// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdi, %rbx
leaq 0xc0b22(%rip), %r14     # 0xd2870
movq (%r14), %rax
movl 0x1c0(%rax), %edi
decl %edi
movl %edi, %esi
callq 0x3c6e5
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq (%r14), %rax
movl 0x1c0(%rax), %edi
decl %edi
movl %edi, %esi
callq 0x3c6e5
movq %rax, 0x18(%rsp)
movq %rdx, 0x8(%rsp)
movq %rbx, %rdi
callq 0x115e1
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
movq %rax, 0x38(%rsp)
movq %rax, %rsi
callq 0x11918
movq %rax, %r13
movq (%r14), %rax
cmpl $0x0, 0x10(%rax)
jle 0x11f31
xorl %ebp, %ebp
cmpq $0x0, 0x20(%rsp)
je 0x11eca
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x2eaca
cmpl %ebp, %eax
leaq 0xc0a99(%rip), %rcx     # 0xd2870
jne 0x11ebd
movq (%rcx), %rax
cmpl $0x2, 0x1c0(%rax)
jl 0x11ebd
xorl %r14d, %r14d
movq (%rcx), %rax
cmpl $0x2, 0x1c0(%rax)
movq 0x8(%rsp), %r15
jl 0x11ea4
xorl %r12d, %r12d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2e4b6
movsd %xmm0, 0x10(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x30fe5
movq %rax, %rdi
movl %r14d, %esi
callq 0x2e4b6
movsd 0x10(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2e4b6
movsd %xmm0, 0x40(%rsp)
movq %r13, %rdi
movl %ebp, %esi
callq 0x30fe5
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e4b6
leaq 0xc0a05(%rip), %rcx     # 0xd2870
movsd 0x40(%rsp), %xmm1
subsd %xmm0, %xmm1
mulsd 0x10(%rsp), %xmm1
movq (%r15,%r14,8), %rax
addsd (%rax,%r12,8), %xmm1
movsd %xmm1, (%rax,%r12,8)
incq %r12
movq (%rcx), %rax
movslq 0x1c0(%rax), %rax
decq %rax
cmpq %rax, %r12
jl 0x11e08
incq %r14
movq (%rcx), %rax
movslq 0x1c0(%rax), %rax
decq %rax
cmpq %rax, %r14
jl 0x11df0
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
jne 0x11dc6
leaq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x3e64c
leaq 0xc0988(%rip), %rax     # 0xd2870
movq (%rax), %rax
movl 0x1c0(%rax), %r14d
cmpl $0x2, %r14d
jl 0x11f1c
decl %r14d
leaq (,%r14,8), %rbx
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x4050
incq %r12
cmpq %r12, %r14
jne 0x11f06
incl %ebp
leaq 0xc094b(%rip), %rax     # 0xd2870
movq (%rax), %rax
cmpl 0x10(%rax), %ebp
jl 0x11db5
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x3dbad
movq 0x38(%rsp), %rdi
callq 0x39194
movq %r13, %rdi
callq 0x2f616
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq