//
// sub_1800DCD70 from 0x1800dcd70 to 0x1800dcf59 (489 bytes)
//
// 6 xrefs:
// > sub_1800DE150 @ 0x1800de28d
// > sub_1800DE460 @ 0x1800de5ef
// > sub_1800DE830 @ 0x1800deccd
// > ??> @ 0x18014c4a8
// > ??> @ 0x18014c4bc
// > ??> @ 0x1801c4e24
//
// 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:22:35 +0000
//
char *__fastcall sub_1800DCD70(char *Source, char *a2, int a3, int a4, int a5)
{
__int64 v5; // rbp
__int64 v6; // r14
int v9; // r10d
_DWORD *v10; // rax
char *v13; // rsi
void *v14; // rax
__int64 v15; // rax
__int64 v16; // r9
unsigned __int8 *v17; // rdx
char v18; // r8
bool v19; // cc
__int64 v20; // r8
unsigned __int8 *v21; // rcx
char v22; // dl
bool v23; // cc
v5 = 0;
v6 = a4;
v9 = 0;
v10 = &unk_1801B4118;
while ( *(v10 - 72) )
{
if ( !*v10 )
{
++v9;
break;
}
if ( !v10[72] )
{
v9 += 2;
break;
}
if ( !v10[144] )
{
v9 += 3;
break;
}
v10 += 288;
v9 += 4;
if ( (__int64)v10 > (__int64)&qword_1801B51F8 )
break;
}
if ( v9 > 15 )
return nullptr;
v13 = (char *)&unk_1801B3FF8 + 288 * v9;
*(_DWORD *)v13 = 1;
*((_QWORD *)v13 + 1) = calloc(a3, 4u);
*((_QWORD *)v13 + 3) = calloc(v6 + 4LL * a5, 1u);
v14 = calloc(a5, 1u);
*((_DWORD *)v13 + 4) = a3;
*((_QWORD *)v13 + 5) = v14;
*((_DWORD *)v13 + 8) = v6;
*((_DWORD *)v13 + 12) = a5;
strncpy(v13 + 52, Source, 0x7Fu);
strncpy(v13 + 192, a2, 0x20u);
v15 = sub_1800DD2C0(v13 + 192);
if ( v15 )
{
v16 = 0;
v17 = (unsigned __int8 *)(v15 + 162);
while ( 1 )
{
v18 = *(v17 - 1);
switch ( v18 )
{
case 3:
if ( *v17 >> 4 >= *((_DWORD *)v13 + 12) )
goto LABEL_29;
break;
case 2:
v19 = (int)*v17 < *((_DWORD *)v13 + 8);
LABEL_19:
if ( !v19 )
goto LABEL_29;
break;
case 1:
v19 = (int)*v17 < *((_DWORD *)v13 + 4);
goto LABEL_19;
}
++v16;
v17 += 4;
if ( v16 > 14 )
{
v20 = 0;
v21 = (unsigned __int8 *)(v15 + 222);
while ( 1 )
{
v22 = *(v21 - 1);
switch ( v22 )
{
case 3:
if ( *v21 >> 4 >= *((_DWORD *)v13 + 12) )
goto LABEL_29;
break;
case 2:
v23 = (int)*v21 < *((_DWORD *)v13 + 8);
LABEL_26:
if ( !v23 )
goto LABEL_29;
break;
case 1:
v23 = (int)*v21 < *((_DWORD *)v13 + 4);
goto LABEL_26;
}
++v20;
v21 += 4;
if ( v20 > 5 )
goto LABEL_28;
}
}
}
}
LABEL_28:
v5 = v15;
LABEL_29:
*((_QWORD *)v13 + 29) = v5;
return v13;
}