#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 main() {
  int obj, c, oportunidades, adivinado, i;
  obj = 271;
  oportunidades = 5;
  adivinado = i = 0;
  while (i < oportunidades && !adivinado) {
    printf("Ingresa un numero entre el 1 y el 1000: ");
    scanf(" %d", &c);
    if (c < 1 || c > 1000) {
      printf("\tEl numero no entra dentro del rango.\n\n");
    } else {
      if (c == obj) {
        printf("\tFelicidades, adivinaste!\n");
        adivinado = 1;
      } else if (c > obj) {
        printf("\tEl numero que ingresaste es mayor al que tienes que "
               "adivinar\n\n");
      } else {
        printf("\tEl numero que ingresaste es menor al que tienes que "
               "adivinar\n\n");
      }
    }
    i++;
  }
  if (!adivinado && i == oportunidades)
    printf("Lo lamento, no adivinaste.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x10f,-0x8(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x19(%rbp)
jge    1168 <main+0x48>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1178 <main+0x58>
jmp    1221 <main+0x101>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jl     11ab <main+0x8b>
cmpl   $0x3e8,-0xc(%rbp)
jle    11bc <main+0x9c>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11e0 <main+0xc0>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    120e <main+0xee>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11fd <main+0xdd>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
jmp    1213 <main+0xf3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
cmpl   $0x0,-0x14(%rbp)
jne    1243 <main+0x123>
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1243 <main+0x123>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x3e9(%rax),%ecx
lea    0xf7d(%rip),%rbx
mov    %rbx,%rdi
cmp    $0xfffffc18,%ecx
jb     118b <main+0x5b>
cmp    $0x10f,%eax
je     12be <main+0x18e>
lea    0xf07(%rip),%rax
lea    0xec1(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x3e9(%rax),%ecx
mov    %rbx,%rdi
cmp    $0xfffffc18,%ecx
jb     11df <main+0xaf>
cmp    $0x10f,%eax
je     12be <main+0x18e>
lea    0xeb3(%rip),%rax
lea    0xe6d(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
lea    0xe32(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x3e9(%rax),%ecx
mov    %rbx,%rdi
cmp    $0xfffffc18,%ecx
jb     1233 <main+0x103>
cmp    $0x10f,%eax
je     12be <main+0x18e>
lea    0xe5f(%rip),%rax
lea    0xe19(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
lea    0xdde(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x3e9(%rax),%ecx
mov    %rbx,%rdi
cmp    $0xfffffc18,%ecx
jb     1283 <main+0x153>
cmp    $0x10f,%eax
je     12be <main+0x18e>
lea    0xe0f(%rip),%rax
lea    0xdc9(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
lea    0xd71(%rip),%rdi
call   1040 <printf@plt>
lea    0xd8e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x3e9(%rax),%ecx
cmp    $0xfffffc18,%ecx
jb     12d9 <main+0x1a9>
cmp    $0x10f,%eax
jne    12c7 <main+0x197>
lea    0xe01(%rip),%rdi
jmp    12e8 <main+0x1b8>
lea    0xdb9(%rip),%rax
lea    0xd73(%rip),%rbx
cmova  %rax,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xd45(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Ingresa un numero entre el 1 y el 1000: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [40 x i8] c"\09El numero no entra dentro del rango.\0A\0A\00"
@.str.3 = [27 x i8] c"\09Felicidades, adivinaste!\0A\00"
@.str.4 = [64 x i8] c"\09El numero que ingresaste es mayor al que tienes que adivinar\0A\0A\00"
@.str.5 = [64 x i8] c"\09El numero que ingresaste es menor al que tienes que adivinar\0A\0A\00"
@.str.6 = [28 x i8] c"Lo lamento, no adivinaste.\0A\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 271, i32* %2
store i32 5, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %43, %0
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %11, %7
%16 = phi i1 [ false, %7 ], [ %14, %11 ]
br i1 %16, label %17, label %46
17: ; preds = %15
%18 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 1
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 1000
br i1 %24, label %25, label %27
25: ; preds = %22, %17
%26 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %43
27: ; preds = %22
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %5
br label %42
33: ; preds = %27
%34 = load i32, i32* %3
%35 = load i32, i32* %2
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0))
br label %41
39: ; preds = %33
%40 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
br label %42
42: ; preds = %41, %31
br label %43
43: ; preds = %42, %25
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %7
46: ; preds = %15
%47 = load i32, i32* %5
%48 = icmp ne i32 %47, 0
br i1 %48, label %55, label %49
49: ; preds = %46
%50 = load i32, i32* %6
%51 = load i32, i32* %4
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %55
55: ; preds = %53, %49, %46
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Ingresa un numero entre el 1 y el 1000: \00"
@.str.1 = [4 x i8] c" %d\00"
@str = [27 x i8] c"Lo lamento, no adivinaste.\00"
@str.7 = [63 x i8] c"\09El numero que ingresaste es menor al que tienes que adivinar\0A\00"
@str.8 = [63 x i8] c"\09El numero que ingresaste es mayor al que tienes que adivinar\0A\00"
@str.9 = [26 x i8] c"\09Felicidades, adivinaste!\00"
@str.10 = [39 x i8] c"\09El numero no entra dentro del rango.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -1001
%7 = icmp ult i32 %6, -1000
br i1 %7, label %13, label %8
8: ; preds = %0
%9 = icmp eq i32 %5, 271
br i1 %9, label %68, label %10
10: ; preds = %8
%11 = icmp ugt i32 %5, 271
%12 = select i1 %11, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.7, i64 0, i64 0)
br label %13
13: ; preds = %10, %0
%14 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0), %0 ], [ %12, %10 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = add i32 %18, -1001
%20 = icmp ult i32 %19, -1000
br i1 %20, label %26, label %21
21: ; preds = %13
%22 = icmp eq i32 %18, 271
br i1 %22, label %68, label %23
23: ; preds = %21
%24 = icmp ugt i32 %18, 271
%25 = select i1 %24, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.7, i64 0, i64 0)
br label %26
26: ; preds = %23, %13
%27 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0), %13 ], [ %25, %23 ]
%28 = call i32 @puts(i8* dereferenceable(1) %27)
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%31 = load i32, i32* %1
%32 = add i32 %31, -1001
%33 = icmp ult i32 %32, -1000
br i1 %33, label %39, label %34
34: ; preds = %26
%35 = icmp eq i32 %31, 271
br i1 %35, label %68, label %36
36: ; preds = %34
%37 = icmp ugt i32 %31, 271
%38 = select i1 %37, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.7, i64 0, i64 0)
br label %39
39: ; preds = %36, %26
%40 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0), %26 ], [ %38, %36 ]
%41 = call i32 @puts(i8* dereferenceable(1) %40)
%42 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%44 = load i32, i32* %1
%45 = add i32 %44, -1001
%46 = icmp ult i32 %45, -1000
br i1 %46, label %52, label %47
47: ; preds = %39
%48 = icmp eq i32 %44, 271
br i1 %48, label %68, label %49
49: ; preds = %47
%50 = icmp ugt i32 %44, 271
%51 = select i1 %50, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.7, i64 0, i64 0)
br label %52
52: ; preds = %49, %39
%53 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0), %39 ], [ %51, %49 ]
%54 = call i32 @puts(i8* dereferenceable(1) %53)
%55 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%56 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%57 = load i32, i32* %1
%58 = add i32 %57, -1001
%59 = icmp ult i32 %58, -1000
br i1 %59, label %65, label %60
60: ; preds = %52
%61 = icmp eq i32 %57, 271
br i1 %61, label %68, label %62
62: ; preds = %60
%63 = icmp ugt i32 %57, 271
%64 = select i1 %63, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([63 x i8], [63 x i8]* @str.7, i64 0, i64 0)
br label %65
65: ; preds = %62, %52
%66 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0), %52 ], [ %64, %62 ]
%67 = call i32 @puts(i8* dereferenceable(1) %66)
br label %68
68: ; preds = %8, %21, %34, %47, %60, %65
%69 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0), %65 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0), %60 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0), %47 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0), %34 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0), %21 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0), %8 ]
%70 = call i32 @puts(i8* dereferenceable(1) %69)
ret i32 0
}