#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 erf(float);
float sqrt(float);
float fgamma_0f(float x) {
  float t;
  if (x < 0.0005)
    return 1.0 - x / 3.0 + x * x / 10.0;
  t = sqrt(x);
  return (float)0.8862269254528 * erf(t) / t;
}


x86 assembly (clang, -O0):
<fgamma_0f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1195 <fgamma_0f+0x75>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebf(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeab(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe89(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11c7 <fgamma_0f+0xa7>
movss  -0x8(%rbp),%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <erf@plt>
movaps %xmm0,%xmm1
movss  0xe67(%rip),%xmm0
mulss  %xmm1,%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgamma_0f>:
push   %rax
cvtss2sd %xmm0,%xmm1
movsd  0xed3(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1163 <fgamma_0f+0x43>
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movlhps %xmm0,%xmm1
divpd  0xeda(%rip),%xmm1
movsd  0xeba(%rip),%xmm0
subsd  %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
pop    %rax
ret
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1171 <fgamma_0f+0x51>
sqrtss %xmm0,%xmm0
jmp    1176 <fgamma_0f+0x56>
call   1030 <sqrt@plt>
movss  %xmm0,0x4(%rsp)
call   1040 <erf@plt>
mulss  0xe87(%rip),%xmm0
divss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fgamma_0f(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = fcmp olt double %6, 5.000000e-04
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fdiv double %10, 3.000000e+00
%12 = fsub double 1.000000e+00, %11
%13 = load float, float* %3
%14 = load float, float* %3
%15 = fmul float %13, %14
%16 = fpext float %15 to double
%17 = fdiv double %16, 1.000000e+01
%18 = fadd double %12, %17
%19 = fptrunc double %18 to float
store float %19, float* %2
br label %28
20: ; preds = %1
%21 = load float, float* %3
%22 = call float @sqrt(float %21)
store float %22, float* %4
%23 = load float, float* %4
%24 = call float @erf(float %23)
%25 = fmul float 0x3FEC5BF8A0000000, %24
%26 = load float, float* %4
%27 = fdiv float %25, %26
store float %27, float* %2
br label %28
28: ; preds = %20, %8
%29 = load float, float* %2
ret float %29
}

LLVM IR (-O2):
define float @fgamma_0f(float %0) {
%2 = fpext float %0 to double
%3 = fcmp olt double %2, 5.000000e-04
br i1 %3, label %4, label %15
4: ; preds = %1
%5 = fmul float %0, %0
%6 = fpext float %5 to double
%7 = insertelement <2 x double> poison, double %2, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = fdiv <2 x double> %8, <double 3.000000e+00, double 1.000000e+01>
%10 = extractelement <2 x double> %9, i64 0
%11 = fsub double 1.000000e+00, %10
%12 = extractelement <2 x double> %9, i64 1
%13 = fadd double %11, %12
%14 = fptrunc double %13 to float
br label %20
15: ; preds = %1
%16 = tail call float @sqrt(float %0)
%17 = tail call float @erf(float %16)
%18 = fmul float %17, 0x3FEC5BF8A0000000
%19 = fdiv float %18, %16
br label %20
20: ; preds = %15, %4
%21 = phi float [ %14, %4 ], [ %19, %15 ]
ret float %21
}