//
// cocos2d::ZipUtils::decompressString2 from 0x1800a3e60 to 0x1800a412d (717 bytes)
//
// 3 xrefs:
// > DS_Dictionary::loadRootSubDictFromCompressedFile @ 0x18001bb9c
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b7b3c
//
// 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
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall cocos2d::ZipUtils::decompressString2(__int64 a1, void *a2, char a3, signed int a4, unsigned int a5)
{
signed int v5; // esi
int v8; // edi
unsigned __int8 *v9; // rcx
void *v10; // rcx
void *v11; // rcx
int v12; // eax
unsigned __int8 *v13; // rdi
signed int v14; // eax
unsigned __int8 *v16; // [rsp+30h] [rbp-41h] BYREF
unsigned int v17; // [rsp+38h] [rbp-39h] BYREF
unsigned __int8 *v18; // [rsp+40h] [rbp-31h] BYREF
void *Src[2]; // [rsp+50h] [rbp-21h] BYREF
__m128i si128; // [rsp+60h] [rbp-11h]
void *Block[2]; // [rsp+70h] [rbp-1h] BYREF
__m128i v22; // [rsp+80h] [rbp+Fh]
v5 = a4;
v18 = (unsigned __int8 *)a1;
if ( !a2 || a4 <= 0 )
{
*(_OWORD *)a1 = 0;
*(_QWORD *)(a1 + 16) = 0;
*(_QWORD *)(a1 + 24) = 15;
*(_BYTE *)a1 = 0;
return a1;
}
v16 = nullptr;
if ( a3 )
{
*(_OWORD *)Src = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Src[0]) = 0;
sub_180007CF0(Src, a2, a4);
cocos2d::ZipUtils::encryptDecrypt(Block, Src, a5);
v5 = v22.m128i_i32[0];
v9 = (unsigned __int8 *)Block;
if ( v22.m128i_i64[1] > 0xFuLL )
v9 = (unsigned __int8 *)Block[0];
v8 = base64Decode(v9, v22.m128i_i32[0], (void **)&v16, 1);
if ( v22.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(v22.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v10);
}
v22 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Block[0]) = 0;
if ( si128.m128i_i64[1] > 0xFuLL )
{
v11 = Src[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v11 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v11);
}
}
else
{
v8 = base64Decode((unsigned __int8 *)a2, a4, (void **)&v16, 1);
}
if ( v8 <= 0 )
{
if ( v16 )
{
j_j_free_0(v16);
v16 = nullptr;
}
goto LABEL_32;
}
v18 = nullptr;
v17 = 0;
v12 = cocos2d::ZipUtils::ccInflateMemoryWithHint(v16, v8, &v18, &v17, 0x100000);
v13 = v18;
if ( v12 || !v18 )
{
j_j_free_0(v18);
v13 = nullptr;
v14 = 0;
}
else
{
v14 = v17;
}
if ( v14 <= 0 )
{
if ( v16 )
{
j_j_free_0(v16);
v16 = nullptr;
}
if ( v13 )
j_j_free_0(v13);
LABEL_32:
*(_OWORD *)Src = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Src[0]) = 0;
sub_180007CF0(Src, a2, v5);
*(_OWORD *)a1 = *(_OWORD *)Src;
*(__m128i *)(a1 + 16) = si128;
return a1;
}
*(_OWORD *)Src = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Src[0]) = 0;
sub_180007CF0(Src, v13, v14);
if ( v16 )
{
j_j_free_0(v16);
v16 = nullptr;
}
if ( v13 )
j_j_free_0(v13);
*(_OWORD *)a1 = *(_OWORD *)Src;
*(__m128i *)(a1 + 16) = si128;
return a1;
}