// File: /workspace/github_c_makefile_star2_O1/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 0x7c015(%rip), %rsi     # 0xa88a1
callq 0x40f0
movq %rax, %rbx
leaq 0x38281d(%rip), %rbp    # 0x3af0b8
movl (%rbp), %ecx
movl 0x4(%rbp), %edx
movl 0x124(%rbp), %r8d
movl 0x120(%rbp), %r9d
leaq 0x76567(%rip), %rsi     # 0xa2e1d
movq %rax, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x38(%rbp), %ecx
movl 0x8(%rbp), %edx
movl 0x28(%rbp), %r8d
leaq 0x7654f(%rip), %rsi     # 0xa2e20
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movq 0x40(%rbp), %rdx
leaq 0x80ce0(%rip), %rsi     # 0xad5c6
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 0x78f91(%rip), %rsi     # 0xa5898
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 0x78f82(%rip), %r14     # 0xa58a9
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 0x2c987
cmpl $0x0, 0x20(%rbp)
jle 0x2c987
leaq 0x80c63(%rip), %r14     # 0xad5c6
xorl %r15d, %r15d
movq 0x30(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
movslq 0x20(%rbp), %rax
cmpq %rax, %r15
jl 0x2c966
movl 0xa8(%rbp), %ecx
movl 0x78(%rbp), %edx
movl 0x98(%rbp), %r8d
leaq 0x76482(%rip), %rsi     # 0xa2e20
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
cmpl $0x0, 0x78(%rbp)
je 0x2ca91
movq 0xb0(%rbp), %rdx
leaq 0x80c06(%rip), %rsi     # 0xad5c6
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 0x78eab(%rip), %rsi     # 0xa5898
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 0x78e90(%rip), %r14     # 0xa58a9
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 0x2ca91
cmpl $0x0, 0x90(%rbp)
jle 0x2ca91
leaq 0x80b5f(%rip), %r14     # 0xad5c6
xorl %r15d, %r15d
movq 0xa0(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
movslq 0x90(%rbp), %rax
cmpq %rax, %r15
jl 0x2ca6a
cmpl $0x0, 0x124(%rbp)
jle 0x2cc6f
movl $0x38, %r13d
leaq 0x80202(%rip), %r12     # 0xaccad
xorl %r15d, %r15d
movq 0x128(%rbp), %rax
movq %r15, %rcx
shlq $0x5, %rcx
leaq (%rcx,%rcx,2), %r14
movl 0x24(%rax,%r14), %ecx
movl (%rax,%r14), %edx
movl 0x20(%rax,%r14), %r8d
movq %rbx, %rdi
leaq 0x76348(%rip), %rsi     # 0xa2e20
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 0x78da3(%rip), %rsi     # 0xa58a9
movb $0x1, %al
callq 0x42e0
movq 0x128(%rbp), %rax
movl (%rax,%r14), %ecx
cmpq $0x8, %rcx
ja 0x2cc58
addq %rax, %r14
leaq 0x78ce8(%rip), %rdx     # 0xa5814
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq (%r15,%r15,2), %rcx
shlq $0x5, %rcx
movsd 0x28(%rax,%rcx), %xmm0
movsd 0x30(%rax,%rcx), %xmm1
movq 0x38(%rax,%rcx), %rdx
movq %rbx, %rdi
leaq 0x78d60(%rip), %rsi     # 0xa58b8
movb $0x2, %al
callq 0x42e0
jmp 0x2cc58
movsd 0x38(%r14), %xmm0
movsd 0x40(%r14), %xmm1
movsd 0x28(%r14), %xmm2
movsd 0x30(%r14), %xmm3
movq %rbx, %rdi
leaq 0x78d45(%rip), %rsi     # 0xa58cb
movb $0x4, %al
callq 0x42e0
jmp 0x2cc58
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movq %rbx, %rdi
leaq 0x78cf6(%rip), %rsi     # 0xa589e
movb $0x2, %al
callq 0x42e0
xorl %r14d, %r14d
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
cmpq $0xa, %r14
jne 0x2cbb2
movl $0xa, %edi
movq %rbx, %rsi
callq 0x4150
jmp 0x2cc58
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movq %rbx, %rdi
leaq 0x78ca3(%rip), %rsi     # 0xa589e
movb $0x2, %al
callq 0x42e0
jmp 0x2cc58
movsd 0x48(%r14), %xmm0
movsd 0x40(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movsd 0x28(%r14), %xmm4
movsd 0x30(%r14), %xmm3
movq %rbx, %rdi
leaq 0x78c9a(%rip), %rsi     # 0xa58c6
movb $0x5, %al
callq 0x42e0
jmp 0x2cc58
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movq %rbx, %rdi
leaq 0x78c7f(%rip), %rsi     # 0xa58d0
movb $0x3, %al
callq 0x42e0
incq %r15
movslq 0x124(%rbp), %rax
addq $0x60, %r13
cmpq %rax, %r15
jl 0x2caae
movl 0xe8(%rbp), %edx
movl 0xec(%rbp), %ecx
leaq 0x761aa(%rip), %rsi     # 0xa2e2c
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 0x78bfb(%rip), %rsi     # 0xa58a9
movq %rbx, %rdi
movb $0x1, %al
callq 0x42e0
cmpl $0x0, 0xec(%rbp)
jle 0x2ccf2
leaq 0x808fe(%rip), %r14     # 0xad5c6
xorl %r15d, %r15d
movq 0x100(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
movslq 0xec(%rbp), %rax
cmpq %rax, %r15
jl 0x2cccb
cmpl $0x0, 0xec(%rbp)
jle 0x2cd2c
leaq 0x7ffab(%rip), %r14     # 0xaccad
xorl %r15d, %r15d
movq 0xf0(%rbp), %rax
movl (%rax,%r15,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x42e0
incq %r15
movslq 0xec(%rbp), %rax
cmpq %rax, %r15
jl 0x2cd05
movl $0xa, %edi
movq %rbx, %rsi
callq 0x4150
cmpl $0x0, 0xec(%rbp)
jle 0x2cd68
xorl %r14d, %r14d
movq 0xf8(%rbp), %rax
movsbl (%rax,%r14), %edi
movq %rbx, %rsi
callq 0x4150
incq %r14
movslq 0xec(%rbp), %rax
cmpq %rax, %r14
jl 0x2cd45
movl $0xa, %edi
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