// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
movq %rdi, %rbx
movl $0xa, %edi
callq 0x1030
movq %rbx, %rdi
callq 0x1782
leaq 0x199d(%rip), %rdi      # 0x49eb
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1782
movl %eax, %r15d
leaq 0x1991(%rip), %rdi      # 0x4a04
movl %ebp, 0xc(%rsp)
movl %ebp, %esi
xorl %eax, %eax
callq 0x1060
leaq 0x1996(%rip), %rdi      # 0x4a1d
movl %r15d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
leaq 0x1ab1(%rip), %rdi      # 0x4b51
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
testl %r15d, %r15d
je 0x3206
movl %r15d, %r14d
movl 0xc(%rsp), %eax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
leaq 0x196e(%rip), %rdi      # 0x4a36
movl %r13d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1090
movq %rax, %r15
movq %rbx, %rdi
callq 0x16e8
leaq 0x196f(%rip), %rdi      # 0x4a5b
movq %rax, %rsi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
movl %eax, %r12d
movq %rbx, %rdi
callq 0x1782
movl %eax, %ebp
leaq 0x1967(%rip), %rdi      # 0x4a79
movl %r12d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
movl %r12d, %esi
callq 0x29bf
leaq 0x196d(%rip), %rdi      # 0x4a9b
movl %ebp, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
movl %ebp, %esi
callq 0x29bf
movq %rbx, %rdi
callq 0x1782
leaq 0x196d(%rip), %rdi      # 0x4abd
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
leaq 0x1972(%rip), %rdi      # 0x4ada
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
leaq 0x1977(%rip), %rdi      # 0x4af7
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
leaq 0x197a(%rip), %rdi      # 0x4b12
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
cmpl $0x21, 0xc(%rsp)
jb 0x31d8
movq %rbx, %rdi
callq 0x1782
leaq 0x1976(%rip), %rdi      # 0x4b2d
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1782
leaq 0x1980(%rip), %rdi      # 0x4b4f
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1090
subq %r15, %rax
subq 0x10(%rsp), %rax
jge 0x31fa
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x10b0
incl %r13d
cmpl %r13d, %r14d
jne 0x30c1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq