LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: on_cgi_data
static void on_cgi_data(struct ns_connection *nc) {
  struct connection *conn = (struct connection *) nc->user_data;
  const char *status = "500";
  struct mg_connection c;

  if (!conn) return;

  // Copy CGI data from CGI socket to the client send buffer
  ns_forward(nc, conn->ns_conn);

  // If reply has not been parsed yet, parse it
  if (conn->ns_conn->flags & NSF_BUFFER_BUT_DONT_SEND) {
    struct iobuf *io = &conn->ns_conn->send_iobuf;
    size_t s_len = sizeof(cgi_status) - 1;
    int len = get_request_len(io->buf + s_len, io->len - s_len);
    char buf[MAX_REQUEST_SIZE], *s = buf;

    if (len == 0) return;

    if (len < 0 || len > (int) sizeof(buf)) {
      len = io->len;
      iobuf_remove(io, io->len);
      send_http_error(conn, 500, "CGI program sent malformed headers: [%.*s]",
        len, io->buf);
    } else {
      memset(&c, 0, sizeof(c));
      memcpy(buf, io->buf + s_len, len);
      buf[len - 1] = '\0';
      parse_http_headers(&s, &c);
      if (mg_get_header(&c, "Location") != NULL) {
        status = "302";
      } else if ((status = (char *) mg_get_header(&c, "Status")) == NULL) {
        status = "200";
      }
      memcpy(io->buf + 9, status, 3);
      conn->mg_conn.status_code = atoi(status);
    }
    conn->ns_conn->flags &= ~NSF_BUFFER_BUT_DONT_SEND;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x42a8, %rsp           # imm = 0x42A8
movq 0x80(%rdi), %rbx
testq %rbx, %rbx
je 0x71eef
movq (%rbx), %rsi
callq 0x6ffee
movq (%rbx), %r13
testb $0x2, 0xa0(%r13)
je 0x71eef
movq 0x58(%r13), %rdi
movq 0x60(%r13), %rsi
addq $0x11, %rdi
addq $-0x11, %rsi
callq 0x6d4b2
leaq -0x42d0(%rbp), %r15
movq %r15, -0x30(%rbp)
testl %eax, %eax
je 0x71eef
movl %eax, %r14d
cmpl $0x4001, %eax           # imm = 0x4001
jb 0x71e4d
movq 0x60(%r13), %r14
testq %r14, %r14
je 0x71e2b
movq 0x60(%r13), %rdx
subq %r14, %rdx
jb 0x71e2b
movq 0x58(%r13), %rdi
leaq (%rdi,%r14), %rsi
callq 0xc1f0
subq %r14, 0x60(%r13)
movq 0x58(%r13), %r8
leaq 0x9bd7(%rip), %rdx      # 0x7ba0d
movq %rbx, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
movl %r14d, %ecx
xorl %eax, %eax
callq 0x6c73d
jmp 0x71ee5
leaq -0x2d0(%rbp), %r12
movl $0x2a0, %edx            # imm = 0x2A0
movq %r12, %rdi
xorl %esi, %esi
callq 0xc360
movq 0x58(%r13), %rsi
addq $0x11, %rsi
movl %r14d, %edx
movq %r15, %rdi
callq 0xc0e0
movslq %r14d, %rax
movb $0x0, -0x1(%rax,%r15)
leaq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x70396
leaq 0x9ba6(%rip), %rsi      # 0x7ba38
movq %r12, %rdi
callq 0x69863
testq %rax, %rax
je 0x71ea8
leaq 0x9b9b(%rip), %rdi      # 0x7ba41
jmp 0x71ec9
leaq 0x86ab(%rip), %rsi      # 0x7a55a
leaq -0x2d0(%rbp), %rdi
callq 0x69863
testq %rax, %rax
leaq 0x9052(%rip), %rdi      # 0x7af17
cmovneq %rax, %rdi
movq 0x58(%r13), %rax
movb 0x2(%rdi), %cl
movb %cl, 0xb(%rax)
movzwl (%rdi), %ecx
movw %cx, 0x9(%rax)
callq 0xc370
movl %eax, 0x284(%rbx)
movq (%rbx), %rax
andl $-0x3, 0xa0(%rax)
addq $0x42a8, %rsp           # imm = 0x42A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: process_response
static void process_response(struct connection *conn) {
  struct iobuf *io = &conn->ns_conn->recv_iobuf;

  try_parse(conn);
  DBG(("%p %d %lu", conn, conn->request_len, (unsigned long)io->len));
  if (conn->request_len < 0 ||
      (conn->request_len == 0 && io->len > MAX_REQUEST_SIZE)) {
    call_http_client_handler(conn);
  } else if ((int64_t) io->len >= conn->cl) {
    call_http_client_handler(conn);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
callq 0x6f6cc
cmpq $0x0, 0x2e0(%rbx)
js 0x71f3b
jne 0x71f29
cmpq $0x4000, 0x48(%r14)     # imm = 0x4000
ja 0x71f3b
movq 0x48(%r14), %rax
cmpq 0x2d8(%rbx), %rax
jge 0x71f3b
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x71f44
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: call_http_client_handler
static void call_http_client_handler(struct connection *conn) {
  //conn->mg_conn.status_code = code;
  // For responses without Content-Lengh, use the whole buffer
  if (conn->cl == 0) {
    conn->mg_conn.content_len = conn->ns_conn->recv_iobuf.len;
  }
  conn->mg_conn.content = conn->ns_conn->recv_iobuf.buf;
  if (call_user(conn, MG_REPLY) == MG_FALSE) {
    conn->ns_conn->flags |= NSF_CLOSE_IMMEDIATELY;
  }
  iobuf_remove(&conn->ns_conn->recv_iobuf, conn->mg_conn.content_len);
  conn->mg_conn.status_code = 0;
  conn->cl = conn->num_bytes_recv = conn->request_len = 0;
  NS_FREE(conn->request);
  conn->request = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x2d8(%rdi)
jne 0x71f69
movq (%rbx), %rax
movq 0x48(%rax), %rax
movq %rax, 0x278(%rbx)
movq (%rbx), %rax
movq 0x40(%rax), %rax
movq %rax, 0x270(%rbx)
movq 0x2a8(%rbx), %rax
testq %rax, %rax
je 0x71f9b
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x71f9b
leaq 0x8(%rbx), %rdi
movl $0x68, %esi
callq *%rax
testl %eax, %eax
jne 0x71fa5
movq (%rbx), %rax
orl $0x10, 0xa0(%rax)
movq 0x278(%rbx), %r14
testq %r14, %r14
je 0x71fce
movq (%rbx), %r15
movq 0x48(%r15), %rdx
subq %r14, %rdx
jb 0x71fce
movq 0x40(%r15), %rdi
leaq (%rdi,%r14), %rsi
callq 0xc1f0
subq %r14, 0x48(%r15)
movl $0x0, 0x284(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x2d0(%rbx)
xorl %r14d, %r14d
movq %r14, 0x2e0(%rbx)
movq 0x2c8(%rbx), %rdi
callq 0xc250
movq %r14, 0x2c8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: transfer_file_data
static void transfer_file_data(struct connection *conn) {
  char buf[IOBUF_SIZE];
  size_t n;

  // If output buffer is too big, don't send anything. Wait until
  // mongoose drains already buffered data to the client.
  if (conn->ns_conn->send_iobuf.len > sizeof(buf) * 2) return;

  // Do not send anyt
  n = read(conn->endpoint.fd, buf, conn->cl < (int64_t) sizeof(buf) ?
           (int) conn->cl : (int) sizeof(buf));

  if (n <= 0) {
    close_local_endpoint(conn);
  } else if (n > 0) {
    conn->cl -= n;
    ns_send(conn->ns_conn, buf, n);
    if (conn->cl <= 0) {
      close_local_endpoint(conn);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x2008, %rsp           # imm = 0x2008
movq (%rdi), %rax
cmpq $0x4000, 0x60(%rax)     # imm = 0x4000
ja 0x7207e
movq %rdi, %rbx
movl 0x2b0(%rdi), %edi
movq 0x2d8(%rbx), %rax
movl $0x2000, %ecx           # imm = 0x2000
cmpq %rcx, %rax
movslq %eax, %rdx
cmovgeq %rcx, %rdx
leaq -0x2010(%rbp), %rsi
callq 0xc890
testq %rax, %rax
je 0x72076
subq %rax, 0x2d8(%rbx)
movq (%rbx), %rdi
leaq -0x2010(%rbp), %rsi
movq %rax, %rdx
callq 0x681c0
cmpq $0x0, 0x2d8(%rbx)
jg 0x7207e
movq %rbx, %rdi
callq 0x6a615
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: read_file_header
int read_file_header(FILE *in, struct file_header_t *file_header)
{
  // Align to 2 bytes if needed.
  while ((ftell(in) % 2) != 0) { getc(in); }

  file_header->offset = ftell(in);

  if (fread(file_header->name,     1, 16, in) != 16) { return -1; }
  if (fread(file_header->date,     1, 12, in) != 12) { return -1; }
  if (fread(file_header->user_id,  1,  6, in) !=  6) { return -1; }
  if (fread(file_header->group_id, 1,  6, in) !=  6) { return -1; }
  if (fread(file_header->mode,     1,  8, in) !=  8) { return -1; }
  if (fread(file_header->size,     1, 10, in) != 10) { return -1; }
  if (fread(file_header->end,      1,  2, in) !=  2) { return -1; }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0x10c0
movq %rbx, %rdi
testb $0x1, %al
je 0x127c
callq 0x1150
movq %rbx, %rdi
jmp 0x1266
callq 0x10c0
movq %rax, (%r14)
leaq 0x8(%r14), %rdi
movl $0x1, %esi
movl $0x10, %edx
movq %rbx, %rcx
callq 0x1070
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x10, %rax
jne 0x135e
leaq 0x18(%r14), %rdi
movl $0x1, %esi
movl $0xc, %edx
movq %rbx, %rcx
callq 0x1070
cmpq $0xc, %rax
jne 0x135e
leaq 0x24(%r14), %rdi
movl $0x1, %esi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x1070
cmpq $0x6, %rax
jne 0x135e
leaq 0x2a(%r14), %rdi
movl $0x1, %esi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x1070
cmpq $0x6, %rax
jne 0x135e
leaq 0x30(%r14), %rdi
movl $0x1, %esi
movl $0x8, %edx
movq %rbx, %rcx
callq 0x1070
cmpq $0x8, %rax
jne 0x135e
leaq 0x38(%r14), %rdi
movl $0x1, %esi
movl $0xa, %edx
movq %rbx, %rcx
callq 0x1070
cmpq $0xa, %rax
jne 0x135e
addq $0x42, %r14
movl $0x1, %esi
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x1070
xorl %ebp, %ebp
cmpq $0x2, %rax
setne %bpl
negl %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: read_coff_header
int read_coff_header(FILE *in, struct coff_header_t *coff_header)
{
  coff_header->offset = ftell(in);

  coff_header->magic = read_uint16(in);
  coff_header->section_count = read_uint16(in);

  // It seems like if the magic number is 0 (and I guess section count
  // is 0xffff) that this isn't a COFF section.
  if (coff_header->magic == 0 && coff_header->section_count == 0xffff)
  {
    return -2;
  }

  coff_header->timestamp = read_uint32(in);
  coff_header->symbol_table_pointer = read_uint32(in);
  coff_header->symbol_count = read_uint32(in);
  coff_header->optional_header_size = read_uint16(in);
  coff_header->flags = read_uint16(in);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x10c0
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0x8(%rbx)
movq %r14, %rdi
callq 0x2520
movl %eax, %ecx
movw %cx, 0xa(%rbx)
notl %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
orw 0x8(%rbx), %cx
je 0x13d9
movq %r14, %rdi
callq 0x24de
movl %eax, 0xc(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x10(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0x18(%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0x1a(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: read_coff_optional_header
int read_coff_optional_header(
  FILE *in,
  struct coff_optional_header_t *optional_header)
{
  optional_header->offset = ftell(in);

  optional_header->magic = read_uint16(in);
  optional_header->version = read_uint16(in);
  optional_header->text_size = read_uint32(in);
  optional_header->data_size = read_uint32(in);
  optional_header->uninit_size = read_uint32(in);
  optional_header->entry_point = read_uint32(in);
  optional_header->text_start = read_uint32(in);
  optional_header->data_start = read_uint32(in);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x10c0
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0x8(%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0xa(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0xc(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x10(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x18(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x1c(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x20(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: read_coff_section_header
int read_coff_section_header(
  FILE *in,
  struct coff_section_header_t *section_header)
{
  section_header->offset = ftell(in);

  if (fread(section_header->name, 1, 8, in) != 8) { return -1; }

  section_header->physical_address = read_uint32(in);
  section_header->virtual_address = read_uint32(in);
  section_header->size = read_uint32(in);
  section_header->file_offset_section_data = read_uint32(in);
  section_header->file_offset_relocation_table = read_uint32(in);
  section_header->file_offset_line_number = read_uint32(in);
  section_header->relocation_count = read_uint16(in);
  section_header->line_number_count = read_uint16(in);
  section_header->flags = read_uint32(in);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x10c0
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
movl $0x1, %esi
movl $0x8, %edx
movq %r14, %rcx
callq 0x1070
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x8, %rcx
jne 0x14f4
movq %r14, %rdi
callq 0x24de
movl %eax, 0x10(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x18(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x1c(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x20(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x24(%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0x28(%rbx)
movq %r14, %rdi
callq 0x2520
movw %ax, 0x2a(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x2c(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_file_header
void print_file_header(struct file_header_t *file_header)
{
  printf(" --- file header 0x%06lx ---\n", file_header->offset);
  printf("        name: %.16s\n", file_header->name);
  printf("        date: %.12s\n", file_header->date);
  printf("     user_id: %.6s\n", file_header->user_id);
  printf("    group_id: %.6s\n", file_header->group_id);
  printf("        mode: %.8s\n", file_header->mode);
  printf("        size: %.10s\n", file_header->size);
  printf("         end: %.2s\n", file_header->end);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x3b36(%rip), %rdi      # 0x5040
xorl %eax, %eax
callq 0x1090
leaq 0x8(%rbx), %rsi
leaq 0x3b42(%rip), %rdi      # 0x505e
xorl %eax, %eax
callq 0x1090
leaq 0x18(%rbx), %rsi
leaq 0x3b45(%rip), %rdi      # 0x5073
xorl %eax, %eax
callq 0x1090
leaq 0x24(%rbx), %rsi
leaq 0x3b48(%rip), %rdi      # 0x5088
xorl %eax, %eax
callq 0x1090
leaq 0x2a(%rbx), %rsi
leaq 0x3b4a(%rip), %rdi      # 0x509c
xorl %eax, %eax
callq 0x1090
leaq 0x30(%rbx), %rsi
leaq 0x3b4c(%rip), %rdi      # 0x50b0
xorl %eax, %eax
callq 0x1090
leaq 0x38(%rbx), %rsi
leaq 0x3b4e(%rip), %rdi      # 0x50c4
xorl %eax, %eax
callq 0x1090
addq $0x42, %rbx
leaq 0x3b51(%rip), %rdi      # 0x50d9
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
jmp 0x1090
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_coff_header
void print_coff_header(struct coff_header_t *coff_header)
{
  printf(" --- coff header 0x%06lx ---\n", coff_header->offset);
  printf("                magic: 0x%04x\n", coff_header->magic);
  printf("        section_count: %d\n", coff_header->section_count);
  printf("            timestamp: %d\n", coff_header->timestamp);
  printf(" symbol_table_pointer: 0x%04x\n", coff_header->symbol_table_pointer);
  printf("         symbol_count: %d\n", coff_header->symbol_count);
  printf(" optional_header_size: %d\n", coff_header->optional_header_size);
  printf("                flags: %08x\n", coff_header->flags);
  printf("\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x3b4c(%rip), %rdi      # 0x50ed
xorl %eax, %eax
callq 0x1090
movzwl 0x8(%rbx), %esi
leaq 0x3b58(%rip), %rdi      # 0x510b
xorl %eax, %eax
callq 0x1090
movzwl 0xa(%rbx), %esi
leaq 0x3b65(%rip), %rdi      # 0x512a
xorl %eax, %eax
callq 0x1090
movl 0xc(%rbx), %esi
leaq 0x3b6f(%rip), %rdi      # 0x5145
xorl %eax, %eax
callq 0x1090
movl 0x10(%rbx), %esi
leaq 0x3b79(%rip), %rdi      # 0x5160
xorl %eax, %eax
callq 0x1090
movl 0x14(%rbx), %esi
leaq 0x3b87(%rip), %rdi      # 0x517f
xorl %eax, %eax
callq 0x1090
movzwl 0x18(%rbx), %esi
leaq 0x3b90(%rip), %rdi      # 0x519a
xorl %eax, %eax
callq 0x1090
movzwl 0x1a(%rbx), %esi
leaq 0x3dad(%rip), %rdi      # 0x53c9
xorl %eax, %eax
callq 0x1090
movl $0xa, %edi
popq %rbx
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_coff_optional_header
void print_coff_optional_header(struct coff_optional_header_t *optional_header)
{
  printf(" --- coff optional header 0x%06lx ---\n", optional_header->offset);
  printf("          magic: 0x%04x\n", optional_header->magic);
  printf("        version: 0x%04x\n", optional_header->version);
  printf("      text_size: %d\n", optional_header->text_size);
  printf("      data_size: %d\n", optional_header->data_size);
  printf("   uininit_size: %d\n", optional_header->uninit_size);
  printf("    entry_point: 0x%06x\n", optional_header->entry_point);
  printf("     text_start: 0x%06x\n", optional_header->text_start);
  printf("     data_start: 0x%06x\n", optional_header->data_start);
  printf("\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x3b79(%rip), %rdi      # 0x51b5
xorl %eax, %eax
callq 0x1090
movzwl 0x8(%rbx), %esi
leaq 0x3ac3(%rip), %rdi      # 0x5111
xorl %eax, %eax
callq 0x1090
movzwl 0xa(%rbx), %esi
leaq 0x3b7c(%rip), %rdi      # 0x51dc
xorl %eax, %eax
callq 0x1090
movl 0xc(%rbx), %esi
leaq 0x3b84(%rip), %rdi      # 0x51f5
xorl %eax, %eax
callq 0x1090
movl 0x10(%rbx), %esi
leaq 0x3b88(%rip), %rdi      # 0x520a
xorl %eax, %eax
callq 0x1090
movl 0x14(%rbx), %esi
leaq 0x3b8c(%rip), %rdi      # 0x521f
xorl %eax, %eax
callq 0x1090
movl 0x18(%rbx), %esi
leaq 0x3b90(%rip), %rdi      # 0x5234
xorl %eax, %eax
callq 0x1090
movl 0x1c(%rbx), %esi
leaq 0x3b98(%rip), %rdi      # 0x524d
xorl %eax, %eax
callq 0x1090
movl 0x20(%rbx), %esi
leaq 0x3ba0(%rip), %rdi      # 0x5266
xorl %eax, %eax
callq 0x1090
movl $0xa, %edi
popq %rbx
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_coff_section_header
void print_coff_section_header(struct coff_section_header_t *section_header)
{
  printf(" --- coff section header 0x%06lx ---\n", section_header->offset);
  printf("                       name: %.8s\n", section_header->name);
  printf("           physical_address: 0x%06x\n", section_header->physical_address);
  printf("            virtual_address: 0x%06x\n", section_header->virtual_address);
  printf("                       size: %d\n", section_header->size);
  printf("   file_offset_section_data: 0x%06x\n", section_header->file_offset_section_data);
  printf("file_offset_relocation_data: 0x%06x\n", section_header->file_offset_relocation_table);
  printf("    file_offset_line_number: 0x%06x\n", section_header->file_offset_line_number);
  printf("          line_number_count: %d\n", section_header->line_number_count);
  printf("                      flags: %08x\n", section_header->flags);
  printf("\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x3b99(%rip), %rdi      # 0x527f
xorl %eax, %eax
callq 0x1090
leaq 0x8(%rbx), %rsi
leaq 0x3bad(%rip), %rdi      # 0x52a5
xorl %eax, %eax
callq 0x1090
movl 0x10(%rbx), %esi
leaq 0x3bbf(%rip), %rdi      # 0x52c8
xorl %eax, %eax
callq 0x1090
movl 0x14(%rbx), %esi
leaq 0x3bd3(%rip), %rdi      # 0x52ed
xorl %eax, %eax
callq 0x1090
movl 0x18(%rbx), %esi
leaq 0x3be7(%rip), %rdi      # 0x5312
xorl %eax, %eax
callq 0x1090
movl 0x1c(%rbx), %esi
leaq 0x3bf7(%rip), %rdi      # 0x5333
xorl %eax, %eax
callq 0x1090
movl 0x20(%rbx), %esi
leaq 0x3c0b(%rip), %rdi      # 0x5358
xorl %eax, %eax
callq 0x1090
movl 0x24(%rbx), %esi
leaq 0x3c1f(%rip), %rdi      # 0x537d
xorl %eax, %eax
callq 0x1090
movzwl 0x2a(%rbx), %esi
leaq 0x3c32(%rip), %rdi      # 0x53a2
xorl %eax, %eax
callq 0x1090
movl 0x2c(%rbx), %esi
leaq 0x3c42(%rip), %rdi      # 0x53c3
xorl %eax, %eax
callq 0x1090
movl $0xa, %edi
popq %rbx
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_symbol
int print_symbol(FILE *in)
{
  while (1)
  {
    int ch = getc(in);
    if (ch == 0 || ch == EOF) { break; }
    printf("%c", ch);
  }

  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x1150
leal -0x1(%rax), %ecx
cmpl $-0x3, %ecx
ja 0x17bc
movl %eax, %edi
callq 0x1040
movq %rbx, %rdi
callq 0x1150
movl %eax, %ecx
decl %ecx
cmpl $-0x2, %ecx
jb 0x17a4
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_symbol_offsets
int print_symbol_offsets(FILE *in, uint32_t size)
{
  long marker = ftell(in);
  int symbol_count = read_uint32_be(in);
  uint32_t *offsets = (uint32_t *)malloc(symbol_count * sizeof(uint32_t));
  int n;

  printf(" --- symbol_count: %d ---\n", symbol_count);

  for (n = 0; n < symbol_count; n++)
  {
    offsets[n] = read_uint32_be(in);
  }

  for (n = 0; n < symbol_count; n++)
  {
    printf("   0x%06x  ", offsets[n]);
    print_symbol(in);
    printf("\n");
  }

  printf("\n");

  free(offsets);

  long total = ftell(in) - marker;

  if (total != size)
  {
    printf("Error: Bad archive members size %ld vs %d.\n", total, size);
    return -1;
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x10c0
movq %rax, (%rsp)
movq %r14, %rdi
callq 0x25c4
movl %eax, %ebp
movslq %eax, %r13
leaq (,%r13,4), %rdi
callq 0x10e0
movq %rax, %r12
leaq 0x3be9(%rip), %rdi      # 0x53e6
movl %r13d, %esi
xorl %eax, %eax
callq 0x1090
movl %r13d, %r15d
testl %r13d, %r13d
jle 0x1826
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x25c4
movl %eax, (%r12,%r13,4)
incq %r13
cmpq %r13, %r15
jne 0x1812
testl %ebp, %ebp
jle 0x185b
leaq 0x3bd0(%rip), %r13      # 0x5401
xorl %ebp, %ebp
movl (%r12,%rbp,4), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x1090
movq %r14, %rdi
callq 0x1793
movl $0xa, %edi
callq 0x1040
incq %rbp
cmpq %rbp, %r15
jne 0x1833
movl $0xa, %edi
callq 0x1040
movq %r12, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x10c0
subq (%rsp), %rax
movl %ebx, %edx
xorl %ecx, %ecx
cmpq %rdx, %rax
je 0x189a
leaq 0x3b84(%rip), %rdi      # 0x540d
movq %rax, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1090
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_symbol_header
int print_symbol_header(FILE *in)
{
  struct coff_symbol_header_t symbol_header;

  symbol_header.offset = ftell(in);
  symbol_header.version = read_uint16(in);
  symbol_header.machine = read_uint16(in);
  symbol_header.timestamp = read_uint32(in);
  symbol_header.size = read_uint32(in);
  symbol_header.unknown_0 = read_uint16(in);
  symbol_header.unknown_1 = read_uint16(in);

  printf("--- symbol %06lx ---\n", symbol_header.offset);
  printf("        version: 0x%04x\n", symbol_header.version);
  printf("        machine: 0x%04x\n", symbol_header.machine);
  printf("      timestamp: %d\n", symbol_header.timestamp);
  printf("           size: %d\n", symbol_header.size);
  printf("      unknown_0: %d\n", symbol_header.unknown_0);
  printf("      unknown_1: %d\n", symbol_header.unknown_1);
  printf("           name: ");
  print_symbol(in);
  printf("\n");
  printf("            DLL: ");
  print_symbol(in);
  printf("\n\n");

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x10c0
movq %rax, %r12
movq %rbx, %rdi
callq 0x2520
movl %eax, %r15d
movq %rbx, %rdi
callq 0x2520
movl %eax, %r13d
movq %rbx, %rdi
callq 0x24de
movl %eax, (%rsp)
movq %rbx, %rdi
callq 0x24de
movl %eax, 0x4(%rsp)
movq %rbx, %rdi
callq 0x2520
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2520
movl %eax, %ebp
leaq 0x3b2f(%rip), %rdi      # 0x5439
movq %r12, %rsi
xorl %eax, %eax
callq 0x1090
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %r15d
leaq 0x38b8(%rip), %rdi      # 0x51dc
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
andl %r12d, %r13d
leaq 0x465d(%rip), %rdi      # 0x5f95
movl %r13d, %esi
xorl %eax, %eax
callq 0x1090
leaq 0x3802(%rip), %rdi      # 0x514b
movl (%rsp), %esi
xorl %eax, %eax
callq 0x1090
leaq 0x39c4(%rip), %rdi      # 0x531e
movl 0x4(%rsp), %esi
xorl %eax, %eax
callq 0x1090
andl %r12d, %r14d
leaq 0x3ae0(%rip), %rdi      # 0x544f
movl %r14d, %esi
xorl %eax, %eax
callq 0x1090
andl %r12d, %ebp
leaq 0x3ae1(%rip), %rdi      # 0x5464
movl %ebp, %esi
xorl %eax, %eax
callq 0x1090
leaq 0x3ae6(%rip), %rdi      # 0x5479
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1793
movl $0xa, %edi
callq 0x1040
leaq 0x3ad8(%rip), %rdi      # 0x548b
xorl %eax, %eax
callq 0x1090
movq %rbx, %rdi
callq 0x1793
leaq 0x4e53(%rip), %rdi      # 0x681c
callq 0x1060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_public_symbols
int print_public_symbols(FILE *in, uint32_t size)
{
  long marker = ftell(in);
  int offset_count = read_uint32(in);
  int n;

  printf(" --- offset_count: %d ---\n", offset_count);

  for (n = 0; n < offset_count; n++)
  {
    printf("  %02x %06x\n", n, read_uint32(in));
  }

  printf("\n");

  int symbol_count = read_uint32(in);
  uint16_t *offsets = (uint16_t *)malloc(symbol_count * sizeof(uint16_t));

  printf(" --- symbol_count: %d ---\n", symbol_count);

  for (n = 0; n < symbol_count; n++)
  {
    offsets[n] = read_uint16(in);
  }

  for (n = 0; n < symbol_count; n++)
  {
    printf("   0x%04x  ", offsets[n]);
	    print_symbol(in);
	    printf("\n");
	  }

	  printf("\n");

	  long total = ftell(in) - marker;

	  if (total != size)
	  {
	    printf("Error: Bad archive members size %ld vs %d.\n", total, size);
	    return -1;
	  }

	  return 0;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x10c0
movq %rax, (%rsp)
movq %r14, %rdi
callq 0x24de
movl %eax, %ebp
leaq 0x3a94(%rip), %rdi      # 0x549d
movl %eax, %esi
xorl %eax, %eax
callq 0x1090
testl %ebp, %ebp
jle 0x1a3f
leaq 0x3a9b(%rip), %r12      # 0x54b8
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x24de
movq %r12, %rdi
movl %r13d, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x1090
incl %r13d
cmpl %r13d, %ebp
jne 0x1a20
movl $0xa, %edi
callq 0x1040
movq %r14, %rdi
callq 0x24de
movl %eax, %ebp
movslq %eax, %r13
leaq (,%r13,2), %rdi
callq 0x10e0
movq %rax, %r12
leaq 0x3979(%rip), %rdi      # 0x53e6
movl %r13d, %esi
xorl %eax, %eax
callq 0x1090
movl %r13d, %r15d
testl %r13d, %r13d
jle 0x1a97
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x2520
movw %ax, (%r12,%r13,2)
incq %r13
cmpq %r13, %r15
jne 0x1a82
testl %ebp, %ebp
jle 0x1acd
leaq 0x3a23(%rip), %r13      # 0x54c5
xorl %ebp, %ebp
movzwl (%r12,%rbp,2), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x1090
movq %r14, %rdi
callq 0x1793
movl $0xa, %edi
callq 0x1040
incq %rbp
cmpq %rbp, %r15
jne 0x1aa4
movl $0xa, %edi
callq 0x1040
movq %r14, %rdi
callq 0x10c0
subq (%rsp), %rax
movl %ebx, %edx
xorl %ecx, %ecx
cmpq %rdx, %rax
je 0x1b04
leaq 0x391a(%rip), %rdi      # 0x540d
movq %rax, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1090
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_name
int print_name(FILE *in, uint32_t size)
	{
	  long marker = ftell(in);

	  printf("   name: ");
	  print_symbol(in);
  printf("\n\n");

  long total = ftell(in) - marker;

  if (total != size)
  {
    printf("Error: Bad archive members size %ld vs %d.\n", total, size);
    return -1;
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x10c0
movq %rax, %r15
leaq 0x3951(%rip), %rdi      # 0x5481
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1090
movq %r14, %rdi
callq 0x1793
leaq 0x4cd4(%rip), %rdi      # 0x681c
callq 0x1060
movq %r14, %rdi
callq 0x10c0
subq %r15, %rax
movl %ebx, %ecx
cmpq %rcx, %rax
je 0x1b77
leaq 0x38a7(%rip), %rdi      # 0x540d
movq %rax, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1090
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_raw
int print_raw(FILE *in, long offset, uint32_t size)
{
  long marker = ftell(in);
  fseek(in, offset, SEEK_SET);
  int n, i;

  uint8_t data[16];
  int total = 0;

  for (n = 0; n < size; n += 16)
  {
    int length = fread(data, 1, 16, in);
    printf("  %06x: ", n);

    total += length;
    if (total > size) { length -= total - size; }

    for (i = 0; i < length; i++)
    {
      printf("%02x ", data[i]);
    }

    for (i = length; i < 16; i++) { printf("   "); }

    for (i = 0; i < length; i++)
    {
      printf("%c", data[i] >= 32 && data[i] < 126 ? data[i] : '.');
    }

    printf("\n");
  }

  printf("\n");

  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, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x10c0
movq %rax, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10f0
testl %ebp, %ebp
je 0x1cac
leaq 0x3915(%rip), %r13      # 0x54da
xorl %ebx, %ebx
xorl %r15d, %r15d
movl %ebp, 0x8(%rsp)
movl $0x1, %esi
movl $0x10, %edx
leaq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rcx
callq 0x1070
movq %rax, %r12
leaq 0x38e0(%rip), %rdi      # 0x54d1
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
leal (%rbx,%r12), %eax
movl %eax, 0xc(%rsp)
subl %ebp, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
subl %eax, %r12d
movl %r12d, %ebp
testl %r12d, %r12d
jle 0x1c33
xorl %r14d, %r14d
movzbl 0x20(%rsp,%r14), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x1090
incq %r14
cmpq %rbp, %r14
jb 0x1c1b
cmpl $0xf, %r12d
leaq 0x38b8(%rip), %r14      # 0x54f6
jg 0x1c62
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %eax
cmpl %eax, %ecx
cmovbl %ecx, %eax
notl %ebx
addl %eax, %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x1090
incl %ebx
cmpl $0xf, %ebx
jl 0x1c51
testl %r12d, %r12d
jle 0x1c8b
xorl %ebx, %ebx
movzbl 0x20(%rsp,%rbx), %eax
leal -0x20(%rax), %ecx
cmpb $0x5e, %cl
jb 0x1c7b
movl $0x2e, %eax
movzbl %al, %edi
callq 0x1040
incq %rbx
cmpq %rbp, %rbx
jb 0x1c69
movl $0xa, %edi
callq 0x1040
addl $0x10, %r15d
movl 0xc(%rsp), %eax
movl %eax, %ebx
movl 0x8(%rsp), %ebp
cmpl %ebp, %r15d
jb 0x1bce
movl $0xa, %edi
callq 0x1040
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x10f0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: print_section
int print_section(FILE *in, uint32_t size)
{
  struct coff_header_t coff_header;
  struct coff_optional_header_t optional_header;
  struct coff_section_header_t section_header;
  long marker = ftell(in);
  int n;

  int result = read_coff_header(in, &coff_header);

  if (result != 0)
  {
    return result;
  }

  print_coff_header(&coff_header);

  if (coff_header.optional_header_size != 0)
  {
    read_coff_optional_header(in, &optional_header);
    print_coff_optional_header(&optional_header);
  }

  for (n = 0; n < coff_header.section_count; n++)
  {
    read_coff_section_header(in, &section_header);
    print_coff_section_header(&section_header);
    print_raw(in, marker + section_header.file_offset_section_data, section_header.size);
  }

#if 0
  long total = ftell(in) - marker;

  if (total != size)
  {
    printf("Error: Bad archive members size %ld vs %d.\n", total, size);
    return -1;
  }
#endif

  fseek(in, marker + size, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
movl %esi, %ebp
movq %rdi, %rbx
callq 0x10c0
movq %rax, %r14
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x1365
movl %eax, %r15d
testl %eax, %eax
jne 0x1d85
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x1593
cmpw $0x0, 0x18(%r15)
je 0x1d35
leaq 0x58(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13e1
movq %r15, %rdi
callq 0x162e
movzwl 0x12(%rsp), %r12d
testl %r12d, %r12d
je 0x1d70
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1457
movq %r15, %rdi
callq 0x16d8
movl 0x40(%rsp), %edx
movl 0x44(%rsp), %esi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x1b84
decl %r12d
jne 0x1d45
movl %ebp, %eax
addq %rax, %r14
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10f0
movl %r15d, %eax
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/print_lib.c
// Function: main
int main(int argc, char *argv[])
{
  FILE *in;

  printf("\nprint_lib (March 24, 2023)\n");
  printf("Copyright 2023 - Michael Kohn  http://www.mikekohn.net/\n\n");

  if (argc != 2)
  {
    printf("Usage: print_lib <filename>\n");
    exit(0);
  }

  in = fopen(argv[1], "rb");

  if (in == NULL)
  {
    printf("Could not open input file %s for reading.\n", argv[1]);
    exit(1);
  }

  read_lib(in);

  fclose(in);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x3671(%rip), %rdi      # 0x55ae
callq 0x1060
leaq 0x3681(%rip), %rdi      # 0x55ca
callq 0x1060
cmpl $0x2, %ebp
jne 0x1f82
movq 0x8(%rbx), %rdi
leaq 0x35be(%rip), %rsi      # 0x551c
callq 0x1100
testq %rax, %rax
je 0x1f95
movq %rax, %r14
movq %rax, %rdi
callq 0x1d98
movq %r14, %rdi
callq 0x1080
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x367a(%rip), %rdi      # 0x5603
callq 0x1060
xorl %edi, %edi
callq 0x1130
movq 0x8(%rbx), %rsi
leaq 0x357f(%rip), %rdi      # 0x551f
xorl %eax, %eax
callq 0x1090
movl $0x1, %edi
callq 0x1130
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/demangle.c
// Function: demangle
int demangle(const char *name, char *demangled, int length)
{
  if (name[0] != '?')
  {
    snprintf(demangled, length, "%s", name);
    return -1;
  }

  char temp[length];
  char params[length];
  char return_type[length];

  temp[0] = 0;
  params[0] = 0;
  return_type[0] = 0;

  int offset = demangle_name(name + 1, temp, params, return_type, 0, length);
  demangled[length - 1] = 0;
  if (offset < length) { demangled[offset] = 0; }

  snprintf(demangled, length, "%s %s%s", return_type, temp, params);

  return offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %r8
movq %rdi, %rcx
cmpb $0x3f, (%rdi)
jne 0x205c
movq %rsp, -0x30(%rbp)
movl %r14d, %eax
movq %rsp, %r15
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %r13
subq %rax, %r13
movq %r13, %rsp
xorl %eax, %eax
movb %al, (%r15)
movb %al, (%r12)
movb %al, (%r13)
incq %rcx
movq %rcx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %r8, %rbx
movl %r14d, %r8d
callq 0x2086
movq %rbx, %rdi
movl %eax, %ebx
movslq %r14d, %rsi
xorl %eax, %eax
movb %al, -0x1(%rdi,%rsi)
cmpl %r14d, %ebx
jge 0x203f
movslq %ebx, %rax
movb $0x0, (%rdi,%rax)
leaq 0x3696(%rip), %rdx      # 0x56dc
movq %r13, %rcx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x10a0
movq -0x30(%rbp), %rsp
jmp 0x2075
movslq %r14d, %rsi
leaq 0x367b(%rip), %rdx      # 0x56e1
movq %r8, %rdi
xorl %eax, %eax
callq 0x10a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/demangle.c
// Function: demangle_insert_name
static int demangle_insert_name(
  const char *name,
  char *demangled,
  int offset,
  int length)
{
  while (offset < length)
  {
    if (*name == 0 || *name == '@') { break; }

    if (*name == '?')
    {
      switch (name[1])
      {
        case '0': break;
        case '1': demangled[offset++] = '~'; break;
        case '2':
          offset = demangle_append("operator new ", demangled, offset, length);
          break;
        case '3':
          offset = demangle_append("operator delete ", demangled, offset, length);
          break;
        // FIXME: Add the rest of these.
        default: break;
      }

      name += 2;
      continue;
    }

    demangled[offset++] = *name;
    name++;
  }

  if (offset < length) { demangled[offset] = 0; }

  return offset;
}

// Assembly:
movl %edx, %eax
cmpl %ecx, %edx
jge 0x2442
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
leal -0x1(%rcx), %edx
movslq %edx, %r8
leaq 0x3382(%rip), %r9       # 0x56f3
leaq 0x336d(%rip), %r10      # 0x56e5
movzbl (%rdi), %r11d
cmpl $0x3f, %r11d
je 0x23b0
movslq %eax, %rbx
testl %r11d, %r11d
je 0x2438
cmpl $0x40, %r11d
je 0x2438
incl %eax
movb %r11b, (%rsi,%rbx)
movl $0x1, %r11d
addq %r11, %rdi
cmpl %ecx, %eax
jl 0x2378
jmp 0x243c
movzbl 0x1(%rdi), %ebx
movl $0x2, %r11d
cmpl $0x33, %ebx
je 0x2405
cmpl $0x32, %ebx
je 0x23d4
cmpl $0x31, %ebx
jne 0x23a4
movslq %eax, %rbx
incl %eax
movb $0x7e, (%rsi,%rbx)
jmp 0x23a4
cmpl %eax, %r8d
jle 0x23a4
movslq %eax, %rbx
incq %rbx
movb $0x6f, %bpl
movq %r10, %r14
movb %bpl, -0x1(%rsi,%rbx)
movb (%r14), %bpl
incl %eax
testb %bpl, %bpl
je 0x23a4
leaq 0x1(%rbx), %r15
incq %r14
cmpq %r8, %rbx
movq %r15, %rbx
jl 0x23e5
jmp 0x23a4
cmpl %eax, %edx
jle 0x23a4
movslq %eax, %rbx
incq %rbx
movb $0x6f, %bpl
movq %r9, %r14
movb %bpl, -0x1(%rsi,%rbx)
movb (%r14), %bpl
incl %eax
testb %bpl, %bpl
je 0x23a4
leaq 0x1(%rbx), %r15
incq %r14
cmpq %r8, %rbx
movq %r15, %rbx
jl 0x2415
jmp 0x23a4
movb $0x0, (%rsi,%rbx)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: read_uint64
uint64_t read_uint64(FILE *in)
{
  uint64_t c;

  c = (uint64_t)getc(in);
  c |= (uint64_t)getc(in) << 8;
  c |= (uint64_t)getc(in) << 16;
  c |= (uint64_t)getc(in) << 24;
  c |= (uint64_t)getc(in) << 32;
  c |= (uint64_t)getc(in) << 40;
  c |= (uint64_t)getc(in) << 48;
  c |= (uint64_t)getc(in) << 56;

  return c;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1150
movslq %eax, %r14
movq %rbx, %rdi
callq 0x1150
movslq %eax, %r15
shlq $0x8, %r15
orq %r14, %r15
movq %rbx, %rdi
callq 0x1150
movslq %eax, %r14
shlq $0x10, %r14
movq %rbx, %rdi
callq 0x1150
movslq %eax, %r12
shlq $0x18, %r12
orq %r14, %r12
orq %r15, %r12
movq %rbx, %rdi
callq 0x1150
movl %eax, %r14d
shlq $0x20, %r14
movq %rbx, %rdi
callq 0x1150
movl %eax, %r15d
shlq $0x28, %r15
orq %r14, %r15
movq %rbx, %rdi
callq 0x1150
movl %eax, %r14d
shlq $0x30, %r14
orq %r15, %r14
movq %rbx, %rdi
callq 0x1150
shlq $0x38, %rax
orq %r14, %rax
orq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: read_uint32
int read_uint32(FILE *in)
{
  int c;

  c = getc(in);
  c |= getc(in) << 8;
  c |= getc(in) << 16;
  c |= getc(in) << 24;

  return c;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x1150
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1150
movl %eax, %r14d
shll $0x8, %r14d
orl %ebp, %r14d
movq %rbx, %rdi
callq 0x1150
movl %eax, %ebp
shll $0x10, %ebp
movq %rbx, %rdi
callq 0x1150
shll $0x18, %eax
orl %ebp, %eax
orl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: read_chars
int read_chars(FILE *in, char *s, int count)
{
  int t;

  for (t = 0; t < count; t++)
  {
    s[t] = getc(in);
  }

  s[t] = 0;

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
testl %edx, %edx
jle 0x2574
movq %rdi, %r14
movl %edx, %r12d
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x1150
movb %al, (%rbx,%r15)
incq %r15
cmpq %r15, %r12
jne 0x255e
jmp 0x2577
xorl %r15d, %r15d
movb $0x0, (%rbx,%r15)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: read_chars_bin
int read_chars_bin(FILE *in, uint8_t *s, int count)
{
  int t;

  for (t = 0; t < count; t++)
  {
    s[t] = getc(in);
  }

  return 0;
}

// Assembly:
testl %edx, %edx
jle 0x25c1
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl %edx, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x1150
movb %al, (%rbx,%r12)
incq %r12
cmpq %r12, %r15
jne 0x25a2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: read_uint32_be
int read_uint32_be(FILE *in)
{
  int c;

  c = getc(in) << 24;
  c |= getc(in) << 16;
  c |= getc(in) << 8;
  c |= getc(in);

  return c;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x1150
movl %eax, %ebp
shll $0x18, %ebp
movq %rbx, %rdi
callq 0x1150
movl %eax, %r14d
shll $0x10, %r14d
orl %ebp, %r14d
movq %rbx, %rdi
callq 0x1150
movl %eax, %ebp
shll $0x8, %ebp
movq %rbx, %rdi
callq 0x1150
orl %ebp, %eax
orl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: print_string
int print_string(FILE *in, int addr)
{
  int marker;
  int ch;

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

  while (1)
  {
    ch = getc(in);
    if (ch == EOF || ch == 0) { break; }

    printf("%c",ch);
  }

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x10c0
movq %rax, %r14
movslq %ebp, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10f0
movq %rbx, %rdi
callq 0x1150
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x266d
movl %eax, %edi
callq 0x1040
movq %rbx, %rdi
callq 0x1150
movl %eax, %ecx
incl %ecx
cmpl $0x1, %ecx
ja 0x2655
movslq %r14d, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10f0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: get_string
int get_string(FILE *in, char *s, int addr)
{
  int marker;
  int ch;
  int t;

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

  t = 0;

  while (1)
  {
    ch = getc(in);
    if (ch == EOF || ch == 0) { break; }

    s[t++] = ch;
  }

  s[t] = 0;

  fseek(in, marker, SEEK_SET);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x10c0
movq %rax, %r15
movslq %ebp, %rsi
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10f0
movq %rbx, %rdi
callq 0x1150
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x26d7
xorl %r12d, %r12d
movb %al, (%r14,%r12)
incq %r12
movq %rbx, %rdi
callq 0x1150
movl %eax, %ecx
incl %ecx
cmpl $0x1, %ecx
ja 0x26bc
movl %r12d, %r12d
movb $0x0, (%r14,%r12)
movslq %r15d, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10f0
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: get_ptr
int get_ptr(FILE *in, int addr)
{
  int marker;
  int i;

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

  i = read_uint32(in);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
callq 0x10c0
movq %rax, %r15
movslq %ebx, %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x10f0
movq %r14, %rdi
callq 0x24de
movl %eax, %ebx
movslq %r15d, %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x10f0
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/fileio.c
// Function: get_ushort
int get_ushort(FILE *in, int addr)
{
  int marker;
  int i;

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

  i = read_uint16(in);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x10c0
movq %rax, %r14
movslq %ebp, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10f0
movq %rbx, %rdi
callq 0x1150
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1150
movl %eax, %r15d
shll $0x8, %r15d
orl %ebp, %r15d
movslq %r14d, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10f0
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/pdb.c
// Function: read_pdb_header
int read_pdb_header(struct pdb_header_t *pdb_header, FILE *in)
{
  uint8_t magic_2[] = { 0x1a, 0x44, 0x53, 0x00, 0x00, 0x00 };
  int n;

  for (n = 0; n < sizeof(pdb_header->magic); n++)
  {
    pdb_header->magic[n] = getc(in);

    if (pdb_header->magic[n] == '\r') { pdb_header->magic[n] = 0; }
    if (pdb_header->magic[n] == '\n') { break; }
  }

  if (n == sizeof(pdb_header->magic)) { return -1; }

  for (n = 0; n < 6; n++)
  {
    pdb_header->magic_2[n] = getc(in);
    if (pdb_header->magic_2[n] != magic_2[n]) { return -1; }
  }

  pdb_header->block_size = read_uint32(in);
  pdb_header->free_block_map = read_uint32(in);
  pdb_header->number_of_blocks = read_uint32(in);
  pdb_header->number_of_dir_bytes = read_uint32(in);
  pdb_header->reserved = read_uint32(in);
  pdb_header->block_map_address = read_uint32(in);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %r12d, %r12d
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x1150
cmpb $0xd, %al
cmovel %r12d, %eax
movb %al, (%rbx,%r15)
cmpb $0xa, %al
je 0x27c5
incq %r15
cmpq $0x50, %r15
jne 0x27a0
movl $0x50, %r15d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x50, %r15d
je 0x2840
xorl %r15d, %r15d
leaq 0x304e(%rip), %r12      # 0x5828
movq %r14, %rdi
callq 0x1150
movb %al, 0x50(%rbx,%r15)
movsbl %al, %eax
movzbl (%r15,%r12), %ecx
cmpl %ecx, %eax
jne 0x2840
incq %r15
cmpq $0x6, %r15
jne 0x27da
movq %r14, %rdi
callq 0x24de
movl %eax, 0x58(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x5c(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x60(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x64(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x68(%rbx)
movq %r14, %rdi
callq 0x24de
movl %eax, 0x6c(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/pdb.c
// Function: read_pdb_names
int read_pdb_names(
  struct pdb_dir_t *pdb_dir,
  struct pdb_header_t *pdb_header,
  FILE *in)
{
  const int index = pdb_dir->names_index;
  const int length = pdb_dir->stream_sizes[index];

  if (index == 0)
  {
    printf("Error: No /names stream found.\n");
    return -1;
  }

  read_data(pdb_dir, index, pdb_header->block_size, in);
  pdb_dir->names = (uint8_t *)malloc(length);
  memcpy(pdb_dir->names, pdb_dir->heap, length);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movslq 0x28(%rdi), %rsi
testq %rsi, %rsi
je 0x2aaa
movq %rdx, %rcx
movq %rdi, %rbx
movq 0x8(%rdi), %rdx
movslq (%rdx,%rsi,4), %r14
movl 0x58(%rax), %edx
callq 0x2ac3
movq %r14, %rdi
callq 0x10e0
movq %rax, 0x20(%rbx)
movq 0x18(%rbx), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x10d0
xorl %eax, %eax
jmp 0x2abb
leaq 0x3db3(%rip), %rdi      # 0x6864
callq 0x1060
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq