//
// cocos2d::ZipUtils::base64EncodeEnc from 0x1001e8ec0 to 0x1001e90b0 (496 bytes)
//
// 13 xrefs:
// > GameLevelManager::uploadLevel @ 0x100555c24
// > GameLevelManager::uploadLevelList @ 0x10055a20a
// > GameLevelManager::downloadLevel @ 0x10055e9fe
// > sub_10055EFA0 @ 0x10055f072
// > GameLevelManager::rateStars @ 0x100561866
// > GameLevelManager::updateUserScore @ 0x1005644e4
// > GameLevelManager::getLevelLeaderboard @ 0x100565dd5
// > GameLevelManager::getLevelLeaderboard @ 0x1005665c9
// > GameLevelManager::uploadUserMessage @ 0x100569328
// > GameLevelManager::uploadComment @ 0x10056caae
// > GameLevelManager::likeItem @ 0x10057eba6
// > GameLevelManager::getGJChallenges @ 0x100580687
// > GJMultiplayerManager::uploadComment @ 0x10073ae2a
//
// 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
//
std::string *__fastcall cocos2d::ZipUtils::base64EncodeEnc(std::string *this, std::string *a2, __int128 *a3)
{
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v5; // al
char v6; // cl
std::string::size_type size; // r15
char v8; // al
unsigned int v9; // esi
__int64 v10; // rcx
std::string::pointer data; // r10
char *v12; // rax
char v13; // al
std::string::pointer v14; // rdx
std::string::pointer v15; // rdi
__int64 v16; // rsi
int v17; // eax
__int128 v19; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
std::string v21; // [rsp+20h] [rbp-40h] BYREF
std::string::value_type *__s; // [rsp+40h] [rbp-20h] BYREF
v5 = a2->__r_.__value_.__s.0;
v6 = *(_BYTE *)&a2->__r_.__value_.__s.0 & 1;
if ( v6 )
{
if ( !a2->__r_.__value_.__l.__size_ )
{
sub_10001AD30(this, a2->__r_.__value_.__l.__data_, 0);
return this;
}
}
else if ( !*(_BYTE *)&v5 )
{
*this = *a2;
return this;
}
if ( (*(_BYTE *)a3 & 1) != 0 )
{
sub_10001AD30(&v19, *((const void **)a3 + 2), *((_QWORD *)a3 + 1));
v5 = a2->__r_.__value_.__s.0;
v6 = *(_BYTE *)&a2->__r_.__value_.__s.0 & 1;
}
else
{
__p = *((void **)a3 + 2);
v19 = *a3;
}
memset(&v21, 0, sizeof(v21));
if ( v6 )
size = a2->__r_.__value_.__l.__size_;
else
size = *(unsigned __int8 *)&v5 >> 1;
std::string::resize(&v21, size, 0);
v8 = v19 & 1;
if ( (v19 & 1) != 0 )
{
v9 = DWORD2(v19);
if ( !size )
goto LABEL_24;
LABEL_15:
v10 = 0;
do
{
data = a2->__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
data = a2->__r_.__value_.__l.__data_;
v12 = (char *)&v19 + 1;
if ( (v19 & 1) != 0 )
v12 = (char *)__p;
v13 = data[v10] ^ v12[(unsigned int)v10 % v9];
v14 = v21.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
v14 = v21.__r_.__value_.__l.__data_;
v14[v10++] = v13;
}
while ( size > (unsigned int)v10 );
v8 = v19 & 1;
goto LABEL_24;
}
v9 = (unsigned __int8)v19 >> 1;
if ( size )
goto LABEL_15;
LABEL_24:
if ( v8 )
operator delete(__p);
__s = nullptr;
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
{
v15 = v21.__r_.__value_.__l.__data_;
v16 = LODWORD(v21.__r_.__value_.__r.__words[1]);
}
else
{
v16 = *(_BYTE *)&v21.__r_.__value_.__l.0 >> 1;
v15 = v21.__r_.__value_.__s.__data_;
}
v17 = sub_100314A90(v15, v16, &__s, 1);
if ( v17 <= 0 )
{
if ( __s )
{
operator delete[](__s);
__s = nullptr;
}
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(this, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
}
else
{
this->__r_.__value_.__r.__words[2] = a2->__r_.__value_.__r.__words[2];
*(_OWORD *)&this->__r_.__value_.__l.0 = *(_OWORD *)&a2->__r_.__value_.__l.0;
}
}
else
{
*(_OWORD *)&this->__r_.__value_.__l.0 = 0;
this->__r_.__value_.__r.__words[2] = 0;
std::string::append(this, __s, (unsigned int)v17);
if ( __s )
operator delete[](__s);
}
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v21.__r_.__value_.__l.__data_);
return this;
}