//
// lws_b64_decode_string from 0xe31434 to 0xe31584 (336 bytes)
//
// 2 xrefs:
// > sub_E31584 @ 0xe31600
// > ??> @ 0x58510
//
// 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 13:09:55 +0000
//
__int64 __fastcall lws_b64_decode_string(_BYTE *a1, _BYTE *a2, int a3)
{
int v3; // w3
unsigned int v4; // w10
__int64 v5; // x6
int v6; // w7
int v7; // w3
int v8; // w5
unsigned __int8 v9; // w3
unsigned __int8 v10; // w4
int v11; // w0
char v13; // [xsp+8h] [xbp-8h]
unsigned __int8 v14; // [xsp+9h] [xbp-7h]
unsigned __int8 v15; // [xsp+Ah] [xbp-6h]
char v16; // [xsp+Bh] [xbp-5h]
v3 = (unsigned __int8)*a1;
if ( *a1 )
{
v4 = 0;
LABEL_3:
v5 = 0;
v6 = 0;
while ( 1 )
{
v7 = v3 - 43;
++a1;
if ( (unsigned __int8)v7 > 0x4Fu || (v8 = (unsigned __int8)aRstuvwxyzAbcde[v7], !aRstuvwxyzAbcde[v7]) || v8 == 36 )
{
v3 = (unsigned __int8)*a1;
if ( !*a1 )
goto LABEL_22;
++v6;
}
else
{
v3 = (unsigned __int8)*a1;
if ( *a1 )
{
++v6;
if ( (_BYTE)v8 != 61 )
{
*(&v13 + v5) = v8 - 62;
goto LABEL_10;
}
}
else
{
LABEL_22:
*(&v13 + v5) = 0;
v3 = 0;
LABEL_10:
if ( ++v5 == 4 || !v3 )
{
if ( (int)(v4 + v6 - 1) <= a3 )
{
if ( v6 > 1 )
{
v9 = v14;
*a2 = (v14 >> 4) | (4 * v13);
if ( v6 == 2 )
{
++a2;
v3 = (unsigned __int8)*a1;
}
else
{
v10 = v15;
a2[1] = (v15 >> 2) | (16 * v9);
if ( v6 == 3 )
{
a2 += 2;
}
else
{
a2 += 3;
*(a2 - 1) = v16 | (v10 << 6);
}
v3 = (unsigned __int8)*a1;
}
}
v4 += v6 - 1;
if ( !v3 )
{
v11 = v4 + 1;
goto LABEL_20;
}
goto LABEL_3;
}
return 0xFFFFFFFFLL;
}
}
}
}
}
v11 = 1;
v4 = 0;
LABEL_20:
if ( a3 <= v11 )
return 0xFFFFFFFFLL;
*a2 = 0;
return v4;
}