#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 *, ...);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int highAdd(char *pseudo, int fautes, int ok, char *time, char *mot) {
  FILE *high = NULL;
  high = fopen("high.paul", "a");
  float ratio = 0;
  int taillePseudo = 0;
  int i;
  char *espace = " ";
  if (high == NULL) {
    printf("pas de fichier highscore");
    return 0;
  }
  taillePseudo = strlen(pseudo);
  fprintf(high, "%s", pseudo);
  for (i = 0; i < (20 - taillePseudo); i++) {
    fprintf(high, "%s", espace);
  }
  fprintf(high, ",fautes : %d", fautes);
  if (fautes > 10) {
    fprintf(high, " ,");
  } else {
    fprintf(high, "   ,");
  }
  fprintf(high, "ok : %d", ok);
  if (ok > 10) {
    fprintf(high, ",");
  } else {
    fprintf(high, "   ,");
  }
  fprintf(high, "%s , %s\n", mot, time);
  fclose(high);
}


x86 assembly (clang, -O0):
<highAdd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe6d(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11c6 <highAdd+0x76>
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d9 <highAdd+0x189>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    $0x14,%ecx
sub    -0x38(%rbp),%ecx
cmp    %ecx,%eax
jge    1226 <highAdd+0xd6>
mov    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%rdx
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ef <highAdd+0x9f>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0xa,-0x14(%rbp)
jle    125c <highAdd+0x10c>
mov    -0x30(%rbp),%rdi
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    126e <highAdd+0x11e>
mov    -0x30(%rbp),%rdi
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xdc0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0xa,-0x18(%rbp)
jle    12a4 <highAdd+0x154>
mov    -0x30(%rbp),%rdi
lea    0xda2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12b6 <highAdd+0x166>
mov    -0x30(%rbp),%rdi
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<highAdd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%rbp
lea    0xe5f(%rip),%rdi
lea    0xe62(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     122a <highAdd+0xaa>
mov    %rax,%rbx
mov    %r15,(%rsp)
mov    %r14,%r15
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <fputs@plt>
cmp    $0x13,%r14d
jg     1202 <highAdd+0x82>
mov    $0x14,%eax
sub    %r14d,%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
mov    %rbx,%rsi
call   1070 <fputc@plt>
add    $0xffffffff,%ebp
jne    11f0 <highAdd+0x70>
lea    0xe1c(%rip),%rsi
mov    %rbx,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
cmp    $0xb,%r13d
jl     1238 <highAdd+0xb8>
lea    0xe11(%rip),%rdi
mov    $0x2,%esi
jmp    1244 <highAdd+0xc4>
lea    0xddb(%rip),%rdi
call   1050 <printf@plt>
jmp    12b6 <highAdd+0x136>
lea    0xdf3(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
lea    0xddf(%rip),%rsi
mov    %rbx,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
cmp    $0xb,%r12d
mov    (%rsp),%rbp
jl     127e <highAdd+0xfe>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1070 <fputc@plt>
jmp    1297 <highAdd+0x117>
lea    0xdad(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
lea    0xda1(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"high.paul\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [25 x i8] c"pas de fichier highscore\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [13 x i8] c",fautes : %d\00"
@.str.6 = [3 x i8] c" ,\00"
@.str.7 = [5 x i8] c" ,\00"
@.str.8 = [8 x i8] c"ok : %d\00"
@.str.9 = [2 x i8] c",\00"
@.str.10 = [9 x i8] c"%s , %s\0A\00"
define i32 @highAdd(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca float
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32* null, i32** %12
%17 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %12
store float 0.000000e+00, float* %13
store i32 0, i32* %14
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %16
%18 = load i32*, i32** %12
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %5
%21 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %71
22: ; preds = %5
%23 = load i8*, i8** %7
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %14
%25 = load i32*, i32** %12
%26 = load i8*, i8** %7
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %26)
store i32 0, i32* %15
br label %28
28: ; preds = %37, %22
%29 = load i32, i32* %15
%30 = load i32, i32* %14
%31 = sub nsw i32 20, %30
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %40
33: ; preds = %28
%34 = load i32*, i32** %12
%35 = load i8*, i8** %16
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %33
%38 = load i32, i32* %15
%39 = add nsw i32 %38, 1
store i32 %39, i32* %15
br label %28
40: ; preds = %28
%41 = load i32*, i32** %12
%42 = load i32, i32* %8
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %8
%45 = icmp sgt i32 %44, 10
br i1 %45, label %46, label %49
46: ; preds = %40
%47 = load i32*, i32** %12
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %52
49: ; preds = %40
%50 = load i32*, i32** %12
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %49, %46
%53 = load i32*, i32** %12
%54 = load i32, i32* %9
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %9
%57 = icmp sgt i32 %56, 10
br i1 %57, label %58, label %61
58: ; preds = %52
%59 = load i32*, i32** %12
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %64
61: ; preds = %52
%62 = load i32*, i32** %12
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %64
64: ; preds = %61, %58
%65 = load i32*, i32** %12
%66 = load i8*, i8** %11
%67 = load i8*, i8** %10
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %66, i8* %67)
%69 = load i32*, i32** %12
%70 = call i32 @fclose(i32* %69)
br label %71
71: ; preds = %64, %20
%72 = load i32, i32* %6
ret i32 %72
}

LLVM IR (-O2):
@.str = [10 x i8] c"high.paul\00"
@.str.1 = [2 x i8] c"a\00"
@.str.3 = [25 x i8] c"pas de fichier highscore\00"
@.str.5 = [13 x i8] c",fautes : %d\00"
@.str.6 = [3 x i8] c" ,\00"
@.str.7 = [5 x i8] c" ,\00"
@.str.8 = [8 x i8] c"ok : %d\00"
@.str.10 = [9 x i8] c"%s , %s\0A\00"
define i32 @highAdd(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %39
10: ; preds = %5
%11 = tail call i32 @strlen(i8* %0)
%12 = tail call i32 @fputs(i8* %0, i32* %6)
%13 = icmp slt i32 %11, 20
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = sub i32 20, %11
%16 = call i32 @llvm.smax.i32(i32 %15, i32 1)
br label %17
17: ; preds = %14, %17
%18 = phi i32 [ %20, %17 ], [ 0, %14 ]
%19 = tail call i32 @fputc(i32 32, i32* %6)
%20 = add nuw nsw i32 %18, 1
%21 = icmp eq i32 %20, %16
br i1 %21, label %22, label %17
22: ; preds = %17, %10
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %1)
%24 = icmp sgt i32 %1, 10
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %6)
br label %29
27: ; preds = %22
%28 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 4, i64 1, i32* %6)
br label %29
29: ; preds = %27, %25
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %2)
%31 = icmp sgt i32 %2, 10
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @fputc(i32 44, i32* %6)
br label %36
34: ; preds = %29
%35 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 4, i64 1, i32* %6)
br label %36
36: ; preds = %34, %32
%37 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %4, i8* %3)
%38 = tail call i32 @fclose(i32* %6)
br label %39
39: ; preds = %36, %8
ret i32 0
}