// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/x3f.c
// Function: process_x3f_props
unsigned long
process_x3f_props(FILE *inptr,unsigned short byteorder,unsigned long data_offset,
                           unsigned long data_length,unsigned long char_format,
                           char *dirname,unsigned long num_entries,int indent)
{
    unsigned long max_offset = 0UL;
    unsigned long name_offset = 0UL;
    unsigned long value_offset = 0UL;
    unsigned long offset = 0UL;
    unsigned long property_offset = 0UL;
    unsigned long index_length = 0UL;
    unsigned long list_data_length = 0UL;
    int chpr = 0;
    int i;

    if(inptr)
    {
        clearerr(inptr);
        offset = data_offset;
        property_offset = data_offset + (num_entries * 8);
        index_length = num_entries * 8;
        list_data_length = data_length - index_length;

        if((PRINT_SECTION))
        {
            print_tag_address(SECTION,data_offset,indent,"@");
            chpr += printf("<Property List> %ld entries, length %lu",num_entries,data_length);
            chpr = newline(chpr);
            print_tag_address(SECTION,data_offset,indent + SMALLINDENT,"@");
            chpr += printf("<Property List Index> %ld entries, length %lu",num_entries,index_length);
            chpr = newline(chpr);
        }
        /* Print the index of name/value offsets first                */
        for(i = 0; i < num_entries; ++i)
        {
            if(fseek(inptr,offset,SEEK_SET) == 0)
            {
                name_offset = read_ulong(inptr,byteorder,HERE);
                name_offset *= 2;
                if(feof(inptr) || ferror(inptr))
                {
                    PUSHCOLOR(RED);
                    chpr += printf(" FAILED to read Property List name %d at offset %lu",i,offset);
                    POPCOLOR();
                    break;
                }
                value_offset = read_ulong(inptr,byteorder,HERE);
                value_offset *= 2;
                if(feof(inptr) || ferror(inptr))
                {
                    PUSHCOLOR(RED);
                    chpr += printf(" FAILED to read Property List value %d at offset %lu",i,offset + 4);
                    POPCOLOR();
                    break;
                }

                /* Show the name/value offsets, even in LIST mode     */
                print_tag_address(ENTRY,offset,indent + MEDIUMINDENT,"@");
                if((PRINT_TAGINFO))
                {
                    if((PRINT_LONGNAMES))
                        chpr += printf("%s.Index.",dirname);
                    chpr += printf("NameOffset.%-2d",i);
                    if((PRINT_VALUE))
                    {
                        putindent(X3FTAGWIDTH - 15);
                        chpr += printf(" = ");
                    }
                }
                if((PRINT_VALUE))
                {
                    chpr += printf("@%lu",name_offset + property_offset);
                    if((PRINT_RAW_VALUES))
                        chpr += printf(" (%lu)",name_offset);
                }
                chpr = newline(chpr);

                print_tag_address(ENTRY,offset + 4,indent + MEDIUMINDENT,"@");
                if((PRINT_TAGINFO))
                {
                    if((PRINT_LONGNAMES))
                        chpr += printf("%s.Index.",dirname);
                    chpr += printf("ValueOffset.%-2d",i);
                    if((PRINT_VALUE))
                    {
                        putindent(X3FTAGWIDTH - 16);
                        chpr += printf(" = ");
                    }
                }
                if((PRINT_VALUE))
                {
                    chpr += printf("@%lu",value_offset + property_offset);
                    if((PRINT_RAW_VALUES))
                        chpr += printf(" (%lu)",value_offset);
                }
                chpr = newline(chpr);

            }
            else
            {
                PUSHCOLOR(RED);
                chpr += printf(" SEEK FAILED reading Property List item %d at offset %lu",i,offset);
                POPCOLOR();
                break;
            }
                
            offset += 8;
            max_offset = ftell(inptr);
        }
        if((PRINT_SECTION))
        {
            print_tag_address(SECTION,max_offset - 1,indent + SMALLINDENT,"@");
            chpr += printf("</Property List iIndex>");
            chpr = newline(chpr);
            print_tag_address(SECTION,property_offset,indent + SMALLINDENT,"@");
            chpr += printf("<Property List Data> length %lu",list_data_length);
            chpr = newline(chpr);
        }
        offset = data_offset;

        /* Read 'em again, and this time show the names and values    */
        for(i = 0; i < num_entries; ++i)
        {
            if(fseek(inptr,offset,SEEK_SET) == 0)
            {
                name_offset = read_ulong(inptr,byteorder,HERE);
                name_offset *= 2;
                if(feof(inptr) || ferror(inptr))
                {
                    PUSHCOLOR(RED);
                    chpr += printf(" FAILED to read Property List name %d at offset %lu",i,offset);
                    POPCOLOR();
                    break;
                }
                value_offset = read_ulong(inptr,byteorder,HERE);
                value_offset *= 2;
                if(feof(inptr) || ferror(inptr))
                {
                    PUSHCOLOR(RED);
                    chpr += printf(" FAILED to read Property List value %d at offset %lu",i,offset + 4);
                    POPCOLOR();
                    break;
                }
                name_offset += property_offset;
                value_offset += property_offset;
                print_property(inptr,byteorder,name_offset,value_offset,char_format,
                                                    dirname,i,indent + MEDIUMINDENT);
            }
            else
            {
                PUSHCOLOR(RED);
                chpr += printf(" SEEK FAILED reading Property List item %d at offset %lu",i,offset);
                POPCOLOR();
                break;
            }
                
            offset += 8;
            max_offset = ftell(inptr);
        }
        if((PRINT_SECTION))
        {
            print_tag_address(SECTION,max_offset - 1,indent + SMALLINDENT,"@");
            chpr += printf("</Property List Data>");
            chpr = newline(chpr);
        }
        if((PRINT_SECTION))
        {
            print_tag_address(SECTION,property_offset + list_data_length - 1,indent,"@");
            chpr += printf("</Property List>");
            chpr = newline(chpr);
        }
    }
    else
    {
        PUSHCOLOR(RED);
        fprintf(stderr,"%s: no file pointer to read X3F Properties List\n",Progname);
        POPCOLOR();
    }
    setcharsprinted(chpr);
    return(max_offset);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x18(%rsp)
testq %rdi, %rdi
je 0x29e6e
movl %esi, %ebx
movq %rdi, %r13
movl 0x88(%rsp), %r15d
movq 0x80(%rsp), %r12
callq 0x31b0
leaq (,%r12,8), %r14
leaq 0x2d8e9(%rip), %rbp     # 0x57180
movl $0x0, 0x8(%rsp)
testb $0x4, 0x2(%rbp)
je 0x29931
leaq 0x1582c(%rip), %rcx     # 0x3f0dc
movl $0x40000, %edi          # imm = 0x40000
movq 0x18(%rsp), %r12
movq %r12, %rsi
movl %r15d, %edx
callq 0x5100
leaq 0x1e33b(%rip), %rdi     # 0x47c07
movq 0x80(%rsp), %rsi
movq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x160f7
movl %eax, %ebp
leal 0x2(%r15), %edx
movl $0x40000, %edi          # imm = 0x40000
movq %r12, %rsi
movq 0x80(%rsp), %r12
leaq 0x157d8(%rip), %rcx     # 0x3f0dc
callq 0x5100
leaq 0x1e31f(%rip), %rdi     # 0x47c2f
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
leaq 0x2d858(%rip), %rbp     # 0x57180
callq 0x160f7
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rax
leaq (%rax,%r12,8), %rcx
movq %rcx, 0x20(%rsp)
movq 0x28(%rsp), %rcx
subq %r14, %rcx
movq %rcx, 0x40(%rsp)
leal 0x4(%r15), %ecx
movq %rcx, 0x38(%rsp)
movzwl %bx, %ecx
movl %ecx, 0xc(%rsp)
xorl %ebx, %ebx
xorl %r12d, %r12d
movq %rax, %r14
cmpq %rbx, 0x80(%rsp)
je 0x29c10
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
jne 0x29bf9
movq %r14, %r15
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0xc(%rsp), %esi
callq 0x42ba
movq %rax, %r14
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x29bd9
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x29bd9
movq %rbx, 0x10(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0xc(%rsp), %esi
callq 0x42ba
movq %rax, %rbx
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x29be4
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x29be4
movl $0x4003333, %edi        # imm = 0x4003333
movq %r15, %rsi
movq 0x38(%rsp), %rdx
leaq 0x156d1(%rip), %rcx     # 0x3f0dc
callq 0x5100
movq (%rbp), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x29a8e
testb $0x40, %al
jne 0x29a24
movl 0x8(%rsp), %ebp
jmp 0x29a3d
leaq 0x1e29b(%rip), %rdi     # 0x47cc6
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %ebp
addl %eax, %ebp
leaq 0x1e28c(%rip), %rdi     # 0x47cd0
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %r12d
addl %ebp, %r12d
leaq 0x2d723(%rip), %rbp     # 0x57180
movq (%rbp), %rax
testb $0x30, %al
je 0x29a89
pushq $0x3
popq %rdi
callq 0x521b
leaq 0x1eae4(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, 0x8(%rsp)
movq (%rbp), %rax
jmp 0x29a8e
movl %r12d, 0x8(%rsp)
testb $0x30, %al
je 0x29ad3
addq %r14, %r14
movq 0x20(%rsp), %rax
leaq (%r14,%rax), %rsi
leaq 0x1cd37(%rip), %rdi     # 0x467dc
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %r12d
addl %eax, %r12d
testb $0x2, 0x3(%rbp)
je 0x29ace
leaq 0x15d42(%rip), %rdi     # 0x3f803
movq %r14, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r12d
movl %r12d, %edi
jmp 0x29ad7
movl 0x8(%rsp), %edi
callq 0x160f7
movl %eax, %ebp
movq %r15, %r14
leaq 0x4(%r15), %rsi
movl $0x4003333, %edi        # imm = 0x4003333
movq 0x38(%rsp), %rdx
leaq 0x155e6(%rip), %rcx     # 0x3f0dc
callq 0x5100
leaq 0x2d67e(%rip), %rax     # 0x57180
movq (%rax), %rax
testw $0x3003, %ax            # imm = 0x3003
je 0x29b6b
testb $0x40, %al
je 0x29b24
leaq 0x1e1b0(%rip), %rdi     # 0x47cc6
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %r14d
leaq 0x1e1b2(%rip), %rdi     # 0x47ce0
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r14d, %ebp
leaq 0x2d63a(%rip), %r14     # 0x57180
movq (%r14), %rax
testb $0x30, %al
je 0x29b68
pushq $0x2
popq %rdi
callq 0x521b
leaq 0x1e9fc(%rip), %rdi     # 0x48558
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movq (%r14), %rax
movq %r15, %r14
testb $0x30, %al
je 0x29bab
addq %rbx, %rbx
movq 0x20(%rsp), %rax
leaq (%rbx,%rax), %rsi
leaq 0x1cc5a(%rip), %rdi     # 0x467dc
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
leaq 0x2d5ee(%rip), %rax     # 0x57180
testb $0x2, 0x3(%rax)
je 0x29bab
leaq 0x15c64(%rip), %rdi     # 0x3f803
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
callq 0x160f7
movl %eax, 0x8(%rsp)
addq $0x8, %r14
movq %r13, %rdi
callq 0x3190
movq %rax, %r12
movq 0x10(%rsp), %rbx
incq %rbx
leaq 0x2d5ac(%rip), %rbp     # 0x57180
jmp 0x29964
leaq 0x1e07d(%rip), %rdi     # 0x47c5d
movl %ebx, %esi
jmp 0x29bf4
addq $0x4, %r15
leaq 0x1e0a2(%rip), %rdi     # 0x47c91
movq 0x10(%rsp), %rsi
movq %r15, %rdx
jmp 0x29c05
leaq 0x1e0f1(%rip), %rdi     # 0x47cf1
movl %ebx, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
testb $0x4, 0x2(%rbp)
movq 0x80(%rsp), %r15
je 0x29c99
leaq -0x1(%r12), %rsi
movl 0x88(%rsp), %eax
leal 0x2(%rax), %ebx
leaq 0x154a8(%rip), %r14     # 0x3f0dc
movl $0x40000, %edi          # imm = 0x40000
movl %ebx, %edx
movq %r14, %rcx
callq 0x5100
leaq 0x1e0e0(%rip), %rdi     # 0x47d2a
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
movl %eax, %ebp
movl $0x40000, %edi          # imm = 0x40000
movq 0x20(%rsp), %rsi
movl %ebx, %edx
movq %r14, %rcx
callq 0x5100
leaq 0x1e0c9(%rip), %rdi     # 0x47d42
movq 0x40(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
leaq 0x2d4f0(%rip), %rbp     # 0x57180
callq 0x160f7
movl %eax, 0x8(%rsp)
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq %rbx, %r15
je 0x29dc5
movq %r13, %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
jne 0x29dac
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0xc(%rsp), %esi
callq 0x42ba
movq %rax, %r15
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x29d7e
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x29d7e
movq %rbp, %r14
movq %r12, %rbp
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0xc(%rsp), %esi
callq 0x42ba
movq %rax, %r12
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x29d87
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x29d87
addq %r15, %r15
addq %r12, %r12
movq 0x20(%rsp), %rax
addq %rax, %r15
addq %rax, %r12
movq %r13, %rdi
movl 0xc(%rsp), %esi
movq %r15, %rdx
movq %r12, %rcx
movq 0x30(%rsp), %r9
pushq 0x38(%rsp)
pushq %rbx
callq 0x2a3ce
popq %rax
popq %rcx
addq $0x8, 0x10(%rsp)
movq %r13, %rdi
callq 0x3190
movq %rax, %r12
incq %rbx
movq 0x80(%rsp), %r15
movq %r14, %rbp
jmp 0x29ca5
leaq 0x1ded8(%rip), %rdi     # 0x47c5d
jmp 0x29db3
movq 0x10(%rsp), %rdx
addq $0x4, %rdx
leaq 0x1defa(%rip), %rdi     # 0x47c91
movl %ebx, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
movq %rbp, %r12
movq %r14, %rbp
jmp 0x29dc5
leaq 0x1df3e(%rip), %rdi     # 0x47cf1
movl %ebx, %esi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, 0x8(%rsp)
testb $0x4, 0x2(%rbp)
movl 0x88(%rsp), %ebx
jne 0x29dd8
movl 0x8(%rsp), %edi
jmp 0x29e57
leaq -0x1(%r12), %rsi
leal 0x2(%rbx), %edx
leaq 0x152f5(%rip), %rcx     # 0x3f0dc
movl $0x40000, %edi          # imm = 0x40000
callq 0x5100
leaq 0x1df6a(%rip), %rdi     # 0x47d62
xorl %eax, %eax
callq 0x3120
movl 0x8(%rsp), %edi
addl %eax, %edi
callq 0x160f7
movl %eax, %r14d
testb $0x4, 0x2(%rbp)
jne 0x29e18
movl %r14d, %edi
jmp 0x29e57
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax), %rsi
decq %rsi
leaq 0x152ac(%rip), %rcx     # 0x3f0dc
movl $0x40000, %edi          # imm = 0x40000
movl %ebx, %edx
callq 0x5100
leaq 0x1df35(%rip), %rdi     # 0x47d78
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %edi
callq 0x16a4f
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d183(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x2e5e9(%rip), %rax     # 0x58468
movq (%rax), %rdx
leaq 0x1df00(%rip), %rsi     # 0x47d89
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x3180
xorl %edi, %edi
jmp 0x29e57