//
// FMOD::Sound::getLength from 0x1004bf8a4 to 0x1004bfa04 (352 bytes)
//
// 4 xrefs:
// > FMODAudioEngine::storeEffect @ 0x10013cbcc
// > FMODAudioEngine::startMusic @ 0x10013d768
// > FMODAudioEngine::getMusicLengthMS @ 0x10013e688
// > sub_100453074 @ 0x100453078
//
// 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
//
// local variable allocation has failed, the output may be wrong!
FMOD_RESULT __fastcall FMOD::Sound::getLength(FMOD::Sound *a1, unsigned int *a2, unsigned int a3)
{
__int64 v3; // x21
int v6; // w3
int v7; // w4
int v8; // w5
int v9; // w6
int v10; // w7
__int64 v11; // x20
unsigned int v12; // w8
unsigned int v13; // w8
int v14; // w0
__int64 v15; // x22
int v16; // w3
int v17; // w4
int v18; // w5
int v19; // w6
int v20; // w7
int v21; // w0
int v22; // w3
int v23; // w4
int v24; // w5
int v25; // w6
int v26; // w7
__int64 v28; // [xsp+8h] [xbp-158h] BYREF
unsigned int *v29; // [xsp+10h] [xbp-150h] BYREF
_BYTE v30[256]; // [xsp+18h] [xbp-148h] BYREF
v3 = *(_QWORD *)&a3;
v28 = 0;
v11 = sub_1004C3CE0(a1, &v29, &v28);
if ( !(_DWORD)v11 )
{
v12 = atomic_load(v29 + 68);
if ( v12 && (v13 = atomic_load(v29 + 68), v13 != 7) )
{
v11 = 46;
}
else
{
v11 = (*(__int64 (__fastcall **)(unsigned int *, unsigned int *, __int64))(*(_QWORD *)v29 + 152LL))(v29, a2, v3);
if ( !(_DWORD)v11 )
goto LABEL_9;
}
}
if ( (*((_BYTE *)off_1008524C8 + 32) & 0x80) != 0 )
{
v14 = sub_1004360EC((int)v30, 0x100u, (__int64)a2, v6, v7, v8, v9, v10);
v15 = v14;
v21 = sub_100435EB4(&v30[v14], (unsigned int)(256 - v14), ", ", v16, v17, v18, v19, v20);
sub_100435D28(&v30[v15 + v21], (unsigned int)(256 - (v15 + v21)), v3, v22, v23, v24, v25, v26);
sub_10048489C(v11, 5, (__int64)a1, (__int64)"Sound::getLength", (__int64)v30);
}
LABEL_9:
if ( v28 )
sub_100442B7C(v28, 0xDu);
return (unsigned int)v11;
}