double bigpos_loggamma(x)
double x;
{
  static double p[4] = {
      0.12398282342474941538685913e+00, 0.67082783834332134961461700e+00,
      0.64507302912892202513890000e+00, 0.66662907040200752600000000e-01};
  static double q[4] = {
      0.14877938810969929846815600e+01, 0.80995271894897557472821400e+01,
      0.79966911236636441947720000e+01, 0.10000000000000000000000000e+01};
  double rsq = 1.0 / (x * x);
  extern double log();
  return (x - 0.5) * log(x) - x + 0.91893853320467274178032973640561763 +
         POLYNOM3(rsq, p) / (x * POLYNOM3(rsq, q));
}


x86 assembly (clang, -O0):
<bigpos_loggamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xed1(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe64(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0x2e8f(%rip),%rdi
mov    $0x1,%al
call   1030 <POLYNOM3@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0x2e89(%rip),%rdi
mov    $0x1,%al
call   1030 <POLYNOM3@plt>
movsd  -0x28(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
cvtsi2sd %eax,%xmm3
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bigpos_loggamma>:
sub    $0x28,%rsp
movsd  %xmm0,0x18(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xec6(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  0xebc(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1040 <log@plt>
mulsd  0x8(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
addsd  0xea1(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x2ec4(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <POLYNOM3@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x2ec3(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <POLYNOM3@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm0
divsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@bigpos_loggamma.p = internal global [4 x double] [double 0x3FBFBD569BE002B8, double 0x3FE5776BF15DCA43, double 0x3FE4A47031747DF5, double 0x3FB110D1FD980D22]
@bigpos_loggamma.q = internal global [4 x double] [double 0x3FF7CE00F4E8020A, double 0x402032F53A4FD7B4, double 0x401FFC9C99116537, double 1.000000e+00]
define double @bigpos_loggamma(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = fdiv double 1.000000e+00, %6
store double %7, double* %3
%8 = load double, double* %2
%9 = fsub double %8, 5.000000e-01
%10 = load double, double* %2
%11 = call double @log(double %10)
%12 = load double, double* %2
%13 = fneg double %12
%14 = call double @llvm.fmuladd.f64(double %9, double %11, double %13)
%15 = fadd double %14, 0x3FED67F1C864BEB5
%16 = load double, double* %3
%17 = call i32 (double, double*, ...) bitcast (i32 (...)* @POLYNOM3 to i32 (double, double*, ...)*)(double %16, double* getelementptr inbounds ([4 x double], [4 x double]* @bigpos_loggamma.p, i64 0, i64 0))
%18 = sitofp i32 %17 to double
%19 = load double, double* %2
%20 = load double, double* %3
%21 = call i32 (double, double*, ...) bitcast (i32 (...)* @POLYNOM3 to i32 (double, double*, ...)*)(double %20, double* getelementptr inbounds ([4 x double], [4 x double]* @bigpos_loggamma.q, i64 0, i64 0))
%22 = sitofp i32 %21 to double
%23 = fmul double %19, %22
%24 = fdiv double %18, %23
%25 = fadd double %15, %24
ret double %25
}

LLVM IR (-O2):
@bigpos_loggamma.p = internal global [4 x double] [double 0x3FBFBD569BE002B8, double 0x3FE5776BF15DCA43, double 0x3FE4A47031747DF5, double 0x3FB110D1FD980D22]
@bigpos_loggamma.q = internal global [4 x double] [double 0x3FF7CE00F4E8020A, double 0x402032F53A4FD7B4, double 0x401FFC9C99116537, double 1.000000e+00]
define double @bigpos_loggamma(double %0) {
%2 = fmul double %0, %0
%3 = fdiv double 1.000000e+00, %2
%4 = fadd double %0, -5.000000e-01
%5 = tail call double @log(double %0)
%6 = fneg double %0
%7 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %6)
%8 = fadd double %7, 0x3FED67F1C864BEB5
%9 = tail call i32 (double, double*, ...) bitcast (i32 (...)* @POLYNOM3 to i32 (double, double*, ...)*)(double %3, double* getelementptr inbounds ([4 x double], [4 x double]* @bigpos_loggamma.p, i64 0, i64 0))
%10 = sitofp i32 %9 to double
%11 = tail call i32 (double, double*, ...) bitcast (i32 (...)* @POLYNOM3 to i32 (double, double*, ...)*)(double %3, double* getelementptr inbounds ([4 x double], [4 x double]* @bigpos_loggamma.q, i64 0, i64 0))
%12 = sitofp i32 %11 to double
%13 = fmul double %12, %0
%14 = fdiv double %10, %13
%15 = fadd double %8, %14
ret double %15
}