#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double,
                           double);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *,
                          double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  FILE *fp = fopen("orig.txt", "r");
  FILE *output = fopen("output.txt", "w");
  if (!fp) {
    printf("ERROR opening input file orig.txt\n");
    exit(0);
  }
  int i = 0;
  char append[50], find[50];
  double orig_sum_a = 0.0, orig_sum_f = 0.0, orig_a, orig_f;
  for (i = 0; i < 100; i++) {
    if (feof(fp)) {
      printf("ERROR: You need 100 datum instead of %d\n", i);
      printf("run 'make run' longer to get enough information\n\n");
      exit(0);
    }
    fscanf(fp, "%s %s %lf %lf\n", append, find, &orig_a, &orig_f);
    orig_sum_a += orig_a;
    orig_sum_f += orig_f;
  }
  fclose(fp);
  fp = fopen("opt.txt", "r");
  if (!fp) {
    fp = fopen("orig.txt", "r");
    if (!fp) {
      printf("ERROR opening input file opt.txt\n");
      exit(0);
    }
  }
  double opt_sum_a = 0.0, opt_sum_f = 0.0, opt_a, opt_f;
  for (i = 0; i < 100; i++) {
    if (feof(fp)) {
      printf("ERROR: You need 100 datum instead of %d\n", i);
      printf("run 'make run' longer to get enough information\n\n");
      exit(0);
    }
    fscanf(fp, "%s %s %lf %lf\n", append, find, &opt_a, &opt_f);
    opt_sum_a += opt_a;
    opt_sum_f += opt_f;
  }
  fclose(fp);
  fp = fopen("hash.txt", "r");
  if (!fp) {
    fp = fopen("orig.txt", "r");
    if (!fp) {
      printf("ERROR opening input file hash.txt\n");
      exit(0);
    }
  }
  double hash_sum_a = 0.0, hash_sum_f = 0.0, hash_a, hash_f;
  for (i = 0; i < 100; i++) {
    if (feof(fp)) {
      printf("ERROR: You need 100 datum instead of %d\n", i);
      printf("run 'make run' longer to get enough information\n\n");
      exit(0);
    }
    fscanf(fp, "%s %s %lf %lf\n", append, find, &hash_a, &hash_f);
    hash_sum_a += hash_a;
    hash_sum_f += hash_f;
  }
  fclose(fp);
  fprintf(output, "append() %lf %lf %lf\n", orig_sum_a / 100.0,
          opt_sum_a / 100.0, hash_sum_a / 100.0);
  fprintf(output, "findName() %lf %lf %lf", orig_sum_f / 100.0,
          opt_sum_f / 100.0, hash_sum_f / 100.0);
  fclose(output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7f(%rip),%rdi
lea    0xe81(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe73(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11d0 <main+0x60>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
movl   $0x0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    129e <main+0x12e>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     1237 <main+0xc7>
mov    -0x1c(%rbp),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    0xe51(%rip),%rsi
lea    -0xa8(%rbp),%r8
lea    -0xb0(%rbp),%r9
call   1050 <fscanf@plt>
movsd  -0xa8(%rbp),%xmm0
ff
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f4 <main+0x84>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xdff(%rip),%rdi
lea    0xd5c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1305 <main+0x195>
lea    0xd38(%rip),%rdi
lea    0xd3a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1300 <main+0x190>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    1305 <main+0x195>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    13cc <main+0x25c>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     1365 <main+0x1f5>
mov    -0x1c(%rbp),%esi
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    0xd23(%rip),%rsi
lea    -0xc8(%rbp),%r8
lea    -0xd0(%rbp),%r9
call   1050 <fscanf@plt>
movsd  -0xc8(%rbp),%xmm0
ff
addsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
addsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1322 <main+0x1b2>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xcfb(%rip),%rdi
lea    0xc2e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1433 <main+0x2c3>
lea    0xc0a(%rip),%rdi
lea    0xc0c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    142e <main+0x2be>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    1433 <main+0x2c3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    14fa <main+0x38a>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     1493 <main+0x323>
mov    -0x1c(%rbp),%esi
lea    0xbcc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbe7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    0xbf5(%rip),%rsi
lea    -0xe8(%rbp),%r8
lea    -0xf0(%rbp),%r9
call   1050 <fscanf@plt>
movsd  -0xe8(%rbp),%xmm0
ff
addsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
addsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1450 <main+0x2e0>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
movsd  -0x98(%rbp),%xmm0
ff
movsd  0xae9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0xb8(%rbp),%xmm1
ff
movsd  0xad5(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xd8(%rbp),%xmm2
ff
movsd  0xac1(%rip),%xmm3
divsd  %xmm3,%xmm2
lea    0xbb9(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xa9d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0xc0(%rbp),%xmm1
ff
movsd  0xa89(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xe0(%rbp),%xmm2
ff
movsd  0xa75(%rip),%xmm3
divsd  %xmm3,%xmm2
lea    0xb83(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
lea    0xefd(%rip),%rdi
lea    0xe69(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe5c(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,0x38(%rsp)
test   %rbx,%rbx
je     14b2 <main+0x332>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0xb0(%rsp),%r12
lea    0x70(%rsp),%r13
lea    0x68(%rsp),%r14
lea    0x60(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    148f <main+0x30f>
mov    %rbx,%rdi
lea    0xe25(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x28(%rsp),%xmm0
addsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x30(%rsp),%xmm0
addsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    1200 <main+0x80>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe50(%rip),%rdi
lea    0xd9a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    129a <main+0x11a>
lea    0xe13(%rip),%rdi
lea    0xd7f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     14bb <main+0x33b>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xb0(%rsp),%r12
lea    0x70(%rsp),%r13
lea    0x58(%rsp),%r14
lea    0x50(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    148f <main+0x30f>
mov    %rbx,%rdi
lea    0xd55(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x18(%rsp),%xmm0
addsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    12d0 <main+0x150>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xda1(%rip),%rdi
lea    0xcca(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    136a <main+0x1ea>
lea    0xd43(%rip),%rdi
lea    0xcaf(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     14c4 <main+0x344>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xb0(%rsp),%r12
lea    0x70(%rsp),%r13
lea    0x48(%rsp),%r14
lea    0x40(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    148f <main+0x30f>
mov    %rbx,%rdi
lea    0xc85(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    13a0 <main+0x220>
mov    %rbx,%rdi
call   1040 <fclose@plt>
movsd  0xbf8(%rip),%xmm3
movsd  0x28(%rsp),%xmm0
divsd  %xmm3,%xmm0
movsd  0x18(%rsp),%xmm1
divsd  %xmm3,%xmm1
movsd  0x8(%rsp),%xmm2
divsd  %xmm3,%xmm2
lea    0xc22(%rip),%rsi
mov    0x38(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <fprintf@plt>
movsd  0x30(%rsp),%xmm0
movsd  0xbb8(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  0x20(%rsp),%xmm1
divsd  %xmm2,%xmm1
movapd %xmm2,%xmm3
movsd  0x10(%rsp),%xmm2
divsd  %xmm3,%xmm2
lea    0xbfa(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb81(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc3b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    0xbc3(%rip),%rdi
jmp    14a6 <main+0x326>
lea    0xbdc(%rip),%rdi
jmp    14a6 <main+0x326>
lea    0xbf4(%rip),%rdi
jmp    14a6 <main+0x326>

LLVM IR (-O0):
@.str = [9 x i8] c"orig.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [35 x i8] c"ERROR opening input file orig.txt\0A\00"
@.str.5 = [41 x i8] c"ERROR: You need 100 datum instead of %d\0A\00"
@.str.6 = [50 x i8] c"run 'make run' longer to get enough information\0A\0A\00"
@.str.7 = [15 x i8] c"%s %s %lf %lf\0A\00"
@.str.8 = [8 x i8] c"opt.txt\00"
@.str.9 = [34 x i8] c"ERROR opening input file opt.txt\0A\00"
@.str.10 = [9 x i8] c"hash.txt\00"
@.str.11 = [35 x i8] c"ERROR opening input file hash.txt\0A\00"
@.str.12 = [22 x i8] c"append() %lf %lf %lf\0A\00"
@.str.13 = [23 x i8] c"findName() %lf %lf %lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [50 x i8]
%6 = alloca [50 x i8]
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32 0, i32* %1
%19 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %2
%20 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %20, i32** %3
%21 = load i32*, i32** %2
%22 = icmp ne i32* %21, null
br i1 %22, label %26, label %23
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %0
store i32 0, i32* %4
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store i32 0, i32* %4
br label %27
27: ; preds = %50, %26
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 100
br i1 %29, label %30, label %53
30: ; preds = %27
%31 = load i32*, i32** %2
%32 = call i64 @feof(i32* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i32, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %30
%40 = load i32*, i32** %2
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%42 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%43 = call i32 @fscanf(i32* %40, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %41, i8* %42, double* %9, double* %10)
%44 = load double, double* %9
%45 = load double, double* %7
%46 = fadd double %45, %44
store double %46, double* %7
%47 = load double, double* %10
%48 = load double, double* %8
%49 = fadd double %48, %47
store double %49, double* %8
br label %50
50: ; preds = %39
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %27
53: ; preds = %27
%54 = load i32*, i32** %2
%55 = call i32 @fclose(i32* %54)
%56 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %56, i32** %2
%57 = load i32*, i32** %2
%58 = icmp ne i32* %57, null
br i1 %58, label %67, label %59
59: ; preds = %53
%60 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %60, i32** %2
%61 = load i32*, i32** %2
%62 = icmp ne i32* %61, null
br i1 %62, label %66, label %63
63: ; preds = %59
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%65 = call i32 @exit(i32 0)
unreachable
66: ; preds = %59
br label %67
67: ; preds = %66, %53
store double 0.000000e+00, double* %11
store double 0.000000e+00, double* %12
store i32 0, i32* %4
br label %68
68: ; preds = %91, %67
%69 = load i32, i32* %4
%70 = icmp slt i32 %69, 100
br i1 %70, label %71, label %94
71: ; preds = %68
%72 = load i32*, i32** %2
%73 = call i64 @feof(i32* %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %80
75: ; preds = %71
%76 = load i32, i32* %4
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%79 = call i32 @exit(i32 0)
unreachable
80: ; preds = %71
%81 = load i32*, i32** %2
%82 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%83 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%84 = call i32 @fscanf(i32* %81, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %82, i8* %83, double* %13, double* %14)
%85 = load double, double* %13
%86 = load double, double* %11
%87 = fadd double %86, %85
store double %87, double* %11
%88 = load double, double* %14
%89 = load double, double* %12
%90 = fadd double %89, %88
store double %90, double* %12
br label %91
91: ; preds = %80
%92 = load i32, i32* %4
%93 = add nsw i32 %92, 1
store i32 %93, i32* %4
br label %68
94: ; preds = %68
%95 = load i32*, i32** %2
%96 = call i32 @fclose(i32* %95)
%97 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %97, i32** %2
%98 = load i32*, i32** %2
%99 = icmp ne i32* %98, null
br i1 %99, label %108, label %100
100: ; preds = %94
%101 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %101, i32** %2
%102 = load i32*, i32** %2
%103 = icmp ne i32* %102, null
br i1 %103, label %107, label %104
104: ; preds = %100
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%106 = call i32 @exit(i32 0)
unreachable
107: ; preds = %100
br label %108
108: ; preds = %107, %94
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %16
store i32 0, i32* %4
br label %109
109: ; preds = %132, %108
%110 = load i32, i32* %4
%111 = icmp slt i32 %110, 100
br i1 %111, label %112, label %135
112: ; preds = %109
%113 = load i32*, i32** %2
%114 = call i64 @feof(i32* %113)
%115 = icmp ne i64 %114, 0
br i1 %115, label %116, label %121
116: ; preds = %112
%117 = load i32, i32* %4
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %117)
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%120 = call i32 @exit(i32 0)
unreachable
121: ; preds = %112
%122 = load i32*, i32** %2
%123 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%124 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%125 = call i32 @fscanf(i32* %122, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %123, i8* %124, double* %17, double* %18)
%126 = load double, double* %17
%127 = load double, double* %15
%128 = fadd double %127, %126
store double %128, double* %15
%129 = load double, double* %18
%130 = load double, double* %16
%131 = fadd double %130, %129
store double %131, double* %16
br label %132
132: ; preds = %121
%133 = load i32, i32* %4
%134 = add nsw i32 %133, 1
store i32 %134, i32* %4
br label %109
135: ; preds = %109
%136 = load i32*, i32** %2
%137 = call i32 @fclose(i32* %136)
%138 = load i32*, i32** %3
%139 = load double, double* %7
%140 = fdiv double %139, 1.000000e+02
%141 = load double, double* %11
%142 = fdiv double %141, 1.000000e+02
%143 = load double, double* %15
%144 = fdiv double %143, 1.000000e+02
%145 = call i32 @fprintf(i32* %138, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), double %140, double %142, double %144)
%146 = load i32*, i32** %3
%147 = load double, double* %8
%148 = fdiv double %147, 1.000000e+02
%149 = load double, double* %12
%150 = fdiv double %149, 1.000000e+02
%151 = load double, double* %16
%152 = fdiv double %151, 1.000000e+02
%153 = call i32 @fprintf(i32* %146, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), double %148, double %150, double %152)
%154 = load i32*, i32** %3
%155 = call i32 @fclose(i32* %154)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"orig.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.5 = [41 x i8] c"ERROR: You need 100 datum instead of %d\0A\00"
@.str.7 = [15 x i8] c"%s %s %lf %lf\0A\00"
@.str.8 = [8 x i8] c"opt.txt\00"
@.str.10 = [9 x i8] c"hash.txt\00"
@.str.12 = [22 x i8] c"append() %lf %lf %lf\0A\00"
@.str.13 = [23 x i8] c"findName() %lf %lf %lf\00"
@str = [34 x i8] c"ERROR opening input file orig.txt\00"
@str.14 = [33 x i8] c"ERROR opening input file opt.txt\00"
@str.15 = [34 x i8] c"ERROR opening input file hash.txt\00"
@str.18 = [49 x i8] c"run 'make run' longer to get enough information\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32* %9, null
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %0
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%18 = bitcast double* %3 to i8*
%19 = bitcast double* %4 to i8*
br label %20
20: ; preds = %15, %30
%21 = phi double [ 0.000000e+00, %15 ], [ %35, %30 ]
%22 = phi double [ 0.000000e+00, %15 ], [ %33, %30 ]
%23 = phi i32 [ 0, %15 ], [ %36, %30 ]
%24 = call i64 @feof(i32* %9)
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.18, i64 0, i64 0))
%29 = call i32 @exit(i32 0)
unreachable
30: ; preds = %20
%31 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %16, i8* %17, double* %3, double* %4)
%32 = load double, double* %3
%33 = fadd double %22, %32
%34 = load double, double* %4
%35 = fadd double %21, %34
%36 = add nuw nsw i32 %23, 1
%37 = icmp eq i32 %36, 100
br i1 %37, label %38, label %20
38: ; preds = %30
%39 = call i32 @fclose(i32* %9)
%40 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %48
42: ; preds = %38
%43 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.14, i64 0, i64 0))
%47 = call i32 @exit(i32 0)
unreachable
48: ; preds = %42, %38
%49 = phi i32* [ %40, %38 ], [ %43, %42 ]
%50 = bitcast double* %5 to i8*
%51 = bitcast double* %6 to i8*
br label %52
52: ; preds = %48, %62
%53 = phi double [ 0.000000e+00, %48 ], [ %67, %62 ]
%54 = phi double [ 0.000000e+00, %48 ], [ %65, %62 ]
%55 = phi i32 [ 0, %48 ], [ %68, %62 ]
%56 = call i64 @feof(i32* %49)
%57 = icmp eq i64 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %52
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %55)
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.18, i64 0, i64 0))
%61 = call i32 @exit(i32 0)
unreachable
62: ; preds = %52
%63 = call i32 @fscanf(i32* %49, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %16, i8* %17, double* %5, double* %6)
%64 = load double, double* %5
%65 = fadd double %54, %64
%66 = load double, double* %6
%67 = fadd double %53, %66
%68 = add nuw nsw i32 %55, 1
%69 = icmp eq i32 %68, 100
br i1 %69, label %70, label %52
70: ; preds = %62
%71 = call i32 @fclose(i32* %49)
%72 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %80
74: ; preds = %70
%75 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%76 = icmp eq i32* %75, null
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.15, i64 0, i64 0))
%79 = call i32 @exit(i32 0)
unreachable
80: ; preds = %74, %70
%81 = phi i32* [ %72, %70 ], [ %75, %74 ]
%82 = bitcast double* %7 to i8*
%83 = bitcast double* %8 to i8*
br label %84
84: ; preds = %80, %94
%85 = phi double [ 0.000000e+00, %80 ], [ %99, %94 ]
%86 = phi double [ 0.000000e+00, %80 ], [ %97, %94 ]
%87 = phi i32 [ 0, %80 ], [ %100, %94 ]
%88 = call i64 @feof(i32* %81)
%89 = icmp eq i64 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %84
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %87)
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.18, i64 0, i64 0))
%93 = call i32 @exit(i32 0)
unreachable
94: ; preds = %84
%95 = call i32 @fscanf(i32* %81, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %16, i8* %17, double* %7, double* %8)
%96 = load double, double* %7
%97 = fadd double %86, %96
%98 = load double, double* %8
%99 = fadd double %85, %98
%100 = add nuw nsw i32 %87, 1
%101 = icmp eq i32 %100, 100
br i1 %101, label %102, label %84
102: ; preds = %94
%103 = call i32 @fclose(i32* %81)
%104 = fdiv double %33, 1.000000e+02
%105 = fdiv double %65, 1.000000e+02
%106 = fdiv double %97, 1.000000e+02
%107 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), double %104, double %105, double %106)
%108 = fdiv double %35, 1.000000e+02
%109 = fdiv double %67, 1.000000e+02
%110 = fdiv double %99, 1.000000e+02
%111 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), double %108, double %109, double %110)
%112 = call i32 @fclose(i32* %10)
ret i32 0
}