// File: /workspace/github_cpp_makefile_star2_O2/kallaballa[P]PixelStencil/./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; // Check for OFF format.
      else if (!std::strncmp(header,"#INRIMAGE",9)) f_type = _inr; // Check for INRIMAGE format.
      else if (!std::strncmp(header,"PANDORE",7)) f_type = _pan; // Check for PANDORE format.
      else if (!std::strncmp(header+128,"DICM",4)) f_type = _dcm; // Check for DICOM format.
      else if (uheader[0]==0xFF && uheader[1]==0xD8 && uheader[2]==0xFF) f_type = _jpg;  // Check for JPEG format.
      else if (header[0]=='B' && header[1]=='M') f_type = _bmp;  // Check for BMP format.
      else if (header[0]=='G' && header[1]=='I' && header[2]=='F' && header[3]=='8' && header[5]=='a' && // Check for GIF format.
               (header[4]=='7' || header[4]=='9')) f_type = _gif;
      else if (uheader[0]==0x89 && uheader[1]==0x50 && uheader[2]==0x4E && uheader[3]==0x47 &&  // Check for PNG format.
               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; // Check for TIFF format.
      else { // Check for PNM or PFM format.
        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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc18, %rsp            # imm = 0xC18
movq %rdi, %rax
orq %rsi, %rax
je 0x6cf1
movq %rdi, %r14
movq %rdi, %r12
testq %rdi, %rdi
jne 0x6a3b
leaq 0x1bbab(%rip), %rax     # 0x225d8
movq %rsi, %rdi
movq %rax, %rsi
callq 0x6909
movq %rax, %r12
leaq 0x410(%rsp), %r15
movl $0x800, %edx            # imm = 0x800
movq %r15, %rdi
xorl %esi, %esi
callq 0x3150
leaq 0x10(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x3150
pushq $0x1
popq %rbx
movl $0x800, %esi            # imm = 0x800
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x3420
movq %rax, %r15
testq %r14, %r14
jne 0x6a89
movq %r12, %rdi
callq 0x7982
movl 0x410(%rsp), %ebp
cmpl $0xa46464f, %ebp        # imm = 0xA46464F
jne 0x6aa4
leaq 0x1e509(%rip), %r12     # 0x24fa8
jmp 0x6cdc
leaq 0x1e501(%rip), %rsi     # 0x24fac
leaq 0x410(%rsp), %rdi
pushq $0x9
popq %rdx
callq 0x32d0
testl %eax, %eax
je 0x6af6
leaq 0x1ddd5(%rip), %rsi     # 0x2489b
leaq 0x410(%rsp), %r14
pushq $0x7
popq %rdx
movq %r14, %rdi
callq 0x32d0
testl %eax, %eax
je 0x6b02
cmpl $0x4d434944, 0x490(%rsp) # imm = 0x4D434944
jne 0x6b0e
leaq 0x1ba5f(%rip), %r12     # 0x22550
jmp 0x6cdc
leaq 0x1ba65(%rip), %r12     # 0x22562
jmp 0x6cdc
leaq 0x1ba5d(%rip), %r12     # 0x22566
jmp 0x6cdc
movl %ebp, %eax
shrl $0x8, %eax
movl %ebp, %edx
shrl $0x10, %edx
movl %eax, %ecx
xorb $-0x28, %cl
movl %ebp, %esi
andb %dl, %sil
notb %sil
orb %cl, %sil
jne 0x6b36
leaq 0x1b9c0(%rip), %r12     # 0x224f1
jmp 0x6cdc
movl %ebp, %esi
xorb $0x42, %sil
movl %eax, %ecx
xorb $0x4d, %cl
orb %cl, %sil
jne 0x6b52
leaq 0x1b9a0(%rip), %r12     # 0x224ed
jmp 0x6cdc
movl %ebp, %esi
shrl $0x18, %esi
movl %ebp, %edi
xorb $0x47, %dil
cmpb $0x49, %al
sete %r8b
movl %edx, %r9d
xorb $0x46, %r9b
orb %dil, %r9b
sete %dil
cmpl $0x38, %esi
sete %r9b
andb %r8b, %r9b
andb %dil, %r9b
movb 0x415(%rsp), %dil
cmpb $0x61, %dil
sete %r10b
andb %r9b, %r10b
movzbl 0x414(%rsp), %r8d
cmpb $0x1, %r10b
jne 0x6bbb
leaq 0x1b9a5(%rip), %r12     # 0x2254c
cmpl $0x37, %r8d
je 0x6cdc
cmpl $0x39, %r8d
je 0x6cdc
cmpb $-0x77, %bpl
jne 0x6bfb
cmpb $0x50, %al
jne 0x6bfb
cmpb $0x4e, %dl
jne 0x6bfb
cmpl $0x47, %esi
jne 0x6bfb
cmpb $0xd, %r8b
jne 0x6bfb
cmpb $0xa, %dil
jne 0x6bfb
cmpb $0x1a, 0x416(%rsp)
jne 0x6bfb
cmpb $0xa, 0x417(%rsp)
jne 0x6bfb
leaq 0x1d358(%rip), %r12     # 0x23f4e
jmp 0x6cdc
xorb $0x49, %al
movl %ebp, %edx
xorb $0x49, %dl
xorb $0x4d, %bpl
orb %cl, %bpl
sete %cl
orb %al, %dl
leaq 0x1b902(%rip), %r12     # 0x22517
je 0x6cdc
testb %cl, %cl
jne 0x6cdc
movl %r15d, %eax
leaq (%rsp,%rax), %r13
addq $0x410, %r13            # imm = 0x410
leaq 0x1cc95(%rip), %r15     # 0x238cd
leaq 0x10(%rsp), %r12
cmpq %r13, %r14
jae 0x6c80
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3280
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x6c80
testl %eax, %eax
je 0x6c66
cmpb $0x23, 0x10(%rsp)
jne 0x6c80
movq %rbx, %rcx
testl %eax, %eax
je 0x6c7b
movq %r12, %rdi
callq 0x30e0
movq %rax, %rcx
incq %rcx
addq %rcx, %r14
jmp 0x6c3d
leaq 0x1e32f(%rip), %rsi     # 0x24fb6
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x3280
cmpl $0x1, %eax
jne 0x6ca6
leaq 0x1e5ff(%rip), %r12     # 0x252a3
jmp 0x6cdc
leaq 0x1cde0(%rip), %rsi     # 0x23a8d
xorl %r12d, %r12d
leaq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
xorl %eax, %eax
callq 0x3280
cmpl $0x1, %eax
jne 0x6cdc
movb 0xb(%rsp), %al
andb $-0x21, %al
xorl %r12d, %r12d
cmpb $0x46, %al
leaq 0x1b83b(%rip), %rax     # 0x22513
cmoveq %rax, %r12
movq %r12, %rax
addq $0xc18, %rsp            # imm = 0xC18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x3110
movq %rax, %rbx
leaq 0x1e272(%rip), %rsi     # 0x24f77
movq %rax, %rdi
xorl %eax, %eax
callq 0x531a
leaq 0x28fb2(%rip), %rsi     # 0x2fcc8
movq 0x292bb(%rip), %rdx     # 0x2ffd8
movq %rbx, %rdi
callq 0x34e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x31d0
movq %r14, %rdi
callq 0x3500