//
// sub_6802E4 from 0x6802e4 to 0x68036c (136 bytes)
//
// 0 xrefs:
//
// 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_6802E4(_DWORD *a1, int a2, int a3, int a4, int a5, _DWORD *a6, int a7)
{
_DWORD *v7; // r4
int v9; // r7
int v10; // r0
int v11; // r1
unsigned int v12; // r5
unsigned int v13; // r7
int result; // r0
unsigned int v15; // r2
unsigned int v16; // r5
v7 = (_DWORD *)a1[114];
v9 = v7[6];
if ( v9 )
{
v10 = v7[3];
}
else
{
v10 = (*(int (__fastcall **)(_DWORD *))(a1[1] + 28))(a1);
v9 = v7[6];
v7[3] = v10;
}
v11 = v10 + 4 * v9;
v12 = a7 - *a6;
if ( v12 >= a1[29] - v7[5] )
v12 = a1[29] - v7[5];
v13 = v7[4] - v9;
if ( v12 >= v13 )
v12 = v13;
result = (*(int (__fastcall **)(_DWORD *, int, int, unsigned int))(a1[121] + 4))(a1, v11, a5 + 4 * *a6, v12);
*a6 += v12;
v15 = v7[4];
v16 = v12 + v7[6];
v7[6] = v16;
if ( v16 >= v15 )
{
v7[5] += v15;
v7[6] = 0;
}
return result;
}