//
// sub_14052A4F0 from 0x14052a4f0 to 0x14052a7e4 (756 bytes)
//
// 2 xrefs:
// > sub_140545920 @ 0x1405471d2
// > ??> @ 0x14092b724
//
// 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 11:33:41 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall sub_14052A4F0(__int64 *a1, _QWORD *a2)
{
__int64 v4; // r8
__int64 v5; // rdx
size_t *v6; // r8
void *v7; // rdx
__int64 v8; // rax
int v9; // ebx
__int64 v10; // rcx
const char *v11; // rcx
__int64 v12; // rdi
int v13; // ecx
__int64 v14; // rdx
const char *v15; // rcx
const char *v16; // rcx
unsigned int v17; // r8d
_QWORD *v18; // r9
__int64 *v19; // rcx
__int64 v20; // rax
__int64 v21; // rdx
__int64 v22; // rcx
__int64 v23; // rbx
void *v24; // rcx
int v25; // [rsp+30h] [rbp-49h] BYREF
__int128 v26; // [rsp+38h] [rbp-41h] BYREF
__int64 v27; // [rsp+48h] [rbp-31h]
int v28; // [rsp+50h] [rbp-29h]
__int64 v29; // [rsp+58h] [rbp-21h]
_BYTE v30[16]; // [rsp+60h] [rbp-19h] BYREF
void *Block[2]; // [rsp+70h] [rbp-9h] BYREF
__m128i si128; // [rsp+80h] [rbp+7h]
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
v4 = *a1;
v5 = *((int *)a1 + 6);
if ( (int)v5 < (int)((a1[1] - *a1) >> 5) )
{
*((_DWORD *)a1 + 6) = v5 + 1;
v6 = (size_t *)(32 * v5 + v4);
if ( Block != (void **)v6 )
{
v7 = v6;
if ( v6[3] > 0xF )
v7 = (void *)*v6;
sub_1400405A0(Block, v7, v6[2]);
}
}
v8 = a1[4];
v26 = 0;
v27 = 0;
v28 = 0;
v29 = v8;
sub_1401C5360((__int64 *)Block, (unsigned __int8 *)&word_14070D07C, (__int64 *)&v26);
v9 = 0;
v10 = v28;
if ( v28 < (int)((__int64)(*((_QWORD *)&v26 + 1) - v26) >> 5) )
{
++v28;
v11 = (const char *)(32 * v10 + v26);
if ( *((_QWORD *)v11 + 3) > 0xFu )
v11 = *(const char **)v11;
v9 = atoi(v11);
}
sub_140066610(a2);
if ( v9 > 0 )
{
v12 = (unsigned int)v9;
v13 = v28;
v14 = v26;
while ( 1 )
{
v25 = 0;
if ( v13 < (int)((*((_QWORD *)&v26 + 1) - v14) >> 5) )
{
v28 = v13 + 1;
v15 = (const char *)(32LL * v13 + v14);
if ( *((_QWORD *)v15 + 3) > 0xFu )
v15 = *(const char **)v15;
v25 = atoi(v15);
v13 = v28;
v14 = v26;
}
if ( v13 >= (int)((*((_QWORD *)&v26 + 1) - v14) >> 5) )
goto LABEL_35;
v28 = v13 + 1;
v16 = (const char *)(32LL * v13 + v14);
if ( *((_QWORD *)v16 + 3) > 0xFu )
v16 = *(const char **)v16;
v17 = atoi(v16);
if ( v17 )
{
v18 = (_QWORD *)a1[4];
if ( v18 )
break;
}
LABEL_34:
v14 = v26;
v13 = v28;
LABEL_35:
if ( !--v12 )
goto LABEL_36;
}
v19 = (__int64 *)(v18[1826]
+ 16
* (v18[1829]
& (0x100000001B3LL
* (((unsigned __int64)v17 >> 24)
^ (0x100000001B3LL
* ((0x100000001B3LL
* ((0x100000001B3LL * ((unsigned __int8)v17 ^ 0xCBF29CE484222325uLL)) ^ BYTE1(v17)))
^ BYTE2(v17)))))));
v20 = v19[1];
v21 = v18[1824];
if ( v20 != v21 )
{
v22 = *v19;
if ( v17 == *(_DWORD *)(v20 + 16) )
{
LABEL_27:
if ( !v20 )
v20 = v18[1824];
if ( v20 == v21 )
v23 = 0;
else
v23 = *(_QWORD *)(v20 + 24);
if ( v23 )
*(_QWORD *)(*(_QWORD *)sub_14018C8D0(a2, (__int64)v30, (unsigned __int8 *)&v25) + 24LL) = v23;
goto LABEL_34;
}
while ( v20 != v22 )
{
v20 = *(_QWORD *)(v20 + 8);
if ( v17 == *(_DWORD *)(v20 + 16) )
goto LABEL_27;
}
}
v20 = 0;
goto LABEL_27;
}
LABEL_36:
sub_1400760C0((__int64 *)&v26);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v24 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
}