//
// cocos2d::ZipUtils::decompressString2 from 0x10023d8b4 to 0x10023dae0 (556 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::parseMusicLibrary @ 0x100158090
// > MusicDownloadManager::parseSFXLibrary @ 0x10015a3bc
//
// 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
//
void __usercall cocos2d::ZipUtils::decompressString2(
std::string *__return_ptr a1@,
std::string::value_type *__s@,
std::string::size_type __n@,
char a4@,
char a5@)
{
int v6; // w21
unsigned __int64 size; // x21
__int64 v10; // x8
std::string *v11; // x11
std::string::value_type v12; // w11
std::string *v13; // x12
std::string *v14; // x0
__int64 v15; // x22
int v16; // w0
void *v17; // x20
std::string v18; // [xsp+8h] [xbp-58h] BYREF
std::string v19; // [xsp+20h] [xbp-40h] BYREF
void *v20; // [xsp+38h] [xbp-28h]
if ( !__s || (v6 = __n, (int)__n <= 0) )
{
sub_100009900(a1, "");
return;
}
v20 = nullptr;
if ( (a4 & 1) != 0 )
{
memset(&v19, 0, sizeof(v19));
std::string::append(&v19, __s, (unsigned int)__n);
memset(&v18, 0, sizeof(v18));
if ( (v19.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(v19.__r_.__value_.__r.__words[2]);
else
size = v19.__r_.__value_.__l.__size_;
std::string::resize(&v18, size, 0);
if ( size )
{
v10 = 0;
do
{
if ( (v19.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v11 = &v19;
else
v11 = (std::string *)v19.__r_.__value_.__r.__words[0];
v12 = v11->__r_.__value_.__s.__data_[v10] ^ a5;
if ( (v18.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = &v18;
else
v13 = (std::string *)v18.__r_.__value_.__r.__words[0];
v13->__r_.__value_.__s.__data_[v10++] = v12;
}
while ( size > (unsigned int)v10 );
}
if ( (v18.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v6 = HIBYTE(v18.__r_.__value_.__r.__words[2]);
else
v6 = v18.__r_.__value_.__r.__words[1];
if ( (v18.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v14 = &v18;
else
v14 = (std::string *)v18.__r_.__value_.__r.__words[0];
v15 = sub_100240884(v14);
if ( SHIBYTE(v18.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v18.__r_.__value_.__l.__data_);
if ( SHIBYTE(v19.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v19.__r_.__value_.__l.__data_);
}
else
{
v15 = sub_100240884(__s);
}
if ( (int)v15 < 1 )
{
if ( v20 )
{
operator delete[](v20);
v20 = nullptr;
}
goto LABEL_41;
}
v19.__r_.__value_.__r.__words[0] = 0;
v16 = sub_10023EA54(v20, v15, &v19, 0x100000);
if ( v16 < 1 )
{
if ( v20 )
{
operator delete[](v20);
v20 = nullptr;
}
if ( v19.__r_.__value_.__r.__words[0] )
operator delete[](v19.__r_.__value_.__l.__data_);
LABEL_41:
a1->__r_.__value_.__r.__words[0] = 0;
a1->__r_.__value_.__l.__size_ = 0;
a1->__r_.__value_.__r.__words[2] = 0;
std::string::append(a1, __s, v6);
return;
}
a1->__r_.__value_.__r.__words[0] = 0;
a1->__r_.__value_.__l.__size_ = 0;
a1->__r_.__value_.__r.__words[2] = 0;
v17 = (void *)v19.__r_.__value_.__r.__words[0];
std::string::append(a1, v19.__r_.__value_.__l.__data_, (unsigned int)v16);
if ( v20 )
{
operator delete[](v20);
v20 = nullptr;
}
if ( v17 )
operator delete[](v17);
}