//
// sub_6E89B0 from 0x6e89b0 to 0x6e8c24 (628 bytes)
//
// 6 xrefs:
// > sub_6E7DA0 @ 0x6e7e50
// > sub_6E7DA0 @ 0x6e7e54
// > sub_6E7DA0 @ 0x6e7f04
// > sub_6E7DA0 @ 0x6e7f08
// > ??> @ 0x6e8058
// > ??> @ 0x6e8070
//
// 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
//
int __fastcall sub_6E89B0(int a1, _WORD *a2, int a3)
{
int result; // r0
int v4; // [sp+10h] [bp-14h]
int v6; // [sp+18h] [bp-Ch]
int v7; // [sp+18h] [bp-Ch]
int i; // [sp+1Ch] [bp-8h]
v4 = *(_DWORD *)(*(_DWORD *)(a1 + 576) + 4);
v6 = a3 / 2;
result = a3 / (2 * v4);
if ( a3 % (2 * v4) )
result = _assert2();
if ( v6 > v4 )
{
v7 = v6 - v4;
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 )
{
a2[v4] += *a2;
++a2;
}
LABEL_9:
a2[v4] += *a2;
++a2;
LABEL_10:
a2[v4] += *a2;
++a2;
LABEL_11:
a2[v4] += *a2;
++a2;
LABEL_12:
a2[v4] += *a2;
++a2;
LABEL_13:
v7 -= v4;
if ( v7 <= 0 )
return result;
continue;
}
}
}
return result;
}