// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0xc10, %rsp            # imm = 0xC10
movq %rdi, %rax
orq %rsi, %rax
je 0x8a89
movq %rdi, %r12
movq %rdi, %r15
testq %rdi, %rdi
jne 0x8799
leaq 0x24dfd(%rip), %rax     # 0x2d588
movq %rsi, %rdi
movq %rax, %rsi
callq 0x8669
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 0x8840
cmpl $0xa46464f, 0x10(%rsp)  # imm = 0xA46464F
jne 0x87f4
leaq 0x27769(%rip), %r15     # 0x2ff58
jmp 0x8a76
movabsq $0x47414d49524e4923, %rax # imm = 0x47414D49524E4923
xorq 0x10(%rsp), %rax
movzbl 0x18(%rsp), %ecx
xorq $0x45, %rcx
orq %rax, %rcx
je 0x8882
movl $0x444e4150, %eax       # imm = 0x444E4150
xorl 0x10(%rsp), %eax
movl $0x45524f44, %ecx       # imm = 0x45524F44
xorl 0x13(%rsp), %ecx
orl %eax, %ecx
je 0x88a1
cmpl $0x4d434944, 0x90(%rsp) # imm = 0x4D434944
jne 0x88ad
leaq 0x24cc5(%rip), %r15     # 0x2d500
jmp 0x8a76
testq %r15, %r15
je 0x888e
movq 0x31774(%rip), %rax     # 0x39fc0
cmpq %r15, (%rax)
je 0x87de
movq 0x31740(%rip), %rax     # 0x39f98
cmpq %r15, (%rax)
je 0x87de
movq %r15, %rdi
callq 0x32b0
testl %eax, %eax
je 0x87de
leaq 0x252a0(%rip), %rdi     # 0x2db14
movl %eax, %esi
xorl %eax, %eax
callq 0x9991
jmp 0x87de
leaq 0x24c89(%rip), %r15     # 0x2d512
jmp 0x8a76
leaq 0x25255(%rip), %rdi     # 0x2daea
xorl %eax, %eax
callq 0x9991
jmp 0x87de
leaq 0x24c6e(%rip), %r15     # 0x2d516
jmp 0x8a76
movb 0x10(%rsp), %al
movb 0x11(%rsp), %sil
movl %eax, %ecx
notb %cl
movl %esi, %edx
xorb $-0x28, %dl
orb %cl, %dl
movb 0x12(%rsp), %dil
movl %edi, %ecx
notb %cl
orb %dl, %cl
jne 0x88da
leaq 0x24bcc(%rip), %r15     # 0x2d4a1
jmp 0x8a76
movl %eax, %edx
xorb $0x42, %dl
movl %esi, %ecx
xorb $0x4d, %cl
orb %cl, %dl
jne 0x88f4
leaq 0x24bae(%rip), %r15     # 0x2d49d
jmp 0x8a76
movl %eax, %r10d
xorb $0x47, %r10b
movl %esi, %edx
xorb $0x49, %dl
orb %dl, %r10b
movl %edi, %r11d
xorb $0x46, %r11b
movb 0x13(%rsp), %r9b
movb 0x15(%rsp), %r8b
movl %r9d, %ebp
xorb $0x38, %bpl
orb %r11b, %bpl
orb %r10b, %bpl
movl %r8d, %r10d
xorb $0x61, %r10b
orb %bpl, %r10b
jne 0x894e
movzbl 0x14(%rsp), %r10d
leaq 0x24bc2(%rip), %r15     # 0x2d4fc
cmpl $0x37, %r10d
je 0x8a76
cmpl $0x39, %r10d
je 0x8a76
cmpb $-0x77, %al
jne 0x898b
cmpb $0x50, %sil
jne 0x898b
cmpb $0x4e, %dil
jne 0x898b
cmpb $0x47, %r9b
jne 0x898b
cmpb $0xd, 0x14(%rsp)
jne 0x898b
cmpb $0xa, %r8b
jne 0x898b
cmpb $0x1a, 0x16(%rsp)
jne 0x898b
cmpb $0xa, 0x17(%rsp)
jne 0x898b
leaq 0x26578(%rip), %r15     # 0x2eefe
jmp 0x8a76
movl %eax, %esi
xorb $0x49, %sil
xorb $0x4d, %al
orb %cl, %al
sete %al
orb %dl, %sil
leaq 0x24b25(%rip), %r15     # 0x2d4c7
je 0x8a76
testb %al, %al
jne 0x8a76
movl %r14d, %eax
testq %rax, %rax
je 0x8a14
leaq (%rsp,%rax), %r12
addq $0x10, %r12
leaq 0x25eb6(%rip), %r14     # 0x2e87d
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 0x8a14
testl %eax, %eax
je 0x89f6
cmpb $0x23, 0x810(%rsp)
jne 0x8a14
testl %eax, %eax
je 0x8a07
movq %r15, %rdi
callq 0x3100
incq %rax
jmp 0x8a0c
movl $0x1, %eax
addq %rax, %rbx
cmpq %r12, %rbx
jb 0x89cf
leaq 0x2754b(%rip), %rsi     # 0x2ff66
leaq 0x810(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x32a0
cmpl $0x1, %eax
jne 0x8a3d
leaq 0x27818(%rip), %r15     # 0x30253
jmp 0x8a76
leaq 0x25ff9(%rip), %rsi     # 0x2ea3d
xorl %r15d, %r15d
leaq 0x810(%rsp), %rdi
leaq 0xb(%rsp), %rdx
xorl %eax, %eax
callq 0x32a0
cmpl $0x1, %eax
jne 0x8a76
movb 0xb(%rsp), %al
andb $-0x21, %al
xorl %r15d, %r15d
cmpb $0x46, %al
leaq 0x24a51(%rip), %rax     # 0x2d4c3
cmoveq %rax, %r15
movq %r15, %rax
addq $0xc10, %rsp            # imm = 0xC10
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x4008, %edi           # imm = 0x4008
callq 0x3110
movq %rax, %rbx
leaq 0x2748a(%rip), %rsi     # 0x2ff27
movq %rax, %rdi
xorl %eax, %eax
callq 0x641a
leaq 0x311e2(%rip), %rsi     # 0x39c90
movq 0x31523(%rip), %rdx     # 0x39fd8
movq %rbx, %rdi
callq 0x34b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x31e0
movq %r14, %rdi
callq 0x34d0