//
// cocos2d::ZipUtils::base64EncodeEnc from 0xb29354 to 0xb295d0 (636 bytes)
//
// 16 xrefs:
// > GameLevelManager::uploadLevel @ 0x71c4b4
// > GameLevelManager::downloadLevel @ 0x71e240
// > GameLevelManager::rateStars @ 0x71eda4
// > GameLevelManager::getLevelLeaderboard @ 0x720aa0
// > GameLevelManager::getLevelLeaderboard @ 0x720f10
// > GameLevelManager::uploadUserMessage @ 0x722d04
// > GameLevelManager::uploadComment @ 0x724534
// > GameLevelManager::likeItem @ 0x728d94
// > GameLevelManager::getGJSecretReward @ 0x729874
// > GameLevelManager::getGJRewards @ 0x729fbc
// > GameLevelManager::getGJChallenges @ 0x72a6ec
// > GameLevelManager::getGJDailyLevelState @ 0x72ad34
// > GameLevelManager::uploadLevelList @ 0x72d5b4
// > GameLevelManager::updateUserScore @ 0x737d20
// > GJMultiplayerManager::uploadComment @ 0x983c0c
// > ??> @ 0xa11d8
//
// 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
//
char **__usercall cocos2d::ZipUtils::base64EncodeEnc@(_QWORD *a1@, char **a2@)
{
unsigned __int64 v3; // x23
char *v4; // x19
__int64 v5; // x21
unsigned int v6; // w28
__int64 v7; // x26
char *v8; // x0
char *v9; // x2
char *v10; // x27
char v11; // w24
__int64 v12; // x19
char *v13; // x0
int v14; // w0
char *v15; // x0
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x19
int v20; // w1
char *v22; // [xsp+70h] [xbp+70h] BYREF
void *p; // [xsp+78h] [xbp+78h] BYREF
char *v24; // [xsp+80h] [xbp+80h] BYREF
if ( *(_QWORD *)(*a1 - 24LL) )
{
sub_D18D28(&v24);
v3 = *(_QWORD *)(*a1 - 24LL);
v22 = &byte_124B6C8;
sub_D17E50(&v22, v3, 0);
v4 = v24;
v5 = *((_QWORD *)v24 - 3);
if ( v3 )
{
v6 = 0;
v7 = 0;
do
{
v8 = v22;
if ( (*((_DWORD *)v22 - 2) & 0x80000000) == 0 )
{
sub_D176A8(&v22);
v8 = v22;
}
v9 = v24;
v10 = &v8[v7];
v11 = *(_BYTE *)(*a1 + v7);
v12 = v6 % (unsigned int)v5;
if ( (*((_DWORD *)v24 - 2) & 0x80000000) == 0 )
{
sub_D176A8(&v24);
v9 = v24;
}
v7 = ++v6;
*v10 = v11 ^ v9[v12];
}
while ( v3 > v6 );
v4 = v24;
}
v13 = v4 - 24;
if ( v4 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v4 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v4 - 2);
*((_DWORD *)v4 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v13);
}
p = nullptr;
v14 = base64Encode((__int64)v22, (const unsigned __int8 *)*((unsigned int *)v22 - 6), &p, 1u);
if ( v14 <= 0 )
{
if ( p )
{
operator delete[](p);
p = nullptr;
}
sub_D18D28(a2);
}
else
{
v24 = &byte_124B6C8;
sub_D15FD4(&v24, p, v14);
if ( p )
{
operator delete[](p);
p = nullptr;
}
*a2 = v24;
}
v15 = v22 - 24;
if ( v22 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v22 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v22 - 2);
*((_DWORD *)v22 - 2) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v15);
}
}
else
{
sub_D18D28(a2);
}
return a2;
}