//
// cocos2d::ZipUtils::compressString from 0x5f00b8 to 0x5f01ae (246 bytes)
//
// 5 xrefs:
// > GManager::getCompressedSaveString @ 0x2f026a
// > GJGameLevel::dataLoaded @ 0x3c9350
// > EditorPauseLayer::saveLevel @ 0x40132e
// > GJBaseGameLayer::getRecordString @ 0x48eef0
// > DS_Dictionary::saveRootSubDictToCompressedFile @ 0x5fcaea
//
// 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
//
_DWORD *__fastcall cocos2d::ZipUtils::compressString(_DWORD *a1, unsigned __int8 **a2, int a3, char a4)
{
unsigned __int8 *v5; // r0
unsigned int v8; // r1
const unsigned __int8 *v9; // r1
signed int v10; // r2
void *v11; // r3
void *v12; // r0
void *v14; // [sp+0h] [bp-18h] BYREF
void *v15; // [sp+4h] [bp-14h] BYREF
void *v16; // [sp+8h] [bp-10h] BYREF
void *v17; // [sp+Ch] [bp-Ch] BYREF
int v18; // [sp+10h] [bp-8h] BYREF
v5 = *a2;
v8 = *((_DWORD *)*a2 - 3);
v14 = nullptr;
v9 = (const unsigned __int8 *)cocos2d::ZipUtils::ccDeflateMemory(v5, v8, (unsigned __int8 **)&v14);
if ( (int)v9 <= 0 )
{
v12 = v14;
if ( !v14 )
{
LABEL_17:
sub_775C20(a1);
return a1;
}
LABEL_16:
operator delete[](v12);
v14 = nullptr;
goto LABEL_17;
}
v15 = nullptr;
v10 = base64Encode((cocos2d *)v14, v9, &v15, (_BYTE *)&dword_0 + 1);
if ( v10 <= 0 )
{
if ( v15 )
{
operator delete[](v15);
v15 = nullptr;
}
v12 = v14;
if ( !v14 )
goto LABEL_17;
goto LABEL_16;
}
v16 = &unk_ACDDA8;
if ( a3 )
{
v17 = &unk_ACDDA8;
sub_774534(&v17, v15, v10);
cocos2d::ZipUtils::encryptDecrypt(&v18, &v17, a4);
sub_774794(&v16, &v18);
sub_774008(&v18);
sub_774008(&v17);
}
else
{
sub_774534(&v16, v15, v10);
}
if ( v15 )
{
operator delete[](v15);
v15 = nullptr;
}
if ( v14 )
{
operator delete[](v14);
v14 = nullptr;
}
v11 = v16;
v16 = &unk_ACDDA8;
*a1 = v11;
sub_774008(&v16);
return a1;
}