//
// GameToolbox::pointsToString from 0x5878c8 to 0x587cc0 (1016 bytes)
//
// 38 xrefs:
// > GJScoreCell::loadFromScore @ 0x619000
// > GJScoreCell::loadFromScore @ 0x61917c
// > GJScoreCell::loadFromScore @ 0x619330
// > GJScoreCell::loadFromScore @ 0x61948c
// > GJScoreCell::loadFromScore @ 0x619640
// > GJScoreCell::loadFromScore @ 0x6197f0
// > GJScoreCell::loadFromScore @ 0x619ad0
// > GJLocalLevelScoreCell::loadFromScore @ 0x61a674
// > GJLevelScoreCell::loadFromScore @ 0x61b258
// > PauseLayer::setupProgressBars @ 0x6c7738
// > LevelInfoLayer::setupPlatformerStats @ 0x6d7b68
// > LevelInfoLayer::updateLabelValues @ 0x6d9a38
// > LevelInfoLayer::updateLabelValues @ 0x6d9ad8
// > EndLevelLayer::customSetup @ 0x7d6bf0
// > GJBaseGameLayer::updateSpecialLabels @ 0x87a900
// > ProfilePage::onInfo @ 0x8f9098
// > ProfilePage::onInfo @ 0x8f90ac
// > ProfilePage::onInfo @ 0x8f90c0
// > ProfilePage::onInfo @ 0x8f90d4
// > ProfilePage::onInfo @ 0x8f90e8
// > ProfilePage::onInfo @ 0x8f9100
// > ProfilePage::onInfo @ 0x8f91d4
// > ProfilePage::loadPageFromUserInfo @ 0x8fa300
// > DemonInfoPopup::init @ 0x8ff934
// > DemonInfoPopup::init @ 0x8ff9cc
// > DemonInfoPopup::init @ 0x8ffb88
// > DemonInfoPopup::init @ 0x8ffc1c
// > DemonInfoPopup::init @ 0x8ffd94
// > DemonInfoPopup::init @ 0x8ffe54
// > StarInfoPopup::init @ 0x900614
// > StarInfoPopup::init @ 0x900774
// > StarInfoPopup::init @ 0x9008d4
// > StarInfoPopup::init @ 0x900990
// > StarInfoPopup::init @ 0x900a4c
// > GJShopLayer::init @ 0x92eb3c
// > PurchaseItemPopup::init @ 0x92ff50
// > GJPathPage::init @ 0xa70398
// > ??> @ 0x3b2c8
//
// 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 *__usercall GameToolbox::pointsToString@(GameToolbox *this@, __int64 *a2@)
{
int v2; // w19
__int64 v3; // x25
__int64 v4; // x27
int v5; // w28
__int64 v6; // x22
void *v7; // x0
unsigned int v8; // w25
__int64 v9; // x1
char *v10; // x0
unsigned int *v11; // x1
int v12; // w2
unsigned int *v13; // x1
int v14; // w2
__int64 v15; // x19
void *v16; // x0
void *v18; // x0
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x19
int v22; // w1
unsigned int v23; // [xsp+64h] [xbp+64h]
__int64 v25; // [xsp+90h] [xbp+90h] BYREF
char *v26; // [xsp+98h] [xbp+98h] BYREF
char *v27; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v28; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v29; // [xsp+B0h] [xbp+B0h] BYREF
if ( (unsigned int)((_DWORD)this + 999) <= 0x7CE )
{
GameToolbox::intToString(a2, this);
}
else
{
v23 = (unsigned int)this >> 31;
v2 = 0;
GameToolbox::intToString(
&v25,
(GameToolbox *)(((unsigned int)this ^ ((int)this >> 31)) + ((unsigned int)this >> 31)));
v3 = v25;
v4 = *(_QWORD *)(v25 - 24);
v26 = &byte_124B6C8;
v5 = v4 - 1;
v6 = (int)v4 - 1;
if ( (((_DWORD)v4 - 1) & 0x80000000) == 0 )
{
while ( 1 )
{
++v2;
if ( (*(_DWORD *)(v3 - 8) & 0x80000000) == 0 )
{
sub_D176A8(&v25);
v3 = v25;
}
v8 = *(unsigned __int8 *)(v3 + v6);
v9 = *((_QWORD *)v26 - 3);
v27 = &byte_124B6C8;
sub_D15888(&v27, v9 + 1);
sub_D1603C(&v27, 1, v8);
sub_D15E14(&v27, &v26);
sub_D163D4(&v26, &v27);
v10 = v27 - 24;
if ( v27 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v27 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v27 - 2);
*((_DWORD *)v27 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
if ( (_DWORD)v4 == v2 )
goto LABEL_7;
if ( v2 != 3 * (v2 / 3) )
goto LABEL_7;
sub_583094(&byte_F804F8, &v26, &v28);
sub_D163D4(&v26, &v28);
v7 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) == &qword_124B6B0 )
goto LABEL_7;
if ( &pthread_create )
{
v13 = (unsigned int *)(v28 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v14 - 1;
}
if ( v14 > 0 )
{
LABEL_7:
--v6;
if ( v5 - v2 < 0 )
break;
}
else
{
--v6;
operator delete(v7);
if ( v5 - v2 < 0 )
break;
}
v3 = v25;
}
}
if ( v23 )
{
sub_583094(&byte_F10E40, &v26, &v29);
sub_D163D4(&v26, &v29);
v18 = (void *)(v29 - 24);
if ( (__int64 *)(v29 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v29 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v29 - 8);
*(_DWORD *)(v29 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v18);
}
}
v15 = v25;
*a2 = (__int64)v26;
v16 = (void *)(v15 - 24);
if ( (__int64 *)(v15 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v15 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v15 - 8);
*(_DWORD *)(v15 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v16);
}
}
return a2;
}