// File: /workspace/github_c_makefile_star2_O1/hfiguiere[P]exifprobe/print.c
// Function: print_entry
unsigned long
print_entry(FILE *inptr,unsigned short byteorder,struct ifd_entry *entry_ptr,
            unsigned long fileoffset_base,struct image_summary *summary_entry,
            char *parent_name,int ifdtype,int ifdnum,int subifdnum,int indent)
{
    int value_is_offset = 0;
    unsigned long endoffset = 0UL;
    int chpr = 0;

    value_is_offset = is_offset(entry_ptr);
    if((PRINT_ENTRY))
    {
        print_taginfo(entry_ptr,parent_name,indent,ifdtype,ifdnum,subifdnum);
        if((entry_ptr->value_type == 0) || (entry_ptr->value_type > DOUBLE) ||
            ferror(inptr) || feof(inptr))
        {
            clearerr(inptr);
            printred("# INVALID ENTRY");
            endoffset = ftell(inptr);
        }
        else if(entry_ptr->count == 0)
        {
            if(PRINT_VALUE)
                chpr += printf(" EMPTY (value=%#lx)",entry_ptr->value);
            endoffset = ftell(inptr);
        }
        else if(value_is_offset)
        {
            /* Offsets read from the file are printed relative to the */
            /* beginning of the file (with fileoffset_base added) so  */
            /* that the values, printed later, will be easy to find.  */
            if(PRINT_BOTH_OFFSET)
                chpr += printf("@%#lx=%lu",entry_ptr->value + fileoffset_base,
                        entry_ptr->value + fileoffset_base);
            else if(PRINT_HEX_OFFSET)
                chpr += printf("@%#lx",entry_ptr->value + fileoffset_base);
            else if(PRINT_DEC_OFFSET)
                chpr += printf("@%lu",entry_ptr->value + fileoffset_base);

            if(fileoffset_base && (PRINT_ENTRY_RELOFFSET))
                chpr += printf(" (%lu) ",entry_ptr->value);

            /* Print "inline" in REPORT & LIST modes                      */
            if(!(PRINT_VALUE_AT_OFFSET))
            {
                setcharsprinted(chpr);
                chpr = 0;
                endoffset = print_offset_value(inptr,byteorder,entry_ptr,
                                            fileoffset_base,parent_name,
                                            ifdtype,indent,0);
            }
        }
        else if(PRINT_VALUE)
        {
            /* Intercept some EXIF values which print_value() would   */
            /* not handle properly, possibly because they are ascii   */
            /* items tagged as UNDEFINED. A few items given as LONG   */
            /* type are actually offsets, and are printed as such     */
            /* here, with fileoffset_base added.                      */
            switch(entry_ptr->tag)
            {
                case EXIFTAG_ExifVersion:
                case EXIFTAG_FlashPixVersion:
                case INTEROPTAG_Version:
                case INTEROPTAG_Index:
                    /* ASCII                                          */
                    /* ###%%% show_string()?                          */
                    chpr += printf("%s\'%s\'",PREFIX,(char *)&entry_ptr->value);
                    break;
                case EXIFTAG_ExifIFDPointer:
                case EXIFTAG_GPSInfoIFDPointer:
                case EXIFTAG_Interoperability:
                case TIFFTAG_JPEGInterchangeFormat:
                    /* OFFSETS                                        */
                    if(PRINT_BOTH_OFFSET)
                    {
                        chpr += printf("@%#lx=%lu",entry_ptr->value + fileoffset_base,
                                entry_ptr->value + fileoffset_base);
                    }
                    else if(PRINT_HEX_OFFSET)
                        chpr += printf("@%#lx",entry_ptr->value + fileoffset_base);
                    else if((PRINT_DEC_OFFSET) || is_a_long_offset(entry_ptr)) 
                        chpr += printf("@%lu",entry_ptr->value + fileoffset_base);

                    if(fileoffset_base && (PRINT_ENTRY_RELOFFSET))
                        chpr += printf(" (%lu)",entry_ptr->value);
                    break;
                default:
                    /* VALUES                                         */
                    if(entry_ptr->tag == TIFFTAG_StripOffsets)
                        print_value(entry_ptr,"@");
                    else
                        print_value(entry_ptr,PREFIX);
                    /* This one is worth flagging...                  */
                    if((entry_ptr->tag == TIFFTAG_StripOffsets) &&
                                                (entry_ptr->value == 0))
                    {
                            printred(" (BAD START OFFSET)");
                    }
                    interpret_value(entry_ptr,summary_entry);
                    break;
            }
        }
        chpr = newline(chpr);
    }
    return(endoffset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r12
movq %r8, %rbp
movq %rcx, (%rsp)
movq %rdx, %rbx
movl %esi, %r13d
movq %rdi, %r15
movq %rdx, %rdi
callq 0xfe62
movl %eax, %r14d
leaq 0x529ed(%rip), %rax     # 0x58180
testl $0x4003333, (%rax)      # imm = 0x4003333
je 0x5809
movl 0x40(%rsp), %ecx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5aec
movzwl 0x2(%rbx), %eax
addl $-0xd, %eax
cmpw $-0xc, %ax
jb 0x57cf
movq %r15, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x57cf
movq %r15, %rdi
callq 0x31a0
testl %eax, %eax
je 0x581e
movq %r15, %rdi
callq 0x31b0
leaq 0x3b8b9(%rip), %rdi     # 0x41097
leaq 0x3bde7(%rip), %rsi     # 0x415cc
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x17530
movq %r15, %rdi
callq 0x3190
movq %rax, %r14
movl %ebp, %edi
callq 0x16b56
jmp 0x580c
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x8(%rbx)
je 0x5864
leaq 0x52954(%rip), %rsi     # 0x58180
movq (%rsi), %rcx
testl %r14d, %r14d
je 0x588d
movl %ecx, %eax
notl %eax
testl $0x300, %eax            # imm = 0x300
movq (%rsp), %r14
jne 0x58d6
movq 0x10(%rbx), %rdx
addq %r14, %rdx
leaq 0x3f9b8(%rip), %rdi     # 0x4520d
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x5910
leaq 0x52915(%rip), %rax     # 0x58180
testb $0x30, (%rax)
je 0x58f4
movq 0x10(%rbx), %rsi
leaq 0x3bd5d(%rip), %rdi     # 0x415dc
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
jmp 0x57f5
testb $0x30, %cl
movq (%rsp), %r14
je 0x5a87
movzwl (%rbx), %eax
cmpl $0x8824, %eax           # imm = 0x8824
jg 0x597e
cmpl $0x200, %eax            # imm = 0x200
jg 0x59d0
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x59aa
cmpl $0x111, %eax            # imm = 0x111
jne 0x5a43
leaq 0x3b80b(%rip), %rsi     # 0x410dc
jmp 0x5a4a
btl $0x8, %ecx
jb 0x58fb
xorl %ebp, %ebp
btl $0x9, %ecx
jae 0x5919
movq 0x10(%rbx), %rsi
addq %r14, %rsi
leaq 0x42efa(%rip), %rdi     # 0x487ec
jmp 0x5909
xorl %ebp, %ebp
jmp 0x57f5
movq 0x10(%rbx), %rsi
addq %r14, %rsi
leaq 0x3f911(%rip), %rdi     # 0x4521a
xorl %eax, %eax
callq 0x3120
leaq 0x52869(%rip), %rsi     # 0x58180
movl %eax, %ebp
testq %r14, %r14
je 0x593f
testb $0x4, 0x3(%rsi)
je 0x593f
movq 0x10(%rbx), %rsi
leaq 0x3bcc1(%rip), %rdi     # 0x415f0
xorl %eax, %eax
callq 0x3120
leaq 0x52843(%rip), %rsi     # 0x58180
addl %eax, %ebp
xorl %r14d, %r14d
testb $0x1, 0x3(%rsi)
jne 0x5800
movl 0x58(%rsp), %r14d
movl %ebp, %edi
callq 0x17530
movzwl %r13w, %esi
movq %r15, %rdi
movq %rbx, %rdx
movq (%rsp), %rcx
movq %r12, %r8
pushq $0x0
pushq %r14
callq 0x5c4d
addq $0x10, %rsp
movq %rax, %r14
jmp 0x5a8a
cmpl $0x9fff, %eax           # imm = 0x9FFF
jg 0x5998
cmpl $0x8825, %eax           # imm = 0x8825
je 0x59de
cmpl $0x9000, %eax           # imm = 0x9000
je 0x59aa
jmp 0x5a43
cmpl $0xa005, %eax           # imm = 0xA005
je 0x59de
cmpl $0xa000, %eax           # imm = 0xA000
jne 0x5a43
addq $0x10, %rbx
leaq 0x3bc43(%rip), %rdi     # 0x415f8
leaq 0x422da(%rip), %rsi     # 0x47c96
xorl %r14d, %r14d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
jmp 0x5800
cmpl $0x201, %eax            # imm = 0x201
je 0x59de
cmpl $0x8769, %eax           # imm = 0x8769
jne 0x5a43
movl %ecx, %edx
notl %edx
testl $0x300, %edx            # imm = 0x300
jne 0x5a07
movq 0x10(%rbx), %rdx
addq %r14, %rdx
leaq 0x3f815(%rip), %rdi     # 0x4520d
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x5ab4
btl $0x8, %ecx
jb 0x5a33
btl $0x9, %ecx
jb 0x5a9f
xorl %ebp, %ebp
cmpl $0x8824, %eax           # imm = 0x8824
jg 0x5a91
cmpl $0x201, %eax            # imm = 0x201
je 0x5a9f
cmpl $0x8769, %eax           # imm = 0x8769
je 0x5a9f
jmp 0x5abd
movq 0x10(%rbx), %rsi
addq %r14, %rsi
leaq 0x3f7d9(%rip), %rdi     # 0x4521a
jmp 0x5aad
leaq 0x4224c(%rip), %rsi     # 0x47c96
movq %rbx, %rdi
callq 0x62c7
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5a7c
cmpq $0x0, 0x10(%rbx)
jne 0x5a7c
leaq 0x3b630(%rip), %rdi     # 0x41097
leaq 0x3bb91(%rip), %rsi     # 0x415ff
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x17530
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x17ae4
xorl %r14d, %r14d
xorl %ebp, %ebp
jmp 0x5800
cmpl $0xa005, %eax           # imm = 0xA005
je 0x5a9f
cmpl $0x8825, %eax           # imm = 0x8825
jne 0x5abd
movq 0x10(%rbx), %rsi
addq %r14, %rsi
leaq 0x42d3f(%rip), %rdi     # 0x487ec
xorl %eax, %eax
callq 0x3120
leaq 0x526c5(%rip), %rsi     # 0x58180
movl %eax, %ebp
testq %r14, %r14
je 0x5ac8
testb $0x4, 0x3(%rsi)
jne 0x5ad0
xorl %r14d, %r14d
jmp 0x5800
movq 0x10(%rbx), %rsi
leaq 0x3bd28(%rip), %rdi     # 0x41803
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
jmp 0x5800