// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/tests.c
// Function: kruskalwallis_multivariate
double kruskalwallis_multivariate(char **files)
{
 Graphptr mst;
 matrix* observations, distancematrix;
 int treatmentno, pos, i, p, n, treatments = 0, df, N = 0;
 double *T, S, sumd, res;
 while (files[treatments])
   treatments++;
 observations = safemalloc(treatments * sizeof(matrix), "kruskalwallis_multivariate", 5);
 p = read_multivariate_observations_for_multiple_file(files, observations, treatments);
 if (p == -1)
  {
   for (i = 0; i < treatments; i++)
     matrix_free(observations[i]);
   safe_free(observations);
   return 0;
  } 
 n = observations[0].row; 
 for (i = 0; i < treatments; i++) 
   N += observations[i].row; 
 T = (double *)safecalloc(treatments, sizeof(double), "kruskalwallis_multivariate", 15);
 distancematrix = distance_matrix_for_multiple_multivariate_sample(observations, treatments, N);
 mst = minimum_spanning_tree_from_observations(observations, distancematrix, treatments, N);
 if (mst == NULL)
   return 0;
 ranks_from_minimum_spanning_tree(mst, distancematrix);
 matrix_free(distancematrix);
 for (i = 0; i < N; i++)
  {
   treatmentno = index_in_multiple_sample(i, &pos, observations, treatments);
   write_array_variables("aout", pos + 1, 5 + treatmentno, "d", mst->visitorder[i]);
  }
 if (p == 2)
   save_mst_to_array_variables(mst, observations, treatments);
 for (i = 0; i < N; i++)
  {
   treatmentno = index_in_multiple_sample(i, &pos, observations, treatments);
   T[treatmentno] += mst->visitorder[i];
  }
 free_graph(mst);
 sumd = 0;
 for (i = 0; i < treatments; i++)
   sumd += T[i] * T[i] / observations[i].row;
 for (i = 0; i < treatments; i++)
   matrix_free(observations[i]);
 safe_free(observations); 
 safe_free(T);
 S = sumd * ((12 + 0.0) / (treatments * n * (treatments * n + 1))) - 3 * (treatments * n + 1);
 df = treatments - 1;
 res = chi_square(df, S);
 return 1 - res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movslq -0x48(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xd52e7
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xd52cd
movslq -0x48(%rbp), %rdi
shlq $0x4, %rdi
leaq 0x19196(%rip), %rsi     # 0xee48c
movl $0x5, %edx
callq 0x52d70
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x48(%rbp), %edx
callq 0xd1950
movl %eax, -0x40(%rbp)
cmpl $-0x1, -0x40(%rbp)
jne 0xd5368
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0xd5352
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x59ea0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd5324
movq -0x20(%rbp), %rdi
callq 0x52e80
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xd5637
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0xd53a2
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
addl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd5378
movslq -0x48(%rbp), %rdi
movl $0x8, %esi
leaq 0x190da(%rip), %rdx     # 0xee48c
movl $0xf, %ecx
callq 0x52f40
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movl -0x48(%rbp), %esi
movl -0x50(%rbp), %edx
callq 0xd39c0
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movl -0x48(%rbp), %ecx
movl -0x50(%rbp), %r8d
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xd4130
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xd5417
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xd5637
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xd4350
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59ea0
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0xd5496
movl -0x3c(%rbp), %edi
movq -0x20(%rbp), %rdx
movl -0x48(%rbp), %ecx
leaq -0x38(%rbp), %rsi
callq 0xd3930
movl %eax, -0x34(%rbp)
movl -0x38(%rbp), %esi
addl $0x1, %esi
movl -0x34(%rbp), %edx
addl $0x5, %edx
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl 0xf433a0(%rax,%rcx,4), %r8d
leaq 0xd038(%rip), %rdi      # 0xe24b5
leaq 0x17de2(%rip), %rcx     # 0xed266
movb $0x0, %al
callq 0x490c0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd543c
cmpl $0x2, -0x40(%rbp)
jne 0xd54ac
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x48(%rbp), %edx
callq 0xd3b50
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0xd54ff
movl -0x3c(%rbp), %edi
movq -0x20(%rbp), %rdx
movl -0x48(%rbp), %ecx
leaq -0x38(%rbp), %rsi
callq 0xd3930
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
cvtsi2sdl 0xf433a0(%rax,%rcx,4), %xmm0
movq -0x58(%rbp), %rax
movslq -0x34(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd54b3
movq -0x18(%rbp), %rdi
callq 0x27120
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0xd5565
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd5517
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0xd559a
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x59ea0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xd556c
movq -0x20(%rbp), %rdi
callq 0x52e80
movq -0x58(%rbp), %rdi
callq 0x52e80
movsd -0x68(%rbp), %xmm0
movl -0x48(%rbp), %eax
imull -0x44(%rbp), %eax
movl -0x48(%rbp), %ecx
imull -0x44(%rbp), %ecx
addl $0x1, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm1
movsd 0x1231f(%rip), %xmm2    # 0xe78f0
divsd %xmm1, %xmm2
movl -0x48(%rbp), %eax
imull -0x44(%rbp), %eax
addl $0x1, %eax
imull $0x3, %eax, %eax
cvtsi2sd %eax, %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %edi
movsd -0x60(%rbp), %xmm0
callq 0x2d5e0
movsd %xmm0, -0x70(%rbp)
movsd 0xc9eb(%rip), %xmm0     # 0xe2018
subsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)