//
// sub_1004CF638 from 0x1004cf638 to 0x1004cf6f8 (192 bytes)
//
// 2 xrefs:
// > sub_1004B7034 @ 0x1004b75c4
// > sub_1004CEE58 @ 0x1004cf074
//
// 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_1004CF638(__int64 a1, __int64 a2)
{
__int64 v4; // x21
__int64 v5; // x9
int v6; // w8
bool v7; // vf
int v8; // w8
__int64 v9; // x20
v4 = a1 + 74056;
if ( a1 )
sub_100442B5C(a1, 0x12u);
v5 = *(int *)(a2 + 32);
v6 = *(_DWORD *)(v4 + 8);
v7 = __OFSUB__(v6, 1);
v8 = v6 - 1;
*(_QWORD *)(*(_QWORD *)v4 + 8 * v5) = *(_QWORD *)(*(_QWORD *)v4 + 8LL * v8);
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)v4 + 8 * v5) + 32LL) = v5;
if ( v8 < 0 == v7 )
*(_DWORD *)(v4 + 8) = v8;
sub_100442B7C(a1, 0x12u);
v9 = FMOD::ExpandingPool::free(a1 + 1824, *(_QWORD *)(a2 + 16), 1u);
if ( !(_DWORD)v9 )
sub_1004B1970(*((_QWORD *)off_1008524C8 + 54), (int *)a2);
return v9;
}