float gausin(p)
float p;
{
  float px, q, t, xn, xd;
  double log(), sqrt();
  px = p;
  if (p > .5)
    px = 1. - p;
  q = log(p);
  t = sqrt(-q - q);
  xn = 2.515517 + t * (.802853 + .010328 * t);
  xd = 1. + t * (1.432788 + t * (.189269 + .001308 * t));
  if (p < .5)
    return (xn / xd - t);
  return (t - xn / xd);
}


x86 assembly (clang, -O0):
<gausin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1174 <gausin+0x54>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea1(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <log@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <sqrt@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe62(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe5e(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xdfe(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xdfa(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdda(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdc2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd9c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1287 <gausin+0x167>
movss  -0x18(%rbp),%xmm0
divss  -0x1c(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    129f <gausin+0x17f>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
divss  -0x1c(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gausin>:
sub    $0x18,%rsp
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,(%rsp)
cvtss2sd %xmm0,%xmm0
call   1040 <log@plt>
cvtsd2ss %xmm0,%xmm1
movaps 0xec0(%rip),%xmm0
xorps  %xmm1,%xmm0
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1155 <gausin+0x35>
sqrtss %xmm0,%xmm0
jmp    115a <gausin+0x3a>
call   1030 <sqrtf@plt>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xed7(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xed3(%rip),%xmm2
unpcklpd %xmm1,%xmm1
movapd 0xe8f(%rip),%xmm3
unpcklpd %xmm2,%xmm3
mulpd  %xmm1,%xmm3
addpd  0xe8f(%rip),%xmm3
mulpd  %xmm1,%xmm3
addpd  0xe93(%rip),%xmm3
cvtpd2ps %xmm3,%xmm1
movapd %xmm1,%xmm2
shufps $0x55,%xmm1,%xmm2
divss  %xmm2,%xmm1
movaps %xmm1,%xmm2
subss  %xmm0,%xmm2
movaps (%rsp),%xmm3
cmpltss 0xe8f(%rip),%xmm3
subss  %xmm1,%xmm0
andps  %xmm3,%xmm2
andnps %xmm0,%xmm3
orps   %xmm2,%xmm3
movaps %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @gausin(double %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = fptrunc double %0 to float
store float %9, float* %3
%10 = load float, float* %3
store float %10, float* %4
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = fcmp ogt double %12, 5.000000e-01
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = fsub double 1.000000e+00, %16
%18 = fptrunc double %17 to float
store float %18, float* %4
br label %19
19: ; preds = %14, %1
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = call double @log(double %21)
%23 = fptrunc double %22 to float
store float %23, float* %5
%24 = load float, float* %5
%25 = fneg float %24
%26 = load float, float* %5
%27 = fsub float %25, %26
%28 = fpext float %27 to double
%29 = call double @sqrt(double %28)
%30 = fptrunc double %29 to float
store float %30, float* %6
%31 = load float, float* %6
%32 = fpext float %31 to double
%33 = load float, float* %6
%34 = fpext float %33 to double
%35 = call double @llvm.fmuladd.f64(double 1.032800e-02, double %34, double 8.028530e-01)
%36 = call double @llvm.fmuladd.f64(double %32, double %35, double 0x40041FC7607C419A)
%37 = fptrunc double %36 to float
store float %37, float* %7
%38 = load float, float* %6
%39 = fpext float %38 to double
%40 = load float, float* %6
%41 = fpext float %40 to double
%42 = load float, float* %6
%43 = fpext float %42 to double
%44 = call double @llvm.fmuladd.f64(double 1.308000e-03, double %43, double 1.892690e-01)
%45 = call double @llvm.fmuladd.f64(double %41, double %44, double 0x3FF6ECB31C219EB6)
%46 = call double @llvm.fmuladd.f64(double %39, double %45, double 1.000000e+00)
%47 = fptrunc double %46 to float
store float %47, float* %8
%48 = load float, float* %3
%49 = fpext float %48 to double
%50 = fcmp olt double %49, 5.000000e-01
br i1 %50, label %51, label %57
51: ; preds = %19
%52 = load float, float* %7
%53 = load float, float* %8
%54 = fdiv float %52, %53
%55 = load float, float* %6
%56 = fsub float %54, %55
store float %56, float* %2
br label %63
57: ; preds = %19
%58 = load float, float* %6
%59 = load float, float* %7
%60 = load float, float* %8
%61 = fdiv float %59, %60
%62 = fsub float %58, %61
store float %62, float* %2
br label %63
63: ; preds = %57, %51
%64 = load float, float* %2
ret float %64
}

LLVM IR (-O2):
define float @gausin(double %0) {
%2 = fptrunc double %0 to float
%3 = fpext float %2 to double
%4 = tail call double @log(double %3)
%5 = fptrunc double %4 to float
%6 = fneg float %5
%7 = fsub float %6, %5
%8 = tail call float @sqrtf(float %7)
%9 = fpext float %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.308000e-03, double 1.892690e-01)
%11 = insertelement <2 x double> poison, double %9, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = insertelement <2 x double> <double 1.032800e-02, double poison>, double %10, i64 1
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %13, <2 x double> <double 8.028530e-01, double 0x3FF6ECB31C219EB6>)
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %14, <2 x double> <double 0x40041FC7607C419A, double 1.000000e+00>)
%16 = fptrunc <2 x double> %15 to <2 x float>
%17 = fcmp olt float %2, 5.000000e-01
%18 = extractelement <2 x float> %16, i64 0
%19 = extractelement <2 x float> %16, i64 1
%20 = fdiv float %18, %19
%21 = fsub float %20, %8
%22 = fsub float %8, %20
%23 = select i1 %17, float %21, float %22
ret float %23
}