//
// cocos2d::ZipUtils::urlDecode from 0x100205ec0 to 0x1002060d6 (534 bytes)
//
// 6 xrefs:
// > SongInfoObject::create_2 @ 0x10058c5a3
// > SongInfoObject::create_2 @ 0x10058c858
// > MusicDownloadManager::parseMusicLibrary @ 0x1005924ed
// > MusicDownloadManager::parseMusicLibrary @ 0x10059252b
// > MusicDownloadManager::parseMusicLibrary @ 0x100592cdb
// > MusicDownloadManager::parseMusicLibrary @ 0x100592dcb
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
_QWORD *__fastcall cocos2d::ZipUtils::urlDecode(_QWORD *a1, const std::string *a2, double a3)
{
unsigned int v4; // eax
std::string::size_type v5; // r12
unsigned int v6; // eax
std::string::size_type size; // rax
std::string::pointer v8; // rsi
unsigned int v9; // eax
std::string::size_type v10; // rcx
size_t v11; // r15
__int64 (__fastcall **v13)(); // [rsp+0h] [rbp-160h] BYREF
void (__cdecl **v14)(std::streambuf *__hidden); // [rsp+8h] [rbp-158h] BYREF
std::locale v15; // [rsp+10h] [rbp-150h] BYREF
char v16; // [rsp+48h] [rbp-118h]
void *v17; // [rsp+58h] [rbp-108h]
__int64 (__fastcall **v18)(); // [rsp+70h] [rbp-F0h] BYREF
char *data; // [rsp+108h] [rbp-58h]
std::string::value_type v20; // [rsp+110h] [rbp-50h] BYREF
_BYTE __dst[15]; // [rsp+111h] [rbp-4Fh] BYREF
void *__p; // [rsp+120h] [rbp-40h]
_QWORD *v23; // [rsp+128h] [rbp-38h]
char v24[41]; // [rsp+137h] [rbp-29h] BYREF
v23 = a1;
sub_100206120(&v13);
v4 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v4 & 1) == 0 )
{
if ( !(v4 >> 1) )
goto LABEL_23;
goto LABEL_5;
}
if ( a2->__r_.__value_.__l.__size_ )
{
LABEL_5:
data = a2->__r_.__value_.__s.__data_;
v5 = 0;
while ( 1 )
{
if ( *std::string::at(a2, v5) == 37 )
{
v6 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v6 & 1) != 0 )
{
size = a2->__r_.__value_.__l.__size_;
if ( size <= v5 )
LABEL_26:
sub_1000547C0();
v8 = a2->__r_.__value_.__l.__data_;
}
else
{
size = v6 >> 1;
v8 = data;
if ( v5 >= size )
goto LABEL_26;
}
v10 = v5 + 1;
v11 = size - (v5 + 1);
if ( v11 >= 2 )
v11 = 2;
v20 = 2 * v11;
if ( size != v10 )
{
v8 += v10;
memmove(__dst, v8, v11);
}
__dst[v11] = 0;
v24[0] = cocos2d::ZipUtils::hexToChar(&v20, v8);
sub_100183CF0(&v13, (__int64)v24, 1);
if ( (v20 & 1) != 0 )
operator delete(__p);
v5 += 2LL;
v9 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v9 & 1) == 0 )
goto LABEL_22;
LABEL_6:
if ( ++v5 >= a2->__r_.__value_.__l.__size_ )
break;
}
else
{
v20 = *std::string::at(a2, v5);
sub_100183CF0(&v13, (__int64)&v20, 1);
v9 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v9 & 1) != 0 )
goto LABEL_6;
LABEL_22:
if ( ++v5 >= v9 >> 1 )
break;
}
}
}
LABEL_23:
sub_1001837B0(v23, (__int64)&v14, a3);
v13 = &off_1008DBF28;
v18 = off_1008DBF50;
v14 = (void (__cdecl **)(std::streambuf *__hidden))&off_1008C3F58;
if ( (v16 & 1) != 0 )
operator delete(v17);
v14 = &`vtable for'std::streambuf.~basic_streambuf;
std::locale::~locale(&v15);
std::ostream::~ostream(&v13, off_1008DBF68);
std::ios::~ios(&v18);
return v23;
}