//
// sub_76DCFC from 0x76dcfc to 0x76ddf2 (246 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_76DCFC(int a1, int a2)
{
int v3; // r5
unsigned int v4; // r3
int v5; // r7
unsigned int v6; // r6
int v7; // r0
int v9; // r2
bool v10; // zf
_BYTE *v11; // r3
int v12; // r0
int v13; // r6
int v14; // [sp+8h] [bp-14h] BYREF
int v15; // [sp+Ch] [bp-10h]
if ( (*(_DWORD *)(a1 + 44) & 8) == 0 )
return -1;
v3 = a2;
if ( *(_BYTE *)(a1 + 70) )
{
if ( (*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 52))(a1, -1) != -1 )
{
v9 = *(_DWORD *)(a1 + 60);
v5 = *(unsigned __int8 *)(a1 + 80);
*(_DWORD *)(a1 + 20) = 0;
v6 = v3 == -1;
*(_DWORD *)(a1 + 4) = v9;
*(_DWORD *)(a1 + 8) = v9;
*(_DWORD *)(a1 + 12) = v9;
*(_DWORD *)(a1 + 16) = 0;
*(_DWORD *)(a1 + 24) = 0;
*(_BYTE *)(a1 + 70) = 0;
goto LABEL_12;
}
return -1;
}
v4 = *(_DWORD *)(a1 + 8);
v5 = *(unsigned __int8 *)(a1 + 80);
v6 = a2 == -1;
if ( *(_DWORD *)(a1 + 4) < v4 )
{
*(_DWORD *)(a1 + 8) = v4 - 1;
v7 = *(unsigned __int8 *)(v4 - 1);
goto LABEL_5;
}
LABEL_12:
(*(void (__fastcall **)(int *, int, int, int, int, int))(*(_DWORD *)a1 + 16))(&v14, a1, -1, -1, 1, 24);
v10 = v15 == -1;
if ( v15 == -1 )
v10 = v14 == -1;
if ( v10 )
return -1;
v7 = (*(int (__fastcall **)(int))(*(_DWORD *)a1 + 36))(a1);
if ( v7 == -1 )
return -1;
LABEL_5:
if ( (v3 == v7) > v6 )
return v3;
if ( !v6 )
{
if ( !v5 )
{
if ( *(_BYTE *)(a1 + 80) )
{
v11 = *(_BYTE **)(a1 + 8);
}
else
{
v12 = *(_DWORD *)(a1 + 8);
v13 = *(_DWORD *)(a1 + 12);
v11 = (_BYTE *)(a1 + 71);
*(_DWORD *)(a1 + 4) = a1 + 71;
*(_DWORD *)(a1 + 72) = v12;
*(_DWORD *)(a1 + 76) = v13;
*(_DWORD *)(a1 + 8) = a1 + 71;
*(_DWORD *)(a1 + 12) = a1 + 72;
*(_BYTE *)(a1 + 80) = 1;
}
*(_BYTE *)(a1 + 69) = 1;
*v11 = v3;
return v3;
}
return -1;
}
if ( v3 == -1 )
return 0;
return v3;
}