// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc18, %rsp            # imm = 0xC18
movq %rdi, %rax
orq %rsi, %rax
je 0x8ede
movq %rdi, %r12
movq %rdi, %r15
testq %rdi, %rdi
jne 0x8be6
leaq 0x24a30(%rip), %rax     # 0x2d608
movq %rsi, %rdi
movq %rax, %rsi
callq 0x8ab7
movq %rax, %r15
leaq 0x10(%rsp), %rbx
movl $0x800, %edx            # imm = 0x800
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3150
leaq 0x810(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x3150
movl $0x800, %esi            # imm = 0x800
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rcx
callq 0x3410
movq %rax, %r14
testq %r12, %r12
je 0x8c8e
movl 0x10(%rsp), %eax
cmpl $0xa46464f, %eax        # imm = 0xA46464F
jne 0x8c42
leaq 0x2739b(%rip), %r15     # 0x2ffd8
jmp 0x8ecc
movabsq $0x47414d49524e4923, %rcx # imm = 0x47414D49524E4923
xorq 0x10(%rsp), %rcx
movzbl 0x18(%rsp), %edx
xorq $0x45, %rdx
orq %rcx, %rdx
je 0x8cd0
movl $0x444e4150, %ecx       # imm = 0x444E4150
xorl 0x10(%rsp), %ecx
movl $0x45524f44, %edx       # imm = 0x45524F44
xorl 0x13(%rsp), %edx
orl %ecx, %edx
je 0x8cef
cmpl $0x4d434944, 0x90(%rsp) # imm = 0x4D434944
jne 0x8cfb
leaq 0x248f7(%rip), %r15     # 0x2d580
jmp 0x8ecc
testq %r15, %r15
je 0x8cdc
movq 0x31326(%rip), %rax     # 0x39fc0
cmpq %r15, (%rax)
je 0x8c2b
movq 0x312f2(%rip), %rax     # 0x39f98
cmpq %r15, (%rax)
je 0x8c2b
movq %r15, %rdi
callq 0x32b0
testl %eax, %eax
je 0x8c2b
leaq 0x24ed2(%rip), %rdi     # 0x2db94
movl %eax, %esi
xorl %eax, %eax
callq 0x9db1
jmp 0x8c2b
leaq 0x248bb(%rip), %r15     # 0x2d592
jmp 0x8ecc
leaq 0x24e87(%rip), %rdi     # 0x2db6a
xorl %eax, %eax
callq 0x9db1
jmp 0x8c2b
leaq 0x248a0(%rip), %r15     # 0x2d596
jmp 0x8ecc
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 0x8d23
leaq 0x24803(%rip), %r15     # 0x2d521
jmp 0x8ecc
movl %eax, %edi
xorb $0x42, %dil
movl %ecx, %edx
xorb $0x4d, %dl
orb %dl, %dil
jne 0x8d3f
leaq 0x247e3(%rip), %r15     # 0x2d51d
jmp 0x8ecc
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 0x8da4
leaq 0x247ec(%rip), %r15     # 0x2d57c
cmpl $0x37, %r9d
je 0x8ecc
cmpl $0x39, %r9d
je 0x8ecc
cmpb $-0x77, %al
jne 0x8dde
cmpb $0x50, %cl
jne 0x8dde
cmpb $0x4e, %sil
jne 0x8dde
cmpl $0x47, %edi
jne 0x8dde
cmpb $0xd, %r9b
jne 0x8dde
cmpb $0xa, %r8b
jne 0x8dde
cmpb $0x1a, 0x16(%rsp)
jne 0x8dde
cmpb $0xa, 0x17(%rsp)
jne 0x8dde
leaq 0x261a5(%rip), %r15     # 0x2ef7e
jmp 0x8ecc
xorb $0x49, %cl
movl %eax, %esi
xorb $0x49, %sil
xorb $0x4d, %al
orb %dl, %al
sete %al
orb %cl, %sil
leaq 0x2474f(%rip), %r15     # 0x2d547
je 0x8ecc
testb %al, %al
jne 0x8ecc
movl %r14d, %eax
testq %rax, %rax
je 0x8e6a
leaq (%rsp,%rax), %r12
addq $0x10, %r12
leaq 0x25ae0(%rip), %r14     # 0x2e8fd
leaq 0x810(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x32a0
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x8e6a
testl %eax, %eax
je 0x8e4c
cmpb $0x23, 0x810(%rsp)
jne 0x8e6a
testl %eax, %eax
je 0x8e5d
movq %r15, %rdi
callq 0x3100
incq %rax
jmp 0x8e62
movl $0x1, %eax
addq %rax, %rbx
cmpq %r12, %rbx
jb 0x8e25
leaq 0x27175(%rip), %rsi     # 0x2ffe6
leaq 0x810(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x32a0
cmpl $0x1, %eax
jne 0x8e93
leaq 0x27442(%rip), %r15     # 0x302d3
jmp 0x8ecc
leaq 0x25c23(%rip), %rsi     # 0x2eabd
xorl %r15d, %r15d
leaq 0x810(%rsp), %rdi
leaq 0xb(%rsp), %rdx
xorl %eax, %eax
callq 0x32a0
cmpl $0x1, %eax
jne 0x8ecc
movb 0xb(%rsp), %al
andb $-0x21, %al
xorl %r15d, %r15d
cmpb $0x46, %al
leaq 0x2467b(%rip), %rax     # 0x2d543
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 0x3110
movq %rax, %rbx
leaq 0x270b5(%rip), %rsi     # 0x2ffa7
movq %rax, %rdi
xorl %eax, %eax
callq 0x6378
leaq 0x30db5(%rip), %rsi     # 0x39cb8
movq 0x310ce(%rip), %rdx     # 0x39fd8
movq %rbx, %rdi
callq 0x34b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x31e0
movq %r14, %rdi
callq 0x34d0
nop