//
// GameLevelManager::userNameForUserID from 0x100540260 to 0x1005403da (378 bytes)
//
// 5 xrefs:
// > CommentCell::loadFromComment @ 0x10022d535
// > LevelBrowserLayer::getSearchTitle @ 0x1004863dc
// > LevelBrowserLayer::getSearchTitle @ 0x10048646e
// > GameLevelManager::tryGetUsername @ 0x10054044d
// > GJGameLevel::create @ 0x100541964
//
// 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:31:57 +0000
//
_QWORD *__fastcall GameLevelManager::userNameForUserID(_QWORD *a1, __int64 a2, int a3)
{
__int64 v3; // r14
__int64 v4; // rax
const char *CString; // r12
size_t v6; // rax
size_t v7; // r15
char *v8; // r13
size_t v9; // r14
__int64 v10; // r14
const char *v11; // r15
size_t v12; // rax
size_t v13; // r14
char *v14; // r12
char *v15; // r12
size_t v16; // r13
char v18; // [rsp+0h] [rbp-50h]
__int64 v19; // [rsp+8h] [rbp-48h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
if ( a3 <= 0 )
goto LABEL_17;
v3 = *(_QWORD *)(a2 + 976);
v4 = sub_10088E820("%i", v18);
CString = (const char *)cocos2d::CCString::getCString(v4);
v6 = strlen(CString);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_24;
v7 = v6;
if ( v6 >= 0x17 )
{
v19 = v3;
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst[0] = v9 + 1;
v3 = v19;
__dst[1] = v7;
goto LABEL_9;
}
LOBYTE(__dst[0]) = 2 * v6;
v8 = (char *)__dst + 1;
if ( v6 )
LABEL_9:
memmove(v8, CString, v7);
v8[v7] = 0;
v10 = cocos2d::CCDictionary::objectForKey(v3, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( v10 )
{
v11 = (const char *)cocos2d::CCString::getCString(v10);
v12 = strlen(v11);
if ( v12 < 0xFFFFFFFFFFFFFFF8LL )
{
v13 = v12;
if ( v12 >= 0x17 )
{
v16 = 26;
if ( (v12 | 7) != 0x17 )
v16 = (v12 | 7) + 1;
v14 = (char *)operator new(v16);
a1[2] = v14;
*a1 = v16 + 1;
a1[1] = v13;
}
else
{
*(_BYTE *)a1 = 2 * v12;
v14 = (char *)a1 + 1;
if ( !v12 )
goto LABEL_22;
}
memmove(v14, v11, v13);
LABEL_22:
v15 = &v14[v13];
goto LABEL_23;
}
LABEL_24:
sub_100003630();
}
LABEL_17:
*(_WORD *)a1 = 11522;
v15 = (char *)a1 + 2;
LABEL_23:
*v15 = 0;
return a1;
}