//
// sub_1001B5FD0 from 0x1001b5fd0 to 0x1001b6230 (608 bytes)
//
// 1 xrefs:
// > FMODAudioEngine::update @ 0x1001b5b74
//
// 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 11:00:10 +0000
//
__int64 __fastcall sub_1001B5FD0(__int64 result)
{
__int64 v1; // x20
__int64 v2; // x19
char isPersistentMatchPlaying; // w0
char v4; // w22
int v6; // w8
__int64 *v7; // x22
__int128 v8; // q0
__int128 v9; // q1
__int128 v10; // q2
__int64 v11; // x22
__int128 v12; // q1
void *v13[2]; // [xsp+0h] [xbp-F0h] BYREF
__int64 v14; // [xsp+10h] [xbp-E0h]
__int128 v15; // [xsp+18h] [xbp-D8h]
__int128 v16; // [xsp+28h] [xbp-C8h]
__int128 v17; // [xsp+38h] [xbp-B8h]
__int128 v18; // [xsp+48h] [xbp-A8h]
char v19; // [xsp+58h] [xbp-98h]
void *__p[2]; // [xsp+60h] [xbp-90h] BYREF
__int64 v21; // [xsp+70h] [xbp-80h]
__int128 __dst; // [xsp+80h] [xbp-70h] BYREF
__int64 v23; // [xsp+90h] [xbp-60h]
__int64 v24; // [xsp+A8h] [xbp-48h] BYREF
v1 = *(_QWORD *)(result + 1080);
if ( v1 )
{
v2 = result;
do
{
if ( !*(_QWORD *)(v1 + 104) )
goto LABEL_32;
if ( *(_BYTE *)(v1 + 112) == 1 )
{
if ( *(char *)(v1 + 47) < 0 )
{
sub_1000097D0(&__dst, *(void **)(v1 + 24), *(_QWORD *)(v1 + 32));
}
else
{
__dst = *(_OWORD *)(v1 + 24);
v23 = *(_QWORD *)(v1 + 40);
}
isPersistentMatchPlaying = FMODAudioEngine::isPersistentMatchPlaying(v2, &__dst, *(unsigned int *)(v1 + 88));
v4 = isPersistentMatchPlaying;
if ( SHIBYTE(v23) < 0 )
{
operator delete((void *)__dst);
if ( (v4 & 1) != 0 )
goto LABEL_32;
}
else if ( (isPersistentMatchPlaying & 1) != 0 )
{
goto LABEL_32;
}
}
result = FMOD::Sound::getOpenState(*(_QWORD *)(v1 + 104), &v24, 0, 0, 0);
*(_DWORD *)(v2 + 536) = result;
if ( (unsigned int)v24 <= 6 && ((1 << v24) & 0x45) != 0 )
{
v6 = *(_DWORD *)(v1 + 96);
if ( v6 == 1 )
{
if ( *(_BYTE *)(v1 + 92) == 1 )
{
if ( *(char *)(v1 + 47) < 0 )
{
sub_1000097D0(v13, *(void **)(v1 + 24), *(_QWORD *)(v1 + 32));
}
else
{
*(_OWORD *)v13 = *(_OWORD *)(v1 + 24);
v14 = *(_QWORD *)(v1 + 40);
}
v12 = *(_OWORD *)(v1 + 80);
v16 = *(_OWORD *)(v1 + 64);
v17 = v12;
v18 = *(_OWORD *)(v1 + 96);
v19 = *(_BYTE *)(v1 + 112);
v15 = *(_OWORD *)(v1 + 48);
FMODAudioEngine::triggerQueuedMusic(v2, v13);
if ( SHIBYTE(v14) < 0 )
operator delete(v13[0]);
}
else
{
v24 = v1 + 16;
v7 = sub_1001A31B4(v2 + 1104, (int *)(v1 + 16));
std::string::operator=((std::string *)v7 + 1, (const std::string *)(v1 + 24));
*((_OWORD *)v7 + 3) = *(_OWORD *)(v1 + 48);
v9 = *(_OWORD *)(v1 + 80);
v8 = *(_OWORD *)(v1 + 96);
v10 = *(_OWORD *)(v1 + 64);
*((_BYTE *)v7 + 112) = *(_BYTE *)(v1 + 112);
*((_OWORD *)v7 + 5) = v9;
*((_OWORD *)v7 + 6) = v8;
*((_OWORD *)v7 + 4) = v10;
}
LABEL_32:
v11 = *(_QWORD *)v1;
result = sub_1000D9488((_QWORD *)(v2 + 1064), (__int64 *)v1);
goto LABEL_33;
}
if ( v6 )
goto LABEL_32;
if ( *(char *)(v1 + 47) < 0 )
{
sub_1000097D0(__p, *(void **)(v1 + 24), *(_QWORD *)(v1 + 32));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v1 + 24);
v21 = *(_QWORD *)(v1 + 40);
}
FMODAudioEngine::loadMusic(
v2,
__p,
*(unsigned __int8 *)(v1 + 76),
*(unsigned int *)(v1 + 80),
0,
*(unsigned __int8 *)(v1 + 112),
*(float *)(v1 + 48),
*(float *)(v1 + 52),
*(float *)(v1 + 56));
if ( SHIBYTE(v21) < 0 )
operator delete(__p[0]);
result = FMODAudioEngine::setMusicTimeMS(v2, *(unsigned int *)(v1 + 60), 1, *(unsigned int *)(v1 + 80));
*(_DWORD *)(v1 + 96) = 1;
}
v11 = *(_QWORD *)v1;
LABEL_33:
v1 = v11;
}
while ( v11 );
}
return result;
}