//
// sub_10052FC20 from 0x10052fc20 to 0x10052fca8 (136 bytes)
//
// 3 xrefs:
// > sub_10052E57C @ 0x10052e5d0
// > sub_10052E57C @ 0x10052e870
// > sub_10052EC84 @ 0x10052f37c
//
// 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_10052FC20(__int64 result, __int64 a2)
{
unsigned int v2; // w19
__int64 v3; // x20
__int64 v4; // x21
v2 = a2;
v3 = result;
LODWORD(result) = *(_DWORD *)(result + 112);
if ( (unsigned int)result >= (unsigned int)a2 )
return a2;
v4 = *(_QWORD *)(v3 + 104);
do
{
*(_DWORD *)(v3 + 40) = 3;
result = sub_1005DA62C(*(_QWORD *)(v3 + 16), v4 + (unsigned int)result, v2 - (unsigned int)result);
if ( (int)result < 1 )
break;
*(_DWORD *)(v3 + 40) = 1;
result = (unsigned int)(*(_DWORD *)(v3 + 112) + result);
*(_DWORD *)(v3 + 112) = result;
}
while ( (unsigned int)result < v2 );
return result;
}