#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 chi_square(double, double, char const *);
double chi_square_density(double, double, char const *);
int /*<<< orphan*/ exit(int);
double fabs(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void chi_square_constants(double n, double p, double *c1, double *c2,
                          const char *prompt) {
  double delta_c1, delta_c2;
  static double last_n, last_p, last_c1, last_c2;
  double a11, a12, a21, a22, b1, b2;
  double det;
  static const double eps = 1e-10;
  if (n <= 0 || p <= 0 || p >= 1) {
    fprintf(stderr,
            "%s: IMPLEMENTATION ERROR! (Invalid argument in function "
            "\"chi_square_constants\")\n",
            prompt);
    exit(4);
  }
  if ((((n) != (n)) || ((last_n) != (last_n))
           ? (((n) != (n)) && ((last_n) != (last_n)) ? 1 : 0)
           : !(n < last_n || last_n < n)) &&
      (((p) != (p)) || ((last_p) != (last_p))
           ? (((p) != (p)) && ((last_p) != (last_p)) ? 1 : 0)
           : !(p < last_p || last_p < p))) {
    *c1 = last_c1;
    *c2 = last_c2;
    return;
  }
  *c1 = n;
  *c2 = n;
  while (1) {
    a11 = -chi_square_density(n, *c1, prompt);
    a12 = chi_square_density(n, *c2, prompt);
    a21 = -chi_square_density(n + 2, *c1, prompt);
    a22 = chi_square_density(n + 2, *c2, prompt);
    b1 = p + chi_square(n, *c1, prompt) - chi_square(n, *c2, prompt);
    b2 = p + chi_square(n + 2, *c1, prompt) - chi_square(n + 2, *c2, prompt);
    det = a11 * a22 - a12 * a21;
    delta_c1 = (b1 * a22 - b2 * a12) / det;
    delta_c2 = (b2 * a11 - b1 * a21) / det;
    if (fabs(delta_c1) < *c1 * eps && fabs(delta_c2) < *c2 * eps)
      break;
    if (*c1 + delta_c1 >= n)
      *c1 = (n + *c1) / 2;
    else if (*c1 + delta_c1 <= 0)
      *c1 /= 2;
    else
      *c1 += delta_c1;
    if (*c2 + delta_c2 <= n)
      *c2 = (n + *c2) / 2;
    else
      *c2 += delta_c2;
  }
  last_n = n;
  last_p = p;
  last_c1 = *c1;
  last_c2 = *c2;
  return;
}


x86 assembly (clang, -O0):
<chi_square_constants>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jae    1194 <chi_square_constants+0x54>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    1194 <chi_square_constants+0x54>
movsd  -0x10(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11b7 <chi_square_constants+0x77>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe90(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x4,%edi
call   1060 <exit@plt>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    11ee <chi_square_constants+0xae>
jp     11ee <chi_square_constants+0xae>
movsd  0x2e73(%rip),%xmm0
ucomisd 0x2e6b(%rip),%xmm0
jne    11ee <chi_square_constants+0xae>
jp     11ee <chi_square_constants+0xae>
jmp    1248 <chi_square_constants+0x108>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    1209 <chi_square_constants+0xc9>
jp     1209 <chi_square_constants+0xc9>
jmp    1239 <chi_square_constants+0xf9>
movsd  0x2e37(%rip),%xmm0
ucomisd 0x2e2f(%rip),%xmm0
jne    122a <chi_square_constants+0xea>
jp     122a <chi_square_constants+0xea>
jmp    1239 <chi_square_constants+0xf9>
mov    $0x1,%al
test   $0x1,%al
jne    1276 <chi_square_constants+0x136>
jmp    135a <chi_square_constants+0x21a>
xor    %eax,%eax
test   $0x1,%al
jne    1276 <chi_square_constants+0x136>
jmp    135a <chi_square_constants+0x21a>
movsd  -0x8(%rbp),%xmm1
movsd  0x2df3(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     135a <chi_square_constants+0x21a>
movsd  0x2de1(%rip),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     135a <chi_square_constants+0x21a>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    12ad <chi_square_constants+0x16d>
jp     12ad <chi_square_constants+0x16d>
movsd  0x2dbc(%rip),%xmm0
ucomisd 0x2db4(%rip),%xmm0
jne    12ad <chi_square_constants+0x16d>
jp     12ad <chi_square_constants+0x16d>
jmp    1307 <chi_square_constants+0x1c7>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    12c8 <chi_square_constants+0x188>
jp     12c8 <chi_square_constants+0x188>
jmp    12f8 <chi_square_constants+0x1b8>
movsd  0x2d80(%rip),%xmm0
ucomisd 0x2d78(%rip),%xmm0
jne    12e9 <chi_square_constants+0x1a9>
jp     12e9 <chi_square_constants+0x1a9>
jmp    12f8 <chi_square_constants+0x1b8>
mov    $0x1,%al
test   $0x1,%al
jne    1335 <chi_square_constants+0x1f5>
jmp    135a <chi_square_constants+0x21a>
xor    %eax,%eax
test   $0x1,%al
jne    1335 <chi_square_constants+0x1f5>
jmp    135a <chi_square_constants+0x21a>
movsd  -0x10(%rbp),%xmm1
movsd  0x2d3c(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     135a <chi_square_constants+0x21a>
movsd  0x2d2a(%rip),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     135a <chi_square_constants+0x21a>
movsd  0x2d1b(%rip),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0x2d13(%rip),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1712 <chi_square_constants+0x5d2>
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1030 <chi_square_density@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1030 <chi_square_density@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xc47(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1030 <chi_square_density@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xc0d(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1030 <chi_square_density@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1040 <chi_square@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1040 <chi_square@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xb7c(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1040 <chi_square@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xb4d(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rdi
call   1040 <chi_square@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
movaps 0xa78(%rip),%xmm0
pand   %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0xa50(%rip),%xmm0
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    15f5 <chi_square_constants+0x4b5>
movsd  -0x38(%rbp),%xmm1
movaps 0xa4e(%rip),%xmm0
pand   %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0xa26(%rip),%xmm0
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    15f5 <chi_square_constants+0x4b5>
jmp    16d8 <chi_square_constants+0x598>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x30(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1633 <chi_square_constants+0x4f3>
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0x9ee(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1680 <chi_square_constants+0x540>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
addsd  -0x30(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     166a <chi_square_constants+0x52a>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x9b3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    167b <chi_square_constants+0x53b>
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    1680 <chi_square_constants+0x540>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     16c2 <chi_square_constants+0x582>
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
addsd  (%rax),%xmm0
movsd  0x95f(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    16d3 <chi_square_constants+0x593>
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    1374 <chi_square_constants+0x234>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2963(%rip)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x295e(%rip)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x2956(%rip)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x294e(%rip)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chi_square_constants>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %rdx,%rbx
movsd  %xmm1,0x8(%rsp)
ucomisd 0xea3(%rip),%xmm1
jae    11d6 <chi_square_constants+0x96>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jae    11d6 <chi_square_constants+0x96>
ucomisd 0x8(%rsp),%xmm0
jae    11d6 <chi_square_constants+0x96>
mov    %rsi,%r14
mov    %rdi,%r15
ucomisd %xmm2,%xmm2
movsd  0x2ec1(%rip),%xmm0
jp     11f8 <chi_square_constants+0xb8>
ucomisd %xmm0,%xmm0
jp     1206 <chi_square_constants+0xc6>
ucomisd %xmm2,%xmm0
jne    1206 <chi_square_constants+0xc6>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm0
movsd  0x2ea9(%rip),%xmm0
jp     1200 <chi_square_constants+0xc0>
ucomisd %xmm0,%xmm0
jp     1206 <chi_square_constants+0xc6>
ucomisd 0x8(%rsp),%xmm0
jne    1206 <chi_square_constants+0xc6>
movsd  0x2e99(%rip),%xmm0
movsd  %xmm0,(%r15)
movsd  0x2e94(%rip),%xmm0
movsd  %xmm0,(%r14)
jmp    1472 <chi_square_constants+0x332>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    $0x4,%edi
call   1060 <exit@plt>
ucomisd %xmm0,%xmm0
jnp    1206 <chi_square_constants+0xc6>
jmp    1195 <chi_square_constants+0x55>
ucomisd %xmm0,%xmm0
jp     11b7 <chi_square_constants+0x77>
movsd  %xmm2,(%r15)
movsd  0xdf5(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
movapd %xmm2,%xmm0
movsd  %xmm2,0x10(%rsp)
jmp    126f <chi_square_constants+0x12f>
nopl   0x0(%rax)
addsd  %xmm2,%xmm0
movsd  0xddc(%rip),%xmm3
mulsd  %xmm3,%xmm0
movapd %xmm0,%xmm6
movsd  %xmm6,(%r15)
movsd  (%r14),%xmm1
addsd  %xmm1,%xmm5
addsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm5,%xmm0
cmpnlesd %xmm2,%xmm0
andpd  %xmm0,%xmm5
andnpd %xmm1,%xmm0
orpd   %xmm5,%xmm0
movsd  %xmm0,(%r14)
movsd  (%r15),%xmm1
movapd %xmm2,%xmm0
mov    %rbx,%rdi
call   1030 <chi_square_density@plt>
movapd %xmm0,0x80(%rsp)
movapd %xmm0,%xmm1
movapd 0xd96(%rip),%xmm0
xorpd  %xmm0,%xmm1
movapd %xmm1,0x70(%rsp)
movsd  (%r14),%xmm1
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <chi_square_density@plt>
movaps %xmm0,0x60(%rsp)
movsd  (%r15),%xmm1
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <chi_square_density@plt>
movaps %xmm0,0x50(%rsp)
movsd  (%r14),%xmm1
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <chi_square_density@plt>
movaps %xmm0,0x40(%rsp)
movsd  (%r15),%xmm1
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <chi_square@plt>
addsd  0x8(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
movsd  (%r14),%xmm1
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <chi_square@plt>
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  (%r15),%xmm1
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <chi_square@plt>
addsd  0x8(%rsp),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  (%r14),%xmm1
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <chi_square@plt>
movapd 0x40(%rsp),%xmm6
movapd 0x50(%rsp),%xmm5
movapd 0x30(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movapd %xmm1,%xmm2
xorpd  0xcaa(%rip),%xmm0
movapd 0x60(%rsp),%xmm1
unpcklpd %xmm1,%xmm1
unpcklpd %xmm5,%xmm0
mulpd  %xmm1,%xmm0
movapd 0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm5
unpcklpd 0x70(%rsp),%xmm1
unpcklpd %xmm6,%xmm6
mulpd  %xmm1,%xmm6
addpd  %xmm0,%xmm6
movapd %xmm6,%xmm0
unpckhpd %xmm6,%xmm0
divsd  %xmm0,%xmm6
mulsd  0x80(%rsp),%xmm2
subsd  %xmm2,%xmm5
divsd  %xmm0,%xmm5
movapd %xmm6,%xmm1
movapd 0xc63(%rip),%xmm3
andpd  %xmm3,%xmm1
movsd  (%r15),%xmm0
movapd %xmm0,%xmm2
movsd  0xc1e(%rip),%xmm4
mulsd  %xmm4,%xmm2
ucomisd %xmm1,%xmm2
jbe    1417 <chi_square_constants+0x2d7>
movapd %xmm5,%xmm2
andpd  %xmm3,%xmm2
movsd  (%r14),%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm4,%xmm3
ucomisd %xmm2,%xmm3
ja     1446 <chi_square_constants+0x306>
addsd  %xmm0,%xmm6
movsd  0x10(%rsp),%xmm2
ucomisd %xmm2,%xmm6
jae    1230 <chi_square_constants+0xf0>
xorpd  %xmm1,%xmm1
ucomisd %xmm6,%xmm1
movsd  0xbdd(%rip),%xmm3
jae    123c <chi_square_constants+0xfc>
jmp    1244 <chi_square_constants+0x104>
movsd  0x10(%rsp),%xmm2
movsd  %xmm2,0x2bf4(%rip)
movsd  0x8(%rsp),%xmm2
movsd  %xmm2,0x2bee(%rip)
movsd  %xmm0,0x2bee(%rip)
movsd  %xmm1,0x2bee(%rip)
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@chi_square_constants.last_n = internal global double 0.000000e+00
@chi_square_constants.last_p = internal global double 0.000000e+00
@chi_square_constants.last_c1 = internal global double 0.000000e+00
@chi_square_constants.last_c2 = internal global double 0.000000e+00
@chi_square_constants.eps = internal constant double 1.000000e-10
@stderr = global i32 0
@.str = [81 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22chi_square_constants\22)\0A\00"
define void @chi_square_constants(double %0, double %1, double* %2, double* %3, i8* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca i8*
%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
store double %0, double* %6
store double %1, double* %7
store double* %2, double** %8
store double* %3, double** %9
store i8* %4, i8** %10
%20 = load double, double* %6
%21 = fcmp ole double %20, 0.000000e+00
br i1 %21, label %28, label %22
22: ; preds = %5
%23 = load double, double* %7
%24 = fcmp ole double %23, 0.000000e+00
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load double, double* %7
%27 = fcmp oge double %26, 1.000000e+00
br i1 %27, label %28, label %33
28: ; preds = %25, %22, %5
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %10
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = call i32 @exit(i32 4)
unreachable
33: ; preds = %25
%34 = load double, double* %6
%35 = load double, double* %6
%36 = fcmp une double %34, %35
br i1 %36, label %41, label %37
37: ; preds = %33
%38 = load double, double* @chi_square_constants.last_n
%39 = load double, double* @chi_square_constants.last_n
%40 = fcmp une double %38, %39
br i1 %40, label %41, label %51
41: ; preds = %37, %33
%42 = load double, double* %6
%43 = load double, double* %6
%44 = fcmp une double %42, %43
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load double, double* @chi_square_constants.last_n
%47 = load double, double* @chi_square_constants.last_n
%48 = fcmp une double %46, %47
br i1 %48, label %49, label %50
49: ; preds = %45
br i1 true, label %59, label %90
50: ; preds = %45, %41
br i1 false, label %59, label %90
51: ; preds = %37
%52 = load double, double* %6
%53 = load double, double* @chi_square_constants.last_n
%54 = fcmp olt double %52, %53
br i1 %54, label %90, label %55
55: ; preds = %51
%56 = load double, double* @chi_square_constants.last_n
%57 = load double, double* %6
%58 = fcmp olt double %56, %57
br i1 %58, label %90, label %59
59: ; preds = %55, %50, %49
%60 = load double, double* %7
%61 = load double, double* %7
%62 = fcmp une double %60, %61
br i1 %62, label %67, label %63
63: ; preds = %59
%64 = load double, double* @chi_square_constants.last_p
%65 = load double, double* @chi_square_constants.last_p
%66 = fcmp une double %64, %65
br i1 %66, label %67, label %77
67: ; preds = %63, %59
%68 = load double, double* %7
%69 = load double, double* %7
%70 = fcmp une double %68, %69
br i1 %70, label %71, label %76
71: ; preds = %67
%72 = load double, double* @chi_square_constants.last_p
%73 = load double, double* @chi_square_constants.last_p
%74 = fcmp une double %72, %73
br i1 %74, label %75, label %76
75: ; preds = %71
br i1 true, label %85, label %90
76: ; preds = %71, %67
br i1 false, label %85, label %90
77: ; preds = %63
%78 = load double, double* %7
%79 = load double, double* @chi_square_constants.last_p
%80 = fcmp olt double %78, %79
br i1 %80, label %90, label %81
81: ; preds = %77
%82 = load double, double* @chi_square_constants.last_p
%83 = load double, double* %7
%84 = fcmp olt double %82, %83
br i1 %84, label %90, label %85
85: ; preds = %81, %76, %75
%86 = load double, double* @chi_square_constants.last_c1
%87 = load double*, double** %8
store double %86, double* %87
%88 = load double, double* @chi_square_constants.last_c2
%89 = load double*, double** %9
store double %88, double* %89
br label %244
90: ; preds = %81, %77, %76, %75, %55, %51, %50, %49
%91 = load double, double* %6
%92 = load double*, double** %8
store double %91, double* %92
%93 = load double, double* %6
%94 = load double*, double** %9
store double %93, double* %94
br label %95
95: ; preds = %90, %236
%96 = load double, double* %6
%97 = load double*, double** %8
%98 = load double, double* %97
%99 = load i8*, i8** %10
%100 = call double @chi_square_density(double %96, double %98, i8* %99)
%101 = fneg double %100
store double %101, double* %13
%102 = load double, double* %6
%103 = load double*, double** %9
%104 = load double, double* %103
%105 = load i8*, i8** %10
%106 = call double @chi_square_density(double %102, double %104, i8* %105)
store double %106, double* %14
%107 = load double, double* %6
%108 = fadd double %107, 2.000000e+00
%109 = load double*, double** %8
%110 = load double, double* %109
%111 = load i8*, i8** %10
%112 = call double @chi_square_density(double %108, double %110, i8* %111)
%113 = fneg double %112
store double %113, double* %15
%114 = load double, double* %6
%115 = fadd double %114, 2.000000e+00
%116 = load double*, double** %9
%117 = load double, double* %116
%118 = load i8*, i8** %10
%119 = call double @chi_square_density(double %115, double %117, i8* %118)
store double %119, double* %16
%120 = load double, double* %7
%121 = load double, double* %6
%122 = load double*, double** %8
%123 = load double, double* %122
%124 = load i8*, i8** %10
%125 = call double @chi_square(double %121, double %123, i8* %124)
%126 = fadd double %120, %125
%127 = load double, double* %6
%128 = load double*, double** %9
%129 = load double, double* %128
%130 = load i8*, i8** %10
%131 = call double @chi_square(double %127, double %129, i8* %130)
%132 = fsub double %126, %131
store double %132, double* %17
%133 = load double, double* %7
%134 = load double, double* %6
%135 = fadd double %134, 2.000000e+00
%136 = load double*, double** %8
%137 = load double, double* %136
%138 = load i8*, i8** %10
%139 = call double @chi_square(double %135, double %137, i8* %138)
%140 = fadd double %133, %139
%141 = load double, double* %6
%142 = fadd double %141, 2.000000e+00
%143 = load double*, double** %9
%144 = load double, double* %143
%145 = load i8*, i8** %10
%146 = call double @chi_square(double %142, double %144, i8* %145)
%147 = fsub double %140, %146
store double %147, double* %18
%148 = load double, double* %13
%149 = load double, double* %16
%150 = load double, double* %14
%151 = load double, double* %15
%152 = fmul double %150, %151
%153 = fneg double %152
%154 = call double @llvm.fmuladd.f64(double %148, double %149, double %153)
store double %154, double* %19
%155 = load double, double* %17
%156 = load double, double* %16
%157 = load double, double* %18
%158 = load double, double* %14
%159 = fmul double %157, %158
%160 = fneg double %159
%161 = call double @llvm.fmuladd.f64(double %155, double %156, double %160)
%162 = load double, double* %19
%163 = fdiv double %161, %162
store double %163, double* %11
%164 = load double, double* %18
%165 = load double, double* %13
%166 = load double, double* %17
%167 = load double, double* %15
%168 = fmul double %166, %167
%169 = fneg double %168
%170 = call double @llvm.fmuladd.f64(double %164, double %165, double %169)
%171 = load double, double* %19
%172 = fdiv double %170, %171
store double %172, double* %12
%173 = load double, double* %11
%174 = call double @llvm.fabs.f64(double %173)
%175 = load double*, double** %8
%176 = load double, double* %175
%177 = fmul double %176, 1.000000e-10
%178 = fcmp olt double %174, %177
br i1 %178, label %179, label %187
179: ; preds = %95
%180 = load double, double* %12
%181 = call double @llvm.fabs.f64(double %180)
%182 = load double*, double** %9
%183 = load double, double* %182
%184 = fmul double %183, 1.000000e-10
%185 = fcmp olt double %181, %184
br i1 %185, label %186, label %187
186: ; preds = %179
br label %237
187: ; preds = %179, %95
%188 = load double*, double** %8
%189 = load double, double* %188
%190 = load double, double* %11
%191 = fadd double %189, %190
%192 = load double, double* %6
%193 = fcmp oge double %191, %192
br i1 %193, label %194, label %201
194: ; preds = %187
%195 = load double, double* %6
%196 = load double*, double** %8
%197 = load double, double* %196
%198 = fadd double %195, %197
%199 = fdiv double %198, 2.000000e+00
%200 = load double*, double** %8
store double %199, double* %200
br label %217
201: ; preds = %187
%202 = load double*, double** %8
%203 = load double, double* %202
%204 = load double, double* %11
%205 = fadd double %203, %204
%206 = fcmp ole double %205, 0.000000e+00
br i1 %206, label %207, label %211
207: ; preds = %201
%208 = load double*, double** %8
%209 = load double, double* %208
%210 = fdiv double %209, 2.000000e+00
store double %210, double* %208
br label %216
211: ; preds = %201
%212 = load double, double* %11
%213 = load double*, double** %8
%214 = load double, double* %213
%215 = fadd double %214, %212
store double %215, double* %213
br label %216
216: ; preds = %211, %207
br label %217
217: ; preds = %216, %194
%218 = load double*, double** %9
%219 = load double, double* %218
%220 = load double, double* %12
%221 = fadd double %219, %220
%222 = load double, double* %6
%223 = fcmp ole double %221, %222
br i1 %223, label %224, label %231
224: ; preds = %217
%225 = load double, double* %6
%226 = load double*, double** %9
%227 = load double, double* %226
%228 = fadd double %225, %227
%229 = fdiv double %228, 2.000000e+00
%230 = load double*, double** %9
store double %229, double* %230
br label %236
231: ; preds = %217
%232 = load double, double* %12
%233 = load double*, double** %9
%234 = load double, double* %233
%235 = fadd double %234, %232
store double %235, double* %233
br label %236
236: ; preds = %231, %224
br label %95
237: ; preds = %186
%238 = load double, double* %6
store double %238, double* @chi_square_constants.last_n
%239 = load double, double* %7
store double %239, double* @chi_square_constants.last_p
%240 = load double*, double** %8
%241 = load double, double* %240
store double %241, double* @chi_square_constants.last_c1
%242 = load double*, double** %9
%243 = load double, double* %242
store double %243, double* @chi_square_constants.last_c2
br label %244
244: ; preds = %237, %85
ret void
}

LLVM IR (-O2):
@chi_square_constants.last_n = internal unnamed_addr global double 0.000000e+00
@chi_square_constants.last_p = internal unnamed_addr global double 0.000000e+00
@chi_square_constants.last_c1 = internal unnamed_addr global double 0.000000e+00
@chi_square_constants.last_c2 = internal unnamed_addr global double 0.000000e+00
@stderr = global i32 0
@.str = [81 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22chi_square_constants\22)\0A\00"
define void @chi_square_constants(double %0, double %1, double* nocapture %2, double* nocapture %3, i8* %4) {
%6 = fcmp ole double %0, 0.000000e+00
%7 = fcmp ole double %1, 0.000000e+00
%8 = or i1 %6, %7
%9 = fcmp oge double %1, 1.000000e+00
%10 = or i1 %9, %8
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %4)
%14 = tail call i32 @exit(i32 4)
unreachable
15: ; preds = %5
%16 = fcmp uno double %0, 0.000000e+00
%17 = load double, double* @chi_square_constants.last_n
br i1 %16, label %22, label %18
18: ; preds = %15
%19 = fcmp ord double %17, 0.000000e+00
%20 = fcmp ueq double %17, %0
%21 = and i1 %19, %20
br i1 %21, label %24, label %36
22: ; preds = %15
%23 = fcmp uno double %17, 0.000000e+00
br i1 %23, label %24, label %36
24: ; preds = %18, %22
%25 = fcmp uno double %1, 0.000000e+00
%26 = load double, double* @chi_square_constants.last_p
br i1 %25, label %31, label %27
27: ; preds = %24
%28 = fcmp ord double %26, 0.000000e+00
%29 = fcmp ueq double %26, %1
%30 = and i1 %28, %29
br i1 %30, label %33, label %36
31: ; preds = %24
%32 = fcmp uno double %26, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %27, %31
%34 = load double, double* @chi_square_constants.last_c1
store double %34, double* %2
%35 = load double, double* @chi_square_constants.last_c2
store double %35, double* %3
br label %106
36: ; preds = %27, %18, %31, %22
store double %0, double* %2
%37 = fadd double %0, 2.000000e+00
br label %38
38: ; preds = %97, %36
%39 = phi double [ %104, %97 ], [ %0, %36 ]
store double %39, double* %3
%40 = load double, double* %2
%41 = tail call double @chi_square_density(double %0, double %40, i8* %4)
%42 = fneg double %41
%43 = load double, double* %3
%44 = tail call double @chi_square_density(double %0, double %43, i8* %4)
%45 = load double, double* %2
%46 = tail call double @chi_square_density(double %37, double %45, i8* %4)
%47 = load double, double* %3
%48 = tail call double @chi_square_density(double %37, double %47, i8* %4)
%49 = load double, double* %2
%50 = tail call double @chi_square(double %0, double %49, i8* %4)
%51 = fadd double %50, %1
%52 = load double, double* %3
%53 = tail call double @chi_square(double %0, double %52, i8* %4)
%54 = fsub double %51, %53
%55 = load double, double* %2
%56 = tail call double @chi_square(double %37, double %55, i8* %4)
%57 = fadd double %56, %1
%58 = load double, double* %3
%59 = tail call double @chi_square(double %37, double %58, i8* %4)
%60 = fsub double %57, %59
%61 = fneg double %60
%62 = insertelement <2 x double> poison, double %44, i64 0
%63 = shufflevector <2 x double> %62, <2 x double> poison, <2 x i32> zeroinitializer
%64 = insertelement <2 x double> poison, double %61, i64 0
%65 = insertelement <2 x double> %64, double %46, i64 1
%66 = fmul <2 x double> %63, %65
%67 = insertelement <2 x double> poison, double %54, i64 0
%68 = insertelement <2 x double> %67, double %42, i64 1
%69 = insertelement <2 x double> poison, double %48, i64 0
%70 = shufflevector <2 x double> %69, <2 x double> poison, <2 x i32> zeroinitializer
%71 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %68, <2 x double> %70, <2 x double> %66)
%72 = extractelement <2 x double> %71, i64 0
%73 = extractelement <2 x double> %71, i64 1
%74 = fdiv double %72, %73
%75 = fmul double %46, %54
%76 = tail call double @llvm.fmuladd.f64(double %60, double %42, double %75)
%77 = fdiv double %76, %73
%78 = tail call double @llvm.fabs.f64(double %74)
%79 = load double, double* %2
%80 = fmul double %79, 1.000000e-10
%81 = fcmp olt double %78, %80
br i1 %81, label %82, label %87
82: ; preds = %38
%83 = tail call double @llvm.fabs.f64(double %77)
%84 = load double, double* %3
%85 = fmul double %84, 1.000000e-10
%86 = fcmp olt double %83, %85
br i1 %86, label %105, label %87
87: ; preds = %82, %38
%88 = fadd double %79, %74
%89 = fcmp ult double %88, %0
br i1 %89, label %93, label %90
90: ; preds = %87
%91 = fadd double %79, %0
%92 = fmul double %91, 5.000000e-01
br label %97
93: ; preds = %87
%94 = fcmp ugt double %88, 0.000000e+00
br i1 %94, label %97, label %95
95: ; preds = %93
%96 = fmul double %79, 5.000000e-01
br label %97
97: ; preds = %93, %95, %90
%98 = phi double [ %96, %95 ], [ %92, %90 ], [ %88, %93 ]
store double %98, double* %2
%99 = load double, double* %3
%100 = fadd double %77, %99
%101 = fcmp ugt double %100, %0
%102 = fadd double %99, %0
%103 = fmul double %102, 5.000000e-01
%104 = select i1 %101, double %100, double %103
br label %38
105: ; preds = %82
store double %0, double* @chi_square_constants.last_n
store double %1, double* @chi_square_constants.last_p
store double %79, double* @chi_square_constants.last_c1
store double %84, double* @chi_square_constants.last_c2
br label %106
106: ; preds = %105, %33
ret void
}