//
// GJFriendRequest::create from 0x10054d020 to 0x10054d448 (1064 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetGJUserInfoCompleted @ 0x100522f5f
// > GameLevelManager::onGetFriendRequestsCompleted @ 0x1005249c5
//
// 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
//
GJFriendRequest *__fastcall GJFriendRequest::create(cocos2d::CCDictionary *a1)
{
double v1; // xmm0_8
cocos2d::CCString *v2; // rax
cocos2d::CCString *v3; // rax
cocos2d::CCString *v4; // rax
cocos2d::CCString *v5; // rax
const char *CString; // r13
size_t v7; // rax
std::string::size_type v8; // rbx
char *data; // r14
size_t v10; // r15
cocos2d::CCString *v11; // rax
const char *v12; // r13
size_t v13; // rax
size_t v14; // rbx
char *v15; // r14
cocos2d::CCString *v16; // rax
const char *v17; // r13
char *v18; // r12
double v19; // xmm0_8
size_t v20; // r15
std::string __str; // [rsp+0h] [rbp-D0h] BYREF
std::string v23; // [rsp+20h] [rbp-B0h] BYREF
std::string __dst; // [rsp+38h] [rbp-98h] BYREF
int v25; // [rsp+54h] [rbp-7Ch]
int v26; // [rsp+58h] [rbp-78h]
int v27; // [rsp+5Ch] [rbp-74h]
char v28; // [rsp+60h] [rbp-70h] BYREF
char v29[15]; // [rsp+61h] [rbp-6Fh] BYREF
void *v30; // [rsp+70h] [rbp-60h]
__int128 v31; // [rsp+78h] [rbp-58h] BYREF
void *v32; // [rsp+88h] [rbp-48h]
std::string v33[2]; // [rsp+90h] [rbp-40h] BYREF
v33[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)4;
*(_WORD *)((char *)&v33[0].__r_.__value_.__l.0 + 1) = 12851;
v33[0].__r_.__value_.__s.__data_[2] = 0;
v2 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v33);
v25 = cocos2d::CCString::intValue(v2);
if ( (*(_BYTE *)&v33[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33[0].__r_.__value_.__l.__data_);
v33[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)4;
*(_WORD *)((char *)&v33[0].__r_.__value_.__l.0 + 1) = 13107;
v33[0].__r_.__value_.__s.__data_[2] = 0;
v3 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v33);
v26 = cocos2d::CCString::intValue(v3);
if ( (*(_BYTE *)&v33[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33[0].__r_.__value_.__l.__data_);
v33[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)4;
*(_WORD *)((char *)&v33[0].__r_.__value_.__l.0 + 1) = 13363;
v33[0].__r_.__value_.__s.__data_[2] = 0;
v4 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v33);
v27 = cocos2d::CCString::intValue(v4);
if ( (*(_BYTE *)&v33[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33[0].__r_.__value_.__l.__data_);
LOBYTE(v31) = 4;
*(_WORD *)((char *)&v31 + 1) = 13619;
BYTE3(v31) = 0;
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v31);
CString = cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
data = (char *)operator new(v10);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v10 | 1;
__dst.__r_.__value_.__l.__size_ = v8;
goto LABEL_14;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = __dst.__r_.__value_.__s.__data_;
if ( v7 )
LABEL_14:
memmove(data, CString, v8);
data[v8] = 0;
LevelTools::base64DecodeString(v33, &__dst, v1);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( (v31 & 1) != 0 )
operator delete(v32);
v28 = 4;
strcpy(v29, "37");
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v28);
v12 = cocos2d::CCString::getCString(v11);
v13 = strlen(v12);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v14 = v13;
if ( v13 >= 0x17 )
{
v20 = 26;
if ( (v13 | 7) != 0x17 )
v20 = (v13 | 7) + 1;
v15 = (char *)operator new(v20);
v32 = v15;
*(_QWORD *)&v31 = v20 | 1;
*((_QWORD *)&v31 + 1) = v14;
}
else
{
LOBYTE(v31) = 2 * v13;
v15 = (char *)&v31 + 1;
if ( !v13 )
{
BYTE1(v31) = 0;
if ( (v28 & 1) == 0 )
goto LABEL_24;
goto LABEL_23;
}
}
memmove(v15, v12, v14);
v15[v14] = 0;
if ( (v28 & 1) != 0 )
LABEL_23:
operator delete(v30);
LABEL_24:
v28 = 4;
strcpy(v29, "36");
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v28);
v17 = cocos2d::CCString::getCString(v16);
if ( (v28 & 1) != 0 )
operator delete(v30);
v18 = (char *)operator new(0x180u);
cocos2d::CCNode::CCNode((__int64)v18);
*(_QWORD *)v18 = off_100961690;
v19 = 0.0;
*(_OWORD *)(v18 + 316) = 0;
*(_OWORD *)(v18 + 332) = 0;
*(_OWORD *)(v18 + 348) = 0;
*(_OWORD *)(v18 + 361) = 0;
if ( cocos2d::CCNode::init((cocos2d::CCNode *)v18) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v18);
}
else
{
(*(void (__fastcall **)(char *))(*(_QWORD *)v18 + 16LL))(v18);
v18 = nullptr;
}
*((_DWORD *)v18 + 79) = v25;
*((_DWORD *)v18 + 80) = v26;
*((_DWORD *)v18 + 81) = v27;
if ( (*(_BYTE *)&v33[0].__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&__str, v33[0].__r_.__value_.__l.__data_, v33[0].__r_.__value_.__l.__size_, 0.0);
}
else
{
__str = v33[0];
v19 = *(double *)v33[0].__r_.__value_.__r.__words;
}
std::string::operator=((std::string *)(v18 + 328), &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (v31 & 1) != 0 )
{
sub_100006B70(&v23, v32, *((unsigned __int64 *)&v31 + 1), v19);
}
else
{
v23.__r_.__value_.__r.__words[2] = (std::string::size_type)v32;
*(_OWORD *)&v23.__r_.__value_.__l.0 = v31;
}
std::string::operator=((std::string *)(v18 + 352), &v23);
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) == 0 )
{
v18[376] = v17 != nullptr;
if ( (v31 & 1) == 0 )
goto LABEL_44;
LABEL_48:
operator delete(v32);
if ( (*(_BYTE *)&v33[0].__r_.__value_.__s.0 & 1) == 0 )
return (GJFriendRequest *)v18;
goto LABEL_45;
}
operator delete(v23.__r_.__value_.__l.__data_);
v18[376] = v17 != nullptr;
if ( (v31 & 1) != 0 )
goto LABEL_48;
LABEL_44:
if ( (*(_BYTE *)&v33[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_45:
operator delete(v33[0].__r_.__value_.__l.__data_);
return (GJFriendRequest *)v18;
}