// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/tests.c
// Function: manova
double manova(char **files)
{
 int i, j, p, L = 0, k, t, v, df1, df2, df3;
 matrix* observations;
 matrix H, E, EH, eigenvectors;
 double **averages;
 double *overallaverage, *eigenvalues, statistic, ratio, res;
 while (files[L])
   L++;
 observations = safemalloc(L * sizeof(matrix), "manova", 5);
 p = read_multivariate_observations_for_multiple_file(files, observations, L);
 k = observations[0].row;
 if (p == -1)
  {
   for (i = 0; i < L; i++)
     matrix_free(observations[i]);
   safe_free(observations);
   return 0;
  }
 averages = safemalloc(L * sizeof(double*), "manova", 11);
 overallaverage = safecalloc(p, sizeof(double), "manova", 12);
 for (i = 0; i < L; i++)
   averages[i] = matrix_average_columns(observations[i]);
 for (i = 0; i < L; i++)
   for (j = 0; j < p; j++)
     overallaverage[j] += averages[i][j];
 for (i = 0; i < p; i++)
   overallaverage[i] /= L;
 H = matrix_alloc(p, p);
 E = matrix_alloc(p, p); 
 for (i = 0; i < L; i++)
   for (j = 0; j < p; j++)
     for (t = 0; t < p; t++)
       H.values[j][t] += (averages[i][j] - overallaverage[j]) * (averages[i][t] - overallaverage[t]);
 matrix_multiply_constant(&H, k);
 safe_free(overallaverage);
 for (i = 0; i < L; i++)
   for (j = 0; j < k; j++)
     for (t = 0; t < p; t++)
       for (v = 0; v < p; v++)
         E.values[t][v] += (observations[i].values[j][t] - averages[i][t]) *  (observations[i].values[j][v] - averages[i][v]);
 for (i = 0; i < L; i++)
  {
   safe_free(averages[i]);
   matrix_free(observations[i]);
  }
 safe_free(observations);
 safe_free(averages);
 EH = matrix_sum(E, H);
 ratio = matrix_determinant(E) / matrix_determinant(EH);
 matrix_inverse(&E);
 matrix_product(&E, H);
 eigenvalues = find_eigenvalues_eigenvectors_symmetric(&eigenvectors, E);
 if (eigenvalues != NULL)
  {
   for (i = 1; i < E.col + 1; i++)
     write_array_variables("aout", i, 1, "f", eigenvalues[i - 1]);
   for (i = 0; i < E.col; i++)
     for (j = 0; j < E.row; j++)
       write_array_variables("aout", j + 1, 2 + i, "f", eigenvectors.values[j][i]);
   safe_free(eigenvalues);
   matrix_free(eigenvectors);
  }
 matrix_free(H);
 matrix_free(E);
 matrix_free(EH);
 df1 = p;
 df2 = L * (k - 1);
 df3 = L - 1;
 statistic = ((df1 + df3 + 1) / 2.0 - (df2 + df3)) * log(ratio);
 res = chi_square(df1 * df3, statistic);
 return 1 - res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xd21a0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xd2186
movslq -0x20(%rbp), %rdi
shlq $0x4, %rdi
leaq 0x1c1f9(%rip), %rsi     # 0xee3a8
movl $0x5, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x20(%rbp), %edx
callq 0xd1950
movl %eax, -0x1c(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0xd222a
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd2214
movq -0x40(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x59ea0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd21e6
movq -0x40(%rbp), %rdi
callq 0x52e80
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xd2871
movslq -0x20(%rbp), %rdi
shlq $0x3, %rdi
leaq 0x1c16f(%rip), %rsi     # 0xee3a8
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x88(%rbp)
movslq -0x1c(%rbp), %rdi
movl $0x8, %esi
leaq 0x1c14e(%rip), %rdx     # 0xee3a8
movl $0xc, %ecx
callq 0x52f40
movq %rax, -0x90(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd22b2
movq -0x40(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x5b3e0
movq %rax, %rdx
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd2272
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd2315
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd2308
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x90(%rbp), %rax
movslq -0x18(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xd22c8
jmp 0xd230a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd22b9
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd234d
cvtsi2sdl -0x20(%rbp), %xmm1
movq -0x90(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd231c
movl -0x1c(%rbp), %edi
movl -0x1c(%rbp), %esi
callq 0x57fc0
movq %rax, -0xc0(%rbp)
movq %rdx, -0xb8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x1c(%rbp), %edi
movl -0x1c(%rbp), %esi
callq 0x57fc0
movq %rax, -0xd0(%rbp)
movq %rdx, -0xc8(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd2484
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd2474
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd2464
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x18(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x90(%rbp), %rax
movslq -0x18(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x90(%rbp), %rax
movslq -0x28(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm2
movq -0x48(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xd23d8
jmp 0xd2466
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xd23c5
jmp 0xd2476
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd23b2
cvtsi2sdl -0x24(%rbp), %xmm0
leaq -0x50(%rbp), %rdi
callq 0x5a9d0
movq -0x90(%rbp), %rdi
callq 0x52e80
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd25c2
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xd25b2
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd25a2
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd2592
movq -0x40(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x28(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x40(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm2
movq -0x58(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xd24de
jmp 0xd2594
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xd24cb
jmp 0xd25a4
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xd24b8
jmp 0xd25b4
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd24a5
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xd260b
movq -0x88(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x52e80
movq -0x40(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x59ea0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd25c9
movq -0x40(%rbp), %rdi
callq 0x52e80
movq -0x88(%rbp), %rdi
callq 0x52e80
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0x5acf0
movq %rax, -0xe0(%rbp)
movq %rdx, -0xd8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x5c130
movsd %xmm0, -0xe8(%rbp)
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x5c130
movaps %xmm0, %xmm1
movsd -0xe8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x5c470
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x5afa0
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x5fb50
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0xd27a8
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0xd2723
movl -0x14(%rbp), %esi
movq -0x98(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0xfdb0(%rip), %rdi      # 0xe24b5
movl $0x1, %edx
leaq 0x12b08(%rip), %rcx     # 0xe5219
movb $0x1, %al
callq 0x490c0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd26d9
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0xd278f
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x60(%rbp), %eax
jge 0xd2782
movl -0x18(%rbp), %esi
addl $0x1, %esi
movl -0x14(%rbp), %edx
addl $0x2, %edx
movq -0x78(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0xfd4c(%rip), %rdi      # 0xe24b5
leaq 0x12aa9(%rip), %rcx     # 0xe5219
movb $0x1, %al
callq 0x490c0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xd2739
jmp 0xd2784
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd272a
movq -0x98(%rbp), %rdi
callq 0x52e80
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x59ea0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x59ea0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x59ea0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x59ea0
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
imull %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x30(%rbp), %eax
addl -0x38(%rbp), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm0
movsd 0x1049e(%rip), %xmm1    # 0xe2ca0
divsd %xmm1, %xmm0
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
cvtsi2sd %eax, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xa8(%rbp), %xmm0
callq 0x4120
movaps %xmm0, %xmm1
movsd -0xf0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0x30(%rbp), %edi
imull -0x38(%rbp), %edi
movsd -0xa0(%rbp), %xmm0
callq 0x2d5e0
movsd %xmm0, -0xb0(%rbp)
movsd 0xf7b4(%rip), %xmm0     # 0xe2018
subsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0xf0, %rsp
popq %rbp
retq
nop