//
// GameLevelManager::getPlatformerSaveStats from 0x805be8 to 0x806068 (1152 bytes)
//
// 3 xrefs:
// > ClearPlatformerSavesPopup::updateStats @ 0xc8ee74
// > ClearPlatformerSavesPopup::updateStats @ 0xc8ef20
// > ??> @ 0x86950
//
// This function is hookable on this platform (idp: arm, 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:54:45 +0000
//
__int64 __fastcall GameLevelManager::getPlatformerSaveStats(
GameLevelManager *this,
int a2,
int *a3,
unsigned __int64 *a4)
{
_QWORD *v7; // x24
__int64 v8; // x0
__int64 v9; // x0
__int64 i; // x21
__int64 v11; // x19
unsigned __int8 v12; // w0
__int64 v13; // x1
__int64 v14; // x2
unsigned __int64 v15; // x0
__int64 v16; // x2
__int64 v17; // x0
__int64 v18; // x0
__int64 j; // x21
__int64 v20; // x19
unsigned __int8 v21; // w0
__int64 v22; // x1
__int64 v23; // x2
unsigned __int64 v24; // x0
__int64 v25; // x2
__int64 v26; // x0
__int64 v27; // x0
__int64 k; // x21
__int64 v29; // x19
unsigned __int8 v30; // w0
__int64 v31; // x1
__int64 v32; // x2
unsigned __int64 v33; // x0
__int64 v34; // x2
unsigned __int64 isPlatformer; // x0
unsigned __int64 m; // x21
__int64 v37; // x19
unsigned __int8 v38; // w0
__int64 v39; // x1
__int64 v40; // x2
unsigned __int64 v41; // x0
__int64 v42; // x2
__int64 result; // x0
cocos2d::CCArray *v44; // x24
unsigned int v45; // w19
GJGameLevel *v46; // x0
GJGameLevel *v47; // x21
__int64 v48; // x2
unsigned __int64 v49; // x0
__int64 v50; // x2
*a3 = 0;
*a4 = 0;
v7 = (_QWORD *)GameLevelManager::sharedState(this);
v8 = v7[95];
if ( v8 )
{
v9 = *(_QWORD *)(v8 + 56);
if ( v9 )
{
for ( i = *(_QWORD *)(v9 + 288); ; i = *(_QWORD *)(i + 288) )
{
v11 = *(_QWORD *)(v9 + 264);
if ( !v11 || !GJGameLevel::isPlatformer(*(GJGameLevel **)(v9 + 264)) )
{
LABEL_10:
if ( !i )
goto LABEL_17;
goto LABEL_11;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_8;
if ( !*(_BYTE *)(v11 + 912) )
goto LABEL_10;
v12 = *(_BYTE *)(v11 + 1472);
v13 = v11 + 1472;
if ( (v12 & 1) != 0 )
{
LABEL_9:
if ( !*(_QWORD *)(v13 + 8) )
goto LABEL_10;
goto LABEL_12;
}
LABEL_31:
if ( !(v12 >> 1) )
goto LABEL_10;
LABEL_12:
++*a3;
v14 = *(_BYTE *)(v11 + 1472) >> 1;
if ( (*(_BYTE *)(v11 + 1472) & 1) != 0 )
v14 = *(_QWORD *)(v13 + 8);
v15 = v14 + *a4;
*a4 = v15;
v16 = *(_BYTE *)(v11 + 1496) >> 1;
if ( (*(_BYTE *)(v11 + 1496) & 1) != 0 )
v16 = *(_QWORD *)(v11 + 1504);
*a4 = v16 + v15;
if ( !i )
goto LABEL_17;
LABEL_11:
v9 = i;
}
if ( *(_BYTE *)(v11 + 912) )
goto LABEL_10;
LABEL_8:
v12 = *(_BYTE *)(v11 + 1472);
v13 = v11 + 1472;
if ( (v12 & 1) != 0 )
goto LABEL_9;
goto LABEL_31;
}
}
LABEL_17:
v17 = v7[106];
if ( v17 )
{
v18 = *(_QWORD *)(v17 + 56);
if ( v18 )
{
for ( j = *(_QWORD *)(v18 + 288); ; j = *(_QWORD *)(j + 288) )
{
v20 = *(_QWORD *)(v18 + 264);
if ( !v20 || !GJGameLevel::isPlatformer(*(GJGameLevel **)(v18 + 264)) )
{
LABEL_26:
if ( !j )
goto LABEL_38;
goto LABEL_27;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_24;
if ( !*(_BYTE *)(v20 + 912) )
goto LABEL_26;
v21 = *(_BYTE *)(v20 + 1472);
v22 = v20 + 1472;
if ( (v21 & 1) != 0 )
{
LABEL_25:
if ( !*(_QWORD *)(v22 + 8) )
goto LABEL_26;
goto LABEL_33;
}
LABEL_94:
if ( !(v21 >> 1) )
goto LABEL_26;
LABEL_33:
++*a3;
v23 = *(_BYTE *)(v20 + 1472) >> 1;
if ( (*(_BYTE *)(v20 + 1472) & 1) != 0 )
v23 = *(_QWORD *)(v22 + 8);
v24 = v23 + *a4;
*a4 = v24;
v25 = *(_BYTE *)(v20 + 1496) >> 1;
if ( (*(_BYTE *)(v20 + 1496) & 1) != 0 )
v25 = *(_QWORD *)(v20 + 1504);
*a4 = v25 + v24;
if ( !j )
goto LABEL_38;
LABEL_27:
v18 = j;
}
if ( *(_BYTE *)(v20 + 912) )
goto LABEL_26;
LABEL_24:
v21 = *(_BYTE *)(v20 + 1472);
v22 = v20 + 1472;
if ( (v21 & 1) != 0 )
goto LABEL_25;
goto LABEL_94;
}
}
LABEL_38:
v26 = v7[117];
if ( v26 )
{
v27 = *(_QWORD *)(v26 + 56);
if ( v27 )
{
for ( k = *(_QWORD *)(v27 + 288); ; k = *(_QWORD *)(k + 288) )
{
v29 = *(_QWORD *)(v27 + 264);
if ( !v29 || !GJGameLevel::isPlatformer(*(GJGameLevel **)(v27 + 264)) )
{
LABEL_47:
if ( !k )
goto LABEL_54;
goto LABEL_48;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_45;
if ( !*(_BYTE *)(v29 + 912) )
goto LABEL_47;
v30 = *(_BYTE *)(v29 + 1472);
v31 = v29 + 1472;
if ( (v30 & 1) != 0 )
{
LABEL_46:
if ( !*(_QWORD *)(v31 + 8) )
goto LABEL_47;
goto LABEL_49;
}
LABEL_89:
if ( !(v30 >> 1) )
goto LABEL_47;
LABEL_49:
++*a3;
v32 = *(_BYTE *)(v29 + 1472) >> 1;
if ( (*(_BYTE *)(v29 + 1472) & 1) != 0 )
v32 = *(_QWORD *)(v31 + 8);
v33 = v32 + *a4;
*a4 = v33;
v34 = *(_BYTE *)(v29 + 1496) >> 1;
if ( (*(_BYTE *)(v29 + 1496) & 1) != 0 )
v34 = *(_QWORD *)(v29 + 1504);
*a4 = v34 + v33;
if ( !k )
goto LABEL_54;
LABEL_48:
v27 = k;
}
if ( *(_BYTE *)(v29 + 912) )
goto LABEL_47;
LABEL_45:
v30 = *(_BYTE *)(v29 + 1472);
v31 = v29 + 1472;
if ( (v30 & 1) != 0 )
goto LABEL_46;
goto LABEL_89;
}
}
LABEL_54:
isPlatformer = v7[93];
if ( isPlatformer )
{
isPlatformer = *(_QWORD *)(isPlatformer + 56);
if ( isPlatformer )
{
for ( m = *(_QWORD *)(isPlatformer + 288); ; m = *(_QWORD *)(m + 288) )
{
v37 = *(_QWORD *)(isPlatformer + 264);
if ( !v37
|| (isPlatformer = GJGameLevel::isPlatformer(*(GJGameLevel **)(isPlatformer + 264)), !(_BYTE)isPlatformer) )
{
LABEL_63:
if ( !m )
goto LABEL_70;
goto LABEL_64;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_61;
isPlatformer = *(unsigned __int8 *)(v37 + 912);
if ( !*(_BYTE *)(v37 + 912) )
goto LABEL_63;
v38 = *(_BYTE *)(v37 + 1472);
v39 = v37 + 1472;
if ( (v38 & 1) != 0 )
{
LABEL_62:
isPlatformer = *(_QWORD *)(v39 + 8);
if ( !isPlatformer )
goto LABEL_63;
goto LABEL_65;
}
LABEL_84:
isPlatformer = v38 >> 1;
if ( !isPlatformer )
goto LABEL_63;
LABEL_65:
++*a3;
v40 = *(_BYTE *)(v37 + 1472) >> 1;
if ( (*(_BYTE *)(v37 + 1472) & 1) != 0 )
v40 = *(_QWORD *)(v39 + 8);
v41 = v40 + *a4;
*a4 = v41;
v42 = *(_BYTE *)(v37 + 1496) >> 1;
if ( (*(_BYTE *)(v37 + 1496) & 1) != 0 )
v42 = *(_QWORD *)(v37 + 1504);
isPlatformer = v42 + v41;
*a4 = isPlatformer;
if ( !m )
goto LABEL_70;
LABEL_64:
isPlatformer = m;
}
isPlatformer = *(unsigned __int8 *)(v37 + 912);
if ( *(_BYTE *)(v37 + 912) )
goto LABEL_63;
LABEL_61:
v38 = *(_BYTE *)(v37 + 1472);
v39 = v37 + 1472;
if ( (v38 & 1) != 0 )
goto LABEL_62;
goto LABEL_84;
}
}
LABEL_70:
result = LocalLevelManager::sharedState((LocalLevelManager *)isPlatformer);
v44 = *(cocos2d::CCArray **)(result + 360);
v45 = 0;
if ( v44 )
{
result = cocos2d::CCArray::count(*(cocos2d::CCArray **)(result + 360));
if ( (_DWORD)result )
{
do
{
v46 = (GJGameLevel *)cocos2d::CCArray::objectAtIndex(v44, v45);
v47 = v46;
if ( v46 && GJGameLevel::isPlatformer(v46) )
{
if ( a2 )
{
if ( a2 == 2 && !*((_BYTE *)v47 + 912) )
{
++v45;
goto LABEL_79;
}
LABEL_76:
if ( (*((_BYTE *)v47 + 1472) & 1) != 0 )
{
if ( *((_QWORD *)v47 + 185) )
goto LABEL_96;
}
else if ( *((_BYTE *)v47 + 1472) >> 1 )
{
LABEL_96:
++*a3;
v48 = *((_BYTE *)v47 + 1472) >> 1;
if ( (*((_BYTE *)v47 + 1472) & 1) != 0 )
v48 = *((_QWORD *)v47 + 185);
v49 = v48 + *a4;
*a4 = v49;
v50 = *((_BYTE *)v47 + 1496) >> 1;
if ( (*((_BYTE *)v47 + 1496) & 1) != 0 )
v50 = *((_QWORD *)v47 + 188);
*a4 = v50 + v49;
++v45;
goto LABEL_79;
}
goto LABEL_78;
}
if ( !*((_BYTE *)v47 + 912) )
goto LABEL_76;
}
LABEL_78:
++v45;
LABEL_79:
result = cocos2d::CCArray::count(v44);
}
while ( v45 < (unsigned int)result );
}
}
return result;
}