char *sResidueTypeNameFromChar(char c) {
  switch (c) {
  case '?':
    return ("undefined");
  case 'w':
    return ("solvent");
  case 'p':
    return ("protein");
  case 'n':
    return ("nucleic");
  case 's':
    return ("saccharide");
  default:
    return ("UNKNOWN RESIDUE TYPE NAME!");
  }
  return ("UNKNOWN RESIDUE TYPE NAME!");
}


x86 assembly (clang, -O0):
<sResidueTypeNameFromChar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x3f,%eax
je     1163 <sResidueTypeNameFromChar+0x63>
jmp    111f <sResidueTypeNameFromChar+0x1f>
mov    -0x10(%rbp),%eax
sub    $0x6e,%eax
je     1193 <sResidueTypeNameFromChar+0x93>
jmp    1130 <sResidueTypeNameFromChar+0x30>
mov    -0x10(%rbp),%eax
sub    $0x70,%eax
je     1183 <sResidueTypeNameFromChar+0x83>
jmp    1141 <sResidueTypeNameFromChar+0x41>
mov    -0x10(%rbp),%eax
sub    $0x73,%eax
je     11a3 <sResidueTypeNameFromChar+0xa3>
jmp    1152 <sResidueTypeNameFromChar+0x52>
mov    -0x10(%rbp),%eax
sub    $0x77,%eax
je     1173 <sResidueTypeNameFromChar+0x73>
jmp    11b3 <sResidueTypeNameFromChar+0xb3>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11be <sResidueTypeNameFromChar+0xbe>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11be <sResidueTypeNameFromChar+0xbe>
lea    0xe88(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11be <sResidueTypeNameFromChar+0xbe>
lea    0xe80(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11be <sResidueTypeNameFromChar+0xbe>
lea    0xe78(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11be <sResidueTypeNameFromChar+0xbe>
lea    0xe73(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sResidueTypeNameFromChar>:
lea    -0x6e(%rdi),%eax
cmp    $0x9,%eax
ja     1120 <sResidueTypeNameFromChar+0x20>
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf23(%rip),%rax
ret
cmp    $0x3f,%edi
jne    112d <sResidueTypeNameFromChar+0x2d>
lea    0xefc(%rip),%rax
ret
lea    0xf21(%rip),%rax
ret
lea    0xefe(%rip),%rax
ret
lea    0xf06(%rip),%rax
ret
lea    0xee6(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"undefined\00"
@.str.1 = [8 x i8] c"solvent\00"
@.str.2 = [8 x i8] c"protein\00"
@.str.3 = [8 x i8] c"nucleic\00"
@.str.4 = [11 x i8] c"saccharide\00"
@.str.5 = [27 x i8] c"UNKNOWN RESIDUE TYPE NAME!\00"
define i8* @sResidueTypeNameFromChar(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
switch i32 %5, label %11 [
i32 63, label %6
i32 119, label %7
i32 112, label %8
i32 110, label %9
i32 115, label %10
]
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [10 x i8] c"undefined\00"
@.str.1 = [8 x i8] c"solvent\00"
@.str.2 = [8 x i8] c"protein\00"
@.str.3 = [8 x i8] c"nucleic\00"
@.str.4 = [11 x i8] c"saccharide\00"
@.str.5 = [27 x i8] c"UNKNOWN RESIDUE TYPE NAME!\00"
define i8* @sResidueTypeNameFromChar(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %7 [
i32 63, label %8
i32 119, label %3
i32 112, label %4
i32 110, label %5
i32 115, label %6
]
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3
%9 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %9
}