// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/plot.c
// Function: plotgauss
void plotgauss(char* names)
{
 /*!Last Changed 20.09.2006*/
 /*!Last Changed 07.10.2004 added img.xaxis.lim and img.yaxis.lim*/
 /*!Last Changed 02.02.2004 added safemalloc*/
 double obs, sum, divisionx, startx;
 double means;
 double variances;
 double* observations = NULL;
 Point p1, p2;
 char st2[3], *legendname;
 FILE* myfile;
 int datacount, j, color;
 Objectptr obj;
 if (!get_parameter_o("hold"))
   clear_image();
 legendname = file_only_name(names);
 color = img.imagelegend.legendcount;
 add_legend((char)('A' + color), legendname);
 safe_free(legendname);
 datacount = 0;
 sum = 0;
 myfile = fopen(names, "r");
 if (!myfile)
   return;
 while (fscanf(myfile,"%lf\n",&obs)!=EOF)
  {
   datacount++;
   observations = alloc(observations,datacount*sizeof(double),datacount);
   observations[datacount-1]=obs;
   sum += obs;
  }
 if (datacount != 0)
   means = sum / datacount;
 else
   means = 0;
 sum = 0;
 for (j = 0;j < datacount;j++)
   sum += (observations[j] - means) * (observations[j] - means);
 if (datacount > 1)
   variances = sqrt(sum / (datacount - 1));
 else
   variances = 0;
 safe_free(observations);
 fclose(myfile);
 img.yaxis.available = 0;
 img.height = (img.imagelegend.legendcount + 1) * 20 + MARGIN + 20;
 if (img.yaxis.lim.min > img.yaxis.lim.max)
  {
   img.yaxis.lim.min = 0;
   img.yaxis.lim.max = 1;
  }
 divisionx = variances * 6 / PARTITIONS;
 startx = means - 3 * variances;
 p1.x = startx;
 p1.y = gaussian(p1.x, means, variances);
 sprintf(st2, "%c", 'A' + color);
 for (j = 1; j < PARTITIONS; j++)
  {
   p2.x = startx + divisionx * j;
   p2.y = gaussian(p1.x, means, variances);
   obj = add_object(OBJECT_LINE, p1, p2, dummyp, st2);
   obj->fnt.fontcolor = color;
   p1.x = p2.x;
   p1.y = p2.y;
  }
 export_image();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0x526d1(%rip), %rdi     # 0xaa7b5
callq 0x54bec
testl %eax, %eax
jne 0x580f4
xorl %eax, %eax
callq 0x2e342
movq %rbx, %rdi
callq 0x38b30
movq %rax, %r14
leaq 0x359fb2(%rip), %r12    # 0x3b20b8
movl 0xec(%r12), %r15d
leal 0x41(%r15), %ebp
movsbl %bpl, %edi
movq %rax, %rsi
callq 0x2cbc4
movq %r14, %rdi
callq 0x3a180
leaq 0x5382e(%rip), %rsi     # 0xab95b
movq %rbx, %rdi
callq 0x40f0
testq %rax, %rax
je 0x583d5
movq %rax, %rbx
leaq 0x52bf4(%rip), %rsi     # 0xaad3c
xorl %r14d, %r14d
leaq 0x28(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x4070
cmpl $-0x1, %eax
je 0x5824d
movl %ebp, 0x18(%rsp)
movq %r15, 0x10(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movl $0x1, %ebp
movl $0x8, %r15d
leaq 0x28(%rsp), %r13
movq %rbx, %r12
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x3a0b4
movq %rax, %r14
movsd 0x28(%rsp), %xmm0
movsd %xmm0, -0x8(%rax,%r15)
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movq %r12, %rdi
leaq 0x52b7a(%rip), %rsi     # 0xaad3c
movq %r13, %rdx
xorl %eax, %eax
callq 0x4070
incl %ebp
decq %rbx
addq $0x8, %r15
cmpl $-0x1, %eax
jne 0x5818d
movq %r12, %r13
movq %rbx, %rax
negq %rax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd (%rsp), %xmm2
divsd %xmm0, %xmm2
movl %eax, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movsd (%r14,%rcx,8), %xmm1
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rcx
cmpq %rcx, %rax
jne 0x581fb
cmpq $-0x1, %rbx
movq 0x10(%rsp), %r15
movl 0x18(%rsp), %ebp
leaq 0x359e8f(%rip), %r12    # 0x3b20b8
movsd %xmm2, (%rsp)
je 0x5825e
notl %ebx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x58264
sqrtsd %xmm0, %xmm0
jmp 0x58269
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movsd %xmm0, 0x8(%rsp)
jmp 0x58272
xorpd %xmm0, %xmm0
jmp 0x58269
callq 0x4300
movsd %xmm0, 0x8(%rsp)
movq %r13, %rbx
movq %r14, %rdi
callq 0x3a180
movq %rbx, %rdi
callq 0x42a0
movl $0x0, 0x78(%r12)
movl 0xec(%r12), %eax
leal (%rax,%rax,4), %eax
leal 0x78(,%rax,4), %eax
movl %eax, (%r12)
movsd 0x80(%r12), %xmm0
ucomisd 0x88(%r12), %xmm0
jbe 0x582cd
xorpd %xmm0, %xmm0
movhpd 0x4d25d(%rip), %xmm0    # xmm0 = xmm0[0],mem[0]
movupd %xmm0, 0x80(%r12)
movsd 0x4fa4b(%rip), %xmm0    # 0xa7d20
movsd 0x8(%rsp), %xmm2
mulsd %xmm2, %xmm0
divsd 0x4fb31(%rip), %xmm0    # 0xa7e18
movsd %xmm0, 0x38(%rsp)
movsd 0x5296b(%rip), %xmm0    # 0xaac60
mulsd %xmm2, %xmm0
movsd (%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd %xmm1, (%rsp)
movsd %xmm2, 0x8(%rsp)
callq 0x8dd8e
movapd %xmm0, %xmm1
leaq 0x35(%rsp), %rbx
movb %bpl, (%rbx)
movb $0x0, 0x1(%rbx)
movsd 0x4d1f0(%rip), %xmm3    # 0xa5520
movl $0x1f3, %ebp            # imm = 0x1F3
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x48(%rsp)
movsd %xmm3, 0x18(%rsp)
movsd 0x38(%rsp), %xmm2
mulsd %xmm3, %xmm2
addsd 0x20(%rsp), %xmm2
movsd %xmm2, 0x10(%rsp)
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
callq 0x8dd8e
movaps %xmm0, %xmm3
movsd %xmm0, 0x50(%rsp)
movsd 0x7ccec(%rip), %xmm4    # 0xd5070
movsd 0x7ccec(%rip), %xmm5    # 0xd5078
xorl %edi, %edi
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movq %rbx, %rsi
callq 0x2cc6c
movsd 0x18(%rsp), %xmm3
movl %r15d, 0x18(%rax)
addsd 0x4d166(%rip), %xmm3    # 0xa5520
movsd 0x50(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
decl %ebp
jne 0x5833b
xorl %eax, %eax
callq 0x2e6d0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq