#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  char ch;
  printf("Please input a char:\n");
  ch = getchar();
  switch (ch) {
  case 'A':
    printf("95\n");
    break;
  case 'B':
    printf("85\n");
    break;
  case 'C':
    printf("75\n");
    break;
  case 'D':
    printf("65\n");
    break;
  case 'E':
    printf("65\n");
    break;
  default:
    printf("error!\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     11c4 <main+0xa4>
mov    -0x10(%rbp),%rax
lea    0xe9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    11d0 <main+0xb0>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    11d0 <main+0xb0>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    11d0 <main+0xb0>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    11d0 <main+0xb0>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    11d0 <main+0xb0>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%eax
add    $0xffffffbf,%eax
cmp    $0x4,%eax
ja     1151 <main+0x31>
cltq
lea    0xee0(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1158 <main+0x38>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Please input a char:\0A\00"
@.str.1 = [4 x i8] c"95\0A\00"
@.str.2 = [4 x i8] c"85\0A\00"
@.str.3 = [4 x i8] c"75\0A\00"
@.str.4 = [4 x i8] c"65\0A\00"
@.str.5 = [8 x i8] c"error!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
switch i32 %6, label %17 [
i32 65, label %7
i32 66, label %9
i32 67, label %11
i32 68, label %13
i32 69, label %15
]
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %19
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %19
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %19
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %19
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %19
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"Please input a char:\00"
@str.7 = [3 x i8] c"65\00"
@str.8 = [3 x i8] c"75\00"
@str.9 = [3 x i8] c"85\00"
@str.10 = [3 x i8] c"95\00"
@str.11 = [7 x i8] c"error!\00"
@reltable.main = [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @str.10 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @str.9 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @str.8 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @str.7 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @str.7 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
%4 = add nsw i32 %3, -65
%5 = icmp ult i32 %4, 5
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([5 x i32]* @reltable.main to i8*), i64 %8)
br label %10
10: ; preds = %0, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0), %0 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}