//
// sub_10009CB2C from 0x10009cb2c to 0x10009d208 (1756 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x100093a98
//
// 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:29 +0000
//
void __fastcall sub_10009CB2C(__int64 a1, _QWORD *a2)
{
_BOOL4 v4; // w0
_BOOL4 v5; // w21
__int64 v6; // x0
__int64 v7; // x20
__int64 v8; // x0
char *CString; // x0
__int64 v10; // x0
char *v11; // x0
std::string::size_type size; // x8
__int64 v13; // x0
__int64 v14; // x0
const std::string::value_type *v15; // x0
std::string *p_a; // x20
size_t v17; // x0
bool v18; // w0
bool v19; // w20
__int64 v20; // x21
__int64 v21; // x0
__int64 v22; // x0
__int64 v23; // x0
__int64 v24; // x0
int v25; // w20
_DWORD *v26; // x22
float v27; // s0
__int64 v28; // x0
__int64 v29; // x0
int v30; // w20
__int64 v31; // x0
__int64 v32; // x0
char *v33; // x0
_QWORD *v34; // x0
__int64 v35; // x0
bool v36; // w20
__int64 v37; // x0
__int64 v38; // x0
int v39; // w20
__int64 v40; // x0
__int64 v41; // x0
__int64 v42; // x20
__int64 v43; // x0
char *v44; // x0
__int64 v45; // x0
char *v46; // x0
__int64 v47; // x0
char *v48; // x0
__int64 v49; // x0
__int64 v50; // x21
__int64 v51; // x0
__int64 Challenge; // x22
__int64 v53; // x0
__int64 v54; // x23
__int64 v55; // x0
__int64 v56; // x25
void **v57; // x8
char *v58; // x9
void *v59; // x1
void **v60; // x8
__int64 v61; // x0
__int64 v62; // x24
__int64 v63; // x0
__int64 v64; // x0
__int64 v65; // x0
__int64 v66; // x0
void (__fastcall ***v67)(_QWORD); // x0
__int64 v68; // x0
void *v69[2]; // [xsp+30h] [xbp-1A0h] BYREF
void *v70; // [xsp+40h] [xbp-190h]
void *v71[2]; // [xsp+50h] [xbp-180h] BYREF
char v72; // [xsp+67h] [xbp-169h] BYREF
void *v73[2]; // [xsp+68h] [xbp-168h] BYREF
char v74; // [xsp+7Fh] [xbp-151h] BYREF
void *__dst[2]; // [xsp+80h] [xbp-150h] BYREF
__int64 v76; // [xsp+90h] [xbp-140h] BYREF
void *v77[2]; // [xsp+98h] [xbp-138h] BYREF
char v78; // [xsp+AFh] [xbp-121h]
void *__p[2]; // [xsp+B0h] [xbp-120h] BYREF
char v80; // [xsp+C7h] [xbp-109h]
void *v81[2]; // [xsp+C8h] [xbp-108h] BYREF
char v82; // [xsp+DFh] [xbp-F1h]
std::string __a; // [xsp+E0h] [xbp-F0h] BYREF
void *v84[2]; // [xsp+F8h] [xbp-D8h] BYREF
char v85; // [xsp+10Fh] [xbp-C1h]
std::string __str; // [xsp+110h] [xbp-C0h] BYREF
std::string v87; // [xsp+130h] [xbp-A0h] BYREF
_BYTE v88[20]; // [xsp+15Ch] [xbp-74h] BYREF
sub_1000ADC9C(a1, "get_chal");
sub_100009900(&v87, "-1");
v4 = sub_1000045BC(a2, &v87);
v5 = v4;
if ( SHIBYTE(v87.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v87.__r_.__value_.__l.__data_);
if ( v5 )
{
LABEL_3:
v6 = *(_QWORD *)(a1 + 1424);
if ( !v6 )
return;
goto LABEL_4;
}
}
else if ( v4 )
{
goto LABEL_3;
}
v7 = sub_1000A72B8(a2, "|");
if ( (unsigned int)sub_1002E757C(v7) <= 1 )
{
v6 = *(_QWORD *)(a1 + 1424);
if ( !v6 )
return;
LABEL_4:
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 8LL))(v6);
return;
}
v8 = cocos2d::CCArray::stringAtIndex(v7, 0);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_100009900(&__str, CString);
v10 = cocos2d::CCArray::stringAtIndex(v7, 1);
v11 = (char *)cocos2d::CCString::getCString(v10);
sub_100009900(v84, v11);
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( size <= 4 )
{
v13 = *(_QWORD *)(a1 + 1424);
if ( v13 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 8LL))(v13);
goto LABEL_94;
}
std::string::basic_string(&v87, &__str, 5u, 0xFFFFFFFFFFFFFFFFLL, (std::allocator *)&__a);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
__str = v87;
if ( SHIBYTE(v87.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__a, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
else
__a = __str;
v14 = sub_1003065B0("%c%s%s%c%c%s", 111, "C36", "fpYa", 80, 116, "dg");
v15 = (const std::string::value_type *)cocos2d::CCString::getCString(v14);
p_a = &__a;
std::string::append(&__a, v15);
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
p_a = (std::string *)__a.__r_.__value_.__r.__words[0];
v17 = strlen((const char *)p_a);
sub_10011BEE8(p_a, v17, v88);
sub_10011C380(v88, &v87);
sub_100009900(v81, (char *)&v87);
v18 = sub_1000045BC(v81, v84);
v19 = v18;
if ( (v82 & 0x80000000) == 0 )
{
if ( v18 )
goto LABEL_23;
LABEL_29:
v22 = *(_QWORD *)(a1 + 1424);
if ( v22 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 8LL))(v22);
goto LABEL_92;
}
operator delete(v81[0]);
if ( !v19 )
goto LABEL_29;
LABEL_23:
sub_100009900(__p, "19847");
cocos2d::ZipUtils::base64DecodeEnc(v81, &__str, __p);
if ( v80 < 0 )
operator delete(__p[0]);
v20 = sub_1000A72B8(v81, ":");
if ( (unsigned int)sub_1002E757C(v20) <= 8 )
{
v21 = *(_QWORD *)(a1 + 1424);
if ( !v21 )
goto LABEL_90;
LABEL_38:
(*(void (__fastcall **)(__int64))(*(_QWORD *)v21 + 8LL))(v21);
goto LABEL_90;
}
v23 = cocos2d::CCArray::stringAtIndex(v20, 1);
v24 = cocos2d::CCString::intValue(v23);
v25 = v24;
if ( (int)v24 < 1 )
{
v21 = *(_QWORD *)(a1 + 1408);
if ( !v21 )
goto LABEL_90;
goto LABEL_38;
}
v26 = (_DWORD *)GameManager::sharedState(v24);
v26[167] = v25;
v27 = vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0;
v26[166] = (int)v27;
v26[165] = v25 + (int)v27;
v28 = cocos2d::CCArray::stringAtIndex(v20, 2);
v29 = cocos2d::CCString::intValue(v28);
v30 = v29;
v31 = GameManager::sharedState(v29);
if ( v30 != *(_DWORD *)(v31 + 896) - *(_DWORD *)(v31 + 900) )
{
v21 = *(_QWORD *)(a1 + 1408);
if ( !v21 )
goto LABEL_90;
goto LABEL_38;
}
v32 = cocos2d::CCArray::stringAtIndex(v20, 3);
v33 = (char *)cocos2d::CCString::getCString(v32);
v34 = sub_100009900(v77, v33);
v35 = GameManager::sharedState(v34);
if ( *(char *)(v35 + 631) < 0 )
{
sub_1000097D0(__dst, *(void **)(v35 + 608), *(_QWORD *)(v35 + 616));
}
else
{
*(_OWORD *)__dst = *(_OWORD *)(v35 + 608);
v76 = *(_QWORD *)(v35 + 624);
}
v36 = sub_1000045BC(v77, __dst);
if ( SHIBYTE(v76) < 0 )
operator delete(__dst[0]);
if ( !v36 )
{
v68 = *(_QWORD *)(a1 + 1408);
if ( !v68 )
goto LABEL_88;
LABEL_87:
(*(void (__fastcall **)(__int64))(*(_QWORD *)v68 + 8LL))(v68);
goto LABEL_88;
}
v37 = cocos2d::CCArray::stringAtIndex(v20, 4);
v38 = cocos2d::CCString::intValue(v37);
v39 = v38;
v40 = GJAccountManager::sharedState(v38);
if ( v39 != *(_DWORD *)(v40 + 352) - *(_DWORD *)(v40 + 356) )
{
v68 = *(_QWORD *)(a1 + 1408);
if ( !v68 )
goto LABEL_88;
goto LABEL_87;
}
v41 = cocos2d::CCArray::stringAtIndex(v20, 5);
v42 = cocos2d::CCString::intValue(v41);
v43 = cocos2d::CCArray::stringAtIndex(v20, 6);
v44 = (char *)cocos2d::CCString::getCString(v43);
sub_100009900(__dst, v44);
v45 = cocos2d::CCArray::stringAtIndex(v20, 7);
v46 = (char *)cocos2d::CCString::getCString(v45);
sub_100009900(v73, v46);
v47 = cocos2d::CCArray::stringAtIndex(v20, 8);
v48 = (char *)cocos2d::CCString::getCString(v47);
v49 = (__int64)sub_100009900(v71, v48);
v50 = 1;
do
{
v51 = GameStatsManager::sharedState(v49);
Challenge = GameStatsManager::getChallenge(v51, v50);
v53 = GameStatsManager::sharedState(Challenge);
v54 = sub_1003D1E18(v53, v50);
v55 = GameStatsManager::sharedState(v54);
v56 = sub_1003D1E9C(v55, v50);
if ( (_DWORD)v50 == 2 )
v57 = v73;
else
v57 = v71;
v58 = &v74;
if ( (_DWORD)v50 != 2 )
v58 = &v72;
if ( (_DWORD)v50 == 1 )
{
v57 = __dst;
v58 = (char *)&v76 + 7;
}
if ( *v58 < 0 )
{
v59 = *v57;
if ( (_DWORD)v50 == 2 )
v60 = v73;
else
v60 = v71;
if ( (_DWORD)v50 == 1 )
v60 = __dst;
sub_1000097D0(v69, v59, (unsigned __int64)v60[1]);
}
else
{
*(_OWORD *)v69 = *(_OWORD *)v57;
v70 = v57[2];
}
v61 = GJChallengeItem::createFromString(v69);
v62 = v61;
if ( SHIBYTE(v70) < 0 )
operator delete(v69[0]);
*(_DWORD *)(v62 + 104) = v50;
v63 = GameStatsManager::sharedState(v61);
v49 = sub_1003D1FDC(v63, v62);
if ( (v49 & 1) == 0
&& (!Challenge || *(_DWORD *)(Challenge + 96) < *(_DWORD *)(v62 + 96))
&& (!v54 || *(_DWORD *)(v54 + 96) < *(_DWORD *)(v62 + 96))
&& (!v56 || *(_DWORD *)(v56 + 96) < *(_DWORD *)(v62 + 96)) )
{
if ( Challenge )
{
if ( v54 && (*(_BYTE *)(Challenge + 100) & 1) != 0 )
{
LABEL_72:
v64 = GameStatsManager::sharedState(v49);
v49 = sub_1003D1C88(v64, v50, v62);
goto LABEL_75;
}
}
else if ( v54 )
{
goto LABEL_72;
}
v65 = GameStatsManager::sharedState(v49);
v49 = sub_1003D1B84(v65, v50, v62);
}
LABEL_75:
v50 = (unsigned int)(v50 + 1);
}
while ( (_DWORD)v50 != 4 );
v66 = GameStatsManager::sharedState(v49);
sub_1003D1A0C(v66, v42);
v67 = *(void (__fastcall ****)(_QWORD))(a1 + 1424);
if ( v67 )
(**v67)(v67);
if ( v72 < 0 )
operator delete(v71[0]);
if ( v74 < 0 )
operator delete(v73[0]);
if ( SHIBYTE(v76) < 0 )
operator delete(__dst[0]);
LABEL_88:
if ( v78 < 0 )
operator delete(v77[0]);
LABEL_90:
if ( v82 < 0 )
operator delete(v81[0]);
LABEL_92:
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__a.__r_.__value_.__l.__data_);
LABEL_94:
if ( v85 < 0 )
operator delete(v84[0]);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}