//
// sub_F19818 from 0xf19818 to 0xf199f8 (480 bytes)
//
// 4 xrefs:
// > sub_F11F60 @ 0xf1223c
// > sub_F11F60 @ 0xf12258
// > sub_F11F60 @ 0xf12894
// > sub_F11F60 @ 0xf13494
//
// 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:12:33 +0000
//
__int64 __fastcall sub_F19818(_DWORD *a1, __int64 a2, int a3)
{
int v5; // w22
__int64 v6; // x24
size_t v7; // x2
__int64 result; // x0
__int64 v9; // x3
int v10; // w1
int v11; // w1
int v12; // w1
char *v13; // x1
char *v14; // x1
char *v15; // x1
signed int v16; // w1
unsigned int v17; // w2
signed int v18; // w1
unsigned int v19; // w2
_QWORD v20[3]; // [xsp+48h] [xbp+48h] BYREF
if ( a3 < 0 )
{
v5 = a1[810];
v6 = *(_QWORD *)a1;
if ( v5 > 0 )
goto LABEL_3;
LABEL_22:
v7 = 4400;
goto LABEL_4;
}
v5 = a3;
a1[810] = a3;
v6 = *(_QWORD *)a1;
if ( a3 <= 0 )
goto LABEL_22;
LABEL_3:
v7 = 4 * ((1 << v5) + 1100);
LABEL_4:
memset(a1, 0, v7);
a1[810] = v5;
*(_QWORD *)a1 = v6;
sub_F11D54(a2, v20);
LABEL_5:
result = v20[0];
v9 = v20[2];
while ( result )
{
if ( *(_BYTE *)result )
{
if ( *(_BYTE *)result == 1 )
{
++*(_DWORD *)(*(_QWORD *)a1 + 4LL * (*(_DWORD *)(result + 4) + 280));
}
else
{
if ( *(unsigned __int16 *)(result + 2) > 0x1FFu )
{
v18 = *(unsigned __int16 *)(result + 2) - 1;
v19 = __clz(v18) ^ 0x1F;
v10 = ((v18 >> (v19 - 1)) & 1) + 2 * v19;
}
else
{
v10 = byte_11E5760[2 * *(unsigned __int16 *)(result + 2)];
}
++*(_DWORD *)(*(_QWORD *)a1 + 4LL * (v10 + 256));
v11 = *(_DWORD *)(result + 4);
if ( v11 > 511 )
{
v16 = v11 - 1;
v17 = __clz(v16) ^ 0x1F;
v12 = ((v16 >> (v17 - 1)) & 1) + 2 * v17;
}
else
{
v12 = byte_11E5760[2 * v11];
}
++a1[v12 + 770];
}
}
else
{
v13 = (char *)&a1[*(unsigned __int8 *)(result + 7)];
++*((_DWORD *)v13 + 514);
v14 = (char *)&a1[*(unsigned __int8 *)(result + 6)];
++*((_DWORD *)v14 + 2);
++*(_DWORD *)(*(_QWORD *)a1 + 4LL * *(unsigned __int8 *)(result + 5));
v15 = (char *)&a1[*(unsigned __int8 *)(result + 4)];
++*((_DWORD *)v15 + 258);
}
result += 8;
v20[0] = result;
if ( result == v9 )
{
sub_F11D98((__int64)v20);
goto LABEL_5;
}
}
return result;
}