//
// GameLevelManager::createAndGetCommentsFull from 0x1005502a0 to 0x10055096c (1740 bytes)
//
// 4 xrefs:
// > GameLevelManager::onGetLevelCommentsCompleted @ 0x100520e31
// > GameLevelManager::onGetAccountCommentsCompleted @ 0x100521364
// > GameLevelManager::createAndGetLevelComments @ 0x10054fe5a
// > GameLevelManager::createAndGetAccountComments @ 0x10055025d
//
// 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
//
__int64 __fastcall GameLevelManager::createAndGetCommentsFull(__int64 a1, __int64 a2, int a3, char a4, __m128 a5)
{
const char *v6; // r15
size_t v7; // rax
size_t v8; // rbx
char *v9; // r14
size_t v10; // r13
unsigned int v11; // r12d
__int64 v12; // rbx
cocos2d::CCString *v13; // rax
const char *CString; // r14
size_t v15; // rax
size_t v16; // rbx
char *v17; // r15
__int64 v18; // rax
size_t v19; // r13
cocos2d::CCDictionary *v20; // rax
GJComment *v21; // rbx
unsigned int v22; // r14d
__int64 v23; // rbx
cocos2d::CCString *v24; // rax
const char *v25; // r14
size_t v26; // rax
size_t v27; // rbx
char *v28; // r15
__int64 v29; // rax
size_t v30; // r12
cocos2d::CCArray *v31; // r12
cocos2d::CCString *v32; // rax
const char *v33; // rbx
size_t v34; // rax
size_t v35; // r14
char *v36; // r15
__int64 v37; // rax
size_t v38; // r13
cocos2d::CCString *v39; // rax
const char *v40; // rbx
size_t v41; // rax
size_t v42; // r14
char *v43; // r15
char v44; // r14
__int64 v45; // rax
size_t v46; // r12
cocos2d::CCDictionary *v47; // rax
GJComment *v48; // r12
char v49; // r13
cocos2d::CCDictionary *v50; // rax
GJUserScore *v51; // rbx
cocos2d::CCObject *m_userScore; // rdi
int m_userID; // r14d
int m_accountID; // r15d
std::string *p_m_userName; // rbx
__int128 v58; // [rsp+10h] [rbp-110h] BYREF
void *v59; // [rsp+20h] [rbp-100h]
__int128 v60; // [rsp+30h] [rbp-F0h] BYREF
void *v61; // [rsp+40h] [rbp-E0h]
__m128 v62; // [rsp+50h] [rbp-D0h] BYREF
void *longStorage; // [rsp+60h] [rbp-C0h]
__int128 v64; // [rsp+70h] [rbp-B0h] BYREF
void *v65; // [rsp+80h] [rbp-A0h]
unsigned int v66; // [rsp+8Ch] [rbp-94h]
__int64 v67; // [rsp+90h] [rbp-90h]
__int128 v68; // [rsp+98h] [rbp-88h] BYREF
void *v69; // [rsp+A8h] [rbp-78h]
__int128 v70; // [rsp+B0h] [rbp-70h] BYREF
void *v71; // [rsp+C0h] [rbp-60h]
int v72; // [rsp+CCh] [rbp-54h]
__int64 v73; // [rsp+D0h] [rbp-50h]
__int128 __dst; // [rsp+D8h] [rbp-48h] BYREF
void *__p; // [rsp+E8h] [rbp-38h]
char v76; // [rsp+F7h] [rbp-29h]
v72 = a3;
v67 = sub_10071F9E0(a1, a2);
if ( (*(_BYTE *)a2 & 1) != 0 )
v6 = *(const char **)(a2 + 16);
else
v6 = (const char *)(a2 + 1);
v7 = strlen(v6);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_88:
sub_100006BF0(*(double *)a5.i64);
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
*(_QWORD *)&__dst = v10 + 1;
*((_QWORD *)&__dst + 1) = v8;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
LABEL_11:
memmove(v9, v6, v8);
v9[v8] = 0;
v73 = sub_10052DD30((unsigned __int8 *)&__dst, "|", *(double *)a5.i64);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (unsigned int)sub_100720070(v73) )
{
if ( a4 )
{
v11 = 0;
v12 = v73;
while ( 1 )
{
v13 = (cocos2d::CCString *)sub_1007200C0(v12, v11);
CString = cocos2d::CCString::getCString(v13);
v15 = strlen(CString);
if ( v15 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_88;
v16 = v15;
if ( v15 >= 0x17 )
{
v18 = v15 | 7;
v19 = 26;
if ( (v16 | 7) != 0x17 )
v19 = v18 + 1;
v17 = (char *)operator new(v19);
__p = v17;
*(_QWORD *)&__dst = v19 + 1;
*((_QWORD *)&__dst + 1) = v16;
}
else
{
LOBYTE(__dst) = 2 * v15;
v17 = (char *)&__dst + 1;
if ( !v15 )
{
BYTE1(__dst) = 0;
if ( (__dst & 1) != 0 )
goto LABEL_27;
goto LABEL_22;
}
}
memmove(v17, CString, v16);
v17[v16] = 0;
if ( (__dst & 1) != 0 )
{
LABEL_27:
sub_100006B70(&v64, __p, *((unsigned __int64 *)&__dst + 1), *(double *)a5.i64);
goto LABEL_28;
}
LABEL_22:
v65 = __p;
a5.i64[0] = __dst;
v64 = __dst;
LABEL_28:
v20 = GameLevelManager::responseToDict((__int64)&v64, 1, *(double *)a5.i64);
v21 = GJComment::create(v20);
if ( (v64 & 1) != 0 )
operator delete(v65);
v21->m_accountID = v72;
sub_10071FCD0(v67, v21);
if ( (__dst & 1) != 0 )
operator delete(__p);
++v11;
v12 = v73;
if ( v11 >= (unsigned int)sub_100720070(v73) )
return v67;
}
}
v22 = 0;
v23 = v73;
while ( 1 )
{
v66 = v22;
v24 = (cocos2d::CCString *)sub_1007200C0(v23, v22);
v25 = cocos2d::CCString::getCString(v24);
v26 = strlen(v25);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_88;
v27 = v26;
if ( v26 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v26;
v28 = (char *)&__dst + 1;
if ( v26 )
goto LABEL_41;
LABEL_42:
v28[v27] = 0;
v31 = (cocos2d::CCArray *)sub_10052DD30((unsigned __int8 *)&__dst, ":", *(double *)a5.i64);
if ( (unsigned int)sub_100720070(v31) >= 2 )
{
v32 = cocos2d::CCArray::stringAtIndex(v31, 0);
v33 = cocos2d::CCString::getCString(v32);
v34 = strlen(v33);
if ( v34 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v35 = v34;
if ( v34 >= 0x17 )
{
v37 = v34 | 7;
v38 = 26;
if ( (v35 | 7) != 0x17 )
v38 = v37 + 1;
v36 = (char *)operator new(v38);
v69 = v36;
*(_QWORD *)&v68 = v38 | 1;
*((_QWORD *)&v68 + 1) = v35;
}
else
{
LOBYTE(v68) = 2 * v34;
v36 = (char *)&v68 + 1;
if ( !v34 )
{
LABEL_51:
v36[v35] = 0;
v39 = cocos2d::CCArray::stringAtIndex(v31, 1u);
v40 = cocos2d::CCString::getCString(v39);
v41 = strlen(v40);
if ( v41 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a5.i64);
v42 = v41;
if ( v41 >= 0x17 )
{
v45 = v41 | 7;
v46 = 26;
if ( (v42 | 7) != 0x17 )
v46 = v45 + 1;
v43 = (char *)operator new(v46);
v71 = v43;
*(_QWORD *)&v70 = v46 | 1;
*((_QWORD *)&v70 + 1) = v42;
}
else
{
LOBYTE(v70) = 2 * v41;
v43 = (char *)&v70 + 1;
if ( !v41 )
{
BYTE1(v70) = 0;
v44 = v68;
if ( (v68 & 1) == 0 )
goto LABEL_55;
LABEL_60:
sub_100006B70(&v58, v69, *((unsigned __int64 *)&v68 + 1), *(double *)a5.i64);
goto LABEL_61;
}
}
memmove(v43, v40, v42);
v43[v42] = 0;
v44 = v68;
if ( (v68 & 1) != 0 )
goto LABEL_60;
LABEL_55:
v59 = v69;
a5.i64[0] = v68;
v58 = v68;
LABEL_61:
v47 = GameLevelManager::responseToDict((__int64)&v58, 1, *(double *)a5.i64);
v48 = GJComment::create(v47);
v76 = v44;
if ( (v58 & 1) != 0 )
operator delete(v59);
v49 = v70;
if ( (v70 & 1) != 0 )
{
sub_100006B70(&v60, v71, *((unsigned __int64 *)&v70 + 1), *(double *)a5.i64);
}
else
{
v61 = v71;
a5.i64[0] = v70;
v60 = v70;
}
v50 = GameLevelManager::responseToDict((__int64)&v60, 1, *(double *)a5.i64);
v51 = GJUserScore::create(v50);
if ( (v60 & 1) != 0 )
operator delete(v61);
if ( v51 )
{
if ( v48->m_userScore != v51 )
{
cocos2d::CCObject::retain(v51);
m_userScore = v48->m_userScore;
if ( m_userScore )
cocos2d::CCObject::release(m_userScore);
v48->m_userScore = v51;
}
m_userID = v48->m_userID;
m_accountID = v51->m_accountID;
if ( (v51->m_userName.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v62,
v51->m_userName.m_data.m_long.longStorage,
v51->m_userName.m_data.m_long.size,
*(double *)a5.i64);
}
else
{
p_m_userName = &v51->m_userName;
longStorage = p_m_userName->m_data.m_long.longStorage;
a5 = *(__m128 *)&p_m_userName->m_data.m_short.sizex2;
v62 = *(__m128 *)&p_m_userName->m_data.m_short.sizex2;
}
GameLevelManager::storeUserName(a1, m_userID, m_accountID, (__int64)&v62, *(double *)a5.i64);
if ( (v62.i8[0] & 1) != 0 )
operator delete(longStorage);
}
if ( (v49 & 1) != 0 )
{
operator delete(v71);
if ( (v76 & 1) != 0 )
goto LABEL_85;
LABEL_80:
if ( !v48->m_levelID )
LABEL_86:
v48->m_levelID = v72;
}
else
{
if ( (v76 & 1) == 0 )
goto LABEL_80;
LABEL_85:
operator delete(v69);
if ( !v48->m_levelID )
goto LABEL_86;
}
sub_10071FCD0(v67, v48);
goto LABEL_82;
}
}
memmove(v36, v33, v35);
goto LABEL_51;
}
LABEL_82:
if ( (__dst & 1) != 0 )
operator delete(__p);
v22 = v66 + 1;
v23 = v73;
if ( v22 >= (unsigned int)sub_100720070(v73) )
return v67;
}
v29 = v26 | 7;
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = v29 + 1;
v28 = (char *)operator new(v30);
__p = v28;
*(_QWORD *)&__dst = v30 + 1;
*((_QWORD *)&__dst + 1) = v27;
LABEL_41:
memmove(v28, v25, v27);
goto LABEL_42;
}
return v67;
}