//
// base64_decode from 0x307514 to 0x30768c (376 bytes)
//
// 0 xrefs:
//
// 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
//
_DWORD *__fastcall base64_decode(_DWORD *a1, _DWORD *a2)
{
int v2; // r4
int v5; // r5
int v6; // r9
char *j; // r3
int v8; // r11
int k; // r4
int v10; // r5
int v11; // r4
int v12; // r3
int i; // r5
char v15; // [sp+4h] [bp-10h] BYREF
char v16; // [sp+5h] [bp-Fh] BYREF
_BYTE v17[2]; // [sp+6h] [bp-Eh] BYREF
char v18; // [sp+8h] [bp-Ch] BYREF
unsigned __int8 v19; // [sp+9h] [bp-Bh]
unsigned __int8 v20; // [sp+Ah] [bp-Ah]
char v21; // [sp+Bh] [bp-9h]
_BYTE v22[4]; // [sp+10h] [bp-4h] BYREF
v2 = 0;
v5 = 0;
v6 = *(_DWORD *)(*a2 - 12);
*a1 = 0;
a1[1] = 0;
a1[2] = 0;
while ( v2 != v6 )
{
v8 = *(unsigned __int8 *)(*a2 + v2);
if ( v8 == 61 || !isalnum(*(unsigned __int8 *)(*a2 + v2)) && (v8 & 0xFB) != 0x2B )
break;
v12 = v5 + 1;
++v2;
v22[v5 - 8] = v8;
if ( v5 == 3 )
{
for ( i = 0; i != 4; ++i )
*(&v18 + i) = sub_774910(&dword_AC59C8, (unsigned __int8)*(&v18 + i), 0);
v15 = ((v19 >> 4) & 3) + 4 * v18;
v16 = ((v20 >> 2) & 0xF) + 16 * v19;
v17[0] = v21 + (v20 << 6);
std::vector::push_back((int)a1, &v15);
std::vector::push_back((int)a1, &v16);
std::vector::push_back((int)a1, v17);
v12 = 0;
}
v5 = v12;
}
if ( v5 )
{
for ( j = &v18 + v5; j - &v18 <= 3; ++j )
*j = 0;
for ( k = 0; k != 4; ++k )
*(&v18 + k) = sub_774910(&dword_AC59C8, (unsigned __int8)*(&v18 + k), 0);
v10 = v5 - 1;
v11 = 0;
v15 = ((v19 >> 4) & 3) + 4 * v18;
v16 = ((v20 >> 2) & 0xF) + 16 * v19;
v17[0] = v21 + (v20 << 6);
while ( v11 < v10 )
std::vector::push_back((int)a1, &v15 + v11++);
}
return a1;
}