//
// sub_1001E99E0 from 0x1001e99e0 to 0x1001e9b3d (349 bytes)
//
// 4 xrefs:
// > cocos2d::ZipUtils::decompressString2 @ 0x1001e8846
// > sub_1001E89A0 @ 0x1001e89ba
// > cocos2d::ZipUtils::decompressString @ 0x1001e8b6f
// > sub_1001E9B60 @ 0x1001e9b77
//
// This function is hookable on this platform (idp: pc, 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 12:26:30 +0000
//
__int64 __fastcall sub_1001E99E0(Bytef *a1, uInt a2, void **a3, _DWORD *a4, int a5)
{
signed int v5; // r14d
int v8; // eax
Bytef *v9; // rax
unsigned int v10; // r13d
char *v11; // rax
z_stream strm; // [rsp+0h] [rbp-A0h] BYREF
_DWORD *v14; // [rsp+70h] [rbp-30h]
v5 = a5;
v8 = -1;
if ( a5 >= 0 )
v8 = a5;
v9 = (Bytef *)operator new[](v8);
*a3 = v9;
memset(&strm.zalloc, 0, 24);
strm.next_in = a1;
strm.avail_in = a2;
strm.next_out = v9;
strm.avail_out = v5;
v10 = inflateInit2_(&strm, 47, "1.2.12", 112);
if ( !v10 )
{
v14 = a4;
while ( 1 )
{
v10 = inflate(&strm, 0);
switch ( v10 )
{
case 0xFFFFFFFB:
if ( strm.avail_in )
goto LABEL_7;
inflateEnd(&strm);
return (unsigned int)-3;
case 0xFFFFFFFC:
case 0xFFFFFFFD:
goto LABEL_11;
case 1u:
*v14 = v5 - strm.avail_out;
return (unsigned int)inflateEnd(&strm);
case 2u:
v10 = -3;
LABEL_11:
inflateEnd(&strm);
return v10;
default:
LABEL_7:
v11 = (char *)realloc(*a3, 2 * v5);
*a3 = v11;
if ( !v11 )
{
inflateEnd(&strm);
return (unsigned int)-4;
}
strm.next_out = (Bytef *)&v11[v5];
strm.avail_out = v5;
v5 *= 2;
break;
}
}
}
return v10;
}