// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/image.c
// Function: add_object
Objectptr add_object(OBJECT_TYPE type, Point p1, Point p2, Point p3, char* st)
{
 /*!Last Changed 04.02.2008 added namedpoint type*/
 /*!Last Changed 27.12.2007 added error_histogram_plot type*/
 /*!Last Changed 20.09.2006 added dashedtype*/
 /*!Last Changed 11.07.2005 added boxplot and mean variance plot objects*/
 /*!Last Changed 23.01.2005*/
 int i, count = img.objectcount;
 img.objects = alloc(img.objects, (count + 1) * sizeof(Object), count + 1);
 img.objects[count].type = type;
 switch (type)
  {
   case OBJECT_LINE      :initialize_font(&(img.objects[count].fnt), (int) (p3.x), 0, 1.0);
                          if (between(st[0], '0', '9'))
                            img.objects[count].fnt.dashedtype = atoi(st) % MAX_LINE_TYPE;
                          img.objects[count].obje.li.upleft = p1;
                          img.objects[count].obje.li.downright = p2;
                          break;
   case OBJECT_CIRCLE    :initialize_font(&(img.objects[count].fnt), (int) (p3.x), 0, 1.0);
                          img.objects[count].obje.ci.center = p1;
                          img.objects[count].obje.ci.radius = p2.x;
                          break;
   case OBJECT_POINT     :initialize_font(&(img.objects[count].fnt), (int) (p3.x), TIMES, 14.0);
                          img.objects[count].obje.st.p = p1;
                          img.objects[count].obje.st.st = strcopy(img.objects[count].obje.st.st, st);
                          break;
   case OBJECT_STRING    :initialize_font(&(img.objects[count].fnt), (int) (p3.x), TIMES, (int) (p3.y));
                          img.objects[count].obje.st.p = p1;
                          img.objects[count].obje.st.st = strcopy(img.objects[count].obje.st.st, st);
                          break;
   case OBJECT_NAMEDPOINT:initialize_font(&(img.objects[count].fnt), 0, TIMES, 10.0);
                          img.objects[count].obje.st.p = p1;
                          img.objects[count].obje.st.st = strcopy(img.objects[count].obje.st.st, st);
                          break;
   case OBJECT_RECTANGLE :initialize_font(&(img.objects[count].fnt), 0, 0, 1.0);
                          img.objects[count].obje.re.upleft = p1;
                          img.objects[count].obje.re.downright = p2;
                          img.objects[count].groupindex = (int) p1.x;
                          img.objects[count].index = (int) p2.x;
                          break;
   case OBJECT_MVBOX     :initialize_font(&(img.objects[count].fnt), 0, 0, 1.0);
                          img.objects[count].obje.mv.mean = p1.x;
                          img.objects[count].obje.mv.variance = p1.y;
                          img.objects[count].groupindex = (int) p2.x;
                          img.objects[count].index = (int) p2.y;
                          break;
   case OBJECT_BOXPLOT   :initialize_font(&(img.objects[count].fnt), 0, 0, 1.0);
                          img.objects[count].obje.box.median = p1.x;
                          img.objects[count].obje.box.p25 = p1.y;
                          img.objects[count].obje.box.p75 = p2.x;
                          img.objects[count].obje.box.swhisker = p3.x;
                          img.objects[count].obje.box.lwhisker = p3.y;
                          img.objects[count].groupindex = atoi(st);
                          img.objects[count].index = (int) p2.y;
                          break;
   case OBJECT_ERRORHISTOGRAM:initialize_font(&(img.objects[count].fnt), 0, 0, 1.0);
                              img.objects[count].obje.errorhist.min = p1.x;
                              img.objects[count].obje.errorhist.max = p1.y;
                              for (i = 0; i < 10; i++)
                                img.objects[count].obje.errorhist.counts[i] = st[i] - '0';
                              img.objects[count].groupindex = (int) p2.x;
                              img.objects[count].index = (int) p2.y;
                              break;
   default               :printf(m1233, type);
                          break;
  } 
 img.objectcount++;
 return &(img.objects[count]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movaps %xmm5, 0x30(%rsp)
movsd %xmm4, 0x20(%rsp)
movsd %xmm3, 0x28(%rsp)
movsd %xmm2, 0x18(%rsp)
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movl %edi, %ebp
leaq 0x382caf(%rip), %r14    # 0x3af0b8
movslq 0x124(%r14), %r15
movq 0x128(%r14), %rdi
leal 0x1(%r15), %edx
movq %r15, %r13
shlq $0x5, %r13
leaq 0x60(,%r13,2), %rsi
addq %r13, %rsi
callq 0x390c8
movq %rax, 0x128(%r14)
leaq (,%r13,2), %r12
addq %r13, %r12
movl %ebp, (%rax,%r12)
cmpl $0x8, %ebp
ja 0x2c7d8
movl %ebp, %ecx
leaq 0x79396(%rip), %rdx     # 0xa57f0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq (%r15,%r15,2), %r12
shlq $0x5, %r12
cvttsd2si 0x20(%rsp), %ecx
movl %ecx, 0x18(%rax,%r12)
movl $0x0, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%r12)
movsbl (%rbx), %edi
movl $0x30, %esi
movl $0x39, %edx
callq 0x38d18
testl %eax, %eax
je 0x2c4d3
movq %rbx, %rdi
callq 0x4200
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
movq 0x128(%r14), %rcx
movl %eax, 0x1c(%rcx,%r12)
movq 0x128(%r14), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%r12)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x40(%rax,%r12)
jmp 0x2c7e8
xorl %ecx, %ecx
movl %ecx, 0x18(%rax,%r12)
movl %ecx, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%r12)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movq 0x128(%r14), %rax
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
movq 0x128(%r14), %rax
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%r12)
movq 0x128(%r14), %rax
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x40(%rax,%r12)
movq 0x128(%r14), %rax
movaps 0x30(%rsp), %xmm0
movsd %xmm0, 0x48(%rax,%r12)
movq %rbx, %rdi
callq 0x4200
jmp 0x2c63f
leaq (%r15,%r15,2), %rcx
shlq $0x5, %rcx
xorl %edx, %edx
movl %edx, 0x18(%rax,%rcx)
movl %edx, 0x8(%rax,%rcx)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, 0x10(%rax,%rcx)
movsd 0x8(%rsp), %xmm2
movsd %xmm2, 0x28(%rax,%rcx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rcx)
movsd 0x18(%rsp), %xmm1
movsd %xmm1, 0x38(%rax,%rcx)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x40(%rax,%rcx)
cvttsd2si %xmm2, %edx
movl %edx, 0x20(%rax,%rcx)
cvttsd2si %xmm1, %edx
movl %edx, 0x24(%rax,%rcx)
jmp 0x2c7e8
xorl %ecx, %ecx
movl %ecx, 0x18(%rax,%r12)
movl %ecx, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%r12)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movq 0x128(%r14), %rax
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
cvttsd2si 0x18(%rsp), %eax
movq 0x128(%r14), %rcx
movl %eax, 0x20(%rcx,%r12)
cvttsd2si 0x28(%rsp), %eax
movl %eax, 0x24(%rcx,%r12)
jmp 0x2c7e8
leaq (%r15,%r15,2), %rcx
cvttsd2si 0x20(%rsp), %edx
shlq $0x5, %rcx
movl %edx, 0x18(%rax,%rcx)
movl $0x0, 0x8(%rax,%rcx)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, 0x10(%rax,%rcx)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rcx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rcx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%rcx)
jmp 0x2c7e8
cvttsd2si 0x20(%rsp), %ecx
cvttpd2dq 0x30(%rsp), %xmm0
cvtdq2pd %xmm0, %xmm0
movl %ecx, 0x18(%rax,%r12)
movl $0x2, 0x8(%rax,%r12)
movlps %xmm0, 0x10(%rax,%r12)
jmp 0x2c7a3
xorl %ecx, %ecx
movl %ecx, 0x18(%rax,%r12)
movl %ecx, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, 0x10(%rax,%r12)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movq 0x128(%r14), %rax
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
leaq 0x38(,%r13,2), %rax
addq %r13, %rax
movsbl (%rbx,%rcx), %edx
addl $-0x30, %edx
movq 0x128(%r14), %rsi
addq %rax, %rsi
movl %edx, (%rsi,%rcx,4)
incq %rcx
cmpq $0xa, %rcx
jne 0x2c71d
cvttsd2si 0x18(%rsp), %eax
movq 0x128(%r14), %rcx
leaq (%r15,%r15,2), %rdx
shlq $0x5, %rdx
movl %eax, 0x20(%rcx,%rdx)
cvttsd2si 0x28(%rsp), %eax
movl %eax, 0x24(%rcx,%rdx)
jmp 0x2c7e8
movl $0x0, 0x18(%rax,%r12)
movl $0x2, 0x8(%rax,%r12)
movabsq $0x4024000000000000, %rcx # imm = 0x4024000000000000
jmp 0x2c79e
cvttsd2si 0x20(%rsp), %ecx
movl %ecx, 0x18(%rax,%r12)
movl $0x2, 0x8(%rax,%r12)
movabsq $0x402c000000000000, %rcx # imm = 0x402C000000000000
movq %rcx, 0x10(%rax,%r12)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
movq 0x38(%rax,%r12), %rdi
movq %rbx, %rsi
callq 0x3a404
movq 0x128(%r14), %rcx
movq %rax, 0x38(%rcx,%r12)
jmp 0x2c7e8
leaq 0x786af(%rip), %rdi     # 0xa4e8e
movl %ebp, %esi
xorl %eax, %eax
callq 0x4030
incl 0x124(%r14)
leaq (%r15,%r15,2), %rax
shlq $0x5, %rax
addq 0x128(%r14), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq