//
// GameStatsManager::unlockGauntlet from 0x1000785e0 to 0x1000786e5 (261 bytes)
//
// 1 xrefs:
// > GameManager::rewardedVideoHidden @ 0x100380499
//
// 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 __fastcall GameStatsManager::unlockGauntlet(GameStatsManager *a1, int a2)
{
double v2; // xmm0_8
cocos2d::CCDictionary *m_unlockedGauntlets; // r14
__int64 v4; // r13
char *v5; // r15
size_t v6; // rax
size_t v7; // r12
char *v8; // r13
size_t v9; // rbx
char v10; // [rsp+0h] [rbp-60h]
__int64 v11; // [rsp+0h] [rbp-60h]
size_t v12[2]; // [rsp+8h] [rbp-58h] BYREF
char *__s; // [rsp+18h] [rbp-48h]
_QWORD __dst[2]; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
m_unlockedGauntlets = a1->m_unlockedGauntlets;
v4 = sub_1007AB580("%i", v10);
GameStatsManager::getGauntletRewardKey(v12, v2, 1, a2);
if ( (v12[0] & 1) != 0 )
v5 = __s;
else
v5 = (char *)v12 + 1;
v6 = strlen(v5);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v7 = v6;
v11 = v4;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
__dst[0] = v9 | 1;
__dst[1] = v7;
goto LABEL_11;
}
LOBYTE(__dst[0]) = 2 * v6;
v8 = (char *)__dst + 1;
if ( v6 )
LABEL_11:
memmove(v8, v5, v7);
v8[v7] = 0;
cocos2d::CCDictionary::setObject_1(m_unlockedGauntlets, v11, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( (v12[0] & 1) != 0 )
operator delete(__s);
}