//
// cocos2d::ZipUtils::ccDeflateMemory from 0xb2a5fc to 0xb2a74c (336 bytes)
//
// 2 xrefs:
// > cocos2d::ZipUtils::compressString @ 0xb2a79c
// > ??> @ 0x73860
//
// 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)
{
int v6; // w22
unsigned __int8 *v7; // x0
int result; // w0
int v9; // w0
int v10; // w19
int v11; // w19
unsigned __int8 *v12; // x0
unsigned __int8 *v13; // [xsp+48h] [xbp+48h] BYREF
unsigned int v14; // [xsp+50h] [xbp+50h]
unsigned __int8 *v15; // [xsp+60h] [xbp+60h]
int v16; // [xsp+68h] [xbp+68h]
__int64 v17; // [xsp+88h] [xbp+88h]
__int64 v18; // [xsp+90h] [xbp+90h]
__int64 v19; // [xsp+98h] [xbp+98h]
v6 = 0x100000;
v7 = (unsigned __int8 *)operator new[](0x100000u);
*a3 = v7;
v17 = 0;
v18 = 0;
v19 = 0;
v13 = a1;
v14 = a2;
v15 = v7;
v16 = 0x100000;
result = deflateInit2_(&v13, 0xFFFFFFFFLL, 8, 31, 8, 0, "1.2.8", 112);
if ( !result )
{
while ( 1 )
{
v9 = deflate(&v13, 4);
v10 = v9;
if ( v9 == 1 )
{
v11 = v6 - v16;
deflateEnd(&v13);
return v11;
}
if ( v9 >= -4 )
{
if ( v9 <= -3 )
goto LABEL_7;
if ( v9 == 2 )
{
v10 = -3;
LABEL_7:
deflateEnd(&v13);
return v10;
}
}
v12 = (unsigned __int8 *)realloc(*a3, 2 * v6);
*a3 = v12;
if ( !v12 )
break;
v16 = v6;
v15 = &v12[v6];
v6 *= 2;
}
deflateEnd(&v13);
return -4;
}
return result;
}