#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*/ createHighScores();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int pow(int, int);
int getLowestScore() {
  FILE *fp;
  char str[128];
  int lowestScore = 0;
  int i;
  int intLength;
  if ((fp = fopen("highscores.txt", "r")) == NULL) {
    createHighScores();
    if ((fp = fopen("highscores.txt", "r")) == NULL)
      exit(1);
  }
  while (!feof(fp)) {
    fgets(str, 126, fp);
  }
  fclose(fp);
  i = 0;
  while (str[2 + i] != '\t') {
    i++;
  }
  intLength = i;
  for (i = 0; i < intLength; i++) {
    lowestScore =
        lowestScore + ((int)str[2 + i] - 48) * pow(10, intLength - i - 1);
  }
  return (lowestScore);
}


x86 assembly (clang, -O0):
<getLowestScore>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x94(%rbp)
lea    0xe74(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    11dd <getLowestScore+0x6d>
mov    $0x0,%al
call   1060 <createHighScores@plt>
lea    0xe4c(%rip),%rdi
lea    0xe54(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    11d8 <getLowestScore+0x68>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    11dd <getLowestScore+0x6d>
jmp    11e2 <getLowestScore+0x72>
mov    -0x8(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1200 <getLowestScore+0x90>
jmp    121a <getLowestScore+0xaa>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x7e,%esi
call   1040 <fgets@plt>
jmp    11e2 <getLowestScore+0x72>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x90(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
je     125d <getLowestScore+0xed>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    122d <getLowestScore+0xbd>
mov    -0x98(%rbp),%eax
mov    %eax,-0x9c(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x9c(%rbp),%eax
jge    12f3 <getLowestScore+0x183>
mov    -0x94(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x98(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x90(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x9c(%rbp),%esi
sub    -0x98(%rbp),%esi
sub    $0x1,%esi
mov    $0xa,%edi
call   1080 <pow@plt>
mov    -0xa4(%rbp),%ecx
mov    %eax,%edx
mov    -0xa0(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x94(%rbp)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1273 <getLowestScore+0x103>
mov    -0x94(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLowestScore>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xe78(%rip),%rdi
lea    0xe80(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c2 <getLowestScore+0x52>
xor    %eax,%eax
call   1060 <createHighScores@plt>
lea    0xe56(%rip),%rdi
lea    0xe5e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     12f4 <getLowestScore+0x184>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    11fc <getLowestScore+0x8c>
lea    0x10(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    $0x7e,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     11e0 <getLowestScore+0x70>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
cmpb   $0x9,0x12(%rsp,%r15,1)
lea    0x1(%r15),%r15
jne    1210 <getLowestScore+0xa0>
xor    %ebx,%ebx
cmp    $0x1,%r15d
je     12e0 <getLowestScore+0x170>
lea    -0x1(%r15),%rax
cmp    $0x1,%eax
mov    %rax,(%rsp)
jne    123c <getLowestScore+0xcc>
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    12b3 <getLowestScore+0x143>
lea    -0x2(%r15),%r14
mov    %eax,%edx
and    $0x1,%eax
sub    %rax,%rdx
mov    %rdx,0x8(%rsp)
xor    %r13d,%r13d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x12(%rsp,%r13,1),%r12d
add    $0xffffffd0,%r12d
mov    $0xa,%edi
mov    %r14d,%esi
call   1080 <pow@plt>
mov    %eax,%ebp
imul   %r12d,%ebp
add    %ebx,%ebp
movsbl 0x13(%rsp,%r13,1),%r12d
add    $0xffffffd0,%r12d
mov    %r13d,%esi
xor    $0xfffffffe,%esi
add    (%rsp),%esi
mov    $0xa,%edi
call   1080 <pow@plt>
mov    %eax,%ebx
imul   %r12d,%ebx
add    %ebp,%ebx
add    $0x2,%r13
add    $0xfffffffe,%r14d
cmp    %r13,0x8(%rsp)
jne    1260 <getLowestScore+0xf0>
testb  $0x1,(%rsp)
je     12e0 <getLowestScore+0x170>
lea    0x10(%rsp),%rax
movsbl 0x2(%r13,%rax,1),%ebp
add    $0xffffffd0,%ebp
not    %r13d
lea    (%r15,%r13,1),%esi
add    $0xffffffff,%esi
mov    $0xa,%edi
call   1080 <pow@plt>
imul   %ebp,%eax
add    %eax,%ebx
mov    %ebx,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"highscores.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @getLowestScore() {
%1 = alloca i32*
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %3
%6 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %1
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %15
8: ; preds = %0
%9 = call i32 (...) @createHighScores()
%10 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %1
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %8
br label %15
15: ; preds = %14, %0
br label %16
16: ; preds = %21, %15
%17 = load i32*, i32** %1
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%23 = load i32*, i32** %1
%24 = call i32 @fgets(i8* %22, i32 126, i32* %23)
br label %16
25: ; preds = %16
%26 = load i32*, i32** %1
%27 = call i32 @fclose(i32* %26)
store i32 0, i32* %4
br label %28
28: ; preds = %36, %25
%29 = load i32, i32* %4
%30 = add nsw i32 2, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 9
br i1 %35, label %36, label %39
36: ; preds = %28
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %28
39: ; preds = %28
%40 = load i32, i32* %4
store i32 %40, i32* %5
store i32 0, i32* %4
br label %41
41: ; preds = %61, %39
%42 = load i32, i32* %4
%43 = load i32, i32* %5
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %64
45: ; preds = %41
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = add nsw i32 2, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = sub nsw i32 %52, 48
%54 = load i32, i32* %5
%55 = load i32, i32* %4
%56 = sub nsw i32 %54, %55
%57 = sub nsw i32 %56, 1
%58 = call i32 @pow(i32 10, i32 %57)
%59 = mul nsw i32 %53, %58
%60 = add nsw i32 %46, %59
store i32 %60, i32* %3
br label %61
61: ; preds = %45
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
store i32 %63, i32* %4
br label %41
64: ; preds = %41
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str = [15 x i8] c"highscores.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @getLowestScore() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = tail call i32 (...) @createHighScores()
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %5, %0
%12 = phi i32* [ %7, %5 ], [ %3, %0 ]
%13 = call i32 @feof(i32* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11, %15
%16 = call i32 @fgets(i8* %2, i32 126, i32* %12)
%17 = call i32 @feof(i32* %12)
%18 = icmp eq i32 %17, 0
br i1 %18, label %15, label %19
19: ; preds = %15, %11
%20 = call i32 @fclose(i32* %12)
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ %27, %21 ], [ 0, %19 ]
%23 = add nuw nsw i64 %22, 2
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 9
%27 = add nuw i64 %22, 1
br i1 %26, label %28, label %21
28: ; preds = %21
%29 = trunc i64 %22 to i32
%30 = icmp eq i32 %29, 0
br i1 %30, label %83, label %31
31: ; preds = %28
%32 = and i64 %22, 4294967295
%33 = and i64 %22, 1
%34 = icmp eq i64 %32, 1
br i1 %34, label %66, label %35
35: ; preds = %31
%36 = sub nsw i64 %32, %33
br label %37
37: ; preds = %37, %35
%38 = phi i64 [ 0, %35 ], [ %63, %37 ]
%39 = phi i32 [ 0, %35 ], [ %62, %37 ]
%40 = phi i64 [ 0, %35 ], [ %64, %37 ]
%41 = trunc i64 %38 to i32
%42 = add nuw nsw i64 %38, 2
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = add nsw i32 %45, -48
%47 = xor i32 %41, -1
%48 = add nsw i32 %29, %47
%49 = call i32 @pow(i32 10, i32 %48)
%50 = mul nsw i32 %46, %49
%51 = add nsw i32 %50, %39
%52 = trunc i64 %38 to i32
%53 = add nuw nsw i64 %38, 3
%54 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = add nsw i32 %56, -48
%58 = xor i32 %52, -2
%59 = add nsw i32 %58, %29
%60 = call i32 @pow(i32 10, i32 %59)
%61 = mul nsw i32 %57, %60
%62 = add nsw i32 %61, %51
%63 = add nuw nsw i64 %38, 2
%64 = add i64 %40, 2
%65 = icmp eq i64 %64, %36
br i1 %65, label %66, label %37
66: ; preds = %37, %31
%67 = phi i32 [ undef, %31 ], [ %62, %37 ]
%68 = phi i64 [ 0, %31 ], [ %63, %37 ]
%69 = phi i32 [ 0, %31 ], [ %62, %37 ]
%70 = icmp eq i64 %33, 0
br i1 %70, label %83, label %71
71: ; preds = %66
%72 = trunc i64 %68 to i32
%73 = add nuw nsw i64 %68, 2
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = add nsw i32 %76, -48
%78 = xor i32 %72, -1
%79 = add nsw i32 %29, %78
%80 = call i32 @pow(i32 10, i32 %79)
%81 = mul nsw i32 %77, %80
%82 = add nsw i32 %81, %69
br label %83
83: ; preds = %71, %66, %28
%84 = phi i32 [ 0, %28 ], [ %67, %66 ], [ %82, %71 ]
ret i32 %84
}