//
// GameLevelManager::onGetTopArtistsCompleted from 0x1401592d0 to 0x140159741 (1137 bytes)
//
// 3 xrefs:
// > GameLevelManager::handleIt @ 0x140143c70
// > ??> @ 0x1406ca9a4
// > ??> @ 0x1406ca9b0
//
// 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=7
void __fastcall GameLevelManager::onGetTopArtistsCompleted(GameLevelManager *a1, const void **a2, const char *a3)
{
const char *v6; // r12
const void *v7; // rcx
unsigned __int64 v8; // rdi
unsigned __int64 v9; // rbx
size_t v10; // r8
_BYTE *v11; // rdx
size_t v12; // r8
cocos2d::CCArray *v13; // rbx
void *v14; // rcx
OnlineListDelegate *m_onlineListDelegate; // rcx
cocos2d::CCString *v16; // rax
const char *CString; // rax
size_t v18; // r8
cocos2d::CCString *v19; // rax
const char *v20; // rax
unsigned int v21; // ebx
size_t v22; // r8
__int64 v23; // rdx
__int64 v24; // rcx
__int64 v25; // r8
__int64 v26; // r9
void **v27; // rsi
__int64 v28; // rbx
unsigned __int64 v29; // rdi
cocos2d::CCArray *v30; // rsi
__int128 *v31; // rdx
size_t v32; // r8
cocos2d::CCArray *v33; // rdi
cocos2d::CCString *v34; // rax
const char *v35; // rax
size_t v36; // r8
__int64 v37; // rax
cocos2d::CCDictionary *v38; // rax
SongInfoObject *v39; // rax
void *v40; // rcx
_QWORD *v41; // rax
OnlineListDelegate *v42; // rcx
_BYTE v43[32]; // [rsp+28h] [rbp-91h] BYREF
const void **v44; // [rsp+48h] [rbp-71h]
const char *v45; // [rsp+50h] [rbp-69h]
__int128 Buf2; // [rsp+58h] [rbp-61h] BYREF
__m128i si128; // [rsp+68h] [rbp-51h]
void *Src[2]; // [rsp+78h] [rbp-41h] BYREF
unsigned __int64 v49; // [rsp+88h] [rbp-31h]
unsigned __int64 v50; // [rsp+90h] [rbp-29h]
__int128 v51; // [rsp+98h] [rbp-21h] BYREF
__int128 v52; // [rsp+A8h] [rbp-11h]
_OWORD v53[2]; // [rsp+B8h] [rbp-1h] BYREF
v44 = a2;
v45 = a3;
v6 = a3;
if ( *((_QWORD *)a3 + 3) > 0xFu )
v6 = *(const char **)a3;
GameLevelManager::removeDLFromActive(a1, v6);
Buf2 = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 15;
strcpy((char *)&Buf2, "-1");
v7 = a2;
v8 = (unsigned __int64)a2[3];
if ( v8 > 0xF )
v7 = *a2;
v9 = (unsigned __int64)a2[2];
v10 = v9;
if ( v9 > 2 )
v10 = 2;
if ( !memcmp(v7, &Buf2, v10) && v9 == 2 )
goto LABEL_19;
v11 = a2;
if ( v8 > 0xF )
v11 = *a2;
Buf2 = 0;
si128 = 0;
v12 = -1;
do
++v12;
while ( v11[v12] );
sub_14003A930(&Buf2, v11, v12);
v13 = sub_140140F70((__int64 *)&Buf2, "#");
if ( si128.m128i_i64[1] > 0xFuLL )
{
v14 = (void *)Buf2;
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Buf2) = 0;
if ( cocos2d::CCArray::count(v13) < 2 )
{
LABEL_19:
m_onlineListDelegate = a1->m_onlineListDelegate;
if ( m_onlineListDelegate )
m_onlineListDelegate->loadListFailed(m_onlineListDelegate, v6);
}
else
{
v16 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v13, 0);
CString = cocos2d::CCString::getCString(v16);
v51 = 0;
v52 = 0;
v18 = -1;
do
++v18;
while ( CString[v18] );
sub_14003A930(&v51, CString, v18);
v19 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v13, 1u);
v20 = cocos2d::CCString::getCString(v19);
*(_OWORD *)Src = 0;
v21 = 0;
v49 = 0;
v50 = 0;
v22 = -1;
do
++v22;
while ( v20[v22] );
sub_14003A930(Src, v20, v22);
if ( a1->m_onlineListDelegate )
{
Buf2 = 0;
si128 = 0u;
v27 = Src;
if ( v50 > 0xF )
v27 = (void **)Src[0];
v28 = 0x7FFFFFFFFFFFFFFFLL;
v29 = v49;
if ( v49 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v24, v23, v25, v26);
si128.m128i_i64[1] = 15;
if ( v49 > 0xF )
{
if ( (v49 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v28 = v49 | 0xF;
if ( (v49 | 0xF) < 0x16 )
v28 = 22;
}
*(_QWORD *)&Buf2 = sub_14003AA10(v28 + 1);
si128.m128i_i64[0] = v29;
si128.m128i_i64[1] = v28;
memcpy((void *)Buf2, v27, v29 + 1);
}
else
{
si128.m128i_i64[0] = v49;
Buf2 = *(_OWORD *)v27;
}
a1->m_onlineListDelegate->setupPageInfo(a1->m_onlineListDelegate, (std::string *)&Buf2, v6);
v21 = 0;
}
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
v31 = &v51;
if ( *((_QWORD *)&v52 + 1) > 0xFu )
v31 = (__int128 *)v51;
memset(v53, 0, sizeof(v53));
v32 = -1;
do
++v32;
while ( *((_BYTE *)v31 + v32) );
sub_14003A930(v53, v31, v32);
v33 = sub_140140F70((__int64 *)v53, "|");
sub_14003A830((__int64)v53);
if ( cocos2d::CCArray::count(v33) )
{
do
{
v34 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v33, v21);
v35 = cocos2d::CCString::getCString(v34);
Buf2 = 0;
si128 = 0u;
v36 = -1;
do
++v36;
while ( v35[v36] );
sub_14003A930(&Buf2, v35, v36);
v37 = sub_14003BDB0((__int64)v43, (__int64)&Buf2);
v38 = (cocos2d::CCDictionary *)GameLevelManager::responseToDict(v37, 0);
v39 = SongInfoObject::create_2(v38);
cocos2d::CCArray::addObject(v30, v39);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v40 = (void *)Buf2;
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v40 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v40 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v40);
}
++v21;
}
while ( v21 < cocos2d::CCArray::count(v33) );
}
v41 = (_QWORD *)sub_14003BDB0((__int64)v43, (__int64)Src);
GameLevelManager::storeSearchResult(a1, (__int64)v30, v41, v6);
v42 = a1->m_onlineListDelegate;
if ( v42 )
v42->loadListFinished(v42, v30, v6);
sub_14003A830((__int64)Src);
sub_14003A830((__int64)&v51);
}
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}