// File: manikandan5[P]Image-Matching-Stitching-Warping/./CImg.h
// Function: cimg_library::cimg::file_type(_IO_FILE*, char const*)
inline const char *file_type(std::FILE *const file, const char *const filename) {
      if (!file && !filename)
        throw CImgArgumentException("cimg::file_type(): Specified filename is (null).");
      static const char
        *const _pnm = "pnm",
        *const _pfm = "pfm",
        *const _bmp = "bmp",
        *const _gif = "gif",
        *const _jpg = "jpg",
        *const _off = "off",
        *const _pan = "pan",
        *const _png = "png",
        *const _tif = "tif",
        *const _inr = "inr",
        *const _dcm = "dcm";
      std::FILE *const nfile = file?file:cimg::fopen(filename,"rb");
      const char *f_type = 0, *head;
      char header[2048] = { 0 }, item[1024] = { 0 };
      const unsigned char *const uheader = (unsigned char*)header;
      int err; char cerr;
      const unsigned int siz = (unsigned int)std::fread(header,2048,1,nfile);   // Read first 2048 bytes.
      if (!file) cimg::fclose(nfile);

      if (!std::strncmp(header,"OFF\n",4)) f_type = _off; // OFF.
      else if (!std::strncmp(header,"#INRIMAGE",9)) f_type = _inr; // INRIMAGE.
      else if (!std::strncmp(header,"PANDORE",7)) f_type = _pan; // PANDORE.
      else if (!std::strncmp(header+128,"DICM",4)) f_type = _dcm; // DICOM.
      else if (uheader[0]==0xFF && uheader[1]==0xD8 && uheader[2]==0xFF) f_type = _jpg;  // JPEG.
      else if (header[0]=='B' && header[1]=='M') f_type = _bmp;  // BMP.
      else if (header[0]=='G' && header[1]=='I' && header[2]=='F' && header[3]=='8' && header[5]=='a' && // GIF.
               (header[4]=='7' || header[4]=='9')) f_type = _gif;
      else if (uheader[0]==0x89 && uheader[1]==0x50 && uheader[2]==0x4E && uheader[3]==0x47 &&  // PNG.
               uheader[4]==0x0D && uheader[5]==0x0A && uheader[6]==0x1A && uheader[7]==0x0A) f_type = _png;
      else if ((uheader[0]==0x49 && uheader[1]==0x49) || (uheader[0]==0x4D && uheader[1]==0x4D)) f_type = _tif; // TIFF.
      else { // PNM or PFM.
        head = header;
        while (head<header+siz && (err=std::sscanf(head,"%1023[^\n]",item))!=EOF && (*item=='#' || !err))
          head+=1+(err?std::strlen(item):0);
        if (std::sscanf(item," P%d",&err)==1) f_type = _pnm;
        else if (std::sscanf(item," P%c",&cerr)==1 && (cerr=='f' || cerr=='F')) f_type = _pfm;
      }
      return f_type;
    }

// Assembly:
subq $0xc78, %rsp            # imm = 0xC78
movq %rdi, 0xc70(%rsp)
movq %rsi, 0xc68(%rsp)
cmpq $0x0, 0xc70(%rsp)
jne 0x656fd
cmpq $0x0, 0xc68(%rsp)
jne 0x656fd
movl $0x4008, %edi           # imm = 0x4008
callq 0x5240
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x20(%rsp)
leaq 0x8597c(%rip), %rsi     # 0xeb035
xorl %eax, %eax
callq 0x12220
jmp 0x656c2
movq 0x20(%rsp), %rdi
leaq 0x9a492(%rip), %rsi     # 0xffb60
leaq -0x53275(%rip), %rdx    # 0x12460
callq 0x5920
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc60(%rsp)
movl %eax, 0xc5c(%rsp)
callq 0x53a0
jmp 0x65b93
cmpq $0x0, 0xc70(%rsp)
je 0x65717
movq 0xc70(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x65730
movq 0xc68(%rsp), %rdi
leaq 0x83a38(%rip), %rsi     # 0xe915e
callq 0x654a0
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0xc50(%rsp)
movq $0x0, 0xc48(%rsp)
leaq 0x440(%rsp), %rdi
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x52a0
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x52a0
leaq 0x440(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x440(%rsp), %rdi
movq 0xc50(%rsp), %rcx
movl $0x800, %esi            # imm = 0x800
movl $0x1, %edx
callq 0x57d0
movl %eax, 0x2c(%rsp)
cmpq $0x0, 0xc70(%rsp)
jne 0x657b6
movq 0xc50(%rsp), %rdi
callq 0x5c6f0
leaq 0x440(%rsp), %rdi
leaq 0x858a5(%rip), %rsi     # 0xeb06a
movl $0x4, %edx
callq 0x5230
cmpl $0x0, %eax
jne 0x657e8
leaq 0x8588b(%rip), %rax     # 0xeb066
movq %rax, 0xc48(%rsp)
jmp 0x65b83
leaq 0x440(%rsp), %rdi
leaq 0x85878(%rip), %rsi     # 0xeb06f
movl $0x9, %edx
callq 0x5230
cmpl $0x0, %eax
jne 0x6581a
leaq 0x838d8(%rip), %rax     # 0xe90e5
movq %rax, 0xc48(%rsp)
jmp 0x65b81
leaq 0x440(%rsp), %rdi
leaq 0x8514d(%rip), %rsi     # 0xea976
movl $0x7, %edx
callq 0x5230
cmpl $0x0, %eax
jne 0x6584c
leaq 0x838aa(%rip), %rax     # 0xe90e9
movq %rax, 0xc48(%rsp)
jmp 0x65b7f
leaq 0x440(%rsp), %rdi
addq $0x80, %rdi
leaq 0x85817(%rip), %rsi     # 0xeb079
movl $0x4, %edx
callq 0x5230
cmpl $0x0, %eax
jne 0x65885
leaq 0x8385b(%rip), %rax     # 0xe90d3
movq %rax, 0xc48(%rsp)
jmp 0x65b7d
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
jne 0x658c8
movq 0x38(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xd8, %eax
jne 0x658c8
movq 0x38(%rsp), %rax
movzbl 0x2(%rax), %eax
cmpl $0xff, %eax
jne 0x658c8
leaq 0x64180(%rip), %rax     # 0xc9a3b
movq %rax, 0xc48(%rsp)
jmp 0x65b7b
movsbl 0x440(%rsp), %eax
cmpl $0x42, %eax
jne 0x658f6
movsbl 0x441(%rsp), %eax
cmpl $0x4d, %eax
jne 0x658f6
leaq 0x8378b(%rip), %rax     # 0xe9074
movq %rax, 0xc48(%rsp)
jmp 0x65b79
movsbl 0x440(%rsp), %eax
cmpl $0x47, %eax
jne 0x65965
movsbl 0x441(%rsp), %eax
cmpl $0x49, %eax
jne 0x65965
movsbl 0x442(%rsp), %eax
cmpl $0x46, %eax
jne 0x65965
movsbl 0x443(%rsp), %eax
cmpl $0x38, %eax
jne 0x65965
movsbl 0x445(%rsp), %eax
cmpl $0x61, %eax
jne 0x65965
movsbl 0x444(%rsp), %eax
cmpl $0x37, %eax
je 0x65951
movsbl 0x444(%rsp), %eax
cmpl $0x39, %eax
jne 0x65965
leaq 0x83777(%rip), %rax     # 0xe90cf
movq %rax, 0xc48(%rsp)
jmp 0x65b77
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x89, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x50, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x4e, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x3(%rax), %eax
cmpl $0x47, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x4(%rax), %eax
cmpl $0xd, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x5(%rax), %eax
cmpl $0xa, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x6(%rax), %eax
cmpl $0x1a, %eax
jne 0x659ea
movq 0x38(%rsp), %rax
movzbl 0x7(%rax), %eax
cmpl $0xa, %eax
jne 0x659ea
leaq 0x8464c(%rip), %rax     # 0xea029
movq %rax, 0xc48(%rsp)
jmp 0x65b75
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x49, %eax
jne 0x65a05
movq 0x38(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x49, %eax
je 0x65a20
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x4d, %eax
jne 0x65a34
movq 0x38(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x4d, %eax
jne 0x65a34
leaq 0x83673(%rip), %rax     # 0xe909a
movq %rax, 0xc48(%rsp)
jmp 0x65b73
leaq 0x440(%rsp), %rax
movq %rax, 0xc40(%rsp)
movq 0xc40(%rsp), %rcx
leaq 0x440(%rsp), %rdx
movl 0x2c(%rsp), %eax
addq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x17(%rsp)
jae 0x65ab8
movq 0xc40(%rsp), %rdi
leaq 0x40(%rsp), %rdx
leaq 0x85604(%rip), %rsi     # 0xeb07e
movb $0x0, %al
callq 0x5510
movl %eax, %ecx
movl %ecx, 0x34(%rsp)
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, 0x17(%rsp)
je 0x65ab8
movsbl 0x40(%rsp), %ecx
movb $0x1, %al
cmpl $0x23, %ecx
movb %al, 0x16(%rsp)
je 0x65ab0
cmpl $0x0, 0x34(%rsp)
setne %al
xorb $-0x1, %al
movb %al, 0x16(%rsp)
movb 0x16(%rsp), %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x65ac2
jmp 0x65b01
cmpl $0x0, 0x34(%rsp)
je 0x65ada
leaq 0x40(%rsp), %rdi
callq 0x5210
movq %rax, 0x8(%rsp)
jmp 0x65ae3
xorl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x65ae3
movq 0x8(%rsp), %rax
addq $0x1, %rax
addq 0xc40(%rsp), %rax
movq %rax, 0xc40(%rsp)
jmp 0x65a44
leaq 0x40(%rsp), %rdi
leaq 0x8557b(%rip), %rsi     # 0xeb088
leaq 0x34(%rsp), %rdx
movb $0x0, %al
callq 0x5510
cmpl $0x1, %eax
jne 0x65b2f
leaq 0x85868(%rip), %rax     # 0xeb38d
movq %rax, 0xc48(%rsp)
jmp 0x65b71
leaq 0x40(%rsp), %rdi
leaq 0x840a6(%rip), %rsi     # 0xe9be1
leaq 0x33(%rsp), %rdx
movb $0x0, %al
callq 0x5510
cmpl $0x1, %eax
jne 0x65b6f
movsbl 0x33(%rsp), %eax
cmpl $0x66, %eax
je 0x65b60
movsbl 0x33(%rsp), %eax
cmpl $0x46, %eax
jne 0x65b6f
leaq 0x8352f(%rip), %rax     # 0xe9096
movq %rax, 0xc48(%rsp)
jmp 0x65b71
jmp 0x65b73
jmp 0x65b75
jmp 0x65b77
jmp 0x65b79
jmp 0x65b7b
jmp 0x65b7d
jmp 0x65b7f
jmp 0x65b81
jmp 0x65b83
movq 0xc48(%rsp), %rax
addq $0xc78, %rsp            # imm = 0xC78
retq
movq 0xc60(%rsp), %rdi
callq 0x5970