//
// cocos2d::ZipUtils::urlDecode from 0x1001e92c0 to 0x1001e94d6 (534 bytes)
//
// 7 xrefs:
// > SongInfoObject::create_2 @ 0x10064c839
// > MusicDownloadManager::parseMusicLibrary @ 0x10065ada3
// > MusicDownloadManager::parseMusicLibrary @ 0x10065ae7a
// > MusicDownloadManager::parseMusicLibrary @ 0x10065b7c8
// > sub_10065DF30 @ 0x10065e0d3
// > sub_10065DF30 @ 0x10065e118
// > SongInfoObject::createWithCoder @ 0x10066501a
//
// This function is hookable on this platform (idp: pc, 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:26:30 +0000
//
_QWORD *__fastcall cocos2d::ZipUtils::urlDecode(_QWORD *a1, const std::string *a2)
{
unsigned int v3; // eax
std::string::size_type v4; // r12
unsigned int v5; // eax
std::string::size_type size; // rax
std::string::pointer v7; // rsi
unsigned int v8; // eax
std::string::size_type v9; // rcx
size_t v10; // r15
__int64 (__fastcall **v12)(); // [rsp+0h] [rbp-160h] BYREF
void (__cdecl **v13)(std::streambuf *__hidden); // [rsp+8h] [rbp-158h] BYREF
std::locale v14; // [rsp+10h] [rbp-150h] BYREF
char v15; // [rsp+48h] [rbp-118h]
void *v16; // [rsp+58h] [rbp-108h]
__int64 (__fastcall **v17)(); // [rsp+70h] [rbp-F0h] BYREF
char *data; // [rsp+108h] [rbp-58h]
std::string::value_type v19; // [rsp+110h] [rbp-50h] BYREF
_BYTE __dst[15]; // [rsp+111h] [rbp-4Fh] BYREF
void *__p; // [rsp+120h] [rbp-40h]
_QWORD *v22; // [rsp+128h] [rbp-38h]
char v23[41]; // [rsp+137h] [rbp-29h] BYREF
v22 = a1;
sub_1001E9520(&v12);
v3 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v3 & 1) == 0 )
{
if ( !(v3 >> 1) )
goto LABEL_23;
goto LABEL_5;
}
if ( a2->__r_.__value_.__l.__size_ )
{
LABEL_5:
data = a2->__r_.__value_.__s.__data_;
v4 = 0;
while ( 1 )
{
if ( *std::string::at(a2, v4) == 37 )
{
v5 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v5 & 1) != 0 )
{
size = a2->__r_.__value_.__l.__size_;
if ( size <= v4 )
LABEL_26:
sub_100056810();
v7 = a2->__r_.__value_.__l.__data_;
}
else
{
size = v5 >> 1;
v7 = data;
if ( v4 >= size )
goto LABEL_26;
}
v9 = v4 + 1;
v10 = size - (v4 + 1);
if ( v10 >= 2 )
v10 = 2;
v19 = 2 * v10;
if ( size != v9 )
{
v7 += v9;
memmove(__dst, v7, v10);
}
__dst[v10] = 0;
v23[0] = cocos2d::ZipUtils::hexToChar(&v19, v7);
sub_1001630E0(&v12, (__int64)v23, 1);
if ( (v19 & 1) != 0 )
operator delete(__p);
v4 += 2LL;
v8 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v8 & 1) == 0 )
goto LABEL_22;
LABEL_6:
if ( ++v4 >= a2->__r_.__value_.__l.__size_ )
break;
}
else
{
v19 = *std::string::at(a2, v4);
sub_1001630E0(&v12, (__int64)&v19, 1);
v8 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v8 & 1) != 0 )
goto LABEL_6;
LABEL_22:
if ( ++v4 >= v8 >> 1 )
break;
}
}
}
LABEL_23:
sub_100162BA0(v22, (__int64)&v13);
v12 = &off_100AE01C8;
v17 = off_100AE01F0;
v13 = (void (__cdecl **)(std::streambuf *__hidden))&off_100BB1EA0;
if ( (v15 & 1) != 0 )
operator delete(v16);
v13 = &`vtable for'std::streambuf.~basic_streambuf;
std::locale::~locale(&v14);
std::ostream::~ostream(&v12, off_100AE0208);
std::ios::~ios(&v17);
return v22;
}