//
// sub_10045D08C from 0x10045d08c to 0x10045d1f8 (364 bytes)
//
// 1 xrefs:
// > FMOD::Channel::setLoopPoints @ 0x100455c70
//
// 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_10045D08C(__int64 a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5)
{
_QWORD *v6; // x0
__int64 v7; // x8
__int64 v8; // x8
unsigned int v10; // w9
unsigned int v11; // w10
unsigned int v12; // w9
unsigned int v13; // w8
v6 = *(_QWORD **)(a1 + 472);
if ( !v6 || !*(_QWORD *)(a1 + 32) )
return 30;
v7 = 19;
if ( a3 > 4 )
return v7;
if ( ((1 << a3) & 0x16) == 0 )
return v7;
v7 = 19;
if ( a5 > 4 || ((1 << a5) & 0x16) == 0 )
return v7;
v8 = v6[5];
if ( !v8 )
return 31;
if ( a3 == 1 )
{
a2 = (unsigned int)(float)((float)((float)((float)a2 / 1000.0) * *(float *)(v8 + 108)) + 0.5);
}
else
{
if ( a3 == 4 )
{
v10 = *(_DWORD *)(v8 + 104);
if ( v10 )
{
v11 = *(_DWORD *)(v8 + 40) - 1;
if ( v11 <= 4 )
a2 = (unsigned int)(8 * (unsigned __int64)a2 / qword_100649400[v11]) / v10;
goto LABEL_18;
}
goto LABEL_17;
}
if ( a3 != 2 )
LABEL_17:
a2 = 0;
}
LABEL_18:
switch ( a5 )
{
case 1u:
a4 = (unsigned int)(float)((float)((float)((float)a4 / 1000.0) * *(float *)(v8 + 108)) + 0.5);
goto LABEL_25;
case 2u:
goto LABEL_25;
case 4u:
v12 = *(_DWORD *)(v8 + 104);
if ( v12 )
{
v13 = *(_DWORD *)(v8 + 40) - 1;
if ( v13 <= 4 )
a4 = (unsigned int)(8 * (unsigned __int64)a4 / qword_100649400[v13]) / v12;
LABEL_25:
if ( a4 > a2 )
return (*(__int64 (__fastcall **)(_QWORD *))(*v6 + 144LL))(v6);
}
break;
}
return 31;
}