//
// DS_Dictionary::setSubDictForKey from 0x180020250 to 0x18002040f (447 bytes)
//
// 4 xrefs:
// > DS_Dictionary::setArrayForKey @ 0x18001e730
// > DS_Dictionary::setObjectForKey @ 0x18001f49f
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aed58
//
// 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 __fastcall DS_Dictionary::setSubDictForKey(DS_Dictionary *this, char *a2, char a3, char a4)
{
const char *v8; // rsi
const char *v9; // r8
char *v10; // rax
const char *v11; // r8
__int64 *v12; // rax
__int64 v13; // rax
const char *v14; // r8
std::_Vector_val>::pointer Mylast; // rdx
__int64 v16; // [rsp+20h] [rbp-38h] BYREF
pugi::xml_node_struct *v17; // [rsp+28h] [rbp-30h] BYREF
_BYTE v18[40]; // [rsp+30h] [rbp-28h] BYREF
__int64 v19; // [rsp+60h] [rbp+8h] BYREF
pugi::xml_node::xml_node((cocos2d::CCThread *)&v16);
v8 = "k";
if ( !a3 )
goto LABEL_9;
v9 = "k";
if ( this->compatible )
v9 = "key";
sub_18007FB10(&this->dictTree._Mypair._Myval2._Mylast[-1], &v19, v9);
if ( sub_18007F4E0(&v19) )
{
while ( 1 )
{
v10 = (char *)sub_18007FB70(&v19);
if ( !sub_1800190E0(v10, a2) )
break;
v11 = "k";
if ( this->compatible )
v11 = "key";
v19 = *(_QWORD *)sub_180081A50(&v19, v18, v11);
if ( !sub_18007F4E0(&v19) )
goto LABEL_9;
}
if ( this->compatible )
v8 = "key";
v12 = (__int64 *)sub_180081070(&this->dictTree._Mypair._Myval2._Mylast[-1], v18, v8, &v19);
}
else
{
LABEL_9:
if ( this->compatible )
v8 = "key";
v12 = (__int64 *)sub_18007F870(&this->dictTree._Mypair._Myval2._Mylast[-1], v18, v8);
}
v16 = *v12;
v13 = sub_18007F910(&v16, &v19, 3);
sub_180085410(v13, a2);
v14 = "d";
if ( this->compatible )
v14 = "dict";
sub_180080EE0(&this->dictTree._Mypair._Myval2._Mylast[-1], &v17, v14, &v16);
if ( a4 )
{
Mylast = this->dictTree._Mypair._Myval2._Mylast;
if ( Mylast == this->dictTree._Mypair._Myval2._Myend )
{
sub_180015D80((const void **)&this->dictTree._Mypair._Myval2._Myfirst, Mylast, &v17);
}
else
{
Mylast->_root = v17;
++this->dictTree._Mypair._Myval2._Mylast;
}
}
}