#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*/ printf(char *);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n_c;
  int indovinato;
  int t;
  int n_u;
  printf("\n                Indovina il numero ");
  n_c = rand();
  indovinato = 0;
  t = 10;
  printf("\n inserisce un numero");
  scanf("%d", &n_u);
  do {
    if (n_u == n_c) {
      indovinato = 1;
    }
  } while (t > 0 && indovinato == 0);
  if (indovinato == 1) {
    printf("\n HAI VINTO");
  } else {
    PRINTF("\n HAI PERSO");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11a2 <main+0x62>
movl   $0x1,-0xc(%rbp)
jmp    11a7 <main+0x67>
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x15(%rbp)
jle    11c0 <main+0x80>
cmpl   $0x0,-0xc(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    118f <main+0x4f>
cmpl   $0x1,-0xc(%rbp)
jne    11e6 <main+0xa6>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    11f2 <main+0xb2>
lea    0xe5d(%rip),%rdi
call   1050 <PRINTF@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ebx
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmp    %ebx,0xc(%rsp)
jne    1190 <main+0x60>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1190 <main+0x60>

LLVM IR (-O0):
@.str = [37 x i8] c"\0A Indovina il numero \00"
@.str.1 = [22 x i8] c"\0A inserisce un numero\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"\0A HAI VINTO\00"
@.str.4 = [12 x i8] c"\0A HAI PERSO\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 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @rand()
store i32 %7, i32* %2
store i32 0, i32* %3
store i32 10, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
br label %10
10: ; preds = %22, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %3
br label %15
15: ; preds = %14, %10
br label %16
16: ; preds = %15
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 0
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ false, %16 ], [ %21, %19 ]
br i1 %23, label %10, label %24
24: ; preds = %22
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %31
29: ; preds = %24
%30 = call i32 @PRINTF(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [37 x i8] c"\0A Indovina il numero \00"
@.str.1 = [22 x i8] c"\0A inserisce un numero\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"\0A HAI VINTO\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @rand()
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, %4
br i1 %8, label %10, label %9
9: ; preds = %0, %9
br label %9
10: ; preds = %0
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}