//
// FMODAudioEngine::stopAndRemoveMusic from 0x6d7ff4 to 0x6d80cc (216 bytes)
//
// 3 xrefs:
// > FMODAudioEngine::stopMusic @ 0x6d80cc
// > FMODAudioEngine::preloadMusic @ 0x6d813c
// > ??> @ 0xde748
//
// 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:31 +0000
//
__int64 *__fastcall FMODAudioEngine::stopAndRemoveMusic(FMODAudioEngine *this, int a2)
{
__int64 *v2; // x20
__int64 *result; // x0
int *v5; // x0
FMOD::ChannelControl *v6; // x0
__int64 v7; // x1
_QWORD *v8; // x2
__int64 v9; // x1
int v10; // [xsp+3Ch] [xbp+3Ch] BYREF
v2 = (__int64 *)((char *)this + 320);
v10 = a2;
result = std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 40,
&v10);
if ( result )
{
v5 = (int *)std::unordered_map::operator[]((__int64)v2, &v10);
v6 = (FMOD::ChannelControl *)FMODAudioEngine::channelForChannelID(this, *v5);
if ( v6 )
{
return (__int64 *)FMOD::ChannelControl::stop(v6);
}
else
{
if ( *(_QWORD *)(std::unordered_map::operator[]((__int64)v2, &v10) + 8) )
{
v7 = std::unordered_map::operator[]((__int64)v2, &v10);
v8 = *((_QWORD **)this + 150);
if ( v8 == *((_QWORD **)this + 151) )
{
std::vector::__push_back_slow_path(
(__int64)this + 1192,
(_QWORD *)(v7 + 8));
}
else
{
v9 = *(_QWORD *)(v7 + 8);
if ( v8 )
{
*v8 = v9;
v8 = *((_QWORD **)this + 150);
}
*((_QWORD *)this + 150) = v8 + 1;
}
}
return (__int64 *)std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
v2,
&v10);
}
}
return result;
}