int main(void) {
  long i, ind;
  double val[101];
  double x[101];
  const char *filename = "erf_data.txt";
  printf("CSPL_Special_Erf1(0.0) = %lf\n", CSPL_Special_Erf1(0.0));
  printf("CSPL_Special_Erf1(-1.0) = %lf\n", CSPL_Special_Erf1(-1.0));
  printf("CSPL_Special_Erf1(1.0) = %lf\n", CSPL_Special_Erf1(1.0));
  printf("CSPL_Special_Erf1(3.0) = %lf\n", CSPL_Special_Erf1(3.0));
  printf("CSPL_Special_Erf1(-3.0) = %lf\n", CSPL_Special_Erf1(-3.0));
  ind = 0;
  for (i = -50; i < 51; i++) {
    x[ind] = (double)i / (50. / 3.);
    val[ind] = CSPL_Special_Erf1(x[ind]);
    ind++;
  }
  printf("\nDumping Answer and input file named %s\n", filename);
  CSPL_Array_filedump1d(filename, 101, 2, x, val);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x680,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xedf(%rip),%rax
mov    %rax,-0x678(%rbp)
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
mov    %eax,%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  0xea6(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
mov    %eax,%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  0xe7f(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
mov    %eax,%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  0xe58(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
mov    %eax,%esi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  0xe31(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
mov    %eax,%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x0,-0x18(%rbp)
movq   $0xffffffffffffffce,-0x10(%rbp)
ff
cmpq   $0x33,-0x10(%rbp)
jge    1262 <main+0x132>
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,-0x670(%rbp,%rax,8)
ff ff
mov    -0x18(%rbp),%rax
movsd  -0x670(%rbp,%rax,8),%xmm0
ff ff
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
cvtsi2sd %eax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,-0x340(%rbp,%rax,8)
ff ff
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11f6 <main+0xc6>
mov    -0x678(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x678(%rbp),%rdi
lea    -0x670(%rbp),%rcx
lea    -0x340(%rbp),%r8
mov    $0x65,%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1040 <CSPL_Array_filedump1d@plt>
xor    %eax,%eax
add    $0x680,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x660,%rsp
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
lea    0xeec(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xea6(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
lea    0xeeb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xe8f(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
lea    0xeeb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xe78(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
lea    0xeea(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  0xe61(%rip),%xmm0
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
lea    0xee9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffffffffffce,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
divsd  0xe30(%rip),%xmm0
movsd  %xmm0,0x190(%rsp,%rbx,8)
mov    $0x1,%al
call   1030 <CSPL_Special_Erf1@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x4c0(%rsp,%rbx,8)
lea    0x1(%rbx),%rax
cmp    $0x32,%rbx
mov    %rax,%rbx
jne    11e0 <main+0xb0>
lea    0xea9(%rip),%rdi
lea    0xdfd(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rcx
lea    0x330(%rsp),%r8
mov    %rbx,%rdi
mov    $0x65,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <CSPL_Array_filedump1d@plt>
xor    %eax,%eax
add    $0x660,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"erf_data.txt\00"
@.str.1 = [30 x i8] c"CSPL_Special_Erf1(0.0) = %lf\0A\00"
@.str.2 = [31 x i8] c"CSPL_Special_Erf1(-1.0) = %lf\0A\00"
@.str.3 = [30 x i8] c"CSPL_Special_Erf1(1.0) = %lf\0A\00"
@.str.4 = [30 x i8] c"CSPL_Special_Erf1(3.0) = %lf\0A\00"
@.str.5 = [31 x i8] c"CSPL_Special_Erf1(-3.0) = %lf\0A\00"
@.str.6 = [41 x i8] c"\0ADumping Answer and input file named %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca [101 x double]
%5 = alloca [101 x double]
%6 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double 0.000000e+00)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double -1.000000e+00)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double 1.000000e+00)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double 3.000000e+00)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double -3.000000e+00)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %15)
store i64 0, i64* %3
store i64 -50, i64* %2
br label %17
17: ; preds = %35, %0
%18 = load i64, i64* %2
%19 = icmp slt i64 %18, 51
br i1 %19, label %20, label %38
20: ; preds = %17
%21 = load i64, i64* %2
%22 = sitofp i64 %21 to double
%23 = fdiv double %22, 0x4030AAAAAAAAAAAB
%24 = load i64, i64* %3
%25 = getelementptr inbounds [101 x double], [101 x double]* %5, i64 0, i64 %24
store double %23, double* %25
%26 = load i64, i64* %3
%27 = getelementptr inbounds [101 x double], [101 x double]* %5, i64 0, i64 %26
%28 = load double, double* %27
%29 = call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double %28)
%30 = sitofp i32 %29 to double
%31 = load i64, i64* %3
%32 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 %31
store double %30, double* %32
%33 = load i64, i64* %3
%34 = add nsw i64 %33, 1
store i64 %34, i64* %3
br label %35
35: ; preds = %20
%36 = load i64, i64* %2
%37 = add nsw i64 %36, 1
store i64 %37, i64* %2
br label %17
38: ; preds = %17
%39 = load i8*, i8** %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %6
%42 = getelementptr inbounds [101 x double], [101 x double]* %5, i64 0, i64 0
%43 = getelementptr inbounds [101 x double], [101 x double]* %4, i64 0, i64 0
%44 = call i32 (i8*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @CSPL_Array_filedump1d to i32 (i8*, i32, i32, double*, double*, ...)*)(i8* %41, i32 101, i32 2, double* %42, double* %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"erf_data.txt\00"
@.str.1 = [30 x i8] c"CSPL_Special_Erf1(0.0) = %lf\0A\00"
@.str.2 = [31 x i8] c"CSPL_Special_Erf1(-1.0) = %lf\0A\00"
@.str.3 = [30 x i8] c"CSPL_Special_Erf1(1.0) = %lf\0A\00"
@.str.4 = [30 x i8] c"CSPL_Special_Erf1(3.0) = %lf\0A\00"
@.str.5 = [31 x i8] c"CSPL_Special_Erf1(-3.0) = %lf\0A\00"
@.str.6 = [41 x i8] c"\0ADumping Answer and input file named %s\0A\00"
define i32 @main() {
%1 = alloca [101 x double]
%2 = alloca [101 x double]
%3 = bitcast [101 x double]* %1 to i8*
%4 = bitcast [101 x double]* %2 to i8*
%5 = tail call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double 0.000000e+00)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double -1.000000e+00)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double 1.000000e+00)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double 3.000000e+00)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = tail call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double -3.000000e+00)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %0, %15
%16 = phi i64 [ -50, %0 ], [ %25, %15 ]
%17 = phi i64 [ 0, %0 ], [ %24, %15 ]
%18 = sitofp i64 %16 to double
%19 = fdiv double %18, 0x4030AAAAAAAAAAAB
%20 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %17
store double %19, double* %20
%21 = tail call i32 (double, ...) bitcast (i32 (...)* @CSPL_Special_Erf1 to i32 (double, ...)*)(double %19)
%22 = sitofp i32 %21 to double
%23 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 %17
store double %22, double* %23
%24 = add nuw nsw i64 %17, 1
%25 = add nsw i64 %16, 1
%26 = icmp eq i64 %24, 101
br i1 %26, label %27, label %15
27: ; preds = %15
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%29 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 0
%30 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 0, i64 0
%31 = call i32 (i8*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @CSPL_Array_filedump1d to i32 (i8*, i32, i32, double*, double*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 101, i32 2, double* %29, double* %30)
ret i32 0
}