//
// DeathStatsPopup::showResult from 0x76fc70 to 0x76febc (588 bytes)
//
// 1 xrefs:
// > DeathStatsPopup::pollFetch @ 0x76ff12
//
// 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:14 +0000
//
int __fastcall DeathStatsPopup::showResult(DeathStatsPopup *this)
{
int v2; // r0
GameLevelManager *DeathDisplayData; // r0
GameLevelManager *v4; // r0
unsigned int v5; // r2
GameLevelManager *DeathDataVersion; // r7
GameLevelManager *v7; // r0
int v8; // r8
size_t v9; // r2
cocos2d::CCString *v10; // r0
const char *CString; // r0
char *v12; // r10
_BYTE *v13; // r0
size_t v14; // r10
int v15; // r8
unsigned int v16; // r3
int v17; // r10
int v18; // r11
unsigned int v19; // r0
unsigned int v20; // r2
char *v21; // r1
const char *v22; // r0
int v23; // r3
cocos2d::CCString *v24; // r0
const char *v25; // r0
int v27; // r0
int v28; // r2
char *v29; // r1
unsigned int i; // r2
int v32; // r12
int v33; // r0
int v34; // r3
unsigned __int8 *v35; // r0
int *v36; // [sp+0h] [bp-44h]
int v37; // [sp+Ch] [bp-38h] BYREF
size_t v38; // [sp+10h] [bp-34h]
void *v39; // [sp+14h] [bp-30h]
int v40; // [sp+18h] [bp-2Ch] BYREF
size_t v41; // [sp+1Ch] [bp-28h]
char *v42; // [sp+20h] [bp-24h]
int v43; // [sp+24h] [bp-20h] BYREF
unsigned int v44; // [sp+28h] [bp-1Ch]
char *v45; // [sp+2Ch] [bp-18h]
int v46[3]; // [sp+30h] [bp-14h] BYREF
v2 = GameLevelManager::sharedState(this);
DeathDisplayData = GameLevelManager::getDeathDisplayData((GameLevelManager *)&v37, v2, *((_DWORD *)this + 182));
v4 = (GameLevelManager *)GameLevelManager::sharedState(DeathDisplayData);
DeathDataVersion = (GameLevelManager *)GameLevelManager::getDeathDataVersion(v4, *((_DWORD *)this + 182), v5);
v7 = (GameLevelManager *)GameLevelManager::sharedState(DeathDataVersion);
GameLevelManager::evictDeathDataCache(v7, *((_DWORD *)this + 182));
v8 = v37 & 1;
if ( v8 )
{
v9 = v38;
if ( v38 )
{
v12 = (char *)v39;
goto LABEL_9;
}
LABEL_5:
if ( *((int *)this + 183) <= 0 )
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"No death data for level %d.",
*((const char **)this + 182));
else
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"No death data for level %d (v%d).",
*((const char **)this + 182));
CString = (const char *)cocos2d::CCString::getCString(v10);
DeathStatsPopup::setStatus(this, CString);
return std::string::~string((int)&v37);
}
v9 = (int)(unsigned __int8)v37 >> 1;
if ( !v9 )
goto LABEL_5;
v12 = (char *)&v37 + 1;
LABEL_9:
v13 = memchr(v12, 124, v9);
if ( v13 && (v14 = v13 - v12, v14 != -1) )
{
std::string::basic_string(&v40, (unsigned __int8 *)&v37, 0, v14);
v36 = &v37;
std::string::basic_string(&v43, (unsigned __int8 *)&v37, v14 + 1, 0xFFFFFFFF);
}
else
{
v40 = 0;
v41 = 0;
v42 = nullptr;
if ( v8 )
{
std::string::__init(&v40, v39, v38);
}
else
{
v40 = v37;
v41 = v38;
v42 = (char *)v39;
}
v43 = 0;
v44 = 0;
v45 = nullptr;
std::string::__init(&v43, &unk_B6B226, 0);
}
v27 = v40 & 1;
if ( v27 )
v28 = v41;
else
v28 = (int)(unsigned __int8)v40 >> 1;
if ( v28 )
{
v29 = (char *)&v40 + 1;
if ( v27 )
v29 = v42;
v15 = 1;
for ( i = 0; !(v27 ? i >= v41 : i >= (int)(unsigned __int8)v40 >> 1); ++i )
{
v32 = (unsigned __int8)v29[i];
if ( v32 == 59 )
++v15;
}
}
else
{
v15 = 0;
}
v16 = 0;
v17 = 0;
v18 = v43 & 1;
v19 = (int)(unsigned __int8)v43 >> 1;
v20 = 0;
while ( 1 )
{
if ( (v43 & 1) != 0 )
{
if ( v16 > v44 )
{
v18 = 0;
goto LABEL_27;
}
if ( v16 == v44 )
goto LABEL_22;
v21 = v45;
}
else
{
if ( v16 > v19 )
goto LABEL_27;
if ( v16 == v19 )
goto LABEL_22;
v21 = (char *)&v43 + 1;
}
if ( v21[v16] != 44 )
goto LABEL_46;
LABEL_22:
if ( v17 == 101 )
break;
++v17;
v20 = v16 + 1;
LABEL_46:
++v16;
}
v36 = &v43;
std::string::basic_string(v46, (unsigned __int8 *)&v43, v20, v16 - v20);
if ( (v46[0] & 1) != 0 )
v22 = (const char *)v46[2];
else
v22 = (char *)v46 + 1;
v18 = atoi(v22);
std::string::~string((int)v46);
LABEL_27:
v23 = *((_DWORD *)this + 178);
if ( v23 )
{
v33 = *(_DWORD *)(v23 + 1408);
if ( v33 )
{
v34 = *((_DWORD *)this + 182);
v35 = (unsigned __int8 *)(v33 + 1316);
*((_DWORD *)v35 - 1) = DeathDataVersion;
*((_DWORD *)v35 - 2) = v34;
std::string::operator=(v35, (unsigned __int8 *)&v37);
LevelEditorLayer::rebuildDeathOverlay(*((LevelEditorLayer **)this + 178));
}
}
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"v%d %d players %d spots",
(const char *)DeathDataVersion,
v18,
v15,
v36);
v25 = (const char *)cocos2d::CCString::getCString(v24);
DeathStatsPopup::setStatus(this, v25);
std::string::~string((int)&v43);
std::string::~string((int)&v40);
return std::string::~string((int)&v37);
}