//
// FMODAudioEngine::releaseRemovedSounds from 0x6cb0b4 to 0x6cb214 (352 bytes)
//
// 2 xrefs:
// > sub_6DC4D0 @ 0x6dc540
// > ??> @ 0x9e650
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:51:23 +0000
//
__int64 __fastcall FMODAudioEngine::releaseRemovedSounds(FMODAudioEngine *this)
{
__int64 v2; // x1
__int64 v3; // x5
int v4; // w20
__int64 v5; // x0
FMOD::Sound *v6; // x25
__int64 v7; // x24
__int64 v8; // x2
__int64 v9; // x24
__int64 v10; // x25
__int64 v11; // x24
__int64 v12; // x0
void *v14; // x0
const void *v15; // x1
size_t v16; // x2
int v17; // [xsp+54h] [xbp+54h]
v2 = *((_QWORD *)this + 149);
if ( (*((_QWORD *)this + 150) - v2) >> 3 )
{
v3 = 0;
v4 = 0;
while ( 1 )
{
while ( 1 )
{
v6 = *(FMOD::Sound **)(v2 + 8 * v3);
v7 = 8 * v3;
*((_DWORD *)this + 134) = FMOD::Sound::getOpenState();
ERRCHECK_fn();
if ( (v17 & 0xFFFFFFFD) == 0 )
break;
v5 = *((_QWORD *)this + 150);
++v4;
v2 = *((_QWORD *)this + 149);
LABEL_4:
v3 = v4;
if ( v4 >= (unsigned __int64)((v5 - v2) >> 3) )
return _stack_chk_guard;
}
FMOD::Sound::release(v6);
v2 = *((_QWORD *)this + 149);
v8 = *((_QWORD *)this + 150);
v9 = v2 + v7;
v10 = v8 - (v9 + 8);
if ( v10 >> 3 )
break;
v11 = v8 - 8;
if ( v8 - 8 == v8 )
goto LABEL_11;
LABEL_8:
v3 = v4;
v12 = v8 + 8 * ~((unsigned __int64)(v8 - 8 - v11) >> 3);
*((_QWORD *)this + 150) = v12;
if ( v4 >= (unsigned __int64)((v12 - v2) >> 3) )
return _stack_chk_guard;
}
v14 = (void *)v9;
v15 = (const void *)(v9 + 8);
v16 = v8 - (v9 + 8);
v11 = v9 + v10;
memmove(v14, v15, v16);
v8 = *((_QWORD *)this + 150);
v2 = *((_QWORD *)this + 149);
if ( v11 != v8 )
goto LABEL_8;
LABEL_11:
v5 = v8;
goto LABEL_4;
}
return _stack_chk_guard;
}