// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/tests.c
// Function: anova
double anova(char **files)
{
 /*Last Changed 02.02.2004 added safemalloc*/
 /*Last Changed 23.04.2001*/
 FILE *myfile;
 int treatments = 0, df1, df2;
 int *counts = NULL, i, j, total = 0;
 double **observations = NULL;
 double *means, overall_mean = 0.0;
 double res, mst, mse, sst = 0.0, sse = 0.0;
 while (files[treatments])
  {
   treatments++;
   counts = alloc(counts, treatments * sizeof(int), treatments);
   observations = alloc(observations, treatments * sizeof(double *), treatments);
   counts[treatments - 1] = file_length(files[treatments - 1]);
   observations[treatments - 1] = (double *)safemalloc(counts[treatments - 1] * sizeof(double), "anova", 13);
   if ((myfile = fopen(files[treatments - 1], "r")) == NULL)
    {
     printf(m1274, files[treatments - 1]);
     return 0;
    }
   for (i = 0; i < counts[treatments - 1]; i++)
     fscanf(myfile, "%lf", &observations[treatments - 1][i]);
   fclose(myfile);
  }
 means = (double *)safecalloc(treatments, sizeof(double), "anova", 23);
 for (i = 0; i < treatments; i++)
  {
   for (j = 0; j < counts[i]; j++)
     means[i] += observations[i][j];
   overall_mean += means[i];
   total += counts[i];
   means[i] /= counts[i];
  }
 overall_mean /= total;
 for (i = 0; i < treatments; i++)
  {
   sst += counts[i] * pow(means[i] - overall_mean, 2);
   for (j = 0; j < counts[i]; j++)
     sse += pow(observations[i][j] - means[i], 2);
  }
 df1 = treatments - 1;
 df2 = total - treatments;
 mst=sst / df1;
 mse=sse / df2;
 free_2d((void**)observations, treatments);
 safe_free(counts);
 safe_free(means);
 res = f_distribution(mst / mse, df1, df2);
 return 1-res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movq $0x0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x78(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xd2a29
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
shlq $0x2, %rsi
movl -0x1c(%rbp), %edx
callq 0x52d10
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
shlq $0x3, %rsi
movl -0x1c(%rbp), %edx
callq 0x52d10
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x50f90
movl %eax, %edx
movq -0x30(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movslq (%rax,%rcx,4), %rdi
shlq $0x3, %rdi
leaq 0x1ba54(%rip), %rsi     # 0xee3a9
movl $0xd, %edx
callq 0x52d70
movq %rax, %rdx
movq -0x48(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1581b(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0xd29c6
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x104d8(%rip), %rdi     # 0xe2e8a
movb $0x0, %al
callq 0x4030
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0xd2c60
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x30(%rbp), %rcx
movl -0x1c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xd2a1b
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movslq -0x34(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
leaq 0x13dbf(%rip), %rsi     # 0xe67c8
movb $0x0, %al
callq 0x4070
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd29cd
movq -0x18(%rbp), %rdi
callq 0x4250
jmp 0xd28c5
movslq -0x1c(%rbp), %rdi
movl $0x8, %esi
leaq 0x1b970(%rip), %rdx     # 0xee3a9
movl $0x17, %ecx
callq 0x52f40
movq %rax, -0x50(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd2afc
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xd2aa3
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd2a61
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm1
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd2a4e
cvtsi2sdl -0x3c(%rbp), %xmm1
movsd -0x58(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xd2bde
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,4), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd -0x58(%rbp), %xmm0
movsd 0x1014f(%rip), %xmm1    # 0xe2ca0
callq 0x4290
movaps %xmm0, %xmm2
movsd -0x88(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xd2bce
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd 0x100ec(%rip), %xmm1    # 0xe2ca0
callq 0x4290
addsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd2b7a
jmp 0xd2bd0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd2b16
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x3c(%rbp), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movsd -0x78(%rbp), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x80(%rbp), %xmm0
cvtsi2sdl -0x24(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x48(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x52e20
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x50(%rbp), %rdi
callq 0x52e80
movsd -0x68(%rbp), %xmm0
divsd -0x70(%rbp), %xmm0
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
callq 0x2ddf0
movsd %xmm0, -0x60(%rbp)
movsd 0xf3c2(%rip), %xmm0     # 0xe2018
subsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nop