// File: /workspace/github_c_makefile_star2_O2/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 0x57ab
movq %r8, %r13
movl %esi, %r12d
movq 0x10(%rbx), %rbp
movq %rcx, 0x10(%rsp)
addq %rcx, %rbp
movzwl 0x2(%rbx), %edi
callq 0x155c8
movslq %eax, %r14
imulq 0x8(%rbx), %r14
addq %rbp, %r14
leaq 0x51a2f(%rip), %rdi     # 0x57180
movq (%rdi), %rax
testb $0x30, %al
je 0x5d93
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 0x5794
testw $0x300, %ax             # imm = 0x300
je 0x57f5
movl $0x0, 0x8(%rsp)
cmpw $0x7, 0x2(%rbx)
je 0x597f
movl %r8d, %r12d
leaq 0x42dba(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
movl %eax, 0x8(%rsp)
jmp 0x5800
leaq 0x39f3c(%rip), %rdi     # 0x3f6ee
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testq %r15, %r15
jne 0x57d0
leaq 0x39f4e(%rip), %rdi     # 0x3f715
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
testq %rbx, %rbx
je 0x57dd
xorl %r14d, %r14d
jmp 0x5d8c
leaq 0x39f4b(%rip), %rdi     # 0x3f72f
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
jmp 0x5d8c
movl %r8d, %r12d
movl $0x0, 0x8(%rsp)
movzwl 0x2(%rbx), %esi
leal -0x1(%rsi), %eax
cmpl $0xb, %eax
ja 0x59f1
leaq 0x39bd9(%rip), %rcx     # 0x3f3f0
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 0x5a84
callq 0x71a9
jmp 0x5a89
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8c1e
jmp 0x59e7
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8191
jmp 0x59e7
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x865c
jmp 0x59e7
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5a0c
leaq 0x39837(%rip), %rdi     # 0x3f0dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r13d
addl %eax, %r13d
jmp 0x5a11
cmpw $0x111, (%rbx)          # imm = 0x111
jne 0x5a2a
leaq 0x39811(%rip), %rdi     # 0x3f0dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r13d
addl %eax, %r13d
jmp 0x5a2f
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x7aa9
jmp 0x59e7
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x71a9
leaq 0x56d5f(%rip), %rax     # 0x5c670
testb $0x8, (%rax)
je 0x5a89
movzwl (%rbx), %eax
cmpl $0x110, %eax            # imm = 0x110
movl 0x8(%rsp), %r13d
je 0x5c66
cmpl $0x10f, %eax            # imm = 0x10F
movl 0xc(%rsp), %r12d
jne 0x5d6f
leaq 0x52aec(%rip), %rax     # 0x58430
movq (%rax), %rdi
callq 0x1a575
leaq 0x39d82(%rip), %rdi     # 0x3f6d5
movl %eax, %esi
xorl %eax, %eax
callq 0x3120
jmp 0x5d6c
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x75b4
jmp 0x5a89
leaq 0x51804(%rip), %rdi     # 0x57180
movl %r12d, %r8d
testl %r8d, %r8d
jne 0x5ab9
movq (%rdi), %rax
testb $0x30, %al
je 0x5ab9
movq 0x8(%rbx), %rdx
testw $0x300, %ax             # imm = 0x300
je 0x5a98
leaq 0x3d7be(%rip), %rdi     # 0x43166
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x5aa9
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x8a43
jmp 0x59e7
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x7fa4
movl 0x8(%rsp), %r13d
jmp 0x5d6f
leaq 0x39ce4(%rip), %rdi     # 0x3f6dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r13d
addl %eax, %r13d
jmp 0x5a8e
movl 0x8(%rsp), %r13d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x7790
jmp 0x5a46
movl 0x8(%rsp), %r13d
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %edx
movq %rbp, %rcx
callq 0x7caf
cmpw $0x117, (%rbx)          # imm = 0x117
jne 0x5d6f
movq 0x10(%rbx), %rdx
addq 0x10(%rsp), %rdx
movq 0x8(%rbx), %rcx
movzwl 0x2(%rbx), %r8d
movq %r15, %rdi
movl %r12d, %esi
callq 0x16dfb
leaq 0x39656(%rip), %rdi     # 0x3f0cb
movq %rax, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x5d6c
callq 0x73b2
movl 0x8(%rsp), %r13d
movl 0xc(%rsp), %r12d
jmp 0x5d6f
leaq 0x3d6c3(%rip), %rdi     # 0x43162
movq %rbp, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
leaq 0x516cc(%rip), %rdi     # 0x57180
movl 0x58(%rsp), %r8d
movzwl (%rbx), %eax
cmpl $0x15b, %eax            # imm = 0x15B
je 0x5b4b
cmpl $0x927c, %eax           # imm = 0x927C
je 0x5b4b
cmpl $0x9286, %eax           # imm = 0x9286
je 0x5b5a
cmpl $0xc4a5, %eax           # imm = 0xC4A5
je 0x5b4b
cmpl $0xc353, %eax           # imm = 0xC353
je 0x5ba1
cmpl $0xa302, %eax           # imm = 0xA302
jne 0x5c23
movw $0xa302, %ax            # imm = 0xA302
testl %r8d, %r8d
jne 0x5b19
testb $0x30, (%rdi)
je 0x5b19
leaq 0x42a4d(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
movzwl (%rbx), %eax
movzwl %ax, %edi
callq 0xa1c8
movq %rax, %r12
movl 0x8(%rsp), %edi
callq 0x16a4f
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %edx
movq %rbp, %rcx
movq %r13, %r8
movq %r12, %r9
movl %edx, %r12d
callq 0x6354
jmp 0x5b99
movl 0x8(%rsp), %r13d
movl 0xc(%rsp), %r12d
jmp 0x5d54
testl %r8d, %r8d
movl 0x8(%rsp), %r12d
jne 0x5b7a
testb $0x30, (%rdi)
je 0x5b7a
leaq 0x429e8(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, %edi
callq 0x16a4f
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %rbp, %rdx
movl 0xc(%rsp), %r12d
movl %r12d, %ecx
callq 0x6903
xorl %r13d, %r13d
jmp 0x5d48
testl %r8d, %r8d
movl 0x8(%rsp), %r12d
jne 0x5bc1
testb $0x30, (%rdi)
je 0x5bc1
leaq 0x429a1(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
pushq $0x8
popq %rsi
movq %r15, %rdi
movq %rbp, %rdx
callq 0x4410
testq %rax, %rax
je 0x5bee
leaq 0x39ad2(%rip), %rsi     # 0x3f6ad
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x3090
testl %eax, %eax
je 0x5c9d
movl %r12d, %edi
callq 0x160f7
movl %eax, %r13d
movq 0x8(%rbx), %rcx
movl $0x2, (%rsp)
pushq $0x10
popq %r8
movq %r15, %rdi
movq %rbp, %rsi
movq %rcx, %rdx
xorl %r9d, %r9d
callq 0x6e93
movl 0xc(%rsp), %r12d
jmp 0x5d48
testl %r8d, %r8d
je 0x5c5c
leaq 0x527d9(%rip), %rax     # 0x58408
movq (%rax), %rax
testq %rax, %rax
movl 0x8(%rsp), %r13d
je 0x5ce9
movl 0x50(%rsp), %r12d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jne 0x5cfc
movq 0x8(%rbx), %r13
jmp 0x5d07
movl 0x8(%rsp), %r13d
jmp 0x5d32
leaq 0x527c3(%rip), %rax     # 0x58430
movq (%rax), %rdi
callq 0x1a575
leaq 0x527bc(%rip), %rcx     # 0x58438
movq (%rcx), %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x1a5b5
leaq 0x39a46(%rip), %rdi     # 0x3f6d5
movl %eax, %esi
xorl %eax, %eax
callq 0x3120
jmp 0x5a04
leaq 0x514dc(%rip), %rax     # 0x57180
movzwl 0x2(%rax), %eax
testw $0x104, %ax             # imm = 0x104
je 0x5cbf
leaq 0x39a00(%rip), %rdi     # 0x3f6b5
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, %edi
callq 0x16a4f
movq 0x8(%rbx), %rsi
addq $-0x8, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r15, %rdi
movl 0xc(%rsp), %r12d
movl %r12d, %ecx
callq 0x6d6c
jmp 0x5b99
leaq 0x399cf(%rip), %rdi     # 0x3f6bf
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
jmp 0x5d32
movq 0x8(%rbx), %r13
cmpq %r13, %rax
cmovbq %rax, %r13
pushq $0x1
popq %rdi
callq 0x160f7
movq 0x8(%rbx), %rdx
movl $0x2, (%rsp)
pushq $0xc
popq %r8
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rcx
movl %eax, %r13d
movl %r12d, %r9d
callq 0x6e93
movl 0xc(%rsp), %r12d
addq 0x8(%rbx), %rbp
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3210
leaq 0x51431(%rip), %rdi     # 0x57180
movl 0x58(%rsp), %r8d
testl %r8d, %r8d
jne 0x5d6f
testb $0x30, (%rdi)
je 0x5d6f
leaq 0x39f9e(%rip), %rdi     # 0x3fd03
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x16a4f
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq 0x10(%rsp), %rcx
callq 0x1783a
xorl %ebp, %ebp
movl %ebp, %edi
callq 0x160f7
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq