//
// sub_1800CCF50 from 0x1800ccf50 to 0x1800cd22a (730 bytes)
//
// 3 xrefs:
// > sub_1800CE3D0 @ 0x1800ce502
// > ??> @ 0x1801fe70c
// > ??> @ 0x1801fe718
//
// 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:08 +0000
//
__int64 __fastcall sub_1800CCF50(__int64 a1, __int64 a2, char a3)
{
__int64 v6; // rdx
__int64 v7; // rcx
__int64 result; // rax
__int64 v9; // rax
__int64 v10; // [rsp+58h] [rbp+20h] BYREF
if ( a3 )
{
v6 = *(_QWORD *)(a1 + 8);
*(_QWORD *)(a1 + 496) = 0;
*(_DWORD *)(a1 + 24) = 1;
*(_QWORD *)(a1 + 16) = 0;
*(_QWORD *)(a1 + 40) = 0;
v7 = *(_QWORD *)(a1 + 472);
if ( (*(_DWORD *)(v7 + 60) & 0x10000) == 0 )
*(_DWORD *)(a1 + 548) = *(_DWORD *)(v6 + 70452);
*(_DWORD *)(a1 + 72) &= 0xFEEDFFD8;
*(_DWORD *)(a1 + 552) = 0;
*(_DWORD *)(a1 + 544) = 1065353216;
*(_DWORD *)(a1 + 52) = 1065353216;
*(_DWORD *)(a1 + 120) = 1065353216;
*(_DWORD *)(a1 + 164) = 1065353216;
*(_DWORD *)(a1 + 124) = 1065353216;
*(_DWORD *)(a1 + 192) = 0;
*(_DWORD *)(a1 + 156) = *(_DWORD *)(a2 + 120);
*(_DWORD *)(a1 + 160) = *(_DWORD *)(a2 + 124);
*(_DWORD *)(a1 + 152) = 0;
*(_DWORD *)(a1 + 168) = *(_DWORD *)(a2 + 128);
*(_DWORD *)(a1 + 172) = *(_DWORD *)(a2 + 132);
*(_DWORD *)(a1 + 176) = *(_DWORD *)(a2 + 136);
*(_QWORD *)(a1 + 180) = 0;
*(_DWORD *)(a1 + 188) = 1065353216;
*(_QWORD *)(a1 + 224) = *(_QWORD *)(a2 + 144);
*(_DWORD *)(a1 + 232) = *(_DWORD *)(a2 + 152);
*(_DWORD *)(a1 + 240) = 1065353216;
*(_QWORD *)(a1 + 244) = 1065353216;
*(_DWORD *)(a1 + 256) = 0;
*(_DWORD *)(a1 + 252) = *(_DWORD *)(v6 + 69704);
*(_QWORD *)(a1 + 88) = 1065353216;
*(_DWORD *)(a1 + 316) = 1065353216;
*(_QWORD *)(a1 + 336) = 0;
*(_DWORD *)(a1 + 320) = 1065353216;
*(_QWORD *)(a1 + 344) = 0;
*(_DWORD *)(a1 + 324) = 1065353216;
*(_QWORD *)(a1 + 352) = 0;
*(_DWORD *)(a1 + 328) = 1065353216;
*(_QWORD *)(a1 + 360) = 0;
*(_QWORD *)(a1 + 296) = 0;
*(_QWORD *)(a1 + 304) = 0;
*(_BYTE *)(a1 + 312) = 0;
}
else
{
v7 = *(_QWORD *)(a1 + 472);
}
if ( !v7 )
return 30;
*(_QWORD *)(v7 + 40) = a2;
*(_QWORD *)(*(_QWORD *)(a1 + 472) + 48LL) = 0;
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 56LL) = *(_DWORD *)(a2 + 44);
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 88LL) = *(_DWORD *)(a2 + 76);
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 92LL) = *(_DWORD *)(a2 + 80);
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 84LL) = *(_DWORD *)(a2 + 84);
*(_DWORD *)(*(_QWORD *)(a1 + 472) + 96LL) = *(_DWORD *)(a2 + 68);
*(_QWORD *)(*(_QWORD *)(a1 + 472) + 24LL) = a1;
_InterlockedAnd((volatile signed __int32 *)(a2 + 88), 0xFFFFF7FF);
result = sub_18009B6A0(*(_QWORD *)(a1 + 96), 0, 1u);
if ( !(_DWORD)result )
{
if ( !a3 )
goto LABEL_16;
if ( (*(_DWORD *)(*(_QWORD *)(a1 + 472) + 60LL) & 0x10000) != 0 )
_InterlockedOr((volatile signed __int32 *)(*(_QWORD *)(a1 + 96) + 100LL), 0x100u);
result = sub_180096490(*(_QWORD *)(a1 + 96), 0, 0, 4);
if ( !(_DWORD)result )
{
result = sub_180068B10(*(_QWORD *)(a1 + 112));
if ( !(_DWORD)result )
{
result = (*(__int64 (__fastcall **)(_QWORD, __int64, __int64 *))(**(_QWORD **)(a1 + 32) + 288LL))(
*(_QWORD *)(a1 + 32),
4294967293LL,
&v10);
if ( !(_DWORD)result )
{
result = sub_1800923A0(v10, *(_QWORD *)(a1 + 96), nullptr, 0, 0, nullptr);
if ( !(_DWORD)result )
{
LABEL_16:
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 472) + 40LL))(*(_QWORD *)(a1 + 472));
if ( !(_DWORD)result )
{
_InterlockedOr((volatile signed __int32 *)(a2 + 88), 4u);
v9 = *(_QWORD *)(a2 + 184);
if ( v9 )
_InterlockedOr((volatile signed __int32 *)(v9 + 88), 4u);
return 0;
}
}
}
}
}
}
return result;
}