//
// cocos2d::ZipUtils::decompressString from 0x1800a7ac0 to 0x1800a7ca6 (486 bytes)
//
// 2 xrefs:
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c1df4
//
// 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 11:22:16 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall cocos2d::ZipUtils::decompressString(__int64 a1, __int64 a2, char a3, unsigned int a4)
{
signed int v6; // edx
unsigned __int8 *v7; // rcx
int v8; // ebx
unsigned __int8 *v9; // rcx
void *v10; // rcx
int v11; // eax
unsigned __int8 *v12; // rbx
signed int v13; // eax
unsigned __int8 *v15; // [rsp+30h] [rbp-50h] BYREF
unsigned int v16; // [rsp+38h] [rbp-48h] BYREF
unsigned __int8 *v17; // [rsp+40h] [rbp-40h] BYREF
void *Block[2]; // [rsp+50h] [rbp-30h] BYREF
__m128i si128; // [rsp+60h] [rbp-20h]
v17 = (unsigned __int8 *)a1;
v6 = *(_DWORD *)(a2 + 16);
if ( v6 <= 0 )
{
LABEL_30:
sub_180016870(a1, a2);
return a1;
}
v15 = nullptr;
if ( a3 )
{
cocos2d::ZipUtils::encryptDecrypt(Block, a2, a4);
v9 = (unsigned __int8 *)Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v9 = (unsigned __int8 *)Block[0];
v8 = base64Decode(v9, si128.m128i_u32[0], (void **)&v15, 1);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v10);
}
}
else
{
v7 = (unsigned __int8 *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v7 = *(unsigned __int8 **)a2;
v8 = base64Decode(v7, v6, (void **)&v15, 1);
}
if ( v8 <= 0 )
{
if ( v15 )
{
j_j_free_0(v15);
v15 = nullptr;
}
goto LABEL_30;
}
v17 = nullptr;
v16 = 0;
v11 = cocos2d::ZipUtils::ccInflateMemoryWithHint(v15, v8, &v17, &v16, 0x100000);
v12 = v17;
if ( v11 || !v17 )
{
j_j_free_0(v17);
v12 = nullptr;
v13 = 0;
}
else
{
v13 = v16;
}
if ( v13 <= 0 )
{
if ( v15 )
{
j_j_free_0(v15);
v15 = nullptr;
}
if ( v12 )
j_j_free_0(v12);
goto LABEL_30;
}
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
LOBYTE(Block[0]) = 0;
sub_180007DF0(Block, v12, v13);
if ( v15 )
{
j_j_free_0(v15);
v15 = nullptr;
}
if ( v12 )
j_j_free_0(v12);
*(_OWORD *)a1 = *(_OWORD *)Block;
*(__m128i *)(a1 + 16) = si128;
return a1;
}