#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 *, long, long, char *);
void initScores() {
  short i;
  FILE *scoresFile;
  scoresFile = fopen("BrogueHighScores.txt", "w");
  for (i = 0; i < 30; i++) {
    fprintf(scoresFile, "%li\t%li\t%s", (long)0, (long)0, "(empty entry)\n");
  }
  fclose(scoresFile);
}


x86 assembly (clang, -O0):
<initScores>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xecf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movw   $0x0,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x1e,%eax
jge    1191 <initScores+0x61>
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    0xeaa(%rip),%r8
mov    %rcx,%rdx
call   1040 <fprintf@plt>
mov    -0x2(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x2(%rbp)
jmp    1155 <initScores+0x25>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initScores>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    $0x1e,%bp
lea    0xebf(%rip),%r14
lea    0xec3(%rip),%r15
nop
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r15,%r8
call   1040 <fprintf@plt>
add    $0xffff,%bp
jne    1160 <initScores+0x30>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"BrogueHighScores.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [11 x i8] c"%li\09%li\09%s\00"
@.str.3 = [15 x i8] c"(empty entry)\0A\00"
define void @initScores() {
%1 = alloca i16
%2 = alloca i32*
%3 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
store i16 0, i16* %1
br label %4
4: ; preds = %11, %0
%5 = load i16, i16* %1
%6 = sext i16 %5 to i32
%7 = icmp slt i32 %6, 30
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32*, i32** %2
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 0, i64 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %8
%12 = load i16, i16* %1
%13 = add i16 %12, 1
store i16 %13, i16* %1
br label %4
14: ; preds = %4
%15 = load i32*, i32** %2
%16 = call i32 @fclose(i32* %15)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"BrogueHighScores.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [11 x i8] c"%li\09%li\09%s\00"
@.str.3 = [15 x i8] c"(empty entry)\0A\00"
define void @initScores() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i16 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 0, i64 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%5 = add nuw nsw i16 %3, 1
%6 = icmp eq i16 %5, 30
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @fclose(i32* %1)
ret void
}