//
// sub_2FE390 from 0x2fe390 to 0x2fe426 (150 bytes)
//
// 4 xrefs:
// > FMODAudioEngine::unregisterChannel @ 0x3051e6
// > FMODAudioEngine::unregisterChannel @ 0x3051f0
// > FMODAudioEngine::playEffectAdvanced @ 0x305640
// > FMODAudioEngine::playEffectAdvanced @ 0x30564a
//
// 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
//
void **__fastcall sub_2FE390(int *a1, _DWORD *a2)
{
unsigned int v2; // r9
int v4; // r6
void **result; // r0
int v6; // r8
void **v7; // r7
_DWORD *v8; // r10
int v9; // r1
int v10; // r2
int v11; // r1
v2 = a1[1];
v4 = *a2 % v2;
result = (void **)sub_2FE352(a1, v4, a2);
if ( result )
{
v6 = *a1;
v7 = (void **)*result;
if ( result != *(void ***)(*a1 + 4 * v4) )
{
if ( *v7 )
{
v11 = *((_DWORD *)*v7 + 1) % v2;
if ( v11 != v4 )
*(_DWORD *)(v6 + 4 * v11) = result;
}
goto LABEL_12;
}
v8 = *v7;
if ( *v7 )
{
v9 = v8[1] % v2;
if ( v9 == v4 )
{
LABEL_12:
*result = *v7;
operator delete(v7);
--a1[3];
return (void **)(&dword_0 + 1);
}
*(_DWORD *)(v6 + 4 * v9) = result;
}
v10 = *a1;
if ( *(int **)(*a1 + 4 * v4) == a1 + 2 )
a1[2] = (int)v8;
*(_DWORD *)(v10 + 4 * v4) = 0;
goto LABEL_12;
}
return result;
}