#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*/ drive(int, long double *, long double *, long double *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long double);
int fscanf(int /*<<< orphan*/ *, char *, long double *);
void main(void) {
  int k, N = 0;
  long double v[100002];
  long double t[100002];
  long double c[100002];
  FILE *fid;
  ;
  fid = fopen("data.bin", "r");
  while (!feof(fid)) {
    if (fscanf(fid, "%Lf", &c[N]) == 1)
      ++N;
  }
  fclose(fid);
  fid = fopen("data_t.bin", "r");
  for (k = 0; k < N; k++) {
    fscanf(fid, "%Lf", &t[k]);
  }
  fclose(fid);
  drive(N, c, t, v);
  fid = fopen("results.bin", "w+");
  for (k = 0; k < N; k++)
    fprintf(fid, "%33.33Lg\n", v[k]);
  fclose(fid);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x493e90,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x493e78(%rbp)
mov    -0x493e78(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ad <main+0x4d>
jmp    11e9 <main+0x89>
mov    -0x493e78(%rbp),%rdi
movslq -0x8(%rbp),%rax
lea    -0x493e70(%rbp),%rdx
shl    $0x4,%rax
add    %rax,%rdx
lea    0xe3e(%rip),%rsi
call   1040 <fscanf@plt>
cmp    $0x1,%eax
jne    11e4 <main+0x84>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118c <main+0x2c>
mov    -0x493e78(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe13(%rip),%rdi
lea    0xe06(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x493e78(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1255 <main+0xf5>
mov    -0x493e78(%rbp),%rdi
movslq -0x4(%rbp),%rax
lea    -0x30d450(%rbp),%rdx
shl    $0x4,%rax
add    %rax,%rdx
lea    0xdc9(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1216 <main+0xb6>
mov    -0x493e78(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x8(%rbp),%edi
lea    -0x493e70(%rbp),%rsi
lea    -0x30d450(%rbp),%rdx
lea    -0x186a30(%rbp),%rcx
call   1080 <drive@plt>
lea    0xd95(%rip),%rdi
lea    0xd9a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x493e78(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12e0 <main+0x180>
mov    -0x493e78(%rbp),%rdi
movslq -0x4(%rbp),%rax
shl    $0x4,%rax
fldt   -0x186a30(%rbp,%rax,1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xd5c(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    129f <main+0x13f>
mov    -0x493e78(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x493e90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x493e78,%rsp
lea    0xe88(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <feof@plt>
xor    %r13d,%r13d
test   %eax,%eax
jne    11d1 <main+0x71>
xor    %r13d,%r13d
lea    0xe6b(%rip),%r15
mov    %r13d,%eax
shl    $0x4,%rax
lea    (%rsp,%rax,1),%rdx
add    $0x10,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ecx,%r13d
mov    %r14,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     11a0 <main+0x40>
mov    %r14,%rdi
call   1030 <fclose@plt>
lea    0xe2f(%rip),%rdi
lea    0xe22(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %r13d,%r12d
test   %r13d,%r13d
je     1228 <main+0xc8>
lea    0x186a30(%rsp),%rbx
lea    0xe05(%rip),%r15
mov    %r12,%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <fscanf@plt>
add    $0x10,%rbx
add    $0xffffffffffffffff,%rbp
jne    1210 <main+0xb0>
mov    %r14,%rdi
call   1030 <fclose@plt>
lea    0x10(%rsp),%rsi
lea    0x186a30(%rsp),%rdx
lea    0x30d450(%rsp),%rcx
mov    %r13d,%edi
call   1080 <drive@plt>
lea    0xdc6(%rip),%rdi
lea    0xdcb(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
test   %r13d,%r13d
je     129e <main+0x13e>
shl    $0x4,%r12
xor    %ebp,%ebp
lea    0xdb4(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
fldt   0x30d450(%rsp,%rbp,1)
fstpt  (%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
add    $0x10,%rbp
cmp    %rbp,%r12
jne    1280 <main+0x120>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x493e78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"data.bin\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%Lf\00"
@.str.3 = [11 x i8] c"data_t.bin\00"
@.str.4 = [12 x i8] c"results.bin\00"
@.str.5 = [3 x i8] c"w+\00"
@.str.6 = [10 x i8] c"%33.33Lg\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100002 x x86_fp80]
%4 = alloca [100002 x x86_fp80]
%5 = alloca [100002 x x86_fp80]
%6 = alloca i32*
store i32 0, i32* %2
%7 = 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* %7, i32** %6
br label %8
8: ; preds = %23, %0
%9 = load i32*, i32** %6
%10 = call i32 @feof(i32* %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = load i32*, i32** %6
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %5, i64 0, i64 %16
%18 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), x86_fp80* %17)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %13
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %13
br label %8
24: ; preds = %8
%25 = load i32*, i32** %6
%26 = call i32 @fclose(i32* %25)
%27 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %6
store i32 0, i32* %1
br label %28
28: ; preds = %38, %24
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32*, i32** %6
%34 = load i32, i32* %1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %4, i64 0, i64 %35
%37 = call i32 @fscanf(i32* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), x86_fp80* %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %1
%40 = add nsw i32 %39, 1
store i32 %40, i32* %1
br label %28
41: ; preds = %28
%42 = load i32*, i32** %6
%43 = call i32 @fclose(i32* %42)
%44 = load i32, i32* %2
%45 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %5, i64 0, i64 0
%46 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %4, i64 0, i64 0
%47 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %3, i64 0, i64 0
%48 = call i32 @drive(i32 %44, x86_fp80* %45, x86_fp80* %46, x86_fp80* %47)
%49 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %49, i32** %6
store i32 0, i32* %1
br label %50
50: ; preds = %61, %41
%51 = load i32, i32* %1
%52 = load i32, i32* %2
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %64
54: ; preds = %50
%55 = load i32*, i32** %6
%56 = load i32, i32* %1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %3, i64 0, i64 %57
%59 = load x86_fp80, x86_fp80* %58
%60 = call i32 @fprintf(i32* %55, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), x86_fp80 %59)
br label %61
61: ; preds = %54
%62 = load i32, i32* %1
%63 = add nsw i32 %62, 1
store i32 %63, i32* %1
br label %50
64: ; preds = %50
%65 = load i32*, i32** %6
%66 = call i32 @fclose(i32* %65)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"data.bin\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%Lf\00"
@.str.3 = [11 x i8] c"data_t.bin\00"
@.str.4 = [12 x i8] c"results.bin\00"
@.str.5 = [3 x i8] c"w+\00"
@.str.6 = [10 x i8] c"%33.33Lg\0A\00"
define void @main() {
%1 = alloca [100002 x x86_fp80]
%2 = alloca [100002 x x86_fp80]
%3 = alloca [100002 x x86_fp80]
%4 = bitcast [100002 x x86_fp80]* %1 to i8*
%5 = bitcast [100002 x x86_fp80]* %2 to i8*
%6 = bitcast [100002 x x86_fp80]* %3 to i8*
%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 = call i32 @feof(i32* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %0, %10
%11 = phi i32 [ %17, %10 ], [ 0, %0 ]
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %3, i64 0, i64 %12
%14 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), x86_fp80* %13)
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %11, %16
%18 = call i32 @feof(i32* %7)
%19 = icmp eq i32 %18, 0
br i1 %19, label %10, label %20
20: ; preds = %10, %0
%21 = phi i32 [ 0, %0 ], [ %17, %10 ]
%22 = call i32 @fclose(i32* %7)
%23 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32 %21, 0
br i1 %24, label %33, label %25
25: ; preds = %20
%26 = zext i32 %21 to i64
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 0, %25 ], [ %31, %27 ]
%29 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %2, i64 0, i64 %28
%30 = call i32 @fscanf(i32* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), x86_fp80* %29)
%31 = add nuw nsw i64 %28, 1
%32 = icmp eq i64 %31, %26
br i1 %32, label %33, label %27
33: ; preds = %27, %20
%34 = call i32 @fclose(i32* %23)
%35 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %3, i64 0, i64 0
%36 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %2, i64 0, i64 0
%37 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %1, i64 0, i64 0
%38 = call i32 @drive(i32 %21, x86_fp80* %35, x86_fp80* %36, x86_fp80* %37)
%39 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br i1 %24, label %49, label %40
40: ; preds = %33
%41 = zext i32 %21 to i64
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ 0, %40 ], [ %47, %42 ]
%44 = getelementptr inbounds [100002 x x86_fp80], [100002 x x86_fp80]* %1, i64 0, i64 %43
%45 = load x86_fp80, x86_fp80* %44
%46 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), x86_fp80 %45)
%47 = add nuw nsw i64 %43, 1
%48 = icmp eq i64 %47, %41
br i1 %48, label %49, label %42
49: ; preds = %42, %33
%50 = call i32 @fclose(i32* %39)
ret void
}