//
// sub_8F9850 from 0x8f9850 to 0x8f9b0c (700 bytes)
//
// 3 xrefs:
// > sub_8F7C58 @ 0x8f7d00
// > sub_8F7C58 @ 0x8f7d04
// > ??> @ 0x8f7e50
//
// 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:04:15 +0000
//
int __fastcall sub_8F9850(int a1, int a2, int a3)
{
int result; // r0
int v4; // [sp+18h] [bp-14h]
_WORD *v6; // [sp+1Ch] [bp-10h]
int v7; // [sp+20h] [bp-Ch]
int v8; // [sp+20h] [bp-Ch]
int i; // [sp+24h] [bp-8h]
v4 = *(_DWORD *)(*(_DWORD *)(a1 + 576) + 4);
v7 = a3 / 2;
result = a3 / (2 * v4);
if ( a3 % (2 * v4) )
result = _assert2();
if ( v7 > v4 )
{
v8 = v7 - v4;
v6 = (_WORD *)(a2 + 2 * (v8 - 1));
while ( 2 )
{
switch ( v4 )
{
case 0:
goto LABEL_13;
case 1:
goto LABEL_12;
case 2:
goto LABEL_11;
case 3:
goto LABEL_10;
case 4:
goto LABEL_9;
default:
for ( i = v4 - 4; i > 0; --i )
{
v6[v4] -= *v6;
--v6;
}
LABEL_9:
v6[v4] -= *v6;
--v6;
LABEL_10:
v6[v4] -= *v6;
--v6;
LABEL_11:
v6[v4] -= *v6;
--v6;
LABEL_12:
v6[v4] -= *v6;
--v6;
LABEL_13:
v8 -= v4;
if ( v8 <= 0 )
return result;
continue;
}
}
}
return result;
}