#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 rand_num();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  srand(time(0));
  int t = 0, adivinado = 0;
  int input, numero;
  numero = rand_num();
  do {
    printf("\nIngresa un numero entre el 1 y el 100: ");
    scanf("%d", &input);
    if (numero == input)
      adivinado = 1;
    else if (input > numero)
      printf(
          "\tEl numero que ingresaste es mayor al que tienes que adivinar\n");
    else
      printf(
          "\tEl numero que ingresaste es menor al que tienes que adivinar\n");
    t++;
  } while (t < 5 && !adivinado);
  if (!adivinado)
    printf("\nSe te acabaron las oportunidades. El numero era: %d\n", numero);
  else
    printf("\nFelicidades! Adivinaste\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1070 <rand_num@plt>
mov    %eax,-0x14(%rbp)
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11bb <main+0x6b>
movl   $0x1,-0xc(%rbp)
jmp    11ed <main+0x9d>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11da <main+0x8a>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <main+0x98>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0x9d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x5,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jge    1211 <main+0xc1>
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1185 <main+0x35>
cmpl   $0x0,-0xc(%rbp)
jne    123c <main+0xec>
mov    -0x14(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124a <main+0xfa>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand_num@plt>
mov    %eax,%ebx
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
je     1289 <main+0x129>
lea    0xf07(%rip),%r15
lea    0xea9(%rip),%r14
mov    %r14,%rdi
cmovl  %r15,%rdi
call   1030 <puts@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
je     1289 <main+0x129>
mov    %r14,%rdi
cmovl  %r15,%rdi
call   1030 <puts@plt>
lea    0xdfd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
je     1289 <main+0x129>
mov    %r14,%rdi
cmovl  %r15,%rdi
call   1030 <puts@plt>
lea    0xdca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
je     1289 <main+0x129>
mov    %r14,%rdi
cmovl  %r15,%rdi
call   1030 <puts@plt>
lea    0xd97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
jne    12a1 <main+0x141>
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
cmovl  %r15,%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xd78(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1295 <main+0x135>

LLVM IR (-O0):
@.str = [41 x i8] c"\0AIngresa un numero entre el 1 y el 100: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [63 x i8] c"\09El numero que ingresaste es mayor al que tienes que adivinar\0A\00"
@.str.3 = [63 x i8] c"\09El numero que ingresaste es menor al que tienes que adivinar\0A\00"
@.str.4 = [54 x i8] c"\0ASe te acabaron las oportunidades. El numero era: %d\0A\00"
@.str.5 = [26 x i8] c"\0AFelicidades! Adivinaste\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @time(i32 0)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %2
store i32 0, i32* %3
%8 = call i32 (...) @rand_num()
store i32 %8, i32* %5
br label %9
9: ; preds = %35, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %9
store i32 1, i32* %3
br label %25
16: ; preds = %9
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
br label %24
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
br label %25
25: ; preds = %24, %15
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %28
28: ; preds = %25
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 5
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* %3
%33 = icmp ne i32 %32, 0
%34 = xor i1 %33, true
br label %35
35: ; preds = %31, %28
%36 = phi i1 [ false, %28 ], [ %34, %31 ]
br i1 %36, label %9, label %37
37: ; preds = %35
%38 = load i32, i32* %3
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %41)
br label %45
43: ; preds = %37
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"\0AIngresa un numero entre el 1 y el 100: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [54 x i8] c"\0ASe te acabaron las oportunidades. El numero era: %d\0A\00"
@str = [62 x i8] c"\09El numero que ingresaste es menor al que tienes que adivinar\00"
@str.6 = [25 x i8] c"\0AFelicidades! Adivinaste\00"
@str.7 = [62 x i8] c"\09El numero que ingresaste es mayor al que tienes que adivinar\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @time(i32 0)
%3 = tail call i32 @srand(i32 %2)
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 (...) @rand_num()
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp eq i32 %5, %8
br i1 %9, label %47, label %10
10: ; preds = %0
%11 = icmp sgt i32 %8, %5
%12 = select i1 %11, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp eq i32 %5, %16
br i1 %17, label %47, label %18
18: ; preds = %10
%19 = icmp sgt i32 %16, %5
%20 = select i1 %19, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp eq i32 %5, %24
br i1 %25, label %47, label %26
26: ; preds = %18
%27 = icmp sgt i32 %24, %5
%28 = select i1 %27, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0)
%29 = call i32 @puts(i8* dereferenceable(1) %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%32 = load i32, i32* %1
%33 = icmp eq i32 %5, %32
br i1 %33, label %47, label %34
34: ; preds = %26
%35 = icmp sgt i32 %32, %5
%36 = select i1 %35, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0)
%37 = call i32 @puts(i8* dereferenceable(1) %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%40 = load i32, i32* %1
%41 = icmp eq i32 %5, %40
br i1 %41, label %47, label %42
42: ; preds = %34
%43 = icmp sgt i32 %40, %5
%44 = select i1 %43, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0)
%45 = call i32 @puts(i8* dereferenceable(1) %44)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %5)
br label %49
47: ; preds = %34, %26, %18, %10, %0
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %42
ret i32 0
}