//
// sub_180113CC0 from 0x180113cc0 to 0x180113e0a (330 bytes)
//
// 4 xrefs:
// > sub_180114A80 @ 0x180114a93
// > ??> @ 0x180191140
// > ??> @ 0x180191154
// > ??> @ 0x180201da8
//
// 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:36 +0000
//
__int64 __fastcall sub_180113CC0(__int64 a1)
{
int v1; // edi
__int64 result; // rax
int v4; // eax
int v5; // edi
int v6; // r9d
__int64 i; // rcx
__int64 v8; // rdi
__int64 v9; // r11
__int64 j; // r10
int v11; // eax
__int64 v12; // r8
int *v13; // rdx
int k; // eax
v1 = *(_DWORD *)(a1 + 36);
if ( v1 == -1 )
return 28;
v4 = *(_DWORD *)(a1 + 8);
if ( v1 != v4 )
return 0;
v5 = 2 * v1;
if ( v5 < 4 )
v5 = 4;
if ( v5 <= v4 || *(_DWORD *)(a1 + 24) != v4 || *(_DWORD *)(a1 + 32) != -1 )
return 28;
if ( v5 <= (int)abs32(*(_DWORD *)(a1 + 28)) || (result = sub_180114EC0(a1 + 16, (unsigned int)v5), !(_DWORD)result) )
{
result = sub_1800887F0(a1, v5);
if ( !(_DWORD)result )
{
v6 = 0;
for ( i = 0; i < (unsigned int)v5; *(_DWORD *)(*(_QWORD *)a1 + 4 * i++) = -1 )
;
if ( *(int *)(a1 + 24) > 0 )
{
v8 = *(int *)(a1 + 24);
v9 = 0;
for ( j = 0; ; j += 16 )
{
v11 = *(_DWORD *)(a1 + 8);
if ( !v11 )
break;
v12 = *(_QWORD *)(a1 + 16);
v13 = (int *)(*(_QWORD *)a1 + 4LL * ((v11 - 1) & *(_DWORD *)(j + v12)));
for ( k = *v13; *v13 != -1; k = *v13 )
v13 = (int *)(16LL * k + v12 + 4);
*v13 = v6;
++v9;
++v6;
*(_DWORD *)(*(_QWORD *)(a1 + 16) + j + 4) = -1;
if ( v9 >= v8 )
return 0;
}
return 28;
}
return 0;
}
}
return result;
}