#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  printf("Juego de adivinar numeros creado por eder\n");
  srand(time(NULL));
  char linea[180];
  int numeroRandom = -1;
  int numeroUsuario = -1;
  numeroRandom = rand() % 21 + 0;
  do {
    printf("En numero esta entre el (1 to 20): ");
    fgets(linea, 180, stdin);
    sscanf(linea, "%d", &numeroUsuario);
    if (numeroRandom < numeroUsuario)
      printf("El numero es menor\n");
    else if (numeroRandom > numeroUsuario)
      printf("El numero es mayor\n");
    else if (numeroRandom = numeroUsuario)
      printf("Ganador: Has adivinado el munero\n");
  } while (numeroRandom != numeroUsuario);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0xffffffff,-0xd4(%rbp)
ff ff ff
movl   $0xffffffff,-0xd8(%rbp)
ff ff ff
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x15,%ecx
cltd
idiv   %ecx
add    $0x0,%edx
mov    %edx,-0xd4(%rbp)
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
mov    $0xb4,%esi
call   1060 <fgets@plt>
lea    -0xd0(%rbp),%rdi
lea    0xe4a(%rip),%rsi
lea    -0xd8(%rbp),%rdx
call   1080 <sscanf@plt>
mov    -0xd4(%rbp),%eax
cmp    -0xd8(%rbp),%eax
jge    1234 <main+0xc4>
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
jmp    1282 <main+0x112>
mov    -0xd4(%rbp),%eax
cmp    -0xd8(%rbp),%eax
jle    1257 <main+0xe7>
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
jmp    127d <main+0x10d>
mov    -0xd8(%rbp),%eax
mov    %eax,-0xd4(%rbp)
cmp    $0x0,%eax
je     1278 <main+0x108>
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
jmp    127d <main+0x10d>
jmp    1282 <main+0x112>
jmp    1287 <main+0x117>
mov    -0xd4(%rbp),%eax
cmp    -0xd8(%rbp),%eax
jne    11d1 <main+0x61>
lea    0xdfc(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0xffffffff,0xc(%rsp)
ff
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rbx
imul   $0x30c30c31,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%eax
sub    %eax,%ebx
lea    0xe20(%rip),%r14
mov    0x2e01(%rip),%rbp
lea    0x10(%rsp),%r13
lea    0xe31(%rip),%r15
lea    0xc(%rsp),%r12
jmp    1212 <main+0x92>
nopw   0x0(%rax,%rax,1)
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
cmp    0xc(%rsp),%ebx
je     125e <main+0xde>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    0x0(%rbp),%edx
mov    %r13,%rdi
mov    $0xb4,%esi
call   1070 <fgets@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1090 <sscanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,%ebx
jl     1200 <main+0x80>
lea    0xe31(%rip),%rdi
jg     1207 <main+0x87>
lea    0xe07(%rip),%rdi
mov    %eax,%ebx
test   %eax,%eax
jne    1207 <main+0x87>
xor    %ebx,%ebx
cmp    0xc(%rsp),%ebx
jne    1212 <main+0x92>
lea    0xdc2(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Juego de adivinar numeros creado por eder\0A\00"
@.str.1 = [36 x i8] c"En numero esta entre el (1 to 20): \00"
@stdin = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [20 x i8] c"El numero es menor\0A\00"
@.str.4 = [20 x i8] c"El numero es mayor\0A\00"
@.str.5 = [34 x i8] c"Ganador: Has adivinado el munero\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [180 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
store i32 -1, i32* %7
store i32 -1, i32* %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 21
%14 = add nsw i32 %13, 0
store i32 %14, i32* %7
br label %15
15: ; preds = %41, %2
%16 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [180 x i8], [180 x i8]* %6, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 180, i32 %18)
%20 = getelementptr inbounds [180 x i8], [180 x i8]* %6, i64 0, i64 0
%21 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %15
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %40
27: ; preds = %15
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %39
33: ; preds = %27
%34 = load i32, i32* %8
store i32 %34, i32* %7
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %38
38: ; preds = %36, %33
br label %39
39: ; preds = %38, %31
br label %40
40: ; preds = %39, %25
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = icmp ne i32 %42, %43
br i1 %44, label %15, label %45
45: ; preds = %41
%46 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"En numero esta entre el (1 to 20): \00"
@stdin = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@.str.6 = [6 x i8] c"pause\00"
@str = [42 x i8] c"Juego de adivinar numeros creado por eder\00"
@str.7 = [33 x i8] c"Ganador: Has adivinado el munero\00"
@str.8 = [19 x i8] c"El numero es mayor\00"
@str.9 = [19 x i8] c"El numero es menor\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [180 x i8]
%4 = alloca i32
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = getelementptr inbounds [180 x i8], [180 x i8]* %3, i64 0, i64 0
%9 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 21
br label %12
12: ; preds = %28, %2
%13 = phi i32 [ %11, %2 ], [ %29, %28 ]
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %8, i32 180, i32 %15)
%17 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %4
%19 = icmp slt i32 %13, %18
br i1 %19, label %24, label %20
20: ; preds = %12
%21 = icmp sgt i32 %13, %18
br i1 %21, label %24, label %22
22: ; preds = %20
%23 = icmp eq i32 %18, 0
br i1 %23, label %28, label %24
24: ; preds = %22, %20, %12
%25 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0), %12 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0), %20 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0), %22 ]
%26 = phi i32 [ %13, %12 ], [ %13, %20 ], [ %18, %22 ]
%27 = call i32 @puts(i8* dereferenceable(1) %25)
br label %28
28: ; preds = %24, %22
%29 = phi i32 [ 0, %22 ], [ %26, %24 ]
%30 = load i32, i32* %4
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %12
32: ; preds = %28
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}