//
// GameStatsManager::completedChallenge from 0x1000393c0 to 0x1000394fc (316 bytes)
//
// 1 xrefs:
// > ChallengesPage::claimItem @ 0x10038826b
//
// This function is hookable on this platform (idp: pc, 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:19:33 +0000
//
void __fastcall GameStatsManager::completedChallenge(__int64 a1, __int64 a2, __m128 a3)
{
unsigned int v3; // r14d
__int64 v4; // r12
__int64 v5; // rax
const char *CString; // r15
size_t v7; // rax
size_t v8; // r13
char *v9; // r12
size_t v10; // r14
char v11; // [rsp+0h] [rbp-60h]
char v12; // [rsp+0h] [rbp-60h]
__int64 v13; // [rsp+8h] [rbp-58h]
__int64 v14; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
unsigned int v17; // [rsp+34h] [rbp-2Ch]
if ( *(_BYTE *)(a2 + 100) != 1 || GameStatsManager::hasCompletedChallenge(a1) )
return;
v3 = *(_DWORD *)(a2 + 72) - *(_DWORD *)(a2 + 76);
v4 = *(_QWORD *)(a1 + 712);
v13 = sub_10088E820("%i", v11);
v5 = sub_10088E820("c%i%i", v12);
CString = (const char *)cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
v14 = v4;
if ( v7 >= 0x17 )
{
v17 = v3;
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst[0] = v10 + 1;
v3 = v17;
__dst[1] = v8;
}
else
{
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( !v7 )
goto LABEL_11;
}
memmove(v9, CString, v8);
LABEL_11:
v9[v8] = 0;
cocos2d::CCDictionary::setObject(v14, v13, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
GameStatsManager::incrementStat(a1, "13", v3, a3);
}