int base64toValue(char Base64Character, unsigned char *Val) {
  int result = 0;
  if (('A' <= Base64Character) && (Base64Character <= 'Z')) {
    *Val = Base64Character - 'A';
  } else if (('a' <= Base64Character) && (Base64Character <= 'z')) {
    *Val = ('Z' - 'A') + 1 + (Base64Character - 'a');
  } else if (('0' <= Base64Character) && (Base64Character <= '9')) {
    *Val = ('Z' - 'A') + 1 + ('z' - 'a') + 1 + (Base64Character - '0');
  } else if ('+' == Base64Character) {
    *Val = 62;
  } else if ('/' == Base64Character) {
    *Val = 63;
  } else {
    *Val = 0;
    result = -1;
  }
  return result;
}


x86 assembly (clang, -O0):
<base64toValue>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     1147 <base64toValue+0x47>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1147 <base64toValue+0x47>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    120d <base64toValue+0x10d>
movsbl -0x1(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     117c <base64toValue+0x7c>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     117c <base64toValue+0x7c>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0x1a,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1208 <base64toValue+0x108>
movsbl -0x1(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     11b1 <base64toValue+0xb1>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     11b1 <base64toValue+0xb1>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
add    $0x34,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1203 <base64toValue+0x103>
movsbl -0x1(%rbp),%ecx
mov    $0x2b,%eax
cmp    %ecx,%eax
jne    11ce <base64toValue+0xce>
mov    -0x10(%rbp),%rax
movb   $0x3e,(%rax)
jmp    11fe <base64toValue+0xfe>
movsbl -0x1(%rbp),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
jne    11eb <base64toValue+0xeb>
mov    -0x10(%rbp),%rax
movb   $0x3f,(%rax)
jmp    11f9 <base64toValue+0xf9>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0xffffffff,-0x14(%rbp)
jmp    11fe <base64toValue+0xfe>
jmp    1203 <base64toValue+0x103>
jmp    1208 <base64toValue+0x108>
jmp    120d <base64toValue+0x10d>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64toValue>:
lea    -0x41(%rdi),%ecx
xor    %eax,%eax
cmp    $0x1a,%cl
jae    110d <base64toValue+0xd>
mov    %cl,(%rsi)
ret
lea    -0x61(%rdi),%ecx
cmp    $0x19,%cl
ja     111b <base64toValue+0x1b>
add    $0xb9,%dil
jmp    1127 <base64toValue+0x27>
lea    -0x30(%rdi),%ecx
cmp    $0x9,%cl
ja     112c <base64toValue+0x2c>
add    $0x4,%dil
mov    %edi,%ecx
mov    %cl,(%rsi)
ret
cmp    $0x2b,%dil
je     113d <base64toValue+0x3d>
cmp    $0x2f,%dil
jne    1142 <base64toValue+0x42>
mov    $0x3f,%cl
mov    %cl,(%rsi)
ret
mov    $0x3e,%cl
mov    %cl,(%rsi)
ret
mov    $0xffffffff,%eax
xor    %ecx,%ecx
mov    %cl,(%rsi)
ret

LLVM IR (-O0):
define i32 @base64toValue(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
store i8 %0, i8* %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sle i32 65, %7
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 90
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 65
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %4
store i8 %17, i8* %18
br label %67
19: ; preds = %9, %2
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sle i32 97, %21
br i1 %22, label %23, label %34
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 122
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = sub nsw i32 %29, 97
%31 = add nsw i32 26, %30
%32 = trunc i32 %31 to i8
%33 = load i8*, i8** %4
store i8 %32, i8* %33
br label %66
34: ; preds = %23, %19
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp sle i32 48, %36
br i1 %37, label %38, label %49
38: ; preds = %34
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 57
br i1 %41, label %42, label %49
42: ; preds = %38
%43 = load i8, i8* %3
%44 = sext i8 %43 to i32
%45 = sub nsw i32 %44, 48
%46 = add nsw i32 52, %45
%47 = trunc i32 %46 to i8
%48 = load i8*, i8** %4
store i8 %47, i8* %48
br label %65
49: ; preds = %38, %34
%50 = load i8, i8* %3
%51 = sext i8 %50 to i32
%52 = icmp eq i32 43, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = load i8*, i8** %4
store i8 62, i8* %54
br label %64
55: ; preds = %49
%56 = load i8, i8* %3
%57 = sext i8 %56 to i32
%58 = icmp eq i32 47, %57
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = load i8*, i8** %4
store i8 63, i8* %60
br label %63
61: ; preds = %55
%62 = load i8*, i8** %4
store i8 0, i8* %62
store i32 -1, i32* %5
br label %63
63: ; preds = %61, %59
br label %64
64: ; preds = %63, %53
br label %65
65: ; preds = %64, %42
br label %66
66: ; preds = %65, %27
br label %67
67: ; preds = %66, %13
%68 = load i32, i32* %5
ret i32 %68
}

LLVM IR (-O2):
define i32 @base64toValue(i8 signext %0, i8* nocapture writeonly %1) {
%3 = add i8 %0, -65
%4 = icmp ult i8 %3, 26
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = add i8 %0, -97
%7 = icmp ult i8 %6, 26
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = add nsw i8 %0, -71
br label %18
10: ; preds = %5
%11 = add i8 %0, -48
%12 = icmp ult i8 %11, 10
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = add nuw nsw i8 %0, 4
br label %18
15: ; preds = %10
switch i8 %0, label %17 [
i8 43, label %18
i8 47, label %16
]
16: ; preds = %15
br label %18
17: ; preds = %15
br label %18
18: ; preds = %15, %2, %8, %17, %16, %13
%19 = phi i8 [ %9, %8 ], [ 0, %17 ], [ 63, %16 ], [ %14, %13 ], [ %3, %2 ], [ 62, %15 ]
%20 = phi i32 [ 0, %8 ], [ -1, %17 ], [ 0, %16 ], [ 0, %13 ], [ 0, %2 ], [ 0, %15 ]
store i8 %19, i8* %1
ret i32 %20
}