#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 */
double log(double);
double log_gamma(double x) {
  double result, y, xnum, xden;
  int i;
  static double d1 = -5.772156649015328605195174e-1;
  static double p1[] = {
      4.945235359296727046734888e0, 2.018112620856775083915565e2,
      2.290838373831346393026739e3, 1.131967205903380828685045e4,
      2.855724635671635335736389e4, 3.848496228443793359990269e4,
      2.637748787624195437963534e4, 7.225813979700288197698961e3};
  static double q1[] = {
      6.748212550303777196073036e1, 1.113332393857199323513008e3,
      7.738757056935398733233834e3, 2.763987074403340708898585e4,
      5.499310206226157329794414e4, 6.161122180066002127833352e4,
      3.635127591501940507276287e4, 8.785536302431013170870835e3};
  static double d2 = 4.227843350984671393993777e-1;
  static double p2[] = {
      4.974607845568932035012064e0, 5.424138599891070494101986e2,
      1.550693864978364947665077e4, 1.847932904445632425417223e5,
      1.088204769468828767498470e6, 3.338152967987029735917223e6,
      5.106661678927352456275255e6, 3.074109054850539556250927e6};
  static double q2[] = {
      1.830328399370592604055942e2, 7.765049321445005871323047e3,
      1.331903827966074194402448e5, 1.136705821321969608938755e6,
      5.267964117437946917577538e6, 1.346701454311101692290052e7,
      1.782736530353274213975932e7, 9.533095591844353613395747e6};
  static double d4 = 1.791759469228055000094023e0;
  static double p4[] = {
      1.474502166059939948905062e4,  2.426813369486704502836312e6,
      1.214755574045093227939592e8,  2.663432449630976949898078e9,
      2.940378956634553899906876e10, 1.702665737765398868392998e11,
      4.926125793377430887588120e11, 5.606251856223951465078242e11};
  static double q4[] = {
      2.690530175870899333379843e3,  6.393885654300092398984238e5,
      4.135599930241388052042842e7,  1.120872109616147941376570e9,
      1.488613728678813811542398e10, 1.016803586272438228077304e11,
      3.417476345507377132798597e11, 4.463158187419713286462081e11};
  static double c[] = {-1.910444077728e-03,
                       8.4171387781295e-04,
                       -5.952379913043012e-04,
                       7.93650793500350248e-04,
                       -2.777777777777681622553e-03,
                       8.333333333333333331554247e-02,
                       5.7083835261e-03};
  static double a = 0.6796875;
  if ((x <= 0.5) || ((x > a) && (x <= 1.5))) {
    if (x <= 0.5) {
      result = -log(x);
      if (x + 1 == 1) {
        return result;
      }
    } else {
      result = 0;
      x = (x - 0.5) - 0.5;
    }
    xnum = 0;
    xden = 1;
    for (i = 0; i < 8; i++) {
      xnum = xnum * x + p1[i];
      xden = xden * x + q1[i];
    }
    result += x * (d1 + x * (xnum / xden));
  } else if ((x <= a) || ((x > 1.5) && (x <= 4))) {
    if (x <= a) {
      result = -log(x);
      x = (x - 0.5) - 0.5;
    } else {
      result = 0;
      x -= 2;
    }
    xnum = 0;
    xden = 1;
    for (i = 0; i < 8; i++) {
      xnum = xnum * x + p2[i];
      xden = xden * x + q2[i];
    }
    result += x * (d2 + x * (xnum / xden));
  } else if (x <= 12) {
    x -= 4;
    xnum = 0;
    xden = -1;
    for (i = 0; i < 8; i++) {
      xnum = xnum * x + p4[i];
      xden = xden * x + q4[i];
    }
    result = d4 + x * (xnum / xden);
  } else {
    y = log(x);
    result = x * (y - 1) - y * 0.5 + .9189385332046727417803297;
    x = 1 / x;
    y = x * x;
    xnum = c[6];
    for (i = 0; i < 6; i++) {
      xnum = xnum * y + c[i];
    }
    xnum *= x;
    result += xnum;
  }
  return result;
}


x86 assembly (clang, -O0):
<log_gamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    1156 <log_gamma+0x46>
movsd  -0x10(%rbp),%xmm0
ucomisd 0x30db(%rip),%xmm0
jbe    12af <log_gamma+0x19f>
movsd  0xebd(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     12af <log_gamma+0x19f>
movsd  0xea2(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11c8 <log_gamma+0xb8>
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe89(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11c3 <log_gamma+0xb3>
jp     11c3 <log_gamma+0xb3>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    160b <log_gamma+0x4fb>
jmp    11f2 <log_gamma+0xe2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe17(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe1e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    1274 <log_gamma+0x164>
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2e13(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2e2c(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120e <log_gamma+0xfe>
movsd  -0x10(%rbp),%xmm0
movsd  0x2daf(%rip),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
divsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1601 <log_gamma+0x4f1>
movsd  -0x10(%rbp),%xmm1
movsd  0x2f5c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    12f0 <log_gamma+0x1e0>
movsd  -0x10(%rbp),%xmm0
movsd  0xd35(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    142f <log_gamma+0x31f>
movsd  0xd2b(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     142f <log_gamma+0x31f>
movsd  -0x10(%rbp),%xmm1
movsd  0x2f1b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1354 <log_gamma+0x244>
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xcc6(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xcba(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1372 <log_gamma+0x262>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xccf(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xc9e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    13f4 <log_gamma+0x2e4>
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2d23(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2d3c(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    138e <log_gamma+0x27e>
movsd  -0x10(%rbp),%xmm0
movsd  0x2cbf(%rip),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
divsd  -0x30(%rbp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    15fc <log_gamma+0x4ec>
movsd  0xbe1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1503 <log_gamma+0x3f3>
movsd  -0x10(%rbp),%xmm0
movsd  0xbc1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xbc8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    14da <log_gamma+0x3ca>
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2ccd(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2ce6(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1474 <log_gamma+0x364>
movsd  0x2c6e(%rip),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
divsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    15f7 <log_gamma+0x4e7>
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xafc(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xad0(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xacc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xab3(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0x2c82(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x6,-0x34(%rbp)
jge    15d9 <log_gamma+0x4c9>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movslq -0x34(%rbp),%rcx
lea    0x2c27(%rip),%rax
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    159a <log_gamma+0x48a>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    15fc <log_gamma+0x4ec>
jmp    1601 <log_gamma+0x4f1>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_gamma>:
sub    $0x18,%rsp
movapd %xmm0,%xmm3
movsd  0xee0(%rip),%xmm0
ucomisd %xmm3,%xmm0
jae    115c <log_gamma+0x4c>
ucomisd 0xee2(%rip),%xmm3
jbe    122d <log_gamma+0x11d>
movsd  0xedc(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     122d <log_gamma+0x11d>
movsd  0xed2(%rip),%xmm0
addsd  %xmm0,%xmm3
addsd  %xmm0,%xmm3
xorpd  %xmm0,%xmm0
jmp    1194 <log_gamma+0x84>
movapd %xmm3,%xmm0
movapd %xmm3,(%rsp)
call   1030 <log@plt>
movapd (%rsp),%xmm3
xorpd  0xf59(%rip),%xmm0
movsd  0xe89(%rip),%xmm1
movapd %xmm3,%xmm2
addsd  %xmm1,%xmm2
ucomisd %xmm1,%xmm2
jne    1194 <log_gamma+0x84>
jp     1194 <log_gamma+0x84>
add    $0x18,%rsp
ret
xorpd  %xmm1,%xmm1
mulsd  %xmm3,%xmm1
addsd  0xf0c(%rip),%xmm1
movsd  0xf0c(%rip),%xmm2
addsd  %xmm3,%xmm2
unpcklpd %xmm2,%xmm1
movapd %xmm3,%xmm2
unpcklpd %xmm3,%xmm2
mulpd  %xmm2,%xmm1
addpd  0x1008(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0x100c(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0x1010(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0x1014(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0x1018(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0x101c(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0x1020(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
addsd  0xe98(%rip),%xmm1
jmp    1328 <log_gamma+0x218>
movsd  0xddb(%rip),%xmm0
ucomisd %xmm3,%xmm0
jae    1269 <log_gamma+0x159>
ucomisd 0xdd5(%rip),%xmm3
jbe    1339 <log_gamma+0x229>
movsd  0xdd7(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     1339 <log_gamma+0x229>
addsd  0xe2d(%rip),%xmm3
xorpd  %xmm0,%xmm0
jmp    1294 <log_gamma+0x184>
movapd %xmm3,%xmm0
movapd %xmm3,(%rsp)
call   1030 <log@plt>
movapd (%rsp),%xmm3
xorpd  0xe4c(%rip),%xmm0
movsd  0xd94(%rip),%xmm1
addsd  %xmm1,%xmm3
addsd  %xmm1,%xmm3
xorpd  %xmm1,%xmm1
mulsd  %xmm3,%xmm1
addsd  0xdf4(%rip),%xmm1
movsd  0xdf4(%rip),%xmm2
addsd  %xmm3,%xmm2
unpcklpd %xmm2,%xmm1
movapd %xmm3,%xmm2
unpcklpd %xmm3,%xmm2
mulpd  %xmm2,%xmm1
addpd  0xe98(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0xe9c(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0xea0(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0xea4(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0xea8(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0xeac(%rip),%xmm1
mulpd  %xmm2,%xmm1
addpd  0xeb0(%rip),%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
addsd  0xd80(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret
movsd  0xcef(%rip),%xmm0
ucomisd %xmm3,%xmm0
jae    13f7 <log_gamma+0x2e7>
movapd %xmm3,%xmm0
movapd %xmm3,(%rsp)
call   1030 <log@plt>
movapd %xmm0,%xmm1
movsd  0xcdb(%rip),%xmm2
addsd  %xmm0,%xmm2
mulsd  0xcaf(%rip),%xmm1
movsd  0xc8f(%rip),%xmm3
movapd (%rsp),%xmm5
divsd  %xmm5,%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm3,%xmm4
movsd  0xcbe(%rip),%xmm0
mulsd  %xmm4,%xmm0
addsd  0xcba(%rip),%xmm0
mulsd  %xmm4,%xmm0
addsd  0xcb6(%rip),%xmm0
mulsd  %xmm4,%xmm0
addsd  0xcb2(%rip),%xmm0
mulsd  %xmm4,%xmm0
addsd  0xcae(%rip),%xmm0
mulsd  %xmm5,%xmm2
mulsd  %xmm4,%xmm0
addsd  0xca6(%rip),%xmm0
addsd  %xmm1,%xmm2
mulsd  %xmm4,%xmm0
addsd  0xc9e(%rip),%xmm0
addsd  0xc9e(%rip),%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
add    $0x18,%rsp
ret
addsd  0xc39(%rip),%xmm3
movapd %xmm3,%xmm1
xorpd  %xmm0,%xmm0
movhpd 0xc31(%rip),%xmm0
unpcklpd %xmm3,%xmm1
mulpd  %xmm1,%xmm0
addpd  0xcc1(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xcc5(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xcc9(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xccd(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xcd1(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xcd5(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xcd9(%rip),%xmm0
mulpd  %xmm1,%xmm0
addpd  0xcdd(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
addsd  0xbbd(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@log_gamma.d1 = internal global double 0xBFE2788CFC6FB619
@log_gamma.p1 = internal global [8 x double] [double 0x4013C7EBC72CCF1B, double 0x406939F5DBE7CF07, double 0x40A1E5AD3F55B6E9, double 0x40C61BD60607C998, double 0x40DBE34FC44EF5F9, double 0x40E2CA9ECB08BBCC, double 0x40D9C25F395D45EC, double 0x40BC39D060F94058]
@log_gamma.q1 = internal global [8 x double] [double 0x4050DEDB24ED0759, double 0x409165545F0E2840, double 0x40BE3AC1CE7BBABF, double 0x40DAFDF7BA452EAB, double 0x40EADA2344181374, double 0x40EE156718FDB2A1, double 0x40E1BFE8D44BBC1A, double 0x40C128C4A58EDCFC]
@log_gamma.d2 = internal global double 0x3FDB0EE6072093CE
@log_gamma.p2 = internal global [8 x double] [double 0x4013E5FF995C9307, double 0x4080F34F95D372B4, double 0x40CE497825AD1596, double 0x41068ECA52D49963, double 0x41309ACCC4FBE8BF, double 0x414977D47BE6FFBE, double 0x41537AF96B738BB6, double 0x4147741E870557AD]
@log_gamma.q2 = internal global [8 x double] [double 0x4066E10D0656F583, double 0x40BE550CA054894B, double 0x410042330FF7AAEF, double 0x41315841D2422817, double 0x4154187F07841A73, double 0x4169AFB0D1612A5B, double 0x4171006254DB4526, double 0x41622ED4F2F06392]
@log_gamma.d4 = internal global double 0x3FFCAB0BFA2A2002
@log_gamma.p4 = internal global [8 x double] [double 0x40CCCC82C5C64704, double 0x414283DEAF4B5720, double 0x419CF647959E37B1, double 0x41E3D818203430F7, double 0x421B6268E3F961D5, double 0x4243D256DDE8451B, double 0x425CAC7FDC026F8F, double 0x426050FBAE6ACCA5]
@log_gamma.q4 = internal global [8 x double] [double 0x40A5050F73363548, double 0x4123833921800ACC, double 0x4183B856FA6B57F8, double 0x41D0B3C9AB676EF8, double 0x420BBA436E364E1B, double 0x4237AC9F24E33E6B, double 0x4253E46FC45DAF37, double 0x4259FA9FBBBD7E2A]
@log_gamma.c = internal global [7 x double] [double 0xBF5F4CFBB56B5FF7, double 0x3F4B94CEC9F537D1, double 0xBF438137DA5DD682, double 0x3F4A01A019EC73CF, double 0xBF66C16C16C16B39, double 0x3FB5555555555555, double 0x3F7761AC88EC07D7]
@log_gamma.a = internal global double 0x3FE5C00000000000
define double @log_gamma(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store double %0, double* %3
%9 = load double, double* %3
%10 = fcmp ole double %9, 5.000000e-01
br i1 %10, label %18, label %11
11: ; preds = %1
%12 = load double, double* %3
%13 = load double, double* @log_gamma.a
%14 = fcmp ogt double %12, %13
br i1 %14, label %15, label %67
15: ; preds = %11
%16 = load double, double* %3
%17 = fcmp ole double %16, 1.500000e+00
br i1 %17, label %18, label %67
18: ; preds = %15, %1
%19 = load double, double* %3
%20 = fcmp ole double %19, 5.000000e-01
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load double, double* %3
%23 = call double @log(double %22)
%24 = fneg double %23
store double %24, double* %4
%25 = load double, double* %3
%26 = fadd double %25, 1.000000e+00
%27 = fcmp oeq double %26, 1.000000e+00
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = load double, double* %4
store double %29, double* %2
br label %199
30: ; preds = %21
br label %35
31: ; preds = %18
store double 0.000000e+00, double* %4
%32 = load double, double* %3
%33 = fsub double %32, 5.000000e-01
%34 = fsub double %33, 5.000000e-01
store double %34, double* %3
br label %35
35: ; preds = %31, %30
store double 0.000000e+00, double* %6
store double 1.000000e+00, double* %7
store i32 0, i32* %8
br label %36
36: ; preds = %54, %35
%37 = load i32, i32* %8
%38 = icmp slt i32 %37, 8
br i1 %38, label %39, label %57
39: ; preds = %36
%40 = load double, double* %6
%41 = load double, double* %3
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [8 x double], [8 x double]* @log_gamma.p1, i64 0, i64 %43
%45 = load double, double* %44
%46 = call double @llvm.fmuladd.f64(double %40, double %41, double %45)
store double %46, double* %6
%47 = load double, double* %7
%48 = load double, double* %3
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [8 x double], [8 x double]* @log_gamma.q1, i64 0, i64 %50
%52 = load double, double* %51
%53 = call double @llvm.fmuladd.f64(double %47, double %48, double %52)
store double %53, double* %7
br label %54
54: ; preds = %39
%55 = load i32, i32* %8
%56 = add nsw i32 %55, 1
store i32 %56, i32* %8
br label %36
57: ; preds = %36
%58 = load double, double* %3
%59 = load double, double* @log_gamma.d1
%60 = load double, double* %3
%61 = load double, double* %6
%62 = load double, double* %7
%63 = fdiv double %61, %62
%64 = call double @llvm.fmuladd.f64(double %60, double %63, double %59)
%65 = load double, double* %4
%66 = call double @llvm.fmuladd.f64(double %58, double %64, double %65)
store double %66, double* %4
br label %197
67: ; preds = %15, %11
%68 = load double, double* %3
%69 = load double, double* @log_gamma.a
%70 = fcmp ole double %68, %69
br i1 %70, label %77, label %71
71: ; preds = %67
%72 = load double, double* %3
%73 = fcmp ogt double %72, 1.500000e+00
br i1 %73, label %74, label %123
74: ; preds = %71
%75 = load double, double* %3
%76 = fcmp ole double %75, 4.000000e+00
br i1 %76, label %77, label %123
77: ; preds = %74, %67
%78 = load double, double* %3
%79 = load double, double* @log_gamma.a
%80 = fcmp ole double %78, %79
br i1 %80, label %81, label %88
81: ; preds = %77
%82 = load double, double* %3
%83 = call double @log(double %82)
%84 = fneg double %83
store double %84, double* %4
%85 = load double, double* %3
%86 = fsub double %85, 5.000000e-01
%87 = fsub double %86, 5.000000e-01
store double %87, double* %3
br label %91
88: ; preds = %77
store double 0.000000e+00, double* %4
%89 = load double, double* %3
%90 = fsub double %89, 2.000000e+00
store double %90, double* %3
br label %91
91: ; preds = %88, %81
store double 0.000000e+00, double* %6
store double 1.000000e+00, double* %7
store i32 0, i32* %8
br label %92
92: ; preds = %110, %91
%93 = load i32, i32* %8
%94 = icmp slt i32 %93, 8
br i1 %94, label %95, label %113
95: ; preds = %92
%96 = load double, double* %6
%97 = load double, double* %3
%98 = load i32, i32* %8
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [8 x double], [8 x double]* @log_gamma.p2, i64 0, i64 %99
%101 = load double, double* %100
%102 = call double @llvm.fmuladd.f64(double %96, double %97, double %101)
store double %102, double* %6
%103 = load double, double* %7
%104 = load double, double* %3
%105 = load i32, i32* %8
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [8 x double], [8 x double]* @log_gamma.q2, i64 0, i64 %106
%108 = load double, double* %107
%109 = call double @llvm.fmuladd.f64(double %103, double %104, double %108)
store double %109, double* %7
br label %110
110: ; preds = %95
%111 = load i32, i32* %8
%112 = add nsw i32 %111, 1
store i32 %112, i32* %8
br label %92
113: ; preds = %92
%114 = load double, double* %3
%115 = load double, double* @log_gamma.d2
%116 = load double, double* %3
%117 = load double, double* %6
%118 = load double, double* %7
%119 = fdiv double %117, %118
%120 = call double @llvm.fmuladd.f64(double %116, double %119, double %115)
%121 = load double, double* %4
%122 = call double @llvm.fmuladd.f64(double %114, double %120, double %121)
store double %122, double* %4
br label %196
123: ; preds = %74, %71
%124 = load double, double* %3
%125 = fcmp ole double %124, 1.200000e+01
br i1 %125, label %126, label %157
126: ; preds = %123
%127 = load double, double* %3
%128 = fsub double %127, 4.000000e+00
store double %128, double* %3
store double 0.000000e+00, double* %6
store double -1.000000e+00, double* %7
store i32 0, i32* %8
br label %129
129: ; preds = %147, %126
%130 = load i32, i32* %8
%131 = icmp slt i32 %130, 8
br i1 %131, label %132, label %150
132: ; preds = %129
%133 = load double, double* %6
%134 = load double, double* %3
%135 = load i32, i32* %8
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [8 x double], [8 x double]* @log_gamma.p4, i64 0, i64 %136
%138 = load double, double* %137
%139 = call double @llvm.fmuladd.f64(double %133, double %134, double %138)
store double %139, double* %6
%140 = load double, double* %7
%141 = load double, double* %3
%142 = load i32, i32* %8
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [8 x double], [8 x double]* @log_gamma.q4, i64 0, i64 %143
%145 = load double, double* %144
%146 = call double @llvm.fmuladd.f64(double %140, double %141, double %145)
store double %146, double* %7
br label %147
147: ; preds = %132
%148 = load i32, i32* %8
%149 = add nsw i32 %148, 1
store i32 %149, i32* %8
br label %129
150: ; preds = %129
%151 = load double, double* @log_gamma.d4
%152 = load double, double* %3
%153 = load double, double* %6
%154 = load double, double* %7
%155 = fdiv double %153, %154
%156 = call double @llvm.fmuladd.f64(double %152, double %155, double %151)
store double %156, double* %4
br label %195
157: ; preds = %123
%158 = load double, double* %3
%159 = call double @log(double %158)
store double %159, double* %5
%160 = load double, double* %3
%161 = load double, double* %5
%162 = fsub double %161, 1.000000e+00
%163 = load double, double* %5
%164 = fmul double %163, 5.000000e-01
%165 = fneg double %164
%166 = call double @llvm.fmuladd.f64(double %160, double %162, double %165)
%167 = fadd double %166, 0x3FED67F1C864BEB5
store double %167, double* %4
%168 = load double, double* %3
%169 = fdiv double 1.000000e+00, %168
store double %169, double* %3
%170 = load double, double* %3
%171 = load double, double* %3
%172 = fmul double %170, %171
store double %172, double* %5
%173 = load double, double* getelementptr inbounds ([7 x double], [7 x double]* @log_gamma.c, i64 0, i64 6)
store double %173, double* %6
store i32 0, i32* %8
br label %174
174: ; preds = %185, %157
%175 = load i32, i32* %8
%176 = icmp slt i32 %175, 6
br i1 %176, label %177, label %188
177: ; preds = %174
%178 = load double, double* %6
%179 = load double, double* %5
%180 = load i32, i32* %8
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [7 x double], [7 x double]* @log_gamma.c, i64 0, i64 %181
%183 = load double, double* %182
%184 = call double @llvm.fmuladd.f64(double %178, double %179, double %183)
store double %184, double* %6
br label %185
185: ; preds = %177
%186 = load i32, i32* %8
%187 = add nsw i32 %186, 1
store i32 %187, i32* %8
br label %174
188: ; preds = %174
%189 = load double, double* %3
%190 = load double, double* %6
%191 = fmul double %190, %189
store double %191, double* %6
%192 = load double, double* %6
%193 = load double, double* %4
%194 = fadd double %193, %192
store double %194, double* %4
br label %195
195: ; preds = %188, %150
br label %196
196: ; preds = %195, %113
br label %197
197: ; preds = %196, %57
%198 = load double, double* %4
store double %198, double* %2
br label %199
199: ; preds = %197, %28
%200 = load double, double* %2
ret double %200
}

LLVM IR (-O2):
define double @log_gamma(double %0) {
%2 = fcmp ugt double %0, 5.000000e-01
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = fcmp ogt double %0, 0x3FE5C00000000000
%5 = fcmp ole double %0, 1.500000e+00
%6 = and i1 %4, %5
br i1 %6, label %12, label %36
7: ; preds = %1
%8 = tail call double @log(double %0)
%9 = fneg double %8
%10 = fadd double %0, 1.000000e+00
%11 = fcmp oeq double %10, 1.000000e+00
br i1 %11, label %104, label %15
12: ; preds = %3
%13 = fadd double %0, -5.000000e-01
%14 = fadd double %13, -5.000000e-01
br label %15
15: ; preds = %7, %12
%16 = phi double [ %0, %7 ], [ %14, %12 ]
%17 = phi double [ %9, %7 ], [ 0.000000e+00, %12 ]
%18 = tail call double @llvm.fmuladd.f64(double %16, double 0.000000e+00, double 0x4013C7EBC72CCF1B)
%19 = fadd double %16, 0x4050DEDB24ED0759
%20 = insertelement <2 x double> poison, double %18, i64 0
%21 = insertelement <2 x double> %20, double %19, i64 1
%22 = insertelement <2 x double> poison, double %16, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %23, <2 x double> <double 0x406939F5DBE7CF07, double 0x409165545F0E2840>)
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %23, <2 x double> <double 0x40A1E5AD3F55B6E9, double 0x40BE3AC1CE7BBABF>)
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %23, <2 x double> <double 0x40C61BD60607C998, double 0x40DAFDF7BA452EAB>)
%27 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %26, <2 x double> %23, <2 x double> <double 0x40DBE34FC44EF5F9, double 0x40EADA2344181374>)
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %27, <2 x double> %23, <2 x double> <double 0x40E2CA9ECB08BBCC, double 0x40EE156718FDB2A1>)
%29 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %23, <2 x double> <double 0x40D9C25F395D45EC, double 0x40E1BFE8D44BBC1A>)
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %29, <2 x double> %23, <2 x double> <double 0x40BC39D060F94058, double 0x40C128C4A58EDCFC>)
%31 = extractelement <2 x double> %30, i64 0
%32 = extractelement <2 x double> %30, i64 1
%33 = fdiv double %31, %32
%34 = tail call double @llvm.fmuladd.f64(double %16, double %33, double 0xBFE2788CFC6FB619)
%35 = tail call double @llvm.fmuladd.f64(double %16, double %34, double %17)
br label %104
36: ; preds = %3
%37 = fcmp ugt double %0, 0x3FE5C00000000000
br i1 %37, label %38, label %42
38: ; preds = %36
%39 = fcmp ogt double %0, 1.500000e+00
%40 = fcmp ole double %0, 4.000000e+00
%41 = and i1 %39, %40
br i1 %41, label %47, label %70
42: ; preds = %36
%43 = tail call double @log(double %0)
%44 = fneg double %43
%45 = fadd double %0, -5.000000e-01
%46 = fadd double %45, -5.000000e-01
br label %49
47: ; preds = %38
%48 = fadd double %0, -2.000000e+00
br label %49
49: ; preds = %47, %42
%50 = phi double [ %46, %42 ], [ %48, %47 ]
%51 = phi double [ %44, %42 ], [ 0.000000e+00, %47 ]
%52 = tail call double @llvm.fmuladd.f64(double %50, double 0.000000e+00, double 0x4013E5FF995C9307)
%53 = fadd double %50, 0x4066E10D0656F583
%54 = insertelement <2 x double> poison, double %52, i64 0
%55 = insertelement <2 x double> %54, double %53, i64 1
%56 = insertelement <2 x double> poison, double %50, i64 0
%57 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> zeroinitializer
%58 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %55, <2 x double> %57, <2 x double> <double 0x4080F34F95D372B4, double 0x40BE550CA054894B>)
%59 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %58, <2 x double> %57, <2 x double> <double 0x40CE497825AD1596, double 0x410042330FF7AAEF>)
%60 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %59, <2 x double> %57, <2 x double> <double 0x41068ECA52D49963, double 0x41315841D2422817>)
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %57, <2 x double> <double 0x41309ACCC4FBE8BF, double 0x4154187F07841A73>)
%62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %61, <2 x double> %57, <2 x double> <double 0x414977D47BE6FFBE, double 0x4169AFB0D1612A5B>)
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %57, <2 x double> <double 0x41537AF96B738BB6, double 0x4171006254DB4526>)
%64 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %63, <2 x double> %57, <2 x double> <double 0x4147741E870557AD, double 0x41622ED4F2F06392>)
%65 = extractelement <2 x double> %64, i64 0
%66 = extractelement <2 x double> %64, i64 1
%67 = fdiv double %65, %66
%68 = tail call double @llvm.fmuladd.f64(double %50, double %67, double 0x3FDB0EE6072093CE)
%69 = tail call double @llvm.fmuladd.f64(double %50, double %68, double %51)
br label %104
70: ; preds = %38
%71 = fcmp ugt double %0, 1.200000e+01
br i1 %71, label %88, label %72
72: ; preds = %70
%73 = fadd double %0, -4.000000e+00
%74 = insertelement <2 x double> poison, double %73, i64 0
%75 = shufflevector <2 x double> %74, <2 x double> poison, <2 x i32> zeroinitializer
%76 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %75, <2 x double> <double 0.000000e+00, double -1.000000e+00>, <2 x double> <double 0x40CCCC82C5C64704, double 0x40A5050F73363548>)
%77 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %76, <2 x double> %75, <2 x double> <double 0x414283DEAF4B5720, double 0x4123833921800ACC>)
%78 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %77, <2 x double> %75, <2 x double> <double 0x419CF647959E37B1, double 0x4183B856FA6B57F8>)
%79 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %78, <2 x double> %75, <2 x double> <double 0x41E3D818203430F7, double 0x41D0B3C9AB676EF8>)
%80 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %79, <2 x double> %75, <2 x double> <double 0x421B6268E3F961D5, double 0x420BBA436E364E1B>)
%81 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %80, <2 x double> %75, <2 x double> <double 0x4243D256DDE8451B, double 0x4237AC9F24E33E6B>)
%82 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %81, <2 x double> %75, <2 x double> <double 0x425CAC7FDC026F8F, double 0x4253E46FC45DAF37>)
%83 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %82, <2 x double> %75, <2 x double> <double 0x426050FBAE6ACCA5, double 0x4259FA9FBBBD7E2A>)
%84 = extractelement <2 x double> %83, i64 0
%85 = extractelement <2 x double> %83, i64 1
%86 = fdiv double %84, %85
%87 = tail call double @llvm.fmuladd.f64(double %73, double %86, double 0x3FFCAB0BFA2A2002)
br label %104
88: ; preds = %70
%89 = tail call double @log(double %0)
%90 = fadd double %89, -1.000000e+00
%91 = fmul double %89, -5.000000e-01
%92 = tail call double @llvm.fmuladd.f64(double %0, double %90, double %91)
%93 = fdiv double 1.000000e+00, %0
%94 = fmul double %93, %93
%95 = tail call double @llvm.fmuladd.f64(double %94, double 0x3F7761AC88EC07D7, double 0xBF5F4CFBB56B5FF7)
%96 = tail call double @llvm.fmuladd.f64(double %95, double %94, double 0x3F4B94CEC9F537D1)
%97 = tail call double @llvm.fmuladd.f64(double %96, double %94, double 0xBF438137DA5DD682)
%98 = tail call double @llvm.fmuladd.f64(double %97, double %94, double 0x3F4A01A019EC73CF)
%99 = tail call double @llvm.fmuladd.f64(double %98, double %94, double 0xBF66C16C16C16B39)
%100 = tail call double @llvm.fmuladd.f64(double %99, double %94, double 0x3FB5555555555555)
%101 = fadd double %92, 0x3FED67F1C864BEB5
%102 = fmul double %93, %100
%103 = fadd double %101, %102
br label %104
104: ; preds = %15, %72, %88, %49, %7
%105 = phi double [ %9, %7 ], [ %35, %15 ], [ %69, %49 ], [ %87, %72 ], [ %103, %88 ]
ret double %105
}