//
// sub_1800A5A00 from 0x1800a5a00 to 0x1800a5bdc (476 bytes)
//
// 4 xrefs:
// > sub_1800A5E20 @ 0x1800a5e7c
// > ??> @ 0x180186b04
// > ??> @ 0x180186b14
// > ??> @ 0x1801fb790
//
// 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:53 +0000
//
__int64 __fastcall sub_1800A5A00(__int64 *a1)
{
__int64 v1; // rbx
int v2; // esi
LPVOID *v3; // rdi
int v4; // eax
__int64 v5; // rdx
unsigned int v6; // edi
__int64 v7; // rdx
unsigned int v9; // [rsp+50h] [rbp+8h] BYREF
__int64 v10; // [rsp+58h] [rbp+10h] BYREF
LPVOID pv; // [rsp+60h] [rbp+18h] BYREF
__int64 v12; // [rsp+68h] [rbp+20h] BYREF
v1 = *a1;
v2 = 0;
if ( *(int *)(*a1 + 720) > 0 )
{
v3 = (LPVOID *)(v1 + 728);
do
{
CoTaskMemFree(*v3);
++v2;
++v3;
}
while ( v2 < *(_DWORD *)(v1 + 720) );
}
*(_DWORD *)(v1 + 720) = 0;
v10 = 0;
v4 = (*(__int64 (__fastcall **)(_QWORD, __int64, _QWORD, __int64 *))(**(_QWORD **)(v1 + 704) + 32LL))(
*(_QWORD *)(v1 + 704),
1,
0,
&v10);
if ( v4 != -2147023728 )
{
if ( v4 < 0 )
return 57;
v5 = *(int *)(v1 + 720);
*(_DWORD *)(v1 + 720) = v5 + 1;
if ( (*(int (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 40LL))(v10, v1 + 728 + 8 * v5) < 0 )
return 57;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 16LL))(v10);
}
v12 = 0;
if ( (*(int (__fastcall **)(_QWORD, __int64, __int64, __int64 *))(**(_QWORD **)(v1 + 704) + 24LL))(
*(_QWORD *)(v1 + 704),
2,
1,
&v12) < 0 )
return 57;
v9 = 0;
if ( (*(int (__fastcall **)(__int64, unsigned int *))(*(_QWORD *)v12 + 24LL))(v12, &v9) < 0 )
return 57;
v6 = 0;
if ( v9 )
{
while ( *(int *)(v1 + 720) < 32 )
{
if ( (*(int (__fastcall **)(__int64, _QWORD, __int64 *))(*(_QWORD *)v12 + 32LL))(v12, v6, &v10) < 0 )
return 49;
pv = nullptr;
if ( (*(int (__fastcall **)(__int64, LPVOID *))(*(_QWORD *)v10 + 40LL))(v10, &pv) < 0 )
return 57;
if ( *(int *)(v1 + 720) >= 32 || (v7 = *(_QWORD *)(v1 + 728)) != 0 && !(unsigned int)sub_1800B82D0(pv, v7) )
CoTaskMemFree(pv);
else
*(_QWORD *)(v1 + 8LL * (int)(*(_DWORD *)(v1 + 720))++ + 728) = pv;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 16LL))(v10);
if ( ++v6 >= v9 )
break;
}
}
CoTaskMemFree(nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 16LL))(v12);
return 0;
}