#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 *);
main() {
  char ch;
  printf("Please enter the character \n");
  scanf("%c", &ch);
  if ((ch == 'b') || (ch == 'B')) {
    printf("brown - carbon monoxide");
  } else if ((ch == 'o') || (ch == 'O')) {
    printf("orange - ammonia");
  } else if ((ch == 'y') || (ch == 'Y')) {
    printf("yellow - hydrogen");
  } else if ((ch == 'g') || (ch == 'G')) {
    printf("green - oxygen");
  }
}


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    0xedb(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x62,%eax
je     1165 <main+0x45>
movsbl -0x5(%rbp),%eax
cmp    $0x42,%eax
jne    1176 <main+0x56>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    1201 <main+0xe1>
movsbl -0x5(%rbp),%eax
cmp    $0x6f,%eax
je     1190 <main+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x4f,%eax
jne    11a1 <main+0x81>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    11fc <main+0xdc>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
je     11bb <main+0x9b>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
jne    11cc <main+0xac>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
movsbl -0x5(%rbp),%eax
cmp    $0x67,%eax
je     11e6 <main+0xc6>
movsbl -0x5(%rbp),%eax
cmp    $0x47,%eax
jne    11f2 <main+0xd2>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
jmp    11fc <main+0xdc>
jmp    1201 <main+0xe1>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf75(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x7(%rsp),%al
and    $0xdf,%al
add    $0xbe,%al
cmp    $0x17,%al
ja     1192 <main+0x62>
lea    0xf02(%rip),%rdi
movzbl %al,%eax
lea    0xe95(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf23(%rip),%rdi
jmp    118d <main+0x5d>
lea    0xef7(%rip),%rdi
jmp    118d <main+0x5d>
lea    0xeff(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Please enter the character \0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [24 x i8] c"brown - carbon monoxide\00"
@.str.3 = [17 x i8] c"orange - ammonia\00"
@.str.4 = [18 x i8] c"yellow - hydrogen\00"
@.str.5 = [15 x i8] c"green - oxygen\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 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, 98
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, 66
br i1 %11, label %12, label %14
12: ; preds = %8, %0
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %47
14: ; preds = %8
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 111
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, 79
br i1 %21, label %22, label %24
22: ; preds = %18, %14
%23 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %46
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 121
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, 89
br i1 %31, label %32, label %34
32: ; preds = %28, %24
%33 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %45
34: ; preds = %28
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 103
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 71
br i1 %41, label %42, label %44
42: ; preds = %38, %34
%43 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
br label %45
45: ; preds = %44, %32
br label %46
46: ; preds = %45, %22
br label %47
47: ; preds = %46, %12
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [24 x i8] c"brown - carbon monoxide\00"
@.str.3 = [17 x i8] c"orange - ammonia\00"
@.str.4 = [18 x i8] c"yellow - hydrogen\00"
@.str.5 = [15 x i8] c"green - oxygen\00"
@str = [28 x i8] c"Please enter the character \00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 66, label %9
i8 79, label %6
i8 89, label %7
i8 71, label %8
]
6: ; preds = %0
br label %9
7: ; preds = %0
br label %9
8: ; preds = %0
br label %9
9: ; preds = %0, %7, %8, %6
%10 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), %0 ]
%11 = call i32 @printf(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %0
ret i32 0
}