//
// MusicDownloadManager::linkTypeForURL from 0x969e18 to 0x96a7ec (2516 bytes)
//
// 5 xrefs:
// > sub_9040E0 @ 0x90427c
// > SongInfoObject::createWithCoder @ 0x976698
// > MusicDownloadManager::parseMusicLibrary @ 0x976f7c
// > MusicDownloadManager::parseMusicLibrary @ 0x9776d8
// > ??> @ 0xd3840
//
// This function is hookable on this platform (idp: arm, 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 12:57:37 +0000
//
__int64 __fastcall MusicDownloadManager::linkTypeForURL(char *a1)
{
char v2; // w0
__int64 v3; // x0
__int64 v4; // x1
char *v5; // x21
unsigned __int64 v6; // x0
char *v7; // x19
__int64 v8; // x0
size_t v9; // x3
char *v10; // x19
char *v11; // x21
bool v12; // w0
_BOOL4 v13; // w21
unsigned int v14; // w19
_BOOL4 v16; // w21
_BOOL4 v17; // w21
bool v18; // w0
_BOOL4 v19; // w21
_BOOL4 v20; // w21
bool v21; // w0
_BOOL4 v22; // w21
_BOOL4 v23; // w21
bool v24; // w0
_BOOL4 v25; // w21
_BOOL4 v26; // w21
_BOOL4 v27; // w21
bool v28; // w0
_BOOL4 v29; // w21
_BOOL4 v30; // w21
_BOOL4 v31; // w19
__int64 v32; // [xsp+48h] [xbp+48h] BYREF
__int64 v33; // [xsp+50h] [xbp+50h]
char *v34; // [xsp+58h] [xbp+58h]
__int64 v35[3]; // [xsp+60h] [xbp+60h] BYREF
__int64 v36[3]; // [xsp+78h] [xbp+78h] BYREF
__int64 v37[3]; // [xsp+90h] [xbp+90h] BYREF
__int64 v38[2]; // [xsp+A8h] [xbp+A8h] BYREF
void *v39; // [xsp+B8h] [xbp+B8h]
__int64 v40[2]; // [xsp+C0h] [xbp+C0h] BYREF
void *v41; // [xsp+D0h] [xbp+D0h]
__int64 v42[2]; // [xsp+D8h] [xbp+D8h] BYREF
void *v43; // [xsp+E8h] [xbp+E8h]
__int64 v44[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v45; // [xsp+100h] [xbp+100h]
__int64 v46[2]; // [xsp+108h] [xbp+108h] BYREF
void *v47; // [xsp+118h] [xbp+118h]
__int64 v48[2]; // [xsp+120h] [xbp+120h] BYREF
void *v49; // [xsp+130h] [xbp+130h]
__int64 v50[2]; // [xsp+138h] [xbp+138h] BYREF
void *v51; // [xsp+148h] [xbp+148h]
__int64 v52[2]; // [xsp+150h] [xbp+150h] BYREF
void *v53; // [xsp+160h] [xbp+160h]
__int64 v54[2]; // [xsp+168h] [xbp+168h] BYREF
void *v55; // [xsp+178h] [xbp+178h]
__int64 v56[2]; // [xsp+180h] [xbp+180h] BYREF
void *v57; // [xsp+190h] [xbp+190h]
__int64 v58[2]; // [xsp+198h] [xbp+198h] BYREF
void *v59; // [xsp+1A8h] [xbp+1A8h]
__int64 v60[2]; // [xsp+1B0h] [xbp+1B0h] BYREF
void *v61; // [xsp+1C0h] [xbp+1C0h]
__int64 v62[2]; // [xsp+1C8h] [xbp+1C8h] BYREF
void *v63; // [xsp+1D8h] [xbp+1D8h]
__int64 v64[2]; // [xsp+1E0h] [xbp+1E0h] BYREF
void *v65; // [xsp+1F0h] [xbp+1F0h]
__int64 v66[2]; // [xsp+1F8h] [xbp+1F8h] BYREF
void *v67; // [xsp+208h] [xbp+208h]
__int64 v68[2]; // [xsp+210h] [xbp+210h] BYREF
void *v69; // [xsp+220h] [xbp+220h]
__int64 v70[2]; // [xsp+228h] [xbp+228h] BYREF
void *v71; // [xsp+238h] [xbp+238h]
__int64 v72[2]; // [xsp+240h] [xbp+240h] BYREF
void *v73; // [xsp+250h] [xbp+250h]
v2 = *a1;
v32 = 0;
v33 = 0;
v34 = nullptr;
if ( (v2 & 1) != 0 )
{
std::string::__init(&v32, *((void **)a1 + 2), *((_QWORD *)a1 + 1));
}
else
{
v3 = *(_QWORD *)a1;
v4 = *((_QWORD *)a1 + 1);
v34 = *((char **)a1 + 2);
v32 = v3;
v33 = v4;
}
if ( (v32 & 1) != 0 )
{
v5 = v34;
v6 = v33;
}
else
{
v6 = (unsigned __int8)v32 >> 1;
v5 = (char *)&v32 + 1;
}
if ( v6 > 2 )
{
v7 = &v5[v6];
v8 = std::__search(
(__int64)v5,
(__int64)&v5[v6],
"://",
(unsigned __int8 *)"",
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v7 != (char *)v8 && v8 - (_QWORD)v5 != -1 )
{
std::string::basic_string(v35, (__int64)&v32, v8 - (_QWORD)v5 + 3, 0xFFFFFFFFFFFFFFFFLL);
if ( (v32 & 1) != 0 )
{
*v34 = 0;
v33 = 0;
}
else
{
LOWORD(v32) = 0;
}
std::string::reserve(&v32, 0);
v34 = (char *)v35[2];
v32 = v35[0];
v33 = v35[1];
}
}
v9 = std::string::find((__int64)&v32, 0x2Fu, 0);
if ( v9 != -1 )
{
std::string::basic_string(v36, (__int64)&v32, 0, v9);
if ( (v32 & 1) != 0 )
{
*v34 = 0;
v33 = 0;
}
else
{
LOWORD(v32) = 0;
}
std::string::reserve(&v32, 0);
v34 = (char *)v36[2];
v32 = v36[0];
v33 = v36[1];
}
if ( (v32 & 1) != 0 )
{
v10 = v34;
v11 = &v34[v33];
}
else
{
v10 = (char *)&v32 + 1;
v11 = (char *)&v32 + ((unsigned __int8)v32 >> 1) + 1;
}
while ( v10 != v11 )
{
*v10 = tolower((unsigned __int8)*v10);
++v10;
}
if ( !(unsigned int)std::string::compare((__int64)&v32, 0, 4u, "www.", 4u) )
{
std::string::basic_string(v37, (__int64)&v32, 4u, 0xFFFFFFFFFFFFFFFFLL);
if ( (v32 & 1) != 0 )
{
*v34 = 0;
v33 = 0;
}
else
{
LOWORD(v32) = 0;
}
std::string::reserve(&v32, 0);
v34 = (char *)v37[2];
v32 = v37[0];
v33 = v37[1];
}
v38[0] = 0;
v38[1] = 0;
v39 = nullptr;
std::string::__init(v38, "youtube.com", 0xBu);
v12 = sub_965574((__int64)&v32, (__int64)v38);
v13 = v12;
if ( v12 )
{
if ( (v38[0] & 1) == 0 )
{
v14 = 1;
goto LABEL_26;
}
goto LABEL_37;
}
v40[0] = 0;
v40[1] = 0;
v41 = nullptr;
std::string::__init(v40, "youtu.be", 8u);
v13 = sub_965574((__int64)&v32, (__int64)v40);
if ( (v40[0] & 1) != 0 )
operator delete(v41);
if ( (v38[0] & 1) != 0 )
LABEL_37:
operator delete(v39);
v14 = 1;
if ( v13 )
goto LABEL_26;
v42[0] = 0;
v42[1] = 0;
v43 = nullptr;
std::string::__init(v42, "newgrounds.com", 0xEu);
v16 = sub_965574((__int64)&v32, (__int64)v42);
if ( (v42[0] & 1) != 0 )
operator delete(v43);
v14 = 2;
if ( v16 )
goto LABEL_26;
v44[0] = 0;
v44[1] = 0;
v45 = nullptr;
std::string::__init(v44, "soundcloud.com", 0xEu);
v17 = sub_965574((__int64)&v32, (__int64)v44);
if ( (v44[0] & 1) != 0 )
operator delete(v45);
v14 = 3;
if ( v17 )
goto LABEL_26;
v46[0] = 0;
v46[1] = 0;
v47 = nullptr;
std::string::__init(v46, "spotify.com", 0xBu);
v18 = sub_965574((__int64)&v32, (__int64)v46);
v19 = v18;
if ( v18 )
{
if ( (v46[0] & 1) == 0 )
{
v14 = 4;
goto LABEL_26;
}
goto LABEL_52;
}
v48[0] = 0;
v48[1] = 0;
v49 = nullptr;
std::string::__init(v48, "spotify.link", 0xCu);
v19 = sub_965574((__int64)&v32, (__int64)v48);
if ( (v48[0] & 1) != 0 )
operator delete(v49);
if ( (v46[0] & 1) != 0 )
LABEL_52:
operator delete(v47);
v14 = 4;
if ( v19 )
goto LABEL_26;
v50[0] = 0;
v50[1] = 0;
v51 = nullptr;
std::string::__init(v50, "bandcamp.com", 0xCu);
v20 = sub_965574((__int64)&v32, (__int64)v50);
if ( (v50[0] & 1) != 0 )
operator delete(v51);
v14 = 5;
if ( v20 )
goto LABEL_26;
v52[0] = 0;
v52[1] = 0;
v53 = nullptr;
std::string::__init(v52, "ncs.io", 6u);
v21 = sub_965574((__int64)&v32, (__int64)v52);
v22 = v21;
if ( v21 )
{
v14 = 6;
if ( (v52[0] & 1) == 0 )
goto LABEL_26;
goto LABEL_59;
}
v54[0] = 0;
v54[1] = 0;
v55 = nullptr;
std::string::__init(v54, "ncs.lnk.to", 0xAu);
v22 = sub_965574((__int64)&v32, (__int64)v54);
if ( (v54[0] & 1) != 0 )
operator delete(v55);
if ( (v52[0] & 1) != 0 )
LABEL_59:
operator delete(v53);
v14 = 6;
if ( v22 )
goto LABEL_26;
v56[0] = 0;
v56[1] = 0;
v57 = nullptr;
std::string::__init(v56, "instagram.com", 0xDu);
v23 = sub_965574((__int64)&v32, (__int64)v56);
if ( (v56[0] & 1) != 0 )
operator delete(v57);
v14 = 8;
if ( v23 )
goto LABEL_26;
v58[0] = 0;
v58[1] = 0;
v59 = nullptr;
std::string::__init(v58, "twitter.com", 0xBu);
v24 = sub_965574((__int64)&v32, (__int64)v58);
v25 = v24;
if ( v24 )
{
v14 = 9;
if ( (v58[0] & 1) == 0 )
goto LABEL_26;
goto LABEL_66;
}
v60[0] = 0;
v60[1] = 0;
v61 = nullptr;
std::string::__init(v60, "x.com", 5u);
v25 = sub_965574((__int64)&v32, (__int64)v60);
if ( (v60[0] & 1) != 0 )
operator delete(v61);
if ( (v58[0] & 1) != 0 )
LABEL_66:
operator delete(v59);
v14 = 9;
if ( !v25 )
{
v62[0] = 0;
v62[1] = 0;
v63 = nullptr;
std::string::__init(v62, "facebook.com", 0xCu);
v26 = sub_965574((__int64)&v32, (__int64)v62);
if ( (v62[0] & 1) != 0 )
operator delete(v63);
v14 = 10;
if ( !v26 )
{
v64[0] = 0;
v64[1] = 0;
v65 = nullptr;
std::string::__init(v64, "twitch.tv", 9u);
v27 = sub_965574((__int64)&v32, (__int64)v64);
if ( (v64[0] & 1) != 0 )
operator delete(v65);
v14 = 11;
if ( !v27 )
{
v66[0] = 0;
v66[1] = 0;
v67 = nullptr;
std::string::__init(v66, "discord.gg", 0xAu);
v28 = sub_965574((__int64)&v32, (__int64)v66);
v29 = v28;
if ( v28 )
{
v14 = 12;
if ( (v66[0] & 1) == 0 )
goto LABEL_26;
}
else
{
v68[0] = 0;
v68[1] = 0;
v69 = nullptr;
std::string::__init(v68, "discord.com", 0xBu);
v29 = sub_965574((__int64)&v32, (__int64)v68);
if ( (v68[0] & 1) != 0 )
operator delete(v69);
if ( (v66[0] & 1) == 0 )
goto LABEL_77;
}
operator delete(v67);
LABEL_77:
v14 = 12;
if ( !v29 )
{
v70[0] = 0;
v70[1] = 0;
v71 = nullptr;
std::string::__init(v70, "tiktok.com", 0xAu);
v30 = sub_965574((__int64)&v32, (__int64)v70);
if ( (v70[0] & 1) != 0 )
operator delete(v71);
v14 = 13;
if ( !v30 )
{
v72[0] = 0;
v72[1] = 0;
v73 = nullptr;
std::string::__init(v72, "itch.io", 7u);
v31 = sub_965574((__int64)&v32, (__int64)v72);
if ( (v72[0] & 1) != 0 )
operator delete(v73);
if ( v31 )
v14 = 14;
else
v14 = 7;
}
}
}
}
}
LABEL_26:
if ( (v32 & 1) != 0 )
operator delete(v34);
return v14;
}