//
// sub_DC1DDC from 0xdc1ddc to 0xdc23b0 (1492 bytes)
//
// 3 xrefs:
// > sub_DC5D74 @ 0xdc69bc
// > sub_DC5D74 @ 0xdc6a18
// > sub_DC5D74 @ 0xdc6a34
//
// This function is hookable on this platform (idp: arm, 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 13:08:48 +0000
//
__int64 __fastcall sub_DC1DDC(uint16x8_t *a1, unsigned __int8 a2, unsigned __int8 a3)
{
unsigned __int64 v6; // x2
__int32 v8; // w22
uint16x8_t *v9; // x1
uint16x8_t *v10; // x23
__int64 v11; // x0
char *v12; // x0
int v13; // w3
bool v14; // zf
__int16 v15; // w3
unsigned __int64 v16; // x2
unsigned __int64 v17; // x3
__int64 v18; // x1
uint16x8_t *v19; // x5
unsigned __int64 v20; // x4
__int64 v21; // x4
unsigned __int64 v22; // x1
unsigned __int8 v23; // w4
unsigned __int8 v24; // w4
unsigned __int8 v25; // w5
unsigned __int8 v26; // w4
unsigned __int8 v27; // w5
unsigned __int8 v28; // w6
int v29; // w4
unsigned __int8 *v30; // x0
int v31; // w3
unsigned __int8 v32; // w3
unsigned __int8 v33; // w4
unsigned __int8 v34; // w4
unsigned __int8 v35; // w7
int v36; // w3
__int64 v37; // x1
int v38; // w3
v6 = a1[640].n128_u64[1];
if ( v6 + 2 <= 0x800 )
{
a1->n128_u8[v6] = a2;
a1->n128_u8[v6 + 1] = a3;
a1[640].n128_u64[1] = v6 + 2;
return v6 + 1;
}
v8 = a1[641].n128_i32[0];
v9 = a1;
if ( v8 == 1 )
{
(*(void (__fastcall **)(unsigned __int64, uint16x8_t *))(*(_QWORD *)a1[640].n128_u64[0] + 16LL))(
a1[640].n128_u64[0],
a1);
goto LABEL_8;
}
v10 = a1 + 128;
if ( (unsigned int)(v8 - 2) > 1 )
{
if ( (unsigned int)(v8 - 5) <= 1 )
{
v11 = (char *)sub_DBE2E0((unsigned __int8 *)a1, a1[640].n128_u64[1], (int *)&a1[128]) - (char *)v10;
if ( v8 != 5 && v11 >> 2 )
{
v37 = 0;
do
{
v10->n128_u32[v37] = bswap32(v10->n128_u32[v37]);
++v37;
}
while ( v11 >> 2 != v37 );
}
goto LABEL_7;
}
v11 = 0;
if ( v8 != 9 )
goto LABEL_7;
v30 = (unsigned __int8 *)v10;
while ( 1 )
{
LABEL_49:
while ( 1 )
{
v31 = v9->n128_u8[0];
if ( (v31 & 0x80) == 0 )
break;
if ( (unsigned int)(v31 - 192) > 0x1F || v6 == 1 )
{
if ( (unsigned int)(v31 - 224) > 0xF || v6 <= 2 )
{
if ( (unsigned int)(v31 - 240) <= 7
&& v6 > 3
&& (v9->n128_u8[1] & 0xC0) == 0x80
&& (v9->n128_u8[2] & 0xC0) == 0x80
&& (v9->n128_u8[3] & 0xC0) == 0x80 )
{
*v30++ = 63;
v9 = (uint16x8_t *)((char *)v9 + 4);
v6 -= 4LL;
goto LABEL_56;
}
}
else
{
v34 = v9->n128_u8[1];
if ( (v34 & 0xC0) == 0x80 )
{
v35 = v9->n128_u8[2];
if ( (v35 & 0xC0) == 0x80 )
{
v36 = ((v31 & 0x1F) << 12) | ((v34 & 0x3F) << 6) | v35 & 0x3F;
v9 = (uint16x8_t *)((char *)v9 + 3);
v6 -= 3LL;
if ( v36 > 255 )
LOBYTE(v36) = 63;
*v30++ = v36;
goto LABEL_56;
}
}
}
}
else
{
v33 = v9->n128_u8[1];
if ( (v33 & 0xC0) == 0x80 )
{
v38 = ((v31 & 0x3F) << 6) | v33 & 0x3F;
v9 = (uint16x8_t *)((char *)v9 + 2);
v6 -= 2LL;
if ( v38 > 255 )
LOBYTE(v38) = 63;
*v30++ = v38;
goto LABEL_56;
}
}
v9 = (uint16x8_t *)((char *)v9 + 1);
--v6;
LABEL_56:
if ( !v6 )
{
v11 = v30 - (unsigned __int8 *)v10;
goto LABEL_7;
}
}
*v30++ = v31;
--v6;
if ( (((unsigned __int64)v9->n128_u64 + 1) & 3) != 0 || v6 <= 3 )
{
v9 = (uint16x8_t *)((char *)v9 + 1);
goto LABEL_56;
}
v14 = (*(unsigned __int32 *)((_BYTE *)v9->n128_u32 + 1) & 0x80808080) == 0;
v9 = (uint16x8_t *)((char *)v9 + 1);
if ( v14 )
{
while ( 1 )
{
v32 = v9->n128_u8[0];
v9 = (uint16x8_t *)((char *)v9 + 4);
*v30 = v32;
v30 += 4;
v6 -= 4LL;
*(v30 - 3) = v9[-1].n128_u8[13];
*(v30 - 2) = v9[-1].n128_u8[14];
*(v30 - 1) = v9[-1].n128_u8[15];
if ( v6 <= 3 )
goto LABEL_56;
if ( (v9->n128_u32[0] & 0x80808080) != 0 )
goto LABEL_49;
}
}
}
}
v12 = (char *)&a1[128];
do
{
LABEL_10:
while ( 1 )
{
v13 = v9->n128_u8[0];
if ( (v13 & 0x80) != 0 )
break;
*(_WORD *)v12 = v13;
v12 += 2;
--v6;
if ( (((unsigned __int64)v9->n128_u64 + 1) & 3) != 0 || v6 <= 3 )
{
v9 = (uint16x8_t *)((char *)v9 + 1);
goto LABEL_17;
}
v14 = (*(unsigned __int32 *)((_BYTE *)v9->n128_u32 + 1) & 0x80808080) == 0;
v9 = (uint16x8_t *)((char *)v9 + 1);
if ( v14 )
{
while ( 1 )
{
v15 = v9->n128_u8[0];
v9 = (uint16x8_t *)((char *)v9 + 4);
*(_WORD *)v12 = v15;
v12 += 8;
v6 -= 4LL;
*((_WORD *)v12 - 3) = v9[-1].n128_u8[13];
*((_WORD *)v12 - 2) = v9[-1].n128_u8[14];
*((_WORD *)v12 - 1) = v9[-1].n128_u8[15];
if ( v6 <= 3 )
goto LABEL_17;
if ( (v9->n128_u32[0] & 0x80808080) != 0 )
goto LABEL_10;
}
}
}
if ( (unsigned int)(v13 - 192) > 0x1F || v6 == 1 )
{
if ( (unsigned int)(v13 - 224) > 0xF || v6 <= 2 )
{
if ( (unsigned int)(v13 - 240) > 7
|| v6 <= 3
|| (v26 = v9->n128_u8[1], (v26 & 0xC0) != 0x80)
|| (v27 = v9->n128_u8[2], (v27 & 0xC0) != 0x80)
|| (v28 = v9->n128_u8[3], (v28 & 0xC0) != 0x80) )
{
LABEL_35:
v9 = (uint16x8_t *)((char *)v9 + 1);
--v6;
continue;
}
v29 = ((v13 & 0xF) << 18) | ((v27 & 0x3F) << 6) | v28 & 0x3F | ((v26 & 0x3F) << 12);
v12 += 4;
*((_WORD *)v12 - 1) = (v29 & 0x3FF) - 9216;
*((_WORD *)v12 - 2) = ((unsigned int)(v29 - 0x10000) >> 10) - 10240;
v9 = (uint16x8_t *)((char *)v9 + 4);
v6 -= 4LL;
}
else
{
v24 = v9->n128_u8[1];
if ( (v24 & 0xC0) != 0x80 )
goto LABEL_35;
v25 = v9->n128_u8[2];
if ( (v25 & 0xC0) != 0x80 )
goto LABEL_35;
v9 = (uint16x8_t *)((char *)v9 + 3);
*(_WORD *)v12 = ((v13 & 0x1F) << 12) | ((v24 & 0x3F) << 6) | v25 & 0x3F;
v12 += 2;
v6 -= 3LL;
}
}
else
{
v23 = v9->n128_u8[1];
if ( (v23 & 0xC0) != 0x80 )
goto LABEL_35;
v9 = (uint16x8_t *)((char *)v9 + 2);
*(_WORD *)v12 = ((v13 & 0x3F) << 6) | v23 & 0x3F;
v12 += 2;
v6 -= 2LL;
}
LABEL_17:
;
}
while ( v6 );
v11 = v12 - (char *)v10;
if ( v8 != 2 )
{
v16 = v11 >> 1;
if ( v11 >> 1 )
{
v17 = ((v16 - 8) >> 3) + 1;
v18 = 8 * v17;
if ( v16 - 1 <= 6 )
{
v18 = 0;
LABEL_24:
v10[(unsigned __int64)v18 / 8].n128_u16[0] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[0])
| (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[0] << 8);
if ( v16 > v18 + 1 )
{
v10[(unsigned __int64)v18 / 8].n128_u16[1] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[1])
| (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[1] << 8);
if ( v16 > v18 + 2 )
{
v10[(unsigned __int64)v18 / 8].n128_u16[2] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[2])
| (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[2] << 8);
if ( v16 > v18 + 3 )
{
v10[(unsigned __int64)v18 / 8].n128_u16[3] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[3])
| (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[3] << 8);
if ( v16 > v18 + 4 )
{
v21 = v18 + 5;
v10[(unsigned __int64)v18 / 8].n128_u16[4] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[4])
| (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[4] << 8);
if ( v16 > v18 + 5 )
{
v22 = v18 + 6;
v10->n128_u16[v21] = (unsigned __int8)HIBYTE(v10->n128_u16[v21])
| (unsigned __int16)(v10->n128_u16[v21] << 8);
if ( v16 > v22 )
v10->n128_u16[v22] = (unsigned __int8)HIBYTE(v10->n128_u16[v22])
| (unsigned __int16)(v10->n128_u16[v22] << 8);
}
}
}
}
}
}
else
{
v19 = v10;
v20 = 0;
do
{
++v20;
*v19 = vorrq_s8(vshlq_n_s16(*v19, 8u), vshrq_n_u16(*v19, 8u));
++v19;
}
while ( v17 > v20 );
if ( v16 != v18 )
goto LABEL_24;
}
}
}
LABEL_7:
(*(void (__fastcall **)(unsigned __int64, uint16x8_t *, __int64))(*(_QWORD *)a1[640].n128_u64[0] + 16LL))(
a1[640].n128_u64[0],
v10,
v11);
LABEL_8:
a1->n128_u8[0] = a2;
a1->n128_u8[1] = a3;
a1[640].n128_u64[1] = 2;
return 1;
}