//
// sub_D709B8 from 0xd709b8 to 0xd70a98 (224 bytes)
//
// 1 xrefs:
// > ??> @ 0x1238930
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_D709B8(__int64 *a1, _BYTE *a2, __int64 a3, __int64 a4)
{
__int64 v4; // x20
unsigned __int64 v5; // x19
int v6; // w0
_BYTE *v7; // x1
int v8; // w4
int v9; // w0
int v10; // w6
_BYTE *v11; // x2
_BYTE *v12; // x1
int v14; // w2
_BYTE *v15; // x2
_BYTE *v16; // x1
v4 = *a1;
if ( *a1 != *(_QWORD *)(a4 + 40) )
{
v5 = v4 ^ (v4 >> 63);
v6 = BN_num_bits_word(v5);
v7 = a2;
if ( (v6 & 7) != 0 )
{
v14 = v6 + 7;
v9 = 0;
v8 = v14 >> 3;
if ( a2 )
{
LABEL_5:
v10 = v8 - 1;
if ( v8 - 1 >= 0 )
{
if ( v4 < 0 )
{
v15 = &v7[v10];
v16 = &v7[v10 - 1LL - (unsigned int)v10];
do
{
*v15-- = ~(_BYTE)v5;
v5 >>= 8;
}
while ( v15 != v16 );
}
else
{
v11 = &v7[v10];
v12 = &v7[v10 - 1LL - (unsigned int)v10];
do
{
*v11-- = v5;
v5 >>= 8;
}
while ( v11 != v12 );
}
}
}
}
else
{
v8 = (v6 + 7) >> 3;
v9 = 1;
if ( a2 )
{
v7 = a2 + 1;
v9 = 1;
*a2 = v4 >> 63;
goto LABEL_5;
}
}
return (unsigned int)(v8 + v9);
}
return 0xFFFFFFFFLL;
}