// File: /workspace/github_c_makefile_star2_O3/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 %rcx, 0x30(%rsp)
testq %rdi, %rdi
je 0x2b437
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r13
movq %r9, 0x18(%rsp)
movq 0x80(%rsp), %rbp
callq 0x31b0
leaq (,%rbp,8), %rax
movq %rax, 0x38(%rsp)
leaq 0x2d34f(%rip), %r14     # 0x58180
xorl %eax, %eax
testb $0x4, 0x2(%r14)
je 0x2aec7
leaq 0x16297(%rip), %r14     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq %r15, %rsi
movl 0x88(%rsp), %r12d
movl %r12d, %edx
movq %r14, %rcx
callq 0x55eb
leaq 0x1edf0(%rip), %rdi     # 0x49c57
movq %rbp, %rsi
movq 0x30(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x1707a
movl %eax, %ebp
leal 0x2(%r12), %edx
movl $0x40000, %edi          # imm = 0x40000
movq %r15, %rsi
movq %r14, %rcx
leaq 0x2d2ea(%rip), %r14     # 0x58180
callq 0x55eb
leaq 0x1eddd(%rip), %rdi     # 0x49c7f
movq 0x80(%rsp), %rsi
movq 0x38(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
movq 0x80(%rsp), %rbp
callq 0x1707a
movl %eax, 0x4(%rsp)
leaq (%r15,%rbp,8), %rax
movq %rax, 0x28(%rsp)
movzwl %bx, %eax
movl %eax, 0x14(%rsp)
testq %rbp, %rbp
movq %r15, 0x40(%rsp)
je 0x2b183
movq %r15, %r12
movl 0x88(%rsp), %eax
addl $0x4, %eax
movl %eax, 0x20(%rsp)
xorl %r15d, %r15d
xorl %ebx, %ebx
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
jne 0x2b1ac
movq %r12, 0x8(%rsp)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0x14(%rsp), %esi
callq 0x4707
movq %rax, %r12
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2b187
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2b187
movq %r15, %rbp
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0x14(%rsp), %esi
callq 0x4707
movq %rax, %r15
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2b198
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2b198
movl $0x4003333, %edi        # imm = 0x4003333
movq 0x8(%rsp), %rsi
movl 0x20(%rsp), %edx
leaq 0x16143(%rip), %rcx     # 0x410dc
callq 0x55eb
movq (%r14), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x2b018
testb $0x40, %al
jne 0x2afb3
movl 0x4(%rsp), %r14d
jmp 0x2afce
leaq 0x1ed5c(%rip), %rdi     # 0x49d16
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %r14d
addl %eax, %r14d
leaq 0x1ed4b(%rip), %rdi     # 0x49d20
movl %ebp, %esi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r14d, %ebx
leaq 0x2d196(%rip), %r14     # 0x58180
movq (%r14), %rax
testb $0x30, %al
je 0x2b014
movl $0x3, %edi
callq 0x5716
leaq 0x1f5a6(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, 0x4(%rsp)
movq (%r14), %rax
jmp 0x2b018
movl %ebx, 0x4(%rsp)
movq %r15, %rbx
testb $0x30, %al
je 0x2b064
addq %r12, %r12
movq 0x28(%rsp), %rax
leaq (%r12,%rax), %rsi
leaq 0x1d7fa(%rip), %rdi     # 0x4882c
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %ecx
addl %eax, %ecx
movl %ecx, %eax
testb $0x2, 0x3(%r14)
je 0x2b068
leaq 0x167b4(%rip), %rdi     # 0x41803
movq %r12, %rsi
movl %eax, %ebx
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %eax
movq %r15, %rbx
jmp 0x2b068
movl 0x4(%rsp), %eax
movl %eax, %edi
callq 0x1707a
movl %eax, %r14d
movq 0x8(%rsp), %r12
leaq 0x4(%r12), %rsi
movl $0x4003333, %edi        # imm = 0x4003333
movl 0x20(%rsp), %edx
leaq 0x16050(%rip), %rcx     # 0x410dc
callq 0x55eb
leaq 0x2d0e8(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x3003, %eax           # imm = 0x3003
movq %rbp, %r15
je 0x2b10c
testb $0x40, %al
je 0x2b0bf
leaq 0x1ec66(%rip), %rdi     # 0x49d16
movq 0x18(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %r12d
leaq 0x1ec67(%rip), %rdi     # 0x49d30
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
movl %eax, %r14d
addl %r12d, %r14d
leaq 0x2d0a0(%rip), %r12     # 0x58180
movq (%r12), %rax
testb $0x30, %al
je 0x2b107
movl $0x2, %edi
callq 0x5716
leaq 0x1f4af(%rip), %rdi     # 0x4a5a8
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movq (%r12), %rax
movq 0x8(%rsp), %r12
testb $0x30, %al
je 0x2b14e
addq %rbx, %rbx
movq 0x28(%rsp), %rax
leaq (%rbx,%rax), %rsi
leaq 0x1d709(%rip), %rdi     # 0x4882c
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
leaq 0x2d04c(%rip), %rax     # 0x58180
testb $0x2, 0x3(%rax)
je 0x2b14e
leaq 0x166c2(%rip), %rdi     # 0x41803
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, 0x4(%rsp)
addq $0x8, %r12
movq %r13, %rdi
callq 0x3190
movq %rax, %rbx
incq %r15
cmpq %r15, 0x80(%rsp)
leaq 0x2d005(%rip), %r14     # 0x58180
jne 0x2aeff
jmp 0x2b1c4
xorl %ebx, %ebx
jmp 0x2b1c4
leaq 0x1eb1f(%rip), %rdi     # 0x49cad
movl %r15d, %esi
movq 0x8(%rsp), %rdx
jmp 0x2b1b9
movq 0x8(%rsp), %rdx
addq $0x4, %rdx
leaq 0x1eb39(%rip), %rdi     # 0x49ce1
movl %ebp, %esi
jmp 0x2b1b9
leaq 0x1eb8e(%rip), %rdi     # 0x49d41
movl %r15d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, 0x4(%rsp)
testb $0x4, 0x2(%r14)
movq %rbx, 0x8(%rsp)
je 0x2b255
movq %rbx, %rax
movq 0x30(%rsp), %rbx
subq 0x38(%rsp), %rbx
leaq -0x1(%rax), %rsi
movl 0x88(%rsp), %eax
leal 0x2(%rax), %ebp
leaq 0x15ee6(%rip), %r15     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movl %ebp, %edx
movq %r15, %rcx
callq 0x55eb
leaq 0x1eb6e(%rip), %rdi     # 0x49d7a
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %edi
addl %eax, %edi
callq 0x1707a
movl %eax, %r14d
movl $0x40000, %edi          # imm = 0x40000
movq 0x28(%rsp), %rsi
movl %ebp, %edx
movq %r15, %rcx
callq 0x55eb
leaq 0x1eb56(%rip), %rdi     # 0x49d92
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, 0x4(%rsp)
movq 0x18(%rsp), %r14
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x2b349
movl 0x88(%rsp), %eax
addl $0x4, %eax
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
movq 0x40(%rsp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
jne 0x2b36d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0x14(%rsp), %esi
callq 0x4707
movq %rax, %r12
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2b357
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2b357
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl 0x14(%rsp), %esi
callq 0x4707
movq %rax, %rbp
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2b360
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2b360
addq %r12, %r12
addq %rbp, %rbp
movq 0x28(%rsp), %rax
addq %rax, %r12
addq %rax, %rbp
movq %r13, %rdi
movl 0x14(%rsp), %esi
movq %r12, %rdx
movq %rbp, %rcx
movq %r14, %r9
pushq 0x20(%rsp)
pushq %r15
callq 0x2b98b
addq $0x10, %rsp
addq $0x8, %rbx
movq %r13, %rdi
callq 0x3190
movq %rax, 0x8(%rsp)
incq %r15
cmpq %r15, 0x80(%rsp)
jne 0x2b282
movl 0x88(%rsp), %r14d
movl 0x4(%rsp), %ebp
jmp 0x2b38f
leaq 0x1e94f(%rip), %rdi     # 0x49cad
jmp 0x2b374
addq $0x4, %rbx
leaq 0x1e976(%rip), %rdi     # 0x49ce1
jmp 0x2b374
leaq 0x1e9cd(%rip), %rdi     # 0x49d41
movl %r15d, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %ebp
addl %eax, %ebp
movl 0x88(%rsp), %r14d
leaq 0x2cdea(%rip), %r15     # 0x58180
testb $0x4, 0x2(%r15)
movq 0x40(%rsp), %rbx
je 0x2b419
movq 0x8(%rsp), %rcx
leaq -0x1(%rcx), %rsi
leal 0x2(%r14), %edx
leaq 0x15d26(%rip), %rcx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
callq 0x55eb
leaq 0x1e9eb(%rip), %rdi     # 0x49db2
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
callq 0x1707a
movl %eax, %ebp
testb $0x4, 0x2(%r15)
je 0x2b419
movq 0x30(%rsp), %rax
leaq (%rbx,%rax), %rsi
decq %rsi
leaq 0x15ce9(%rip), %rcx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movl %r14d, %edx
callq 0x55eb
leaq 0x1e9c1(%rip), %rdi     # 0x49dc8
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
callq 0x1707a
movl %eax, %ebp
movq 0x8(%rsp), %rbx
movl %ebp, %edi
callq 0x17a82
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x36ba
xorl %ebx, %ebx
xorl %ebp, %ebp
jmp 0x2b41e