// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movw %si, %ax
movl 0x18(%rbp), %esi
movq 0x10(%rbp), %rsi
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3d769
movq -0x8(%rbp), %rdi
callq 0x31a0
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq 0x10(%rbp), %rax
shlq $0x3, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq 0x3a0c6(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3d14e
movq -0x18(%rbp), %rsi
movl 0x18(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x26ffc(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq 0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0x2f3fb(%rip), %rdi     # 0x6c4ef
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rsi
movl 0x18(%rbp), %edx
addl $0x2, %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x26fba(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq 0x10(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq 0x2f3e1(%rip), %rdi     # 0x6c517
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
cmpq 0x10(%rbp), %rax
jae 0x3d4a9
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $0x0, %eax
jne 0x3d465
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4610
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shlq %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x3d1b8
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x3d1d8
movl -0x70(%rbp), %esi
movq -0x50(%rbp), %rdx
leaq 0x2f37f(%rip), %rdi     # 0x6c545
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d4a9
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4610
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x3d215
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x3d239
movl -0x70(%rbp), %esi
movq -0x50(%rbp), %rdx
addq $0x4, %rdx
leaq 0x2f352(%rip), %rdi     # 0x6c579
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d4a9
movq -0x50(%rbp), %rsi
movl 0x18(%rbp), %edx
addl $0x4, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x26e8d(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x39f25(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x3d2e1
leaq 0x39f0f(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x3d296
movq -0x30(%rbp), %rsi
leaq 0x2f325(%rip), %rdi     # 0x6c5ae
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x70(%rbp), %esi
leaq 0x2f318(%rip), %rdi     # 0x6c5b8
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
leaq 0x39ecc(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3d2df
movl $0x3, %edi
callq 0x60e0
leaq 0x2fa46(%rip), %rdi     # 0x6cd18
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d2e1
leaq 0x39e98(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3d341
movq -0x40(%rbp), %rsi
addq -0x58(%rbp), %rsi
leaq 0x2da87(%rip), %rdi     # 0x6ad8b
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
leaq 0x39e68(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x2000000, %rax        # imm = 0x2000000
cmpq $0x0, %rax
je 0x3d33f
movq -0x40(%rbp), %rsi
leaq 0x27491(%rip), %rdi     # 0x647c3
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d341
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
movq -0x50(%rbp), %rsi
addq $0x4, %rsi
movl 0x18(%rbp), %edx
addl $0x4, %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x26d76(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x39e0e(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x3d3f8
leaq 0x39df8(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x3d3ad
movq -0x30(%rbp), %rsi
leaq 0x2f20e(%rip), %rdi     # 0x6c5ae
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x70(%rbp), %esi
leaq 0x2f211(%rip), %rdi     # 0x6c5c8
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
leaq 0x39db5(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3d3f6
movl $0x2, %edi
callq 0x60e0
leaq 0x2f92f(%rip), %rdi     # 0x6cd18
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d3f8
leaq 0x39d81(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3d458
movq -0x48(%rbp), %rsi
addq -0x58(%rbp), %rsi
leaq 0x2d970(%rip), %rdi     # 0x6ad8b
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
leaq 0x39d51(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x2000000, %rax        # imm = 0x2000000
cmpq $0x0, %rax
je 0x3d456
movq -0x48(%rbp), %rsi
leaq 0x2737a(%rip), %rdi     # 0x647c3
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d458
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
jmp 0x3d482
movl -0x70(%rbp), %esi
movq -0x50(%rbp), %rdx
leaq 0x2f166(%rip), %rdi     # 0x6c5d9
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d4a9
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x38(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x3d155
leaq 0x39cd0(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3d53b
movq -0x38(%rbp), %rsi
subq $0x1, %rsi
movl 0x18(%rbp), %edx
addl $0x2, %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x26c03(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x2f12d(%rip), %rdi     # 0x6c612
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
movq -0x58(%rbp), %rsi
movl 0x18(%rbp), %edx
addl $0x2, %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x26bc9(%rip), %rcx     # 0x640dc
callq 0x5ed0
movq -0x68(%rbp), %rsi
leaq 0x2f107(%rip), %rdi     # 0x6c62a
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
cmpq 0x10(%rbp), %rax
jae 0x3d6be
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x3200
cmpl $0x0, %eax
jne 0x3d67a
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4610
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shlq %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x3d5ad
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x3d5cd
movl -0x70(%rbp), %esi
movq -0x50(%rbp), %rdx
leaq 0x2ef8a(%rip), %rdi     # 0x6c545
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d6be
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4610
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3190
cmpl $0x0, %eax
jne 0x3d60a
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x3d62e
movl -0x70(%rbp), %esi
movq -0x50(%rbp), %rdx
addq $0x4, %rdx
leaq 0x2ef5d(%rip), %rdi     # 0x6c579
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d6be
movq -0x58(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %si
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movl -0x70(%rbp), %r10d
movl 0x18(%rbp), %eax
addl $0x4, %eax
movzwl %si, %esi
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x3deb0
jmp 0x3d697
movl -0x70(%rbp), %esi
movq -0x50(%rbp), %rdx
leaq 0x2ef51(%rip), %rdi     # 0x6c5d9
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x3d6be
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x38(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x3d54a
leaq 0x39abb(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3d712
movq -0x38(%rbp), %rsi
subq $0x1, %rsi
movl 0x18(%rbp), %edx
addl $0x2, %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x269ee(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x2ef50(%rip), %rdi     # 0x6c64a
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
leaq 0x39a67(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3d767
movq -0x58(%rbp), %rsi
addq -0x68(%rbp), %rsi
subq $0x1, %rsi
movl 0x18(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x26999(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x2ef11(%rip), %rdi     # 0x6c660
movb $0x0, %al
callq 0x3110
addl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
callq 0x1ef50
movl %eax, -0x6c(%rbp)
jmp 0x3d78b
movq 0x39888(%rip), %rax     # 0x76ff8
movq (%rax), %rdi
leaq 0x3acee(%rip), %rax     # 0x78468
movq (%rax), %rdx
leaq 0x2eeed(%rip), %rsi     # 0x6c671
movb $0x0, %al
callq 0x3170
movl -0x6c(%rbp), %edi
callq 0x1ff00
movq -0x38(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq