LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/debug_directory.c
// Function: debug_directory_print_codeview
static void debug_directory_print_codeview(
  struct debug_directory_t *debug_directory,
  FILE *in)
{
  long marker = ftell(in);
  uint8_t magic[4];
  int n;

  fseek(in, debug_directory->pointer_to_raw_data, SEEK_SET);
  read_chars_bin(in, magic, 4);

  if (memcmp(magic, "RSDS", 4) != 0) { return; }

  printf("      GUID:");
  for (n = 0; n < 16; n++)
  {
    printf(" %02x", getc(in));
  }
  printf("\n");

  uint32_t age = read_uint32(in);
  printf("       age: %d\n", age);
  printf("  filename: ");

  while (1)
  {
    int ch = getc(in);
    if (ch == 0) { break; }
    printf("%c", ch);
  }
  printf("\n\n");

  fseek(in, marker, SEEK_SET);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30e0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x3100
movq -0x10(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
movl $0x4, %edx
callq 0x6140
leaq -0x1c(%rbp), %rax
movl (%rax), %eax
subl $0x53445352, %eax       # imm = 0x53445352
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x484e
jmp 0x490a
leaq 0x65bc(%rip), %rdi      # 0xae11
movb $0x0, %al
callq 0x3080
movl $0x0, -0x20(%rbp)
cmpl $0x10, -0x20(%rbp)
jge 0x488d
movq -0x10(%rbp), %rdi
callq 0x3150
movl %eax, %esi
leaq 0x65a2(%rip), %rdi      # 0xae1d
movb $0x0, %al
callq 0x3080
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4863
leaq 0x5898(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %esi
leaq 0x6572(%rip), %rdi      # 0xae23
movb $0x0, %al
callq 0x3080
leaq 0x6574(%rip), %rdi      # 0xae33
movb $0x0, %al
callq 0x3080
movq -0x10(%rbp), %rdi
callq 0x3150
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x48da
jmp 0x48ed
movl -0x28(%rbp), %esi
leaq 0x655c(%rip), %rdi      # 0xae40
movb $0x0, %al
callq 0x3080
jmp 0x48c6
leaq 0x5837(%rip), %rdi      # 0xa12b
movb $0x0, %al
callq 0x3080
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/dos.c
// Function: read_dos_header
int read_dos_header(FILE *in, struct dos_header_t *dos_header)
{
  dos_header->e_magic = read_uint16(in);
  dos_header->e_cblp = read_uint16(in);
  dos_header->e_cp = read_uint16(in);
  dos_header->e_crlc = read_uint16(in);
  dos_header->e_cparhdr = read_uint16(in);
  dos_header->e_minalloc = read_uint16(in);
  dos_header->e_maxalloc = read_uint16(in);
  dos_header->e_ss = read_uint16(in);
  dos_header->e_sp = read_uint16(in);
  dos_header->e_csum = read_uint16(in);
  dos_header->e_ip = read_uint16(in);
  dos_header->e_cs = read_uint16(in);
  dos_header->e_lfarlc = read_uint16(in);
  dos_header->e_ovno = read_uint16(in);
  read_chars_bin(in, dos_header->e_res, 8);
  dos_header->e_oemid = read_uint16(in);
  dos_header->e_oeminfo = read_uint16(in);
  read_chars_bin(in, dos_header->e_res2, 20);
  dos_header->e_lfanew = read_uint32(in);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xa(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x14(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x16(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x1a(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1c, %rsi
movl $0x8, %edx
callq 0x6140
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x24(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x26(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
movl $0x14, %edx
callq 0x6140
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x3c(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/file_header.c
// Function: file_header_read
int file_header_read(struct file_header_t *file_header, FILE *in)
{
  file_header->Machine = read_uint16(in);
  file_header->NumberOfSections = read_uint16(in);
  file_header->TimeDateStamp = read_uint32(in);
  file_header->PointerToSymbolTable = read_uint32(in);
  file_header->NumberOfSymbols = read_uint32(in);
  file_header->SizeOfOptionalHeader = read_uint16(in);
  file_header->Characteristics = read_uint16(in);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x12(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/imports.c
// Function: import_dir_read
static int import_dir_read(struct import_dir_t *import_dir, FILE *in)
{
  import_dir->FunctionNameList = read_uint32(in);
  import_dir->TimeDateStamp = read_uint32(in);
  import_dir->ForwardChain = read_uint32(in);
  import_dir->ModuleName = read_uint32(in);
  import_dir->FunctionAddressList = read_uint32(in);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/imports.c
// Function: imports_find
int imports_find(
  FILE *in,
  int address,
  int size,
  int address_size,
  struct section_header_t *section_header,
  const char *search_name)
{
  struct import_dir_t import_dir;
  char name[1024];
  long marker;
  int total_size;
  uint32_t virtual_address, raw_ptr;
  int func_addr;
  int t, ptr;

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

  address = (address - virtual_address) + raw_ptr;

  marker = ftell(in);
  fseek(in, address, SEEK_SET);

  total_size = 0;

  while (total_size < size)
  {
    import_dir_read(&import_dir, in);

    if (import_dir.FunctionNameList == 0) { break; }

    t = 0;

    while (1)
    {
      func_addr = get_ptr(in, (import_dir.FunctionAddressList - virtual_address) + raw_ptr + t);

      if (func_addr == 0) { break; }

      ptr = get_ptr(in, (import_dir.FunctionNameList - virtual_address) + raw_ptr + t);
      get_string(in, name, (ptr - virtual_address) + raw_ptr + 2);

      if (strcmp(name, search_name) == 0)
      {
        fseek(in, marker, SEEK_SET);
        return 1;
      }

      t = t + address_size;
    }

    total_size = total_size + sizeof(import_dir);
  }

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x460(%rbp)
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x464(%rbp)
movl -0x14(%rbp), %eax
subl -0x460(%rbp), %eax
addl -0x464(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30e0
movq %rax, -0x458(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl $0x0, -0x45c(%rbp)
movl -0x45c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x681b
movq -0x10(%rbp), %rsi
leaq -0x44(%rbp), %rdi
callq 0x6620
cmpl $0x0, -0x44(%rbp)
jne 0x673c
jmp 0x681b
movl $0x0, -0x46c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
subl -0x460(%rbp), %esi
addl -0x464(%rbp), %esi
addl -0x46c(%rbp), %esi
callq 0x6330
movl %eax, -0x468(%rbp)
cmpl $0x0, -0x468(%rbp)
jne 0x6778
jmp 0x6805
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
subl -0x460(%rbp), %esi
addl -0x464(%rbp), %esi
addl -0x46c(%rbp), %esi
callq 0x6330
movl %eax, -0x470(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x450(%rbp), %rsi
movl -0x470(%rbp), %edx
subl -0x460(%rbp), %edx
addl -0x464(%rbp), %edx
addl $0x2, %edx
callq 0x62a0
leaq -0x450(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x30b0
cmpl $0x0, %eax
jne 0x67f1
movq -0x10(%rbp), %rdi
movq -0x458(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl $0x1, -0x4(%rbp)
jmp 0x6834
movl -0x46c(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x46c(%rbp)
jmp 0x6746
movslq -0x45c(%rbp), %rax
addq $0x14, %rax
movl %eax, -0x45c(%rbp)
jmp 0x6715
movq -0x10(%rbp), %rdi
movq -0x458(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/pe.c
// Function: rip_binary
int rip_binary(FILE *in, char *filename, int address, int size)
{
  FILE *out;
  long marker;
  int t;

  out = fopen(filename, "wb");

  if (out == NULL)
  {
    printf("Cannot open file %s for writing.\n\n",filename);
    return -1;
  }

  marker = ftell(in);
  fseek(in, address, SEEK_SET);

  for (t = 0; t < size; t++)
  {
    putc(getc(in), out);
  }

  fseek(in, marker, SEEK_SET);
  fclose(out);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x2efe(%rip), %rsi      # 0xa16f
callq 0x3110
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x729c
movq -0x18(%rbp), %rsi
leaq 0x4af9(%rip), %rdi      # 0xbd85
movb $0x0, %al
callq 0x3080
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7305
movq -0x10(%rbp), %rdi
callq 0x30e0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x72e6
movq -0x10(%rbp), %rdi
callq 0x3150
movl %eax, %edi
movq -0x28(%rbp), %rsi
callq 0x30c0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x72bf
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movq -0x28(%rbp), %rdi
callq 0x3060
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/pe.c
// Function: read_unicode
int read_unicode(FILE *in, int address, char *s, int max_chars)
{
  long marker;
  int ch,t,len;

  marker = ftell(in);
  fseek(in, address, SEEK_SET);

  t = 0;
  len = read_uint16(in);

  while (t < len)
  {
    getc(in);
    ch = getc(in);
    if (ch == EOF || ch == 0) { break; }
    s[t++] = ch;

    if (t == max_chars - 1) { break; }
  }

  s[t] = 0;

  fseek(in, marker, SEEK_SET);

  return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6070
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x73ab
movq -0x8(%rbp), %rdi
callq 0x3150
movq -0x8(%rbp), %rdi
callq 0x3150
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
je 0x737e
cmpl $0x0, -0x2c(%rbp)
jne 0x7380
jmp 0x73ab
movl -0x2c(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x30(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x73a9
jmp 0x73ab
jmp 0x7355
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl -0x30(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/pe.c
// Function: hex_dump
int hex_dump(FILE *in, int address, int size, struct section_header_t *section_header)
{
  long marker;
  uint32_t virtual_address, raw_ptr;
  int t;

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

  address = (address - virtual_address) + raw_ptr;

  marker = ftell(in);
  fseek(in, address, SEEK_SET);

  printf("-- Hex Dump address=0x%04x size=%d --\n", address, size);

  for (t = 0; t < size; t++)
  {
    if ((t % 8) == 0) { printf("\n"); }
    printf(" %02x", getc(in));
  }
  printf("\n");

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0xc(%rbp), %eax
subl -0x24(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq 0x4979(%rip), %rdi      # 0xbda8
movb $0x0, %al
callq 0x3080
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x7487
movl -0x2c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x7463
leaq 0x2cd0(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
callq 0x3150
movl %eax, %esi
leaq 0x39a8(%rip), %rdi      # 0xae1d
movb $0x0, %al
callq 0x3080
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x743d
leaq 0x2c9e(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_version_info
int parse_version_info(FILE *in, long offset, int size)
{
  struct fixed_file_info_t fixed_file_info;
  long marker;
  uint16_t wLength, wValueLength, wType;
  char szKey[128];
  int len;

  marker = ftell(in);
  fseek(in, offset, SEEK_SET);

  len = read_struct_info(in, &wLength, &wValueLength, &wType, szKey, sizeof(szKey));

#if 0
fseek(in, offset, SEEK_SET);
//char buffer[2192];
char buffer[wLength];
fread(buffer, 1, sizeof(buffer), in);
fclose(in);

FILE *fp = fopen("vs_versionfinfo.bin", "wb");
fwrite(buffer, 1, sizeof(buffer), fp);
fclose(fp);
exit(0);
#endif

  len += read_padding(in, len);
  len += read_fixed_file_info(in, &fixed_file_info);
  print_fixed_file_info(&fixed_file_info);
  len += read_padding(in, len);

  while (len < wLength)
  {
    len += parse_x_file_info(in);
  }

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movq -0x8(%rbp), %rdi
leaq -0xe0(%rbp), %r8
leaq -0x52(%rbp), %rsi
leaq -0x54(%rbp), %rdx
leaq -0x56(%rbp), %rcx
movl $0x80, %r9d
callq 0x75b0
movl %eax, -0xe4(%rbp)
movq -0x8(%rbp), %rdi
movl -0xe4(%rbp), %esi
callq 0x76c0
addl -0xe4(%rbp), %eax
movl %eax, -0xe4(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x7710
addl -0xe4(%rbp), %eax
movl %eax, -0xe4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7820
movq -0x8(%rbp), %rdi
movl -0xe4(%rbp), %esi
callq 0x76c0
addl -0xe4(%rbp), %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movzwl -0x52(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7587
movq -0x8(%rbp), %rdi
callq 0x7ae0
addl -0xe4(%rbp), %eax
movl %eax, -0xe4(%rbp)
jmp 0x7562
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: read_struct_info
static int read_struct_info(
  FILE *in,
  uint16_t *wLength,
  uint16_t *wValueLength,
  uint16_t *wType,
  char *szKey,
  int szKey_length)
{
  int len = 6;

  *wLength = read_uint16(in);
  *wValueLength = read_uint16(in);
  *wType = read_uint16(in);

  printf("   wLength=%d\n", *wLength);
  printf("   wValueLength=%d\n", *wValueLength);
  printf("   wType=%d %s\n", *wType, *wType == 0 ? "(binary)" : "(text)");
  printf("   szKey=");
  len += parse_unicode(in, szKey, szKey_length);
  len += read_padding(in, len);
  printf("\n");

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl $0x6, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
movq -0x10(%rbp), %rax
movzwl (%rax), %esi
leaq 0x4c4a(%rip), %rdi      # 0xc268
movb $0x0, %al
callq 0x3080
movq -0x18(%rbp), %rax
movzwl (%rax), %esi
leaq 0x4c44(%rip), %rdi      # 0xc277
movb $0x0, %al
callq 0x3080
movq -0x20(%rbp), %rax
movzwl (%rax), %esi
movq -0x20(%rbp), %rax
movzwl (%rax), %ecx
leaq 0x4c55(%rip), %rdx      # 0xc2a4
leaq 0x4c45(%rip), %rax      # 0xc29b
cmpl $0x0, %ecx
cmoveq %rax, %rdx
leaq 0x4c27(%rip), %rdi      # 0xc28b
movb $0x0, %al
callq 0x3080
leaq 0x4c39(%rip), %rdi      # 0xc2ab
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x8420
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x76c0
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
leaq 0x2a84(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
movl -0x30(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: read_padding
static int read_padding(FILE *in, int len)
{
  int count = 0;

  while ((len & 0x3) != 0)
  {
    getc(in);
    count++;
    len++;
  }

  return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x76fe
movq -0x8(%rbp), %rdi
callq 0x3150
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x76d6
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: read_fixed_file_info
int read_fixed_file_info(FILE *in, struct fixed_file_info_t *fixed_file_info)
{
  fixed_file_info->Signature = read_uint32(in);
  fixed_file_info->StrucVersion = read_uint32(in);
  fixed_file_info->FileVersionMS = read_uint32(in);
  fixed_file_info->FileVersionLS = read_uint32(in);
  fixed_file_info->ProductVersionMS = read_uint32(in);
  fixed_file_info->ProductVersionLS = read_uint32(in);
  fixed_file_info->FileFlagsMask = read_uint32(in);
  fixed_file_info->FileFlags = read_uint32(in);
  fixed_file_info->FileOS = read_uint32(in);
  fixed_file_info->FileType = read_uint32(in);
  fixed_file_info->FileSubtype = read_uint32(in);
  fixed_file_info->FileDateMS = read_uint32(in);
  fixed_file_info->FileDateLS = read_uint32(in);

  return 13 * sizeof(uint32_t);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x34, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_x_file_info
static int parse_x_file_info(FILE *in)
{
  uint16_t wLength, wValueLength, wType;
  char szKey[128];
  int len;

  printf("   -- StringFileInfo --\n");
  len = read_struct_info(in, &wLength, &wValueLength, &wType, szKey, sizeof(szKey));

  if (strcmp(szKey, "StringFileInfo") == 0)
  {
    len += parse_string_table(in, wLength);
  }
    else
  if (strcmp(szKey, "VarFileInfo") == 0)
  {
    len += parse_var(in, wLength);
  }
    else
  {
    len += wLength - 4;
  }

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x47bf(%rip), %rdi      # 0xc2b5
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %r8
leaq -0xa(%rbp), %rsi
leaq -0xc(%rbp), %rdx
leaq -0xe(%rbp), %rcx
movl $0x80, %r9d
callq 0x75b0
movl %eax, -0x94(%rbp)
leaq -0x90(%rbp), %rdi
leaq 0x479b(%rip), %rsi      # 0xc2ce
callq 0x30b0
cmpl $0x0, %eax
jne 0x7b58
movq -0x8(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x84e0
addl -0x94(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x7ba0
leaq -0x90(%rbp), %rdi
leaq 0x4777(%rip), %rsi      # 0xc2dd
callq 0x30b0
cmpl $0x0, %eax
jne 0x7b8b
movq -0x8(%rbp), %rdi
movzwl -0xa(%rbp), %esi
callq 0x8560
addl -0x94(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x7b9e
movzwl -0xa(%rbp), %eax
subl $0x4, %eax
addl -0x94(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x7ba0
movl -0x94(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: read_resource_dir
int read_resource_dir(FILE *in, int addr, struct resource_dir_t *resource_dir)
{
  int marker;

  marker = ftell(in);
  fseek(in,addr,SEEK_SET);

  resource_dir->Characteristics = read_uint32(in);
  resource_dir->TimeDateStamp = read_uint32(in);
  resource_dir->MajorVersion = read_uint16(in);
  resource_dir->MinorVersion = read_uint16(in);
  resource_dir->NumberOfNamedEntries = read_uint16(in);
  resource_dir->NumberOfIdEntries = read_uint16(in);

  fseek(in, marker, SEEK_SET);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xa(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x8(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x8(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: print_resource_dir
int print_resource_dir(struct resource_dir_t *resource_dir, int level)
{
  char indent[RES_INDENT_MAX];

  memset(indent, ' ', RES_INDENT_MAX);
  if (level > RES_INDENT_LEVELS) { level = RES_INDENT_LEVELS; }
  indent[level * RES_INDENT_UNIT] = 0;

  printf("%s|_______ Resource Directory ___\n",indent);

  printf("%s|  Characteristics: 0x%x\n",indent,resource_dir->Characteristics);
  printf("%s|    TimeDateStamp: %s",indent,ctime((time_t *)&resource_dir->TimeDateStamp));
  printf("%s|     MajorVersion: %d\n",indent,resource_dir->MajorVersion);
  printf("%s|     MinorVersion: %d\n",indent,resource_dir->MinorVersion);
  printf("%s|NumOfNamedEntries: %d\n",indent,resource_dir->NumberOfNamedEntries);
  printf("%s|   NumOfIdEntries: %d\n",indent,resource_dir->NumberOfIdEntries);
  printf("\n");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x70(%rbp), %rdi
movl $0x20, %esi
movl $0x64, %edx
callq 0x30a0
cmpl $0x18, -0xc(%rbp)
jle 0x7eb2
movl $0x18, -0xc(%rbp)
movl -0xc(%rbp), %eax
shll $0x2, %eax
cltq
movb $0x0, -0x70(%rbp,%rax)
leaq -0x70(%rbp), %rsi
leaq 0x3fd9(%rip), %rdi      # 0xbea3
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movl (%rax), %edx
leaq 0x3fe4(%rip), %rdi      # 0xbec6
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
callq 0x3070
movq -0x78(%rbp), %rsi
movq %rax, %rdx
leaq 0x3fd6(%rip), %rdi      # 0xbee2
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movzwl 0x8(%rax), %edx
leaq 0x3fd5(%rip), %rdi      # 0xbefb
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %edx
leaq 0x3fd5(%rip), %rdi      # 0xbf15
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movzwl 0xc(%rax), %edx
leaq 0x3fd5(%rip), %rdi      # 0xbf2f
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movzwl 0xe(%rax), %edx
leaq 0x3fd5(%rip), %rdi      # 0xbf49
movb $0x0, %al
callq 0x3080
leaq 0x21aa(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
xorl %eax, %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: read_resource_dir_entry
int read_resource_dir_entry(
  FILE *in,
  int addr,
  struct resource_dir_entry_t *resource_dir_entry,
  int offset)
{
  long marker;

  marker = ftell(in);
  fseek(in, addr + offset, SEEK_SET);

  resource_dir_entry->Name = read_uint32(in);
  resource_dir_entry->OffsetToData = read_uint32(in);

  if ((resource_dir_entry->Name & 0x80000000) != 0)
  {
    read_unicode(
      in,
      addr + (resource_dir_entry->Name & 0x7fffffff),
      resource_dir_entry->RealName,
      256);
  }
    else
  {
    resource_dir_entry->RealName[0] = 0;
  }

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
addl -0x1c(%rbp), %eax
movslq %eax, %rsi
xorl %edx, %edx
callq 0x3100
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x8032
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl %eax, %esi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x7310
jmp 0x803a
movq -0x18(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: print_resource_dir_entry
int print_resource_dir_entry(
  struct resource_dir_entry_t *resource_dir_entry,
  int level,
  int count)
{
  char indent[RES_INDENT_MAX];

  memset(indent, ' ', RES_INDENT_MAX);
  if (level > RES_INDENT_LEVELS) level = RES_INDENT_LEVELS;
  indent[level * RES_INDENT_UNIT] = 0;

  if ((resource_dir_entry->OffsetToData & 0x80000000) == 0)
  {
    printf("%s-- Resource Dir Entry [%d] --\n", indent, count);
  }
    else
  {
    printf("%s-- Resource Dir Entry (Dir) [%d] --\n", indent, count);
  }

  printf("%s|             Name: 0x%08x", indent, resource_dir_entry->Name);

  if ((resource_dir_entry->Name&0x80000000) != 0)
  {
    printf("%s|(%s)", indent, resource_dir_entry->RealName);
  }

  printf("\n");
  printf("%s|     OffsetToData: 0x%08x\n", indent, resource_dir_entry->OffsetToData);
  printf("\n");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
leaq -0x80(%rbp), %rdi
movl $0x20, %esi
movl $0x64, %edx
callq 0x30a0
cmpl $0x18, -0xc(%rbp)
jle 0x8095
movl $0x18, -0xc(%rbp)
movl -0xc(%rbp), %eax
shll $0x2, %eax
cltq
movb $0x0, -0x80(%rbp,%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x80ca
leaq -0x80(%rbp), %rsi
movl -0x10(%rbp), %edx
leaq 0x3d57(%rip), %rdi      # 0xbe18
movb $0x0, %al
callq 0x3080
jmp 0x80df
leaq -0x80(%rbp), %rsi
movl -0x10(%rbp), %edx
leaq 0x3d61(%rip), %rdi      # 0xbe39
movb $0x0, %al
callq 0x3080
leaq -0x80(%rbp), %rsi
movq -0x8(%rbp), %rax
movl (%rax), %edx
leaq 0x3d70(%rip), %rdi      # 0xbe60
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x8121
leaq -0x80(%rbp), %rsi
movq -0x8(%rbp), %rdx
addq $0x8, %rdx
leaq 0x3d63(%rip), %rdi      # 0xbe7d
movb $0x0, %al
callq 0x3080
leaq 0x2004(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
leaq -0x80(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0x3d44(%rip), %rdi      # 0xbe85
movb $0x0, %al
callq 0x3080
leaq 0x1fdd(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
xorl %eax, %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: read_resource_data
int read_resource_data(
  FILE *in,
  int addr,
  struct resource_data_t *resource_data,
  int offset)
{
  long marker;

  marker = ftell(in);
  fseek(in, addr + offset, SEEK_SET);

  resource_data->OffsetToData = read_uint32(in);
  resource_data->Size = read_uint32(in);
  resource_data->CodePage = read_uint32(in);
  resource_data->Reserved = read_uint32(in);

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
addl -0x1c(%rbp), %eax
movslq %eax, %rsi
xorl %edx, %edx
callq 0x3100
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: print_resource_data
int print_resource_data(struct resource_data_t *resource_data, int level)
{
  char indent[RES_INDENT_MAX];

  memset(indent, ' ', RES_INDENT_MAX);
  if (level > RES_INDENT_LEVELS) { level = RES_INDENT_LEVELS; }
  indent[level * RES_INDENT_UNIT] = 0;

  printf("%s-- Resource Data --\n", indent);
  printf("%s|     OffsetToData: %d\n", indent,resource_data->OffsetToData);
  printf("%s|             Size: %d\n", indent,resource_data->Size);
  printf("%s|         CodePage: %d\n", indent,resource_data->CodePage);
  printf("%s|         Reserved: %d\n", indent,resource_data->Reserved);
  printf("\n");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x70(%rbp), %rdi
movl $0x20, %esi
movl $0x64, %edx
callq 0x30a0
cmpl $0x18, -0xc(%rbp)
jle 0x823f
movl $0x18, -0xc(%rbp)
movl -0xc(%rbp), %eax
shll $0x2, %eax
cltq
movb $0x0, -0x70(%rbp,%rax)
leaq -0x70(%rbp), %rsi
leaq 0x3daa(%rip), %rdi      # 0xc001
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movl (%rax), %edx
leaq 0x3da9(%rip), %rdi      # 0xc018
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0x3daa(%rip), %rdi      # 0xc032
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x3dab(%rip), %rdi      # 0xc04c
movb $0x0, %al
callq 0x3080
leaq -0x70(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0xc(%rax), %edx
leaq 0x3dac(%rip), %rdi      # 0xc066
movb $0x0, %al
callq 0x3080
leaq 0x1e64(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
xorl %eax, %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: print_resource_type
int print_resource_type(int id, int level)
{
  char indent[RES_INDENT_MAX];
  char *ids[] = {
    "", "Cursor", "Bitmap", "Icon", "Menu", "Dialog", "String",
    "Font Dir", "Font", "Accelerator", "RCData", "MessageTable",
    "", "", "", "", "Version Info", "DlgInclude", "", "PlugPlay",
    "VXD", "AniCursor", "AniIcon", "HTML", "Unknown"
  };

  memset(indent, ' ', RES_INDENT_MAX);
  if (level > RES_INDENT_LEVELS) { level = RES_INDENT_LEVELS; }
  indent[level*RES_INDENT_UNIT] = 0;

  printf("%s>> Resource Type: ", indent);

  if (id < 0x17)
  {
    printf("%s\n", ids[id]);
  }
  else
  {
    printf("???\n");
  }

  printf("\n");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
leaq -0x140(%rbp), %rdi
leaq 0x6a31(%rip), %rsi      # 0xed30
movl $0xc8, %edx
callq 0x30f0
leaq -0x70(%rbp), %rdi
movl $0x20, %esi
movl $0x64, %edx
callq 0x30a0
cmpl $0x18, -0x8(%rbp)
jle 0x8329
movl $0x18, -0x8(%rbp)
movl -0x8(%rbp), %eax
shll $0x2, %eax
cltq
movb $0x0, -0x70(%rbp,%rax)
leaq -0x70(%rbp), %rsi
leaq 0x3ca6(%rip), %rdi      # 0xbfe7
movb $0x0, %al
callq 0x3080
cmpl $0x17, -0x4(%rbp)
jge 0x836a
movslq -0x4(%rbp), %rax
movq -0x140(%rbp,%rax,8), %rsi
leaq 0x47da(%rip), %rdi      # 0xcb3b
movb $0x0, %al
callq 0x3080
jmp 0x8378
leaq 0x3c8b(%rip), %rdi      # 0xbffc
movb $0x0, %al
callq 0x3080
leaq 0x1dad(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
xorl %eax, %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: save_resource
int save_resource(FILE *in, char *filename, int addr)
{
  int marker;
  unsigned OffsetToData,Size;

  marker = ftell(in);
  fseek(in, addr, SEEK_SET);

  OffsetToData = read_uint32(in);
  Size = read_uint32(in);

  printf("OffsetToData=%d\n", OffsetToData);
  printf("Size=0x%08x\n", Size);

  fseek(in, marker, SEEK_SET);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30e0
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x14(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %esi
leaq 0x3a0a(%rip), %rdi      # 0xbdfa
movb $0x0, %al
callq 0x3080
movl -0x20(%rbp), %esi
leaq 0x3a0a(%rip), %rdi      # 0xbe0b
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x3100
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_unicode
static int parse_unicode(FILE *in, char *key, int length)
{
  int ch, w;
  int len = 0;
  int ptr = 0;

  while (1)
  {
    w = getc(in);
    ch = getc(in);
    w |= (ch << 8);
    len += 2;
    if (w == 0 || ch == EOF) { break; }

    printf("%c", w);
    if (ptr < length -1) { key[ptr++] = w; }
  }

  key[ptr] = 0;
  printf("\n");

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3150
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3150
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
shll $0x8, %eax
orl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x847a
cmpl $-0x1, -0x18(%rbp)
jne 0x847c
jmp 0x84b6
movl -0x1c(%rbp), %esi
leaq 0x29ba(%rip), %rdi      # 0xae40
movb $0x0, %al
callq 0x3080
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x84b4
movl -0x1c(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x8441
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, (%rax,%rcx)
leaq 0x1c63(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
movl -0x20(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_string_table
static int parse_string_table(FILE *in, int length)
{
  uint16_t wLength, wValueLength, wType;
  char szKey[128];
  int len;

  printf("    -- StringTable --\n");
  len = read_struct_info(in, &wLength, &wValueLength, &wType, szKey, sizeof(szKey));

  while (len < wLength)
  {
    len += parse_string(in);
  }

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x3df0(%rip), %rdi      # 0xc2e9
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %r8
leaq -0xe(%rbp), %rsi
leaq -0x10(%rbp), %rdx
leaq -0x12(%rbp), %rcx
movl $0x80, %r9d
callq 0x75b0
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movzwl -0xe(%rbp), %ecx
cmpl %ecx, %eax
jge 0x854d
movq -0x8(%rbp), %rdi
callq 0x85e0
addl -0xa4(%rbp), %eax
movl %eax, -0xa4(%rbp)
jmp 0x8528
movl -0xa4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_var
static int parse_var(FILE *in, int length)
{
  uint16_t wLength, wValueLength, wType;
  char szKey[128];
  int len;

  printf("    -- Var --\n");
  len = read_struct_info(in, &wLength, &wValueLength, &wType, szKey, sizeof(szKey));

  printf("   value=%d\n\n", read_uint32(in));

  len += 4;

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x3da3(%rip), %rdi      # 0xc31c
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
leaq -0xa0(%rbp), %r8
leaq -0xe(%rbp), %rsi
leaq -0x10(%rbp), %rdx
leaq -0x12(%rbp), %rcx
movl $0x80, %r9d
callq 0x75b0
movl %eax, -0xa4(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6010
movl %eax, %esi
leaq 0x3d71(%rip), %rdi      # 0xc32b
movb $0x0, %al
callq 0x3080
movl -0xa4(%rbp), %eax
addl $0x4, %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/resource.c
// Function: parse_string
static int parse_string(FILE *in)
{
  uint16_t wLength, wValueLength, wType;
  char szKey[128];
  int len, n;

  printf("    -- String --\n");
  len = read_struct_info(in, &wLength, &wValueLength, &wType, szKey, sizeof(szKey));

  printf("   value=");

  for (n = 0; n < wValueLength; n++)
  {
    int w = getc(in);
    int ch = getc(in);
    w |= (ch << 8);

    printf("%c", w);

    len += 2;
  }

  printf("\n\n");

  len += read_padding(in, len);

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x3d0a(%rip), %rdi      # 0xc300
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %r8
leaq -0xa(%rbp), %rsi
leaq -0xc(%rbp), %rdx
leaq -0xe(%rbp), %rcx
movl $0x80, %r9d
callq 0x75b0
movl %eax, -0x94(%rbp)
leaq 0x3ce6(%rip), %rdi      # 0xc312
movb $0x0, %al
callq 0x3080
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
movzwl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x86b2
movq -0x8(%rbp), %rdi
callq 0x3150
movl %eax, -0x9c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3150
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
shll $0x8, %eax
orl -0x9c(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %esi
leaq 0x27b5(%rip), %rdi      # 0xae40
movb $0x0, %al
callq 0x3080
movl -0x94(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x94(%rbp)
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x863d
leaq 0x1a72(%rip), %rdi      # 0xa12b
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rdi
movl -0x94(%rbp), %esi
callq 0x76c0
addl -0x94(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/section_header.c
// Function: section_header_read
int section_header_read(struct section_header_t *section_header, FILE *in)
{
  memset(section_header->name, 0, sizeof(section_header->name));
  read_chars(in, section_header->name, 8);
  section_header->VirtualSize = read_uint32(in);
  section_header->VirtualAddress = read_uint32(in);
  section_header->SizeOfRawData = read_uint32(in);
  section_header->PointerToRawData = read_uint32(in);
  section_header->PointerToRelocations = read_uint32(in);
  section_header->PointerToLinenumbers = read_uint32(in);
  section_header->NumberOfRelocations = read_uint16(in);
  section_header->NumberOfLinenumbers = read_uint16(in);
  section_header->Characteristics = read_uint32(in);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x30a0
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x8, %edx
callq 0x60e0
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x24(%rax)
movq -0x10(%rbp), %rdi
callq 0x6070
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x26(%rax)
movq -0x10(%rbp), %rdi
callq 0x6010
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/section_header.c
// Function: section_header_print
int section_header_print(struct section_header_t *section_header, int count)
{
  printf("---------------------------------------------\n");
  printf("Section Header %d\n",count);
  printf("---------------------------------------------\n");
  printf("      Section Name: %s\n",section_header->name);
  printf("       VirtualSize: %d\n",section_header->VirtualSize);
  printf("    VirtualAddress: 0x%04x\n",section_header->VirtualAddress);
  printf("     SizeOfRawData: %d\n",section_header->SizeOfRawData);
  printf("  PointerToRawData: 0x%04x\n",section_header->PointerToRawData);
  printf("  PtrToRelocations: %d\n",section_header->PointerToRelocations);
  printf("  PtrToLinenumbers: %d\n",section_header->PointerToLinenumbers);
  printf("  NumOfRelocations: %d\n",section_header->NumberOfRelocations);
  printf("  NumOfLinenumbers: %d\n",section_header->NumberOfLinenumbers);
  printf("   Characteristics: 0x%x\n",section_header->Characteristics);
  printf("\n");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x1a0c(%rip), %rdi      # 0xa1f2
movb $0x0, %al
callq 0x3080
movl -0xc(%rbp), %esi
leaq 0x3b42(%rip), %rdi      # 0xc339
movb $0x0, %al
callq 0x3080
leaq 0x19ed(%rip), %rdi      # 0xa1f2
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rsi
leaq 0x3b35(%rip), %rdi      # 0xc34c
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0xc(%rax), %esi
leaq 0x3b38(%rip), %rdi      # 0xc364
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0x10(%rax), %esi
leaq 0x3b3b(%rip), %rdi      # 0xc37c
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0x14(%rax), %esi
leaq 0x3b42(%rip), %rdi      # 0xc398
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0x18(%rax), %esi
leaq 0x2585(%rip), %rdi      # 0xadf0
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0x1c(%rax), %esi
leaq 0x3b30(%rip), %rdi      # 0xc3b0
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0x20(%rax), %esi
leaq 0x3b33(%rip), %rdi      # 0xc3c8
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movzwl 0x24(%rax), %esi
leaq 0x3b35(%rip), %rdi      # 0xc3e0
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movzwl 0x26(%rax), %esi
leaq 0x3b37(%rip), %rdi      # 0xc3f8
movb $0x0, %al
callq 0x3080
movq -0x8(%rbp), %rax
movl 0x28(%rax), %esi
leaq 0x3b3a(%rip), %rdi      # 0xc410
movb $0x0, %al
callq 0x3080
leaq 0x1848(%rip), %rdi      # 0xa12c
movb $0x0, %al
callq 0x3080
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nop
nopw %cs:(%rax,%rax)
nop