// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/eps.c
// Function: difference_plot
void difference_plot(char** files, int filecount)
{
 int i, base, barwidth, bargap;
 int counts[2];
 char st[10];
 double** observations, *difference, max = 0, min = 0;
 FILE* outfile;
 observations = read_observations_for_two_file(files, counts);
 if (counts[0] != counts[1])
   return;
 difference = safemalloc(counts[0] * sizeof(double), "difference_plot", 7);
 for (i = 0; i < counts[0]; i++)
  {
   difference[i] = observations[0][i] - observations[1][i];
   if (difference[i] > max)
     max = difference[i];
   if (difference[i] < min)
     min = difference[i];
  }
 free_2d((void**) observations, 2);
 outfile = fopen("image.eps", "w");
 if (!outfile)
   return; 
 write_image_header(outfile, 2 * MARGIN + epsaxis, 2 * MARGIN + epsaxis);
 base = MARGIN + epsaxis * (-min / (max - min));
 barwidth = 0.8 * (epsaxis / counts[0]);
 bargap = 0.2 * (epsaxis / counts[0]);
 write_line(outfile, MARGIN, MARGIN, MARGIN, epsaxis + MARGIN);
 write_line(outfile, MARGIN, base, epsaxis + MARGIN, base);
 for (i = 0; i <= 10; i++)
  {
   write_line(outfile, MARGIN, MARGIN + i * epsaxis / 10, MARGIN + TICKWIDTH, MARGIN + i * epsaxis / 10);
   sprintf(st, "%.2f", min + ((max - min) / 10) * i);
   write_string(outfile, MARGIN - 20, MARGIN + i * epsaxis / 10, st, ALIGN_CENTER); 
  }
 for (i = 0; i < counts[0]; i++)
   write_rectangle(outfile, MARGIN + bargap + (barwidth + bargap) * i, base, MARGIN + (barwidth + bargap) * (i + 1), base + epsaxis * (difference[i] / (max - min)), FILL_COLOR, difference[i] > 0 ? BLACK : RED);
 write_image_footer(outfile);
 fclose(outfile);
 safe_free(difference);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0xd2020
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x35ced
jmp 0x36039
movslq -0x24(%rbp), %rdi
shlq $0x3, %rdi
leaq 0xaed7d(%rip), %rsi     # 0xe4a79
movl $0x7, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x35dab
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0x35d71
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd -0x50(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x35d9b
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x35d9d
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x35d11
movq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0x52e20
leaq 0xaec93(%rip), %rdi     # 0xe4a53
leaq 0xb23f7(%rip), %rsi     # 0xe81be
callq 0x40c0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x35ddc
jmp 0x36039
movq -0x58(%rbp), %rdi
movl $0x294, %edx            # imm = 0x294
movl %edx, %esi
callq 0x31a50
movsd -0x50(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd -0x48(%rbp), %xmm1
subsd -0x50(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0xaeb62(%rip), %xmm1    # 0xe4980
mulsd %xmm1, %xmm0
movsd 0xaeb5e(%rip), %xmm1    # 0xe4988
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
movl $0x1f4, %eax            # imm = 0x1F4
cltd
idivl -0x24(%rbp)
cvtsi2sd %eax, %xmm1
movsd 0xaea46(%rip), %xmm0    # 0xe4890
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x18(%rbp)
movl $0x1f4, %eax            # imm = 0x1F4
cltd
idivl -0x24(%rbp)
cvtsi2sd %eax, %xmm1
movsd 0xae9b6(%rip), %xmm0    # 0xe4820
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
movq -0x58(%rbp), %rdi
movl $0x50, %ecx
movl $0x244, %r8d            # imm = 0x244
movl %ecx, %esi
movl %ecx, %edx
callq 0x32a70
movq -0x58(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x14(%rbp), %r8d
movl $0x50, %esi
movl $0x244, %ecx            # imm = 0x244
callq 0x32a70
movl $0x0, -0x10(%rbp)
cmpl $0xa, -0x10(%rbp)
jg 0x35f6d
movq -0x58(%rbp), %rdi
imull $0x1f4, -0x10(%rbp), %eax # imm = 0x1F4
movl $0xa, %ecx
cltd
idivl %ecx
addl $0x50, %eax
movl %eax, -0x5c(%rbp)
imull $0x1f4, -0x10(%rbp), %eax # imm = 0x1F4
movl $0xa, %ecx
cltd
idivl %ecx
movl -0x5c(%rbp), %edx
movl %eax, %r8d
addl $0x50, %r8d
movl $0x50, %esi
movl $0x56, %ecx
callq 0x32a70
leaq -0x2e(%rbp), %rdi
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
movsd 0xaea34(%rip), %xmm2    # 0xe4948
divsd %xmm2, %xmm0
cvtsi2sdl -0x10(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
leaq 0xaeaf8(%rip), %rsi     # 0xe4a24
movb $0x1, %al
callq 0x4170
movq -0x58(%rbp), %rdi
imull $0x1f4, -0x10(%rbp), %eax # imm = 0x1F4
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, %edx
addl $0x50, %edx
leaq -0x2e(%rbp), %rcx
movl $0x3c, %esi
movl $0x2, %r8d
callq 0x32c00
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x35eae
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3601e
movq -0x58(%rbp), %rdi
movl -0x1c(%rbp), %esi
addl $0x50, %esi
movl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
imull -0x10(%rbp), %eax
addl %eax, %esi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
addl -0x1c(%rbp), %ecx
movl -0x10(%rbp), %eax
addl $0x1, %eax
imull %eax, %ecx
addl $0x50, %ecx
cvtsi2sdl -0x14(%rbp), %xmm1
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %r8
movsd (%rax,%r8,8), %xmm0
movsd -0x48(%rbp), %xmm2
subsd -0x50(%rbp), %xmm2
divsd %xmm2, %xmm0
movsd 0xae9ac(%rip), %xmm2    # 0xe4980
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r8d
movq -0x40(%rbp), %rax
movslq -0x10(%rbp), %r9
movsd (%rax,%r9,8), %xmm0
xorps %xmm1, %xmm1
movl $0x1, %eax
xorl %r9d, %r9d
ucomisd %xmm1, %xmm0
cmoval %r9d, %eax
movl $0x4, %r9d
movl %eax, (%rsp)
callq 0x32d30
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x35f74
movq -0x58(%rbp), %rdi
callq 0x32ec0
movq -0x58(%rbp), %rdi
callq 0x4250
movq -0x40(%rbp), %rdi
callq 0x52e80
addq $0x70, %rsp
popq %rbp
retq
nop