//
// sub_1004FAA00 from 0x1004faa00 to 0x1004faa84 (132 bytes)
//
// 1 xrefs:
// > sub_1004FA84C @ 0x1004fa8d8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_1004FAA00(__int64 a1, int a2, unsigned int **a3, _DWORD *a4)
{
__int64 v4; // x8
_BYTE *v5; // x8
unsigned int *v6; // x8
char v7; // w11
char v8; // t1
unsigned int v10; // t1
unsigned int v11; // w12
unsigned __int64 v12; // x14
int v13; // w13
v4 = *(_QWORD *)(a1 + 384);
if ( v4 )
a2 = *(_DWORD *)(v4 + 4LL * a2);
v5 = (_BYTE *)(*(_QWORD *)(*(_QWORD *)(a1 + 376) + 64LL)
+ *(int *)(*(_QWORD *)(*(_QWORD *)(a1 + 376) + 56LL) + 4LL * a2));
v8 = *v5;
v6 = (unsigned int *)(v5 + 8);
v7 = v8;
do
{
if ( (v7 & 1) == 0 )
break;
v10 = *v6++;
v7 = v10;
v11 = v10 >> 25;
v12 = ((unsigned __int64)v10 >> 1) & 0xFFFFFF;
v13 = 1 << (v10 >> 25);
if ( v10 >> 25 > 0xF || (v13 & 0x8A40) == 0 )
{
v6 = (unsigned int *)((char *)v6 + v12);
}
else
{
if ( a3 )
*a3 = v6;
if ( a4 )
*a4 = v12;
}
}
while ( v11 > 0xF || (v13 & 0x8A40) == 0 );
return 0;
}