//
// ObjectManager::loadCopiedSets from 0x100795c10 to 0x100795f8b (891 bytes)
//
// 2 xrefs:
// > ObjectManager::instance @ 0x1007956ce
// > ObjectManager::init @ 0x10079576f
//
// 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 ObjectManager::loadCopiedSets(ObjectManager *a1)
{
double v1; // xmm0_8
cocos2d::CCArray *v2; // rbx
unsigned int v3; // r14d
cocos2d::CCString *v4; // rdi
cocos2d::CCDictionary *m_objectDefinitions; // rbx
const char *CString; // r12
size_t v7; // rax
size_t v8; // r14
char *v9; // r15
__int64 v10; // rax
size_t v11; // r13
cocos2d::CCDictionary *v12; // r14
cocos2d::CCString *v13; // r12
cocos2d::CCString *v14; // rbx
cocos2d::CCDictionary *v15; // r14
const char *v16; // r13
size_t v17; // rax
size_t v18; // r12
char *v19; // r15
__int64 v20; // rax
size_t v21; // r14
cocos2d::CCString *v22; // rax
cocos2d::CCDictionary *v23; // rbx
cocos2d::CCDictionary *v24; // r14
const char *v25; // r12
size_t v26; // rax
size_t v27; // r13
char *v28; // r15
__int64 v29; // rax
size_t v30; // rbx
__int64 v31; // [rsp+8h] [rbp-68h]
cocos2d::CCDictionary *v32; // [rsp+10h] [rbp-60h]
unsigned int v33; // [rsp+1Ch] [rbp-54h]
cocos2d::CCDictionary *v35; // [rsp+28h] [rbp-48h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
v2 = cocos2d::CCDictionary::allKeys(a1->m_objectDefinitions);
if ( (unsigned int)sub_100720070((__int64)v2) )
{
v3 = 0;
v31 = (__int64)v2;
while ( 1 )
{
v33 = v3;
v4 = (cocos2d::CCString *)sub_1007200C0((__int64)v2, v3);
m_objectDefinitions = a1->m_objectDefinitions;
CString = cocos2d::CCString::getCString(v4);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_43:
sub_100006BF0(v1);
v8 = v7;
if ( v7 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
goto LABEL_11;
LABEL_12:
v9[v8] = 0;
v12 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1((__int64)m_objectDefinitions, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
LOBYTE(__dst) = 8;
*(_DWORD *)((char *)&__dst + 1) = 2037411683;
BYTE5(__dst) = 0;
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1((__int64)v12, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
LOBYTE(__dst) = 20;
strcpy((char *)&__dst + 1, "replaceTag");
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1((__int64)v12, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !v14 )
goto LABEL_3;
if ( v13 )
{
v15 = a1->m_objectDefinitions;
v16 = cocos2d::CCString::getCString(v13);
v17 = strlen(v16);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_43;
v18 = v17;
if ( v17 >= 0x17 )
{
v32 = v15;
v20 = v17 | 7;
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = v20 + 1;
v19 = (char *)operator new(v21);
__p = v19;
*(_QWORD *)&__dst = v21 + 1;
*((_QWORD *)&__dst + 1) = v18;
v15 = v32;
}
else
{
LOBYTE(__dst) = 2 * v17;
v19 = (char *)&__dst + 1;
if ( !v17 )
{
LABEL_28:
v19[v18] = 0;
v12 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1((__int64)v15, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
goto LABEL_30;
}
}
memmove(v19, v16, v18);
goto LABEL_28;
}
LABEL_30:
LOBYTE(__dst) = 6;
*(_DWORD *)((char *)&__dst + 1) = 8026488;
v22 = (cocos2d::CCString *)sub_1007AB360(&__dst);
v23 = ObjectManager::replaceAllOccurencesOfString(v22, v14, v12);
if ( (__dst & 1) != 0 )
operator delete(__p);
v24 = a1->m_objectDefinitions;
v25 = cocos2d::CCString::getCString(v4);
v26 = strlen(v25);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_43;
v27 = v26;
if ( v26 >= 0x17 )
{
v35 = v23;
v29 = v26 | 7;
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = v29 + 1;
v28 = (char *)operator new(v30);
__p = v28;
*(_QWORD *)&__dst = v30 + 1;
*((_QWORD *)&__dst + 1) = v27;
v23 = v35;
LABEL_39:
memmove(v28, v25, v27);
goto LABEL_40;
}
LOBYTE(__dst) = 2 * v26;
v28 = (char *)&__dst + 1;
if ( v26 )
goto LABEL_39;
LABEL_40:
v28[v27] = 0;
cocos2d::CCDictionary::setObject_1((__int64)v24, v23, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
LABEL_3:
v3 = v33 + 1;
v2 = (cocos2d::CCArray *)v31;
if ( v33 + 1 >= (unsigned int)sub_100720070(v31) )
return;
}
v10 = v7 | 7;
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = v10 + 1;
v9 = (char *)operator new(v11);
__p = v9;
*(_QWORD *)&__dst = v11 + 1;
*((_QWORD *)&__dst + 1) = v8;
LABEL_11:
memmove(v9, CString, v8);
goto LABEL_12;
}
}