//
// sub_10038FEB0 from 0x10038feb0 to 0x1003903ac (1276 bytes)
//
// 1 xrefs:
// > sub_10038FE14 @ 0x10038fe80
//
// 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:03:37 +0000
//
_DWORD *__fastcall sub_10038FEB0(__int64 a1, __int64 a2)
{
void *v4; // x0
char *CString; // x21
_QWORD *v6; // x20
char *v7; // x0
char *v8; // x1
_DWORD *v9; // x19
unsigned int v10; // w21
void *v11; // x28
__int64 v12; // x23
__int64 v13; // x27
char *v14; // x0
std::string::size_type v15; // x3
int v16; // w19
size_t size; // x2
unsigned __int64 v18; // x9
std::string *v19; // x0
void **v20; // x1
bool v21; // w26
std::string::size_type v22; // x3
int v23; // w19
size_t v24; // x2
std::string::size_type v25; // x9
std::string *v26; // x0
const void *v27; // x1
_BOOL4 v28; // w26
_QWORD *v29; // x26
char *v30; // x0
char *v31; // x0
char *v32; // x1
__int64 v33; // x0
void *v34; // x24
char *v35; // x0
std::string *v36; // x28
signed __int64 v37; // x27
_BYTE *v38; // x19
size_t v39; // x2
std::string *v40; // x0
_BYTE *v41; // x0
int v42; // w8
int v43; // w0
void *v44; // x28
int v45; // w27
__int64 v46; // x0
int v47; // w28
__int64 v48; // x0
int v49; // w26
__int64 v51; // [xsp+0h] [xbp-F0h]
int v52; // [xsp+Ch] [xbp-E4h] BYREF
std::string __a; // [xsp+10h] [xbp-E0h] BYREF
std::string v54; // [xsp+28h] [xbp-C8h] BYREF
std::string __str; // [xsp+40h] [xbp-B0h] BYREF
void *v56; // [xsp+58h] [xbp-98h] BYREF
std::string::size_type v57; // [xsp+60h] [xbp-90h]
unsigned __int8 v58; // [xsp+6Fh] [xbp-81h]
void *__p[2]; // [xsp+70h] [xbp-80h] BYREF
unsigned __int8 v60; // [xsp+87h] [xbp-69h]
char v61; // [xsp+8Fh] [xbp-61h] BYREF
std::allocator v62[16]; // [xsp+90h] [xbp-60h] BYREF
sub_100018AA8((_QWORD *)(a1 + 56));
sub_100018AA8((_QWORD *)(a1 + 96));
v4 = cocos2d::CCString::createWithContentsOfFile(a2);
CString = (char *)cocos2d::CCString::getCString((__int64)v4);
v6 = sub_1002E736C();
if ( strtok(CString, "\n") )
{
v7 = strtok(nullptr, "\n");
if ( v7 )
{
v8 = v7;
do
{
sub_100009900(__p, v8);
sub_1003064AC((__int128 *)__p);
sub_1002E74E0((__int64)v6);
if ( (char)v60 < 0 )
operator delete(__p[0]);
v8 = strtok(nullptr, "\n");
}
while ( v8 );
}
}
v51 = a1;
v9 = v6;
if ( (unsigned int)sub_1002E757C((__int64)v6) )
{
v10 = 0;
v11 = &unk_10076DAD8;
do
{
v12 = (__int64)v9;
v13 = sub_1002E75A0((__int64)v9, v10);
sub_100009900(__p, "chars");
sub_100009900(&v56, "char");
v14 = (char *)cocos2d::CCString::getCString(v13);
sub_100009900(&__str, v14);
if ( (v60 & 0x80u) == 0 )
v15 = v60;
else
v15 = (std::string::size_type)__p[1];
std::string::basic_string(&v54, &__str, 0, v15, (std::allocator *)&__a);
v16 = SHIBYTE(v54.__r_.__value_.__r.__words[2]);
if ( (v54.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(v54.__r_.__value_.__r.__words[2]);
else
size = v54.__r_.__value_.__l.__size_;
v18 = v60;
if ( (v60 & 0x80u) != 0 )
v18 = (unsigned __int64)__p[1];
if ( size == v18 )
{
if ( (v54.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v19 = &v54;
else
v19 = (std::string *)v54.__r_.__value_.__r.__words[0];
if ( (v60 & 0x80u) == 0 )
v20 = __p;
else
v20 = (void **)__p[0];
v21 = memcmp(v19, v20, size) == 0;
if ( v16 < 0 )
{
LABEL_28:
operator delete(v54.__r_.__value_.__l.__data_);
if ( v21 )
goto LABEL_78;
goto LABEL_29;
}
}
else
{
v21 = 0;
if ( SHIBYTE(v54.__r_.__value_.__r.__words[2]) < 0 )
goto LABEL_28;
}
if ( v21 )
goto LABEL_78;
LABEL_29:
if ( (v58 & 0x80u) == 0 )
v22 = v58;
else
v22 = v57;
std::string::basic_string(&v54, &__str, 0, v22, (std::allocator *)&__a);
v23 = SHIBYTE(v54.__r_.__value_.__r.__words[2]);
if ( (v54.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v24 = HIBYTE(v54.__r_.__value_.__r.__words[2]);
else
v24 = v54.__r_.__value_.__l.__size_;
v25 = v58;
if ( (v58 & 0x80u) != 0 )
v25 = v57;
if ( v24 == v25 )
{
if ( (v54.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v26 = &v54;
else
v26 = (std::string *)v54.__r_.__value_.__r.__words[0];
if ( (v58 & 0x80u) == 0 )
v27 = &v56;
else
v27 = v56;
v28 = memcmp(v26, v27, v24) == 0;
if ( (v23 & 0x80000000) == 0 )
{
LABEL_45:
if ( v28 )
goto LABEL_49;
goto LABEL_78;
}
}
else
{
v28 = 0;
if ( (SHIBYTE(v54.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_45;
}
operator delete(v54.__r_.__value_.__l.__data_);
if ( v28 )
{
LABEL_49:
v29 = sub_1002E736C();
v30 = (char *)cocos2d::CCString::getCString(v13);
if ( strtok(v30, "=") )
{
v31 = strtok(nullptr, "=");
if ( v31 )
{
v32 = v31;
do
{
sub_100009900(&v54, v32);
sub_1003064AC((__int128 *)&v54);
sub_1002E74E0((__int64)v29);
if ( SHIBYTE(v54.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v54.__r_.__value_.__l.__data_);
v32 = strtok(nullptr, "=");
}
while ( v32 );
}
}
v33 = sub_1002E75A0((__int64)v29, 0);
v34 = v11;
v35 = (char *)cocos2d::CCString::getCString(v33);
sub_100009900(&v54, v35);
if ( (v54.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v36 = &v54;
else
v36 = (std::string *)v54.__r_.__value_.__r.__words[0];
if ( (v54.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v37 = SHIBYTE(v54.__r_.__value_.__r.__words[2]);
else
v37 = v54.__r_.__value_.__l.__size_;
v38 = (char *)v36 + v37;
if ( v37 >= 1 )
{
v39 = v37;
v40 = v36;
do
{
v41 = memchr(v40, 32, v39);
if ( !v41 )
break;
if ( *v41 == 32 )
goto LABEL_67;
v40 = (std::string *)(v41 + 1);
v39 = v38 - (_BYTE *)v40;
}
while ( v38 - (_BYTE *)v40 > 0 );
}
v41 = (char *)v36 + v37;
LABEL_67:
v42 = (_DWORD)v36 - (_DWORD)v41;
if ( v41 == v38 )
v42 = 1;
std::string::basic_string(&__a, &v54, 0, v42 + (int)v37 + 1, v62);
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
{
v44 = (void *)__a.__r_.__value_.__r.__words[0];
v43 = atoi(__a.__r_.__value_.__l.__data_);
if ( v43 < 0 )
{
operator delete(v44);
v11 = v34;
goto LABEL_76;
}
}
else
{
v11 = v34;
v43 = atoi((const char *)&__a);
if ( v43 < 0 )
{
LABEL_76:
if ( SHIBYTE(v54.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v54.__r_.__value_.__l.__data_);
goto LABEL_78;
}
}
v45 = v43;
v46 = sub_1002E75A0((__int64)v29, 3u);
v47 = cocos2d::CCString::intValue(v46);
v48 = sub_1002E75A0((__int64)v29, 7u);
v49 = cocos2d::CCString::intValue(v48);
v52 = v45;
*(_QWORD *)&v62[0].std::__non_trivial_if = &v52;
*(_DWORD *)(sub_10039056C(v51 + 56, &v52, v34, v62, &v61) + 20) = v49 + v47;
v52 = v45;
*(_QWORD *)&v62[0].std::__non_trivial_if = &v52;
v11 = v34;
*(_DWORD *)(sub_10039056C(v51 + 96, &v52, v34, v62, &v61) + 20) = v49;
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__a.__r_.__value_.__l.__data_);
goto LABEL_76;
}
LABEL_78:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (char)v58 < 0 )
operator delete(v56);
if ( (char)v60 < 0 )
operator delete(__p[0]);
++v10;
v9 = (_DWORD *)v12;
}
while ( v10 < (unsigned int)sub_1002E757C(v12) );
}
return cocos2d::CCObject::release(v9);
}