//
// GameLevelManager::onGetGJSecretRewardCompleted from 0x1401653a0 to 0x140166020 (3200 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x140143edd
// > ??> @ 0x1406cacc8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=17
void __fastcall GameLevelManager::onGetGJSecretRewardCompleted(__int64 a1, __int64 *a2, __int64 a3)
{
void *v5; // rcx
const void *v6; // rcx
unsigned __int64 v7; // r14
size_t v8; // r8
int v9; // ebx
size_t v10; // rdi
cocos2d::CCArray *v11; // rbx
__int64 v12; // rcx
__int64 v13; // rcx
cocos2d::CCString *v14; // rax
const char *CString; // rax
size_t v16; // r8
cocos2d::CCString *v17; // rax
const char *v18; // rax
size_t v19; // r8
__int64 v20; // rcx
__int128 *v21; // rdx
__int64 v22; // r8
__int64 v23; // r9
__int64 v24; // rdx
void *v25; // rcx
__int64 v26; // xmm2_8
__int128 *v27; // r14
__int64 v28; // r15
unsigned __int64 v29; // rbx
cocos2d::CCString *v30; // rax
char *v31; // rax
size_t v32; // r8
void **v33; // rax
void **v34; // rcx
__int64 v35; // rdx
size_t v36; // r8
void **v37; // rdx
bool v38; // r12
char *v39; // rbx
void **v40; // rcx
size_t v41; // rsi
size_t v42; // r8
size_t v43; // r14
cocos2d::CCArray *v44; // rsi
__int64 v45; // rcx
void *v46; // rcx
bool v47; // zf
char *v48; // rax
void *v49; // rcx
cocos2d::CCString *v50; // rax
int v51; // r14d
__int64 v52; // rcx
cocos2d::CCString *v53; // rax
cocos2d::CCString *v54; // rax
cocos2d::CCString *v55; // rax
const char *v56; // rax
size_t v57; // r8
__int64 v58; // rdx
__int64 v59; // rcx
__int64 v60; // r8
__int64 v61; // r9
void **v62; // r12
_BYTE *v63; // r14
size_t v64; // r13
unsigned __int64 v65; // rsi
_BYTE *v66; // rax
__int64 v67; // rdx
__int64 v68; // rcx
__int64 v69; // r8
__int64 v70; // r9
__int128 *p_Buf2; // r13
__int128 *v72; // r12
unsigned __int64 v73; // rsi
unsigned __int64 v74; // rdi
__int64 v75; // rcx
__int64 v76; // rax
__int128 *v77; // rdi
char *v78; // rax
_BYTE *v79; // rax
void *v80; // rcx
__int64 v81; // rcx
_BYTE *v82; // rax
__int64 v83; // rcx
void *v84; // rcx
char *v85; // rax
bool v86; // [rsp+40h] [rbp-C0h]
bool v87; // [rsp+41h] [rbp-BFh]
bool v88; // [rsp+42h] [rbp-BEh]
void *v89; // [rsp+48h] [rbp-B8h]
unsigned int v90; // [rsp+48h] [rbp-B8h]
__int64 Reward; // [rsp+48h] [rbp-B8h]
unsigned int v93; // [rsp+58h] [rbp-A8h]
void *v94; // [rsp+58h] [rbp-A8h]
void *Block[2]; // [rsp+88h] [rbp-78h] BYREF
size_t v98; // [rsp+98h] [rbp-68h]
unsigned __int64 v99; // [rsp+A0h] [rbp-60h]
__int128 Buf2; // [rsp+A8h] [rbp-58h] BYREF
__m128i v101; // [rsp+B8h] [rbp-48h]
__int128 v102; // [rsp+C8h] [rbp-38h] BYREF
__m128i v103; // [rsp+D8h] [rbp-28h]
void *v104[2]; // [rsp+E8h] [rbp-18h] BYREF
__int64 v105; // [rsp+F8h] [rbp-8h]
unsigned __int64 v106; // [rsp+100h] [rbp+0h]
void *v107[2]; // [rsp+108h] [rbp+8h] BYREF
size_t Size; // [rsp+118h] [rbp+18h]
unsigned __int64 v109; // [rsp+120h] [rbp+20h]
void *Src[2]; // [rsp+128h] [rbp+28h] BYREF
unsigned __int64 v111; // [rsp+138h] [rbp+38h]
unsigned __int64 v112; // [rsp+140h] [rbp+40h]
__int64 v113[5]; // [rsp+148h] [rbp+48h] BYREF
_BYTE v114[528]; // [rsp+170h] [rbp+70h] BYREF
_QWORD v115[4]; // [rsp+380h] [rbp+280h] BYREF
__int128 v116; // [rsp+3A0h] [rbp+2A0h] BYREF
__int64 v117; // [rsp+3B0h] [rbp+2B0h]
__int64 v118; // [rsp+3B8h] [rbp+2B8h]
v98 = 11;
v99 = 15;
Block[0] = (void *)0x776572735F746567LL;
Block[1] = (void *)6582881;
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 584), Block);
if ( v99 > 0xF )
{
v5 = Block[0];
if ( v99 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v5);
}
Buf2 = 0;
v101.m128i_i64[0] = 2;
v101.m128i_i64[1] = 15;
strcpy((char *)&Buf2, "-1");
v6 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v6 = (const void *)*a2;
v7 = a2[2];
v8 = v7;
if ( v7 > 2 )
v8 = 2;
v9 = memcmp(v6, &Buf2, v8);
v10 = -1;
if ( !v9 )
{
if ( v7 >= 2 )
v9 = v7 > 2;
else
v9 = -1;
}
if ( v9 )
{
v11 = sub_140140F70(a2, "|");
if ( cocos2d::CCArray::count(v11) >= 2 )
{
v14 = cocos2d::CCArray::stringAtIndex(v11, 0);
CString = cocos2d::CCString::getCString(v14);
v102 = 0;
v103 = 0u;
v16 = -1;
do
++v16;
while ( CString[v16] );
sub_14003A930(&v102, CString, v16);
v17 = cocos2d::CCArray::stringAtIndex(v11, 1u);
v18 = cocos2d::CCString::getCString(v17);
*(_OWORD *)v107 = 0;
Size = 0;
v109 = 0;
v19 = -1;
do
++v19;
while ( v18[v19] );
sub_14003A930(v107, v18, v19);
Buf2 = 0;
v101 = 0u;
if ( v103.m128i_i64[0] < 5uLL )
sub_14003BCC0(v20);
v21 = &v102;
if ( v103.m128i_i64[1] > 0xFuLL )
v21 = (__int128 *)v102;
sub_14003A930(&Buf2, (char *)v21 + 5, v103.m128i_i64[0] - 5);
v24 = v103.m128i_i64[1];
if ( v103.m128i_i64[1] > 0xFuLL )
{
v25 = (void *)v102;
if ( (unsigned __int64)(v103.m128i_i64[1] + 1) >= 0x1000 )
{
v25 = *(void **)(v102 - 8);
if ( (unsigned __int64)(v102 - (_QWORD)v25 - 8) > 0x1F )
goto LABEL_145;
}
j_j_free(v25);
}
v102 = Buf2;
v26 = v101.m128i_i64[0];
v103 = v101;
*(_OWORD *)v104 = 0;
v105 = 0;
v106 = 0;
v27 = &v102;
if ( _mm_srli_si128(v101, 8).m128i_u64[0] > 0xF )
v27 = (__int128 *)Buf2;
v28 = 0x7FFFFFFFFFFFFFFFLL;
if ( v101.m128i_i64[0] > 0x7FFFFFFFFFFFFFFFuLL )
sub_140007B50(Buf2, v24, v22, v23);
if ( v101.m128i_i64[0] > 0xFuLL )
{
v29 = v101.m128i_i64[0] | 0xF;
if ( (v101.m128i_i64[0] | 0xFuLL) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v29 < 0x16 )
v29 = 22;
}
else
{
v29 = 0x7FFFFFFFFFFFFFFFLL;
}
v104[0] = sub_14003AA10(v29 + 1);
v105 = v26;
v106 = v29;
memcpy(v104[0], v27, v26 + 1);
}
else
{
v105 = v101.m128i_i64[0];
v106 = 15;
*(_OWORD *)v104 = *v27;
}
v30 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 112, "C26", "fpYa", 81, 67, "tg");
v31 = (char *)cocos2d::CCString::getCString(v30);
v32 = -1;
do
++v32;
while ( v31[v32] );
sub_140041270(v104, v31, v32);
v33 = v104;
if ( v106 <= 0xF )
{
v34 = v104;
}
else
{
v34 = (void **)v104[0];
v33 = (void **)v104[0];
}
v35 = -1;
do
++v35;
while ( *((_BYTE *)v33 + v35) );
sub_140070860((__int64)v34, v35, v115);
sub_140070B30((unsigned __int8 *)v115, &v116);
*(_OWORD *)Block = 0;
v98 = 0;
v99 = 0;
v36 = -1;
do
++v36;
while ( *((_BYTE *)&v116 + v36) );
sub_14003A930(Block, &v116, v36);
v37 = v107;
v38 = v109 > 0xF;
v88 = v109 > 0xF;
v39 = (char *)v107[0];
if ( v109 > 0xF )
v37 = (void **)v107[0];
v40 = Block;
if ( v99 > 0xF )
v40 = (void **)Block[0];
v41 = v98;
v42 = v98;
v43 = Size;
if ( Size < v98 )
v42 = Size;
if ( memcmp(v40, v37, v42) || v41 < v43 || v41 > v43 )
{
sub_14003A830((__int64)Block);
v83 = *(_QWORD *)(a1 + 864);
if ( v83 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v83 + 8LL))(v83);
if ( v106 > 0xF )
{
v84 = v104[0];
if ( v106 + 1 >= 0x1000 )
{
v84 = *((void **)v104[0] - 1);
if ( (unsigned __int64)((char *)v104[0] - (char *)v84 - 8) > 0x1F )
goto LABEL_145;
}
j_j_free(v84);
}
if ( v38 )
{
v85 = v39;
if ( v109 + 1 >= 0x1000 )
{
v39 = *((char **)v39 - 1);
if ( (unsigned __int64)(v85 - v39 - 8) > 0x1F )
goto LABEL_150;
}
j_j_free(v39);
}
if ( v103.m128i_i64[1] <= 0xFuLL )
goto LABEL_74;
v49 = (void *)v102;
if ( (unsigned __int64)(v103.m128i_i64[1] + 1) < 0x1000 )
goto LABEL_73;
v49 = *(void **)(v102 - 8);
if ( (unsigned __int64)(v102 - (_QWORD)v49 - 8) <= 0x1F )
goto LABEL_73;
goto LABEL_155;
}
sub_14003A830((__int64)Block);
Buf2 = 0;
v101.m128i_i64[0] = 5;
v101.m128i_i64[1] = 15;
strcpy((char *)&Buf2, "59182");
cocos2d::ZipUtils::base64DecodeEnc(v113, &v102, &Buf2);
v44 = sub_140140F70(v113, ":");
if ( cocos2d::CCArray::count(v44) < 5 )
goto LABEL_59;
v50 = cocos2d::CCArray::stringAtIndex(v44, 1u);
v51 = cocos2d::CCString::intValue(v50);
v52 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v89 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v89);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v52 = qword_1406C2ED8;
}
if ( v51 != *(_DWORD *)(v52 + 888) - *(_DWORD *)(v52 + 892) )
{
LABEL_59:
v45 = *(_QWORD *)(a1 + 864);
if ( v45 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 8LL))(v45);
sub_14003A830((__int64)v113);
if ( v106 > 0xF )
{
v46 = v104[0];
if ( v106 + 1 >= 0x1000 )
{
v46 = *((void **)v104[0] - 1);
if ( (unsigned __int64)((char *)v104[0] - (char *)v46 - 8) > 0x1F )
goto LABEL_145;
}
j_j_free(v46);
}
v47 = !v38;
LABEL_66:
if ( v47 )
goto LABEL_70;
v48 = v39;
if ( v109 + 1 < 0x1000 || (v39 = *((char **)v39 - 1), (unsigned __int64)(v48 - v39 - 8) <= 0x1F) )
{
j_j_free(v39);
LABEL_70:
if ( v103.m128i_i64[1] <= 0xFuLL )
{
LABEL_74:
v103.m128i_i64[0] = 0;
v103.m128i_i64[1] = 15;
LOBYTE(v102) = 0;
v13 = (__int64)a2;
goto LABEL_75;
}
v49 = (void *)v102;
if ( (unsigned __int64)(v103.m128i_i64[1] + 1) < 0x1000
|| (v49 = *(void **)(v102 - 8), (unsigned __int64)(v102 - (_QWORD)v49 - 8) <= 0x1F) )
{
LABEL_73:
j_j_free(v49);
goto LABEL_74;
}
LABEL_155:
invalid_parameter_noinfo_noreturn();
}
LABEL_150:
invalid_parameter_noinfo_noreturn();
}
v53 = cocos2d::CCArray::stringAtIndex(v44, 2u);
v93 = cocos2d::CCString::intValue(v53);
v54 = cocos2d::CCArray::stringAtIndex(v44, 3u);
v90 = cocos2d::CCString::intValue(v54);
v55 = cocos2d::CCArray::stringAtIndex(v44, 4u);
v56 = cocos2d::CCString::getCString(v55);
*(_OWORD *)Src = 0;
v111 = 0;
v112 = 0;
v57 = -1;
do
++v57;
while ( v56[v57] );
sub_14003A930(Src, v56, v57);
*(_OWORD *)Block = 0;
v98 = 0;
v99 = 0;
v62 = Src;
v87 = v112 > 0xF;
v63 = Src[0];
if ( v112 > 0xF )
v62 = (void **)Src[0];
v64 = v111;
if ( v111 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v59, v58, v60, v61);
v99 = 15;
if ( v111 > 0xF )
{
v65 = v111 | 0xF;
if ( (v111 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v65 < 0x16 )
v65 = 22;
}
else
{
v65 = 0x7FFFFFFFFFFFFFFFLL;
}
Block[0] = sub_14003AA10(v65 + 1);
v98 = v64;
v99 = v65;
memcpy(Block[0], v62, v64 + 1);
}
else
{
v98 = v111;
*(_OWORD *)Block = *(_OWORD *)v62;
}
if ( !qword_1406C2EE8 )
{
v115[0] = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v115[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
Reward = GameStatsManager::createReward(v59, v90, v93, Block);
if ( Reward )
{
if ( !qword_1406C2EE8 )
{
v115[0] = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v115[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
fmt::BasicWriter::BasicWriter(v114);
v115[0] = "o_secret_";
v115[1] = 0;
fmt::BasicWriter::operator<<(v114, v115);
fmt::BasicWriter::operator<<(v114, v93);
v66 = (_BYTE *)fmt::BasicWriter::c_str(v114);
Buf2 = 0;
v101 = 0u;
do
++v10;
while ( v66[v10] );
sub_14003A930(&Buf2, v66, v10);
fmt::BasicWriter::~BasicWriter(v114);
v115[0] = &v116;
v116 = 0;
v117 = 0;
v118 = 0;
p_Buf2 = &Buf2;
v86 = v101.m128i_i64[1] > 0xFuLL;
v72 = (__int128 *)Buf2;
if ( v101.m128i_i64[1] > 0xFuLL )
p_Buf2 = (__int128 *)Buf2;
v73 = v101.m128i_i64[0];
if ( v101.m128i_i64[0] > 0x7FFFFFFFFFFFFFFFuLL )
sub_140007B50(v68, v67, v69, v70);
v118 = 15;
if ( v101.m128i_i64[0] > 0xFuLL )
{
v74 = v101.m128i_i64[0] | 0xF;
if ( (v101.m128i_i64[0] | 0xFuLL) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v74 < 0x16 )
v74 = 22;
}
else
{
v74 = 0x7FFFFFFFFFFFFFFFLL;
}
*(_QWORD *)&v116 = sub_14003AA10(v74 + 1);
v117 = v73;
v118 = v74;
memcpy((void *)v116, p_Buf2, v73 + 1);
}
else
{
v117 = v101.m128i_i64[0];
v116 = *p_Buf2;
}
v75 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v94 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v94);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v75 = qword_1406C2EE8;
}
cocos2d::CCDictionary::setObject(*(_QWORD *)(v75 + 368), Reward, &v116);
sub_14003A830((__int64)&v116);
v76 = a1;
if ( *(_QWORD *)(a1 + 864) )
{
*(_OWORD *)Block = 0;
v98 = 0;
v77 = &Buf2;
if ( v86 )
v77 = v72;
if ( v73 > 0xF )
{
v99 = 15;
if ( (v73 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v28 = v73 | 0xF;
if ( (v73 | 0xF) < 0x16 )
v28 = 22;
}
Block[0] = sub_14003AA10(v28 + 1);
v98 = v73;
v99 = v28;
memcpy(Block[0], v77, v73 + 1);
v76 = a1;
}
else
{
v98 = v73;
v99 = 15;
*(_OWORD *)Block = *v77;
}
(***(void (__fastcall ****)(_QWORD, void **))(v76 + 864))(*(_QWORD *)(v76 + 864), Block);
}
if ( v86 )
{
v78 = (char *)v72;
if ( (unsigned __int64)(v101.m128i_i64[1] + 1) >= 0x1000 )
{
v72 = *((__int128 **)v72 - 1);
if ( (unsigned __int64)(v78 - (char *)v72 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v72);
}
if ( !v87 )
goto LABEL_129;
v79 = v63;
if ( v112 + 1 < 0x1000 || (v63 = *((_BYTE **)v63 - 1), (unsigned __int64)(v79 - v63 - 8) <= 0x1F) )
{
LABEL_128:
j_j_free(v63);
LABEL_129:
sub_14003A830((__int64)v113);
if ( v106 <= 0xF )
{
LABEL_133:
v47 = !v88;
goto LABEL_66;
}
v80 = v104[0];
if ( v106 + 1 < 0x1000
|| (v80 = *((void **)v104[0] - 1), (unsigned __int64)((char *)v104[0] - (char *)v80 - 8) <= 0x1F) )
{
j_j_free(v80);
goto LABEL_133;
}
LABEL_145:
invalid_parameter_noinfo_noreturn();
}
}
else
{
v81 = *(_QWORD *)(a1 + 864);
if ( v81 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v81 + 8LL))(v81);
if ( !v87 )
goto LABEL_129;
v82 = v63;
if ( v112 + 1 < 0x1000 )
goto LABEL_128;
v63 = *((_BYTE **)v63 - 1);
if ( (unsigned __int64)(v82 - v63 - 8) <= 0x1F )
goto LABEL_128;
}
invalid_parameter_noinfo_noreturn();
}
}
v12 = *(_QWORD *)(a1 + 864);
if ( v12 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 8LL))(v12);
v13 = (__int64)a2;
LABEL_75:
sub_14003A830(v13);
sub_14003A830(a3);
}