//
// GameToolbox::pointsToString from 0x1004f5fb0 to 0x1004f6284 (724 bytes)
//
// 45 xrefs:
// > GJBaseGameLayer::updateSpecialLabels @ 0x100133eea
// > GJScoreCell::loadFromScore @ 0x10022ff96
// > GJScoreCell::loadFromScore @ 0x100230143
// > GJScoreCell::loadFromScore @ 0x10023032c
// > GJScoreCell::loadFromScore @ 0x1002304be
// > GJScoreCell::loadFromScore @ 0x100230689
// > GJScoreCell::loadFromScore @ 0x100230860
// > GJScoreCell::loadFromScore @ 0x100230a50
// > GJLevelScoreCell::loadFromScore @ 0x100231359
// > GJLocalLevelScoreCell::loadFromScore @ 0x10023189e
// > LevelInfoLayer::setupPlatformerStats @ 0x1002adeaa
// > LevelInfoLayer::updateLabelValues @ 0x1002af99d
// > LevelInfoLayer::updateLabelValues @ 0x1002afaba
// > GJPathPage::init @ 0x1002eb45c
// > GJShopLayer::init @ 0x10030f754
// > PurchaseItemPopup::init @ 0x10031353b
// > PauseLayer::setupPlatformerLabels @ 0x1003c2e89
// > EndLevelLayer::customSetup @ 0x1004b967e
// > ProfilePage::loadPageFromUserInfo @ 0x10089fbd5
// > ProfilePage::onStatInfo @ 0x1008a2f44
// > ProfilePage::onStatInfo @ 0x1008a2f66
// > ProfilePage::onInfo @ 0x1008a369b
// > ProfilePage::onInfo @ 0x1008a36c4
// > ProfilePage::onInfo @ 0x1008a36f6
// > ProfilePage::onInfo @ 0x1008a3728
// > ProfilePage::onInfo @ 0x1008a376e
// > ProfilePage::onInfo @ 0x1008a379d
// > ProfilePage::onInfo @ 0x1008a38aa
// > DemonInfoPopup::init @ 0x1008a7fb5
// > DemonInfoPopup::init @ 0x1008a804c
// > DemonInfoPopup::init @ 0x1008a82f2
// > DemonInfoPopup::init @ 0x1008a838a
// > DemonInfoPopup::init @ 0x1008a8527
// > DemonInfoPopup::init @ 0x1008a85f1
// > StarInfoPopup::init @ 0x1008a8c2a
// > StarInfoPopup::init @ 0x1008a8d8c
// > StarInfoPopup::init @ 0x1008a8ee8
// > StarInfoPopup::init @ 0x1008a8fe2
// > StarInfoPopup::init @ 0x1008a90ab
// > StarInfoPopup::init @ 0x1008a9174
// > sub_100926430 @ 0x100926921
// > sub_1009269F0 @ 0x100926bd5
// > sub_1009269F0 @ 0x100926f7a
// > SongUsagePopup::songUsageFinished @ 0x1009765ec
// > sub_100976F40 @ 0x10097712b
//
// 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:26 +0000
//
size_t *__fastcall GameToolbox::pointsToString(size_t *a1, int a2)
{
int v2; // r15d
size_t *v3; // r12
int v4; // esi
int v5; // ebx
unsigned int v6; // eax
int v7; // r14d
int v8; // r13d
char *v9; // rax
unsigned int v10; // edx
size_t v11; // r13
unsigned __int64 v12; // r14
char v13; // bl
char *v14; // r15
int v15; // r14d
const void *v16; // rsi
unsigned int v17; // r13d
unsigned int v18; // ecx
bool v19; // cf
int v20; // ebx
size_t v21; // r12
_BYTE *v22; // rax
int v24; // [rsp+8h] [rbp-98h]
__int64 v25; // [rsp+18h] [rbp-88h]
size_t v26; // [rsp+20h] [rbp-80h] BYREF
int v27; // [rsp+28h] [rbp-78h]
void *__p; // [rsp+30h] [rbp-70h]
int v29; // [rsp+3Ch] [rbp-64h]
unsigned int v30; // [rsp+40h] [rbp-60h]
unsigned int v31; // [rsp+44h] [rbp-5Ch]
size_t *v32; // [rsp+48h] [rbp-58h]
__int128 __dst; // [rsp+50h] [rbp-50h] BYREF
_BYTE *v34; // [rsp+60h] [rbp-40h]
int v35; // [rsp+74h] [rbp-2Ch]
v2 = a2;
v3 = a1;
if ( (unsigned int)(a2 + 999) <= 0x7CE )
{
GameToolbox::intToString(a1, a2);
return v3;
}
v4 = -a2;
if ( v2 > 0 )
v4 = v2;
GameToolbox::intToString(&v26, v4);
*(_OWORD *)a1 = 0;
a1[2] = 0;
if ( (v26 & 1) == 0 )
{
v5 = (unsigned __int8)v26 >> 1;
v6 = v5 - 1;
v32 = a1;
if ( v5 - 1 < 0 )
goto LABEL_33;
goto LABEL_9;
}
v5 = v27;
v6 = v27 - 1;
v32 = a1;
if ( v27 - 1 >= 0 )
{
LABEL_9:
v25 = v6;
v7 = -1;
v8 = 1;
v24 = v2;
while ( 1 )
{
v29 = v5;
v9 = (char *)&v26 + 1;
if ( (v26 & 1) != 0 )
v9 = (char *)__p;
v30 = v8;
v10 = *(unsigned __int8 *)v3;
v35 = v7;
if ( (v10 & 1) != 0 )
v11 = v3[1];
else
v11 = v10 >> 1;
v12 = v11 + 1;
if ( v11 + 1 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v13 = v9[v25];
if ( v12 >= 0x17 )
break;
__dst = 0;
v34 = nullptr;
LOBYTE(__dst) = 2 * v12;
BYTE1(__dst) = v13;
v14 = (char *)&__dst + 2;
v15 = v35;
if ( v11 )
{
v16 = (char *)a1 + 1;
if ( (v10 & 1) != 0 )
goto LABEL_21;
goto LABEL_22;
}
LABEL_23:
v14[v11] = 0;
if ( (*(_BYTE *)v3 & 1) != 0 )
operator delete((void *)v3[2]);
v17 = v30;
v18 = v15 + 3 * (v30 / 3);
v3[2] = (size_t)v34;
*(_OWORD *)v3 = __dst;
v19 = v25-- != 0;
v2 = v24;
v20 = v29;
if ( !v18 && v19 )
{
std::operator+(&__dst, ",", v3);
if ( (*(_BYTE *)v3 & 1) != 0 )
operator delete((void *)v3[2]);
v3[2] = (size_t)v34;
*(_OWORD *)v3 = __dst;
}
v7 = v15 - 1;
v8 = v17 + 1;
v5 = v20 - 1;
if ( !v5 )
goto LABEL_33;
}
v31 = v10;
v21 = (v12 | 7) + 1;
if ( (v12 | 7) == 0x17 )
v21 = 26;
v22 = operator new(v21);
*(_QWORD *)&__dst = v21 | 1;
v34 = v22;
*((_QWORD *)&__dst + 1) = v11 + 1;
*v22 = v13;
v14 = v22 + 1;
v3 = v32;
v15 = v35;
v16 = (char *)a1 + 1;
if ( (v31 & 1) != 0 )
LABEL_21:
v16 = (const void *)v3[2];
LABEL_22:
memmove(v14, v16, v11);
goto LABEL_23;
}
LABEL_33:
if ( v2 >= 0 )
{
if ( (v26 & 1) == 0 )
return v3;
LABEL_35:
operator delete(__p);
return v3;
}
std::operator+(&__dst, "-", v3);
if ( (*(_BYTE *)v3 & 1) != 0 )
operator delete((void *)v3[2]);
v3[2] = (size_t)v34;
*(_OWORD *)v3 = __dst;
if ( (v26 & 1) != 0 )
goto LABEL_35;
return v3;
}