//
// sub_5A76C from 0x5a76c to 0x5a8e8 (380 bytes)
//
// 2 xrefs:
// > sub_5A244 @ 0x5a29c
// > FMOD::Channel::setLoopPoints @ 0xcf074
//
// 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_5A76C(__int64 a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5)
{
__int64 v5; // x9
__int64 result; // x0
__int64 v9; // x22
unsigned int v11; // w8
__int64 v12; // [xsp+8h] [xbp-38h] BYREF
v12 = 0;
v5 = *(_QWORD *)(a1 + 472);
if ( !v5 || !*(_QWORD *)(a1 + 32) )
return 30;
result = 19;
if ( a3 <= 4 && ((1 << a3) & 0x16) != 0 )
{
result = 19;
if ( a5 <= 4 && ((1 << a5) & 0x16) != 0 )
{
v9 = *(_QWORD *)(v5 + 40);
if ( !v9 )
return 31;
v11 = a2;
switch ( a3 )
{
case 1u:
v11 = (unsigned int)(float)((float)((float)((float)a2 * 0.001) * *(float *)(v9 + 108)) + 0.5);
break;
case 4u:
sub_5C214(a2, (char *)&v12 + 4, *(unsigned int *)(v9 + 104), *(unsigned int *)(v9 + 40));
goto LABEL_17;
case 2u:
break;
default:
LABEL_17:
switch ( a5 )
{
case 1u:
LODWORD(v12) = (unsigned int)(float)((float)((float)((float)a4 * 0.001) * *(float *)(v9 + 108)) + 0.5);
break;
case 4u:
sub_5C214(a4, &v12, *(unsigned int *)(v9 + 104), *(unsigned int *)(v9 + 40));
break;
case 2u:
LODWORD(v12) = a4;
break;
}
if ( (unsigned int)v12 > HIDWORD(v12) )
return (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 472) + 144LL))(*(_QWORD *)(a1 + 472));
return 31;
}
HIDWORD(v12) = v11;
goto LABEL_17;
}
}
return result;
}