// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::_save_pnk(_IO_FILE*, char const*) const
const CImg<T>& _save_pnk(std::FILE *const file, const char *const filename) const {
      if (!file && !filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_pnk(): Specified filename is (null).",
                                    cimg_instance);
      if (is_empty()) { cimg::fempty(file,filename); return *this; }
      if (_spectrum>1)
        cimg::warn(_cimg_instance
                   "save_pnk(): Instance is multispectral, only the first channel will be saved in file '%s'.",
                   cimg_instance,
                   filename?filename:"(FILE*)");

      const unsigned long buf_size = cimg::min(1024*1024LU,_width*_height*_depth);
      std::FILE *const nfile = file?file:cimg::fopen(filename,"wb");
      const T *ptr = data(0,0,0,0);

      if (!cimg::type<T>::is_float() && sizeof(T)==1 && _depth<2) // Can be saved as regular PNM file.
        _save_pnm(file,filename,0);
      else if (!cimg::type<T>::is_float() && sizeof(T)==1) { // Save as extended P5 file: Binary byte-valued 3d.
        std::fprintf(nfile,"P5\n%u %u %u\n255\n",_width,_height,_depth);
        CImg<ucharT> buf(buf_size);
        for (long to_write = (long)_width*_height*_depth; to_write>0; ) {
          const unsigned long N = cimg::min((unsigned long)to_write,buf_size);
          unsigned char *ptrd = buf._data;
          for (unsigned long i = N; i>0; --i) *(ptrd++) = (unsigned char)*(ptr++);
          cimg::fwrite(buf._data,N,nfile);
          to_write-=N;
        }
      } else if (!cimg::type<T>::is_float()) { // Save as P8: Binary int32-valued 3d.
        if (_depth>1) std::fprintf(nfile,"P8\n%u %u %u\n%d\n",_width,_height,_depth,(int)max());
        else std::fprintf(nfile,"P8\n%u %u\n%d\n",_width,_height,(int)max());
        CImg<intT> buf(buf_size);
        for (long to_write = (long)_width*_height*_depth; to_write>0; ) {
          const unsigned long N = cimg::min((unsigned long)to_write,buf_size);
          int *ptrd = buf._data;
          for (unsigned long i = N; i>0; --i) *(ptrd++) = (int)*(ptr++);
          cimg::fwrite(buf._data,N,nfile);
          to_write-=N;
        }
      } else { // Save as P9: Binary float-valued 3d.
        if (_depth>1) std::fprintf(nfile,"P9\n%u %u %u\n%g\n",_width,_height,_depth,(double)max());
        else std::fprintf(nfile,"P9\n%u %u\n%g\n",_width,_height,(double)max());
        CImg<floatT> buf(buf_size);
        for (long to_write = (long)_width*_height*_depth; to_write>0; ) {
          const unsigned long N = cimg::min((unsigned long)to_write,buf_size);
          float *ptrd = buf._data;
          for (unsigned long i = N; i>0; --i) *(ptrd++) = (float)*(ptr++);
          cimg::fwrite(buf._data,N,nfile);
          to_write-=N;
        }
      }

      if (!file) cimg::fclose(nfile);
      return *this;
    }

// Assembly:
subq $0x208, %rsp            # imm = 0x208
movq %rdi, 0x1f8(%rsp)
movq %rsi, 0x1f0(%rsp)
movq %rdx, 0x1e8(%rsp)
movq 0x1f8(%rsp), %rax
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0x1f0(%rsp)
jne 0xa0489
cmpq $0x0, 0x1e8(%rsp)
jne 0xa0489
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0xd0(%rsp), %rax
movq %rcx, 0xa0(%rsp)
movl (%rax), %ecx
movl %ecx, 0xa8(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0xac(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0xb0(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0xb4(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0xb8(%rsp)
movb 0x10(%rax), %dl
leaq 0x4860b(%rip), %rcx     # 0xe89d2
leaq 0x29713(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0xc0(%rsp)
callq 0x118f0
movq %rax, 0xc8(%rsp)
jmp 0xa03ec
movl 0xb4(%rsp), %r9d
movl 0xb0(%rsp), %r8d
movl 0xac(%rsp), %ecx
movl 0xa8(%rsp), %edx
movq 0xa0(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %r10
movq 0xc8(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x4bc49(%rip), %rsi     # 0xec088
xorl %eax, %eax
callq 0x12220
jmp 0xa0448
movq 0xa0(%rsp), %rdi
leaq 0x5f709(%rip), %rsi     # 0xffb60
leaq -0x8dffe(%rip), %rdx    # 0x12460
callq 0x5920
movq 0xa0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
callq 0x53a0
jmp 0xa0cb3
movq 0xd0(%rsp), %rdi
callq 0x10320
testb $0x1, %al
jne 0xa049c
jmp 0xa04c6
movq 0x1f0(%rsp), %rdi
movq 0x1e8(%rsp), %rsi
callq 0x9c310
movq 0xd0(%rsp), %rax
movq %rax, 0x200(%rsp)
jmp 0xa0ca3
movq 0xd0(%rsp), %rax
cmpl $0x1, 0xc(%rax)
jbe 0xa05b2
movq 0xd0(%rsp), %rax
movl (%rax), %ecx
movl %ecx, 0x78(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x7c(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x80(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x84(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x88(%rsp)
movb 0x10(%rax), %dl
leaq 0x295ca(%rip), %rax     # 0xc9ae1
leaq 0x484b4(%rip), %rcx     # 0xe89d2
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x90(%rsp)
callq 0x118f0
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x1e8(%rsp)
je 0xa0554
movq 0x1e8(%rsp), %rax
movq %rax, 0x70(%rsp)
jmp 0xa0562
leaq 0x48f2f(%rip), %rax     # 0xe948a
movq %rax, 0x70(%rsp)
jmp 0xa0562
movq 0x98(%rsp), %r10
movq 0x90(%rsp), %r11
movq 0x88(%rsp), %r9
movl 0x84(%rsp), %r8d
movl 0x80(%rsp), %ecx
movl 0x7c(%rsp), %edx
movl 0x78(%rsp), %esi
movq 0x70(%rsp), %rax
leaq 0x4bb43(%rip), %rdi     # 0xec0e0
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x117e0
movq 0xd0(%rsp), %rcx
movq $0x100000, 0x1c8(%rsp) # imm = 0x100000
movl (%rcx), %eax
imull 0x4(%rcx), %eax
imull 0x8(%rcx), %eax
movl %eax, 0x1c4(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x1c4(%rsp), %rsi
callq 0x30ea0
movq %rax, 0x1d0(%rsp)
cmpq $0x0, 0x1f0(%rsp)
je 0xa060e
movq 0x1f0(%rsp), %rax
movq %rax, 0x68(%rsp)
jmp 0xa0627
movq 0x1e8(%rsp), %rdi
leaq 0x488e3(%rip), %rsi     # 0xe8f00
callq 0x654a0
movq %rax, 0x68(%rsp)
movq 0xd0(%rsp), %rdi
movq 0x68(%rsp), %rax
movq %rax, 0x1b8(%rsp)
xorl %r8d, %r8d
movl %r8d, %esi
movl %r8d, %edx
movl %r8d, %ecx
callq 0x73790
movq %rax, 0x1b0(%rsp)
callq 0xa0cc0
testb $0x1, %al
jne 0xa0698
xorl %eax, %eax
testb $0x1, %al
jne 0xa0666
jmp 0xa0698
movq 0xd0(%rsp), %rax
cmpl $0x2, 0x8(%rax)
jae 0xa0698
movq 0xd0(%rsp), %rdi
movq 0x1f0(%rsp), %rsi
movq 0x1e8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x9eb10
jmp 0xa0c7b
callq 0xa0cc0
testb $0x1, %al
jne 0xa0844
xorl %eax, %eax
testb $0x1, %al
jne 0xa06b0
jmp 0xa0844
movq 0xd0(%rsp), %rax
movq 0x1b8(%rsp), %rdi
movl (%rax), %edx
movl 0x4(%rax), %ecx
movl 0x8(%rax), %r8d
leaq 0x4ba98(%rip), %rsi     # 0xec168
movb $0x0, %al
callq 0x5750
movq 0x1d0(%rsp), %rax
movl %eax, %esi
leaq 0x190(%rsp), %rdi
movl $0x1, %r8d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x15df0
movq 0xd0(%rsp), %rcx
movl (%rcx), %eax
movl 0x4(%rcx), %edx
imulq %rdx, %rax
movl 0x8(%rcx), %ecx
imulq %rcx, %rax
movq %rax, 0x188(%rsp)
cmpq $0x0, 0x188(%rsp)
jle 0xa0832
movq 0x188(%rsp), %rax
movq %rax, 0x178(%rsp)
leaq 0x178(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0xa00b0
movq %rax, 0x180(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x170(%rsp)
movq 0x180(%rsp), %rax
movq %rax, 0x168(%rsp)
cmpq $0x0, 0x168(%rsp)
jbe 0xa07cd
movq 0x1b0(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x1b0(%rsp)
cvttsd2si (%rax), %eax
movb %al, %cl
movq 0x170(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x170(%rsp)
movb %cl, (%rax)
movq 0x168(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x168(%rsp)
jmp 0xa0776
movq 0x1a8(%rsp), %rdi
movq 0x180(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
callq 0x9d390
jmp 0xa07ec
movq 0x180(%rsp), %rcx
movq 0x188(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x188(%rsp)
jmp 0xa071a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x15650
jmp 0xa0cb3
leaq 0x190(%rsp), %rdi
callq 0x15650
jmp 0xa0c79
callq 0xa0cc0
testb $0x1, %al
jne 0xa0a66
movq 0xd0(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jbe 0xa08b4
movq 0xd0(%rsp), %rdi
movq 0x1b8(%rsp), %rax
movq %rax, 0x50(%rsp)
movl (%rdi), %eax
movl %eax, 0x5c(%rsp)
movl 0x4(%rdi), %eax
movl %eax, 0x60(%rsp)
movl 0x8(%rdi), %eax
movl %eax, 0x64(%rsp)
callq 0xa0cd0
movq 0x50(%rsp), %rdi
movl 0x5c(%rsp), %edx
movl 0x60(%rsp), %ecx
movl 0x64(%rsp), %r8d
cvttsd2si (%rax), %r9d
leaq 0x4b8ce(%rip), %rsi     # 0xec179
movb $0x0, %al
callq 0x5750
jmp 0xa08fb
movq 0xd0(%rsp), %rdi
movq 0x1b8(%rsp), %rax
movq %rax, 0x40(%rsp)
movl (%rdi), %eax
movl %eax, 0x48(%rsp)
movl 0x4(%rdi), %eax
movl %eax, 0x4c(%rsp)
callq 0xa0cd0
movq 0x40(%rsp), %rdi
movl 0x48(%rsp), %edx
movl 0x4c(%rsp), %ecx
cvttsd2si (%rax), %r8d
leaq 0x4b895(%rip), %rsi     # 0xec189
movb $0x0, %al
callq 0x5750
movq 0x1d0(%rsp), %rax
movl %eax, %esi
leaq 0x148(%rsp), %rdi
movl $0x1, %r8d
movl %r8d, %edx
movl %r8d, %ecx
callq 0xa0e90
movq 0xd0(%rsp), %rcx
movl (%rcx), %eax
movl 0x4(%rcx), %edx
imulq %rdx, %rax
movl 0x8(%rcx), %ecx
imulq %rcx, %rax
movq %rax, 0x140(%rsp)
cmpq $0x0, 0x140(%rsp)
jle 0xa0a54
movq 0x140(%rsp), %rax
movq %rax, 0x130(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0xa00b0
movq %rax, 0x138(%rsp)
movq 0x160(%rsp), %rax
movq %rax, 0x128(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x120(%rsp)
cmpq $0x0, 0x120(%rsp)
jbe 0xa09ef
movq 0x1b0(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x1b0(%rsp)
cvttsd2si (%rax), %ecx
movq 0x128(%rsp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, 0x128(%rsp)
movl %ecx, (%rax)
movq 0x120(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x120(%rsp)
jmp 0xa099a
movq 0x160(%rsp), %rdi
movq 0x138(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
callq 0xa11b0
jmp 0xa0a0e
movq 0x138(%rsp), %rcx
movq 0x140(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x140(%rsp)
jmp 0xa093e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x766d0
jmp 0xa0cb3
leaq 0x148(%rsp), %rdi
callq 0x766d0
jmp 0xa0c77
movq 0xd0(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jbe 0xa0ac8
movq 0xd0(%rsp), %rdi
movq 0x1b8(%rsp), %rax
movq %rax, 0x28(%rsp)
movl (%rdi), %eax
movl %eax, 0x34(%rsp)
movl 0x4(%rdi), %eax
movl %eax, 0x38(%rsp)
movl 0x8(%rdi), %eax
movl %eax, 0x3c(%rsp)
callq 0xa0cd0
movq 0x28(%rsp), %rdi
movl 0x34(%rsp), %edx
movl 0x38(%rsp), %ecx
movl 0x3c(%rsp), %r8d
movsd (%rax), %xmm0
leaq 0x4b6d7(%rip), %rsi     # 0xec196
movb $0x1, %al
callq 0x5750
jmp 0xa0b0e
movq 0xd0(%rsp), %rdi
movq 0x1b8(%rsp), %rax
movq %rax, 0x18(%rsp)
movl (%rdi), %eax
movl %eax, 0x20(%rsp)
movl 0x4(%rdi), %eax
movl %eax, 0x24(%rsp)
callq 0xa0cd0
movq 0x18(%rsp), %rdi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %ecx
movsd (%rax), %xmm0
leaq 0x4b69f(%rip), %rsi     # 0xec1a6
movb $0x1, %al
callq 0x5750
movq 0x1d0(%rsp), %rax
movl %eax, %esi
leaq 0x100(%rsp), %rdi
movl $0x1, %r8d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x31ac0
movq 0xd0(%rsp), %rcx
movl (%rcx), %eax
movl 0x4(%rcx), %edx
imulq %rdx, %rax
movl 0x8(%rcx), %ecx
imulq %rcx, %rax
movq %rax, 0xf8(%rsp)
cmpq $0x0, 0xf8(%rsp)
jle 0xa0c6a
movq 0xf8(%rsp), %rax
movq %rax, 0xe8(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0xa00b0
movq %rax, 0xf0(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0xd8(%rsp)
cmpq $0x0, 0xd8(%rsp)
jbe 0xa0c08
movq 0x1b0(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x1b0(%rsp)
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0xe0(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, 0xe0(%rsp)
movss %xmm0, (%rax)
movq 0xd8(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0xd8(%rsp)
jmp 0xa0bad
movq 0x118(%rsp), %rdi
movq 0xf0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
callq 0xa13e0
jmp 0xa0c27
movq 0xf0(%rsp), %rcx
movq 0xf8(%rsp), %rax
subq %rcx, %rax
movq %rax, 0xf8(%rsp)
jmp 0xa0b51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x31710
jmp 0xa0cb3
leaq 0x100(%rsp), %rdi
callq 0x31710
jmp 0xa0c79
jmp 0xa0c7b
cmpq $0x0, 0x1f0(%rsp)
jne 0xa0c93
movq 0x1b8(%rsp), %rdi
callq 0x5c6f0
movq 0xd0(%rsp), %rax
movq %rax, 0x200(%rsp)
movq 0x200(%rsp), %rax
addq $0x208, %rsp            # imm = 0x208
retq
movq 0x1e0(%rsp), %rdi
callq 0x5970