//
// sub_1004A0004 from 0x1004a0004 to 0x1004a0080 (124 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008523a8
//
// 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_1004A0004(__int64 *a1, int a2, unsigned int a3)
{
__int64 v3; // x8
unsigned int v4; // w9
__int64 result; // x0
float v6; // s0
bool v7; // cf
unsigned int v8; // w9
v3 = *a1;
if ( a2 )
{
v4 = *(_DWORD *)(v3 + 2076);
if ( !v4 )
return 11;
}
else
{
v6 = *(float *)(v3 + 2068);
if ( v6 <= -80.0 )
v4 = *(_DWORD *)(v3 + 2076);
else
v4 = (unsigned int)(float)((float)((float)((float)(v6 + 100.0) * *(float *)(v3 + 2024)) * 0.000016667)
* (float)*(int *)(v3 + 2072));
}
result = 0;
v7 = v4 >= a3;
v8 = v4 - a3;
if ( !v7 )
v8 = 0;
*(_DWORD *)(v3 + 2076) = v8;
return result;
}