//
// BN_bn2lebinpad from 0xd7a804 to 0xd7a8d0 (204 bytes)
//
// 1 xrefs:
// > ??> @ 0x5aba0
//
// 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 BN_bn2lebinpad(_QWORD *a1, __int64 a2, int a3)
{
int v5; // w0
int v6; // w3
int v7; // w22
__int64 v8; // x1
int v9; // w3
int v10; // w6
unsigned int v11; // w4
char v12; // w5
v5 = BN_num_bits((__int64)a1);
v6 = v5 + 14;
if ( v5 + 7 >= 0 )
v6 = v5 + 7;
v7 = v6 >> 3;
if ( v6 >> 3 > a3 )
return 0xFFFFFFFFLL;
if ( v7 < a3 )
memset((void *)(a2 + v7), 0, a3 - v7);
v8 = a2 + v7;
v9 = v7 - 1;
if ( v7 )
{
do
{
v10 = v9 + 7;
if ( v9 >= 0 )
v10 = v9;
v11 = (unsigned int)(v9 >> 31) >> 29;
v12 = (v9-- + v11) & 7;
*(_BYTE *)--v8 = *(_QWORD *)(*a1 + 8LL * (v10 >> 3)) >> (8 * (v12 - (unsigned __int8)v11));
}
while ( v9 != -1 );
}
return (unsigned int)a3;
}