LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: if_directive
int if_directive(struct preprocessor *pp) {
  skip_pp_token_with_space(pp);

  int control = if_control(pp);
  conditional_include(pp, control);

  return control;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x45b6
movq %rax, %rdi
callq 0x1e94
movq %rbx, %rdi
callq 0x4680
movq %rbx, %rdi
callq 0x4da1
movl %eax, %ebp
movq %rbx, %rdi
testl %eax, %eax
je 0x53a4
callq 0x4fd8
jmp 0x53a9
callq 0x5217
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: ifdef_directive
int ifdef_directive(struct preprocessor *pp) {
  skip_pp_token_with_space(pp);

  struct pp_token *ident = expect_pp_token(pp, PP_IDENT);
  discard_new_line(pp);

  struct macro_entry *macro = search_macro_table(ident->text->head);
  int control = macro != NULL;
  conditional_include(pp, control);

  return control;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x45b6
movq %rax, %rdi
callq 0x1e94
movq %rbx, %rdi
callq 0x4680
movq %rbx, %rdi
movl $0x1, %esi
callq 0x46a5
movq %rax, %r14
movq %rbx, %rdi
movl $0x3b, %esi
callq 0x46a5
movq %rax, %rdi
callq 0x1e94
movq 0x10(%r14), %rax
movq (%rax), %rdi
callq 0x378b
movq %rax, %r14
movq %rbx, %rdi
testq %rax, %rax
je 0x5411
callq 0x4fd8
jmp 0x5416
callq 0x5217
xorl %eax, %eax
testq %r14, %r14
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: elif_directive
int elif_directive(struct preprocessor *pp, int skip) {
  skip_pp_token_with_space(pp);

  int control = if_control(pp);
  conditional_include(pp, !skip && control);

  return skip || control;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
callq 0x45b6
movq %rax, %rdi
callq 0x1e94
movq %r14, %rdi
callq 0x4680
movq %r14, %rdi
callq 0x4da1
movl %eax, %ebp
testl %ebx, %ebx
setne %al
testl %ebp, %ebp
sete %cl
movq %r14, %rdi
orb %al, %cl
je 0x54da
callq 0x5217
jmp 0x54df
callq 0x4fd8
xorl %eax, %eax
orl %ebp, %ebx
setne %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: if_section
void if_section(struct preprocessor *pp) {
  int skip;

  if(check_keyword(pp, "if")) {
    skip = if_directive(pp);
  } else if(check_keyword(pp, "ifdef")) {
    skip = ifdef_directive(pp);
  } else if(check_keyword(pp, "ifndef")) {
    skip = ifndef_directive(pp);
  }

  while(check_keyword(pp, "elif")) {
    skip = elif_directive(pp, skip);
  }

  if(check_keyword(pp, "else")) {
    else_directive(pp, skip);
  }

  if(check_keyword(pp, "endif")) {
    endif_directive(pp);
  } else {
    error("#endif directive is missing.\n");
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x2ab1(%rip), %rsi      # 0x8024
callq 0x461e
testl %eax, %eax
je 0x5586
movq %rbx, %rdi
callq 0x5371
jmp 0x55c2
leaq 0x2a7d(%rip), %rsi      # 0x800a
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x55a3
movq %rbx, %rdi
callq 0x53b2
jmp 0x55c2
leaq 0x2a66(%rip), %rsi      # 0x8010
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x5653
movq %rbx, %rdi
callq 0x5426
movl %eax, %ebp
leaq 0x2a4c(%rip), %rsi      # 0x8017
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x55f9
leaq 0x2a39(%rip), %r14      # 0x8017
movq %rbx, %rdi
movl %ebp, %esi
callq 0x549a
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x461e
testl %eax, %eax
jne 0x55de
leaq 0x2a1c(%rip), %rsi      # 0x801c
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x5616
movq %rbx, %rdi
movl %ebp, %esi
callq 0x54eb
leaq 0x2a04(%rip), %rsi      # 0x8021
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x5635
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5536
leaq 0x28d4(%rip), %rdi      # 0x7f10
leaq 0x29e4(%rip), %rdx      # 0x8027
movl $0x3ac, %esi            # imm = 0x3AC
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x142c
jmp 0x55c4
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: try_fopen
int try_fopen(char *file) {
  FILE *fp = fopen(file, "r");

  if(fp == NULL) return 0;

  fclose(fp);
  return 1;
}

// Assembly:
pushq %rax
leaq 0x19b4(%rip), %rsi      # 0x7014
callq 0x10d0
testq %rax, %rax
je 0x5679
movq %rax, %rdi
callq 0x1040
movl $0x1, %eax
jmp 0x567b
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: search_header_file
struct string *search_header_file(struct string *text) {
  char location[4][64] = {
    "/usr/lib/gcc/x86_64-linux-gnu/7/include/",
    "/usr/include/",
    "/usr/include/linux/",
    "/usr/include/x86_64-linux-gnu/"
  };

  for(int k = 0; k < 4; k++) {
    struct string *path = allocate_string();
    write_string(path, location[k]);
    for(int i = 1; i < text->size - 1; i++) {
      append_string(path, text->head[i]);
    }

    if(try_fopen(path->head)) return path;

    free_string(path);
  }

  // failed to search header file
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
leaq 0x277b(%rip), %rsi      # 0x7e10
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x10a0
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x1a00
movq %rax, %r14
movq %r15, %rax
shlq $0x6, %rax
leaq (%rsp,%rax), %rsi
movq %r14, %rdi
callq 0x1abc
cmpl $0x3, 0x8(%rbx)
jl 0x56ed
movl $0x1, %r12d
movq (%rbx), %rax
movzbl (%rax,%r12), %esi
movq %r14, %rdi
callq 0x1a31
incq %r12
movslq 0x8(%rbx), %rax
decq %rax
cmpq %rax, %r12
jl 0x56ce
movq (%r14), %rdi
callq 0x5658
testl %eax, %eax
jne 0x570d
movq %r14, %rdi
callq 0x1b21
incq %r15
cmpq $0x4, %r15
jne 0x56a5
xorl %r14d, %r14d
movq %r14, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: search_named_source_file
struct string *search_named_source_file(struct string *text, const char *current_file) {
  int last_slash = 0;
  for(int i = 0; current_file[i]; i++) {
    if(current_file[i] == '/') {
      last_slash = i;
    }
  }

  struct string *dir = allocate_string();
  if(last_slash > 0) {
    for(int i = 0; i < last_slash; i++) {
      append_string(dir, current_file[i]);
    }
    append_string(dir, '/');
  }

  struct string *path = allocate_string();
  concat_string(path, dir);
  for(int i = 1; i < text->size - 1; i++) {
    append_string(path, text->head[i]);
  }

  if(try_fopen(path->head)) {
    return path;
  }

  free_string(path);

  // reprocess as if header file was read
  return search_header_file(text);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
xorl %ebp, %ebp
movzbl (%r14,%rax), %ecx
cmpl $0x2f, %ecx
je 0x5744
testl %ecx, %ecx
jne 0x5746
jmp 0x574b
movl %eax, %ebp
incq %rax
jmp 0x5734
xorl %eax, %eax
callq 0x1a00
movq %rax, %r15
testl %ebp, %ebp
jle 0x5781
movl %ebp, %r12d
xorl %r13d, %r13d
movzbl (%r14,%r13), %esi
movq %r15, %rdi
callq 0x1a31
incq %r13
cmpq %r13, %r12
jne 0x575f
movq %r15, %rdi
movl $0x2f, %esi
callq 0x1a31
xorl %eax, %eax
callq 0x1a00
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x1aeb
cmpl $0x3, 0x8(%rbx)
jl 0x57c1
movl $0x1, %r15d
movq (%rbx), %rax
movzbl (%rax,%r15), %esi
movq %r14, %rdi
callq 0x1a31
incq %r15
movslq 0x8(%rbx), %rax
decq %rax
cmpq %rax, %r15
jl 0x57a2
movq (%r14), %rdi
callq 0x5658
testl %eax, %eax
je 0x57df
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x1b21
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x567d
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: include_directive
void include_directive(struct preprocessor *pp) {
  struct pp_token *header;
  if(peek_pp_token(pp)->type == PP_H_NAME) {
    header = read_pp_token(pp);
  } else {
    error("macro-replaced include directive is not implemented yet.\n");
  }
  discard_new_line(pp);

  struct string *path;
  if(header->type == PP_H_NAME && header->text->head[0] == '<') {
    path = search_header_file(header->text);
  } else if(header->type == PP_H_NAME && header->text->head[0] == '"') {
    path = search_named_source_file(header->text, pp->lexer->src->file);
  }

  if(path == NULL) {
    error("failed to search include file\n");
  }

  struct pp_list *list = parse_preprocessing_file(path->head);
  concat_pp_list(pp->list, list);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x10(%rdi)
jne 0x5821
movq (%rbx), %rdi
callq 0x2163
movslq 0x10(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x10(%rbx)
movq %rax, 0x8(%rbx,%rcx,8)
movq 0x8(%rbx), %rax
cmpl $0x0, (%rax)
je 0x5846
leaq 0x26df(%rip), %rdi      # 0x7f10
leaq 0x280d(%rip), %rdx      # 0x8045
movl $0x3f7, %esi            # imm = 0x3F7
xorl %eax, %eax
callq 0x142c
jmp 0x5851
movq %rbx, %rdi
callq 0x45b6
movq %rax, %r14
movq %rbx, %rdi
movl $0x3b, %esi
callq 0x46a5
movq %rax, %rdi
callq 0x1e94
cmpl $0x0, (%r14)
jne 0x58c6
movq 0x10(%r14), %rdi
movq (%rdi), %rax
movzbl (%rax), %eax
cmpl $0x22, %eax
je 0x5887
cmpl $0x3c, %eax
jne 0x58c6
callq 0x567d
jmp 0x5896
movq (%rbx), %rax
movq (%rax), %rax
movq 0x8(%rax), %rsi
callq 0x571f
testq %rax, %rax
je 0x58c6
movq (%rax), %rdi
callq 0x58cb
movq (%rax), %rcx
testq %rcx, %rcx
je 0x58be
movq 0x18(%rbx), %rdx
movq 0x8(%rdx), %rsi
movq %rcx, (%rsi)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rdx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x1318
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: parse_preprocessing_file
struct pp_list *parse_preprocessing_file(unsigned char *file) {
  struct preprocessor pp;
  pp.lexer = allocate_pp_token_lexer(file);
  pp.token_queue_size = 0;
  pp.list = allocate_pp_list();

  group(&pp);

  if(!check_pp_token(&pp, PP_NONE)) {
    if(check_keyword(&pp, "elif")) {
      error("invalid #elif directive appeared.\n");
    } else if(check_keyword(&pp, "else")) {
      error("invalid #else directive appeared.\n");
    } else if(check_keyword(&pp, "endif")) {
      error("invalid #endif directive appeared.\n");
    }
  }

  return pp.list;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
callq 0x1b38
movq %rsp, %rbx
movq %rax, (%rbx)
movl $0x0, 0x10(%rbx)
callq 0x33b4
movq %rax, 0x18(%rbx)
movq %rbx, %rdi
callq 0x4fd8
movq %rbx, %rdi
movl $0x3e, %esi
callq 0x45e4
testl %eax, %eax
jne 0x5981
leaq 0x270c(%rip), %rsi      # 0x8017
movq %rsp, %rdi
callq 0x461e
testl %eax, %eax
je 0x592c
leaq 0x25f2(%rip), %rdi      # 0x7f10
leaq 0x28a2(%rip), %rdx      # 0x81c7
movl $0x504, %esi            # imm = 0x504
jmp 0x597a
leaq 0x26e9(%rip), %rsi      # 0x801c
movq %rsp, %rdi
callq 0x461e
testl %eax, %eax
je 0x5954
leaq 0x25ca(%rip), %rdi      # 0x7f10
leaq 0x289d(%rip), %rdx      # 0x81ea
movl $0x506, %esi            # imm = 0x506
jmp 0x597a
leaq 0x26c6(%rip), %rsi      # 0x8021
movq %rsp, %rdi
callq 0x461e
testl %eax, %eax
je 0x5981
leaq 0x25a2(%rip), %rdi      # 0x7f10
leaq 0x2898(%rip), %rdx      # 0x820d
movl $0x508, %esi            # imm = 0x508
xorl %eax, %eax
callq 0x142c
movq 0x18(%rsp), %rax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: check_parameter
int check_parameter(struct macro_entry *macro, struct pp_token *token) {
  int parameter_size = macro->parameter_size;
  if(macro->parameter_ellipsis) parameter_size++;

  if(token->type == PP_IDENT) {
    for(int i = 0; i < parameter_size; i++) {
      if(strcmp(token->text->head, macro->parameters[i]->head) == 0) {
        return 1;
      }
    }
  }

  return 0;
}

// Assembly:
movl 0x10(%rdi), %ecx
cmpl $0x1, 0x14(%rdi)
sbbl $-0x1, %ecx
xorl %eax, %eax
cmpl $0x1, (%rsi)
jne 0x59e9
testl %ecx, %ecx
jle 0x59e9
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rsi), %rax
movq (%rax), %r14
movl %ecx, %r15d
xorl %r12d, %r12d
movq 0x18(%rbx,%r12,8), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x1080
testl %eax, %eax
je 0x59d9
incq %r12
cmpq %r12, %r15
jne 0x59b9
xorl %eax, %eax
jmp 0x59de
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: check_stringify_operator
int check_stringify_operator(struct macro_entry *macro) {
  struct pp_list *list = macro->replacement_list;

  for(struct pp_node *node = list->head; node != NULL; node = node->next) {
    if(node->token->type == PP_SHARP) {
      struct pp_node *target = node->next;

      if(target == NULL) return 0;
      if(target->token->type == PP_SPACE) target = target->next;
      if(!check_parameter(macro, target->token)) return 0;

      node = target;
    }
  }

  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x418(%rdi), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x5a37
movq %rdi, %rbx
xorl %ebp, %ebp
movq (%r14), %rax
cmpl $0x39, (%rax)
jne 0x5a2e
movq 0x8(%r14), %r14
testq %r14, %r14
je 0x5a3c
movq (%r14), %rsi
cmpl $0x3c, (%rsi)
jne 0x5a22
movq 0x8(%r14), %r14
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x598c
testl %eax, %eax
je 0x5a3c
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0x5a02
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: check_concat_operator
int check_concat_operator(struct macro_entry *macro) {
  struct pp_list *list = macro->replacement_list;

  for(struct pp_node *node = list->head; node != NULL; node = node->next) {
    if(node->token->type == PP_CONCAT) {
      if(node == list->head) return 0;
      if(node->next == NULL) return 0;
    }
  }

  return 1;
}

// Assembly:
movq 0x418(%rdi), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x5a78
movq %rcx, %rdx
movq (%rdx), %rax
cmpl $0x3a, (%rax)
jne 0x5a6f
xorl %eax, %eax
cmpq %rcx, %rdx
je 0x5a7d
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
jne 0x5a73
jmp 0x5a7d
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
jne 0x5a55
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: parse_text_line
void parse_text_line(struct preprocessor *pp) {
  struct pp_list *text = allocate_pp_list();

  while(1) {
    struct pp_token *token = read_pp_token(pp);
    append_pp_list(text, token);
    if(token->type == PP_NEW_LINE) {
      struct pp_token *next = peek_pp_token(pp);
      if(next->type == PP_SHARP || next->type == PP_NONE) {
        break;
      }
    }
  }

  struct pp_list *replaced = scan_macro(pp, text);
  concat_pp_list(pp->list, replaced);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x33b4
movq %rax, %r14
movq %rbx, %rdi
callq 0x45b6
movq %rax, %r15
movl $0x18, %edi
callq 0x10b0
movq %r15, (%rax)
leaq 0x8(%rax), %rcx
movq $0x0, 0x8(%rax)
movl $0x0, 0x10(%rax)
movq 0x8(%r14), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%r14)
cmpl $0x3b, (%r15)
jne 0x5e36
cmpl $0x0, 0x10(%rbx)
jne 0x5e8f
movq (%rbx), %rdi
callq 0x2163
movslq 0x10(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x10(%rbx)
movq %rax, 0x8(%rbx,%rcx,8)
movq 0x8(%rbx), %rax
movl (%rax), %eax
cmpl $0x3e, %eax
je 0x5e9f
cmpl $0x39, %eax
jne 0x5e36
movq %rbx, %rdi
movq %r14, %rsi
callq 0x38da
movq (%rax), %rcx
testq %rcx, %rcx
je 0x5ec5
movq 0x18(%rbx), %rdx
movq 0x8(%rdx), %rsi
movq %rcx, (%rsi)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rdx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: check_if_section
int check_if_section(struct preprocessor *pp) {
  if(check_keyword(pp, "if")) return 1;
  if(check_keyword(pp, "ifdef")) return 1;
  if(check_keyword(pp, "ifndef")) return 1;
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x214e(%rip), %rsi      # 0x8024
callq 0x461e
testl %eax, %eax
jne 0x5ef2
leaq 0x2124(%rip), %rsi      # 0x800a
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x5ef9
movl $0x1, %eax
popq %rbx
retq
leaq 0x2110(%rip), %rsi      # 0x8010
movq %rbx, %rdi
popq %rbx
jmp 0x461e
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: check_group_end
int check_group_end(struct preprocessor *pp) {
  if(check_keyword(pp, "elif")) return 1;
  if(check_keyword(pp, "else")) return 1;
  if(check_keyword(pp, "endif")) return 1;
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x2103(%rip), %rsi      # 0x8017
callq 0x461e
testl %eax, %eax
jne 0x5f30
leaq 0x20f8(%rip), %rsi      # 0x801c
movq %rbx, %rdi
callq 0x461e
testl %eax, %eax
je 0x5f37
movl $0x1, %eax
popq %rbx
retq
leaq 0x20e3(%rip), %rsi      # 0x8021
movq %rbx, %rdi
popq %rbx
jmp 0x461e
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/preprocess.c
// Function: preprocess
struct pp_list *preprocess(unsigned char *file) {
  struct macro_entry *arch = allocate_macro_entry();
  arch->identifier = "__x86_64__";
  insert_macro_table(arch);

  struct pp_list *list = parse_preprocessing_file(file);

  for(int i = 0; i < MACRO_TABLE_SIZE; i++) {
    if(macro_table[i] != NULL) {
      free_macro_entry(macro_table[i]);
    }
  }

  return list;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x345a
leaq 0x22c0(%rip), %rcx      # 0x8231
movq %rcx, 0x8(%rax)
movq %rax, %rdi
callq 0x35bf
movq %rbx, %rdi
callq 0x58cb
movq %rax, %rbx
xorl %r15d, %r15d
leaq 0x512e(%rip), %r12      # 0xb0c0
movq (%r15,%r12), %r14
testq %r14, %r14
je 0x5faf
movq 0x418(%r14), %rdi
callq 0x33d6
movq %r14, %rdi
callq 0x1030
addq $0x8, %r15
cmpq $0x50008, %r15          # imm = 0x50008
jne 0x5f92
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/ShinyaKato[P]skcc/main.c
// Function: main
int main(int argc, char **argv) {
  if(argc < 2) {
    error("usage: skcc [source file name]");
  }

  char *file = argv[1];
  struct pp_list *list = preprocess(file);

  /* for(struct pp_node *node = list->head; node != NULL; node = node->next) { */
  /*   struct pp_token *token = node->token; */
  /*   printf("(%d, %s)", token->type, token->name); */
  /*   if(token->type != PP_NEW_LINE && token->type != PP_SPACE && token->type != PP_NONE) { */
  /*     printf(" %s", token->text->head); */
  /*   } */
  /*   printf("\n"); */
  /* } */

  for(struct pp_node *node = list->head; node != NULL; node = node->next) {
    struct pp_token *token = node->token;
    printf("%s", token->text->head);
  }

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x1, %edi
jg 0x5ff2
leaq 0x225d(%rip), %rdi      # 0x823c
leaq 0x225d(%rip), %rdx      # 0x8243
movl $0x5, %esi
xorl %eax, %eax
callq 0x142c
movq 0x8(%rbx), %rdi
callq 0x5f5a
movq (%rax), %r14
testq %r14, %r14
je 0x6027
leaq 0x2258(%rip), %rbx      # 0x8262
movq (%r14), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1050
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0x600a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/net.cpp
// Function: Net::Net(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Net::Net(string n){
  netname = n;
  val ='x';
  drivers = new vector<Gate *>;
  loads = new vector<Gate *>;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
leaq 0x28(%rdi), %r15
movq %r15, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
movq %r14, %rdi
callq 0x20d0
movb $0x78, 0x10(%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, (%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x25ff
movq (%r15), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/net.cpp
// Function: Net::printDriversLoads()
void Net::printDriversLoads(){
  cout << " net " << name();

  cout << ", drivers: ";
  for(unsigned int i=0; i!=drivers->size();i++){
    cout << (*drivers)[i];
  }

  cout << "  loads: ";
  for(unsigned int i=0; i!=loads->size();i++){
    cout << (*loads)[i];
  }
  cout<< endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x8883(%rip), %r14      # 0xafd0
leaq 0x48cc(%rip), %rsi      # 0x7020
movl $0x5, %edx
movq %r14, %rdi
callq 0x21d0
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
callq 0x28b4
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x21d0
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x27a5
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2190
movq 0x8824(%rip), %rdi      # 0xafd0
leaq 0x4873(%rip), %rsi      # 0x7026
movl $0xb, %edx
callq 0x21d0
movq (%rbx), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x2800
movl $0x1, %r15d
xorl %ecx, %ecx
movq 0x87f8(%rip), %r14      # 0xafd0
movq (%rax,%rcx,8), %rsi
movq %r14, %rdi
callq 0x2120
movl %r15d, %ecx
movq (%rbx), %rdx
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r15d
cmpq %rcx, %rdx
jne 0x27d8
movq 0x87c9(%rip), %r14      # 0xafd0
leaq 0x4824(%rip), %rsi      # 0x7032
movl $0x9, %edx
movq %r14, %rdi
callq 0x21d0
movq 0x8(%rbx), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x2860
movl $0x1, %r12d
xorl %ecx, %ecx
movq 0x8799(%rip), %r15      # 0xafd0
movq (%rax,%rcx,8), %rsi
movq %r15, %rdi
callq 0x2120
movl %r12d, %ecx
movq 0x8(%rbx), %rdx
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r12d
cmpq %rcx, %rdx
jne 0x2837
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x28ac
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22b0
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gsim.cpp
// Function: main
int main(int argc, char* argv[]){

  if(argc < 2){ //use "argc < 3" for pa6
    cerr << "Usage: ./gatesim verilog_file input_test_file" << endl;
    return 1;
  }

/*************** autoparsing **************
//note: to use the autoparsing, need to change "parse" to a pure virtual fuction, in vlg_parser.h, namely:
//  virtual Design *parse(char *filename) =0;

  VlgParserAuto auto_;
  Design* design2 = auto_.parse(argv[1]);
  ofstream output_stream("autoparsing_result.v");

  design2->dump(output_stream);
  output_stream.close();
*******************************************/

  //self parsing
  VlgParser pars;
  Design* design1= pars.parse(argv[1]);
  ofstream ofile("output.v") ; 
  
  //print results if no errors
  if(design1!=NULL){
    cout<< " parser correct " <<endl;
    design1->dump(ofile);
    delete design1;
  }
  else{ //if error, report
    cout<< " Parser reports error " <<endl;
  }


  ofile.close();

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
cmpl $0x1, %edi
jg 0x2af3
movq 0x8542(%rip), %rbx      # 0xaff0
leaq 0x45cb(%rip), %rsi      # 0x7080
movl $0x2d, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x1, %eax
jmp 0x2c24
leaq 0x827e(%rip), %rax      # 0xad78
addq $0x10, %rax
leaq -0x18(%rbp), %rdi
movq %rax, (%rdi)
movq 0x8(%rsi), %rsi
callq 0x5a1c
movq %rax, %rbx
leaq 0x4596(%rip), %rsi      # 0x70ae
leaq -0x218(%rbp), %rdi
movl $0x10, %edx
callq 0x21c0
testq %rbx, %rbx
je 0x2b9a
movq 0x849b(%rip), %r14      # 0xafd0
leaq 0x457b(%rip), %rsi      # 0x70b7
movl $0x10, %edx
movq %r14, %rdi
callq 0x21d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq 0x8469(%rip), %rdi      # 0xafd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq -0x218(%rbp), %rsi
movq %rbx, %rdi
callq 0x43f8
movq %rbx, %rdi
callq 0x3ef4
movl $0xd8, %esi
movq %rbx, %rdi
callq 0x2190
jmp 0x2be0
movq 0x842f(%rip), %rbx      # 0xafd0
leaq 0x4520(%rip), %rsi      # 0x70c8
movl $0x16, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq 0x83fd(%rip), %rdi      # 0xafd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq -0x218(%rbp), %rdi
callq 0x2210
movq 0x83d5(%rip), %rax      # 0xafc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x210(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x218(%rbp,%rcx)
callq 0x2150
leaq -0x120(%rbp), %rdi
callq 0x2090
xorl %eax, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: Gate::Gate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Gate::Gate(string n){ //no delay
  delay = 1;
  inst_name = n;
  inputs = new vector<Net *>;
  delay_default=true;
  output = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x7f50(%rip), %rax      # 0xabd0
movq %rax, (%rdi)
leaq 0x18(%rdi), %r14
leaq 0x28(%rdi), %r15
movq %r15, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
movl $0x1, 0x38(%rdi)
movq %r14, %rdi
callq 0x20d0
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movq %rax, 0x8(%rbx)
movb $0x1, 0x3c(%rbx)
movq %rcx, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x2ced
movq (%r15), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: Gate::Gate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
Gate::Gate(string n, int d){  // with delay provided
  inst_name = n;
  delay = d;
  inputs = new vector<Net *>;
  delay_default=false;
  output = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x7ec2(%rip), %rax      # 0xabd0
movq %rax, (%rdi)
leaq 0x18(%rdi), %r14
leaq 0x28(%rdi), %r12
movq %r12, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
movq %r14, %rdi
callq 0x20d0
movl %r15d, 0x38(%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movq %rax, 0x8(%rbx)
movb $0x0, 0x3c(%rbx)
movq %rcx, 0x10(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x2d77
movq (%r12), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: Gate::dump(std::ostream&)
void Gate::dump(ostream &os) {

  if(!delay_default){
    os << "#" << delay <<" "; 
  }
  os << inst_name <<'(';
  if(output!=NULL){
    os << output->name();
  }
  for(unsigned int i=0; i!=inputs->size(); i++){
    os << ", " << ( (*inputs)[i]->name() );
  }
  os << ");" <<endl ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, 0x3c(%rdi)
jne 0x2f03
leaq 0x4209(%rip), %rsi      # 0x70df
movl $0x1, %edx
movq %rbx, %rdi
callq 0x21d0
movl 0x38(%r14), %esi
movq %rbx, %rdi
callq 0x2290
leaq 0x42af(%rip), %rsi      # 0x71a5
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdx
movq %rbx, %rdi
callq 0x21d0
leaq -0x48(%rbp), %rsi
movb $0x28, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0x2f64
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x2686
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x21d0
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f64
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
movq 0x8(%r14), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x2fe8
movl $0x1, %r13d
xorl %r15d, %r15d
leaq -0x48(%rbp), %r12
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x4154(%rip), %rsi      # 0x70e1
callq 0x21d0
movq 0x8(%r14), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rsi
movq %r12, %rdi
callq 0x2686
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x21d0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2fce
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
movq 0x8(%r14), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
movl %r13d, %r15d
sarq $0x3, %rcx
incl %r13d
cmpq %r15, %rcx
jne 0x2f7e
leaq 0x40f5(%rip), %rsi      # 0x70e4
movl $0x2, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x304a
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x305b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: And::eval()
char And::eval(){
  unsigned int count1=0;
  for(unsigned i = 0; i!=inputs->size() ; i++){
    char value_in =(*inputs)[i]->getVal() ;
    if(value_in=='0'){
      return '0';
    }
    if(value_in=='1'){
      count1++;
    }
  }
  if(count1==inputs->size()){ 
    return '1';
  }
//if they is no '0' and there is at least one 'x'
return 'x';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rsi
movq %rsi, %rax
subq %rdx, %rax
sarq $0x3, %rax
xorl %ecx, %ecx
cmpq %rdx, %rsi
je 0x3240
movl $0x1, %esi
xorl %edi, %edi
movq (%rdx,%rdi,8), %rdi
movb 0x10(%rdi), %dil
cmpb $0x30, %dil
je 0x3252
xorl %r8d, %r8d
cmpb $0x31, %dil
sete %r8b
addl %r8d, %ecx
movl %esi, %edi
incl %esi
cmpq %rdi, %rax
jne 0x3219
movl %ecx, %ecx
cmpq %rcx, %rax
movl $0x31, %ecx
movl $0x78, %eax
cmovel %ecx, %eax
jmp 0x3254
movb $0x30, %al
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: Or::eval()
char Or::eval(){
  unsigned int count0=0;
  for(unsigned i = 0; i!=inputs->size() ; i++){
    char value_in =(*inputs)[i]->getVal() ;
    if(value_in=='1'){
      return '1';
    }
    if(value_in=='0'){
      count0++;
    }
  }

  if(count0==inputs->size()){ 
    return '0';
  }
//if they is no '1' and there is at least 'x'
return 'x';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rsi
movq %rsi, %rax
subq %rdx, %rax
sarq $0x3, %rax
xorl %ecx, %ecx
cmpq %rdx, %rsi
je 0x3432
movl $0x1, %esi
xorl %edi, %edi
movq (%rdx,%rdi,8), %rdi
movb 0x10(%rdi), %dil
cmpb $0x31, %dil
je 0x3444
xorl %r8d, %r8d
cmpb $0x30, %dil
sete %r8b
addl %r8d, %ecx
movl %esi, %edi
incl %esi
cmpq %rdi, %rax
jne 0x340b
movl %ecx, %ecx
cmpq %rcx, %rax
movl $0x30, %ecx
movl $0x78, %eax
cmovel %ecx, %eax
jmp 0x3446
movb $0x31, %al
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: Nor::eval()
char Nor::eval(){
  unsigned int count0=0;
  for(unsigned i = 0; i!=inputs->size() ; i++){
    char value_in =(*inputs)[i]->getVal() ;
    if(value_in=='1'){
      return '0';//'1';
    }
    if(value_in=='0'){
      count0++;
    }
  }

  if(count0==inputs->size()){ 
    return '1';//'0';
  }
//if they is no '1' and there is one 'x'
return 'x';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rsi
movq %rsi, %rax
subq %rdx, %rax
sarq $0x3, %rax
xorl %ecx, %ecx
cmpq %rdx, %rsi
je 0x3624
movl $0x1, %esi
xorl %edi, %edi
movq (%rdx,%rdi,8), %rdi
movb 0x10(%rdi), %dil
cmpb $0x31, %dil
je 0x3636
xorl %r8d, %r8d
cmpb $0x30, %dil
sete %r8b
addl %r8d, %ecx
movl %esi, %edi
incl %esi
cmpq %rdi, %rax
jne 0x35fd
movl %ecx, %ecx
cmpq %rcx, %rax
movl $0x31, %ecx
movl $0x78, %eax
cmovel %ecx, %eax
jmp 0x3638
movb $0x30, %al
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/gates.cpp
// Function: Xor::eval()
char Xor::eval(){ //odd number of '1' gives true
  bool unknown=false;
  unsigned int count1=0;
  for(unsigned i = 0; i!=inputs->size() ; i++){
    char value_in =(*inputs)[i]->getVal() ;
    if(value_in=='x'){
      unknown=true;
    }
    if(value_in=='0'){
      count1++;
    }
  }
  
 
  bool isOdd=count1%2;
  if( isOdd ){ //if it is odd number
    return '1';
  }
  if(unknown){
    return 'x';
  }


return '0';
}

// Assembly:
movq 0x8(%rdi), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
je 0x3a22
pushq %rbp
movq %rsp, %rbp
sarq $0x3, %rcx
xorl %esi, %esi
xorl %edi, %edi
xorl %edx, %edx
movq (%rax,%rsi,8), %r8
movb 0x10(%r8), %r8b
cmpb $0x78, %r8b
sete %r9b
orb %r9b, %dil
xorl %r9d, %r9d
cmpb $0x30, %r8b
sete %r9b
addl %r9d, %edx
incq %rsi
movl %esi, %r8d
cmpq %r8, %rcx
jne 0x39d8
testb $0x1, %dil
movl $0x78, %eax
movl $0x30, %ecx
cmovnel %eax, %ecx
testb $0x1, %dl
movl $0x31, %eax
cmovel %ecx, %eax
popq %rbp
retq
movb $0x30, %al
retq
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::Design(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Design::Design(string n){
  desname = n;
  PINets = new vector<Net *>(); // " () " used for initializing size to 0 
  PONets = new vector<Net *>();
  WireNets = new vector<Net*>();
  all_Nets = new vector<Net*>();
  all_Gates = new vector<Gate *>();
  //pis.clear();
  //pos.clear();


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq %r14, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0x20(%rdi), %rcx
movq %rcx, -0x38(%rbp)
leaq 0x28(%rdi), %rcx
movl %eax, 0x28(%rdi)
movq %rax, 0x30(%rdi)
movq %rcx, 0x38(%rdi)
movq %rcx, 0x40(%rdi)
movq %rax, 0x48(%rdi)
leaq 0x50(%rdi), %r15
leaq 0x58(%rdi), %rcx
movl %eax, 0x58(%rdi)
movq %rax, 0x60(%rdi)
movq %rcx, 0x68(%rdi)
movq %rcx, 0x70(%rdi)
leaq 0x80(%rdi), %r12
leaq 0x98(%rdi), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rdi)
movups %xmm0, 0x88(%rdi)
movups %xmm0, 0x98(%rdi)
movq %rax, 0xa8(%rdi)
callq 0x20d0
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, 0xb0(%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, 0xb8(%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, 0xc0(%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, 0xc8(%rbx)
movl $0x18, %edi
callq 0x2180
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rax, 0xd0(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, -0x30(%rbp)
movq %r13, %rdi
callq 0x4d92
movq %r12, %rdi
callq 0x4d92
movq %r15, %rdi
callq 0x4f5a
movq -0x38(%rbp), %rdi
callq 0x4fea
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x3eea
movq (%r14), %rsi
incq %rsi
callq 0x2190
movq -0x30(%rbp), %rdi
callq 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::~Design()
Design::~Design(){
  //destructor for all nets
  map<string, Net *>::iterator it_net;
  for(it_net=designNets.begin() ; it_net!=designNets.end(); it_net++){
    //cout << (it_net->second)->name() <<endl;////////////////
    delete it_net->second;
  }

 // destructor for all gates
  map<string, Gate *>::iterator it_gate;
  for(it_gate=designGates.begin() ; it_gate!=designGates.end(); it_gate++){
    //cout << (it_gate->second)->name() <<endl;////////////////
    delete it_gate->second;
  }
  
  //delete vectors
  delete PINets;
  delete PONets;
  delete WireNets;
  delete all_Nets;
  delete all_Gates;
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %r14
leaq 0x28(%rdi), %r12
cmpq %r12, %r14
je 0x3f3d
movq 0x40(%r14), %r15
testq %r15, %r15
je 0x3f20
movq %r15, %rdi
callq 0x2608
movl $0x40, %esi
movq %r15, %rdi
callq 0x2190
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
cmpq %r12, %rax
jne 0x3f0f
movq 0x68(%rbx), %r14
leaq 0x58(%rbx), %r15
cmpq %r15, %r14
je 0x3f69
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x3f59
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
cmpq %r15, %rax
jne 0x3f4a
movq 0xb0(%rbx), %r14
testq %r14, %r14
je 0x3f89
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3f89
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r14, %rdi
callq 0x2190
movq 0xb8(%rbx), %r14
testq %r14, %r14
je 0x3fb6
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3fb6
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r14, %rdi
callq 0x2190
movq 0xc0(%rbx), %r14
testq %r14, %r14
je 0x3fe3
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3fe3
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r14, %rdi
callq 0x2190
movq 0xc8(%rbx), %r12
testq %r12, %r12
je 0x4012
movq (%r12), %rdi
testq %rdi, %rdi
je 0x4012
movq 0x10(%r12), %rsi
subq %rdi, %rsi
callq 0x2190
leaq 0x20(%rbx), %r14
leaq 0x50(%rbx), %r15
movl $0x18, %esi
movq %r12, %rdi
callq 0x2190
movq 0xd0(%rbx), %r12
testq %r12, %r12
je 0x4049
movq (%r12), %rdi
testq %rdi, %rdi
je 0x4049
movq 0x10(%r12), %rsi
subq %rdi, %rsi
callq 0x2190
movl $0x18, %esi
movq %r12, %rdi
callq 0x2190
leaq 0x98(%rbx), %rdi
callq 0x4d92
leaq 0x80(%rbx), %rdi
callq 0x4d92
movq %r15, %rdi
callq 0x4f5a
movq %r14, %rdi
callq 0x4fea
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x409d
movq (%rbx), %rsi
incq %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2190
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::addPI(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Design::addPI(string n){
  pis.push_back(n);
  Net* ptr_net = new Net(n);//make net
  PINets->push_back(ptr_net); 
  designNets[n]=ptr_net;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %r15
addq $0x80, %rdi
callq 0x4e00
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x28b4
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x2576
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x413d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
movq %rbx, -0x28(%rbp)
movq 0xb0(%r15), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x415c
movq %rbx, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x416b
leaq -0x28(%rbp), %rbx
movq %rbx, %rdx
callq 0x3be0
movq (%rbx), %rbx
addq $0x20, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4e4c
movq %rbx, (%rax)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x41a7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
jmp 0x41a7
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2190
movq %r14, %rdi
callq 0x22b0
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::addPO(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Design::addPO(string n){ 
  pos.push_back(n);
  Net* ptr_net = new Net(n);//make net
  PONets->push_back(ptr_net); 
  designNets[n]=ptr_net; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %r15
addq $0x98, %rdi
callq 0x4e00
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x28b4
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x2576
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x4227
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
movq %rbx, -0x28(%rbp)
movq 0xb8(%r15), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x4246
movq %rbx, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x4255
leaq -0x28(%rbp), %rbx
movq %rbx, %rdx
callq 0x3be0
movq (%rbx), %rbx
addq $0x20, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4e4c
movq %rbx, (%rax)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x4291
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2190
jmp 0x4291
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2190
movq %r14, %rdi
callq 0x22b0
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::findNet(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Net* Design::findNet(string net_name){
  map<string, Net *>::iterator it;
  it=designNets.find(net_name);
  if(it!=designNets.end() ){
    return it->second;
  }
  else{
    return NULL;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x560e
addq $0x28, %rbx
cmpq %rbx, %rax
je 0x42c7
movq 0x40(%rax), %rax
jmp 0x42c9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::addFindNet(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Net* Design::addFindNet(string n){
  map<string, Net *>::iterator it;
  it=designNets.find(n);
  if(it!=designNets.end() ){
    return it->second;
  }
  else{
    Net* net_ptr = new Net(n);
    designNets[n]= net_ptr;
    WireNets->push_back(net_ptr);

    return net_ptr;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x20(%rdi), %r12
movq %r12, %rdi
callq 0x560e
leaq 0x28(%r14), %rcx
cmpq %rcx, %rax
je 0x4305
movq 0x40(%rax), %rbx
jmp 0x438a
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x28b4
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2576
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x434e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2190
movq %rbx, -0x30(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x4e4c
movq %rbx, (%rax)
movq 0xc0(%r14), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x437b
movq %rbx, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x438a
leaq -0x30(%rbp), %rbx
movq %rbx, %rdx
callq 0x3be0
movq (%rbx), %rbx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x43b9
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2190
jmp 0x43b9
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2190
movq %r14, %rdi
callq 0x22b0
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::findGate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Gate * Design::findGate(string inst_name){
  map<string, Gate*>::iterator it;
  it=designGates.find(inst_name);
  if(it!=designGates.end() ){
    return it->second;
  }
  else{
    return NULL;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x50, %rdi
callq 0x565e
addq $0x58, %rbx
cmpq %rbx, %rax
je 0x43ef
movq 0x40(%rax), %rax
jmp 0x43f1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::allNets()
vector<Net *> * Design::allNets(){
  map<string, Net *>::iterator it_net;
  for(it_net=designNets.begin() ; it_net!=designNets.end(); it_net++){
     all_Nets->push_back( it_net->second );
  }
  return all_Nets;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %r14
leaq 0x28(%rdi), %r15
cmpq %r15, %r14
je 0x4d1b
movq 0xc8(%rbx), %rdi
leaq 0x40(%r14), %rdx
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x4d06
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x4d0b
callq 0x3be0
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
cmpq %r15, %rax
jne 0x4ce4
movq 0xc8(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/design.cpp
// Function: Design::allGates()
vector<Gate *> * Design::allGates(){
  map<string, Gate *>::iterator it_gate;
  for(it_gate=designGates.begin() ; it_gate!=designGates.end(); it_gate++){
     all_Gates->push_back( it_gate->second );
  }
  return all_Gates;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x68(%rdi), %r14
leaq 0x58(%rdi), %r15
cmpq %r15, %r14
je 0x4d7f
movq 0xd0(%rbx), %rdi
leaq 0x40(%r14), %rdx
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x4d6a
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x4d6f
callq 0x2952
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
cmpq %r15, %rax
jne 0x4d48
movq 0xd0(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/luixmao[P]verilog/vlg_parser_man.cpp
// Function: errase_comments_and_spaces(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string errase_comments_and_spaces(string s){
  bool exit = false;
  unsigned int i=0;
  while(i<s.length()){
    //delete everything after comments
    if(s[i]=='/'){
        if(s[i+1]=='/'){// if there is two adjacent "//"
          while (i!=s.length() ){ //delete all the values starting from the one located at i
            s.erase(s.begin()+i); 
            exit=true; //to exit loop
          }
          if(exit){
            break;
          }
        }
    }
    //delete repeated spaces
    if(s[i] == ' '){
       while(s[i+1] == ' ' && (i+1)<s.length() ){
         s.erase(s.begin()+i+1); 
       }
    }
    
    i++;
  }
  return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq 0x8(%rsi), %r13
xorl %r12d, %r12d
testq %r13, %r13
je 0x62f9
xorl %r15d, %r15d
movb (%rax,%r15), %cl
cmpb $0x2f, %cl
jne 0x62a0
leal 0x1(%r12), %ecx
cmpb $0x2f, (%rax,%rcx)
jne 0x62e8
cmpq %r15, %r13
je 0x629c
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21e0
cmpq %r15, 0x8(%rbx)
jne 0x6277
movq (%rbx), %rax
cmpq %r15, %r13
movq %r15, %r13
jne 0x6343
movb (%rax,%r15), %cl
cmpb $0x20, %cl
jne 0x62e8
leal 0x1(%r12), %r15d
cmpb $0x20, (%rax,%r15)
jne 0x62e3
movq 0x8(%rbx), %r13
cmpq %r15, %r13
jbe 0x62e3
movl %r12d, %r12d
incq %r12
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x21e0
movq (%rbx), %rax
movq 0x8(%rbx), %r13
cmpb $0x20, (%rax,%r15)
jne 0x62e3
cmpq %r15, %r13
ja 0x62c0
movl %r15d, %r12d
jmp 0x62ee
incl %r12d
movq %r12, %r15
cmpq %r15, %r13
ja 0x625e
jmp 0x62fc
xorl %r13d, %r13d
leaq 0x10(%r14), %rdx
movq %rdx, (%r14)
leaq 0x10(%rbx), %rcx
cmpq %rcx, %rax
je 0x6318
movq %rax, (%r14)
movq (%rcx), %rax
movq %rax, 0x10(%r14)
jmp 0x631e
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %r13, 0x8(%r14)
movq %rcx, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %r13
jmp 0x62fc