// File: /workspace/github_c_makefile_star2_O3/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 0x3ef49
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 0x1c518
movq %rax, %r14
leaq 0x2d9c(%rip), %rsi      # 0x41997
movq %r13, %rdi
movq %rax, %rdx
callq 0x17f99
movq %rax, 0x20(%rsp)
movq 0x8(%rbp), %r8
movq 0x10(%rbp), %rdx
leaq (%rdx,%rbx), %rsi
movzwl (%rbp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
je 0x3ec92
cmpl $0xe00, %eax            # imm = 0xE00
je 0x3ec7a
cmpl $0x4, %eax
jne 0x3ed08
xorl %r12d, %r12d
cmpl $0x0, 0x28(%rsp)
movq 0x20(%rsp), %r13
jne 0x3ef3c
leaq 0x19534(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
jne 0x3ef3c
leaq 0x9bc1(%rip), %rdi      # 0x4882c
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
jmp 0x3ef3c
xorl %r12d, %r12d
cmpl $0x0, 0x28(%rsp)
je 0x3ed42
movq 0x8(%rsp), %r15
jmp 0x3ed87
leaq 0x194e7(%rip), %r14     # 0x58180
movq (%r14), %rax
cmpl $0x0, 0x28(%rsp)
movq %rsi, 0x10(%rsp)
movq %r8, 0x38(%rsp)
je 0x3edb6
btl $0x12, %eax
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %r15
jae 0x3ede7
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x18(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %r8, %r12
callq 0x55eb
leaq 0xb37d(%rip), %rdi      # 0x4a060
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0x9a67(%rip), %rdi      # 0x4875a
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
addl %ebx, %r12d
jmp 0x3edea
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 0x19706
addq $0x20, %rsp
xorl %r12d, %r12d
jmp 0x3ef3c
leaq 0x19437(%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 0x3ed87
leaq 0x643d(%rip), %rdi      # 0x451a6
movq %r8, %rdx
xorl %eax, %eax
movq %r8, %r12
callq 0x3120
movl %eax, %edi
callq 0x1707a
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 0x1337a
addq $0x20, %rsp
movq 0x20(%rsp), %r13
jmp 0x3ef3c
testb $0x30, %al
sete %cl
testl $0x300, %eax            # imm = 0x300
setne %al
orb %cl, %al
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %r15
jne 0x3ede7
leaq 0xf864(%rip), %rdi      # 0x4e63c
movq %r8, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
jmp 0x3edea
xorl %r12d, %r12d
testb $0xc, 0x2(%r14)
je 0x3edfc
movl %r12d, %edi
callq 0x1707a
movl %eax, %r12d
movq %r15, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq 0x10(%rsp), %rbp
movq %rbp, %rdx
callq 0x45af
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 0x11455
addq $0x10, %rsp
cmpl $0x0, 0x28(%rsp)
je 0x3eee2
testb $0x4, 0x2(%r14)
je 0x3eee2
xorl %edi, %edi
callq 0x1336d
xorl %ebp, %ebp
cmpl $0x1, %eax
sete %bpl
jne 0x3ee72
movl %r12d, %edi
callq 0x1707a
movl %eax, %r12d
movl %r12d, %r15d
movl %ebp, %edi
callq 0x1336d
movq 0x10(%rsp), %rax
movq 0x38(%rsp), %rcx
leaq (%rax,%rcx), %rsi
decq %rsi
leaq 0x2265(%rip), %rcx      # 0x410f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x18(%rsp), %rdx
callq 0x55eb
leaq 0xb1df(%rip), %rdi      # 0x4a089
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
addl %r15d, %r12d
leaq 0x192c2(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x3eedd
movl %r12d, %edi
callq 0x1707a
movl %eax, %r12d
movq 0x8(%rsp), %r15
xorl %eax, %eax
callq 0x9734
testw %bx, %bx
sete %al
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x3ef20
callq 0xfed1
testq %rax, %rax
je 0x3ef20
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 0x3ef49
movq %r13, %rdi
callq 0x3050
movl %r12d, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17a82