//
// sub_10045CEF0 from 0x10045cef0 to 0x10045d064 (372 bytes)
//
// 1 xrefs:
// > FMOD::Channel::getLoopPoints @ 0x100455e18
//
// 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_10045CEF0(__int64 a1, unsigned int *a2, unsigned int a3, _DWORD *a4, unsigned int a5)
{
__int64 v5; // x8
__int64 result; // x0
__int64 v7; // x9
unsigned int v8; // w10
unsigned __int64 v9; // x11
unsigned int v10; // w12
unsigned __int64 v11; // x8
int v12; // w10
unsigned int v13; // w9
v5 = *(_QWORD *)(a1 + 472);
if ( !v5 )
return 30;
result = 19;
if ( a3 <= 4 && ((1 << a3) & 0x16) != 0 )
{
result = 19;
if ( a5 <= 4 && ((1 << a5) & 0x16) != 0 )
{
v7 = *(_QWORD *)(v5 + 40);
if ( !v7 )
return 31;
if ( a2 )
{
switch ( a3 )
{
case 1u:
v8 = (unsigned int)(float)((float)((float)((float)*(unsigned int *)(v5 + 88) * 1000.0) / *(float *)(v7 + 108))
+ 0.5);
break;
case 4u:
v9 = *(unsigned int *)(v5 + 88);
v10 = *(_DWORD *)(v7 + 40) - 1;
if ( v10 <= 4 )
v9 = (qword_100649400[v10] * v9) >> 3;
v8 = v9 * *(_DWORD *)(v7 + 104);
break;
case 2u:
v8 = *(_DWORD *)(v5 + 88);
break;
default:
goto LABEL_19;
}
*a2 = v8;
}
LABEL_19:
if ( !a4 )
return 0;
v11 = (unsigned int)(*(_DWORD *)(v5 + 88) + *(_DWORD *)(v5 + 92) - 1);
switch ( a5 )
{
case 1u:
LODWORD(v11) = (unsigned int)(float)((float)((float)((float)(unsigned int)v11 * 1000.0) / *(float *)(v7 + 108))
+ 0.5);
break;
case 2u:
break;
case 4u:
v12 = *(_DWORD *)(v7 + 104);
v13 = *(_DWORD *)(v7 + 40) - 1;
if ( v13 <= 4 )
v11 = (qword_100649400[v13] * v11) >> 3;
LODWORD(v11) = v11 * v12;
break;
default:
return 0;
}
*a4 = v11;
return 0;
}
}
return result;
}