//
// cocos2d::ZipUtils::decompressString from 0x1002dab88 to 0x1002dad94 (524 bytes)
//
// 18 xrefs:
// > sub_10009C054 @ 0x10009c120
// > sub_1000B34EC @ 0x1000b3710
// > sub_1000D0E20 @ 0x1000d0e70
// > GJGameLevel::copyLevelInfo @ 0x1000d18bc
// > GJGameLevel::dataLoaded @ 0x1000d268c
// > PlayLayer::init @ 0x10013e8d4
// > PlayLayer::loadPersistentCheckpoint @ 0x10014adf0
// > PlayLayer::loadPersistentCheckpoint @ 0x10014af38
// > PlayLayer::addLiveStartPosObject @ 0x10014b16c
// > LocalLevelManager::tryRecoverAutoSaves @ 0x10025fdc4
// > LocalLevelManager::importLevelsFromPaths @ 0x1002616a4
// > GManager::loadFromCompressedString @ 0x1002e7a9c
// > LevelEditorLayer::init @ 0x1003f6fd4
// > GJAccountManager::onSyncAccountCompleted @ 0x100445ffc
// > GJAccountManager::onSyncAccountCompleted @ 0x1004460e8
// > sub_1004C9C38 @ 0x1004c9c88
// > EditorSFXManager::importFromString @ 0x1004cab30
// > LevelStatsInfoPopup::buildInfoText @ 0x1004f2e2c
//
// 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 11:02:44 +0000
//
void __usercall cocos2d::ZipUtils::decompressString(void **a1@, int a2@, char a3@, std::string *a4@)
{
void **v5; // x20
int v7; // w9
std::string::size_type v8; // x10
std::string::size_type v9; // x8
std::string::size_type v10; // x22
__int64 v11; // x8
_BYTE *v12; // x10
std::string::value_type v13; // w10
std::string *p_p; // x11
std::string *v15; // x0
__int64 v16; // x21
int v17; // w0
void *v18; // x20
std::string __p; // [xsp+0h] [xbp-40h] BYREF
void *v20; // [xsp+18h] [xbp-28h]
v5 = a1;
v7 = *((char *)a1 + 23);
v8 = *((char *)a1 + 23);
if ( v7 < 0 )
{
v9 = (std::string::size_type)a1[1];
if ( (int)v9 < 1 )
{
sub_1000097D0(a4, *a1, (unsigned __int64)a1[1]);
return;
}
v20 = nullptr;
if ( (a2 & 1) != 0 )
goto LABEL_7;
a1 = (void **)*a1;
LABEL_26:
v16 = sub_1002DD8F8(a1);
goto LABEL_27;
}
if ( !*((_BYTE *)a1 + 23) )
goto LABEL_40;
v20 = nullptr;
if ( !a2 )
goto LABEL_26;
v9 = (std::string::size_type)a1[1];
LABEL_7:
memset(&__p, 0, sizeof(__p));
if ( v7 >= 0 )
v10 = v8;
else
v10 = v9;
std::string::resize(&__p, v10, 0);
if ( v10 )
{
v11 = 0;
do
{
if ( *((char *)v5 + 23) >= 0 )
v12 = v5;
else
v12 = *v5;
v13 = v12[v11] ^ a3;
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
p_p->__r_.__value_.__s.__data_[v11++] = v13;
}
while ( v10 > (unsigned int)v11 );
}
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v15 = &__p;
else
v15 = (std::string *)__p.__r_.__value_.__r.__words[0];
v16 = sub_1002DD8F8(v15);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
LABEL_27:
if ( (int)v16 < 1 )
{
if ( v20 )
{
operator delete[](v20);
v20 = nullptr;
}
LABEL_39:
if ( *((char *)v5 + 23) < 0 )
{
sub_1000097D0(a4, *v5, (unsigned __int64)v5[1]);
return;
}
LABEL_40:
*(_OWORD *)&a4->__r_.__value_.__l.__data_ = *(_OWORD *)v5;
a4->__r_.__value_.__r.__words[2] = (std::string::size_type)v5[2];
return;
}
__p.__r_.__value_.__r.__words[0] = 0;
v17 = sub_1002DBAC8(v20, v16, &__p, 0x100000);
if ( v17 < 1 )
{
if ( v20 )
{
operator delete[](v20);
v20 = nullptr;
}
if ( __p.__r_.__value_.__r.__words[0] )
operator delete[](__p.__r_.__value_.__l.__data_);
goto LABEL_39;
}
a4->__r_.__value_.__r.__words[0] = 0;
a4->__r_.__value_.__l.__size_ = 0;
a4->__r_.__value_.__r.__words[2] = 0;
v18 = (void *)__p.__r_.__value_.__r.__words[0];
std::string::append(a4, __p.__r_.__value_.__l.__data_, (unsigned int)v17);
if ( v20 )
{
operator delete[](v20);
v20 = nullptr;
}
if ( v18 )
operator delete[](v18);
}