//
// cocos2d::ZipUtils::base64EncodeEnc from 0x100205ac0 to 0x100205cb0 (496 bytes)
//
// 15 xrefs:
// > GameLevelManager::uploadLevel @ 0x10053dd84
// > GameLevelManager::uploadLevelList @ 0x10054183e
// > GameLevelManager::downloadLevel @ 0x100544087
// > GameLevelManager::rateStars @ 0x100546286
// > GameLevelManager::updateUserScore @ 0x100549a58
// > GameLevelManager::getLevelLeaderboard @ 0x10054b6e5
// > GameLevelManager::getLevelLeaderboard @ 0x10054bed9
// > GameLevelManager::uploadUserMessage @ 0x10054eb18
// > GameLevelManager::uploadComment @ 0x100551f97
// > GameLevelManager::likeItem @ 0x1005575b6
// > GameLevelManager::getGJSecretReward @ 0x1005586a4
// > GameLevelManager::getGJRewards @ 0x100558e8f
// > GameLevelManager::getGJChallenges @ 0x100559387
// > GameLevelManager::getGJDailyLevelState @ 0x10055988b
// > GJMultiplayerManager::uploadComment @ 0x10065b7ca
//
// 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
//
std::string *__fastcall cocos2d::ZipUtils::base64EncodeEnc(std::string *this, std::string *a2, __int128 *a3, double a4)
{
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v6; // al
char v7; // cl
std::string::size_type size; // r15
char v9; // al
unsigned int v10; // esi
__int64 v11; // rcx
std::string::pointer data; // r10
char *v13; // rax
char v14; // al
std::string::pointer v15; // rdx
std::string::pointer v16; // rdi
__int64 v17; // rsi
int v18; // eax
__int128 v20; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
std::string v22; // [rsp+20h] [rbp-40h] BYREF
std::string::value_type *__s; // [rsp+40h] [rbp-20h] BYREF
v6 = a2->__r_.__value_.__s.0;
v7 = *(_BYTE *)&a2->__r_.__value_.__s.0 & 1;
if ( v7 )
{
if ( !a2->__r_.__value_.__l.__size_ )
{
sub_100006B70(this, a2->__r_.__value_.__l.__data_, 0, a4);
return this;
}
}
else if ( !*(_BYTE *)&v6 )
{
*this = *a2;
return this;
}
if ( (*(_BYTE *)a3 & 1) != 0 )
{
sub_100006B70(&v20, *((const void **)a3 + 2), *((_QWORD *)a3 + 1), a4);
v6 = a2->__r_.__value_.__s.0;
v7 = *(_BYTE *)&a2->__r_.__value_.__s.0 & 1;
}
else
{
__p = *((void **)a3 + 2);
v20 = *a3;
}
memset(&v22, 0, sizeof(v22));
if ( v7 )
size = a2->__r_.__value_.__l.__size_;
else
size = *(unsigned __int8 *)&v6 >> 1;
std::string::resize(&v22, size, 0);
v9 = v20 & 1;
if ( (v20 & 1) != 0 )
{
v10 = DWORD2(v20);
if ( !size )
goto LABEL_24;
LABEL_15:
v11 = 0;
do
{
data = a2->__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
data = a2->__r_.__value_.__l.__data_;
v13 = (char *)&v20 + 1;
if ( (v20 & 1) != 0 )
v13 = (char *)__p;
v14 = data[v11] ^ v13[(unsigned int)v11 % v10];
v15 = v22.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
v15 = v22.__r_.__value_.__l.__data_;
v15[v11++] = v14;
}
while ( size > (unsigned int)v11 );
v9 = v20 & 1;
goto LABEL_24;
}
v10 = (unsigned __int8)v20 >> 1;
if ( size )
goto LABEL_15;
LABEL_24:
if ( v9 )
operator delete(__p);
__s = nullptr;
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
{
v16 = v22.__r_.__value_.__l.__data_;
v17 = LODWORD(v22.__r_.__value_.__r.__words[1]);
}
else
{
v17 = *(_BYTE *)&v22.__r_.__value_.__l.0 >> 1;
v16 = v22.__r_.__value_.__s.__data_;
}
v18 = sub_100329370(v16, v17, &__s, 1);
if ( v18 <= 0 )
{
if ( __s )
{
operator delete[](__s);
__s = nullptr;
}
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(this, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_, 0.0);
}
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)v18);
if ( __s )
operator delete[](__s);
}
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v22.__r_.__value_.__l.__data_);
return this;
}