#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 selection;
  printf("******** MAIN MENU **************\n");
  printf(" a. Formula 1 \n");
  printf(" b. Formula 2 \n");
  printf(" e. EXIT program \n");
  scanf("%c", &selection);
  switch (selection) {
  case 'A':
  case 'a':
    printf("Solving Formula 1 \n");
    break;
  case 'B':
  case 'b':
    printf("Solving Formula 2 \n");
    break;
  case 'E':
  case 'e':
    printf("Exiting program...\n");
  default:
    printf("Invalid option!");
  }
  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    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x41,%eax
je     11d9 <main+0xb9>
jmp    1184 <main+0x64>
mov    -0xc(%rbp),%eax
sub    $0x42,%eax
je     11ea <main+0xca>
jmp    1195 <main+0x75>
mov    -0xc(%rbp),%eax
sub    $0x45,%eax
je     11fb <main+0xdb>
jmp    11a6 <main+0x86>
mov    -0xc(%rbp),%eax
sub    $0x61,%eax
je     11d9 <main+0xb9>
jmp    11b7 <main+0x97>
mov    -0xc(%rbp),%eax
sub    $0x62,%eax
je     11ea <main+0xca>
jmp    11c8 <main+0xa8>
mov    -0xc(%rbp),%eax
sub    $0x65,%eax
je     11fb <main+0xdb>
jmp    1207 <main+0xe7>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffbf,%eax
cmp    $0x24,%eax
ja     11bb <main+0x8b>
movabs $0x100000001,%rcx
bt     %rax,%rcx
jb     11c9 <main+0x99>
movabs $0x200000002,%rcx
bt     %rax,%rcx
jb     11d2 <main+0xa2>
movabs $0x1000000010,%rcx
bt     %rax,%rcx
jae    11bb <main+0x8b>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
jmp    11de <main+0xae>
lea    0xebb(%rip),%rdi
jmp    11d9 <main+0xa9>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"******** MAIN MENU **************\0A\00"
@.str.1 = [16 x i8] c" a. Formula 1 \0A\00"
@.str.2 = [16 x i8] c" b. Formula 2 \0A\00"
@.str.3 = [19 x i8] c" e. EXIT program \0A\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [20 x i8] c"Solving Formula 1 \0A\00"
@.str.6 = [20 x i8] c"Solving Formula 2 \0A\00"
@.str.7 = [20 x i8] c"Exiting program...\0A\00"
@.str.8 = [16 x i8] c"Invalid option!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
switch i32 %9, label %16 [
i32 65, label %10
i32 97, label %10
i32 66, label %12
i32 98, label %12
i32 69, label %14
i32 101, label %14
]
10: ; preds = %0, %0
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %18
12: ; preds = %0, %0
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %18
14: ; preds = %0, %0
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %16
16: ; preds = %0, %14
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %18
18: ; preds = %16, %12, %10
ret i32 0
}

LLVM IR (-O2):
@.str.4 = [3 x i8] c"%c\00"
@.str.8 = [16 x i8] c"Invalid option!\00"
@str = [34 x i8] c"******** MAIN MENU **************\00"
@str.9 = [15 x i8] c" a. Formula 1 \00"
@str.10 = [15 x i8] c" b. Formula 2 \00"
@str.11 = [18 x i8] c" e. EXIT program \00"
@str.12 = [19 x i8] c"Exiting program...\00"
@str.13 = [19 x i8] c"Solving Formula 2 \00"
@str.14 = [19 x i8] c"Solving Formula 1 \00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.9, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
switch i32 %8, label %15 [
i32 65, label %9
i32 97, label %9
i32 66, label %11
i32 98, label %11
i32 69, label %13
i32 101, label %13
]
9: ; preds = %0, %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
br label %17
11: ; preds = %0, %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
br label %17
13: ; preds = %0, %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0))
br label %15
15: ; preds = %0, %13
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %17
17: ; preds = %15, %11, %9
ret i32 0
}