// File: /workspace/github_c_makefile_star2_O1/hfiguiere[P]exifprobe/maker_asahi.c
// Function: asahi1_offset_makervalue
void
asahi1_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)
{
    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 0x0004:    /* JpegThumbnailOffset                    */
                /* These models provide the 0x2000 tag as well as the */
                /* 0x0003/0x0004 tags. Both entries point to the same */
                /* thumbnail, so just print values for length and     */
                /* offset tags, and display the thumbnail on the      */
                /* (self-contained) 0x2000 tag                        */
                if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu",value_offset);
                }
                break;
            case 0x2000: /* Jpeg Thumbnail as UNDEFINED section       */
                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 %lu",count); 
                }
                else if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu:%lu    # UNDEFINED",value_offset,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:%lu",value_offset,count);
                        chpr = newline(chpr);
                    }
                }
                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;
        }
        if(fulldirname)
            free(fulldirname);
    }
    setcharsprinted(chpr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %cl
xorl %r12d, %r12d
orb %al, %cl
jne 0x3e652
movq %r9, %r13
movq %rdx, %rbp
movl %esi, 0x10(%rsp)
movq %r8, 0x40(%rsp)
movq %rdi, 0x8(%rsp)
movl 0xa0(%rsp), %eax
movq %rax, 0x28(%rsp)
movl 0x98(%rsp), %r15d
movl 0x90(%rsp), %r12d
movl 0x88(%rsp), %eax
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movzwl (%rdx), %edi
movl %r12d, %esi
movl %r15d, %edx
callq 0x1c020
movq %rax, %r14
leaq 0x3692(%rip), %rsi      # 0x41997
movq %r13, %rdi
movq %rax, %rdx
callq 0x17a47
movq %rax, 0x20(%rsp)
movq 0x10(%rbp), %rsi
addq %rbx, %rsi
movq 0x8(%rbp), %r8
movzwl (%rbp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
je 0x3e39b
cmpl $0xe00, %eax            # imm = 0xE00
je 0x3e383
cmpl $0x4, %eax
jne 0x3e411
xorl %r12d, %r12d
cmpl $0x0, 0x28(%rsp)
movq 0x20(%rsp), %r13
jne 0x3e645
leaq 0x19e2b(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
jne 0x3e645
leaq 0xa478(%rip), %rdi      # 0x487ec
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
jmp 0x3e645
xorl %r12d, %r12d
cmpl $0x0, 0x28(%rsp)
je 0x3e44b
movq 0x8(%rsp), %r15
jmp 0x3e48c
leaq 0x19dde(%rip), %r14     # 0x58180
movq (%r14), %rax
cmpl $0x0, 0x28(%rsp)
movq %rsi, 0x10(%rsp)
movq %r8, 0x38(%rsp)
je 0x3e4bf
btl $0x12, %eax
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %r15
jae 0x3e4f0
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x18(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %r8, %r12
callq 0x5605
leaq 0xbc34(%rip), %rdi      # 0x4a020
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0xa31e(%rip), %rdi      # 0x4871a
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
addl %ebx, %r12d
jmp 0x3e4f3
movzwl 0x10(%rsp), %esi
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
movq %rbx, %rcx
movq 0x20(%rsp), %r13
movq %r13, %r8
movq 0x30(%rsp), %r9
pushq 0x28(%rsp)
pushq %r15
pushq %r12
pushq 0x30(%rsp)
callq 0x191ac
addq $0x20, %rsp
xorl %r12d, %r12d
jmp 0x3e645
leaq 0x19d2e(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
movq 0x8(%rsp), %r15
jne 0x3e48c
leaq 0x6cf0(%rip), %rdi      # 0x45162
movq %r8, %rdx
xorl %eax, %eax
movq %r8, %r12
callq 0x3120
movl %eax, %edi
callq 0x16b56
movq %r12, %r8
movl %eax, %r12d
movq 0x10(%rbp), %rdx
subq $0x8, %rsp
movzwl 0x18(%rsp), %esi
movq %r15, %rdi
movq %rbx, %rcx
movq %r14, %r9
pushq 0x20(%rsp)
pushq 0x40(%rsp)
pushq %r13
callq 0x12f22
addq $0x20, %rsp
movq 0x20(%rsp), %r13
jmp 0x3e645
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %r15
jne 0x3e4f0
leaq 0x1011b(%rip), %rdi     # 0x4e5fc
movq %r8, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
jmp 0x3e4f3
xorl %r12d, %r12d
testb $0xc, 0x2(%r14)
je 0x3e505
movl %r12d, %edi
callq 0x16b56
movl %eax, %r12d
movq %r15, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq 0x10(%rsp), %rbp
movq %rbp, %rdx
callq 0x4574
movl %eax, %ebx
movq 0x18(%rsp), %rax
addl $0x2, %eax
movzwl %bx, %edx
movq %r15, %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %r8
movq %r13, %r9
pushq %rax
pushq 0x38(%rsp)
callq 0x112cd
addq $0x10, %rsp
cmpl $0x0, 0x28(%rsp)
je 0x3e5eb
testb $0x4, 0x2(%r14)
je 0x3e5eb
xorl %edi, %edi
callq 0x12f15
xorl %ebp, %ebp
cmpl $0x1, %eax
sete %bpl
jne 0x3e57b
movl %r12d, %edi
callq 0x16b56
movl %eax, %r12d
movl %r12d, %r15d
movl %ebp, %edi
callq 0x12f15
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
leaq (%rax,%rcx), %rsi
decq %rsi
leaq 0x2b5c(%rip), %rcx      # 0x410f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x18(%rsp), %rdx
callq 0x5605
leaq 0xba96(%rip), %rdi      # 0x4a049
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
addl %r15d, %r12d
leaq 0x19bb9(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x3e5e6
movl %r12d, %edi
callq 0x16b56
movl %eax, %r12d
movq 0x8(%rsp), %r15
xorl %eax, %eax
callq 0x9609
testw %bx, %bx
sete %al
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x3e629
callq 0xfdaa
testq %rax, %rax
je 0x3e629
orb $0x1, 0x19(%rax)
movl $0x5, 0x118(%rax)
movl $0x2, 0xc4(%rax)
movq %r15, %rdi
callq 0x31b0
movq 0x10(%rsp), %rsi
addq 0x38(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x3210
testq %r13, %r13
je 0x3e652
movq %r13, %rdi
callq 0x3050
movl %r12d, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17530