//
// sub_F03D8 from 0xf03d8 to 0xf05b8 (480 bytes)
//
// 1 xrefs:
// > sub_F2CAC @ 0xf2cb4
//
// 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_F03D8(__int64 result, __int64 a2)
{
__int64 v3; // x20
unsigned int v4; // w21
int v5; // w8
int v6; // w27
int v7; // w26
__int64 v8; // x9
int v9; // w8
__int64 v10; // x0
int v11; // w21
int i; // w28
int v13; // w8
__int64 v14; // x8
int v15; // [xsp+8h] [xbp-58h] BYREF
int v16; // [xsp+Ch] [xbp-54h] BYREF
v3 = result;
v4 = 0;
LABEL_2:
v5 = 1;
while ( 1 )
{
v6 = 0;
v7 = v5;
while ( 1 )
{
if ( v4 > 3 )
{
**(_DWORD **)a2 = 1;
return 1;
}
v8 = *(_QWORD *)(a2 + 8);
if ( *(_DWORD *)(v8 + 3976) )
{
v9 = *(unsigned __int8 *)(v8 + 4038);
v15 = v9;
*(_DWORD *)(v8 + 3976) = 0;
}
else
{
result = sub_F2CE8(result, *(_QWORD *)(v8 + 120), &v15, 8);
if ( !(_DWORD)result )
return result;
v9 = v15;
}
if ( v9 == (unsigned __int8)aFlac[v4] )
{
++v4;
goto LABEL_2;
}
if ( v9 != byte_4EB54[v6] )
break;
++v6;
v4 = 0;
if ( v6 == 3 )
{
v10 = sub_F2B90(v3, a2, &v16, 24);
if ( !(_DWORD)v10 )
return 0;
v11 = 0;
for ( i = 4; i; --i )
{
v10 = sub_F2CE8(v10, *(_QWORD *)(*(_QWORD *)(a2 + 8) + 120LL), &v16, 8);
if ( !(_DWORD)v10 )
return 0;
v11 = v16 & 0x7F | (v11 << 7);
}
v13 = sub_F2CD0();
v4 = 0;
result = 0;
if ( !v13 )
return result;
}
}
if ( v9 == 255 )
break;
LABEL_24:
v4 = 0;
v5 = 0;
if ( v7 )
{
result = sub_F2CF0();
v4 = 0;
v5 = 0;
}
}
*(_BYTE *)(*(_QWORD *)(a2 + 8) + 4036LL) = -1;
result = sub_F2B90(v3, a2, &v15, 8);
if ( !(_DWORD)result )
return result;
if ( v15 == 255 )
{
v14 = *(_QWORD *)(a2 + 8);
*(_BYTE *)(v14 + 4038) = -1;
*(_DWORD *)(v14 + 3976) = 1;
goto LABEL_24;
}
if ( (v15 & 0xFFFFFFFC) != 0xF8 )
goto LABEL_24;
*(_BYTE *)(*(_QWORD *)(a2 + 8) + 4037LL) = v15;
**(_DWORD **)a2 = 3;
return 1;
}