// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/dataset.c
// Function: k_way_anova_dataset_cont
void k_way_anova_dataset_cont(Datasetptr d, Instanceptr data, int* features, int fdependent)
{
 /*!Last Changed 07.05.2004 only for two way currently*/
 Instanceptr tmp;
 int rowsize, colsize, i, j, row, col, *rowcounts, *colcounts, **cellcounts, datasize;
 double grandmean = 0, value, criticalvalue;
 double** cellmeans;
 double* rowmeans;
 double* colmeans, sstotal = 0.0, sswithin = 0.0, sscolumns = 0.0, ssrows = 0.0;
 double mscolumn, msrow, msinteraction, mswithin;
 double columnconf, rowconf, interactionconf;
 datasize = data_size(data);
 rowsize = d->features[features[0]].valuecount;
 colsize = d->features[features[1]].valuecount;
 cellmeans = (double**) safecalloc_2d(sizeof(double *), sizeof(double), rowsize, colsize, "k_way_anova_dataset_cont", 9);
 cellcounts = (int**) safecalloc_2d(sizeof(int *), sizeof(int), rowsize, colsize, "k_way_anova_dataset_cont", 10);
 rowmeans = safecalloc(rowsize, sizeof(double), "k_way_anova_dataset_cont", 14);
 colmeans = safecalloc(colsize, sizeof(double), "k_way_anova_dataset_cont", 15);
 rowcounts = safecalloc(rowsize, sizeof(double), "k_way_anova_dataset_cont", 16);
 colcounts = safecalloc(colsize, sizeof(double), "k_way_anova_dataset_cont", 17);
 tmp = data;
 while (tmp)
  {
   switch (d->features[fdependent].type)
    {
     case INTEGER:value = tmp->values[fdependent].intvalue;
                  break;
     case    REAL:
     case  REGDEF:value = tmp->values[fdependent].floatvalue;
                  break;
     default     :value = 0;
                  printf(m1226);
                  break;
    }
   row = tmp->values[features[0]].stringindex;
   col = tmp->values[features[1]].stringindex;
   grandmean += value;
   rowmeans[row] += value;
   rowcounts[row]++;
   colmeans[col] += value;
   colcounts[col]++;
   cellmeans[row][col] += value;
   cellcounts[row][col]++;
   tmp = tmp->next;
  }
 check_and_set_mean(&grandmean, datasize);
 for (i = 0; i < rowsize; i++)
   check_and_set_mean(&(rowmeans[i]), rowcounts[i]);
 for (i = 0; i < colsize; i++)
   check_and_set_mean(&(colmeans[i]), colcounts[i]);
 for (i = 0; i < rowsize; i++)
   for (j = 0; j < colsize; j++)
     check_and_set_mean(&(cellmeans[i][j]), cellcounts[i][j]);
 tmp = data;
 while (tmp)
  {
   switch (d->features[fdependent].type)
    {
     case INTEGER:value = tmp->values[fdependent].intvalue;
                  break;
     case    REAL:
     case  REGDEF:value = tmp->values[fdependent].floatvalue;
                  break;
     default     :value = 0;
                  printf(m1226);
                  break;
    }   
   row = tmp->values[features[0]].stringindex;
   col = tmp->values[features[1]].stringindex;
   sstotal += (value - grandmean) * (value - grandmean);
   sswithin += (value - cellmeans[row][col]) * (value - cellmeans[row][col]);
   tmp = tmp->next;
  }
 for (i = 0; i < rowsize; i++)
   ssrows += rowcounts[i] * (rowmeans[i] - grandmean) * (rowmeans[i] - grandmean);
 for (i = 0; i < colsize; i++)
   sscolumns += colcounts[i] * (colmeans[i] - grandmean) * (colmeans[i] - grandmean);
 mscolumn = sscolumns / (colsize - 1);
 msrow = ssrows / (rowsize - 1);
 msinteraction = (sstotal - sscolumns - ssrows - sswithin) / ((colsize - 1) * (rowsize - 1));
 mswithin = sswithin / (datasize - rowsize * colsize);
 criticalvalue = msrow / mswithin;
 rowconf = f_distribution(criticalvalue, rowsize - 1, datasize - rowsize * colsize);
 criticalvalue = mscolumn / mswithin;
 columnconf = f_distribution(criticalvalue, colsize - 1, datasize - rowsize * colsize);
 criticalvalue = msinteraction / mswithin;
 interactionconf = f_distribution(criticalvalue, (colsize - 1) * (rowsize - 1), datasize - rowsize * colsize);
 if (get_parameter_o("displayresulton"))
  {
   if (rowconf < get_parameter_f("confidencelevel"))
     printf(m1249, features[0] + 1);
   else
     printf(m1250, features[0] + 1);
   if (columnconf < get_parameter_f("confidencelevel"))
     printf(m1249, features[1] + 1);
   else
     printf(m1250, features[1] + 1);
   if (interactionconf < get_parameter_f("confidencelevel"))
     printf(m1251, features[0] + 1, features[1] + 1);
   else
     printf(m1252, features[0] + 1, features[1] + 1);
  }
 set_default_variable("out1", rowconf);
 set_default_variable("out2", columnconf);
 set_default_variable("out3", interactionconf);
 safe_free(rowmeans);
 safe_free(colmeans);
 safe_free(rowcounts);
 safe_free(colcounts);
 free_2d((void**)cellmeans, rowsize);
 free_2d((void**)cellcounts, rowsize);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, 0x10(%rsp)
movq %rdx, %rbx
movq %rsi, 0x18(%rsp)
movq %rdi, %r14
movq $0x0, 0x30(%rsp)
movq %rsi, %rdi
callq 0x2fa14
movl %eax, 0x38(%rsp)
leaq 0x30f08(%r14), %rax
movq %rax, 0x58(%rsp)
movq %rbx, %rcx
movq %rbx, 0x48(%rsp)
movslq (%rbx), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movl 0x30f20(%r14,%rax), %ebx
movslq 0x4(%rcx), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movl 0x30f20(%r14,%rax), %r13d
leaq 0x8fa60(%rip), %rbp     # 0xa3608
movl $0x8, %edi
movl $0x8, %esi
movl %ebx, %edx
movl %r13d, %ecx
movq %rbp, %r8
movl $0x9, %r9d
callq 0x39245
movq %rax, %r14
movl $0x8, %edi
movl $0x4, %esi
movl %ebx, %edx
movl %r13d, %ecx
movq %rbp, %r8
movl $0xa, %r9d
callq 0x39245
movq %rax, %r15
movq %rbx, 0x8(%rsp)
movslq %ebx, %r12
movl $0x8, %esi
movq %r12, %rdi
movq %rbp, %rdx
movq %rbp, %rbx
movl $0xe, %ecx
callq 0x39210
movq %rax, 0x28(%rsp)
movslq %r13d, %rbp
movl $0x8, %esi
movq %rbp, %rdi
movq %rbx, %rdx
movl $0xf, %ecx
callq 0x39210
movq %rax, 0x40(%rsp)
movl $0x8, %esi
movq %r12, %rdi
movq 0x18(%rsp), %r12
movq %rbx, %rdx
movl $0x10, %ecx
callq 0x39210
movq %rax, %rbx
movl $0x8, %esi
movq %rbp, %rdi
leaq 0x8f9b2(%rip), %rdx     # 0xa3608
movl $0x11, %ecx
callq 0x39210
movq 0x40(%rsp), %r8
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rsi
movslq 0x10(%rsp), %r11
testq %r12, %r12
movq %rbx, 0x50(%rsp)
movq %rax, 0x10(%rsp)
movq %r11, 0x20(%rsp)
je 0x13d63
movq %rbx, %r9
imulq $0x340, %r11, %rbp      # imm = 0x340
addq 0x58(%rsp), %rbp
movq %r12, %rbx
movl (%rbp), %ecx
cmpl $0x4, %ecx
je 0x13cbd
cmpl $0x2, %ecx
je 0x13cbd
testl %ecx, %ecx
jne 0x13cc8
movq (%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%r11,8), %xmm0
jmp 0x13cf6
movq (%rbx), %rcx
movsd (%rcx,%r11,8), %xmm0
jmp 0x13cf6
leaq 0x908a3(%rip), %rdi     # 0xa4572
callq 0x4090
movq 0x20(%rsp), %r11
movq 0x10(%rsp), %rax
movq 0x50(%rsp), %r9
movq 0x40(%rsp), %r8
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rsi
xorpd %xmm0, %xmm0
movq (%rbx), %r10
movslq (%rsi), %rcx
movslq (%r10,%rcx,8), %rcx
movslq 0x4(%rsi), %rdx
movslq (%r10,%rdx,8), %r10
movsd 0x30(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd (%rdi,%rcx,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rdi,%rcx,8)
incl (%r9,%rcx,4)
movsd (%r8,%r10,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%r8,%r10,8)
incl (%rax,%r10,4)
movq (%r14,%rcx,8), %rdx
addsd (%rdx,%r10,8), %xmm0
movsd %xmm0, (%rdx,%r10,8)
movq (%r15,%rcx,8), %rcx
incl (%rcx,%r10,4)
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
jne 0x13c9e
leaq 0x30(%rsp), %rdi
movl 0x38(%rsp), %esi
callq 0x39c2d
movq 0x8(%rsp), %r12
testl %r12d, %r12d
jle 0x13d9e
xorl %ebx, %ebx
movq 0x28(%rsp), %rbp
movq 0x50(%rsp), %rax
movl (%rax,%rbx,4), %esi
movq %rbp, %rdi
callq 0x39c2d
incq %rbx
addq $0x8, %rbp
cmpq %rbx, %r12
jne 0x13d82
testl %r13d, %r13d
movq 0x10(%rsp), %r12
jle 0x13dc7
xorl %ebx, %ebx
movq 0x40(%rsp), %rbp
movl (%r12,%rbx,4), %esi
movq %rbp, %rdi
callq 0x39c2d
incq %rbx
addq $0x8, %rbp
cmpq %rbx, %r13
jne 0x13daf
movq 0x8(%rsp), %rbp
testl %ebp, %ebp
movq 0x18(%rsp), %r12
jle 0x13e0b
xorl %ebx, %ebx
testl %r13d, %r13d
jle 0x13dfe
xorl %ebp, %ebp
leaq (,%rbp,8), %rdi
addq (%r14,%rbx,8), %rdi
movq (%r15,%rbx,8), %rax
movl (%rax,%rbp,4), %esi
callq 0x39c2d
incq %rbp
cmpq %r13, %rbp
jne 0x13dde
incq %rbx
movq 0x8(%rsp), %rbp
cmpq %rbp, %rbx
jne 0x13dd7
xorpd %xmm0, %xmm0
xorpd %xmm4, %xmm4
xorpd %xmm3, %xmm3
testq %r12, %r12
movq 0x48(%rsp), %rsi
movq 0x28(%rsp), %rdi
movq 0x50(%rsp), %r8
movq 0x10(%rsp), %r9
movq 0x58(%rsp), %rbx
movq 0x20(%rsp), %r10
je 0x13efc
imulq $0x340, %r10, %rax      # imm = 0x340
addq %rax, %rbx
movl (%rbx), %eax
cmpl $0x4, %eax
je 0x13e67
cmpl $0x2, %eax
je 0x13e67
testl %eax, %eax
jne 0x13e73
movq (%r12), %rax
xorps %xmm2, %xmm2
cvtsi2sdl (%rax,%r10,8), %xmm2
jmp 0x13eb8
movq (%r12), %rax
movsd (%rax,%r10,8), %xmm2
jmp 0x13eb8
leaq 0x906f8(%rip), %rdi     # 0xa4572
movsd %xmm3, 0x18(%rsp)
movsd %xmm4, 0x8(%rsp)
callq 0x4090
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm4
movsd 0x18(%rsp), %xmm3
movq 0x20(%rsp), %r10
movq 0x10(%rsp), %r9
movq 0x50(%rsp), %r8
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rsi
xorpd %xmm2, %xmm2
movslq (%rsi), %rax
movq (%r12), %rcx
movq 0x10(%r12), %r12
movslq (%rcx,%rax,8), %rax
movslq 0x4(%rsi), %rdx
movslq (%rcx,%rdx,8), %rcx
movapd %xmm2, %xmm1
subsd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm1
movq (%r14,%rax,8), %rax
subsd (%rax,%rcx,8), %xmm2
addsd %xmm1, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm4
testq %r12, %r12
jne 0x13e48
testl %ebp, %ebp
jle 0x13f32
movsd 0x30(%rsp), %xmm5
xorpd %xmm0, %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
cvtsi2sdl (%r8,%rax,4), %xmm1
movsd (%rdi,%rax,8), %xmm2
subsd %xmm5, %xmm2
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq %rax, %rbp
jne 0x13f0c
testl %r13d, %r13d
movq 0x40(%rsp), %rcx
jle 0x13f70
movsd 0x30(%rsp), %xmm5
xorpd %xmm6, %xmm6
xorl %eax, %eax
xorps %xmm1, %xmm1
cvtsi2sdl (%r9,%rax,4), %xmm1
movsd (%rcx,%rax,8), %xmm2
subsd %xmm5, %xmm2
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm6
incq %rax
cmpq %rax, %r13
jne 0x13f48
jmp 0x13f74
xorpd %xmm6, %xmm6
leal -0x1(%r13), %ebx
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
movl %ebx, 0x58(%rsp)
leal -0x1(%rbp), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
subsd %xmm6, %xmm3
divsd %xmm2, %xmm6
movsd %xmm6, 0x60(%rsp)
subsd %xmm0, %xmm3
divsd %xmm1, %xmm0
subsd %xmm4, %xmm3
imull %edi, %ebx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
divsd %xmm1, %xmm3
movsd %xmm3, 0x18(%rsp)
movl %ebp, %eax
imull %r13d, %eax
movl 0x38(%rsp), %r12d
subl %eax, %r12d
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
divsd %xmm1, %xmm4
movsd %xmm4, 0x8(%rsp)
divsd %xmm4, %xmm0
movl %r12d, %esi
callq 0x1faa9
movsd %xmm0, 0x20(%rsp)
movsd 0x60(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
movl 0x58(%rsp), %edi
movl %r12d, %esi
callq 0x1faa9
movsd %xmm0, 0x38(%rsp)
movsd 0x18(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
movl %ebx, %edi
movl %r12d, %esi
callq 0x1faa9
movsd %xmm0, 0x8(%rsp)
leaq 0x8f5f3(%rip), %rdi     # 0xa3621
callq 0x536e7
testl %eax, %eax
je 0x140cb
leaq 0x8e8e6(%rip), %rdi     # 0xa2928
callq 0x534b6
movq 0x48(%rsp), %rbx
movl (%rbx), %esi
incl %esi
ucomisd 0x20(%rsp), %xmm0
leaq 0x8f5e3(%rip), %r12     # 0xa3640
leaq 0x8f615(%rip), %r13     # 0xa3679
movq %r13, %rdi
cmovaq %r12, %rdi
xorl %eax, %eax
callq 0x4030
leaq 0x8e8af(%rip), %rdi     # 0xa2928
callq 0x534b6
ucomisd 0x38(%rsp), %xmm0
cmovaq %r12, %r13
movl 0x4(%rbx), %esi
incl %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x4030
leaq 0x8e88a(%rip), %rdi     # 0xa2928
callq 0x534b6
ucomisd 0x8(%rsp), %xmm0
leaq 0x8f581(%rip), %rax     # 0xa3631
leaq 0x8f5b3(%rip), %rdi     # 0xa366a
cmovaq %rax, %rdi
movl (%rbx), %esi
movl 0x4(%rbx), %edx
incl %esi
incl %edx
xorl %eax, %eax
callq 0x4030
leaq 0x91ee6(%rip), %rdi     # 0xa5fb8
movsd 0x20(%rsp), %xmm0
callq 0x3403a
leaq 0x91eda(%rip), %rdi     # 0xa5fbe
movsd 0x38(%rsp), %xmm0
callq 0x3403a
leaq 0x91ece(%rip), %rdi     # 0xa5fc4
movsd 0x8(%rsp), %xmm0
callq 0x3403a
movq 0x28(%rsp), %rdi
callq 0x39194
movq 0x40(%rsp), %rdi
callq 0x39194
movq 0x50(%rsp), %rdi
callq 0x39194
movq 0x10(%rsp), %rdi
callq 0x39194
movq %r14, %rdi
movl %ebp, %esi
callq 0x3915f
movq %r15, %rdi
movl %ebp, %esi
callq 0x3915f
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq