#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__ EXIT_FAILURE;
char lireCaractere(char);
int /*<<< orphan*/ modeMulti(char *, int);
scalar_t__ modeSolo(char *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  char modeJeu;
  char play;
  char motSecret[30];
  int tailleMotSecret;
  do {
    tailleMotSecret = 0;
    modeJeu = 0;
    printf("Bienvenue dans le jeu du pendu !\n");
    printf("------------------------------------------------\n");
    printf("Voulez vous jouer en mode solo ou 2 joueurs ? (1/2) \n");
    while (modeJeu != '1' && modeJeu != '2') {
      printf("Veuillez entrer 1 ou 2. \n");
      modeJeu = lireCaractere(modeJeu);
    }
    if (modeJeu == '1') {
      if (modeSolo(motSecret, tailleMotSecret) == EXIT_FAILURE)
        return EXIT_FAILURE;
    } else if (modeJeu == '2')
      modeMulti(motSecret, tailleMotSecret);
    else
      printf("Veuillez entrez 1 ou 2\n");
    printf("Voulez vous rejouer ? (O/N)\n");
    play = lireCaractere(play);
  } while (play == 'O');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movb   $0x0,-0x5(%rbp)
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x31,%ecx
mov    %al,-0x35(%rbp)
je     119d <main+0x5d>
movsbl -0x5(%rbp),%eax
cmp    $0x32,%eax
setne  %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    11ad <main+0x6d>
jmp    11ca <main+0x8a>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1040 <lireCaractere@plt>
mov    %al,-0x5(%rbp)
jmp    117e <main+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x31,%eax
jne    120a <main+0xca>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <modeSolo@plt>
mov    0x2df6(%rip),%rcx
cmp    (%rcx),%rax
jne    1205 <main+0xc5>
mov    0x2de6(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    1265 <main+0x125>
jmp    1239 <main+0xf9>
movsbl -0x5(%rbp),%eax
cmp    $0x32,%eax
jne    1228 <main+0xe8>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1060 <modeMulti@plt>
jmp    1234 <main+0xf4>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
jmp    1239 <main+0xf9>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x6(%rbp),%edi
call   1040 <lireCaractere@plt>
mov    %al,-0x6(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x4f,%eax
je     114f <main+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%r14
lea    0xec5(%rip),%r15
lea    0xeef(%rip),%r12
lea    0xf50(%rip),%rbx
lea    0xf2d(%rip),%rbp
jmp    11a2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    $0x4f,%edi
call   1040 <lireCaractere@plt>
cmp    $0x4f,%al
jne    120c <main+0xcc>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
xor    %r13d,%r13d
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
movsbl %r13b,%edi
call   1040 <lireCaractere@plt>
mov    %eax,%r13d
lea    -0x33(%r13),%eax
cmp    $0xfe,%al
jb     11c0 <main+0x80>
cmp    $0x32,%r13b
je     1200 <main+0xc0>
cmp    $0x31,%r13b
jne    1180 <main+0x40>
mov    %rsp,%rdi
xor    %esi,%esi
call   1050 <modeSolo@plt>
mov    0x2de7(%rip),%rcx
cmp    (%rcx),%rax
jne    118c <main+0x4c>
jmp    120e <main+0xce>
mov    %rsp,%rdi
xor    %esi,%esi
call   1060 <modeMulti@plt>
jmp    118c <main+0x4c>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Bienvenue dans le jeu du pendu !\0A\00"
@.str.1 = [50 x i8] c"------------------------------------------------\0A\00"
@.str.2 = [54 x i8] c"Voulez vous jouer en mode solo ou 2 joueurs ? (1/2) \0A\00"
@.str.3 = [26 x i8] c"Veuillez entrer 1 ou 2. \0A\00"
@EXIT_FAILURE = global i64 0
@.str.4 = [24 x i8] c"Veuillez entrez 1 ou 2\0A\00"
@.str.5 = [29 x i8] c"Voulez vous rejouer ? (O/N)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca [30 x i8]
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %53, %0
store i32 0, i32* %5
store i8 0, i8* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %20, %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 49
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 50
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%22 = load i8, i8* %2
%23 = call signext i8 @lireCaractere(i8 signext %22)
store i8 %23, i8* %2
br label %10
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 49
br i1 %27, label %28, label %38
28: ; preds = %24
%29 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%30 = load i32, i32* %5
%31 = call i64 @modeSolo(i8* %29, i32 %30)
%32 = load i64, i64* @EXIT_FAILURE
%33 = icmp eq i64 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = load i64, i64* @EXIT_FAILURE
%36 = trunc i64 %35 to i32
store i32 %36, i32* %1
br label %58
37: ; preds = %28
br label %49
38: ; preds = %24
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 50
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%44 = load i32, i32* %5
%45 = call i32 @modeMulti(i8* %43, i32 %44)
br label %48
46: ; preds = %38
%47 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %46, %42
br label %49
49: ; preds = %48, %37
%50 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%51 = load i8, i8* %3
%52 = call signext i8 @lireCaractere(i8 signext %51)
store i8 %52, i8* %3
br label %53
53: ; preds = %49
%54 = load i8, i8* %3
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 79
br i1 %56, label %6, label %57
57: ; preds = %53
store i32 0, i32* %1
br label %58
58: ; preds = %57, %34
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@EXIT_FAILURE = global i64 0
@str = [33 x i8] c"Bienvenue dans le jeu du pendu !\00"
@str.6 = [49 x i8] c"------------------------------------------------\00"
@str.7 = [53 x i8] c"Voulez vous jouer en mode solo ou 2 joueurs ? (1/2) \00"
@str.8 = [23 x i8] c"Veuillez entrez 1 ou 2\00"
@str.9 = [28 x i8] c"Voulez vous rejouer ? (O/N)\00"
@str.10 = [25 x i8] c"Veuillez entrer 1 ou 2. \00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %24, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.6, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.7, i64 0, i64 0))
br label %7
7: ; preds = %3, %7
%8 = phi i8 [ 0, %3 ], [ %10, %7 ]
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%10 = call signext i8 @lireCaractere(i8 signext %8)
%11 = add i8 %10, -51
%12 = icmp ult i8 %11, -2
br i1 %12, label %7, label %13
13: ; preds = %7
switch i8 %10, label %22 [
i8 49, label %14
i8 50, label %20
]
14: ; preds = %13
%15 = call i64 @modeSolo(i8* %2, i32 0)
%16 = load i64, i64* @EXIT_FAILURE
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = trunc i64 %15 to i32
br label %28
20: ; preds = %13
%21 = call i32 @modeMulti(i8* %2, i32 0)
br label %24
22: ; preds = %13
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
br label %24
24: ; preds = %20, %22, %14
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.9, i64 0, i64 0))
%26 = call signext i8 @lireCaractere(i8 signext 79)
%27 = icmp eq i8 %26, 79
br i1 %27, label %3, label %28
28: ; preds = %24, %18
%29 = phi i32 [ %19, %18 ], [ 0, %24 ]
ret i32 %29
}