#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 *);
double sqrt(int);
int /*<<< orphan*/ write(int, double *, int);
int create_Data_file(void) {
  int i, nbVal;
  double tabD[20000], Inc;
  char *F_name;
  int fp;
  F_name = "gamma_inp.ref";
  nbVal = 20000;
  Inc = sqrt(3);
  for (i = 0; i < nbVal; i++)
    tabD[i] = (1 + Inc * i);
  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, &tabD[i], sizeof(double));
    }
    close(fp);
    return 0;
  }
  return (0);
}


x86 assembly (clang, -O0):
<create_Data_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x27130,%rsp
lea    0xea6(%rip),%rax
mov    %rax,-0x27120(%rbp)
movl   $0x4e20,-0xc(%rbp)
mov    $0x3,%edi
call   1070 <sqrt@plt>
movsd  %xmm0,-0x27118(%rbp)
ff
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cd <create_Data_file+0x7d>
movsd  -0x27118(%rbp),%xmm0
ff
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe52(%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    1189 <create_Data_file+0x39>
mov    -0x27120(%rbp),%rdi
mov    0x2dfd(%rip),%rax
mov    (%rax),%esi
mov    0x2e14(%rip),%rax
or     (%rax),%esi
mov    0x2e03(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   1060 <open@plt>
mov    %eax,-0x27124(%rbp)
cmpl   $0x0,-0x27124(%rbp)
jne    122f <create_Data_file+0xdf>
lea    0xe03(%rip),%rdi
call   1040 <printf@plt>
mov    -0x27124(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1284 <create_Data_file+0x134>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1272 <create_Data_file+0x122>
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    1236 <create_Data_file+0xe6>
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
mov    $0x3,%edi
call   1070 <sqrt@plt>
unpcklpd %xmm0,%xmm0
movdqa 0xe8f(%rip),%xmm1
mov    $0x6,%eax
movdqa 0xe91(%rip),%xmm8
movapd 0xe99(%rip),%xmm3
movdqa 0xea1(%rip),%xmm4
movdqa 0xea9(%rip),%xmm5
movdqa 0xeb1(%rip),%xmm6
nop
movdqa %xmm1,%xmm7
cvtdq2pd %xmm1,%xmm2
paddd  %xmm8,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm0,%xmm2
addpd  %xmm3,%xmm2
mulpd  %xmm0,%xmm7
addpd  %xmm3,%xmm7
movapd %xmm2,-0x30(%rsp,%rax,8)
movapd %xmm7,-0x20(%rsp,%rax,8)
movdqa %xmm1,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm1,%xmm7
cvtdq2pd %xmm2,%xmm2
paddd  %xmm5,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm0,%xmm2
addpd  %xmm3,%xmm2
mulpd  %xmm0,%xmm7
addpd  %xmm3,%xmm7
movapd %xmm2,-0x10(%rsp,%rax,8)
movapd %xmm7,(%rsp,%rax,8)
paddd  %xmm6,%xmm1
add    $0x8,%rax
cmp    $0x4e26,%rax
jne    11a0 <create_Data_file+0x50>
mov    0x2dc1(%rip),%rax
mov    0x2dda(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dc7(%rip),%rax
or     (%rax),%esi
lea    0xe2e(%rip),%rdi
mov    $0x1ff,%edx
call   1060 <open@plt>
test   %eax,%eax
je     126f <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    1250 <create_Data_file+0x100>
jmp    1283 <create_Data_file+0x133>
lea    0xdf8(%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 = [14 x i8] c"gamma_inp.ref\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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 20000, i32* %3
%8 = call double @sqrt(i32 3)
store double %8, double* %5
store i32 0, i32* %2
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %24
13: ; preds = %9
%14 = load double, double* %5
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to double
%17 = call double @llvm.fmuladd.f64(double %14, double %16, double 1.000000e+00)
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [20000 x double], [20000 x double]* %4, i64 0, i64 %19
store double %17, double* %20
br label %21
21: ; preds = %13
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %9
24: ; preds = %9
%25 = load i8*, i8** %6
%26 = load i32, i32* @O_RDWR
%27 = load i32, i32* @O_CREAT
%28 = or i32 %26, %27
%29 = load i32, i32* @O_TRUNC
%30 = or i32 %28, %29
%31 = call i32 @open(i8* %25, i32 %30, i32 511)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %24
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* %7
%37 = call i32 @close(i32 %36)
store i32 -1, i32* %1
br label %55
38: ; preds = %24
store i32 0, i32* %2
br label %39
39: ; preds = %49, %38
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %52
43: ; preds = %39
%44 = load i32, i32* %7
%45 = load i32, i32* %2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20000 x double], [20000 x double]* %4, i64 0, i64 %46
%48 = call i32 @write(i32 %44, double* %47, i32 8)
br label %49
49: ; preds = %43
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %39
52: ; preds = %39
%53 = load i32, i32* %7
%54 = call i32 @close(i32 %53)
store i32 0, i32* %1
br label %55
55: ; preds = %52, %34
%56 = load i32, i32* %1
ret i32 %56
}

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