// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImgList<double>::_save_cimg(_IO_FILE*, char const*, bool) const
const CImgList<T>& _save_cimg(std::FILE *const file, const char *const filename, const bool is_compressed) const {
      if (!file && !filename)
        throw CImgArgumentException(_cimglist_instance
                                    "save_cimg(): Specified filename is (null).",
                                    cimglist_instance);
#ifndef cimg_use_zlib
      if (is_compressed)
        cimg::warn(_cimglist_instance
                   "save_cimg(): Unable to save compressed data in file '%s' unless zlib is enabled, "
                   "saving them uncompressed.",
                   cimglist_instance,
                   filename?filename:"(FILE*)");
#endif
      std::FILE *const nfile = file?file:cimg::fopen(filename,"wb");
      const char *const ptype = pixel_type(), *const etype = cimg::endianness()?"big":"little";
      if (std::strstr(ptype,"unsigned")==ptype) std::fprintf(nfile,"%u unsigned_%s %s_endian\n",_width,ptype+9,etype);
      else std::fprintf(nfile,"%u %s %s_endian\n",_width,ptype,etype);
      cimglist_for(*this,l) {
        const CImg<T>& img = _data[l];
        std::fprintf(nfile,"%u %u %u %u",img._width,img._height,img._depth,img._spectrum);
        if (img._data) {
          CImg<T> tmp;
          if (cimg::endianness()) { tmp = img; cimg::invert_endianness(tmp._data,tmp.size()); }
          const CImg<T>& ref = cimg::endianness()?tmp:img;
          bool failed_to_compress = true;
          if (is_compressed) {
#ifdef cimg_use_zlib
            const unsigned long siz = sizeof(T)*ref.size();
            unsigned long csiz = siz + siz/100 + 16;
            Bytef *const cbuf = new Bytef[csiz];
            if (compress(cbuf,&csiz,(Bytef*)ref._data,siz))
              cimg::warn(_cimglist_instance
                         "save_cimg(): Failed to save compressed data for file '%s', saving them uncompressed.",
                         cimglist_instance,
                         filename?filename:"(FILE*)");
            else {
              std::fprintf(nfile," #%lu\n",csiz);
              cimg::fwrite(cbuf,csiz,nfile);
              delete[] cbuf;
              failed_to_compress = false;
            }
#endif
          }
          if (failed_to_compress) { // Write in a non-compressed way.
            std::fputc('\n',nfile);
            cimg::fwrite(ref._data,ref.size(),nfile);
          }
        } else std::fputc('\n',nfile);
      }
      if (!file) cimg::fclose(nfile);
      return *this;
    }

// Assembly:
subq $0xf8, %rsp
movb %cl, %al
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movq %rdx, 0xe0(%rsp)
andb $0x1, %al
movb %al, 0xdf(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x68(%rsp)
cmpq $0x0, 0xe8(%rsp)
jne 0xa230c
cmpq $0x0, 0xe0(%rsp)
jne 0xa230c
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movl (%rax), %ecx
movl %ecx, 0x58(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x5c(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
callq 0x7c860
movq 0x50(%rsp), %rdi
movl 0x58(%rsp), %edx
movl 0x5c(%rsp), %ecx
movq 0x60(%rsp), %r8
movq %rax, %r9
leaq 0x4a1e3(%rip), %rsi     # 0xec4ab
xorl %eax, %eax
callq 0x12220
jmp 0xa22d1
movq 0x48(%rsp), %rdi
leaq 0x5d883(%rip), %rsi     # 0xffb60
leaq -0x8fe84(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
callq 0x53a0
jmp 0xa2673
testb $0x1, 0xdf(%rsp)
je 0xa2388
movq 0x68(%rsp), %rax
movl (%rax), %ecx
movl %ecx, 0x30(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x34(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x38(%rsp)
callq 0x7c860
movq %rax, 0x40(%rsp)
cmpq $0x0, 0xe0(%rsp)
je 0xa2355
movq 0xe0(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0xa2363
leaq 0x4712e(%rip), %rax     # 0xe948a
movq %rax, 0x28(%rsp)
jmp 0xa2363
movq 0x40(%rsp), %r8
movq 0x38(%rsp), %rcx
movl 0x34(%rsp), %edx
movl 0x30(%rsp), %esi
movq 0x28(%rsp), %r9
leaq 0x4a178(%rip), %rdi     # 0xec4f9
movb $0x0, %al
callq 0x117e0
cmpq $0x0, 0xe8(%rsp)
je 0xa23a2
movq 0xe8(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0xa23bb
movq 0xe0(%rsp), %rdi
leaq 0x46b4f(%rip), %rsi     # 0xe8f00
callq 0x654a0
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rsp)
callq 0x7c860
movq %rax, 0xb8(%rsp)
callq 0x43af0
movb %al, %dl
leaq 0x48737(%rip), %rax     # 0xeab1a
leaq 0x48737(%rip), %rcx     # 0xeab21
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xb0(%rsp)
movq 0xb8(%rsp), %rdi
leaq 0x483a7(%rip), %rsi     # 0xea7af
callq 0x50c0
cmpq 0xb8(%rsp), %rax
jne 0xa244a
movq 0x68(%rsp), %rax
movq 0xc0(%rsp), %rdi
movl (%rax), %edx
movq 0xb8(%rsp), %rcx
addq $0x9, %rcx
movq 0xb0(%rsp), %r8
leaq 0x4a146(%rip), %rsi     # 0xec587
movb $0x0, %al
callq 0x5750
jmp 0xa2477
movq 0x68(%rsp), %rax
movq 0xc0(%rsp), %rdi
movl (%rax), %edx
movq 0xb8(%rsp), %rcx
movq 0xb0(%rsp), %r8
leaq 0x4a131(%rip), %rsi     # 0xec5a1
movb $0x0, %al
callq 0x5750
movl $0x0, 0xac(%rsp)
movq 0x68(%rsp), %rcx
movl 0xac(%rsp), %eax
cmpl (%rcx), %eax
jge 0xa264e
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0xac(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, 0xa0(%rsp)
movq 0xc0(%rsp), %rdi
movq 0xa0(%rsp), %rax
movl (%rax), %edx
movq 0xa0(%rsp), %rax
movl 0x4(%rax), %ecx
movq 0xa0(%rsp), %rax
movl 0x8(%rax), %r8d
movq 0xa0(%rsp), %rax
movl 0xc(%rax), %r9d
leaq 0x4753a(%rip), %rsi     # 0xe9a2c
movb $0x0, %al
callq 0x5750
movq 0xa0(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0xa2624
leaq 0x80(%rsp), %rdi
callq 0xb6c0
callq 0x43af0
testb $0x1, %al
jne 0xa2524
jmp 0xa258c
movq 0xa0(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0xb700
jmp 0xa253b
movq 0x98(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x117b0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x7f600
jmp 0xa2564
jmp 0xa258c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xa540
jmp 0xa2673
callq 0x43af0
testb $0x1, %al
jne 0xa2597
jmp 0xa25a6
leaq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0xa25b3
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x78(%rsp)
movb $0x1, 0x77(%rsp)
testb $0x1, 0xdf(%rsp)
je 0xa25ce
jmp 0xa25ce
testb $0x1, 0x77(%rsp)
je 0xa2615
movq 0xc0(%rsp), %rsi
movl $0xa, %edi
callq 0x5630
jmp 0xa25e9
movq 0x78(%rsp), %rdi
movq 0x18(%rdi), %rax
movq %rax, 0x8(%rsp)
callq 0x117b0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq 0xc0(%rsp), %rdx
callq 0xa2680
jmp 0xa2613
jmp 0xa2615
leaq 0x80(%rsp), %rdi
callq 0xa540
jmp 0xa2636
movq 0xc0(%rsp), %rsi
movl $0xa, %edi
callq 0x5630
jmp 0xa2638
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0xa2482
cmpq $0x0, 0xe8(%rsp)
jne 0xa2666
movq 0xc0(%rsp), %rdi
callq 0x5c6f0
movq 0x68(%rsp), %rax
addq $0xf8, %rsp
retq
movq 0xd0(%rsp), %rdi
callq 0x5970