#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int EXIT_FAILURE;
int /*<<< orphan*/ boucleEssai(char *, char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ supprEnter(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int modeSolo(char motSecret[], int tailleMotSecret) {
  FILE *dico = NULL;
  int caractereCourant, ligneRandom, i;
  srand(time(NULL));
  int nbLignes = 0;
  dico = fopen("dico.txt", "r");
  if (dico != NULL) {
    do {
      caractereCourant = fgetc(dico);
      if (caractereCourant == '\n')
        nbLignes++;
    } while (caractereCourant != EOF);
    rewind(dico);
    ligneRandom = (rand() % nbLignes - 1) + 1;
    for (i = 0; i != ligneRandom; i++) {
      fgets(motSecret, 30, dico);
    }
  } else {
    printf("Erreur lors du l'ouverture du fichier dico.txt");
    return EXIT_FAILURE;
  }
  fclose(dico);
  supprEnter(motSecret);
  tailleMotSecret = strlen(motSecret);
  char motEssai[30] = "******************************";
  motEssai[tailleMotSecret] = '\0';
  boucleEssai(motSecret, motEssai, tailleMotSecret);
}


x86 assembly (clang, -O0):
<modeSolo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
movl   $0x0,-0x30(%rbp)
lea    0xe33(%rip),%rdi
lea    0xe04(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     12a2 <modeSolo+0xe2>
jmp    1215 <modeSolo+0x55>
mov    -0x20(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
jne    1234 <modeSolo+0x74>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1239 <modeSolo+0x79>
mov    -0x24(%rbp),%eax
mov    0x2da5(%rip),%rcx
cmp    (%rcx),%eax
jne    1215 <modeSolo+0x55>
mov    -0x20(%rbp),%rdi
call   1060 <rewind@plt>
mov    $0x0,%al
call   10e0 <rand@plt>
cltd
idivl  -0x30(%rbp)
mov    %edx,%eax
sub    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     129d <modeSolo+0xdd>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x1e,%esi
call   1090 <fgets@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1271 <modeSolo+0xb1>
jmp    12bf <modeSolo+0xff>
lea    0xd59(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    132b <modeSolo+0x16b>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <supprEnter@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    0xd5c(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xd59(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xd56(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xd54(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xd4e(%rip),%ax
mov    %ax,-0x34(%rbp)
movslq -0x14(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   10d0 <boucleEssai@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modeSolo>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
xor    %ebp,%ebp
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
lea    0xe54(%rip),%rdi
lea    0xe25(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1291 <modeSolo+0xd1>
mov    %rax,%rbx
mov    0x2de5(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1070 <fgetc@plt>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebp
cmp    (%r15),%eax
jne    1210 <modeSolo+0x50>
mov    %rbx,%rdi
call   1060 <rewind@plt>
xor    %eax,%eax
call   10e0 <rand@plt>
cltd
idiv   %ebp
test   %edx,%edx
je     1255 <modeSolo+0x95>
mov    %edx,%ebp
nop
mov    %r14,%rdi
mov    $0x1e,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
add    $0xffffffff,%ebp
jne    1240 <modeSolo+0x80>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   10b0 <supprEnter@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
movaps 0xd8c(%rip),%xmm0
movups %xmm0,0xe(%rsp)
movaps %xmm0,(%rsp)
movslq %eax,%rdx
movb   $0x0,(%rsp,%rdx,1)
mov    %rsp,%rsi
mov    %r14,%rdi
call   10d0 <boucleEssai@plt>
jmp    12a6 <modeSolo+0xe6>
lea    0xd7a(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d34(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"dico.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [47 x i8] c"Erreur lors du l'ouverture du fichier dico.txt\00"
@EXIT_FAILURE = global i32 0
@__const.modeSolo.motEssai = [30 x i8] c"******************************"
define i32 @modeSolo(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [30 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* null, i32** %6
%12 = call i32 @time(i32* null)
%13 = call i32 @srand(i32 %12)
store i32 0, i32* %10
%14 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %6
%15 = load i32*, i32** %6
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %51
17: ; preds = %2
br label %18
18: ; preds = %27, %17
%19 = load i32*, i32** %6
%20 = call i32 @fgetc(i32* %19)
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* %10
%25 = add nsw i32 %24, 1
store i32 %25, i32* %10
br label %26
26: ; preds = %23, %18
br label %27
27: ; preds = %26
%28 = load i32, i32* %7
%29 = load i32, i32* @EOF
%30 = icmp ne i32 %28, %29
br i1 %30, label %18, label %31
31: ; preds = %27
%32 = load i32*, i32** %6
%33 = call i32 @rewind(i32* %32)
%34 = call i32 (...) @rand()
%35 = load i32, i32* %10
%36 = srem i32 %34, %35
%37 = sub nsw i32 %36, 1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
store i32 0, i32* %9
br label %39
39: ; preds = %47, %31
%40 = load i32, i32* %9
%41 = load i32, i32* %8
%42 = icmp ne i32 %40, %41
br i1 %42, label %43, label %50
43: ; preds = %39
%44 = load i8*, i8** %4
%45 = load i32*, i32** %6
%46 = call i32 @fgets(i8* %44, i32 30, i32* %45)
br label %47
47: ; preds = %43
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %39
50: ; preds = %39
br label %54
51: ; preds = %2
%52 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
store i32 %53, i32* %3
br label %69
54: ; preds = %50
%55 = load i32*, i32** %6
%56 = call i32 @fclose(i32* %55)
%57 = load i8*, i8** %4
%58 = call i32 @supprEnter(i8* %57)
%59 = load i8*, i8** %4
%60 = call i32 @strlen(i8* %59)
store i32 %60, i32* %5
%61 = bitcast [30 x i8]* %11 to i8*
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 %63
store i8 0, i8* %64
%65 = load i8*, i8** %4
%66 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%67 = load i32, i32* %5
%68 = call i32 @boucleEssai(i8* %65, i8* %66, i32 %67)
br label %69
69: ; preds = %54, %51
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
@.str = [9 x i8] c"dico.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [47 x i8] c"Erreur lors du l'ouverture du fichier dico.txt\00"
@EXIT_FAILURE = global i32 0
define i32 @modeSolo(i8* %0, i32 %1) {
%3 = alloca [30 x i8]
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %26, label %8
8: ; preds = %2, %8
%9 = phi i32 [ %13, %8 ], [ 0, %2 ]
%10 = tail call i32 @fgetc(i32* %6)
%11 = icmp eq i32 %10, 10
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %9, %12
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %10, %14
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = tail call i32 @rewind(i32* %6)
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, %13
%20 = icmp eq i32 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %16, %21
%22 = phi i32 [ %24, %21 ], [ 0, %16 ]
%23 = tail call i32 @fgets(i8* %0, i32 30, i32* %6)
%24 = add nuw nsw i32 %22, 1
%25 = icmp eq i32 %24, %19
br i1 %25, label %29, label %21
26: ; preds = %2
%27 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
br label %37
29: ; preds = %21, %16
%30 = tail call i32 @fclose(i32* %6)
%31 = tail call i32 @supprEnter(i8* %0)
%32 = tail call i32 @strlen(i8* %0)
%33 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %34
store i8 0, i8* %35
%36 = call i32 @boucleEssai(i8* %0, i8* %33, i32 %32)
br label %37
37: ; preds = %29, %26
%38 = phi i32 [ undef, %29 ], [ %28, %26 ]
ret i32 %38
}