#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 MINN(int /*<<< orphan*/, float);
float copysign(float, float);
int /*<<< orphan*/ fabsf(float);
float erf_fast_gpu(float x) {
  float y, xa = MINN(fabsf(x), 4.45f);
  y = ((((-0.001133515f * xa + 0.00830125f) * xa - 0.003218f) * xa -
        0.06928657f) *
           xa -
       0.14108256f) *
          xa +
      1.f;
  y = y * y;
  y = y * y;
  y = y * y;
  y = 1.f - y;
  y = copysign(y, x);
  return y;
}


x86 assembly (clang, -O0):
<erf_fast_gpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabsf@plt>
mov    %eax,%edi
movss  0xec7(%rip),%xmm0
call   1050 <MINN@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xea8(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xea0(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe83(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe6a(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe51(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe38(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xdfa(%rip),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1040 <copysign@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erf_fast_gpu>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <fabsf@plt>
movss  0xebc(%rip),%xmm0
mov    %eax,%edi
call   1050 <MINN@plt>
movss  0xeb1(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xea9(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xea1(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xe99(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xe91(%rip),%xmm1
mulss  %xmm0,%xmm1
movss  0xe89(%rip),%xmm0
addss  %xmm0,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm1,%xmm1
subss  %xmm1,%xmm0
movss  0x4(%rsp),%xmm1
pop    %rax
jmp    1040 <copysign@plt>

LLVM IR (-O0):
define float @erf_fast_gpu(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = call i32 @fabsf(float %5)
%7 = call float @MINN(i32 %6, float 0x4011CCCCC0000000)
store float %7, float* %4
%8 = load float, float* %4
%9 = call float @llvm.fmuladd.f32(float 0xBF52924E80000000, float %8, float 0x3F81003EE0000000)
%10 = load float, float* %4
%11 = call float @llvm.fmuladd.f32(float %9, float %10, float 0xBF6A5CA2A0000000)
%12 = load float, float* %4
%13 = call float @llvm.fmuladd.f32(float %11, float %12, float 0xBFB1BCC3C0000000)
%14 = load float, float* %4
%15 = call float @llvm.fmuladd.f32(float %13, float %14, float 0xBFC20EFE40000000)
%16 = load float, float* %4
%17 = call float @llvm.fmuladd.f32(float %15, float %16, float 1.000000e+00)
store float %17, float* %3
%18 = load float, float* %3
%19 = load float, float* %3
%20 = fmul float %18, %19
store float %20, float* %3
%21 = load float, float* %3
%22 = load float, float* %3
%23 = fmul float %21, %22
store float %23, float* %3
%24 = load float, float* %3
%25 = load float, float* %3
%26 = fmul float %24, %25
store float %26, float* %3
%27 = load float, float* %3
%28 = fsub float 1.000000e+00, %27
store float %28, float* %3
%29 = load float, float* %3
%30 = load float, float* %2
%31 = call float @copysign(float %29, float %30)
store float %31, float* %3
%32 = load float, float* %3
ret float %32
}

LLVM IR (-O2):
define float @erf_fast_gpu(float %0) {
%2 = tail call i32 @fabsf(float %0)
%3 = tail call float @MINN(i32 %2, float 0x4011CCCCC0000000)
%4 = tail call float @llvm.fmuladd.f32(float %3, float 0xBF52924E80000000, float 0x3F81003EE0000000)
%5 = tail call float @llvm.fmuladd.f32(float %4, float %3, float 0xBF6A5CA2A0000000)
%6 = tail call float @llvm.fmuladd.f32(float %5, float %3, float 0xBFB1BCC3C0000000)
%7 = tail call float @llvm.fmuladd.f32(float %6, float %3, float 0xBFC20EFE40000000)
%8 = tail call float @llvm.fmuladd.f32(float %7, float %3, float 1.000000e+00)
%9 = fmul float %8, %8
%10 = fmul float %9, %9
%11 = fmul float %10, %10
%12 = fsub float 1.000000e+00, %11
%13 = tail call float @copysign(float %12, float %0)
ret float %13
}