//
// AchievementManager::getAllAchievementsSorted from 0x14003c320 to 0x14003c55d (573 bytes)
//
// 3 xrefs:
// > AchievementManager::init @ 0x14000a10e
// > AchievementManager::init @ 0x14000a128
// > ??> @ 0x14090effc
//
// 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 11:25:27 +0000
//
// Hidden C++ exception states: #wind=2
cocos2d::CCArray *__fastcall AchievementManager::getAllAchievementsSorted(__int64 a1, char a2)
{
cocos2d::CCArray *v4; // r14
cocos2d::CCArray *v5; // rbp
unsigned int v6; // edi
__m128i si128; // xmm7
__m128i v8; // xmm6
cocos2d::CCString *v9; // rax
const char *CString; // rax
__int64 v11; // r8
struct cocos2d::CCObject *v12; // rsi
void *v13; // rcx
__int64 v14; // rbx
void *v15; // rcx
__int128 v17; // [rsp+30h] [rbp-98h] BYREF
__m128i v18; // [rsp+40h] [rbp-88h]
__int128 v19; // [rsp+50h] [rbp-78h] BYREF
__m128i v20; // [rsp+60h] [rbp-68h]
v4 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 328));
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create();
v6 = 0;
if ( cocos2d::CCArray::count(v4) )
{
si128 = _mm_load_si128((const __m128i *)&xmmword_140836530);
v8 = _mm_load_si128((const __m128i *)&Size);
do
{
v9 = cocos2d::CCArray::objectAtIndex(v4, v6);
CString = cocos2d::CCString::getCString(v9);
v17 = 0;
v18 = 0;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003D230(&v17);
v12 = (struct cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 328), &v17);
if ( v18.m128i_i64[1] > 0xFuLL )
{
v13 = (void *)v17;
if ( (unsigned __int64)(v18.m128i_i64[1] + 1) >= 0x1000 )
{
v13 = *(void **)(v17 - 8);
if ( (unsigned __int64)(v17 - (_QWORD)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
v18 = v8;
LOBYTE(v17) = 0;
if ( !a2 )
goto LABEL_15;
v19 = 0;
v20 = si128;
strcpy((char *)&v19, "un");
v14 = cocos2d::CCDictionary::objectForKey(v12, &v19);
if ( v20.m128i_i64[1] > 0xFuLL )
{
v15 = (void *)v19;
if ( (unsigned __int64)(v20.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *(void **)(v19 - 8);
if ( (unsigned __int64)(v19 - (_QWORD)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
if ( !v14 )
LABEL_15:
cocos2d::CCArray::addObject(v5, v12);
++v6;
}
while ( v6 < cocos2d::CCArray::count(v4) );
}
if ( cocos2d::CCArray::count(v5) )
qsort(
*(void **)(*((_QWORD *)v5 + 7) + 16LL),
**((unsigned int **)v5 + 7),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)CompareFunction);
return v5;
}