//
// FMOD_System_Create from 0x50278 to 0x5036c (244 bytes)
//
// 4 xrefs:
// > .FMOD_System_Create @ 0x1081bc
// > ??> @ 0x1318
// > .FMOD_System_Create @ 0x1081b4
// > ??> @ 0x1109a0
//
// 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 FMOD_System_Create(__int64 *a1, unsigned int a2)
{
__int64 v3; // x0
__int64 v4; // x19
__int64 i; // x20
__int64 result; // x0
if ( a2 >> 8 != 514 )
return 20;
if ( !a1 )
return 31;
v3 = sub_E2AC4(*(__int64 *)((char *)&qword_1B0 + (_QWORD)off_114000), 74080, "../../src/fmod.cpp", 145, 0);
if ( v3 )
{
v4 = v3;
sub_6B00C();
*a1 = v4;
for ( i = 46; ; ++i )
{
if ( i == 54 )
{
sub_E2D74(*(__int64 *)((char *)&qword_1B0 + (_QWORD)off_114000), v4, "../../src/fmod.cpp", 163, 1);
return 38;
}
if ( !*((_QWORD *)off_114000 + i) )
break;
}
result = sub_5F3C0();
if ( !(_DWORD)result )
{
*((_QWORD *)off_114000 + i) = v4;
*(_DWORD *)(*((_QWORD *)off_114000 + i) + 69816LL) = i - 46;
}
}
else
{
*a1 = 0;
return 38;
}
return result;
}