//
// sub_100086DC4 from 0x100086dc4 to 0x1000871bc (1016 bytes)
//
// 1 xrefs:
// > sub_100086D38 @ 0x100086d74
//
// 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 10:58:19 +0000
//
__int64 __fastcall sub_100086DC4(__int64 a1, __int64 a2, __int64 a3, int a4)
{
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x0
__n128 v11; // q0
__int64 v12; // x0
__int64 v13; // x22
__int64 v14; // x23
__int64 v15; // x24
_BYTE *v16; // x25
__int64 v17; // x25
__int64 v18; // x0
char *CString; // x0
__int64 v20; // x0
__int64 v21; // x26
_BOOL4 v22; // w28
std::string *v23; // x27
std::string *v24; // x0
__int64 v25; // x0
__int64 v26; // x28
__int64 v27; // x28
__int64 v28; // x25
char *v29; // x0
__n128 v30; // q0
unsigned int v32; // [xsp+0h] [xbp-2E0h]
std::string __str; // [xsp+20h] [xbp-2C0h] BYREF
void *v35[2]; // [xsp+40h] [xbp-2A0h] BYREF
char v36; // [xsp+57h] [xbp-289h]
std::string v37; // [xsp+58h] [xbp-288h] BYREF
void *__p[2]; // [xsp+70h] [xbp-270h] BYREF
char *v39; // [xsp+80h] [xbp-260h]
_BYTE v40[504]; // [xsp+88h] [xbp-258h] BYREF
v7 = cocos2d::CCSprite::initWithTexture_1(a1, a3, &unk_1009F37B0);
v32 = v7;
if ( (_DWORD)v7 )
{
v8 = sub_1002E736C(v7);
*(_QWORD *)(a1 + 632) = v8;
cocos2d::CCObject::retain(v8);
v10 = cocos2d::CCDictionary::create(v9);
*(_QWORD *)(a1 + 600) = v10;
v11 = cocos2d::CCObject::retain(v10);
v12 = CCAnimateFrameCache::sharedSpriteFrameCache(v11);
v13 = CCAnimateFrameCache::addSpriteFramesWithFile(v12, a2);
*(_BYTE *)(a1 + 616) = 1;
sub_100009900(__p, "usedTextures");
v14 = cocos2d::CCDictionary::objectForKey(v13, __p);
if ( SHIBYTE(v39) < 0 )
operator delete(__p[0]);
if ( (unsigned int)cocos2d::CCDictionary::count(v14) )
{
v15 = 0;
do
{
*(_OWORD *)__p = xmmword_10075BA80;
v39 = v40;
sub_10000CB50((__int64 *)__p, "texture_", 0);
LODWORD(v37.__r_.__value_.__l.__data_) = v15;
sub_100009A40((int)__p, v15, (int)&v37);
v16 = __p[0];
if ( __p[1] < (char *)__p[0] + 1 )
sub_100009ED4((__int64)__p, (size_t)__p[0] + 1);
v16[(_QWORD)v39] = 0;
sub_100009900(&v37, v39);
v17 = cocos2d::CCDictionary::objectForKey(v14, &v37);
if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v37.__r_.__value_.__l.__data_);
sub_100009900(v35, "texture");
v18 = cocos2d::CCDictionary::valueForKey(v17, v35);
CString = (char *)cocos2d::CCString::getCString(v18);
sub_100009900(&v37, CString);
if ( v36 < 0 )
operator delete(v35[0]);
sub_100009900(v35, "tag");
v20 = cocos2d::CCDictionary::valueForKey(v17, v35);
v21 = cocos2d::CCString::intValue(v20);
if ( v36 < 0 )
operator delete(v35[0]);
sub_100009900(v35, "0");
v22 = sub_1000045BC(&v37, v35);
if ( v36 < 0 )
operator delete(v35[0]);
if ( ((a4 | v22) & 1) != 0 )
{
v23 = (std::string *)sub_10008736C(a3);
if ( ((v22 | a4 ^ 1) & 1) == 0 )
{
if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__str, v37.__r_.__value_.__l.__data_, v37.__r_.__value_.__l.__size_);
else
__str = v37;
std::string::operator=(v23 + 26, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}
}
else
{
if ( (v37.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v24 = &v37;
else
v24 = (std::string *)v37.__r_.__value_.__r.__words[0];
v23 = (std::string *)sub_100087280(v24);
}
(*(void (__fastcall **)(std::string *, __int64))(v23->__r_.__value_.__r.__words[0] + 72))(v23, v21);
sub_100009900(v35, "customID");
v25 = cocos2d::CCDictionary::objectForKey(v17, v35);
v26 = v25;
if ( v36 < 0 )
{
operator delete(v35[0]);
if ( v26 )
{
LABEL_31:
sub_100009900(v35, "customID");
v27 = cocos2d::CCDictionary::objectForKey(v17, v35);
if ( v36 < 0 )
operator delete(v35[0]);
v28 = *(_QWORD *)(a1 + 600);
v29 = (char *)cocos2d::CCString::getCString(v27);
sub_100009900(v35, v29);
cocos2d::CCDictionary::setObject(v28, v23, v35);
if ( v36 < 0 )
operator delete(v35[0]);
}
}
else if ( v25 )
{
goto LABEL_31;
}
v30 = sub_1002E74E0(*(_QWORD *)(a1 + 632), v23);
(*(void (__fastcall **)(__int64, std::string *, _QWORD, __int64, __n128))(*(_QWORD *)a1 + 472LL))(
a1,
v23,
0,
v21,
v30);
(*(void (__fastcall **)(std::string *, _QWORD))(v23->__r_.__value_.__r.__words[0] + 344))(v23, 0);
if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v37.__r_.__value_.__l.__data_);
if ( v39 != v40 && v39 )
operator delete[](v39);
v15 = (unsigned int)(v15 + 1);
}
while ( (unsigned int)v15 < (unsigned int)cocos2d::CCDictionary::count(v14) );
}
}
return v32;
}