//
// sub_100582F38 from 0x100582f38 to 0x100583058 (288 bytes)
//
// 1 xrefs:
// > FMOD::Channel::getPosition @ 0x10057b4ac
//
// 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:08:30 +0000
//
__int64 __fastcall sub_100582F38(__int64 a1, unsigned int *a2, __int64 a3)
{
_QWORD *v4; // x0
char v5; // w20
__int64 v7; // x9
int v8; // w21
float v9; // s8
int v10; // w22
__int64 result; // x0
__int64 v12; // x9
unsigned int v13; // w8
unsigned __int64 v14; // x8
_BYTE v15[4]; // [xsp+8h] [xbp-38h] BYREF
unsigned int v16; // [xsp+Ch] [xbp-34h]
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 = *(float *)(v7 + 108);
v10 = *(_DWORD *)(v7 + 40) - 1;
LABEL_11:
result = (*(__int64 (__fastcall **)(_QWORD *, _BYTE *))(*v4 + 136LL))(v4, v15);
if ( (_DWORD)result )
return result;
if ( (v5 & 4) != 0 )
{
LODWORD(v14) = v16;
if ( (unsigned int)v10 <= 4 )
v14 = (qword_100772400[v10] * (unsigned __int64)v16) >> 3;
v13 = v14 * v8;
}
else
{
v13 = v16;
if ( (v5 & 1) != 0 )
v13 = (unsigned int)(float)((float)((float)((float)v16 / v9) * 1000.0) + 0.5);
}
*a2 = v13;
return 0;
}
v12 = v4[6];
if ( v12 )
{
v8 = *(unsigned __int16 *)(v12 + 272);
v9 = (float)*(int *)(*(_QWORD *)(a1 + 8) + 1744LL);
v10 = 4;
goto LABEL_11;
}
return 30;
}
result = (*(__int64 (__fastcall **)(_QWORD *, unsigned int *, __int64))(*v4 + 224LL))(v4, a2, a3);
if ( (_DWORD)result )
return result;
return 0;
}