// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/maker_olympus.c
// Function: olympus2020_offset_value
void
olympus2020_offset_value(FILE *inptr,unsigned short byteorder,
    struct ifd_entry *entry_ptr,unsigned long fileoffset_base,
    struct image_summary *summary_entry,char *parent_name,char*prefix,
    int indent,int make,int model,int at_offset)
{
    static unsigned long jpegthumbnailoffset = 0UL;
    static unsigned long jpegthumbnailvalid = 1UL;
    unsigned long value_offset,max_offset;
    unsigned long count;
    unsigned short marker;
    char *nameoftag;
    char *fulldirname = CNULL;
    int status = 0;
    int chpr = 0;

    if(entry_ptr)
    {
        nameoftag = maker_tagname(entry_ptr->tag,make,model); 
        if((PRINT_LONGNAMES))
        {
            fulldirname = splice(parent_name,".",nameoftag);
            nameoftag = fulldirname;
        }
        value_offset = fileoffset_base + entry_ptr->value;
        count = entry_ptr->count;
        switch(entry_ptr->tag)
        {
            case 0x0100: /* JPEG Thumbnail valid                      */
                /* The default is 1 (valid), so this can turn off     */
                /* processing if present and 0. Better to attempt     */
                /* processing when invalid than miss a valid image.   */
                jpegthumbnailvalid = value_offset;
                break;
            case 0x0101: /* JPEG Thumbnail offset                     */
                jpegthumbnailoffset = value_offset;
                if(!(PRINT_VALUE_AT_OFFSET))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu",jpegthumbnailoffset);
                }
                break;
            case 0x0102: /* JPEG Thumbnail length                     */
                if(jpegthumbnailvalid == 0)
                {
                    jpegthumbnailvalid = 0;
                    break;
                }
                if(jpegthumbnailoffset)
                {
                    count = entry_ptr->value;
                    value_offset = jpegthumbnailoffset;
                    jpegthumbnailoffset = 0UL;
                }
                else
                {
                    printred("# Warning: no thumbnail offset");
                    break;
                }
                indent += SMALLINDENT;
                if(at_offset && (PRINT_SECTION))
                {
                    print_tag_address(VALUE_AT_OFFSET,value_offset,indent,prefix);
                    chpr += printf("# Start of JPEG Thumbnail from MakerNote SubIFD");
                    chpr += printf(" length %ld",count); 
                }
                if((PRINT_SECTION) || (PRINT_SEGMENT))
                    chpr = newline(chpr);
                marker = read_ushort(inptr,TIFF_MOTOROLA,value_offset);
                max_offset = process_jpeg_segments(inptr,value_offset,marker,
                                            count,summary_entry,fulldirname,
                                                prefix,indent+MEDIUMINDENT);
                if(at_offset)
                {
                    if((PRINT_SECTION))
                    {
                        if((status = jpeg_status(0) == JPEG_EARLY_EOI))
                            chpr = newline(chpr);
                        jpeg_status(status);
                        print_tag_address(VALUE_AT_OFFSET,value_offset + count - 1,
                                                                        indent,"-");
                        chpr += printf("# End of JPEG Thumbnail from MakerNote SubIFD");
                        if((PRINT_ENTRY) && !(PRINT_VALUE))
                            chpr = newline(chpr);
                    }
                }
                print_jpeg_status();
                if(marker && summary_entry)
                { 
                    /* The new one is on the end of the chain         */
                    if((summary_entry = last_summary_entry(summary_entry)))
                    {
                        summary_entry->filesubformat |= FILESUBFMT_MNOTE;
                        summary_entry->datatype = MAKER_SUBIFD;
                        summary_entry->subfiletype = REDUCED_RES_TYPE;
                    }
                }
                /* make certain we're at the end                      */
                clearerr(inptr);
                fseek(inptr,value_offset + count,SEEK_SET);
                break;
            case 0x0304:
            case 0x0503:
            case 0x0505:
            case 0x0506:
            case 0x050f:
            default:
                print_private_offset_value(inptr,byteorder,entry_ptr,
                                        fileoffset_base,0x2020,
                                        fulldirname,prefix,indent,
                                        make,model,at_offset);
                break;
        }
        if(fulldirname)
            free(fulldirname);
    }
    setcharsprinted(chpr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movw %si, %ax
movl 0x30(%rbp), %esi
movl 0x28(%rbp), %esi
movl 0x20(%rbp), %esi
movl 0x18(%rbp), %esi
movq 0x10(%rbp), %rsi
movq %rdi, -0x18(%rbp)
movw %ax, -0x1a(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4610c
movq -0x28(%rbp), %rax
movw (%rax), %ax
movl 0x20(%rbp), %esi
movl 0x28(%rbp), %edx
movzwl %ax, %edi
callq 0x28160
movq %rax, -0x68(%rbp)
leaq 0x31476(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x45d37
movq -0x40(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0x1ec3c(%rip), %rsi     # 0x64962
callq 0x20960
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x7c(%rbp)
subl $0x100, %eax            # imm = 0x100
je 0x45dcb
jmp 0x45d69
movl -0x7c(%rbp), %eax
subl $0x101, %eax            # imm = 0x101
je 0x45ddb
jmp 0x45d75
movl -0x7c(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x45e34
jmp 0x45d85
movl -0x7c(%rbp), %eax
subl $0x304, %eax            # imm = 0x304
je 0x460ae
jmp 0x45d95
movl -0x7c(%rbp), %eax
subl $0x503, %eax            # imm = 0x503
je 0x460ae
jmp 0x45da5
movl -0x7c(%rbp), %eax
addl $0xfffffafb, %eax       # imm = 0xFFFFFAFB
subl $0x2, %eax
jb 0x460ae
jmp 0x45db8
movl -0x7c(%rbp), %eax
subl $0x50f, %eax            # imm = 0x50F
je 0x460ae
jmp 0x460b0
movq -0x48(%rbp), %rax
movq %rax, 0x3261a(%rip)     # 0x783f0
jmp 0x460fa
movq -0x48(%rbp), %rax
movq %rax, 0x36b52(%rip)     # 0x7c938
leaq 0x31393(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
jne 0x45e2f
leaq 0x3137d(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x300, %rax            # imm = 0x300
cmpq $0x0, %rax
jne 0x45e2d
movq 0x36b1f(%rip), %rsi     # 0x7c938
leaq 0x24f6b(%rip), %rdi     # 0x6ad8b
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x45e2f
jmp 0x460fa
cmpq $0x0, 0x325b4(%rip)     # 0x783f0
jne 0x45e4e
movq $0x0, 0x325a7(%rip) # 0x783f0
jmp 0x460fa
cmpq $0x0, 0x36ae2(%rip)     # 0x7c938
je 0x45e7c
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movq 0x36acd(%rip), %rax     # 0x7c938
movq %rax, -0x48(%rbp)
movq $0x0, 0x36abe(%rip) # 0x7c938
jmp 0x45e8d
leaq 0x27990(%rip), %rdi     # 0x6d813
callq 0x6860
jmp 0x460fa
movl 0x18(%rbp), %eax
addl $0x2, %eax
movl %eax, 0x18(%rbp)
cmpl $0x0, 0x30(%rbp)
je 0x45ef3
leaq 0x312dd(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x45ef3
movq -0x48(%rbp), %rsi
movl 0x18(%rbp), %edx
movq 0x10(%rbp), %rcx
movl $0x1000000, %edi        # imm = 0x1000000
callq 0x5ed0
leaq 0x27964(%rip), %rdi     # 0x6d832
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x58(%rbp), %rsi
leaq 0x26926(%rip), %rdi     # 0x6c80c
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq 0x31286(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
jne 0x45f1f
leaq 0x31270(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
je 0x45f2a
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4480
movw %ax, -0x5a(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movw -0x5a(%rbp), %dx
movq -0x58(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x70(%rbp), %r9
movq 0x10(%rbp), %r10
movl 0x18(%rbp), %eax
addl $0x4, %eax
movzwl %dx, %edx
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x17470
movq %rax, -0x50(%rbp)
cmpl $0x0, 0x30(%rbp)
je 0x46038
leaq 0x311f9(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x46036
xorl %edi, %edi
callq 0x19930
cmpl $0x1, %eax
sete %al
movb %al, %cl
andb $0x1, %cl
movzbl %cl, %ecx
movl %ecx, -0x74(%rbp)
testb $0x1, %al
jne 0x45fb8
jmp 0x45fc3
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
movl -0x74(%rbp), %edi
callq 0x19930
movq -0x48(%rbp), %rsi
addq -0x58(%rbp), %rsi
subq $0x1, %rsi
movl 0x18(%rbp), %edx
movl $0x1000000, %edi        # imm = 0x1000000
leaq 0x1e113(%rip), %rcx     # 0x640f9
callq 0x5ed0
leaq 0x27870(%rip), %rdi     # 0x6d862
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq 0x3117a(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x4003333, %rax        # imm = 0x4003333
cmpq $0x0, %rax
je 0x46034
leaq 0x31164(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
jne 0x46034
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
jmp 0x46036
jmp 0x46038
movb $0x0, %al
callq 0xba00
movzwl -0x5a(%rbp), %eax
cmpl $0x0, %eax
je 0x46090
cmpq $0x0, -0x38(%rbp)
je 0x46090
movq -0x38(%rbp), %rdi
callq 0x15780
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x4608e
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl $0x6, 0x118(%rax)
movq -0x38(%rbp), %rax
movl $0x5, 0xc4(%rax)
jmp 0x46090
movq -0x18(%rbp), %rdi
callq 0x31a0
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq -0x58(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
jmp 0x460fa
jmp 0x460b0
movq -0x18(%rbp), %rdi
movw -0x1a(%rbp), %si
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x70(%rbp), %r9
movq 0x10(%rbp), %r14
movl 0x18(%rbp), %ebx
movl 0x20(%rbp), %r11d
movl 0x28(%rbp), %r10d
movl 0x30(%rbp), %eax
movl $0x2020, %r8d           # imm = 0x2020
movzwl %si, %esi
movq %r14, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0xd160
cmpq $0x0, -0x70(%rbp)
je 0x4610a
movq -0x70(%rbp), %rdi
callq 0x3040
jmp 0x4610c
movl -0x78(%rbp), %edi
callq 0x1ff00
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq