//
// sub_1003AFD0C from 0x1003afd0c to 0x1003b0344 (1592 bytes)
//
// 5 xrefs:
// > GameManager::completedAchievement @ 0x1003b0458
// > GameManager::resetAchievement @ 0x1003b0548
// > ShardsPage::init @ 0x100449370
// > sub_10045F6C4 @ 0x10046022c
// > sub_100460E04 @ 0x100460e90
//
// 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 11:03:53 +0000
//
void __fastcall sub_1003AFD0C(__int64 a1, char *a2, _DWORD *a3, int *a4)
{
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x21
__int64 v10; // x0
__int64 v11; // x22
__int64 v12; // x0
char *CString; // x0
_QWORD *v14; // x21
std::string *p_str; // x8
std::string::size_type size; // x24
std::string *v17; // x9
std::string::size_type v18; // x11
std::string *v19; // x10
__int64 v20; // x8
__int64 v21; // x25
std::string::size_type v22; // x22
std::string *p_p; // x1
__int64 v24; // x26
bool v25; // zf
std::string::size_type v26; // x11
std::string *v27; // x8
_BYTE *v28; // x9
_BYTE *v29; // x10
std::string::size_type v30; // x11
__int64 v31; // x8
unsigned int v32; // w0
__int64 v33; // x0
char *v34; // x0
__int64 v35; // x0
bool v36; // w0
bool v37; // w20
int v38; // w8
bool v39; // w0
bool v40; // w20
bool v41; // w20
bool v42; // w20
bool v43; // w20
bool v44; // w20
bool v45; // w20
bool v46; // w20
bool v47; // w20
bool v48; // w20
bool v49; // w20
bool v50; // w20
bool v51; // w20
bool v52; // w20
bool v53; // w20
std::string __str; // [xsp+8h] [xbp-88h] BYREF
std::allocator __a[23]; // [xsp+20h] [xbp-70h] BYREF
char v56; // [xsp+37h] [xbp-59h]
std::string __p; // [xsp+38h] [xbp-58h] BYREF
*a3 = 0;
*a4 = 0;
v7 = AchievementManager::sharedState();
if ( a2[23] < 0 )
a2 = *(char **)a2;
v8 = sub_10010E3AC(v7, a2);
if ( !v8 )
return;
v9 = v8;
sub_100009900(&__p, "icon");
v10 = cocos2d::CCDictionary::objectForKey(v9, &__p);
v11 = v10;
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(__p.__r_.__value_.__l.__data_);
if ( !v11 )
return;
}
else if ( !v10 )
{
return;
}
sub_100009900(&__p, "icon");
v12 = cocos2d::CCDictionary::objectForKey(v9, &__p);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_100009900(&__str, CString);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v14 = sub_1002E736C();
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_str = &__str;
else
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
else
size = __str.__r_.__value_.__l.__size_;
if ( size )
{
v17 = (std::string *)((char *)p_str + size);
v18 = size;
v19 = p_str;
while ( v19->__r_.__value_.__s.__data_[0] != 95 )
{
v19 = (std::string *)((char *)v19 + 1);
if ( !--v18 )
{
v19 = (std::string *)((char *)p_str + size);
break;
}
}
v20 = (char *)v19 - (char *)p_str;
if ( v19 == v17 )
v21 = -1;
else
v21 = v20;
}
else
{
v21 = -1;
}
v22 = 0;
do
{
std::string::basic_string(&__p, &__str, v22, v21 - v22, __a);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v22 == size && !__p.__r_.__value_.__l.__size_ )
goto LABEL_35;
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
}
else
{
if ( v22 == size && !*((_BYTE *)&__p.__r_.__value_.__s + 23) )
goto LABEL_35;
p_p = &__p;
}
sub_100009900(__a, (char *)p_p);
sub_1003064AC((__int128 *)__a);
sub_1002E74E0((__int64)v14);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
LABEL_35:
if ( v21 == -1 )
goto LABEL_36;
v22 = v21 + 1;
v26 = __str.__r_.__value_.__l.__size_;
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v27 = &__str;
else
v27 = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v26 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( v26 <= v22 )
{
LABEL_36:
v24 = -1;
}
else
{
v28 = (char *)v27 + v26;
v29 = (char *)v27 + v22;
v30 = ~v21 + v26;
while ( *v29 != 95 )
{
++v29;
if ( !--v30 )
{
v29 = v28;
break;
}
}
v31 = v29 - (_BYTE *)v27;
if ( v29 == v28 )
v24 = -1;
else
v24 = v31;
}
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v25 = v21 == -1;
v21 = v24;
}
while ( !v25 );
v32 = sub_1002E757C((__int64)v14);
if ( v32 < 2 )
goto LABEL_119;
v33 = sub_1002E75A0((__int64)v14, 0);
v34 = (char *)cocos2d::CCString::getCString(v33);
sub_100009900(&__p, v34);
v35 = sub_1002E75A0((__int64)v14, 1u);
*a3 = cocos2d::CCString::intValue(v35);
sub_100009900(__a, "icon");
v36 = sub_1000045BC(&__p, __a);
v37 = v36;
if ( v56 < 0 )
{
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( !v37 )
goto LABEL_60;
LABEL_58:
v38 = 1;
LABEL_116:
*a4 = v38;
goto LABEL_117;
}
if ( v36 )
goto LABEL_58;
LABEL_60:
sub_100009900(__a, "ship");
v39 = sub_1000045BC(&__p, __a);
v40 = v39;
if ( v56 < 0 )
{
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( !v40 )
goto LABEL_64;
LABEL_62:
v38 = 4;
goto LABEL_116;
}
if ( v39 )
goto LABEL_62;
LABEL_64:
sub_100009900(__a, "ball");
v41 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v41 )
{
v38 = 5;
goto LABEL_116;
}
sub_100009900(__a, "bird");
v42 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v42 )
{
v38 = 6;
goto LABEL_116;
}
sub_100009900(__a, "dart");
v43 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v43 )
{
v38 = 7;
goto LABEL_116;
}
sub_100009900(__a, "special");
v44 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v44 )
{
v38 = 10;
goto LABEL_116;
}
sub_100009900(__a, "robot");
v45 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v45 )
{
v38 = 8;
goto LABEL_116;
}
sub_100009900(__a, "spider");
v46 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v46 )
{
v38 = 9;
goto LABEL_116;
}
sub_100009900(__a, "death");
v47 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v47 )
{
v38 = 11;
goto LABEL_116;
}
sub_100009900(__a, "item");
v48 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v48 )
{
v38 = 12;
goto LABEL_116;
}
sub_100009900(__a, "swing");
v49 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v49 )
{
v38 = 13;
goto LABEL_116;
}
sub_100009900(__a, "jetpack");
v50 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v50 )
{
v38 = 14;
goto LABEL_116;
}
sub_100009900(__a, "shipstreak");
v51 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v51 )
{
v38 = 15;
goto LABEL_116;
}
sub_100009900(__a, "color");
v52 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v52 )
{
v38 = 2;
goto LABEL_116;
}
sub_100009900(__a, "color2");
v53 = sub_1000045BC(&__p, __a);
if ( v56 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
if ( v53 )
{
v38 = 3;
goto LABEL_116;
}
LABEL_117:
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
LABEL_119:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}