#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 exp(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 tabD[20000], tabD_pow[20000], Inc, Inc_pow;
  char *F_name, *F_name_pow;
  int fp, fp2;
  F_name = "pow_inp.ref";
  F_name_pow = "1pow_inp.ref";
  nbVal = 20000;
  Inc = exp(1);
  Inc_pow = exp(1) / 100;
  for (i = 0; i < nbVal; i++) {
    tabD_pow[nbVal - (i + 1)] = Inc_pow * i + Inc_pow;
    tabD[i] = (Inc * i) + Inc;
  }
  fp = open(F_name, O_RDWR | O_CREAT | O_TRUNC, 0777);
  fp2 = open(F_name_pow, O_RDWR | O_CREAT | O_TRUNC, 0777);
  if (!fp || !fp2) {
    printf("error opening file");
    close(fp);
    close(fp2);
    return -1;
  } else {
    for (i = 0; i < nbVal; i++) {
      write(fp, &tabD[i], sizeof(double));
      write(fp2, &tabD_pow[i], sizeof(double));
    }
    close(fp);
    close(fp2);
    return 0;
  }
}


x86 assembly (clang, -O0):
<create_Data_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e240,%rsp
lea    0xe9f(%rip),%rax
mov    %rax,-0x4e228(%rbp)
lea    0xe90(%rip),%rax
mov    %rax,-0x4e230(%rbp)
movl   $0x4e20,-0xc(%rbp)
mov    $0x1,%edi
call   1060 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x4e218(%rbp)
ff
mov    $0x1,%edi
call   1060 <exp@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x4e220(%rbp)
ff
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1230 <create_Data_file+0xe0>
movsd  -0x4e220(%rbp),%xmm0
ff
cvtsi2sdl -0x8(%rbp),%xmm2
movsd  -0x4e220(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    %ecx,%eax
cltq
movsd  %xmm0,-0x4e210(%rbp,%rax,8)
fb ff
movsd  -0x4e218(%rbp),%xmm0
ff
cvtsi2sdl -0x8(%rbp),%xmm2
movsd  -0x4e218(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
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    11b9 <create_Data_file+0x69>
mov    -0x4e228(%rbp),%rdi
mov    0x2d9a(%rip),%rax
mov    (%rax),%esi
mov    0x2db1(%rip),%rax
or     (%rax),%esi
mov    0x2da0(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   1070 <open@plt>
mov    %eax,-0x4e234(%rbp)
mov    -0x4e230(%rbp),%rdi
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
mov    0x2d7f(%rip),%rax
or     (%rax),%esi
mov    0x2d6e(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   1070 <open@plt>
mov    %eax,-0x4e238(%rbp)
cmpl   $0x0,-0x4e234(%rbp)
je     12ae <create_Data_file+0x15e>
cmpl   $0x0,-0x4e238(%rbp)
jne    12dc <create_Data_file+0x18c>
lea    0xd58(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4e234(%rbp),%edi
call   1050 <close@plt>
mov    -0x4e238(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    135e <create_Data_file+0x20e>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1341 <create_Data_file+0x1f1>
mov    -0x4e234(%rbp),%edi
movslq -0x8(%rbp),%rax
lea    -0x27110(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    -0x4e238(%rbp),%edi
movslq -0x8(%rbp),%rax
lea    -0x4e210(%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    12e3 <create_Data_file+0x193>
mov    -0x4e234(%rbp),%edi
call   1050 <close@plt>
mov    -0x4e238(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4e240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_Data_file>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x4e218,%rsp
mov    $0x1,%edi
call   1060 <exp@plt>
cvtsi2sd %eax,%xmm0
movapd %xmm0,(%rsp)
mov    $0x1,%edi
call   1060 <exp@plt>
movapd (%rsp),%xmm2
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
unpcklpd %xmm0,%xmm0
unpcklpd %xmm2,%xmm2
lea    0x27120(%rsp),%rax
movdqa 0xe4c(%rip),%xmm1
mov    $0x4e1c,%ecx
movdqa 0xe4e(%rip),%xmm8
movdqa 0xe56(%rip),%xmm3
nopw   0x0(%rax,%rax,1)
movdqa %xmm1,%xmm4
paddd  %xmm8,%xmm4
cvtdq2pd %xmm1,%xmm5
cvtdq2pd %xmm4,%xmm4
movapd %xmm0,%xmm6
mulpd  %xmm5,%xmm6
addpd  %xmm0,%xmm6
movapd %xmm0,%xmm7
mulpd  %xmm4,%xmm7
addpd  %xmm0,%xmm7
shufpd $0x1,%xmm6,%xmm6
movapd %xmm6,0x20(%rsp,%rcx,8)
shufpd $0x1,%xmm7,%xmm7
movapd %xmm7,0x10(%rsp,%rcx,8)
mulpd  %xmm2,%xmm5
addpd  %xmm2,%xmm5
mulpd  %xmm2,%xmm4
addpd  %xmm2,%xmm4
movapd %xmm5,-0x10(%rax)
movapd %xmm4,(%rax)
paddd  %xmm3,%xmm1
add    $0xfffffffffffffffc,%rcx
add    $0x20,%rax
cmp    $0xfffffffffffffffc,%rcx
jne    11d0 <create_Data_file+0x80>
mov    0x2d97(%rip),%r14
mov    0x2db0(%rip),%rbp
mov    0x0(%rbp),%esi
or     (%r14),%esi
mov    0x2d9b(%rip),%rbx
or     (%rbx),%esi
lea    0xdd3(%rip),%rdi
mov    $0x1ff,%edx
call   1070 <open@plt>
mov    %eax,%r15d
mov    0x0(%rbp),%esi
or     (%r14),%esi
or     (%rbx),%esi
lea    0xdb6(%rip),%rdi
mov    $0x1ff,%edx
call   1070 <open@plt>
mov    %eax,%ebp
test   %r15d,%r15d
je     12db <create_Data_file+0x18b>
test   %ebp,%ebp
je     12db <create_Data_file+0x18b>
xor    %r14d,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rsp,%rbx,1),%rsi
add    $0x27110,%rsi
mov    %r15d,%edi
mov    $0x8,%edx
call   1030 <write@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %ebp,%edi
mov    $0x8,%edx
call   1030 <write@plt>
add    $0x8,%rbx
cmp    $0x27100,%rbx
jne    12a0 <create_Data_file+0x150>
jmp    12ed <create_Data_file+0x19d>
lea    0xd5b(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%r14d
mov    %r15d,%edi
call   1050 <close@plt>
mov    %ebp,%edi
call   1050 <close@plt>
mov    %r14d,%eax
add    $0x4e218,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"pow_inp.ref\00"
@.str.1 = [13 x i8] c"1pow_inp.ref\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.2 = [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 [20000 x double]
%6 = alloca double
%7 = alloca double
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %9
store i32 20000, i32* %3
%12 = call i32 @exp(i32 1)
%13 = sitofp i32 %12 to double
store double %13, double* %6
%14 = call i32 @exp(i32 1)
%15 = sdiv i32 %14, 100
%16 = sitofp i32 %15 to double
store double %16, double* %7
store i32 0, i32* %2
br label %17
17: ; preds = %41, %0
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %44
21: ; preds = %17
%22 = load double, double* %7
%23 = load i32, i32* %2
%24 = sitofp i32 %23 to double
%25 = load double, double* %7
%26 = call double @llvm.fmuladd.f64(double %22, double %24, double %25)
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
%30 = sub nsw i32 %27, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [20000 x double], [20000 x double]* %5, i64 0, i64 %31
store double %26, double* %32
%33 = load double, double* %6
%34 = load i32, i32* %2
%35 = sitofp i32 %34 to double
%36 = load double, double* %6
%37 = call double @llvm.fmuladd.f64(double %33, double %35, double %36)
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [20000 x double], [20000 x double]* %4, i64 0, i64 %39
store double %37, double* %40
br label %41
41: ; preds = %21
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %17
44: ; preds = %17
%45 = load i8*, i8** %8
%46 = load i32, i32* @O_RDWR
%47 = load i32, i32* @O_CREAT
%48 = or i32 %46, %47
%49 = load i32, i32* @O_TRUNC
%50 = or i32 %48, %49
%51 = call i32 @open(i8* %45, i32 %50, i32 511)
store i32 %51, i32* %10
%52 = load i8*, i8** %9
%53 = load i32, i32* @O_RDWR
%54 = load i32, i32* @O_CREAT
%55 = or i32 %53, %54
%56 = load i32, i32* @O_TRUNC
%57 = or i32 %55, %56
%58 = call i32 @open(i8* %52, i32 %57, i32 511)
store i32 %58, i32* %11
%59 = load i32, i32* %10
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %44
%62 = load i32, i32* %11
%63 = icmp ne i32 %62, 0
br i1 %63, label %70, label %64
64: ; preds = %61, %44
%65 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%66 = load i32, i32* %10
%67 = call i32 @close(i32 %66)
%68 = load i32, i32* %11
%69 = call i32 @close(i32 %68)
store i32 -1, i32* %1
br label %94
70: ; preds = %61
store i32 0, i32* %2
br label %71
71: ; preds = %86, %70
%72 = load i32, i32* %2
%73 = load i32, i32* %3
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %89
75: ; preds = %71
%76 = load i32, i32* %10
%77 = load i32, i32* %2
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [20000 x double], [20000 x double]* %4, i64 0, i64 %78
%80 = call i32 @write(i32 %76, double* %79, i32 8)
%81 = load i32, i32* %11
%82 = load i32, i32* %2
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [20000 x double], [20000 x double]* %5, i64 0, i64 %83
%85 = call i32 @write(i32 %81, double* %84, i32 8)
br label %86
86: ; preds = %75
%87 = load i32, i32* %2
%88 = add nsw i32 %87, 1
store i32 %88, i32* %2
br label %71
89: ; preds = %71
%90 = load i32, i32* %10
%91 = call i32 @close(i32 %90)
%92 = load i32, i32* %11
%93 = call i32 @close(i32 %92)
store i32 0, i32* %1
br label %94
94: ; preds = %89, %64
%95 = load i32, i32* %1
ret i32 %95
}

LLVM IR (-O2):
@.str = [12 x i8] c"pow_inp.ref\00"
@.str.1 = [13 x i8] c"1pow_inp.ref\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.2 = [19 x i8] c"error opening file\00"
define i32 @create_Data_file() {
%1 = alloca [20000 x double]
%2 = alloca [20000 x double]
%3 = bitcast [20000 x double]* %1 to i8*
%4 = bitcast [20000 x double]* %2 to i8*
%5 = tail call i32 @exp(i32 1)
%6 = sitofp i32 %5 to double
%7 = tail call i32 @exp(i32 1)
%8 = sdiv i32 %7, 100
%9 = sitofp i32 %8 to double
%10 = insertelement <2 x double> poison, double %9, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = insertelement <2 x double> poison, double %9, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %6, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = insertelement <2 x double> poison, double %6, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
br label %18
18: ; preds = %18, %0
%19 = phi i64 [ 0, %0 ], [ %40, %18 ]
%20 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %41, %18 ]
%21 = add <2 x i32> %20, <i32 2, i32 2>
%22 = sitofp <2 x i32> %20 to <2 x double>
%23 = sitofp <2 x i32> %21 to <2 x double>
%24 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %22, <2 x double> %11)
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %23, <2 x double> %13)
%26 = sub nuw nsw i64 19999, %19
%27 = getelementptr inbounds [20000 x double], [20000 x double]* %2, i64 0, i64 %26
%28 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%29 = getelementptr inbounds double, double* %27, i64 -1
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> %28, <2 x double>* %30
%31 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%32 = getelementptr inbounds double, double* %27, i64 -3
%33 = bitcast double* %32 to <2 x double>*
store <2 x double> %31, <2 x double>* %33
%34 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %22, <2 x double> %15)
%35 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %17, <2 x double> %23, <2 x double> %17)
%36 = getelementptr inbounds [20000 x double], [20000 x double]* %1, i64 0, i64 %19
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> %34, <2 x double>* %37
%38 = getelementptr inbounds double, double* %36, i64 2
%39 = bitcast double* %38 to <2 x double>*
store <2 x double> %35, <2 x double>* %39
%40 = add nuw i64 %19, 4
%41 = add <2 x i32> %20, <i32 4, i32 4>
%42 = icmp eq i64 %40, 20000
br i1 %42, label %43, label %18
43: ; preds = %18
%44 = load i32, i32* @O_RDWR
%45 = load i32, i32* @O_CREAT
%46 = or i32 %45, %44
%47 = load i32, i32* @O_TRUNC
%48 = or i32 %46, %47
%49 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %48, i32 511)
%50 = load i32, i32* @O_RDWR
%51 = load i32, i32* @O_CREAT
%52 = or i32 %51, %50
%53 = load i32, i32* @O_TRUNC
%54 = or i32 %52, %53
%55 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %54, i32 511)
%56 = icmp ne i32 %49, 0
%57 = icmp ne i32 %55, 0
%58 = and i1 %56, %57
br i1 %58, label %61, label %59
59: ; preds = %43
%60 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %69
61: ; preds = %43, %61
%62 = phi i64 [ %67, %61 ], [ 0, %43 ]
%63 = getelementptr inbounds [20000 x double], [20000 x double]* %1, i64 0, i64 %62
%64 = call i32 @write(i32 %49, double* %63, i32 8)
%65 = getelementptr inbounds [20000 x double], [20000 x double]* %2, i64 0, i64 %62
%66 = call i32 @write(i32 %55, double* %65, i32 8)
%67 = add nuw nsw i64 %62, 1
%68 = icmp eq i64 %67, 20000
br i1 %68, label %69, label %61
69: ; preds = %61, %59
%70 = phi i32 [ -1, %59 ], [ 0, %61 ]
%71 = tail call i32 @close(i32 %49)
%72 = tail call i32 @close(i32 %55)
ret i32 %70
}