//
// GJChallengeItem::createFromString from 0x100055f70 to 0x10005612d (445 bytes)
//
// 3 xrefs:
// > sub_10052CE00 @ 0x10052d665
// > sub_10052CE00 @ 0x10052d795
// > sub_10052CE00 @ 0x10052d8c5
//
// 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 12:19:36 +0000
//
__int64 __fastcall GJChallengeItem::createFromString(unsigned __int8 *a1)
{
__int64 v1; // r13
__int64 result; // rax
__int64 v3; // rax
unsigned int v4; // r12d
__int64 v5; // rax
unsigned int v6; // r14d
__int64 v7; // rax
unsigned int v8; // r15d
__int64 v9; // rax
__int64 v10; // rax
const char *CString; // rbx
size_t v12; // rax
size_t v13; // r13
unsigned int v14; // r12d
char *v15; // r14
char v16; // r15
size_t v17; // r15
__int64 v18; // rbx
__int64 v19; // rbx
__int128 v20; // [rsp+0h] [rbp-70h] BYREF
void *__p; // [rsp+10h] [rbp-60h]
unsigned int v22; // [rsp+24h] [rbp-4Ch]
unsigned int v23; // [rsp+28h] [rbp-48h]
unsigned int v24; // [rsp+2Ch] [rbp-44h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *v26; // [rsp+40h] [rbp-30h]
v1 = sub_100034610(a1, ",");
if ( (unsigned int)sub_1007FEF90(v1) < 5 )
return 0;
v3 = cocos2d::CCArray::stringAtIndex(v1, 0);
v4 = cocos2d::CCString::intValue(v3);
v5 = cocos2d::CCArray::stringAtIndex(v1, 1);
v6 = cocos2d::CCString::intValue(v5);
v7 = cocos2d::CCArray::stringAtIndex(v1, 2);
v8 = cocos2d::CCString::intValue(v7);
v9 = cocos2d::CCArray::stringAtIndex(v1, 3);
v22 = cocos2d::CCString::intValue(v9);
v10 = cocos2d::CCArray::stringAtIndex(v1, 4);
CString = (const char *)cocos2d::CCString::getCString(v10);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v13 = v12;
v23 = v6;
v24 = v4;
v14 = v8;
if ( v12 >= 0x17 )
{
v17 = 26;
if ( (v12 | 7) != 0x17 )
v17 = (v12 | 7) + 1;
v15 = (char *)operator new(v17);
v26 = v15;
*(_QWORD *)&__dst = v17 + 1;
*((_QWORD *)&__dst + 1) = v13;
LABEL_11:
memmove(v15, CString, v13);
v15[v13] = 0;
v16 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_7;
LABEL_12:
sub_10001AD30(&v20, v26, *((unsigned __int64 *)&__dst + 1));
goto LABEL_13;
}
LOBYTE(__dst) = 2 * v12;
v15 = (char *)&__dst + 1;
if ( v12 )
goto LABEL_11;
BYTE1(__dst) = 0;
v16 = __dst;
if ( (__dst & 1) != 0 )
goto LABEL_12;
LABEL_7:
__p = v26;
v20 = __dst;
LABEL_13:
result = GJChallengeItem::create(v23, v14, v22, v24, &v20);
if ( (v20 & 1) != 0 )
{
v18 = result;
operator delete(__p);
result = v18;
}
if ( (v16 & 1) != 0 )
{
v19 = result;
operator delete(v26);
return v19;
}
return result;
}