#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double,
                           double);
void writeFileOutput(double *t, double *x, double *v, int size,
                     char *filename_output) {
  int i, j;
  FILE *outputFile;
  outputFile = fopen(filename_output, "w");
  for (i = 0; i < size; i++) {
    fprintf(outputFile, "%f\t%.10f\t%.10f\t\n", t[i], x[i], v[i]);
  }
  fclose(outputFile);
}


x86 assembly (clang, -O0):
<writeFileOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b7 <writeFileOutput+0x87>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe5e(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1166 <writeFileOutput+0x36>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFileOutput>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeb3(%rip),%rsi
mov    %r8,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    119a <writeFileOutput+0x6a>
mov    %ebp,%ebp
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%r13,8),%xmm0
movsd  (%r15,%r13,8),%xmm1
movsd  (%r14,%r13,8),%xmm2
mov    %rbx,%rdi
lea    0xe76(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
jne    1170 <writeFileOutput+0x40>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [17 x i8] c"%f\09%.10f\09%.10f\09\0A\00"
define void @writeFileOutput(double* %0, double* %1, double* %2, i32 %3, i8* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%14 = load i8*, i8** %10
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %13
store i32 0, i32* %11
br label %16
16: ; preds = %38, %5
%17 = load i32, i32* %11
%18 = load i32, i32* %9
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %41
20: ; preds = %16
%21 = load i32*, i32** %13
%22 = load double*, double** %6
%23 = load i32, i32* %11
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %7
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = load double*, double** %8
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %26, double %31, double %36)
br label %38
38: ; preds = %20
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %16
41: ; preds = %16
%42 = load i32*, i32** %13
%43 = call i32 @fclose(i32* %42)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [17 x i8] c"%f\09%.10f\09%.10f\09\0A\00"
define void @writeFileOutput(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3, i8* nocapture %4) {
%6 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = zext i32 %3 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %19, %10 ]
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %1, i64 %11
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %2, i64 %11
%17 = load double, double* %16
%18 = tail call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %13, double %15, double %17)
%19 = add nuw nsw i64 %11, 1
%20 = icmp eq i64 %19, %9
br i1 %20, label %21, label %10
21: ; preds = %10, %5
%22 = tail call i32 @fclose(i32* %6)
ret void
}