#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void a_scores() {
  FILE *fichier = NULL;
  char chaine[1000] = "";
  fichier = fopen("scores.txt", "r+");
  if (fichier != NULL) {
    while (fgets(chaine, 1000, fichier) != NULL) {
      printf("%s", chaine);
    }
    fclose(fichier);
  } else {
    printf("Aucuns Scores Enregistrés !");
  }
}


x86 assembly (clang, -O0):
<a_scores>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x3f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1050 <memset@plt>
lea    0xe83(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11e4 <a_scores+0x94>
jmp    119d <a_scores+0x4d>
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x3e8,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     11d6 <a_scores+0x86>
lea    -0x3f0(%rbp),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    119d <a_scores+0x4d>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11f2 <a_scores+0xa2>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_scores>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe8e(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11e7 <a_scores+0x97>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x3e8,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11d2 <a_scores+0x82>
lea    0xe6c(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    11b0 <a_scores+0x60>
mov    %r15,%rdi
call   1030 <fclose@plt>
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe23(%rip),%rdi
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"scores.txt\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [29 x i8] c"Aucuns Scores Enregistr\C3\A9s !\00"
define void @a_scores() {
%1 = alloca i32*
%2 = alloca [1000 x i8]
store i32* null, i32** %1
%3 = bitcast [1000 x i8]* %2 to i8*
%4 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %19
7: ; preds = %0
br label %8
8: ; preds = %13, %7
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%10 = load i32*, i32** %1
%11 = call i32* @fgets(i8* %9, i32 1000, i32* %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %8
16: ; preds = %8
%17 = load i32*, i32** %1
%18 = call i32 @fclose(i32* %17)
br label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"scores.txt\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [29 x i8] c"Aucuns Scores Enregistr\C3\A9s !\00"
define void @a_scores() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %14, label %5
5: ; preds = %0
%6 = call i32* @fgets(i8* %2, i32 1000, i32* %3)
%7 = icmp eq i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %5, %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%10 = call i32* @fgets(i8* %2, i32 1000, i32* %3)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %8
12: ; preds = %8, %5
%13 = call i32 @fclose(i32* %3)
br label %16
14: ; preds = %0
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret void
}