// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc18, %rsp            # imm = 0xC18
movq %rdi, %rax
orq %rsi, %rax
je 0x3b538
movq %rdi, %r12
movq %rdi, %r15
testq %rdi, %rdi
jne 0x3b240
leaq 0x540b3(%rip), %rax     # 0x8f2e5
movq %rsi, %rdi
movq %rax, %rsi
callq 0x3b111
movq %rax, %r15
leaq 0x10(%rsp), %rbx
movl $0x800, %edx            # imm = 0x800
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4290
leaq 0x810(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4290
movl $0x800, %esi            # imm = 0x800
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x47d0
movq %rax, %r14
testq %r12, %r12
je 0x3b2e8
movl 0x10(%rsp), %eax
cmpl $0xa46464f, %eax        # imm = 0xA46464F
jne 0x3b29c
leaq 0x55f54(%rip), %r15     # 0x911eb
jmp 0x3b526
movabsq $0x47414d49524e4923, %rcx # imm = 0x47414D49524E4923
xorq 0x10(%rsp), %rcx
movzbl 0x18(%rsp), %edx
xorq $0x45, %rdx
orq %rcx, %rdx
je 0x3b32a
movl $0x444e4150, %ecx       # imm = 0x444E4150
xorl 0x10(%rsp), %ecx
movl $0x45524f44, %edx       # imm = 0x45524F44
xorl 0x13(%rsp), %edx
orl %ecx, %edx
je 0x3b349
cmpl $0x4d434944, 0x90(%rsp) # imm = 0x4D434944
jne 0x3b355
leaq 0x53f77(%rip), %r15     # 0x8f25a
jmp 0x3b526
testq %r15, %r15
je 0x3b336
movq 0x6ccb4(%rip), %rax     # 0xa7fa8
cmpq %r15, (%rax)
je 0x3b285
movq 0x6cc88(%rip), %rax     # 0xa7f88
cmpq %r15, (%rax)
je 0x3b285
movq %r15, %rdi
callq 0x4550
testl %eax, %eax
je 0x3b285
leaq 0x53ce0(%rip), %rdi     # 0x8effc
movl %eax, %esi
xorl %eax, %eax
callq 0xbb10
jmp 0x3b285
leaq 0x53f3b(%rip), %r15     # 0x8f26c
jmp 0x3b526
leaq 0x53c95(%rip), %rdi     # 0x8efd2
xorl %eax, %eax
callq 0xbb10
jmp 0x3b285
leaq 0x53f20(%rip), %r15     # 0x8f270
jmp 0x3b526
movl %eax, %ecx
shrl $0x8, %ecx
movl %eax, %esi
shrl $0x10, %esi
movl %ecx, %edx
xorb $-0x28, %dl
movl %eax, %edi
andb %sil, %dil
notb %dil
orb %dl, %dil
jne 0x3b37d
leaq 0x34824(%rip), %r15     # 0x6fb9c
jmp 0x3b526
movl %eax, %edi
xorb $0x42, %dil
movl %ecx, %edx
xorb $0x4d, %dl
orb %dl, %dil
jne 0x3b399
leaq 0x53e67(%rip), %r15     # 0x8f1fb
jmp 0x3b526
movl %eax, %edi
shrl $0x18, %edi
movl %eax, %r8d
xorb $0x47, %r8b
cmpb $0x49, %cl
sete %r9b
movl %esi, %r10d
xorb $0x46, %r10b
orb %r8b, %r10b
sete %r8b
cmpl $0x38, %edi
sete %r10b
andb %r9b, %r10b
andb %r8b, %r10b
movb 0x15(%rsp), %r8b
cmpb $0x61, %r8b
sete %r11b
andb %r10b, %r11b
movzbl 0x14(%rsp), %r9d
cmpb $0x1, %r11b
jne 0x3b3fe
leaq 0x53e6c(%rip), %r15     # 0x8f256
cmpl $0x37, %r9d
je 0x3b526
cmpl $0x39, %r9d
je 0x3b526
cmpb $-0x77, %al
jne 0x3b438
cmpb $0x50, %cl
jne 0x3b438
cmpb $0x4e, %sil
jne 0x3b438
cmpl $0x47, %edi
jne 0x3b438
cmpb $0xd, %r9b
jne 0x3b438
cmpb $0xa, %r8b
jne 0x3b438
cmpb $0x1a, 0x16(%rsp)
jne 0x3b438
cmpb $0xa, 0x17(%rsp)
jne 0x3b438
leaq 0x54d7b(%rip), %r15     # 0x901ae
jmp 0x3b526
xorb $0x49, %cl
movl %eax, %esi
xorb $0x49, %sil
xorb $0x4d, %al
orb %dl, %al
sete %al
orb %cl, %sil
leaq 0x53dcf(%rip), %r15     # 0x8f221
je 0x3b526
testb %al, %al
jne 0x3b526
movl %r14d, %eax
testq %rax, %rax
je 0x3b4c4
leaq (%rsp,%rax), %r12
addq $0x10, %r12
leaq 0x55d82(%rip), %r14     # 0x911f9
leaq 0x810(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4540
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x3b4c4
testl %eax, %eax
je 0x3b4a6
cmpb $0x23, 0x810(%rsp)
jne 0x3b4c4
testl %eax, %eax
je 0x3b4b7
movq %r15, %rdi
callq 0x41e0
incq %rax
jmp 0x3b4bc
movl $0x1, %eax
addq %rax, %rbx
cmpq %r12, %rbx
jb 0x3b47f
leaq 0x55d38(%rip), %rsi     # 0x91203
leaq 0x810(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x4540
cmpl $0x1, %eax
jne 0x3b4ed
leaq 0x5601d(%rip), %r15     # 0x91508
jmp 0x3b526
leaq 0x54874(%rip), %rsi     # 0x8fd68
xorl %r15d, %r15d
leaq 0x810(%rsp), %rdi
leaq 0xb(%rsp), %rdx
xorl %eax, %eax
callq 0x4540
cmpl $0x1, %eax
jne 0x3b526
movb 0xb(%rsp), %al
andb $-0x21, %al
xorl %r15d, %r15d
cmpb $0x46, %al
leaq 0x53cfb(%rip), %rax     # 0x8f21d
cmoveq %rax, %r15
movq %r15, %rax
addq $0xc18, %rsp            # imm = 0xC18
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x4210
movq %rax, %rbx
leaq 0x55c6e(%rip), %rsi     # 0x911ba
movq %rax, %rdi
xorl %eax, %eax
callq 0xc16a
leaq 0x6c6f3(%rip), %rsi     # 0xa7c50
movq 0x6ca6c(%rip), %rdx     # 0xa7fd0
movq %rbx, %rdi
callq 0x4910
movq %rax, %r14
movq %rbx, %rdi
callq 0x43c0
movq %r14, %rdi
callq 0x4960
nop