//
// sub_8859D8 from 0x8859d8 to 0x885a02 (42 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:03:13 +0000
//
int __fastcall sub_8859D8(int result, int a2)
{
int v2; // r4
int v3; // r6
int *v4; // r5
int i; // r1
int v6; // r3
v2 = a2;
v3 = result;
v4 = *(int **)(result + 24);
if ( a2 > 0 )
{
for ( i = v4[1]; i < v2; i = v4[1] )
{
v2 -= i;
result = ((int (__fastcall *)(int))v4[3])(v3);
}
v6 = *v4;
v4[1] = i - v2;
*v4 = v2 + v6;
}
return result;
}