//
// sub_59520 from 0x59520 to 0x595be (158 bytes)
//
// 2 xrefs:
// > sub_58CA8 @ 0x590f4
// > FMOD::System::createSoundGroup @ 0xb979c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:40:47 +0000
//
int __fastcall sub_59520(int a1, int a2, _DWORD *a3)
{
_DWORD *v6; // r0
_DWORD *v7; // r6
int v8; // r1
int v9; // r0
int v10; // r5
int v12; // [sp+8h] [bp-20h] BYREF
_DWORD *v13; // [sp+Ch] [bp-1Ch]
v12 = *(int *)((char *)&dword_10C + (_DWORD)off_E8000);
v13 = nullptr;
if ( !a3 )
{
v10 = 31;
goto LABEL_9;
}
v6 = (_DWORD *)sub_BD580(*(int *)((char *)&dword_14C + (_DWORD)off_E8000), 72, "../../src/fmod_systemi.cpp", 4469, 0);
if ( v6 )
{
v7 = v6;
sub_54A04(v6);
j_FMOD_OS_CriticalSection_Enter(*(int *)((char *)&dword_10C + (_DWORD)off_E8000));
v8 = *(_DWORD *)(a1 + 68916);
*v7 = v8;
v7[1] = a1 + 68916;
*(_DWORD *)(v8 + 4) = v7;
*(_DWORD *)v7[1] = v7;
v7[3] = a1;
j_FMOD_OS_CriticalSection_Leave(*(int *)((char *)&dword_10C + (_DWORD)off_E8000));
v13 = v7;
if ( a2 )
{
v9 = sub_BE3B8(a2);
v7[12] = v9;
if ( !v9 )
goto LABEL_5;
}
else
{
v7[12] = 0;
}
v10 = 0;
v13 = nullptr;
*a3 = v7;
goto LABEL_9;
}
LABEL_5:
v10 = 38;
LABEL_9:
sub_5A3E4(&v12);
return v10;
}