#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 */

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ close(int);
int open(char *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ write(int, double *, int);
int create_Data_file(void) {
  int i, nbVal;
  double tabDatan[20000], Inc;
  char *F_name;
  int fp;
  F_name = "datan";
  nbVal = 20000;
  Inc = 2 / nbVal;
  for (i = 0; i < nbVal; i++)
    tabDatan[i] = (Inc * i) - 1;
  fp = open(F_name, O_RDWR | O_CREAT | O_TRUNC, 0777);
  if (!fp) {
    printf("error opening file");
    close(fp);
    return -1;
  } else {
    for (i = 0; i < nbVal; i++) {
      write(fp, &tabDatan[i], sizeof(double));
    }
    close(fp);
    return 0;
  }
}


x86 assembly (clang, -O0):
<create_Data_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x27130,%rsp
lea    0xeb6(%rip),%rax
mov    %rax,-0x27120(%rbp)
movl   $0x4e20,-0xc(%rbp)
mov    $0x2,%eax
cltd
idivl  -0xc(%rbp)
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x27118(%rbp)
ff
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c0 <create_Data_file+0x80>
movsd  -0x27118(%rbp),%xmm0
ff
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm1
addsd  %xmm1,%xmm0
movslq -0x8(%rbp),%rax
movsd  %xmm0,-0x27110(%rbp,%rax,8)
fd ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117c <create_Data_file+0x3c>
mov    -0x27120(%rbp),%rdi
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
mov    0x2e21(%rip),%rax
or     (%rax),%esi
mov    0x2e10(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   1060 <open@plt>
mov    %eax,-0x27124(%rbp)
cmpl   $0x0,-0x27124(%rbp)
jne    1222 <create_Data_file+0xe2>
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
mov    -0x27124(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1277 <create_Data_file+0x137>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1265 <create_Data_file+0x125>
mov    -0x27124(%rbp),%edi
movslq -0x8(%rbp),%rax
lea    -0x27110(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1229 <create_Data_file+0xe9>
mov    -0x27124(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x27130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_Data_file>:
push   %rbp
push   %r14
push   %rbx
sub    $0x27100,%rsp
movdqa 0xead(%rip),%xmm0
mov    $0x6,%eax
movdqa 0xeaf(%rip),%xmm8
xorpd  %xmm2,%xmm2
movapd 0xeb3(%rip),%xmm3
movdqa 0xebb(%rip),%xmm4
movdqa 0xec3(%rip),%xmm5
movdqa 0xecb(%rip),%xmm6
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm0,%xmm7
cvtdq2pd %xmm0,%xmm1
paddd  %xmm8,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm2,%xmm1
addpd  %xmm3,%xmm1
mulpd  %xmm2,%xmm7
addpd  %xmm3,%xmm7
movapd %xmm1,-0x30(%rsp,%rax,8)
movapd %xmm7,-0x20(%rsp,%rax,8)
movdqa %xmm0,%xmm1
paddd  %xmm4,%xmm1
movdqa %xmm0,%xmm7
cvtdq2pd %xmm1,%xmm1
paddd  %xmm5,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm2,%xmm1
addpd  %xmm3,%xmm1
mulpd  %xmm2,%xmm7
addpd  %xmm3,%xmm7
movapd %xmm1,-0x10(%rsp,%rax,8)
movapd %xmm7,(%rsp,%rax,8)
paddd  %xmm6,%xmm0
add    $0x8,%rax
cmp    $0x4e26,%rax
jne    1190 <create_Data_file+0x50>
mov    0x2dd1(%rip),%rax
mov    0x2dea(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dd7(%rip),%rax
or     (%rax),%esi
lea    0xe3e(%rip),%rdi
mov    $0x1ff,%edx
call   1060 <open@plt>
test   %eax,%eax
je     125f <create_Data_file+0x11f>
mov    %eax,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%rsp,%rbx,1),%rsi
mov    %ebp,%edi
mov    $0x8,%edx
call   1030 <write@plt>
add    $0x8,%rbx
cmp    $0x27100,%rbx
jne    1240 <create_Data_file+0x100>
jmp    1273 <create_Data_file+0x133>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
xor    %ebp,%ebp
mov    %ebp,%edi
call   1050 <close@plt>
mov    %r14d,%eax
add    $0x27100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"datan\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.1 = [19 x i8] c"error opening file\00"
define i32 @create_Data_file() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20000 x double]
%5 = alloca double
%6 = alloca i8*
%7 = alloca i32
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 20000, i32* %3
%8 = load i32, i32* %3
%9 = sdiv i32 2, %8
%10 = sitofp i32 %9 to double
store double %10, double* %5
store i32 0, i32* %2
br label %11
11: ; preds = %23, %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load double, double* %5
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to double
%19 = call double @llvm.fmuladd.f64(double %16, double %18, double -1.000000e+00)
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [20000 x double], [20000 x double]* %4, i64 0, i64 %21
store double %19, double* %22
br label %23
23: ; preds = %15
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %11
26: ; preds = %11
%27 = load i8*, i8** %6
%28 = load i32, i32* @O_RDWR
%29 = load i32, i32* @O_CREAT
%30 = or i32 %28, %29
%31 = load i32, i32* @O_TRUNC
%32 = or i32 %30, %31
%33 = call i32 @open(i8* %27, i32 %32, i32 511)
store i32 %33, i32* %7
%34 = load i32, i32* %7
%35 = icmp ne i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %26
%37 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32, i32* %7
%39 = call i32 @close(i32 %38)
store i32 -1, i32* %1
br label %57
40: ; preds = %26
store i32 0, i32* %2
br label %41
41: ; preds = %51, %40
%42 = load i32, i32* %2
%43 = load i32, i32* %3
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %54
45: ; preds = %41
%46 = load i32, i32* %7
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [20000 x double], [20000 x double]* %4, i64 0, i64 %48
%50 = call i32 @write(i32 %46, double* %49, i32 8)
br label %51
51: ; preds = %45
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %41
54: ; preds = %41
%55 = load i32, i32* %7
%56 = call i32 @close(i32 %55)
store i32 0, i32* %1
br label %57
57: ; preds = %54, %36
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str = [6 x i8] c"datan\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.1 = [19 x i8] c"error opening file\00"
define i32 @create_Data_file() {
%1 = alloca [20000 x double]
%2 = bitcast [20000 x double]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %26, %3 ]
%5 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %27, %3 ]
%6 = add <2 x i32> %5, <i32 2, i32 2>
%7 = sitofp <2 x i32> %5 to <2 x double>
%8 = sitofp <2 x i32> %6 to <2 x double>
%9 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %7, <2 x double> zeroinitializer, <2 x double> <double -1.000000e+00, double -1.000000e+00>)
%10 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> zeroinitializer, <2 x double> <double -1.000000e+00, double -1.000000e+00>)
%11 = getelementptr inbounds [20000 x double], [20000 x double]* %1, i64 0, i64 %4
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> %9, <2 x double>* %12
%13 = getelementptr inbounds double, double* %11, i64 2
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> %10, <2 x double>* %14
%15 = or i64 %4, 4
%16 = add <2 x i32> %5, <i32 4, i32 4>
%17 = add <2 x i32> %5, <i32 6, i32 6>
%18 = sitofp <2 x i32> %16 to <2 x double>
%19 = sitofp <2 x i32> %17 to <2 x double>
%20 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %18, <2 x double> zeroinitializer, <2 x double> <double -1.000000e+00, double -1.000000e+00>)
%21 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %19, <2 x double> zeroinitializer, <2 x double> <double -1.000000e+00, double -1.000000e+00>)
%22 = getelementptr inbounds [20000 x double], [20000 x double]* %1, i64 0, i64 %15
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> %20, <2 x double>* %23
%24 = getelementptr inbounds double, double* %22, i64 2
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> %21, <2 x double>* %25
%26 = add nuw nsw i64 %4, 8
%27 = add <2 x i32> %5, <i32 8, i32 8>
%28 = icmp eq i64 %26, 20000
br i1 %28, label %29, label %3
29: ; preds = %3
%30 = load i32, i32* @O_RDWR
%31 = load i32, i32* @O_CREAT
%32 = or i32 %31, %30
%33 = load i32, i32* @O_TRUNC
%34 = or i32 %32, %33
%35 = tail call i32 @open(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %34, i32 511)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %29
%38 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %45
39: ; preds = %29, %39
%40 = phi i64 [ %43, %39 ], [ 0, %29 ]
%41 = getelementptr inbounds [20000 x double], [20000 x double]* %1, i64 0, i64 %40
%42 = call i32 @write(i32 %35, double* %41, i32 8)
%43 = add nuw nsw i64 %40, 1
%44 = icmp eq i64 %43, 20000
br i1 %44, label %45, label %39
45: ; preds = %39, %37
%46 = phi i32 [ 0, %37 ], [ %35, %39 ]
%47 = phi i32 [ -1, %37 ], [ 0, %39 ]
%48 = tail call i32 @close(i32 %46)
ret i32 %47
}