//
// GJGameLevel::handleStatsConflict from 0x4dc820 to 0x4dcc50 (1072 bytes)
//
// 5 xrefs:
// > GameLevelManager::dataLoaded @ 0x4dcd3c
// > GameLevelManager::dataLoaded @ 0x4dce6e
// > GameLevelManager::dataLoaded @ 0x4dcf9e
// > GameLevelManager::dataLoaded @ 0x4dd0c0
// > LocalLevelManager::dataLoaded @ 0x544a2e
//
// 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:50:57 +0000
//
unsigned __int8 *__fastcall GJGameLevel::handleStatsConflict(GJGameLevel *this, GJGameLevel *a2)
{
int v3; // r2
int v5; // r1
int v6; // r2
int v7; // r1
int v8; // r2
int v9; // r1
int NormalPercent; // r6
GJGameLevel *v11; // r0
int v12; // r0
int v13; // r2
int v14; // r1
int v15; // r11
int v16; // r9
int v17; // r10
int v18; // r8
int v19; // r10
int v20; // r11
int v21; // r10
int v22; // r10
unsigned __int8 *result; // r0
int v24; // r3
int v25; // r2
int v26; // r2
int v27; // r3
int v28; // r2
int v29; // r3
int v30; // r3
int v31; // r3
int v32; // r3
int v33; // r3
int v35; // r3
int v36; // r3
int v37; // r3
int v39; // r3
int v40; // r3
int v41; // r3
int v43; // r3
int v44; // r3
int v45; // r3
int v46; // r3
int v47; // [sp+10h] [bp-1Ch]
int v48; // [sp+10h] [bp-1Ch]
int v49; // [sp+14h] [bp-18h]
int v50; // [sp+14h] [bp-18h]
int v51[3]; // [sp+18h] [bp-14h] BYREF
v3 = *((_DWORD *)this + 156);
v5 = *((_DWORD *)a2 + 155) - *((_DWORD *)a2 + 156);
if ( v5 < *((_DWORD *)this + 155) - v3 )
v5 = *((_DWORD *)this + 155) - v3;
GJGameLevel::setAttempts(this, v5);
v6 = *((_DWORD *)this + 159);
v7 = *((_DWORD *)a2 + 158) - *((_DWORD *)a2 + 159);
if ( v7 < *((_DWORD *)this + 158) - v6 )
v7 = *((_DWORD *)this + 158) - v6;
GJGameLevel::setJumps(this, v7);
v8 = *((_DWORD *)this + 162);
v9 = *((_DWORD *)a2 + 161) - *((_DWORD *)a2 + 162);
if ( v9 < *((_DWORD *)this + 161) - v8 )
v9 = *((_DWORD *)this + 161) - v8;
GJGameLevel::setClicks(this, v9);
NormalPercent = GJGameLevel::getNormalPercent(this);
if ( NormalPercent >= GJGameLevel::getNormalPercent(a2) )
v11 = this;
else
v11 = a2;
v12 = GJGameLevel::getNormalPercent(v11);
GJGameLevel::setNormalPercent(this, v12);
v13 = *((_DWORD *)this + 173);
v14 = *((_DWORD *)a2 + 172) - *((_DWORD *)a2 + 173);
if ( v14 < *((_DWORD *)this + 172) - v13 )
v14 = *((_DWORD *)this + 172) - v13;
GJGameLevel::setNewNormalPercent(this, v14);
v15 = *((_DWORD *)a2 + 260);
v16 = *((_DWORD *)this + 175) - *((_DWORD *)this + 176);
v17 = *((_DWORD *)a2 + 261);
v18 = *((_DWORD *)a2 + 175) - *((_DWORD *)a2 + 176);
v49 = *((_DWORD *)a2 + 262);
v47 = *((_DWORD *)a2 + 263);
std::string::basic_string(v51, (int)a2 + 1056);
v19 = GJGameLevel::saveNewScore((int)this, v15, 0, v17, v49, v47, (unsigned __int8 *)v51, 0);
std::string::~string((int)v51);
if ( v19 )
*((_BYTE *)this + 1124) = *((_BYTE *)a2 + 1124);
v20 = *((_DWORD *)a2 + 267);
v21 = *((_DWORD *)a2 + 268);
v50 = *((_DWORD *)a2 + 269);
v48 = *((_DWORD *)a2 + 270);
std::string::basic_string(v51, (int)a2 + 1084);
v22 = GJGameLevel::saveNewScore((int)this, v20, 1, v21, v50, v48, (unsigned __int8 *)v51, 0);
result = (unsigned __int8 *)std::string::~string((int)v51);
if ( v22 )
*((_BYTE *)this + 1125) = *((_BYTE *)a2 + 1125);
if ( v18 > v16 )
{
GJGameLevel::setNewNormalPercent2(this, v18);
GJGameLevel::setClicks(this, *((_DWORD *)a2 + 161) - *((_DWORD *)a2 + 162));
GJGameLevel::setAttemptTime(this, *((_DWORD *)a2 + 164) - *((_DWORD *)a2 + 165));
*((_DWORD *)this + 167) = *((_DWORD *)a2 + 167);
std::string::basic_string(v51, (int)a2 + 988);
std::string::operator=((unsigned __int8 *)this + 988, (unsigned __int8 *)v51);
result = (unsigned __int8 *)std::string::~string((int)v51);
*((_BYTE *)this + 672) = *((_BYTE *)a2 + 672);
}
v24 = *((_DWORD *)a2 + 178);
v25 = *((_DWORD *)this + 178);
if ( v25 < v24 )
*((_DWORD *)this + 178) = v24;
else
*((_DWORD *)this + 178) = v25;
v26 = *((_DWORD *)this + 296);
v27 = *((_DWORD *)a2 + 296);
if ( v26 < v27 )
*((_DWORD *)this + 296) = v27;
else
*((_DWORD *)this + 296) = v26;
v28 = *((_DWORD *)this + 115);
v29 = *((_DWORD *)a2 + 115);
if ( v28 < v29 )
*((_DWORD *)this + 115) = v29;
else
*((_DWORD *)this + 115) = v28;
if ( *((_BYTE *)a2 + 736) )
*((_BYTE *)this + 736) = 1;
v30 = *((_DWORD *)a2 + 297);
if ( v30 > 0 && (!*((_DWORD *)this + 297) || *((_DWORD *)a2 + 311) > *((_DWORD *)this + 311)) )
{
*((_DWORD *)this + 297) = v30;
std::string::operator=((unsigned __int8 *)this + 1192, (unsigned __int8 *)a2 + 1192);
std::string::operator=((unsigned __int8 *)this + 1204, (unsigned __int8 *)a2 + 1204);
std::string::operator=((unsigned __int8 *)this + 1216, (unsigned __int8 *)a2 + 1216);
std::string::operator=((unsigned __int8 *)this + 1228, (unsigned __int8 *)a2 + 1228);
*((_DWORD *)this + 310) = *((_DWORD *)a2 + 310);
*((_DWORD *)this + 311) = *((_DWORD *)a2 + 311);
*((_DWORD *)this + 312) = *((_DWORD *)a2 + 312);
*((_DWORD *)this + 313) = *((_DWORD *)a2 + 313);
*((_DWORD *)this + 314) = *((_DWORD *)a2 + 314);
std::string::operator=((unsigned __int8 *)this + 1260, (unsigned __int8 *)a2 + 1260);
result = std::string::operator=((unsigned __int8 *)this + 1272, (unsigned __int8 *)a2 + 1272);
*((_BYTE *)this + 1284) = *((_BYTE *)a2 + 1284);
if ( *((_DWORD *)a2 + 153) == *((_DWORD *)this + 153)
&& (*((_DWORD *)this + 238) != 2
|| (result = (unsigned __int8 *)sub_4A9CC4((unsigned __int8 *)this + 304, (unsigned __int8 *)a2 + 304)) != nullptr) )
{
result = std::string::operator=((unsigned __int8 *)this + 1288, (unsigned __int8 *)a2 + 1288);
*((_BYTE *)this + 1300) = *((_BYTE *)a2 + 1300);
}
}
v31 = *((unsigned __int8 *)this + 1316);
if ( (v31 & 1) != 0 )
v32 = *((_DWORD *)this + 330);
else
v32 = v31 >> 1;
if ( !v32 )
{
v33 = *((unsigned __int8 *)a2 + 1316);
result = (unsigned __int8 *)(v33 << 31);
if ( (v33 & 1) != 0 ? *((_DWORD *)a2 + 330) : v33 >> 1 )
{
result = std::string::operator=((unsigned __int8 *)this + 1316, (unsigned __int8 *)a2 + 1316);
*((_DWORD *)this + 327) = *((_DWORD *)a2 + 327);
*((_DWORD *)this + 328) = *((_DWORD *)a2 + 328);
}
}
v35 = *((unsigned __int8 *)this + 1344);
if ( (v35 & 1) != 0 )
v36 = *((_DWORD *)this + 337);
else
v36 = v35 >> 1;
if ( !v36 )
{
v37 = *((unsigned __int8 *)a2 + 1344);
if ( (v37 & 1) != 0 ? *((_DWORD *)a2 + 337) : v37 >> 1 )
{
result = std::string::operator=((unsigned __int8 *)this + 1344, (unsigned __int8 *)a2 + 1344);
*((_DWORD *)this + 339) = *((_DWORD *)a2 + 339);
*((_BYTE *)this + 1360) = *((_BYTE *)a2 + 1360);
*((_DWORD *)this + 341) = *((_DWORD *)a2 + 341);
}
}
v39 = *((unsigned __int8 *)this + 1328);
if ( (v39 & 1) != 0 )
v40 = *((_DWORD *)this + 333);
else
v40 = v39 >> 1;
if ( !v40 )
{
v41 = *((unsigned __int8 *)a2 + 1328);
result = (unsigned __int8 *)(v41 << 31);
if ( (v41 & 1) != 0 ? *((_DWORD *)a2 + 333) : v41 >> 1 )
{
result = std::string::operator=((unsigned __int8 *)this + 1328, (unsigned __int8 *)a2 + 1328);
*((_DWORD *)this + 335) = *((_DWORD *)a2 + 335);
}
}
v43 = *((unsigned __int8 *)this + 1148);
if ( (v43 & 1) != 0 )
v44 = *((_DWORD *)this + 288);
else
v44 = v43 >> 1;
if ( !v44 )
{
v45 = *((unsigned __int8 *)a2 + 1148);
if ( (v45 & 1) != 0 )
v46 = *((_DWORD *)a2 + 288);
else
v46 = v45 >> 1;
if ( v46 )
{
if ( *((_DWORD *)a2 + 293) == *((_DWORD *)this + 153)
&& (*((_DWORD *)this + 238) != 2
|| (result = (unsigned __int8 *)sub_4A9CC4((unsigned __int8 *)this + 304, (unsigned __int8 *)a2 + 304)) != nullptr) )
{
std::string::operator=((unsigned __int8 *)this + 1148, (unsigned __int8 *)a2 + 1148);
*((_DWORD *)this + 293) = *((_DWORD *)a2 + 293);
*((_DWORD *)this + 294) = *((_DWORD *)a2 + 294);
result = std::string::operator=((unsigned __int8 *)this + 1160, (unsigned __int8 *)a2 + 1160);
*((_BYTE *)this + 593) = *((_BYTE *)a2 + 593);
}
}
}
return result;
}