//
// sub_1005219EC from 0x1005219ec to 0x100521ad4 (232 bytes)
//
// 2 xrefs:
// > sub_10051CF68 @ 0x10051d4d0
// > sub_100537D24 @ 0x100538288
//
// 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_1005219EC(__int64 a1)
{
_BYTE *v2; // x8
if ( *(_DWORD *)(a1 + 72) != 8704 )
return sub_10052C304(a1, 22);
if ( (unsigned int)sub_1005D9E40(*(_QWORD *)(a1 + 80), *(int *)(a1 + 528) + 8LL) )
{
v2 = *(_BYTE **)(*(_QWORD *)(a1 + 80) + 8LL);
*v2 = 22;
v2[1] = (unsigned int)(*(_DWORD *)(a1 + 528) + 4) >> 16;
v2[2] = (unsigned __int16)(*(_WORD *)(a1 + 528) + 4) >> 8;
v2[3] = *(_DWORD *)(a1 + 528) + 4;
v2[4] = *(_DWORD *)(a1 + 492);
v2[5] = *(_WORD *)(a1 + 530);
v2[6] = BYTE1(*(_DWORD *)(a1 + 528));
v2[7] = *(_DWORD *)(a1 + 528);
memcpy(v2 + 8, *(const void **)(a1 + 520), *(int *)(a1 + 528));
*(_DWORD *)(a1 + 96) = *(_DWORD *)(a1 + 528) + 8;
*(_DWORD *)(a1 + 72) = 8705;
*(_DWORD *)(a1 + 100) = 0;
return sub_10052C304(a1, 22);
}
*(_DWORD *)(a1 + 72) = 5;
return 0xFFFFFFFFLL;
}