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