//
// LevelStatsInfoPopup::buildStatsText from 0x140426da0 to 0x14042724d (1197 bytes)
//
// 2 xrefs:
// > LevelStatsInfoPopup::init @ 0x140426ace
// > ??> @ 0x1409269e4
//
// 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 11:32:11 +0000
//
// Hidden C++ exception states: #wind=6
_QWORD *__fastcall LevelStatsInfoPopup::buildStatsText(__int64 a1, _QWORD *a2)
{
__int64 v4; // rax
__int64 v5; // rdx
const char *v6; // rdx
cocos2d::CCString *v7; // rax
const char *CString; // rax
size_t v9; // rbx
size_t v10; // r8
int v11; // edx
cocos2d::CCString *v12; // rax
char *v13; // rax
size_t v14; // r8
cocos2d::CCString *v15; // rax
char *v16; // rax
size_t v17; // r8
int v18; // edx
cocos2d::CCString *v19; // rax
char *v20; // rax
size_t v21; // r8
int v22; // edx
void **v23; // rax
cocos2d::CCString *v24; // rax
char *v25; // rax
size_t v26; // r8
signed int v27; // edx
__m128i *v28; // rax
cocos2d::CCString *v29; // rax
char *v30; // rax
const char *v31; // rdx
cocos2d::CCString *v32; // rax
const char *v33; // rax
size_t v34; // rbx
size_t v35; // r8
int v36; // edx
cocos2d::CCString *v37; // rax
char *v38; // rax
size_t v39; // r8
cocos2d::CCString *v40; // rax
char *v41; // rax
size_t v42; // r8
_DWORD *v43; // rcx
int v44; // edx
cocos2d::CCString *v45; // rax
char *v46; // rax
size_t v47; // r8
int v48; // edx
cocos2d::CCString *v49; // rax
char *v50; // rax
size_t v51; // r8
int v52; // edx
cocos2d::CCString *v53; // rax
char *v54; // rax
_QWORD v56[3]; // [rsp+30h] [rbp-58h] BYREF
unsigned __int64 v57; // [rsp+48h] [rbp-40h]
__m128i v58[2]; // [rsp+50h] [rbp-38h] BYREF
v4 = *(_QWORD *)(a1 + 664);
v5 = v4 + 344;
if ( *(_DWORD *)(v4 + 972) == 5 )
{
sub_14003F4F0((__int64)v56, v5);
v6 = (const char *)v56;
if ( v57 > 0xF )
v6 = (const char *)v56[0];
v7 = cocos2d::CCString::createWithFormat(
"%s\nTotal Attempts: %i",
v6,
*(_DWORD *)(*(_QWORD *)(a1 + 664) + 868LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 872LL));
CString = cocos2d::CCString::getCString(v7);
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 0;
v9 = -1;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003D230(a2, CString, v10);
sub_14003D310((__int64)v56);
v11 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 1708LL);
if ( v11 > 0 )
{
v12 = cocos2d::CCString::createWithFormat("\nPractice Attempts: %i", v11);
v13 = (char *)cocos2d::CCString::getCString(v12);
v14 = -1;
do
++v14;
while ( v13[v14] );
sub_140044D80(a2, v13, v14);
}
v15 = cocos2d::CCString::createWithFormat(
"\nTotal Jumps: %i",
*(_DWORD *)(*(_QWORD *)(a1 + 664) + 880LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 884LL));
v16 = (char *)cocos2d::CCString::getCString(v15);
v17 = -1;
do
++v17;
while ( v16[v17] );
sub_140044D80(a2, v16, v17);
v18 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 932LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 928LL);
if ( (unsigned int)(v18 - 1) <= 0x62 )
{
v19 = cocos2d::CCString::createWithFormat("\nBest: %i%%", v18);
v20 = (char *)cocos2d::CCString::getCString(v19);
v21 = -1;
do
++v21;
while ( v20[v21] );
sub_140044D80(a2, v20, v21);
}
v22 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 1416LL);
if ( v22 > 0 )
{
v23 = GameToolbox::msToTimeString((void **)v58, v22, 0);
if ( (unsigned __int64)v23[3] > 0xF )
v23 = (void **)*v23;
v24 = cocos2d::CCString::createWithFormat("\nBest Time: %s", (const char *)v23);
v25 = (char *)cocos2d::CCString::getCString(v24);
v26 = -1;
do
++v26;
while ( v25[v26] );
sub_140044D80(a2, v25, v26);
sub_14003D310((__int64)v58);
}
v27 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 1464LL);
if ( v27 )
{
v28 = GameToolbox::pointsToString(v58, v27);
if ( v28[1].m128i_i64[1] > 0xFuLL )
v28 = (__m128i *)v28->m128i_i64[0];
v29 = cocos2d::CCString::createWithFormat("\nBest Points: %s", v28->m128i_i8);
v30 = (char *)cocos2d::CCString::getCString(v29);
do
++v9;
while ( v30[v9] );
sub_140044D80(a2, v30, v9);
sub_14003D310((__int64)v58);
}
}
else
{
sub_14003F4F0((__int64)v56, v5);
v31 = (const char *)v56;
if ( v57 > 0xF )
v31 = (const char *)v56[0];
v32 = cocos2d::CCString::createWithFormat(
"%s\nTotal Attempts: %i",
v31,
*(_DWORD *)(*(_QWORD *)(a1 + 664) + 868LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 872LL));
v33 = cocos2d::CCString::getCString(v32);
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 0;
v34 = -1;
v35 = -1;
do
++v35;
while ( v33[v35] );
sub_14003D230(a2, v33, v35);
sub_14003D310((__int64)v56);
v36 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 1708LL);
if ( v36 > 0 )
{
v37 = cocos2d::CCString::createWithFormat("\nPractice Attempts: %i", v36);
v38 = (char *)cocos2d::CCString::getCString(v37);
v39 = -1;
do
++v39;
while ( v38[v39] );
sub_140044D80(a2, v38, v39);
}
v40 = cocos2d::CCString::createWithFormat(
"\nTotal Jumps: %i\nNormal: %i%%\nPractice: %i%%",
*(_DWORD *)(*(_QWORD *)(a1 + 664) + 880LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 884LL),
*(_DWORD *)(*(_QWORD *)(a1 + 664) + 932LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 928LL),
*(_DWORD *)(*(_QWORD *)(a1 + 664) + 960LL));
v41 = (char *)cocos2d::CCString::getCString(v40);
v42 = -1;
do
++v42;
while ( v41[v42] );
sub_140044D80(a2, v41, v42);
v43 = *(_DWORD **)(a1 + 664);
v44 = v43[237] - v43[238];
if ( v43[233] - v43[232] != v44 )
{
v45 = cocos2d::CCString::createWithFormat("\nLeaderboard: %i%%", v44);
v46 = (char *)cocos2d::CCString::getCString(v45);
v47 = -1;
do
++v47;
while ( v46[v47] );
sub_140044D80(a2, v46, v47);
}
v48 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 892LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 896LL);
if ( v48 > 0 )
{
v49 = cocos2d::CCString::createWithFormat("\nClicks (best att.): %i", v48);
v50 = (char *)cocos2d::CCString::getCString(v49);
v51 = -1;
do
++v51;
while ( v50[v51] );
sub_140044D80(a2, v50, v51);
}
v52 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 904LL) - *(_DWORD *)(*(_QWORD *)(a1 + 664) + 908LL);
if ( v52 > 0 )
{
v53 = cocos2d::CCString::createWithFormat("\nTime (best att.): %is", v52);
v54 = (char *)cocos2d::CCString::getCString(v53);
do
++v34;
while ( v54[v34] );
sub_140044D80(a2, v54, v34);
}
}
return a2;
}