//
// sub_DD89A0 from 0xdd89a0 to 0xdd8d34 (916 bytes)
//
// 8 xrefs:
// > sub_DD72CC @ 0xdd740c
// > sub_DD72CC @ 0xdd74b8
// > sub_DD72CC @ 0xdd751c
// > sub_DD72CC @ 0xdd7654
// > sub_DD72CC @ 0xdd7708
// > sub_DD89A0 @ 0xdd8a64
// > sub_DD8D34 @ 0xdd8db0
// > sub_DD8E00 @ 0xdd8f7c
//
// 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:09:05 +0000
//
_QWORD *__fastcall sub_DD89A0(__int64 a1, _QWORD *a2, int a3)
{
unsigned __int8 **v3; // x23
__int64 v7; // x0
int v8; // w1
int v9; // w19
bool v10; // cc
int v11; // w20
__int64 v12; // x26
int v13; // w0
int v14; // w1
__int64 v15; // x2
_QWORD *v16; // x19
__int64 v17; // x0
__int64 v18; // x2
__int64 v19; // x0
_QWORD *v20; // x27
__int64 v21; // x0
int v22; // w1
unsigned __int8 *v23; // x4
__int64 v24; // x2
int v25; // w0
__int64 v26; // x0
__int64 v27; // x0
_QWORD *v28; // x0
__int64 v29; // x0
__int64 v30; // x0
__int64 v33; // [xsp+70h] [xbp+70h]
v3 = (unsigned __int8 **)(a1 + 8);
v7 = sub_DBE8C0(a1 + 8);
v9 = v8;
v10 = a3 <= v8;
v33 = v7;
v11 = v7;
if ( !v10 || !(_DWORD)v7 )
return a2;
while ( 1 )
{
sub_DBDEA0(v3);
v12 = sub_DD72CC(a1);
v13 = sub_DBE8C0((__int64)v3);
v15 = (unsigned int)v14;
if ( v14 > v9 )
{
while ( v13 )
{
v12 = sub_DD89A0(a1, v12, v15);
switch ( *(_DWORD *)(a1 + 40) )
{
case 1:
case 2:
v15 = 3;
v13 = v9 <= 2;
continue;
case 3:
case 4:
case 5:
case 6:
v15 = 4;
v13 = v9 <= 3;
continue;
case 7:
case 8:
v15 = 5;
v13 = v9 <= 4;
continue;
case 9:
goto LABEL_18;
case 0xA:
v15 = 7;
v13 = v9 <= 6;
continue;
case 0x14:
v23 = *(unsigned __int8 **)(a1 + 24);
v24 = *(_QWORD *)(a1 + 32) - (_QWORD)v23;
if ( !v24 )
{
if ( aGravityMod[8] )
goto LABEL_7;
LABEL_18:
v15 = 6;
v13 = v9 <= 5;
continue;
}
v25 = *v23;
switch ( v25 )
{
case 'o':
v26 = 0;
while ( v24 != ++v26 )
{
if ( (unsigned __int8)aBaseColor[v26 + 8] != v23[v26] )
goto LABEL_7;
}
if ( aBaseColor[v24 + 8] )
goto LABEL_7;
v15 = 1;
v13 = v9 <= 0;
break;
case 'a':
v27 = 0;
while ( v24 != ++v27 )
{
if ( (unsigned __int8)aSetupScaleComm[v27 + 16] != v23[v27] )
goto LABEL_7;
}
if ( aSetupScaleComm[v24 + 16] )
goto LABEL_7;
v15 = 2;
v13 = v9 <= 1;
break;
case 'd':
v29 = 0;
while ( v24 != ++v29 )
{
if ( (unsigned __int8)aDiv[v29] != v23[v29] )
goto LABEL_7;
}
if ( aDiv[v24] )
goto LABEL_7;
v15 = 6;
v13 = v9 <= 5;
break;
case 'm':
v30 = 0;
while ( v24 != ++v30 )
{
if ( (unsigned __int8)aGravityMod[v30 + 8] != v23[v30] )
goto LABEL_7;
}
if ( aGravityMod[v24 + 8] )
goto LABEL_7;
goto LABEL_18;
default:
goto LABEL_7;
}
break;
default:
goto LABEL_7;
}
}
}
LABEL_7:
if ( v11 == 15 && (*((_BYTE *)a2 + 1) != 1 || *(_BYTE *)(v12 + 1) != 1) )
sub_DBE628(a1, (__int64)"Union operator has to be applied to node sets");
v16 = *(_QWORD **)a1;
v17 = *(_QWORD *)(*(_QWORD *)a1 + 8LL);
if ( (unsigned __int64)(v17 + 40) > 0x1000 )
{
v28 = off_154A348(0x1008u);
if ( !v28 )
LABEL_52:
sub_631BF8(a1);
v20 = v28 + 1;
*v28 = *v16;
*v16 = v28;
v16[1] = 40;
}
else
{
v18 = *v16;
v16[1] = v17 + 40;
v19 = v18 + v17;
v20 = (_QWORD *)(v19 + 8);
if ( v19 == -8 )
goto LABEL_52;
}
*(_BYTE *)v20 = v11;
*(_WORD *)((char *)v20 + 1) = BYTE4(v33);
*((_BYTE *)v20 + 3) = 0;
v20[1] = a2;
v20[2] = v12;
v20[3] = 0;
v21 = sub_DBE8C0((__int64)v3);
v9 = v22;
v11 = v21;
v33 = v21;
if ( v22 < a3 || !(_DWORD)v21 )
return v20;
a2 = v20;
}
}