//
// sub_D2E4A4 from 0xd2e4a4 to 0xd2e7b8 (788 bytes)
//
// 6 xrefs:
// > sub_D2E7B8 @ 0xd2e7fc
// > sub_D2E7B8 @ 0xd2e8dc
// > sub_D2E7B8 @ 0xd2e914
// > sub_D2EA80 @ 0xd2eb08
// > sub_D2EA80 @ 0xd2eb70
// > sub_D2EA80 @ 0xd2ec34
//
// 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_D2E4A4(__int64 result, unsigned int a2, _QWORD *a3, int a4)
{
_QWORD *v4; // x19
__int64 v5; // x20
unsigned int **v8; // x2
__int64 v9; // x24
__int64 v10; // x22
__int64 v11; // x1
__int64 v12; // x0
__int64 v13; // x1
__int64 v14; // x0
__int64 v15; // x19
unsigned int v16; // w0
__int64 v17; // x2
void (__fastcall *v18)(__int64, __int64, __int64); // x3
__int64 v19; // x2
void (__fastcall *v20)(__int64, __int64, __int64); // x3
__int64 v21; // x1
__int64 v22; // x2
void (__fastcall *v23)(__int64, __int64, __int64); // x3
__int64 v24; // x1
const char *v25; // x22
char v26; // w23
__int64 v27; // x0
__int64 v28; // x2
void (__fastcall *v29)(__int64, __int64, __int64); // x3
v4 = a3;
v5 = result;
if ( !a3 )
return result;
result = *(unsigned int *)(result + 304);
if ( (_DWORD)result )
return result;
while ( 1 )
{
result = *((unsigned int *)v4 + 4);
if ( (_DWORD)result )
goto LABEL_12;
v8 = (unsigned int **)v4[1];
result = *(unsigned int *)v8;
if ( !a4 && (unsigned int)(result - 28) <= 4 )
goto LABEL_12;
*((_DWORD *)v4 + 4) = 1;
v9 = *(_QWORD *)(v5 + 288);
*(_QWORD *)(v5 + 288) = v4[3];
if ( (_DWORD)result == 41 )
{
result = sub_D2EA80(v5, a2, v8 + 2, *v4);
*(_QWORD *)(v5 + 288) = v9;
return result;
}
if ( (_DWORD)result == 42 )
{
result = sub_D2E7B8(v5, a2, v8 + 1, *v4);
*(_QWORD *)(v5 + 288) = v9;
return result;
}
if ( (_DWORD)result == 2 )
break;
result = sub_D2DC24(v5, a2, (__int64)v8);
*(_QWORD *)(v5 + 288) = v9;
LABEL_12:
v4 = (_QWORD *)*v4;
if ( v4 )
{
result = *(unsigned int *)(v5 + 304);
if ( !(_DWORD)result )
continue;
}
return result;
}
v10 = *(_QWORD *)(v5 + 296);
*(_QWORD *)(v5 + 296) = 0;
sub_D2A218(v5, a2, v8[1]);
*(_QWORD *)(v5 + 296) = v10;
v11 = *(_QWORD *)(v5 + 256);
if ( (a2 & 4) != 0 )
{
if ( v11 == 255 )
{
v22 = *(_QWORD *)(v5 + 280);
v23 = *(void (__fastcall **)(__int64, __int64, __int64))(v5 + 272);
*(_BYTE *)(v5 + 255) = 0;
v23(v5, 255, v22);
v14 = 1;
v11 = 0;
++*(_QWORD *)(v5 + 312);
}
else
{
v14 = v11 + 1;
}
*(_QWORD *)(v5 + 256) = v14;
*(_BYTE *)(v5 + v11) = 46;
*(_BYTE *)(v5 + 264) = 46;
}
else
{
if ( v11 == 255 )
{
v19 = *(_QWORD *)(v5 + 280);
v20 = *(void (__fastcall **)(__int64, __int64, __int64))(v5 + 272);
*(_BYTE *)(v5 + 255) = 0;
v20(v5, 255, v19);
v21 = *(_QWORD *)(v5 + 312);
v12 = 1;
*(_BYTE *)v5 = 58;
*(_QWORD *)(v5 + 312) = v21 + 1;
LABEL_19:
v13 = v12 + 1;
}
else
{
v12 = v11 + 1;
*(_QWORD *)(v5 + 256) = v11 + 1;
*(_BYTE *)(v5 + v11) = 58;
*(_BYTE *)(v5 + 264) = 58;
if ( v11 != 254 )
goto LABEL_19;
v17 = *(_QWORD *)(v5 + 280);
v18 = *(void (__fastcall **)(__int64, __int64, __int64))(v5 + 272);
*(_BYTE *)(v5 + 255) = 0;
v18(v5, 255, v17);
v13 = 1;
v12 = 0;
++*(_QWORD *)(v5 + 312);
}
*(_QWORD *)(v5 + 256) = v13;
*(_BYTE *)(v5 + v12) = 58;
*(_BYTE *)(v5 + 264) = 58;
}
v15 = *(_QWORD *)(v4[1] + 16LL);
v16 = *(_DWORD *)v15;
if ( *(_DWORD *)v15 != 70 )
goto LABEL_27;
v24 = *(_QWORD *)(v5 + 256);
v25 = "{default arg#";
do
{
v26 = *v25;
v27 = v24;
if ( v24 == 255 )
{
v28 = *(_QWORD *)(v5 + 280);
v29 = *(void (__fastcall **)(__int64, __int64, __int64))(v5 + 272);
*(_BYTE *)(v5 + 255) = 0;
v29(v5, 255, v28);
v24 = 1;
v27 = 0;
++*(_QWORD *)(v5 + 312);
}
else
{
++v24;
}
*(_QWORD *)(v5 + 256) = v24;
++v25;
*(_BYTE *)(v5 + v27) = v26;
*(_BYTE *)(v5 + 264) = v26;
}
while ( v25 != "" );
sub_D22578(v5, *(_DWORD *)(v15 + 16) + 1);
sub_D22370(v5, "}::");
do
{
v15 = *(_QWORD *)(v15 + 8);
v16 = *(_DWORD *)v15;
LABEL_27:
;
}
while ( v16 - 28 <= 4 );
result = sub_D2A218(v5, a2, (unsigned int *)v15);
*(_QWORD *)(v5 + 288) = v9;
return result;
}