//
// GameManager::getUnlockForAchievement from 0x718fe8 to 0x71992c (2372 bytes)
//
// 6 xrefs:
// > GameManager::completedAchievement @ 0x721e9c
// > GameManager::resetAchievement @ 0x722a5c
// > ShardsPage::init @ 0xaa4654
// > GJPathPage::onIconInfo @ 0xba513c
// > GJPathPage::init @ 0xba6e68
// > ??> @ 0x84f70
//
// This function is hookable on this platform (idp: arm, 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:52:17 +0000
//
__int64 __fastcall GameManager::getUnlockForAchievement(__int64 a1, __int64 a2, _DWORD *a3, _DWORD *a4)
{
AchievementManager *v7; // x0
AchievementManager *v8; // x0
const char *v9; // x1
__int64 AchievementsWithID; // x19
__int64 v11; // x20
cocos2d::CCString *v12; // x0
const char *CString; // x0
size_t v14; // x0
cocos2d::CCArray *v15; // x0
cocos2d::CCArray *v16; // x25
char *v17; // x0
unsigned __int64 v18; // x24
__int64 v19; // x21
unsigned __int64 v20; // x19
int v21; // w1
const char *v22; // x1
size_t v23; // x0
cocos2d::CCObject *v24; // x0
char *v25; // x2
unsigned __int64 v26; // x0
cocos2d::CCString *v27; // x0
size_t v28; // x0
cocos2d::CCString *v29; // x0
_BOOL4 v30; // w21
char *v32; // x3
char *v33; // x0
__int64 *v34; // x1
char *v35; // x21
_BOOL4 v36; // w21
_BOOL4 v37; // w21
_BOOL4 v38; // w21
_BOOL4 v39; // w21
_BOOL4 v40; // w21
_BOOL4 v41; // w19
_BOOL4 v42; // w19
_BOOL4 v43; // w19
_BOOL4 v44; // w19
_BOOL4 v45; // w19
_BOOL4 v46; // w19
_BOOL4 v47; // w19
_BOOL4 v48; // w19
_BOOL4 v49; // w19
char *v50; // [xsp+68h] [xbp+68h]
char *v51; // [xsp+68h] [xbp+68h]
char *v52; // [xsp+68h] [xbp+68h]
__int64 v53; // [xsp+78h] [xbp+78h] BYREF
unsigned __int64 v54; // [xsp+80h] [xbp+80h]
char *v55; // [xsp+88h] [xbp+88h]
__int64 v56[2]; // [xsp+90h] [xbp+90h] BYREF
void *v57; // [xsp+A0h] [xbp+A0h]
__int64 v58[2]; // [xsp+A8h] [xbp+A8h] BYREF
void *v59; // [xsp+B8h] [xbp+B8h]
__int64 v60[2]; // [xsp+C0h] [xbp+C0h] BYREF
void *v61; // [xsp+D0h] [xbp+D0h]
__int64 v62[2]; // [xsp+D8h] [xbp+D8h] BYREF
void *v63; // [xsp+E8h] [xbp+E8h]
__int64 v64[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v65; // [xsp+100h] [xbp+100h]
__int64 v66[2]; // [xsp+108h] [xbp+108h] BYREF
void *v67; // [xsp+118h] [xbp+118h]
__int64 v68[2]; // [xsp+120h] [xbp+120h] BYREF
void *v69; // [xsp+130h] [xbp+130h]
__int64 v70[2]; // [xsp+138h] [xbp+138h] BYREF
void *v71; // [xsp+148h] [xbp+148h]
__int64 v72[2]; // [xsp+150h] [xbp+150h] BYREF
void *v73; // [xsp+160h] [xbp+160h]
__int64 v74[2]; // [xsp+168h] [xbp+168h] BYREF
void *v75; // [xsp+178h] [xbp+178h]
__int64 v76[2]; // [xsp+180h] [xbp+180h] BYREF
void *v77; // [xsp+190h] [xbp+190h]
__int64 v78[2]; // [xsp+198h] [xbp+198h] BYREF
void *v79; // [xsp+1A8h] [xbp+1A8h]
__int64 v80[2]; // [xsp+1B0h] [xbp+1B0h] BYREF
void *v81; // [xsp+1C0h] [xbp+1C0h]
__int64 v82[2]; // [xsp+1C8h] [xbp+1C8h] BYREF
void *v83; // [xsp+1D8h] [xbp+1D8h]
__int64 v84[2]; // [xsp+1E0h] [xbp+1E0h] BYREF
void *v85; // [xsp+1F0h] [xbp+1F0h]
__int64 v86[2]; // [xsp+1F8h] [xbp+1F8h] BYREF
void *v87; // [xsp+208h] [xbp+208h]
cocos2d::CCArray *v88; // [xsp+210h] [xbp+210h] BYREF
__int64 v89; // [xsp+218h] [xbp+218h]
void *v90; // [xsp+220h] [xbp+220h]
AchievementManager *v91; // [xsp+228h] [xbp+228h]
v7 = (AchievementManager *)_stack_chk_guard;
*a3 = 0;
*a4 = 0;
v91 = v7;
v8 = (AchievementManager *)AchievementManager::sharedState(v7);
v9 = (const char *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v9 = *(const char **)(a2 + 16);
AchievementsWithID = AchievementManager::getAchievementsWithID(v8, v9);
if ( AchievementsWithID )
{
v88 = nullptr;
v89 = 0;
v90 = nullptr;
std::string::__init((__int64 *)&v88, "icon", 4u);
v11 = cocos2d::CCDictionary::objectForKey(AchievementsWithID, &v88);
if ( ((unsigned __int8)v88 & 1) != 0 )
{
operator delete(v90);
if ( !v11 )
return _stack_chk_guard;
}
else if ( !v11 )
{
return _stack_chk_guard;
}
v88 = nullptr;
v89 = 0;
v90 = nullptr;
std::string::__init((__int64 *)&v88, "icon", 4u);
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(AchievementsWithID, &v88);
CString = (const char *)cocos2d::CCString::getCString(v12);
v53 = 0;
v54 = 0;
v55 = nullptr;
v50 = (char *)CString;
v14 = strlen(CString);
std::string::__init(&v53, v50, v14);
v15 = (cocos2d::CCArray *)(unsigned __int8)v88;
if ( ((unsigned __int8)v88 & 1) != 0 )
operator delete(v90);
v16 = (cocos2d::CCArray *)cocos2d::CCArray::create(v15);
if ( (v53 & 1) != 0 )
{
v17 = v55;
if ( !v54 )
{
LABEL_10:
v18 = 0;
v19 = -1;
LABEL_11:
v20 = 0;
while ( 1 )
{
std::string::basic_string(v86, (__int64)&v53, v20, v19 - v20);
v21 = v86[0] & 1;
if ( v21 )
{
if ( v20 == v18 )
{
v21 = 1;
if ( !v86[1] )
goto LABEL_19;
}
v22 = (const char *)v87;
}
else
{
if ( v20 == v18 && !((int)LOBYTE(v86[0]) >> 1) )
goto LABEL_19;
v22 = (char *)v86 + 1;
}
v51 = (char *)v22;
v88 = nullptr;
v89 = 0;
v90 = nullptr;
v23 = strlen(v22);
std::string::__init((__int64 *)&v88, v51, v23);
v24 = (cocos2d::CCObject *)cocos2d::CCString::create(&v88);
cocos2d::CCArray::addObject(v16, v24);
if ( ((unsigned __int8)v88 & 1) != 0 )
operator delete(v90);
v21 = v86[0] & 1;
LABEL_19:
if ( v19 == -1 )
{
if ( v21 )
operator delete(v87);
if ( (unsigned int)cocos2d::CCArray::count(v16) > 1 )
{
v27 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v16, 0);
v52 = (char *)cocos2d::CCString::getCString(v27);
v88 = nullptr;
v89 = 0;
v90 = nullptr;
v28 = strlen(v52);
std::string::__init((__int64 *)&v88, v52, v28);
v29 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v16, 1u);
*a3 = cocos2d::CCString::intValue(v29);
v56[0] = 0;
v56[1] = 0;
v57 = nullptr;
std::string::__init(v56, "icon", 4u);
v30 = sub_714624((__int64)&v88, (__int64)v56);
if ( (v56[0] & 1) != 0 )
operator delete(v57);
if ( v30 )
{
*a4 = 1;
}
else
{
v58[0] = 0;
v58[1] = 0;
v59 = nullptr;
std::string::__init(v58, "ship", 4u);
v36 = sub_714624((__int64)&v88, (__int64)v58);
if ( (v58[0] & 1) != 0 )
operator delete(v59);
if ( v36 )
{
*a4 = 4;
}
else
{
v60[0] = 0;
v60[1] = 0;
v61 = nullptr;
std::string::__init(v60, "ball", 4u);
v37 = sub_714624((__int64)&v88, (__int64)v60);
if ( (v60[0] & 1) != 0 )
operator delete(v61);
if ( v37 )
{
*a4 = 5;
}
else
{
v62[0] = 0;
v62[1] = 0;
v63 = nullptr;
std::string::__init(v62, "bird", 4u);
v38 = sub_714624((__int64)&v88, (__int64)v62);
if ( (v62[0] & 1) != 0 )
operator delete(v63);
if ( v38 )
{
*a4 = 6;
}
else
{
v64[0] = 0;
v64[1] = 0;
v65 = nullptr;
std::string::__init(v64, "dart", 4u);
v39 = sub_714624((__int64)&v88, (__int64)v64);
if ( (v64[0] & 1) != 0 )
operator delete(v65);
if ( v39 )
{
*a4 = 7;
}
else
{
v66[0] = 0;
v66[1] = 0;
v67 = nullptr;
std::string::__init(v66, "special", 7u);
v40 = sub_714624((__int64)&v88, (__int64)v66);
if ( (v66[0] & 1) != 0 )
operator delete(v67);
if ( v40 )
{
*a4 = 10;
}
else
{
v68[0] = 0;
v68[1] = 0;
v69 = nullptr;
std::string::__init(v68, "robot", 5u);
v41 = sub_714624((__int64)&v88, (__int64)v68);
if ( (v68[0] & 1) != 0 )
operator delete(v69);
if ( v41 )
{
*a4 = 8;
}
else
{
v70[0] = 0;
v70[1] = 0;
v71 = nullptr;
std::string::__init(v70, "spider", 6u);
v42 = sub_714624((__int64)&v88, (__int64)v70);
if ( (v70[0] & 1) != 0 )
operator delete(v71);
if ( v42 )
{
*a4 = 9;
}
else
{
v72[0] = 0;
v72[1] = 0;
v73 = nullptr;
std::string::__init(v72, "death", 5u);
v43 = sub_714624((__int64)&v88, (__int64)v72);
if ( (v72[0] & 1) != 0 )
operator delete(v73);
if ( v43 )
{
*a4 = 11;
}
else
{
v74[0] = 0;
v74[1] = 0;
v75 = nullptr;
std::string::__init(v74, "item", 4u);
v44 = sub_714624((__int64)&v88, (__int64)v74);
if ( (v74[0] & 1) != 0 )
operator delete(v75);
if ( v44 )
{
*a4 = 12;
}
else
{
v76[0] = 0;
v76[1] = 0;
v77 = nullptr;
std::string::__init(v76, "swing", 5u);
v45 = sub_714624((__int64)&v88, (__int64)v76);
if ( (v76[0] & 1) != 0 )
operator delete(v77);
if ( v45 )
{
*a4 = 13;
}
else
{
v78[0] = 0;
v78[1] = 0;
v79 = nullptr;
std::string::__init(v78, "jetpack", 7u);
v46 = sub_714624((__int64)&v88, (__int64)v78);
if ( (v78[0] & 1) != 0 )
operator delete(v79);
if ( v46 )
{
*a4 = 14;
}
else
{
v80[0] = 0;
v80[1] = 0;
v81 = nullptr;
std::string::__init(v80, "shipstreak", 0xAu);
v47 = sub_714624((__int64)&v88, (__int64)v80);
if ( (v80[0] & 1) != 0 )
operator delete(v81);
if ( v47 )
{
*a4 = 15;
}
else
{
v82[0] = 0;
v82[1] = 0;
v83 = nullptr;
std::string::__init(v82, "color", 5u);
v48 = sub_714624((__int64)&v88, (__int64)v82);
if ( (v82[0] & 1) != 0 )
operator delete(v83);
if ( v48 )
{
*a4 = 2;
}
else
{
v84[0] = 0;
v84[1] = 0;
v85 = nullptr;
std::string::__init(v84, "color2", 6u);
v49 = sub_714624((__int64)&v88, (__int64)v84);
if ( (v84[0] & 1) != 0 )
operator delete(v85);
if ( v49 )
*a4 = 3;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if ( ((unsigned __int8)v88 & 1) != 0 )
operator delete(v90);
}
if ( (v53 & 1) != 0 )
operator delete(v55);
return _stack_chk_guard;
}
v20 = v19 + 1;
if ( (v53 & 1) != 0 )
{
v25 = v55;
v26 = v54;
}
else
{
v26 = (unsigned __int8)v53 >> 1;
v25 = (char *)&v53 + 1;
}
v19 = -1;
if ( v20 < v26 )
{
v32 = &v25[v20];
v33 = &v25[v26];
if ( &v25[v20] != v33 )
{
if ( v25[v20] == 95 )
{
LABEL_47:
v19 = v32 - v25;
}
else
{
while ( v33 != ++v32 )
{
if ( *v32 == 95 )
goto LABEL_47;
}
v19 = -1;
}
}
}
if ( v21 )
operator delete(v87);
}
}
v34 = (__int64 *)&v55[v54];
v19 = -1;
if ( v55 == &v55[v54] )
{
LABEL_60:
v18 = v54;
goto LABEL_11;
}
}
else
{
LODWORD(v18) = (int)(unsigned __int8)v53 >> 1;
if ( !(_DWORD)v18 )
goto LABEL_10;
v17 = (char *)&v53 + 1;
v19 = -1;
v34 = (__int64 *)((char *)&v53 + (int)v18 + 1);
if ( v34 == (__int64 *)((char *)&v53 + 1) )
goto LABEL_50;
}
v35 = v17;
if ( *v17 == 95 )
{
v19 = 0;
goto LABEL_59;
}
do
{
if ( v34 == (__int64 *)++v35 )
{
v19 = -1;
goto LABEL_59;
}
}
while ( *v35 != 95 );
v19 = v35 - v17;
LABEL_59:
LODWORD(v18) = (int)(unsigned __int8)v53 >> 1;
if ( (v53 & 1) != 0 )
goto LABEL_60;
LABEL_50:
v18 = (int)v18;
goto LABEL_11;
}
return _stack_chk_guard;
}