#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int n1, n2, op = 1, coins = 5;
  do {
    printf("\e[33m"
           "Jugador 1"
           "\e[m");
    printf(" - Ingrese un numero entre 0 y 30: ");
    scanf("%d", &n1);
    system("clear");
  } while ((n1 < 0 || n1 > 30) && (op == 1));
  do {
    printf("\e[34m"
           "Jugador 2 (%d intentos): "
           "\e[m",
           coins);
    scanf("%d", &n2);
    if (n2 > n1) {
      if (coins == 1) {
        puts("\e[31m"
             "Perdiste! "
             "\e[m");
        printf("¿Volver a jugar? [Si-1/No-otro numero] ");
        scanf("%d", &op);
        if (op != 1)
          exit(1);
        return main();
      }
      puts("Intenta con uno menor");
      coins--;
    } else if (n2 < n1) {
      if (coins == 1) {
        puts("\e[31m"
             "Perdiste!"
             "\e[m");
        printf("¿Volver a jugar? [Si-1/No-otro numero] ");
        scanf("%d", &op);
        if (op != 1)
          exit(1);
        return main();
      }
      puts("Intenta con uno mayor");
      coins--;
    } else {
      puts("\e[32m"
           "Ganaste!"
           "\e[m");
      printf("¿Volver a jugar? [Si-1/No-otro numero] ");
      scanf("%d", &op);
      if (op != 1)
        exit(1);
      return main();
    }
  } while (coins != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe89(%rip),%rdi
call   1040 <system@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11ce <main+0x6e>
xor    %eax,%eax
cmpl   $0x1e,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jle    11d8 <main+0x78>
cmpl   $0x1,-0x10(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    117d <main+0x1d>
jmp    11e8 <main+0x88>
mov    -0x14(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe36(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1284 <main+0x124>
cmpl   $0x1,-0x14(%rbp)
jne    126a <main+0x10a>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdf6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
je     125d <main+0xfd>
mov    $0x1,%edi
call   1080 <exit@plt>
call   1060 <main@plt>
mov    %eax,-0x4(%rbp)
jmp    1365 <main+0x205>
lea    0xe2c(%rip),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    134f <main+0x1ef>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ff <main+0x19f>
cmpl   $0x1,-0x14(%rbp)
jne    12e5 <main+0x185>
lea    0xe12(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd7b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
je     12d8 <main+0x178>
mov    $0x1,%edi
call   1080 <exit@plt>
call   1060 <main@plt>
mov    %eax,-0x4(%rbp)
jmp    1365 <main+0x205>
lea    0xdd9(%rip),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    134a <main+0x1ea>
lea    0xdd5(%rip),%rdi
call   1030 <puts@plt>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd16(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
je     133d <main+0x1dd>
mov    $0x1,%edi
call   1080 <exit@plt>
call   1060 <main@plt>
mov    %eax,-0x4(%rbp)
jmp    1365 <main+0x205>
jmp    134f <main+0x1ef>
jmp    1354 <main+0x1f4>
cmpl   $0x0,-0x14(%rbp)
jne    11e8 <main+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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,0xc(%rsp)
lea    0xe83(%rip),%r14
lea    0xe8e(%rip),%r15
lea    0xeab(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xea2(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
cmpl   $0x1e,0x10(%rsp)
ja     11a0 <main+0x40>
mov    $0x5,%ebx
lea    0xe65(%rip),%r14
lea    0xe55(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xeb0(%rip),%r13
lea    0xed1(%rip),%rbp
jmp    1210 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
cmp    $0x1,%ebx
je     1244 <main+0xe4>
call   1030 <puts@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %eax,0x14(%rsp)
jg     1200 <main+0xa0>
jge    124d <main+0xed>
mov    %rbp,%rdi
cmp    $0x1,%ebx
jne    1208 <main+0xa8>
lea    0xe71(%rip),%rdi
jmp    1254 <main+0xf4>
lea    0xe16(%rip),%rdi
jmp    1254 <main+0xf4>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdc8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
jne    1295 <main+0x135>
call   1060 <main@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"\1B[33mJugador 1\1B[m\00"
@.str.1 = [36 x i8] c" - Ingrese un numero entre 0 y 30: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"clear\00"
@.str.4 = [34 x i8] c"\1B[34mJugador 2 (%d intentos): \1B[m\00"
@.str.5 = [19 x i8] c"\1B[31mPerdiste! \1B[m\00"
@.str.6 = [41 x i8] c"\C2\BFVolver a jugar? [Si-1/No-otro numero] \00"
@.str.7 = [22 x i8] c"Intenta con uno menor\00"
@.str.8 = [18 x i8] c"\1B[31mPerdiste!\1B[m\00"
@.str.9 = [22 x i8] c"Intenta con uno mayor\00"
@.str.10 = [17 x i8] c"\1B[32mGanaste!\1B[m\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
store i32 5, i32* %5
br label %6
6: ; preds = %20, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %6
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 30
br i1 %16, label %17, label %20
17: ; preds = %14, %11
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 1
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br i1 %21, label %6, label %22
22: ; preds = %20
br label %23
23: ; preds = %80, %22
%24 = load i32, i32* %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, 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 %30, label %47
30: ; preds = %23
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%37 = load i32, i32* %4
%38 = icmp ne i32 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %33
%42 = call i32 @main()
store i32 %42, i32* %1
br label %84
43: ; preds = %30
%44 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%45 = load i32, i32* %5
%46 = add nsw i32 %45, -1
store i32 %46, i32* %5
br label %79
47: ; preds = %23
%48 = load i32, i32* %3
%49 = load i32, i32* %2
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %68
51: ; preds = %47
%52 = load i32, i32* %5
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %64
54: ; preds = %51
%55 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%57 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%58 = load i32, i32* %4
%59 = icmp ne i32 %58, 1
br i1 %59, label %60, label %62
60: ; preds = %54
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %54
%63 = call i32 @main()
store i32 %63, i32* %1
br label %84
64: ; preds = %51
%65 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%66 = load i32, i32* %5
%67 = add nsw i32 %66, -1
store i32 %67, i32* %5
br label %78
68: ; preds = %47
%69 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%71 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%72 = load i32, i32* %4
%73 = icmp ne i32 %72, 1
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %68
%77 = call i32 @main()
store i32 %77, i32* %1
br label %84
78: ; preds = %64
br label %79
79: ; preds = %78, %43
br label %80
80: ; preds = %79
%81 = load i32, i32* %5
%82 = icmp ne i32 %81, 0
br i1 %82, label %23, label %83
83: ; preds = %80
store i32 0, i32* %1
br label %84
84: ; preds = %83, %76, %62, %41
%85 = load i32, i32* %1
ret i32 %85
}

LLVM IR (-O2):
@.str = [18 x i8] c"\1B[33mJugador 1\1B[m\00"
@.str.1 = [36 x i8] c" - Ingrese un numero entre 0 y 30: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"clear\00"
@.str.4 = [34 x i8] c"\1B[34mJugador 2 (%d intentos): \1B[m\00"
@.str.5 = [19 x i8] c"\1B[31mPerdiste! \1B[m\00"
@.str.6 = [41 x i8] c"\C2\BFVolver a jugar? [Si-1/No-otro numero] \00"
@.str.7 = [22 x i8] c"Intenta con uno menor\00"
@.str.8 = [18 x i8] c"\1B[31mPerdiste!\1B[m\00"
@.str.9 = [22 x i8] c"Intenta con uno mayor\00"
@.str.10 = [17 x i8] c"\1B[32mGanaste!\1B[m\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 1, i32* %3
br label %7
7: ; preds = %7, %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp ugt i32 %12, 30
br i1 %13, label %7, label %14
14: ; preds = %7, %51
%15 = phi i32 [ %54, %51 ], [ 5, %7 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = load i32, i32* %1
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %31
21: ; preds = %14
%22 = icmp eq i32 %15, 1
br i1 %22, label %23, label %51
23: ; preds = %21
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 1
br i1 %28, label %55, label %29
29: ; preds = %23
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %14
%32 = icmp slt i32 %18, %19
br i1 %32, label %33, label %43
33: ; preds = %31
%34 = icmp eq i32 %15, 1
br i1 %34, label %35, label %51
35: ; preds = %33
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 1
br i1 %40, label %55, label %41
41: ; preds = %35
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %31
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%47 = load i32, i32* %3
%48 = icmp eq i32 %47, 1
br i1 %48, label %55, label %49
49: ; preds = %43
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %33, %21
%52 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %21 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), %33 ]
%53 = call i32 @puts(i8* dereferenceable(1) %52)
%54 = add nsw i32 %15, -1
br label %14
55: ; preds = %43, %35, %23
%56 = call i32 @main()
ret i32 0
}