//
// sub_10052FB88 from 0x10052fb88 to 0x10052fc20 (152 bytes)
//
// 1 xrefs:
// > sub_10052EC84 @ 0x10052f26c
//
// 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_10052FB88(__int64 a1)
{
__int64 v2; // x22
__int64 v3; // x20
__int64 v4; // x21
__int64 result; // x0
v2 = *(_QWORD *)(*(_QWORD *)(a1 + 80) + 8LL);
v3 = *(unsigned int *)(a1 + 96);
v4 = *(int *)(a1 + 100);
*(_DWORD *)(a1 + 40) = 2;
result = sub_1005DA72C(*(_QWORD *)(a1 + 24), v2 + v4, v3);
if ( (int)result <= 0 )
{
LABEL_4:
*(_DWORD *)(a1 + 96) = v3;
*(_DWORD *)(a1 + 100) = v4;
}
else
{
while ( 1 )
{
*(_DWORD *)(a1 + 40) = 1;
v3 = (unsigned int)(v3 - result);
if ( !(_DWORD)v3 )
return (unsigned int)(result + v4);
LODWORD(v4) = result + v4;
*(_DWORD *)(a1 + 40) = 2;
result = sub_1005DA72C(*(_QWORD *)(a1 + 24), v2 + (int)v4, v3);
if ( (int)result < 1 )
goto LABEL_4;
}
}
return result;
}