//
// FMODAudioEngine::loadAndPlayMusic from 0x5b6c6c to 0x5b6da8 (316 bytes)
//
// 4 xrefs:
// > CreateGuidelinesLayer::playMusic @ 0x5bf7a4
// > FindBPMLayer::playMusic @ 0x5bf8b8
// > SongOptionsLayer::onPlayback @ 0x83df54
// > ??> @ 0xa7130
//
// 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::loadAndPlayMusic(FMODAudioEngine *a1, __int64 a2, unsigned int a3, int a4)
{
void *v7; // x0
unsigned int *v9; // x2
int v10; // w1
__int64 v11; // [xsp+50h] [xbp+50h] BYREF
sub_D18D28(&v11, a2);
FMODAudioEngine::loadMusic((__int64)a1, &v11, 0, a4, 0, 0, 1.0, 0.0, 1.0);
v7 = (void *)(v11 - 24);
if ( (__int64 *)(v11 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v11 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v11 - 8);
*(_DWORD *)(v11 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v7);
}
if ( a3 )
FMODAudioEngine::setMusicTimeMS(a1, a3, 0, a4);
FMODAudioEngine::resumeMusic(a1, a4);
return _stack_chk_guard;
}