int http_base64decode(unsigned char *src, int src_len, unsigned char *dst) {
  int i = 0, j = 0;
  char base64_decode_map[256] = {
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62,  255,
      255, 255, 63,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  255, 255,
      255, 0,   255, 255, 255, 0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
      10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,
      25,  255, 255, 255, 255, 255, 255, 26,  27,  28,  29,  30,  31,  32,  33,
      34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,
      49,  50,  51,  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
      255};
  for (; i < src_len; i += 4) {
    dst[j++] =
        (base64_decode_map[src[i]] << 2) | (base64_decode_map[src[i + 1]] >> 4);
    dst[j++] = (base64_decode_map[src[i + 1]] << 4) |
               (base64_decode_map[src[i + 2]] >> 2);
    dst[j++] =
        (base64_decode_map[src[i + 2]] << 6) | (base64_decode_map[src[i + 3]]);
  }
  dst[j] = '\0';
  return j;
}


x86 assembly (clang, -O0):
<http_base64decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
lea    0xebe(%rip),%rsi
mov    $0x100,%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1251 <http_base64decode+0x141>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
movsbl -0x120(%rbp,%rax,1),%eax
ff
shl    $0x2,%eax
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
movsbl -0x120(%rbp,%rcx,1),%ecx
ff
sar    $0x4,%ecx
or     %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x20(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
movsbl -0x120(%rbp,%rax,1),%eax
ff
shl    $0x4,%eax
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
movsbl -0x120(%rbp,%rcx,1),%ecx
ff
sar    $0x2,%ecx
or     %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x20(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
movsbl -0x120(%rbp,%rax,1),%eax
ff
shl    $0x6,%eax
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
movsbl -0x120(%rbp,%rcx,1),%ecx
ff
or     %ecx,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x20(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <http_base64decode+0x3c>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_base64decode>:
test   %esi,%esi
jle    1191 <http_base64decode+0x91>
mov    %esi,%r8d
xor    %r11d,%r11d
lea    0xeeb(%rip),%r9
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rdi,%r11,1),%ecx
movzbl (%rcx,%r9,1),%r10d
shl    $0x2,%r10b
movzbl 0x1(%rdi,%r11,1),%ecx
movzbl (%rcx,%r9,1),%ecx
sar    $0x4,%cl
or     %r10b,%cl
mov    %cl,(%rdx,%rax,1)
movzbl 0x1(%rdi,%r11,1),%ecx
movzbl (%rcx,%r9,1),%r10d
shl    $0x4,%r10b
movzbl 0x2(%rdi,%r11,1),%ecx
movzbl (%rcx,%r9,1),%ecx
sar    $0x2,%cl
or     %r10b,%cl
mov    %cl,0x1(%rdx,%rax,1)
movzbl 0x2(%rdi,%r11,1),%ecx
movzbl (%rcx,%r9,1),%ecx
shl    $0x6,%cl
movzbl 0x3(%rdi,%r11,1),%esi
or     (%rsi,%r9,1),%cl
mov    %cl,0x2(%rdx,%rax,1)
add    $0x3,%rax
add    $0x4,%r11
cmp    %r8,%r11
jb     1120 <http_base64decode+0x20>
jmp    1193 <http_base64decode+0x93>
xor    %eax,%eax
mov    %eax,%ecx
movb   $0x0,(%rdx,%rcx,1)
ret

LLVM IR (-O0):
@__const.http_base64decode.base64_decode_map = [256 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF>\FF\FF\FF?456789:;<=\FF\FF\FF\00\FF\FF\FF\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\FF\FF\FF\FF\FF\FF\1A\1B\1C\1D\1E\1F !\22#$%&'()*+,-./0123\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF"
define i32 @http_base64decode(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
%10 = bitcast [256 x i8]* %9 to i8*
br label %11
11: ; preds = %101, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %104
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i64
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = shl i32 %24, 2
%26 = load i8*, i8** %4
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = ashr i32 %35, 4
%37 = or i32 %25, %36
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %6
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
store i8 %38, i8* %43
%44 = load i8*, i8** %4
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = load i8, i8* %48
%50 = zext i8 %49 to i64
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = shl i32 %53, 4
%55 = load i8*, i8** %4
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %55, i64 %58
%60 = load i8, i8* %59
%61 = zext i8 %60 to i64
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = ashr i32 %64, 2
%66 = or i32 %54, %65
%67 = trunc i32 %66 to i8
%68 = load i8*, i8** %6
%69 = load i32, i32* %8
%70 = add nsw i32 %69, 1
store i32 %70, i32* %8
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds i8, i8* %68, i64 %71
store i8 %67, i8* %72
%73 = load i8*, i8** %4
%74 = load i32, i32* %7
%75 = add nsw i32 %74, 2
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %73, i64 %76
%78 = load i8, i8* %77
%79 = zext i8 %78 to i64
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = shl i32 %82, 6
%84 = load i8*, i8** %4
%85 = load i32, i32* %7
%86 = add nsw i32 %85, 3
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %84, i64 %87
%89 = load i8, i8* %88
%90 = zext i8 %89 to i64
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = or i32 %83, %93
%95 = trunc i32 %94 to i8
%96 = load i8*, i8** %6
%97 = load i32, i32* %8
%98 = add nsw i32 %97, 1
store i32 %98, i32* %8
%99 = sext i32 %97 to i64
%100 = getelementptr inbounds i8, i8* %96, i64 %99
store i8 %95, i8* %100
br label %101
101: ; preds = %15
%102 = load i32, i32* %7
%103 = add nsw i32 %102, 4
store i32 %103, i32* %7
br label %11
104: ; preds = %11
%105 = load i8*, i8** %6
%106 = load i32, i32* %8
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
store i8 0, i8* %108
%109 = load i32, i32* %8
ret i32 %109
}

LLVM IR (-O2):
@__const.http_base64decode.base64_decode_map = [256 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF>\FF\FF\FF?456789:;<=\FF\FF\FF\00\FF\FF\FF\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\FF\FF\FF\FF\FF\FF\1A\1B\1C\1D\1E\1F !\22#$%&'()*+,-./0123\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF"
define i32 @http_base64decode(i8* nocapture %0, i32 %1, i8* nocapture writeonly %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %59
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %55, %7 ]
%9 = phi i64 [ 0, %5 ], [ %53, %7 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %8
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* @__const.http_base64decode.base64_decode_map, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = shl i8 %14, 2
%16 = or i64 %8, 1
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i64
%20 = getelementptr inbounds [256 x i8], [256 x i8]* @__const.http_base64decode.base64_decode_map, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = ashr i8 %21, 4
%23 = or i8 %22, %15
%24 = add nuw nsw i64 %9, 1
%25 = getelementptr inbounds i8, i8* %2, i64 %9
store i8 %23, i8* %25
%26 = load i8, i8* %17
%27 = zext i8 %26 to i64
%28 = getelementptr inbounds [256 x i8], [256 x i8]* @__const.http_base64decode.base64_decode_map, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = shl i8 %29, 4
%31 = or i64 %8, 2
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i64
%35 = getelementptr inbounds [256 x i8], [256 x i8]* @__const.http_base64decode.base64_decode_map, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = ashr i8 %36, 2
%38 = or i8 %37, %30
%39 = add nuw nsw i64 %9, 2
%40 = getelementptr inbounds i8, i8* %2, i64 %24
store i8 %38, i8* %40
%41 = load i8, i8* %32
%42 = zext i8 %41 to i64
%43 = getelementptr inbounds [256 x i8], [256 x i8]* @__const.http_base64decode.base64_decode_map, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = shl i8 %44, 6
%46 = or i64 %8, 3
%47 = getelementptr inbounds i8, i8* %0, i64 %46
%48 = load i8, i8* %47
%49 = zext i8 %48 to i64
%50 = getelementptr inbounds [256 x i8], [256 x i8]* @__const.http_base64decode.base64_decode_map, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = or i8 %51, %45
%53 = add nuw nsw i64 %9, 3
%54 = getelementptr inbounds i8, i8* %2, i64 %39
store i8 %52, i8* %54
%55 = add nuw nsw i64 %8, 4
%56 = icmp ult i64 %55, %6
br i1 %56, label %7, label %57
57: ; preds = %7
%58 = trunc i64 %53 to i32
br label %59
59: ; preds = %57, %3
%60 = phi i32 [ 0, %3 ], [ %58, %57 ]
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %2, i64 %61
store i8 0, i8* %62
ret i32 %60
}