//
// sub_180066F80 from 0x180066f80 to 0x180067154 (468 bytes)
//
// 4 xrefs:
// > ??> @ 0x180182f18
// > ??> @ 0x180182f28
// > ??> @ 0x1801ac8c8
// > ??> @ 0x1801f9390
//
// 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:53:26 +0000
//
__int64 __fastcall sub_180066F80(__int64 *a1, __int64 a2, __int64 a3, int a4, int a5)
{
__int64 v5; // rbx
int v7; // edx
int v8; // esi
__int64 v9; // rbp
int v10; // edi
__int64 result; // rax
__int64 v12; // [rsp+A0h] [rbp+8h] BYREF
__int64 v13; // [rsp+A8h] [rbp+10h] BYREF
int v14; // [rsp+B8h] [rbp+20h] BYREF
v5 = *a1;
v7 = a5;
v8 = a4;
v9 = a3;
a5 = a4;
v12 = a3;
v10 = *(_DWORD *)(v5 + 616);
v14 = v10;
v13 = a2;
if ( v7 == *(_DWORD *)(v5 + 628)
|| ((*(_DWORD *)(v5 + 628) = v7, v7 <= *(_DWORD *)(v5 + 448))
|| (result = sub_180068270(v5, *(unsigned int *)(v5 + 600)), !(_DWORD)result))
&& (result = sub_1800683A0(v5), !(_DWORD)result) )
{
if ( v10 )
{
result = sub_180067CD0(
v5,
(unsigned int)&v12,
(unsigned int)&v13,
*(_QWORD *)(v5 + 576),
v5 + 608,
v5 + 604,
*(_DWORD *)(v5 + 596),
*(_DWORD *)(v5 + 568),
*(_DWORD *)(v5 + 560),
*(_DWORD *)(v5 + 552),
(__int64)&a5,
*(_DWORD *)(v5 + 628),
(__int64)&v14,
v5 + 612);
if ( (_DWORD)result )
return result;
v8 = a5;
v9 = v12;
a2 = v13;
v10 = v14;
}
if ( v8 )
(*(void (__fastcall **)(__int64, __int64, _QWORD, _QWORD, _DWORD, __int64, __int64, _DWORD, _DWORD, _DWORD, _DWORD, int, _DWORD))qword_1801D2E30)(
v9,
a2,
*(_QWORD *)(v5 + 576),
*(unsigned int *)(v5 + 608),
*(_DWORD *)(v5 + 604),
v5 + 608,
v5 + 604,
*(_DWORD *)(v5 + 596),
*(_DWORD *)(v5 + 568),
*(_DWORD *)(v5 + 560),
*(_DWORD *)(v5 + 552),
v8,
*(_DWORD *)(v5 + 628));
*(_DWORD *)(v5 + 616) = v10;
return 0;
}
return result;
}