// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/data.c
// Function: within_class_matrix
matrix within_class_matrix(Instanceptr myptr)
{
 /*!Last Changed 26.01.2002*/
 int i,j,k;
 Instanceptr temp;
 int *c_counts;
 Instanceptr c_means; 
 matrix result, current_matrix;
 temp = myptr;
 result = matrix_alloc(current_dataset->multifeaturecount - 1, current_dataset->multifeaturecount - 1);
 current_matrix = matrix_alloc(current_dataset->multifeaturecount - 1, current_dataset->multifeaturecount - 1);
 c_counts = find_class_counts(temp);
 c_means = find_class_means(temp, c_counts);
 for (i = 0; i < current_dataset->classno; i++)
  {
   temp = myptr;
   while (temp)
    {
     if (give_classno(temp) == i)
       for (j = 0; j < current_dataset->multifeaturecount - 1; j++)
         for (k = 0; k < current_dataset->multifeaturecount - 1; k++)
           current_matrix.values[j][k] += (real_feature(temp, j) - real_feature(data_x(c_means, i), j)) * (real_feature(temp, k) - real_feature(data_x(c_means, i), k));
     temp = temp->next;
    }
   matrix_add(&result, current_matrix);
   for (j = 0; j < current_dataset->multifeaturecount - 1; j++)
     for (k = 0; k < current_dataset->multifeaturecount - 1; k++)
       current_matrix.values[j][k] = 0;
  }
 matrix_free(current_matrix);
 safe_free(c_counts);
 deallocate(c_means);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0xbc8eb(%rip), %r14     # 0xcd870
movq (%r14), %rax
movl 0x1c0(%rax), %edi
decl %edi
movl %edi, %esi
callq 0x380d3
leaq 0x28(%rsp), %rcx
movq %rax, (%rcx)
movq %rdx, 0x8(%rcx)
movq (%r14), %rax
movl 0x1c0(%rax), %edi
decl %edi
movl %edi, %esi
callq 0x380d3
movq %rax, 0x8(%rsp)
movq %rdx, %r12
movq %rbx, %rdi
callq 0x108c8
movq %rbx, 0x18(%rsp)
movq %rbx, %rdi
movq %rax, 0x10(%rsp)
movq %rax, %rsi
callq 0x10bb9
movq %rax, %rbp
movq (%r14), %rax
xorl %r13d, %r13d
cmpl 0x10(%rax), %r13d
jge 0x1113a
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x110e3
movq %rbx, %rdi
callq 0x2b47e
cmpl %r13d, %eax
jne 0x110da
leaq 0xbc85d(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x1c0(%rax), %eax
xorl %r14d, %r14d
leal -0x1(%rax), %ecx
movslq %ecx, %rcx
cmpq %rcx, %r14
jge 0x110da
xorl %r15d, %r15d
leal -0x1(%rax), %ecx
movslq %ecx, %rcx
cmpq %rcx, %r15
jge 0x110d2
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2aea2
movsd %xmm0, (%rsp)
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2d761
movq %rax, %rdi
movl %r14d, %esi
callq 0x2aea2
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2aea2
movsd %xmm0, 0x20(%rsp)
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2d761
movq %rax, %rdi
movl %r15d, %esi
callq 0x2aea2
movsd 0x20(%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd (%rsp), %xmm1
movq (%r12,%r14,8), %rax
addsd (%rax,%r15,8), %xmm1
movsd %xmm1, (%rax,%r15,8)
incq %r15
leaq 0xbc7ac(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x1c0(%rax), %eax
jmp 0x11031
incq %r14
jmp 0x1101f
movq 0x10(%rbx), %rbx
jmp 0x10ff2
leaq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
callq 0x39b81
leaq 0xbc774(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x1c0(%rax), %ecx
decl %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
xorl %esi, %esi
cmpq %rdx, %rsi
je 0x11132
xorl %edi, %edi
cmpq %rdi, %rcx
je 0x1112d
movq (%r12,%rsi,8), %r8
andq $0x0, (%r8,%rdi,8)
incq %rdi
jmp 0x1111a
incq %rsi
jmp 0x11113
incl %r13d
jmp 0x10fe3
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x3929f
movq 0x10(%rsp), %rdi
callq 0x34ff7
movq %rbp, %rdi
callq 0x2c010
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq