//
// sub_4AF98 from 0x4af98 to 0x4b052 (186 bytes)
//
// 4 xrefs:
// > ??> @ 0x4af96
// > sub_4A934 @ 0x4a964
// > sub_4B96E @ 0x4b9ac
// > FMOD::Channel::getPosition @ 0xad2da
//
// 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
//
int __fastcall sub_4AF98(int a1, unsigned int *a2, int a3)
{
_DWORD *v5; // r0
int v7; // r6
int v8; // r2
float v9; // s16
int v10; // r9
int v11; // r8
int result; // r0
int v13; // r2
_BYTE v14[4]; // [sp+8h] [bp-28h] BYREF
unsigned int v15; // [sp+Ch] [bp-24h]
if ( !a2 )
return 31;
v5 = *(_DWORD **)(a1 + 332);
if ( !v5 )
return 30;
v7 = a3 << 29;
if ( a3 << 29 )
{
v8 = v5[5];
if ( v8 )
{
v9 = *(float *)(v8 + 80);
v10 = *(_DWORD *)(v8 + 24);
v11 = *(_DWORD *)(v8 + 76);
LABEL_11:
result = (*(int (__fastcall **)(_DWORD *, _BYTE *))(*v5 + 68))(v5, v14);
if ( result )
return result;
if ( v7 < 0 )
{
sub_4C6EA(v15, a2, v11, v10);
}
else if ( a3 << 31 )
{
*a2 = (unsigned int)(float)((float)((float)((float)v15 * 1000.0) / v9) + 0.5);
}
else
{
*a2 = v15;
}
return 0;
}
v13 = v5[6];
if ( v13 )
{
v10 = 5;
v11 = *(unsigned __int16 *)(v13 + 192);
v9 = (float)*(int *)(*(_DWORD *)(a1 + 4) + 1184);
goto LABEL_11;
}
return 30;
}
result = (*(int (__fastcall **)(_DWORD *, unsigned int *, int))(*v5 + 112))(v5, a2, a3);
if ( result )
return result;
return 0;
}