//
// DS_Dictionary::addBoolValuesToMapForKey from 0xb49d2c to 0xb4a0cc (928 bytes)
//
// 2 xrefs:
// > GameLevelManager::dataLoaded @ 0x73a1b4
// > ??> @ 0x49fc8
//
// 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 DS_Dictionary::addBoolValuesToMapForKey(
DS_Dictionary *a1,
std::map *a2,
const char *a3,
bool a4)
{
char *v5; // x0
std::_rb_tree_base *m_parent; // x27
pugi::xml_node_struct *root; // x19
std::_rb_tree_base *v8; // x20
size_t v9; // x28
const void *v10; // x2
const void *v11; // x0
size_t v12; // x25
size_t v13; // x2
signed __int64 v14; // x0
const void *v15; // x2
const void *v16; // x1
size_t v17; // x22
size_t v18; // x2
signed __int64 v19; // x0
std::_rb_tree_base *v20; // x21
__int64 v21; // x0
const void **v22; // x19
std::_rb_tree_base *insert_hint_unique_pos; // x0
__int64 v24; // x1
std::_rb_tree_base *v25; // x22
__int64 v26; // x21
const void *v27; // x2
_QWORD *v28; // x0
unsigned __int64 v29; // x19
const void *v30; // x1
unsigned __int64 v31; // x22
size_t v32; // x2
unsigned int v33; // w0
__int64 v34; // x19
__int64 v35; // x0
unsigned int *v36; // x19
int v37; // w0
__int64 v38; // x1
void *v39; // x0
std::_rb_tree_base *v40; // x0
unsigned int *v41; // x1
int v42; // w2
__int64 *p; // [xsp+80h] [xbp+80h]
std::_rb_tree_base *p_m_header; // [xsp+88h] [xbp+88h]
pugi::xml_node v47; // [xsp+98h] [xbp+98h] BYREF
pugi::xml_node v48; // [xsp+A0h] [xbp+A0h] BYREF
if ( !a3 || a4 || DS_Dictionary::stepIntoSubDictWithKey(a1, a3) )
{
p_m_header = &a2->m_header;
v47._root = (pugi::xml_node_struct *)pugi::xml_node::first_child(a1->dictTree.m_finish - 1);
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&v47) )
goto LABEL_36;
while ( 1 )
{
v5 = (char *)pugi::xml_node::child_value(&v47);
sub_D153B8((int)&v48, v5);
m_parent = a2->m_header.m_parent;
if ( !m_parent )
{
v8 = &a2->m_header;
LABEL_21:
v20 = v8;
v21 = operator new(0x30u);
v22 = (const void **)(v21 + 32);
v8 = (std::_rb_tree_base *)v21;
sub_D18D28(v21 + 32);
LOBYTE(v8[1].m_parent) = 0;
insert_hint_unique_pos = (std::_rb_tree_base *)std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
a2,
v20,
v22);
v25 = insert_hint_unique_pos;
v26 = v24;
if ( v24 )
{
if ( insert_hint_unique_pos || p_m_header == (std::_rb_tree_base *)v24 )
{
v35 = 1;
}
else
{
v27 = *(const void **)(v24 + 32);
v28 = *(_QWORD **)&v8[1].m_isblack;
v29 = *(v28 - 3);
v30 = v27;
v31 = *((_QWORD *)v27 - 3);
if ( v31 > v29 )
v32 = *(v28 - 3);
else
v32 = *((_QWORD *)v27 - 3);
v33 = memcmp(v28, v30, v32);
if ( v33 )
{
LABEL_31:
v35 = v33 >> 31;
}
else
{
v34 = v29 - v31;
v35 = 0;
if ( v34 <= 0x7FFFFFFF )
{
v35 = 1;
if ( v34 >= (__int64)0xFFFFFFFF80000000LL )
{
v33 = v34;
goto LABEL_31;
}
}
}
}
sub_CFAD74(v35, v8, v26, p_m_header);
++a2->m_nodecount;
}
else
{
v38 = *(_QWORD *)&v8[1].m_isblack;
v39 = (void *)(v38 - 24);
if ( (__int64 *)(v38 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v38 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(_DWORD *)(v38 - 8);
*(_DWORD *)(v38 - 8) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v39);
}
v40 = v8;
v8 = v25;
operator delete(v40);
}
root = v48._root;
p = (__int64 *)((char *)v48._root - 24);
LABEL_34:
LOBYTE(v8[1].m_parent) = 1;
if ( p != &qword_124B6B0 )
goto LABEL_43;
goto LABEL_35;
}
root = v48._root;
v8 = &a2->m_header;
p = (__int64 *)((char *)v48._root - 24);
v9 = *((_QWORD *)v48._root - 3);
do
{
while ( 1 )
{
v10 = *(const void **)&m_parent[1].m_isblack;
v11 = v10;
v12 = *((_QWORD *)v10 - 3);
v13 = v12 > v9 ? v9 : *((_QWORD *)v10 - 3);
LODWORD(v14) = memcmp(v11, root, v13);
if ( (_DWORD)v14 )
break;
v14 = v12 - v9;
if ( (__int64)(v12 - v9) <= 0x7FFFFFFF )
{
if ( v14 < (__int64)0xFFFFFFFF80000000LL )
goto LABEL_39;
break;
}
LABEL_13:
v8 = m_parent;
m_parent = m_parent->m_left;
if ( !m_parent )
goto LABEL_14;
}
if ( (v14 & 0x80000000) == 0 )
goto LABEL_13;
LABEL_39:
m_parent = m_parent->m_right;
}
while ( m_parent );
LABEL_14:
if ( p_m_header == v8 )
goto LABEL_21;
v15 = *(const void **)&v8[1].m_isblack;
v16 = v15;
v17 = *((_QWORD *)v15 - 3);
if ( v17 > v9 )
v18 = v9;
else
v18 = *((_QWORD *)v15 - 3);
LODWORD(v19) = memcmp(root, v16, v18);
if ( (_DWORD)v19 )
goto LABEL_41;
v19 = v9 - v17;
if ( (__int64)(v9 - v17) > 0x7FFFFFFF )
goto LABEL_34;
if ( v19 < (__int64)0xFFFFFFFF80000000LL )
goto LABEL_21;
LABEL_41:
if ( (v19 & 0x80000000) != 0 )
goto LABEL_21;
LOBYTE(v8[1].m_parent) = 1;
if ( p != &qword_124B6B0 )
{
LABEL_43:
if ( &pthread_create )
{
v36 = (unsigned int *)((char *)root - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)root - 2);
*((_DWORD *)root - 2) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(p);
}
LABEL_35:
v48._root = (pugi::xml_node_struct *)pugi::xml_node::next_sibling(&v47);
v47._root = (pugi::xml_node_struct *)pugi::xml_node::next_sibling(&v48);
if ( !pugi::xml_node::operator void (*)(pugi::xml_node***)(&v47) )
{
LABEL_36:
if ( a3 )
DS_Dictionary::stepOutOfSubDict(a1);
return;
}
}
}
}