// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/maker_asahi.c
// Function: asahi2_offset_makervalue
void
asahi2_offset_makervalue(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 jpegthumbnaillength = 0UL;
    unsigned long value_offset,max_offset;
    unsigned short marker;
    unsigned long count;
    char *nameoftag;
    char *fulldirname = CNULL;
    int status = 0;
    int chpr = 0;

    if(inptr && entry_ptr)
    {
        nameoftag = maker_tagname(entry_ptr->tag,make,model); 
        fulldirname = splice(parent_name,".",nameoftag);
        value_offset = fileoffset_base + entry_ptr->value;
        count = entry_ptr->count;

        switch(entry_ptr->tag)
        {
            case 0x0003:    /* JpegThumbnailLength                    */
                /* Just record it                                     */
                jpegthumbnaillength = entry_ptr->value;
                break;
            case 0x0004:    /* JpegThumbnailOffset                    */
                if(jpegthumbnaillength)
                {
                    count = jpegthumbnaillength;
                    jpegthumbnaillength = 0;
                }
                if(at_offset && (PRINT_SECTION))
                {
                    print_tag_address(VALUE_AT_OFFSET,value_offset,indent,prefix);
                    chpr += printf("# Start of JPEG Thumbnail from MakerNote");
                    chpr += printf(" length %ld",count); 
                }
                else if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu:%lu",value_offset,count);
                    else
                        chpr = printf("length %lu",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+SMALLINDENT);
                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");
                        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_IFD;
                        summary_entry->subfiletype = THUMBNAIL_TYPE;
                    }
                }
                /* make certain we're at the end                      */
                clearerr(inptr);
                fseek(inptr,value_offset + count,SEEK_SET);
                break;
            case 0x0e00: /* PrintIM (Epson Print Image matching)      */
                if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu",value_offset);
                }
                process_pim(inptr,byteorder,entry_ptr->value,fileoffset_base,
                    count,nameoftag,parent_name,prefix,indent);
                break;
            default:
                print_generic_offset_makervalue(inptr,byteorder,entry_ptr,
                                        fileoffset_base, fulldirname,prefix,indent,
                                        make,model,at_offset);
                break;
        }
    }
    setcharsprinted(chpr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r13
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %cl
xorl %ebp, %ebp
orb %al, %cl
jne 0x3eb5d
movq %r9, %r14
movq %rdx, %r12
movl %esi, 0x8(%rsp)
movq %r8, 0x30(%rsp)
movq %rdi, 0x18(%rsp)
movl 0x90(%rsp), %eax
movq %rax, 0x28(%rsp)
movl 0x88(%rsp), %r15d
movl 0x80(%rsp), %ebp
movl 0x78(%rsp), %eax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movzwl (%rdx), %edi
movl %ebp, %esi
movl %r15d, %edx
callq 0x1c518
movq %rax, %rbx
leaq 0x3145(%rip), %rsi      # 0x41997
movq %r14, %rdi
movq %rax, %rdx
callq 0x17f99
movq 0x8(%r12), %r8
movq 0x10(%r12), %rdx
leaq (%rdx,%r13), %rsi
movzwl (%r12), %ecx
cmpl $0xe00, %ecx            # imm = 0xE00
je 0x3e91d
cmpl $0x4, %ecx
je 0x3e896
cmpl $0x3, %ecx
jne 0x3e930
movq %rdx, 0x1f077(%rip)     # 0x5d908
jmp 0x3e95c
movq 0x1f06b(%rip), %rcx     # 0x5d908
testq %rcx, %rcx
je 0x3e8b0
movq $0x0, 0x1f05b(%rip) # 0x5d908
movq %rcx, %r8
leaq 0x198c9(%rip), %rcx     # 0x58180
movq (%rcx), %rcx
cmpl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %r15
movq %rsi, 0x8(%rsp)
movq %rax, %r14
je 0x3e963
movq %r8, %r12
btl $0x12, %ecx
jae 0x3e9f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x55eb
leaq 0xb766(%rip), %rdi      # 0x4a060
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0xb7a6(%rip), %rdi      # 0x4a0b0
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
jmp 0x3ea13
xorl %ebp, %ebp
cmpl $0x0, 0x28(%rsp)
je 0x3e991
movq 0x18(%rsp), %r15
jmp 0x3e9cc
movzwl 0x8(%rsp), %esi
movq 0x18(%rsp), %rdi
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
movq 0x20(%rsp), %r9
pushq 0x28(%rsp)
pushq %r15
pushq %rbp
pushq 0x28(%rsp)
callq 0x19706
addq $0x20, %rsp
xorl %ebp, %ebp
jmp 0x3eb5d
testb $0x30, %cl
je 0x3e9f6
testl $0x300, %ecx            # imm = 0x300
je 0x3e9fd
leaq 0x9ddc(%rip), %rdi      # 0x4875b
movq %r8, %r12
movq %r8, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x3ea11
leaq 0x197e8(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
movq 0x18(%rsp), %r15
jne 0x3e9cc
leaq 0x9e74(%rip), %rdi      # 0x4882c
xorl %eax, %eax
movq %r8, %rbp
callq 0x3120
movq %rbp, %r8
movl %eax, %ebp
movq 0x10(%r12), %rdx
subq $0x8, %rsp
movzwl 0x10(%rsp), %esi
movq %r15, %rdi
movq %r13, %rcx
movq %rbx, %r9
pushq 0x18(%rsp)
pushq 0x30(%rsp)
pushq %r14
callq 0x1337a
addq $0x20, %rsp
jmp 0x3eb5d
movq %r8, %r12
xorl %ebp, %ebp
jmp 0x3ea13
leaq 0x67a2(%rip), %rdi      # 0x451a6
movq %r8, %r12
movq %r8, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
leaq 0x19766(%rip), %rax     # 0x58180
testb $0xc, 0x2(%rax)
je 0x3ea29
movl %ebp, %edi
callq 0x1707a
movl %eax, %ebp
movq %r15, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x45af
movl %eax, %ecx
movq 0x10(%rsp), %rax
addl $0x2, %eax
movl %ecx, %r13d
movzwl %cx, %edx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rcx
movq 0x30(%rsp), %rbx
movq %rbx, %r8
movq %r14, %r9
pushq %rax
pushq 0x28(%rsp)
callq 0x11455
addq $0x10, %rsp
cmpl $0x0, 0x28(%rsp)
je 0x3eb06
leaq 0x196fe(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x3eb06
xorl %edi, %edi
callq 0x1336d
xorl %ebx, %ebx
cmpl $0x1, %eax
sete %bl
jne 0x3eaa2
movl %ebp, %edi
callq 0x1707a
movl %eax, %ebp
movl %ebx, %edi
callq 0x1336d
movq 0x8(%rsp), %rax
leaq (%rax,%r12), %rsi
decq %rsi
leaq 0x263d(%rip), %rcx      # 0x410f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x10(%rsp), %rdx
callq 0x55eb
leaq 0xb5b7(%rip), %rdi      # 0x4a089
xorl %eax, %eax
callq 0x3120
addl %ebp, %eax
movl %eax, %ebp
leaq 0x1969c(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x3eb01
movl %ebp, %edi
callq 0x1707a
movl %eax, %ebp
movq 0x30(%rsp), %rbx
xorl %eax, %eax
callq 0x9734
testw %r13w, %r13w
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x3eb43
movq %rbx, %rdi
callq 0xfed1
testq %rax, %rax
je 0x3eb43
orb $0x1, 0x19(%rax)
movl $0x5, 0x118(%rax)
movl $0x2, 0xc4(%rax)
movq %r15, %rdi
callq 0x31b0
addq 0x8(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3210
movl %ebp, %edi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17a82