//
// cocos2d::ZipUtils::decompressString2 from 0x1001e86e0 to 0x1001e8956 (630 bytes)
//
// 5 xrefs:
// > DS_Dictionary::loadRootSubDictFromCompressedFile @ 0x10015a41b
// > sub_10054C9E0 @ 0x10054ca93
// > MusicDownloadManager::parseMusicLibrary @ 0x10065a6d1
// > MusicDownloadManager::parseSFXLibrary @ 0x10065f9c2
// > MusicDownloadManager::parseNewsFeed @ 0x100661d1c
//
// 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
//
std::string *__fastcall cocos2d::ZipUtils::decompressString2(
std::string *this,
std::string::value_type *__s,
char a3,
unsigned int a4,
char a5)
{
int v5; // r15d
unsigned __int64 size; // r15
int v10; // r12d
__int64 v11; // rdx
std::string::pointer data; // rsi
std::string::pointer v13; // rdi
std::string::pointer v14; // rdi
int v15; // eax
void *v16; // r12
std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 v17; // rdx
std::string v19; // [rsp+0h] [rbp-60h] BYREF
std::string v20; // [rsp+20h] [rbp-40h] BYREF
void *__p[5]; // [rsp+38h] [rbp-28h] BYREF
v5 = a4;
if ( (int)a4 <= 0 || __s == nullptr )
{
*(_WORD *)&this->__r_.__value_.__l.0 = 0;
return this;
}
__p[0] = nullptr;
if ( !a3 )
{
v10 = sub_100314A00(__s, a4, __p, 1);
if ( v10 > 0 )
goto LABEL_22;
goto LABEL_27;
}
memset(&v19, 0, sizeof(v19));
std::string::append(&v19, __s, a4);
memset(&v20, 0, sizeof(v20));
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
size = v19.__r_.__value_.__l.__size_;
else
size = *(_BYTE *)&v19.__r_.__value_.__l.0 >> 1;
std::string::resize(&v20, size, 0);
if ( size )
{
v11 = 0;
do
{
data = v19.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
data = v19.__r_.__value_.__l.__data_;
v13 = v20.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
v13 = v20.__r_.__value_.__l.__data_;
v13[v11] = a5 ^ data[v11];
++v11;
}
while ( size > (unsigned int)v11 );
}
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
{
v5 = v20.__r_.__value_.__r.__words[1];
v14 = v20.__r_.__value_.__l.__data_;
}
else
{
v5 = *(_BYTE *)&v20.__r_.__value_.__l.0 >> 1;
v14 = v20.__r_.__value_.__s.__data_;
}
v10 = sub_100314A00(v14, (unsigned int)v5, __p, 1);
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v20.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_21:
if ( v10 > 0 )
goto LABEL_22;
LABEL_27:
if ( __p[0] )
{
operator delete[](__p[0]);
__p[0] = nullptr;
}
goto LABEL_40;
}
}
else if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_21;
}
operator delete(v19.__r_.__value_.__l.__data_);
if ( v10 <= 0 )
goto LABEL_27;
LABEL_22:
v19.__r_.__value_.__r.__words[0] = 0;
*(_DWORD *)&v20.__r_.__value_.__l.0 = 0;
v15 = sub_1001E99E0(__p[0], (unsigned int)v10, &v19, &v20, 0x100000);
v16 = (void *)v19.__r_.__value_.__r.__words[0];
if ( v15 )
{
if ( v19.__r_.__value_.__r.__words[0] )
operator delete[]((void *)v19.__r_.__value_.__r.__words[0]);
goto LABEL_35;
}
if ( !v19.__r_.__value_.__r.__words[0] )
{
LABEL_35:
v16 = nullptr;
goto LABEL_36;
}
v17 = v20.__r_.__value_.__l.0;
if ( *(_DWORD *)&v20.__r_.__value_.__l.0 <= 0 )
{
LABEL_36:
if ( __p[0] )
{
operator delete[](__p[0]);
__p[0] = nullptr;
}
if ( v16 )
operator delete[](v16);
LABEL_40:
*(_OWORD *)&this->__r_.__value_.__l.0 = 0;
this->__r_.__value_.__r.__words[2] = 0;
std::string::append(this, __s, v5);
return this;
}
*(_OWORD *)&this->__r_.__value_.__l.0 = 0;
this->__r_.__value_.__r.__words[2] = 0;
std::string::append(this, (const std::string::value_type *)v16, *(_QWORD *)&v17);
if ( __p[0] )
{
operator delete[](__p[0]);
__p[0] = nullptr;
}
operator delete[](v16);
return this;
}