#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 /*<<< orphan*/ show_menu();
int /*<<< orphan*/ system(char *);
char get_menu_option(void) {
  char option = '0';
  do {
    system("clear");
    show_menu();
    printf("--> ");
    scanf("%c", &option);
  } while (option < '1' || option > '5');
  return option;
}


x86 assembly (clang, -O0):
<get_menu_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x30,-0x1(%rbp)
lea    0xead(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1060 <show_menu@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x31,%ecx
mov    %al,-0x2(%rbp)
jl     119a <get_menu_option+0x5a>
movsbl -0x1(%rbp),%eax
cmp    $0x35,%eax
setg   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    114c <get_menu_option+0xc>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_menu_option>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movb   $0x30,0x7(%rsp)
lea    0xeac(%rip),%r14
lea    0xeab(%rip),%r15
lea    0xea9(%rip),%r12
lea    0x7(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <system@plt>
xor    %eax,%eax
call   1060 <show_menu@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl 0x7(%rsp),%eax
lea    -0x36(%rax),%ecx
cmp    $0xfb,%cl
jb     1170 <get_menu_option+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [5 x i8] c"--> \00"
@.str.2 = [3 x i8] c"%c\00"
define signext i8 @get_menu_option() {
%1 = alloca i8
store i8 48, i8* %1
br label %2
2: ; preds = %15, %0
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @show_menu()
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %2
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 49
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = icmp sgt i32 %13, 53
br label %15
15: ; preds = %11, %7
%16 = phi i1 [ true, %7 ], [ %14, %11 ]
br i1 %16, label %2, label %17
17: ; preds = %15
%18 = load i8, i8* %1
ret i8 %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [5 x i8] c"--> \00"
@.str.2 = [3 x i8] c"%c\00"
define signext i8 @get_menu_option() {
%1 = alloca i8
store i8 48, i8* %1
br label %2
2: ; preds = %2, %0
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @show_menu()
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%7 = load i8, i8* %1
%8 = add i8 %7, -54
%9 = icmp ult i8 %8, -5
br i1 %9, label %2, label %10
10: ; preds = %2
ret i8 %7
}