#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*/ isValidInputOption(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int questionMenuOption() {
  int inputOption = 0;
  do {
    printf("\nIngrese una opción: ");
    scanf("%d", &inputOption);
    if (!isValidInputOption(inputOption)) {
      printf("\nError: opción no valida.\n");
    }
  } while (!isValidInputOption(inputOption));
  return inputOption;
}


x86 assembly (clang, -O0):
<questionMenuOption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1050 <isValidInputOption@plt>
cmp    $0x0,%eax
jne    1178 <questionMenuOption+0x48>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <questionMenuOption+0x4d>
mov    -0x4(%rbp),%edi
call   1050 <isValidInputOption@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113f <questionMenuOption+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<questionMenuOption>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xea9(%rip),%r14
lea    0xeb9(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xeb0(%rip),%r12
jmp    117d <questionMenuOption+0x3d>
nopl   0x0(%rax)
mov    0x4(%rsp),%edi
call   1060 <isValidInputOption@plt>
test   %eax,%eax
jne    11a7 <questionMenuOption+0x67>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1060 <isValidInputOption@plt>
test   %eax,%eax
jne    1170 <questionMenuOption+0x30>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    1170 <questionMenuOption+0x30>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0AIngrese una opci\C3\B3n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0AError: opci\C3\B3n no valida.\0A\00"
define i32 @questionMenuOption() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %11, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 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), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @isValidInputOption(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
br label %11
11: ; preds = %10
%12 = load i32, i32* %1
%13 = call i32 @isValidInputOption(i32 %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %2, label %16
16: ; preds = %11
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0AIngrese una opci\C3\B3n: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"\0AError: opci\C3\B3n no valida.\00"
define i32 @questionMenuOption() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %11, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 @isValidInputOption(i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %3, %9
%12 = load i32, i32* %1
%13 = call i32 @isValidInputOption(i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %3, label %15
15: ; preds = %11
%16 = load i32, i32* %1
ret i32 %16
}