#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;
  }
  fp = fopen("hash.txt", "r");
  if (!fp) {
    fp = fopen("opt.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;
  }
  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);
  fclose(output);
  fclose(fp);
  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>
lea    0xd04(%rip),%rdi
lea    0xc37(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    142a <main+0x2ba>
lea    0xcb8(%rip),%rdi
lea    0xc15(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1425 <main+0x2b5>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    142a <main+0x2ba>
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    14f1 <main+0x381>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     148a <main+0x31a>
mov    -0x1c(%rbp),%esi
lea    0xbd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbf0(%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    0xbfe(%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    1447 <main+0x2d7>
mov    -0x18(%rbp),%rdi
movsd  -0x98(%rbp),%xmm0
ff
movsd  0xafb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0xb8(%rbp),%xmm1
ff
movsd  0xae7(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xd8(%rbp),%xmm2
ff
movsd  0xad3(%rip),%xmm3
divsd  %xmm3,%xmm2
lea    0xbcb(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xaaf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0xc0(%rbp),%xmm1
ff
movsd  0xa9b(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0xe0(%rbp),%xmm2
ff
lea    0xba1(%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    $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,0x30(%rsp)
test   %rbx,%rbx
je     1494 <main+0x314>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0xb0(%rsp),%r12
lea    0x70(%rsp),%r13
lea    0x68(%rsp),%r14
lea    0x60(%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    1471 <main+0x2f1>
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  0x68(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
addsd  0x60(%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     149d <main+0x31d>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0xb0(%rsp),%r12
lea    0x70(%rsp),%r13
lea    0x58(%rsp),%r14
lea    0x50(%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    1471 <main+0x2f1>
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  0x58(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    12d0 <main+0x150>
lea    0xda9(%rip),%rdi
lea    0xcd2(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1362 <main+0x1e2>
lea    0xd6d(%rip),%rdi
lea    0xcb7(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     14a6 <main+0x326>
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xb0(%rsp),%r12
lea    0x70(%rsp),%r13
lea    0x48(%rsp),%r14
lea    0x40(%rsp),%r15
xorpd  %xmm2,%xmm2
nopl   0x0(%rax)
movsd  %xmm2,0x38(%rsp)
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %rax,%rax
jne    1471 <main+0x2f1>
mov    %rbx,%rdi
lea    0xc8f(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1060 <fscanf@plt>
movsd  0x38(%rsp),%xmm2
addsd  0x48(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    1390 <main+0x210>
movsd  0xc10(%rip),%xmm3
movsd  0x20(%rsp),%xmm0
divsd  %xmm3,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm3,%xmm1
divsd  %xmm3,%xmm2
lea    0xc40(%rip),%rsi
mov    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <fprintf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0xbd6(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  0x18(%rsp),%xmm1
divsd  %xmm2,%xmm1
lea    0xc26(%rip),%rsi
mov    %rbp,%rdi
movsd  0x8(%rsp),%xmm2
call   1070 <fprintf@plt>
mov    %rbp,%rdi
call   1040 <fclose@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    0xb9f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc59(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    0xbe1(%rip),%rdi
jmp    1488 <main+0x308>
lea    0xbfa(%rip),%rdi
jmp    1488 <main+0x308>
lea    0xc12(%rip),%rdi
jmp    1488 <main+0x308>

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 = 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* %95, i32** %2
%96 = load i32*, i32** %2
%97 = icmp ne i32* %96, null
br i1 %97, label %106, label %98
98: ; preds = %94
%99 = 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* %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 ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%104 = call i32 @exit(i32 0)
unreachable
105: ; preds = %98
br label %106
106: ; preds = %105, %94
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* %17, double* %18)
%124 = load double, double* %17
%125 = load double, double* %15
%126 = fadd double %125, %124
store double %126, double* %15
%127 = load double, double* %18
%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 = 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 %147)
%149 = load i32*, i32** %3
%150 = call i32 @fclose(i32* %149)
%151 = load i32*, i32** %2
%152 = call i32 @fclose(i32* %151)
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* @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))
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %79
73: ; preds = %70
%74 = 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))
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.15, i64 0, i64 0))
%78 = call i32 @exit(i32 0)
unreachable
79: ; preds = %73, %70
%80 = phi i32* [ %71, %70 ], [ %74, %73 ]
%81 = bitcast double* %7 to i8*
%82 = bitcast double* %8 to i8*
br label %83
83: ; preds = %79, %93
%84 = phi double [ 0.000000e+00, %79 ], [ %98, %93 ]
%85 = phi double [ 0.000000e+00, %79 ], [ %96, %93 ]
%86 = phi i32 [ 0, %79 ], [ %99, %93 ]
%87 = call i64 @feof(i32* %80)
%88 = icmp eq i64 %87, 0
br i1 %88, label %93, label %89
89: ; preds = %83
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %86)
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.18, i64 0, i64 0))
%92 = call i32 @exit(i32 0)
unreachable
93: ; preds = %83
%94 = call i32 @fscanf(i32* %80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %16, i8* %17, double* %7, double* %8)
%95 = load double, double* %7
%96 = fadd double %85, %95
%97 = load double, double* %8
%98 = fadd double %84, %97
%99 = add nuw nsw i32 %86, 1
%100 = icmp eq i32 %99, 100
br i1 %100, label %101, label %83
101: ; preds = %93
%102 = fdiv double %33, 1.000000e+02
%103 = fdiv double %65, 1.000000e+02
%104 = fdiv double %96, 1.000000e+02
%105 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), double %102, double %103, double %104)
%106 = fdiv double %35, 1.000000e+02
%107 = fdiv double %67, 1.000000e+02
%108 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), double %106, double %107, double %98)
%109 = call i32 @fclose(i32* %10)
%110 = call i32 @fclose(i32* %80)
ret i32 0
}