//
// sub_5A4DC from 0x5a4dc to 0x5a5dc (256 bytes)
//
// 3 xrefs:
// > sub_59CF0 @ 0x59d3c
// > sub_5B13C @ 0x5b198
// > FMOD::Channel::getPosition @ 0xceba0
//
// 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 sub_5A4DC(__int64 a1, unsigned int *a2, unsigned int a3)
{
_QWORD *v4; // x0
char v5; // w20
__int64 v7; // x9
unsigned int v8; // w21
unsigned int v9; // w22
float v10; // s8
__int64 result; // x0
__int64 v12; // x9
unsigned int v13; // w8
_BYTE v14[4]; // [xsp+8h] [xbp-28h] BYREF
unsigned int v15; // [xsp+Ch] [xbp-24h]
if ( !a2 )
return 31;
v4 = *(_QWORD **)(a1 + 472);
if ( !v4 )
return 30;
v5 = a3;
if ( (a3 & 7) != 0 )
{
v7 = v4[5];
if ( v7 )
{
v8 = *(_DWORD *)(v7 + 104);
v9 = *(_DWORD *)(v7 + 40);
v10 = *(float *)(v7 + 108);
LABEL_11:
result = (*(__int64 (__fastcall **)(_QWORD *, _BYTE *))(*v4 + 136LL))(v4, v14);
if ( (_DWORD)result )
return result;
if ( (v5 & 4) != 0 )
{
sub_5C280(v15, a2, v8, v9, 1);
}
else
{
v13 = v15;
if ( (v5 & 1) != 0 )
v13 = (unsigned int)(float)((float)((float)((float)v15 * 1000.0) / v10) + 0.5);
*a2 = v13;
}
return 0;
}
v12 = v4[6];
if ( v12 )
{
v8 = *(unsigned __int16 *)(v12 + 280);
v9 = 5;
v10 = (float)*(int *)(*(_QWORD *)(a1 + 8) + 1744LL);
goto LABEL_11;
}
return 30;
}
result = (*(__int64 (__fastcall **)(_QWORD *, unsigned int *, _QWORD))(*v4 + 224LL))(v4, a2, a3);
if ( (_DWORD)result )
return result;
return 0;
}