// File: /workspace/github_c_makefile_star2_O2/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 0x3cb39
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 0x1b2e4
movq %rax, %rbx
leaq 0x3161(%rip), %rsi      # 0x3f997
movq %r14, %rdi
movq %rax, %rdx
callq 0x16f1d
movq 0x8(%r12), %r8
movq 0x10(%r12), %rdx
leaq (%rdx,%r13), %rsi
movzwl (%r12), %ecx
cmpl $0xe00, %ecx            # imm = 0xE00
je 0x3c8fe
cmpl $0x4, %ecx
je 0x3c87a
cmpl $0x3, %ecx
jne 0x3c911
movq %rdx, 0x20093(%rip)     # 0x5c908
jmp 0x3c93d
movq 0x20087(%rip), %rcx     # 0x5c908
testq %rcx, %rcx
je 0x3c891
andq $0x0, 0x2007a(%rip)     # 0x5c908
movq %rcx, %r8
leaq 0x1a8e8(%rip), %rcx     # 0x57180
movq (%rcx), %rcx
cmpl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %r15
movq %rsi, 0x8(%rsp)
movq %rax, %r14
je 0x3c944
movq %r8, %r12
btl $0x12, %ecx
jae 0x3c9d5
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x5100
leaq 0xb735(%rip), %rdi      # 0x48010
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0xb775(%rip), %rdi      # 0x48060
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
jmp 0x3c9ef
xorl %ebp, %ebp
cmpl $0x0, 0x28(%rsp)
je 0x3c96e
movq 0x18(%rsp), %r15
jmp 0x3c9a8
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 0x185a8
addq $0x20, %rsp
xorl %ebp, %ebp
jmp 0x3cb39
testb $0x30, %cl
je 0x3c9d2
testw $0x300, %cx             # imm = 0x300
je 0x3c9d9
leaq 0x9dac(%rip), %rdi      # 0x4670b
movq %r8, %r12
movq %r8, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x3c9ed
leaq 0x1a80b(%rip), %rax     # 0x57180
movq (%rax), %rax
testb $0x30, %al
sete %cl
testw $0x300, %ax             # imm = 0x300
setne %al
orb %cl, %al
movq 0x18(%rsp), %r15
jne 0x3c9a8
leaq 0x9e48(%rip), %rdi      # 0x467dc
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 0x125a8
addq $0x20, %rsp
jmp 0x3cb39
movq %r8, %r12
xorl %ebp, %ebp
jmp 0x3c9ef
leaq 0x6782(%rip), %rdi      # 0x43162
movq %r8, %r12
movq %r8, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
leaq 0x1a78a(%rip), %rax     # 0x57180
testb $0xc, 0x2(%rax)
je 0x3ca05
movl %ebp, %edi
callq 0x160f7
movl %eax, %ebp
movq %r15, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x416a
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 0x105af
addq $0x10, %rsp
cmpl $0x0, 0x28(%rsp)
je 0x3cae2
leaq 0x1a722(%rip), %rax     # 0x57180
testb $0x4, 0x2(%rax)
je 0x3cae2
xorl %edi, %edi
callq 0x1259b
xorl %ebx, %ebx
cmpl $0x1, %eax
sete %bl
jne 0x3ca7e
movl %ebp, %edi
callq 0x160f7
movl %eax, %ebp
movl %ebx, %edi
callq 0x1259b
movq 0x8(%rsp), %rax
leaq (%rax,%r12), %rsi
decq %rsi
leaq 0x2661(%rip), %rcx      # 0x3f0f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x10(%rsp), %rdx
callq 0x5100
leaq 0xb58b(%rip), %rdi      # 0x48039
xorl %eax, %eax
callq 0x3120
addl %ebp, %eax
movl %eax, %ebp
leaq 0x1a6c0(%rip), %rax     # 0x57180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x3cadd
movl %ebp, %edi
callq 0x160f7
movl %eax, %ebp
movq 0x30(%rsp), %rbx
xorl %eax, %eax
callq 0x8fb2
testw %r13w, %r13w
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x3cb1f
movq %rbx, %rdi
callq 0xf111
testq %rax, %rax
je 0x3cb1f
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 0x16a4f