//
// cocos2d::ZipUtils::ccInflateGZipFile from 0x1800a3840 to 0x1800a3921 (225 bytes)
//
// 5 xrefs:
// > sub_1800AA090 @ 0x1800aa3fd
// > ??> @ 0x18013f9b4
// > ??> @ 0x18013f9cc
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b7ae8
//
// 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
//
__int64 __fastcall cocos2d::ZipUtils::ccInflateGZipFile(const char *a1, unsigned __int8 **a2)
{
unsigned int v3; // edi
__int64 v4; // r14
__int64 result; // rax
unsigned int v6; // ebx
unsigned int v7; // ebp
unsigned __int8 *v8; // rax
int v9; // eax
bool v10; // zf
unsigned __int8 *v11; // rax
v3 = 0;
v4 = gzopen(a1, "rb");
if ( !v4 )
return 0xFFFFFFFFLL;
v6 = 0x80000;
v7 = 0x80000;
v8 = (unsigned __int8 *)malloc(0x80000u);
*a2 = v8;
v9 = gzread(v4, v8, 0x80000);
v10 = v9 == 0;
if ( v9 < 0 )
{
LABEL_8:
free(*a2);
result = 0xFFFFFFFFLL;
*a2 = nullptr;
}
else
{
while ( !v10 )
{
v3 += v9;
if ( v9 < v6 )
break;
v7 += 2 * v6;
v6 *= 2;
v11 = (unsigned __int8 *)realloc(*a2, v7);
if ( v11 )
{
*a2 = v11;
v9 = gzread(v4, &v11[v3], v6);
v10 = v9 == 0;
if ( v9 >= 0 )
continue;
}
goto LABEL_8;
}
gzclose(v4);
return v3;
}
return result;
}