#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int);
int /*<<< orphan*/ printf(char *);
void nettoyageScore(char pseudo[100][4], int score[100], int maxi) {
  int i = 0;
  FILE *fichier = NULL;
  fichier = fopen("score.txt", "w+");
  if (fichier != NULL) {
    for (i = maxi - 1; i > maxi - 11; i--) {
      fprintf(fichier, "%s %d\n", pseudo[i], score[i]);
    }
    fclose(fichier);
  } else {
    printf(
        "Erreur lors de l'ouverture/suppression du contenu du fichier score\n");
  }
}


x86 assembly (clang, -O0):
<nettoyageScore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11e4 <nettoyageScore+0xa4>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0xb,%ecx
cmp    %ecx,%eax
jle    11d6 <nettoyageScore+0x96>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe4a(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    118d <nettoyageScore+0x4d>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11f0 <nettoyageScore+0xb0>
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nettoyageScore>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xea6(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11c6 <nettoyageScore+0x86>
mov    %rax,%r15
movslq %ebp,%rbp
lea    -0x9(%rbp),%eax
movslq %eax,%r13
lea    (%rbx,%rbp,4),%rbx
add    $0xfffffffffffffffc,%rbx
add    $0x1,%rbp
lea    0xe83(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    -0x8(%r14,%rbp,4),%ecx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
add    $0xffffffffffffffff,%rbp
add    $0xfffffffffffffffc,%rbx
cmp    %r13,%rbp
jg     1190 <nettoyageScore+0x50>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fclose@plt>
lea    0xe47(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"score.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [7 x i8] c"%s %d\0A\00"
@.str.3 = [68 x i8] c"Erreur lors de l'ouverture/suppression du contenu du fichier score\0A\00"
define void @nettoyageScore([4 x i8]* %0, i32* %1, i32 %2) {
%4 = alloca [4 x i8]*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store [4 x i8]* %0, [4 x i8]** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32* null, i32** %8
%9 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %8
%10 = load i32*, i32** %8
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %39
12: ; preds = %3
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %7
br label %15
15: ; preds = %33, %12
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 11
%19 = icmp sgt i32 %16, %18
br i1 %19, label %20, label %36
20: ; preds = %15
%21 = load i32*, i32** %8
%22 = load [4 x i8]*, [4 x i8]** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %22, i64 %24
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %25, i64 0, i64 0
%27 = load i32*, i32** %5
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %26, i32 %31)
br label %33
33: ; preds = %20
%34 = load i32, i32* %7
%35 = add nsw i32 %34, -1
store i32 %35, i32* %7
br label %15
36: ; preds = %15
%37 = load i32*, i32** %8
%38 = call i32 @fclose(i32* %37)
br label %41
39: ; preds = %3
%40 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"score.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [7 x i8] c"%s %d\0A\00"
@str = [67 x i8] c"Erreur lors de l'ouverture/suppression du contenu du fichier score\00"
define void @nettoyageScore([4 x i8]* %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %20, label %6
6: ; preds = %3
%7 = sext i32 %2 to i64
%8 = add nsw i32 %2, -9
%9 = sext i32 %8 to i64
br label %10
10: ; preds = %6, %10
%11 = phi i64 [ %7, %6 ], [ %12, %10 ]
%12 = add nsw i64 %11, -1
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 %12, i64 0
%14 = getelementptr inbounds i32, i32* %1, i64 %12
%15 = load i32, i32* %14
%16 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %13, i32 %15)
%17 = icmp sgt i64 %11, %9
br i1 %17, label %10, label %18
18: ; preds = %10
%19 = tail call i32 @fclose(i32* %4)
br label %22
20: ; preds = %3
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
ret void
}