#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*/ clean_stdin();
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *, char *);
int requestMenuOption() {
  int option, read;
  char enter;
  printf("******************************\n");
  printf("*      SELECT AN OPTION      *\n");
  printf("*----------------------------*\n");
  printf("*  0.- End Execution         *\n");
  printf("*  1.- Number of Rows        *\n");
  printf("*  2.- Number of Columns     *\n");
  printf("*  3.- Number of Characters  *\n");
  printf("*  4.- Longest Row           *\n");
  printf("*  5.- Print Row             *\n");
  printf("*  6.- Print File            *\n");
  printf("*  7.- New Row               *\n");
  printf("*  8.- Modify Class Value    *\n");
  printf("******************************\n");
  while (1) {
    printf("Insert option number: ");
    read = scanf("%d%c", &option, &enter);
    if (read != 2 || enter != '\n') {
      printf("Incorrect value, please try again.\n");
      clean_stdin();
    } else if (option < 0 || option > 8) {
      printf("Value out of range, please try again.\n");
    } else {
      return option;
    }
  }
}


x86 assembly (clang, -O0):
<requestMenuOption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
lea    0xf25(%rip),%rdi
call   1030 <printf@plt>
lea    0xf39(%rip),%rdi
call   1030 <printf@plt>
lea    0xf4d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf61(%rip),%rdi
call   1030 <printf@plt>
lea    0xf75(%rip),%rdi
call   1030 <printf@plt>
lea    0xf89(%rip),%rdi
call   1030 <printf@plt>
lea    0xf9d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
lea    0xfa5(%rip),%rdi
call   1030 <printf@plt>
lea    0xfb0(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x9(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    120e <requestMenuOption+0xde>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     1226 <requestMenuOption+0xf6>
lea    0xf87(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <clean_stdin@plt>
jmp    1259 <requestMenuOption+0x129>
cmpl   $0x0,-0x4(%rbp)
jl     123a <requestMenuOption+0x10a>
cmpl   $0x8,-0x4(%rbp)
jle    124b <requestMenuOption+0x11b>
lea    0xf7f(%rip),%rdi
call   1030 <printf@plt>
jmp    1254 <requestMenuOption+0x124>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1259 <requestMenuOption+0x129>
jmp    11d4 <requestMenuOption+0xa4>

x86 assembly (clang, -O2):
<requestMenuOption>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x101f(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf40(%rip),%rdi
call   1030 <puts@plt>
lea    0xf53(%rip),%rdi
call   1030 <puts@plt>
lea    0xf66(%rip),%rdi
call   1030 <puts@plt>
lea    0xf79(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe13(%rip),%r14
lea    0xe23(%rip),%r15
lea    0x4(%rsp),%r12
lea    0x3(%rsp),%rbx
lea    0xfb1(%rip),%r13
lea    0xf84(%rip),%rbp
jmp    121f <requestMenuOption+0xdf>
xchg   %ax,%ax
mov    %r13,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <clean_stdin@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
cmp    $0x2,%eax
jne    1210 <requestMenuOption+0xd0>
cmpb   $0xa,0x3(%rsp)
jne    1210 <requestMenuOption+0xd0>
mov    0x4(%rsp),%eax
cmp    $0x9,%eax
jb     1254 <requestMenuOption+0x114>
mov    %rbp,%rdi
call   1030 <puts@plt>
jmp    121f <requestMenuOption+0xdf>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"******************************\0A\00"
@.str.1 = [32 x i8] c"* SELECT AN OPTION *\0A\00"
@.str.2 = [32 x i8] c"*----------------------------*\0A\00"
@.str.3 = [32 x i8] c"* 0.- End Execution *\0A\00"
@.str.4 = [32 x i8] c"* 1.- Number of Rows *\0A\00"
@.str.5 = [32 x i8] c"* 2.- Number of Columns *\0A\00"
@.str.6 = [32 x i8] c"* 3.- Number of Characters *\0A\00"
@.str.7 = [32 x i8] c"* 4.- Longest Row *\0A\00"
@.str.8 = [32 x i8] c"* 5.- Print Row *\0A\00"
@.str.9 = [32 x i8] c"* 6.- Print File *\0A\00"
@.str.10 = [32 x i8] c"* 7.- New Row *\0A\00"
@.str.11 = [32 x i8] c"* 8.- Modify Class Value *\0A\00"
@.str.12 = [23 x i8] c"Insert option number: \00"
@.str.13 = [5 x i8] c"%d%c\00"
@.str.14 = [36 x i8] c"Incorrect value, please try again.\0A\00"
@.str.15 = [39 x i8] c"Value out of range, please try again.\0A\00"
define i32 @requestMenuOption() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %0, %40
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32* %1, i8* %3)
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 2
br i1 %21, label %26, label %22
22: ; preds = %17
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 10
br i1 %25, label %26, label %29
26: ; preds = %22, %17
%27 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0))
%28 = call i32 (...) @clean_stdin()
br label %40
29: ; preds = %22
%30 = load i32, i32* %1
%31 = icmp slt i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32, i32* %1
%34 = icmp sgt i32 %33, 8
br i1 %34, label %35, label %37
35: ; preds = %32, %29
%36 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %39
37: ; preds = %32
%38 = load i32, i32* %1
ret i32 %38
39: ; preds = %35
br label %40
40: ; preds = %39, %26
br label %17
}

LLVM IR (-O2):
@.str.12 = [23 x i8] c"Insert option number: \00"
@.str.13 = [5 x i8] c"%d%c\00"
@str.16 = [31 x i8] c"* SELECT AN OPTION *\00"
@str.17 = [31 x i8] c"*----------------------------*\00"
@str.18 = [31 x i8] c"* 0.- End Execution *\00"
@str.19 = [31 x i8] c"* 1.- Number of Rows *\00"
@str.20 = [31 x i8] c"* 2.- Number of Columns *\00"
@str.21 = [31 x i8] c"* 3.- Number of Characters *\00"
@str.22 = [31 x i8] c"* 4.- Longest Row *\00"
@str.23 = [31 x i8] c"* 5.- Print Row *\00"
@str.24 = [31 x i8] c"* 6.- Print File *\00"
@str.25 = [31 x i8] c"* 7.- New Row *\00"
@str.26 = [31 x i8] c"* 8.- Modify Class Value *\00"
@str.27 = [31 x i8] c"******************************\00"
@str.28 = [38 x i8] c"Value out of range, please try again.\00"
@str.29 = [35 x i8] c"Incorrect value, please try again.\00"
define i32 @requestMenuOption() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.27, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.21, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.22, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.23, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.24, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.25, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.26, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.27, i64 0, i64 0))
br label %17
17: ; preds = %32, %0
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32* %1, i8* %2)
%20 = icmp ne i32 %19, 2
%21 = load i8, i8* %2
%22 = icmp ne i8 %21, 10
%23 = select i1 %20, i1 true, i1 %22
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.29, i64 0, i64 0))
%26 = call i32 (...) @clean_stdin()
br label %32
27: ; preds = %17
%28 = load i32, i32* %1
%29 = icmp ugt i32 %28, 8
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.28, i64 0, i64 0))
br label %32
32: ; preds = %30, %24
br label %17
33: ; preds = %27
ret i32 %28
}