//
// LevelStatsInfoPopup::decodeProgress from 0x79bb48 to 0x79bd42 (506 bytes)
//
// 1 xrefs:
// > LevelStatsInfoPopup::buildInfoText @ 0x79c1a2
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:59:50 +0000
//
int *__fastcall LevelStatsInfoPopup::decodeProgress(int *a1, int a2, unsigned __int8 *a3)
{
int v4; // r4
int v6; // r2
unsigned int v7; // r6
const char *v8; // r10
unsigned int v9; // r3
int v10; // r2
unsigned int v11; // r3
unsigned __int8 *v12; // r3
int v13; // r0
int v14; // r1
int v15; // r2
unsigned __int8 *v16; // r3
size_t v17; // r4
unsigned int v18; // r5
unsigned int v19; // r5
unsigned int v20; // r5
char *v21; // r0
char *v22; // r3
const char *v23; // r0
int v24; // r3
cocos2d::CCString *v25; // r0
char *CString; // r0
char *v27; // r9
char v29; // [sp+0h] [bp-34h]
char *v30; // [sp+4h] [bp-30h]
int v31; // [sp+14h] [bp-20h] BYREF
int v32; // [sp+18h] [bp-1Ch]
int v33; // [sp+1Ch] [bp-18h]
char v34[4]; // [sp+20h] [bp-14h] BYREF
unsigned int v35; // [sp+24h] [bp-10h]
char *v36; // [sp+28h] [bp-Ch]
v4 = *a3;
if ( (v4 & 1) != 0 )
v6 = *((_DWORD *)a3 + 1);
else
v6 = v4 >> 1;
if ( v6 )
{
v7 = 0;
v8 = nullptr;
v31 = 0;
v32 = 0;
v33 = 0;
*(_DWORD *)v34 = 0;
v35 = 0;
v36 = nullptr;
while ( 1 )
{
v9 = *a3;
v10 = v9 & 1;
if ( (v9 & 1) != 0 )
{
v11 = *((_DWORD *)a3 + 1);
if ( v7 > v11 )
goto LABEL_16;
if ( v7 == v11 )
goto LABEL_40;
v12 = *((unsigned __int8 **)a3 + 2);
}
else
{
if ( v7 > v9 >> 1 )
{
LABEL_16:
v13 = v31;
v14 = v32;
v15 = v33;
v31 = 0;
v32 = 0;
v33 = 0;
*a1 = v13;
a1[1] = v14;
a1[2] = v15;
std::string::~string((int)v34);
std::string::~string((int)&v31);
return a1;
}
if ( v7 == v9 >> 1 )
goto LABEL_40;
v12 = a3 + 1;
}
if ( v12[v7] != 44 )
{
if ( v10 )
v16 = *((unsigned __int8 **)a3 + 2);
else
v16 = a3 + 1;
v29 = v16[v7];
if ( (v34[0] & 1) != 0 )
{
v17 = v35;
if ( v35 == (*(_DWORD *)v34 & 0xFFFFFFFE) - 1 )
{
if ( v35 == -17 )
sub_38B530();
v27 = v36;
if ( v35 > 0x7FFFFFE6 )
{
v19 = -18;
}
else
{
LABEL_27:
v18 = 2 * v17;
if ( 2 * v17 < v17 + 1 )
v18 = v17 + 1;
if ( v18 <= 0xA )
v19 = 10;
else
v19 = ((v18 + 16) & 0xFFFFFFF0) - 1;
}
v20 = v19 + 1;
v21 = (char *)operator new(v20);
v30 = v21;
if ( !v17 || (std::char_traits::copy(v21, v27, v17), v17 != 10) )
operator delete(v27);
*(_DWORD *)v34 = v20 | 1;
v36 = v30;
}
v22 = &v36[v17];
v35 = v17 + 1;
}
else
{
v17 = (int)(unsigned __int8)v34[0] >> 1;
if ( v17 == 10 )
{
v27 = &v34[1];
goto LABEL_27;
}
v22 = &v34[v17 + 1];
v34[0] = 2 * (v17 + 1);
}
*v22 = v29;
v22[1] = 0;
goto LABEL_39;
}
LABEL_40:
if ( (v34[0] & 1) != 0 )
{
if ( !v35 )
goto LABEL_39;
v23 = v36;
}
else
{
if ( !((unsigned __int8)v34[0] >> 1) )
goto LABEL_39;
v23 = &v34[1];
}
v8 += atoi(v23);
if ( (v31 & 1) != 0 )
v24 = v32;
else
v24 = (int)(unsigned __int8)v31 >> 1;
if ( v24 )
std::string::append(&v31, " ");
v25 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i%%", v8);
CString = (char *)cocos2d::CCString::getCString(v25);
std::string::append(&v31, CString);
if ( (v34[0] & 1) != 0 )
{
*v36 = 0;
v35 = 0;
}
else
{
v34[1] = 0;
v34[0] = 0;
}
LABEL_39:
++v7;
}
}
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
std::string::__init(a1, &unk_B6B226, 0);
return a1;
}