// File: /workspace/github_c_makefile_star2_O3/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 0x7e846(%rip), %rsi     # 0xab96d
callq 0x40f0
movq %rax, %rbx
leaq 0x384f82(%rip), %rbp    # 0x3b20b8
movl (%rbp), %ecx
movl 0x4(%rbp), %edx
movl 0x124(%rbp), %r8d
movl 0x120(%rbp), %r9d
leaq 0x78ccc(%rip), %rsi     # 0xa5e1d
movq %rax, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x38(%rbp), %ecx
movl 0x8(%rbp), %edx
movl 0x28(%rbp), %r8d
leaq 0x78cb4(%rip), %rsi     # 0xa5e20
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movq 0x40(%rbp), %rdx
leaq 0x834dd(%rip), %rsi     # 0xb065e
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 0x7b76e(%rip), %rsi     # 0xa8910
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 0x7b75f(%rip), %r14     # 0xa8921
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 0x2d222
cmpl $0x0, 0x20(%rbp)
jle 0x2d222
leaq 0x83460(%rip), %r14     # 0xb065e
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 0x2d201
movl 0xa8(%rbp), %ecx
movl 0x78(%rbp), %edx
movl 0x98(%rbp), %r8d
leaq 0x78be7(%rip), %rsi     # 0xa5e20
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
cmpl $0x0, 0x78(%rbp)
je 0x2d32c
movq 0xb0(%rbp), %rdx
leaq 0x83403(%rip), %rsi     # 0xb065e
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 0x7b688(%rip), %rsi     # 0xa8910
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 0x7b66d(%rip), %r14     # 0xa8921
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 0x2d32c
cmpl $0x0, 0x90(%rbp)
jle 0x2d32c
leaq 0x8335c(%rip), %r14     # 0xb065e
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 0x2d305
cmpl $0x0, 0x124(%rbp)
jle 0x2d50a
movl $0x38, %r13d
leaq 0x82a3f(%rip), %r12     # 0xafd85
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 0x78aad(%rip), %rsi     # 0xa5e20
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 0x7b580(%rip), %rsi     # 0xa8921
movb $0x1, %al
callq 0x42e0
movq 0x128(%rbp), %rax
movl (%rax,%r14), %ecx
cmpq $0x8, %rcx
ja 0x2d4f3
addq %rax, %r14
leaq 0x7b4a5(%rip), %rdx     # 0xa886c
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 0x7b53d(%rip), %rsi     # 0xa8930
movb $0x2, %al
callq 0x42e0
jmp 0x2d4f3
movsd 0x38(%r14), %xmm0
movsd 0x40(%r14), %xmm1
movsd 0x28(%r14), %xmm2
movsd 0x30(%r14), %xmm3
movq %rbx, %rdi
leaq 0x7b522(%rip), %rsi     # 0xa8943
movb $0x4, %al
callq 0x42e0
jmp 0x2d4f3
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movq %rbx, %rdi
leaq 0x7b4d3(%rip), %rsi     # 0xa8916
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 0x2d44d
movl $0xa, %edi
movq %rbx, %rsi
callq 0x4150
jmp 0x2d4f3
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movq %rbx, %rdi
leaq 0x7b480(%rip), %rsi     # 0xa8916
movb $0x2, %al
callq 0x42e0
jmp 0x2d4f3
movsd 0x48(%r14), %xmm0
movsd 0x40(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movsd 0x28(%r14), %xmm4
movsd 0x30(%r14), %xmm3
movq %rbx, %rdi
leaq 0x7b477(%rip), %rsi     # 0xa893e
movb $0x5, %al
callq 0x42e0
jmp 0x2d4f3
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x38(%r14), %xmm2
movq %rbx, %rdi
leaq 0x7b45c(%rip), %rsi     # 0xa8948
movb $0x3, %al
callq 0x42e0
incq %r15
movslq 0x124(%rbp), %rax
addq $0x60, %r13
cmpq %rax, %r15
jl 0x2d349
movl 0xe8(%rbp), %edx
movl 0xec(%rbp), %ecx
leaq 0x7890f(%rip), %rsi     # 0xa5e2c
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 0x7b3d8(%rip), %rsi     # 0xa8921
movq %rbx, %rdi
movb $0x1, %al
callq 0x42e0
cmpl $0x0, 0xec(%rbp)
jle 0x2d5c2
leaq 0x830fb(%rip), %r14     # 0xb065e
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 0x2d566
testl %eax, %eax
jle 0x2d5c2
leaq 0x827ed(%rip), %r14     # 0xafd85
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 0x2d59b
movl $0xa, %edi
movq %rbx, %rsi
callq 0x4150
cmpl $0x0, 0xec(%rbp)
jle 0x2d5fe
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 0x2d5db
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