//
// TopArtistsLayer::setupPageInfo from 0x1002fbdc0 to 0x1002fc2a3 (1251 bytes)
//
// 2 xrefs:
// > sub_1002FC3A0 @ 0x1002fc3ac
// > ??> @ 0x100b17f58
//
// 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:28:30 +0000
//
__int64 __fastcall TopArtistsLayer::setupPageInfo(_DWORD *a1, __int64 a2)
{
const char *v2; // r14
const char *v3; // rdi
size_t v4; // rax
size_t v5; // r15
char *v6; // rbx
size_t v7; // r12
char *v8; // rax
unsigned __int64 v9; // r15
__int64 v10; // r14
unsigned __int64 v11; // rsi
char *v12; // rdx
unsigned __int64 v13; // rcx
bool v14; // zf
unsigned __int64 v15; // r12
char *v16; // r13
size_t v17; // r12
char *v18; // rbx
char v19; // al
const char *v20; // r12
size_t v21; // r15
size_t v22; // rax
size_t v23; // r13
char *v24; // rbx
size_t v25; // r15
__int64 v26; // rax
__int64 v27; // rbx
char *v28; // rax
unsigned __int64 v29; // rsi
__int64 v30; // r8
char *v31; // rdx
unsigned __int64 v32; // rdi
__int64 result; // rax
__int64 v34; // rax
_DWORD *v35; // rbx
__int64 v36; // rax
__int64 v37; // rax
__int64 v38; // rax
__int64 CString; // rax
unsigned __int64 v41; // [rsp+8h] [rbp-88h]
__int64 v42; // [rsp+10h] [rbp-80h]
_QWORD v43[2]; // [rsp+18h] [rbp-78h] BYREF
void *__p; // [rsp+28h] [rbp-68h]
char __s[8]; // [rsp+30h] [rbp-60h] BYREF
size_t v46; // [rsp+38h] [rbp-58h]
void *v47; // [rsp+40h] [rbp-50h]
__int64 v48; // [rsp+48h] [rbp-48h]
size_t __dst; // [rsp+50h] [rbp-40h] BYREF
unsigned __int64 v50; // [rsp+58h] [rbp-38h]
void *v51; // [rsp+60h] [rbp-30h]
if ( (*(_BYTE *)a2 & 1) != 0 )
v2 = *(const char **)(a2 + 16);
else
v2 = (const char *)(a2 + 1);
v3 = v2;
v4 = strlen(v2);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
v6 = (char *)operator new(v7);
v51 = v6;
__dst = v7 + 1;
v50 = v5;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v4;
v6 = (char *)&__dst + 1;
if ( v4 )
{
LABEL_11:
v3 = v6;
memmove(v6, v2, v5);
}
v6[v5] = 0;
v42 = sub_1007FE900(v3);
if ( (__dst & 1) != 0 )
{
v8 = (char *)v51;
v9 = v50;
v10 = -1;
if ( !v50 )
goto LABEL_22;
LABEL_16:
v11 = v9;
v12 = v8;
while ( *v12 != 58 )
{
++v12;
if ( !--v11 )
{
v12 = &v8[v9];
break;
}
}
v10 = -1;
if ( v12 != &v8[v9] )
v10 = v12 - v8;
goto LABEL_22;
}
v9 = (unsigned __int8)__dst >> 1;
v8 = (char *)&__dst + 1;
v10 = -1;
if ( (unsigned __int8)__dst >> 1 )
goto LABEL_16;
LABEL_22:
v13 = 0;
v41 = v9;
do
{
if ( (__dst & 1) != 0 )
{
v15 = v50;
if ( v50 < v13 )
LABEL_74:
sub_100056810();
v16 = (char *)v51;
}
else
{
v15 = (unsigned __int8)__dst >> 1;
v16 = (char *)&__dst + 1;
if ( v13 > v15 )
goto LABEL_74;
}
v17 = v15 - v13;
if ( v17 >= v10 - v13 )
v17 = v10 - v13;
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v48 = v13;
if ( v17 >= 0x17 )
{
v21 = (v17 | 7) + 1;
if ( (v17 | 7) == 0x17 )
v21 = 26;
v18 = (char *)operator new(v21);
v47 = v18;
*(_QWORD *)__s = v21 | 1;
v46 = v17;
v9 = v41;
}
else
{
__s[0] = 2 * v17;
v18 = &__s[1];
if ( !v17 )
{
__s[1] = 0;
v19 = __s[0];
if ( (__s[0] & 1) == 0 )
goto LABEL_35;
goto LABEL_42;
}
}
memmove(v18, &v16[v48], v17);
v18[v17] = 0;
v19 = __s[0];
if ( (__s[0] & 1) == 0 )
{
LABEL_35:
if ( !v19 && v48 == v9 )
goto LABEL_55;
v20 = &__s[1];
goto LABEL_45;
}
LABEL_42:
if ( !v46 && v48 == v9 )
goto LABEL_55;
v20 = (const char *)v47;
LABEL_45:
v22 = strlen(v20);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v23 = v22;
if ( v22 >= 0x17 )
{
v25 = (v22 | 7) + 1;
if ( (v22 | 7) == 0x17 )
v25 = 26;
v24 = (char *)operator new(v25);
__p = v24;
v43[0] = v25 | 1;
v43[1] = v23;
v9 = v41;
LABEL_52:
memmove(v24, v20, v23);
goto LABEL_53;
}
LOBYTE(v43[0]) = 2 * v22;
v24 = (char *)v43 + 1;
if ( v22 )
goto LABEL_52;
LABEL_53:
v24[v23] = 0;
v26 = sub_10088E600(v43);
sub_1007FEBF0(v42, v26);
if ( (v43[0] & 1) != 0 )
operator delete(__p);
LABEL_55:
v27 = -1;
if ( v10 == -1 )
goto LABEL_56;
if ( (__dst & 1) != 0 )
{
v28 = (char *)v51;
v29 = v50;
v30 = v10 + 1;
v48 = v10 + 1;
if ( v50 <= v10 + 1 )
goto LABEL_56;
}
else
{
v29 = (unsigned __int8)__dst >> 1;
v28 = (char *)&__dst + 1;
v30 = v10 + 1;
v48 = v10 + 1;
if ( v29 <= v10 + 1 )
goto LABEL_56;
}
v31 = &v28[v30];
v32 = v29 + ~v10;
while ( *v31 != 58 )
{
++v31;
if ( !--v32 )
{
v31 = &v28[v29];
break;
}
}
v27 = v31 - v28;
if ( v31 == &v28[v29] )
v27 = -1;
LABEL_56:
if ( (__s[0] & 1) != 0 )
operator delete(v47);
v14 = v10 == -1;
v10 = v27;
v13 = v48;
}
while ( !v14 );
if ( (__dst & 1) != 0 )
operator delete(v51);
result = sub_1007FEF90(v42);
if ( (unsigned int)result >= 3 )
{
v34 = sub_1007FEFE0(v42, 0);
v35 = a1;
a1[182] = cocos2d::CCString::intValue(v34);
v36 = sub_1007FEFE0(v42, 1);
a1[183] = cocos2d::CCString::intValue(v36);
v37 = sub_1007FEFE0(v42, 2);
a1[184] = cocos2d::CCString::intValue(v37);
(*(void (__fastcall **)(_QWORD, bool))(**((_QWORD **)v35 + 88) + 344LL))(*((_QWORD *)v35 + 88), v35[183] != 0);
(*(void (__fastcall **)(_QWORD, bool))(**((_QWORD **)v35 + 87) + 344LL))(
*((_QWORD *)v35 + 87),
v35[183] + v35[184] < v35[182]);
v38 = sub_10088E820("%i to %i of %i", (char)a1);
CString = cocos2d::CCString::getCString(v38);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)v35 + 90) + 928LL))(*((_QWORD *)v35 + 90), CString);
return cocos2d::CCLabelBMFont::limitLabelWidth(*((_QWORD *)v35 + 90), 100.0, 0.5, 0.0);
}
return result;
}