#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int mystery, usr;
  mystery = 42;
  usr = 0;
  while (usr != mystery) {
    printf("Entrez un nombre : ");
    scanf("%d", &usr);
    if (usr < mystery) {
      puts("Trop petit !");
    } else if (usr > mystery) {
      puts("Trop grand !");
    } else {
      puts("Bravo ! Vous avez gagné !");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11c5 <main+0x95>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1192 <main+0x62>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
jmp    11c0 <main+0x90>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11af <main+0x7f>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
jmp    11bb <main+0x8b>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
jmp    11c0 <main+0x90>
jmp    114d <main+0x1d>
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
movl   $0x0,0x4(%rsp)
lea    0xeb6(%rip),%r14
lea    0xec3(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xed4(%rip),%r13
lea    0xec0(%rip),%rbx
lea    0xeac(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmpl   $0x2a,0x4(%rsp)
mov    %rbx,%rdi
cmove  %r13,%rdi
cmovl  %rbp,%rdi
call   1030 <puts@plt>
cmpl   $0x2a,0x4(%rsp)
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Entrez un nombre : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Trop petit !\00"
@.str.3 = [13 x i8] c"Trop grand !\00"
@.str.4 = [27 x i8] c"Bravo ! Vous avez gagn\C3\A9 !\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %25, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %26
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %25
16: ; preds = %8
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %24
22: ; preds = %16
%23 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
br label %25
25: ; preds = %24, %14
br label %4
26: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Entrez un nombre : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Trop petit !\00"
@.str.3 = [13 x i8] c"Trop grand !\00"
@.str.4 = [27 x i8] c"Bravo ! Vous avez gagn\C3\A9 !\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 42
%8 = icmp eq i32 %6, 42
%9 = select i1 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0)
%10 = select i1 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %9
%11 = call i32 @puts(i8* dereferenceable(1) %10)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 42
br i1 %13, label %14, label %3
14: ; preds = %3
ret i32 0
}