//
// DS_Dictionary::addBoolValuesToMapForKeySpecial from 0xb49918 to 0xb49d2c (1044 bytes)
//
// 2 xrefs:
// > GameLevelManager::dataLoaded @ 0x73a1cc
// > ??> @ 0x80ac0
//
// 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::addBoolValuesToMapForKeySpecial(
DS_Dictionary *a1,
std::map *a2,
const char *a3,
bool a4)
{
__int64 *v4; // x23
char *v5; // x0
pugi::xml_node_struct *root; // x19
unsigned int *v7; // x19
int v8; // w0
std::_rb_tree_base *m_parent; // x27
std::_rb_tree_base *v10; // x22
size_t v11; // x28
const void *v12; // x2
const void *v13; // x0
size_t v14; // x26
size_t v15; // x2
signed __int64 v16; // x0
std::_rb_tree_base *v17; // x24
const void *v18; // x2
const void *v19; // x1
size_t v20; // x22
size_t v21; // x2
signed __int64 v22; // x0
std::_rb_tree_base *v23; // x22
__int64 v24; // x0
const void **v25; // x19
std::_rb_tree_base *insert_hint_unique_pos; // x0
__int64 v27; // x1
std::_rb_tree_base *v28; // x23
__int64 v29; // x22
const void *v30; // x2
_QWORD *v31; // x0
unsigned __int64 v32; // x19
const void *v33; // x1
unsigned __int64 v34; // x23
size_t v35; // x2
unsigned int v36; // w0
__int64 v37; // x19
__int64 v38; // x0
__int64 v39; // x1
void *v40; // x0
std::_rb_tree_base *v41; // x0
unsigned int *v42; // x1
int v43; // w2
std::_rb_tree_base *p_m_header; // [xsp+80h] [xbp+80h]
pugi::xml_node v48; // [xsp+98h] [xbp+98h] BYREF
pugi::xml_node v49; // [xsp+A0h] [xbp+A0h] BYREF
if ( a3 && !a4 && !DS_Dictionary::stepIntoSubDictWithKey(a1, a3) )
return;
v48._root = (pugi::xml_node_struct *)pugi::xml_node::first_child(a1->dictTree.m_finish - 1);
LABEL_7:
if ( pugi::xml_node::operator void (*)(pugi::xml_node***)(&v48) )
{
v5 = (char *)pugi::xml_node::child_value(&v48);
sub_D153B8((int)&v49, v5);
root = v49._root;
if ( atoi((const char *)v49._root) > 0 )
goto LABEL_4;
if ( sub_D1641C((int)&v49, "Rate") != -1
|| sub_D1641C((int)&v49, "like") != -1
|| sub_D1641C((int)&v49, "report") != -1 )
{
root = v49._root;
LABEL_4:
v4 = (__int64 *)((char *)root - 24);
goto LABEL_5;
}
m_parent = a2->m_header.m_parent;
p_m_header = &a2->m_header;
if ( !m_parent )
{
v17 = &a2->m_header;
goto LABEL_40;
}
root = v49._root;
v10 = &a2->m_header;
v4 = (__int64 *)((char *)v49._root - 24);
v11 = *((_QWORD *)v49._root - 3);
while ( 1 )
{
v12 = *(const void **)&m_parent[1].m_isblack;
v13 = v12;
v14 = *((_QWORD *)v12 - 3);
if ( v14 > v11 )
v15 = v11;
else
v15 = *((_QWORD *)v12 - 3);
LODWORD(v16) = memcmp(v13, root, v15);
if ( !(_DWORD)v16 )
{
v16 = v14 - v11;
if ( (__int64)(v14 - v11) > 0x7FFFFFFF )
goto LABEL_31;
if ( v16 < (__int64)0xFFFFFFFF80000000LL )
goto LABEL_55;
}
if ( (v16 & 0x80000000) != 0 )
{
LABEL_55:
m_parent = m_parent->m_right;
goto LABEL_32;
}
LABEL_31:
v10 = m_parent;
m_parent = m_parent->m_left;
LABEL_32:
if ( !m_parent )
{
v17 = v10;
if ( p_m_header == v10 )
goto LABEL_40;
v18 = *(const void **)&v10[1].m_isblack;
v19 = v18;
v20 = *((_QWORD *)v18 - 3);
if ( v20 > v11 )
v21 = v11;
else
v21 = *((_QWORD *)v18 - 3);
LODWORD(v22) = memcmp(root, v19, v21);
if ( (_DWORD)v22 )
goto LABEL_56;
v22 = v11 - v20;
if ( (__int64)(v11 - v20) <= 0x7FFFFFFF )
{
if ( v22 < (__int64)0xFFFFFFFF80000000LL )
goto LABEL_40;
LABEL_56:
if ( (v22 & 0x80000000) != 0 )
{
LABEL_40:
v23 = v17;
v24 = operator new(0x30u);
v25 = (const void **)(v24 + 32);
v17 = (std::_rb_tree_base *)v24;
sub_D18D28(v24 + 32);
LOBYTE(v17[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,
v23,
v25);
v28 = insert_hint_unique_pos;
v29 = v27;
if ( v27 )
{
if ( insert_hint_unique_pos || p_m_header == (std::_rb_tree_base *)v27 )
{
v38 = 1;
}
else
{
v30 = *(const void **)(v27 + 32);
v31 = *(_QWORD **)&v17[1].m_isblack;
v32 = *(v31 - 3);
v33 = v30;
v34 = *((_QWORD *)v30 - 3);
if ( v34 > v32 )
v35 = *(v31 - 3);
else
v35 = *((_QWORD *)v30 - 3);
v36 = memcmp(v31, v33, v35);
if ( v36 )
{
LABEL_50:
v38 = v36 >> 31;
}
else
{
v37 = v32 - v34;
v38 = 0;
if ( v37 <= 0x7FFFFFFF )
{
v38 = 1;
if ( v37 >= (__int64)0xFFFFFFFF80000000LL )
{
v36 = v37;
goto LABEL_50;
}
}
}
}
sub_CFAD74(v38, v17, v29, p_m_header);
++a2->m_nodecount;
}
else
{
v39 = *(_QWORD *)&v17[1].m_isblack;
v40 = (void *)(v39 - 24);
if ( (__int64 *)(v39 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v39 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(v39 - 8);
*(_DWORD *)(v39 - 8) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v40);
}
v41 = v17;
v17 = v28;
operator delete(v41);
}
root = v49._root;
v4 = (__int64 *)((char *)v49._root - 24);
}
}
LOBYTE(v17[1].m_parent) = 1;
LABEL_5:
if ( v4 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)((char *)root - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *((_DWORD *)root - 2);
*((_DWORD *)root - 2) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v4);
}
v49._root = (pugi::xml_node_struct *)pugi::xml_node::next_sibling(&v48);
v48._root = (pugi::xml_node_struct *)pugi::xml_node::next_sibling(&v49);
goto LABEL_7;
}
}
}
if ( a3 )
DS_Dictionary::stepOutOfSubDict(a1);
}