#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 print_menu() {
  int c;
  printf("[1] Imprimir tabla de multiplicaciones\n");
  printf("[2] Saber si un numero es primo o no\n");
  printf("[3] Obtener la suma de los digitos de un numero\n");
  printf("[4] Salir\n");
  printf("Entrada: ");
  scanf("%d", &c);
  if (c <= 0 || c > 4)
    c = -1;
  return c;
}


x86 assembly (clang, -O0):
<print_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2c(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf29(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    1188 <print_menu+0x68>
cmpl   $0x4,-0x4(%rbp)
jle    118f <print_menu+0x6f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_menu>:
push   %rax
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
lea    -0x5(%rcx),%eax
cmp    $0xfffffffc,%eax
mov    $0xffffffff,%eax
cmovae %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"[1] Imprimir tabla de multiplicaciones\0A\00"
@.str.1 = [38 x i8] c"[2] Saber si un numero es primo o no\0A\00"
@.str.2 = [49 x i8] c"[3] Obtener la suma de los digitos de un numero\0A\00"
@.str.3 = [11 x i8] c"[4] Salir\0A\00"
@.str.4 = [10 x i8] c"Entrada: \00"
@.str.5 = [3 x i8] c"%d\00"
define i32 @print_menu() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sle i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 4
br i1 %12, label %13, label %14
13: ; preds = %10, %0
store i32 -1, i32* %1
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str.4 = [10 x i8] c"Entrada: \00"
@.str.5 = [3 x i8] c"%d\00"
@str = [39 x i8] c"[1] Imprimir tabla de multiplicaciones\00"
@str.6 = [37 x i8] c"[2] Saber si un numero es primo o no\00"
@str.7 = [48 x i8] c"[3] Obtener la suma de los digitos de un numero\00"
@str.8 = [10 x i8] c"[4] Salir\00"
define i32 @print_menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.8, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = add i32 %9, -5
%11 = icmp ult i32 %10, -4
%12 = select i1 %11, i32 -1, i32 %9
ret i32 %12
}