//
// GameLevelManager::storeUserName from 0x140145d10 to 0x140145ee4 (468 bytes)
//
// 9 xrefs:
// > GameLevelManager::storeUserNames @ 0x140145c78
// > GameLevelManager::createAndGetScores @ 0x1401473b2
// > GameLevelManager::dataLoaded @ 0x14014c568
// > GameLevelManager::onGetUserMessagesCompleted @ 0x14015a8ec
// > GameLevelManager::createAndGetCommentsFull @ 0x14015d379
// > GameLevelManager::onGetFriendRequestsCompleted @ 0x14016043e
// > GameLevelManager::onGetUserListCompleted @ 0x140162f2c
// > ProfilePage::init @ 0x1403becbf
// > ??> @ 0x1406ca590
//
// 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
//
// Hidden C++ exception states: #wind=3
void __fastcall GameLevelManager::storeUserName(__int64 a1, int a2, int a3, _QWORD *a4)
{
__int64 v5; // rsi
__int64 v6; // rbp
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // rbx
size_t v11; // r8
_BYTE *v12; // rdx
__int64 v13; // rax
void *v14; // rcx
void *v15; // rcx
struct cocos2d::CCString *v16; // rax
struct cocos2d::CCString *v17; // rax
void *Block[2]; // [rsp+28h] [rbp-70h] BYREF
__m128i si128; // [rsp+38h] [rbp-60h]
void *v20[2]; // [rsp+48h] [rbp-50h] BYREF
__int128 v21; // [rsp+58h] [rbp-40h]
v5 = a3;
v6 = a2;
if ( a2 > 0 )
{
v8 = cocos2d::CCString::createWithFormat("%i", (unsigned int)a2);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)v20 = 0;
v21 = 0;
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003A930(v20, CString, v11);
v12 = a4;
if ( a4[3] > 0xFu )
v12 = (_BYTE *)*a4;
*(_OWORD *)Block = 0;
si128 = 0;
do
++v10;
while ( v12[v10] );
sub_14003A930(Block, v12, v10);
v13 = cocos2d::CCString::create(Block);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 520), v13, v20);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v14 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( *((_QWORD *)&v21 + 1) > 0xFu )
{
v15 = v20[0];
if ( (unsigned __int64)(*((_QWORD *)&v21 + 1) + 1LL) >= 0x1000 )
{
v15 = *((void **)v20[0] - 1);
if ( (unsigned __int64)((char *)v20[0] - (char *)v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v15);
}
if ( (int)v5 > 0 )
{
v16 = cocos2d::CCString::createWithFormat("%i", v5);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 536), v16, v6);
v17 = cocos2d::CCString::createWithFormat("%i", v6);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 528), v17, v5);
}
}
sub_14003A830((__int64)a4);
}