//
// MusicDownloadManager::urlEncode from 0x95f9ac to 0x95fad8 (300 bytes)
//
// 3 xrefs:
// > MusicDownloadManager::linkRowString @ 0x95fb1c
// > MusicDownloadManager::linkRowString @ 0x95fb38
// > ??> @ 0xd2c40
//
// 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:31 +0000
//
__int64 *__usercall MusicDownloadManager::urlEncode@(char *a1@, __int64 *a2@)
{
unsigned __int8 v4; // w0
unsigned __int64 v5; // x1
unsigned __int8 v6; // w0
unsigned __int64 v7; // x20
char *i; // x0
int v9; // w19
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
v4 = *a1;
v5 = v4 >> 1;
if ( (v4 & 1) != 0 )
v5 = *((_QWORD *)a1 + 1);
std::string::reserve(a2, v5);
v6 = *a1;
v7 = 0;
if ( (*a1 & 1) == 0 )
goto LABEL_12;
while ( v7 < *((_QWORD *)a1 + 1) )
{
for ( i = *((char **)a1 + 2); ; i = a1 + 1 )
{
v9 = (unsigned __int8)i[v7];
if ( isalnum(v9) || (unsigned __int8)(v9 - 45) <= 1u || v9 == 95 || v9 == 126 )
{
std::string::push_back(a2, v9);
++v7;
}
else
{
std::string::push_back(a2, 37);
std::string::push_back(a2, a0123456789abcd[(unsigned __int8)v9 >> 4]);
std::string::push_back(a2, a0123456789abcd[v9 & 0xF]);
++v7;
}
v6 = *a1;
if ( (*a1 & 1) != 0 )
break;
LABEL_12:
if ( v7 >= v6 >> 1 )
return a2;
}
}
return a2;
}