// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/plot.c
// Function: plot_covariance
void plot_covariance(matrix avg, matrix covariance, int contour, int color, double maxdist)
{
 int i, j, oldbin, newbin;
 double avgdist, predicted, predictedx, predictedy;
 Point p, dummyp;
 char st[2];
 matrix x;
 st[0] = '.';
 st[1] = '\0';
 dummyp.x = color;
 if (maxdist == 0.0)
   maxdist = 0.5 * pow(matrix_determinant(covariance), 0.25);
 else
   maxdist /= 2.0;
 avgdist = maxdist / contour;
 x = matrix_alloc(1, 2);
 for (i = 1; i < MESHDEPTH * PARTITIONS; i++)
  {
   p.x = img.xaxis.lim.min + i * ((img.xaxis.lim.max - img.xaxis.lim.min) / (MESHDEPTH * PARTITIONS));
   x.values[0][0] = p.x;
   for (j = 1; j < MESHDEPTH * PARTITIONS; j++)
    {
     p.y = img.yaxis.lim.min + j * ((img.yaxis.lim.max - img.yaxis.lim.min) / (MESHDEPTH * PARTITIONS));
     x.values[0][1] = p.y;
     predicted = sqrt(mahalanobis_distance(x, avg, covariance));
     oldbin = ((int)(predictedy / avgdist));
     newbin = ((int)(predicted / avgdist));
     if ((oldbin != newbin) && (newbin < contour) && (j != 1))
       add_object(OBJECT_POINT, p, dummyp, dummyp, st);
     predictedy = predicted;
    }
  }
 for (i = 1; i < MESHDEPTH * PARTITIONS; i++)
  {
   p.x = img.xaxis.lim.max - i * ((img.xaxis.lim.max - img.xaxis.lim.min) / (MESHDEPTH * PARTITIONS));
   x.values[0][0] = p.x;
   for (j = 1; j < MESHDEPTH * PARTITIONS; j++)
    {
     p.y = img.yaxis.lim.max - j * ((img.yaxis.lim.max - img.yaxis.lim.min) / (MESHDEPTH * PARTITIONS));
     x.values[0][1] = p.y;
     predicted = sqrt(mahalanobis_distance(x, avg, covariance));
     oldbin = ((int)(predictedy / avgdist));
     newbin = ((int)(predicted / avgdist));
     if ((oldbin != newbin) && (newbin < contour) && (j != 1))
       add_object(OBJECT_POINT, p, dummyp, dummyp, st);
     predictedy = predicted;
    }
  }
 for (i = 1; i < MESHDEPTH * PARTITIONS; i++)
  {
   p.y = img.yaxis.lim.min + i * ((img.yaxis.lim.max - img.yaxis.lim.min) / (MESHDEPTH * PARTITIONS));
   x.values[0][1] = p.y;
   for (j = 1; j < MESHDEPTH * PARTITIONS; j++)
    {
     p.x = img.xaxis.lim.min + j * ((img.xaxis.lim.max - img.xaxis.lim.min) / (MESHDEPTH * PARTITIONS));
     x.values[0][0] = p.x;
     predicted = sqrt(mahalanobis_distance(x, avg, covariance));
     oldbin = ((int)(predictedx / avgdist));
     newbin = ((int)(predicted / avgdist));
     if ((oldbin != newbin) && (newbin < contour) && (j != 1))
       add_object(OBJECT_POINT, p, dummyp, dummyp, st);
     predictedx = predicted;
    }
  }
 for (i = 1; i < MESHDEPTH * PARTITIONS; i++)
  {
   p.y = img.yaxis.lim.max - i * ((img.yaxis.lim.max - img.yaxis.lim.min) / (MESHDEPTH * PARTITIONS));
   x.values[0][1] = p.y;
   for (j = 1; j < MESHDEPTH * PARTITIONS; j++)
    {
     p.x = img.xaxis.lim.max - j * ((img.xaxis.lim.max - img.xaxis.lim.min) / (MESHDEPTH * PARTITIONS));
     x.values[0][0] = p.x;
     predicted = sqrt(mahalanobis_distance(x, avg, covariance));
     oldbin = ((int)(predictedx / avgdist));
     newbin = ((int)(predicted / avgdist));
     if ((oldbin != newbin) && (newbin < contour) && (j != 1))
       add_object(OBJECT_POINT, p, dummyp, dummyp, st);
     predictedx = predicted;
    }
  }
 matrix_free(x);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r9d, %ebx
movl %r8d, 0x2c(%rsp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, 0x60(%rsp)
movq %rdi, 0x58(%rsp)
movw $0x2e, 0xe(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4f9f3
jp 0x4f9f3
movq %r14, %rdi
movq %r13, %rsi
callq 0x3a822
movsd 0x46322(%rip), %xmm1    # 0x95d10
callq 0x42f0
movq %r14, 0x68(%rsp)
cvtsi2sd %ebx, %xmm1
movsd %xmm1, 0x50(%rsp)
mulsd 0x46316(%rip), %xmm0    # 0x95d20
movapd %xmm0, 0x70(%rsp)
cvtsi2sdl 0x2c(%rsp), %xmm0
movapd 0x70(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, 0x70(%rsp)
pushq $0x1
popq %r15
pushq $0x2
popq %rsi
movl %r15d, %edi
callq 0x380d3
movq %rax, %rbp
movq %rdx, %rbx
movaps 0x70(%rsp), %xmm0
movlhps %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movaps %xmm0, 0x70(%rsp)
movsd 0x45ad0(%rip), %xmm0    # 0x95520
leaq 0x35a661(%rip), %r14    # 0x3aa0b8
movsd %xmm0, 0x10(%rsp)
cmpl $0x1f4, %r15d           # imm = 0x1F4
je 0x4fbca
movl %r15d, 0x1c(%rsp)
movsd 0x10(%r14), %xmm0
movsd 0x18(%r14), %xmm2
subsd %xmm0, %xmm2
divsd 0x48311(%rip), %xmm2    # 0x97d98
mulsd 0x10(%rsp), %xmm2
addsd %xmm0, %xmm2
movq (%rbx), %rax
movsd %xmm2, 0x40(%rsp)
movsd %xmm2, (%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movsd 0x45a74(%rip), %xmm2    # 0x95520
movl %r15d, %r12d
subl $0x1, %r15d
jb 0x4fba9
movaps %xmm1, 0x30(%rsp)
movsd 0x80(%r14), %xmm0
movsd 0x88(%r14), %xmm1
subsd %xmm0, %xmm1
divsd 0x482bc(%rip), %xmm1    # 0x97d98
movsd %xmm2, 0x20(%rsp)
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, 0x48(%rsp)
movsd %xmm1, 0x8(%rax)
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %r8
movq %r13, %r9
callq 0x3a8ff
ucomisd 0x461fb(%rip), %xmm0    # 0x95d18
jb 0x4fb25
sqrtsd %xmm0, %xmm1
jmp 0x4fb2e
callq 0x4300
movapd %xmm0, %xmm1
movapd 0x30(%rsp), %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
divpd 0x70(%rsp), %xmm0
cvttpd2dq %xmm0, %xmm0
movd %xmm0, %ecx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm2
je 0x4fb9c
cmpl $0x1f3, %r12d           # imm = 0x1F3
je 0x4fb9c
cmpl 0x2c(%rsp), %eax
jge 0x4fb9c
pushq $0x8
popq %rdi
movq 0x40(%rsp), %xmm0
movapd %xmm1, 0x30(%rsp)
movsd 0x48(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
movaps %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x28f8d
movsd 0x20(%rsp), %xmm2
movapd 0x30(%rsp), %xmm1
addsd 0x4597c(%rip), %xmm2    # 0x95520
jmp 0x4faac
movsd 0x10(%rsp), %xmm0
addsd 0x45969(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
movl 0x1c(%rsp), %r15d
incl %r15d
jmp 0x4fa5d
pushq $0x1
popq %rax
movsd 0x4594b(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
cmpl $0x1f4, %eax            # imm = 0x1F4
je 0x4fd43
movl %eax, 0x1c(%rsp)
movsd 0x18(%r14), %xmm0
movapd %xmm0, %xmm2
subsd 0x10(%r14), %xmm2
divsd 0x4817e(%rip), %xmm2    # 0x97d80
mulsd 0x10(%rsp), %xmm2
addsd %xmm0, %xmm2
movq (%rbx), %rax
movsd %xmm2, 0x40(%rsp)
movsd %xmm2, (%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movsd 0x458f9(%rip), %xmm2    # 0x95520
movl %r15d, %r12d
subl $0x1, %r15d
jb 0x4fd24
movaps %xmm1, 0x30(%rsp)
movsd 0x88(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x80(%r14), %xmm1
divsd 0x48129(%rip), %xmm1    # 0x97d80
movsd %xmm2, 0x20(%rsp)
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, 0x48(%rsp)
movsd %xmm1, 0x8(%rax)
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %r8
movq %r13, %r9
callq 0x3a8ff
ucomisd 0x46080(%rip), %xmm0    # 0x95d18
jb 0x4fca0
sqrtsd %xmm0, %xmm1
jmp 0x4fca9
callq 0x4300
movapd %xmm0, %xmm1
movapd 0x30(%rsp), %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
divpd 0x70(%rsp), %xmm0
cvttpd2dq %xmm0, %xmm0
movd %xmm0, %ecx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm2
je 0x4fd17
cmpl $0x1f3, %r12d           # imm = 0x1F3
je 0x4fd17
cmpl 0x2c(%rsp), %eax
jge 0x4fd17
pushq $0x8
popq %rdi
movq 0x40(%rsp), %xmm0
movapd %xmm1, 0x30(%rsp)
movsd 0x48(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
movaps %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x28f8d
movsd 0x20(%rsp), %xmm2
movapd 0x30(%rsp), %xmm1
addsd 0x45801(%rip), %xmm2    # 0x95520
jmp 0x4fc27
movsd 0x10(%rsp), %xmm0
addsd 0x457ee(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
movl 0x1c(%rsp), %eax
incl %eax
jmp 0x4fbdb
pushq $0x1
popq %rax
movsd 0x457d2(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
cmpl $0x1f4, %eax            # imm = 0x1F4
je 0x4febc
movl %eax, 0x1c(%rsp)
movsd 0x80(%r14), %xmm0
movsd 0x88(%r14), %xmm2
subsd %xmm0, %xmm2
divsd 0x48017(%rip), %xmm2    # 0x97d98
mulsd 0x10(%rsp), %xmm2
addsd %xmm0, %xmm2
movq (%rbx), %rax
movsd %xmm2, 0x40(%rsp)
movsd %xmm2, 0x8(%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movsd 0x45779(%rip), %xmm2    # 0x95520
movl %r15d, %r12d
subl $0x1, %r15d
jb 0x4fe9d
movaps %xmm1, 0x30(%rsp)
movsd 0x10(%r14), %xmm0
movsd 0x18(%r14), %xmm1
subsd %xmm0, %xmm1
divsd 0x47fc7(%rip), %xmm1    # 0x97d98
movsd %xmm2, 0x20(%rsp)
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, 0x48(%rsp)
movsd %xmm1, (%rax)
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %r8
movq %r13, %r9
callq 0x3a8ff
ucomisd 0x45f07(%rip), %xmm0    # 0x95d18
jb 0x4fe19
sqrtsd %xmm0, %xmm1
jmp 0x4fe22
callq 0x4300
movapd %xmm0, %xmm1
movapd 0x30(%rsp), %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
divpd 0x70(%rsp), %xmm0
cvttpd2dq %xmm0, %xmm0
movd %xmm0, %ecx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm2
je 0x4fe90
cmpl $0x1f3, %r12d           # imm = 0x1F3
je 0x4fe90
cmpl 0x2c(%rsp), %eax
jge 0x4fe90
pushq $0x8
popq %rdi
movq 0x48(%rsp), %xmm0
movapd %xmm1, 0x30(%rsp)
movsd 0x40(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
movaps %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x28f8d
movsd 0x20(%rsp), %xmm2
movapd 0x30(%rsp), %xmm1
addsd 0x45688(%rip), %xmm2    # 0x95520
jmp 0x4fda7
movsd 0x10(%rsp), %xmm0
addsd 0x45675(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
movl 0x1c(%rsp), %eax
incl %eax
jmp 0x4fd54
pushq $0x1
popq %rax
movsd 0x45659(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
cmpl $0x1f4, %eax            # imm = 0x1F4
je 0x50035
movl %eax, 0x1c(%rsp)
movsd 0x88(%r14), %xmm0
movapd %xmm0, %xmm2
subsd 0x80(%r14), %xmm2
divsd 0x47e86(%rip), %xmm2    # 0x97d80
mulsd 0x10(%rsp), %xmm2
addsd %xmm0, %xmm2
movq (%rbx), %rax
movsd %xmm2, 0x40(%rsp)
movsd %xmm2, 0x8(%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movsd 0x45600(%rip), %xmm2    # 0x95520
movl %r15d, %r12d
subl $0x1, %r15d
jb 0x50016
movaps %xmm1, 0x30(%rsp)
movsd 0x18(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x10(%r14), %xmm1
divsd 0x47e36(%rip), %xmm1    # 0x97d80
movsd %xmm2, 0x20(%rsp)
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movq (%rbx), %rax
movsd %xmm1, 0x48(%rsp)
movsd %xmm1, (%rax)
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x68(%rsp), %r8
movq %r13, %r9
callq 0x3a8ff
ucomisd 0x45d8e(%rip), %xmm0    # 0x95d18
jb 0x4ff92
sqrtsd %xmm0, %xmm1
jmp 0x4ff9b
callq 0x4300
movapd %xmm0, %xmm1
movapd 0x30(%rsp), %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
divpd 0x70(%rsp), %xmm0
cvttpd2dq %xmm0, %xmm0
movd %xmm0, %ecx
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm2
je 0x50009
cmpl $0x1f3, %r12d           # imm = 0x1F3
je 0x50009
cmpl 0x2c(%rsp), %eax
jge 0x50009
pushq $0x8
popq %rdi
movq 0x48(%rsp), %xmm0
movapd %xmm1, 0x30(%rsp)
movsd 0x40(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
movaps %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x28f8d
movsd 0x20(%rsp), %xmm2
movapd 0x30(%rsp), %xmm1
addsd 0x4550f(%rip), %xmm2    # 0x95520
jmp 0x4ff20
movsd 0x10(%rsp), %xmm0
addsd 0x454fc(%rip), %xmm0    # 0x95520
movsd %xmm0, 0x10(%rsp)
movl 0x1c(%rsp), %eax
incl %eax
jmp 0x4fecd
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3929f
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq