char ss2i(char c) {
  if (c >= 'a' && c <= 'z')
    c += 'A' - 'a';
  switch (c) {
  case '.':
    return 0;
  case '-':
    return 0;
  case 'X':
    return 0;
  case 'H':
    return 1;
  case 'E':
    return 2;
  case 'C':
    return 3;
  case '~':
    return 3;
  case 'S':
    return 4;
  case 'T':
    return 5;
  case 'G':
    return 6;
  case 'B':
    return 7;
  case 'I':
    return 3;
  case ' ':
    return -1;
  case '\t':
    return -1;
  case '\n':
    return -1;
  }
  return -2;
}


x86 assembly (clang, -O0):
<ss2i>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     112e <ss2i+0x2e>
movsbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     112e <ss2i+0x2e>
movsbl -0x2(%rbp),%eax
add    $0xffffffe0,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xfffffff7,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x75,%eax
ja     11df <ss2i+0xdf>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x0,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x0,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x0,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x1,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x2,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x3,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x3,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x4,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x5,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x6,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x7,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0x3,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0xff,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0xff,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0xff,-0x1(%rbp)
jmp    11e3 <ss2i+0xe3>
movb   $0xfe,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss2i>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
movsbl %al,%ecx
add    $0xfffffff7,%ecx
cmp    $0x75,%ecx
ja     1131 <ss2i+0x31>
xor    %eax,%eax
lea    0xede(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xff,%al
ret
mov    $0x3,%al
ret
mov    $0xfe,%al
ret
mov    $0x7,%al
ret
mov    $0x2,%al
ret
mov    $0x6,%al
ret
mov    $0x1,%al
ret
mov    $0x4,%al
ret
mov    $0x5,%al
ret

LLVM IR (-O0):
define signext i8 @ss2i(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = add nsw i32 %13, -32
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
br label %16
16: ; preds = %11, %7, %1
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
switch i32 %18, label %34 [
i32 46, label %19
i32 45, label %20
i32 88, label %21
i32 72, label %22
i32 69, label %23
i32 67, label %24
i32 126, label %25
i32 83, label %26
i32 84, label %27
i32 71, label %28
i32 66, label %29
i32 73, label %30
i32 32, label %31
i32 9, label %32
i32 10, label %33
]
19: ; preds = %16
store i8 0, i8* %2
br label %35
20: ; preds = %16
store i8 0, i8* %2
br label %35
21: ; preds = %16
store i8 0, i8* %2
br label %35
22: ; preds = %16
store i8 1, i8* %2
br label %35
23: ; preds = %16
store i8 2, i8* %2
br label %35
24: ; preds = %16
store i8 3, i8* %2
br label %35
25: ; preds = %16
store i8 3, i8* %2
br label %35
26: ; preds = %16
store i8 4, i8* %2
br label %35
27: ; preds = %16
store i8 5, i8* %2
br label %35
28: ; preds = %16
store i8 6, i8* %2
br label %35
29: ; preds = %16
store i8 7, i8* %2
br label %35
30: ; preds = %16
store i8 3, i8* %2
br label %35
31: ; preds = %16
store i8 -1, i8* %2
br label %35
32: ; preds = %16
store i8 -1, i8* %2
br label %35
33: ; preds = %16
store i8 -1, i8* %2
br label %35
34: ; preds = %16
store i8 -2, i8* %2
br label %35
35: ; preds = %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19
%36 = load i8, i8* %2
ret i8 %36
}

LLVM IR (-O2):
define signext i8 @ss2i(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
%6 = sext i8 %5 to i32
switch i32 %6, label %19 [
i32 46, label %20
i32 45, label %20
i32 88, label %20
i32 72, label %7
i32 69, label %8
i32 67, label %9
i32 126, label %10
i32 83, label %11
i32 84, label %12
i32 71, label %13
i32 66, label %14
i32 73, label %15
i32 32, label %16
i32 9, label %17
i32 10, label %18
]
7: ; preds = %1
br label %20
8: ; preds = %1
br label %20
9: ; preds = %1
br label %20
10: ; preds = %1
br label %20
11: ; preds = %1
br label %20
12: ; preds = %1
br label %20
13: ; preds = %1
br label %20
14: ; preds = %1
br label %20
15: ; preds = %1
br label %20
16: ; preds = %1
br label %20
17: ; preds = %1
br label %20
18: ; preds = %1
br label %20
19: ; preds = %1
br label %20
20: ; preds = %1, %1, %1, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
%21 = phi i8 [ -2, %19 ], [ -1, %18 ], [ -1, %17 ], [ -1, %16 ], [ 3, %15 ], [ 7, %14 ], [ 6, %13 ], [ 5, %12 ], [ 4, %11 ], [ 3, %10 ], [ 3, %9 ], [ 2, %8 ], [ 1, %7 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i8 %21
}