//
// BN_bn2lebinpad from 0x9e92ec to 0x9e9398 (172 bytes)
//
// 1 xrefs:
// > ??> @ 0x795dc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:25 +0000
//
int __fastcall BN_bn2lebinpad(_DWORD *a1, int a2, int a3)
{
int v6; // r0
int v7; // r3
int v8; // r6
char *v9; // r1
int v10; // r3
unsigned int v11; // r2
int v12; // lr
char v13; // r12
char *v15; // r7
v6 = BN_num_bits(a1);
v7 = v6 + 7;
if ( v6 + 7 < 0 )
v7 = v6 + 14;
v8 = v7 >> 3;
if ( v7 >> 3 > a3 )
return -1;
if ( v7 >> 3 < a3 )
{
v15 = (char *)(a2 + v8);
memset(v15, 0, a3 - v8);
v9 = v15;
}
else
{
v9 = (char *)(a2 + v8);
}
v10 = v8 - 1;
if ( v8 )
{
do
{
v11 = (unsigned int)(v10 >> 31) >> 30;
v12 = v10 + 3;
v13 = v10 + v11;
if ( v10 >= 0 )
v12 = v10;
--v10;
*--v9 = *(_DWORD *)(*a1 + 4 * (v12 >> 2)) >> (8 * ((v13 & 3) - v11));
}
while ( v10 != -1 );
}
return a3;
}