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


x86 assembly (clang, -O0):
<afficherGagnantPuissance4Solo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xee0(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <gagnerPuissance4@plt>
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     1230 <afficherGagnantPuissance4Solo+0xd0>
mov    -0x20(%rbp),%rax
lea    0xe51(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe59(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1070 <coloration@plt>
jmp    1230 <afficherGagnantPuissance4Solo+0xd0>
lea    0xe60(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1070 <coloration@plt>
movl   $0x19,-0x10(%rbp)
cmpl   $0x8,-0x4(%rbp)
jg     1205 <afficherGagnantPuissance4Solo+0xa5>
cmpl   $0x3,-0xc(%rbp)
jne    1205 <afficherGagnantPuissance4Solo+0xa5>
movl   $0x1,-0x14(%rbp)
jmp    1230 <afficherGagnantPuissance4Solo+0xd0>
lea    0xe43(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1030 <afficherPuissance4@plt>
lea    0xe36(%rip),%rdi
call   1050 <printf@plt>
movl   $0x5,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1080 <systemePoints@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficherGagnantPuissance4Solo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%r12d
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1070 <gagnerPuissance4@plt>
xor    %ebx,%ebx
cmp    $0x5,%eax
ja     11c3 <afficherGagnantPuissance4Solo+0x53>
mov    %eax,%eax
lea    0xe5b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
xor    %ebp,%ebp
jmp    *%rax
lea    0xe61(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1080 <coloration@plt>
xor    %ebp,%ebp
jmp    121a <afficherGagnantPuissance4Solo+0xaa>
lea    0xe86(%rip),%rdi
call   1060 <system@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <afficherPuissance4@plt>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%ebx
jmp    121a <afficherGagnantPuissance4Solo+0xaa>
lea    0xe41(%rip),%rdi
lea    0xe54(%rip),%rsi
call   1080 <coloration@plt>
cmp    $0x9,%r12d
setl   %al
cmp    $0x3,%r15d
sete   %cl
and    %al,%cl
movzbl %cl,%ebp
mov    $0x19,%ebx
imul   %r15d,%ebx
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <systemePoints@plt>

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

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