#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ request();
int /*<<< orphan*/ stdin;
char toupper(int /*<<< orphan*/);
int main() {
  char ch;
  do {
    puts("\nMain Menu\n=========");
    printf("Press 1 to enter new request or 6 to quit: ");
    ch = toupper(getchar());
    fflush(stdin);
    switch (ch) {
    case '1':
      request();
      break;
    case 'Q':
      puts("Quiting now..");
      break;
    default:
      printf("Naughty Input ! %c\n\n\n", 1);
    }
  } while (ch != 'Q');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xd(%rbp)
call   1050 <printf@plt>
mov    -0xd(%rbp),%al
call   1060 <getchar@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %al,-0x5(%rbp)
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x31,%eax
je     11d2 <main+0x72>
jmp    11c1 <main+0x61>
mov    -0xc(%rbp),%eax
sub    $0x51,%eax
je     11de <main+0x7e>
jmp    11ef <main+0x8f>
mov    $0x0,%al
call   1080 <request@plt>
jmp    1202 <main+0xa2>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
jmp    1202 <main+0xa2>
lea    0xe59(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1207 <main+0xa7>
movsbl -0x5(%rbp),%eax
cmp    $0x51,%eax
jne    116f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%r14
lea    0xe9c(%rip),%r13
mov    0x2e68(%rip),%rbp
lea    0xeba(%rip),%r15
lea    0xec1(%rip),%r12
jmp    11a4 <main+0x44>
mov    %r12,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x51,%bl
je     11fa <main+0x9a>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,%ebx
mov    0x0(%rbp),%edi
call   1070 <fflush@plt>
movsbl %bl,%eax
cmp    $0x51,%eax
je     11f0 <main+0x90>
cmp    $0x31,%eax
jne    1190 <main+0x30>
xor    %eax,%eax
call   1080 <request@plt>
jmp    119f <main+0x3f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    119f <main+0x3f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AMain Menu\0A=========\00"
@.str.1 = [44 x i8] c"Press 1 to enter new request or 6 to quit: \00"
@stdin = global i32 0
@.str.2 = [14 x i8] c"Quiting now..\00"
@.str.3 = [22 x i8] c"Naughty Input ! %c\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %19, %0
%4 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @getchar()
%7 = call signext i8 @toupper(i32 %6)
store i8 %7, i8* %2
%8 = load i32, i32* @stdin
%9 = call i32 @fflush(i32 %8)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
switch i32 %11, label %16 [
i32 49, label %12
i32 81, label %14
]
12: ; preds = %3
%13 = call i32 (...) @request()
br label %18
14: ; preds = %3
%15 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %18
18: ; preds = %16, %14, %12
br label %19
19: ; preds = %18
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 81
br i1 %22, label %3, label %23
23: ; preds = %19
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AMain Menu\0A=========\00"
@.str.1 = [44 x i8] c"Press 1 to enter new request or 6 to quit: \00"
@stdin = global i32 0
@.str.2 = [14 x i8] c"Quiting now..\00"
@.str.3 = [22 x i8] c"Naughty Input ! %c\0A\0A\0A\00"
define i32 @main() {
br label %1
1: ; preds = %15, %0
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
%5 = tail call signext i8 @toupper(i32 %4)
%6 = load i32, i32* @stdin
%7 = tail call i32 @fflush(i32 %6)
%8 = sext i8 %5 to i32
switch i32 %8, label %13 [
i32 49, label %9
i32 81, label %11
]
9: ; preds = %1
%10 = tail call i32 (...) @request()
br label %15
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %15
13: ; preds = %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %15
15: ; preds = %9, %11, %13
%16 = icmp eq i8 %5, 81
br i1 %16, label %17, label %1
17: ; preds = %15
ret i32 0
}