//
// sub_6E8EAC from 0x6e8eac to 0x6e9110 (612 bytes)
//
// 6 xrefs:
// > sub_6E7DA0 @ 0x6e7e64
// > sub_6E7DA0 @ 0x6e7e68
// > sub_6E7DA0 @ 0x6e7f40
// > sub_6E7DA0 @ 0x6e7f44
// > ??> @ 0x6e805c
// > ??> @ 0x6e807c
//
// 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_6E8EAC(int a1, _DWORD *a2, int a3)
{
int v3; // r3
int v4; // r2
int result; // r0
int v7; // [sp+10h] [bp-14h]
int v9; // [sp+18h] [bp-Ch]
int v10; // [sp+18h] [bp-Ch]
int i; // [sp+1Ch] [bp-8h]
v7 = *(_DWORD *)(*(_DWORD *)(a1 + 576) + 4);
v3 = a3;
v4 = a3 + 3;
if ( v3 < 0 )
v3 = v4;
v9 = v3 >> 2;
result = a3 / (4 * v7);
if ( a3 % (4 * v7) )
result = _assert2();
if ( v9 > v7 )
{
v10 = v9 - v7;
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 )
{
a2[v7] += *a2;
++a2;
}
LABEL_11:
a2[v7] += *a2;
++a2;
LABEL_12:
a2[v7] += *a2;
++a2;
LABEL_13:
a2[v7] += *a2;
++a2;
LABEL_14:
a2[v7] += *a2;
++a2;
LABEL_15:
v10 -= v7;
if ( v10 <= 0 )
return result;
continue;
}
}
}
return result;
}