#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 *, int *);
int /*<<< orphan*/ system(char *);
int menu() {
  int op;
  do {
    system("cls");
    printf("\t1. sumar\n");
    printf("\t2. restar\n");
    printf("\t3. multiplicar\n");
    printf("\t4. dividir\n");
    printf("\t5. salir\n");
    printf("\nSeleccione la operación deseada: ");
    scanf("%d", &op);
  } while (op < 1 || op > 5);
  return op;
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <system@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     11b5 <menu+0x85>
cmpl   $0x5,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1138 <menu+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeee(%rip),%r13
lea    0xef7(%rip),%rbx
lea    0xefc(%rip),%rbp
lea    0xe9d(%rip),%r14
lea    0xeba(%rip),%r15
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe79(%rip),%rdi
call   1040 <system@plt>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x6(%rax),%ecx
cmp    $0xfffffffb,%ecx
jb     1180 <menu+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [11 x i8] c"\091. sumar\0A\00"
@.str.2 = [12 x i8] c"\092. restar\0A\00"
@.str.3 = [17 x i8] c"\093. multiplicar\0A\00"
@.str.4 = [13 x i8] c"\094. dividir\0A\00"
@.str.5 = [11 x i8] c"\095. salir\0A\00"
@.str.6 = [36 x i8] c"\0ASeleccione la operaci\C3\B3n deseada: \00"
@.str.7 = [3 x i8] c"%d\00"
define i32 @menu() {
%1 = alloca i32
br label %2
2: ; preds = %17, %0
%3 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
br label %11
11: ; preds = %2
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 5
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ true, %11 ], [ %16, %14 ]
br i1 %18, label %2, label %19
19: ; preds = %17
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.6 = [36 x i8] c"\0ASeleccione la operaci\C3\B3n deseada: \00"
@.str.7 = [3 x i8] c"%d\00"
@str = [10 x i8] c"\091. sumar\00"
@str.8 = [11 x i8] c"\092. restar\00"
@str.9 = [16 x i8] c"\093. multiplicar\00"
@str.10 = [12 x i8] c"\094. dividir\00"
@str.11 = [10 x i8] c"\095. salir\00"
define i32 @menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.10, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.11, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = add i32 %12, -6
%14 = icmp ult i32 %13, -5
br i1 %14, label %3, label %15
15: ; preds = %3
ret i32 %12
}