//
// GameStatsManager::unlockGauntlet from 0x7b637c to 0x7b6528 (428 bytes)
//
// 2 xrefs:
// > GameManager::rewardedVideoHidden @ 0x5e8410
// > ??> @ 0x544f8
//
// 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
//
void GameStatsManager::unlockGauntlet(GameStatsManager *a1, int a2)
{
cocos2d::CCDictionary *m_unlockedGauntlets; // x23
cocos2d::CCObject *v5; // x22
void *v6; // x0
char *v7; // x0
unsigned int *v8; // x1
int v9; // w2
unsigned int *v10; // x1
int v11; // w2
char *v12; // [xsp+58h] [xbp+58h] BYREF
__int64 v13; // [xsp+60h] [xbp+60h] BYREF
m_unlockedGauntlets = a1->m_unlockedGauntlets;
v5 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)&dword_0 + 1);
GameStatsManager::getGauntletRewardKey(a1, a2, (__int64)&v12);
sub_D153B8((int)&v13, v12);
cocos2d::CCDictionary::setObject((int)m_unlockedGauntlets, v5);
v6 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v13 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v13 - 8);
*(_DWORD *)(v13 - 8) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v6);
}
v7 = v12 - 24;
if ( v12 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v12 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v7);
}
}