#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 *);
int main() {
  char myChar;
  printf("Please enter a character: ");
  scanf("%c", &myChar);
  if (myChar == 'A' || myChar == 'a')
    printf("Hello\n");
  else if (myChar == 'B' || myChar == 'b')
    printf("Happy Birthday\n");
  else if (myChar == 'C' || myChar == 'c')
    printf("Welcome\n");
  else
    printf("You entered an invalid character.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
je     1165 <main+0x45>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    1176 <main+0x56>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    11e2 <main+0xc2>
movsbl -0x5(%rbp),%eax
cmp    $0x42,%eax
je     1190 <main+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
jne    11a1 <main+0x81>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    11dd <main+0xbd>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
je     11bb <main+0x9b>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    11cc <main+0xac>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <main+0xb8>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    11dd <main+0xbd>
jmp    11e2 <main+0xc2>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
and    $0xdf,%al
cmp    $0x43,%al
je     116e <main+0x3e>
cmp    $0x42,%al
je     117c <main+0x4c>
cmp    $0x41,%al
jne    118a <main+0x5a>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
jmp    1196 <main+0x66>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
jmp    1196 <main+0x66>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
jmp    1196 <main+0x66>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Please enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [7 x i8] c"Hello\0A\00"
@.str.3 = [16 x i8] c"Happy Birthday\0A\00"
@.str.4 = [9 x i8] c"Welcome\0A\00"
@.str.5 = [34 x i8] c"You entered an invalid character.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 65
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 97
br i1 %11, label %12, label %14
12: ; preds = %8, %0
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %38
14: ; preds = %8
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 66
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 98
br i1 %21, label %22, label %24
22: ; preds = %18, %14
%23 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %37
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 67
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 99
br i1 %31, label %32, label %34
32: ; preds = %28, %24
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %36
34: ; preds = %28
%35 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36, %22
br label %38
38: ; preds = %37, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Please enter a character: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.5 = [34 x i8] c"You entered an invalid character.\00"
@str = [8 x i8] c"Welcome\00"
@str.6 = [15 x i8] c"Happy Birthday\00"
@str.7 = [6 x i8] c"Hello\00"
define i32 @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 = and i8 %4, -33
switch i8 %5, label %12 [
i8 65, label %6
i8 66, label %8
i8 67, label %10
]
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
br label %14
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
br label %14
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %14
14: ; preds = %8, %12, %10, %6
ret i32 0
}