//
// FMODAudioEngine::isPersistentMatchPlaying from 0x5b399c to 0x5b3b00 (356 bytes)
//
// 4 xrefs:
// > FMODAudioEngine::loadMusic @ 0x5b697c
// > FMODAudioEngine::updateQueuedMusic @ 0x5baf58
// > FMODAudioEngine::queueStartMusic @ 0x5bb530
// > ??> @ 0x33b88
//
// 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
//
__int64 __fastcall FMODAudioEngine::isPersistentMatchPlaying(__int64 a1, const void **a2, int a3)
{
bool isMusicPlaying; // w0
unsigned int v6; // w20
_DWORD *v8; // x21
unsigned __int64 v9; // x20
const void *v10; // x1
unsigned __int64 v11; // x23
size_t v12; // x2
unsigned __int64 v13; // x20
char *v14; // x0
unsigned int *v15; // x21
int v16; // w1
int v17[3]; // [xsp+4Ch] [xbp+4Ch] BYREF
void *v18; // [xsp+60h] [xbp+60h] BYREF
v17[0] = a3;
isMusicPlaying = FMODAudioEngine::isMusicPlaying((FMODAudioEngine *)a1, a3);
v6 = isMusicPlaying;
if ( isMusicPlaying )
{
FMODAudioEngine::getActiveMusic((FMODAudioEngine *)a1, v17[0], (__int64)&v18);
v8 = v18;
v9 = *((_QWORD *)v18 - 3);
v10 = *a2;
v11 = *((_QWORD *)*a2 - 3);
v12 = v11 > v9 ? *((_QWORD *)v18 - 3) : v11;
if ( memcmp(v18, v10, v12) || (v13 = v9 - v11, v13 + 0x80000000 > 0xFFFFFFFF) || (_DWORD)v13 )
{
v6 = 0;
}
else
{
v6 = (unsigned __int8)std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
(char **)(a1 + 320),
v17)[25];
v8 = v18;
}
v14 = (char *)(v8 - 6);
if ( v8 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = v8 - 2;
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(v8 - 2);
*(v8 - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v14);
}
}
return v6;
}