//
// cocos2d::CCDictionary::copyWithZone from 0x10030fc60 to 0x10030fe40 (480 bytes)
//
// 1 xrefs:
// > ??> @ 0x10090fe18
//
// 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
//
cocos2d::CCObject *__fastcall cocos2d::CCDictionary::copyWithZone(cocos2d::CCDictionary *a1, cocos2d::CCZone *a2)
{
double v2; // xmm0_8
cocos2d::CCDictionary *v3; // r15
cocos2d::CCDictionary::CCDictType m_eDictType; // eax
cocos2d::CCDictElement *v5; // r14
cocos2d::CCDictElement *v6; // r15
cocos2d::CCObject *v7; // rbx
cocos2d::CCDictElement *m_pElements; // r13
cocos2d::CCDictElement *next; // rbx
__int64 v10; // r15
size_t v11; // rax
size_t v12; // r14
cocos2d::CCDictElement *v13; // r12
char *v14; // rbx
cocos2d::CCDictionary *v15; // r15
size_t v16; // r15
cocos2d::CCObject *v18; // [rsp+0h] [rbp-50h]
_QWORD __dst[2]; // [rsp+8h] [rbp-48h] BYREF
void *__p; // [rsp+18h] [rbp-38h]
cocos2d::CCDictionary *v21; // [rsp+20h] [rbp-30h]
v3 = (cocos2d::CCDictionary *)operator new(0x48u);
cocos2d::CCObject::CCObject(v3);
v3->__vftable = (cocos2d::CCDictionary_vtbl *)off_10090FE18;
v3->m_pElements = nullptr;
v21 = v3;
v3->m_eDictType = kCCDictUnknown;
m_eDictType = a1->m_eDictType;
if ( m_eDictType == kCCDictStr )
{
m_pElements = a1->m_pElements;
if ( !m_pElements )
return v21;
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
v10 = sub_10048AAA0(m_pElements->m_pObject);
v11 = strlen(m_pElements->m_szKey);
if ( v11 > 0xFFFFFFFFFFFFFFF7LL )
LABEL_20:
sub_100006BF0(v2);
v12 = v11;
while ( 1 )
{
v18 = (cocos2d::CCObject *)v10;
v13 = next;
if ( v12 >= 0x17 )
break;
LOBYTE(__dst[0]) = 2 * v12;
v14 = (char *)__dst + 1;
v15 = v21;
if ( v12 )
goto LABEL_15;
LABEL_16:
v14[v12] = 0;
cocos2d::CCDictionary::setObject_1((__int64)v15, v18, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
cocos2d::CCObject::release(v18);
if ( !v13 )
return v21;
next = (cocos2d::CCDictElement *)v13->hh.next;
v10 = sub_10048AAA0(v13->m_pObject);
v12 = strlen(v13->m_szKey);
m_pElements = v13;
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_20;
}
v16 = (v12 | 7) + 1;
if ( (v12 | 7) == 0x17 )
v16 = 26;
v14 = (char *)operator new(v16);
__p = v14;
__dst[0] = v16 + 1;
__dst[1] = v12;
v15 = v21;
LABEL_15:
memmove(v14, m_pElements, v12);
goto LABEL_16;
}
if ( m_eDictType == kCCDictInt )
{
v5 = a1->m_pElements;
if ( v5 )
{
do
{
v6 = (cocos2d::CCDictElement *)v5->hh.next;
v7 = (cocos2d::CCObject *)sub_10048AAA0(v5->m_pObject);
cocos2d::CCDictionary::setObject(v21, v7, v5->m_iKey);
cocos2d::CCObject::release(v7);
v5 = v6;
}
while ( v6 );
}
}
return v21;
}