// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/image.c
// Function: save_image
void save_image(char* fname)
{
 int i, j;
 FILE* outfile;
 outfile = fopen(fname, "w");
 fprintf(outfile, "%d %d %d %d\n", img.width, img.height, img.objectcount, img.groupcoloring);
 /* Save x axis */
 fprintf(outfile, "%d %d %d\n", img.xaxis.available, img.xaxis.namesavailable, img.xaxis.limitsset);
 fprintf(outfile, "%s\n", img.xaxis.label);
 fprintf(outfile, "%d %d %.6f %.6f\n", img.xaxis.lim.division, img.xaxis.lim.precision, img.xaxis.lim.min, img.xaxis.lim.max);
 fprintf(outfile, "%d %.6f %d %d\n", img.xaxis.labelfnt.dashedtype, img.xaxis.labelfnt.fontsize, img.xaxis.labelfnt.fontname, img.xaxis.labelfnt.fontcolor);
 fprintf(outfile, "%d %.6f %d %d\n", img.xaxis.axisfnt.dashedtype, img.xaxis.axisfnt.fontsize, img.xaxis.axisfnt.fontname, img.xaxis.axisfnt.fontcolor);
 if (img.xaxis.namesavailable)
   for (i = 0; i < img.xaxis.lim.division; i++)
     fprintf(outfile, "%s\n", img.xaxis.names[i]);
 /* Save y axis */
 fprintf(outfile, "%d %d %d\n", img.yaxis.available, img.yaxis.namesavailable, img.yaxis.limitsset);
 if (img.yaxis.available)
  {
   fprintf(outfile, "%s\n", img.yaxis.label);
   fprintf(outfile, "%d %d %.6f %.6f\n", img.yaxis.lim.division, img.yaxis.lim.precision, img.yaxis.lim.min, img.yaxis.lim.max);
   fprintf(outfile, "%d %.6f %d %d\n", img.yaxis.labelfnt.dashedtype, img.yaxis.labelfnt.fontsize, img.yaxis.labelfnt.fontname, img.yaxis.labelfnt.fontcolor);
   fprintf(outfile, "%d %.6f %d %d\n", img.yaxis.axisfnt.dashedtype, img.yaxis.axisfnt.fontsize, img.yaxis.axisfnt.fontname, img.yaxis.axisfnt.fontcolor);
   if (img.yaxis.namesavailable)
     for (i = 0; i < img.yaxis.lim.division; i++)
       fprintf(outfile, "%s\n", img.yaxis.names[i]);
  }
 /* Save Objects */
 for (i = 0; i < img.objectcount; i++)
  {
   fprintf(outfile, "%d %d %d\n", img.objects[i].type, img.objects[i].index, img.objects[i].groupindex);
   fprintf(outfile, "%d %.6f %d %d\n", img.objects[i].fnt.dashedtype, img.objects[i].fnt.fontsize, img.objects[i].fnt.fontname, img.objects[i].fnt.fontcolor);
   switch (img.objects[i].type)
    {
     case       OBJECT_LINE:fprintf(outfile, "%.6f %.6f %.6f %.6f\n", img.objects[i].obje.li.downright.x, img.objects[i].obje.li.downright.y, img.objects[i].obje.li.upleft.x, img.objects[i].obje.li.upleft.y);
                            break;
     case     OBJECT_CIRCLE:fprintf(outfile, "%.6f %.6f %.6f\n", img.objects[i].obje.ci.center.x, img.objects[i].obje.ci.center.y, img.objects[i].obje.ci.radius);
                            break;
     case      OBJECT_POINT:
     case     OBJECT_STRING:
     case OBJECT_NAMEDPOINT:fprintf(outfile, "%.6f %.6f %s\n", img.objects[i].obje.st.p.x, img.objects[i].obje.st.p.y, img.objects[i].obje.st.st);
                            break;
     case  OBJECT_RECTANGLE:fprintf(outfile, "%.6f %.6f %.6f %.6f\n", img.objects[i].obje.re.downright.x, img.objects[i].obje.re.downright.y, img.objects[i].obje.re.upleft.x, img.objects[i].obje.re.upleft.y);
                            break;
     case      OBJECT_MVBOX:fprintf(outfile, "%.6f %.6f\n", img.objects[i].obje.mv.mean, img.objects[i].obje.mv.variance);
                            break;
     case    OBJECT_BOXPLOT:fprintf(outfile, "%.6f %.6f %.6f %.6f %.6f\n", img.objects[i].obje.box.lwhisker, img.objects[i].obje.box.swhisker, img.objects[i].obje.box.p75, img.objects[i].obje.box.p25, img.objects[i].obje.box.median);
                            break;
     case OBJECT_ERRORHISTOGRAM:fprintf(outfile, "%.6f %.6f\n", img.objects[i].obje.errorhist.min, img.objects[i].obje.errorhist.max);
                                 for (j = 0; j < 10; j++)
                                   fprintf(outfile, "%d ", img.objects[i].obje.errorhist.counts[j]);
                                 fprintf(outfile, "\n");
                                 break;
    }
  }
 /* Save Legend */
 fprintf(outfile, "%d %d\n", img.imagelegend.position, img.imagelegend.legendcount);
 fprintf(outfile, "%d %.6f %d %d\n", img.imagelegend.fnt.dashedtype, img.imagelegend.fnt.fontsize, img.imagelegend.fnt.fontname, img.imagelegend.fnt.fontcolor);
 for (i = 0; i < img.imagelegend.legendcount; i++)
   fprintf(outfile, "%s\n", img.imagelegend.names[i]);
 for (i = 0; i < img.imagelegend.legendcount; i++)
   fprintf(outfile, "%d ", img.imagelegend.colors[i]);
 fprintf(outfile, "\n");
 for (i = 0; i < img.imagelegend.legendcount; i++)
   fprintf(outfile, "%c", img.imagelegend.types[i]);
 fprintf(outfile, "\n");
 fclose(outfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x724ee(%rip), %rsi     # 0x9b891
callq 0x40f0
movq %rax, %rbx
leaq 0x380d06(%rip), %rbp    # 0x3aa0b8
movl (%rbp), %ecx
movl 0x4(%rbp), %edx
movl 0x124(%rbp), %r8d
movl 0x120(%rbp), %r9d
leaq 0x6ca58(%rip), %rsi     # 0x95e25
movq %rax, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x38(%rbp), %ecx
movl 0x8(%rbp), %edx
movl 0x28(%rbp), %r8d
leaq 0x6ca40(%rip), %rsi     # 0x95e28
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movq 0x40(%rbp), %rdx
leaq 0x771c5(%rip), %rsi     # 0xa05c2
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x20(%rbp), %edx
movl 0x24(%rbp), %ecx
movsd 0x10(%rbp), %xmm0
movsd 0x18(%rbp), %xmm1
leaq 0x6f472(%rip), %rsi     # 0x98890
movq %rbx, %rdi
movb $0x2, %al
callq 0x42e0
movl 0x74(%rbp), %edx
movsd 0x68(%rbp), %xmm0
movl 0x60(%rbp), %ecx
movl 0x70(%rbp), %r8d
leaq 0x6f463(%rip), %r14     # 0x988a1
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x42e0
movl 0x5c(%rbp), %edx
movsd 0x50(%rbp), %xmm0
movl 0x48(%rbp), %ecx
movl 0x58(%rbp), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x42e0
cmpl $0x0, 0x38(%rbp)
je 0x2949a
leaq 0x7714e(%rip), %r14     # 0xa05c2
xorl %r15d, %r15d
movslq 0x20(%rbp), %rax
cmpq %rax, %r15
jge 0x2949a
movq 0x30(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
jmp 0x29477
movl 0xa8(%rbp), %ecx
movl 0x78(%rbp), %edx
movl 0x98(%rbp), %r8d
leaq 0x6c977(%rip), %rsi     # 0x95e28
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
cmpl $0x0, 0x78(%rbp)
je 0x2959d
movq 0xb0(%rbp), %rdx
leaq 0x770ef(%rip), %rsi     # 0xa05c2
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x90(%rbp), %edx
movl 0x94(%rbp), %ecx
movsd 0x80(%rbp), %xmm0
movsd 0x88(%rbp), %xmm1
leaq 0x6f390(%rip), %rsi     # 0x98890
movq %rbx, %rdi
movb $0x2, %al
callq 0x42e0
movl 0xe4(%rbp), %edx
movsd 0xd8(%rbp), %xmm0
movl 0xd0(%rbp), %ecx
movl 0xe0(%rbp), %r8d
leaq 0x6f375(%rip), %r14     # 0x988a1
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x42e0
movl 0xcc(%rbp), %edx
movsd 0xc0(%rbp), %xmm0
movl 0xb8(%rbp), %ecx
movl 0xc8(%rbp), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x42e0
cmpl $0x0, 0xa8(%rbp)
je 0x2959d
leaq 0x77051(%rip), %r14     # 0xa05c2
xorl %r15d, %r15d
movslq 0x90(%rbp), %rax
cmpq %rax, %r15
jge 0x2959d
movq 0xa0(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
jmp 0x29574
pushq $0x38
popq %r13
leaq 0x76710(%rip), %r12     # 0x9fcb8
xorl %r15d, %r15d
movslq 0x124(%rbp), %rax
cmpq %rax, %r15
jge 0x29755
movq 0x128(%rbp), %rax
imulq $0x60, %r15, %r14
movl 0x24(%rax,%r14), %ecx
movl (%rax,%r14), %edx
movl 0x20(%rax,%r14), %r8d
movq %rbx, %rdi
leaq 0x6c84a(%rip), %rsi     # 0x95e28
xorl %eax, %eax
callq 0x42e0
movq 0x128(%rbp), %rax
movl 0x1c(%rax,%r14), %edx
movsd 0x10(%rax,%r14), %xmm0
movl 0x8(%rax,%r14), %ecx
movl 0x18(%rax,%r14), %r8d
movq %rbx, %rdi
leaq 0x6f295(%rip), %rsi     # 0x988a1
movb $0x1, %al
callq 0x42e0
movq 0x128(%rbp), %rcx
movl (%rcx,%r14), %edx
cmpq $0x8, %rdx
ja 0x29749
leaq (%rcx,%r14), %rax
leaq 0x6f1b9(%rip), %rsi     # 0x987ec
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movsd 0x28(%rcx,%r14), %xmm0
movsd 0x30(%rcx,%r14), %xmm1
movq 0x38(%rcx,%r14), %rdx
movq %rbx, %rdi
leaq 0x6f257(%rip), %rsi     # 0x988b0
movb $0x2, %al
callq 0x42e0
jmp 0x29749
movsd 0x38(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movsd 0x28(%rax), %xmm2
movsd 0x30(%rax), %xmm3
movq %rbx, %rdi
leaq 0x6f240(%rip), %rsi     # 0x988c3
movb $0x4, %al
callq 0x42e0
jmp 0x29749
movsd 0x28(%rax), %xmm0
movsd 0x30(%rax), %xmm1
movq %rbx, %rdi
leaq 0x6f1f3(%rip), %rsi     # 0x98896
movb $0x2, %al
callq 0x42e0
xorl %r14d, %r14d
cmpq $0xa, %r14
je 0x296d3
movq 0x128(%rbp), %rax
addq %r13, %rax
movl (%rax,%r14,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r14
jmp 0x296ad
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x4150
jmp 0x29749
movsd 0x28(%rax), %xmm0
movsd 0x30(%rax), %xmm1
movq %rbx, %rdi
leaq 0x6f1a2(%rip), %rsi     # 0x98896
movb $0x2, %al
callq 0x42e0
jmp 0x29749
movsd 0x48(%rax), %xmm0
movsd 0x40(%rax), %xmm1
movsd 0x38(%rax), %xmm2
movsd 0x28(%rax), %xmm4
movsd 0x30(%rax), %xmm3
movq %rbx, %rdi
leaq 0x6f19e(%rip), %rsi     # 0x988be
movb $0x5, %al
callq 0x42e0
jmp 0x29749
movsd 0x28(%rax), %xmm0
movsd 0x30(%rax), %xmm1
movsd 0x38(%rax), %xmm2
movq %rbx, %rdi
leaq 0x6f186(%rip), %rsi     # 0x988c8
movb $0x3, %al
callq 0x42e0
incq %r15
addq $0x60, %r13
jmp 0x295ab
movl 0xe8(%rbp), %edx
movl 0xec(%rbp), %ecx
leaq 0x6c6cc(%rip), %rsi     # 0x95e34
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x11c(%rbp), %edx
movsd 0x110(%rbp), %xmm0
movl 0x108(%rbp), %ecx
movl 0x118(%rbp), %r8d
leaq 0x6f10d(%rip), %rsi     # 0x988a1
movq %rbx, %rdi
movb $0x1, %al
callq 0x42e0
leaq 0x76e1d(%rip), %r14     # 0xa05c2
xorl %r15d, %r15d
movslq 0xec(%rbp), %rax
cmpq %rax, %r15
jge 0x297d1
movq 0x100(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
jmp 0x297a8
leaq 0x764e0(%rip), %r14     # 0x9fcb8
xorl %r15d, %r15d
cltq
cmpq %rax, %r15
jge 0x29805
movq 0xf0(%rbp), %rax
movl (%rax,%r15,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
movl 0xec(%rbp), %eax
jmp 0x297db
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x4150
xorl %r14d, %r14d
movslq 0xec(%rbp), %rax
cmpq %rax, %r14
jge 0x29838
movq 0xf8(%rbp), %rax
movsbl (%rax,%r14), %edi
movq %rbx, %rsi
callq 0x4150
incq %r14
jmp 0x29813
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x4150
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0