#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;
double chi_square_inv(double n, double p, const char *prompt) {
  static double last_n = -1, last_p = -1, last_x = -1;
  static double last_last_n = -1, last_last_p = -1, last_last_x = -1;
  double x, xx;
  static const double eps = 1e-10;
  if (n <= 0 || p <= 0 || p >= 1) {
    fprintf(stderr,
            "%s: IMPLEMENTATION ERROR! (Invalid argument in function "
            "\"chi_square_inv\")\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)))
    return last_x;
  if ((((n) != (n)) || ((last_last_n) != (last_last_n))
           ? (((n) != (n)) && ((last_last_n) != (last_last_n)) ? 1 : 0)
           : !(n < last_last_n || last_last_n < n)) &&
      (((p) != (p)) || ((last_last_p) != (last_last_p))
           ? (((p) != (p)) && ((last_last_p) != (last_last_p)) ? 1 : 0)
           : !(p < last_last_p || last_last_p < p)))
    return last_last_x;
  x = n;
  while (1) {
    xx = x - (chi_square(n, x, prompt) - p) / chi_square_density(n, x, prompt);
    if (fabs(xx - x) < x * eps)
      break;
    if (xx < 0)
      x /= 2;
    else
      x = xx;
  }
  last_last_n = last_n;
  last_last_p = last_p;
  last_last_x = last_x;
  last_n = n;
  last_p = p;
  last_x = x;
  return x;
}


x86 assembly (clang, -O0):
<chi_square_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    1189 <chi_square_inv+0x49>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jae    1189 <chi_square_inv+0x49>
movsd  -0x18(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ac <chi_square_inv+0x6c>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe9b(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x4,%edi
call   1060 <exit@plt>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    11e3 <chi_square_inv+0xa3>
jp     11e3 <chi_square_inv+0xa3>
movsd  0x2e76(%rip),%xmm0
ucomisd 0x2e6e(%rip),%xmm0
jne    11e3 <chi_square_inv+0xa3>
jp     11e3 <chi_square_inv+0xa3>
jmp    123d <chi_square_inv+0xfd>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    11fe <chi_square_inv+0xbe>
jp     11fe <chi_square_inv+0xbe>
jmp    122e <chi_square_inv+0xee>
movsd  0x2e3a(%rip),%xmm0
ucomisd 0x2e32(%rip),%xmm0
jne    121f <chi_square_inv+0xdf>
jp     121f <chi_square_inv+0xdf>
jmp    122e <chi_square_inv+0xee>
mov    $0x1,%al
test   $0x1,%al
jne    126b <chi_square_inv+0x12b>
jmp    133c <chi_square_inv+0x1fc>
xor    %eax,%eax
test   $0x1,%al
jne    126b <chi_square_inv+0x12b>
jmp    133c <chi_square_inv+0x1fc>
movsd  -0x10(%rbp),%xmm1
movsd  0x2df6(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     133c <chi_square_inv+0x1fc>
movsd  0x2de4(%rip),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     133c <chi_square_inv+0x1fc>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    12a2 <chi_square_inv+0x162>
jp     12a2 <chi_square_inv+0x162>
movsd  0x2dbf(%rip),%xmm0
ucomisd 0x2db7(%rip),%xmm0
jne    12a2 <chi_square_inv+0x162>
jp     12a2 <chi_square_inv+0x162>
jmp    12fc <chi_square_inv+0x1bc>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    12bd <chi_square_inv+0x17d>
jp     12bd <chi_square_inv+0x17d>
jmp    12ed <chi_square_inv+0x1ad>
movsd  0x2d83(%rip),%xmm0
ucomisd 0x2d7b(%rip),%xmm0
jne    12de <chi_square_inv+0x19e>
jp     12de <chi_square_inv+0x19e>
jmp    12ed <chi_square_inv+0x1ad>
mov    $0x1,%al
test   $0x1,%al
jne    132a <chi_square_inv+0x1ea>
jmp    133c <chi_square_inv+0x1fc>
xor    %eax,%eax
test   $0x1,%al
jne    132a <chi_square_inv+0x1ea>
jmp    133c <chi_square_inv+0x1fc>
movsd  -0x18(%rbp),%xmm1
movsd  0x2d3f(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     133c <chi_square_inv+0x1fc>
movsd  0x2d2d(%rip),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     133c <chi_square_inv+0x1fc>
movsd  0x2d1e(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15f4 <chi_square_inv+0x4b4>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    1373 <chi_square_inv+0x233>
jp     1373 <chi_square_inv+0x233>
movsd  0x2cfe(%rip),%xmm0
ucomisd 0x2cf6(%rip),%xmm0
jne    1373 <chi_square_inv+0x233>
jp     1373 <chi_square_inv+0x233>
jmp    13cd <chi_square_inv+0x28d>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    138e <chi_square_inv+0x24e>
jp     138e <chi_square_inv+0x24e>
jmp    13be <chi_square_inv+0x27e>
movsd  0x2cc2(%rip),%xmm0
ucomisd 0x2cba(%rip),%xmm0
jne    13af <chi_square_inv+0x26f>
jp     13af <chi_square_inv+0x26f>
jmp    13be <chi_square_inv+0x27e>
mov    $0x1,%al
test   $0x1,%al
jne    13fb <chi_square_inv+0x2bb>
jmp    14cc <chi_square_inv+0x38c>
xor    %eax,%eax
test   $0x1,%al
jne    13fb <chi_square_inv+0x2bb>
jmp    14cc <chi_square_inv+0x38c>
movsd  -0x10(%rbp),%xmm1
movsd  0x2c7e(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     14cc <chi_square_inv+0x38c>
movsd  0x2c6c(%rip),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     14cc <chi_square_inv+0x38c>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1432 <chi_square_inv+0x2f2>
jp     1432 <chi_square_inv+0x2f2>
movsd  0x2c47(%rip),%xmm0
ucomisd 0x2c3f(%rip),%xmm0
jne    1432 <chi_square_inv+0x2f2>
jp     1432 <chi_square_inv+0x2f2>
jmp    148c <chi_square_inv+0x34c>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    144d <chi_square_inv+0x30d>
jp     144d <chi_square_inv+0x30d>
jmp    147d <chi_square_inv+0x33d>
movsd  0x2c0b(%rip),%xmm0
ucomisd 0x2c03(%rip),%xmm0
jne    146e <chi_square_inv+0x32e>
jp     146e <chi_square_inv+0x32e>
jmp    147d <chi_square_inv+0x33d>
mov    $0x1,%al
test   $0x1,%al
jne    14ba <chi_square_inv+0x37a>
jmp    14cc <chi_square_inv+0x38c>
xor    %eax,%eax
test   $0x1,%al
jne    14ba <chi_square_inv+0x37a>
jmp    14cc <chi_square_inv+0x38c>
movsd  -0x18(%rbp),%xmm1
movsd  0x2bc7(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     14cc <chi_square_inv+0x38c>
movsd  0x2bb5(%rip),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     14cc <chi_square_inv+0x38c>
movsd  0x2ba6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    15f4 <chi_square_inv+0x4b4>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
call   1040 <chi_square@plt>
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
call   1030 <chi_square_density@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
movaps 0xae5(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xac1(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    155b <chi_square_inv+0x41b>
jmp    1593 <chi_square_inv+0x453>
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1584 <chi_square_inv+0x444>
movsd  -0x28(%rbp),%xmm0
movsd  0xa9a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    158e <chi_square_inv+0x44e>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    14d6 <chi_square_inv+0x396>
movsd  0x2aa5(%rip),%xmm0
movsd  %xmm0,0x2ab5(%rip)
movsd  0x2a9d(%rip),%xmm0
movsd  %xmm0,0x2aad(%rip)
movsd  0x2a95(%rip),%xmm0
movsd  %xmm0,0x2aa5(%rip)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2a70(%rip)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,0x2a6b(%rip)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,0x2a66(%rip)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chi_square_inv>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
ucomisd 0xea4(%rip),%xmm1
jae    11cb <chi_square_inv+0x8b>
xorpd  %xmm0,%xmm0
ucomisd 0x8(%rsp),%xmm0
jae    11cb <chi_square_inv+0x8b>
ucomisd 0x10(%rsp),%xmm0
jae    11cb <chi_square_inv+0x8b>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm0
movsd  0x2ebc(%rip),%xmm0
jp     11ed <chi_square_inv+0xad>
ucomisd %xmm0,%xmm0
jp     121f <chi_square_inv+0xdf>
ucomisd 0x8(%rsp),%xmm0
jne    121f <chi_square_inv+0xdf>
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm0
movsd  0x2e9a(%rip),%xmm0
jp     120d <chi_square_inv+0xcd>
ucomisd %xmm0,%xmm0
jp     1213 <chi_square_inv+0xd3>
ucomisd 0x10(%rsp),%xmm0
jne    1213 <chi_square_inv+0xd3>
movsd  0x2e8a(%rip),%xmm1
jmp    1376 <chi_square_inv+0x236>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    $0x4,%edi
call   1060 <exit@plt>
ucomisd %xmm0,%xmm0
jp     119c <chi_square_inv+0x5c>
movsd  0x2e5d(%rip),%xmm0
ucomisd %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
jnp    12b1 <chi_square_inv+0x171>
jmp    1243 <chi_square_inv+0x103>
ucomisd %xmm0,%xmm0
jp     11be <chi_square_inv+0x7e>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm0
jp     11f3 <chi_square_inv+0xb3>
movsd  0x2e31(%rip),%xmm0
ucomisd %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
jp     12b1 <chi_square_inv+0x171>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    12b1 <chi_square_inv+0x171>
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm0
movsd  0x2e0b(%rip),%xmm0
jp     127e <chi_square_inv+0x13e>
ucomisd %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
jp     12b1 <chi_square_inv+0x171>
ucomisd 0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
jne    12b1 <chi_square_inv+0x171>
movsd  0x2def(%rip),%xmm1
jmp    1376 <chi_square_inv+0x236>
ucomisd %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
jnp    12b1 <chi_square_inv+0x171>
jmp    1271 <chi_square_inv+0x131>
nopl   0x0(%rax)
mulsd  0xd78(%rip),%xmm1
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm2
cmpltsd %xmm3,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm2,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <chi_square@plt>
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
mov    %rbx,%rdi
call   1030 <chi_square_density@plt>
movapd 0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
andpd  0xd14(%rip),%xmm3
movsd  0xcf4(%rip),%xmm2
mulsd  %xmm1,%xmm2
ucomisd %xmm3,%xmm2
jbe    1290 <chi_square_inv+0x150>
movsd  0x2d16(%rip),%xmm0
movsd  %xmm0,0x2d26(%rip)
movsd  0x2d0e(%rip),%xmm0
movsd  %xmm0,0x2d1e(%rip)
movsd  0x2d06(%rip),%xmm0
movsd  %xmm0,0x2d16(%rip)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x2ce0(%rip)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x2cda(%rip)
movsd  %xmm1,0x2cda(%rip)
movapd %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@chi_square_inv.last_n = internal global double -1.000000e+00
@chi_square_inv.last_p = internal global double -1.000000e+00
@chi_square_inv.last_x = internal global double -1.000000e+00
@chi_square_inv.last_last_n = internal global double -1.000000e+00
@chi_square_inv.last_last_p = internal global double -1.000000e+00
@chi_square_inv.last_last_x = internal global double -1.000000e+00
@chi_square_inv.eps = internal constant double 1.000000e-10
@stderr = global i32 0
@.str = [75 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22chi_square_inv\22)\0A\00"
define double @chi_square_inv(double %0, double %1, i8* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i8*
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store i8* %2, i8** %7
%10 = load double, double* %5
%11 = fcmp ole double %10, 0.000000e+00
br i1 %11, label %18, label %12
12: ; preds = %3
%13 = load double, double* %6
%14 = fcmp ole double %13, 0.000000e+00
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load double, double* %6
%17 = fcmp oge double %16, 1.000000e+00
br i1 %17, label %18, label %23
18: ; preds = %15, %12, %3
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %7
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 4)
unreachable
23: ; preds = %15
%24 = load double, double* %5
%25 = load double, double* %5
%26 = fcmp une double %24, %25
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load double, double* @chi_square_inv.last_n
%29 = load double, double* @chi_square_inv.last_n
%30 = fcmp une double %28, %29
br i1 %30, label %31, label %41
31: ; preds = %27, %23
%32 = load double, double* %5
%33 = load double, double* %5
%34 = fcmp une double %32, %33
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load double, double* @chi_square_inv.last_n
%37 = load double, double* @chi_square_inv.last_n
%38 = fcmp une double %36, %37
br i1 %38, label %39, label %40
39: ; preds = %35
br i1 true, label %49, label %77
40: ; preds = %35, %31
br i1 false, label %49, label %77
41: ; preds = %27
%42 = load double, double* %5
%43 = load double, double* @chi_square_inv.last_n
%44 = fcmp olt double %42, %43
br i1 %44, label %77, label %45
45: ; preds = %41
%46 = load double, double* @chi_square_inv.last_n
%47 = load double, double* %5
%48 = fcmp olt double %46, %47
br i1 %48, label %77, label %49
49: ; preds = %45, %40, %39
%50 = load double, double* %6
%51 = load double, double* %6
%52 = fcmp une double %50, %51
br i1 %52, label %57, label %53
53: ; preds = %49
%54 = load double, double* @chi_square_inv.last_p
%55 = load double, double* @chi_square_inv.last_p
%56 = fcmp une double %54, %55
br i1 %56, label %57, label %67
57: ; preds = %53, %49
%58 = load double, double* %6
%59 = load double, double* %6
%60 = fcmp une double %58, %59
br i1 %60, label %61, label %66
61: ; preds = %57
%62 = load double, double* @chi_square_inv.last_p
%63 = load double, double* @chi_square_inv.last_p
%64 = fcmp une double %62, %63
br i1 %64, label %65, label %66
65: ; preds = %61
br i1 true, label %75, label %77
66: ; preds = %61, %57
br i1 false, label %75, label %77
67: ; preds = %53
%68 = load double, double* %6
%69 = load double, double* @chi_square_inv.last_p
%70 = fcmp olt double %68, %69
br i1 %70, label %77, label %71
71: ; preds = %67
%72 = load double, double* @chi_square_inv.last_p
%73 = load double, double* %6
%74 = fcmp olt double %72, %73
br i1 %74, label %77, label %75
75: ; preds = %71, %66, %65
%76 = load double, double* @chi_square_inv.last_x
store double %76, double* %4
br label %172
77: ; preds = %71, %67, %66, %65, %45, %41, %40, %39
%78 = load double, double* %5
%79 = load double, double* %5
%80 = fcmp une double %78, %79
br i1 %80, label %85, label %81
81: ; preds = %77
%82 = load double, double* @chi_square_inv.last_last_n
%83 = load double, double* @chi_square_inv.last_last_n
%84 = fcmp une double %82, %83
br i1 %84, label %85, label %95
85: ; preds = %81, %77
%86 = load double, double* %5
%87 = load double, double* %5
%88 = fcmp une double %86, %87
br i1 %88, label %89, label %94
89: ; preds = %85
%90 = load double, double* @chi_square_inv.last_last_n
%91 = load double, double* @chi_square_inv.last_last_n
%92 = fcmp une double %90, %91
br i1 %92, label %93, label %94
93: ; preds = %89
br i1 true, label %103, label %131
94: ; preds = %89, %85
br i1 false, label %103, label %131
95: ; preds = %81
%96 = load double, double* %5
%97 = load double, double* @chi_square_inv.last_last_n
%98 = fcmp olt double %96, %97
br i1 %98, label %131, label %99
99: ; preds = %95
%100 = load double, double* @chi_square_inv.last_last_n
%101 = load double, double* %5
%102 = fcmp olt double %100, %101
br i1 %102, label %131, label %103
103: ; preds = %99, %94, %93
%104 = load double, double* %6
%105 = load double, double* %6
%106 = fcmp une double %104, %105
br i1 %106, label %111, label %107
107: ; preds = %103
%108 = load double, double* @chi_square_inv.last_last_p
%109 = load double, double* @chi_square_inv.last_last_p
%110 = fcmp une double %108, %109
br i1 %110, label %111, label %121
111: ; preds = %107, %103
%112 = load double, double* %6
%113 = load double, double* %6
%114 = fcmp une double %112, %113
br i1 %114, label %115, label %120
115: ; preds = %111
%116 = load double, double* @chi_square_inv.last_last_p
%117 = load double, double* @chi_square_inv.last_last_p
%118 = fcmp une double %116, %117
br i1 %118, label %119, label %120
119: ; preds = %115
br i1 true, label %129, label %131
120: ; preds = %115, %111
br i1 false, label %129, label %131
121: ; preds = %107
%122 = load double, double* %6
%123 = load double, double* @chi_square_inv.last_last_p
%124 = fcmp olt double %122, %123
br i1 %124, label %131, label %125
125: ; preds = %121
%126 = load double, double* @chi_square_inv.last_last_p
%127 = load double, double* %6
%128 = fcmp olt double %126, %127
br i1 %128, label %131, label %129
129: ; preds = %125, %120, %119
%130 = load double, double* @chi_square_inv.last_last_x
store double %130, double* %4
br label %172
131: ; preds = %125, %121, %120, %119, %99, %95, %94, %93
%132 = load double, double* %5
store double %132, double* %8
br label %133
133: ; preds = %131, %163
%134 = load double, double* %8
%135 = load double, double* %5
%136 = load double, double* %8
%137 = load i8*, i8** %7
%138 = call double @chi_square(double %135, double %136, i8* %137)
%139 = load double, double* %6
%140 = fsub double %138, %139
%141 = load double, double* %5
%142 = load double, double* %8
%143 = load i8*, i8** %7
%144 = call double @chi_square_density(double %141, double %142, i8* %143)
%145 = fdiv double %140, %144
%146 = fsub double %134, %145
store double %146, double* %9
%147 = load double, double* %9
%148 = load double, double* %8
%149 = fsub double %147, %148
%150 = call double @llvm.fabs.f64(double %149)
%151 = load double, double* %8
%152 = fmul double %151, 1.000000e-10
%153 = fcmp olt double %150, %152
br i1 %153, label %154, label %155
154: ; preds = %133
br label %164
155: ; preds = %133
%156 = load double, double* %9
%157 = fcmp olt double %156, 0.000000e+00
br i1 %157, label %158, label %161
158: ; preds = %155
%159 = load double, double* %8
%160 = fdiv double %159, 2.000000e+00
store double %160, double* %8
br label %163
161: ; preds = %155
%162 = load double, double* %9
store double %162, double* %8
br label %163
163: ; preds = %161, %158
br label %133
164: ; preds = %154
%165 = load double, double* @chi_square_inv.last_n
store double %165, double* @chi_square_inv.last_last_n
%166 = load double, double* @chi_square_inv.last_p
store double %166, double* @chi_square_inv.last_last_p
%167 = load double, double* @chi_square_inv.last_x
store double %167, double* @chi_square_inv.last_last_x
%168 = load double, double* %5
store double %168, double* @chi_square_inv.last_n
%169 = load double, double* %6
store double %169, double* @chi_square_inv.last_p
%170 = load double, double* %8
store double %170, double* @chi_square_inv.last_x
%171 = load double, double* %8
store double %171, double* %4
br label %172
172: ; preds = %164, %129, %75
%173 = load double, double* %4
ret double %173
}

LLVM IR (-O2):
@chi_square_inv.last_n = internal unnamed_addr global double -1.000000e+00
@chi_square_inv.last_p = internal unnamed_addr global double -1.000000e+00
@chi_square_inv.last_x = internal unnamed_addr global double -1.000000e+00
@chi_square_inv.last_last_n = internal unnamed_addr global double -1.000000e+00
@chi_square_inv.last_last_p = internal unnamed_addr global double -1.000000e+00
@chi_square_inv.last_last_x = internal unnamed_addr global double -1.000000e+00
@stderr = global i32 0
@.str = [75 x i8] c"%s: IMPLEMENTATION ERROR! (Invalid argument in function \22chi_square_inv\22)\0A\00"
define double @chi_square_inv(double %0, double %1, i8* %2) {
%4 = fcmp ole double %0, 0.000000e+00
%5 = fcmp ole double %1, 0.000000e+00
%6 = or i1 %4, %5
%7 = fcmp oge double %1, 1.000000e+00
%8 = or i1 %7, %6
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %2)
%12 = tail call i32 @exit(i32 4)
unreachable
13: ; preds = %3
%14 = fcmp uno double %0, 0.000000e+00
%15 = load double, double* @chi_square_inv.last_n
br i1 %14, label %20, label %16
16: ; preds = %13
%17 = fcmp ord double %15, 0.000000e+00
%18 = fcmp ueq double %15, %0
%19 = and i1 %17, %18
br i1 %19, label %22, label %34
20: ; preds = %13
%21 = fcmp uno double %15, 0.000000e+00
br i1 %21, label %22, label %39
22: ; preds = %16, %20
%23 = fcmp uno double %1, 0.000000e+00
%24 = load double, double* @chi_square_inv.last_p
br i1 %23, label %29, label %25
25: ; preds = %22
%26 = fcmp ord double %24, 0.000000e+00
%27 = fcmp ueq double %24, %1
%28 = and i1 %26, %27
br i1 %28, label %31, label %33
29: ; preds = %22
%30 = fcmp uno double %24, 0.000000e+00
br i1 %30, label %31, label %33
31: ; preds = %25, %29
%32 = load double, double* @chi_square_inv.last_x
br label %73
33: ; preds = %25, %29
br i1 %14, label %39, label %34
34: ; preds = %16, %33
%35 = load double, double* @chi_square_inv.last_last_n
%36 = fcmp ord double %35, 0.000000e+00
%37 = fcmp ueq double %35, %0
%38 = and i1 %36, %37
br i1 %38, label %43, label %42
39: ; preds = %20, %33
%40 = load double, double* @chi_square_inv.last_last_n
%41 = fcmp uno double %40, 0.000000e+00
br i1 %41, label %43, label %42
42: ; preds = %46, %34, %50, %39
br label %54
43: ; preds = %34, %39
%44 = fcmp uno double %1, 0.000000e+00
%45 = load double, double* @chi_square_inv.last_last_p
br i1 %44, label %50, label %46
46: ; preds = %43
%47 = fcmp ord double %45, 0.000000e+00
%48 = fcmp ueq double %45, %1
%49 = and i1 %47, %48
br i1 %49, label %52, label %42
50: ; preds = %43
%51 = fcmp uno double %45, 0.000000e+00
br i1 %51, label %52, label %42
52: ; preds = %46, %50
%53 = load double, double* @chi_square_inv.last_last_x
br label %73
54: ; preds = %42, %65
%55 = phi double [ %68, %65 ], [ %0, %42 ]
%56 = tail call double @chi_square(double %0, double %55, i8* %2)
%57 = fsub double %56, %1
%58 = tail call double @chi_square_density(double %0, double %55, i8* %2)
%59 = fdiv double %57, %58
%60 = fsub double %55, %59
%61 = fsub double %60, %55
%62 = tail call double @llvm.fabs.f64(double %61)
%63 = fmul double %55, 1.000000e-10
%64 = fcmp olt double %62, %63
br i1 %64, label %69, label %65
65: ; preds = %54
%66 = fcmp olt double %60, 0.000000e+00
%67 = fmul double %55, 5.000000e-01
%68 = select i1 %66, double %67, double %60
br label %54
69: ; preds = %54
%70 = load double, double* @chi_square_inv.last_n
store double %70, double* @chi_square_inv.last_last_n
%71 = load double, double* @chi_square_inv.last_p
store double %71, double* @chi_square_inv.last_last_p
%72 = load double, double* @chi_square_inv.last_x
store double %72, double* @chi_square_inv.last_last_x
store double %0, double* @chi_square_inv.last_n
store double %1, double* @chi_square_inv.last_p
store double %55, double* @chi_square_inv.last_x
br label %73
73: ; preds = %69, %52, %31
%74 = phi double [ %32, %31 ], [ %53, %52 ], [ %55, %69 ]
ret double %74
}