#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 */
int eps(double);
int /*<<< orphan*/ exit(int);
double exp(scalar_t__);
scalar_t__ gamma_log(double);
double log(double);
double normf(double);
int /*<<< orphan*/ printf(char *);
double sqrt(double);
double pgamma(double x, double a) {
  double oup, ct, d, s, la;
  double a0, a1, b0, b1, g, g0, delta, fact;
  if (a < 0.) {
    printf("a must be non-negative");
    exit(1);
  }
  la = 2.0e20;
  if (a > la) {
    x = la - 1.0 / 3.0 + sqrt(la / a) * (x - (a - 1.0 / 3.0));
    a = la;
    if (x < 0.0) {
      x = 0.0;
    }
  }
  if (a != 0 && x != 0 && x < a + 1) {
    ct = a;
    d = 1.;
    s = 1.;
    while (normf(d) >= 100 * eps(s)) {
      ct += 1.0;
      d = x * d / ct;
      s += d;
    }
    oup = s * exp(-x + a * log(x) - gamma_log(a + 1));
    if (x > 0 && oup > 1.) {
      oup = 1.0;
    }
  }
  if (a != 0 && x >= a + 1) {
    a0 = 1.0;
    a1 = x;
    b0 = 0.0;
    b1 = 1.0;
    fact = 1.0 / a1;
    ct = 1.0;
    g = b1 * fact;
    g0 = b0;
    delta = normf(g - g0);
    while (delta >= 100 * eps(normf(g))) {
      g0 = g;
      d = ct - a;
      a0 = (a1 + a0 * d) * fact;
      b0 = (b1 + b0 * d) * fact;
      s = ct * fact;
      a1 = x * a0 + s * a1;
      b1 = x * b0 + s * b1;
      fact = 1.0 / a1;
      ct += 1.0;
      g = b1 * fact;
      delta = normf(g - g0);
    }
    oup = 1.0 - g * exp(-x + a * log(x) - gamma_log(a));
  }
  if (x == 0) {
    oup = 0.0;
  }
  if (a == 0) {
    oup = 1.0;
  }
  return oup;
}


x86 assembly (clang, -O0):
<pgamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11b9 <pgamma+0x39>
lea    0xe6e(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
movsd  0xe3f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    124c <pgamma+0xcc>
movsd  -0x38(%rbp),%xmm0
movsd  0xe25(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x38(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1090 <sqrt@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  0xdf6(%rip),%xmm4
subsd  %xmm4,%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1247 <pgamma+0xc7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    124c <pgamma+0xcc>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1269 <pgamma+0xe9>
jp     1269 <pgamma+0xe9>
jmp    141c <pgamma+0x29c>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1286 <pgamma+0x106>
jp     1286 <pgamma+0x106>
jmp    141c <pgamma+0x29c>
movsd  -0x8(%rbp),%xmm1
movsd  0xd7d(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    141c <pgamma+0x29c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xd5c(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd4f(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <normf@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <eps@plt>
movsd  -0x88(%rbp),%xmm0
ff
imul   $0x64,%eax,%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
jb     1335 <pgamma+0x1b5>
movsd  0xd0d(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12c6 <pgamma+0x146>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1080 <log@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xc68(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1040 <gamma_log@plt>
movsd  -0x98(%rbp),%xmm0
ff
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1417 <pgamma+0x297>
movsd  -0x18(%rbp),%xmm0
movsd  0xc10(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1417 <pgamma+0x297>
movsd  0xbfe(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    141c <pgamma+0x29c>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1439 <pgamma+0x2b9>
jp     1439 <pgamma+0x2b9>
jmp    16c1 <pgamma+0x541>
movsd  -0x8(%rbp),%xmm0
movsd  0xbca(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     16c1 <pgamma+0x541>
movsd  0xbb3(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xb94(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xb87(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xb75(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
call   1050 <normf@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
call   1050 <normf@plt>
call   1030 <eps@plt>
movsd  -0xb0(%rbp),%xmm0
ff
imul   $0x64,%eax,%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
jb     15fa <pgamma+0x47a>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xa5a(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xa48(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
call   1050 <normf@plt>
movsd  %xmm0,-0x70(%rbp)
jmp    14cd <pgamma+0x34d>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1080 <log@plt>
movsd  -0xd0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1040 <gamma_log@plt>
movsd  -0xc0(%rbp),%xmm0
ff
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x958(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    16e1 <pgamma+0x561>
jp     16e1 <pgamma+0x561>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1706 <pgamma+0x586>
jp     1706 <pgamma+0x586>
movsd  0x90f(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgamma>:
push   %rbx
sub    $0x90,%rsp
movapd %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     15da <pgamma+0x45a>
ucomisd 0xe5e(%rip),%xmm1
jbe    11c4 <pgamma+0x44>
movsd  0xe54(%rip),%xmm2
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jb     11ca <pgamma+0x4a>
sqrtsd %xmm0,%xmm0
jmp    11f1 <pgamma+0x71>
movapd %xmm1,%xmm2
jmp    1212 <pgamma+0x92>
movsd  %xmm4,(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1090 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm4
xorpd  %xmm3,%xmm3
movsd  0xe0f(%rip),%xmm2
addsd  0xe0f(%rip),%xmm1
subsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm2,%xmm4
ucomisd %xmm4,%xmm3
jbe    1212 <pgamma+0x92>
mov    $0x1,%bl
jmp    13b6 <pgamma+0x236>
movapd %xmm4,%xmm3
xorpd  %xmm0,%xmm0
movapd %xmm2,%xmm1
cmpneqsd %xmm0,%xmm1
movq   %xmm1,%rbx
and    $0x1,%ebx
ucomisd %xmm0,%xmm2
jne    1237 <pgamma+0xb7>
jnp    13b6 <pgamma+0x236>
ucomisd %xmm0,%xmm3
jne    1243 <pgamma+0xc3>
jnp    13b6 <pgamma+0x236>
movsd  0xdc5(%rip),%xmm0
addsd  %xmm2,%xmm0
mov    $0x1,%bl
ucomisd %xmm3,%xmm0
jbe    13b6 <pgamma+0x236>
movsd  %xmm0,0x50(%rsp)
movapd %xmm2,0x30(%rsp)
movsd  0xda1(%rip),%xmm0
movapd %xmm3,0x20(%rsp)
call   1050 <normf@plt>
movsd  %xmm0,(%rsp)
movsd  0xd89(%rip),%xmm0
call   1030 <eps@plt>
imul   $0x64,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  0xd69(%rip),%xmm0
movsd  %xmm0,(%rsp)
jb     1337 <pgamma+0x1b7>
movsd  0xd56(%rip),%xmm1
movsd  %xmm1,(%rsp)
movapd 0x30(%rsp),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
addsd  0xd38(%rip),%xmm0
movsd  %xmm0,0x48(%rsp)
mulsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
call   1050 <normf@plt>
movsd  %xmm0,0x60(%rsp)
movsd  (%rsp),%xmm0
call   1030 <eps@plt>
movsd  0x10(%rsp),%xmm1
imul   $0x64,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x60(%rsp),%xmm2
ucomisd %xmm0,%xmm2
movsd  0x48(%rsp),%xmm0
jae    12d0 <pgamma+0x150>
movapd 0x20(%rsp),%xmm0
call   1080 <log@plt>
mulsd  0x30(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x50(%rsp),%xmm0
call   1040 <gamma_log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1070 <exp@plt>
movapd 0x30(%rsp),%xmm2
mulsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
movapd 0x20(%rsp),%xmm3
cmpltsd %xmm3,%xmm1
movsd  0xc73(%rip),%xmm4
minsd  %xmm0,%xmm4
andpd  %xmm1,%xmm4
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm4
test   %bl,%bl
jne    13be <pgamma+0x23e>
jmp    15a7 <pgamma+0x427>
test   %bl,%bl
je     15a7 <pgamma+0x427>
movsd  0xc4a(%rip),%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm0,%xmm3
jb     15a7 <pgamma+0x427>
movapd %xmm2,0x30(%rsp)
movsd  0xc2e(%rip),%xmm0
divsd  %xmm3,%xmm0
movapd %xmm0,0x10(%rsp)
movapd %xmm3,0x20(%rsp)
call   1050 <normf@plt>
movsd  %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <normf@plt>
call   1030 <eps@plt>
imul   $0x64,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    1430 <pgamma+0x2b0>
movapd 0x10(%rsp),%xmm0
movapd %xmm0,(%rsp)
jmp    1544 <pgamma+0x3c4>
movapd 0xbe8(%rip),%xmm4
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm1,%xmm4
xorpd  %xmm2,%xmm2
movsd  0xbc2(%rip),%xmm0
unpcklpd %xmm0,%xmm2
unpcklpd %xmm1,%xmm1
movapd %xmm1,0x80(%rsp)
movapd 0x10(%rsp),%xmm1
movapd %xmm0,%xmm5
nopl   0x0(%rax)
movapd %xmm5,%xmm0
subsd  0x30(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm2,%xmm0
addpd  %xmm4,%xmm0
movapd %xmm5,%xmm2
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm2
unpcklpd %xmm3,%xmm3
mulpd  %xmm0,%xmm3
movapd %xmm3,0x60(%rsp)
unpcklpd %xmm2,%xmm2
mulpd  %xmm4,%xmm2
movapd 0x80(%rsp),%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm2,%xmm4
movapd %xmm4,0x50(%rsp)
movapd %xmm4,%xmm0
unpckhpd %xmm4,%xmm0
movsd  0xb3f(%rip),%xmm2
movapd %xmm2,%xmm3
divsd  %xmm0,%xmm3
addsd  %xmm2,%xmm5
movsd  %xmm5,0x48(%rsp)
movapd %xmm4,%xmm0
movapd %xmm3,0x10(%rsp)
mulsd  %xmm3,%xmm0
movapd %xmm0,(%rsp)
subsd  %xmm1,%xmm0
call   1050 <normf@plt>
movsd  %xmm0,0x78(%rsp)
movaps (%rsp),%xmm0
call   1050 <normf@plt>
call   1030 <eps@plt>
movapd 0x60(%rsp),%xmm2
movsd  0x48(%rsp),%xmm5
movapd 0x50(%rsp),%xmm4
imul   $0x64,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x78(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd (%rsp),%xmm1
jae    1470 <pgamma+0x2f0>
movapd 0x20(%rsp),%xmm0
call   1080 <log@plt>
movapd %xmm0,%xmm1
movapd 0x30(%rsp),%xmm0
mulsd  %xmm0,%xmm1
subsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
call   1040 <gamma_log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1070 <exp@plt>
movapd 0x20(%rsp),%xmm3
mulsd  (%rsp),%xmm0
movsd  0xa73(%rip),%xmm4
subsd  %xmm0,%xmm4
movapd 0x30(%rsp),%xmm2
xorpd  %xmm0,%xmm0
cmpeqsd %xmm0,%xmm3
andnpd %xmm4,%xmm3
cmpeqsd %xmm0,%xmm2
movapd %xmm2,%xmm1
andnpd %xmm3,%xmm1
movsd  0xa47(%rip),%xmm0
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
add    $0x90,%rsp
pop    %rbx
ret
lea    0xa4f(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"a must be non-negative\00"
define double @pgamma(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %3
store double %1, double* %4
%18 = load double, double* %4
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
store double 2.000000e+20, double* %9
%24 = load double, double* %4
%25 = load double, double* %9
%26 = fcmp ogt double %24, %25
br i1 %26, label %27, label %44
27: ; preds = %23
%28 = load double, double* %9
%29 = fsub double %28, 0x3FD5555555555555
%30 = load double, double* %9
%31 = load double, double* %4
%32 = fdiv double %30, %31
%33 = call double @sqrt(double %32)
%34 = load double, double* %3
%35 = load double, double* %4
%36 = fsub double %35, 0x3FD5555555555555
%37 = fsub double %34, %36
%38 = call double @llvm.fmuladd.f64(double %33, double %37, double %29)
store double %38, double* %3
%39 = load double, double* %9
store double %39, double* %4
%40 = load double, double* %3
%41 = fcmp olt double %40, 0.000000e+00
br i1 %41, label %42, label %43
42: ; preds = %27
store double 0.000000e+00, double* %3
br label %43
43: ; preds = %42, %27
br label %44
44: ; preds = %43, %23
%45 = load double, double* %4
%46 = fcmp une double %45, 0.000000e+00
br i1 %46, label %47, label %99
47: ; preds = %44
%48 = load double, double* %3
%49 = fcmp une double %48, 0.000000e+00
br i1 %49, label %50, label %99
50: ; preds = %47
%51 = load double, double* %3
%52 = load double, double* %4
%53 = fadd double %52, 1.000000e+00
%54 = fcmp olt double %51, %53
br i1 %54, label %55, label %99
55: ; preds = %50
%56 = load double, double* %4
store double %56, double* %6
store double 1.000000e+00, double* %7
store double 1.000000e+00, double* %8
br label %57
57: ; preds = %65, %55
%58 = load double, double* %7
%59 = call double @normf(double %58)
%60 = load double, double* %8
%61 = call i32 @eps(double %60)
%62 = mul nsw i32 100, %61
%63 = sitofp i32 %62 to double
%64 = fcmp oge double %59, %63
br i1 %64, label %65, label %76
65: ; preds = %57
%66 = load double, double* %6
%67 = fadd double %66, 1.000000e+00
store double %67, double* %6
%68 = load double, double* %3
%69 = load double, double* %7
%70 = fmul double %68, %69
%71 = load double, double* %6
%72 = fdiv double %70, %71
store double %72, double* %7
%73 = load double, double* %7
%74 = load double, double* %8
%75 = fadd double %74, %73
store double %75, double* %8
br label %57
76: ; preds = %57
%77 = load double, double* %8
%78 = load double, double* %3
%79 = fneg double %78
%80 = load double, double* %4
%81 = load double, double* %3
%82 = call double @log(double %81)
%83 = call double @llvm.fmuladd.f64(double %80, double %82, double %79)
%84 = load double, double* %4
%85 = fadd double %84, 1.000000e+00
%86 = call i64 @gamma_log(double %85)
%87 = sitofp i64 %86 to double
%88 = fsub double %83, %87
%89 = fptosi double %88 to i64
%90 = call double @exp(i64 %89)
%91 = fmul double %77, %90
store double %91, double* %5
%92 = load double, double* %3
%93 = fcmp ogt double %92, 0.000000e+00
br i1 %93, label %94, label %98
94: ; preds = %76
%95 = load double, double* %5
%96 = fcmp ogt double %95, 1.000000e+00
br i1 %96, label %97, label %98
97: ; preds = %94
store double 1.000000e+00, double* %5
br label %98
98: ; preds = %97, %94, %76
br label %99
99: ; preds = %98, %50, %47, %44
%100 = load double, double* %4
%101 = fcmp une double %100, 0.000000e+00
br i1 %101, label %102, label %186
102: ; preds = %99
%103 = load double, double* %3
%104 = load double, double* %4
%105 = fadd double %104, 1.000000e+00
%106 = fcmp oge double %103, %105
br i1 %106, label %107, label %186
107: ; preds = %102
store double 1.000000e+00, double* %10
%108 = load double, double* %3
store double %108, double* %11
store double 0.000000e+00, double* %12
store double 1.000000e+00, double* %13
%109 = load double, double* %11
%110 = fdiv double 1.000000e+00, %109
store double %110, double* %17
store double 1.000000e+00, double* %6
%111 = load double, double* %13
%112 = load double, double* %17
%113 = fmul double %111, %112
store double %113, double* %14
%114 = load double, double* %12
store double %114, double* %15
%115 = load double, double* %14
%116 = load double, double* %15
%117 = fsub double %115, %116
%118 = call double @normf(double %117)
store double %118, double* %16
br label %119
119: ; preds = %127, %107
%120 = load double, double* %16
%121 = load double, double* %14
%122 = call double @normf(double %121)
%123 = call i32 @eps(double %122)
%124 = mul nsw i32 100, %123
%125 = sitofp i32 %124 to double
%126 = fcmp oge double %120, %125
br i1 %126, label %127, label %170
127: ; preds = %119
%128 = load double, double* %14
store double %128, double* %15
%129 = load double, double* %6
%130 = load double, double* %4
%131 = fsub double %129, %130
store double %131, double* %7
%132 = load double, double* %11
%133 = load double, double* %10
%134 = load double, double* %7
%135 = call double @llvm.fmuladd.f64(double %133, double %134, double %132)
%136 = load double, double* %17
%137 = fmul double %135, %136
store double %137, double* %10
%138 = load double, double* %13
%139 = load double, double* %12
%140 = load double, double* %7
%141 = call double @llvm.fmuladd.f64(double %139, double %140, double %138)
%142 = load double, double* %17
%143 = fmul double %141, %142
store double %143, double* %12
%144 = load double, double* %6
%145 = load double, double* %17
%146 = fmul double %144, %145
store double %146, double* %8
%147 = load double, double* %3
%148 = load double, double* %10
%149 = load double, double* %8
%150 = load double, double* %11
%151 = fmul double %149, %150
%152 = call double @llvm.fmuladd.f64(double %147, double %148, double %151)
store double %152, double* %11
%153 = load double, double* %3
%154 = load double, double* %12
%155 = load double, double* %8
%156 = load double, double* %13
%157 = fmul double %155, %156
%158 = call double @llvm.fmuladd.f64(double %153, double %154, double %157)
store double %158, double* %13
%159 = load double, double* %11
%160 = fdiv double 1.000000e+00, %159
store double %160, double* %17
%161 = load double, double* %6
%162 = fadd double %161, 1.000000e+00
store double %162, double* %6
%163 = load double, double* %13
%164 = load double, double* %17
%165 = fmul double %163, %164
store double %165, double* %14
%166 = load double, double* %14
%167 = load double, double* %15
%168 = fsub double %166, %167
%169 = call double @normf(double %168)
store double %169, double* %16
br label %119
170: ; preds = %119
%171 = load double, double* %14
%172 = load double, double* %3
%173 = fneg double %172
%174 = load double, double* %4
%175 = load double, double* %3
%176 = call double @log(double %175)
%177 = call double @llvm.fmuladd.f64(double %174, double %176, double %173)
%178 = load double, double* %4
%179 = call i64 @gamma_log(double %178)
%180 = sitofp i64 %179 to double
%181 = fsub double %177, %180
%182 = fptosi double %181 to i64
%183 = call double @exp(i64 %182)
%184 = fneg double %171
%185 = call double @llvm.fmuladd.f64(double %184, double %183, double 1.000000e+00)
store double %185, double* %5
br label %186
186: ; preds = %170, %102, %99
%187 = load double, double* %3
%188 = fcmp oeq double %187, 0.000000e+00
br i1 %188, label %189, label %190
189: ; preds = %186
store double 0.000000e+00, double* %5
br label %190
190: ; preds = %189, %186
%191 = load double, double* %4
%192 = fcmp oeq double %191, 0.000000e+00
br i1 %192, label %193, label %194
193: ; preds = %190
store double 1.000000e+00, double* %5
br label %194
194: ; preds = %193, %190
%195 = load double, double* %5
ret double %195
}

LLVM IR (-O2):
@.str = [23 x i8] c"a must be non-negative\00"
define double @pgamma(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = fcmp ogt double %1, 2.000000e+20
br i1 %8, label %9, label %16
9: ; preds = %7
%10 = fdiv double 2.000000e+20, %1
%11 = tail call double @sqrt(double %10)
%12 = fadd double %1, 0xBFD5555555555555
%13 = fsub double %0, %12
%14 = tail call double @llvm.fmuladd.f64(double %11, double %13, double 2.000000e+20)
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %59, label %16
16: ; preds = %9, %7
%17 = phi double [ 2.000000e+20, %9 ], [ %1, %7 ]
%18 = phi double [ %14, %9 ], [ %0, %7 ]
%19 = fcmp une double %17, 0.000000e+00
%20 = fcmp une double %18, 0.000000e+00
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %22, label %59
22: ; preds = %16
%23 = fadd double %17, 1.000000e+00
%24 = fcmp olt double %18, %23
br i1 %24, label %25, label %59
25: ; preds = %22
%26 = tail call double @normf(double 1.000000e+00)
%27 = tail call i32 @eps(double 1.000000e+00)
%28 = mul nsw i32 %27, 100
%29 = sitofp i32 %28 to double
%30 = fcmp ult double %26, %29
br i1 %30, label %44, label %31
31: ; preds = %25, %31
%32 = phi double [ %38, %31 ], [ 1.000000e+00, %25 ]
%33 = phi double [ %37, %31 ], [ 1.000000e+00, %25 ]
%34 = phi double [ %35, %31 ], [ %17, %25 ]
%35 = fadd double %34, 1.000000e+00
%36 = fmul double %18, %33
%37 = fdiv double %36, %35
%38 = fadd double %32, %37
%39 = tail call double @normf(double %37)
%40 = tail call i32 @eps(double %38)
%41 = mul nsw i32 %40, 100
%42 = sitofp i32 %41 to double
%43 = fcmp ult double %39, %42
br i1 %43, label %44, label %31
44: ; preds = %31, %25
%45 = phi double [ 1.000000e+00, %25 ], [ %38, %31 ]
%46 = fneg double %18
%47 = tail call double @log(double %18)
%48 = tail call double @llvm.fmuladd.f64(double %17, double %47, double %46)
%49 = tail call i64 @gamma_log(double %23)
%50 = sitofp i64 %49 to double
%51 = fsub double %48, %50
%52 = fptosi double %51 to i64
%53 = tail call double @exp(i64 %52)
%54 = fmul double %45, %53
%55 = fcmp ogt double %18, 0.000000e+00
%56 = fcmp ogt double %54, 1.000000e+00
%57 = select i1 %55, i1 %56, i1 false
%58 = select i1 %57, double 1.000000e+00, double %54
br label %59
59: ; preds = %9, %44, %22, %16
%60 = phi i1 [ true, %44 ], [ true, %22 ], [ %19, %16 ], [ true, %9 ]
%61 = phi double [ %18, %44 ], [ %18, %22 ], [ %18, %16 ], [ 0.000000e+00, %9 ]
%62 = phi double [ %17, %44 ], [ %17, %22 ], [ %17, %16 ], [ 2.000000e+20, %9 ]
%63 = phi double [ %58, %44 ], [ undef, %22 ], [ undef, %16 ], [ undef, %9 ]
%64 = xor i1 %60, true
%65 = fadd double %62, 1.000000e+00
%66 = fcmp ult double %61, %65
%67 = select i1 %64, i1 true, i1 %66
br i1 %67, label %122, label %68
68: ; preds = %59
%69 = fdiv double 1.000000e+00, %61
%70 = tail call double @normf(double %69)
%71 = tail call double @normf(double %69)
%72 = tail call i32 @eps(double %71)
%73 = mul nsw i32 %72, 100
%74 = sitofp i32 %73 to double
%75 = fcmp ult double %70, %74
br i1 %75, label %110, label %76
76: ; preds = %68
%77 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %61, i64 1
%78 = insertelement <2 x double> poison, double %61, i64 0
%79 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> zeroinitializer
br label %80
80: ; preds = %76, %80
%81 = phi double [ %99, %80 ], [ %69, %76 ]
%82 = phi double [ %102, %80 ], [ %69, %76 ]
%83 = phi double [ %100, %80 ], [ 1.000000e+00, %76 ]
%84 = phi <2 x double> [ %92, %80 ], [ <double 0.000000e+00, double 1.000000e+00>, %76 ]
%85 = phi <2 x double> [ %97, %80 ], [ %77, %76 ]
%86 = fsub double %83, %62
%87 = insertelement <2 x double> poison, double %86, i64 0
%88 = shufflevector <2 x double> %87, <2 x double> poison, <2 x i32> zeroinitializer
%89 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %84, <2 x double> %88, <2 x double> %85)
%90 = insertelement <2 x double> poison, double %81, i64 0
%91 = shufflevector <2 x double> %90, <2 x double> poison, <2 x i32> zeroinitializer
%92 = fmul <2 x double> %89, %91
%93 = fmul double %83, %81
%94 = insertelement <2 x double> poison, double %93, i64 0
%95 = shufflevector <2 x double> %94, <2 x double> poison, <2 x i32> zeroinitializer
%96 = fmul <2 x double> %85, %95
%97 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %79, <2 x double> %92, <2 x double> %96)
%98 = extractelement <2 x double> %97, i64 1
%99 = fdiv double 1.000000e+00, %98
%100 = fadd double %83, 1.000000e+00
%101 = extractelement <2 x double> %97, i64 0
%102 = fmul double %101, %99
%103 = fsub double %102, %82
%104 = tail call double @normf(double %103)
%105 = tail call double @normf(double %102)
%106 = tail call i32 @eps(double %105)
%107 = mul nsw i32 %106, 100
%108 = sitofp i32 %107 to double
%109 = fcmp ult double %104, %108
br i1 %109, label %110, label %80
110: ; preds = %80, %68
%111 = phi double [ %69, %68 ], [ %102, %80 ]
%112 = fneg double %61
%113 = tail call double @log(double %61)
%114 = tail call double @llvm.fmuladd.f64(double %62, double %113, double %112)
%115 = tail call i64 @gamma_log(double %62)
%116 = sitofp i64 %115 to double
%117 = fsub double %114, %116
%118 = fptosi double %117 to i64
%119 = tail call double @exp(i64 %118)
%120 = fneg double %111
%121 = tail call double @llvm.fmuladd.f64(double %120, double %119, double 1.000000e+00)
br label %122
122: ; preds = %110, %59
%123 = phi double [ %121, %110 ], [ %63, %59 ]
%124 = fcmp oeq double %61, 0.000000e+00
%125 = select i1 %124, double 0.000000e+00, double %123
%126 = fcmp oeq double %62, 0.000000e+00
%127 = select i1 %126, double 1.000000e+00, double %125
ret double %127
}