//
// sub_18002C750 from 0x18002c750 to 0x18002c9ea (666 bytes)
//
// 2 xrefs:
// > sub_18002CFF0 @ 0x18002d034
// > ??> @ 0x1801f783c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_18002C750(__int64 a1, _DWORD *a2, _DWORD *a3)
{
__int64 v3; // rax
_DWORD *v5; // rbx
_DWORD *v6; // r12
_DWORD *v7; // r14
int v8; // ebp
__int16 *v9; // r15
int v10; // r13d
int v11; // eax
int v12; // ebx
int v13; // edi
int v14; // ebp
int v15; // edi
char v16; // al
_DWORD *v17; // r14
_DWORD *v18; // rdi
int v19; // ebp
int *v21; // r14
int v23; // ebx
__int16 v24; // di
_DWORD *v25; // r14
_DWORD *v26; // rdi
int v29; // eax
int v30; // eax
int v31; // eax
int v32; // eax
int v33; // [rsp+20h] [rbp-158h]
_BYTE v35[256]; // [rsp+30h] [rbp-148h] BYREF
v3 = *(_QWORD *)(a1 + 376);
v5 = a3;
v6 = a2;
v7 = a2;
v8 = *(_DWORD *)(v3 + 18520);
v9 = *(__int16 **)(v3 + 18504);
v10 = v8 << (*(_BYTE *)(v3 + 18512) - 1);
if ( *(_DWORD *)(v3 + 18512) == 1 )
{
if ( v8 )
{
v23 = *(_DWORD *)(v3 + 18520);
do
{
v24 = *v9;
*v7++ = (char)sub_18002B930(a1, *v9);
v9 += 2 * (1 << v24);
--v23;
}
while ( v23 );
v5 = a3;
v25 = v35;
v26 = v6;
do
{
if ( *v26++ )
*v25++ = (char)sub_18002B9C0(a1, 2);
--v8;
}
while ( v8 );
}
goto LABEL_22;
}
v11 = *(_DWORD *)(v3 + 18516);
v33 = v11;
if ( v11 )
{
v12 = v11;
do
{
v13 = *v9;
*v7 = (char)sub_18002B930(a1, v13);
v7[1] = (char)sub_18002B930(a1, v13);
v7 += 2;
v9 += 2 * (1 << v13);
--v12;
}
while ( v12 );
v5 = a3;
v11 = v33;
}
v14 = v8 - v11;
if ( !v14 )
{
LABEL_9:
v17 = v35;
v18 = v6;
v19 = v10;
if ( v10 )
{
do
{
if ( *v18++ )
*v17++ = (char)sub_18002B9C0(a1, 2);
--v19;
}
while ( v19 );
v21 = (int *)v35;
LABEL_23:
while ( !*v6++ )
{
LABEL_34:
if ( !--v10 )
return 0;
}
v29 = *v21++;
if ( v29 )
{
v30 = v29 - 1;
if ( v30 )
{
if ( v30 == 1 )
{
v31 = sub_18002B9C0(a1, 6);
*v5 = v31;
}
else
{
*v5 = sub_18002B9C0(a1, 6);
v31 = sub_18002B9C0(a1, 6);
}
v5[1] = v31;
goto LABEL_33;
}
v32 = sub_18002B9C0(a1, 6);
*v5 = v32;
}
else
{
*v5 = sub_18002B9C0(a1, 6);
v32 = sub_18002B9C0(a1, 6);
}
v5[1] = v32;
v31 = sub_18002B9C0(a1, 6);
LABEL_33:
v5[2] = v31;
v5 += 3;
goto LABEL_34;
}
LABEL_22:
v21 = (int *)v35;
if ( v10 )
goto LABEL_23;
return 0;
}
while ( 1 )
{
v15 = *v9;
v16 = sub_18002B930(a1, v15);
*v7 = v16;
v7[1] = v16;
v7 += 2;
if ( v15 < 0 )
return 13;
v9 += 2 * (1 << v15);
if ( !--v14 )
goto LABEL_9;
}
}