//
// FMODAudioEngine::lengthForSound from 0x140059a00 to 0x140059ac6 (198 bytes)
//
// 3 xrefs:
// > SetupSFXPopup::onClose @ 0x14044877d
// > SetupSFXPopup::createSFXWidget @ 0x140448af8
// > ??> @ 0x1406c5250
//
// 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
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall FMODAudioEngine::lengthForSound(__int64 a1, _QWORD *a2)
{
__int64 v2; // rdi
__int64 v4; // r9
unsigned __int64 v5; // r8
unsigned __int64 i; // rcx
unsigned int v7; // ebx
_BYTE v9[16]; // [rsp+20h] [rbp-28h] BYREF
_QWORD *v10; // [rsp+30h] [rbp-18h]
v2 = (__int64)a2;
v10 = a2;
if ( a2[3] > 0xFu )
a2 = (_QWORD *)*a2;
v4 = 0xCBF29CE484222325uLL;
v5 = *(_QWORD *)(v2 + 16);
for ( i = 0; i < v5; ++i )
v4 = 0x100000001B3LL * (*((unsigned __int8 *)a2 + i) ^ (unsigned __int64)v4);
if ( *(_QWORD *)(sub_140063040(a1 + 384, v9, v2, v4) + 8) )
{
v7 = *(_DWORD *)(*(_QWORD *)sub_1400612C0(a1 + 384, v9, v2) + 88LL);
sub_14003A830(v2);
return v7;
}
else
{
sub_14003A830(v2);
return 0;
}
}