//
// cocos2d::ZipUtils::compressString from 0x7fb398 to 0x7fb54a (434 bytes)
//
// 17 xrefs:
// > GManager::getCompressedSaveString @ 0x3d41f6
// > PlayLayer::addLiveStartPosObject @ 0x406818
// > PlayLayer::writePersistentSave @ 0x40785c
// > sub_46BA3C @ 0x46ba92
// > sub_46BB18 @ 0x46bb70
// > LevelEditorLayer::prepareSaveData @ 0x470b2c
// > LevelEditorLayer::saveLevel @ 0x47283c
// > sub_4B5A60 @ 0x4b5a86
// > GameLevelManager::uploadDeathData @ 0x4bce84
// > GJGameLevel::copyLevelInfo @ 0x4c0d08
// > GJGameLevel::dataLoaded @ 0x4cc46c
// > GJGameLevel::encodeWithCoder @ 0x4d8142
// > GJGameLevel::encodeWithCoder @ 0x4d82a2
// > LocalLevelManager::exportLevelsToFile @ 0x543f7e
// > GJBaseGameLayer::getRecordString @ 0x5bea6e
// > EditorSFXManager::serializeCompressed @ 0x77f098
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x80e71e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:01:15 +0000
//
int *__fastcall cocos2d::ZipUtils::compressString(int *a1, unsigned __int8 *a2, int a3, unsigned __int8 **a4, char a5)
{
int v7; // r0
int v9; // r1
cocos2d::ZipUtils *v10; // r2
const unsigned __int8 *v11; // r1
signed int v12; // r2
bool v13; // zf
int v14; // r0
unsigned int v15; // r3
unsigned int v16; // r0
char *v17; // r10
int v18; // r9
char *v19; // r0
int v20; // r2
int v21; // r0
unsigned int v22; // r1
_BYTE *v23; // r2
int v24; // r0
unsigned int v25; // r1
_BYTE *v26; // r2
void *v28; // [sp+0h] [bp-30h] BYREF
void *v29; // [sp+4h] [bp-2Ch] BYREF
int v30; // [sp+8h] [bp-28h] BYREF
unsigned int v31; // [sp+Ch] [bp-24h]
_BYTE *v32; // [sp+10h] [bp-20h]
_DWORD v33[3]; // [sp+14h] [bp-1Ch] BYREF
int v34; // [sp+20h] [bp-10h] BYREF
unsigned int v35; // [sp+24h] [bp-Ch]
_BYTE *v36; // [sp+28h] [bp-8h]
v7 = *a2;
if ( (v7 & 1) != 0 )
v9 = *((_DWORD *)a2 + 1);
else
v9 = v7 >> 1;
v28 = nullptr;
if ( (v7 & 1) != 0 )
v10 = *((cocos2d::ZipUtils **)a2 + 2);
else
v10 = (cocos2d::ZipUtils *)(a2 + 1);
v11 = (const unsigned __int8 *)cocos2d::ZipUtils::ccDeflateMemory(v10, (unsigned __int8 *)v9, &v28, a4, (int)v28);
if ( (int)v11 > 0 )
{
v29 = nullptr;
v12 = base64Encode((cocos2d *)v28, v11, &v29, (_BYTE *)&dword_0 + 1);
if ( v12 > 0 )
{
v30 = 0;
v31 = 0;
v32 = nullptr;
if ( !a3 )
{
std::string::append(&v30, v29, v12);
LABEL_33:
if ( v29 )
{
operator delete[](v29);
v29 = nullptr;
}
if ( v28 )
{
operator delete[](v28);
v28 = nullptr;
}
v24 = v30;
v25 = v31;
v26 = v32;
v30 = 0;
v31 = 0;
v32 = nullptr;
*a1 = v24;
a1[1] = v25;
a1[2] = (int)v26;
std::string::~string((int)&v30);
return a1;
}
memset(v33, 0, sizeof(v33));
std::string::append(v33, v29, v12);
cocos2d::ZipUtils::encryptDecrypt((int)&v34, (unsigned __int8 *)v33, a5);
v13 = (v30 & 1) == 0;
if ( (v30 & 1) != 0 )
*v32 = 0;
else
LOWORD(v30) = 0;
if ( !v13 )
v31 = 0;
if ( (v30 & 1) != 0 )
{
v14 = v31;
v15 = (v30 & 0xFFFFFFFE) - 1;
if ( v31 <= 0xA )
{
if ( (v30 & 0xFFFFFFFE) != 0xB )
goto LABEL_23;
goto LABEL_32;
}
}
else
{
v14 = (int)(unsigned __int8)v30 >> 1;
if ( v14 <= 10 )
goto LABEL_32;
v15 = 10;
}
v16 = (v14 + 16) & 0xFFFFFFF0;
if ( v16 - 1 != v15 )
{
if ( v16 != 11 )
{
v19 = (char *)operator new(v16);
v18 = v30 & 1;
if ( (v30 & 1) != 0 )
v17 = v32;
else
v17 = (char *)&v30 + 1;
goto LABEL_27;
}
LABEL_23:
v17 = v32;
v18 = 1;
v19 = (char *)&v30 + 1;
LABEL_27:
if ( (v30 & 1) != 0 )
v20 = v31;
else
v20 = (int)(unsigned __int8)v30 >> 1;
std::char_traits::copy(v19, v17, v20 + 1);
if ( v18 )
operator delete(v17);
}
LABEL_32:
v21 = v34;
v22 = v35;
v23 = v36;
v34 = 0;
v35 = 0;
v36 = nullptr;
v30 = v21;
v31 = v22;
v32 = v23;
std::string::~string((int)&v34);
std::string::~string((int)v33);
goto LABEL_33;
}
if ( v29 )
{
operator delete[](v29);
v29 = nullptr;
}
}
if ( v28 )
{
operator delete[](v28);
v28 = nullptr;
}
std::string::basic_string(a1, (int)a2);
return a1;
}