#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 */
float exp(float);
float fabs(float);
float erff(float x) {
  float a1 = 0.254829592f;
  float a2 = -0.284496736f;
  float a3 = 1.421413741f;
  float a4 = -1.453152027f;
  float a5 = 1.061405429f;
  float p = 0.3275911f;
  int sign = 1;
  if (x < 0)
    sign = -1;
  x = fabs(x);
  float t = 1.0f / (1.0f + p * x);
  float y =
      1.0f - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-x * x);
  return sign * y;
}


x86 assembly (clang, -O0):
<erff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedf(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xece(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xebd(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xeac(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe9b(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe8a(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1196 <erff+0x76>
movl   $0xffffffff,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
mulss  %xmm0,%xmm1
movss  0xe5d(%rip),%xmm0
addss  %xmm0,%xmm1
movss  0xe51(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x4(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xdb4(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
cvtsi2ssl -0x20(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erff>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm1
andps  %xmm0,%xmm1
movaps %xmm0,%xmm2
movaps %xmm0,0x10(%rsp)
movss  0xef2(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0xeea(%rip),%xmm3
addss  %xmm3,%xmm0
divss  %xmm0,%xmm3
movss  %xmm3,0xc(%rsp)
movss  0xed8(%rip),%xmm0
mulss  %xmm3,%xmm0
addss  0xed0(%rip),%xmm0
mulss  %xmm3,%xmm0
addss  0xec8(%rip),%xmm0
mulss  %xmm3,%xmm0
addss  0xec0(%rip),%xmm0
mulss  %xmm3,%xmm0
addss  0xeb8(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
movaps %xmm2,%xmm0
orps   0xe80(%rip),%xmm0
mulss  %xmm1,%xmm0
call   1030 <exp@plt>
movss  0x8(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  0xe73(%rip),%xmm0
subss  %xmm1,%xmm0
movaps 0xe54(%rip),%xmm3
xorps  %xmm0,%xmm3
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
movaps 0x10(%rsp),%xmm1
cmpltss %xmm0,%xmm1
movaps %xmm1,%xmm0
andnps %xmm2,%xmm0
andps  %xmm3,%xmm1
orps   %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @erff(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca float
%11 = alloca float
store float %0, float* %2
store float 0x3FD04F20C0000000, float* %3
store float 0xBFD23531C0000000, float* %4
store float 0x3FF6BE1C60000000, float* %5
store float 0xBFF7401C60000000, float* %6
store float 0x3FF0FB8440000000, float* %7
store float 0x3FD4F740A0000000, float* %8
store i32 1, i32* %9
%12 = load float, float* %2
%13 = fcmp olt float %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 -1, i32* %9
br label %15
15: ; preds = %14, %1
%16 = load float, float* %2
%17 = call float @fabs(float %16)
store float %17, float* %2
%18 = load float, float* %8
%19 = load float, float* %2
%20 = call float @llvm.fmuladd.f32(float %18, float %19, float 1.000000e+00)
%21 = fdiv float 1.000000e+00, %20
store float %21, float* %10
%22 = load float, float* %7
%23 = load float, float* %10
%24 = load float, float* %6
%25 = call float @llvm.fmuladd.f32(float %22, float %23, float %24)
%26 = load float, float* %10
%27 = load float, float* %5
%28 = call float @llvm.fmuladd.f32(float %25, float %26, float %27)
%29 = load float, float* %10
%30 = load float, float* %4
%31 = call float @llvm.fmuladd.f32(float %28, float %29, float %30)
%32 = load float, float* %10
%33 = load float, float* %3
%34 = call float @llvm.fmuladd.f32(float %31, float %32, float %33)
%35 = load float, float* %10
%36 = fmul float %34, %35
%37 = load float, float* %2
%38 = fneg float %37
%39 = load float, float* %2
%40 = fmul float %38, %39
%41 = call float @exp(float %40)
%42 = fneg float %36
%43 = call float @llvm.fmuladd.f32(float %42, float %41, float 1.000000e+00)
store float %43, float* %11
%44 = load i32, i32* %9
%45 = sitofp i32 %44 to float
%46 = load float, float* %11
%47 = fmul float %45, %46
ret float %47
}

LLVM IR (-O2):
define float @erff(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = tail call float @llvm.fabs.f32(float %0)
%4 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FD4F740A0000000, float 1.000000e+00)
%5 = fdiv float 1.000000e+00, %4
%6 = tail call float @llvm.fmuladd.f32(float %5, float 0x3FF0FB8440000000, float 0xBFF7401C60000000)
%7 = tail call float @llvm.fmuladd.f32(float %6, float %5, float 0x3FF6BE1C60000000)
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 0xBFD23531C0000000)
%9 = tail call float @llvm.fmuladd.f32(float %8, float %5, float 0x3FD04F20C0000000)
%10 = fneg float %3
%11 = fmul float %3, %10
%12 = tail call float @exp(float %11)
%13 = fneg float %9
%14 = fmul float %5, %13
%15 = tail call float @llvm.fmuladd.f32(float %14, float %12, float 1.000000e+00)
%16 = fneg float %15
%17 = select i1 %2, float %16, float %15
ret float %17
}