int base64_decodestring(char *param_1,void *param_2,int param_3)
{
char cVar1;
char *pcVar2;
char *pcVar3;
int iVar4;
size_t __n;
int iVar5;
int iVar6;
byte local_70;
byte local_6f;
byte local_6e;
uint local_60;
uint local_5c;
uint local_58;
uint local_54;
void *local_48;
void *local_44;
uint local_40;
int local_3c;
char *local_38;
byte *local_34;
int local_30;
local_48 = (void *)((int)param_2 + param_3);
local_38 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
iVar6 = 0;
iVar5 = 0;
local_3c = 1;
local_34 = &local_70;
local_30 = 4;
local_40 = 0x40;
cVar1 = *param_1;
pcVar2 = param_1 + 1;
local_44 = param_2;
while (iVar4 = (int)cVar1, iVar4 != 0) {
if ((((iVar4 != 0x20) && (iVar4 != 9)) && (iVar4 != 10)) && (iVar4 != 0xd)) {
if (iVar6 == local_3c) {
return -1;
}
pcVar3 = strchr(local_38,iVar4);
if (pcVar3 == (char *)0x0) goto LAB_00417f68;
iVar4 = iVar5 + 2;
iVar5 = iVar5 + 1;
*(int *)(local_34 + iVar4 * 4 + 8) = (int)pcVar3 - (int)local_38 //possible issue identified - semgrep
if (iVar5 == local_30) {
if ((local_60 == local_40) || (local_5c == local_40)) goto LAB_00417f68;
if (local_58 == local_40) {
if (local_54 != local_40) {
return -1;
}
if ((local_5c & 0xf) != 0) {
return -1;
}
LAB_004180f0:
if (local_58 != local_40) goto LAB_00418048;
local_58 = 0;
if (local_54 == local_40) {
__n = 1 //possible issue identified - semgrep
goto LAB_00418134;
}
iVar6 = 1;
__n = 1 //possible issue identified - semgrep
}
else {
if (local_54 == local_40) {
if ((local_58 & 3) != 0) {
return -1;
}
goto LAB_004180f0;
}
LAB_00418048:
__n = 2 //possible issue identified - semgrep
if (local_54 == local_40) {
LAB_00418134:
local_54 = 0;
iVar6 = 1;
}
else {
__n = 3 //possible issue identified - semgrep
}
}
if (local_48 <= (void *)((int)param_2 + __n)) {
return -1;
}
local_6f = (byte)((int)local_58 >> 2) | (byte)(local_5c << 4);
local_70 = (byte)((int)local_5c >> 4) | (byte)(local_60 << 2);
local_6e = (byte)(local_58 << 6) | (byte)local_54;
memcpy(param_2,local_34,__n) //possible issue identified - semgrep
iVar5 = 0;
param_2 = (void *)((int)param_2 + __n);
}
}
cVar1 = *pcVar2;
pcVar2 = pcVar2 + 1;
}
iVar6 = (int)param_2 - (int)local_44;
if (iVar5 != 0) {
LAB_00417f68:
iVar6 = -1;
}
return iVar6;
}