//
// cocos2d::ZipUtils::ccDeflateMemory from 0xd9a0e4 to 0xd9a23c (344 bytes)
//
// 3 xrefs:
// > cocos2d::ZipUtils::compressString @ 0xd9b6d0
// > cocos2d::ZipUtils::compressString @ 0xd9b87c
// > ??> @ 0xcc388
//
// 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 13:08:23 +0000
//
__int64 __fastcall cocos2d::ZipUtils::ccDeflateMemory(
cocos2d::ZipUtils *this,
unsigned __int8 *a2,
void **a3,
unsigned __int8 **a4)
{
int v4; // w19
int v7; // w22
__int64 v8; // x0
__int64 result; // x0
int v10; // w0
unsigned int v11; // w19
unsigned int v12; // w19
char *v13; // x0
__int64 v14; // [xsp+48h] [xbp+48h]
cocos2d::ZipUtils *v15; // [xsp+58h] [xbp+58h] BYREF
int v16; // [xsp+60h] [xbp+60h]
char *v17; // [xsp+70h] [xbp+70h]
int v18; // [xsp+78h] [xbp+78h]
__int64 v19; // [xsp+98h] [xbp+98h]
__int64 v20; // [xsp+A0h] [xbp+A0h]
__int64 v21; // [xsp+A8h] [xbp+A8h]
v4 = (int)a2;
v14 = (unsigned int)a4;
v7 = 0x100000;
v8 = operator new[](0x100000u);
*a3 = (void *)v8;
v19 = 0;
v20 = 0;
v21 = 0;
v15 = this;
v16 = v4;
v17 = (char *)v8;
v18 = 0x100000;
result = deflateInit2_(&v15, v14, 8, 31, 8, 0, "1.2.8", 112);
if ( !(_DWORD)result )
{
while ( 1 )
{
v10 = deflate(&v15, 4);
v11 = v10;
if ( v10 == 1 )
{
v12 = v7 - v18;
deflateEnd(&v15);
return v12;
}
if ( v10 >= -4 )
{
if ( v10 <= -3 )
goto LABEL_7;
if ( v10 == 2 )
{
v11 = -3;
LABEL_7:
deflateEnd(&v15);
return v11;
}
}
v13 = (char *)realloc(*a3, 2 * v7);
*a3 = v13;
if ( !v13 )
break;
v18 = v7;
v17 = &v13[v7];
v7 *= 2;
}
deflateEnd(&v15);
return 4294967292LL;
}
return result;
}