#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 /*<<< orphan*/ cdflib_cumchi(double const *, double const *, double *,
                                 double *);
int cdflib_fifidint(double);
double cdflib_gamma_log(double *);
double exp(double);
double log(double);
void cdflib_cumchn(const double *x, const double *df, const double *pnonc,
                   double *cum, double *ccum) {
  static const double eps = 1.0e-5;
  static const int ntired = 1000;
  double adj, centaj, centwt, chid2, dfd2, lcntaj, lcntwt, lfact, pcent, pterm,
      sum, sumadj, term, wt, xnonc;
  int i, icent, iterb, iterf;
  double T1, T2, T3;
  if (!(*x <= 0.0e0)) {
    goto S10;
  }
  *cum = 0.0e0;
  *ccum = 1.0e0;
  return;
S10:
  if (!(*pnonc <= 1.0e-10)) {
    goto S20;
  }
  cdflib_cumchi(x, df, cum, ccum);
  return;
S20:
  xnonc = *pnonc / 2.0e0;
  icent = cdflib_fifidint(xnonc);
  if (icent == 0) {
    icent = 1;
  }
  chid2 = *x / 2.0e0;
  T1 = (double)(icent + 1);
  lfact = cdflib_gamma_log(&T1);
  lcntwt = -xnonc + (double)icent * log(xnonc) - lfact;
  centwt = exp(lcntwt);
  T2 = (*df + 2.0e0 * (double)(icent));
  cdflib_cumchi(x, &T2, &pcent, ccum);
  dfd2 = (*df + 2.0e0 * (double)(icent)) / 2.0e0;
  T3 = 1.0e0 + dfd2;
  lfact = cdflib_gamma_log(&T3);
  lcntaj = dfd2 * log(chid2) - chid2 - lfact;
  centaj = exp(lcntaj);
  sum = centwt * pcent;
  iterb = 0;
  sumadj = 0.0e0;
  adj = centaj;
  wt = centwt;
  i = icent;
  goto S40;
S30:
  if ((int)((iterb) > ntired) || (int)(sum < 1.0e-20 || (term) < eps * sum) ||
      i == 0) {
    goto S50;
  }
S40:
  dfd2 = (*df + 2.0e0 * (double)(i)) / 2.0e0;
  adj = adj * dfd2 / chid2;
  sumadj = sumadj + adj;
  pterm = pcent + sumadj;
  wt *= ((double)i / xnonc);
  term = wt * pterm;
  sum = sum + term;
  i -= 1;
  iterb = iterb + 1;
  goto S30;
S50:
  iterf = 0;
  sumadj = adj = centaj;
  wt = centwt;
  i = icent;
  goto S70;
S60:
  if ((int)((iterf) > ntired) || (int)(sum < 1.0e-20 || (term) < eps * sum)) {
    goto S80;
  }
S70:
  wt *= (xnonc / (double)(i + 1));
  pterm = pcent - sumadj;
  term = wt * pterm;
  sum = sum + term;
  i = i + 1;
  dfd2 = (*df + 2.0e0 * (double)(i)) / 2.0e0;
  adj = adj * chid2 / dfd2;
  sumadj = sum + adj;
  iterf = iterf + 1;
  goto S60;
S80:
  *cum = sum;
  *ccum = 0.5e0 + (0.5e0 - *cum);
  return;
}


x86 assembly (clang, -O0):
<cdflib_cumchn>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jae    1185 <cdflib_cumchn+0x35>
jmp    11a5 <cdflib_cumchn+0x55>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xe74(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    16f2 <cdflib_cumchn+0x5a2>
mov    -0x18(%rbp),%rax
movsd  0xe4f(%rip),%xmm0
ucomisd (%rax),%xmm0
jae    11c0 <cdflib_cumchn+0x70>
jmp    11da <cdflib_cumchn+0x8a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <cdflib_cumchi@plt>
jmp    16f2 <cdflib_cumchn+0x5a2>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe1e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
call   1030 <cdflib_fifidint@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jne    1220 <cdflib_cumchn+0xd0>
movl   $0x1,-0xa8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdd8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
lea    -0xb8(%rbp),%rdi
call   1070 <cdflib_gamma_log@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
cvtsi2sdl -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
call   1060 <log@plt>
movsd  -0xe0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
cvtsi2sdl -0xa8(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rcx
lea    -0xc0(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1040 <cdflib_cumchi@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
cvtsi2sdl -0xa8(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xcd9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xcd0(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
lea    -0xc8(%rbp),%rdi
call   1070 <cdflib_gamma_log@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1060 <log@plt>
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0xac(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0xa8(%rbp),%eax
mov    %eax,-0xa4(%rbp)
jmp    147b <cdflib_cumchn+0x32b>
cmpl   $0x3e8,-0xac(%rbp)
jg     1471 <cdflib_cumchn+0x321>
mov    $0x1,%al
movsd  0xbf5(%rip),%xmm0
ucomisd -0x80(%rbp),%xmm0
mov    %al,-0xe1(%rbp)
ja     1456 <cdflib_cumchn+0x306>
movsd  -0x90(%rbp),%xmm1
ff
movsd  0xbdc(%rip),%xmm0
mulsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
test   $0x1,%al
jne    1471 <cdflib_cumchn+0x321>
cmpl   $0x0,-0xa4(%rbp)
jne    1476 <cdflib_cumchn+0x326>
jmp    1549 <cdflib_cumchn+0x3f9>
jmp    147b <cdflib_cumchn+0x32b>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb6d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
divsd  -0xa0(%rbp),%xmm0
ff
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
mov    -0xa4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    1409 <cdflib_cumchn+0x2b9>
movl   $0x0,-0xb0(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0xa8(%rbp),%eax
mov    %eax,-0xa4(%rbp)
jmp    15ed <cdflib_cumchn+0x49d>
cmpl   $0x3e8,-0xb0(%rbp)
jg     15e3 <cdflib_cumchn+0x493>
mov    $0x1,%al
movsd  0xa7b(%rip),%xmm0
ucomisd -0x80(%rbp),%xmm0
mov    %al,-0xe2(%rbp)
ja     15d0 <cdflib_cumchn+0x480>
movsd  -0x90(%rbp),%xmm1
ff
movsd  0xa62(%rip),%xmm0
mulsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0xe2(%rbp)
mov    -0xe2(%rbp),%al
test   $0x1,%al
jne    15e3 <cdflib_cumchn+0x493>
jmp    15e8 <cdflib_cumchn+0x498>
jmp    16c1 <cdflib_cumchn+0x571>
jmp    15ed <cdflib_cumchn+0x49d>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
cvtsi2sdl -0xa4(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x98a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x80(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    1583 <cdflib_cumchn+0x433>
movsd  -0x80(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0x94e(%rip),%xmm1
subsd  (%rax),%xmm1
movsd  0x942(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_cumchn>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %r8,%r15
mov    %rcx,%r14
xorpd  %xmm0,%xmm0
ucomisd (%rdi),%xmm0
jae    1415 <cdflib_cumchn+0x2c5>
mov    %rsi,%r12
mov    %rdi,%r13
movsd  (%rdx),%xmm0
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1437 <cdflib_cumchn+0x2e7>
mulsd  0xe73(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
call   1030 <cdflib_fifidint@plt>
test   %eax,%eax
mov    $0x1,%ebx
cmovne %eax,%ebx
movsd  0x0(%r13),%xmm0
mulsd  0xe50(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x60(%rsp)
lea    0x60(%rsp),%rdi
call   1070 <cdflib_gamma_log@plt>
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x30(%rsp),%xmm0
call   1060 <log@plt>
mulsd  0x8(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   1050 <exp@plt>
movapd %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r12),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x58(%rsp)
lea    0x58(%rsp),%rsi
lea    0x68(%rsp),%rdx
mov    %r13,%rdi
mov    %r15,%rcx
call   1040 <cdflib_cumchi@plt>
movsd  0x8(%rsp),%xmm1
addsd  (%r12),%xmm1
mulsd  0xdac(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xda6(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x50(%rsp)
lea    0x50(%rsp),%rdi
call   1070 <cdflib_gamma_log@plt>
movsd  %xmm0,0x48(%rsp)
movapd 0x20(%rsp),%xmm0
call   1060 <log@plt>
mulsd  0x8(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
subsd  0x48(%rsp),%xmm0
call   1050 <exp@plt>
movdqa 0x10(%rsp),%xmm3
movapd 0x20(%rsp),%xmm14
movsd  0xd4c(%rip),%xmm13
movapd 0x30(%rsp),%xmm12
movsd  0x68(%rsp),%xmm15
movsd  (%r12),%xmm11
movq   %xmm3,%xmm7
movdqa %xmm3,%xmm2
mulsd  %xmm15,%xmm2
movapd %xmm12,%xmm10
unpcklpd %xmm14,%xmm10
xor    %eax,%eax
movsd  0xd26(%rip),%xmm8
movsd  0xd25(%rip),%xmm9
movapd %xmm0,%xmm6
nop
lea    (%rbx,%rax,1),%ecx
xorps  %xmm4,%xmm4
cvtsi2sd %ecx,%xmm4
movapd %xmm4,%xmm1
addsd  %xmm4,%xmm1
addsd  %xmm11,%xmm1
mulsd  %xmm13,%xmm1
mulsd  %xmm6,%xmm1
unpcklpd %xmm1,%xmm4
divpd  %xmm10,%xmm4
movdqa %xmm7,%xmm6
mulpd  %xmm4,%xmm6
addpd  %xmm4,%xmm7
movapd %xmm7,%xmm5
unpckhpd %xmm7,%xmm5
addsd  %xmm15,%xmm5
mulsd  %xmm6,%xmm5
addsd  %xmm5,%xmm2
cmp    $0xfffffc18,%eax
je     1380 <cdflib_cumchn+0x230>
ucomisd %xmm2,%xmm8
movapd %xmm2,%xmm1
mulsd  %xmm9,%xmm1
ja     1380 <cdflib_cumchn+0x230>
ucomisd %xmm5,%xmm1
ja     1380 <cdflib_cumchn+0x230>
lea    (%rbx,%rax,1),%ecx
add    $0xffffffff,%ecx
movsd  %xmm6,%xmm7
add    $0xffffffff,%eax
unpckhpd %xmm4,%xmm4
movapd %xmm4,%xmm6
test   %ecx,%ecx
jne    1300 <cdflib_cumchn+0x1b0>
mov    $0x1,%eax
movapd %xmm0,%xmm6
nopl   0x0(%rax)
movdqa %xmm3,%xmm1
lea    (%rbx,%rax,1),%ecx
xorps  %xmm7,%xmm7
cvtsi2sd %ecx,%xmm7
movapd %xmm12,%xmm3
divsd  %xmm7,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm15,%xmm4
subsd  %xmm0,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm4,%xmm2
addsd  %xmm7,%xmm7
addsd  %xmm11,%xmm7
mulsd  %xmm13,%xmm7
cmp    $0x3e9,%eax
je     13fb <cdflib_cumchn+0x2ab>
ucomisd %xmm2,%xmm8
movapd %xmm2,%xmm5
mulsd  %xmm9,%xmm5
ja     13fb <cdflib_cumchn+0x2ab>
mulsd  %xmm14,%xmm6
divsd  %xmm7,%xmm6
movapd %xmm6,%xmm0
addsd  %xmm2,%xmm0
add    $0x1,%eax
ucomisd %xmm4,%xmm5
jbe    1390 <cdflib_cumchn+0x240>
movsd  %xmm2,(%r14)
movapd %xmm13,%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm13,%xmm0
movsd  %xmm0,(%r15)
jmp    1429 <cdflib_cumchn+0x2d9>
movq   $0x0,(%r14)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r15)
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <cdflib_cumchi@plt>

LLVM IR (-O0):
@cdflib_cumchn.eps = internal constant double 1.000000e-05
@cdflib_cumchn.ntired = internal constant i32 1000
define void @cdflib_cumchn(double* %0, double* %1, double* %2, double* %3, double* %4) {
%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
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca double
%31 = alloca double
%32 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%33 = load double*, double** %6
%34 = load double, double* %33
%35 = fcmp ole double %34, 0.000000e+00
br i1 %35, label %37, label %36
36: ; preds = %5
br label %40
37: ; preds = %5
%38 = load double*, double** %9
store double 0.000000e+00, double* %38
%39 = load double*, double** %10
store double 1.000000e+00, double* %39
br label %226
40: ; preds = %36
%41 = load double*, double** %8
%42 = load double, double* %41
%43 = fcmp ole double %42, 1.000000e-10
br i1 %43, label %45, label %44
44: ; preds = %40
br label %51
45: ; preds = %40
%46 = load double*, double** %6
%47 = load double*, double** %7
%48 = load double*, double** %9
%49 = load double*, double** %10
%50 = call i32 @cdflib_cumchi(double* %46, double* %47, double* %48, double* %49)
br label %226
51: ; preds = %44
%52 = load double*, double** %8
%53 = load double, double* %52
%54 = fdiv double %53, 2.000000e+00
store double %54, double* %25
%55 = load double, double* %25
%56 = call i32 @cdflib_fifidint(double %55)
store i32 %56, i32* %27
%57 = load i32, i32* %27
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %51
store i32 1, i32* %27
br label %60
60: ; preds = %59, %51
%61 = load double*, double** %6
%62 = load double, double* %61
%63 = fdiv double %62, 2.000000e+00
store double %63, double* %14
%64 = load i32, i32* %27
%65 = add nsw i32 %64, 1
%66 = sitofp i32 %65 to double
store double %66, double* %30
%67 = call double @cdflib_gamma_log(double* %30)
store double %67, double* %18
%68 = load double, double* %25
%69 = fneg double %68
%70 = load i32, i32* %27
%71 = sitofp i32 %70 to double
%72 = load double, double* %25
%73 = call double @log(double %72)
%74 = call double @llvm.fmuladd.f64(double %71, double %73, double %69)
%75 = load double, double* %18
%76 = fsub double %74, %75
store double %76, double* %17
%77 = load double, double* %17
%78 = call double @exp(double %77)
store double %78, double* %13
%79 = load double*, double** %7
%80 = load double, double* %79
%81 = load i32, i32* %27
%82 = sitofp i32 %81 to double
%83 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %82, double %80)
store double %83, double* %31
%84 = load double*, double** %6
%85 = load double*, double** %10
%86 = call i32 @cdflib_cumchi(double* %84, double* %31, double* %19, double* %85)
%87 = load double*, double** %7
%88 = load double, double* %87
%89 = load i32, i32* %27
%90 = sitofp i32 %89 to double
%91 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %90, double %88)
%92 = fdiv double %91, 2.000000e+00
store double %92, double* %15
%93 = load double, double* %15
%94 = fadd double 1.000000e+00, %93
store double %94, double* %32
%95 = call double @cdflib_gamma_log(double* %32)
store double %95, double* %18
%96 = load double, double* %15
%97 = load double, double* %14
%98 = call double @log(double %97)
%99 = load double, double* %14
%100 = fneg double %99
%101 = call double @llvm.fmuladd.f64(double %96, double %98, double %100)
%102 = load double, double* %18
%103 = fsub double %101, %102
store double %103, double* %16
%104 = load double, double* %16
%105 = call double @exp(double %104)
store double %105, double* %12
%106 = load double, double* %13
%107 = load double, double* %19
%108 = fmul double %106, %107
store double %108, double* %21
store i32 0, i32* %28
store double 0.000000e+00, double* %22
%109 = load double, double* %12
store double %109, double* %11
%110 = load double, double* %13
store double %110, double* %24
%111 = load i32, i32* %27
store i32 %111, i32* %26
br label %130
112: ; preds = %130
%113 = load i32, i32* %28
%114 = icmp sgt i32 %113, 1000
br i1 %114, label %128, label %115
115: ; preds = %112
%116 = load double, double* %21
%117 = fcmp olt double %116, 0x3BC79CA10C924223
br i1 %117, label %123, label %118
118: ; preds = %115
%119 = load double, double* %23
%120 = load double, double* %21
%121 = fmul double 1.000000e-05, %120
%122 = fcmp olt double %119, %121
br label %123
123: ; preds = %118, %115
%124 = phi i1 [ true, %115 ], [ %122, %118 ]
br i1 %124, label %128, label %125
125: ; preds = %123
%126 = load i32, i32* %26
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %129
128: ; preds = %125, %123, %112
br label %164
129: ; preds = %125
br label %130
130: ; preds = %129, %60
%131 = load double*, double** %7
%132 = load double, double* %131
%133 = load i32, i32* %26
%134 = sitofp i32 %133 to double
%135 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %134, double %132)
%136 = fdiv double %135, 2.000000e+00
store double %136, double* %15
%137 = load double, double* %11
%138 = load double, double* %15
%139 = fmul double %137, %138
%140 = load double, double* %14
%141 = fdiv double %139, %140
store double %141, double* %11
%142 = load double, double* %22
%143 = load double, double* %11
%144 = fadd double %142, %143
store double %144, double* %22
%145 = load double, double* %19
%146 = load double, double* %22
%147 = fadd double %145, %146
store double %147, double* %20
%148 = load i32, i32* %26
%149 = sitofp i32 %148 to double
%150 = load double, double* %25
%151 = fdiv double %149, %150
%152 = load double, double* %24
%153 = fmul double %152, %151
store double %153, double* %24
%154 = load double, double* %24
%155 = load double, double* %20
%156 = fmul double %154, %155
store double %156, double* %23
%157 = load double, double* %21
%158 = load double, double* %23
%159 = fadd double %157, %158
store double %159, double* %21
%160 = load i32, i32* %26
%161 = sub nsw i32 %160, 1
store i32 %161, i32* %26
%162 = load i32, i32* %28
%163 = add nsw i32 %162, 1
store i32 %163, i32* %28
br label %112
164: ; preds = %128
store i32 0, i32* %29
%165 = load double, double* %12
store double %165, double* %11
store double %165, double* %22
%166 = load double, double* %13
store double %166, double* %24
%167 = load i32, i32* %27
store i32 %167, i32* %26
br label %183
168: ; preds = %183
%169 = load i32, i32* %29
%170 = icmp sgt i32 %169, 1000
br i1 %170, label %181, label %171
171: ; preds = %168
%172 = load double, double* %21
%173 = fcmp olt double %172, 0x3BC79CA10C924223
br i1 %173, label %179, label %174
174: ; preds = %171
%175 = load double, double* %23
%176 = load double, double* %21
%177 = fmul double 1.000000e-05, %176
%178 = fcmp olt double %175, %177
br label %179
179: ; preds = %174, %171
%180 = phi i1 [ true, %171 ], [ %178, %174 ]
br i1 %180, label %181, label %182
181: ; preds = %179, %168
br label %218
182: ; preds = %179
br label %183
183: ; preds = %182, %164
%184 = load double, double* %25
%185 = load i32, i32* %26
%186 = add nsw i32 %185, 1
%187 = sitofp i32 %186 to double
%188 = fdiv double %184, %187
%189 = load double, double* %24
%190 = fmul double %189, %188
store double %190, double* %24
%191 = load double, double* %19
%192 = load double, double* %22
%193 = fsub double %191, %192
store double %193, double* %20
%194 = load double, double* %24
%195 = load double, double* %20
%196 = fmul double %194, %195
store double %196, double* %23
%197 = load double, double* %21
%198 = load double, double* %23
%199 = fadd double %197, %198
store double %199, double* %21
%200 = load i32, i32* %26
%201 = add nsw i32 %200, 1
store i32 %201, i32* %26
%202 = load double*, double** %7
%203 = load double, double* %202
%204 = load i32, i32* %26
%205 = sitofp i32 %204 to double
%206 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %205, double %203)
%207 = fdiv double %206, 2.000000e+00
store double %207, double* %15
%208 = load double, double* %11
%209 = load double, double* %14
%210 = fmul double %208, %209
%211 = load double, double* %15
%212 = fdiv double %210, %211
store double %212, double* %11
%213 = load double, double* %21
%214 = load double, double* %11
%215 = fadd double %213, %214
store double %215, double* %22
%216 = load i32, i32* %29
%217 = add nsw i32 %216, 1
store i32 %217, i32* %29
br label %168
218: ; preds = %181
%219 = load double, double* %21
%220 = load double*, double** %9
store double %219, double* %220
%221 = load double*, double** %9
%222 = load double, double* %221
%223 = fsub double 5.000000e-01, %222
%224 = fadd double 5.000000e-01, %223
%225 = load double*, double** %10
store double %224, double* %225
br label %226
226: ; preds = %218, %45, %37
ret void
}

LLVM IR (-O2):
define void @cdflib_cumchn(double* %0, double* %1, double* nocapture %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = bitcast double* %6 to i8*
%11 = bitcast double* %7 to i8*
%12 = bitcast double* %8 to i8*
%13 = bitcast double* %9 to i8*
%14 = load double, double* %0
%15 = fcmp ugt double %14, 0.000000e+00
br i1 %15, label %17, label %16
16: ; preds = %5
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %4
br label %119
17: ; preds = %5
%18 = load double, double* %2
%19 = fcmp ugt double %18, 1.000000e-10
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 @cdflib_cumchi(double* %0, double* %1, double* %3, double* %4)
br label %119
22: ; preds = %17
%23 = fmul double %18, 5.000000e-01
%24 = tail call i32 @cdflib_fifidint(double %23)
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i32 1, i32 %24
%27 = load double, double* %0
%28 = fmul double %27, 5.000000e-01
%29 = add nsw i32 %26, 1
%30 = sitofp i32 %29 to double
store double %30, double* %7
%31 = call double @cdflib_gamma_log(double* %7)
%32 = fneg double %23
%33 = sitofp i32 %26 to double
%34 = call double @log(double %23)
%35 = call double @llvm.fmuladd.f64(double %33, double %34, double %32)
%36 = fsub double %35, %31
%37 = call double @exp(double %36)
%38 = load double, double* %1
%39 = call double @llvm.fmuladd.f64(double %33, double 2.000000e+00, double %38)
store double %39, double* %8
%40 = call i32 @cdflib_cumchi(double* %0, double* %8, double* %6, double* %4)
%41 = load double, double* %1
%42 = call double @llvm.fmuladd.f64(double %33, double 2.000000e+00, double %41)
%43 = fmul double %42, 5.000000e-01
%44 = fadd double %43, 1.000000e+00
store double %44, double* %9
%45 = call double @cdflib_gamma_log(double* %9)
%46 = call double @log(double %28)
%47 = fneg double %28
%48 = call double @llvm.fmuladd.f64(double %43, double %46, double %47)
%49 = fsub double %48, %45
%50 = call double @exp(double %49)
%51 = load double, double* %6
%52 = fmul double %37, %51
%53 = load double, double* %1
%54 = insertelement <2 x double> <double poison, double 0.000000e+00>, double %37, i64 0
%55 = insertelement <2 x double> poison, double %23, i64 0
%56 = insertelement <2 x double> %55, double %28, i64 1
br label %67
57: ; preds = %67
%58 = shufflevector <2 x double> %80, <2 x double> %81, <2 x i32> <i32 0, i32 3>
%59 = add nuw nsw i32 %71, 1
%60 = fcmp olt double %86, 0x3BC79CA10C924223
%61 = fmul double %86, 1.000000e-05
%62 = fcmp olt double %85, %61
%63 = or i1 %60, %62
%64 = icmp eq i32 %87, 0
%65 = select i1 %63, i1 true, i1 %64
%66 = extractelement <2 x double> %79, i64 1
br i1 %65, label %89, label %67
67: ; preds = %57, %22
%68 = phi double [ %52, %22 ], [ %86, %57 ]
%69 = phi double [ %50, %22 ], [ %66, %57 ]
%70 = phi i32 [ %26, %22 ], [ %87, %57 ]
%71 = phi i32 [ 0, %22 ], [ %59, %57 ]
%72 = phi <2 x double> [ %54, %22 ], [ %58, %57 ]
%73 = sitofp i32 %70 to double
%74 = call double @llvm.fmuladd.f64(double %73, double 2.000000e+00, double %53)
%75 = fmul double %74, 5.000000e-01
%76 = fmul double %69, %75
%77 = insertelement <2 x double> poison, double %73, i64 0
%78 = insertelement <2 x double> %77, double %76, i64 1
%79 = fdiv <2 x double> %78, %56
%80 = fmul <2 x double> %72, %79
%81 = fadd <2 x double> %72, %79
%82 = extractelement <2 x double> %81, i64 1
%83 = fadd double %51, %82
%84 = extractelement <2 x double> %80, i64 0
%85 = fmul double %84, %83
%86 = fadd double %68, %85
%87 = add nsw i32 %70, -1
%88 = icmp eq i32 %71, 1000
br i1 %88, label %89, label %57
89: ; preds = %67, %57
br label %97
90: ; preds = %97
%91 = add nuw nsw i32 %103, 1
%92 = fadd double %114, %110
%93 = fcmp olt double %110, 0x3BC79CA10C924223
%94 = fmul double %110, 1.000000e-05
%95 = fcmp olt double %109, %94
%96 = or i1 %93, %95
br i1 %96, label %116, label %97
97: ; preds = %89, %90
%98 = phi double [ %110, %90 ], [ %86, %89 ]
%99 = phi double [ %92, %90 ], [ %50, %89 ]
%100 = phi double [ %107, %90 ], [ %37, %89 ]
%101 = phi double [ %114, %90 ], [ %50, %89 ]
%102 = phi i32 [ %104, %90 ], [ %26, %89 ]
%103 = phi i32 [ %91, %90 ], [ 0, %89 ]
%104 = add nsw i32 %102, 1
%105 = sitofp i32 %104 to double
%106 = fdiv double %23, %105
%107 = fmul double %100, %106
%108 = fsub double %51, %99
%109 = fmul double %108, %107
%110 = fadd double %98, %109
%111 = call double @llvm.fmuladd.f64(double %105, double 2.000000e+00, double %53)
%112 = fmul double %111, 5.000000e-01
%113 = fmul double %28, %101
%114 = fdiv double %113, %112
%115 = icmp eq i32 %103, 1000
br i1 %115, label %116, label %90
116: ; preds = %97, %90
store double %110, double* %3
%117 = fsub double 5.000000e-01, %110
%118 = fadd double %117, 5.000000e-01
store double %118, double* %4
br label %119
119: ; preds = %116, %20, %16
ret void
}