#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 *, ...);
void print_to_file(double data_array[][8]) {
  int i;
  char file_name[17] = "hp_exact_data.dat";
  FILE *file;
  file = fopen(file_name, "w+");
  fprintf(file, "T\t<E>\t<E>/N\t<M>\t<M>/N\tC/N\tX/N\n");
  for (i = 0; i <= 1000; i++) {
    fprintf(file, "%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n", data_array[i][1],
            data_array[i][2], data_array[i][3], data_array[i][4],
            data_array[i][5], data_array[i][6], data_array[i][7],
            data_array[i][8]);
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<print_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb8(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jg     1255 <print_to_file+0x125>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x18(%rax),%xmm2
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x20(%rax),%xmm3
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x28(%rax),%xmm4
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x30(%rax),%xmm5
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x38(%rax),%xmm6
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
movsd  0x40(%rax),%xmm7
lea    0xdf3(%rip),%rsi
mov    $0x8,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1188 <print_to_file+0x58>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_to_file>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r12
movaps 0xeab(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x74,0x10(%rsp)
lea    0xeac(%rip),%rsi
mov    %rsp,%rdi
call   1050 <fopen@plt>
mov    %rax,%r14
lea    0xe9d(%rip),%rdi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    $0x40,%ebx
lea    0xe9e(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x38(%r12,%rbx,1),%xmm0
movsd  -0x30(%r12,%rbx,1),%xmm1
movsd  -0x28(%r12,%rbx,1),%xmm2
movsd  -0x20(%r12,%rbx,1),%xmm3
movsd  -0x18(%r12,%rbx,1),%xmm4
movsd  -0x10(%r12,%rbx,1),%xmm5
movsd  -0x8(%r12,%rbx,1),%xmm6
movsd  (%r12,%rbx,1),%xmm7
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x8,%al
call   1040 <fprintf@plt>
add    $0x40,%rbx
cmp    $0xfa80,%rbx
jne    11a0 <print_to_file+0x60>
mov    %r14,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@__const.print_to_file.file_name = [17 x i8] c"hp_exact_data.dat"
@.str = [3 x i8] c"w+\00"
@.str.1 = [31 x i8] c"T\09<E>\09<E>/N\09<M>\09<M>/N\09C/N\09X/N\0A\00"
@.str.2 = [25 x i8] c"%f\09%f\09%f\09%f\09%f\09%f\09%f\09%f\0A\00"
define void @print_to_file([8 x double]* %0) {
%2 = alloca [8 x double]*
%3 = alloca i32
%4 = alloca [17 x i8]
%5 = alloca i32*
store [8 x double]* %0, [8 x double]** %2
%6 = bitcast [17 x i8]* %4 to i8*
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %11
11: ; preds = %65, %1
%12 = load i32, i32* %3
%13 = icmp sle i32 %12, 1000
br i1 %13, label %14, label %68
14: ; preds = %11
%15 = load i32*, i32** %5
%16 = load [8 x double]*, [8 x double]** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [8 x double], [8 x double]* %16, i64 %18
%20 = getelementptr inbounds [8 x double], [8 x double]* %19, i64 0, i64 1
%21 = load double, double* %20
%22 = load [8 x double]*, [8 x double]** %2
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [8 x double], [8 x double]* %22, i64 %24
%26 = getelementptr inbounds [8 x double], [8 x double]* %25, i64 0, i64 2
%27 = load double, double* %26
%28 = load [8 x double]*, [8 x double]** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [8 x double], [8 x double]* %28, i64 %30
%32 = getelementptr inbounds [8 x double], [8 x double]* %31, i64 0, i64 3
%33 = load double, double* %32
%34 = load [8 x double]*, [8 x double]** %2
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [8 x double], [8 x double]* %34, i64 %36
%38 = getelementptr inbounds [8 x double], [8 x double]* %37, i64 0, i64 4
%39 = load double, double* %38
%40 = load [8 x double]*, [8 x double]** %2
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [8 x double], [8 x double]* %40, i64 %42
%44 = getelementptr inbounds [8 x double], [8 x double]* %43, i64 0, i64 5
%45 = load double, double* %44
%46 = load [8 x double]*, [8 x double]** %2
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [8 x double], [8 x double]* %46, i64 %48
%50 = getelementptr inbounds [8 x double], [8 x double]* %49, i64 0, i64 6
%51 = load double, double* %50
%52 = load [8 x double]*, [8 x double]** %2
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [8 x double], [8 x double]* %52, i64 %54
%56 = getelementptr inbounds [8 x double], [8 x double]* %55, i64 0, i64 7
%57 = load double, double* %56
%58 = load [8 x double]*, [8 x double]** %2
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [8 x double], [8 x double]* %58, i64 %60
%62 = getelementptr inbounds [8 x double], [8 x double]* %61, i64 0, i64 8
%63 = load double, double* %62
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %21, double %27, double %33, double %39, double %45, double %51, double %57, double %63)
br label %65
65: ; preds = %14
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %11
68: ; preds = %11
%69 = load i32*, i32** %5
%70 = call i32 @fclose(i32* %69)
ret void
}

LLVM IR (-O2):
@__const.print_to_file.file_name = [17 x i8] c"hp_exact_data.dat"
@.str = [3 x i8] c"w+\00"
@.str.1 = [31 x i8] c"T\09<E>\09<E>/N\09<M>\09<M>/N\09C/N\09X/N\0A\00"
@.str.2 = [25 x i8] c"%f\09%f\09%f\09%f\09%f\09%f\09%f\09%f\0A\00"
define void @print_to_file([8 x double]* nocapture %0) {
%2 = alloca [17 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%4 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i64 30, i64 1, i32* %4)
br label %6
6: ; preds = %1, %6
%7 = phi i64 [ 0, %1 ], [ %25, %6 ]
%8 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 2
%11 = load double, double* %10
%12 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 3
%13 = load double, double* %12
%14 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 4
%15 = load double, double* %14
%16 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 5
%17 = load double, double* %16
%18 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 6
%19 = load double, double* %18
%20 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 7
%21 = load double, double* %20
%22 = getelementptr inbounds [8 x double], [8 x double]* %0, i64 %7, i64 8
%23 = load double, double* %22
%24 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %9, double %11, double %13, double %15, double %17, double %19, double %21, double %23)
%25 = add nuw nsw i64 %7, 1
%26 = icmp eq i64 %25, 1001
br i1 %26, label %27, label %6
27: ; preds = %6
%28 = tail call i32 @fclose(i32* %4)
ret void
}