// File: /workspace/github_c_makefile_star2_O1/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, %r15
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %cl
xorl %ebp, %ebp
orb %al, %cl
jne 0x3e267
movq %r9, %r14
movq %rdx, %r13
movl %esi, 0x8(%rsp)
movq %r8, 0x30(%rsp)
movq %rdi, 0x18(%rsp)
movl 0x90(%rsp), %eax
movq %rax, 0x28(%rsp)
movl 0x88(%rsp), %r12d
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 %r12d, %edx
callq 0x1c020
movq %rax, %rbx
leaq 0x3a35(%rip), %rsi      # 0x41997
movq %r14, %rdi
movq %rax, %rdx
callq 0x17a47
movq 0x8(%r13), %r8
movq 0x10(%r13), %rdx
leaq (%rdx,%r15), %rsi
movzwl (%r13), %ecx
cmpl $0xe00, %ecx            # imm = 0xE00
je 0x3e02b
cmpl $0x4, %ecx
je 0x3dfa4
cmpl $0x3, %ecx
jne 0x3e03e
movq %rdx, 0x1f969(%rip)     # 0x5d908
jmp 0x3e06a
movq 0x1f95d(%rip), %rcx     # 0x5d908
testq %rcx, %rcx
je 0x3dfbe
movq $0x0, 0x1f94d(%rip) # 0x5d908
movq %rcx, %r8
leaq 0x1a1bb(%rip), %rcx     # 0x58180
movq (%rcx), %rcx
cmpl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %r15
movq %rsi, 0x8(%rsp)
movq %rax, %r14
je 0x3e071
movq %r8, %r12
btl $0x12, %ecx
jae 0x3e103
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x5605
leaq 0xc018(%rip), %rdi      # 0x4a020
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0xc058(%rip), %rdi      # 0x4a070
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
jmp 0x3e11d
xorl %ebp, %ebp
cmpl $0x0, 0x28(%rsp)
je 0x3e09c
movq 0x18(%rsp), %r12
jmp 0x3e0d2
movzwl 0x8(%rsp), %esi
movq 0x18(%rsp), %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
movq 0x20(%rsp), %r9
pushq 0x28(%rsp)
pushq %r12
pushq %rbp
pushq 0x28(%rsp)
callq 0x191ac
addq $0x20, %rsp
xorl %ebp, %ebp
jmp 0x3e267
testb $0x30, %cl
je 0x3e100
testl $0x300, %ecx            # imm = 0x300
je 0x3e107
leaq 0xa68e(%rip), %rdi      # 0x4871b
movq %r8, %r12
movq %r8, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x3e11b
leaq 0x1a0dd(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
movq 0x18(%rsp), %r12
jne 0x3e0d2
leaq 0xa729(%rip), %rdi      # 0x487ec
xorl %eax, %eax
movq %r8, %rbp
callq 0x3120
movq %rbp, %r8
movl %eax, %ebp
movq 0x10(%r13), %rdx
subq $0x8, %rsp
movzwl 0x10(%rsp), %esi
movq %r12, %rdi
movq %r15, %rcx
movq %rbx, %r9
pushq 0x18(%rsp)
pushq 0x30(%rsp)
pushq %r14
callq 0x12f22
addq $0x20, %rsp
jmp 0x3e267
movq %r8, %r12
xorl %ebp, %ebp
jmp 0x3e11d
leaq 0x7054(%rip), %rdi      # 0x45162
movq %r8, %r12
movq %r8, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
leaq 0x1a05c(%rip), %rax     # 0x58180
testb $0xc, 0x2(%rax)
je 0x3e133
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movq %r15, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq 0x8(%rsp), %rbx
movq %rbx, %rdx
callq 0x4574
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 0x112cd
addq $0x10, %rsp
cmpl $0x0, 0x28(%rsp)
je 0x3e210
leaq 0x19ff4(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x3e210
xorl %edi, %edi
callq 0x12f15
xorl %ebx, %ebx
cmpl $0x1, %eax
sete %bl
jne 0x3e1ac
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movl %ebx, %edi
callq 0x12f15
movq 0x8(%rsp), %rax
leaq (%rax,%r12), %rsi
decq %rsi
leaq 0x2f33(%rip), %rcx      # 0x410f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x10(%rsp), %rdx
callq 0x5605
leaq 0xbe6d(%rip), %rdi      # 0x4a049
xorl %eax, %eax
callq 0x3120
addl %ebp, %eax
movl %eax, %ebp
leaq 0x19f92(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x3e20b
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movq 0x30(%rsp), %rbx
xorl %eax, %eax
callq 0x9609
testw %r13w, %r13w
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x3e24d
movq %rbx, %rdi
callq 0xfdaa
testq %rax, %rax
je 0x3e24d
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 0x17530