int getascii(unsigned char c) {
  switch (c) {
  case 'A':
    return 0;
  case 'B':
    return 1;
  case 'C':
    return 2;
  case 'D':
    return 3;
  case 'E':
    return 4;
  case 'F':
    return 5;
  case 'G':
    return 6;
  case 'H':
    return 7;
  case 'I':
    return 8;
  case 'J':
    return 9;
  case 'K':
    return 10;
  case 'L':
    return 11;
  case 'M':
    return 12;
  case 'N':
    return 13;
  case 'O':
    return 14;
  case 'P':
    return 15;
  case 'Q':
    return 16;
  case 'R':
    return 17;
  case 'S':
    return 18;
  case 'T':
    return 19;
  case 'U':
    return 20;
  case 'V':
    return 21;
  case 'W':
    return 22;
  case 'X':
    return 23;
  case 'Y':
    return 24;
  case 'Z':
    return 25;
  case '?':
    return 26;
  case '!':
    return 27;
  case '.':
    return 28;
  case ',':
    return 29;
  case '/':
    return 30;
  case ':':
    return 31;
  case '1':
    return 32;
  case '2':
    return 33;
  case '3':
    return 34;
  case '4':
    return 35;
  case '5':
    return 36;
  case '6':
    return 37;
  case '7':
    return 38;
  case '8':
    return 39;
  case '9':
    return 40;
  case '0':
    return 41;
  case '#':
    return 42;
  case '%':
    return 43;
  case '&':
    return 44;
  case '(':
    return 45;
  case ')':
    return 46;
  case '*':
    return 47;
  case '=':
    return 48;
  case '+':
    return 49;
  case '-':
    return 50;
  case '[':
    return 51;
  case ']':
    return 52;
  case '@':
    return 53;
  }
  return -1;
}


x86 assembly (clang, -O0):
<getascii>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
add    $0xffffffdf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3c,%eax
ja     13bc <getascii+0x2bc>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x3,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x4,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x5,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x6,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x7,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x8,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x9,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xa,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xb,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xc,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xd,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xe,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xf,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x10,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x11,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x12,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x13,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x14,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x15,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x16,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x17,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x18,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x19,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1a,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1b,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1c,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1d,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1e,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x1f,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x20,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x21,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x22,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x23,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x24,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x25,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x26,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x27,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x28,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x29,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2a,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2b,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2c,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2d,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2e,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x2f,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x30,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x31,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x32,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x33,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x34,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0x35,-0x4(%rbp)
jmp    13c3 <getascii+0x2c3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getascii>:
add    $0xdf,%dil
mov    $0xffffffff,%eax
cmp    $0x3c,%dil
ja     111d <getascii+0x1d>
movsbq %dil,%rax
lea    0xee6(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @getascii(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
switch i32 %5, label %60 [
i32 65, label %6
i32 66, label %7
i32 67, label %8
i32 68, label %9
i32 69, label %10
i32 70, label %11
i32 71, label %12
i32 72, label %13
i32 73, label %14
i32 74, label %15
i32 75, label %16
i32 76, label %17
i32 77, label %18
i32 78, label %19
i32 79, label %20
i32 80, label %21
i32 81, label %22
i32 82, label %23
i32 83, label %24
i32 84, label %25
i32 85, label %26
i32 86, label %27
i32 87, label %28
i32 88, label %29
i32 89, label %30
i32 90, label %31
i32 63, label %32
i32 33, label %33
i32 46, label %34
i32 44, label %35
i32 47, label %36
i32 58, label %37
i32 49, label %38
i32 50, label %39
i32 51, label %40
i32 52, label %41
i32 53, label %42
i32 54, label %43
i32 55, label %44
i32 56, label %45
i32 57, label %46
i32 48, label %47
i32 35, label %48
i32 37, label %49
i32 38, label %50
i32 40, label %51
i32 41, label %52
i32 42, label %53
i32 61, label %54
i32 43, label %55
i32 45, label %56
i32 91, label %57
i32 93, label %58
i32 64, label %59
]
6: ; preds = %1
store i32 0, i32* %2
br label %61
7: ; preds = %1
store i32 1, i32* %2
br label %61
8: ; preds = %1
store i32 2, i32* %2
br label %61
9: ; preds = %1
store i32 3, i32* %2
br label %61
10: ; preds = %1
store i32 4, i32* %2
br label %61
11: ; preds = %1
store i32 5, i32* %2
br label %61
12: ; preds = %1
store i32 6, i32* %2
br label %61
13: ; preds = %1
store i32 7, i32* %2
br label %61
14: ; preds = %1
store i32 8, i32* %2
br label %61
15: ; preds = %1
store i32 9, i32* %2
br label %61
16: ; preds = %1
store i32 10, i32* %2
br label %61
17: ; preds = %1
store i32 11, i32* %2
br label %61
18: ; preds = %1
store i32 12, i32* %2
br label %61
19: ; preds = %1
store i32 13, i32* %2
br label %61
20: ; preds = %1
store i32 14, i32* %2
br label %61
21: ; preds = %1
store i32 15, i32* %2
br label %61
22: ; preds = %1
store i32 16, i32* %2
br label %61
23: ; preds = %1
store i32 17, i32* %2
br label %61
24: ; preds = %1
store i32 18, i32* %2
br label %61
25: ; preds = %1
store i32 19, i32* %2
br label %61
26: ; preds = %1
store i32 20, i32* %2
br label %61
27: ; preds = %1
store i32 21, i32* %2
br label %61
28: ; preds = %1
store i32 22, i32* %2
br label %61
29: ; preds = %1
store i32 23, i32* %2
br label %61
30: ; preds = %1
store i32 24, i32* %2
br label %61
31: ; preds = %1
store i32 25, i32* %2
br label %61
32: ; preds = %1
store i32 26, i32* %2
br label %61
33: ; preds = %1
store i32 27, i32* %2
br label %61
34: ; preds = %1
store i32 28, i32* %2
br label %61
35: ; preds = %1
store i32 29, i32* %2
br label %61
36: ; preds = %1
store i32 30, i32* %2
br label %61
37: ; preds = %1
store i32 31, i32* %2
br label %61
38: ; preds = %1
store i32 32, i32* %2
br label %61
39: ; preds = %1
store i32 33, i32* %2
br label %61
40: ; preds = %1
store i32 34, i32* %2
br label %61
41: ; preds = %1
store i32 35, i32* %2
br label %61
42: ; preds = %1
store i32 36, i32* %2
br label %61
43: ; preds = %1
store i32 37, i32* %2
br label %61
44: ; preds = %1
store i32 38, i32* %2
br label %61
45: ; preds = %1
store i32 39, i32* %2
br label %61
46: ; preds = %1
store i32 40, i32* %2
br label %61
47: ; preds = %1
store i32 41, i32* %2
br label %61
48: ; preds = %1
store i32 42, i32* %2
br label %61
49: ; preds = %1
store i32 43, i32* %2
br label %61
50: ; preds = %1
store i32 44, i32* %2
br label %61
51: ; preds = %1
store i32 45, i32* %2
br label %61
52: ; preds = %1
store i32 46, i32* %2
br label %61
53: ; preds = %1
store i32 47, i32* %2
br label %61
54: ; preds = %1
store i32 48, i32* %2
br label %61
55: ; preds = %1
store i32 49, i32* %2
br label %61
56: ; preds = %1
store i32 50, i32* %2
br label %61
57: ; preds = %1
store i32 51, i32* %2
br label %61
58: ; preds = %1
store i32 52, i32* %2
br label %61
59: ; preds = %1
store i32 53, i32* %2
br label %61
60: ; preds = %1
store i32 -1, i32* %2
br label %61
61: ; preds = %60, %59, %58, %57, %56, %55, %54, %53, %52, %51, %50, %49, %48, %47, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%62 = load i32, i32* %2
ret i32 %62
}

LLVM IR (-O2):
@switch.table.getascii = [61 x i32] [i32 27, i32 -1, i32 42, i32 -1, i32 43, i32 44, i32 -1, i32 45, i32 46, i32 47, i32 49, i32 29, i32 50, i32 28, i32 30, i32 41, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 31, i32 -1, i32 -1, i32 48, i32 -1, i32 26, i32 53, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 51, i32 -1, i32 52]
define i32 @getascii(i8 zeroext %0) {
%2 = add i8 %0, -33
%3 = icmp ult i8 %2, 61
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i8 %2 to i64
%6 = getelementptr inbounds [61 x i32], [61 x i32]* @switch.table.getascii, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}