// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x2cd87
movq %rsi, %r15
cmpl %ecx, %edx
movl %ecx, %eax
cmovbl %edx, %eax
cmoval %edx, %ecx
cmpl $0x1, %r8d
ja 0x2cde4
testl %eax, %eax
jne 0x2cde4
cmpl $-0x1, %ecx
jne 0x2cde4
movq %r14, %rdi
movq %r15, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2e0d4
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
leaq 0x27a3e(%rip), %rax     # 0x547e8
leaq 0x28e11(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%r14)
cmovneq %rax, %r10
subq $0x8, %rsp
leaq 0x482da(%rip), %r11     # 0x7509f
leaq 0x49027(%rip), %rsi     # 0x75df3
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
pushq 0x18(%r14)
callq 0x9d52
addq $0x20, %rsp
jmp 0x2ce3d
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
movl (%r14), %edx
movl 0x4(%r14), %ecx
movl 0x8(%r14), %r8d
movl 0xc(%r14), %r9d
leaq 0x279e1(%rip), %rax     # 0x547e8
leaq 0x28db4(%rip), %r10     # 0x55bc2
cmpb $0x0, 0x10(%r14)
cmovneq %rax, %r10
leaq 0x48281(%rip), %r11     # 0x7509f
leaq 0x49027(%rip), %rsi     # 0x75e4c
movq %rbx, %rdi
xorl %eax, %eax
pushq %r15
pushq %r11
pushq %r10
pushq 0x18(%r14)
callq 0x9d52
addq $0x20, %rsp
leaq 0x62e1c(%rip), %rsi     # 0x8fc60
movq 0x6318d(%rip), %rdx     # 0x8ffd8
movq %rbx, %rdi
callq 0x4910
jmp 0x2ce55
movq %rax, %r14
movq %rbx, %rdi
callq 0x4390
movq %r14, %rdi
callq 0x4950