//
// ProfilePage::setupPageInfo from 0x8ff3e0 to 0x8ff78c (940 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'ProfilePage::setupPageInfo @ 0x8ff790
// > ??> @ 0x66978
// > ??> @ 0x11a69e0
//
// 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 ProfilePage::setupPageInfo(ProfilePage *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
ProfilePage *v23; // x19
cocos2d::CCString *v24; // x0
cocos2d::CCString *v25; // x0
unsigned int *v26; // x19
int v27; // w1
unsigned int *v28; // x1
int v29; // w2
_QWORD v30[13]; // [xsp+0h] [xbp+0h] BYREF
ProfilePage *v31; // [xsp+68h] [xbp+68h]
char v32; // [xsp+88h] [xbp+88h] BYREF
__int64 v33; // [xsp+90h] [xbp+90h] BYREF
char *v34; // [xsp+98h] [xbp+98h] BYREF
__int64 v35; // [xsp+A0h] [xbp+A0h] BYREF
v31 = a1;
if ( !ProfilePage::isCorrect(a1, a3) )
return _stack_chk_guard;
v5 = (cocos2d::CCArray *)sub_D153B8((int)&v33, *a2);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v7 = sub_D168E0((unsigned int)v30 + 144, ":", 0, 1u);
v8 = v7;
v9 = 0;
v10 = *(_QWORD *)(v33 - 24);
v30[12] = &v32;
while ( 1 )
{
sub_D14F84(&v34, &v33, v9, v8);
if ( v10 != v9 || *((_QWORD *)v34 - 3) )
{
sub_D153B8((int)&v35, v34);
v12 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v35, v11);
cocos2d::CCArray::addObject(v6, v12);
v13 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v35 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v18 - 1;
}
if ( v18 <= 0 )
break;
}
}
if ( v7 == -1 )
goto LABEL_21;
LABEL_9:
v9 = v7 + 1;
v7 = sub_D168E0((int)&v33, ":", (int)v7 + 1, 1u);
v14 = v34 - 24;
if ( v34 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v34 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v14);
}
v8 = v7 - v9;
if ( *(_QWORD *)(v33 - 24) < v9 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v9,
*(_QWORD *)(v33 - 24));
}
operator delete(v13);
if ( v7 != -1 )
goto LABEL_9;
LABEL_21:
v19 = v34 - 24;
if ( v34 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v34 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v19);
}
v20 = (void *)(v33 - 24);
if ( (__int64 *)(v33 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v33 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v33 - 8);
*(_DWORD *)(v33 - 8) = v27 - 1;
}
if ( v27 <= 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 = v31;
v31->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);
ProfilePage::updatePageArrows(v23);
}
return _stack_chk_guard;
}