//
// sub_1003C08B8 from 0x1003c08b8 to 0x1003c1070 (1976 bytes)
//
// 2 xrefs:
// > ObjectManager::setup @ 0x1002ea9a4
// > sub_1003C06B4 @ 0x1003c0800
//
// This function is hookable on this platform (idp: arm, 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 11:04:02 +0000
//
__int64 __fastcall sub_1003C08B8(char *a1)
{
__int64 v2; // x0
char *v3; // x1
__int64 result; // x0
__int64 v5; // x0
char *v6; // x1
__int64 v7; // x0
char *v8; // x1
__int64 v9; // x20
__int64 v10; // x20
unsigned int v11; // w23
__int64 v12; // x0
char *CString; // x0
__int64 v14; // x27
__int64 v15; // x0
__int64 v16; // x20
float v17; // s8
_QWORD *v18; // x25
__int64 v19; // x0
__int64 v20; // x20
bool v21; // w26
__int64 v22; // x20
const std::string::value_type *v23; // x1
const char *v24; // x8
void **v25; // x9
void *v26; // x0
__int64 v27; // x0
__int64 v28; // x20
__int64 v29; // x0
char *v30; // x0
_QWORD *v31; // x0
std::string *v32; // x1
_DWORD *v33; // x25
int v34; // w8
__int64 v35; // x0
bool v36; // w0
bool v37; // w20
__int64 v38; // x0
char *v39; // x0
char *v40; // x1
_QWORD *v41; // x27
std::string *p_str; // x8
std::string::size_type size; // x20
std::string *v44; // x9
std::string::size_type v45; // x11
std::string *v46; // x10
__int64 v47; // x8
__int64 v48; // x19
__int64 v49; // x0
std::string *v50; // x1
const char *v51; // x8
void **v52; // x9
void *v53; // x0
char *v54; // x0
__int64 v55; // x0
__int64 v56; // x0
int v57; // w27
int v58; // w20
std::string *v59; // x8
_DWORD *v60; // x1
int v61; // w8
__int64 v62; // x28
std::string *v63; // x8
void *v64; // x0
__int64 v65; // x0
std::string::size_type v66; // x28
std::string *v67; // x1
__int64 v68; // x21
bool v69; // zf
std::string::size_type v70; // x11
std::string *v71; // x8
_BYTE *v72; // x9
_BYTE *v73; // x10
std::string::size_type v74; // x11
__int64 v75; // x8
unsigned int v76; // w28
__int64 v77; // x0
__int64 v78; // x0
int v79; // w21
std::string *v80; // x8
_DWORD *v81; // x1
int v82; // w8
__int64 v83; // x20
std::string *v84; // x8
void *v85; // x0
__int64 v86; // x0
_QWORD *v87; // x25
const char *v88; // x8
void **v89; // x9
void *v90; // x0
char *v91; // x0
char *v92; // [xsp+18h] [xbp-118h]
__int64 v93; // [xsp+20h] [xbp-110h]
__int64 v94; // [xsp+28h] [xbp-108h]
__int64 v95; // [xsp+30h] [xbp-100h]
std::string __str; // [xsp+38h] [xbp-F8h] BYREF
void *v97[2]; // [xsp+50h] [xbp-E0h] BYREF
char v98; // [xsp+67h] [xbp-C9h]
std::string v99; // [xsp+68h] [xbp-C8h] BYREF
void *v100[2]; // [xsp+80h] [xbp-B0h] BYREF
char v101; // [xsp+97h] [xbp-99h]
void *__p[2]; // [xsp+98h] [xbp-98h] BYREF
char v103; // [xsp+AFh] [xbp-81h]
std::string v104; // [xsp+B0h] [xbp-80h] BYREF
v2 = ObjectManager::instance();
v3 = a1;
if ( a1[23] < 0 )
v3 = *(char **)a1;
result = sub_1002EB094(v2, v3);
if ( (result & 1) == 0 )
{
v5 = ObjectManager::instance();
v6 = a1;
if ( a1[23] < 0 )
v6 = *(char **)a1;
sub_1002EB014(v5, v6);
v94 = cocos2d::CCAnimationCache::sharedAnimationCache();
v7 = ObjectManager::instance();
v8 = a1;
if ( a1[23] < 0 )
v8 = *(char **)a1;
v9 = sub_1002EAFA8(v7, v8);
sub_100009900(&v104, "animations");
v95 = cocos2d::CCDictionary::objectForKey(v9, &v104);
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v104.__r_.__value_.__l.__data_);
v10 = cocos2d::CCDictionary::allKeys(v95);
result = sub_1002E757C(v10);
if ( (_DWORD)result )
{
v11 = 0;
v92 = a1;
v93 = v10;
do
{
v12 = sub_1002E75A0(v10, v11);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_100009900(v100, CString);
v14 = cocos2d::CCDictionary::objectForKey(v95, v100);
sub_100009900(&v104, "delay");
v15 = cocos2d::CCDictionary::objectForKey(v14, &v104);
v16 = v15;
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v104.__r_.__value_.__l.__data_);
if ( v16 )
{
LABEL_14:
v17 = cocos2d::CCString::floatValue(v16);
goto LABEL_17;
}
}
else if ( v15 )
{
goto LABEL_14;
}
v17 = 0.0;
LABEL_17:
v18 = sub_1002E736C();
sub_100009900(&v104, "usesParts");
v19 = cocos2d::CCDictionary::objectForKey(v14, &v104);
v20 = v19;
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v104.__r_.__value_.__l.__data_);
if ( v20 )
{
LABEL_19:
v21 = cocos2d::CCString::boolValue(v20);
goto LABEL_22;
}
}
else if ( v19 )
{
goto LABEL_19;
}
v21 = 0;
LABEL_22:
sub_100009900(&v104, "animFrameName");
v22 = cocos2d::CCDictionary::objectForKey(v14, &v104);
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v104.__r_.__value_.__l.__data_);
memset(&v99, 0, sizeof(v99));
if ( v22 )
{
v23 = (const std::string::value_type *)cocos2d::CCString::getCString(v22);
}
else
{
v24 = a1;
if ( a1[23] < 0 )
v24 = *(const char **)a1;
v25 = v100;
if ( v101 < 0 )
v25 = (void **)v100[0];
v26 = sub_1003065B0("%s_%s", v24, (const char *)v25);
v23 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v26);
}
std::string::assign(&v99, v23);
sub_100009900(&v104, "singleFrame");
v27 = cocos2d::CCDictionary::objectForKey(v14, &v104);
v28 = v27;
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v104.__r_.__value_.__l.__data_);
if ( v28 )
{
LABEL_33:
sub_100009900(__p, "singleFrame");
v29 = cocos2d::CCDictionary::objectForKey(v14, __p);
v30 = (char *)cocos2d::CCString::getCString(v29);
v31 = sub_100009900(&v104, v30);
if ( v103 < 0 )
{
operator delete(__p[0]);
if ( !v21 )
goto LABEL_61;
LABEL_35:
if ( (v104.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v32 = &v104;
else
v32 = (std::string *)v104.__r_.__value_.__r.__words[0];
sub_100009900(__p, (char *)v32);
v33 = sub_1003064AC((__int128 *)__p);
if ( v103 < 0 )
operator delete(__p[0]);
v34 = 1;
}
else
{
if ( v21 )
goto LABEL_35;
LABEL_61:
v49 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v31);
if ( (v104.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v50 = &v104;
else
v50 = (std::string *)v104.__r_.__value_.__r.__words[0];
v33 = (_DWORD *)cocos2d::CCSpriteFrameCache::spriteFrameByName(v49, v50);
v34 = 2;
}
v33[7] = v34;
v51 = a1;
if ( a1[23] < 0 )
v51 = *(const char **)a1;
v52 = v100;
if ( v101 < 0 )
v52 = (void **)v100[0];
v53 = sub_1003065B0("%s_%s", v51, (const char *)v52);
v54 = (char *)cocos2d::CCString::getCString((__int64)v53);
cocos2d::CCAnimationCache::addAnimation(v94, (__int64)v33, v54);
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v104.__r_.__value_.__l.__data_);
goto LABEL_137;
}
}
else if ( v27 )
{
goto LABEL_33;
}
sub_100009900(&v104, "other");
v35 = cocos2d::CCDictionary::objectForKey(v14, &v104);
v36 = cocos2d::CCString::boolValue(v35);
v37 = v36;
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v104.__r_.__value_.__l.__data_);
if ( v37 )
{
LABEL_44:
sub_100009900(&v104, "frames");
v38 = cocos2d::CCDictionary::objectForKey(v14, &v104);
v39 = (char *)cocos2d::CCString::getCString(v38);
sub_100009900(v97, v39);
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v104.__r_.__value_.__l.__data_);
if ( v98 >= 0 )
v40 = (char *)v97;
else
v40 = (char *)v97[0];
sub_100009900(&__str, v40);
v41 = sub_1002E736C();
p_str = &__str;
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
{
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
}
else
{
size = __str.__r_.__value_.__l.__size_;
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
}
if ( size )
{
v44 = (std::string *)((char *)p_str + size);
v45 = size;
v46 = p_str;
do
{
if ( v46->__r_.__value_.__s.__data_[0] == 32 )
goto LABEL_57;
v46 = (std::string *)((char *)v46 + 1);
--v45;
}
while ( v45 );
v46 = (std::string *)((char *)p_str + size);
LABEL_57:
v47 = (char *)v46 - (char *)p_str;
if ( v46 == v44 )
v48 = -1;
else
v48 = v47;
}
else
{
v48 = -1;
}
v66 = 0;
while ( 2 )
{
std::string::basic_string(&v104, &__str, v66, v48 - v66, (std::allocator *)__p);
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v66 != size || v104.__r_.__value_.__l.__size_ )
{
v67 = (std::string *)v104.__r_.__value_.__r.__words[0];
goto LABEL_96;
}
}
else if ( v66 != size || *((_BYTE *)&v104.__r_.__value_.__s + 23) )
{
v67 = &v104;
LABEL_96:
sub_100009900(__p, (char *)v67);
sub_1003064AC((__int128 *)__p);
sub_1002E74E0((__int64)v41);
if ( v103 < 0 )
operator delete(__p[0]);
}
if ( v48 == -1
|| ((v66 = v48 + 1,
v70 = __str.__r_.__value_.__l.__size_,
v71 = &__str,
(__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL)
? (std::string *)(v70 = HIBYTE(__str.__r_.__value_.__r.__words[2]))
: (v71 = (std::string *)__str.__r_.__value_.__r.__words[0]),
v70 <= v66) )
{
v68 = -1;
}
else
{
v72 = (char *)v71 + v70;
v73 = (char *)v71 + v66;
v74 = ~v48 + v70;
while ( *v73 != 32 )
{
++v73;
if ( !--v74 )
{
v73 = v72;
break;
}
}
v75 = v73 - (_BYTE *)v71;
if ( v73 == v72 )
v68 = -1;
else
v68 = v75;
}
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v104.__r_.__value_.__l.__data_);
v69 = v48 == -1;
v48 = v68;
if ( v69 )
{
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v76 = 0;
a1 = v92;
while ( v76 < (unsigned int)sub_1002E757C((__int64)v41) )
{
v77 = sub_1002E75A0((__int64)v41, v76);
v78 = cocos2d::CCString::intValue(v77);
v79 = v78;
if ( v21 )
{
if ( (v99.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v80 = &v99;
else
v80 = (std::string *)v99.__r_.__value_.__r.__words[0];
v81 = sub_1003065B0("%s_%03d.png", (const char *)v80, v78);
v82 = 1;
}
else
{
v83 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v78);
if ( (v99.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v84 = &v99;
else
v84 = (std::string *)v99.__r_.__value_.__r.__words[0];
v85 = sub_1003065B0("%s_%03d.png", (const char *)v84, v79);
v86 = cocos2d::CCString::getCString((__int64)v85);
v81 = (_DWORD *)cocos2d::CCSpriteFrameCache::spriteFrameByName(v83, v86);
v82 = 2;
}
v81[7] = v82;
sub_1002E74E0((__int64)v18);
++v76;
}
if ( v98 < 0 )
operator delete(v97[0]);
goto LABEL_132;
}
continue;
}
}
}
else if ( v36 )
{
goto LABEL_44;
}
sub_100009900(&v104, "frames");
v55 = cocos2d::CCDictionary::objectForKey(v14, &v104);
v56 = cocos2d::CCString::intValue(v55);
v57 = v56;
if ( SHIBYTE(v104.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v104.__r_.__value_.__l.__data_);
if ( v57 >= 1 )
{
v58 = 1;
do
{
if ( v21 )
{
if ( (v99.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v59 = &v99;
else
v59 = (std::string *)v99.__r_.__value_.__r.__words[0];
v60 = sub_1003065B0("%s_%03d.png", (const char *)v59, v58);
v61 = 1;
}
else
{
v62 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v56);
if ( (v99.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v63 = &v99;
else
v63 = (std::string *)v99.__r_.__value_.__r.__words[0];
v64 = sub_1003065B0("%s_%03d.png", (const char *)v63, v58);
v65 = cocos2d::CCString::getCString((__int64)v64);
v60 = (_DWORD *)cocos2d::CCSpriteFrameCache::spriteFrameByName(v62, v65);
v61 = 2;
}
v60[7] = v61;
v56 = sub_1002E74E0((__int64)v18);
++v58;
--v57;
}
while ( v57 );
}
LABEL_132:
v87 = cocos2d::CCAnimation::createWithSpriteFrames((__int64)v18, v17);
v88 = a1;
if ( a1[23] < 0 )
v88 = *(const char **)a1;
v89 = v100;
if ( v101 < 0 )
v89 = (void **)v100[0];
v90 = sub_1003065B0("%s_%s", v88, (const char *)v89);
v91 = (char *)cocos2d::CCString::getCString((__int64)v90);
cocos2d::CCAnimationCache::addAnimation(v94, (__int64)v87, v91);
LABEL_137:
if ( SHIBYTE(v99.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v99.__r_.__value_.__l.__data_);
if ( v101 < 0 )
operator delete(v100[0]);
++v11;
v10 = v93;
result = sub_1002E757C(v93);
}
while ( v11 < (unsigned int)result );
}
}
return result;
}