// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/misc.c
// Function: print_fileformat
void
print_fileformat(struct image_summary *entry)
{
    struct maker_scheme *scheme;
    char *sep,*camera_name;
    int chpr = 0;
    int filesubformat_shown = 0;
    int with_filesubformat = 0;
    int vendor_filesubformat = 0;
    int has_appn[16];
    int i;

    print_filename();
    if((PRINT_LONGNAMES))
        chpr += printf("FileFormat = ");
    else
        chpr += printf("File Format = ");

    if(entry)
    {
        memset(has_appn,0,sizeof(has_appn));
        print_filetype(entry->fileformat,0);
        if(entry->filesubformat & FILESUBFMT_TIFFEP)
            chpr += printf("EP");

        if(entry->fileformat == FILEFMT_TIFF)
            filesubformat_shown |= FILESUBFMT_TIFF;
        if(entry->filesubformat & FILESUBFMT_TIFFEP)
            filesubformat_shown |= FILESUBFMT_TIFFEP;

        sep = "/";
        for( ; entry; entry = entry->next_entry)
        {
            if((entry->filesubformat & (FILESUBFMT_TIFF|FILESUBFMT_TIFFOLD)) &&
                        !(filesubformat_shown & (FILESUBFMT_TIFF|FILESUBFMT_TIFFOLD)))
                chpr += printf("%sTIFF",sep);
            if((entry->filesubformat & FILESUBFMT_JPEG) &&
                        !(filesubformat_shown & FILESUBFMT_JPEG))
                chpr += printf("%sJPEG",sep);
            if((entry->filesubformat & FILESUBFMT_GEOTIFF) &&
                        !(filesubformat_shown & FILESUBFMT_GEOTIFF))
                chpr += printf("%sGEOTIFF",sep);
            if((entry->filesubformat & FILESUBFMT_TIFFEP) &&
                        !(filesubformat_shown & FILESUBFMT_TIFFEP))
                chpr += printf("%sEP",sep);
            if((entry->filesubformat & FILESUBFMT_APPN) &&
                        !(filesubformat_shown & FILESUBFMT_APPN))
            {
                if(entry->filesubformatAPPN[0])
                {
                    chpr += printf("%sAPP0",sep);
                    if(entry->filesubformat & FILESUBFMT_JFIF)
                        chpr += printf("%sJFIF",sep);
                    if(entry->filesubformat & FILESUBFMT_JFXX)
                        chpr += printf("%sJFXX",sep);
                }
                if(entry->filesubformatAPPN[1])
                {
                    chpr += printf("%sAPP1",sep);
                    if(entry->filesubformat & (FILESUBFMT_TIFF|FILESUBFMT_TIFFOLD))
                    {
                        entry->filesubformat &= ~(FILESUBFMT_TIFF|FILESUBFMT_TIFFOLD);
                        chpr += printf("%sTIFF",sep);
                    }
                    if(entry->filesubformat & FILESUBFMT_EXIF)
                    {
                        entry->filesubformat &= ~FILESUBFMT_EXIF;
                        chpr += printf("%sEXIF",sep);
                    }
                }
                if(entry->filesubformatAPPN[2])
                {
                    chpr += printf("%sAPP2",sep);
                    if(entry->filesubformat & FILESUBFMT_FPIX)
                    {
                        entry->filesubformat &= ~FILESUBFMT_FPIX;
                        chpr += printf("%sFPIX",sep);
                    }
                }
                for(i = 3; i < 16; ++i)
                {
                    if(entry->filesubformatAPPN[i])
                        has_appn[i] = entry->filesubformatAPPN[i];
                }
            }
            if((entry->filesubformat & FILESUBFMT_CIFF) &&
                        !(filesubformat_shown & FILESUBFMT_CIFF))
                chpr += printf("%sCIFF",sep);
            if((entry->filesubformat & FILESUBFMT_EXIF) &&
                        !(filesubformat_shown & FILESUBFMT_EXIF))
                chpr += printf("%sEXIF",sep);
            if((entry->filesubformat & FILESUBFMT_FPIX) &&
                        !(filesubformat_shown & FILESUBFMT_FPIX))
                chpr += printf("%sFPIX",sep);

            filesubformat_shown |= entry->filesubformat;

            if(entry->filesubformat & FILESUBFMT_NEF)
                vendor_filesubformat |= FILESUBFMT_NEF;
            if(entry->filesubformat & FILESUBFMT_CR2)
                vendor_filesubformat |= FILESUBFMT_CR2;
            if(entry->filesubformat & FILESUBFMT_DNG)
                vendor_filesubformat |= FILESUBFMT_DNG;
            if(entry->filesubformat & FILESUBFMT_MNOTE)
                with_filesubformat |= FILESUBFMT_MNOTE;
            if(entry->filesubformat & FILESUBFMT_MNSUBIFD)
                with_filesubformat |= FILESUBFMT_MNSUBIFD;
        }
        for(i = 3; i < 16; ++i)
        {
            if(has_appn[i])
                chpr += printf("%sAPP%d",sep,i);
        }
        if(vendor_filesubformat & FILESUBFMT_NEF)
                chpr += printf(" [NEF]");
        if(vendor_filesubformat & FILESUBFMT_CR2)
                chpr += printf(" [CR2]");
        if(vendor_filesubformat & FILESUBFMT_DNG)
                chpr += printf(" [DNG]");
        if(with_filesubformat)
            chpr += printf(" #");
        if(with_filesubformat & FILESUBFMT_MNOTE)
        {
            chpr += printf(" with MakerNote");
            scheme = retrieve_makerscheme();
            if(scheme->make)
            {
                camera_name = find_camera_name(scheme->make);
                if(scheme->scheme_type != UNKNOWN_SCHEME)
                    printf(" (%s [%d])",camera_name,scheme->note_version);
                else
                    printf(" (%s - unknown makernote format)",camera_name);
            }
            if(with_filesubformat & FILESUBFMT_MNSUBIFD)
                chpr += printf(" and MakerNote-SubIFD");
        }
    }
    else
        chpr += printf("unknown");
    chpr = newline(chpr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
callq 0x16f7d
leaq 0x40bb2(%rip), %rax     # 0x57180
testb $0x40, (%rax)
leaq 0x2d2b4(%rip), %rax     # 0x4388c
leaq 0x2d29f(%rip), %rdi     # 0x4387e
cmoveq %rax, %rdi
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testq %r14, %r14
je 0x169da
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movslq 0x14(%r14), %rdi
xorl %esi, %esi
callq 0x4fdd
testb $0x4, 0x18(%r14)
je 0x16637
leaq 0x2d290(%rip), %rdi     # 0x438b7
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl 0x18(%r14), %ebx
andl $0x4, %ebx
xorl %r15d, %r15d
cmpl $0x2a, 0x14(%r14)
sete %r15b
orl %ebx, %r15d
leaq 0x2d24e(%rip), %r12     # 0x4389b
movl %ebp, %ebx
xorl %ebp, %ebp
xorl %r13d, %r13d
testq %r14, %r14
je 0x168fe
movl 0x18(%r14), %eax
testb $0x3, %al
je 0x16684
movl %r15d, %ecx
andl $0x3, %ecx
jne 0x16684
leaq 0x2d229(%rip), %rdi     # 0x4389d
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
testb $0x8, %al
je 0x166a7
movl %r15d, %ecx
andl $0x8, %ecx
jne 0x166a7
leaq 0x2d20d(%rip), %rdi     # 0x438a4
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
btl $0xb, %eax
jae 0x166cf
movl %r15d, %ecx
andl $0x800, %ecx            # imm = 0x800
jne 0x166cf
leaq 0x2d1ec(%rip), %rdi     # 0x438ab
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
testb $0x4, %al
je 0x166f2
movl %r15d, %ecx
andl $0x4, %ecx
jne 0x166f2
leaq 0x2d1d3(%rip), %rdi     # 0x438b5
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
testw %ax, %ax
jns 0x16875
movl %r15d, %ecx
andl $0x8000, %ecx           # imm = 0x8000
jne 0x16875
cmpl $0x0, 0x1c(%r14)
movl %r13d, 0xc(%rsp)
je 0x1678c
movl %ebp, %r13d
leaq 0x2d19a(%rip), %rdi     # 0x438ba
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
movl 0x18(%r14), %eax
btl $0xc, %eax
jae 0x1674f
leaq 0x2d182(%rip), %rdi     # 0x438c1
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl 0x18(%r14), %eax
btl $0xd, %eax
jb 0x16768
movl %ebp, %ebx
movl %r13d, %ebp
movl 0xc(%rsp), %r13d
leaq 0x2d135(%rip), %r12     # 0x4389b
jmp 0x1678c
leaq 0x2d159(%rip), %rdi     # 0x438c8
leaq 0x2d125(%rip), %r12     # 0x4389b
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %ebp, %ebx
movl %r13d, %ebp
movl 0xc(%rsp), %r13d
cmpl $0x0, 0x20(%r14)
je 0x16817
movl %ebp, %r13d
leaq 0x2d12e(%rip), %rdi     # 0x438cf
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
movl 0x18(%r14), %eax
testb $0x3, %al
je 0x167d5
andl $-0x4, %eax
movl %eax, 0x18(%r14)
leaq 0x2d0d8(%rip), %rdi     # 0x4389d
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl 0x18(%r14), %eax
testb $0x10, %al
jne 0x167ec
movl %ebp, %ebx
movl %r13d, %ebp
movl 0xc(%rsp), %r13d
leaq 0x2d0b1(%rip), %r12     # 0x4389b
jmp 0x16817
andl $-0x11, %eax
movl %eax, 0x18(%r14)
leaq 0x2d0dc(%rip), %rdi     # 0x438d6
leaq 0x2d09a(%rip), %r12     # 0x4389b
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %ebp, %ebx
movl %r13d, %ebp
movl 0xc(%rsp), %r13d
cmpl $0x0, 0x24(%r14)
je 0x16857
leaq 0x2d0b8(%rip), %rdi     # 0x438dd
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
btl $0xe, %eax
jae 0x16857
andl $0xffffbfff, %eax       # imm = 0xFFFFBFFF
movl %eax, 0x18(%r14)
leaq 0x2d099(%rip), %rdi     # 0x438e4
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
xorl %eax, %eax
cmpq $0xd, %rax
je 0x16871
movl 0x28(%r14,%rax,4), %ecx
testl %ecx, %ecx
je 0x1686c
movl %ecx, 0x1c(%rsp,%rax,4)
incq %rax
jmp 0x16859
movl 0x18(%r14), %eax
btl $0xa, %eax
jae 0x1689d
movl %r15d, %ecx
andl $0x400, %ecx            # imm = 0x400
jne 0x1689d
leaq 0x2d05e(%rip), %rdi     # 0x438eb
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
testb $0x10, %al
je 0x168c0
movl %r15d, %ecx
andl $0x10, %ecx
jne 0x168c0
leaq 0x2d026(%rip), %rdi     # 0x438d6
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
btl $0xe, %eax
jae 0x168e8
movl %r15d, %ecx
andl $0x4000, %ecx           # imm = 0x4000
jne 0x168e8
leaq 0x2d00c(%rip), %rdi     # 0x438e4
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl 0x18(%r14), %eax
orl %eax, %r15d
orl %eax, %r13d
andl $0x300, %eax            # imm = 0x300
orl %eax, %ebp
movq 0x8(%r14), %r14
jmp 0x16654
pushq $0x3
popq %r14
leaq 0x2cfe9(%rip), %r15     # 0x438f2
leaq 0x2cf8b(%rip), %r12     # 0x4389b
cmpq $0x10, %r14
je 0x16935
cmpl $0x0, 0x10(%rsp,%r14,4)
je 0x16930
movq %r15, %rdi
movq %r12, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
incq %r14
jmp 0x16910
testb $0x20, %r13b
je 0x1694b
leaq 0x2cfb8(%rip), %rdi     # 0x438fa
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
testb $0x40, %r13b
je 0x16961
leaq 0x2cfa9(%rip), %rdi     # 0x43901
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
testb %r13b, %r13b
jns 0x16976
leaq 0x2cf9b(%rip), %rdi     # 0x43908
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
testl %ebp, %ebp
je 0x16a13
leaq 0x2cf8a(%rip), %rdi     # 0x4390f
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
btl $0x8, %ebp
jae 0x16a13
movl %ebp, %r15d
leaq 0x2cf74(%rip), %rdi     # 0x43912
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
xorl %eax, %eax
callq 0x1b2cb
movl 0x38(%rax), %edi
testl %edi, %edi
je 0x169f4
movq %rax, %r14
callq 0x16a28
cmpq $0x0, (%r14)
je 0x169e3
movl 0x40(%r14), %edx
leaq 0x2cf54(%rip), %rdi     # 0x43922
movq %rax, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x169f4
leaq 0x2cf83(%rip), %rdi     # 0x43964
jmp 0x16a08
leaq 0x2cf43(%rip), %rdi     # 0x4392d
movq %rax, %rsi
xorl %eax, %eax
callq 0x3120
addl %ebx, %ebp
btl $0x9, %r15d
jb 0x16a01
movl %ebp, %ebx
jmp 0x16a13
leaq 0x2cf46(%rip), %rdi     # 0x4394e
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %ebp, %ebx
movl %ebx, %edi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x160f7