// File: /workspace/github_c_makefile_star2_O1/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)
testq %rdi, %rdi
je 0x2ac9f
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r13
movq 0x80(%rsp), %r12
callq 0x31b0
leaq (,%r12,8), %rax
movq %rax, 0x38(%rsp)
leaq 0x2dae4(%rip), %r14     # 0x58180
xorl %eax, %eax
testb $0x4, 0x2(%r14)
je 0x2a738
leaq 0x16a2c(%rip), %rbx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq %r15, %rsi
movl 0x88(%rsp), %r12d
movl %r12d, %edx
movq %rbx, %rcx
callq 0x5605
leaq 0x1f545(%rip), %rdi     # 0x49c17
movq 0x80(%rsp), %rsi
movq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
callq 0x16b56
movl %eax, %r14d
leal 0x2(%r12), %edx
movq 0x80(%rsp), %r12
movl $0x40000, %edi          # imm = 0x40000
movq %r15, %rsi
movq %rbx, %rcx
leaq 0x2da71(%rip), %rbx     # 0x58180
callq 0x5605
leaq 0x1f524(%rip), %rdi     # 0x49c3f
movq %r12, %rsi
movq 0x38(%rsp), %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movq %rbx, %r14
movl %eax, 0x4(%rsp)
leaq (%r15,%r12,8), %rax
movq %rax, 0x20(%rsp)
movzwl %bp, %ebx
testq %r12, %r12
movl %ebx, 0x18(%rsp)
movq %r15, 0x40(%rsp)
je 0x2a9de
movl 0x88(%rsp), %eax
addl $0x4, %eax
movl %eax, 0x1c(%rsp)
movq $0x0, 0x8(%rsp)
movq %r15, %rbp
movq $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
jne 0x2aa1a
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl %ebx, %esi
callq 0x46cc
movq %rax, %r12
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2a9e9
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2a9e9
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl %ebx, %esi
callq 0x46cc
movq %rax, %r15
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2a9f2
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2a9f2
movl $0x4003333, %edi        # imm = 0x4003333
movq %rbp, %rsi
movl 0x1c(%rsp), %edx
leaq 0x168d3(%rip), %rcx     # 0x410dc
callq 0x5605
movq (%r14), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x2a822
testb $0x40, %al
jne 0x2a828
movl 0x4(%rsp), %ebx
jmp 0x2a841
movl 0x4(%rsp), %edi
jmp 0x2a883
leaq 0x1f4a7(%rip), %rdi     # 0x49cd6
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %ebx
addl %eax, %ebx
leaq 0x1f498(%rip), %rdi     # 0x49ce0
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %edi
addl %ebx, %edi
leaq 0x2d921(%rip), %r14     # 0x58180
testb $0x30, (%r14)
je 0x2a883
movl %edi, %ebx
movl $0x3, %edi
callq 0x5730
leaq 0x1fcf0(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
movl %ebx, %edi
addl %eax, %edi
testb $0x30, (%r14)
je 0x2a8c7
addq %r12, %r12
movq 0x20(%rsp), %rax
leaq (%r12,%rax), %rsi
movl %edi, %ebx
leaq 0x1df4e(%rip), %rdi     # 0x487ec
xorl %eax, %eax
callq 0x3120
movl %ebx, %edi
addl %eax, %edi
testb $0x2, 0x3(%r14)
je 0x2a8c7
movl %edi, %ebx
leaq 0x16f4a(%rip), %rdi     # 0x41803
movq %r12, %rsi
xorl %eax, %eax
callq 0x3120
movl %ebx, %edi
addl %eax, %edi
callq 0x16b56
movl %eax, %ebx
leaq 0x4(%rbp), %rsi
movl $0x4003333, %edi        # imm = 0x4003333
movl 0x1c(%rsp), %edx
leaq 0x167fa(%rip), %rcx     # 0x410dc
callq 0x5605
leaq 0x2d892(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x2a952
testb $0x40, %al
je 0x2a911
leaq 0x1f3d3(%rip), %rdi     # 0x49cd6
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %r12d
leaq 0x1f3d5(%rip), %rdi     # 0x49cf0
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %r12d, %ebx
leaq 0x2d84d(%rip), %rax     # 0x58180
testb $0x30, (%rax)
je 0x2a952
movl $0x2, %edi
callq 0x5730
leaq 0x1fc1f(%rip), %rdi     # 0x4a568
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
leaq 0x2d827(%rip), %r12     # 0x58180
testb $0x30, (%r12)
je 0x2a997
addq %r15, %r15
movq 0x20(%rsp), %rax
leaq (%r15,%rax), %rsi
leaq 0x1de79(%rip), %rdi     # 0x487ec
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
testb $0x2, 0x3(%r12)
je 0x2a997
leaq 0x16e78(%rip), %rdi     # 0x41803
movq %r15, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movq 0x80(%rsp), %r12
movl %ebx, %edi
callq 0x16b56
movl %eax, 0x4(%rsp)
addq $0x8, %rbp
movq %r13, %rdi
callq 0x3190
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rcx
incq %rcx
movq %rcx, 0x8(%rsp)
cmpq %rcx, %r12
leaq 0x2d7ae(%rip), %r14     # 0x58180
movl 0x18(%rsp), %ebx
jne 0x2a77d
jmp 0x2aa34
movq $0x0, 0x10(%rsp)
jmp 0x2aa34
leaq 0x1f27d(%rip), %rdi     # 0x49c6d
jmp 0x2a9fd
addq $0x4, %rbp
leaq 0x1f2a4(%rip), %rdi     # 0x49ca1
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, 0x4(%rsp)
movq 0x80(%rsp), %r12
jmp 0x2aa34
leaq 0x1f2e0(%rip), %rdi     # 0x49d01
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3120
addl %eax, 0x4(%rsp)
testb $0x4, 0x2(%r14)
jne 0x2aa44
movl 0x4(%rsp), %edi
jmp 0x2aacd
movq 0x28(%rsp), %r14
subq 0x38(%rsp), %r14
movq 0x10(%rsp), %rax
leaq -0x1(%rax), %rsi
movl 0x88(%rsp), %eax
leal 0x2(%rax), %ebp
leaq 0x16674(%rip), %r15     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movl %ebp, %edx
movq %r15, %rcx
callq 0x5605
leaq 0x1f2bc(%rip), %rdi     # 0x49d3a
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %edi
addl %eax, %edi
callq 0x16b56
movl %eax, %ebx
movl $0x40000, %edi          # imm = 0x40000
movq 0x20(%rsp), %rsi
movl %ebp, %edx
movq %r15, %rcx
callq 0x5605
leaq 0x1f2a5(%rip), %rdi     # 0x49d52
movq %r14, %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %edi
leaq 0x2d6be(%rip), %r14     # 0x58180
movl 0x18(%rsp), %ebx
callq 0x16b56
movl %eax, %edi
testq %r12, %r12
je 0x2abf1
movl %edi, 0x4(%rsp)
movl 0x88(%rsp), %eax
addl $0x4, %eax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movq 0x40(%rsp), %r14
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3210
testl %eax, %eax
jne 0x2abd0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl %ebx, %esi
callq 0x46cc
movq %rax, %r12
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2abba
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2abba
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rdi
movl %ebx, %esi
callq 0x46cc
movq %rax, %rbp
movq %r13, %rdi
callq 0x31a0
testl %eax, %eax
jne 0x2abc3
movq %r13, %rdi
callq 0x30b0
testl %eax, %eax
jne 0x2abc3
addq %r12, %r12
addq %rbp, %rbp
movq 0x20(%rsp), %rax
addq %rax, %r12
addq %rax, %rbp
movq %r13, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %rbp, %rcx
movq 0x30(%rsp), %r9
pushq 0x8(%rsp)
pushq %r15
callq 0x2b1e8
addq $0x10, %rsp
addq $0x8, %r14
movq %r13, %rdi
callq 0x3190
movq %rax, 0x10(%rsp)
incq %r15
cmpq %r15, 0x80(%rsp)
jne 0x2aaf1
movl 0x4(%rsp), %edi
jmp 0x2abea
leaq 0x1f0ac(%rip), %rdi     # 0x49c6d
jmp 0x2abd7
addq $0x4, %r14
leaq 0x1f0d3(%rip), %rdi     # 0x49ca1
jmp 0x2abd7
leaq 0x1f12a(%rip), %rdi     # 0x49d01
movl %r15d, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3120
movl 0x4(%rsp), %edi
addl %eax, %edi
leaq 0x2d58f(%rip), %r14     # 0x58180
testb $0x4, 0x2(%r14)
movq 0x40(%rsp), %rbx
movq 0x10(%rsp), %r14
je 0x2ac3c
leaq -0x1(%r14), %rsi
movl 0x88(%rsp), %eax
leal 0x2(%rax), %edx
leaq 0x164c5(%rip), %rcx     # 0x410dc
movl %edi, %ebp
movl $0x40000, %edi          # imm = 0x40000
callq 0x5605
leaq 0x1f148(%rip), %rdi     # 0x49d72
xorl %eax, %eax
callq 0x3120
addl %eax, %ebp
movl %ebp, %edi
callq 0x16b56
movl %eax, %edi
leaq 0x2d53d(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x2ac88
movq 0x28(%rsp), %rax
leaq (%rbx,%rax), %rsi
decq %rsi
leaq 0x16480(%rip), %rcx     # 0x410dc
movl %edi, %ebx
movl $0x40000, %edi          # imm = 0x40000
movl 0x88(%rsp), %edx
callq 0x5605
leaq 0x1f112(%rip), %rdi     # 0x49d88
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %edi
callq 0x16b56
movl %eax, %edi
callq 0x17530
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x36ba
xorl %r14d, %r14d
xorl %edi, %edi
jmp 0x2ac88