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


x86 assembly (clang, -O0):
<erff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xee6(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xeb3(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
mov    %al,-0x5(%rbp)
movss  -0x24(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe64(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe58(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x4(%rbp),%xmm0
call   1030 <expf@plt>
movss  -0x34(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xdae(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erff>:
sub    $0x18,%rsp
movaps %xmm0,%xmm1
movaps %xmm0,(%rsp)
movaps 0xede(%rip),%xmm0
xorps  %xmm1,%xmm0
mulss  %xmm1,%xmm0
call   1030 <expf@plt>
xorps  %xmm1,%xmm1
movaps (%rsp),%xmm2
ucomiss %xmm1,%xmm2
mulss  0xee0(%rip),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xeec(%rip),%xmm1
addsd  %xmm1,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
xorps  %xmm2,%xmm2
cvtsd2ss %xmm3,%xmm2
movss  0xebd(%rip),%xmm3
mulss  %xmm2,%xmm3
addss  0xeb5(%rip),%xmm3
mulss  %xmm2,%xmm3
addss  0xead(%rip),%xmm3
mulss  %xmm2,%xmm3
addss  0xea5(%rip),%xmm3
mulss  %xmm2,%xmm3
addss  0xe9d(%rip),%xmm3
mulss  %xmm2,%xmm3
mulss  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
subsd  %xmm0,%xmm1
jae    11b4 <erff+0xa4>
xorpd  0xe5c(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define float @erff(float %0) {
%2 = fcmp oge float %0, 0.000000e+00
%3 = fmul float %0, 0x3FD4F740A0000000
%4 = fpext float %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double 1.000000e+00, %5
%7 = fptrunc double %6 to float
%8 = tail call float @llvm.fmuladd.f32(float %7, float 0x3FF0FB8440000000, float 0xBFF7401C60000000)
%9 = tail call float @llvm.fmuladd.f32(float %8, float %7, float 0x3FF6BE1C60000000)
%10 = tail call float @llvm.fmuladd.f32(float %9, float %7, float 0xBFD23531C0000000)
%11 = tail call float @llvm.fmuladd.f32(float %10, float %7, float 0x3FD04F20C0000000)
%12 = fmul float %11, %7
%13 = fneg float %0
%14 = fmul float %13, %0
%15 = tail call float @expf(float %14)
%16 = fmul float %12, %15
%17 = fpext float %16 to double
%18 = fsub double 1.000000e+00, %17
%19 = fneg double %18
%20 = select i1 %2, double %18, double %19
%21 = fptrunc double %20 to float
ret float %21
}