//
// sub_1004CF54C from 0x1004cf54c to 0x1004cf638 (236 bytes)
//
// 6 xrefs:
// > sub_10043D6E0 @ 0x10043d75c
// > sub_100441820 @ 0x100441888
// > sub_100442E2C @ 0x100442fdc
// > FMOD::System::recordStop @ 0x1004cd6f4
// > sub_1004CEE58 @ 0x1004cef08
// > sub_1004D47F4 @ 0x1004d4898
//
// 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_1004CF54C(__int64 a1, unsigned int a2)
{
__int64 v4; // x20
__int64 v5; // x21
v4 = sub_1004D41B4(a1);
if ( !(_DWORD)v4 )
{
if ( (a2 & 0x80000000) != 0 || *(_DWORD *)(a1 + 1684) <= (signed int)a2 )
{
return 31;
}
else if ( *(_QWORD *)(*(_QWORD *)(a1 + 1696) + 56LL * a2 + 48) )
{
sub_100442B5C(a1, 0x11u);
v4 = sub_1004B695C(*(_QWORD *)(a1 + 1648), *(_QWORD **)(*(_QWORD *)(a1 + 1696) + 56LL * a2 + 48));
if ( !(_DWORD)v4 )
{
v5 = 56LL * a2;
sub_1004B1970(*((_QWORD *)off_1008524C8 + 54), *(int **)(*(_QWORD *)(a1 + 1696) + v5 + 48));
*(_QWORD *)(*(_QWORD *)(a1 + 1696) + v5 + 48) = 0;
}
sub_100442B7C(a1, 0x11u);
}
else
{
return 0;
}
}
return v4;
}