//
// sub_6846C from 0x6846c to 0x684fa (142 bytes)
//
// 0 xrefs:
//
// 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
//
int __fastcall sub_6846C(int a1, int a2)
{
int v4; // r4
int v5; // r9
int j; // r5
int v7; // r6
int i; // r4
int v9; // r0
int v11; // [sp+4h] [bp-24h] BYREF
int v12; // [sp+8h] [bp-20h] BYREF
char v13; // [sp+Ch] [bp-1Ch]
v12 = FMOD::DSPTransceiver::sCriticalSection[0];
j_FMOD_OS_CriticalSection_Enter(FMOD::DSPTransceiver::sCriticalSection[0]);
v13 = 1;
v4 = FMOD::DSPTransceiver::sCriticalSection[*(_DWORD *)(a1 + 28) + 4];
if ( !v4 )
goto LABEL_13;
v5 = 0;
if ( !a2 )
{
v7 = v4 + 56;
for ( i = 0; i != 2432; i += 76 )
{
if ( !*(_DWORD *)(v7 + i) )
{
v11 = 0;
v9 = (*(int (__fastcall **)(int, int *, _DWORD))(*(_DWORD *)(a1 + 24) + 28))(a1, &v11, 0);
if ( v9 )
{
v5 = v9;
goto LABEL_14;
}
*(_DWORD *)(v7 + i) = sub_537B4(v11);
}
}
goto LABEL_13;
}
if ( a2 == 1 )
{
for ( j = 0; j != 2432; j += 76 )
sub_67B0C(v4 + j);
LABEL_13:
v5 = 0;
}
LABEL_14:
sub_44984((int)&v12);
return v5;
}