#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__ comparer(char, char const *, char *, int const);
char lireCaractere(char);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char const *);
int boucleEssai(const char motSecret[], char motEssai[],
                const int tailleMotSecret) {
  int i;
  int nbEssai = 10;
  char lettreEssai;
  while (nbEssai > 0) {
    printf("Vous avez encore %d essai !\n", nbEssai);
    printf("Quel est le mot secret ? %s \n", motEssai);
    lettreEssai = lireCaractere(lettreEssai);
    if (comparer(lettreEssai, motSecret, motEssai, tailleMotSecret) == 0)
      nbEssai--;
    if (strcmp(motEssai, motSecret) == 0) {
      printf("Le mot secret est %s \n", motSecret);
      printf("Bravo vous avez trouve le mot secret !\n");
      return 0;
    }
  }
  printf("Vous n'avez pas reussi a trouve le mot secret ... \nLa reponse etait "
         ": %s \n",
         motSecret);
  return 0;
}


x86 assembly (clang, -O0):
<boucleEssai>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0xa,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1204 <boucleEssai+0xc4>
mov    -0x24(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x25(%rbp),%edi
call   1050 <lireCaractere@plt>
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
movsbl %al,%edi
call   1060 <comparer@plt>
cmp    $0x0,%rax
jne    11bc <boucleEssai+0x7c>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ff <boucleEssai+0xbf>
mov    -0x10(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121d <boucleEssai+0xdd>
jmp    115a <boucleEssai+0x1a>
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boucleEssai>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%r15
mov    $0xa,%ebx
lea    0xead(%rip),%r13
test   %ebx,%ebx
jle    11e4 <boucleEssai+0x94>
lea    0xe85(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl %r12b,%edi
call   1060 <lireCaractere@plt>
mov    %eax,%r12d
movsbl %al,%edi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %r14d,%ecx
call   1070 <comparer@plt>
cmp    $0x1,%rax
sbb    $0x0,%ebx
mov    %rbp,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1170 <boucleEssai+0x20>
lea    0xe6f(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
jmp    11f5 <boucleEssai+0xa5>
lea    0xe67(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Vous avez encore %d essai !\0A\00"
@.str.1 = [30 x i8] c"Quel est le mot secret ? %s \0A\00"
@.str.2 = [23 x i8] c"Le mot secret est %s \0A\00"
@.str.3 = [40 x i8] c"Bravo vous avez trouve le mot secret !\0A\00"
@.str.4 = [75 x i8] c"Vous n'avez pas reussi a trouve le mot secret ... \0ALa reponse etait : %s \0A\00"
define i32 @boucleEssai(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 10, i32* %9
br label %11
11: ; preds = %39, %3
%12 = load i32, i32* %9
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %40
14: ; preds = %11
%15 = load i32, i32* %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8, i8* %10
%20 = call signext i8 @lireCaractere(i8 signext %19)
store i8 %20, i8* %10
%21 = load i8, i8* %10
%22 = load i8*, i8** %5
%23 = load i8*, i8** %6
%24 = load i32, i32* %7
%25 = call i64 @comparer(i8 signext %21, i8* %22, i8* %23, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %14
%28 = load i32, i32* %9
%29 = add nsw i32 %28, -1
store i32 %29, i32* %9
br label %30
30: ; preds = %27, %14
%31 = load i8*, i8** %6
%32 = load i8*, i8** %5
%33 = call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %30
%36 = load i8*, i8** %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %43
39: ; preds = %30
br label %11
40: ; preds = %11
%41 = load i8*, i8** %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0), i8* %41)
store i32 0, i32* %4
br label %43
43: ; preds = %40, %35
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
@.str = [29 x i8] c"Vous avez encore %d essai !\0A\00"
@.str.1 = [30 x i8] c"Quel est le mot secret ? %s \0A\00"
@.str.2 = [23 x i8] c"Le mot secret est %s \0A\00"
@.str.4 = [75 x i8] c"Vous n'avez pas reussi a trouve le mot secret ... \0ALa reponse etait : %s \0A\00"
@str = [39 x i8] c"Bravo vous avez trouve le mot secret !\00"
define i32 @boucleEssai(i8* %0, i8* %1, i32 %2) {
br label %4
4: ; preds = %8, %3
%5 = phi i32 [ 10, %3 ], [ %15, %8 ]
%6 = phi i8 [ undef, %3 ], [ %11, %8 ]
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%11 = tail call signext i8 @lireCaractere(i8 signext %6)
%12 = tail call i64 @comparer(i8 signext %11, i8* %0, i8* %1, i32 %2)
%13 = icmp eq i64 %12, 0
%14 = sext i1 %13 to i32
%15 = add nsw i32 %5, %14
%16 = tail call i64 @strcmp(i8* %1, i8* %0)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %8
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %23
21: ; preds = %4
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %23
23: ; preds = %21, %18
ret i32 0
}