#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 */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  char a;
  printf("Please enter a character: ");
  scanf("%c", &a);
  switch (a) {
  case 'A':
  case 'a':
    printf("A is for apple.");
    break;
  case 'b':
    printf("B is for Bannas.");
    break;
  case 'c':
    printf("C is for Suspension.");
    break;
  case 'H':
    printf("H is for Hello.");
    break;
  default:
    printf("Wrong!");
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xf5d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf6c(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x22,%eax
ja     11b2 <main+0x92>
mov    -0x10(%rbp),%rax
lea    0xe9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf35(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <main+0x9e>
lea    0xf34(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <main+0x9e>
lea    0xf34(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <main+0x9e>
lea    0xf38(%rip),%rdi
call   1030 <printf@plt>
jmp    11be <main+0x9e>
lea    0xf37(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf64(%rip),%rdi
call   1030 <printf@plt>
lea    0xf73(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffbf,%eax
cmp    $0x22,%eax
ja     116b <main+0x4b>
lea    0xf58(%rip),%rdi
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf77(%rip),%rdi
jmp    1184 <main+0x64>
lea    0xf7e(%rip),%rdi
jmp    1184 <main+0x64>
lea    0xf3f(%rip),%rdi
jmp    1184 <main+0x64>
lea    0xf47(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Please enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [16 x i8] c"A is for apple.\00"
@.str.3 = [17 x i8] c"B is for Bannas.\00"
@.str.4 = [21 x i8] c"C is for Suspension.\00"
@.str.5 = [16 x i8] c"H is for Hello.\00"
@.str.6 = [7 x i8] c"Wrong!\00"
define void @main() {
%1 = alloca i8
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 65, label %6
i32 97, label %6
i32 98, label %8
i32 99, label %10
i32 72, label %12
]
6: ; preds = %0, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %16
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %16
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %16
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Please enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [16 x i8] c"A is for apple.\00"
@.str.3 = [17 x i8] c"B is for Bannas.\00"
@.str.4 = [21 x i8] c"C is for Suspension.\00"
@.str.5 = [16 x i8] c"H is for Hello.\00"
@.str.6 = [7 x i8] c"Wrong!\00"
define void @main() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
switch i32 %5, label %9 [
i32 65, label %10
i32 97, label %10
i32 98, label %6
i32 99, label %7
i32 72, label %8
]
6: ; preds = %0
br label %10
7: ; preds = %0
br label %10
8: ; preds = %0
br label %10
9: ; preds = %0
br label %10
10: ; preds = %0, %0, %9, %8, %7, %6
%11 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %0 ]
%12 = call i32 @printf(i8* dereferenceable(1) %11)
ret void
}