//
// MusicDownloadManager::urlEncode from 0x56d5a8 to 0x56d644 (156 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::linkRowString @ 0x56d672
// > MusicDownloadManager::linkRowString @ 0x56d68c
//
// 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:34 +0000
//
int *__fastcall MusicDownloadManager::urlEncode(int *a1, unsigned __int8 *a2)
{
int v4; // r1
unsigned int v5; // r1
unsigned int i; // r7
unsigned int v7; // r3
unsigned __int8 *v8; // r3
int v9; // r5
int *v10; // r0
char v11; // r1
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
v4 = *a2;
if ( (v4 & 1) != 0 )
v5 = *((_DWORD *)a2 + 1);
else
v5 = v4 >> 1;
std::string::reserve(a1, v5);
for ( i = 0; ; ++i )
{
v7 = *a2;
if ( (v7 & 1) == 0 )
break;
if ( i >= *((_DWORD *)a2 + 1) )
return a1;
v8 = *((unsigned __int8 **)a2 + 2);
LABEL_10:
v9 = v8[i];
if ( isalnum(v9) || (unsigned int)(v9 - 45) <= 1 || v9 == 95 || v9 == 126 )
{
v10 = a1;
v11 = v9;
}
else
{
std::string::push_back(a1, 37);
std::string::push_back(a1, a0123456789abcd_2[v9 >> 4]);
v10 = a1;
v11 = a0123456789abcd_2[v9 & 0xF];
}
std::string::push_back(v10, v11);
}
if ( i < v7 >> 1 )
{
v8 = a2 + 1;
goto LABEL_10;
}
return a1;
}