//
// sub_180095FD0 from 0x180095fd0 to 0x1800963e3 (1043 bytes)
//
// 2 xrefs:
// > base64Decode @ 0x180096646
// > ??> @ 0x1801c0684
//
// 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:09 +0000
//
__int64 __fastcall sub_180095FD0(unsigned __int8 *a1, unsigned int a2, __int64 a3, unsigned int *a4, char a5)
{
unsigned int v5; // r11d
unsigned int v6; // ebx
int v11; // r8d
unsigned __int8 *v12; // rdx
__int64 v13; // rax
__int64 v14; // rcx
__int64 v15; // rcx
__int64 v16; // rcx
__int64 v17; // rcx
__int64 v18; // rcx
__int64 v19; // rcx
__int64 v20; // rcx
__int64 v21; // rcx
__int64 v22; // rcx
__int64 v23; // rcx
__int64 v24; // rcx
__int64 v25; // rcx
unsigned __int8 *v26; // rdx
__int64 v27; // rax
__int64 v28; // rcx
__int64 v29; // rcx
__int64 v30; // rcx
__int64 v31; // rcx
__int64 v32; // rcx
__int64 v33; // rcx
__int64 v34; // rcx
__int64 v35; // rcx
__int64 v36; // rcx
__int64 v37; // rcx
__int64 v38; // rcx
__int64 v39; // rcx
int v40; // ecx
int v41; // edx
unsigned int v42; // r8d
__int64 v43; // r9
int v44; // edx
__int64 v45; // rax
__int64 v46; // rbx
__int64 v47; // rbx
int v48; // ecx
int v49; // ecx
__int64 v50; // rax
__int64 v51; // rbx
__int64 v52; // rax
FILE *v53; // rax
FILE *v54; // rax
v5 = 0;
v6 = 0;
v11 = 64;
if ( a5 )
{
v26 = (unsigned __int8 *)&aAbcdefghijklmn[62];
do
{
v27 = v26[2];
v28 = v26[1];
v26 -= 13;
byte_1801B2860[v27 + 256] = v11;
byte_1801B2860[v27] = 1;
byte_1801B2860[v28 + 256] = v11 - 1;
byte_1801B2860[v28] = 1;
v29 = v26[13];
byte_1801B2860[v29 + 256] = v11 - 2;
byte_1801B2860[v29] = 1;
v30 = v26[12];
byte_1801B2860[v30 + 256] = v11 - 3;
byte_1801B2860[v30] = 1;
v31 = v26[11];
byte_1801B2860[v31 + 256] = v11 - 4;
byte_1801B2860[v31] = 1;
v32 = v26[10];
byte_1801B2860[v32 + 256] = v11 - 5;
byte_1801B2860[v32] = 1;
v33 = v26[9];
byte_1801B2860[v33 + 256] = v11 - 6;
byte_1801B2860[v33] = 1;
v34 = v26[8];
byte_1801B2860[v34 + 256] = v11 - 7;
byte_1801B2860[v34] = 1;
v35 = v26[7];
byte_1801B2860[v35 + 256] = v11 - 8;
byte_1801B2860[v35] = 1;
v36 = v26[6];
byte_1801B2860[v36 + 256] = v11 - 9;
byte_1801B2860[v36] = 1;
v37 = v26[5];
byte_1801B2860[v37 + 256] = v11 - 10;
byte_1801B2860[v37] = 1;
v38 = v26[4];
byte_1801B2860[v38 + 256] = v11 - 11;
LOBYTE(v27) = v11 - 12;
v11 -= 13;
byte_1801B2860[v38] = 1;
v39 = v26[3];
byte_1801B2860[v39] = 1;
byte_1801B2860[v39 + 256] = v27;
}
while ( v11 >= 0 );
}
else
{
v12 = (unsigned __int8 *)&aAbcdefghijklmn_0[62];
do
{
v13 = v12[2];
v14 = v12[1];
v12 -= 13;
byte_1801B2860[v13 + 256] = v11;
byte_1801B2860[v13] = 1;
byte_1801B2860[v14 + 256] = v11 - 1;
byte_1801B2860[v14] = 1;
v15 = v12[13];
byte_1801B2860[v15 + 256] = v11 - 2;
byte_1801B2860[v15] = 1;
v16 = v12[12];
byte_1801B2860[v16 + 256] = v11 - 3;
byte_1801B2860[v16] = 1;
v17 = v12[11];
byte_1801B2860[v17 + 256] = v11 - 4;
byte_1801B2860[v17] = 1;
v18 = v12[10];
byte_1801B2860[v18 + 256] = v11 - 5;
byte_1801B2860[v18] = 1;
v19 = v12[9];
byte_1801B2860[v19 + 256] = v11 - 6;
byte_1801B2860[v19] = 1;
v20 = v12[8];
byte_1801B2860[v20 + 256] = v11 - 7;
byte_1801B2860[v20] = 1;
v21 = v12[7];
byte_1801B2860[v21 + 256] = v11 - 8;
byte_1801B2860[v21] = 1;
v22 = v12[6];
byte_1801B2860[v22 + 256] = v11 - 9;
byte_1801B2860[v22] = 1;
v23 = v12[5];
byte_1801B2860[v23 + 256] = v11 - 10;
byte_1801B2860[v23] = 1;
v24 = v12[4];
byte_1801B2860[v24 + 256] = v11 - 11;
LOBYTE(v13) = v11 - 12;
v11 -= 13;
byte_1801B2860[v24] = 1;
v25 = v12[3];
byte_1801B2860[v25] = 1;
byte_1801B2860[v25 + 256] = v13;
}
while ( v11 >= 0 );
}
v40 = 0;
v41 = 0;
v42 = 0;
if ( !a2 )
{
LABEL_21:
if ( v42 >= a2 || !v40 )
goto LABEL_25;
v54 = _acrt_iob_func(2u);
sub_180096710(v54, "base64 encoding incomplete: at least %d bits truncated");
LABEL_24:
v5 = 1;
goto LABEL_25;
}
while ( 1 )
{
v43 = *a1;
if ( (_DWORD)v43 == 61 )
break;
if ( byte_1801B2860[v43] )
{
++v40;
v44 = (char)byte_1801B2860[v43 + 256] + v41;
if ( v40 == 4 )
{
v45 = v6;
v46 = v6 + 1;
*(_BYTE *)(v45 + a3) = BYTE2(v44);
v40 = 0;
*(_BYTE *)(v46 + a3) = BYTE1(v44);
v47 = (unsigned int)(v46 + 1);
*(_BYTE *)(v47 + a3) = v44;
v6 = v47 + 1;
v41 = 0;
}
else
{
v41 = v44 << 6;
}
}
++v42;
++a1;
if ( v42 >= a2 )
goto LABEL_21;
}
v48 = v40 - 1;
if ( !v48 )
{
v53 = _acrt_iob_func(2u);
sub_180096710(v53, "base64Decode: encoding incomplete: at least 2 bits missing");
goto LABEL_24;
}
v49 = v48 - 1;
if ( v49 )
{
if ( v49 == 1 )
{
v50 = v6;
v51 = v6 + 1;
*(_BYTE *)(v50 + a3) = BYTE2(v41);
*(_BYTE *)(v51 + a3) = BYTE1(v41);
v6 = v51 + 1;
}
}
else
{
v52 = v6++;
*(_BYTE *)(v52 + a3) = v41 >> 10;
}
LABEL_25:
*a4 = v6;
return v5;
}