//
// MusicDownloadManager::onGetCustomContentURLCompleted from 0x82d96c to 0x82dae4 (376 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::handleIt @ 0x836cfc
// > ??> @ 0x44058
//
// 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::onGetCustomContentURLCompleted(MusicDownloadManager *a1, const void **a2)
{
_DWORD *v4; // x22
unsigned __int64 v5; // x25
unsigned __int64 v6; // x20
size_t v7; // x2
int v8; // w19
__int64 v9; // x20
__int64 *v10; // x0
size_t v11; // x0
unsigned int *v13; // x22
int v14; // w1
const char *v15; // [xsp+58h] [xbp+58h]
void *v16; // [xsp+70h] [xbp+70h] BYREF
MusicDownloadManager::removeDLFromActive(a1, "get_c_url");
sub_D153B8((int)&v16, "-1");
v4 = v16;
v5 = *((_QWORD *)v16 - 3);
v6 = *((_QWORD *)*a2 - 3);
if ( v5 > v6 )
v7 = *((_QWORD *)*a2 - 3);
else
v7 = *((_QWORD *)v16 - 3);
v8 = memcmp(*a2, v16, v7);
if ( v8 || (v8 = 0x7FFFFFFF, v9 = v6 - v5, v9 > 0x7FFFFFFF) )
{
v10 = (__int64 *)(v4 - 6);
if ( v4 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v10 = (__int64 *)(v4 - 6);
if ( v9 >= (__int64)0xFFFFFFFF80000000LL )
v8 = v9;
else
v8 = 0x80000000;
if ( v10 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v13 = v4 - 2;
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(v4 - 2);
*(v4 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v10);
LABEL_7:
if ( v8 )
{
v15 = (const char *)*a2;
v11 = strlen((const char *)*a2);
sub_D1798C(&a1->m_customContentURL, v15, v11);
MusicDownloadManager::musicActionFinished(a1, DownloadOrUpdate);
}
else
{
MusicDownloadManager::musicActionFailed(a1, DownloadOrUpdate);
}
return _stack_chk_guard;
}