//
// sub_1006F54BC from 0x1006f54bc to 0x1006f5740 (644 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009e7dc0
//
// 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 11:12:42 +0000
//
__int64 __fastcall sub_1006F54BC(__int64 a1, __int64 *a2, __int64 *a3, __int64 *a4)
{
__int64 *v8; // x20
_BYTE *v9; // x23
int v10; // w8
__int64 *v11; // x25
int v12; // w26
__int64 v13; // x21
__int64 (__fastcall *v14)(__int64, _BYTE *, _QWORD, __int64 *, _QWORD, __int64 *, _QWORD); // x8
int v15; // w0
unsigned __int64 v16; // x24
_QWORD v18[3]; // [xsp+0h] [xbp-70h] BYREF
__int64 v19; // [xsp+18h] [xbp-58h] BYREF
int v20; // [xsp+20h] [xbp-50h]
int v21; // [xsp+2Ch] [xbp-44h]
if ( !*(_QWORD *)(a1 + 24) || !*(_QWORD *)(a1 + 32) || !*(_QWORD *)(a1 + 40) )
{
sub_100706FB0(10, 107, 101, "dsa_ossl.c", 230);
return 0;
}
sub_1006D0E90(&v19);
sub_1006D0E90(v18);
v8 = a2;
if ( a2 || (v8 = (__int64 *)sub_1006D1C30()) != nullptr )
{
v9 = sub_1006D0E9C();
if ( v9 )
{
do
{
if ( !(unsigned int)sub_1006D4140((__int64)&v19, *(_QWORD *)(a1 + 32)) )
goto LABEL_35;
}
while ( !v20 );
v10 = *(_DWORD *)(a1 + 80);
if ( (v10 & 2) == 0 )
v21 |= 4u;
if ( (v10 & 1) != 0 )
{
if ( !sub_1006D9C50((__int64 *)(a1 + 88), 8, *(_QWORD *)(a1 + 24), v8) )
{
LABEL_35:
sub_100706FB0(10, 107, 3, "dsa_ossl.c", 304);
sub_1006D0DC4((__int64)v9);
goto LABEL_36;
}
v10 = *(_DWORD *)(a1 + 80);
}
if ( (v10 & 2) != 0 )
{
v11 = &v19;
}
else
{
if ( !sub_1006D1164((__int64)v18, (__int64)&v19) )
goto LABEL_35;
if ( !(unsigned int)sub_1006CE958((__int64)v18, (__int64)v18, *(_QWORD *)(a1 + 32)) )
goto LABEL_35;
v11 = v18;
v12 = sub_1006D0D88((__int64)v18);
if ( v12 <= (int)sub_1006D0D88(*(_QWORD *)(a1 + 32)) )
{
v11 = v18;
if ( !(unsigned int)sub_1006CE958((__int64)v18, (__int64)v18, *(_QWORD *)(a1 + 32)) )
goto LABEL_35;
}
}
v14 = *(__int64 (__fastcall **)(__int64, _BYTE *, _QWORD, __int64 *, _QWORD, __int64 *, _QWORD))(*(_QWORD *)(a1 + 120) + 40LL);
if ( v14 )
v15 = v14(a1, v9, *(_QWORD *)(a1 + 40), v11, *(_QWORD *)(a1 + 24), v8, *(_QWORD *)(a1 + 88));
else
v15 = sub_1006CF8D4(
(__int64)v9,
*(_QWORD *)(a1 + 40),
(__int64)v11,
*(_QWORD *)(a1 + 24),
(__int64)v8,
*(_QWORD *)(a1 + 88));
if ( !v15 )
goto LABEL_35;
if ( !(unsigned int)sub_1006CEE1C(0, (__int64)v9, (__int64)v9, *(_QWORD *)(a1 + 32), (__int64)v8) )
goto LABEL_35;
v16 = sub_1006D5E24(0, (__int64)&v19, *(_QWORD *)(a1 + 32), v8);
if ( !v16 )
goto LABEL_35;
if ( *a3 )
sub_1006D0DC4(*a3);
*a3 = v16;
if ( *a4 )
sub_1006D0DC4(*a4);
*a4 = (__int64)v9;
v13 = 1;
goto LABEL_37;
}
}
else
{
v8 = nullptr;
}
sub_100706FB0(10, 107, 3, "dsa_ossl.c", 304);
LABEL_36:
v13 = 0;
LABEL_37:
if ( !a2 )
sub_1006D1C94((void **)v8);
sub_1006D0DC4((__int64)&v19);
sub_1006D0DC4((__int64)v18);
return v13;
}