//
// BN_lebin2bn from 0x9e9d1c to 0x9e9e20 (260 bytes)
//
// 1 xrefs:
// > ??> @ 0x7973c
//
// 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:26 +0000
//
int *__fastcall BN_lebin2bn(int a1, int a2, int *a3)
{
int *v3; // r8
int v6; // r10
int v7; // r4
int v8; // r3
int v10; // r7
int v11; // r5
int v12; // r9
int v13; // r2
int v14; // r6
int v15; // r3
bool v16; // zf
int v17; // r12
int v18; // t1
int v20; // r0
v3 = a3;
if ( a3 )
{
v6 = 0;
}
else
{
v20 = BN_new();
v6 = v20;
if ( !v20 )
return nullptr;
v3 = (int *)v20;
}
v7 = a1 + a2;
if ( a2 > 0 && !*(_BYTE *)(v7 - 1) )
{
v8 = v7 - 1;
while ( 1 )
{
--a2;
v7 = v8;
if ( !a2 )
goto LABEL_21;
if ( *(_BYTE *)--v8 )
goto LABEL_9;
}
}
if ( !a2 )
{
LABEL_21:
v12 = (int)v3;
v3[1] = 0;
return (int *)v12;
}
LABEL_9:
v10 = ((unsigned int)(a2 - 1) >> 2) + 1;
v11 = ((_BYTE)a2 - 1) & 3;
v12 = bn_wexpand((int)v3, v10);
if ( !v12 )
{
BN_free(v6);
return (int *)v12;
}
v13 = 0;
v14 = v7 - a2;
v15 = 0;
v3[1] = v10;
v3[3] = 0;
do
{
v16 = v11 == 0;
v18 = *(unsigned __int8 *)--v7;
v17 = v18;
if ( !v11 )
v13 = *v3;
v15 = v17 | (v15 << 8);
if ( v11 )
{
--v11;
}
else
{
--v10;
*(_DWORD *)(v13 + 4 * v10) = v15;
}
if ( v16 )
{
v15 = v11;
v11 = 3;
}
}
while ( v7 != v14 );
bn_correct_top(v3);
return v3;
}