//
// sub_1002DD654 from 0x1002dd654 to 0x1002dd7e0 (396 bytes)
//
// 1 xrefs:
// > sub_1002DD8F8 @ 0x1002dd950
//
// This function is hookable on this platform (idp: arm, 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:02:45 +0000
//
__int64 __fastcall sub_1002DD654(unsigned __int8 *a1, unsigned int a2, __int64 a3, unsigned int *a4, char a5)
{
__int64 v6; // x10
__int64 v7; // x13
__int64 v8; // x13
unsigned int v9; // w21
int v10; // w10
unsigned int v11; // w11
__int64 v12; // x12
__int64 v13; // x13
unsigned int v14; // t1
unsigned int v15; // w13
unsigned int v16; // w16
__int64 v17; // x20
unsigned int v19; // w9
v6 = 64;
if ( (a5 & 1) != 0 )
{
do
{
v7 = (unsigned __int8)aAbcdefghijklmn_8[v6];
byte_1009F5DC0[v7] = 1;
byte_1009F5EC0[v7] = v6--;
}
while ( v6 != -1 );
}
else
{
do
{
v8 = (unsigned __int8)aAbcdefghijklmn_9[v6];
byte_1009F5DC0[v8] = 1;
byte_1009F5EC0[v8] = v6--;
}
while ( v6 != -1 );
}
if ( a2 )
{
v9 = 0;
v10 = 0;
v11 = 0;
v12 = a2;
while ( 1 )
{
v14 = *a1++;
v13 = v14;
if ( v14 == 61 )
break;
if ( byte_1009F5DC0[v13] )
{
v15 = v11 + byte_1009F5EC0[v13];
if ( ++v10 == 4 )
{
v11 = 0;
v10 = 0;
*(_BYTE *)(a3 + v9) = BYTE2(v15);
v16 = v9 + 2;
*(_BYTE *)(a3 + v9 + 1) = BYTE1(v15);
v9 += 3;
*(_BYTE *)(a3 + v16) = v15;
}
else
{
v11 = v15 << 6;
}
}
if ( !--v12 )
goto LABEL_19;
}
switch ( v10 )
{
case 3:
v17 = 0;
v19 = v9 + 1;
*(_BYTE *)(a3 + v9) = BYTE2(v11);
v9 += 2;
*(_BYTE *)(a3 + v19) = BYTE1(v11);
break;
case 2:
v17 = 0;
*(_BYTE *)(a3 + v9++) = v11 >> 10;
break;
case 1:
v17 = 1;
fwrite("base64Decode: encoding incomplete: at least 2 bits missing", 0x3Au, 1u, __stderrp);
break;
default:
LABEL_19:
v17 = 0;
break;
}
}
else
{
v17 = 0;
v9 = 0;
}
*a4 = v9;
return v17;
}