//
// sub_1800F5EC0 from 0x1800f5ec0 to 0x1800f5fae (238 bytes)
//
// 4 xrefs:
// > ??> @ 0x18018ecfc
// > ??> @ 0x18018ed0c
// > ??> @ 0x1801b0148
// > ??> @ 0x18020095c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 10:54:23 +0000
//
__int64 __fastcall sub_1800F5EC0(__int64 a1, __int64 a2, __int16 *a3, unsigned int a4)
{
__int64 v4; // r14
__int64 v6; // rbp
unsigned int v7; // edi
__int64 v8; // rsi
__int64 v9; // rbx
int v11; // [rsp+58h] [rbp+10h] BYREF
v4 = *(_QWORD *)(a1 + 8);
v6 = a4;
if ( (_DWORD)a2 )
return 31;
v7 = 0;
v8 = *((_QWORD *)off_1801AED20 + *(int *)(a1 + 48) + 44);
sub_1801023B0(v8, a2);
v9 = 0;
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v4 + 24LL))(v4) )
v9 = v4;
sub_1800F6220(v4);
if ( a3 )
{
sub_1800E4020(v8, &v11, nullptr);
if ( v11 )
{
if ( ((v11 - 1) & v11) == 0 )
v7 = sub_1800F65E0(v4, (int)a3 + 2, 2, *a3, (v6 - 2) / (unsigned __int64)(2LL * *a3));
}
}
if ( v9 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v9 + 32LL))(v9);
sub_1801023F0(v8);
return v7;
}