//
// GameStatsManager::recountUserCoins from 0x1401df3c0 to 0x1401dfc00 (2112 bytes)
//
// 3 xrefs:
// > GameStatsManager::verifyUserCoins @ 0x1401dfc38
// > GameStatsManager::verifyUserCoins @ 0x1401dfcb3
// > ??> @ 0x1406cc474
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=14
void GameStatsManager::recountUserCoins(GameStatsManager *a1, bool a2)
{
int Stat; // ebx
int v5; // esi
int i; // ebx
cocos2d::CCString *v7; // rax
const char *CString; // rax
size_t v9; // r8
__int64 v10; // rcx
__int64 v11; // rcx
__int64 v12; // rcx
__int64 v13; // rcx
__int64 v14; // rcx
__int64 v15; // rcx
__int64 v16; // rcx
__int64 v17; // rcx
__int64 v18; // rcx
__int64 v19; // rcx
__int64 v20; // rcx
__int64 v21; // rcx
GameManager *v22; // rcx
bool m_dontNotify; // bl
__int128 v24; // [rsp+20h] [rbp-60h] BYREF
__int64 v25; // [rsp+30h] [rbp-50h]
__int64 v26; // [rsp+38h] [rbp-48h]
__int128 v27; // [rsp+40h] [rbp-40h] BYREF
__int64 v28; // [rsp+50h] [rbp-30h]
__int64 v29; // [rsp+58h] [rbp-28h]
__int128 v30; // [rsp+60h] [rbp-20h] BYREF
__int64 v31; // [rsp+70h] [rbp-10h]
__int64 v32; // [rsp+78h] [rbp-8h]
void *v33; // [rsp+A0h] [rbp+20h]
void *v34; // [rsp+B0h] [rbp+30h]
void *v35; // [rsp+B0h] [rbp+30h]
void *v36; // [rsp+B0h] [rbp+30h]
void *v37; // [rsp+B0h] [rbp+30h]
void *v38; // [rsp+B0h] [rbp+30h]
void *v39; // [rsp+B0h] [rbp+30h]
void *v40; // [rsp+B0h] [rbp+30h]
void *v41; // [rsp+B0h] [rbp+30h]
void *v42; // [rsp+B0h] [rbp+30h]
void *v43; // [rsp+B0h] [rbp+30h]
void *v44; // [rsp+B0h] [rbp+30h]
void *v45; // [rsp+B0h] [rbp+30h]
Stat = GameStatsManager::getStat(a1, "12");
v5 = cocos2d::CCDictionary::count(a1->m_verifiedUserCoins);
if ( Stat > v5 || a2 )
{
for ( i = 1; i <= 21; ++i )
{
v7 = cocos2d::CCString::createWithFormat("geometry.ach.usercoins%02d", i);
CString = cocos2d::CCString::getCString(v7);
v30 = 0;
v31 = 0;
v32 = 0;
v9 = -1;
do
++v9;
while ( CString[v9] );
sub_14003A930(&v30, CString, v9);
v10 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v34 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = qword_1406C2ED8;
}
GameManager::resetAchievement(v10, (const char *)&v30);
}
if ( v5 < 10 )
{
v24 = 0;
*(_QWORD *)&v24 = sub_14003AA10(0x20u);
v25 = 21;
v26 = 31;
strcpy((char *)v24, "geometry.ach.secret05");
v11 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v35 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = qword_1406C2ED8;
}
GameManager::resetAchievement(v11, (const char *)&v24);
v27 = 0;
v28 = 0;
v29 = 15;
*(_QWORD *)&v27 = sub_14003AA10(0x20u);
v28 = 21;
v29 = 31;
strcpy((char *)v27, "geometry.ach.secret06");
v12 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v36 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = qword_1406C2ED8;
}
GameManager::resetAchievement(v12, (const char *)&v27);
v24 = 0;
v25 = 0;
v26 = 15;
*(_QWORD *)&v24 = sub_14003AA10(0x20u);
v25 = 21;
v26 = 31;
strcpy((char *)v24, "geometry.ach.secret07");
v13 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v37 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v13 = qword_1406C2ED8;
}
GameManager::resetAchievement(v13, (const char *)&v24);
v27 = 0;
v28 = 0;
v29 = 15;
*(_QWORD *)&v27 = sub_14003AA10(0x20u);
v28 = 21;
v29 = 31;
strcpy((char *)v27, "geometry.ach.secret08");
v14 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v38 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = qword_1406C2ED8;
}
GameManager::resetAchievement(v14, (const char *)&v27);
v24 = 0;
v25 = 0;
v26 = 15;
*(_QWORD *)&v24 = sub_14003AA10(0x20u);
v25 = 21;
v26 = 31;
strcpy((char *)v24, "geometry.ach.secret09");
v15 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v39 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v39);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v15 = qword_1406C2ED8;
}
GameManager::resetAchievement(v15, (const char *)&v24);
v27 = 0;
v28 = 0;
v29 = 15;
*(_QWORD *)&v27 = sub_14003AA10(0x20u);
v28 = 21;
v29 = 31;
strcpy((char *)v27, "geometry.ach.secret10");
v16 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v40 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v40);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v16 = qword_1406C2ED8;
}
GameManager::resetAchievement(v16, (const char *)&v27);
v24 = 0;
v25 = 0;
v26 = 15;
*(_QWORD *)&v24 = sub_14003AA10(0x20u);
v25 = 21;
v26 = 31;
strcpy((char *)v24, "geometry.ach.secret13");
v17 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v41 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v17 = qword_1406C2ED8;
}
GameManager::resetAchievement(v17, (const char *)&v24);
v27 = 0;
v28 = 0;
v29 = 15;
*(_QWORD *)&v27 = sub_14003AA10(0x20u);
v28 = 21;
v29 = 31;
strcpy((char *)v27, "geometry.ach.secret14");
v18 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v42 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v42);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v18 = qword_1406C2ED8;
}
GameManager::resetAchievement(v18, (const char *)&v27);
v24 = 0;
v25 = 0;
v26 = 15;
*(_QWORD *)&v24 = sub_14003AA10(0x20u);
v25 = 21;
v26 = 31;
strcpy((char *)v24, "geometry.ach.secret15");
v19 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v43 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v43);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v19 = qword_1406C2ED8;
}
GameManager::resetAchievement(v19, (const char *)&v24);
v27 = 0;
v28 = 0;
v29 = 15;
*(_QWORD *)&v27 = sub_14003AA10(0x20u);
v28 = 21;
v29 = 31;
strcpy((char *)v27, "geometry.ach.secret16");
v20 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v20 = qword_1406C2ED8;
}
GameManager::resetAchievement(v20, (const char *)&v27);
v24 = 0;
v25 = 0;
v26 = 15;
*(_QWORD *)&v24 = sub_14003AA10(0x20u);
v25 = 21;
v26 = 31;
strcpy((char *)v24, "geometry.ach.secret17");
v21 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v45 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v21 = qword_1406C2ED8;
}
GameManager::resetAchievement(v21, (const char *)&v24);
}
v22 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v33 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v22 = (GameManager *)qword_1406C2ED8;
}
GameManager::checkUsedIcons(v22);
m_dontNotify = AchievementManager::sharedState()->m_dontNotify;
AchievementManager::sharedState()->m_dontNotify = 1;
GameStatsManager::setStat(a1, "12", v5);
AchievementManager::sharedState()->m_dontNotify = m_dontNotify;
}
}