//
// GameLevelManager::storeUserName from 0x14021d580 to 0x14021d7e0 (608 bytes)
//
// 15 xrefs:
// > GameLevelManager::storeUserNames @ 0x14021d4c4
// > GameLevelManager::createAndGetScores @ 0x14021ee8e
// > GameLevelManager::dataLoaded @ 0x140226498
// > GameLevelManager::onGetGJUserInfoCompleted @ 0x14023a984
// > GameLevelManager::onGetUserMessagesCompleted @ 0x14023b1fa
// > GameLevelManager::createAndGetCommentsFull @ 0x14023da06
// > GameLevelManager::onAdminGetReportQueueCompleted @ 0x140245450
// > GameLevelManager::onAdminGetAccountReviewCompleted @ 0x140247af4
// > GameLevelManager::storeThreadManifest @ 0x14024d948
// > GameLevelManager::storeThreadManifest @ 0x14024dc51
// > GameLevelManager::onGetUserSearchCompleted @ 0x1402537e0
// > GameLevelManager::onGetFriendRequestsCompleted @ 0x140254976
// > GameLevelManager::onGetUserListCompleted @ 0x1402579f7
// > ProfilePage::init @ 0x140550e78
// > ??> @ 0x14091baa0
//
// 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 11:28:23 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall GameLevelManager::storeUserName(_QWORD *a1, int a2, int a3, void **a4)
{
__int64 v5; // rbp
void **v7; // rcx
void *v8; // rdx
cocos2d::CCString *v9; // rax
const char *CString; // rax
size_t v11; // rbx
size_t v12; // r8
_BYTE *v13; // rdx
__int64 v14; // rbx
__int64 v15; // rax
void *v16; // rcx
void *v17; // rcx
cocos2d::CCDictionary *v18; // rdi
struct cocos2d::CCObject *v19; // rax
__int64 v20; // rbx
cocos2d::CCDictionary *v21; // rdi
struct cocos2d::CCObject *v22; // rax
int v23; // [rsp+30h] [rbp-88h] BYREF
void **v24; // [rsp+38h] [rbp-80h]
void *Block[2]; // [rsp+40h] [rbp-78h] BYREF
__m128i si128; // [rsp+50h] [rbp-68h]
void *v27[2]; // [rsp+60h] [rbp-58h] BYREF
__int128 v28; // [rsp+70h] [rbp-48h]
v5 = a2;
v23 = a3;
v24 = a4;
if ( a3 > 0 && (unsigned __int64)a4[2] >= 2 )
{
v7 = (void **)(*(_QWORD *)sub_140067D30((__int64)(a1 + 136), (__int64)Block, (unsigned __int8 *)&v23) + 24LL);
if ( v7 != a4 )
{
v8 = a4;
if ( (unsigned __int64)a4[3] > 0xF )
v8 = *a4;
sub_1400405A0(v7, v8, (size_t)a4[2]);
}
}
if ( (int)v5 > 0 )
{
v9 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v5);
CString = cocos2d::CCString::getCString(v9);
*(_OWORD *)v27 = 0;
v28 = 0;
v11 = -1;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003D230(v27, CString, v12);
v13 = a4;
if ( (unsigned __int64)a4[3] > 0xF )
v13 = *a4;
*(_OWORD *)Block = 0;
si128 = 0;
do
++v11;
while ( v13[v11] );
sub_14003D230(Block, v13, v11);
v14 = a1[133];
v15 = cocos2d::CCString::create(Block);
cocos2d::CCDictionary::setObject(v14, v15, v27);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v16 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
if ( *((_QWORD *)&v28 + 1) > 0xFu )
{
v17 = v27[0];
if ( (unsigned __int64)(*((_QWORD *)&v28 + 1) + 1LL) >= 0x1000 )
{
v17 = *((void **)v27[0] - 1);
if ( (unsigned __int64)((char *)v27[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
if ( v23 > 0 )
{
v18 = (cocos2d::CCDictionary *)a1[135];
v19 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8);
cocos2d::CCDictionary::setObject(v18, v19, v5);
v20 = v23;
v21 = (cocos2d::CCDictionary *)a1[134];
v22 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v5);
cocos2d::CCDictionary::setObject(v21, v22, v20);
}
}
sub_14003D310((__int64)a4);
}