// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/plot.c
// Function: functionplot
void functionplot(char* functiondefinition, int color)
{
 /*!Last Changed 20.09.2006*/
 /*!Last Changed 21.01.2005*/
 int i, functioncount;
 double minvaluey = +LONG_MAX, maxvaluey = -LONG_MAX, valuey, valuex, start, end;
 char st2[3], *legendname; 
 Point p1, p2;
 Functionptr fx = read_function_definition(functiondefinition, &functioncount);
 Objectptr obj;
 if (!get_parameter_o("hold"))
   clear_image();
 legendname = file_only_name(functiondefinition);
 add_legend((char)('A' + color), legendname);
 safe_free(legendname);
 img.yaxis.available = 1;
 find_function_bounds(fx, functioncount, &start, &end);
 for (i = 0; i <= PARTITIONS; i++)
  {
   valuex = start + i * ((end - start) / PARTITIONS);
   valuey = function_value(fx, functioncount, valuex);
   if (img.yaxis.lim.min >= img.yaxis.lim.max)
    {
     if (valuey < minvaluey)
       minvaluey = valuey;
     if (valuey > maxvaluey)
       maxvaluey = valuey;
    }
  }
 if (img.yaxis.lim.min >= img.yaxis.lim.max)
  {
   img.yaxis.lim.min = minvaluey;
   img.yaxis.lim.max = maxvaluey;
  }
 if (img.xaxis.lim.min >= img.xaxis.lim.max)
  {
   img.xaxis.lim.min = start;
   img.xaxis.lim.max = end;
  }
 p1.x = (double) start;
 p1.y = (double) (function_value(fx, functioncount, p1.x));
 sprintf(st2, "%c", 'A' + color);
 for (i = 1; i <= PARTITIONS; i++)
  {
   p2.x = (double) (start + i * ((end - start) / PARTITIONS));
   p2.y = (double) (function_value(fx, functioncount, p1.x));
   obj = add_object(OBJECT_LINE, p1, p2, dummyp, st2);
   obj->fnt.fontcolor = color;
   p1.x = p2.x;
   p1.y = p2.y;
  }
 for (i = 0;i < functioncount; i++)
   free_function(fx[i]);
 safe_free(fx);
 export_image();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movl %esi, %r14d
movq %rdi, %r15
leaq 0x2c(%rsp), %rsi
callq 0x594cb
movq %rax, %rbx
leaq 0x50868(%rip), %rdi     # 0xa7715
callq 0x536e7
testl %eax, %eax
jne 0x56ebd
xorl %eax, %eax
callq 0x2da74
movq %r15, %rdi
callq 0x37f08
movq %rax, %r15
leal 0x41(%r14), %ebp
movsbl %bpl, %edi
movq %rax, %rsi
callq 0x2c324
movq %r15, %rdi
callq 0x39194
leaq 0x3581d1(%rip), %r15    # 0x3af0b8
movl $0x1, 0x78(%r15)
movl 0x2c(%rsp), %esi
leaq 0x48(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %rbx, %rdi
callq 0x59125
movsd 0x4bebb(%rip), %xmm0    # 0xa2dc8
movsd %xmm0, 0x40(%rsp)
movsd 0x4c415(%rip), %xmm0    # 0xa3330
movsd %xmm0, 0x30(%rsp)
xorpd %xmm3, %xmm3
movl $0x1f5, %r12d           # imm = 0x1F5
movsd 0x4de5d(%rip), %xmm2    # 0xa4d90
movsd 0x48(%rsp), %xmm1
movsd 0x50(%rsp), %xmm0
subsd %xmm1, %xmm0
divsd %xmm2, %xmm0
movsd %xmm3, 0x38(%rsp)
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
movl 0x2c(%rsp), %esi
movq %rbx, %rdi
callq 0x59299
movsd 0x80(%r15), %xmm1
ucomisd 0x88(%r15), %xmm1
jb 0x56f93
movapd %xmm0, %xmm1
minsd 0x30(%rsp), %xmm1
ucomisd 0x40(%rsp), %xmm0
jbe 0x56f8d
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd 0x4ddf5(%rip), %xmm2    # 0xa4d90
movsd 0x38(%rsp), %xmm3
movsd 0x4b577(%rip), %xmm0    # 0xa2520
addsd %xmm0, %xmm3
decl %r12d
jne 0x56f33
movsd 0x80(%r15), %xmm0
ucomisd 0x88(%r15), %xmm0
jb 0x56fe4
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x80(%r15)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x88(%r15)
movsd 0x10(%r15), %xmm0
ucomisd 0x18(%r15), %xmm0
jb 0x5700a
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x10(%r15)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x18(%r15)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movl 0x2c(%rsp), %esi
movq %rbx, %rdi
callq 0x59299
movsd 0x30(%rsp), %xmm2
movaps %xmm0, %xmm3
leaq 0x5d(%rsp), %r15
movb %bpl, (%r15)
movb $0x0, 0x1(%r15)
movl $0x1f4, %ebp            # imm = 0x1F4
movsd 0x4b4db(%rip), %xmm1    # 0xa2520
movsd %xmm2, 0x30(%rsp)
movsd %xmm3, 0x60(%rsp)
movsd %xmm1, 0x40(%rsp)
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm4
subsd %xmm0, %xmm4
divsd 0x4dd21(%rip), %xmm4    # 0xa4d90
mulsd %xmm1, %xmm4
addsd %xmm0, %xmm4
movsd %xmm4, 0x38(%rsp)
movl 0x2c(%rsp), %esi
movq %rbx, %rdi
movaps %xmm2, %xmm0
callq 0x59299
movaps %xmm0, %xmm3
movsd %xmm0, 0x68(%rsp)
movsd 0x7afd3(%rip), %xmm4    # 0xd2070
movsd 0x7afd3(%rip), %xmm5    # 0xd2078
xorl %edi, %edi
movsd 0x30(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
movq %r15, %rsi
callq 0x2c3cc
movsd 0x40(%rsp), %xmm1
movl %r14d, 0x18(%rax)
addsd 0x4b44d(%rip), %xmm1    # 0xa2520
movsd 0x68(%rsp), %xmm3
movsd 0x38(%rsp), %xmm2
decl %ebp
jne 0x57045
cmpl $0x0, 0x2c(%rsp)
jle 0x5711e
xorl %r14d, %r14d
movq %rbx, %r15
movups (%r15), %xmm0
movupd 0x10(%r15), %xmm1
movupd %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x595d4
incq %r14
movslq 0x2c(%rsp), %rax
addq $0x20, %r15
cmpq %rax, %r14
jl 0x570f4
movq %rbx, %rdi
callq 0x39194
xorl %eax, %eax
callq 0x2de4a
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq