//
// sub_1004EE454 from 0x1004ee454 to 0x1004ee548 (244 bytes)
//
// 0 xrefs:
//
// 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_1004EE454(__int64 a1, __int64 a2, _QWORD *a3, unsigned int a4, _DWORD *a5)
{
int v5; // w8
__int64 v6; // x25
__int64 v12; // x23
unsigned int v13; // w0
__int64 v14; // x0
__int64 v16; // [xsp+8h] [xbp-48h] BYREF
v5 = *(_DWORD *)(a2 + 128);
if ( v5 < 2 )
return 4294967165LL;
v12 = a2 + 528;
if ( v5 != 4 )
goto LABEL_5;
LABEL_4:
v13 = sub_10042DDAC(v12, &v16);
if ( v13 )
{
if ( a3 )
*a3 = v16;
if ( (int)v13 >= (int)a4 )
v6 = a4;
else
v6 = v13;
sub_10042DE10(v12, v6);
*(_QWORD *)(a2 + 120) += (int)v6;
if ( a5 )
*a5 = *(_DWORD *)(a2 + 136);
}
else
{
LABEL_5:
while ( 1 )
{
v14 = sub_1004ED8FC(a1, a2, 1);
if ( (_DWORD)v14 == -2 )
return 0;
v6 = v14;
if ( (int)v14 <= 0 )
return v6;
if ( *(_DWORD *)(a2 + 128) == 4 )
goto LABEL_4;
}
}
return v6;
}