#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 */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ printf(char *);
float rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int x, n;
  srand(time(NULL));
  x = 1 + 99 * (rand() / (float)RAND_MAX);
  while (1) {
    printf("n = ");
    scanf("%d", &n);
    if (n == x) {
      printf("Acertou\n");
      break;
    } else if (n > x) {
      printf("O número é menor\n");
    } else {
      printf("O número é maior\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    0x2e6b(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  0xe72(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe6a(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11de <main+0x8e>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    1211 <main+0xc1>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11fb <main+0xab>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
jmp    1207 <main+0xb7>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    120c <main+0xbc>
jmp    11a5 <main+0x55>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    0x2e61(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
mulss  0xe68(%rip),%xmm0
addss  0xe64(%rip),%xmm0
cvttss2si %xmm0,%ebp
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe56(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
jne    11e6 <main+0x86>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe36(%rip),%r12
lea    0xe1c(%rip),%r13
lea    0xe0d(%rip),%r14
lea    0xe0b(%rip),%r15
lea    0x4(%rsp),%rbx
jmp    1230 <main+0xd0>
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebp,%eax
je     11c9 <main+0x69>
mov    %r12,%rdi
cmp    %ebp,%eax
jg     1210 <main+0xb0>
mov    %r13,%rdi
jmp    1210 <main+0xb0>

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [5 x i8] c"n = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Acertou\0A\00"
@.str.3 = [20 x i8] c"O n\C3\BAmero \C3\A9 menor\0A\00"
@.str.4 = [20 x i8] c"O n\C3\BAmero \C3\A9 maior\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call float (...) @rand()
%7 = load i64, i64* @RAND_MAX
%8 = sitofp i64 %7 to float
%9 = fdiv float %6, %8
%10 = call float @llvm.fmuladd.f32(float 9.900000e+01, float %9, float 1.000000e+00)
%11 = fptosi float %10 to i32
store i32 %11, i32* %2
br label %12
12: ; preds = %0, %29
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %30
20: ; preds = %12
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %28
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
br label %29
29: ; preds = %28
br label %12
30: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [5 x i8] c"n = \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [19 x i8] c"O n\C3\BAmero \C3\A9 maior\00"
@str.5 = [19 x i8] c"O n\C3\BAmero \C3\A9 menor\00"
@str.6 = [8 x i8] c"Acertou\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call float (...) @rand()
%6 = load i64, i64* @RAND_MAX
%7 = sitofp i64 %6 to float
%8 = fdiv float %5, %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float 9.900000e+01, float 1.000000e+00)
%10 = fptosi float %9 to i32
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, %10
br i1 %14, label %15, label %17
15: ; preds = %17, %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.6, i64 0, i64 0))
ret i32 0
17: ; preds = %0, %17
%18 = phi i32 [ %24, %17 ], [ %13, %0 ]
%19 = icmp sgt i32 %18, %10
%20 = select i1 %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 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 %24, %10
br i1 %25, label %15, label %17
}