// File: /workspace/github_c_makefile_star2_O1/hfiguiere[P]exifprobe/maker_agfa.c
// Function: agfa1_offset_makervalue
void
agfa1_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 dumplength,count;
    unsigned short marker;
    char *nameoftag;
    char *fulldirname = NULL;
    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 0x0209:    /* CameraId                               */
                if(at_offset && (PRINT_VALUE_AT_OFFSET))
                {
                    print_tag_address(ENTRY,value_offset,indent,prefix);
                    print_makertagid(entry_ptr,23," = ",make,model);
                }
                if((PRINT_VALUE))
                    print_ascii(inptr,entry_ptr->count,value_offset);
                break;
            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 %ld",count); 
                }
                else if(!at_offset && (PRINT_VALUE))
                {
                    if(!(PRINT_OFFSET))
                        chpr += printf("@%lu",value_offset);
                    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 0x0f00: /* Data                                      */
                if(at_offset && (PRINT_ENTRY))
                {
                    print_tag_address(ENTRY,value_offset,indent,prefix);
                    print_makertagid(entry_ptr,MAKERTAGWIDTH," : ",make,model);
                    chpr += printf(" length %-9lu", count);
                    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);
                    }
                }
                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_VALUE_AT_OFFSET))
                        chpr += printf(" # UNDEFINED");
                }
                /* 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 0x3ccf8
movq %r9, %r15
movq %rcx, %r12
movq %rdx, %r13
movl %esi, %ebx
movq %r8, 0x30(%rsp)
movq %rdi, (%rsp)
movl 0x90(%rsp), %eax
movq %rax, 0x20(%rsp)
movl 0x88(%rsp), %ebp
movl 0x80(%rsp), %r14d
movl 0x78(%rsp), %eax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
movzwl (%rdx), %edi
movl %r14d, %esi
movl %ebp, %edx
callq 0x1c020
leaq 0x4d4c(%rip), %rsi      # 0x41997
movq %r15, %rdi
movq %rax, %rdx
callq 0x17a47
movq %rax, %r15
movq 0x10(%r13), %rdx
addq %r12, %rdx
movq 0x8(%r13), %rcx
movzwl (%r13), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x3cdaf
cmpl $0xf00, %eax            # imm = 0xF00
je 0x3ccff
cmpl $0x209, %eax            # imm = 0x209
jne 0x3ce1d
cmpl $0x0, 0x20(%rsp)
je 0x3ccd5
leaq 0x1b4e8(%rip), %rax     # 0x58180
testb $0x1, 0x3(%rax)
je 0x3ccd5
movl $0x4003333, %edi        # imm = 0x4003333
movq %rdx, %rsi
movq %rdx, %rbx
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x5605
leaq 0xd8a9(%rip), %rdx      # 0x4a568
movq %r13, %rdi
movl $0x17, %esi
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x1910e
movq %rbx, %rdx
leaq 0x1b4a4(%rip), %rax     # 0x58180
xorl %ebp, %ebp
testb $0x30, (%rax)
je 0x3ccf0
movq 0x8(%r13), %rsi
movq (%rsp), %rdi
callq 0x7793
movq %r15, %r13
jmp 0x3d0c3
xorl %ebp, %ebp
jmp 0x3d0d0
leaq 0x1b47a(%rip), %rbx     # 0x58180
movq (%rbx), %rax
cmpl $0x0, 0x20(%rsp)
je 0x3ce50
testl $0x4003333, %eax        # imm = 0x4003333
je 0x3ceb0
movl $0x4003333, %edi        # imm = 0x4003333
movq %rdx, 0x10(%rsp)
movq %rdx, %rsi
movq 0x8(%rsp), %rdx
movq %rcx, %rbx
movq 0x18(%rsp), %rcx
callq 0x5605
leaq 0x9b3b(%rip), %rdx      # 0x46880
movq %r13, %rdi
movl $0x19, %esi
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x1910e
leaq 0xeee3(%rip), %rdi      # 0x4bc42
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
leaq 0x1c696(%rip), %rax     # 0x59408
movq (%rax), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rbx, %r12
cmpq %rcx, %rax
movq %r15, %r13
movq (%rsp), %r14
je 0x3cecc
testq %rax, %rax
jne 0x3cec2
testl %ebp, %ebp
je 0x3d0a9
leaq 0x491a(%rip), %rdi      # 0x416bf
callq 0x5c33
jmp 0x3d0ab
leaq 0x1b3ca(%rip), %r12     # 0x58180
movq (%r12), %rax
cmpl $0x0, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
je 0x3ce82
btl $0x12, %eax
movq %r15, %r13
jae 0x3cea6
movl $0x1000000, %edi        # imm = 0x1000000
movq %rdx, %r15
movq %rdx, %rsi
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x5605
leaq 0xd228(%rip), %rdi      # 0x4a020
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
leaq 0xd268(%rip), %rdi      # 0x4a070
movq 0x28(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %ebx, %ebp
jmp 0x3cf65
movzwl %bx, %esi
movq (%rsp), %rdi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r13
movq %r15, %r8
movq 0x18(%rsp), %r9
pushq 0x20(%rsp)
pushq %rbp
pushq %r14
pushq 0x20(%rsp)
callq 0x191ac
addq $0x20, %rsp
xorl %ebp, %ebp
jmp 0x3d0c3
testb $0x30, %al
movq %r15, %r13
je 0x3ceb7
testl $0x300, %eax            # imm = 0x300
movq (%rsp), %r14
je 0x3cf12
movq %rdx, %r15
leaq 0xb8ab(%rip), %rdi      # 0x4871b
movq %rcx, %r12
movq %rcx, %rsi
xorl %eax, %eax
callq 0x3120
jmp 0x3cf2c
testb $0x30, %al
movq %r15, %r13
je 0x3cea6
testl $0x300, %eax            # imm = 0x300
je 0x3cf4f
movq %rdx, %r15
leaq 0xb87d(%rip), %rdi      # 0x4871b
movq %rcx, %rsi
jmp 0x3cf5c
movq %rdx, %r15
xorl %ebp, %ebp
jmp 0x3cf65
xorl %ebp, %ebp
movq %r15, %r13
jmp 0x3ceb9
xorl %ebp, %ebp
movq (%rsp), %r14
jmp 0x3d0b3
cmpq %rbx, %rax
cmovaeq %rbx, %rax
movq %rax, %r12
movl %ebp, %edi
callq 0x16b56
subq $0x8, %rsp
movq %r14, %rdi
movq 0x18(%rsp), %r15
movq %r15, %rsi
movq %rbx, %rdx
movq %r12, %rcx
movl $0xc, %r8d
movq 0x10(%rsp), %r9
pushq $0x2
callq 0x7446
addq $0x10, %rsp
movl $0x1, %edi
callq 0x16b56
movq %r15, %rdx
movl %eax, %ebp
jmp 0x3d0b0
leaq 0x8249(%rip), %rdi      # 0x45162
movq %rdx, %r15
movq %rdx, %rsi
movq %rcx, %r12
movq %rcx, %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testb $0x1, 0x3(%rbx)
jne 0x3cf44
leaq 0x4dcb(%rip), %rdi      # 0x41d06
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movq %r15, %rdx
movq %r12, %rcx
jmp 0x3d0b3
leaq 0xb896(%rip), %rdi      # 0x487ec
movq %rdx, %r15
movq %rdx, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
testb $0xc, 0x2(%r12)
je 0x3cf76
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movq (%rsp), %rbx
movq %rbx, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq %r15, %rdx
callq 0x4574
movl %eax, %ecx
movq 0x8(%rsp), %rax
addl $0x2, %eax
movl %ecx, %r14d
movzwl %cx, %edx
movq %rbx, %rdi
movq %r15, 0x10(%rsp)
movq %r15, %rsi
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
movq %r13, %r9
pushq %rax
pushq 0x20(%rsp)
callq 0x112cd
addq $0x10, %rsp
cmpl $0x0, 0x20(%rsp)
je 0x3d04f
testb $0x4, 0x2(%r12)
je 0x3d04f
xorl %edi, %edi
callq 0x12f15
xorl %ebx, %ebx
cmpl $0x1, %eax
sete %bl
jne 0x3cfed
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movl %ebp, %r15d
movl %ebx, %edi
callq 0x12f15
movq 0x28(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %rsi
decq %rsi
leaq 0x40ea(%rip), %rcx      # 0x410f9
movl $0x1000000, %edi        # imm = 0x1000000
movq 0x8(%rsp), %rdx
callq 0x5605
leaq 0xd024(%rip), %rdi      # 0x4a049
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r15d, %ebp
movq (%r12), %rax
testl $0x4003333, %eax        # imm = 0x4003333
sete %cl
testb $0x30, %al
setne %al
orb %cl, %al
jne 0x3d04f
movl %ebp, %edi
callq 0x16b56
movl %eax, %ebp
movq (%rsp), %rbx
xorl %eax, %eax
callq 0x9609
testw %r14w, %r14w
sete %al
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x3d092
callq 0xfdaa
testq %rax, %rax
je 0x3d092
orb $0x1, 0x19(%rax)
movl $0x5, 0x118(%rax)
movl $0x2, 0xc4(%rax)
movq %rbx, %rdi
callq 0x31b0
movq 0x10(%rsp), %rsi
addq 0x28(%rsp), %rsi
movq %rbx, %rdi
jmp 0x3d0bc
xorl %ebp, %ebp
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
addq %rcx, %rdx
movq %r14, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x3210
testq %r13, %r13
je 0x3d0d0
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