//
// cocos2d::ZipUtils::base64EncodeEnc from 0x1800a68f0 to 0x1800a6aae (446 bytes)
//
// 2 xrefs:
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c1cf8
//
// 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 11:22:16 +0000
//
// Hidden C++ exception states: #wind=3
_OWORD *__fastcall cocos2d::ZipUtils::base64EncodeEnc(_OWORD *a1, __int64 a2, void *a3)
{
__int64 v6; // rax
unsigned __int8 *v7; // rcx
int v8; // eax
__m128i si128; // xmm6
void *v10; // rcx
void *Block[3]; // [rsp+30h] [rbp-39h] BYREF
_QWORD v13[2]; // [rsp+48h] [rbp-21h] BYREF
__m128i v14; // [rsp+58h] [rbp-11h]
__int128 Src; // [rsp+68h] [rbp-1h] BYREF
__m128i v16; // [rsp+78h] [rbp+Fh]
Block[0] = a1;
Block[2] = a3;
if ( *(_QWORD *)(a2 + 16) )
{
v6 = sub_180016870((__int64)&Src, (__int64)a3);
cocos2d::ZipUtils::encryptDecryptWKey(v13, a2, v6);
Block[0] = nullptr;
v7 = (unsigned __int8 *)v13;
if ( v14.m128i_i64[1] > 0xFuLL )
v7 = (unsigned __int8 *)v13[0];
v8 = base64Encode(v7, v14.m128i_u32[0], Block, 1);
if ( v8 <= 0 )
{
if ( Block[0] )
{
j_j_free_0(Block[0]);
Block[0] = nullptr;
}
sub_180016870((__int64)a1, a2);
if ( v14.m128i_i64[1] <= 0xFuLL )
goto LABEL_12;
v10 = (void *)v13[0];
if ( (unsigned __int64)(v14.m128i_i64[1] + 1) < 0x1000
|| (v10 = *(void **)(v13[0] - 8LL), (unsigned __int64)(v13[0] - (_QWORD)v10 - 8LL) <= 0x1F) )
{
LABEL_11:
j_j_free_0(v10);
LABEL_12:
si128 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
LABEL_13:
v14 = si128;
LOBYTE(v13[0]) = 0;
goto LABEL_14;
}
}
else
{
Src = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
v16 = si128;
LOBYTE(Src) = 0;
sub_180007DF0(&Src, Block[0], v8);
if ( Block[0] )
{
j_j_free_0(Block[0]);
Block[0] = nullptr;
}
*a1 = Src;
a1[1] = v16;
if ( v14.m128i_i64[1] <= 0xFuLL )
goto LABEL_13;
v10 = (void *)v13[0];
if ( (unsigned __int64)(v14.m128i_i64[1] + 1) < 0x1000 )
goto LABEL_11;
v10 = *(void **)(v13[0] - 8LL);
if ( (unsigned __int64)(v13[0] - (_QWORD)v10 - 8LL) <= 0x1F )
goto LABEL_11;
}
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
sub_180016870((__int64)a1, a2);
LABEL_14:
sub_180005C70((__int64)a3);
return a1;
}