#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 dmax(double, double const);
double dmin(int, double);
int /*<<< orphan*/ error(char *);
double exp(double);
double fabs(double);
double gammln(double const);
double const gammp(double const, double);
double log(double);
double const pow(double const, int);
int sqrt(double const);
double invgammp(const double p, const double a) {
  int j;
  double x, err, t, u, pp, a1 = a - 1;
  double afac = 0;
  double lna1 = 0;
  double eps = 1.e-8;
  double gln = gammln(a);
  if (a <= 0.)
    error("a must be pos in invgammap");
  if (p >= 1.)
    return dmax(100., a + 100. * sqrt(a));
  if (p <= 0.)
    return 0.0;
  if (a > 1.) {
    lna1 = log(a1);
    afac = exp(a1 * (lna1 - 1.) - gln);
    pp = (p < 0.5) ? p : 1. - p;
    t = sqrt(-2. * log(pp));
    x = (2.30753 + t * 0.27061) / (1. + t * (0.99229 + t * 0.04481)) - t;
    if (p < 0.5)
      x = -x;
    x = dmax(1.e-3, a * pow(1. - 1. / (9. * a) - x / (3. * sqrt(a)), 3));
  } else {
    t = 1.0 - a * (0.253 + a * 0.12);
    if (p < t)
      x = pow(p / t, 1. / a);
    else
      x = 1. - log(1. - (p - t) / (1. - t));
  }
  for (j = 0; j < 12; j++) {
    if (x <= 0.0)
      return 0.0;
    err = gammp(a, x) - p;
    if (a > 1.)
      t = afac * exp(-(x - a1) + a1 * (log(x) - lna1));
    else
      t = exp(-x + a1 * log(x) - gln);
    u = err / t;
    x -= (t = u / (1. - 0.5 * dmin(1., u * ((a - 1.) / x - 1))));
    if (x <= 0.)
      x = 0.5 * (x + t);
    if (fabs(t) < eps * x)
      break;
  }
  return x;
}


x86 assembly (clang, -O0):
<invgammp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe2d(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
call   10b0 <gammln@plt>
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1201 <invgammp+0x71>
lea    0xe94(%rip),%rdi
call   1070 <error@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xdfa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     125c <invgammp+0xcc>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
call   10a0 <sqrt@plt>
movsd  -0x78(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movsd  0xe33(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe23(%rip),%xmm0
call   1060 <dmax@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1791 <invgammp+0x601>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1277 <invgammp+0xe7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1791 <invgammp+0x601>
movsd  -0x18(%rbp),%xmm0
movsd  0xd84(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    147d <invgammp+0x2ed>
movsd  -0x50(%rbp),%xmm0
call   1080 <log@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  0xd59(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xd37(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1303 <invgammp+0x173>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1315 <invgammp+0x185>
movsd  0xcfd(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1080 <log@plt>
movaps %xmm0,%xmm1
movsd  0xd14(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   10a0 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xce5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xce1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  0xcb3(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xcaf(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xc77(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xc75(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    13d7 <invgammp+0x247>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xc74(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xc0f(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xc03(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   10a0 <sqrt@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm3
movsd  0xc14(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    $0x3,%edi
call   1090 <pow@plt>
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm0,%xmm1
movsd  0xbe2(%rip),%xmm0
call   1060 <dmax@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    154e <invgammp+0x3be>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xb81(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xb7d(%rip),%xmm2
addsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xb46(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1509 <invgammp+0x379>
movsd  -0x10(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  0xb17(%rip),%xmm1
divsd  -0x18(%rbp),%xmm1
cvttsd2si %xmm1,%edi
call   1090 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    1549 <invgammp+0x3b9>
movsd  -0x10(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  0xaed(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xadc(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1080 <log@plt>
movaps %xmm0,%xmm1
movsd  0xac8(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    154e <invgammp+0x3be>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xc,-0x1c(%rbp)
jge    1787 <invgammp+0x5f7>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     157a <invgammp+0x3ea>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1791 <invgammp+0x601>
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1050 <gammp@plt>
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xa68(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1635 <invgammp+0x4a5>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1080 <log@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
subsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    169a <invgammp+0x50a>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1080 <log@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x70(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0x940(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0x92f(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    $0x1,%edi
call   1040 <dmin@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movsd  0x96d(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x901(%rip),%xmm2
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     174b <invgammp+0x5bb>
movsd  -0x28(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0x8de(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm1
movaps 0x929(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1774 <invgammp+0x5e4>
jmp    1787 <invgammp+0x5f7>
jmp    1779 <invgammp+0x5e9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1555 <invgammp+0x3c5>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invgammp>:
push   %rbx
sub    $0x80,%rsp
movapd %xmm1,(%rsp)
movaps %xmm0,0x30(%rsp)
movapd %xmm1,%xmm0
call   10b0 <gammln@plt>
movapd (%rsp),%xmm2
movsd  %xmm0,0x58(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jb     11d1 <invgammp+0x41>
lea    0xef9(%rip),%rdi
call   1070 <error@plt>
movapd (%rsp),%xmm2
movapd 0x30(%rsp),%xmm0
ucomisd 0xe29(%rip),%xmm0
jae    12f4 <invgammp+0x164>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    15a2 <invgammp+0x412>
movsd  0xe05(%rip),%xmm0
addsd  %xmm2,%xmm0
ucomisd 0xe01(%rip),%xmm2
movapd %xmm0,0x40(%rsp)
jbe    1322 <invgammp+0x192>
call   1080 <log@plt>
movapd %xmm0,%xmm1
movsd  0xddc(%rip),%xmm0
movsd  %xmm1,0x28(%rsp)
addsd  %xmm1,%xmm0
mulsd  0x40(%rsp),%xmm0
subsd  0x58(%rsp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0xdbb(%rip),%xmm1
movapd 0x30(%rsp),%xmm3
subsd  %xmm3,%xmm1
movapd %xmm3,%xmm0
cmpltsd 0xdc4(%rip),%xmm0
movapd %xmm0,%xmm2
andnpd %xmm1,%xmm2
andpd  %xmm3,%xmm0
orpd   %xmm2,%xmm0
call   1080 <log@plt>
mulsd  0xdaf(%rip),%xmm0
call   10a0 <sqrt@plt>
movsd  0xd9a(%rip),%xmm0
ucomisd 0x30(%rsp),%xmm0
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xd95(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xd91(%rip),%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd 0xda1(%rip),%xmm3
unpcklpd %xmm1,%xmm3
mulpd  %xmm2,%xmm3
addpd  0xda1(%rip),%xmm3
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
divsd  %xmm1,%xmm3
subsd  %xmm0,%xmm3
ja     1374 <invgammp+0x1e4>
movaps (%rsp),%xmm0
movapd %xmm3,0x10(%rsp)
jmp    1386 <invgammp+0x1f6>
movapd %xmm2,%xmm0
call   10a0 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xd04(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  (%rsp),%xmm1
add    $0x80,%rsp
pop    %rbx
jmp    1060 <dmax@plt>
movsd  0xcee(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xcea(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xcc6(%rip),%xmm3
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
movapd 0x30(%rsp),%xmm0
ucomisd %xmm0,%xmm1
jbe    13ef <invgammp+0x25f>
divsd  %xmm1,%xmm0
divsd  %xmm2,%xmm3
cvttsd2si %xmm3,%edi
call   1090 <pow@plt>
movapd %xmm0,%xmm1
jmp    141c <invgammp+0x28c>
xorpd  0xd04(%rip),%xmm3
movapd %xmm3,0x10(%rsp)
movaps (%rsp),%xmm0
call   10a0 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  0xced(%rip),%xmm1
movapd 0xcf5(%rip),%xmm2
unpcklpd 0x10(%rsp),%xmm2
divpd  %xmm1,%xmm2
movsd  0xc4b(%rip),%xmm0
subsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm2
subsd  %xmm2,%xmm0
mov    $0x3,%edi
call   1090 <pow@plt>
movapd %xmm0,%xmm1
mulsd  (%rsp),%xmm1
movsd  0xc64(%rip),%xmm0
call   1060 <dmax@plt>
movapd %xmm0,%xmm1
jmp    1430 <invgammp+0x2a0>
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm3,%xmm0
subsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movapd %xmm3,%xmm0
subsd  %xmm2,%xmm0
call   1080 <log@plt>
movsd  0xbf0(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    $0xb,%ebx
xorpd  %xmm2,%xmm2
movapd (%rsp),%xmm0
xchg   %ax,%ax
ucomisd %xmm1,%xmm2
jae    159e <invgammp+0x40e>
movapd %xmm1,0x10(%rsp)
call   1050 <gammp@plt>
movapd %xmm0,0x60(%rsp)
movapd (%rsp),%xmm0
ucomisd 0xba0(%rip),%xmm0
jbe    14b0 <invgammp+0x320>
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
subsd  0x40(%rsp),%xmm1
movapd %xmm1,0x70(%rsp)
call   1080 <log@plt>
subsd  0x28(%rsp),%xmm0
mulsd  0x40(%rsp),%xmm0
subsd  0x70(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x20(%rsp),%xmm0
jmp    14d2 <invgammp+0x342>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd 0x10(%rsp),%xmm0
call   1080 <log@plt>
mulsd  0x40(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
subsd  0x58(%rsp),%xmm0
call   1030 <exp@plt>
movapd 0x60(%rsp),%xmm1
subsd  0x30(%rsp),%xmm1
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm1,%xmm2
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
divpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
addsd  0xafe(%rip),%xmm0
unpckhpd %xmm2,%xmm2
movapd %xmm2,0x60(%rsp)
mulsd  %xmm2,%xmm0
mov    $0x1,%edi
call   1040 <dmin@plt>
mulsd  0xb2e(%rip),%xmm0
addsd  0xade(%rip),%xmm0
movapd 0x60(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd 0x10(%rsp),%xmm3
subsd  %xmm1,%xmm3
movapd %xmm1,%xmm0
movapd %xmm1,%xmm4
addsd  %xmm3,%xmm0
mulsd  0xad6(%rip),%xmm0
movapd %xmm3,%xmm1
xorpd  %xmm2,%xmm2
cmpnlesd %xmm2,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm3
andpd  0xb3d(%rip),%xmm4
movapd %xmm3,%xmm0
movapd %xmm3,%xmm1
mulsd  0xad5(%rip),%xmm0
sub    $0x1,%ebx
setb   %al
ucomisd %xmm4,%xmm0
ja     15a2 <invgammp+0x412>
test   %al,%al
movapd (%rsp),%xmm0
je     1440 <invgammp+0x2b0>
jmp    15a2 <invgammp+0x412>
xorpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
add    $0x80,%rsp
pop    %rbx
ret

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

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