//
// cocos2d::ZipUtils::compressString from 0x1001e8350 to 0x1001e8552 (514 bytes)
//
// 19 xrefs:
// > PlayLayer::writePersistentSave @ 0x10008b97a
// > PlayLayer::addLiveStartPosObject @ 0x10008c338
// > LevelEditorLayer::saveLevel @ 0x1000c6338
// > sub_1000D62F0 @ 0x1000d6326
// > sub_1000E7B50 @ 0x1000e7bcb
// > sub_1000E7DF0 @ 0x1000e7e7b
// > GJBaseGameLayer::getRecordString @ 0x100137f90
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x10015b5a5
// > GManager::getCompressedSaveString @ 0x1004a4f9d
// > sub_10054CEA0 @ 0x10054cecc
// > GameLevelManager::uploadDeathData @ 0x10055226e
// > GJGameLevel::copyLevelInfo @ 0x100588937
// > GJGameLevel::dataLoaded @ 0x10058a74e
// > GJGameLevel::encodeWithCoder @ 0x10058b039
// > GJGameLevel::encodeWithCoder @ 0x10058b23c
// > sub_1006CE060 @ 0x1006ce23b
// > EditorSFXManager::serializeCompressed @ 0x1008ecd8a
// > EditorSFXManager::createMyConfigFromLive @ 0x1008ed6be
// > sub_1008EDBA0 @ 0x1008edc47
//
// 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::compressString(
std::string *this,
unsigned __int8 *a2,
char a3,
__int64 a4,
char a5)
{
unsigned int v9; // esi
int v10; // eax
void *v11; // rdi
void *v12; // r14
int v13; // eax
unsigned __int64 size; // r12
__int64 v15; // rdx
std::string::pointer data; // rsi
std::string::pointer v17; // rdi
std::string v19; // [rsp+0h] [rbp-70h] BYREF
void *__p; // [rsp+18h] [rbp-58h] BYREF
std::string v21; // [rsp+20h] [rbp-50h] BYREF
std::string::value_type *__s; // [rsp+40h] [rbp-30h] BYREF
__p = nullptr;
v9 = *a2;
if ( (v9 & 1) != 0 )
{
v10 = cocos2d::ZipUtils::ccDeflateMemory(*((_QWORD *)a2 + 2), *((unsigned int *)a2 + 2), &__p);
if ( v10 <= 0 )
goto LABEL_3;
}
else
{
v10 = cocos2d::ZipUtils::ccDeflateMemory(a2 + 1, v9 >> 1, &__p);
if ( v10 <= 0 )
{
LABEL_3:
v11 = __p;
if ( !__p )
{
LABEL_15:
if ( (*a2 & 1) != 0 )
{
sub_10001AD30(this, *((const void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
this->__r_.__value_.__r.__words[2] = *((_QWORD *)a2 + 2);
*(_OWORD *)&this->__r_.__value_.__l.0 = *(_OWORD *)a2;
}
return this;
}
LABEL_14:
operator delete[](v11);
goto LABEL_15;
}
}
__s = nullptr;
v12 = __p;
v13 = sub_100314A90(__p, (unsigned int)v10, &__s, 1);
if ( v13 <= 0 )
{
if ( __s )
{
operator delete[](__s);
__s = nullptr;
}
if ( !v12 )
goto LABEL_15;
v11 = v12;
goto LABEL_14;
}
*(_OWORD *)&this->__r_.__value_.__l.0 = 0;
this->__r_.__value_.__r.__words[2] = 0;
if ( a3 )
{
memset(&v21, 0, sizeof(v21));
std::string::append(&v21, __s, (unsigned int)v13);
memset(&v19, 0, sizeof(v19));
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
size = v21.__r_.__value_.__l.__size_;
else
size = *(_BYTE *)&v21.__r_.__value_.__l.0 >> 1;
std::string::resize(&v19, size, 0);
if ( size )
{
v15 = 0;
do
{
data = v21.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
data = v21.__r_.__value_.__l.__data_;
v17 = v19.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
v17 = v19.__r_.__value_.__l.__data_;
v17[v15] = a5 ^ data[v15];
++v15;
}
while ( size > (unsigned int)v15 );
}
if ( (*(_BYTE *)&this->__r_.__value_.__s.0 & 1) != 0 )
operator delete(this->__r_.__value_.__l.__data_);
*this = v19;
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v21.__r_.__value_.__l.__data_);
}
else
{
std::string::append(this, __s, (unsigned int)v13);
}
if ( __s )
{
operator delete[](__s);
__s = nullptr;
}
if ( v12 )
operator delete[](v12);
return this;
}