// File: /workspace/github_c_makefile_star2_O3/mrkite[P]regs/docmaker/compiler.cc
// Function: Compiler::run(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Symbol, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, Symbol>>>&)
bool Compiler::run(std::map<std::string, Symbol> &symbols) {
  numErrors = 0;

  for (auto it = symbols.begin(); it != symbols.end(); it++) {
    if (!it->second.isKnown) {
      if (!refErr(&it->second, "Unknown type: '%s'\n",
                  it->second.name.c_str())) {
        return false;
      }
    } else if (!it->second.isSized) {
      calculateSizes(&it->second);
    }
  }
  AVL avl;

  // verify functions only passed 32-bits or smaller
  // also verify functions have unique signatures
  for (auto it = symbols.begin(); it != symbols.end(); it++) {
    if (it->second.kind == isFunction) {
      Function *f = it->second.asFunction;
      for (auto arg = f->arguments.begin(); arg != f->arguments.end(); arg++) {
        if (arg->ref.pointer == 0 &&
            (arg->ref.symbol->size > 4 || arg->ref.array == 0)) {
          if (!defErr(&it->second, "Argument too large: '%s'\n",
                      arg->key.c_str())) {
            return false;
          }
        }
      }
      if (f->retType.symbol != nullptr && f->retType.pointer == 0 &&
          (f->retType.symbol->size > 4 || f->retType.array >= 0)) {
        if (!defErr(&it->second, "Return value too large on '%s'\n",
                    it->second.name.c_str())) {
          return false;
        }
      }
      if (f->signature.size() > 0) {
        if (!avl.insert(f->signature)) {
          if (!defErr(&it->second, "Duplicate signature on '%s'\n",
                      it->second.name.c_str())) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x0, (%rdi)
movq 0x18(%rsi), %r14
leaq 0x8(%rsi), %rbp
cmpq %rbp, %r14
je 0x7357
movq %rsi, %r15
leaq 0x2eca(%rip), %r13      # 0xa1d0
xorl %r12d, %r12d
cmpb $0x0, 0x68(%r14)
je 0x7335
cmpb $0x0, 0x61(%r14)
jne 0x7323
leaq 0x40(%r14), %rsi
movq %rbx, %rdi
callq 0x74b6
movq %r14, %rdi
callq 0x3160
movq %rax, %r14
cmpq %rbp, %rax
jne 0x7309
jmp 0x7353
leaq 0x40(%r14), %rsi
movq 0x40(%r14), %rcx
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x352a
testb %al, %al
jne 0x7323
jmp 0x748a
movq 0x18(%r15), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
cmpq %rbp, %r14
je 0x7478
movq %rbx, 0x8(%rsp)
cmpl $0x6, 0xb8(%r14)
jne 0x741a
movq 0xc0(%r14), %r13
movq (%r13), %rbx
movq 0x8(%r13), %rax
cmpq %rax, %rbx
je 0x73de
leaq 0x40(%r14), %r15
cmpl $0x0, 0x28(%rbx)
jne 0x73a9
movq 0x20(%rbx), %rcx
cmpl $0x4, 0x24(%rcx)
jg 0x73b4
cmpl $0x0, 0x2c(%rbx)
je 0x73b4
addq $0x50, %rbx
cmpq %rax, %rbx
jne 0x7393
jmp 0x73de
movq (%rbx), %rcx
xorl %r12d, %r12d
movq 0x8(%rsp), %rdi
movq %r15, %rsi
leaq 0x2e1b(%rip), %rdx      # 0xa1e4
xorl %eax, %eax
callq 0x35f6
testb %al, %al
je 0x747b
movq 0x8(%r13), %rax
jmp 0x73a9
movq 0x18(%r13), %rax
testq %rax, %rax
je 0x73fb
cmpl $0x0, 0x20(%r13)
jne 0x73fb
cmpl $0x4, 0x24(%rax)
jg 0x7454
cmpl $0x0, 0x24(%r13)
jns 0x7454
movq 0x50(%r13), %rax
cmpq 0x48(%r13), %rax
je 0x741a
addq $0x48, %r13
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x84ee
testb %al, %al
je 0x7430
movq %r14, %rdi
callq 0x3160
movq %rax, %r14
cmpq %rbp, %rax
jne 0x736d
jmp 0x7478
leaq 0x40(%r14), %rsi
movq 0x40(%r14), %rcx
xorl %r12d, %r12d
movq 0x8(%rsp), %rdi
leaq 0x2dd7(%rip), %rdx      # 0xa21e
xorl %eax, %eax
callq 0x35f6
testb %al, %al
jne 0x741a
jmp 0x747b
leaq 0x40(%r14), %rsi
movq 0x40(%r14), %rcx
xorl %r12d, %r12d
movq 0x8(%rsp), %rdi
leaq 0x2d93(%rip), %rdx      # 0xa1fe
xorl %eax, %eax
callq 0x35f6
testb %al, %al
jne 0x73fb
jmp 0x747b
movb $0x1, %r12b
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x748a
callq 0x77a6
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x74ae
callq 0x77a6
movq %rbx, %rdi
callq 0x33d0