// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/plot.c
// Function: plotgauss2d
void plotgauss2d(char* names, int contour)
{
 int i;
 double obs1, obs2, dist, maxdist;
 double *observations1 = NULL, *observations2 = NULL, *averages;
 matrix observations, covariance, avg, x;
 Point p, dummyp, p3;
 char st2[2], *legendname;
 FILE* myfile;
 int datacount, color;
 if (!get_parameter_o("hold"))
   clear_image();
 legendname = file_only_name(names);
 color = img.imagelegend.legendcount;
 p3.x = color;
 add_legend((char)('A' + color), legendname);
 safe_free(legendname);
 st2[0] = plots[color];
 st2[1] = '\0';
 datacount = 0;
 myfile = fopen(names, "r");
 if (!myfile)
   return;
 while (fscanf(myfile,"%lf %lf\n", &obs1, &obs2) != EOF)
  {
   datacount++;
   observations1 = alloc(observations1, datacount * sizeof(double), datacount);
   observations1[datacount - 1] = obs1;
   observations2 = alloc(observations2, datacount * sizeof(double), datacount);
   observations2[datacount - 1] = obs2;
   p.x = (double) obs1;
   check_x_range(p);
   p.y = (double) obs2;
   check_y_range(p);
   add_object(OBJECT_STRING, p, dummyp, p3, st2);
  }
 fclose(myfile);
 observations = matrix_alloc(datacount, 2);
 avg = matrix_alloc(1, 2);
 for (i = 0; i < datacount; i++)
  {
   observations.values[i][0] = observations1[i];
   observations.values[i][1] = observations2[i];
  }
 covariance = matrix_covariance(observations, &averages);
 matrix_free(observations);
 memcpy(avg.values[0], averages, 2 * sizeof(double));
 safe_free(averages);
 x = matrix_alloc(1, 2);
 maxdist = -INT_MAX;
 for (i = 0; i < datacount; i++)
  {
   x.values[0][0] = observations1[i];
   x.values[0][1] = observations2[i];
   dist = mahalanobis_distance(x, avg, covariance);
   if (dist == -1)
    {
     matrix_free(x);
     safe_free(observations1);
     safe_free(observations2);
     matrix_free(covariance);
     matrix_free(avg);
     return;
    }
   dist = sqrt(dist);
   if (dist > maxdist)
     maxdist = dist;
  }
 matrix_free(x);
 safe_free(observations1);
 safe_free(observations2);
 plot_covariance(avg, covariance, contour, color, maxdist);
 matrix_free(covariance);
 matrix_free(avg);
 export_image();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
leaq 0x69c4f(%rip), %rdi     # 0xe7308
callq 0x79440
cmpl $0x0, %eax
jne 0x7d6ca
movb $0x0, %al
callq 0x41a40
movq -0x8(%rbp), %rdi
callq 0x510a0
movq %rax, -0xc8(%rbp)
leaq 0x3649a7(%rip), %rax    # 0x3e2088
movl 0xec(%rax), %eax
movl %eax, -0xd8(%rbp)
cvtsi2sdl -0xd8(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movl -0xd8(%rbp), %eax
addl $0x41, %eax
movq -0xc8(%rbp), %rsi
movsbl %al, %edi
callq 0x3efa0
movq -0xc8(%rbp), %rdi
callq 0x52e80
movslq -0xd8(%rbp), %rcx
leaq 0x87901(%rip), %rax     # 0x105030
movb (%rax,%rcx), %al
movb %al, -0xba(%rbp)
movb $0x0, -0xb9(%rbp)
movl $0x0, -0xd4(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x6aa52(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
jne 0x7d76f
jmp 0x7db71
jmp 0x7d771
movq -0xd0(%rbp), %rdi
leaq 0x6a023(%rip), %rsi     # 0xe77a2
leaq -0x18(%rbp), %rdx
leaq -0x20(%rbp), %rcx
movb $0x0, %al
callq 0x4070
cmpl $-0x1, %eax
je 0x7d8a0
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movq -0x38(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
shlq $0x3, %rsi
movl -0xd4(%rbp), %edx
callq 0x52d10
movq %rax, -0x38(%rbp)
movsd -0x18(%rbp), %xmm0
movq -0x38(%rbp), %rax
movl -0xd4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x40(%rbp), %rdi
movslq -0xd4(%rbp), %rsi
shlq $0x3, %rsi
movl -0xd4(%rbp), %edx
callq 0x52d10
movq %rax, -0x40(%rbp)
movsd -0x20(%rbp), %xmm0
movq -0x40(%rbp), %rax
movl -0xd4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
callq 0x41560
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x98(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
callq 0x415c0
leaq -0xba(%rbp), %rsi
movsd -0x98(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm2
movsd -0xa0(%rbp), %xmm3
movsd -0xb8(%rbp), %xmm4
movsd -0xb0(%rbp), %xmm5
movl $0x1, %edi
callq 0x3f100
jmp 0x7d771
movq -0xd0(%rbp), %rdi
callq 0x4250
movl -0xd4(%rbp), %edi
movl $0x2, %esi
callq 0x57fc0
movq %rax, -0xe8(%rbp)
movq %rdx, -0xe0(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x1, %edi
movl $0x2, %esi
callq 0x57fc0
movq %rax, -0xf8(%rbp)
movq %rdx, -0xf0(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xd4(%rbp), %eax
jge 0x7d96b
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x50(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x8(%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x7d91a
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x5bc50
movq %rax, -0x108(%rbp)
movq %rdx, -0x100(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x100(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x59ea0
movq -0x70(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rdi
callq 0x52e80
movl $0x1, %edi
movl $0x2, %esi
callq 0x57fc0
movq %rax, -0x118(%rbp)
movq %rdx, -0x110(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0x80(%rbp)
movsd 0x645fb(%rip), %xmm0    # 0xe2008
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xd4(%rbp), %eax
jge 0x7db09
movq -0x38(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x80(%rbp), %rax
movq (%rax), %rax
movsd %xmm0, (%rax)
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x80(%rbp), %rax
movq (%rax), %rax
movsd %xmm0, 0x8(%rax)
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %r8
movq -0x60(%rbp), %r9
callq 0x5c2f0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0x64fbd(%rip), %xmm1    # 0xe2a48
ucomisd %xmm1, %xmm0
jne 0x7dad4
jp 0x7dad4
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x59ea0
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x59ea0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x59ea0
jmp 0x7db71
movsd -0x28(%rbp), %xmm0
callq 0x42a0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x7daf9
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x7dafb
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x7da19
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x59ea0
movq -0x38(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rdi
callq 0x52e80
movl -0xc(%rbp), %r8d
movl -0xd8(%rbp), %r9d
movsd -0x30(%rbp), %xmm0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %rcx
callq 0x7ced0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x59ea0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x59ea0
movb $0x0, %al
callq 0x42280
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw (%rax,%rax)