//
// sub_10054DDE0 from 0x10054dde0 to 0x10054e0ef (783 bytes)
//
// 3 xrefs:
// > sub_10054DDC0 @ 0x10054ddd4
// > sub_10054E170 @ 0x10054e1a0
// > sub_1005839A0 @ 0x100583a08
//
// This function is hookable on this platform (idp: pc, 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 12:32:02 +0000
//
void __fastcall sub_10054DDE0(int a1, __int64 a2)
{
std::mutex *v3; // r13
_QWORD *v4; // r14
unsigned __int8 *v5; // r13
unsigned __int8 *v6; // r15
char *v7; // rbx
unsigned int v8; // eax
size_t v9; // rdx
unsigned __int8 *v10; // rsi
unsigned int v11; // ecx
char *v12; // rsi
const void *v13; // rdi
unsigned __int8 *v14; // rsi
int IntegerForKey; // ebx
_OWORD *v16; // rbx
void *v17; // rdi
void *v18; // rdi
char *v19; // rbx
char *v20; // r15
const char *v21; // rsi
void *v22; // rdi
unsigned __int8 *v23; // rbx
void **v24; // r14
void *v25; // rdi
void **v26; // rbx
void **v27; // r14
unsigned __int8 *v28; // [rsp+8h] [rbp-78h]
void *__p; // [rsp+10h] [rbp-70h] BYREF
unsigned __int8 *v30; // [rsp+18h] [rbp-68h]
unsigned __int8 *v31; // [rsp+28h] [rbp-58h]
void *v32[2]; // [rsp+30h] [rbp-50h] BYREF
void *v33; // [rsp+40h] [rbp-40h]
std::mutex *v34; // [rsp+50h] [rbp-30h]
v3 = qword_100BE5588;
std::mutex::lock(qword_100BE5588);
v4 = operator new(0xF0u);
sub_100158EB0((__int64)v4);
if ( !(unsigned __int8)sub_10054C9E0((__int64)v4, a2) )
{
v17 = (void *)v4[26];
if ( v17 )
{
v4[27] = v17;
operator delete(v17);
}
pugi::xml_document::dxml_document(v4);
v18 = v4;
goto LABEL_61;
}
v31 = (unsigned __int8 *)a2;
v34 = v3;
*(_OWORD *)v32 = 0;
v33 = nullptr;
DS_Dictionary::getAllKeys((__int64)&__p, (__int64)v4);
v5 = (unsigned __int8 *)__p;
v6 = v30;
if ( __p != v30 )
{
v28 = v31 + 1;
do
{
if ( !a1 )
{
LABEL_30:
v16 = v32[1];
if ( v32[1] >= v33 )
{
v7 = sub_1000568A0((__int64)v32, (__int64)v5);
}
else
{
if ( (*v5 & 1) != 0 )
{
sub_10001AD30((_QWORD *)v32[1], *((const void **)v5 + 2), *((_QWORD *)v5 + 1));
}
else
{
*((_QWORD *)v32[1] + 2) = *((_QWORD *)v5 + 2);
*v16 = *(_OWORD *)v5;
}
v7 = (char *)v16 + 24;
}
v32[1] = v7;
goto LABEL_7;
}
if ( a1 != 3 )
{
if ( (*v5 & 1) != 0 )
v12 = *((char **)v5 + 2);
else
v12 = (char *)(v5 + 1);
if ( DS_Dictionary::stepIntoSubDictWithKey((__int64)v4, v12) )
{
IntegerForKey = DS_Dictionary::getIntegerForKey((__int64)v4, "t");
DS_Dictionary::stepOutOfSubDict((__int64)v4);
if ( (a1 != 2) != (IntegerForKey == 2) )
goto LABEL_30;
}
else if ( a1 != 2 )
{
goto LABEL_30;
}
goto LABEL_7;
}
v8 = *v5;
if ( (v8 & 1) != 0 )
{
v9 = *((_QWORD *)v5 + 1);
v10 = v31;
v11 = *v31;
if ( (v11 & 1) != 0 )
goto LABEL_17;
}
else
{
v9 = v8 >> 1;
v10 = v31;
v11 = *v31;
if ( (v11 & 1) != 0 )
{
LABEL_17:
if ( v9 != *((_QWORD *)v10 + 1) )
goto LABEL_7;
goto LABEL_18;
}
}
if ( v9 != v11 >> 1 )
goto LABEL_7;
LABEL_18:
if ( (v8 & 1) == 0 )
{
v13 = v5 + 1;
v14 = v28;
if ( (v11 & 1) == 0 )
goto LABEL_29;
LABEL_28:
v14 = *((unsigned __int8 **)v31 + 2);
goto LABEL_29;
}
v13 = *((const void **)v5 + 2);
v14 = v28;
if ( (v11 & 1) != 0 )
goto LABEL_28;
LABEL_29:
if ( !memcmp(v13, v14, v9) )
goto LABEL_30;
LABEL_7:
v5 += 24;
}
while ( v5 != v6 );
}
v19 = (char *)v32[0];
v20 = (char *)v32[1];
v3 = v34;
if ( v32[0] != v32[1] )
{
do
{
if ( (*v19 & 1) != 0 )
v21 = *((const char **)v19 + 2);
else
v21 = v19 + 1;
DS_Dictionary::removeKey_1((__int64)v4, v21);
v19 += 24;
}
while ( v19 != v20 );
sub_10054CEA0((__int64)v4);
}
v22 = (void *)v4[26];
if ( v22 )
{
v4[27] = v22;
operator delete(v22);
}
pugi::xml_document::dxml_document(v4);
operator delete(v4);
v23 = (unsigned __int8 *)__p;
if ( __p )
{
v24 = (void **)v30;
v25 = __p;
if ( v30 != __p )
{
do
{
if ( (*(_BYTE *)(v24 - 3) & 1) != 0 )
operator delete(*(v24 - 1));
v24 -= 3;
}
while ( v24 != (void **)v23 );
v25 = __p;
}
v30 = v23;
operator delete(v25);
}
v26 = (void **)v32[0];
if ( v32[0] )
{
v27 = (void **)v32[1];
v18 = v32[0];
if ( v32[1] != v32[0] )
{
do
{
if ( (*(_BYTE *)(v27 - 3) & 1) != 0 )
operator delete(*(v27 - 1));
v27 -= 3;
}
while ( v27 != v26 );
v18 = v32[0];
}
v32[1] = v26;
LABEL_61:
operator delete(v18);
}
std::mutex::unlock(v3);
}