//
// DS_Dictionary::stepBackToRootSubDict from 0x10017d050 to 0x10017d1c8 (376 bytes)
//
// 1 xrefs:
// > CCAnimateFrameCache::addDict_1 @ 0x10056c658
//
// 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::stepBackToRootSubDict(DS_Dictionary *a1)
{
pugi::xml_node *begin; // rax
std::__vector_base
::pointer end; // r14
pugi::xml_node *value; // rax
pugi::xml_node *v4; // r15
std::__vector_base::pointer v5; // rsi
signed __int64 v6; // r14
__int64 v7; // r13
__int64 v8; // rax
unsigned __int64 v9; // r15
pugi::xml_node *v10; // r12
std::__vector_base::pointer __src; // [rsp+0h] [rbp-40h]
pugi::xml_node *v12; // [rsp+8h] [rbp-38h]
_QWORD v13[6]; // [rsp+10h] [rbp-30h] BYREF
begin = a1->dictTree.__begin_;
if ( (std::__vector_base::pointer)((char *)a1->dictTree.__end_ - (char *)begin) >= (std::__vector_base::pointer)9 )
{
a1->dictTree.__end_ = begin;
pugi::xml_node::xml_node(v13);
end = a1->dictTree.__end_;
value = a1->dictTree.__end_cap_.__value_;
if ( end >= value )
{
v5 = a1->dictTree.__begin_;
v6 = (char *)end - (char *)v5;
v7 = v6 >> 3;
if ( (unsigned __int64)((v6 >> 3) + 1) >> 61 )
sub_100183910();
v8 = (char *)value - (char *)v5;
v9 = v8 >> 2;
if ( v8 >> 2 <= (unsigned __int64)((v6 >> 3) + 1) )
v9 = (v6 >> 3) + 1;
if ( (unsigned __int64)v8 >= 0x7FFFFFFFFFFFFFF8LL )
v9 = 0x1FFFFFFFFFFFFFFFLL;
__src = a1->dictTree.__begin_;
if ( v9 )
{
if ( v9 > 0x1FFFFFFFFFFFFFFFLL )
sub_100054850();
v10 = (pugi::xml_node *)operator new(8 * v9);
}
else
{
v10 = nullptr;
}
v12 = &v10[v9];
v10[v7] = (pugi::xml_node)v13[0];
v4 = &v10[v7 + 1];
memcpy(v10, __src, v6);
a1->dictTree.__begin_ = v10;
a1->dictTree.__end_ = v4;
a1->dictTree.__end_cap_.__value_ = v12;
if ( __src )
operator delete(__src);
}
else
{
end->_root = (pugi::xml_node_struct *)v13[0];
v4 = end + 1;
}
a1->dictTree.__end_ = v4;
v13[0] = sub_10063B550(a1, "plist");
a1->dictTree.__end_[-1]._root = (pugi::xml_node_struct *)sub_10063B550(v13, "dict");
}
}