#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int op = 1, b = 0, c = 5, n1, n2;
  while (op) {
    c = 5;
    do {
      printf("Jugador 1: ");
      scanf("%d", &n1);
    } while (n1 < 0 || n1 > 30);
    system("clear");
    while (c >= 1) {
      printf("Jugador 2 (quedan %d intentos): ", c);
      scanf("%d", &n2);
      if (n2 > n1) {
        puts("Intenta con uno menor");
        c--;
      } else if (n2 < n1) {
        puts("Intenta con uno mayor");
        c--;
      } else {
        c = 0;
        b = 1;
      }
    }
    if (b) {
      puts("Ganaste");
      b = 0;
    } else {
      puts("Perdiste");
      b = 0;
    }
    printf("Volver a jugar ? [si=1/no=0]: ");
    scanf("%d", &op);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x5,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     12aa <main+0x16a>
movl   $0x5,-0x10(%rbp)
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe82(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jl     11ac <main+0x6c>
cmpl   $0x1e,-0x14(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1175 <main+0x35>
lea    0xe51(%rip),%rdi
call   1040 <system@plt>
cmpl   $0x1,-0x10(%rbp)
jl     1252 <main+0x112>
mov    -0x10(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe27(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1214 <main+0xd4>
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    124d <main+0x10d>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123a <main+0xfa>
lea    0xe25(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1248 <main+0x108>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
jmp    124d <main+0x10d>
jmp    11c3 <main+0x83>
cmpl   $0x0,-0xc(%rbp)
je     1274 <main+0x134>
lea    0xdff(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0xc(%rbp)
jmp    1287 <main+0x147>
lea    0xdef(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0xc(%rbp)
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd70(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
jmp    1164 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x1,0x14(%rsp)
lea    0xea3(%rip),%r14
lea    0xea8(%rip),%rbx
lea    0xc(%rsp),%r15
lea    0xea5(%rip),%r13
lea    0x10(%rsp),%rbp
lea    0xeba(%rip),%r12
jmp    11b8 <main+0x78>
mov    %rax,%rdi
call   1030 <puts@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeda(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
je     1330 <main+0x1f0>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
cmpl   $0x1e,0xc(%rsp)
ja     11b8 <main+0x78>
lea    0xe34(%rip),%rdi
call   1040 <system@plt>
mov    %r13,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %r12,%rax
cmp    %ecx,0x10(%rsp)
jg     121b <main+0xdb>
lea    0xe3e(%rip),%rax
lea    0xe4d(%rip),%rdi
jge    118d <main+0x4d>
mov    %rax,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %r12,%rax
cmp    %ecx,0x10(%rsp)
jg     125e <main+0x11e>
lea    0xdfb(%rip),%rax
lea    0xe0a(%rip),%rdi
jge    118d <main+0x4d>
mov    %rax,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %r12,%rax
cmp    %ecx,0x10(%rsp)
jg     12a1 <main+0x161>
lea    0xdb8(%rip),%rax
lea    0xdc7(%rip),%rdi
jge    118d <main+0x4d>
mov    %rax,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %r12,%rax
cmp    %ecx,0x10(%rsp)
jg     12e4 <main+0x1a4>
lea    0xd75(%rip),%rax
lea    0xd84(%rip),%rdi
jge    118d <main+0x4d>
mov    %rax,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %r12,%rax
cmp    %ecx,0x10(%rsp)
jg     117e <main+0x3e>
lea    0xd2e(%rip),%rax
lea    0xd3d(%rip),%rdi
jl     117e <main+0x3e>
jmp    118d <main+0x4d>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Jugador 1: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [33 x i8] c"Jugador 2 (quedan %d intentos): \00"
@.str.4 = [22 x i8] c"Intenta con uno menor\00"
@.str.5 = [22 x i8] c"Intenta con uno mayor\00"
@.str.6 = [8 x i8] c"Ganaste\00"
@.str.7 = [9 x i8] c"Perdiste\00"
@.str.8 = [31 x i8] c"Volver a jugar ? [si=1/no=0]: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
store i32 5, i32* %4
br label %7
7: ; preds = %56, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %59
10: ; preds = %7
store i32 5, i32* %4
br label %11
11: ; preds = %20, %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %14
14: ; preds = %11
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %5
%19 = icmp sgt i32 %18, 30
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ true, %14 ], [ %19, %17 ]
br i1 %21, label %11, label %22
22: ; preds = %20
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %48, %22
%25 = load i32, i32* %4
%26 = icmp sge i32 %25, 1
br i1 %26, label %27, label %49
27: ; preds = %24
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%31 = load i32, i32* %6
%32 = load i32, i32* %5
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %38
34: ; preds = %27
%35 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%36 = load i32, i32* %4
%37 = add nsw i32 %36, -1
store i32 %37, i32* %4
br label %48
38: ; preds = %27
%39 = load i32, i32* %6
%40 = load i32, i32* %5
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%44 = load i32, i32* %4
%45 = add nsw i32 %44, -1
store i32 %45, i32* %4
br label %47
46: ; preds = %38
store i32 0, i32* %4
store i32 1, i32* %3
br label %47
47: ; preds = %46, %42
br label %48
48: ; preds = %47, %34
br label %24
49: ; preds = %24
%50 = load i32, i32* %3
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %56
54: ; preds = %49
%55 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %56
56: ; preds = %54, %52
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
59: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Jugador 1: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [33 x i8] c"Jugador 2 (quedan %d intentos): \00"
@.str.4 = [22 x i8] c"Intenta con uno menor\00"
@.str.5 = [22 x i8] c"Intenta con uno mayor\00"
@.str.6 = [8 x i8] c"Ganaste\00"
@.str.7 = [9 x i8] c"Perdiste\00"
@.str.8 = [31 x i8] c"Volver a jugar ? [si=1/no=0]: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %12, %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp ugt i32 %10, 30
br i1 %11, label %12, label %13
12: ; preds = %7, %65
br label %7
13: ; preds = %7
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 5)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = icmp sgt i32 %17, %18
br i1 %19, label %22, label %20
20: ; preds = %13
%21 = icmp slt i32 %17, %18
br i1 %21, label %22, label %65
22: ; preds = %20, %13
%23 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %20 ]
%24 = call i32 @puts(i8* dereferenceable(1) %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 4)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = icmp sgt i32 %27, %28
br i1 %29, label %32, label %30
30: ; preds = %22
%31 = icmp slt i32 %27, %28
br i1 %31, label %32, label %65
32: ; preds = %30, %22
%33 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %22 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %30 ]
%34 = call i32 @puts(i8* dereferenceable(1) %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 3)
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%37 = load i32, i32* %3
%38 = load i32, i32* %2
%39 = icmp sgt i32 %37, %38
br i1 %39, label %42, label %40
40: ; preds = %32
%41 = icmp slt i32 %37, %38
br i1 %41, label %42, label %65
42: ; preds = %40, %32
%43 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %32 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %40 ]
%44 = call i32 @puts(i8* dereferenceable(1) %43)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 2)
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%47 = load i32, i32* %3
%48 = load i32, i32* %2
%49 = icmp sgt i32 %47, %48
br i1 %49, label %52, label %50
50: ; preds = %42
%51 = icmp slt i32 %47, %48
br i1 %51, label %52, label %65
52: ; preds = %50, %42
%53 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %42 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %50 ]
%54 = call i32 @puts(i8* dereferenceable(1) %53)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 1)
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%57 = load i32, i32* %3
%58 = load i32, i32* %2
%59 = icmp sgt i32 %57, %58
br i1 %59, label %62, label %60
60: ; preds = %52
%61 = icmp slt i32 %57, %58
br i1 %61, label %62, label %65
62: ; preds = %60, %52
%63 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %52 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), %60 ]
%64 = call i32 @puts(i8* dereferenceable(1) %63)
br label %65
65: ; preds = %62, %60, %50, %40, %30, %20
%66 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %20 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %30 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %40 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %50 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %60 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %62 ]
%67 = call i32 @puts(i8* dereferenceable(1) %66)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%69 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%70 = load i32, i32* %1
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %12
72: ; preds = %65
ret i32 0
}