//
// FMODAudioEngine::swapMusicIndex from 0x6d6484 to 0x6d6968 (1252 bytes)
//
// 2 xrefs:
// > FMODAudioEngine::triggerQueuedMusic @ 0x6d9208
// > ??> @ 0x888a0
//
// 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:30 +0000
//
__int64 __fastcall FMODAudioEngine::swapMusicIndex(FMODAudioEngine *this, int a2, int a3)
{
__int64 *v3; // x24
char *v5; // x23
_BOOL4 v6; // w26
_BOOL4 v7; // w27
char *v8; // x22
_QWORD *v9; // x21
int v10; // w28
int v11; // w23
_DWORD *v12; // x28
int v13; // w22
_DWORD *v14; // x23
__int64 v15; // x21
__int64 v16; // x20
__int64 *v17; // x0
__int64 v18; // x21
__int64 v19; // x1
size_t v20; // x1
char v21; // w2
__int64 v22; // x21
__int64 v23; // x20
const void *v24; // x1
size_t v25; // x2
__int64 v26; // x19
char *v27; // x1
size_t v28; // x2
char v29; // w0
__int64 v31; // x21
__int64 v32; // x19
const void *v33; // x1
size_t v34; // x2
_DWORD *v35; // [xsp+60h] [xbp+60h]
int v36; // [xsp+68h] [xbp+68h] BYREF
int v37[3]; // [xsp+6Ch] [xbp+6Ch] BYREF
int v38; // [xsp+78h] [xbp+78h]
__int64 v39; // [xsp+80h] [xbp+80h]
__int64 v40; // [xsp+88h] [xbp+88h] BYREF
size_t v41; // [xsp+90h] [xbp+90h]
void *v42; // [xsp+98h] [xbp+98h]
char v43; // [xsp+A0h] [xbp+A0h]
char v44; // [xsp+A1h] [xbp+A1h]
v3 = (__int64 *)((char *)this + 320);
v36 = a3;
v37[0] = a2;
v5 = (char *)this + 904;
v6 = std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 40,
v37) != nullptr;
v7 = std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
v3,
&v36) != nullptr;
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 113,
v37) )
*(float *)std::unordered_map::operator[]((unsigned __int64)this + 904, v37) = 1.0;
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 113,
&v36) )
*(float *)std::unordered_map::operator[]((unsigned __int64)this + 904, &v36) = 1.0;
v8 = (char *)this + 944;
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 118,
v37) )
*(float *)std::unordered_map::operator[]((unsigned __int64)this + 944, v37) = 1.0;
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 118,
&v36) )
*(float *)std::unordered_map::operator[]((unsigned __int64)this + 944, &v36) = 1.0;
v9 = (_QWORD *)((char *)this + 984);
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
v9,
v37) )
*(float *)std::unordered_map::operator[]((unsigned __int64)v9, v37) = 1.0;
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
v9,
&v36) )
*(float *)std::unordered_map::operator[]((unsigned __int64)v9, &v36) = 1.0;
v10 = *(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v5, v37);
v35 = (_DWORD *)std::unordered_map::operator[]((unsigned __int64)v5, v37);
*v35 = *(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v5, &v36);
*(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v5, &v36) = v10;
v11 = *(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v8, v37);
v12 = (_DWORD *)std::unordered_map::operator[]((unsigned __int64)v8, v37);
*v12 = *(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v8, &v36);
*(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v8, &v36) = v11;
v13 = *(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v9, v37);
v14 = (_DWORD *)std::unordered_map::operator[]((unsigned __int64)v9, v37);
*v14 = *(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v9, &v36);
*(_DWORD *)std::unordered_map::operator[]((unsigned __int64)v9, &v36) = v13;
if ( v7 )
{
if ( v6 )
{
v18 = std::unordered_map::operator[]((__int64)v3, v37);
v38 = *(_DWORD *)v18;
v19 = *(_QWORD *)(v18 + 8);
v40 = 0;
v41 = 0;
v42 = nullptr;
v39 = v19;
if ( (*(_BYTE *)(v18 + 16) & 1) != 0 )
{
std::string::__init(&v40, *(void **)(v18 + 32), *(_QWORD *)(v18 + 24));
}
else
{
v20 = *(_QWORD *)(v18 + 24);
v40 = *(_QWORD *)(v18 + 16);
v41 = v20;
v42 = *(void **)(v18 + 32);
}
v21 = *(_BYTE *)(v18 + 41);
v43 = *(_BYTE *)(v18 + 40);
v44 = v21;
v22 = std::unordered_map::operator[]((__int64)v3, v37);
v23 = std::unordered_map::operator[]((__int64)v3, &v36);
*(_DWORD *)v22 = *(_DWORD *)v23;
*(_QWORD *)(v22 + 8) = *(_QWORD *)(v23 + 8);
if ( v22 + 16 != v23 + 16 )
{
if ( (*(_BYTE *)(v23 + 16) & 1) != 0 )
{
v24 = *(const void **)(v23 + 32);
v25 = *(_QWORD *)(v23 + 24);
}
else
{
v24 = (const void *)(v23 + 17);
v25 = *(_BYTE *)(v23 + 16) >> 1;
}
std::string::assign((__int64 *)(v22 + 16), v24, v25);
}
*(_BYTE *)(v22 + 40) = *(_BYTE *)(v23 + 40);
*(_BYTE *)(v22 + 41) = *(_BYTE *)(v23 + 41);
v26 = std::unordered_map::operator[]((__int64)v3, &v36);
*(_DWORD *)v26 = v38;
*(_QWORD *)(v26 + 8) = v39;
if ( (__int64 *)(v26 + 16) != &v40 )
{
if ( (v40 & 1) != 0 )
{
v27 = (char *)v42;
v28 = v41;
}
else
{
v28 = (unsigned __int8)v40 >> 1;
v27 = (char *)&v40 + 1;
}
std::string::assign((__int64 *)(v26 + 16), v27, v28);
}
*(_BYTE *)(v26 + 40) = v43;
v29 = v40;
*(_BYTE *)(v26 + 41) = v44;
if ( (v29 & 1) != 0 )
operator delete(v42);
}
else
{
v15 = std::unordered_map::operator[]((__int64)v3, v37);
v16 = std::unordered_map::operator[]((__int64)v3, &v36);
v17 = (__int64 *)(v15 + 16);
*(_DWORD *)v15 = *(_DWORD *)v16;
*(_QWORD *)(v15 + 8) = *(_QWORD *)(v16 + 8);
if ( v15 + 16 != v16 + 16 )
{
if ( (*(_BYTE *)(v16 + 16) & 1) != 0 )
std::string::assign(v17, *(const void **)(v16 + 32), *(_QWORD *)(v16 + 24));
else
std::string::assign(v17, (const void *)(v16 + 17), *(_BYTE *)(v16 + 16) >> 1);
}
*(_BYTE *)(v15 + 40) = *(_BYTE *)(v16 + 40);
*(_BYTE *)(v15 + 41) = *(_BYTE *)(v16 + 41);
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
v3,
&v36);
}
}
else if ( v6 )
{
v31 = std::unordered_map::operator[]((__int64)v3, &v36);
v32 = std::unordered_map::operator[]((__int64)v3, v37);
*(_DWORD *)v31 = *(_DWORD *)v32;
*(_QWORD *)(v31 + 8) = *(_QWORD *)(v32 + 8);
if ( v31 + 16 != v32 + 16 )
{
if ( (*(_BYTE *)(v32 + 16) & 1) != 0 )
{
v33 = *(const void **)(v32 + 32);
v34 = *(_QWORD *)(v32 + 24);
}
else
{
v33 = (const void *)(v32 + 17);
v34 = *(_BYTE *)(v32 + 16) >> 1;
}
std::string::assign((__int64 *)(v31 + 16), v33, v34);
}
*(_BYTE *)(v31 + 40) = *(_BYTE *)(v32 + 40);
*(_BYTE *)(v31 + 41) = *(_BYTE *)(v32 + 41);
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
v3,
v37);
}
return _stack_chk_guard;
}