//
// ObjectManager::loadCopiedAnimations from 0x1008761a0 to 0x1008765e6 (1094 bytes)
//
// 2 xrefs:
// > ObjectManager::instance @ 0x1008760c6
// > ObjectManager::init @ 0x100876167
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:36:53 +0000
//
__int64 __fastcall ObjectManager::loadCopiedAnimations(__int64 a1)
{
__int64 v1; // r15
__int64 result; // rax
unsigned int v3; // esi
__int64 v4; // rax
__int64 v5; // rbx
const char *CString; // r15
size_t v7; // rax
size_t v8; // r14
_BYTE *v9; // r12
size_t v10; // r13
__int64 v11; // rbx
__int64 v12; // rbx
unsigned int v13; // r13d
unsigned int v14; // r13d
__int64 v15; // rbx
const char *v16; // r14
size_t v17; // rax
size_t v18; // r12
_BYTE *v19; // r13
size_t v20; // rbx
__int64 v21; // rbx
__int64 v22; // rbx
const char *v23; // r12
__int64 v24; // rdi
__int64 v25; // r13
size_t v26; // rax
size_t v27; // r14
_BYTE *v28; // rbx
size_t v29; // r15
__int64 v30; // r12
const char *v31; // r14
size_t v32; // rax
size_t v33; // rbx
_BYTE *v34; // r13
size_t v35; // r15
__int64 v36; // [rsp+8h] [rbp-78h]
__int64 v37; // [rsp+10h] [rbp-70h]
unsigned int v39; // [rsp+24h] [rbp-5Ch]
__int64 v40; // [rsp+28h] [rbp-58h]
__int64 v41; // [rsp+30h] [rbp-50h]
unsigned int v42; // [rsp+3Ch] [rbp-44h]
_BYTE __dst[48]; // [rsp+40h] [rbp-40h] BYREF
v1 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 320));
result = sub_1007FEF90(v1);
if ( (_DWORD)result )
{
v3 = 0;
v40 = v1;
while ( 1 )
{
v39 = v3;
v4 = sub_1007FEFE0(v1, v3);
v5 = *(_QWORD *)(a1 + 320);
CString = (const char *)cocos2d::CCString::getCString(v4);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_57:
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
break;
__dst[0] = 2 * v7;
v9 = &__dst[1];
if ( v7 )
goto LABEL_11;
LABEL_12:
v9[v8] = 0;
v11 = cocos2d::CCDictionary::objectForKey(v5, __dst);
v1 = v40;
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
__dst[0] = 20;
strcpy(&__dst[1], "animations");
v41 = cocos2d::CCDictionary::objectForKey(v11, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
if ( v41 )
{
v12 = cocos2d::CCDictionary::allKeys(v41);
if ( (unsigned int)sub_1007FEF90(v12) )
{
v13 = 0;
v37 = v12;
while ( 1 )
{
v15 = sub_1007FEFE0(v12, v13);
v16 = (const char *)cocos2d::CCString::getCString(v15);
v17 = strlen(v16);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
v18 = v17;
v42 = v13;
v36 = v15;
if ( v17 >= 0x17 )
break;
__dst[0] = 2 * v17;
v19 = &__dst[1];
if ( v17 )
goto LABEL_28;
LABEL_29:
v19[v18] = 0;
v21 = cocos2d::CCDictionary::objectForKey(v41, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
__dst[0] = 8;
strcpy(&__dst[1], "copy");
v14 = v42;
v22 = cocos2d::CCDictionary::objectForKey(v21, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
if ( !v22 )
goto LABEL_20;
v23 = (const char *)cocos2d::CCString::getCString(v22);
v24 = *(_QWORD *)(a1 + 320);
strcpy(__dst, " GlobalAnimations");
v25 = cocos2d::CCDictionary::objectForKey(v24, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v26 = strlen(v23);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
v27 = v26;
if ( v26 >= 0x17 )
{
v29 = (v26 | 7) + 1;
if ( (v26 | 7) == 0x17 )
v29 = 26;
v28 = operator new(v29);
*(_QWORD *)&__dst[16] = v28;
*(_QWORD *)__dst = v29 + 1;
*(_QWORD *)&__dst[8] = v27;
LABEL_43:
memcpy(v28, v23, v27);
goto LABEL_44;
}
__dst[0] = 2 * v26;
v28 = &__dst[1];
if ( v26 )
goto LABEL_43;
LABEL_44:
v28[v27] = 0;
v30 = cocos2d::CCDictionary::objectForKey(v25, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v31 = (const char *)cocos2d::CCString::getCString(v36);
v32 = strlen(v31);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_57;
v33 = v32;
if ( v32 >= 0x17 )
{
v35 = (v32 | 7) + 1;
if ( (v32 | 7) == 0x17 )
v35 = 26;
v34 = operator new(v35);
*(_QWORD *)&__dst[16] = v34;
*(_QWORD *)__dst = v35 + 1;
*(_QWORD *)&__dst[8] = v33;
v1 = v40;
}
else
{
__dst[0] = 2 * v32;
v34 = &__dst[1];
v1 = v40;
if ( !v32 )
goto LABEL_54;
}
memmove(v34, v31, v33);
LABEL_54:
v34[v33] = 0;
cocos2d::CCDictionary::setObject(v41, v30, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(*(void **)&__dst[16]);
v14 = v42;
LABEL_20:
v13 = v14 + 1;
v12 = v37;
if ( v13 >= (unsigned int)sub_1007FEF90(v37) )
goto LABEL_3;
}
v20 = (v17 | 7) + 1;
if ( (v17 | 7) == 0x17 )
v20 = 26;
v19 = operator new(v20);
*(_QWORD *)&__dst[16] = v19;
*(_QWORD *)__dst = v20 + 1;
*(_QWORD *)&__dst[8] = v18;
LABEL_28:
memmove(v19, v16, v18);
goto LABEL_29;
}
}
LABEL_3:
result = sub_1007FEF90(v1);
++v3;
if ( v39 + 1 >= (unsigned int)result )
return result;
}
v10 = (v7 | 7) + 1;
if ( (v7 | 7) == 0x17 )
v10 = 26;
v9 = operator new(v10);
*(_QWORD *)&__dst[16] = v9;
*(_QWORD *)__dst = v10 + 1;
*(_QWORD *)&__dst[8] = v8;
LABEL_11:
memmove(v9, CString, v8);
goto LABEL_12;
}
return result;
}