#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("opt_hash.txt", "r");
  if (!fp) {
    fp = fopen("orig.txt", "r");
    if (!fp) {
      printf("ERROR opening input file opt_hash.txt\n");
      exit(0);
    }
  }
  double opt_sum_a_hash = 0.0, opt_sum_f_hash = 0.0;
  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_hash += opt_a;
    opt_sum_f_hash += opt_f;
  }
  fprintf(output, "append() %lf %lf %lf\n", orig_sum_a / 100.0,
          opt_sum_a / 100.0, opt_sum_a_hash / 100.0);
  fprintf(output, "findName() %lf %lf %lf", orig_sum_f / 100.0,
          opt_sum_f / 100.0, opt_sum_f_hash / 100.0);
  fclose(output);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%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    0xcc4(%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    -0xc8(%rbp),%r8
lea    -0xd0(%rbp),%r9
call   1050 <fscanf@plt>
movsd  -0xc8(%rbp),%xmm0
ff
addsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd0(%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    -0x18(%rbp),%rdi
movsd  -0x98(%rbp),%xmm0
ff
movsd  0xaf2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0xb8(%rbp),%xmm1
ff
movsd  0xade(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xd8(%rbp),%xmm2
ff
movsd  0xaca(%rip),%xmm3
divsd  %xmm3,%xmm2
lea    0xbca(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xaa6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0xc0(%rbp),%xmm1
ff
movsd  0xa92(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xe0(%rbp),%xmm2
ff
movsd  0xa7e(%rip),%xmm3
divsd  %xmm3,%xmm2
lea    0xb94(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%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,0x40(%rsp)
test   %rbx,%rbx
je     14ac <main+0x32c>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0xa0(%rsp),%r12
lea    0x60(%rsp),%r13
lea    0x58(%rsp),%r14
lea    0x50(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1489 <main+0x309>
mov    %rbx,%rdi
lea    0xe25(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x20(%rsp),%xmm0
addsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x28(%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     14b5 <main+0x335>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0xa0(%rsp),%r12
lea    0x60(%rsp),%r13
lea    0x38(%rsp),%r14
lea    0x30(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1489 <main+0x309>
mov    %rbx,%rdi
lea    0xd55(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x18(%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     14be <main+0x33e>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xa0(%rsp),%r12
lea    0x60(%rsp),%r13
lea    0x38(%rsp),%r14
lea    0x30(%rsp),%r15
xorpd  %xmm2,%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x48(%rsp)
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1489 <main+0x309>
mov    %rbx,%rdi
lea    0xc7f(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x48(%rsp),%xmm2
addsd  0x38(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    13a0 <main+0x220>
movsd  0xc00(%rip),%xmm3
movsd  0x20(%rsp),%xmm0
divsd  %xmm3,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm3,%xmm1
divsd  %xmm3,%xmm2
lea    0xc30(%rip),%rsi
mov    0x40(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <fprintf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0xbc6(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  0x18(%rsp),%xmm1
divsd  %xmm2,%xmm1
movapd %xmm2,%xmm3
movsd  0x8(%rsp),%xmm2
divsd  %xmm3,%xmm2
lea    0xc08(%rip),%rsi
mov    %rbp,%rdi
call   1070 <fprintf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb87(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc45(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    0xbc9(%rip),%rdi
jmp    14a0 <main+0x320>
lea    0xbe2(%rip),%rdi
jmp    14a0 <main+0x320>
lea    0xbfa(%rip),%rdi
jmp    14a0 <main+0x320>

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