// File: /workspace/github_c_makefile_star2_O2/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_handle_data
void print_minidump_handle_data(FILE *in)
{
  uint32_t n;

  printf("\n");
  printf("     size_of_header: %u\n", read_uint32(in));

  uint32_t size_of_descriptor = read_uint32(in);
  uint32_t number_of_descriptors = read_uint32(in);

  printf(" size_of_descriptor: %u\n", size_of_descriptor);
  printf(" number_descriptors: %u\n", number_of_descriptors);
  printf("           reserved: %u\n", read_uint32(in));

  for (n = 0; n < number_of_descriptors; n++)
  {
    printf("       --- handle descriptor %d ---\n", n);
    long marker = ftell(in);

    printf("               handle: 0x%" PRIx64 "\n", read_uint64(in));

    uint32_t type_name_offset = read_uint32(in);
    uint32_t object_name_offset = read_uint32(in);

    printf("            type_name: offset=%d,", type_name_offset);
    print_minidump_string(in, type_name_offset);

    printf("          object_name: offset=%d,", object_name_offset);
    print_minidump_string(in, object_name_offset);

    printf("           attributes: 0x%x\n", read_uint32(in));
    printf("       granted_access: 0x%x\n", read_uint32(in));
    printf("         handle_count: %u\n", read_uint32(in));
    printf("        pointer_count: %u\n", read_uint32(in));

    if (size_of_descriptor > 32)
    {
      printf("          object_info: offset=%u\n", read_uint32(in));
      printf("             reserved: %u\n", read_uint32(in));
    }

    long end = ftell(in);

    if (end - marker < size_of_descriptor)
    {
      fseek(in, end - marker - size_of_descriptor, SEEK_CUR);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0xa
popq %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1766
leaq 0x1a26(%rip), %rdi      # 0x49eb
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
movl %eax, %r14d
movq %rbx, %rdi
callq 0x1766
movl %eax, %ebp
leaq 0x1a1a(%rip), %rdi      # 0x4a04
movl %r14d, %esi
xorl %eax, %eax
callq 0x1060
leaq 0x1a22(%rip), %rdi      # 0x4a1d
movl %ebp, 0x4(%rsp)
movl %ebp, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
leaq 0x1b3a(%rip), %rdi      # 0x4b51
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movl %r14d, %ebp
xorl %r14d, %r14d
cmpl %r14d, 0x4(%rsp)
je 0x316f
leaq 0x19fe(%rip), %rdi      # 0x4a36
movl %r14d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1090
movq %rax, %r15
movq %rbx, %rdi
callq 0x16cc
leaq 0x19ff(%rip), %rdi      # 0x4a5b
movq %rax, %rsi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
movl %eax, %r12d
movq %rbx, %rdi
callq 0x1766
movl %eax, %r13d
leaq 0x19f6(%rip), %rdi      # 0x4a79
movl %r12d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2951
leaq 0x19fc(%rip), %rdi      # 0x4a9b
movl %r13d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
movl %r13d, %esi
callq 0x2951
movq %rbx, %rdi
callq 0x1766
leaq 0x19fa(%rip), %rdi      # 0x4abd
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
leaq 0x19ff(%rip), %rdi      # 0x4ada
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
leaq 0x1a04(%rip), %rdi      # 0x4af7
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
leaq 0x1a07(%rip), %rdi      # 0x4b12
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
cmpl $0x21, %ebp
jb 0x3149
movq %rbx, %rdi
callq 0x1766
leaq 0x1a05(%rip), %rdi      # 0x4b2d
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1766
leaq 0x1a0f(%rip), %rdi      # 0x4b4f
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1090
subq %r15, %rax
subq %rbp, %rax
jge 0x3167
movq %rbx, %rdi
movq %rax, %rsi
pushq $0x1
popq %rdx
callq 0x10b0
incl %r14d
jmp 0x3026
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq