//
// MusicDownloadManager::generateCustomContentURL from 0x56fca4 to 0x570098 (1012 bytes)
//
// 9 xrefs:
// > MusicDownloadManager::downloadCustomSong @ 0x57012c
// > MusicDownloadManager::tryUpdateMusicLibrary @ 0x570412
// > MusicDownloadManager::downloadMusicLibrary @ 0x570532
// > MusicDownloadManager::downloadSFX @ 0x570708
// > MusicDownloadManager::tryUpdateSFXLibrary @ 0x57082e
// > MusicDownloadManager::downloadSFXLibrary @ 0x57094e
// > MusicDownloadManager::downloadNewsFeed @ 0x570ae6
// > MusicDownloadManager::downloadNewsImage @ 0x570cd2
// > MusicDownloadManager::tryUpdateNewsFeed @ 0x574610
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:36 +0000
//
int *__fastcall MusicDownloadManager::generateCustomContentURL(int *a1, int a2, int a3)
{
const char *v6; // r1
int v7; // r2
_BYTE *v8; // r3
cocos2d::CCString *v9; // r0
char *CString; // r11
size_t v11; // r0
unsigned int v12; // r3
unsigned int v13; // r2
size_t v14; // r2
unsigned int v15; // r3
int i; // r8
char *v17; // r3
int v18; // r0
size_t v19; // r0
const char *v20; // r1
int v21; // r2
unsigned __int8 *v22; // r3
_BYTE *v23; // r0
cocos2d::CCString *v24; // r0
const char *v25; // r0
const char *v26; // r4
size_t v27; // r0
__int64 v29; // [sp+18h] [bp-14Ch] BYREF
char v30; // [sp+20h] [bp-144h] BYREF
_BYTE v31[7]; // [sp+21h] [bp-143h] BYREF
_BYTE *v32; // [sp+28h] [bp-13Ch]
int v33[3]; // [sp+2Ch] [bp-138h] BYREF
_BYTE v34[12]; // [sp+38h] [bp-12Ch] BYREF
char v35; // [sp+44h] [bp-120h] BYREF
char v36; // [sp+45h] [bp-11Fh] BYREF
const char *v37; // [sp+4Ch] [bp-118h]
int v38[3]; // [sp+50h] [bp-114h] BYREF
unsigned __int8 v39[8]; // [sp+5Ch] [bp-108h] BYREF
unsigned __int8 *v40; // [sp+64h] [bp-100h]
int v41[3]; // [sp+68h] [bp-FCh] BYREF
int v42[3]; // [sp+74h] [bp-F0h] BYREF
int v43[3]; // [sp+80h] [bp-E4h] BYREF
int v44[3]; // [sp+8Ch] [bp-D8h] BYREF
int v45[3]; // [sp+98h] [bp-CCh] BYREF
int v46[3]; // [sp+A4h] [bp-C0h] BYREF
int v47[3]; // [sp+B0h] [bp-B4h] BYREF
int v48[3]; // [sp+BCh] [bp-A8h] BYREF
_DWORD v49[22]; // [sp+C8h] [bp-9Ch] BYREF
char v50[16]; // [sp+120h] [bp-44h] BYREF
char v51[36]; // [sp+130h] [bp-34h] BYREF
unsigned __int8 v52[8]; // [sp+154h] [bp-10h] BYREF
std::chrono::system_clock::now((std::chrono::system_clock *)&v29);
GameToolbox::intToString((GameToolbox *)&v30, v29 / 1000000 + 3600);
v49[2] = -1732584194;
v49[1] = -271733879;
v49[3] = 271733878;
v49[5] = 0;
v49[4] = 0;
v49[0] = 1732584193;
memset(v33, 0, sizeof(v33));
std::string::__init(v33, "DQIHAV8MVAUdDgBVVh0NBwQHHQEEDw8dDAQHBAdaAVNWAQkH", 0x30u);
GameToolbox::intToString((GameToolbox *)v34, 57709);
cocos2d::ZipUtils::base64DecodeEnc(&v35, v33, v34);
if ( (v35 & 1) != 0 )
v6 = v37;
else
v6 = &v36;
if ( (*(_BYTE *)a3 & 1) != 0 )
v7 = *(_DWORD *)(a3 + 8);
else
v7 = a3 + 1;
if ( (v30 & 1) != 0 )
v8 = v32;
else
v8 = v31;
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s%s%s", v6, v7, v8);
CString = (char *)cocos2d::CCString::getCString(v9);
std::string::~string((int)&v35);
std::string::~string((int)v34);
std::string::~string((int)v33);
v49[5] = 0;
v49[4] = 0;
v49[0] = 1732584193;
v49[1] = -271733879;
v49[2] = -1732584194;
v49[3] = 271733878;
v11 = strlen(CString);
MD5::Update((MD5 *)v49, (unsigned __int8 *)CString, v11);
MD5::Encode((int)v52, (unsigned __int8 *)&v49[4], (unsigned int *)byte_8, v12);
v13 = (v49[4] >> 3) & 0x3F;
if ( v13 > 0x37 )
v14 = 120 - v13;
else
v14 = 56 - v13;
MD5::Update((MD5 *)v49, byte_D1E184, v14);
MD5::Update((MD5 *)v49, v52, 8u);
MD5::Encode((int)v50, (unsigned __int8 *)v49, (unsigned int *)&word_10, v15);
memset(v49, 0, sizeof(v49));
for ( i = 0; i != 16; ++i )
{
v17 = (char *)v49 + i;
v18 = i + 52;
sub_993BD0((char *)v49 + 2 * v18, "%02x", (unsigned __int8)v17[88]);
}
memset(v38, 0, sizeof(v38));
v19 = strlen(v51);
std::string::__init(v38, v51, v19);
base64_encode(v39, v50, 16);
memset(v41, 0, sizeof(v41));
std::string::__init(v41, "=", 1u);
memset(v42, 0, sizeof(v42));
std::string::__init(v42, &unk_B6B226, 0);
sub_56FBF4((unsigned __int8 **)v39, (unsigned __int8 *)v41, (unsigned __int8 *)v42);
std::string::~string((int)v42);
std::string::~string((int)v41);
memset(v43, 0, sizeof(v43));
std::string::__init(v43, "\n", 1u);
memset(v44, 0, sizeof(v44));
std::string::__init(v44, &unk_B6B226, 0);
sub_56FBF4((unsigned __int8 **)v39, (unsigned __int8 *)v43, (unsigned __int8 *)v44);
std::string::~string((int)v44);
std::string::~string((int)v43);
memset(v45, 0, sizeof(v45));
std::string::__init(v45, "+", 1u);
memset(v46, 0, sizeof(v46));
std::string::__init(v46, "-", 1u);
sub_56FBF4((unsigned __int8 **)v39, (unsigned __int8 *)v45, (unsigned __int8 *)v46);
std::string::~string((int)v46);
std::string::~string((int)v45);
memset(v47, 0, sizeof(v47));
std::string::__init(v47, "/", 1u);
memset(v48, 0, sizeof(v48));
std::string::__init(v48, "_", 1u);
sub_56FBF4((unsigned __int8 **)v39, (unsigned __int8 *)v47, (unsigned __int8 *)v48);
std::string::~string((int)v48);
std::string::~string((int)v47);
if ( (*(_BYTE *)(a2 + 288) & 1) != 0 )
v20 = *(const char **)(a2 + 296);
else
v20 = (const char *)(a2 + 289);
if ( (*(_BYTE *)a3 & 1) != 0 )
v21 = *(_DWORD *)(a3 + 8);
else
v21 = a3 + 1;
if ( (v39[0] & 1) != 0 )
v22 = v40;
else
v22 = &v39[1];
if ( (v30 & 1) != 0 )
v23 = v32;
else
v23 = v31;
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s%s?token=%s&expires=%s",
v20,
v21,
v22,
v23);
v25 = (const char *)cocos2d::CCString::getCString(v24);
*a1 = 0;
a1[1] = 0;
v26 = v25;
a1[2] = 0;
v27 = strlen(v25);
std::string::__init(a1, v26, v27);
std::string::~string((int)v39);
std::string::~string((int)v38);
std::string::~string((int)&v30);
return a1;
}