// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movl %r9d, %ebx
movl %r8d, 0x2c(%rsp)
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, 0x60(%rsp)
movq %rdi, 0x58(%rsp)
movw $0x2e, 0xe(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x561b4
jp 0x561b4
movq %r13, %rdi
movq %r12, %rsi
callq 0x3f436
movsd 0x4cb49(%rip), %xmm1    # 0xa2cf8
callq 0x42f0
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movsd %xmm1, 0x50(%rsp)
mulsd 0x4cb4f(%rip), %xmm0    # 0xa2d18
xorps %xmm1, %xmm1
cvtsi2sdl 0x2c(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movl $0x1, %r15d
movl $0x1, %edi
movl $0x2, %esi
callq 0x3c6e5
movq %rax, %rbp
movq %rdx, %rbx
movsd 0x4c321(%rip), %xmm1    # 0xa2520
leaq 0x358eb2(%rip), %r14    # 0x3af0b8
movapd %xmm1, %xmm0
movl %r15d, 0x1c(%rsp)
movapd %xmm0, %xmm3
movsd 0x10(%r14), %xmm0
movsd 0x18(%r14), %xmm4
subsd %xmm0, %xmm4
divsd 0x4eb65(%rip), %xmm4    # 0xa4d90
movsd %xmm3, 0x38(%rsp)
mulsd %xmm3, %xmm4
addsd %xmm0, %xmm4
movq (%rbx), %rax
movsd %xmm4, 0x40(%rsp)
movsd %xmm4, (%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movapd %xmm1, %xmm3
movsd %xmm2, 0x10(%rsp)
movsd 0x80(%r14), %xmm0
movsd 0x88(%r14), %xmm1
subsd %xmm0, %xmm1
divsd 0x4eb1c(%rip), %xmm1    # 0xa4d90
movsd %xmm3, 0x20(%rsp)
mulsd %xmm3, %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 %r13, %r8
movq %r12, %r9
callq 0x3f534
ucomisd 0x4ca55(%rip), %xmm0    # 0xa2d08
jb 0x562be
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0x562c7
callq 0x4300
movapd %xmm0, %xmm2
movsd 0x30(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm3
je 0x56337
cmpl $0x1f3, %r15d           # imm = 0x1F3
je 0x56337
cmpl 0x2c(%rsp), %eax
jge 0x56337
movl $0x8, %edi
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd %xmm2, 0x10(%rsp)
movsd 0x50(%rsp), %xmm2
movapd %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x2c3cc
movsd 0x20(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movsd 0x4c1e1(%rip), %xmm1    # 0xa2520
addsd %xmm1, %xmm3
decl %r15d
jne 0x56250
movsd 0x38(%rsp), %xmm0
addsd %xmm1, %xmm0
movl 0x1c(%rsp), %r15d
incl %r15d
cmpl $0x1f4, %r15d           # imm = 0x1F4
jne 0x5620a
movl $0x1, %eax
movsd 0x4c1a8(%rip), %xmm1    # 0xa2520
movapd %xmm1, %xmm0
movl %eax, 0x1c(%rsp)
movapd %xmm0, %xmm3
movsd 0x18(%r14), %xmm0
movapd %xmm0, %xmm4
subsd 0x10(%r14), %xmm4
divsd 0x4e9dc(%rip), %xmm4    # 0xa4d78
movsd %xmm3, 0x38(%rsp)
mulsd %xmm3, %xmm4
addsd %xmm0, %xmm4
movq (%rbx), %rax
movsd %xmm4, 0x40(%rsp)
movsd %xmm4, (%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movapd %xmm1, %xmm3
movsd %xmm2, 0x10(%rsp)
movsd 0x88(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x80(%r14), %xmm1
divsd 0x4e993(%rip), %xmm1    # 0xa4d78
movsd %xmm3, 0x20(%rsp)
mulsd %xmm3, %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 %r13, %r8
movq %r12, %r9
callq 0x3f534
ucomisd 0x4c8e4(%rip), %xmm0    # 0xa2d08
jb 0x5642f
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0x56438
callq 0x4300
movapd %xmm0, %xmm2
movsd 0x30(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm3
je 0x564a8
cmpl $0x1f3, %r15d           # imm = 0x1F3
je 0x564a8
cmpl 0x2c(%rsp), %eax
jge 0x564a8
movl $0x8, %edi
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd %xmm2, 0x10(%rsp)
movsd 0x50(%rsp), %xmm2
movapd %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x2c3cc
movsd 0x20(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movsd 0x4c070(%rip), %xmm1    # 0xa2520
addsd %xmm1, %xmm3
decl %r15d
jne 0x563c1
movsd 0x38(%rsp), %xmm0
addsd %xmm1, %xmm0
movl 0x1c(%rsp), %eax
incl %eax
cmpl $0x1f4, %eax            # imm = 0x1F4
jne 0x5637c
movl $0x1, %eax
movsd 0x4c03b(%rip), %xmm1    # 0xa2520
movapd %xmm1, %xmm0
movl %eax, 0x1c(%rsp)
movapd %xmm0, %xmm3
movsd 0x80(%r14), %xmm0
movsd 0x88(%r14), %xmm4
subsd %xmm0, %xmm4
divsd 0x4e881(%rip), %xmm4    # 0xa4d90
movsd %xmm3, 0x38(%rsp)
mulsd %xmm3, %xmm4
addsd %xmm0, %xmm4
movq (%rbx), %rax
movsd %xmm4, 0x40(%rsp)
movsd %xmm4, 0x8(%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movapd %xmm1, %xmm3
movsd %xmm2, 0x10(%rsp)
movsd 0x10(%r14), %xmm0
movsd 0x18(%r14), %xmm1
subsd %xmm0, %xmm1
divsd 0x4e83d(%rip), %xmm1    # 0xa4d90
movsd %xmm3, 0x20(%rsp)
mulsd %xmm3, %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 %r13, %r8
movq %r12, %r9
callq 0x3f534
ucomisd 0x4c777(%rip), %xmm0    # 0xa2d08
jb 0x5659c
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0x565a5
callq 0x4300
movapd %xmm0, %xmm2
movsd 0x30(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm3
je 0x56615
cmpl $0x1f3, %r15d           # imm = 0x1F3
je 0x56615
cmpl 0x2c(%rsp), %eax
jge 0x56615
movl $0x8, %edi
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd %xmm2, 0x10(%rsp)
movsd 0x50(%rsp), %xmm2
movapd %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x2c3cc
movsd 0x20(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movsd 0x4bf03(%rip), %xmm1    # 0xa2520
addsd %xmm1, %xmm3
decl %r15d
jne 0x56535
movsd 0x38(%rsp), %xmm0
addsd %xmm1, %xmm0
movl 0x1c(%rsp), %eax
incl %eax
cmpl $0x1f4, %eax            # imm = 0x1F4
jne 0x564e9
movl $0x1, %eax
movsd 0x4bece(%rip), %xmm1    # 0xa2520
movapd %xmm1, %xmm0
movl %eax, 0x1c(%rsp)
movapd %xmm0, %xmm3
movsd 0x88(%r14), %xmm0
movapd %xmm0, %xmm4
subsd 0x80(%r14), %xmm4
divsd 0x4e6fc(%rip), %xmm4    # 0xa4d78
movsd %xmm3, 0x38(%rsp)
mulsd %xmm3, %xmm4
addsd %xmm0, %xmm4
movq (%rbx), %rax
movsd %xmm4, 0x40(%rsp)
movsd %xmm4, 0x8(%rax)
movl $0x1f3, %r15d           # imm = 0x1F3
movapd %xmm1, %xmm3
movsd %xmm2, 0x10(%rsp)
movsd 0x18(%r14), %xmm0
movapd %xmm0, %xmm1
subsd 0x10(%r14), %xmm1
divsd 0x4e6b8(%rip), %xmm1    # 0xa4d78
movsd %xmm3, 0x20(%rsp)
mulsd %xmm3, %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 %r13, %r8
movq %r12, %r9
callq 0x3f534
ucomisd 0x4c60a(%rip), %xmm0    # 0xa2d08
jb 0x56709
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
jmp 0x56712
callq 0x4300
movapd %xmm0, %xmm2
movsd 0x30(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cmpl %eax, %ecx
movsd 0x20(%rsp), %xmm3
je 0x56782
cmpl $0x1f3, %r15d           # imm = 0x1F3
je 0x56782
cmpl 0x2c(%rsp), %eax
jge 0x56782
movl $0x8, %edi
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd %xmm2, 0x10(%rsp)
movsd 0x50(%rsp), %xmm2
movapd %xmm2, %xmm4
leaq 0xe(%rsp), %rsi
callq 0x2c3cc
movsd 0x20(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movsd 0x4bd96(%rip), %xmm1    # 0xa2520
addsd %xmm1, %xmm3
decl %r15d
jne 0x566a2
movsd 0x38(%rsp), %xmm0
addsd %xmm1, %xmm0
movl 0x1c(%rsp), %eax
incl %eax
cmpl $0x1f4, %eax            # imm = 0x1F4
jne 0x56656
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3dbad
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq