//
// sub_10000658C from 0x10000658c to 0x100006c2c (1696 bytes)
//
// 6 xrefs:
// > sub_1000057F8 @ 0x100005a58
// > sub_1000057F8 @ 0x100005b30
// > sub_1000057F8 @ 0x100005c00
// > sub_1000057F8 @ 0x100005cfc
// > sub_10000658C @ 0x100006ae8
// > sub_10000658C @ 0x100006b68
//
// 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:57:11 +0000
//
__int64 __fastcall sub_10000658C(__int64 a1, const std::string *a2, char a3, __int64 a4)
{
__int64 v8; // x0
__int64 v9; // x23
__int64 v10; // x22
int v11; // w27
int v12; // w8
__int64 *v13; // x8
int v14; // w26
__int64 v15; // x22
void *v16; // x0
std::string::size_type size; // x8
__int64 v18; // x23
__int64 v19; // x24
__int64 v20; // x0
char *CString; // x0
__int64 v22; // x25
char v23; // w24
__int64 v24; // x0
__int64 v25; // x23
__int64 v27; // [xsp+40h] [xbp-240h]
int v28; // [xsp+4Ch] [xbp-234h]
std::string v29; // [xsp+50h] [xbp-230h] BYREF
std::string v30; // [xsp+70h] [xbp-210h] BYREF
std::string v31; // [xsp+90h] [xbp-1F0h] BYREF
std::string v32; // [xsp+B0h] [xbp-1D0h] BYREF
std::string __str; // [xsp+C8h] [xbp-1B8h] BYREF
std::string v34; // [xsp+E0h] [xbp-1A0h] BYREF
std::string v35; // [xsp+F8h] [xbp-188h] BYREF
std::string v36; // [xsp+110h] [xbp-170h] BYREF
std::string __p; // [xsp+128h] [xbp-158h] BYREF
std::string v38; // [xsp+140h] [xbp-140h] BYREF
std::string v39; // [xsp+158h] [xbp-128h] BYREF
std::string v40; // [xsp+170h] [xbp-110h] BYREF
std::string v41; // [xsp+190h] [xbp-F0h] BYREF
std::string v42; // [xsp+1A8h] [xbp-D8h] BYREF
std::string v43; // [xsp+1C0h] [xbp-C0h] BYREF
__int128 v44; // [xsp+1E0h] [xbp-A0h] BYREF
std::string::size_type v45; // [xsp+1F0h] [xbp-90h]
__int128 __dst; // [xsp+200h] [xbp-80h] BYREF
std::string::size_type v47; // [xsp+210h] [xbp-70h]
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
{
sub_1000097D0(&__dst, a2->__r_.__value_.__l.__data_);
}
else
{
__dst = *(_OWORD *)&a2->__r_.__value_.__l.__data_;
v47 = a2->__r_.__value_.__r.__words[2];
}
v8 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 56), &__dst);
v9 = v8;
if ( (SHIBYTE(v47) & 0x80000000) == 0 )
{
if ( !v8 )
goto LABEL_11;
LABEL_8:
if ( (unsigned int)sub_1002E757C(v9) )
{
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
{
sub_1000097D0(&v44, a2->__r_.__value_.__l.__data_);
}
else
{
v44 = *(_OWORD *)&a2->__r_.__value_.__l.__data_;
v45 = a2->__r_.__value_.__r.__words[2];
}
v10 = sub_10000608C(a1, (__int64)&v44);
if ( SHIBYTE(v45) < 0 )
operator delete((void *)v44);
return v10;
}
goto LABEL_11;
}
operator delete((void *)__dst);
if ( v9 )
goto LABEL_8;
LABEL_11:
if ( (a3 & 1) != 0 )
return 0;
v11 = 0;
if ( (_DWORD)a4 )
v12 = 7;
else
v12 = 4;
v28 = v12;
while ( 2 )
{
if ( v11 > 3 )
{
v13 = (__int64 *)(a1 + 72);
if ( v11 != 4 )
{
v13 = (__int64 *)(a1 + 88);
if ( v11 != 5 )
{
v13 = (__int64 *)(a1 + 56);
if ( v11 == 6 )
v13 = (__int64 *)(a1 + 104);
}
}
}
else
{
v13 = (__int64 *)(a1 + 64);
if ( v11 != 1 )
{
v13 = (__int64 *)(a1 + 80);
if ( v11 != 2 )
{
v13 = (__int64 *)(a1 + 56);
if ( v11 == 3 )
v13 = (__int64 *)(a1 + 96);
}
}
}
v14 = 0;
v15 = *v13;
do
{
memset(&v43, 0, sizeof(v43));
if ( v14 > 3 )
{
switch ( v14 )
{
case 4:
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v36, a2->__r_.__value_.__l.__data_);
else
v36 = *a2;
sub_100004E04(&v36, (int)&__p);
sub_100005508(&v42, &__p);
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
v43 = v42;
*((_BYTE *)&v42.__r_.__value_.__s + 23) = 0;
v42.__r_.__value_.__s.__data_[0] = 0;
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( (SHIBYTE(v36.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_86;
v16 = (void *)v36.__r_.__value_.__r.__words[0];
break;
case 5:
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v34, a2->__r_.__value_.__l.__data_);
else
v34 = *a2;
sub_1000055E8((__int64 *)&v35, &v34);
sub_100005508(&v42, &v35);
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
v43 = v42;
*((_BYTE *)&v42.__r_.__value_.__s + 23) = 0;
v42.__r_.__value_.__s.__data_[0] = 0;
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v35.__r_.__value_.__l.__data_);
if ( (SHIBYTE(v34.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_86;
v16 = (void *)v34.__r_.__value_.__r.__words[0];
break;
case 6:
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v31, a2->__r_.__value_.__l.__data_);
else
v31 = *a2;
sub_100004E04(&v31, (int)&v32);
sub_1000055E8((__int64 *)&__str, &v32);
sub_100005508(&v42, &__str);
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
v43 = v42;
*((_BYTE *)&v42.__r_.__value_.__s + 23) = 0;
v42.__r_.__value_.__s.__data_[0] = 0;
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( SHIBYTE(v32.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v32.__r_.__value_.__l.__data_);
if ( (SHIBYTE(v31.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_86;
v16 = (void *)v31.__r_.__value_.__r.__words[0];
break;
default:
LABEL_42:
std::string::operator=(&v43, a2);
LABEL_86:
if ( v11 )
goto LABEL_87;
goto LABEL_105;
}
}
else
{
switch ( v14 )
{
case 1:
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v41, a2->__r_.__value_.__l.__data_);
else
v41 = *a2;
sub_100004E04(&v41, (int)&v42);
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
v43 = v42;
*((_BYTE *)&v42.__r_.__value_.__s + 23) = 0;
v42.__r_.__value_.__s.__data_[0] = 0;
if ( (SHIBYTE(v41.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_86;
v16 = (void *)v41.__r_.__value_.__r.__words[0];
break;
case 2:
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v40, a2->__r_.__value_.__l.__data_);
else
v40 = *a2;
sub_1000055E8((__int64 *)&v42, &v40);
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
v43 = v42;
*((_BYTE *)&v42.__r_.__value_.__s + 23) = 0;
v42.__r_.__value_.__s.__data_[0] = 0;
if ( (SHIBYTE(v40.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_86;
v16 = (void *)v40.__r_.__value_.__r.__words[0];
break;
case 3:
if ( SHIBYTE(a2->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v38, a2->__r_.__value_.__l.__data_);
else
v38 = *a2;
sub_100004E04(&v38, (int)&v39);
sub_1000055E8((__int64 *)&v42, &v39);
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
v43 = v42;
*((_BYTE *)&v42.__r_.__value_.__s + 23) = 0;
v42.__r_.__value_.__s.__data_[0] = 0;
if ( SHIBYTE(v39.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v39.__r_.__value_.__l.__data_);
if ( (SHIBYTE(v38.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_86;
v16 = (void *)v38.__r_.__value_.__r.__words[0];
break;
default:
goto LABEL_42;
}
}
operator delete(v16);
if ( v11 )
{
LABEL_87:
if ( v15 )
{
size = HIBYTE(v43.__r_.__value_.__r.__words[2]);
if ( (v43.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = v43.__r_.__value_.__l.__size_;
if ( size )
{
v18 = cocos2d::CCDictionary::objectForKey(v15, &v43);
if ( v18 )
{
v19 = 0;
while ( (unsigned int)v19 < (unsigned int)sub_1002E757C(v18) )
{
v20 = cocos2d::CCArray::stringAtIndex(v18, v19);
CString = (char *)cocos2d::CCString::getCString(v20);
sub_100009900((int)&v42, CString);
if ( SHIBYTE(v42.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v29, v42.__r_.__value_.__l.__data_);
else
v29 = v42;
v22 = sub_10000658C(a1, &v29, 1, a4);
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v29.__r_.__value_.__l.__data_);
if ( SHIBYTE(v42.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v42.__r_.__value_.__l.__data_);
v19 = (unsigned int)(v19 + 1);
if ( v22 )
{
v23 = 0;
v27 = v22;
goto LABEL_113;
}
}
}
}
}
goto LABEL_112;
}
LABEL_105:
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v30, v43.__r_.__value_.__l.__data_);
else
v30 = v43;
v24 = sub_10000658C(a1, &v30, 1, a4);
v25 = v24;
if ( SHIBYTE(v30.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v30.__r_.__value_.__l.__data_);
if ( v25 )
{
LABEL_110:
v23 = 0;
v27 = v25;
goto LABEL_113;
}
}
else if ( v24 )
{
goto LABEL_110;
}
LABEL_112:
v23 = 1;
LABEL_113:
if ( SHIBYTE(v43.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v43.__r_.__value_.__l.__data_);
if ( (v23 & 1) == 0 )
return v27;
++v14;
}
while ( v14 != v28 );
v10 = 0;
if ( ++v11 != v28 )
continue;
return v10;
}
}