// File: /workspace/github_c_makefile_star2_O1/hfiguiere[P]exifprobe/maker_nikon.c
// Function: nikon1_offset_makervalue
void
nikon1_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 max_offset = 0;
    unsigned long value_offset;
    unsigned long count;
    unsigned long dumplength;
    unsigned short marker;
    int status = 0;
    int chpr = 0;
    char *nameoftag;
    char *fulldirname = NULL;

    if(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 0x0100: /* Jpeg Thumbnail                            */
                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:%-9lu",value_offset,count);
                    else
                        chpr += printf(":%-9lu", count);
                    if(!(PRINT_VALUE_AT_OFFSET))
                        chpr += printf(" # UNDEFINED");
                }
                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");
                        chpr += printf(" length %ld",count); 
                        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 0x0f00: /* Data                                      */
                if(at_offset && (PRINT_ENTRY))
                {
                    print_tag_address(ENTRY,value_offset,indent,prefix);
                    print_makertagid(entry_ptr,25," : ",make,model);
                    chpr += printf("length %-9lu # UNDEFINED", count);
                }
                else if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu:%lu",value_offset,count);
                    else
                        chpr += printf(":%lu", count);
                    if(!(PRINT_VALUE_AT_OFFSET))
                        chpr += printf(" # UNDEFINED");
                }
                if(Max_undefined == 0)
                {
                    if(chpr)
                        printred(" (not dumped, use -U)");
                }
                else
                {
                    if((Max_undefined == DUMPALL) || (Max_undefined > count))
                        dumplength = count;
                    else 
                        dumplength = Max_undefined;
                    chpr = newline(chpr);
                    hexdump(inptr,value_offset,count,dumplength,12,
                                        indent,SUBINDENT);
                    chpr = newline(1);
                }
                /* make certain we're at the end                      */
                fseek(inptr,value_offset + count,SEEK_SET);
                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 $0x38, %rsp
testq %rdx, %rdx
je 0x2bddf
movq %r9, %r15
movq %rcx, %r13
movq %rdx, %r14
movl %esi, %ebx
movq %r8, 0x30(%rsp)
movq %rdi, 0x18(%rsp)
movl 0x90(%rsp), %eax
movq %rax, 0x10(%rsp)
movl 0x88(%rsp), %r12d
movl 0x80(%rsp), %ebp
movl 0x78(%rsp), %eax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x28(%rsp)
movzwl (%rdx), %edi
movl %ebp, %esi
movl %r12d, %edx
callq 0x1c020
leaq 0x15c60(%rip), %rsi     # 0x41997
movq %r15, %rdi
movq %rax, %rdx
callq 0x17a47
movq 0x10(%r14), %r15
addq %r13, %r15
movq 0x8(%r14), %rcx
movq %rcx, 0x8(%rsp)
movzwl (%r14), %ecx
cmpl $0xf00, %ecx            # imm = 0xF00
je 0x2bde6
cmpl $0x100, %ecx            # imm = 0x100
jne 0x2be5c
leaq 0x2c40b(%rip), %r14     # 0x58180
movq (%r14), %rcx
movq 0x10(%rsp), %rbx
testl %ebx, %ebx
je 0x2be90
btl $0x12, %ecx
movq %rax, %r13
movq 0x18(%rsp), %r12
jae 0x2beba
movl $0x1000000, %edi        # imm = 0x1000000
movq %r15, %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0x5605
leaq 0x1e26b(%rip), %rdi     # 0x4a020
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0x1c955(%rip), %rdi     # 0x4871a
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
movq 0x10(%rsp), %rbx
jmp 0x2bf32
xorl %ebp, %ebp
jmp 0x2c13c
leaq 0x2c393(%rip), %rbx     # 0x58180
movq (%rbx), %rcx
cmpl $0x0, 0x10(%rsp)
je 0x2bebe
testl $0x4003333, %ecx        # imm = 0x4003333
movq %rax, %r13
je 0x2bef2
movl $0x4003333, %edi        # imm = 0x4003333
movq %r15, %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0x5605
leaq 0x1aa58(%rip), %rdx     # 0x46880
movq %r14, %rdi
movl $0x19, %esi
movl %ebp, %ecx
movl %r12d, %r8d
callq 0x1910e
leaq 0x15ea4(%rip), %rdi     # 0x41ce5
movq 0x8(%rsp), %r12
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
movq 0x18(%rsp), %r14
jmp 0x2c0aa
movzwl %bx, %esi
movq 0x18(%rsp), %rdi
movq %r14, %rdx
movq %r13, %rcx
movq %rax, %r13
movq %rax, %r8
movq 0x28(%rsp), %r9
pushq 0x10(%rsp)
pushq %r12
pushq %rbp
pushq 0x38(%rsp)
callq 0x191ac
addq $0x20, %rsp
xorl %ebp, %ebp
jmp 0x2c12f
testb $0x30, %cl
movq %rax, %r13
movq 0x18(%rsp), %r12
je 0x2beba
testl $0x300, %ecx            # imm = 0x300
je 0x2bf03
leaq 0x18a71(%rip), %rdi     # 0x4491d
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x2bf19
xorl %ebp, %ebp
jmp 0x2bf32
testb $0x30, %cl
movq %rax, %r13
je 0x2bef2
testl $0x300, %ecx            # imm = 0x300
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %r12
je 0x2c07e
leaq 0x19283(%rip), %rdi     # 0x45166
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x2c092
xorl %ebp, %ebp
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %r12
jmp 0x2c0aa
leaq 0x18a0f(%rip), %rdi     # 0x44919
movq %r15, %rsi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testb $0x1, 0x3(%r14)
jne 0x2bf32
leaq 0x15ddd(%rip), %rdi     # 0x41d06
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
testb $0xc, 0x2(%r14)
je 0x2bf42
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movq %r12, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq %r15, %rdx
callq 0x4574
movl %eax, %ecx
movq 0x20(%rsp), %rax
addl $0x2, %eax
movw %cx, 0x10(%rsp)
movzwl %cx, %edx
movq %r12, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rcx
movq 0x30(%rsp), %r8
movq %r13, %r9
pushq %rax
pushq 0x30(%rsp)
callq 0x112cd
addq $0x10, %rsp
testl %ebx, %ebx
je 0x2c026
testb $0x4, 0x2(%r14)
je 0x2c026
xorl %edi, %edi
callq 0x12f15
xorl %ebx, %ebx
cmpl $0x1, %eax
sete %bl
jne 0x2bfb2
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movl %ebx, %edi
callq 0x12f15
movq 0x8(%rsp), %r14
leaq (%r15,%r14), %rsi
decq %rsi
leaq 0x1512d(%rip), %rcx     # 0x410f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x20(%rsp), %rdx
callq 0x5605
leaq 0x1e067(%rip), %rdi     # 0x4a049
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %ebp, %ebx
leaq 0x1e07c(%rip), %rdi     # 0x4a070
movq %r14, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
leaq 0x2c177(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x2c026
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movzwl 0x10(%rsp), %ebx
xorl %eax, %eax
callq 0x9609
testw %bx, %bx
sete %al
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x2c069
callq 0xfdaa
testq %rax, %rax
je 0x2c069
orb $0x1, 0x19(%rax)
movl $0x5, 0x118(%rax)
movl $0x2, 0xc4(%rax)
movq %r12, %rdi
callq 0x31b0
addq 0x8(%rsp), %r15
movq %r12, %rdi
jmp 0x2c125
leaq 0x190dd(%rip), %rdi     # 0x45162
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testb $0x1, 0x3(%rbx)
jne 0x2c0aa
leaq 0x15c65(%rip), %rdi     # 0x41d06
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
leaq 0x2d357(%rip), %rax     # 0x59408
movq (%rax), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r12, %rbx
cmpq %rcx, %rax
je 0x2c0e6
testq %rax, %rax
jne 0x2c0dc
testl %ebp, %ebp
je 0x2c151
leaq 0x155ea(%rip), %rdi     # 0x416bf
callq 0x5c33
jmp 0x2c11f
cmpq %r12, %rax
cmovaeq %r12, %rax
movq %rax, %rbx
movl %ebp, %edi
callq 0x16b56
subq $0x8, %rsp
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
movl $0xc, %r8d
movq 0x28(%rsp), %r9
pushq $0x2
callq 0x7446
addq $0x10, %rsp
movl $0x1, %edi
callq 0x16b56
movl %eax, %ebp
addq %r12, %r15
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3210
testq %r13, %r13
je 0x2c13c
movq %r13, %rdi
callq 0x3050
movl %ebp, %edi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17530
xorl %ebp, %ebp
jmp 0x2c11f