//
// sub_1004BA0E4 from 0x1004ba0e4 to 0x1004ba168 (132 bytes)
//
// 1 xrefs:
// > sub_1004B9D08 @ 0x1004b9df4
//
// 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_1004BA0E4(
__int64 a1,
__int64 a2,
unsigned int a3,
unsigned int a4,
_QWORD *a5,
_QWORD *a6,
int *a7,
int *a8)
{
__int64 v8; // x8
unsigned int v9; // w11
int v10; // w9
int v11; // w10
int v12; // w8
v8 = a1 - 8;
if ( !a1 )
v8 = 0;
v9 = *(_DWORD *)(v8 + 1464) * *(_DWORD *)(v8 + 1476);
if ( v9 >= a4 )
v10 = a4;
else
v10 = *(_DWORD *)(v8 + 1464) * *(_DWORD *)(v8 + 1476);
v11 = v9 - a3;
if ( v9 <= a3 )
{
*a6 = 0;
*a5 = 0;
*a8 = 0;
*a7 = 0;
return 31;
}
else
{
*a5 = *(_QWORD *)(v8 + 1448) + a3;
if ( v10 + a3 <= v9 )
{
v12 = 0;
*a7 = v10;
*a6 = 0;
}
else
{
*a7 = v11;
*a6 = *(_QWORD *)(v8 + 1448);
v12 = v10 - v11;
}
*a8 = v12;
return 0;
}
}