//
// sub_1004938 from 0x1004938 to 0x1004c08 (720 bytes)
//
// 2 xrefs:
// > ??> @ 0x13ffc10
// > ??> @ 0x13ffce8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:55 +0000
//
__int64 __fastcall sub_1004938(__int64 a1, __int64 a2, int a3)
{
__int64 v5; // x19
__int64 v6; // x20
int v7; // w0
unsigned int v8; // w23
__int64 v9; // x2
__int64 v11; // x2
__int64 v12; // x2
__int64 v13; // x20
const char *v14; // x3
int v15; // w2
int v16; // w0
__int64 v17; // x2
v5 = *(_QWORD *)(a2 + 32);
v6 = *(_QWORD *)(v5 + 32);
if ( *(_QWORD *)(v5 + 8) && v6 )
{
BIO_indent(a1, a3, 128);
v7 = BN_num_bits(*(_QWORD *)(v5 + 8));
if ( (int)BIO_printf(a1, "%s: (%d bit)\n", "DH Public-Key", v7) > 0 )
{
v8 = a3 + 4;
if ( (unsigned int)ASN1_bn_print(a1, "private-key:", 0, 0, (unsigned int)(a3 + 4)) )
{
if ( (unsigned int)ASN1_bn_print(a1, "public-key:", v6, 0, v8) )
{
if ( (unsigned int)ASN1_bn_print(a1, "prime:", *(_QWORD *)(v5 + 8), 0, v8) )
{
if ( (unsigned int)ASN1_bn_print(a1, "generator:", *(_QWORD *)(v5 + 16), 0, v8) )
{
v11 = *(_QWORD *)(v5 + 64);
if ( !v11 || (unsigned int)ASN1_bn_print(a1, "subgroup order:", v11, 0, v8) )
{
v12 = *(_QWORD *)(v5 + 72);
if ( !v12 || (unsigned int)ASN1_bn_print(a1, "subgroup factor:", v12, 0, v8) )
{
if ( *(_QWORD *)(v5 + 80) )
{
BIO_indent(a1, v8, 128);
v13 = 0;
BIO_puts(a1, (__int64)"seed:");
while ( 1 )
{
v16 = *(_DWORD *)(v5 + 88);
if ( (int)v13 >= v16 )
break;
if ( 15 * ((int)v13 / 15) == (_DWORD)v13 )
{
if ( (int)BIO_puts(a1, (__int64)&byte_11AAA48) <= 0
|| !(unsigned int)BIO_indent(a1, a3 + 8, 128) )
{
goto LABEL_5;
}
v16 = *(_DWORD *)(v5 + 88);
}
if ( (_DWORD)v13 + 1 == v16 )
v14 = &byte_11B8890;
else
v14 = ":";
v15 = *(unsigned __int8 *)(*(_QWORD *)(v5 + 80) + v13++);
if ( (int)BIO_printf(a1, "%02x%s", v15, v14) <= 0 )
goto LABEL_5;
}
if ( (int)BIO_write(a1, (__int64)&byte_11AAA48, 1u) <= 0 )
return 0;
}
v17 = *(_QWORD *)(v5 + 96);
if ( !v17 || (unsigned int)ASN1_bn_print(a1, "counter:", v17, 0, v8) )
{
if ( !*(_QWORD *)(v5 + 24) )
return 1;
BIO_indent(a1, v8, 128);
if ( (int)BIO_printf(a1, "recommended-private-length: %d bits\n", *(_DWORD *)(v5 + 24)) > 0 )
return 1;
}
}
}
}
}
}
}
}
LABEL_5:
v9 = 7;
}
else
{
v9 = 67;
}
ERR_put_error(5, 100, v9, "crypto/dh/dh_ameth.c", 343);
return 0;
}