//
// GJChallengeItem::createFromString from 0x7ad9c4 to 0x7adbec (552 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetGJChallengesCompleted @ 0x6fe5b0
// > ??> @ 0x33390
//
// 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 GJChallengeItem::createFromString(_QWORD *a1)
{
cocos2d::CCArray *v1; // x20
cocos2d::CCString *v2; // x0
int v3; // w23
cocos2d::CCString *v4; // x0
int v5; // w26
cocos2d::CCString *v6; // x0
int v7; // w25
cocos2d::CCString *v8; // x0
int v9; // w24
cocos2d::CCString *v10; // x0
char *CString; // x0
__int64 v12; // x21
void *v13; // x0
void *v14; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
__int64 v20; // [xsp+0h] [xbp+0h] BYREF
__int64 v21; // [xsp+58h] [xbp+58h]
__int64 v22; // [xsp+60h] [xbp+60h] BYREF
v1 = sub_7A19E8(a1, &byte_F804F8);
if ( (unsigned int)cocos2d::CCArray::count(v1) <= 4 )
return 0;
v2 = cocos2d::CCArray::stringAtIndex(v1, 0);
v3 = cocos2d::CCString::intValue(v2);
v4 = cocos2d::CCArray::stringAtIndex(v1, 1u);
v5 = cocos2d::CCString::intValue(v4);
v6 = cocos2d::CCArray::stringAtIndex(v1, 2u);
v7 = cocos2d::CCString::intValue(v6);
v8 = cocos2d::CCArray::stringAtIndex(v1, 3u);
v9 = cocos2d::CCString::intValue(v8);
v10 = cocos2d::CCArray::stringAtIndex(v1, 4u);
CString = (char *)cocos2d::CCString::getCString(v10);
sub_D153B8((unsigned int)&v20 + 88, CString);
sub_D18D28(&v22);
v12 = GJChallengeItem::create(v5, v7, v9, v3);
v13 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v22 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
v14 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v21 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v21 - 8);
*(_DWORD *)(v21 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v14);
}
return v12;
}