//
// MusicDownloadManager::addSongObjectFromString from 0x140482dc0 to 0x140483133 (883 bytes)
//
// 3 xrefs:
// > MusicDownloadManager::onGetSongInfoCompleted @ 0x140482d61
// > MusicDownloadManager::createSongsInfo @ 0x140483441
// > ??> @ 0x140928a0c
//
// 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:32:45 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall MusicDownloadManager::addSongObjectFromString(__int64 a1, __int64 a2)
{
__int64 v4; // rax
__int64 v5; // rcx
__int64 v6; // r15
__int64 v7; // rdi
cocos2d::CCString *v9; // rax
const char *CString; // rax
size_t v11; // rbx
size_t v12; // r8
_QWORD *v13; // rsi
void *v14; // rax
void **v15; // rcx
void *v16; // rdx
void **v17; // rcx
void *v18; // rdx
void **v19; // rcx
void *v20; // rdx
cocos2d::CCString *v21; // rax
bool v22; // si
void *v23; // r8
cocos2d::CCString *v24; // rax
const char *v25; // rax
void *v26; // rcx
_BYTE v27[32]; // [rsp+38h] [rbp-21h] BYREF
__int64 v28; // [rsp+58h] [rbp-1h]
void *Block[2]; // [rsp+60h] [rbp+7h] BYREF
__m128i si128; // [rsp+70h] [rbp+17h]
v28 = a2;
v4 = sub_14003F4F0((__int64)v27, a2);
v6 = MusicDownloadManager::responseToDict(v5, v4);
v7 = SongInfoObject::create_2(v6);
if ( *(_DWORD *)(v7 + 320) )
{
v9 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8);
CString = cocos2d::CCString::getCString(v9);
*(_OWORD *)Block = 0;
si128 = 0;
v11 = -1;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003D230(Block, CString, v12);
v13 = (_QWORD *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 344), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v14 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
if ( v13 )
{
if ( !*(_QWORD *)(v7 + 616) )
SongInfoObject::setSongLinks(v7, v13 + 75);
if ( !*(_QWORD *)(v7 + 648) )
SongInfoObject::setArtistLinks(v7, v13 + 79);
v15 = (void **)(v7 + 392);
if ( !*(_QWORD *)(v7 + 408) && v15 != v13 + 49 )
{
v16 = v13 + 49;
if ( v13[52] > 0xFu )
v16 = (void *)v13[49];
sub_1400405A0(v15, v16, v13[51]);
}
v17 = (void **)(v7 + 440);
if ( !*(_QWORD *)(v7 + 456) && v17 != v13 + 55 )
{
v18 = v13 + 55;
if ( v13[58] > 0xFu )
v18 = (void *)v13[55];
sub_1400405A0(v17, v18, v13[57]);
}
v19 = (void **)(v7 + 504);
if ( !*(_QWORD *)(v7 + 520) && v19 != v13 + 63 )
{
v20 = v13 + 63;
if ( v13[66] > 0xFu )
v20 = (void *)v13[63];
sub_1400405A0(v19, v20, v13[65]);
}
}
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_140836520);
LOWORD(Block[0]) = 56;
v21 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v6, Block);
v22 = cocos2d::CCString::boolValue(v21);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v23 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v23 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v23 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v23);
}
*(_BYTE *)(v7 + 473) = !v22;
v24 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, *(unsigned int *)(v7 + 320));
v25 = cocos2d::CCString::getCString(v24);
*(_OWORD *)Block = 0;
si128 = 0;
do
++v11;
while ( v25[v11] );
sub_14003D230(Block, v25, v11);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 344), v7, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v26 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v26 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
sub_14003D310(a2);
return v7;
}
else
{
sub_14003D310(a2);
return 0;
}
}