#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 */
double exp(double);
double CSPL_Special_Erf1(double x) {
  double t;
  double tmp;
  double sign = (((x) > 0) ? 1 : ((x < 0) ? -1 : 0));
  double p = 0.3275911;
  double a1 = 0.254829592;
  double a2 = -0.284496736;
  double a3 = 1.421413741;
  double a4 = -1.453152027;
  double a5 = 1.061405429;
  t = 1.0 / (1.0 + p * (x * sign));
  tmp = (a1 * t + a2 * t * t + a3 * t * t * t + a4 * t * t * t * t +
         a5 * t * t * t * t * t);
  return (sign * (1 - tmp / exp(x * x)));
}


x86 assembly (clang, -O0):
<CSPL_Special_Erf1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    113c <CSPL_Special_Erf1+0x2c>
mov    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1155 <CSPL_Special_Erf1+0x45>
movsd  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
xor    %eax,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec7(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb2(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe9d(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe73(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe5e(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe36(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe2a(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x68(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm2
movsd  0xd5c(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSPL_Special_Erf1>:
sub    $0x28,%rsp
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
movsd  0xed7(%rip),%xmm2
andpd  %xmm1,%xmm2
cmpltsd %xmm0,%xmm3
movapd %xmm3,%xmm1
andnpd %xmm2,%xmm1
movsd  0xec6(%rip),%xmm4
andpd  %xmm4,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
mulsd  0xeb0(%rip),%xmm2
movapd %xmm4,%xmm1
addsd  %xmm4,%xmm2
divsd  %xmm2,%xmm1
movsd  0xea4(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe9c(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  0xe94(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  0xe84(%rip),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  0xe70(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm0,%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe07(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @CSPL_Special_Erf1(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %2
%12 = load double, double* %2
%13 = fcmp ogt double %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %1
br label %20
15: ; preds = %1
%16 = load double, double* %2
%17 = fcmp olt double %16, 0.000000e+00
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 -1, i32 0
br label %20
20: ; preds = %15, %14
%21 = phi i32 [ 1, %14 ], [ %19, %15 ]
%22 = sitofp i32 %21 to double
store double %22, double* %5
store double 0x3FD4F740A93D7B8C, double* %6
store double 0x3FD04F20C6EC5A7E, double* %7
store double 0xBFD23531CC3C1469, double* %8
store double 0x3FF6BE1C55BAE157, double* %9
store double 0xBFF7401C57014C39, double* %10
store double 0x3FF0FB844255A12D, double* %11
%23 = load double, double* %6
%24 = load double, double* %2
%25 = load double, double* %5
%26 = fmul double %24, %25
%27 = call double @llvm.fmuladd.f64(double %23, double %26, double 1.000000e+00)
%28 = fdiv double 1.000000e+00, %27
store double %28, double* %3
%29 = load double, double* %7
%30 = load double, double* %3
%31 = load double, double* %8
%32 = load double, double* %3
%33 = fmul double %31, %32
%34 = load double, double* %3
%35 = fmul double %33, %34
%36 = call double @llvm.fmuladd.f64(double %29, double %30, double %35)
%37 = load double, double* %9
%38 = load double, double* %3
%39 = fmul double %37, %38
%40 = load double, double* %3
%41 = fmul double %39, %40
%42 = load double, double* %3
%43 = call double @llvm.fmuladd.f64(double %41, double %42, double %36)
%44 = load double, double* %10
%45 = load double, double* %3
%46 = fmul double %44, %45
%47 = load double, double* %3
%48 = fmul double %46, %47
%49 = load double, double* %3
%50 = fmul double %48, %49
%51 = load double, double* %3
%52 = call double @llvm.fmuladd.f64(double %50, double %51, double %43)
%53 = load double, double* %11
%54 = load double, double* %3
%55 = fmul double %53, %54
%56 = load double, double* %3
%57 = fmul double %55, %56
%58 = load double, double* %3
%59 = fmul double %57, %58
%60 = load double, double* %3
%61 = fmul double %59, %60
%62 = load double, double* %3
%63 = call double @llvm.fmuladd.f64(double %61, double %62, double %52)
store double %63, double* %4
%64 = load double, double* %5
%65 = load double, double* %4
%66 = load double, double* %2
%67 = load double, double* %2
%68 = fmul double %66, %67
%69 = call double @exp(double %68)
%70 = fdiv double %65, %69
%71 = fsub double 1.000000e+00, %70
%72 = fmul double %64, %71
ret double %72
}

LLVM IR (-O2):
define double @CSPL_Special_Erf1(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = fcmp olt double %0, 0.000000e+00
%4 = sitofp i1 %3 to double
%5 = select i1 %2, double 1.000000e+00, double %4
%6 = fmul double %5, %0
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FD4F740A93D7B8C, double 1.000000e+00)
%8 = fdiv double 1.000000e+00, %7
%9 = fmul double %8, 0xBFD23531CC3C1469
%10 = fmul double %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %8, double 0x3FD04F20C6EC5A7E, double %10)
%12 = fmul double %8, 0x3FF6BE1C55BAE157
%13 = fmul double %8, %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double %8, double %11)
%15 = fmul double %8, 0xBFF7401C57014C39
%16 = fmul double %8, %15
%17 = fmul double %8, %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %8, double %14)
%19 = fmul double %8, 0x3FF0FB844255A12D
%20 = fmul double %8, %19
%21 = fmul double %8, %20
%22 = fmul double %8, %21
%23 = tail call double @llvm.fmuladd.f64(double %22, double %8, double %18)
%24 = fmul double %0, %0
%25 = tail call double @exp(double %24)
%26 = fdiv double %23, %25
%27 = fsub double 1.000000e+00, %26
%28 = fmul double %5, %27
ret double %28
}