// File: /workspace/github_c_makefile_star2_O1/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 0x178e
leaq 0x1994(%rip), %rdi      # 0x49eb
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movl %eax, %ebp
movq %rbx, %rdi
callq 0x178e
movl %eax, %r15d
leaq 0x1988(%rip), %rdi      # 0x4a04
movl %ebp, 0xc(%rsp)
movl %ebp, %esi
xorl %eax, %eax
callq 0x1060
leaq 0x198d(%rip), %rdi      # 0x4a1d
movl %r15d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1aa8(%rip), %rdi      # 0x4b51
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
testl %r15d, %r15d
je 0x320f
movl %r15d, %r14d
movl 0xc(%rsp), %eax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
leaq 0x1965(%rip), %rdi      # 0x4a36
movl %r13d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1090
movq %rax, %r15
movq %rbx, %rdi
callq 0x16f4
leaq 0x1966(%rip), %rdi      # 0x4a5b
movq %rax, %rsi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movl %eax, %r12d
movq %rbx, %rdi
callq 0x178e
movl %eax, %ebp
leaq 0x195e(%rip), %rdi      # 0x4a79
movl %r12d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
movl %r12d, %esi
callq 0x29cb
leaq 0x1964(%rip), %rdi      # 0x4a9b
movl %ebp, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
movl %ebp, %esi
callq 0x29cb
movq %rbx, %rdi
callq 0x178e
leaq 0x1964(%rip), %rdi      # 0x4abd
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1969(%rip), %rdi      # 0x4ada
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x196e(%rip), %rdi      # 0x4af7
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1971(%rip), %rdi      # 0x4b12
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
cmpl $0x21, 0xc(%rsp)
jb 0x31e1
movq %rbx, %rdi
callq 0x178e
leaq 0x196d(%rip), %rdi      # 0x4b2d
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1977(%rip), %rdi      # 0x4b4f
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x1090
subq %r15, %rax
subq 0x10(%rsp), %rax
jge 0x3203
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x10b0
incl %r13d
cmpl %r13d, %r14d
jne 0x30ca
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq