// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dimreduction.c
// Function: local_covariance_matrix
matrix local_covariance_matrix(Datasetptr d, Instanceptr inst, Instanceptr traindata, matrix neighborhood, int index)
{
 /*!Last Changed 19.01.2008*/
 matrix C;
 int i, j, t, k, p, size = matrix_sum_row(neighborhood, index);
 Instanceptr temp1, temp2;
 double sum;
 C = matrix_alloc(size, size);
 for (i = 0, j = 0, temp1 = traindata; i < neighborhood.row; i++, temp1 = temp1->next)
   if (neighborhood.values[index][i] == 1)
    {
     for (t = 0, k = 0, temp2 = traindata; t < neighborhood.row; t++, temp2 = temp2->next)
       if (neighborhood.values[index][t] == 1)
        {
         sum = 0.0;
         for (p = 0; p < d->multifeaturecount - 1; p++)
           sum += (real_feature(inst, p) - real_feature(temp1, p)) * (real_feature(inst, p) - real_feature(temp2, p));
         C.values[j][k] = sum;
         k++;
        }
     j++;
    }
 return C;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rcx, -0x20(%rbp)
movq %r8, -0x18(%rbp)
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movl %r9d, -0x3c(%rbp)
movl -0x3c(%rbp), %edx
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5b6d0
cvttsd2si %xmm0, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %edi
movl -0x54(%rbp), %esi
callq 0x57fc0
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2d0f4
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0xb509c(%rip), %xmm1    # 0xe2018
ucomisd %xmm1, %xmm0
jne 0x2d0d8
jp 0x2d0d8
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2d0cf
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0xb504d(%rip), %xmm1    # 0xe2018
ucomisd %xmm1, %xmm0
jne 0x2d0b3
jp 0x2d0b3
xorps %xmm0, %xmm0
movsd %xmm0, -0x70(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
movl 0x1c0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2d090
movq -0x30(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x98(%rbp)
movq -0x60(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm1
movsd -0x98(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x30(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x90(%rbp)
movq -0x68(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0x42c40
movsd -0x90(%rbp), %xmm2
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
subsd %xmm1, %xmm2
movsd -0x70(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x2cfea
movsd -0x70(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2d0b5
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x2cfa2
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2d0da
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x2cf53
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)