//
// sub_1800CEB90 from 0x1800ceb90 to 0x1800cecd7 (327 bytes)
//
// 4 xrefs:
// > sub_1800CD290 @ 0x1800cd49b
// > sub_1801026E0 @ 0x180102b7d
// > sub_1801026E0 @ 0x180102c6c
// > ??> @ 0x1801fe88c
//
// 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_1800CEB90(__int64 *a1, unsigned int *a2)
{
__int64 v4; // rdx
_QWORD *v5; // r9
_QWORD *v6; // rcx
__int64 v7; // rdx
unsigned int v8; // r8d
__int64 v9; // rdx
int i; // edi
__int64 result; // rax
char v12; // [rsp+40h] [rbp+8h] BYREF
(*(void (__fastcall **)(__int64 *, _QWORD))(*a1 + 144))(a1, *a2);
sub_1800CEE10(a1, v4);
(*(void (__fastcall **)(__int64 *))(*a1 + 72))(a1);
v5 = (_QWORD *)a1[59];
v6 = v5;
if ( v5 )
{
if ( a1[4] )
{
if ( v5[5] )
{
v7 = a2[2];
v8 = a2[3];
if ( (unsigned int)v7 < v8 )
{
(*(void (__fastcall **)(_QWORD *, __int64, _QWORD))(*v5 + 136LL))(v5, v7, v8 - (unsigned int)v7 + 1);
v6 = (_QWORD *)a1[59];
}
}
}
}
if ( v6 && a1[4] && (int)a2[6] >= -1 )
(*(void (__fastcall **)(_QWORD *))(*v6 + 144LL))(v6);
sub_1800CFA60(a1, a2[1], 2);
(*(void (__fastcall **)(__int64 *, __int64, _QWORD))(*a1 + 32))(a1, v9, 0);
for ( i = 0; i < 4; ++i )
(*(void (__fastcall **)(__int64 *, _QWORD))(*a1 + 120))(a1, (unsigned int)i);
if ( !a1[46]
|| ((*(void (__fastcall **)(__int64 *, char *))(*a1 + 496))(a1, &v12),
result = sub_18000EBC0((__int64)a1, a1[10], 0, 1u, v12 != 0, 0),
!(_DWORD)result) )
{
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)a2 + 2) + 200LL))(*((_QWORD *)a2 + 2));
*(_DWORD *)(*((_QWORD *)a2 + 2) + 60LL) &= ~0x8000u;
return 0;
}
return result;
}