// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/maker_casio.c
// Function: casio2_offset_makervalue
void
casio2_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,current_offset;
    unsigned long count;
    unsigned short marker;
    char *nameoftag;
    char *fulldirname = NULL;
    unsigned long max_offset = 0;
    int status = 0;
    int chpr = 0;

    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 0x0004:    /* JpegThumbnailOffset                    */
                /* When this tag is present, the 0x2000 tag is        */
                /* present as well. 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:   /* JpegThumbnail                           */
                if(at_offset && (PRINT_SECTION))
                {
                    print_tag_address(SECTION,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,entry_ptr->count);
                    else
                        chpr += printf("length %lu", entry_ptr->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,prefix);
                        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)  */
                nameoftag = maker_tagname(entry_ptr->tag,make,model); 
                if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu",value_offset);
                }
                current_offset = ftell(inptr);
                if(process_pim(inptr,byteorder,entry_ptr->value,fileoffset_base,
                    entry_ptr->count,nameoftag,parent_name,prefix,indent) == 0)
                {
                    /* At least one QV4000 image uses a PIM offset    */
                    /* relative to the entry address, even though     */
                    /* other entries in the note are TIFF-relative;   */
                    /* check for a PIM entry at that location if the  */
                    /* previous one failed. GROSS HACK!               */
                    fileoffset_base = current_offset - 12;
                    PUSHCOLOR(HI_BLACK);
                    /* We've already seen an error message            */
                    chpr += printf(" checking for entry-relative offset bug");
                    POPCOLOR();
                    if(process_pim(inptr,byteorder,entry_ptr->value,fileoffset_base,
                                    entry_ptr->count,nameoftag,parent_name,
                                    prefix,indent))
                    {
                        if(!(PRINT_OFFSET))
                        {
                            chpr = newline(chpr);
                            chpr += printf("# WARNING:");
                        }
                        PUSHCOLOR(HI_BLACK);
                        chpr += printf(" PrintImage data found at offset %lu - ",
                                                    entry_ptr->value + fileoffset_base);
                        printred("start offset is incorrect!");
                        POPCOLOR();
                        if(!(PRINT_SECTION))
                        {
                            chpr = newline(chpr);
                            print_tag_address(VALUE_AT_OFFSET,entry_ptr->value + fileoffset_base,
                                                        indent,"-");
                            if((PRINT_TAGINFO))
                            {
                                if((PRINT_LONGNAMES))
                                    chpr += printf("%s.",fulldirname);
                                chpr += printf("%-*.*s",MAKERTAGWIDTH,MAKERTAGWIDTH,nameoftag);
                            }
                            if((PRINT_VALUE))
                                chpr += printf(" = @%lu",entry_ptr->value + fileoffset_base);
                        }
                    }
                }
                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
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
movw %si, %ax
movl 0x30(%rbp), %esi
movl 0x28(%rbp), %esi
movl 0x20(%rbp), %esi
movl 0x18(%rbp), %esi
movq 0x10(%rbp), %rsi
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x49430
movq -0x20(%rbp), %rax
movzwl (%rax), %edi
movl 0x20(%rbp), %esi
movl 0x28(%rbp), %edx
callq 0x28160
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq 0x1bb1d(%rip), %rsi     # 0x64962
callq 0x20960
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x7c(%rbp)
subl $0x4, %eax
je 0x48e9d
jmp 0x48e7e
movl -0x7c(%rbp), %eax
subl $0xe00, %eax            # imm = 0xE00
je 0x49178
jmp 0x48e8e
movl -0x7c(%rbp), %eax
subl $0x2000, %eax           # imm = 0x2000
je 0x48eec
jmp 0x493df
cmpl $0x0, 0x30(%rbp)
jne 0x48ee7
leaq 0x2e2d6(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x48ee7
leaq 0x2e2c2(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x300, %rax            # imm = 0x300
cmpq $0x0, %rax
jne 0x48ee5
movq -0x40(%rbp), %rsi
leaq 0x21eb3(%rip), %rdi     # 0x6ad8b
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x48ee7
jmp 0x4941e
cmpl $0x0, 0x30(%rbp)
je 0x48f4b
leaq 0x2e287(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x48f4b
movq -0x40(%rbp), %rsi
movl 0x18(%rbp), %edx
movq 0x10(%rbp), %rcx
movl $0x40000, %edi          # imm = 0x40000
callq 0x5ed0
leaq 0x23898(%rip), %rdi     # 0x6c7bc
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x50(%rbp), %rsi
leaq 0x238d0(%rip), %rdi     # 0x6c80c
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x48fbd
cmpl $0x0, 0x30(%rbp)
jne 0x48fbb
leaq 0x2e228(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x48fbb
leaq 0x2e214(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x300, %rax            # imm = 0x300
cmpq $0x0, %rax
jne 0x48f9d
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x1e8a6(%rip), %rdi     # 0x67834
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x48fb9
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x21d0e(%rip), %rdi     # 0x6acba
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x48fbb
jmp 0x48fbd
leaq 0x2e1bc(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
jne 0x48fe9
leaq 0x2e1a6(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
je 0x48ff4
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rdx
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4480
movw %ax, -0x52(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movw -0x52(%rbp), %dx
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x68(%rbp), %r9
movq 0x10(%rbp), %r10
movl 0x18(%rbp), %eax
addl $0x2, %eax
movzwl %dx, %edx
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x17470
movq %rax, -0x70(%rbp)
cmpl $0x0, 0x30(%rbp)
je 0x490ff
leaq 0x2e12f(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x490fd
xorl %edi, %edi
callq 0x19930
cmpl $0x1, %eax
sete %al
movb %al, %cl
andb $0x1, %cl
movzbl %cl, %ecx
movl %ecx, -0x74(%rbp)
testb $0x1, %al
jne 0x49082
jmp 0x4908d
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
movl -0x74(%rbp), %edi
callq 0x19930
movq -0x40(%rbp), %rsi
addq -0x50(%rbp), %rsi
subq $0x1, %rsi
movl 0x18(%rbp), %edx
movq 0x10(%rbp), %rcx
movl $0x1000000, %edi        # imm = 0x1000000
callq 0x5ed0
leaq 0x2372c(%rip), %rdi     # 0x6c7e5
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq 0x2e0b3(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x4003333, %rax        # imm = 0x4003333
cmpq $0x0, %rax
je 0x490fb
leaq 0x2e09d(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
jne 0x490fb
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
jmp 0x490fd
jmp 0x490ff
movb $0x0, %al
callq 0xba00
movzwl -0x52(%rbp), %eax
cmpl $0x0, %eax
je 0x49157
cmpq $0x0, -0x30(%rbp)
je 0x49157
movq -0x30(%rbp), %rdi
callq 0x15780
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x49155
movq -0x30(%rbp), %rax
movl 0x18(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl $0x5, 0x118(%rax)
movq -0x30(%rbp), %rax
movl $0x2, 0xc4(%rax)
jmp 0x49157
movq -0x10(%rbp), %rdi
callq 0x31a0
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
jmp 0x4941e
movq -0x20(%rbp), %rax
movw (%rax), %ax
movl 0x20(%rbp), %esi
movl 0x28(%rbp), %edx
movzwl %ax, %edi
callq 0x28160
movq %rax, -0x60(%rbp)
cmpl $0x0, 0x30(%rbp)
jne 0x491db
leaq 0x2dfe2(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x491db
leaq 0x2dfce(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x300, %rax            # imm = 0x300
cmpq $0x0, %rax
jne 0x491d9
movq -0x40(%rbp), %rsi
leaq 0x21bbf(%rip), %rdi     # 0x6ad8b
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x491db
movq -0x10(%rbp), %rdi
callq 0x3180
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movw -0x12(%rbp), %si
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x60(%rbp), %r9
movq -0x38(%rbp), %r11
movq 0x10(%rbp), %r10
movl 0x18(%rbp), %eax
movzwl %si, %esi
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x19950
cmpq $0x0, %rax
jne 0x493dd
movq -0x48(%rbp), %rax
subq $0xc, %rax
movq %rax, -0x28(%rbp)
leaq 0x2497b(%rip), %rdi     # 0x6dbc0
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movw -0x12(%rbp), %si
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x60(%rbp), %r9
movq -0x38(%rbp), %r11
movq 0x10(%rbp), %r10
movl 0x18(%rbp), %eax
movzwl %si, %esi
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x19950
cmpq $0x0, %rax
je 0x493db
leaq 0x2dedd(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x300, %rax            # imm = 0x300
cmpq $0x0, %rax
jne 0x492d1
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
leaq 0x1e7e1(%rip), %rdi     # 0x67aa5
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
addq -0x28(%rbp), %rsi
leaq 0x2493f(%rip), %rdi     # 0x6dc23
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq 0x24910(%rip), %rdi     # 0x6dc08
callq 0x6860
leaq 0x2de7c(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
jne 0x493d9
movl -0x78(%rbp), %edi
callq 0x1ef50
movl %eax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
addq -0x28(%rbp), %rsi
movl 0x18(%rbp), %edx
movl $0x1000000, %edi        # imm = 0x1000000
leaq 0x1adbc(%rip), %rcx     # 0x640f9
callq 0x5ed0
leaq 0x2de37(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x493a3
leaq 0x2de21(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x49384
movq -0x68(%rbp), %rsi
leaq 0x1e802(%rip), %rdi     # 0x67b79
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x60(%rbp), %rcx
leaq 0x21d0d(%rip), %rdi     # 0x6b09c
movl $0x19, %edx
movl %edx, %esi
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq 0x2ddd6(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x493d7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
addq -0x28(%rbp), %rsi
leaq 0x219be(%rip), %rdi     # 0x6ad88
movb $0x0, %al
callq 0x3110
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x493d9
jmp 0x493db
jmp 0x493dd
jmp 0x4941e
movq -0x10(%rbp), %rdi
movw -0x12(%rbp), %si
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x68(%rbp), %r8
movq 0x10(%rbp), %r9
movl 0x18(%rbp), %ebx
movl 0x20(%rbp), %r11d
movl 0x28(%rbp), %r10d
movl 0x30(%rbp), %eax
movzwl %si, %esi
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
callq 0x23f60
cmpq $0x0, -0x68(%rbp)
je 0x4942e
movq -0x68(%rbp), %rdi
callq 0x3040
jmp 0x49430
movl -0x78(%rbp), %edi
callq 0x1ff00
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)