// File: /workspace/github_c_makefile_star2_O0/hfiguiere[P]exifprobe/x3f.c
// Function: process_x3f_dir
unsigned long
process_x3f_dir(FILE *inptr,unsigned short byteorder,struct x3f_header *x3fheader,
                                                unsigned long directory_pointer,
                                                struct image_summary *summary_entry,
                                                char *parent_name,int level,int indent)
{
    struct x3f_direntry *entry;
    unsigned long directory_offset = 0UL;
    unsigned long section_id;
    unsigned long max_dir_offset = 0L;
    unsigned long entry_offset,next_entry_offset;
    unsigned long num_entries;
    unsigned short version_major;
    unsigned short version_minor;
    int i;
    int chpr = 0;

    directory_offset = read_ulong(inptr,byteorder,directory_pointer);

    section_id = read_ulong(inptr,byteorder,directory_offset);
    version_minor = read_ushort(inptr,byteorder,HERE);
    version_major = read_ushort(inptr,byteorder,HERE);
    num_entries = read_ulong(inptr,byteorder,HERE);
    entry = NULL;

    entry_offset = ftell(inptr);

    /* Print the entries first, in order                              */
    for(i = 0; i < num_entries; ++i)
    {
        entry = read_x3f_direntry(inptr,byteorder,entry,entry_offset);
        if(ferror(inptr))
        {
            fprintf(stderr,"%s: error reading directory entry at %lu\n",
                                                Progname,entry_offset);
            break;
        }
        if(entry == NULL)
        {
            fprintf(stderr,"%s: null entry %d\n",Progname,i);
            break;
        }
        next_entry_offset = ftell(inptr);
        process_x3f_direntry(inptr,byteorder,entry,entry_offset,
                                            summary_entry,parent_name,i,indent);
        entry_offset = next_entry_offset;
    }
    chpr = newline(chpr);
    
    /* Now show the directory itself                                  */

    if((PRINT_SECTION))
    {
        print_tag_address(SECTION,directory_offset,indent,"@");
        chpr += printf("<DIRECTORY> version %d.%d id \"%4.4s\", %lu entries",
                                            version_major,version_minor,
                                            (char *)&section_id,num_entries);
    }
    chpr = newline(chpr);
    entry_offset = directory_offset + 12;
    for(i = 0; i < num_entries; ++i)
    {
        entry = read_x3f_direntry(inptr,byteorder,entry,entry_offset);
        if(ferror(inptr))
        {
            fprintf(stderr,"%s: error reading directory entry at %lu\n",
                                                Progname,entry_offset);
            break;
        }
        if(entry == NULL)
        {
            fprintf(stderr,"%s: null entry %d\n",Progname,i);
            break;
        }
        next_entry_offset = ftell(inptr);
        print_x3f_direntry(inptr,entry,entry_offset,
                                    parent_name,i,indent);
        entry_offset = next_entry_offset;
    }
    max_dir_offset = ftell(inptr);
    if((PRINT_SECTION))
    {
        print_tag_address(SECTION,max_dir_offset - 1,indent,"@");
        chpr += printf("</DIRECTORY>");
        chpr = newline(chpr);
    }

    print_tag_address(ENTRY,directory_pointer,indent,"@");
    if((PRINT_TAGINFO))
    {
        if((PRINT_LONGNAMES))
            chpr += printf("%s.",parent_name);
        chpr += printf("%s","DirectoryOffset");
        if((PRINT_VALUE))
        {
            putindent(X3FTAGWIDTH - 15);
            chpr += printf(" = ");
        }
    }
    if((PRINT_VALUE))
    {
        if(PRINT_BOTH_OFFSET)
            chpr += printf("@%#lx=%lu",directory_offset,directory_offset);
        else if(PRINT_HEX_OFFSET)
            chpr += printf("@%#lx",directory_offset);
        else 
            chpr += printf("@%lu",directory_offset);
    }
    chpr = newline(chpr);
    
    if(entry)
        free(entry);
    return(max_dir_offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movw %si, %ax
movl 0x18(%rbp), %esi
movl 0x10(%rbp), %esi
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, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %ax
movq -0x20(%rbp), %rdx
movzwl %ax, %esi
callq 0x4610
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %ax
movq -0x40(%rbp), %rdx
movzwl %ax, %esi
callq 0x4610
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4480
movw %ax, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4480
movw %ax, -0x6a(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movzwl -0xa(%rbp), %esi
callq 0x4610
movq %rax, -0x68(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x58(%rbp)
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x3ad24
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %ax
movq -0x38(%rbp), %rdx
movq -0x58(%rbp), %rcx
movzwl %ax, %esi
callq 0x3b040
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x3aca4
movq 0x3c378(%rip), %rax     # 0x76ff8
movq (%rax), %rdi
leaq 0x3d7de(%rip), %rax     # 0x78468
movq (%rax), %rdx
movq -0x58(%rbp), %rcx
leaq 0x30038(%rip), %rsi     # 0x6acd0
movb $0x0, %al
callq 0x3170
jmp 0x3ad24
cmpq $0x0, -0x38(%rbp)
jne 0x3acd2
movq 0x3c346(%rip), %rax     # 0x76ff8
movq (%rax), %rdi
leaq 0x3d7ac(%rip), %rax     # 0x78468
movq (%rax), %rdx
movl -0x70(%rbp), %ecx
leaq 0x30031(%rip), %rsi     # 0x6acfa
movb $0x0, %al
callq 0x3170
jmp 0x3ad24
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %si
movq -0x38(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movl -0x70(%rbp), %r10d
movl 0x18(%rbp), %eax
movzwl %si, %esi
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x3b100
movq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x3ac41
movl -0x74(%rbp), %edi
callq 0x1ef50
movl %eax, -0x74(%rbp)
leaq 0x3c44a(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3ad81
movq -0x40(%rbp), %rsi
movl 0x18(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x29384(%rip), %rcx     # 0x640dc
callq 0x5ed0
movzwl -0x6a(%rbp), %esi
movzwl -0x6c(%rbp), %edx
movq -0x68(%rbp), %r8
leaq 0x3152f(%rip), %rdi     # 0x6c29f
leaq -0x48(%rbp), %rcx
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edi
callq 0x1ef50
movl %eax, -0x74(%rbp)
movq -0x40(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x70(%rbp)
movslq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x3ae6d
movq -0x8(%rbp), %rdi
movw -0xa(%rbp), %ax
movq -0x38(%rbp), %rdx
movq -0x58(%rbp), %rcx
movzwl %ax, %esi
callq 0x3b040
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30a0
cmpl $0x0, %eax
je 0x3adff
movq 0x3c21a(%rip), %rax     # 0x76ff8
movq (%rax), %rdi
leaq 0x3d680(%rip), %rax     # 0x78468
movq (%rax), %rdx
movq -0x58(%rbp), %rcx
leaq 0x2feda(%rip), %rsi     # 0x6acd0
movb $0x0, %al
callq 0x3170
jmp 0x3ae6d
cmpq $0x0, -0x38(%rbp)
jne 0x3ae2d
movq 0x3c1eb(%rip), %rax     # 0x76ff8
movq (%rax), %rdi
leaq 0x3d651(%rip), %rax     # 0x78468
movq (%rax), %rdx
movl -0x70(%rbp), %ecx
leaq 0x2fed6(%rip), %rsi     # 0x6acfa
movb $0x0, %al
callq 0x3170
jmp 0x3ae6d
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl -0x70(%rbp), %r8d
movl 0x18(%rbp), %r9d
callq 0x3bed0
movq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x3ad9f
movq -0x8(%rbp), %rdi
callq 0x3180
movq %rax, -0x50(%rbp)
leaq 0x3c2ff(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40000, %rax          # imm = 0x40000
cmpq $0x0, %rax
je 0x3aecb
movq -0x50(%rbp), %rsi
subq $0x1, %rsi
movl 0x18(%rbp), %edx
movl $0x40000, %edi          # imm = 0x40000
leaq 0x29235(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x3141e(%rip), %rdi     # 0x6c2d1
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edi
callq 0x1ef50
movl %eax, -0x74(%rbp)
movq -0x20(%rbp), %rsi
movl 0x18(%rbp), %edx
movl $0x4003333, %edi        # imm = 0x4003333
leaq 0x291fe(%rip), %rcx     # 0x640dc
callq 0x5ed0
leaq 0x3c296(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x3003, %rax           # imm = 0x3003
cmpq $0x0, %rax
je 0x3af74
leaq 0x3c280(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x3af25
movq -0x30(%rbp), %rsi
leaq 0x2cc61(%rip), %rdi     # 0x67b79
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
leaq 0x2916b(%rip), %rdi     # 0x64097
leaq 0x313ab(%rip), %rsi     # 0x6c2de
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
leaq 0x3c239(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3af72
movl $0x3, %edi
callq 0x60e0
leaq 0x31db3(%rip), %rdi     # 0x6cd18
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x3af74
leaq 0x3c205(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
je 0x3b00e
leaq 0x3c1ed(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x300, %rax            # imm = 0x300
cmpq $0x300, %rax            # imm = 0x300
jne 0x3afc2
movq -0x40(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq 0x2c92c(%rip), %rdi     # 0x678df
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x3b00c
leaq 0x3c1b7(%rip), %rax     # 0x77180
movq (%rax), %rax
andq $0x100, %rax            # imm = 0x100
cmpq $0x0, %rax
je 0x3aff2
movq -0x40(%rbp), %rsi
leaq 0x2c909(%rip), %rdi     # 0x678ec
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x3b00a
movq -0x40(%rbp), %rsi
leaq 0x2fd8e(%rip), %rdi     # 0x6ad8b
movb $0x0, %al
callq 0x3110
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0x3b00c
jmp 0x3b00e
movl -0x74(%rbp), %edi
callq 0x1ef50
movl %eax, -0x74(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3b029
movq -0x38(%rbp), %rdi
callq 0x3040
movq -0x50(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)