//
// DS_Dictionary::setIntegerForKey from 0x18001f0b0 to 0x18001f32d (637 bytes)
//
// 3 xrefs:
// > DS_Dictionary::setIntegerForKey @ 0x18001f0a3
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aece0
//
// 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
//
// Hidden C++ exception states: #wind=1
void __fastcall DS_Dictionary::setIntegerForKey(DS_Dictionary *this, char *a2, int a3, char a4)
{
const char *v7; // rbx
const char *v8; // r8
char *v9; // rax
const char *v10; // r8
_QWORD *v11; // rax
__int64 v12; // rax
size_t v13; // rsi
size_t v14; // rcx
void *v15; // rbx
void *v16; // rbx
const char *v17; // r8
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // [rsp+20h] [rbp-E0h] BYREF
_BYTE v21[8]; // [rsp+28h] [rbp-D8h] BYREF
_QWORD v22[2]; // [rsp+30h] [rbp-D0h] BYREF
size_t Size; // [rsp+40h] [rbp-C0h] BYREF
size_t v24; // [rsp+48h] [rbp-B8h]
void *Src; // [rsp+50h] [rbp-B0h]
_BYTE v26[504]; // [rsp+58h] [rbp-A8h] BYREF
if ( a3 )
{
Size = 0;
v24 = 500;
Src = v26;
sub_180015970((__int64)&Size, a3, (__int64)&v20);
pugi::xml_node::xml_node((cocos2d::CCThread *)v22);
v7 = "k";
if ( !a4 )
goto LABEL_10;
v8 = "k";
if ( this->compatible )
v8 = "key";
sub_18007FB10(&this->dictTree._Mypair._Myval2._Mylast[-1], &v20, v8);
if ( sub_18007F4E0(&v20) )
{
while ( 1 )
{
v9 = (char *)sub_18007FB70(&v20);
if ( !sub_1800190E0(v9, a2) )
break;
v10 = "k";
if ( this->compatible )
v10 = "key";
v20 = *(_QWORD *)sub_180081A50(&v20, v21, v10);
if ( !sub_18007F4E0(&v20) )
goto LABEL_10;
}
if ( this->compatible )
v7 = "key";
v11 = (_QWORD *)sub_180081070(&this->dictTree._Mypair._Myval2._Mylast[-1], v21, v7, &v20);
}
else
{
LABEL_10:
if ( this->compatible )
v7 = "key";
v11 = (_QWORD *)sub_18007F870(&this->dictTree._Mypair._Myval2._Mylast[-1], v21, v7);
}
v22[0] = *v11;
v12 = sub_18007F910(v22, v21, 3);
sub_180085410(v12, a2);
v13 = Size;
v14 = Size + 1;
if ( Size + 1 <= v24 )
{
v15 = Src;
}
else
{
if ( v14 < (v24 >> 1) + v24 )
v14 = (v24 >> 1) + v24;
v24 = v14;
v15 = operator new(v14);
memmove(v15, Src, Size);
if ( Src != v26 )
j_j_free_0(Src);
Src = v15;
}
*((_BYTE *)v15 + v13) = 0;
v16 = Src;
v17 = "i";
if ( this->compatible )
v17 = "integer";
v18 = sub_180080EE0(&this->dictTree._Mypair._Myval2._Mylast[-1], v21, v17, v22);
v19 = sub_18007F910(v18, &v20, 3);
sub_180085410(v19, v16);
if ( Src != v26 )
j_j_free_0(Src);
}
}