//
// sub_1004A7688 from 0x1004a7688 to 0x1004a7754 (204 bytes)
//
// 5 xrefs:
// > sub_1004571E0 @ 0x1004572fc
// > sub_1004571E0 @ 0x1004573c8
// > sub_1004571E0 @ 0x1004573ec
// > sub_10045C264 @ 0x10045c310
// > FMOD::DSP::disconnectAll @ 0x100484da4
//
// 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_1004A7688(__int64 a1, char a2, int a3)
{
char v3; // w19
__int64 result; // x0
unsigned int *v7; // x22
__int16 v8; // w8
unsigned int v9; // w8
int *v10; // x1
int *v11; // [xsp+8h] [xbp-28h] BYREF
v3 = a3;
if ( (a2 & 1) == 0 && !a3 )
return 0;
v7 = (unsigned int *)(a1 + 100);
v8 = atomic_load((unsigned int *)(a1 + 100));
if ( (v8 & 0x100) != 0 )
return sub_1004A7494(a1, a2, a3, 0, 0);
result = sub_10043E710(*(_QWORD *)(a1 + 168), &v11, 24, 1);
if ( !(_DWORD)result )
{
do
v9 = __ldaxr(v7);
while ( __stlxr(v9 | 0x1000, v7) );
*(_BYTE *)v11 = 5;
v10 = v11;
*((_QWORD *)v11 + 1) = a1;
*((_BYTE *)v10 + 16) = a2;
*((_BYTE *)v10 + 17) = v3;
*((_BYTE *)v10 + 18) = 0;
return sub_10043E7B4(*(_QWORD *)(a1 + 168), (__int64)v10, 1);
}
return result;
}