// File: /workspace/github_c_makefile_star2_O2/mikeakohn[P]print_pe/build/../src/debug_directory.c
// Function: debug_directory_print
int debug_directory_print(
  FILE *in,
  int addr,
  int size,
  struct section_header_t *section_header)
{
  struct debug_directory_t debug_directory;
  int n;

  uint32_t virtual_address = section_header->VirtualAddress;
  uint32_t raw_ptr = section_header->PointerToRawData;

  addr = (addr - virtual_address) + raw_ptr;
  long marker = ftell(in);
  fseek(in, addr, SEEK_SET);

  printf("  -- Debug Directory --\n\n");

  for (n = 0; n < size; n += 28)
  {
    printf("  -- Debug Directory Entry %d --\n", n / 28);

    debug_directory_entry_read(&debug_directory, in);
    debug_directory_entry_print(&debug_directory);

    if (debug_directory.type == 2)
    {
      debug_directory_print_codeview(&debug_directory, in);
    }
  }

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, 0x20(%rsp)
movl %esi, %r14d
movq %rdi, %rbx
subl 0x10(%rcx), %r14d
addl 0x18(%rcx), %r14d
callq 0x30f0
movq %rax, 0x28(%rsp)
movslq %r14d, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3110
leaq 0x4e2c(%rip), %rdi      # 0x8e22
callq 0x3060
leaq 0x8(%rsp), %r14
pushq $0x1c
popq %r13
leaq 0x4c73(%rip), %r15      # 0x8c7e
leaq 0x4ded(%rip), %rbp      # 0x8dff
xorl %r12d, %r12d
cmpl 0x20(%rsp), %r12d
jge 0x4261
movl %r12d, %eax
xorl %edx, %edx
divl %r13d
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3090
movq %rbx, %rdi
callq 0x5126
movl %eax, 0x4(%rsp)
movq %rbx, %rdi
callq 0x5126
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
callq 0x5168
movw %ax, 0xc(%rsp)
movq %rbx, %rdi
callq 0x5168
movw %ax, 0xe(%rsp)
movq %rbx, %rdi
callq 0x5126
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x5126
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
callq 0x5126
movl %eax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x5126
movl %eax, 0x1c(%rsp)
movl 0x4(%rsp), %esi
leaq 0x4c81(%rip), %rdi      # 0x8d22
xorl %eax, %eax
callq 0x3090
movq %r14, %rdi
callq 0x3080
leaq 0x4c83(%rip), %rdi      # 0x8d3a
movq %rax, %rsi
xorl %eax, %eax
callq 0x3090
movzwl 0xc(%rsp), %esi
leaq 0x4c84(%rip), %rdi      # 0x8d51
xorl %eax, %eax
callq 0x3090
movzwl 0xe(%rsp), %esi
leaq 0x4c89(%rip), %rdi      # 0x8d69
xorl %eax, %eax
callq 0x3090
movl 0x10(%rsp), %esi
leaq 0x4c8f(%rip), %rdi      # 0x8d81
xorl %eax, %eax
callq 0x3090
movl 0x10(%rsp), %eax
cmpq $0x10, %rax
ja 0x4121
leaq 0x4d32(%rip), %rcx      # 0x8e3c
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
leaq 0x4c36(%rip), %rdi      # 0x8d4e
xorl %eax, %eax
callq 0x3090
jmp 0x412f
leaq 0x4c72(%rip), %rdi      # 0x8d9a
xorl %eax, %eax
callq 0x3090
leaq 0x6cc0(%rip), %rdi      # 0xadf6
callq 0x3060
movl 0x14(%rsp), %esi
leaq 0x4c58(%rip), %rdi      # 0x8d9e
xorl %eax, %eax
callq 0x3090
movl 0x18(%rsp), %esi
leaq 0x4c5e(%rip), %rdi      # 0x8db6
xorl %eax, %eax
callq 0x3090
movl 0x1c(%rsp), %esi
leaq 0x4c68(%rip), %rdi      # 0x8dd2
xorl %eax, %eax
callq 0x3090
pushq $0xa
popq %rdi
callq 0x3030
cmpl $0x2, 0x10(%rsp)
jne 0x4258
movq %rbx, %rdi
callq 0x30f0
movq %rax, %r15
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3110
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x51d0
cmpl $0x53445352, 0x24(%rsp) # imm = 0x53445352
jne 0x4251
movq %r15, 0x30(%rsp)
leaq 0x4c2c(%rip), %rdi      # 0x8df3
xorl %eax, %eax
callq 0x3090
pushq $0x10
popq %r14
subl $0x1, %r14d
jb 0x41ee
movq %rbx, %rdi
callq 0x3160
movq %rbp, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3090
jmp 0x41d2
pushq $0xa
popq %rdi
callq 0x3030
movq %rbx, %rdi
callq 0x5126
leaq 0x4c00(%rip), %rdi      # 0x8e05
movl %eax, %esi
xorl %eax, %eax
callq 0x3090
leaq 0x4c00(%rip), %rdi      # 0x8e15
xorl %eax, %eax
callq 0x3090
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
callq 0x3160
testl %eax, %eax
je 0x4236
movl %eax, %edi
callq 0x3030
jmp 0x4221
leaq 0x3edd(%rip), %rdi      # 0x811a
callq 0x3060
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
xorl %edx, %edx
callq 0x3110
leaq 0x4a26(%rip), %r15      # 0x8c7e
addl $0x1c, %r12d
jmp 0x4015
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x3110
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)