//
// GJComment::create from 0x10056b180 to 0x10056b952 (2002 bytes)
//
// 3 xrefs:
// > sub_10056AAF0 @ 0x10056ad88
// > sub_10056AAF0 @ 0x10056aee8
// > GJMultiplayerManager::addComment @ 0x10073a5e3
//
// This function is hookable on this platform (idp: pc, 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 12:32:13 +0000
//
__int64 __fastcall GJComment::create(__int64 a1)
{
void *v2; // rax
const char *CString; // r14
size_t v4; // rax
std::string::size_type v5; // r15
char *data; // r12
size_t v7; // r13
void *v8; // rax
int v9; // r14d
void *v10; // rax
int v11; // r15d
void *v12; // rax
const char *v13; // rax
int v14; // r12d
void *v15; // rax
void *v16; // rax
void *v17; // rax
const char *v18; // r14
size_t v19; // rax
size_t v20; // r15
char *v21; // r12
void *v22; // rax
int v23; // r14d
void *v24; // rax
void *v25; // rax
char v26; // r15
void *v27; // rax
int v28; // r12d
void *v29; // rdi
char v30; // r12
int v31; // r15d
__int64 v32; // r14
size_t v33; // r13
char v34; // r13
int v35; // r12d
void *v36; // rax
int v37; // r15d
void *v38; // rax
const char *v39; // rbx
size_t v40; // rax
size_t v41; // r15
char *v42; // r12
char *v43; // rbx
size_t v44; // r13
size_t v45; // rax
size_t v46; // r15
char *v47; // r12
size_t v48; // r13
__int64 v49; // rbx
__int64 v50; // rax
unsigned __int8 v51; // r15
__int64 v52; // rax
__int16 v53; // r12
__int64 v54; // rax
std::string __str; // [rsp+0h] [rbp-100h] BYREF
std::string v57; // [rsp+20h] [rbp-E0h] BYREF
std::string v58; // [rsp+38h] [rbp-C8h] BYREF
std::string __dst; // [rsp+50h] [rbp-B0h] BYREF
int v60; // [rsp+6Ch] [rbp-94h]
int v61; // [rsp+70h] [rbp-90h]
int v62; // [rsp+74h] [rbp-8Ch]
int v63; // [rsp+78h] [rbp-88h]
int v64; // [rsp+7Ch] [rbp-84h]
int v65; // [rsp+80h] [rbp-80h]
int v66; // [rsp+84h] [rbp-7Ch]
_QWORD v67[2]; // [rsp+88h] [rbp-78h] BYREF
void *v68; // [rsp+98h] [rbp-68h]
char v69; // [rsp+A7h] [rbp-59h]
__int128 v70; // [rsp+A8h] [rbp-58h] BYREF
void *v71; // [rsp+B8h] [rbp-48h]
_QWORD v72[2]; // [rsp+C0h] [rbp-40h] BYREF
char *__s; // [rsp+D0h] [rbp-30h]
LOWORD(v70) = 12802;
BYTE2(v70) = 0;
v2 = cocos2d::CCDictionary::valueForKey(a1, (__int64)&v70);
CString = (const char *)cocos2d::CCString::getCString(v2);
v4 = strlen(CString);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
data = (char *)operator new(v7);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v7 | 1;
__dst.__r_.__value_.__l.__size_ = v5;
goto LABEL_8;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v4);
data = __dst.__r_.__value_.__s.__data_;
if ( v4 )
LABEL_8:
memmove(data, CString, v5);
data[v5] = 0;
LevelTools::base64DecodeString(&v58, &__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( (v70 & 1) != 0 )
operator delete(v71);
LOWORD(v70) = 13058;
BYTE2(v70) = 0;
v8 = cocos2d::CCDictionary::valueForKey(a1, (__int64)&v70);
v9 = cocos2d::CCString::intValue(v8);
if ( (v70 & 1) != 0 )
operator delete(v71);
LOWORD(v70) = 13314;
BYTE2(v70) = 0;
v10 = cocos2d::CCDictionary::valueForKey(a1, (__int64)&v70);
v11 = cocos2d::CCString::intValue(v10);
if ( (v70 & 1) != 0 )
operator delete(v71);
LOWORD(v70) = 13826;
BYTE2(v70) = 0;
v12 = cocos2d::CCDictionary::valueForKey(a1, (__int64)&v70);
v13 = (const char *)cocos2d::CCString::getCString(v12);
v14 = atoi(v13);
if ( (v70 & 1) != 0 )
operator delete(v71);
LOWORD(v70) = 14082;
BYTE2(v70) = 0;
v15 = cocos2d::CCDictionary::valueForKey(a1, (__int64)&v70);
v69 = cocos2d::CCString::boolValue(v15);
if ( (v70 & 1) != 0 )
operator delete(v71);
LOWORD(v70) = 14338;
BYTE2(v70) = 0;
v16 = cocos2d::CCDictionary::valueForKey(a1, (__int64)&v70);
v60 = cocos2d::CCString::intValue(v16);
v63 = v14;
v62 = v11;
v61 = v9;
if ( (v70 & 1) != 0 )
operator delete(v71);
LOWORD(v72[0]) = 14594;
BYTE2(v72[0]) = 0;
v17 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v18 = (const char *)cocos2d::CCString::getCString(v17);
v19 = strlen(v18);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v20 = v19;
if ( v19 >= 0x17 )
{
v33 = 26;
if ( (v19 | 7) != 0x17 )
v33 = (v19 | 7) + 1;
v21 = (char *)operator new(v33);
v71 = v21;
*(_QWORD *)&v70 = v33 | 1;
*((_QWORD *)&v70 + 1) = v20;
}
else
{
LOBYTE(v70) = 2 * v19;
v21 = (char *)&v70 + 1;
if ( !v19 )
{
BYTE1(v70) = 0;
if ( (v72[0] & 1) == 0 )
goto LABEL_28;
goto LABEL_27;
}
}
memmove(v21, v18, v20);
v21[v20] = 0;
if ( (v72[0] & 1) != 0 )
LABEL_27:
operator delete(__s);
LABEL_28:
LOBYTE(v72[0]) = 4;
*(_WORD *)((char *)v72 + 1) = 12337;
BYTE3(v72[0]) = 0;
v22 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v23 = cocos2d::CCString::intValue(v22);
if ( (v72[0] & 1) != 0 )
operator delete(__s);
LOBYTE(v72[0]) = 4;
*(_WORD *)((char *)v72 + 1) = 12593;
BYTE3(v72[0]) = 0;
v24 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v66 = cocos2d::CCString::intValue(v24);
if ( (v72[0] & 1) != 0 )
operator delete(__s);
LOBYTE(v72[0]) = 4;
*(_WORD *)((char *)v72 + 1) = 13105;
BYTE3(v72[0]) = 0;
v25 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v26 = cocos2d::CCString::boolValue(v25);
if ( (v72[0] & 1) != 0 )
operator delete(__s);
LOWORD(v72[0]) = 12546;
BYTE2(v72[0]) = 0;
v27 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v28 = cocos2d::CCString::intValue(v27);
if ( (v72[0] & 1) != 0 )
operator delete(__s);
v64 = v28;
LOBYTE(v72[0]) = 4;
*(_WORD *)((char *)v72 + 1) = 13617;
BYTE3(v72[0]) = 0;
v29 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v65 = cocos2d::CCString::intValue(v29);
v30 = v26;
v31 = v23;
if ( (v72[0] & 1) != 0 )
operator delete(__s);
v32 = GJComment::create_1();
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&__str, v58.__r_.__value_.__l.__data_, v58.__r_.__value_.__l.__size_);
else
__str = v58;
std::string::operator=((std::string *)(v32 + 320), &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
*(_DWORD *)(v32 + 372) = v61;
*(_DWORD *)(v32 + 376) = v62;
*(_DWORD *)(v32 + 368) = v63;
*(_BYTE *)(v32 + 384) = v69;
*(_DWORD *)(v32 + 388) = v60;
v34 = v70 & 1;
if ( (v70 & 1) != 0 )
{
sub_10001AD30(&v57, v71, *((unsigned __int64 *)&v70 + 1));
}
else
{
v57.__r_.__value_.__r.__words[2] = (std::string::size_type)v71;
*(_OWORD *)&v57.__r_.__value_.__l.0 = v70;
}
std::string::operator=((std::string *)(v32 + 392), &v57);
if ( (*(_BYTE *)&v57.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v57.__r_.__value_.__l.__data_);
*(_DWORD *)(v32 + 420) = v31;
*(_DWORD *)(v32 + 424) = v66;
*(_BYTE *)(v32 + 428) = v30;
v35 = v64;
*(_DWORD *)(v32 + 380) = v64;
*(_DWORD *)(v32 + 444) = v65;
LOBYTE(v72[0]) = 4;
*(_WORD *)((char *)v72 + 1) = 13361;
BYTE3(v72[0]) = 0;
v36 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v72);
v37 = cocos2d::CCString::intValue(v36);
if ( (v72[0] & 1) != 0 )
{
operator delete(__s);
if ( v37 != 6 )
{
LABEL_55:
if ( !v35 )
goto LABEL_57;
goto LABEL_56;
}
}
else if ( v37 != 6 )
{
goto LABEL_55;
}
*(_DWORD *)(v32 + 436) = 3;
if ( v35 )
LABEL_56:
*(_BYTE *)(v32 + 432) = 1;
LABEL_57:
if ( v66 <= 0 )
goto LABEL_89;
LOBYTE(v67[0]) = 4;
*(_WORD *)((char *)v67 + 1) = 12849;
BYTE3(v67[0]) = 0;
v38 = cocos2d::CCDictionary::valueForKey(a1, (__int64)v67);
v39 = (const char *)cocos2d::CCString::getCString(v38);
v40 = strlen(v39);
if ( v40 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v41 = v40;
if ( v40 >= 0x17 )
{
v44 = 26;
if ( (v40 | 7) != 0x17 )
v44 = (v40 | 7) + 1;
v42 = (char *)operator new(v44);
__s = v42;
v72[0] = v44 | 1;
v72[1] = v41;
}
else
{
LOBYTE(v72[0]) = 2 * v40;
v42 = (char *)v72 + 1;
if ( !v40 )
{
BYTE1(v72[0]) = 0;
if ( (v67[0] & 1) == 0 )
goto LABEL_63;
goto LABEL_62;
}
}
memmove(v42, v39, v41);
v42[v41] = 0;
if ( (v67[0] & 1) != 0 )
LABEL_62:
operator delete(v68);
LABEL_63:
if ( (v72[0] & 1) != 0 )
v43 = __s;
else
v43 = (char *)v72 + 1;
v45 = strlen(v43);
if ( v45 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v46 = v45;
if ( v45 >= 0x17 )
{
v48 = 26;
if ( (v45 | 7) != 0x17 )
v48 = (v45 | 7) + 1;
v47 = (char *)operator new(v48);
v68 = v47;
v67[0] = v48 | 1;
v67[1] = v46;
}
else
{
LOBYTE(v67[0]) = 2 * v45;
v47 = (char *)v67 + 1;
if ( !v45 )
goto LABEL_82;
}
memmove(v47, v43, v46);
LABEL_82:
v47[v46] = 0;
v49 = sub_10053FBE0((unsigned __int8 *)v67, ",");
if ( (v67[0] & 1) != 0 )
operator delete(v68);
if ( (unsigned int)sub_1007FEF90(v49) >= 3 )
{
v50 = cocos2d::CCArray::stringAtIndex(v49, 0);
v51 = cocos2d::CCString::intValue(v50);
v52 = cocos2d::CCArray::stringAtIndex(v49, 1);
v53 = cocos2d::CCString::intValue(v52);
v54 = cocos2d::CCArray::stringAtIndex(v49, 2);
*(_BYTE *)(v32 + 431) = cocos2d::CCString::intValue(v54);
*(_WORD *)(v32 + 429) = (v53 << 8) | v51;
}
if ( (v72[0] & 1) != 0 )
operator delete(__s);
v34 = v70 & 1;
LABEL_89:
if ( v34 )
operator delete(v71);
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v58.__r_.__value_.__l.__data_);
return v32;
}