//
// sub_1006FAA10 from 0x1006faa10 to 0x1006fac14 (516 bytes)
//
// 2 xrefs:
// > ??> @ 0x1009beb00
// > ??> @ 0x1009bebd0
//
// 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:45 +0000
//
__int64 __fastcall sub_1006FAA10(__int64 a1, int a2)
{
int *v3; // x24
__int64 v4; // x20
_BYTE *v5; // x21
int v6; // w0
int v7; // w8
unsigned __int64 v8; // x22
int v9; // w25
__int64 v10; // x23
__int64 v11; // x0
_QWORD *v12; // x20
int v13; // w8
__int64 v14; // x0
__int64 v15; // x0
__int64 v16; // x22
int v17; // w8
int v18; // w0
_QWORD *v19; // x21
_BYTE v21[24]; // [xsp+18h] [xbp-58h] BYREF
v3 = *(int **)(a1 + 40);
switch ( v3[6] )
{
case 0:
if ( *(_QWORD *)(a1 + 56) )
{
v5 = v21;
sub_100713384(v21, a1);
}
else
{
v5 = nullptr;
}
v7 = v3[2];
if ( v7 )
{
if ( v7 <= 2 )
{
v8 = *v3;
v9 = v3[3];
v10 = *((_QWORD *)v3 + 2);
v11 = sub_1006F4B10();
v12 = (_QWORD *)v11;
if ( v11 )
{
if ( (int)v8 <= 2047 )
v13 = 160;
else
v13 = 256;
if ( v9 == -1 )
v9 = v13;
if ( !v10 )
{
if ( (int)v8 < 2048 )
v14 = sub_10070F06C(v11);
else
v14 = sub_10070F084(v11);
v10 = v14;
}
v17 = v3[2];
if ( v17 == 2 )
{
v18 = sub_1006F3FE4((__int64)v12, v8, v9, v10, nullptr, 0, -1, nullptr, nullptr, nullptr, (__int64)v5);
}
else
{
if ( v17 != 1 )
goto LABEL_36;
v18 = sub_1006F3514(v12, v8, v9, v10, 0, 0, nullptr, nullptr, nullptr, (__int64)v5);
}
if ( v18 > 0 )
{
v19 = sub_1006F4E2C(v12);
sub_1006F4CA8((__int64)v12);
if ( v19 )
{
v6 = a2;
goto LABEL_10;
}
return 0;
}
LABEL_36:
sub_1006F4CA8((__int64)v12);
}
}
}
else
{
v15 = sub_1006F8CC0();
v16 = v15;
if ( v15 )
{
v4 = sub_1006F85AC(v15, (unsigned int)*v3, (unsigned int)v3[1], (__int64)v5);
if ( (_DWORD)v4 )
{
sub_10070F95C(a2);
return v4;
}
sub_1006F8E54(v16);
}
}
return 0;
case 1:
sub_1006FB16C();
goto LABEL_9;
case 2:
sub_1006FB1E8();
goto LABEL_9;
case 3:
sub_1006FB264();
LABEL_9:
v6 = a2;
LABEL_10:
sub_10070F95C(v6);
return 1;
default:
return 4294967294LL;
}
}