//
// sub_108F820 from 0x108f820 to 0x108f8a0 (128 bytes)
//
// 2 xrefs:
// > ??> @ 0x1552b10
// > ??> @ 0x1552b50
//
// 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:17:17 +0000
//
__int64 __fastcall sub_108F820(_QWORD **a1, _BYTE *a2)
{
_QWORD *v2; // x19
int v3; // w0
_BYTE *v4; // x1
int v5; // w20
int v6; // w0
int v7; // w1
int v8; // w0
v2 = *a1;
if ( !*a1 )
return 0xFFFFFFFFLL;
v3 = BN_num_bits((__int64)v2) & 7;
v4 = a2;
if ( !v3 )
{
v5 = 1;
if ( !a2 )
goto LABEL_5;
*a2 = 0;
v5 = 1;
v4 = a2 + 1;
goto LABEL_4;
}
v5 = 0;
if ( a2 )
LABEL_4:
BN_bn2bin(v2, v4);
LABEL_5:
v6 = BN_num_bits((__int64)v2);
v7 = v6 + 14;
v8 = v6 + 7;
if ( v8 < 0 )
v8 = v7;
return (unsigned int)(v5 + (v8 >> 3));
}