// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r15
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %dl
orb %al, %dl
jne 0x5d2c
movq %r8, %r13
movl %esi, %r12d
movq 0x10(%rbx), %rbp
movq %rcx, 0x18(%rsp)
addq %rcx, %rbp
movzwl 0x2(%rbx), %edi
callq 0x15f20
movslq %eax, %r14
imulq 0x8(%rbx), %r14
addq %rbp, %r14
leaq 0x524de(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
je 0x627c
cmpl $0x0, 0x68(%rsp)
setne %cl
movl %eax, %edx
shrl $0x18, %edx
andl $0x1, %edx
testb %dl, %cl
jne 0x5cd7
movl $0x0, 0x14(%rsp)
testl $0x300, %eax            # imm = 0x300
je 0x5ce9
cmpw $0x7, 0x2(%rbx)
je 0x5ce9
leaq 0x4488a(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
movl %eax, 0x14(%rsp)
movzwl 0x2(%rbx), %esi
leal -0x1(%rsi), %eax
movzwl %r12w, %r12d
cmpl $0xb, %eax
ja 0x5ef3
leaq 0x3b6ec(%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 0x5f79
callq 0x7793
jmp 0x5f7e
leaq 0x3b9bb(%rip), %rdi     # 0x416ee
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testq %r15, %r15
jne 0x5d51
leaq 0x3b9cd(%rip), %rdi     # 0x41715
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
testq %rbx, %rbx
je 0x5d5e
xorl %r14d, %r14d
jmp 0x6275
leaq 0x3b9ca(%rip), %rdi     # 0x4172f
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
jmp 0x6275
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x9252
jmp 0x5f7e
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8754
jmp 0x5f7e
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8c3b
jmp 0x5f7e
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5f0b
leaq 0x3b30f(%rip), %rdi     # 0x410dc
xorl %eax, %eax
callq 0x3120
movl 0x14(%rsp), %r13d
addl %eax, %r13d
jmp 0x5f10
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5f24
leaq 0x3b2e9(%rip), %rdi     # 0x410dc
xorl %eax, %eax
callq 0x3120
movl 0x14(%rsp), %r13d
addl %eax, %r13d
jmp 0x5f29
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8085
jmp 0x5f7e
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x7793
leaq 0x5783c(%rip), %rax     # 0x5d670
testb $0x8, (%rax)
je 0x5f7e
movzwl (%rbx), %eax
cmpl $0x110, %eax            # imm = 0x110
movl 0x14(%rsp), %r13d
je 0x5f88
cmpl $0x10f, %eax            # imm = 0x10F
jne 0x6258
leaq 0x535ce(%rip), %rax     # 0x59430
movq (%rax), %rdi
callq 0x1b1ba
jmp 0x5faa
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x7b9d
jmp 0x5f7e
cmpl $0x0, 0x68(%rsp)
jne 0x5fd4
leaq 0x522eb(%rip), %rcx     # 0x58180
movq (%rcx), %rax
testb $0x30, %al
je 0x5fdb
movq 0x8(%rbx), %rdx
testl $0x300, %eax            # imm = 0x300
je 0x5fbf
leaq 0x3f2b0(%rip), %rdi     # 0x45166
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x5fd0
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x9054
jmp 0x5f7e
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8561
jmp 0x5f7e
leaq 0x3b7e2(%rip), %rdi     # 0x416dc
xorl %eax, %eax
callq 0x3120
movl 0x14(%rsp), %r13d
jmp 0x6255
movl 0x14(%rsp), %r13d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x7d7a
jmp 0x5f3b
movl 0x14(%rsp), %r13d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8272
cmpw $0x117, (%rbx)          # imm = 0x117
jne 0x6258
movq 0x10(%rbx), %rdx
addq 0x18(%rsp), %rdx
movq 0x8(%rbx), %rcx
movzwl 0x2(%rbx), %r8d
movq %r15, %rdi
movl %r12d, %esi
callq 0x1790a
leaq 0x3b161(%rip), %rdi     # 0x410cb
movq %rax, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x6255
callq 0x798e
movl 0x14(%rsp), %r13d
jmp 0x6258
leaq 0x534a1(%rip), %rax     # 0x59430
movq (%rax), %rdi
callq 0x1b1ba
leaq 0x5349a(%rip), %rcx     # 0x59438
movq (%rcx), %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x1b20c
leaq 0x3b724(%rip), %rdi     # 0x416d5
movl %eax, %esi
xorl %eax, %eax
callq 0x3120
jmp 0x6255
leaq 0x3f19c(%rip), %rdi     # 0x45162
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, 0x14(%rsp)
leaq 0x521a5(%rip), %rcx     # 0x58180
movzwl (%rbx), %eax
cmpl $0xa301, %eax           # imm = 0xA301
jg 0x601b
cmpl $0x15b, %eax            # imm = 0x15B
je 0x608c
cmpl $0x927c, %eax           # imm = 0x927C
je 0x608c
cmpl $0x9286, %eax           # imm = 0x9286
jne 0x6096
cmpl $0x0, 0x68(%rsp)
je 0x615d
movl 0x14(%rsp), %r13d
jmp 0x6178
cmpl $0xc4a5, %eax           # imm = 0xC4A5
je 0x608c
cmpl $0xc353, %eax           # imm = 0xC353
je 0x60dc
cmpl $0xa302, %eax           # imm = 0xA302
jne 0x6096
cmpl $0x0, 0x68(%rsp)
movl %r12d, 0x24(%rsp)
jne 0x6057
testb $0x30, (%rcx)
je 0x6057
leaq 0x4451c(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
addl %eax, 0x14(%rsp)
movzwl (%rbx), %edi
callq 0xa958
movq %rax, %r12
movl 0x14(%rsp), %edi
callq 0x17530
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0x24(%rsp), %edx
movq %rbp, %rcx
movq %r13, %r8
movq %r12, %r9
movl %edx, %r12d
callq 0x687a
jmp 0x6192
movl 0x14(%rsp), %r13d
jmp 0x623b
cmpl $0x0, 0x68(%rsp)
je 0x621e
movl %r12d, %r13d
leaq 0x5335d(%rip), %rax     # 0x59408
movq (%rax), %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r12
je 0x61e5
testq %r12, %r12
jne 0x61df
leaq 0x3b5f3(%rip), %rdi     # 0x416bf
xorl %eax, %eax
callq 0x3120
addl %eax, 0x14(%rsp)
jmp 0x621b
cmpl $0x0, 0x68(%rsp)
movl 0x14(%rsp), %r13d
jne 0x60fe
testb $0x30, (%rcx)
je 0x60fe
leaq 0x44474(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl $0x8, %esi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x4832
testq %rax, %rax
je 0x612b
leaq 0x3b593(%rip), %rsi     # 0x416ad
movl $0x8, %edx
movq %rax, %rdi
callq 0x3090
testl %eax, %eax
je 0x619a
movl %r13d, %edi
callq 0x16b56
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 0x7446
jmp 0x6234
testb $0x30, (%rcx)
movl 0x14(%rsp), %r13d
je 0x6178
leaq 0x443fa(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x17530
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
movl %r12d, %ecx
callq 0x6eaa
xorl %r13d, %r13d
jmp 0x6234
leaq 0x51fdf(%rip), %rax     # 0x58180
movzwl 0x2(%rax), %eax
testl $0x104, %eax            # imm = 0x104
je 0x61bd
leaq 0x3b502(%rip), %rdi     # 0x416b5
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x17530
movq 0x8(%rbx), %rsi
addq $-0x8, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r15, %rdi
movl %r12d, %ecx
callq 0x730f
jmp 0x6192
cmpq 0x8(%rbx), %r12
jbe 0x61e9
movq 0x8(%rbx), %r12
movl $0x1, %edi
callq 0x16b56
movl %eax, 0x14(%rsp)
movq 0x8(%rbx), %rdx
movl $0x2, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rcx
movl $0xc, %r8d
movl 0x60(%rsp), %r9d
callq 0x7446
movl %r13d, %r12d
addq 0x8(%rbx), %rbp
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3210
movl 0x14(%rsp), %r13d
leaq 0x51f45(%rip), %rcx     # 0x58180
cmpl $0x0, 0x68(%rsp)
jne 0x6258
testb $0x30, (%rcx)
je 0x6258
leaq 0x3bab5(%rip), %rdi     # 0x41d03
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x17530
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq 0x18(%rsp), %rcx
callq 0x18407
xorl %ebp, %ebp
movl %ebp, %edi
callq 0x16b56
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq