//
// sub_1005CDDA0 from 0x1005cdda0 to 0x1005ce2b9 (1305 bytes)
//
// 1 xrefs:
// > sub_1005CA870 @ 0x1005cb63e
//
// 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 12:32:51 +0000
//
void __fastcall sub_1005CDDA0(__int64 *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rcx
__int64 v4; // rcx
int v5; // r14d
char *v6; // rdi
const char *v7; // rdi
int v8; // eax
int v9; // eax
signed int v10; // r13d
char *v11; // r14
signed int v12; // r12d
__int64 v13; // rax
char *v14; // rdi
const char *v15; // rdi
int v16; // r15d
signed int v17; // ebx
char *v18; // rdi
const char *v19; // rdi
signed int v20; // r14d
int v21; // r12d
int v22; // r13d
signed int v23; // r12d
char *v24; // r14
int v25; // ebx
int v26; // r13d
int v27; // ebx
int v28; // r13d
float v29; // xmm0_4
char *v30; // rdi
const char *v31; // rdi
float v32; // xmm0_4
char *v33; // rdi
const char *v34; // rdi
float v35; // xmm0_4
char *v36; // rdi
const char *v37; // rdi
float v38; // xmm0_4
char *v39; // rdi
const char *v40; // rdi
char *v41; // rdi
const char *v42; // rdi
float v43; // xmm0_4
char *v44; // rdi
const char *v45; // rdi
float **v46; // r12
float *v47; // rax
float **v48; // rbx
int v49; // eax
float *v50; // r14
__int64 v51; // rax
void **v52; // rbx
void **v53; // r14
void *v54; // rdi
std::string v55; // [rsp+10h] [rbp-90h] BYREF
int v56; // [rsp+2Ch] [rbp-74h]
void *__p; // [rsp+30h] [rbp-70h] BYREF
void **v58; // [rsp+38h] [rbp-68h]
signed int v59; // [rsp+48h] [rbp-58h]
float v60; // [rsp+58h] [rbp-48h]
float v61; // [rsp+5Ch] [rbp-44h]
int v62; // [rsp+60h] [rbp-40h]
float v63; // [rsp+64h] [rbp-3Ch]
float v64; // [rsp+68h] [rbp-38h]
int v65; // [rsp+6Ch] [rbp-34h]
char *v66; // [rsp+70h] [rbp-30h]
memset(&v55, 0, sizeof(v55));
v2 = *((int *)a1 + 6);
v3 = *a1;
if ( (int)v2 < (int)(-1431655765 * ((unsigned __int64)(a1[1] - *a1) >> 3)) )
{
*((_DWORD *)a1 + 6) = v2 + 1;
std::string::operator=(&v55, (const std::string *)(v3 + 24 * v2));
}
sub_1005C67B0((__int64)&__p, (unsigned __int8 *)&v55, "|", a1[4]);
v4 = v59;
v5 = 0;
if ( v59 < (int)(-1431655765 * ((unsigned __int64)((char *)v58 - (_BYTE *)__p) >> 3)) )
{
++v59;
v6 = (char *)__p + 24 * v4;
if ( (*v6 & 1) != 0 )
v7 = *((const char **)v6 + 2);
else
v7 = v6 + 1;
v5 = atoi(v7);
}
sub_10001ADF0(a2, *(_QWORD **)(a2 + 8));
*(_QWORD *)a2 = a2 + 8;
*(_OWORD *)(a2 + 8) = 0;
if ( v5 > 0 )
{
v8 = 0;
v56 = v5;
while ( 1 )
{
v62 = v8;
v10 = v59;
v11 = (char *)__p;
v12 = -1431655765 * ((unsigned __int64)((char *)v58 - (_BYTE *)__p) >> 3);
if ( v59 >= v12 )
{
v16 = 0;
}
else
{
v13 = v59;
v10 = ++v59;
v14 = (char *)__p + 24 * v13;
v15 = (*v14 & 1) != 0 ? *((const char **)v14 + 2) : v14 + 1;
v16 = atoi(v15);
}
v61 = 0.0;
v66 = v11;
if ( v10 >= v12 )
break;
v17 = v10 + 1;
v59 = v10 + 1;
v18 = &v11[24 * v10];
if ( (*v18 & 1) != 0 )
v19 = *((const char **)v18 + 2);
else
v19 = v18 + 1;
v29 = atof(v19);
v63 = v29;
v20 = v12;
if ( v17 >= v12 )
goto LABEL_22;
v21 = v10 + 2;
v59 = v10 + 2;
v30 = &v66[24 * v17];
if ( (*v30 & 1) != 0 )
v31 = *((const char **)v30 + 2);
else
v31 = v30 + 1;
v32 = atof(v31);
v61 = v32;
v60 = 0.0;
if ( v21 >= v20 )
{
LABEL_23:
v22 = v21;
v64 = 0.0;
v23 = v20;
v24 = v66;
if ( v22 >= v23 )
goto LABEL_24;
goto LABEL_38;
}
LABEL_34:
v22 = v21 + 1;
v59 = v21 + 1;
v33 = &v66[24 * v21];
if ( (*v33 & 1) != 0 )
v34 = *((const char **)v33 + 2);
else
v34 = v33 + 1;
v23 = v20;
v35 = atof(v34);
v64 = v35;
v24 = v66;
if ( v22 >= v23 )
{
LABEL_24:
v25 = v22;
if ( v22 >= v23 )
goto LABEL_25;
goto LABEL_42;
}
LABEL_38:
v25 = v22 + 1;
v59 = v22 + 1;
v36 = &v24[24 * v22];
if ( (*v36 & 1) != 0 )
v37 = *((const char **)v36 + 2);
else
v37 = v36 + 1;
v38 = atof(v37);
v60 = v38;
if ( v25 >= v23 )
{
LABEL_25:
v65 = 0;
v26 = v25;
LODWORD(v66) = 0;
if ( v25 >= v23 )
goto LABEL_26;
goto LABEL_46;
}
LABEL_42:
v26 = v25 + 1;
v59 = v25 + 1;
v39 = &v24[24 * v25];
if ( (*v39 & 1) != 0 )
v40 = *((const char **)v39 + 2);
else
v40 = v39 + 1;
v65 = atoi(v40);
LODWORD(v66) = 0;
if ( v26 >= v23 )
{
LABEL_26:
v27 = v26;
v28 = 0;
if ( v27 >= v23 )
goto LABEL_54;
LABEL_50:
v59 = v27 + 1;
v44 = &v24[24 * v27];
if ( (*v44 & 1) != 0 )
v45 = *((const char **)v44 + 2);
else
v45 = v44 + 1;
v28 = atoi(v45);
goto LABEL_54;
}
LABEL_46:
v27 = v26 + 1;
v59 = v26 + 1;
v41 = &v24[24 * v26];
if ( (*v41 & 1) != 0 )
v42 = *((const char **)v41 + 2);
else
v42 = v41 + 1;
v43 = atof(v42);
*(float *)&v66 = v43;
v28 = 0;
if ( v27 < v23 )
goto LABEL_50;
LABEL_54:
v46 = (float **)(a2 + 8);
while ( 1 )
{
v47 = *v46;
v48 = v46;
if ( !*v46 )
break;
while ( 1 )
{
v46 = (float **)v47;
v49 = *((_DWORD *)v47 + 7);
if ( v16 < v49 )
break;
if ( v16 <= v49 )
{
v50 = (float *)v46;
goto LABEL_11;
}
v47 = v46[1];
if ( !v47 )
{
v48 = v46 + 1;
goto LABEL_60;
}
}
}
LABEL_60:
v50 = (float *)operator new(0x40u);
*((_DWORD *)v50 + 7) = v16;
*((_DWORD *)v50 + 8) = v16;
v50[9] = v63;
v50[10] = v61;
v50[11] = v64;
v50[12] = 0.0;
*((_DWORD *)v50 + 13) = v65;
*((_DWORD *)v50 + 14) = (_DWORD)v66;
*((_DWORD *)v50 + 15) = v28;
*(_OWORD *)v50 = 0;
*((_QWORD *)v50 + 2) = v46;
*v48 = v50;
v51 = **(_QWORD **)a2;
if ( v51 )
*(_QWORD *)a2 = v51;
sub_10001B680(*(__int64 **)(a2 + 8), (__int64 *)v50);
++*(_QWORD *)(a2 + 16);
LABEL_11:
v9 = v62;
v50[12] = v60;
v8 = v9 + 1;
if ( v8 == v56 )
goto LABEL_63;
}
v17 = v10;
v63 = 0.0;
v20 = v12;
LABEL_22:
v21 = v17;
v60 = 0.0;
if ( v17 >= v20 )
goto LABEL_23;
goto LABEL_34;
}
LABEL_63:
v52 = (void **)__p;
if ( __p )
{
v53 = v58;
v54 = __p;
if ( v58 != __p )
{
do
{
if ( (*(_BYTE *)(v53 - 3) & 1) != 0 )
operator delete(*(v53 - 1));
v53 -= 3;
}
while ( v53 != v52 );
v54 = __p;
}
v58 = v52;
operator delete(v54);
}
if ( (*(_BYTE *)&v55.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v55.__r_.__value_.__l.__data_);
}