// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/plot.c
// Function: error_histogram_plot
void error_histogram_plot(char** names, int filecount)
{
 /*!Last Changed 27.12.2007*/
 int i, j, index, counts[10], count;
 Point p1, p2, p3;
 char* plotname, st2[11];
 char* pos;
 double obs, min = +INT_MAX, max = -INT_MAX;
 FILE* myfile;
 if (!get_parameter_o("hold"))
   clear_image();
 for (i = 0; i < filecount; i++)
  {
   myfile = fopen(names[i], "r");
   if (!myfile)
    {
     printf(m1274, names[i]);
     return;
    }
   while (fscanf(myfile, "%lf\n", &obs) != EOF)
    {
     if (obs > max)
       max = obs;
     if (obs < min)
       min = obs;
    }
   fclose(myfile);
  } 
 for (i = 0; i < filecount; i++)
  {
   p1.x = min;
   p1.y = max;
   p2.x = img.yaxis.namesavailable;
   p2.y = i;
   myfile = fopen(names[i], "r");
   for (j = 0; j < 10; j++)
     counts[j] = 0;
   if (!myfile)
    {
     printf(m1274, names[i]);
     return;
    }
   count = 0;
   while (fscanf(myfile, "%lf\n", &obs) != EOF)
    {
     if (max != min)
      {
       index = (int) (10 * (obs - min) / (max - min));
       if (index == 10)
         index--;
      }
     else
       index = 5;
     counts[index]++;
     count++;
    }
   fclose(myfile);
   for (j = 0; j < 10; j++)
     st2[j] = '0' + (30 * counts[j]) / count;
   st2[10] = '\0';
   add_object(OBJECT_ERRORHISTOGRAM, p1, p2, p3, st2);
   if (img.yaxis.namesavailable == 0)
    {
     plotname = file_only_name(names[i]);     
     pos = strchr(plotname, '-');
     img.xaxis.names = alloc(img.xaxis.names, (i + 1) * sizeof(char *), (i + 1)); 
     if (pos)
       img.xaxis.names[i] = strcopy(img.xaxis.names[i], (pos + 1));
     else
       img.xaxis.names[i] = strcopy(img.xaxis.names[i], "Try Again");
     safe_free(plotname);
    }   
  }
 img.yaxis.names = alloc(img.yaxis.names, (img.yaxis.namesavailable + 1) * sizeof(char *), (img.yaxis.namesavailable + 1));
 plotname = file_only_name(names[0]);
 img.yaxis.names[img.yaxis.namesavailable] = strcopy(img.yaxis.names[img.yaxis.namesavailable], plotname);
 safe_free(plotname);
 img.xaxis.namesavailable = filecount;
 img.yaxis.namesavailable++;
 img.xaxis.limitsset = 1;
 img.xaxis.lim.division = img.xaxis.namesavailable;
 img.xaxis.lim.min = 0;
 img.xaxis.lim.max = img.xaxis.namesavailable;
 img.xaxis.lim.precision = 0;
 img.yaxis.limitsset = 1;
 img.yaxis.lim.division = img.yaxis.namesavailable;
 img.yaxis.lim.min = 0;
 img.yaxis.lim.max = 10 * img.yaxis.namesavailable;
 export_image();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd 0x63246(%rip), %xmm0    # 0xe2010
movsd %xmm0, -0xa8(%rbp)
movsd 0x6322e(%rip), %xmm0    # 0xe2008
movsd %xmm0, -0xb0(%rbp)
leaq 0x6851f(%rip), %rdi     # 0xe7308
callq 0x79440
cmpl $0x0, %eax
jne 0x7edfa
movb $0x0, %al
callq 0x41a40
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7eedc
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x69386(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
jne 0x7ee55
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x64041(%rip), %rdi     # 0xe2e8a
movb $0x0, %al
callq 0x4030
jmp 0x7f350
jmp 0x7ee57
movq -0xb8(%rbp), %rdi
leaq 0x68941(%rip), %rsi     # 0xe77a6
leaq -0xa0(%rbp), %rdx
movb $0x0, %al
callq 0x4070
cmpl $-0x1, %eax
je 0x7eec2
movsd -0xa0(%rbp), %xmm0
ucomisd -0xb0(%rbp), %xmm0
jbe 0x7ee9a
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xa0(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7eec0
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
jmp 0x7ee57
movq -0xb8(%rbp), %rdi
callq 0x4250
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x7ee01
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7f1ba
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq 0x363178(%rip), %rax    # 0x3e2088
cvtsi2sdl 0xa8(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
cvtsi2sdl -0x10(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x6926c(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0xb8(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0xa, -0x14(%rbp)
jge 0x7ef6a
movslq -0x14(%rbp), %rax
movl $0x0, -0x40(%rbp,%rax,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7ef4d
cmpq $0x0, -0xb8(%rbp)
jne 0x7ef93
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x63f03(%rip), %rdi     # 0xe2e8a
movb $0x0, %al
callq 0x4030
jmp 0x7f350
movl $0x0, -0x44(%rbp)
movq -0xb8(%rbp), %rdi
leaq 0x687fe(%rip), %rsi     # 0xe77a6
leaq -0xa0(%rbp), %rdx
movb $0x0, %al
callq 0x4070
cmpl $-0x1, %eax
je 0x7f041
movsd -0xb0(%rbp), %xmm0
ucomisd -0xa8(%rbp), %xmm0
jne 0x7efd5
jp 0x7efd5
jmp 0x7f01d
movsd -0xa0(%rbp), %xmm1
subsd -0xa8(%rbp), %xmm1
movsd 0x6595b(%rip), %xmm0    # 0xe4948
mulsd %xmm1, %xmm0
movsd -0xb0(%rbp), %xmm1
subsd -0xa8(%rbp), %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x18(%rbp)
cmpl $0xa, -0x18(%rbp)
jne 0x7f01b
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7f024
movl $0x5, -0x18(%rbp)
movslq -0x18(%rbp), %rax
movl -0x40(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x40(%rbp,%rax,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x7ef9a
movq -0xb8(%rbp), %rdi
callq 0x4250
movl $0x0, -0x14(%rbp)
cmpl $0xa, -0x14(%rbp)
jge 0x7f082
movslq -0x14(%rbp), %rax
imull $0x1e, -0x40(%rbp,%rax,4), %eax
cltd
idivl -0x44(%rbp)
addl $0x30, %eax
movb %al, %cl
movslq -0x14(%rbp), %rax
movb %cl, -0x8b(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7f054
movb $0x0, -0x81(%rbp)
leaq -0x8b(%rbp), %rsi
movsd -0x58(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
movsd -0x68(%rbp), %xmm2
movsd -0x60(%rbp), %xmm3
movsd -0x78(%rbp), %xmm4
movsd -0x70(%rbp), %xmm5
movl $0x5, %edi
callq 0x3f100
leaq 0x362fc9(%rip), %rax    # 0x3e2088
cmpl $0x0, 0xa8(%rax)
jne 0x7f1aa
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x510a0
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movl $0x2d, %esi
callq 0x41d0
movq %rax, -0x98(%rbp)
leaq 0x362f8b(%rip), %rax    # 0x3e2088
movq 0x30(%rax), %rdi
movl -0x10(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x3, %rsi
movl -0x10(%rbp), %edx
addl $0x1, %edx
callq 0x52d10
movq %rax, %rcx
leaq 0x362f65(%rip), %rax    # 0x3e2088
movq %rcx, 0x30(%rax)
cmpq $0x0, -0x98(%rbp)
je 0x7f16c
leaq 0x362f50(%rip), %rax    # 0x3e2088
movq 0x30(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x98(%rbp), %rsi
addq $0x1, %rsi
callq 0x54ba0
movq %rax, %rdx
leaq 0x362f2a(%rip), %rax    # 0x3e2088
movq 0x30(%rax), %rax
movslq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x7f1a1
leaq 0x362f15(%rip), %rax    # 0x3e2088
movq 0x30(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x685cd(%rip), %rsi     # 0xe7753
callq 0x54ba0
movq %rax, %rdx
leaq 0x362ef3(%rip), %rax    # 0x3e2088
movq 0x30(%rax), %rax
movslq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x80(%rbp), %rdi
callq 0x52e80
jmp 0x7f1ac
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x7eee3
leaq 0x362ec7(%rip), %rax    # 0x3e2088
movq 0xa0(%rax), %rdi
leaq 0x362eb9(%rip), %rax    # 0x3e2088
movl 0xa8(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x3, %rsi
leaq 0x362ea2(%rip), %rax    # 0x3e2088
movl 0xa8(%rax), %edx
addl $0x1, %edx
callq 0x52d10
movq %rax, %rcx
leaq 0x362e8a(%rip), %rax    # 0x3e2088
movq %rcx, 0xa0(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x510a0
movq %rax, -0x80(%rbp)
leaq 0x362e6c(%rip), %rax    # 0x3e2088
movq 0xa0(%rax), %rax
leaq 0x362e5e(%rip), %rcx    # 0x3e2088
movslq 0xa8(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x80(%rbp), %rsi
callq 0x54ba0
movq %rax, %rdx
leaq 0x362e40(%rip), %rax    # 0x3e2088
movq 0xa0(%rax), %rax
leaq 0x362e32(%rip), %rcx    # 0x3e2088
movslq 0xa8(%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x80(%rbp), %rdi
callq 0x52e80
movl -0xc(%rbp), %ecx
leaq 0x362e14(%rip), %rax    # 0x3e2088
movl %ecx, 0x38(%rax)
leaq 0x362e0a(%rip), %rax    # 0x3e2088
movl 0xa8(%rax), %ecx
addl $0x1, %ecx
leaq 0x362dfa(%rip), %rax    # 0x3e2088
movl %ecx, 0xa8(%rax)
leaq 0x362ded(%rip), %rax    # 0x3e2088
movl $0x1, 0x28(%rax)
leaq 0x362ddf(%rip), %rax    # 0x3e2088
movl 0x38(%rax), %ecx
leaq 0x362dd5(%rip), %rax    # 0x3e2088
movl %ecx, 0x20(%rax)
leaq 0x362dcb(%rip), %rax    # 0x3e2088
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
leaq 0x362dbc(%rip), %rax    # 0x3e2088
cvtsi2sdl 0x38(%rax), %xmm0
leaq 0x362db0(%rip), %rax    # 0x3e2088
movsd %xmm0, 0x18(%rax)
leaq 0x362da4(%rip), %rax    # 0x3e2088
movl $0x0, 0x24(%rax)
leaq 0x362d96(%rip), %rax    # 0x3e2088
movl $0x1, 0x98(%rax)
leaq 0x362d85(%rip), %rax    # 0x3e2088
movl 0xa8(%rax), %ecx
leaq 0x362d78(%rip), %rax    # 0x3e2088
movl %ecx, 0x90(%rax)
leaq 0x362d6b(%rip), %rax    # 0x3e2088
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rax)
leaq 0x362d59(%rip), %rax    # 0x3e2088
imull $0xa, 0xa8(%rax), %eax
cvtsi2sd %eax, %xmm0
leaq 0x362d47(%rip), %rax    # 0x3e2088
movsd %xmm0, 0x88(%rax)
movb $0x0, %al
callq 0x42280
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)