// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/data.c
// Function: covariance_2d
matrix covariance_2d(Instanceptr myptr, matrix currentmean)
{
 /*!Last Changed 30.01.2005*/
 matrix result;
 Instanceptr tmp;
 int dim, matrixdim, i, j, k, m, size = 0, x, y;
 double fx, fy, meanx, meany;
 dim  = current_dataset->multifeaturecount - 1;
 matrixdim = multifeaturecount_2d(current_dataset);
 result = matrix_alloc(matrixdim, matrixdim);
 tmp = myptr;
 while (tmp)
  {
   x = 0;
   /*For dimensions x_ix_j*/
   for (i = 0; i < dim; i++)
     for (j = i; j < dim; j++)
      {
       y = 0;
       fx = real_feature(tmp, i) * real_feature(tmp, j);
       meanx = currentmean.values[0][x];
       /*with dimensions x_kx_m*/
       for (k = 0; k < dim; k++)
         for (m = k; m < dim; m++)
          {           
           fy = real_feature(tmp, k) * real_feature(tmp, m);
           meany = currentmean.values[0][y];
           result.values[x][y] += (fx - meanx) * (fy - meany);
           y++;
          }
       /*with dimensions x_k*/
       for (k = 0; k < dim; k++)
        {
         fy = real_feature(tmp, k);
         meany = currentmean.values[0][y];
         result.values[x][y] += (fx - meanx) * (fy - meany);
         y++;
        }
       x++;
      }
   /*For dimensions x_i*/
   for (i = 0; i < dim; i++)
    {
     y = 0;
     fx = real_feature(tmp, i);
     meanx = currentmean.values[0][x];
     /*with dimensions x_kx_m*/
     for (k = 0; k < dim; k++)
       for (m = k; m < dim; m++)
        {           
         fy = real_feature(tmp, k) * real_feature(tmp, m);
         meany = currentmean.values[0][y];
         result.values[x][y] += (fx - meanx) * (fy - meany);
         y++;
        }
     /*with dimensions x_k*/
     for (k = 0; k < dim; k++)
      {
       fy = real_feature(tmp, k);
       meany = currentmean.values[0][y];
       result.values[x][y] += (fx - meanx) * (fy - meany);
       y++;
      }
     x++;
    }
   tmp = tmp->next;
   size++;
  }
 for (i = 0; i < matrixdim; i++)
   for (j = 0; j < matrixdim; j++)
     result.values[i][j] /= (size - 1);
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rsi, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
movq %rdi, -0x28(%rbp)
movl $0x0, -0x4c(%rbp)
leaq 0xedc7b(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
leaq 0xedc65(%rip), %rax     # 0x105840
movq (%rax), %rdi
callq 0x1b690
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %edi
movl -0x38(%rbp), %esi
callq 0x57fc0
movq %rax, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x17fca
movl $0x0, -0x50(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17e0f
movl -0x3c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17dff
movl $0x0, -0x54(%rbp)
movq -0x30(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x90(%rbp)
movq -0x30(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm1
movsd -0x90(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x70(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17d69
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17d59
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x98(%rbp)
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm1
movsd -0x98(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x60(%rbp), %xmm0
subsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
subsd -0x78(%rbp), %xmm2
movq -0x8(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x17cb7
jmp 0x17d5b
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x17ca5
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17de8
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x60(%rbp), %xmm0
subsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
subsd -0x78(%rbp), %xmm2
movq -0x8(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x17d70
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x17c42
jmp 0x17e01
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x17c30
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17fb0
movl $0x0, -0x54(%rbp)
movq -0x30(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x70(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17f1a
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17f0a
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0xa0(%rbp)
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x42c40
movaps %xmm0, %xmm1
movsd -0xa0(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x60(%rbp), %xmm0
subsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
subsd -0x78(%rbp), %xmm2
movq -0x8(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x17e68
jmp 0x17f0c
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x17e56
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x17f99
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x42c40
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x60(%rbp), %xmm0
subsd -0x70(%rbp), %xmm0
movsd -0x68(%rbp), %xmm2
subsd -0x78(%rbp), %xmm2
movq -0x8(%rbp), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x17f21
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x17e16
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x17c17
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x18028
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x1801b
movl -0x4c(%rbp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
movq -0x8(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x17fe0
jmp 0x1801d
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x17fd1
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)