//
// sub_CDF10C from 0xcdf10c to 0xcdf304 (504 bytes)
//
// 7 xrefs:
// > sub_CDF304 @ 0xcdf32c
// > sub_CDF344 @ 0xcdf4f8
// > sub_CDF6F4 @ 0xcdf898
// > sub_CDFB38 @ 0xcdfc38
// > sub_CE0038 @ 0xce0124
// > sub_CE03B4 @ 0xce04b4
// > sub_CE0668 @ 0xce0754
//
// 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
//
void *__fastcall sub_CDF10C(
__int64 a1,
unsigned __int8 a2,
_BYTE *a3,
unsigned __int8 *a4,
__int64 a5,
signed __int64 a6)
{
_BYTE *v6; // x19
int v7; // w24
int v8; // w1
size_t v11; // x21
__int64 v12; // x22
_BYTE *v14; // x0
_BYTE *v15; // x22
int v16; // w1
int v17; // w2
int v18; // w0
unsigned __int8 v19; // w0
unsigned __int8 v20; // w0
unsigned __int8 v21; // w0
unsigned __int8 v22; // w0
v6 = a3;
v7 = a2;
v8 = *(_DWORD *)(a1 + 24) & 0xB0;
v11 = a5 - a6;
if ( v8 != 32 )
{
v12 = 0;
if ( v8 != 16 )
{
LABEL_3:
memset(v6, v7, v11);
return memcpy(&v6[v11], &a4[v12], a6 - v12);
}
v14 = sub_CDB730(a1 + 208);
v15 = v14;
if ( v14[56] )
{
v16 = *a4;
if ( v16 == (unsigned __int8)v14[102] )
goto LABEL_14;
}
else
{
v19 = sub_CD9898((__int64)v14, 0x2Du);
v16 = *a4;
if ( v16 == v19 )
goto LABEL_14;
if ( !v15[56] )
{
sub_D204B0(v15);
v20 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v15 + 48LL))(v15, 43);
v16 = *a4;
if ( v16 != v20 )
{
if ( !v15[56] )
{
sub_D204B0(v15);
v21 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v15 + 48LL))(v15, 48);
v16 = *a4;
if ( v16 != v21 || a6 <= 1 )
goto LABEL_13;
if ( !v15[56] )
{
v22 = sub_CD9898((__int64)v15, 0x78u);
v17 = a4[1];
if ( v17 == v22 )
{
LABEL_26:
LOBYTE(v16) = *a4;
goto LABEL_27;
}
if ( !v15[56] )
{
v18 = (unsigned __int8)sub_CD9898((__int64)v15, 0x58u);
v17 = a4[1];
LABEL_12:
if ( v17 != v18 )
{
LABEL_13:
v12 = 0;
goto LABEL_3;
}
goto LABEL_26;
}
LABEL_11:
v18 = (unsigned __int8)v15[145];
goto LABEL_12;
}
LABEL_9:
if ( (unsigned __int8)v15[177] == a4[1] )
{
LABEL_27:
v12 = 2;
*v6 = v16;
v6 += 2;
*(v6 - 1) = a4[1];
goto LABEL_3;
}
v17 = a4[1];
goto LABEL_11;
}
LABEL_7:
if ( (unsigned __int8)v15[105] != v16 || a6 <= 1 )
goto LABEL_13;
goto LABEL_9;
}
LABEL_14:
*v6++ = v16;
v12 = 1;
goto LABEL_3;
}
}
if ( (unsigned __int8)v15[100] != v16 )
goto LABEL_7;
goto LABEL_14;
}
memcpy(a3, a4, a6);
return memset(&v6[a6], v7, v11);
}