//
// MusicDownloadManager::linkTypeForURL from 0x570d6c to 0x5712d0 (1380 bytes)
//
// 4 xrefs:
// > sub_53B0D8 @ 0x53b1a8
// > SongInfoObject::createWithCoder @ 0x578684
// > MusicDownloadManager::parseMusicLibrary @ 0x578aae
// > MusicDownloadManager::parseMusicLibrary @ 0x578eec
//
// 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:37 +0000
//
int __fastcall MusicDownloadManager::linkTypeForURL(int a1)
{
unsigned __int8 *v1; // r7
unsigned int v2; // r5
unsigned __int8 *v3; // r5
int v4; // r0
unsigned int v5; // r1
unsigned __int8 *v6; // r2
size_t v7; // r3
int v8; // r0
unsigned int v9; // r1
unsigned __int8 *v10; // r2
unsigned __int8 *v11; // r7
int v12; // r3
char *v13; // r5
unsigned __int8 *v14; // r3
char *v15; // r8
int v16; // t1
int v17; // r0
unsigned int v18; // r1
unsigned __int8 *v19; // r2
int v20; // r5
int v21; // r7
int v22; // r7
int v23; // r5
int v24; // r7
int v25; // r5
int v26; // r8
int v27; // r7
int v28; // r8
int v29; // r8
int v30; // r7
int v31; // r8
int v32; // r5
int v33; // r5
unsigned __int8 *v35; // [sp+14h] [bp-118h] BYREF
int v36; // [sp+1Ch] [bp-110h] BYREF
unsigned int v37; // [sp+20h] [bp-10Ch]
unsigned __int8 *v38; // [sp+24h] [bp-108h]
int v39; // [sp+28h] [bp-104h] BYREF
unsigned int v40; // [sp+2Ch] [bp-100h]
unsigned __int8 *v41; // [sp+30h] [bp-FCh]
int v42; // [sp+34h] [bp-F8h] BYREF
unsigned int v43; // [sp+38h] [bp-F4h]
unsigned __int8 *v44; // [sp+3Ch] [bp-F0h]
int v45; // [sp+40h] [bp-ECh] BYREF
unsigned int v46; // [sp+44h] [bp-E8h]
unsigned __int8 *v47; // [sp+48h] [bp-E4h]
int v48[3]; // [sp+4Ch] [bp-E0h] BYREF
int v49[3]; // [sp+58h] [bp-D4h] BYREF
int v50[3]; // [sp+64h] [bp-C8h] BYREF
int v51[3]; // [sp+70h] [bp-BCh] BYREF
int v52[3]; // [sp+7Ch] [bp-B0h] BYREF
int v53[3]; // [sp+88h] [bp-A4h] BYREF
int v54[3]; // [sp+94h] [bp-98h] BYREF
int v55[3]; // [sp+A0h] [bp-8Ch] BYREF
int v56[3]; // [sp+ACh] [bp-80h] BYREF
int v57[3]; // [sp+B8h] [bp-74h] BYREF
int v58[3]; // [sp+C4h] [bp-68h] BYREF
int v59[3]; // [sp+D0h] [bp-5Ch] BYREF
int v60[3]; // [sp+DCh] [bp-50h] BYREF
int v61[3]; // [sp+E8h] [bp-44h] BYREF
int v62[3]; // [sp+F4h] [bp-38h] BYREF
int v63[3]; // [sp+100h] [bp-2Ch] BYREF
int v64[3]; // [sp+10Ch] [bp-20h] BYREF
int v65[3]; // [sp+118h] [bp-14h] BYREF
std::string::basic_string(&v36, a1);
if ( (v36 & 1) != 0 )
{
v1 = v38;
v2 = v37;
}
else
{
v2 = (int)(unsigned __int8)v36 >> 1;
v1 = (unsigned __int8 *)&v36 + 1;
}
if ( v2 > 2 )
{
v3 = &v1[v2];
std::__search(
&v35,
v1,
v3,
"://",
(unsigned __int8 *)"",
(int (__fastcall *)(int, _DWORD))std::char_traits::eq);
if ( v35 != v3 && v35 - v1 != -1 )
{
std::string::basic_string(&v39, (unsigned __int8 *)&v36, v35 - v1 + 3, 0xFFFFFFFF);
if ( (v36 & 1) != 0 )
{
*v38 = 0;
v37 = 0;
}
else
{
LOWORD(v36) = 0;
}
std::string::reserve(&v36, 0);
v4 = v39;
v5 = v40;
v6 = v41;
v39 = 0;
v40 = 0;
v41 = nullptr;
v36 = v4;
v37 = v5;
v38 = v6;
std::string::~string((int)&v39);
}
}
v7 = std::string::find((unsigned __int8 *)&v36, 47, 0);
if ( v7 != -1 )
{
std::string::basic_string(&v42, (unsigned __int8 *)&v36, 0, v7);
if ( (v36 & 1) != 0 )
{
*v38 = 0;
v37 = 0;
}
else
{
LOWORD(v36) = 0;
}
std::string::reserve(&v36, 0);
v8 = v42;
v9 = v43;
v10 = v44;
v42 = 0;
v43 = 0;
v44 = nullptr;
v36 = v8;
v37 = v9;
v38 = v10;
std::string::~string((int)&v42);
}
if ( (v36 & 1) != 0 )
{
v11 = v38;
v12 = v37;
}
else
{
v12 = (int)(unsigned __int8)v36 >> 1;
v11 = (unsigned __int8 *)&v36 + 1;
}
v13 = (char *)&v11[v12];
if ( (v36 & 1) != 0 )
v14 = v38;
else
v14 = (unsigned __int8 *)&v36 + 1;
v15 = (char *)(v14 - 1);
while ( v11 != (unsigned __int8 *)v13 )
{
v16 = *v11++;
*++v15 = tolower(v16);
}
if ( !std::string::compare((unsigned __int8 *)&v36, 0, 4u, "www.", 4u) )
{
std::string::basic_string(&v45, (unsigned __int8 *)&v36, 4u, 0xFFFFFFFF);
if ( (v36 & 1) != 0 )
{
*v38 = 0;
v37 = 0;
}
else
{
LOWORD(v36) = 0;
}
std::string::reserve(&v36, 0);
v17 = v45;
v18 = v46;
v19 = v47;
v45 = 0;
v46 = 0;
v47 = nullptr;
v36 = v17;
v37 = v18;
v38 = v19;
std::string::~string((int)&v45);
}
memset(v48, 0, sizeof(v48));
std::string::__init(v48, "youtube.com", 0xBu);
v20 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v48);
if ( !v20 )
{
memset(v49, 0, sizeof(v49));
std::string::__init(v49, "youtu.be", 8u);
v20 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v49);
std::string::~string((int)v49);
}
std::string::~string((int)v48);
if ( v20 )
{
v33 = 1;
}
else
{
memset(v50, 0, sizeof(v50));
std::string::__init(v50, "newgrounds.com", 0xEu);
v21 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v50);
std::string::~string((int)v50);
if ( v21 )
{
v33 = 2;
}
else
{
memset(v51, 0, sizeof(v51));
std::string::__init(v51, "soundcloud.com", 0xEu);
v22 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v51);
std::string::~string((int)v51);
if ( v22 )
{
v33 = 3;
}
else
{
memset(v52, 0, sizeof(v52));
std::string::__init(v52, "spotify.com", 0xBu);
v23 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v52);
if ( !v23 )
{
memset(v53, 0, sizeof(v53));
std::string::__init(v53, "spotify.link", 0xCu);
v23 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v53);
std::string::~string((int)v53);
}
std::string::~string((int)v52);
if ( v23 )
{
v33 = 4;
}
else
{
memset(v54, 0, sizeof(v54));
std::string::__init(v54, "bandcamp.com", 0xCu);
v24 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v54);
std::string::~string((int)v54);
if ( v24 )
{
v33 = 5;
}
else
{
memset(v55, 0, sizeof(v55));
std::string::__init(v55, "ncs.io", 6u);
v25 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v55);
if ( !v25 )
{
memset(v56, 0, sizeof(v56));
std::string::__init(v56, "ncs.lnk.to", 0xAu);
v25 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v56);
std::string::~string((int)v56);
}
std::string::~string((int)v55);
if ( v25 )
{
v33 = 6;
}
else
{
memset(v57, 0, sizeof(v57));
std::string::__init(v57, "instagram.com", 0xDu);
v26 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v57);
std::string::~string((int)v57);
if ( v26 )
{
v33 = 8;
}
else
{
memset(v58, 0, sizeof(v58));
std::string::__init(v58, "twitter.com", 0xBu);
v27 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v58);
if ( !v27 )
{
memset(v59, 0, sizeof(v59));
std::string::__init(v59, "x.com", 5u);
v27 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v59);
std::string::~string((int)v59);
}
std::string::~string((int)v58);
if ( v27 )
{
v33 = 9;
}
else
{
memset(v60, 0, sizeof(v60));
std::string::__init(v60, "facebook.com", 0xCu);
v28 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v60);
std::string::~string((int)v60);
if ( v28 )
{
v33 = 10;
}
else
{
memset(v61, 0, sizeof(v61));
std::string::__init(v61, "twitch.tv", 9u);
v29 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v61);
std::string::~string((int)v61);
if ( v29 )
{
v33 = 11;
}
else
{
memset(v62, 0, sizeof(v62));
std::string::__init(v62, "discord.gg", 0xAu);
v30 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v62);
if ( !v30 )
{
memset(v63, 0, sizeof(v63));
std::string::__init(v63, "discord.com", 0xBu);
v30 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v63);
std::string::~string((int)v63);
}
std::string::~string((int)v62);
if ( v30 )
{
v33 = 12;
}
else
{
memset(v64, 0, sizeof(v64));
std::string::__init(v64, "tiktok.com", 0xAu);
v31 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v64);
std::string::~string((int)v64);
if ( v31 )
{
v33 = 13;
}
else
{
memset(v65, 0, sizeof(v65));
std::string::__init(v65, "itch.io", 7u);
v32 = sub_56EF80((unsigned __int8 *)&v36, (unsigned __int8 *)v65);
std::string::~string((int)v65);
if ( v32 )
v33 = 14;
else
v33 = 7;
}
}
}
}
}
}
}
}
}
}
}
}
std::string::~string((int)&v36);
return v33;
}