//
// cocos2d::ZipUtils::decompressString from 0x1001e8a00 to 0x1001e8c47 (583 bytes)
//
// 20 xrefs:
// > PlayLayer::init @ 0x100079e4b
// > PlayLayer::loadPersistentCheckpoint @ 0x10008be3e
// > PlayLayer::loadPersistentCheckpoint @ 0x10008bfd4
// > PlayLayer::addLiveStartPosObject @ 0x10008c2a2
// > GJAccountManager::onSyncAccountCompleted @ 0x10009f3c6
// > GJAccountManager::onSyncAccountCompleted @ 0x10009f5bc
// > LevelEditorLayer::init @ 0x1000aabca
// > sub_1002B10F0 @ 0x1002b1136
// > GManager::loadFromCompressedString @ 0x1004a50ac
// > GameLevelManager::onGetLevelSaveDataCompleted @ 0x10052be06
// > sub_1005533D0 @ 0x1005536ec
// > sub_100587120 @ 0x100587183
// > sub_1005871C0 @ 0x1005872ba
// > GJGameLevel::copyLevelInfo @ 0x100588714
// > GJGameLevel::dataLoaded @ 0x1005899e5
// > sub_1006CC260 @ 0x1006ccad8
// > LocalLevelManager::importLevelsFromPaths @ 0x1006ceff6
// > sub_1008EB390 @ 0x1008eb3e0
// > EditorSFXManager::importFromString @ 0x1008ece03
// > sub_1009269F0 @ 0x100926a9b
//
// 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::decompressString(std::string *this, char *a2, char a3, char a4)
{
std::string *v5; // rbx
unsigned __int8 v6; // si
std::string::size_type v7; // rax
unsigned __int8 v8; // di
std::string::size_type v10; // r15
__int64 v11; // rsi
char *v12; // rdi
std::string::pointer data; // r8
__int64 v14; // rsi
std::string::pointer v15; // rdi
const void *v16; // rsi
unsigned __int64 v17; // rdx
char *v18; // rdi
int v19; // eax
int v20; // r15d
int v21; // eax
void *v22; // r15
std::string::size_type v23; // rdx
int v25; // [rsp+Ch] [rbp-44h] BYREF
std::string v26; // [rsp+10h] [rbp-40h] BYREF
void *__p[5]; // [rsp+28h] [rbp-28h] BYREF
v5 = this;
v6 = *a2;
if ( (v6 & 1) != 0 )
{
v7 = *((_QWORD *)a2 + 1);
if ( (int)v7 <= 0 )
{
v16 = *((const void **)a2 + 2);
v17 = *((_QWORD *)a2 + 1);
goto LABEL_44;
}
__p[0] = nullptr;
v8 = v6;
if ( a3 )
goto LABEL_7;
v18 = *((char **)a2 + 2);
LABEL_21:
v19 = sub_100314A00(v18, (unsigned int)v7, __p, 1);
goto LABEL_25;
}
if ( !v6 )
{
LABEL_42:
v5->__r_.__value_.__r.__words[2] = *((_QWORD *)a2 + 2);
*(_OWORD *)&v5->__r_.__value_.__l.0 = *(_OWORD *)a2;
return v5;
}
LODWORD(v7) = v6 >> 1;
__p[0] = nullptr;
if ( !a3 )
{
v18 = a2 + 1;
goto LABEL_21;
}
v8 = v6 >> 1;
v7 = *((_QWORD *)a2 + 1);
LABEL_7:
memset(&v26, 0, sizeof(v26));
v10 = v8;
if ( (v6 & 1) != 0 )
v10 = v7;
std::string::resize(&v26, v10, 0);
if ( v10 )
{
v11 = 0;
do
{
v12 = a2 + 1;
if ( (*a2 & 1) != 0 )
v12 = *((char **)a2 + 2);
data = v26.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
data = v26.__r_.__value_.__l.__data_;
data[v11] = a4 ^ v12[v11];
++v11;
}
while ( v10 > (unsigned int)v11 );
}
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
{
v14 = LODWORD(v26.__r_.__value_.__r.__words[1]);
v15 = v26.__r_.__value_.__l.__data_;
}
else
{
v14 = *(_BYTE *)&v26.__r_.__value_.__l.0 >> 1;
v15 = v26.__r_.__value_.__s.__data_;
}
v19 = sub_100314A00(v15, v14, __p, 1);
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
{
v20 = v19;
operator delete(v26.__r_.__value_.__l.__data_);
v19 = v20;
}
LABEL_25:
if ( v19 <= 0 )
{
if ( __p[0] )
{
operator delete[](__p[0]);
__p[0] = nullptr;
}
goto LABEL_41;
}
v26.__r_.__value_.__r.__words[0] = 0;
v25 = 0;
v21 = sub_1001E99E0(__p[0], (unsigned int)v19, &v26, &v25, 0x100000);
v22 = (void *)v26.__r_.__value_.__r.__words[0];
if ( v21 )
{
if ( v26.__r_.__value_.__r.__words[0] )
operator delete[]((void *)v26.__r_.__value_.__r.__words[0]);
goto LABEL_36;
}
if ( !v26.__r_.__value_.__r.__words[0] )
{
LABEL_36:
v22 = nullptr;
goto LABEL_37;
}
v23 = v25;
if ( v25 <= 0 )
{
LABEL_37:
if ( __p[0] )
{
operator delete[](__p[0]);
__p[0] = nullptr;
}
if ( v22 )
operator delete[](v22);
LABEL_41:
if ( (*a2 & 1) == 0 )
goto LABEL_42;
v17 = *((_QWORD *)a2 + 1);
v16 = *((const void **)a2 + 2);
this = v5;
LABEL_44:
sub_10001AD30(this, v16, v17);
return v5;
}
*(_OWORD *)&v5->__r_.__value_.__l.0 = 0;
v5->__r_.__value_.__r.__words[2] = 0;
std::string::append(v5, (const std::string::value_type *)v22, v23);
if ( __p[0] )
{
operator delete[](__p[0]);
__p[0] = nullptr;
}
operator delete[](v22);
return v5;
}