//
// MusicDownloadManager::createSongsInfo from 0x10064d520 to 0x10064d8ef (975 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetOnlineLevelsCompleted @ 0x100523785
// > sub_10055F180 @ 0x10055f90a
//
// 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:34:48 +0000
//
__int64 __fastcall MusicDownloadManager::createSongsInfo(__int128 *a1, unsigned __int8 *a2, __int128 *a3)
{
unsigned int v3; // eax
__int64 result; // rax
const char *v5; // rbx
size_t v6; // rax
size_t v7; // r15
char *v8; // r12
size_t v9; // r13
__int64 v10; // r14
unsigned int v11; // r12d
__int64 v12; // rax
const char *CString; // r15
size_t v14; // rax
size_t v15; // rbx
char *v16; // r13
char v17; // r13
size_t v18; // r14
__int64 v19; // r15
__int64 **i; // r14
__int64 v21; // rax
const std::string::value_type *v22; // rax
char v23; // [rsp+0h] [rbp-C0h]
__int128 *v24; // [rsp+8h] [rbp-B8h]
__int128 v25; // [rsp+10h] [rbp-B0h] BYREF
void *__p; // [rsp+20h] [rbp-A0h]
__int128 v27; // [rsp+30h] [rbp-90h] BYREF
void *v28; // [rsp+40h] [rbp-80h]
__int64 v29; // [rsp+50h] [rbp-70h]
__int64 v30; // [rsp+58h] [rbp-68h]
std::string __str; // [rsp+60h] [rbp-60h] BYREF
__int128 __dst; // [rsp+78h] [rbp-48h] BYREF
void *v33; // [rsp+88h] [rbp-38h]
char v34; // [rsp+97h] [rbp-29h]
v24 = a1;
v3 = *a2;
if ( (v3 & 1) != 0 )
{
result = *((_QWORD *)a2 + 1);
if ( !result )
return result;
}
else
{
result = v3 >> 1;
if ( !result )
return result;
}
if ( (*(_BYTE *)a3 & 1) != 0 )
{
a1 = &v25;
sub_10001AD30(&v25, *((const void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
__p = *((void **)a3 + 2);
v25 = *a3;
}
v29 = MusicDownloadManager::createArtistsInfo(a1, &v25);
if ( (v25 & 1) != 0 )
operator delete(__p);
if ( (*a2 & 1) != 0 )
v5 = *((const char **)a2 + 2);
else
v5 = (const char *)(a2 + 1);
v6 = strlen(v5);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_55:
sub_100003630();
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
v33 = v8;
*(_QWORD *)&__dst = v9 + 1;
*((_QWORD *)&__dst + 1) = v7;
goto LABEL_20;
}
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( v6 )
LABEL_20:
memmove(v8, v5, v7);
v8[v7] = 0;
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&__str.__r_.__value_.__l.0 + 1) = 8272510;
v10 = sub_10064DC00(&__dst, &__str);
if ( (__dst & 1) != 0 )
operator delete(v33);
result = sub_1007FEF90(v10);
if ( (_DWORD)result )
{
v11 = 0;
v30 = v10;
do
{
v12 = cocos2d::CCArray::stringAtIndex(v10, v11);
CString = (const char *)cocos2d::CCString::getCString(v12);
v14 = strlen(CString);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_55;
v15 = v14;
if ( v14 >= 0x17 )
{
v18 = (v14 | 7) + 1;
if ( (v14 | 7) == 0x17 )
v18 = 26;
v16 = (char *)operator new(v18);
v33 = v16;
*(_QWORD *)&__dst = v18 + 1;
v10 = v30;
*((_QWORD *)&__dst + 1) = v15;
}
else
{
LOBYTE(__dst) = 2 * v14;
v16 = (char *)&__dst + 1;
if ( !v14 )
{
BYTE1(__dst) = 0;
v17 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_30;
goto LABEL_35;
}
}
memmove(v16, CString, v15);
v16[v15] = 0;
v17 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_30:
v28 = v33;
v27 = __dst;
goto LABEL_36;
}
LABEL_35:
sub_10001AD30(&v27, v33, *((unsigned __int64 *)&__dst + 1));
LABEL_36:
v19 = MusicDownloadManager::addSongObjectFromString(v24, &v27);
if ( (v27 & 1) != 0 )
operator delete(v28);
if ( v29 != 0 && v19 != 0 && *(_QWORD *)(v19 + 512) )
{
v34 = v17;
memset(&__str, 0, sizeof(__str));
for ( i = *(__int64 ***)(v19 + 504); ; i = (__int64 **)*i )
{
if ( !i )
{
std::string::operator=((std::string *)(v19 + 464), &__str);
v10 = v30;
v17 = v34;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
goto LABEL_52;
}
if ( cocos2d::CCDictionary::objectForKey_1(v29, *((int *)i + 4)) )
break;
LABEL_41:
;
}
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
if ( !__str.__r_.__value_.__l.__size_ )
goto LABEL_49;
LABEL_48:
std::string::append(&__str, ",");
}
else if ( *(_BYTE *)&__str.__r_.__value_.__l.0 >> 1 )
{
goto LABEL_48;
}
LABEL_49:
v21 = sub_10088E820("%i,%s", v23);
v22 = (const std::string::value_type *)cocos2d::CCString::getCString(v21);
std::string::append(&__str, v22);
goto LABEL_41;
}
LABEL_52:
if ( (v17 & 1) != 0 )
operator delete(v33);
++v11;
result = sub_1007FEF90(v10);
}
while ( v11 < (unsigned int)result );
}
return result;
}