// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/print.c
// Function: print_offset_value
unsigned long
print_offset_value(FILE *inptr,unsigned short byteorder,
                struct ifd_entry *entry_ptr,unsigned long fileoffset_base,
                char *parent_name,int ifdtype,int indent,
                int at_offset)
{
    unsigned long endoffset = 0L;
    unsigned long value_offset,dumplength,total;
    char *nameoftag,*data;
    int chpr = 0;

    if(inptr && entry_ptr)
    {
        value_offset = fileoffset_base + entry_ptr->value;
        endoffset = value_offset + 
            (value_type_size(entry_ptr->value_type) * entry_ptr->count);

        if(PRINT_VALUE)
        {
            if((at_offset && (PRINT_VALUE_AT_OFFSET)) ||
                    ((PRINT_OFFSET) && (entry_ptr->value_type != UNDEFINED)))
                chpr += printf(" = ");
            switch(entry_ptr->value_type)
            {
                case UNDEFINED: 
                    if(!at_offset && (PRINT_VALUE))
                    {
                        if(!(PRINT_OFFSET))
                            chpr += printf("@%lu:%lu",value_offset,entry_ptr->count);
                        else
                            chpr += printf(":%lu", entry_ptr->count);
                    }
                    switch(entry_ptr->tag)
                    {
                        case EXIFTAG_CFAPattern:
                            if(!at_offset && (PRINT_VALUE))
                                chpr += printf(" = ");
                            nameoftag = tagname(entry_ptr->tag);
                            setcharsprinted(chpr);
                            chpr = 0;
                            print_cfapattern(inptr,entry_ptr->count,
                                            byteorder,value_offset,
                                            parent_name,nameoftag);
                            break;
                        case EXIFTAG_UserComment:
                            if(!at_offset && (PRINT_VALUE))
                                chpr += printf(" = ");
                            setcharsprinted(chpr);
                            chpr = 0;
                            print_user_comment(inptr,entry_ptr->count,
                                                value_offset,byteorder);
                            break;
                        case TIFFTAG_META_0xc353:
                            /* This should probably be handled        */
                            /* through the 'private IFD' mechanism,   */
                            /* but do it here for now.                */
                            if(!at_offset && (PRINT_VALUE))
                                chpr += printf(" = ");
                            /* The first 8 bytes should say "UNICODE" */
                            if((data = (char *)read_bytes(inptr,8UL,value_offset)) && (strncmp(data,"UNICODE",8) == 0))
                            {
                                if(!(LIST_MODE))
                                    chpr += printf("UNICODE: ");
                                setcharsprinted(chpr);
                                chpr = 0;
                                print_unicode(inptr,entry_ptr->count - 8,HERE,byteorder);
                            }
                            else
                            {
                                chpr = newline(chpr);
                                dumplength = entry_ptr->count;
                                hexdump(inptr,value_offset,dumplength,dumplength,16,0,SUBINDENT);
                            }
                            break;
                        case TIFFTAG_PrintIM:
                        case EXIFTAG_MakerNote:
                        case TIFFTAG_JPEGTables:
                            break;
                        /* TIFFEP_CFAPATTERN is not quite the same as */
                        /* EXIF_CFAPattern: it will be handled in     */
                        /* interpret.c                                */
                        case TIFFEPTAG_CFAPattern:
                        case TIFFEPTAG_SpatialFrequencyResponse:
                        case EXIFTAG_SpatialFrequencyResponse:
                        case EXIFTAG_SpectralSensitivity:
                        case EXIFTAG_OECF:
                            /* fall through, until some routines are  */
                            /* written for these.                     */
                        default:
                            /* Could make a pseudo-tag for 'count' in */
                            /* LIST mode...                           */
                            if(at_offset)
                            {
                                if(Max_undefined == 0L)
                                    chpr += printf(" (not dumped, use -U)");
                                else
                                {
                                    /* Even in LIST mode              */
                                    if((Max_undefined == DUMPALL) ||
                                            (Max_undefined > entry_ptr->count))
                                        dumplength = entry_ptr->count;
                                    else 
                                        dumplength = Max_undefined;
                                    chpr = newline(1);
                                    hexdump(inptr,value_offset,entry_ptr->count,
                                                dumplength,12,indent,SUBINDENT);
                                }
                            }
                            /* make certain we're at the end          */
                            fseek(inptr,(long)(value_offset + entry_ptr->count),SEEK_SET);
                            break;
                    }
                    if(!at_offset && (PRINT_VALUE))
                        chpr += printf("    # UNDEFINED");
                    break;
                case BYTE:
                    if(entry_ptr->tag == DNGTAG_OriginalRawFileName)
                        print_ascii(inptr,entry_ptr->count,value_offset);
                    else
                        print_ubytes(inptr,entry_ptr->count,value_offset);
                    break;
                case SBYTE:
                    print_sbytes(inptr,entry_ptr->count,value_offset);
                    break;
                case ASCII:
                    print_ascii(inptr,entry_ptr->count,value_offset);
                    if(Debug & NOTE_DEBUG)
                    {
                        if(entry_ptr->tag == TIFFTAG_Make)
                            chpr += printf("  [%d]",maker_number(Make_name));
                        else if(entry_ptr->tag == TIFFTAG_Model)
                            chpr += printf("  [%d]",model_number(maker_number(Make_name),
                                                    Model_name,CNULL));
                    }
                    break;
                case SHORT:
                    if(entry_ptr->tag == TIFFTAG_StripOffsets)
                        chpr += printf("@");
                    print_ushort(inptr,entry_ptr->count,byteorder,value_offset);
                    if(entry_ptr->tag == TIFFTAG_StripByteCounts)
                    {
                        total = sum_strip_bytecounts(inptr,byteorder,
                                    entry_ptr->value + fileoffset_base,
                                    entry_ptr->count,entry_ptr->value_type);
                        chpr += printf(" = %lu",total);
                    }
                    break;
                case SSHORT:
                    print_sshort(inptr,entry_ptr->count,byteorder,value_offset);
                    break;
                case LONG:
                    if(entry_ptr->tag == TIFFTAG_StripOffsets)
                        chpr += printf("@");
                    print_ulong(inptr,entry_ptr->count,byteorder,value_offset);
                    if(entry_ptr->tag == TIFFTAG_StripByteCounts)
                    {
                        total = sum_strip_bytecounts(inptr,byteorder,
                                    entry_ptr->value + fileoffset_base,
                                    entry_ptr->count,entry_ptr->value_type);
                        chpr += printf(" = %lu",total);
                    }
                    break;
                case SLONG:
                    print_slong(inptr,entry_ptr->count,byteorder,value_offset);
                    break;
                case RATIONAL:
                    print_urational(inptr,entry_ptr->count,byteorder,value_offset);
                    break;
                case SRATIONAL:
                    print_srational(inptr,entry_ptr->count,byteorder,value_offset);
                    break;
                case FLOAT:
                    print_float(inptr,entry_ptr->count,byteorder,value_offset);
                    break;
                case DOUBLE:
                    print_double(inptr,entry_ptr->count,byteorder,value_offset);
                    break;
                default:
                    chpr += printf(" INVALID TYPE %#x",entry_ptr->value_type);
                    break;
            }
            setcharsprinted(chpr);
            chpr = 0;
            interpret_offset_value(inptr,entry_ptr,byteorder,fileoffset_base);
            chpr = newline(chpr);
        }
    }
    else
    {
        chpr += printf(" invalid call to print_offset_value() ");
        if(inptr == (FILE *)0)
            chpr += printf(" - no input file pointer ");
        if(entry_ptr == (struct ifd_entry *)0)
            chpr += printf(" - null entry pointer");
        chpr = newline(chpr);
    }
    return(endoffset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, %r15
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %dl
orb %al, %dl
jne 0x5cf0
movq %r8, %r13
movl %esi, %r12d
movq 0x10(%rbx), %rbp
movq %rcx, 0x10(%rsp)
addq %rcx, %rbp
movzwl 0x2(%rbx), %edi
callq 0x1646c
movslq %eax, %r14
imulq 0x8(%rbx), %r14
addq %rbp, %r14
leaq 0x524eb(%rip), %rdi     # 0x58180
movq (%rdi), %rax
testb $0x30, %al
je 0x6300
movl 0x58(%rsp), %r8d
testl %r8d, %r8d
setne %cl
movl %eax, %edx
shrl $0x18, %edx
andl $0x1, %edx
movzwl %r12w, %esi
movl %esi, 0xc(%rsp)
testb %dl, %cl
jne 0x5cd9
testl $0x300, %eax            # imm = 0x300
je 0x5d3a
movl $0x0, 0x8(%rsp)
cmpw $0x7, 0x2(%rbx)
je 0x5ec4
movl %r8d, %r12d
leaq 0x448c5(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
movl %eax, 0x8(%rsp)
jmp 0x5d45
leaq 0x3b9f7(%rip), %rdi     # 0x416ee
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testq %r15, %r15
jne 0x5d15
leaq 0x3ba09(%rip), %rdi     # 0x41715
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
testq %rbx, %rbx
je 0x5d22
xorl %r14d, %r14d
jmp 0x62f9
leaq 0x3ba06(%rip), %rdi     # 0x4172f
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
jmp 0x62f9
movl %r8d, %r12d
movl $0x0, 0x8(%rsp)
movzwl 0x2(%rbx), %esi
leal -0x1(%rsi), %eax
cmpl $0xb, %eax
ja 0x5f37
leaq 0x3b694(%rip), %rcx     # 0x413f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpw $0xc68b, (%rbx)         # imm = 0xC68B
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
jne 0x5fca
callq 0x77d6
jmp 0x5fcf
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x935f
jmp 0x5f2d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8816
jmp 0x5f2d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8d1a
jmp 0x5f2d
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5f52
leaq 0x3b2f2(%rip), %rdi     # 0x410dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r13d
addl %eax, %r13d
jmp 0x5f57
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5f70
leaq 0x3b2cc(%rip), %rdi     # 0x410dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r13d
addl %eax, %r13d
jmp 0x5f75
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x80fe
jmp 0x5f2d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x77d6
leaq 0x5781a(%rip), %rax     # 0x5d670
testb $0x8, (%rax)
je 0x5fcf
movzwl (%rbx), %eax
cmpl $0x110, %eax            # imm = 0x110
movl 0x8(%rsp), %r13d
je 0x61ce
cmpl $0x10f, %eax            # imm = 0x10F
movl 0xc(%rsp), %r12d
jne 0x62dc
leaq 0x535a7(%rip), %rax     # 0x59430
movq (%rax), %rdi
callq 0x1b73f
leaq 0x3b83d(%rip), %rdi     # 0x416d5
movl %eax, %esi
xorl %eax, %eax
callq 0x3120
jmp 0x62d9
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x7be4
jmp 0x5fcf
leaq 0x522bf(%rip), %rdi     # 0x58180
movl %r12d, %r8d
testl %r8d, %r8d
jne 0x5fff
movq (%rdi), %rax
testb $0x30, %al
je 0x5fff
movq 0x8(%rbx), %rdx
testl $0x300, %eax            # imm = 0x300
je 0x5fde
leaq 0x3f2bc(%rip), %rdi     # 0x451aa
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x5fef
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x914d
jmp 0x5f2d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8611
movl 0x8(%rsp), %r13d
jmp 0x62dc
leaq 0x3b79e(%rip), %rdi     # 0x416dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r13d
addl %eax, %r13d
jmp 0x5fd4
movl 0x8(%rsp), %r13d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x7dcb
jmp 0x5f8c
movl 0x8(%rsp), %r13d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8302
cmpw $0x117, (%rbx)          # imm = 0x117
jne 0x62dc
movq 0x10(%rbx), %rdx
addq 0x10(%rsp), %rdx
movq 0x8(%rbx), %rcx
movzwl 0x2(%rbx), %r8d
movq %r15, %rdi
movl %r12d, %esi
callq 0x17e5c
leaq 0x3b110(%rip), %rdi     # 0x410cb
movq %rax, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x62d9
callq 0x79c7
movl 0x8(%rsp), %r13d
movl 0xc(%rsp), %r12d
jmp 0x62dc
leaq 0x3f1c1(%rip), %rdi     # 0x451a6
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
leaq 0x52186(%rip), %rdi     # 0x58180
movl 0x58(%rsp), %r8d
movzwl (%rbx), %eax
cmpl $0xa301, %eax           # imm = 0xA301
jg 0x603d
cmpl $0x15b, %eax            # imm = 0x15B
je 0x60ae
cmpl $0x927c, %eax           # imm = 0x927C
je 0x60ae
cmpl $0x9286, %eax           # imm = 0x9286
jne 0x60bd
testl %r8d, %r8d
je 0x618c
movl 0x8(%rsp), %r12d
jmp 0x61a7
cmpl $0xc4a5, %eax           # imm = 0xC4A5
je 0x60ae
cmpl $0xc353, %eax           # imm = 0xC353
je 0x60fa
cmpl $0xa302, %eax           # imm = 0xA302
jne 0x60bd
movw $0xa302, %ax            # imm = 0xA302
testl %r8d, %r8d
jne 0x6079
testb $0x30, (%rdi)
je 0x6079
leaq 0x4453d(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
movzwl (%rbx), %eax
movzwl %ax, %edi
callq 0xaad8
movq %rax, %r12
movl 0x8(%rsp), %edi
callq 0x17a82
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %edx
movq %rbp, %rcx
movq %r13, %r8
movq %r12, %r9
movl %edx, %r12d
callq 0x68f2
jmp 0x61c6
movl 0x8(%rsp), %r13d
movl 0xc(%rsp), %r12d
jmp 0x62c1
testl %r8d, %r8d
je 0x6182
leaq 0x5333b(%rip), %rax     # 0x59408
movq (%rax), %rax
testq %rax, %rax
movl 0x8(%rsp), %r13d
je 0x6252
movl 0x50(%rsp), %r12d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jne 0x6265
movq 0x8(%rbx), %r13
jmp 0x6270
testl %r8d, %r8d
movl 0x8(%rsp), %r12d
jne 0x611a
testb $0x30, (%rdi)
je 0x611a
leaq 0x44498(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl $0x8, %esi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x4865
testq %rax, %rax
je 0x614b
leaq 0x3b577(%rip), %rsi     # 0x416ad
movl $0x8, %edx
movq %rax, %rdi
callq 0x3090
testl %eax, %eax
je 0x6205
movl %r12d, %edi
callq 0x1707a
movl %eax, %r13d
movq 0x8(%rbx), %rcx
movl $0x2, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %rcx, %rdx
movl $0x10, %r8d
xorl %r9d, %r9d
callq 0x7480
movl 0xc(%rsp), %r12d
jmp 0x62b5
movl 0x8(%rsp), %r13d
jmp 0x629f
testb $0x30, (%rdi)
movl 0x8(%rsp), %r12d
je 0x61a7
leaq 0x4440b(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, %edi
callq 0x17a82
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
movl 0xc(%rsp), %r12d
movl %r12d, %ecx
callq 0x6f0c
xorl %r13d, %r13d
jmp 0x62b5
leaq 0x5325b(%rip), %rax     # 0x59430
movq (%rax), %rdi
callq 0x1b73f
leaq 0x53254(%rip), %rcx     # 0x59438
movq (%rcx), %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x1b791
leaq 0x3b4de(%rip), %rdi     # 0x416d5
movl %eax, %esi
xorl %eax, %eax
callq 0x3120
jmp 0x5f4a
leaq 0x51f74(%rip), %rax     # 0x58180
movzwl 0x2(%rax), %eax
testl $0x104, %eax            # imm = 0x104
je 0x6228
leaq 0x3b497(%rip), %rdi     # 0x416b5
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, %edi
callq 0x17a82
movq 0x8(%rbx), %rsi
addq $-0x8, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %ecx
callq 0x734b
jmp 0x61c6
leaq 0x3b466(%rip), %rdi     # 0x416bf
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
jmp 0x629f
movq 0x8(%rbx), %r13
cmpq %r13, %rax
cmovbq %rax, %r13
movl $0x1, %edi
callq 0x1707a
movq 0x8(%rbx), %rdx
movl $0x2, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rcx
movl %eax, %r13d
movl $0xc, %r8d
movl %r12d, %r9d
callq 0x7480
movl 0xc(%rsp), %r12d
addq 0x8(%rbx), %rbp
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3210
leaq 0x51ec4(%rip), %rdi     # 0x58180
movl 0x58(%rsp), %r8d
testl %r8d, %r8d
jne 0x62dc
testb $0x30, (%rdi)
je 0x62dc
leaq 0x3ba31(%rip), %rdi     # 0x41d03
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x17a82
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq 0x10(%rsp), %rcx
callq 0x1895e
xorl %ebp, %ebp
movl %ebp, %edi
callq 0x1707a
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq