// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::CImg<double>::load_tiff(char const*, unsigned int, unsigned int, unsigned int, float*, cimg_library::CImg<char>*)
CImg<T>& load_tiff(const char *const filename,
                       const unsigned int first_frame=0, const unsigned int last_frame=~0U,
                       const unsigned int step_frame=1,
                       float *const voxel_size=0,
                       CImg<charT> *const description=0) {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "load_tiff(): Specified filename is (null).",
                                    cimg_instance);

      const unsigned int
        nfirst_frame = first_frame<last_frame?first_frame:last_frame,
        nstep_frame = step_frame?step_frame:1;
      unsigned int nlast_frame = first_frame<last_frame?last_frame:first_frame;

#ifndef cimg_use_tiff
      cimg::unused(voxel_size,description);
      if (nfirst_frame || nlast_frame!=~0U || nstep_frame>1)
        throw CImgArgumentException(_cimg_instance
                                    "load_tiff(): Unable to read sub-images from file '%s' unless libtiff is enabled.",
                                    cimg_instance,
                                    filename);
      return load_other(filename);
#else
      TIFF *tif = TIFFOpen(filename,"r");
      if (tif) {
        unsigned int nb_images = 0;
        do ++nb_images; while (TIFFReadDirectory(tif));
        if (nfirst_frame>=nb_images || (nlast_frame!=~0U && nlast_frame>=nb_images))
          cimg::warn(_cimg_instance
                     "load_tiff(): File '%s' contains %u image(s) while specified frame range is [%u,%u] (step %u).",
                     cimg_instance,
                     filename,nb_images,nfirst_frame,nlast_frame,nstep_frame);

        if (nfirst_frame>=nb_images) return assign();
        if (nlast_frame>=nb_images) nlast_frame = nb_images-1;
        TIFFSetDirectory(tif,0);
        CImg<T> frame;
        for (unsigned int l = nfirst_frame; l<=nlast_frame; l+=nstep_frame) {
          frame._load_tiff(tif,l,voxel_size,description);
          if (l==nfirst_frame)
            assign(frame._width,frame._height,1+(nlast_frame-nfirst_frame)/nstep_frame,frame._spectrum);
          if (frame._width>_width || frame._height>_height || frame._spectrum>_spectrum)
            resize(cimg::max(frame._width,_width),
                   cimg::max(frame._height,_height),-100,
                   cimg::max(frame._spectrum,_spectrum),0);
          draw_image(0,0,(l-nfirst_frame)/nstep_frame,frame);
        }
        TIFFClose(tif);
      } else throw CImgIOException(_cimg_instance
                                   "load_tiff(): Failed to open file '%s'.",
                                   cimg_instance,
                                   filename);
      return *this;
#endif
    }

// Assembly:
pushq %rbx
subq $0xe0, %rsp
movq 0xf0(%rsp), %rax
movq %rdi, 0xd8(%rsp)
movq %rsi, 0xd0(%rsp)
movl %edx, 0xcc(%rsp)
movl %ecx, 0xc8(%rsp)
movl %r8d, 0xc4(%rsp)
movq %r9, 0xb8(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x98(%rsp)
cmpq $0x0, 0xd0(%rsp)
jne 0x636f5
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x98(%rsp), %rax
movq %rcx, 0x68(%rsp)
movl (%rax), %ecx
movl %ecx, 0x70(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x74(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x78(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x7c(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x80(%rsp)
movb 0x10(%rax), %dl
leaq 0x8538a(%rip), %rcx     # 0xe89d2
leaq 0x66492(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x88(%rsp)
callq 0x118f0
movq %rax, 0x90(%rsp)
jmp 0x6366d
movl 0x7c(%rsp), %r9d
movl 0x78(%rsp), %r8d
movl 0x74(%rsp), %ecx
movl 0x70(%rsp), %edx
movq 0x68(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %r10
movq 0x90(%rsp), %r11
movq %rsp, %rax
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x86665(%rip), %rsi     # 0xe9d16
xorl %eax, %eax
callq 0x12220
jmp 0x636ba
movq 0x68(%rsp), %rdi
leaq 0x9c49a(%rip), %rsi     # 0xffb60
leaq -0x5126d(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x68(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
callq 0x53a0
jmp 0x638ce
movl 0xcc(%rsp), %eax
cmpl 0xc8(%rsp), %eax
jae 0x63712
movl 0xcc(%rsp), %eax
movl %eax, 0x64(%rsp)
jmp 0x6371d
movl 0xc8(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
movl %eax, 0xa8(%rsp)
cmpl $0x0, 0xc4(%rsp)
je 0x6373f
movl 0xc4(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0x6374a
movl $0x1, %eax
movl %eax, 0x60(%rsp)
jmp 0x6374a
movl 0x60(%rsp), %eax
movl %eax, 0xa4(%rsp)
movl 0xcc(%rsp), %eax
cmpl 0xc8(%rsp), %eax
jae 0x63772
movl 0xc8(%rsp), %eax
movl %eax, 0x5c(%rsp)
jmp 0x6377d
movl 0xcc(%rsp), %eax
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, 0xa0(%rsp)
movq 0xf0(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
movb $0x0, %al
callq 0x7ab30
cmpl $0x0, 0xa8(%rsp)
jne 0x637c1
cmpl $-0x1, 0xa0(%rsp)
jne 0x637c1
cmpl $0x1, 0xa4(%rsp)
jbe 0x638b0
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rcx
movq 0x98(%rsp), %rax
movq %rcx, 0x28(%rsp)
movl (%rax), %ecx
movl %ecx, 0x30(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x34(%rsp)
movl 0x8(%rax), %ecx
movl %ecx, 0x38(%rsp)
movl 0xc(%rax), %ecx
movl %ecx, 0x3c(%rsp)
movq 0x18(%rax), %rcx
movq %rcx, 0x40(%rsp)
movb 0x10(%rax), %dl
leaq 0x851c9(%rip), %rcx     # 0xe89d2
leaq 0x662d1(%rip), %rax     # 0xc9ae1
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, 0x48(%rsp)
callq 0x118f0
movq %rax, 0x50(%rsp)
jmp 0x63828
movl 0x3c(%rsp), %r9d
movl 0x38(%rsp), %r8d
movl 0x34(%rsp), %ecx
movl 0x30(%rsp), %edx
movq 0x28(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %r10
movq 0x50(%rsp), %r11
movq 0xd0(%rsp), %rbx
movq %rsp, %rax
movq %rbx, 0x18(%rax)
movq %r11, 0x10(%rax)
movq %r10, 0x8(%rax)
movq %rsi, (%rax)
leaq 0x86500(%rip), %rsi     # 0xe9d6f
xorl %eax, %eax
callq 0x12220
jmp 0x63878
movq 0x28(%rsp), %rdi
leaq 0x9c2dc(%rip), %rsi     # 0xffb60
leaq -0x5142b(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
callq 0x53a0
jmp 0x638ce
movq 0x98(%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x65ba0
addq $0xe0, %rsp
popq %rbx
retq
movq 0xb0(%rsp), %rdi
callq 0x5970
nopl (%rax,%rax)