//
// sub_1006F73D0 from 0x1006f73d0 to 0x1006f7874 (1188 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009e7e18
//
// 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:43 +0000
//
__int64 **__fastcall sub_1006F73D0(unsigned __int8 *a1, int a2, __int64 *a3, __int64 a4, __int64 a5)
{
__int64 v10; // x19
__int64 v11; // x23
__int64 v12; // x0
__int64 *v13; // x25
bool v14; // zf
__int64 v15; // x0
__int64 **v16; // x19
__int64 v17; // x20
__int64 *v18; // x21
__int64 *v19; // x20
int v20; // w0
int v21; // w23
int v22; // w9
int v23; // w9
__int64 v24; // x24
__int64 v25; // x22
__int64 v26; // x2
__int64 v27; // x4
__int64 *v28; // x22
__int64 v29; // x2
__int64 v30; // x4
__int64 v32; // x2
__int64 v33; // x4
__int64 *v34; // [xsp+0h] [xbp-70h]
__int64 *v35; // [xsp+8h] [xbp-68h]
__int64 v36; // [xsp+10h] [xbp-60h]
__int64 *v37; // [xsp+18h] [xbp-58h] BYREF
v37 = nullptr;
v10 = sub_1006F70D0(a5);
v11 = sub_1006E5C44(a5);
v12 = sub_1006E5C8C(a5);
v13 = (__int64 *)v12;
if ( !v10 || (v11 ? (v14 = v12 == 0) : (v14 = 1), v14) )
{
v26 = 67;
v27 = 253;
LABEL_31:
sub_100706FB0(42, 101, v26, "ecs_ossl.c", v27);
return nullptr;
}
v15 = sub_1006F73AC();
v16 = (__int64 **)v15;
if ( !v15 )
{
v26 = 65;
v27 = 259;
goto LABEL_31;
}
v17 = *(_QWORD *)(v15 + 8);
v18 = (__int64 *)sub_1006D1C30();
if ( !v18 || (v36 = v17, (v19 = (__int64 *)sub_1006D0E9C()) == nullptr) )
{
v24 = 0;
v19 = nullptr;
LABEL_41:
sub_100706FB0(42, 101, 65, "ecs_ossl.c", 266);
v25 = 0;
LABEL_42:
sub_1006F73B8((__int64)v16);
v16 = nullptr;
goto LABEL_43;
}
v34 = (__int64 *)sub_1006D0E9C();
if ( !v34 )
{
v24 = 0;
goto LABEL_41;
}
v35 = (__int64 *)sub_1006D0E9C();
if ( !v35 )
{
v24 = (__int64)v34;
goto LABEL_41;
}
if ( !sub_1006DDD4C(v11, (__int64)v19) )
{
v32 = 16;
v33 = 271;
LABEL_56:
sub_100706FB0(42, 101, v32, "ecs_ossl.c", v33);
v24 = (__int64)v34;
LABEL_70:
v25 = (__int64)v35;
goto LABEL_42;
}
v20 = sub_1006D0D88((__int64)v19);
v21 = v20;
v22 = v20 + 7;
if ( v20 + 7 < 0 )
v22 = v20 + 14;
v23 = v22 >> 3;
if ( 8 * a2 > v20 )
a2 = v23;
if ( !sub_1006D1318(a1, a2, (__int64)v35) )
{
v32 = 3;
v33 = 281;
goto LABEL_56;
}
v24 = (__int64)v34;
if ( 8 * a2 > v21 && !(unsigned int)sub_1006D46B8((__int64)v35, (__int64)v35, 8 - (v21 & 7u)) )
{
v29 = 3;
v30 = 286;
goto LABEL_69;
}
if ( !a3 || !a4 )
{
while ( 1 )
{
if ( !(unsigned int)sub_1006F81F8(a5, v18, &v37, v16) )
{
v29 = 42;
v30 = 292;
goto LABEL_69;
}
v28 = v37;
if ( !sub_1006D3430((__int64)v34, v13, *v16, (__int64)v19, v18) )
goto LABEL_64;
if ( !(unsigned int)sub_1006D32DC((__int64 *)v36, v34, v35, v19) )
goto LABEL_65;
if ( !sub_1006D3430(v36, (__int64 *)v36, v28, (__int64)v19, v18) )
goto LABEL_66;
if ( *(_DWORD *)(v36 + 8) )
break;
if ( a3 != nullptr && a4 != 0 )
goto LABEL_39;
}
v25 = (__int64)v35;
goto LABEL_43;
}
if ( a3 == nullptr || a4 == 0 )
{
while ( sub_1006D1164((__int64)*v16, a4) )
{
if ( !sub_1006D3430((__int64)v34, v13, *v16, (__int64)v19, v18) )
goto LABEL_64;
if ( !(unsigned int)sub_1006D32DC((__int64 *)v36, v34, v35, v19) )
goto LABEL_65;
if ( !sub_1006D3430(v36, (__int64 *)v36, a3, (__int64)v19, v18) )
goto LABEL_66;
if ( *(_DWORD *)(v36 + 8) )
{
v25 = (__int64)v35;
goto LABEL_43;
}
}
goto LABEL_67;
}
if ( !sub_1006D1164((__int64)*v16, a4) )
{
LABEL_67:
v29 = 65;
v30 = 299;
goto LABEL_69;
}
if ( !sub_1006D3430((__int64)v34, v13, *v16, (__int64)v19, v18) )
{
LABEL_64:
v29 = 3;
v30 = 305;
goto LABEL_69;
}
if ( !(unsigned int)sub_1006D32DC((__int64 *)v36, v34, v35, v19) )
{
LABEL_65:
v29 = 3;
v30 = 309;
goto LABEL_69;
}
if ( !sub_1006D3430(v36, (__int64 *)v36, a3, (__int64)v19, v18) )
{
LABEL_66:
v29 = 3;
v30 = 313;
goto LABEL_69;
}
if ( !*(_DWORD *)(v36 + 8) )
{
LABEL_39:
v29 = 106;
v30 = 323;
LABEL_69:
sub_100706FB0(42, 101, v29, "ecs_ossl.c", v30);
goto LABEL_70;
}
v25 = (__int64)v35;
LABEL_43:
if ( v18 )
sub_1006D1C94((void **)v18);
if ( v25 )
sub_1006D0DC4(v25);
if ( v24 )
sub_1006D0DC4(v24);
if ( v19 )
sub_1006D0E38(v19);
if ( v37 )
sub_1006D0DC4((__int64)v37);
return v16;
}