// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, (%rdi)
movq %rsi, %r15
movq 0x18(%rsi), %r12
leaq 0x8(%rsi), %r14
leaq 0x23ce(%rip), %r13      # 0x71d0
xorl %ebp, %ebp
cmpq %r14, %r12
je 0x4e54
cmpb $0x0, 0x68(%r12)
je 0x4e28
cmpb $0x0, 0x61(%r12)
jne 0x4e47
leaq 0x40(%r12), %rsi
movq %rbx, %rdi
callq 0x5072
jmp 0x4e47
leaq 0x40(%r12), %rsi
movq 0x40(%r12), %rcx
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x4fa6
testb %al, %al
je 0x4f78
movq %r12, %rdi
callq 0x2150
movq %rax, %r12
jmp 0x4e04
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
movq 0x18(%r15), %r12
movq %r14, 0x20(%rsp)
cmpq %r14, %r12
sete %al
je 0x4f6b
movb %al, 0xf(%rsp)
cmpl $0x6, 0xb8(%r12)
jne 0x4f56
movq 0xc0(%r12), %r15
movq (%r15), %r14
leaq 0x40(%r12), %r13
cmpq 0x8(%r15), %r14
je 0x4edc
cmpl $0x0, 0x28(%r14)
jne 0x4ed6
movq 0x20(%r14), %rax
cmpl $0x4, 0x24(%rax)
jg 0x4eb5
cmpl $0x0, 0x2c(%r14)
jne 0x4ed6
movq (%r14), %rcx
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x231d(%rip), %rdx      # 0x71e4
xorl %eax, %eax
callq 0x5188
testb %al, %al
je 0x4f6e
addq $0x50, %r14
jmp 0x4e97
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x4f15
cmpl $0x0, 0x20(%r15)
jne 0x4f15
cmpl $0x4, 0x24(%rax)
jg 0x4ef9
cmpl $0x0, 0x24(%r15)
js 0x4f15
movq (%r13), %rcx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x22f4(%rip), %rdx      # 0x71fe
xorl %eax, %eax
callq 0x5188
testb %al, %al
je 0x4f89
movq 0x50(%r15), %rax
cmpq 0x48(%r15), %rax
je 0x4f56
addq $0x48, %r15
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x5f86
testb %al, %al
jne 0x4f56
movq (%r13), %rcx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x22d9(%rip), %rdx      # 0x721e
xorl %eax, %eax
callq 0x5188
movb 0xf(%rsp), %cl
movl %ecx, %ebp
testb %al, %al
je 0x4f6e
movq %r12, %rdi
callq 0x2150
movq %rax, %r12
movq 0x20(%rsp), %r14
jmp 0x4e68
movb $0x1, %bpl
leaq 0x18(%rsp), %rdi
callq 0x5412
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb 0xf(%rsp), %al
movl %eax, %ebp
jmp 0x4f6e
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5412
movq %rbx, %rdi
callq 0x23a0