#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();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  int numero1 = 0;
  srand(time(0));
  int numero_aleatorio = rand() % 10 + 1;
  printf("%d\n", numero_aleatorio);
  printf("\nEntre com um numero inteiro:\n");
  scanf("%d", &numero1);
  if (numero1 == numero_aleatorio) {
    printf("\nVoce acertou!\n");
  } else {
    if (numero1 > numero_aleatorio) {
      printf("\nNumero aleatorio e menor. Tente novamente:\n");
    } else {
      printf("\nNumero aleatorio e maior. Tente novamente:\n");
    }
    scanf("%d", &numero1);
    if (numero1 == numero_aleatorio) {
      printf("\nVoce acertou!\n");
    } else {
      if (numero1 > numero_aleatorio) {
        printf("\nNumero fornecido e maior. Tente novamente:\n");
      } else {
        printf("\nNumero fornecido e menor. Tente novamente:\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11d7 <main+0x87>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126a <main+0x11a>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11f6 <main+0xa6>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1204 <main+0xb4>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe18(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1233 <main+0xe3>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1265 <main+0x115>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1252 <main+0x102>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1260 <main+0x110>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1265 <main+0x115>
jmp    126a <main+0x11a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
lea    0xe55(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3d(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xefd(%rip),%r14
cmp    %ebx,0x4(%rsp)
je     121e <main+0xbe>
lea    0xec4(%rip),%rax
lea    0xe39(%rip),%rdi
cmovg  %rax,%rdi
call   1030 <puts@plt>
lea    0xe08(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
cmp    %ebx,0x4(%rsp)
je     121e <main+0xbe>
lea    0xe6a(%rip),%rax
lea    0xe37(%rip),%r14
cmovg  %rax,%r14
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [31 x i8] c"\0AEntre com um numero inteiro:\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"\0AVoce acertou!\0A\00"
@.str.4 = [45 x i8] c"\0ANumero aleatorio e menor. Tente novamente:\0A\00"
@.str.5 = [45 x i8] c"\0ANumero aleatorio e maior. Tente novamente:\0A\00"
@.str.6 = [45 x i8] c"\0ANumero fornecido e maior. Tente novamente:\0A\00"
@.str.7 = [45 x i8] c"\0ANumero fornecido e menor. Tente novamente:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @time(i32 0)
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 10
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %43
18: ; preds = %0
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %26
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %42
33: ; preds = %26
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
br label %41
39: ; preds = %33
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
br label %42
42: ; preds = %41, %31
br label %43
43: ; preds = %42, %16
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [30 x i8] c"\0AEntre com um numero inteiro:\00"
@str.8 = [44 x i8] c"\0ANumero aleatorio e maior. Tente novamente:\00"
@str.9 = [44 x i8] c"\0ANumero fornecido e menor. Tente novamente:\00"
@str.10 = [44 x i8] c"\0ANumero fornecido e maior. Tente novamente:\00"
@str.12 = [44 x i8] c"\0ANumero aleatorio e menor. Tente novamente:\00"
@str.13 = [15 x i8] c"\0AVoce acertou!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 10
%7 = add nsw i32 %6, 1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, 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 = load i32, i32* %1
%12 = icmp eq i32 %11, %7
br i1 %12, label %23, label %13
13: ; preds = %0
%14 = icmp sgt i32 %11, %7
%15 = select i1 %14, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @str.8, i64 0, i64 0)
%16 = call i32 @puts(i8* dereferenceable(1) %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, %7
br i1 %19, label %23, label %20
20: ; preds = %13
%21 = icmp sgt i32 %18, %7
%22 = select i1 %21, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @str.9, i64 0, i64 0)
br label %23
23: ; preds = %20, %13, %0
%24 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.13, i64 0, i64 0), %0 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.13, i64 0, i64 0), %13 ], [ %22, %20 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
ret i32 0
}