//
// sub_76EE84 from 0x76ee84 to 0x76efa8 (292 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
//
void *__fastcall sub_76EE84(int a1, int a2)
{
void *v4; // r6
int v6; // r0
int v7; // r5
int v8; // r3
int v9; // r8
int v10; // r0
int v11; // r3
size_t v12; // r5
int v13; // r2
int v14; // r0
int v15; // r1
_DWORD v16[4]; // [sp+8h] [bp-10h] BYREF
if ( sub_74DBE4(a2) )
v4 = sub_74CD40(a2);
else
v4 = nullptr;
if ( !sub_77A088(a1 + 36) || !*(_BYTE *)(a1 + 69) && !*(_BYTE *)(a1 + 70) )
goto LABEL_4;
v6 = *(_DWORD *)(a1 + 84);
if ( !v6 )
goto LABEL_24;
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v6 + 20))(v6) != -1 )
{
v7 = *(unsigned __int8 *)(a1 + 69);
if ( *(_BYTE *)(a1 + 69) )
{
v6 = *(_DWORD *)(a1 + 84);
if ( v6 )
{
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v6 + 24))(v6) )
{
if ( v4 )
{
if ( !(*(int (__fastcall **)(void *))(*(_DWORD *)v4 + 24))(v4) )
{
(*(void (__fastcall **)(_DWORD *, int, _DWORD, _DWORD, int, _DWORD))(*(_DWORD *)a1 + 16))(
v16,
a1,
0,
0,
1,
*(_DWORD *)(a1 + 44));
if ( (v16[1] & v16[0]) == -1 )
goto LABEL_14;
}
}
}
else
{
v9 = *(_DWORD *)(a1 + 88);
v10 = (*(int (__fastcall **)(_DWORD, int, int, _DWORD, int))(**(_DWORD **)(a1 + 84) + 28))(
*(_DWORD *)(a1 + 84),
a1 + 56,
v9,
*(_DWORD *)(a1 + 96),
*(_DWORD *)(a1 + 8) - *(_DWORD *)(a1 + 4));
v11 = *(_DWORD *)(a1 + 100);
*(_DWORD *)(a1 + 96) = v9 + v10;
v12 = v11 - (v9 + v10);
if ( v11 != v9 + v10 )
memmove(*(void **)(a1 + 88), (const void *)(v9 + v10), v12);
v13 = *(_DWORD *)(a1 + 60);
v14 = *(_DWORD *)(a1 + 88);
v15 = *(_DWORD *)(a1 + 48);
*(_DWORD *)(a1 + 4) = v13;
*(_DWORD *)(a1 + 96) = v14;
*(_DWORD *)(a1 + 100) = v12 + v14;
*(_DWORD *)(a1 + 8) = v13;
*(_DWORD *)(a1 + 12) = v13;
*(_DWORD *)(a1 + 52) = v15;
*(_DWORD *)(a1 + 56) = v15;
*(_DWORD *)(a1 + 20) = 0;
*(_DWORD *)(a1 + 16) = 0;
*(_DWORD *)(a1 + 24) = 0;
}
LABEL_4:
*(_DWORD *)(a1 + 84) = v4;
return v4;
}
LABEL_24:
sub_772FE4(v6);
}
if ( !*(_BYTE *)(a1 + 70) )
goto LABEL_4;
if ( sub_76EBC4(a1) )
{
v8 = *(_DWORD *)(a1 + 60);
*(_DWORD *)(a1 + 20) = v7;
*(_DWORD *)(a1 + 16) = v7;
*(_DWORD *)(a1 + 24) = v7;
*(_DWORD *)(a1 + 4) = v8;
*(_DWORD *)(a1 + 8) = v8;
*(_DWORD *)(a1 + 12) = v8;
goto LABEL_4;
}
}
LABEL_14:
*(_DWORD *)(a1 + 84) = 0;
return nullptr;
}