#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 IncompleteGamma(double, int, int /*<<< orphan*/);
int /*<<< orphan*/ LnGammaFunction(int);
double QuantileChi2(double, double);
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, double *);
int main(int argc, char *argv[]) {
  int i, j, n = 20, ndf = 200, nprob = 8, option = 0, df;
  double chi2, d = 1.0 / n, prob[] = {.005, .025, .1, .5, .90, .95, .99, .999};
  if (argc != 2 && argc != 3) {
    printf("\n\nChi-square critical values\n");
    for (i = 0; i < ndf; i++) {
      if (i % 15 == 0) {
        printf("\n\t\t\t\tSignificance level\n");
        printf("\n DF ");
        for (j = 0; j < nprob; j++)
          printf("%9.4f", 1 - prob[j]);
        printf("\n");
      }
      printf("\n%3d ", i + 1);
      for (j = 0; j < nprob; j++)
        printf("%9.4f", QuantileChi2(prob[j], (double)(i + 1)));
      if (i % 5 == 4)
        printf("\n");
      if (i % 15 == 14) {
        printf("\nENTER for more, (q+ENTER) for quit... ");
        if (getchar() == 'q')
          break;
      }
    }
  } else if (argc == 2) {
    for (;;) {
      printf("\nd.f. & Chi^2 value (Ctrl-c to break)? ");
      scanf("%d%lf", &df, &chi2);
      if (df < 1 || chi2 < 0)
        break;
      prob[0] = 1 - IncompleteGamma((0.5) * (chi2), (df) / 2.0,
                                    LnGammaFunction((df) / 2.0));
      printf("\ndf = %2d  prob = %.9f = %.3e\n", df, prob[0], prob[0]);
    }
  } else if (argc == 3) {
    df = atoi(argv[1]);
    chi2 = atof(argv[2]);
    if (df < 1 || chi2 < 0) {
      printf("df = %2d  ch2 = %.4f invalid", df, chi2);
      exit(-1);
    }
    prob[0] = 1 - IncompleteGamma((0.5) * (chi2), (df) / 2.0,
                                  LnGammaFunction((df) / 2.0));
    printf("\ndf = %2d  prob = %.9f = %.3e\n", df, prob[0], prob[0]);
  }
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x14,-0x1c(%rbp)
movl   $0xc8,-0x20(%rbp)
movl   $0x8,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xe1e(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe2a(%rip),%rsi
mov    $0x40,%edx
call   1080 <memcpy@plt>
cmpl   $0x2,-0x8(%rbp)
je     1389 <main+0x1e9>
cmpl   $0x3,-0x8(%rbp)
je     1389 <main+0x1e9>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1384 <main+0x1e4>
mov    -0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12b4 <main+0x114>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12a6 <main+0x106>
movslq -0x18(%rbp),%rax
movsd  0xd7c(%rip),%xmm0
subsd  -0x80(%rbp,%rax,8),%xmm0
lea    0xe0c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    126c <main+0xcc>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1310 <main+0x170>
movslq -0x18(%rbp),%rax
movsd  -0x80(%rbp,%rax,8),%xmm0
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
call   10c0 <QuantileChi2@plt>
lea    0xda2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12cf <main+0x12f>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
jne    1332 <main+0x192>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0xe,%edx
jne    1371 <main+0x1d1>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
movsbl %al,%eax
cmp    $0x71,%eax
jne    136c <main+0x1cc>
jmp    1384 <main+0x1e4>
jmp    1371 <main+0x1d1>
jmp    1376 <main+0x1d6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1229 <main+0x89>
jmp    1567 <main+0x3c7>
cmpl   $0x2,-0x8(%rbp)
jne    146d <main+0x2cd>
jmp    1398 <main+0x1f8>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd4c(%rip),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1090 <scanf@plt>
cmpl   $0x1,-0x2c(%rbp)
jl     13d2 <main+0x232>
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    13d7 <main+0x237>
jmp    1468 <main+0x2c8>
movsd  0xc31(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  0xc0f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x84(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  0xbf4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <LnGammaFunction@plt>
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x84(%rbp),%edi
mov    %eax,%esi
call   1060 <IncompleteGamma@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x2c(%rbp),%esi
movsd  -0x80(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
lea    0xca3(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
jmp    1398 <main+0x1f8>
jmp    1562 <main+0x3c2>
cmpl   $0x3,-0x8(%rbp)
jne    155d <main+0x3bd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jl     14b1 <main+0x311>
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    14d1 <main+0x331>
mov    -0x2c(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
lea    0xc5e(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
movsd  0xb37(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  0xb15(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  0xafa(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <LnGammaFunction@plt>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x94(%rbp),%edi
mov    %eax,%esi
call   1060 <IncompleteGamma@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x2c(%rbp),%esi
movsd  -0x80(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
lea    0xba9(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
jmp    1562 <main+0x3c2>
jmp    1567 <main+0x3c7>
lea    0xbae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%eax
and    $0xfffffffe,%eax
cmp    $0x2,%eax
jne    12e2 <main+0x132>
cmp    $0x3,%edi
je     155f <main+0x3af>
cmp    $0x2,%edi
jne    15e5 <main+0x435>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   10a0 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    15e5 <main+0x435>
movsd  0x10(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
ja     15e5 <main+0x435>
lea    0xeb7(%rip),%r14
lea    0xe82(%rip),%r15
lea    0xea3(%rip),%r12
lea    0xc(%rsp),%r13
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xdb9(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebp
mov    %ebp,%edi
call   1030 <LnGammaFunction@plt>
movsd  (%rsp),%xmm0
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <IncompleteGamma@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mov    0xc(%rsp),%esi
mov    %r14,%rdi
movapd %xmm0,%xmm1
mov    $0x2,%al
call   1070 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   10a0 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    15e5 <main+0x435>
movsd  0x10(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    1250 <main+0xa0>
jmp    15e5 <main+0x435>
lea    0xe33(%rip),%rdi
call   1050 <puts@plt>
lea    0xd89(%rip),%rbx
lea    0xd88(%rip),%r12
xor    %r15d,%r15d
jmp    132f <main+0x17f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%r15,%r13,1),%eax
add    $0xfffffff2,%eax
test   %al,%al
je     1530 <main+0x380>
cmp    $0xc6,%r15d
ja     15e5 <main+0x435>
mov    %ebp,%r15d
mov    %r15d,%ebp
mov    $0xcccccccd,%eax
imul   %rax,%rbp
shr    $0x22,%rbp
movzbl %r15b,%eax
imul   $0x89,%eax,%eax
shr    $0xb,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
sub    %ecx,%eax
movzbl %al,%r13d
lea    (%r15,%r13,1),%eax
test   %al,%al
jne    1417 <main+0x267>
lea    0xdcf(%rip),%rdi
call   1050 <puts@plt>
lea    0xd02(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc78(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc6e(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc64(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc5a(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc50(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc46(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc3c(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %rbx,%rdi
movsd  0xc32(%rip),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0x4(%rbp,%rbp,4),%r14d
lea    0x1(%r15),%ebp
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  %xmm1,(%rsp)
movsd  0xc00(%rip),%xmm0
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xbf1(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xbdd(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xb89(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xb65(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xb91(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xb7d(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xb69(%rip),%xmm0
movsd  (%rsp),%xmm1
call   10d0 <QuantileChi2@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
cmp    %r15d,%r14d
jne    1310 <main+0x160>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    1310 <main+0x160>
nopl   0x0(%rax,%rax,1)
lea    0xb53(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0x71,%al
je     15e5 <main+0x435>
cmp    $0xc7,%r15d
jb     132c <main+0x17c>
jmp    15e5 <main+0x435>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebx
mov    %eax,0xc(%rsp)
mov    0x10(%rbp),%rdi
call   1060 <atof@plt>
movsd  %xmm0,0x10(%rsp)
test   %ebx,%ebx
jle    1600 <main+0x450>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1600 <main+0x450>
movsd  0xa82(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%ebp
mov    %ebp,%edi
call   1030 <LnGammaFunction@plt>
movsd  (%rsp),%xmm0
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <IncompleteGamma@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
lea    0xb08(%rip),%rdi
mov    %ebx,%esi
movapd %xmm0,%xmm1
mov    $0x2,%al
call   1070 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xaf8(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@__const.main.prob = [8 x double] [double 5.000000e-03, double 2.500000e-02, double 1.000000e-01, double 5.000000e-01, double 9.000000e-01, double 0x3FEE666666666666, double 0x3FEFAE147AE147AE, double 0x3FEFF7CED916872B]
@.str = [30 x i8] c"\0A\0AChi-square critical values\0A\00"
@.str.1 = [25 x i8] c"\0A\09\09\09\09Significance level\0A\00"
@.str.2 = [6 x i8] c"\0A DF \00"
@.str.3 = [6 x i8] c"%9.4f\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [6 x i8] c"\0A%3d \00"
@.str.6 = [40 x i8] c"\0AENTER for more, (q+ENTER) for quit... \00"
@.str.7 = [40 x i8] c"\0Ad.f. & Chi^2 value (Ctrl-c to break)? \00"
@.str.8 = [6 x i8] c"%d%lf\00"
@.str.9 = [31 x i8] c"\0Adf = %2d prob = %.9f = %.3e\0A\00"
@.str.10 = [29 x i8] c"df = %2d ch2 = %.4f invalid\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca [8 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 20, i32* %8
store i32 200, i32* %9
store i32 8, i32* %10
store i32 0, i32* %11
%16 = load i32, i32* %8
%17 = sitofp i32 %16 to double
%18 = fdiv double 1.000000e+00, %17
store double %18, double* %14
%19 = bitcast [8 x double]* %15 to i8*
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %97
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 3
br i1 %24, label %25, label %97
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %27
27: ; preds = %93, %25
%28 = load i32, i32* %6
%29 = load i32, i32* %9
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %96
31: ; preds = %27
%32 = load i32, i32* %6
%33 = srem i32 %32, 15
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %54
35: ; preds = %31
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %38
38: ; preds = %49, %35
%39 = load i32, i32* %7
%40 = load i32, i32* %10
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %52
42: ; preds = %38
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 %44
%46 = load double, double* %45
%47 = fsub double 1.000000e+00, %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %47)
br label %49
49: ; preds = %42
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
br label %38
52: ; preds = %38
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52, %31
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %56)
store i32 0, i32* %7
br label %58
58: ; preds = %72, %54
%59 = load i32, i32* %7
%60 = load i32, i32* %10
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %75
62: ; preds = %58
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 %64
%66 = load double, double* %65
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
%69 = sitofp i32 %68 to double
%70 = call double @QuantileChi2(double %66, double %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %70)
br label %72
72: ; preds = %62
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
br label %58
75: ; preds = %58
%76 = load i32, i32* %6
%77 = srem i32 %76, 5
%78 = icmp eq i32 %77, 4
br i1 %78, label %79, label %81
79: ; preds = %75
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %81
81: ; preds = %79, %75
%82 = load i32, i32* %6
%83 = srem i32 %82, 15
%84 = icmp eq i32 %83, 14
br i1 %84, label %85, label %92
85: ; preds = %81
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%87 = call signext i8 (...) @getchar()
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 113
br i1 %89, label %90, label %91
90: ; preds = %85
br label %96
91: ; preds = %85
br label %92
92: ; preds = %91, %81
br label %93
93: ; preds = %92
%94 = load i32, i32* %6
%95 = add nsw i32 %94, 1
store i32 %95, i32* %6
br label %27
96: ; preds = %90, %27
br label %179
97: ; preds = %22, %2
%98 = load i32, i32* %4
%99 = icmp eq i32 %98, 2
br i1 %99, label %100, label %133
100: ; preds = %97
br label %101
101: ; preds = %110, %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
%103 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %12, double* %13)
%104 = load i32, i32* %12
%105 = icmp slt i32 %104, 1
br i1 %105, label %109, label %106
106: ; preds = %101
%107 = load double, double* %13
%108 = fcmp olt double %107, 0.000000e+00
br i1 %108, label %109, label %110
109: ; preds = %106, %101
br label %132
110: ; preds = %106
%111 = load double, double* %13
%112 = fmul double 5.000000e-01, %111
%113 = load i32, i32* %12
%114 = sitofp i32 %113 to double
%115 = fdiv double %114, 2.000000e+00
%116 = fptosi double %115 to i32
%117 = load i32, i32* %12
%118 = sitofp i32 %117 to double
%119 = fdiv double %118, 2.000000e+00
%120 = fptosi double %119 to i32
%121 = call i32 @LnGammaFunction(i32 %120)
%122 = call i32 @IncompleteGamma(double %112, i32 %116, i32 %121)
%123 = sub nsw i32 1, %122
%124 = sitofp i32 %123 to double
%125 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 0
store double %124, double* %125
%126 = load i32, i32* %12
%127 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 0
%128 = load double, double* %127
%129 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 0
%130 = load double, double* %129
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %126, double %128, double %130)
br label %101
132: ; preds = %109
br label %178
133: ; preds = %97
%134 = load i32, i32* %4
%135 = icmp eq i32 %134, 3
br i1 %135, label %136, label %177
136: ; preds = %133
%137 = load i8**, i8*** %5
%138 = getelementptr inbounds i8*, i8** %137, i64 1
%139 = load i8*, i8** %138
%140 = call i32 @atoi(i8* %139)
store i32 %140, i32* %12
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 2
%143 = load i8*, i8** %142
%144 = call double @atof(i8* %143)
store double %144, double* %13
%145 = load i32, i32* %12
%146 = icmp slt i32 %145, 1
br i1 %146, label %150, label %147
147: ; preds = %136
%148 = load double, double* %13
%149 = fcmp olt double %148, 0.000000e+00
br i1 %149, label %150, label %155
150: ; preds = %147, %136
%151 = load i32, i32* %12
%152 = load double, double* %13
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i32 %151, double %152)
%154 = call i32 @exit(i32 -1)
unreachable
155: ; preds = %147
%156 = load double, double* %13
%157 = fmul double 5.000000e-01, %156
%158 = load i32, i32* %12
%159 = sitofp i32 %158 to double
%160 = fdiv double %159, 2.000000e+00
%161 = fptosi double %160 to i32
%162 = load i32, i32* %12
%163 = sitofp i32 %162 to double
%164 = fdiv double %163, 2.000000e+00
%165 = fptosi double %164 to i32
%166 = call i32 @LnGammaFunction(i32 %165)
%167 = call i32 @IncompleteGamma(double %157, i32 %161, i32 %166)
%168 = sub nsw i32 1, %167
%169 = sitofp i32 %168 to double
%170 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 0
store double %169, double* %170
%171 = load i32, i32* %12
%172 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 0
%173 = load double, double* %172
%174 = getelementptr inbounds [8 x double], [8 x double]* %15, i64 0, i64 0
%175 = load double, double* %174
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %171, double %173, double %175)
br label %177
177: ; preds = %155, %133
br label %178
178: ; preds = %177, %132
br label %179
179: ; preds = %178, %96
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [6 x i8] c"\0A DF \00"
@.str.3 = [6 x i8] c"%9.4f\00"
@.str.5 = [6 x i8] c"\0A%3d \00"
@.str.6 = [40 x i8] c"\0AENTER for more, (q+ENTER) for quit... \00"
@.str.7 = [40 x i8] c"\0Ad.f. & Chi^2 value (Ctrl-c to break)? \00"
@.str.8 = [6 x i8] c"%d%lf\00"
@.str.9 = [31 x i8] c"\0Adf = %2d prob = %.9f = %.3e\0A\00"
@.str.10 = [29 x i8] c"df = %2d ch2 = %.4f invalid\00"
@str = [29 x i8] c"\0A\0AChi-square critical values\00"
@str.11 = [24 x i8] c"\0A\09\09\09\09Significance level\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca double
%5 = bitcast i32* %3 to i8*
%6 = bitcast double* %4 to i8*
%7 = and i32 %0, -2
%8 = icmp eq i32 %7, 2
br i1 %8, label %63, label %9
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %62, %9
%12 = phi i32 [ 0, %9 ], [ %29, %62 ]
%13 = trunc i32 %12 to i8
%14 = urem i8 %13, 15
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %28
16: ; preds = %11
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.11, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 0x3FEFD70A3D70A3D7)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 0x3FEF333333333333)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 9.000000e-01)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 5.000000e-01)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 0x3FB9999999999998)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 0x3FA99999999999A0)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 0x3F847AE147AE1480)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double 0x3F50624DD2F1AA00)
%27 = tail call i32 @putchar(i32 10)
br label %28
28: ; preds = %16, %11
%29 = add nuw nsw i32 %12, 1
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %29)
%31 = sitofp i32 %29 to double
%32 = tail call double @QuantileChi2(double 5.000000e-03, double %31)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %32)
%34 = tail call double @QuantileChi2(double 2.500000e-02, double %31)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %34)
%36 = tail call double @QuantileChi2(double 1.000000e-01, double %31)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %36)
%38 = tail call double @QuantileChi2(double 5.000000e-01, double %31)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %38)
%40 = tail call double @QuantileChi2(double 9.000000e-01, double %31)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %40)
%42 = tail call double @QuantileChi2(double 0x3FEE666666666666, double %31)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %42)
%44 = tail call double @QuantileChi2(double 0x3FEFAE147AE147AE, double %31)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %44)
%46 = tail call double @QuantileChi2(double 0x3FEFF7CED916872B, double %31)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), double %46)
%48 = urem i32 %12, 5
%49 = icmp eq i32 %48, 4
br i1 %49, label %50, label %52
50: ; preds = %28
%51 = tail call i32 @putchar(i32 10)
br label %52
52: ; preds = %50, %28
%53 = icmp eq i8 %14, 14
br i1 %53, label %54, label %60
54: ; preds = %52
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%56 = tail call signext i8 (...) @getchar()
%57 = icmp ne i8 %56, 113
%58 = icmp ult i32 %12, 199
%59 = and i1 %57, %58
br i1 %59, label %62, label %115
60: ; preds = %52
%61 = icmp ult i32 %12, 199
br i1 %61, label %62, label %115
62: ; preds = %60, %54
br label %11
63: ; preds = %2
switch i32 %0, label %115 [
i32 2, label %64
i32 3, label %92
]
64: ; preds = %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
%66 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %3, double* %4)
%67 = load i32, i32* %3
%68 = icmp slt i32 %67, 1
%69 = load double, double* %4
%70 = fcmp olt double %69, 0.000000e+00
%71 = select i1 %68, i1 true, i1 %70
br i1 %71, label %115, label %72
72: ; preds = %64, %72
%73 = phi double [ %89, %72 ], [ %69, %64 ]
%74 = phi i32 [ %87, %72 ], [ %67, %64 ]
%75 = fmul double %73, 5.000000e-01
%76 = sitofp i32 %74 to double
%77 = fmul double %76, 5.000000e-01
%78 = fptosi double %77 to i32
%79 = call i32 @LnGammaFunction(i32 %78)
%80 = call i32 @IncompleteGamma(double %75, i32 %78, i32 %79)
%81 = sub nsw i32 1, %80
%82 = sitofp i32 %81 to double
%83 = load i32, i32* %3
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %83, double %82, double %82)
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
%86 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %3, double* %4)
%87 = load i32, i32* %3
%88 = icmp slt i32 %87, 1
%89 = load double, double* %4
%90 = fcmp olt double %89, 0.000000e+00
%91 = select i1 %88, i1 true, i1 %90
br i1 %91, label %115, label %72
92: ; preds = %63
%93 = getelementptr inbounds i8*, i8** %1, i64 1
%94 = load i8*, i8** %93
%95 = tail call i32 @atoi(i8* %94)
store i32 %95, i32* %3
%96 = getelementptr inbounds i8*, i8** %1, i64 2
%97 = load i8*, i8** %96
%98 = tail call double @atof(i8* %97)
store double %98, double* %4
%99 = icmp slt i32 %95, 1
%100 = fcmp olt double %98, 0.000000e+00
%101 = select i1 %99, i1 true, i1 %100
br i1 %101, label %102, label %105
102: ; preds = %92
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i32 %95, double %98)
%104 = tail call i32 @exit(i32 -1)
unreachable
105: ; preds = %92
%106 = fmul double %98, 5.000000e-01
%107 = sitofp i32 %95 to double
%108 = fmul double %107, 5.000000e-01
%109 = fptosi double %108 to i32
%110 = tail call i32 @LnGammaFunction(i32 %109)
%111 = tail call i32 @IncompleteGamma(double %106, i32 %109, i32 %110)
%112 = sub nsw i32 1, %111
%113 = sitofp i32 %112 to double
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %95, double %113, double %113)
br label %115
115: ; preds = %60, %54, %72, %64, %63, %105
%116 = call i32 @putchar(i32 10)
ret i32 0
}