#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*/ coloration(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ viderBuffer();
int choisirDifficulte(void) {
  int choix;
  int compteur;
  compteur = 0;
  printf("\n\nChoisissez votre niveau de difficulte : \n\n");
  coloration("\t1 - Facile\n\n", "32");
  coloration("\t2 - Normal\n\n", "33");
  coloration("\t3 - Difficile\n\n", "31");
  do {
    if (compteur > 0)
      printf("Veuillez entrer un nombre compris entre 1 et 3 !\n");
    printf("> ");
    scanf("%d", &choix);
    viderBuffer();
    compteur++;
  } while (choix < 1 || choix > 3);
  return choix;
}


x86 assembly (clang, -O0):
<choisirDifficulte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1040 <coloration@plt>
lea    0xec9(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1040 <coloration@plt>
lea    0xec7(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1040 <coloration@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11aa <choisirDifficulte+0x6a>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <viderBuffer@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jl     11ef <choisirDifficulte+0xaf>
cmpl   $0x3,-0x4(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1194 <choisirDifficulte+0x54>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choisirDifficulte>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <coloration@plt>
lea    0xe93(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1050 <coloration@plt>
lea    0xe91(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <coloration@plt>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1060 <viderBuffer@plt>
mov    0x4(%rsp),%eax
lea    -0x4(%rax),%ecx
cmp    $0xfffffffc,%ecx
ja     121e <choisirDifficulte+0xce>
lea    0xe94(%rip),%r14
lea    0xe5b(%rip),%r15
lea    0xe57(%rip),%r12
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1060 <viderBuffer@plt>
mov    0x4(%rsp),%eax
lea    -0x4(%rax),%ecx
cmp    $0xfffffffd,%ecx
jb     11f0 <choisirDifficulte+0xa0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\0A\0AChoisissez votre niveau de difficulte : \0A\0A\00"
@.str.1 = [14 x i8] c"\091 - Facile\0A\0A\00"
@.str.2 = [3 x i8] c"32\00"
@.str.3 = [14 x i8] c"\092 - Normal\0A\0A\00"
@.str.4 = [3 x i8] c"33\00"
@.str.5 = [17 x i8] c"\093 - Difficile\0A\0A\00"
@.str.6 = [3 x i8] c"31\00"
@.str.7 = [50 x i8] c"Veuillez entrer un nombre compris entre 1 et 3 !\0A\00"
@.str.8 = [3 x i8] c"> \00"
@.str.9 = [3 x i8] c"%d\00"
define i32 @choisirDifficulte() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @coloration(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @coloration(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @coloration(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%15 = call i32 (...) @viderBuffer()
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %12
%19 = load i32, i32* %1
%20 = icmp slt i32 %19, 1
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, 3
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ true, %18 ], [ %23, %21 ]
br i1 %25, label %7, label %26
26: ; preds = %24
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"\091 - Facile\0A\0A\00"
@.str.2 = [3 x i8] c"32\00"
@.str.3 = [14 x i8] c"\092 - Normal\0A\0A\00"
@.str.4 = [3 x i8] c"33\00"
@.str.5 = [17 x i8] c"\093 - Difficile\0A\0A\00"
@.str.6 = [3 x i8] c"31\00"
@.str.8 = [3 x i8] c"> \00"
@.str.9 = [3 x i8] c"%d\00"
@str = [44 x i8] c"\0A\0AChoisissez votre niveau de difficulte : \0A\00"
@str.10 = [49 x i8] c"Veuillez entrer un nombre compris entre 1 et 3 !\00"
define i32 @choisirDifficulte() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @coloration(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @coloration(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @coloration(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%9 = call i32 (...) @viderBuffer()
%10 = load i32, i32* %1
%11 = add i32 %10, -4
%12 = icmp ult i32 %11, -3
br i1 %12, label %13, label %21
13: ; preds = %0, %13
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.10, i64 0, i64 0))
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%17 = call i32 (...) @viderBuffer()
%18 = load i32, i32* %1
%19 = add i32 %18, -4
%20 = icmp ult i32 %19, -3
br i1 %20, label %13, label %21
21: ; preds = %13, %0
%22 = phi i32 [ %10, %0 ], [ %18, %13 ]
ret i32 %22
}