//
// sub_6E9F58 from 0x6e9f58 to 0x6ea1dc (644 bytes)
//
// 3 xrefs:
// > sub_6E8098 @ 0x6e8154
// > sub_6E8098 @ 0x6e8158
// > ??> @ 0x6e8294
//
// 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_6E9F58(int a1, int a2, int a3)
{
int v3; // r3
int v4; // r2
int result; // r0
int v7; // [sp+18h] [bp-14h]
_DWORD *v9; // [sp+1Ch] [bp-10h]
int v10; // [sp+20h] [bp-Ch]
int v11; // [sp+20h] [bp-Ch]
int i; // [sp+24h] [bp-8h]
v7 = *(_DWORD *)(*(_DWORD *)(a1 + 576) + 4);
v3 = a3;
v4 = a3 + 3;
if ( v3 < 0 )
v3 = v4;
v10 = v3 >> 2;
result = a3 / (4 * v7);
if ( a3 % (4 * v7) )
result = _assert2();
if ( v10 > v7 )
{
v11 = v10 - v7;
v9 = (_DWORD *)(a2 + 4 * (v11 - 1));
while ( 2 )
{
switch ( v7 )
{
case 0:
goto LABEL_15;
case 1:
goto LABEL_14;
case 2:
goto LABEL_13;
case 3:
goto LABEL_12;
case 4:
goto LABEL_11;
default:
for ( i = v7 - 4; i > 0; --i )
{
v9[v7] -= *v9;
--v9;
}
LABEL_11:
v9[v7] -= *v9;
--v9;
LABEL_12:
v9[v7] -= *v9;
--v9;
LABEL_13:
v9[v7] -= *v9;
--v9;
LABEL_14:
v9[v7] -= *v9;
--v9;
LABEL_15:
v11 -= v7;
if ( v11 <= 0 )
return result;
continue;
}
}
}
return result;
}