// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
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 0x3810f2(%rip), %r15    # 0x3aa0b8
movslq 0x124(%r15), %rax
movq 0x128(%r15), %rdi
leal 0x1(%rax), %edx
imulq $0x60, %rax, %rbx
leaq 0x60(%rbx), %rsi
callq 0x34f30
movq %rax, 0x128(%r15)
movl %ebp, (%rax,%rbx)
cmpl $0x8, %ebp
ja 0x292fa
movl %ebp, %ecx
leaq 0x6f7c8(%rip), %rdx     # 0x987c8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cvttsd2si 0x8(%rsp), %ecx
movl %ecx, 0x18(%rax,%rbx)
andl $0x0, 0x8(%rax,%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%rbx)
movsbl (%r14), %edi
pushq $0x30
popq %rsi
pushq $0x39
popq %rdx
callq 0x34c00
movq 0x128(%r15), %r12
testl %eax, %eax
je 0x29054
movq %r14, %rdi
callq 0x4200
pushq $0x5
popq %rcx
cltd
idivl %ecx
movl %edx, 0x1c(%r12,%rbx)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%r12,%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%r12,%rbx)
movaps 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%r12,%rbx)
movapd 0x30(%rsp), %xmm0
movsd %xmm0, 0x40(%r12,%rbx)
jmp 0x2930a
andl $0x0, 0x18(%rax,%rbx)
andl $0x0, 0x8(%rax,%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%rbx)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rbx)
movq 0x128(%r15), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rbx)
movq 0x128(%r15), %rax
movaps 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%rbx)
movq 0x128(%r15), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x40(%rax,%rbx)
movq 0x128(%r15), %rax
movapd 0x40(%rsp), %xmm0
movsd %xmm0, 0x48(%rax,%rbx)
movq %r14, %rdi
callq 0x4200
movq 0x128(%r15), %rcx
movl %eax, 0x20(%rcx,%rbx)
cvttsd2si 0x30(%rsp), %eax
movl %eax, 0x24(%rcx,%rbx)
jmp 0x2930a
andl $0x0, 0x18(%rax,%rbx)
andl $0x0, 0x8(%rax,%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%rbx)
movapd 0x10(%rsp), %xmm2
movsd %xmm2, 0x28(%rax,%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rbx)
movapd 0x20(%rsp), %xmm1
movsd %xmm1, 0x38(%rax,%rbx)
movaps 0x30(%rsp), %xmm0
movsd %xmm0, 0x40(%rax,%rbx)
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
cvttpd2dq %xmm2, %xmm0
jmp 0x291b8
andl $0x0, 0x18(%rax,%rbx)
andl $0x0, 0x8(%rax,%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%rbx)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rbx)
movq 0x128(%r15), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rbx)
movapd 0x20(%rsp), %xmm0
unpcklpd 0x30(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
cvttpd2dq %xmm0, %xmm0
movq 0x128(%r15), %rax
movlpd %xmm0, 0x20(%rax,%rbx)
jmp 0x2930a
cvttsd2si 0x8(%rsp), %ecx
movl %ecx, 0x18(%rax,%rbx)
andl $0x0, 0x8(%rax,%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%rbx)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rbx)
movapd 0x20(%rsp), %xmm0
movsd %xmm0, 0x38(%rax,%rbx)
jmp 0x2930a
cvttsd2si 0x8(%rsp), %ecx
cvttpd2dq 0x40(%rsp), %xmm0
cvtdq2pd %xmm0, %xmm0
movl %ecx, 0x18(%rax,%rbx)
movl $0x2, 0x8(%rax,%rbx)
movlpd %xmm0, 0x10(%rax,%rbx)
jmp 0x292c9
andl $0x0, 0x18(%rax,%rbx)
andl $0x0, 0x8(%rax,%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax,%rbx)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rbx)
movq 0x128(%r15), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rbx)
leaq 0x38(%rbx), %rax
xorl %ecx, %ecx
cmpq $0xa, %rcx
je 0x291a1
movsbl (%r14,%rcx), %edx
addl $-0x30, %edx
movq 0x128(%r15), %rsi
addq %rax, %rsi
movl %edx, (%rsi,%rcx,4)
incq %rcx
jmp 0x2926b
andl $0x0, 0x18(%rax,%rbx)
movl $0x2, 0x8(%rax,%rbx)
movabsq $0x4024000000000000, %rcx # imm = 0x4024000000000000
jmp 0x292c4
cvttsd2si 0x8(%rsp), %ecx
movl %ecx, 0x18(%rax,%rbx)
movl $0x2, 0x8(%rax,%rbx)
movabsq $0x402c000000000000, %rcx # imm = 0x402C000000000000
movq %rcx, 0x10(%rax,%rbx)
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax,%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax,%rbx)
movq 0x38(%rax,%rbx), %rdi
movq %r14, %rsi
callq 0x3604c
movq 0x128(%r15), %rcx
movq %rax, 0x38(%rcx,%rbx)
jmp 0x2930a
leaq 0x6eb65(%rip), %rdi     # 0x97e66
movl %ebp, %esi
xorl %eax, %eax
callq 0x4030
incl 0x124(%r15)
addq 0x128(%r15), %rbx
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq