//
// TopArtistsLayer::setupPageInfo from 0x9665f0 to 0x966a10 (1056 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'TopArtistsLayer::setupPageInfo @ 0x966a14
// > ??> @ 0x40cf8
// > ??> @ 0x11bd910
//
// 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
//
__int64 __fastcall TopArtistsLayer::setupPageInfo(TopArtistsLayer *a1, char **a2, char *a3)
{
cocos2d::CCArray *v5; // x0
cocos2d::CCArray *v6; // x28
__int64 v7; // x20
__int64 v8; // x3
unsigned __int64 v9; // x19
__int64 v10; // x26
const std::string *v11; // x1
cocos2d::CCObject *v12; // x0
void *v13; // x0
char *v14; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
char *v19; // x0
void *v20; // x0
cocos2d::CCString *v21; // x0
int v22; // w0
TopArtistsLayer *v23; // x19
cocos2d::CCString *v24; // x0
cocos2d::CCString *v25; // x0
CCMenuItemSpriteExtra *m_nextButton; // x2
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x19
int v30; // w1
TopArtistsLayer *v31[13]; // [xsp+0h] [xbp+0h] BYREF
TopArtistsLayer *v32; // [xsp+68h] [xbp+68h]
char v33; // [xsp+88h] [xbp+88h] BYREF
__int64 v34; // [xsp+90h] [xbp+90h] BYREF
char *v35; // [xsp+98h] [xbp+98h] BYREF
__int64 v36; // [xsp+A0h] [xbp+A0h] BYREF
v32 = a1;
if ( !TopArtistsLayer::isCorrect(a1, a3) )
return _stack_chk_guard;
v5 = (cocos2d::CCArray *)sub_D153B8((int)&v34, *a2);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v7 = sub_D168E0((unsigned int)v31 + 144, ":", 0, 1u);
v8 = v7;
v9 = 0;
v10 = *(_QWORD *)(v34 - 24);
v31[12] = (TopArtistsLayer *)&v33;
while ( 1 )
{
sub_D14F84(&v35, &v34, v9, v8);
if ( v10 != v9 || *((_QWORD *)v35 - 3) )
{
sub_D153B8((int)&v36, v35);
v12 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v36, v11);
cocos2d::CCArray::addObject(v6, v12);
v13 = (void *)(v36 - 24);
if ( (__int64 *)(v36 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v36 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v36 - 8);
*(_DWORD *)(v36 - 8) = v18 - 1;
}
if ( v18 <= 0 )
break;
}
}
if ( v7 == -1 )
goto LABEL_21;
LABEL_9:
v9 = v7 + 1;
v7 = sub_D168E0((int)&v34, ":", (int)v7 + 1, 1u);
v14 = v35 - 24;
if ( v35 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v35 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v14);
}
v8 = v7 - v9;
if ( *(_QWORD *)(v34 - 24) < v9 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v9,
*(_QWORD *)(v34 - 24));
}
operator delete(v13);
if ( v7 != -1 )
goto LABEL_9;
LABEL_21:
v19 = v35 - 24;
if ( v35 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v35 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v19);
}
v20 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v34 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(v34 - 8);
*(_DWORD *)(v34 - 8) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v20);
}
if ( (unsigned int)cocos2d::CCArray::count(v6) > 2 )
{
v21 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v6, 0);
v22 = cocos2d::CCString::intValue(v21);
v23 = v32;
v32->m_itemCount = v22;
v24 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v6, 1u);
v23->m_pageStartIdx = cocos2d::CCString::intValue(v24);
v25 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v6, 2u);
v23->m_pageEndIdx = cocos2d::CCString::intValue(v25);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v32->m_prevButton->setVisible)(v32->m_prevButton);
m_nextButton = v32->m_nextButton;
if ( v32->m_pageStartIdx + v32->m_pageEndIdx < v32->m_itemCount )
m_nextButton->setVisible(v32->m_nextButton, 1);
else
m_nextButton->setVisible(v32->m_nextButton, 0);
TopArtistsLayer::updateLevelsLabel(v32);
}
return _stack_chk_guard;
}