//
// cocos2d::ZipUtils::ccDeflateMemory from 0x1002da7e8 to 0x1002da900 (280 bytes)
//
// 1 xrefs:
// > cocos2d::ZipUtils::compressString @ 0x1002da5e0
//
// This function is hookable on this platform (idp: arm, 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 11:02:44 +0000
//
__int64 __fastcall cocos2d::ZipUtils::ccDeflateMemory(Bytef *a1, uInt a2, void **a3, int a4)
{
Bytef *v8; // x0
__int64 v9; // x20
signed int i; // w21
__int64 v11; // x0
char *v12; // x0
z_stream v14; // [xsp+0h] [xbp-A0h] BYREF
v8 = (Bytef *)operator new[](0x100000u);
*a3 = v8;
memset(&v14.zalloc, 0, 24);
v14.next_in = a1;
v14.avail_in = a2;
v14.next_out = v8;
v14.avail_out = 0x100000;
v9 = deflateInit2_(&v14, a4, 8, 31, 8, 0, "1.2.12", 112);
if ( !(_DWORD)v9 )
{
for ( i = 0x100000; ; i *= 2 )
{
v11 = deflate(&v14, 4);
v9 = v11;
if ( (unsigned int)(v11 + 4) < 2 )
break;
if ( (_DWORD)v11 == 1 )
{
v9 = i - v14.avail_out;
break;
}
if ( (_DWORD)v11 == 2 )
{
v9 = 4294967293LL;
break;
}
v12 = (char *)realloc(*a3, 2 * i);
*a3 = v12;
if ( !v12 )
{
v9 = 4294967292LL;
break;
}
v14.next_out = (Bytef *)&v12[i];
v14.avail_out = i;
}
deflateEnd(&v14);
}
return v9;
}