//
// cocos2d::ZipUtils::ccDeflateMemory from 0x5efff4 to 0x5f00b0 (188 bytes)
//
// 1 xrefs:
// > cocos2d::ZipUtils::compressString @ 0x5f00de
//
// 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
//
int cocos2d::ZipUtils::ccDeflateMemory(unsigned __int8 *a1, unsigned int a2, unsigned __int8 **a3)
{
unsigned __int8 *v6; // r0
int v7; // r5
int result; // r0
int v9; // r0
int v10; // r4
unsigned __int8 *v11; // r0
_DWORD v12[3]; // [sp+14h] [bp+0h] BYREF
unsigned __int8 *v13; // [sp+20h] [bp+Ch]
int v14; // [sp+24h] [bp+10h]
int v15; // [sp+34h] [bp+20h]
int v16; // [sp+38h] [bp+24h]
int v17; // [sp+3Ch] [bp+28h]
v6 = (unsigned __int8 *)operator new[](0x100000u);
v15 = 0;
v16 = 0;
v17 = 0;
v12[0] = a1;
v7 = 0x100000;
v12[1] = a2;
v14 = 0x100000;
*a3 = v6;
v13 = v6;
result = deflateInit2_(v12, -1);
if ( !result )
{
while ( 1 )
{
v9 = deflate(v12, 4);
v10 = v9;
if ( v9 == 1 )
break;
if ( v9 >= -4 )
{
if ( v9 <= -3 )
goto LABEL_11;
if ( v9 == 2 )
{
v10 = -3;
goto LABEL_11;
}
}
v11 = (unsigned __int8 *)realloc(*a3, 2 * v7);
*a3 = v11;
if ( !v11 )
{
deflateEnd(v12);
return -4;
}
v14 = v7;
v13 = &v11[v7];
v7 *= 2;
}
v10 = v7 - v14;
LABEL_11:
deflateEnd(v12);
return v10;
}
return result;
}