//
// sub_14052D490 from 0x14052d490 to 0x14052d64a (442 bytes)
//
// 2 xrefs:
// > sub_14052F080 @ 0x14052f0c3
// > ??> @ 0x14092b7f0
//
// 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:42 +0000
//
void __fastcall sub_14052D490(__int64 *a1, _QWORD *a2)
{
__int64 v4; // r8
__int64 v5; // rdx
size_t *v6; // r8
void *v7; // rdx
__int64 v8; // rax
__int64 v9; // rdi
__int64 v10; // rcx
const char *v11; // rcx
__int64 v12; // rbx
void *v13; // rcx
__int128 v14; // [rsp+30h] [rbp-58h] BYREF
__int64 v15; // [rsp+40h] [rbp-48h]
int v16; // [rsp+48h] [rbp-40h]
__int64 v17; // [rsp+50h] [rbp-38h]
void *Block[2]; // [rsp+58h] [rbp-30h] BYREF
__m128i si128; // [rsp+68h] [rbp-20h]
*(_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];
v14 = 0;
v15 = 0;
v16 = 0;
v17 = v8;
sub_1401C5360((__int64 *)Block, (unsigned __int8 *)&word_14070D07C, (__int64 *)&v14);
v9 = 0;
v10 = v16;
if ( v16 < (int)((__int64)(*((_QWORD *)&v14 + 1) - v14) >> 5) )
{
++v16;
v11 = (const char *)(32 * v10 + v14);
if ( *((_QWORD *)v11 + 3) > 0xFu )
v11 = *(const char **)v11;
v9 = (unsigned int)atoi(v11);
}
sub_140372450((__int64)a2, (int)v9);
if ( (int)v9 > 0 )
{
v12 = 0;
do
{
sub_14053A220(&v14, v12 + *a2);
v12 += 68;
--v9;
}
while ( v9 );
}
sub_1400760C0((__int64 *)&v14);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v13 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
}