//
// sub_6CCEA from 0x6ccea to 0x6cd8c (162 bytes)
//
// 1 xrefs:
// > sub_6CC5E @ 0x6cc76
//
// 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_6CCEA(_DWORD *a1, int a2)
{
int v3; // r0
int v5; // r1
bool v6; // zf
int result; // r0
int i; // r0
int v9; // lr
int j; // r1
int v11; // r6
int v12; // r3
int v13; // r5
_DWORD *k; // r6
v3 = a1[1];
if ( v3 >= a2 )
return 28;
v5 = a1[4];
v6 = v5 == v3;
if ( v5 == v3 )
v6 = a1[6] == -1;
if ( !v6 )
return 28;
result = sub_6CD8C(a1 + 3, a2);
if ( !result )
{
result = sub_53292((int)a1, a2);
if ( !result )
{
for ( i = 0; i < a2; ++i )
*(_DWORD *)(*a1 + 4 * i) = -1;
v9 = a1[4];
for ( j = 0; j < v9; ++j )
{
v11 = a1[1];
if ( !v11 )
return 28;
v12 = a1[3];
v13 = 3 * j;
for ( k = (_DWORD *)(*a1 + 4 * (*(_DWORD *)(v12 + 12 * j) & (v11 - 1))); *k != -1; k = (_DWORD *)(v12 + 12 * *k + 4) )
;
*k = j;
*(_DWORD *)(v12 + 4 * v13 + 4) = -1;
}
return 0;
}
}
return result;
}