//
// sub_1800C8FD0 from 0x1800c8fd0 to 0x1800c90b6 (230 bytes)
//
// 2 xrefs:
// > ??> @ 0x18016c548
// > ??> @ 0x1801fe2ec
//
// 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
//
__int64 __fastcall sub_1800C8FD0(__int64 a1, __int64 a2)
{
__int64 v4; // rsi
__int64 result; // rax
__int64 v6; // r9
__int64 v7; // rax
unsigned int v8; // edx
__int64 v9; // rcx
char v10; // r8
unsigned int v11; // [rsp+3Ch] [rbp+14h]
v11 = HIDWORD(a2);
v4 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 96LL);
result = sub_1800C7D00(a1, a2);
if ( !(_DWORD)result )
{
v7 = *(_QWORD *)(a1 + 40);
if ( v7 )
{
if ( (*(_BYTE *)(a1 + 56) & 1) != 0 || !*(_DWORD *)(a1 + 84) )
v8 = *(_DWORD *)(v7 + 68) - 1;
else
v8 = *(_DWORD *)(a1 + 92) + *(_DWORD *)(a1 + 88) - 1;
}
else
{
v8 = -1;
}
if ( v11 > v8 )
return 32;
if ( (*(_DWORD *)(*(_QWORD *)(a1 + 24) + 72LL) & 0x40000) != 0 && a2 )
*(_DWORD *)(a1 + 60) |= 0x20000u;
v9 = *(_QWORD *)(a1 + 744);
if ( v9 )
goto LABEL_17;
v9 = *(_QWORD *)(a1 + 48);
if ( !v9 )
{
if ( *(_QWORD *)(a1 + 664) )
{
v9 = a1 + 112;
LABEL_17:
LOBYTE(v6) = 1;
v10 = 0;
return sub_18009C2B0(v9, a2, v10, v6);
}
v9 = *(_QWORD *)(a1 + 736);
if ( !v9 )
v9 = v4;
}
LOBYTE(v6) = 1;
v10 = 1;
return sub_18009C2B0(v9, a2, v10, v6);
}
return result;
}