#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 abs(float);
float exp(float);
float erf(float z) {
  float t = 1.0 / (1.0 + 0.5 * abs(z));
  float ans =
      1 -
      t * exp(-z * z - 1.26551223 +
              t * (1.00002368 +
                   t * (0.37409196 +
                        t * (0.09678418 +
                             t * (-0.18628806 +
                                  t * (0.27886807 +
                                       t * (-1.13520398 +
                                            t * (1.48851587 +
                                                 t * (-0.82215223 +
                                                      t * (0.17087277))))))))));
  if (z >= 0)
    return ans;
  else
    return -ans;
}


x86 assembly (clang, -O0):
<erf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  0xf1e(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xf0a(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xefe(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
subsd  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0xc(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
movss  -0xc(%rbp),%xmm5
cvtss2sd %xmm5,%xmm5
movss  -0xc(%rbp),%xmm6
cvtss2sd %xmm6,%xmm6
movss  -0xc(%rbp),%xmm7
cvtss2sd %xmm7,%xmm7
movss  -0xc(%rbp),%xmm8
cvtss2sd %xmm8,%xmm8
movss  -0xc(%rbp),%xmm9
cvtss2sd %xmm9,%xmm9
movsd  0xe4a(%rip),%xmm10
mulsd  %xmm10,%xmm9
movsd  0xe44(%rip),%xmm10
addsd  %xmm10,%xmm9
mulsd  %xmm9,%xmm8
movsd  0xe21(%rip),%xmm9
addsd  %xmm9,%xmm8
mulsd  %xmm8,%xmm7
movsd  0xe06(%rip),%xmm8
addsd  %xmm8,%xmm7
mulsd  %xmm7,%xmm6
movsd  0xded(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xdd5(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xdbd(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xda5(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd8d(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xd4f(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     12da <erf+0x1ba>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12f1 <erf+0x1d1>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erf>:
push   %rax
movss  %xmm0,(%rsp)
call   1030 <abs@plt>
mulsd  0xecd(%rip),%xmm0
movsd  0xecd(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xeb9(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xeb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xeb1(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xead(%rip),%xmm0
movss  (%rsp),%xmm2
mulsd  %xmm1,%xmm0
addsd  0xea4(%rip),%xmm0
mulss  %xmm2,%xmm2
mulsd  %xmm1,%xmm0
addsd  0xe9c(%rip),%xmm0
cvtss2sd %xmm2,%xmm2
mulsd  %xmm1,%xmm0
addsd  0xe94(%rip),%xmm0
movsd  0xe54(%rip),%xmm3
mulsd  %xmm1,%xmm0
addsd  0xe88(%rip),%xmm0
subsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm0
addsd  0xe80(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <exp@plt>
mulss  0x4(%rsp),%xmm0
movss  0xe69(%rip),%xmm1
subss  %xmm0,%xmm1
movaps 0xe6e(%rip),%xmm2
xorps  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cmpnless (%rsp),%xmm0
movaps %xmm0,%xmm3
andnps %xmm1,%xmm3
andps  %xmm2,%xmm0
orps   %xmm3,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @erf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
%6 = load float, float* %3
%7 = call double @abs(float %6)
%8 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %7, double 1.000000e+00)
%9 = fdiv double 1.000000e+00, %8
%10 = fptrunc double %9 to float
store float %10, float* %4
%11 = load float, float* %4
%12 = load float, float* %3
%13 = fneg float %12
%14 = load float, float* %3
%15 = fmul float %13, %14
%16 = fpext float %15 to double
%17 = fsub double %16, 0x3FF43F89C0889BC5
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = load float, float* %4
%27 = fpext float %26 to double
%28 = load float, float* %4
%29 = fpext float %28 to double
%30 = load float, float* %4
%31 = fpext float %30 to double
%32 = load float, float* %4
%33 = fpext float %32 to double
%34 = load float, float* %4
%35 = fpext float %34 to double
%36 = call double @llvm.fmuladd.f64(double %35, double 0x3FC5DF28AF76A5A4, double 0xBFEA4F123185DEFD)
%37 = call double @llvm.fmuladd.f64(double %33, double %36, double 0x3FF7D0F60453A1BE)
%38 = call double @llvm.fmuladd.f64(double %31, double %37, double 0xBFF229CBA6063980)
%39 = call double @llvm.fmuladd.f64(double %29, double %38, double 0x3FD1D8F976231CE6)
%40 = call double @llvm.fmuladd.f64(double %27, double %39, double 0xBFC7D84982AAEAA5)
%41 = call double @llvm.fmuladd.f64(double %25, double %40, double 0x3FB8C6D917DEC3F0)
%42 = call double @llvm.fmuladd.f64(double %23, double %41, double 0x3FD7F11F677960EA)
%43 = call double @llvm.fmuladd.f64(double %21, double %42, double 0x3FF00018D48D3588)
%44 = call double @llvm.fmuladd.f64(double %19, double %43, double %17)
%45 = fptrunc double %44 to float
%46 = call float @exp(float %45)
%47 = fneg float %11
%48 = call float @llvm.fmuladd.f32(float %47, float %46, float 1.000000e+00)
store float %48, float* %5
%49 = load float, float* %3
%50 = fcmp oge float %49, 0.000000e+00
br i1 %50, label %51, label %53
51: ; preds = %1
%52 = load float, float* %5
store float %52, float* %2
br label %56
53: ; preds = %1
%54 = load float, float* %5
%55 = fneg float %54
store float %55, float* %2
br label %56
56: ; preds = %53, %51
%57 = load float, float* %2
ret float %57
}

LLVM IR (-O2):
define float @erf(float %0) {
%2 = tail call double @abs(float %0)
%3 = tail call double @llvm.fmuladd.f64(double %2, double 5.000000e-01, double 1.000000e+00)
%4 = fdiv double 1.000000e+00, %3
%5 = fptrunc double %4 to float
%6 = fneg float %0
%7 = fmul float %6, %0
%8 = fpext float %7 to double
%9 = fadd double %8, 0xBFF43F89C0889BC5
%10 = fpext float %5 to double
%11 = tail call double @llvm.fmuladd.f64(double %10, double 0x3FC5DF28AF76A5A4, double 0xBFEA4F123185DEFD)
%12 = tail call double @llvm.fmuladd.f64(double %10, double %11, double 0x3FF7D0F60453A1BE)
%13 = tail call double @llvm.fmuladd.f64(double %10, double %12, double 0xBFF229CBA6063980)
%14 = tail call double @llvm.fmuladd.f64(double %10, double %13, double 0x3FD1D8F976231CE6)
%15 = tail call double @llvm.fmuladd.f64(double %10, double %14, double 0xBFC7D84982AAEAA5)
%16 = tail call double @llvm.fmuladd.f64(double %10, double %15, double 0x3FB8C6D917DEC3F0)
%17 = tail call double @llvm.fmuladd.f64(double %10, double %16, double 0x3FD7F11F677960EA)
%18 = tail call double @llvm.fmuladd.f64(double %10, double %17, double 0x3FF00018D48D3588)
%19 = tail call double @llvm.fmuladd.f64(double %10, double %18, double %9)
%20 = fptrunc double %19 to float
%21 = tail call float @exp(float %20)
%22 = fneg float %5
%23 = tail call float @llvm.fmuladd.f32(float %22, float %21, float 1.000000e+00)
%24 = fcmp ult float %0, 0.000000e+00
%25 = fneg float %23
%26 = select i1 %24, float %25, float %23
ret float %26
}