//
// achievementCompare from 0x4ee01c to 0x4ee1ec (464 bytes)
//
// 3 xrefs:
// > ??> @ 0x6cba0
// > AchievementManager::getAllAchievementsSorted @ 0x5529cc
// > ??> @ 0x122b908
//
// 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
//
__int64 __fastcall achievementCompare(cocos2d::CCDictionary **a1, cocos2d::CCDictionary **a2)
{
cocos2d::CCDictionary *v2; // x19
cocos2d::CCDictionary *v3; // x24
cocos2d::CCString *v4; // x0
float v5; // s0
char *v6; // x0
float v7; // s9
cocos2d::CCString *v8; // x0
float v9; // s0
char *v10; // x0
float v11; // s0
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
float v17; // [xsp+50h] [xbp+50h]
std::string v18; // [xsp+70h] [xbp+70h] BYREF
v2 = *a1;
v3 = *a2;
sub_D153B8((int)&v18, "order");
v4 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v2, &v18);
v5 = cocos2d::CCString::floatValue(v4);
v6 = (char *)v18.m_data.m_data - 24;
v7 = v5 * 1000.0;
if ( (__int64 *)v18.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)((char *)v18.m_data.m_data - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v18.m_data.m_data - 2);
*((_DWORD *)v18.m_data.m_data - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v18, "order");
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v3, &v18);
v9 = cocos2d::CCString::floatValue(v8);
v10 = (char *)v18.m_data.m_data - 24;
v11 = v9 * 1000.0;
if ( (__int64 *)v18.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)((char *)v18.m_data.m_data - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v18.m_data.m_data - 2);
*((_DWORD *)v18.m_data.m_data - 2) = v16 - 1;
}
if ( v16 <= 0 )
{
v17 = v11;
operator delete(v10);
v11 = v17;
}
}
return (unsigned int)(int)(float)(v7 - v11);
}