#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 const fastlog2(float);
float fastinverseerf(float x) {
  static const float invk = 0.30004578719350504f;
  static const float a = 0.020287853348211326f;
  static const float b = 0.07236892874789555f;
  static const float c = 0.9913030456864257f;
  static const float d = 0.8059775923760193f;
  float xsq = x * x;
  return invk * fastlog2((1.0f + x) / (1.0f - x)) +
         x * (a - b * xsq) / (c - d * xsq);
}


x86 assembly (clang, -O0):
<fastinverseerf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xee0(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xed3(%rip),%xmm1
subss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <fastlog2@plt>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  0xeab(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xea3(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  -0x8(%rbp),%xmm2
movss  0xe82(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xe7a(%rip),%xmm3
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
movss  0xe62(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastinverseerf>:
push   %rax
movaps %xmm0,%xmm2
movss  %xmm0,(%rsp)
mulss  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xed5(%rip),%xmm1
movaps %xmm2,%xmm0
addss  %xmm1,%xmm0
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
call   1030 <fastlog2@plt>
movss  0xebd(%rip),%xmm1
movss  0x4(%rsp),%xmm2
mulss  %xmm2,%xmm1
addss  0xeaf(%rip),%xmm1
mulss  (%rsp),%xmm1
mulss  0xea6(%rip),%xmm2
addss  0xea2(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  0xe9a(%rip),%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@fastinverseerf.invk = internal constant float 0x3FD333F340000000
@fastinverseerf.a = internal constant float 0x3F94C656C0000000
@fastinverseerf.b = internal constant float 0x3FB286C520000000
@fastinverseerf.c = internal constant float 0x3FEFB8C120000000
@fastinverseerf.d = internal constant float 0x3FE9CA9180000000
define float @fastinverseerf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fmul float %4, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = fadd float 1.000000e+00, %7
%9 = load float, float* %2
%10 = fsub float 1.000000e+00, %9
%11 = fdiv float %8, %10
%12 = call float @fastlog2(float %11)
%13 = load float, float* %2
%14 = load float, float* %3
%15 = call float @llvm.fmuladd.f32(float 0xBFB286C520000000, float %14, float 0x3F94C656C0000000)
%16 = fmul float %13, %15
%17 = load float, float* %3
%18 = call float @llvm.fmuladd.f32(float 0xBFE9CA9180000000, float %17, float 0x3FEFB8C120000000)
%19 = fdiv float %16, %18
%20 = call float @llvm.fmuladd.f32(float 0x3FD333F340000000, float %12, float %19)
ret float %20
}

LLVM IR (-O2):
define float @fastinverseerf(float %0) {
%2 = fmul float %0, %0
%3 = fadd float %0, 1.000000e+00
%4 = fsub float 1.000000e+00, %0
%5 = fdiv float %3, %4
%6 = tail call float @fastlog2(float %5)
%7 = tail call float @llvm.fmuladd.f32(float %2, float 0xBFB286C520000000, float 0x3F94C656C0000000)
%8 = fmul float %7, %0
%9 = tail call float @llvm.fmuladd.f32(float %2, float 0xBFE9CA9180000000, float 0x3FEFB8C120000000)
%10 = fdiv float %8, %9
%11 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FD333F340000000, float %10)
ret float %11
}