#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 menu_juego() {
  printf("\n[0] Tirar\n");
  printf("[1] No tirar\n");
  int n;
  do {
    printf("Opcion: ");
    scanf("%d", &n);
  } while (n < 0 || n > 1);
  printf("\n");
  return n;
}


x86 assembly (clang, -O0):
<menu_juego>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1175 <menu_juego+0x55>
cmpl   $0x1,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1140 <menu_juego+0x20>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_juego>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
lea    0xebb(%rip),%rdi
call   1040 <puts@plt>
lea    0xe98(%rip),%r14
lea    0xe9a(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
ja     1180 <menu_juego+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"\0A[0] Tirar\0A\00"
@.str.1 = [14 x i8] c"[1] No tirar\0A\00"
@.str.2 = [9 x i8] c"Opcion: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @menu_juego() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %13, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
br label %7
7: ; preds = %4
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 1
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %4, label %15
15: ; preds = %13
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"Opcion: \00"
@.str.3 = [3 x i8] c"%d\00"
@str = [11 x i8] c"\0A[0] Tirar\00"
@str.5 = [13 x i8] c"[1] No tirar\00"
define i32 @menu_juego() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp ugt i32 %8, 1
br i1 %9, label %5, label %10
10: ; preds = %5
%11 = call i32 @putchar(i32 10)
%12 = load i32, i32* %1
ret i32 %12
}