// File: /workspace/github_c_makefile_star2_O3/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 $0x58, %rsp
movq %rsi, %rbx
movaps %xmm5, 0x40(%rsp)
movsd %xmm4, 0x8(%rsp)
movaps %xmm3, 0x30(%rsp)
movapd %xmm2, 0x20(%rsp)
movsd %xmm1, (%rsp)
movapd %xmm0, 0x10(%rsp)
movl %edi, %ebp
leaq 0x385411(%rip), %r14    # 0x3b20b8
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 0x3a0b4
movq %rax, 0x128(%r14)
leaq (,%r13,2), %r12
addq %r13, %r12
movl %ebp, (%rax,%r12)
cmpl $0x8, %ebp
ja 0x2d073
movl %ebp, %ecx
leaq 0x7bb50(%rip), %rdx     # 0xa8848
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq (%r15,%r15,2), %r12
shlq $0x5, %r12
cvttsd2si 0x8(%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 0x39a78
movq 0x128(%r14), %r13
testl %eax, %eax
je 0x2cd71
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
movl %eax, 0x1c(%r13,%r12)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%r13,%r12)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%r13,%r12)
movaps 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%r13,%r12)
movapd 0x30(%rsp), %xmm0
movsd %xmm0, 0x40(%r13,%r12)
jmp 0x2d083
xorl %ecx, %ecx
movl %ecx, 0x18(%rax,%r12)
movl %ecx, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%r12)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movq 0x128(%r14), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
movq 0x128(%r14), %rax
movaps 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%r12)
movq 0x128(%r14), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x40(%rax,%r12)
movq 0x128(%r14), %rax
movapd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rax,%r12)
movq %rbx, %rdi
callq 0x4200
movq 0x128(%r14), %rcx
movl %eax, 0x20(%rcx,%r12)
cvttsd2si 0x30(%rsp), %eax
movl %eax, 0x24(%rcx,%r12)
jmp 0x2d083
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)
movapd 0x10(%rsp), %xmm2
movsd %xmm2, 0x28(%rax,%rcx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rcx)
movapd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%rcx)
movaps 0x30(%rsp), %xmm1
movsd %xmm1, 0x40(%rax,%rcx)
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
cvttpd2dq %xmm2, %xmm0
jmp 0x2cff4
xorl %ecx, %ecx
movl %ecx, 0x18(%rax,%r12)
movl %ecx, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%r12)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movq 0x128(%r14), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
movapd 0x20(%rsp), %xmm0
unpcklpd 0x30(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
cvttpd2dq %xmm0, %xmm0
movq 0x128(%r14), %rax
movlpd %xmm0, 0x20(%rax,%r12)
jmp 0x2d083
leaq (%r15,%r15,2), %rcx
cvttsd2si 0x8(%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)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rcx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rcx)
movapd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%rcx)
jmp 0x2d083
cvttsd2si 0x8(%rsp), %ecx
cvttpd2dq 0x40(%rsp), %xmm0
cvtdq2pd %xmm0, %xmm0
movl %ecx, 0x18(%rax,%r12)
movl $0x2, 0x8(%rax,%r12)
movlpd %xmm0, 0x10(%rax,%r12)
jmp 0x2d040
xorl %ecx, %ecx
movl %ecx, 0x18(%rax,%r12)
movl %ecx, 0x8(%rax,%r12)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, 0x10(%rax,%r12)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movq 0x128(%r14), %rax
movsd (%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 0x2cfb8
movapd 0x20(%rsp), %xmm0
unpcklpd 0x30(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
cvttpd2dq %xmm0, %xmm0
movq 0x128(%r14), %rax
leaq (%r15,%r15,2), %rcx
shlq $0x5, %rcx
movlpd %xmm0, 0x20(%rax,%rcx)
jmp 0x2d083
movl $0x0, 0x18(%rax,%r12)
movl $0x2, 0x8(%rax,%r12)
movabsq $0x4024000000000000, %rcx # imm = 0x4024000000000000
jmp 0x2d03b
cvttsd2si 0x8(%rsp), %ecx
movl %ecx, 0x18(%rax,%r12)
movl $0x2, 0x8(%rax,%r12)
movabsq $0x402c000000000000, %rcx # imm = 0x402C000000000000
movq %rcx, 0x10(%rax,%r12)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%r12)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%r12)
movq 0x38(%rax,%r12), %rdi
movq %rbx, %rsi
callq 0x3b494
movq 0x128(%r14), %rcx
movq %rax, 0x38(%rcx,%r12)
jmp 0x2d083
leaq 0x7ae6c(%rip), %rdi     # 0xa7ee6
movl %ebp, %esi
xorl %eax, %eax
callq 0x4030
incl 0x124(%r14)
leaq (%r15,%r15,2), %rax
shlq $0x5, %rax
addq 0x128(%r14), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq