#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*/ appuyezEntree(char *);
int choisirDifficulte();
int /*<<< orphan*/ coloration(char *, char *);
int /*<<< orphan*/ lireEtAfficherFichier(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ titre(char *);
void menuMorpion(int modeDeJeux, int *niveauDifficulte) {
  int choixDifficulte;
  titre("Morpion");
  if (modeDeJeux == 0)
    lireEtAfficherFichier("Texte de presentation/Morpion/morpionSolo.txt");
  else if (modeDeJeux == 1)
    lireEtAfficherFichier("Texte de presentation/Morpion/morpionMulti.txt");
  printf("\n\n");
  printf("1 2 3\n");
  printf("4 5 6\n");
  printf("7 8 9\n\n");
  if (modeDeJeux == 0)
    printf("Vous = '");
  else if (modeDeJeux == 1)
    printf("Joueur 1 = '");
  coloration("O", "31");
  if (modeDeJeux == 0)
    printf("'\nOrdinateur = '");
  else if (modeDeJeux == 1)
    printf("'\nJoueur 2 = '");
  coloration("X", "34");
  printf("'\n\n");
  appuyezEntree("Appuyez sur ENTREE pour commencer : ");
  if (modeDeJeux == 0) {
    choixDifficulte = choisirDifficulte();
    *niveauDifficulte = choixDifficulte;
  }
}


x86 assembly (clang, -O0):
<menuMorpion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe8a(%rip),%rdi
call   1070 <titre@plt>
cmpl   $0x0,-0x4(%rbp)
jne    1196 <menuMorpion+0x36>
lea    0xe7c(%rip),%rdi
call   1030 <lireEtAfficherFichier@plt>
jmp    11b1 <menuMorpion+0x51>
cmpl   $0x1,-0x4(%rbp)
jne    11ac <menuMorpion+0x4c>
lea    0xe8f(%rip),%rdi
call   1030 <lireEtAfficherFichier@plt>
jmp    11b1 <menuMorpion+0x51>
lea    0xf04(%rip),%rdi
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11fc <menuMorpion+0x9c>
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
jmp    1217 <menuMorpion+0xb7>
cmpl   $0x1,-0x4(%rbp)
jne    1212 <menuMorpion+0xb2>
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
jmp    1217 <menuMorpion+0xb7>
lea    0xe73(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1060 <coloration@plt>
cmpl   $0x0,-0x4(%rbp)
jne    1245 <menuMorpion+0xe5>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
jmp    1260 <menuMorpion+0x100>
cmpl   $0x1,-0x4(%rbp)
jne    125b <menuMorpion+0xfb>
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
jmp    1260 <menuMorpion+0x100>
lea    0xe4f(%rip),%rdi
lea    0xe4a(%rip),%rsi
call   1060 <coloration@plt>
lea    0xe41(%rip),%rdi
call   1050 <printf@plt>
lea    0xe39(%rip),%rdi
call   1080 <appuyezEntree@plt>
cmpl   $0x0,-0x4(%rbp)
jne    12a8 <menuMorpion+0x148>
mov    $0x0,%al
call   1040 <choisirDifficulte@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuMorpion>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe81(%rip),%rdi
call   1080 <titre@plt>
test   %ebp,%ebp
je     1196 <menuMorpion+0x26>
cmp    $0x1,%ebp
jne    11a2 <menuMorpion+0x32>
lea    0xea2(%rip),%rdi
jmp    119d <menuMorpion+0x2d>
lea    0xe6b(%rip),%rdi
call   1030 <lireEtAfficherFichier@plt>
lea    0xf35(%rip),%rdi
call   1050 <puts@plt>
lea    0xf15(%rip),%rdi
call   1050 <puts@plt>
lea    0xf0f(%rip),%rdi
call   1050 <puts@plt>
lea    0xf09(%rip),%rdi
call   1050 <puts@plt>
test   %ebp,%ebp
je     1203 <menuMorpion+0x93>
cmp    $0x1,%ebp
jne    1230 <menuMorpion+0xc0>
lea    0xe8c(%rip),%rdi
call   1060 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1070 <coloration@plt>
lea    0xe90(%rip),%rdi
jmp    1229 <menuMorpion+0xb9>
lea    0xe5b(%rip),%rdi
call   1060 <printf@plt>
lea    0xe65(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1070 <coloration@plt>
lea    0xe57(%rip),%rdi
call   1060 <printf@plt>
jmp    1243 <menuMorpion+0xd3>
lea    0xe44(%rip),%rdi
lea    0xe3f(%rip),%rsi
call   1070 <coloration@plt>
lea    0xe56(%rip),%rdi
lea    0xe51(%rip),%rsi
call   1070 <coloration@plt>
lea    0xe80(%rip),%rdi
call   1050 <puts@plt>
lea    0xe3c(%rip),%rdi
call   1090 <appuyezEntree@plt>
test   %ebp,%ebp
jne    127b <menuMorpion+0x10b>
xor    %eax,%eax
call   1040 <choisirDifficulte@plt>
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Morpion\00"
@.str.1 = [46 x i8] c"Texte de presentation/Morpion/morpionSolo.txt\00"
@.str.2 = [47 x i8] c"Texte de presentation/Morpion/morpionMulti.txt\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [7 x i8] c"1 2 3\0A\00"
@.str.5 = [7 x i8] c"4 5 6\0A\00"
@.str.6 = [8 x i8] c"7 8 9\0A\0A\00"
@.str.7 = [9 x i8] c"Vous = '\00"
@.str.8 = [13 x i8] c"Joueur 1 = '\00"
@.str.9 = [2 x i8] c"O\00"
@.str.10 = [3 x i8] c"31\00"
@.str.11 = [17 x i8] c"'\0AOrdinateur = '\00"
@.str.12 = [15 x i8] c"'\0AJoueur 2 = '\00"
@.str.13 = [2 x i8] c"X\00"
@.str.14 = [3 x i8] c"34\00"
@.str.15 = [4 x i8] c"'\0A\0A\00"
@.str.16 = [37 x i8] c"Appuyez sur ENTREE pour commencer : \00"
define void @menuMorpion(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = call i32 @titre(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @lireEtAfficherFichier(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %17
11: ; preds = %2
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @lireEtAfficherFichier(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
br label %17
17: ; preds = %16, %9
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %17
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %32
26: ; preds = %17
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
br label %32
32: ; preds = %31, %24
%33 = call i32 @coloration(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %44
38: ; preds = %32
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
br label %44
44: ; preds = %43, %36
%45 = call i32 @coloration(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%47 = call i32 @appuyezEntree(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.16, i64 0, i64 0))
%48 = load i32, i32* %3
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %44
%51 = call i32 (...) @choisirDifficulte()
store i32 %51, i32* %5
%52 = load i32, i32* %5
%53 = load i32*, i32** %4
store i32 %52, i32* %53
br label %54
54: ; preds = %50, %44
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Morpion\00"
@.str.1 = [46 x i8] c"Texte de presentation/Morpion/morpionSolo.txt\00"
@.str.2 = [47 x i8] c"Texte de presentation/Morpion/morpionMulti.txt\00"
@.str.7 = [9 x i8] c"Vous = '\00"
@.str.8 = [13 x i8] c"Joueur 1 = '\00"
@.str.9 = [2 x i8] c"O\00"
@.str.10 = [3 x i8] c"31\00"
@.str.11 = [17 x i8] c"'\0AOrdinateur = '\00"
@.str.12 = [15 x i8] c"'\0AJoueur 2 = '\00"
@.str.13 = [2 x i8] c"X\00"
@.str.14 = [3 x i8] c"34\00"
@.str.16 = [37 x i8] c"Appuyez sur ENTREE pour commencer : \00"
@str = [2 x i8] c"\0A\00"
@str.17 = [6 x i8] c"1 2 3\00"
@str.18 = [6 x i8] c"4 5 6\00"
@str.19 = [7 x i8] c"7 8 9\0A\00"
@str.20 = [3 x i8] c"'\0A\00"
define void @menuMorpion(i32 %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @titre(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = icmp eq i32 %0, 1
br i1 %6, label %7, label %10
7: ; preds = %5, %2
%8 = phi i8* [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), %5 ]
%9 = tail call i32 @lireEtAfficherFichier(i8* %8)
br label %10
10: ; preds = %7, %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.17, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.18, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.19, i64 0, i64 0))
br i1 %4, label %17, label %15
15: ; preds = %10
%16 = icmp eq i32 %0, 1
br i1 %16, label %23, label %21
17: ; preds = %10
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%19 = tail call i32 @coloration(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %27
21: ; preds = %15
%22 = tail call i32 @coloration(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %27
23: ; preds = %15
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%25 = tail call i32 @coloration(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
br label %27
27: ; preds = %21, %23, %17
%28 = tail call i32 @coloration(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.20, i64 0, i64 0))
%30 = tail call i32 @appuyezEntree(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.16, i64 0, i64 0))
br i1 %4, label %31, label %33
31: ; preds = %27
%32 = tail call i32 (...) @choisirDifficulte()
store i32 %32, i32* %1
br label %33
33: ; preds = %31, %27
ret void
}