//
// BN_lebin2bn from 0xff9728 to 0xff985c (308 bytes)
//
// 1 xrefs:
// > ??> @ 0xdeaf0
//
// 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:50 +0000
//
unsigned __int64 *__fastcall BN_lebin2bn(__int64 a1, int a2, __int64 a3)
{
__int64 v4; // x24
__int64 v5; // x19
unsigned __int64 *v6; // x23
unsigned int v8; // w20
unsigned int v9; // w22
int v10; // w21
__int64 v11; // x3
unsigned __int64 v12; // x4
unsigned int v13; // t1
__int64 v14; // x0
__int64 v15; // [xsp+48h] [xbp+48h]
int v16; // [xsp+48h] [xbp+48h]
v4 = 0;
if ( !a3 )
{
v16 = a2;
v14 = BN_new();
v4 = v14;
if ( !v14 )
return nullptr;
a3 = v14;
a2 = v16;
}
v5 = a1 + a2;
if ( a2 > 0 )
{
while ( !*(_BYTE *)(v5 - 1) )
{
--a2;
--v5;
if ( !a2 )
goto LABEL_5;
}
}
if ( !a2 )
{
LABEL_5:
*(_DWORD *)(a3 + 8) = 0;
return (unsigned __int64 *)a3;
}
v8 = a2 - 1;
v15 = a3;
v9 = ((unsigned int)(a2 - 1) >> 3) + 1;
v10 = (a2 - 1) & 7;
v6 = bn_wexpand((unsigned __int64 *)a3, v9);
if ( !v6 )
{
BN_free(v4);
return v6;
}
*(_DWORD *)(v15 + 8) = v9;
*(_DWORD *)(v15 + 16) = 0;
v11 = v5 + ~(unsigned __int64)v8;
v12 = 0;
do
{
while ( 1 )
{
v13 = *(unsigned __int8 *)--v5;
v12 = v13 | (v12 << 8);
if ( !v10 )
break;
--v10;
if ( v5 == v11 )
goto LABEL_13;
}
--v9;
v10 = 7;
*(_QWORD *)(*(_QWORD *)v15 + 8LL * v9) = v12;
v12 = 0;
}
while ( v5 != v11 );
LABEL_13:
bn_correct_top(v15);
return (unsigned __int64 *)v15;
}