// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0x95b63
movslq (%rbx), %rdi
cmpl 0x4(%rbx), %edi
jne 0x25a50
movq %rax, %r14
shlq $0x3, %rdi
leaq 0x7f783(%rip), %rsi     # 0xa4ed9
movl $0x7, %edx
callq 0x390f5
movq %rax, %rbx
movslq 0x28(%rsp), %rax
testq %rax, %rax
jle 0x257ab
movq (%r14), %rcx
movq 0x8(%r14), %rdx
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorpd %xmm1, %xmm1
movsd (%rcx,%rsi,8), %xmm3
subsd (%rdx,%rsi,8), %xmm3
movsd %xmm3, (%rbx,%rsi,8)
movapd %xmm3, %xmm2
maxsd %xmm1, %xmm2
minsd %xmm0, %xmm3
incq %rsi
movapd %xmm3, %xmm0
movapd %xmm2, %xmm1
cmpq %rsi, %rax
jne 0x2577e
jmp 0x257b3
xorpd %xmm2, %xmm2
xorpd %xmm3, %xmm3
movsd %xmm3, 0x20(%rsp)
movsd %xmm2, 0x10(%rsp)
movq %r14, %rdi
movl $0x2, %esi
callq 0x3915f
leaq 0x7f6e0(%rip), %rdi     # 0xa4eb3
leaq 0x830c7(%rip), %rsi     # 0xa88a1
callq 0x40f0
testq %rax, %rax
je 0x25a50
movq %rax, %r14
movq %rax, %rdi
movl $0x294, %esi            # imm = 0x294
movl $0x294, %edx            # imm = 0x294
callq 0x22236
movsd 0x10(%rsp), %xmm1
movsd 0x20(%rsp), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
mulsd 0x7f559(%rip), %xmm0    # 0xa4d78
addsd 0x7f559(%rip), %xmm0    # 0xa4d80
cvttsd2si %xmm0, %ebp
movl $0x1f4, %eax            # imm = 0x1F4
xorl %edx, %edx
idivl 0x28(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x7f453(%rip), %xmm0    # 0xa4c98
mulsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
mulsd 0x7f531(%rip), %xmm1    # 0xa4d88
movsd %xmm1, 0x30(%rsp)
leaq 0x7f79e(%rip), %r15     # 0xa5002
movl $0x50, %r12d
movq %r14, %rdi
movq %r15, %rsi
movl $0x50, %edx
movl $0x50, %ecx
movl $0x50, %r8d
movl $0x244, %r9d            # imm = 0x244
xorl %eax, %eax
callq 0x42e0
movq %r14, %rdi
movq %r15, %rsi
movl $0x50, %edx
movl %ebp, %ecx
movl $0x244, %r8d            # imm = 0x244
movl %ebp, 0x1c(%rsp)
movl %ebp, %r9d
xorl %eax, %eax
callq 0x42e0
movsd 0x10(%rsp), %xmm0
divsd 0x7f474(%rip), %xmm0    # 0xa4d30
movsd %xmm0, 0x40(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x7f5b1(%rip), %r13     # 0xa4e84
leaq 0x4e(%rsp), %rbp
movq %r14, %rdi
movq %r15, %rsi
movl $0x50, %edx
movl %r12d, %ecx
movl $0x56, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x42e0
movsd 0x40(%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
movq %rbp, %rdi
movq %r13, %rsi
movb $0x1, %al
callq 0x41b0
movq %r14, %rdi
movl $0x3c, %esi
movl %r12d, %edx
movq %rbp, %rcx
movl $0x2, %r8d
callq 0x22d13
movsd 0x8(%rsp), %xmm0
addsd 0x7cbe4(%rip), %xmm0    # 0xa2520
movsd %xmm0, 0x8(%rsp)
addl $0x32, %r12d
cmpl $0x276, %r12d           # imm = 0x276
jne 0x258d8
cmpl $0x0, 0x28(%rsp)
movq %rbx, 0x8(%rsp)
movsd 0x10(%rsp), %xmm1
movl 0x1c(%rsp), %eax
jle 0x25a0c
cvttsd2si 0x30(%rsp), %r15d
cvttsd2si 0x38(%rsp), %r13d
leal (%r15,%r13), %ebp
addl $0x50, %r15d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %r12d, %r12d
leaq 0xac22a(%rip), %rbx     # 0xd1bc0
leal (%r15,%r13), %r8d
movq 0x8(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
incq %r12
xorl %eax, %eax
ucomisd 0x7d356(%rip), %xmm0    # 0xa2d08
divsd %xmm1, %xmm0
mulsd 0x7f3d2(%rip), %xmm0    # 0xa4d90
addsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %r9d
setbe %al
leaq (%rax,%rax,2), %rax
movsd (%rbx,%rax,8), %xmm0
movsd 0x8(%rbx,%rax,8), %xmm1
movsd 0x10(%rbx,%rax,8), %xmm2
movq %r14, %rdi
leaq 0x7f701(%rip), %rsi     # 0xa50ec
movl %r15d, %edx
movl 0x1c(%rsp), %ecx
movb $0x3, %al
callq 0x42e0
movsd 0x10(%rsp), %xmm1
movslq 0x28(%rsp), %rax
addl %ebp, %r15d
cmpq %rax, %r12
jl 0x25996
leaq 0x7f44b(%rip), %rdi     # 0xa4e5e
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
leaq 0x7f592(%rip), %rdi     # 0xa4fbe
movl $0x9, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movq %r14, %rdi
callq 0x42a0
movq 0x8(%rsp), %rdi
callq 0x39194
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq