#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*/ afficherMorpion();
int /*<<< orphan*/ coloration(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ systemePoints(int, int, int);
void afficherGagnantMorpionSolo(int gagnant, int nbCoups, int modeDeJeux,
                                int niveauDifficulte) {
  int nbPointsGagnes, nbPointsVIP;
  nbPointsGagnes = nbPointsVIP = 0;
  printf("\n");
  switch (gagnant) {
  case 0:
    system("clear");
    afficherMorpion();
    printf("\nMatch nul !\n");
    nbPointsGagnes = 5;
    break;
  case 1:
    coloration("Dommage ! Vous avez perdu.\n", "31");
    break;
  case 2:
    coloration("Bravo ! Vous avez gagne.\n", "32");
    nbPointsGagnes = 20;
    if (nbCoups <= 4 && niveauDifficulte == 3)
      nbPointsVIP = 1;
    break;
  }
  nbPointsGagnes *= niveauDifficulte;
  systemePoints(nbPointsGagnes, nbPointsVIP, modeDeJeux);
}


x86 assembly (clang, -O0):
<afficherGagnantMorpionSolo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     11b3 <afficherGagnantMorpionSolo+0x63>
jmp    1191 <afficherGagnantMorpionSolo+0x41>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     11de <afficherGagnantMorpionSolo+0x8e>
jmp    11a2 <afficherGagnantMorpionSolo+0x52>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     11f6 <afficherGagnantMorpionSolo+0xa6>
jmp    1230 <afficherGagnantMorpionSolo+0xe0>
lea    0xe46(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1030 <afficherMorpion@plt>
lea    0xe39(%rip),%rdi
call   1050 <printf@plt>
movl   $0x5,-0x14(%rbp)
jmp    1230 <afficherGagnantMorpionSolo+0xe0>
lea    0xe2f(%rip),%rdi
lea    0xe44(%rip),%rsi
call   1060 <coloration@plt>
jmp    1230 <afficherGagnantMorpionSolo+0xe0>
lea    0xe36(%rip),%rdi
lea    0xe49(%rip),%rsi
call   1060 <coloration@plt>
movl   $0x14,-0x14(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     122b <afficherGagnantMorpionSolo+0xdb>
cmpl   $0x3,-0x10(%rbp)
jne    122b <afficherGagnantMorpionSolo+0xdb>
movl   $0x1,-0x18(%rbp)
jmp    1230 <afficherGagnantMorpionSolo+0xe0>
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1070 <systemePoints@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficherGagnantMorpionSolo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebp
je     11bb <afficherGagnantMorpionSolo+0x5b>
xor    %ebx,%ebx
cmp    $0x1,%ebp
je     11e8 <afficherGagnantMorpionSolo+0x88>
mov    $0x0,%r12d
test   %ebp,%ebp
jne    11fe <afficherGagnantMorpionSolo+0x9e>
lea    0xe67(%rip),%rdi
call   1060 <system@plt>
xor    %r12d,%r12d
xor    %eax,%eax
call   1050 <afficherMorpion@plt>
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%ebx
jmp    11fe <afficherGagnantMorpionSolo+0x9e>
lea    0xe63(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1070 <coloration@plt>
cmp    $0x5,%ebx
setl   %al
cmp    $0x3,%r15d
sete   %cl
and    %al,%cl
movzbl %cl,%r12d
mov    $0x14,%ebx
jmp    11fe <afficherGagnantMorpionSolo+0x9e>
lea    0xe17(%rip),%rdi
lea    0xe2c(%rip),%rsi
call   1070 <coloration@plt>
xor    %r12d,%r12d
imul   %r15d,%ebx
mov    %ebx,%edi
mov    %r12d,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <systemePoints@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [6 x i8] c"clear\00"
@.str.2 = [14 x i8] c"\0AMatch nul !\0A\00"
@.str.3 = [28 x i8] c"Dommage ! Vous avez perdu.\0A\00"
@.str.4 = [3 x i8] c"31\00"
@.str.5 = [26 x i8] c"Bravo ! Vous avez gagne.\0A\00"
@.str.6 = [3 x i8] c"32\00"
define void @afficherGagnantMorpionSolo(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %10
store i32 0, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %5
switch i32 %12, label %28 [
i32 0, label %13
i32 1, label %17
i32 2, label %19
]
13: ; preds = %4
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (...) @afficherMorpion()
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 5, i32* %9
br label %28
17: ; preds = %4
%18 = call i32 @coloration(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %28
19: ; preds = %4
%20 = call i32 @coloration(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32 20, i32* %9
%21 = load i32, i32* %6
%22 = icmp sle i32 %21, 4
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i32, i32* %8
%25 = icmp eq i32 %24, 3
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 1, i32* %10
br label %27
27: ; preds = %26, %23, %19
br label %28
28: ; preds = %4, %27, %17, %13
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = mul nsw i32 %30, %29
store i32 %31, i32* %9
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = load i32, i32* %7
%35 = call i32 @systemePoints(i32 %32, i32 %33, i32 %34)
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"clear\00"
@.str.3 = [28 x i8] c"Dommage ! Vous avez perdu.\0A\00"
@.str.4 = [3 x i8] c"31\00"
@.str.5 = [26 x i8] c"Bravo ! Vous avez gagne.\0A\00"
@.str.6 = [3 x i8] c"32\00"
@str = [13 x i8] c"\0AMatch nul !\00"
define void @afficherGagnantMorpionSolo(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @putchar(i32 10)
switch i32 %0, label %18 [
i32 0, label %6
i32 1, label %10
i32 2, label %12
]
6: ; preds = %4
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @afficherMorpion()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %18
10: ; preds = %4
%11 = tail call i32 @coloration(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %18
12: ; preds = %4
%13 = tail call i32 @coloration(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%14 = icmp slt i32 %1, 5
%15 = icmp eq i32 %3, 3
%16 = and i1 %14, %15
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %12, %4, %10, %6
%19 = phi i32 [ 0, %4 ], [ 0, %10 ], [ 5, %6 ], [ 20, %12 ]
%20 = phi i32 [ 0, %4 ], [ 0, %10 ], [ 0, %6 ], [ %17, %12 ]
%21 = mul nsw i32 %19, %3
%22 = tail call i32 @systemePoints(i32 %21, i32 %20, i32 %2)
ret void
}