#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*/ scanf(char *, int *);
int /*<<< orphan*/ separationTexte();
int /*<<< orphan*/ viderBuffer();
unsigned int demanderConfirmation(const char *message,
                                  const unsigned int separation) {
  int choixJoueur;
  unsigned int compteurErreur;
  compteurErreur = 0;
  if (separation == 1)
    separationTexte();
  do {
    if (compteurErreur > 0) {
      printf("Veuillez entrer 0 pour refuser et 1 pour accepter !\n");
      viderBuffer();
    }
    printf("%s\n", message);
    printf("> ");
    scanf("%d", &choixJoueur);
    ++compteurErreur;
  } while (choixJoueur != 0 && choixJoueur != 1);
  viderBuffer();
  return choixJoueur;
}


x86 assembly (clang, -O0):
<demanderConfirmation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1167 <demanderConfirmation+0x27>
mov    $0x0,%al
call   1050 <separationTexte@plt>
jmp    116c <demanderConfirmation+0x2c>
cmpl   $0x0,-0x14(%rbp)
jbe    118b <demanderConfirmation+0x4b>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <viderBuffer@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x15(%rbp)
je     11dd <demanderConfirmation+0x9d>
cmpl   $0x1,-0x10(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    116c <demanderConfirmation+0x2c>
mov    $0x0,%al
call   1040 <viderBuffer@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<demanderConfirmation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
cmp    $0x1,%esi
jne    116a <demanderConfirmation+0x1a>
xor    %eax,%eax
call   1060 <separationTexte@plt>
lea    0xe8f(%rip),%r14
lea    0xe8b(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe82(%rip),%r13
xor    %ebp,%ebp
jmp    11b4 <demanderConfirmation+0x64>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
jbe    11ca <demanderConfirmation+0x7a>
sub    $0x1,%ebp
jb     1190 <demanderConfirmation+0x40>
mov    %r13,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <viderBuffer@plt>
jmp    1190 <demanderConfirmation+0x40>
xor    %eax,%eax
call   1050 <viderBuffer@plt>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Veuillez entrer 0 pour refuser et 1 pour accepter !\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [3 x i8] c"> \00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @demanderConfirmation(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @separationTexte()
br label %11
11: ; preds = %9, %2
br label %12
12: ; preds = %31, %11
%13 = load i32, i32* %6
%14 = icmp ugt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (...) @viderBuffer()
br label %18
18: ; preds = %15, %12
%19 = load i8*, i8** %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%23 = load i32, i32* %6
%24 = add i32 %23, 1
store i32 %24, i32* %6
br label %25
25: ; preds = %18
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %5
%30 = icmp ne i32 %29, 1
br label %31
31: ; preds = %28, %25
%32 = phi i1 [ false, %25 ], [ %30, %28 ]
br i1 %32, label %12, label %33
33: ; preds = %31
%34 = call i32 (...) @viderBuffer()
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"> \00"
@.str.3 = [3 x i8] c"%d\00"
@str = [52 x i8] c"Veuillez entrer 0 pour refuser et 1 pour accepter !\00"
define i32 @demanderConfirmation(i8* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %1, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @separationTexte()
br label %8
8: ; preds = %6, %2
br label %9
9: ; preds = %8, %15
%10 = phi i32 [ %19, %15 ], [ 0, %8 ]
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%14 = call i32 (...) @viderBuffer()
br label %15
15: ; preds = %12, %9
%16 = call i32 @puts(i8* dereferenceable(1) %0)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%19 = add i32 %10, 1
%20 = load i32, i32* %3
%21 = icmp ult i32 %20, 2
br i1 %21, label %22, label %9
22: ; preds = %15
%23 = call i32 (...) @viderBuffer()
%24 = load i32, i32* %3
ret i32 %24
}