//
// MusicDownloadManager::onGetSongInfoCompleted from 0x836970 to 0x836c88 (792 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::handleIt @ 0x836d84
// > ??> @ 0xb3190
//
// 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 MusicDownloadManager::onGetSongInfoCompleted(
MusicDownloadManager *a1,
const void **a2,
const char **a3)
{
int v5; // w25
const char *SongInfoKey; // x0
_DWORD *v7; // x27
unsigned __int64 v8; // x28
unsigned __int64 v9; // x20
size_t v10; // x2
int v11; // w19
__int64 v12; // x20
__int64 *v13; // x0
_DWORD *v14; // x27
unsigned __int64 v15; // x28
unsigned __int64 v16; // x26
size_t v17; // x2
int v18; // w19
__int64 v19; // x26
__int64 *v20; // x0
SongInfoObject *v21; // x27
char *v22; // x23
unsigned int *v24; // x27
int v25; // w1
unsigned int *v26; // x27
int v27; // w1
unsigned int *v28; // x19
int v29; // w0
void *v30; // [xsp+70h] [xbp+70h] BYREF
v5 = atoi(*a3);
SongInfoKey = MusicDownloadManager::getSongInfoKey(a1, v5);
MusicDownloadManager::removeDLFromActive(a1, SongInfoKey);
sub_D153B8((int)&v30, "-1");
v7 = v30;
v8 = *((_QWORD *)v30 - 3);
v9 = *((_QWORD *)*a2 - 3);
if ( v8 > v9 )
v10 = *((_QWORD *)*a2 - 3);
else
v10 = *((_QWORD *)v30 - 3);
v11 = memcmp(*a2, v30, v10);
if ( v11 || (v11 = 0x7FFFFFFF, v12 = v9 - v8, v12 > 0x7FFFFFFF) )
{
v13 = (__int64 *)(v7 - 6);
if ( v7 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v13 = (__int64 *)(v7 - 6);
if ( v12 >= (__int64)0xFFFFFFFF80000000LL )
v11 = v12;
else
v11 = 0x80000000;
if ( v13 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v24 = v7 - 2;
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(v7 - 2);
*(v7 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v13);
LABEL_7:
if ( !v11 )
{
LABEL_25:
MusicDownloadManager::loadSongInfoFailed(a1, v5, FailedToFetch);
return _stack_chk_guard;
}
sub_D153B8((int)&v30, "-2");
v14 = v30;
v15 = *((_QWORD *)v30 - 3);
v16 = *((_QWORD *)*a2 - 3);
if ( v15 > v16 )
v17 = *((_QWORD *)*a2 - 3);
else
v17 = *((_QWORD *)v30 - 3);
v18 = memcmp(*a2, v30, v17);
if ( v18 || (v18 = 0x7FFFFFFF, v19 = v16 - v15, v19 > 0x7FFFFFFF) )
{
v20 = (__int64 *)(v14 - 6);
if ( v14 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_14;
}
else
{
v20 = (__int64 *)(v14 - 6);
if ( v19 >= (__int64)0xFFFFFFFF80000000LL )
v18 = v19;
else
v18 = 0x80000000;
if ( v20 == &qword_124B6B0 )
{
LABEL_14:
if ( v18 )
goto LABEL_15;
LABEL_24:
MusicDownloadManager::loadSongInfoFailed(a1, v5, NotAllowed);
return _stack_chk_guard;
}
}
if ( &pthread_create )
{
v26 = v14 - 2;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(v14 - 2);
*(v14 - 2) = v27 - 1;
}
if ( v27 > 0 )
goto LABEL_14;
operator delete(v20);
if ( !v18 )
goto LABEL_24;
LABEL_15:
sub_D18D28(&v30);
v21 = MusicDownloadManager::addSongObjectFromString((__int64)a1);
v22 = (char *)v30 - 24;
if ( (char *)v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)((char *)v30 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v22);
}
if ( !v21 )
goto LABEL_25;
MusicDownloadManager::loadSongInfoFinished(a1, v21);
return _stack_chk_guard;
}