void cdflib_chi_square_cdf_values(int *n_data, int *a, double *x, double *fx) {
  enum { N_MAX = 21 };
  static const int a_vec[N_MAX] = {1, 2, 1, 2, 1, 2, 3, 4,  1,  2, 3,
                                   4, 5, 3, 3, 3, 3, 3, 10, 10, 10};
  static const double fx_vec[N_MAX] = {
      0.0796557E+00, 0.00498752E+00, 0.112463E+00,    0.00995017E+00,
      0.472911E+00,  0.181269E+00,   0.0597575E+00,   0.0175231E+00,
      0.682689E+00,  0.393469E+00,   0.198748E+00,    0.090204E+00,
      0.0374342E+00, 0.427593E+00,   0.608375E+00,    0.738536E+00,
      0.828203E+00,  0.88839E+00,    0.000172116E+00, 0.00365985E+00,
      0.0185759E+00};
  static const double x_vec[N_MAX] = {
      0.01E+00, 0.01E+00, 0.02E+00, 0.02E+00, 0.40E+00, 0.40E+00, 0.40E+00,
      0.40E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 2.00E+00,
      3.00E+00, 4.00E+00, 5.00E+00, 6.00E+00, 1.00E+00, 2.00E+00, 3.00E+00};
  if (*n_data < 0) {
    *n_data = 0;
  }
  *n_data = *n_data + 1;
  if (N_MAX < *n_data) {
    *n_data = 0;
    *a = 0;
    *x = 0.0E+00;
    *fx = 0.0E+00;
  } else {
    *a = a_vec[*n_data - 1];
    *x = x_vec[*n_data - 1];
    *fx = fx_vec[*n_data - 1];
  }
  return;
}


x86 assembly (clang, -O0):
<cdflib_chi_square_cdf_values>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jge    112b <cdflib_chi_square_cdf_values+0x2b>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0x15,%eax
cmp    (%rcx),%eax
jge    117a <cdflib_chi_square_cdf_values+0x7a>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11d6 <cdflib_chi_square_cdf_values+0xd6>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0xe73(%rip),%rax
mov    (%rax,%rcx,4),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0xf67(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0xe97(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_chi_square_cdf_values>:
mov    (%rdi),%r8d
test   %r8d,%r8d
js     112f <cdflib_chi_square_cdf_values+0x2f>
lea    0x1(%r8),%eax
mov    %eax,(%rdi)
cmp    $0x15,%r8d
jb     1138 <cdflib_chi_square_cdf_values+0x38>
movl   $0x0,(%rdi)
movl   $0x0,(%rsi)
movq   $0x0,(%rdx)
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rcx)
ret
movl   $0x1,(%rdi)
xor    %r8d,%r8d
mov    %r8d,%r8d
lea    0xebe(%rip),%rax
mov    (%rax,%r8,4),%eax
mov    %eax,(%rsi)
movslq (%rdi),%rax
lea    0xfbe(%rip),%rsi
movsd  -0x8(%rsi,%rax,8),%xmm0
movsd  %xmm0,(%rdx)
lea    0xefd(%rip),%rdx
movsd  -0x8(%rdx,%rax,8),%xmm0
movsd  %xmm0,(%rcx)
ret

LLVM IR (-O0):
@cdflib_chi_square_cdf_values.a_vec = internal constant [21 x i32] [i32 1, i32 2, i32 1, i32 2, i32 1, i32 2, i32 3, i32 4, i32 1, i32 2, i32 3, i32 4, i32 5, i32 3, i32 3, i32 3, i32 3, i32 3, i32 10, i32 10, i32 10]
@cdflib_chi_square_cdf_values.fx_vec = internal constant [21 x double] [double 7.965570e-02, double 4.987520e-03, double 1.124630e-01, double 0x3F8460C135EAC88B, double 4.729110e-01, double 1.812690e-01, double 5.975750e-02, double 1.752310e-02, double 6.826890e-01, double 3.934690e-01, double 1.987480e-01, double 9.020400e-02, double 3.743420e-02, double 4.275930e-01, double 6.083750e-01, double 7.385360e-01, double 8.282030e-01, double 8.883900e-01, double 1.721160e-04, double 3.659850e-03, double 1.857590e-02]
@cdflib_chi_square_cdf_values.x_vec = internal constant [21 x double] [double 1.000000e-02, double 1.000000e-02, double 2.000000e-02, double 2.000000e-02, double 4.000000e-01, double 4.000000e-01, double 4.000000e-01, double 4.000000e-01, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00]
define void @cdflib_chi_square_cdf_values(i32* %0, i32* %1, double* %2, double* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca double*
store i32* %0, i32** %5
store i32* %1, i32** %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load i32*, i32** %5
store i32 0, i32* %13
br label %14
14: ; preds = %12, %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
%18 = load i32*, i32** %5
store i32 %17, i32* %18
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = icmp slt i32 21, %20
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = load i32*, i32** %5
store i32 0, i32* %23
%24 = load i32*, i32** %6
store i32 0, i32* %24
%25 = load double*, double** %7
store double 0.000000e+00, double* %25
%26 = load double*, double** %8
store double 0.000000e+00, double* %26
br label %49
27: ; preds = %14
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [21 x i32], [21 x i32]* @cdflib_chi_square_cdf_values.a_vec, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32*, i32** %6
store i32 %33, i32* %34
%35 = load i32*, i32** %5
%36 = load i32, i32* %35
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [21 x double], [21 x double]* @cdflib_chi_square_cdf_values.x_vec, i64 0, i64 %38
%40 = load double, double* %39
%41 = load double*, double** %7
store double %40, double* %41
%42 = load i32*, i32** %5
%43 = load i32, i32* %42
%44 = sub nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [21 x double], [21 x double]* @cdflib_chi_square_cdf_values.fx_vec, i64 0, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %8
store double %47, double* %48
br label %49
49: ; preds = %27, %22
ret void
}

LLVM IR (-O2):
@cdflib_chi_square_cdf_values.a_vec = internal unnamed_addr constant [21 x i32] [i32 1, i32 2, i32 1, i32 2, i32 1, i32 2, i32 3, i32 4, i32 1, i32 2, i32 3, i32 4, i32 5, i32 3, i32 3, i32 3, i32 3, i32 3, i32 10, i32 10, i32 10]
@cdflib_chi_square_cdf_values.fx_vec = internal unnamed_addr constant [21 x double] [double 7.965570e-02, double 4.987520e-03, double 1.124630e-01, double 0x3F8460C135EAC88B, double 4.729110e-01, double 1.812690e-01, double 5.975750e-02, double 1.752310e-02, double 6.826890e-01, double 3.934690e-01, double 1.987480e-01, double 9.020400e-02, double 3.743420e-02, double 4.275930e-01, double 6.083750e-01, double 7.385360e-01, double 8.282030e-01, double 8.883900e-01, double 1.721160e-04, double 3.659850e-03, double 1.857590e-02]
@cdflib_chi_square_cdf_values.x_vec = internal unnamed_addr constant [21 x double] [double 1.000000e-02, double 1.000000e-02, double 2.000000e-02, double 2.000000e-02, double 4.000000e-01, double 4.000000e-01, double 4.000000e-01, double 4.000000e-01, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 1.000000e+00, double 2.000000e+00, double 3.000000e+00]
define void @cdflib_chi_square_cdf_values(i32* nocapture %0, i32* nocapture writeonly %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = load i32, i32* %0
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4
store i32 1, i32* %0
br label %12
8: ; preds = %4
%9 = add nuw nsw i32 %5, 1
store i32 %9, i32* %0
%10 = icmp ugt i32 %5, 20
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 0, i32* %0
store i32 0, i32* %1
store double 0.000000e+00, double* %2
br label %24
12: ; preds = %7, %8
%13 = phi i32 [ 0, %7 ], [ %5, %8 ]
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds [21 x i32], [21 x i32]* @cdflib_chi_square_cdf_values.a_vec, i64 0, i64 %14
%16 = load i32, i32* %15
store i32 %16, i32* %1
%17 = load i32, i32* %0
%18 = add nsw i32 %17, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [21 x double], [21 x double]* @cdflib_chi_square_cdf_values.x_vec, i64 0, i64 %19
%21 = load double, double* %20
store double %21, double* %2
%22 = getelementptr inbounds [21 x double], [21 x double]* @cdflib_chi_square_cdf_values.fx_vec, i64 0, i64 %19
%23 = load double, double* %22
br label %24
24: ; preds = %12, %11
%25 = phi double [ %23, %12 ], [ 0.000000e+00, %11 ]
store double %25, double* %3
ret void
}