//
// sub_1000BA9A8 from 0x1000ba9a8 to 0x1000bac94 (748 bytes)
//
// 2 xrefs:
// > sub_10009D344 @ 0x10009d530
// > sub_1000B9B2C @ 0x1000ba590
//
// 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:43 +0000
//
__int64 __fastcall sub_1000BA9A8(int a1, std::string *__str, _QWORD *a3)
{
std::string::size_type size; // x8
__int64 v6; // x19
__int64 v7; // x0
const std::string::value_type *CString; // x0
std::string *p_a; // x21
size_t v10; // x0
bool v11; // w0
bool v12; // w20
__int64 v13; // x20
__int64 v14; // x0
__int64 v15; // x0
int v16; // w19
__int64 v17; // x0
__int64 v18; // x0
int v19; // w19
__int64 v20; // x0
int v21; // w21
__int64 v22; // x0
char *v23; // x0
_QWORD *v24; // x0
int v25; // w20
void *__dst[2]; // [xsp+30h] [xbp-E0h] BYREF
__int64 v28; // [xsp+40h] [xbp-D0h]
void *v29[2]; // [xsp+48h] [xbp-C8h] BYREF
__int64 v30; // [xsp+58h] [xbp-B8h]
void *__p[2]; // [xsp+60h] [xbp-B0h] BYREF
char v32; // [xsp+77h] [xbp-99h]
std::string v33; // [xsp+78h] [xbp-98h] BYREF
std::string __a; // [xsp+90h] [xbp-80h] BYREF
std::string v35; // [xsp+A8h] [xbp-68h] BYREF
_BYTE v36[20]; // [xsp+D4h] [xbp-3Ch] BYREF
size = SHIBYTE(__str->__r_.__value_.__r.__words[2]);
if ( (size & 0x8000000000000000LL) != 0 )
size = __str->__r_.__value_.__l.__size_;
if ( size < 6 )
return 0;
std::string::basic_string(&v35, __str, 5u, 0xFFFFFFFFFFFFFFFFLL, (std::allocator *)&__a);
if ( SHIBYTE(__str->__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str->__r_.__value_.__l.__data_);
*__str = v35;
if ( SHIBYTE(__str->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__a, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_);
else
__a = *__str;
v7 = sub_1003065B0("%c%s%s%c%c%s", 112, "C26", "fpYa", 81, 67, "tg");
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v7);
p_a = &__a;
std::string::append(&__a, CString);
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
p_a = (std::string *)__a.__r_.__value_.__r.__words[0];
v10 = strlen((const char *)p_a);
sub_10011BEE8(p_a, v10, v36);
sub_10011C380(v36, &v35);
sub_100009900(&v33, (char *)&v35);
v11 = sub_1000045BC(&v33, a3);
v12 = v11;
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v33.__r_.__value_.__l.__data_);
if ( v12 )
goto LABEL_14;
}
else if ( v11 )
{
LABEL_14:
sub_100009900(__p, "59182");
cocos2d::ZipUtils::base64DecodeEnc(&v33, __str, __p);
if ( v32 < 0 )
operator delete(__p[0]);
v13 = sub_1000A72B8(&v33, ":");
if ( (unsigned int)sub_1002E757C(v13) >= 5
&& (v14 = cocos2d::CCArray::stringAtIndex(v13, 1),
v15 = cocos2d::CCString::intValue(v14),
v16 = v15,
v17 = GameManager::sharedState(v15),
v16 == *(_DWORD *)(v17 + 896) - *(_DWORD *)(v17 + 900)) )
{
v18 = cocos2d::CCArray::stringAtIndex(v13, 2);
v19 = cocos2d::CCString::intValue(v18);
v20 = cocos2d::CCArray::stringAtIndex(v13, 3);
v21 = cocos2d::CCString::intValue(v20);
v22 = cocos2d::CCArray::stringAtIndex(v13, 4);
v23 = (char *)cocos2d::CCString::getCString(v22);
v24 = sub_100009900(v29, v23);
v25 = GameStatsManager::sharedState(v24);
if ( SHIBYTE(v30) < 0 )
{
sub_1000097D0(__dst, v29[0], (unsigned __int64)v29[1]);
}
else
{
*(_OWORD *)__dst = *(_OWORD *)v29;
v28 = v30;
}
v6 = sub_1003D105C(v25, v21, v19, (int)__dst);
if ( SHIBYTE(v28) < 0 )
operator delete(__dst[0]);
if ( SHIBYTE(v30) < 0 )
operator delete(v29[0]);
}
else
{
v6 = 0;
}
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v33.__r_.__value_.__l.__data_);
goto LABEL_25;
}
v6 = 0;
LABEL_25:
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__a.__r_.__value_.__l.__data_);
return v6;
}