// File: /workspace/github_c_makefile_star2_O1/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 %rsi, %r14
movq %rdi, %rbp
movl $0x0, (%rdi)
movq 0x18(%rsi), %r15
leaq 0x8(%rsi), %r13
cmpq %r13, %r15
sete %bl
je 0x73c6
leaq 0x2e5b(%rip), %r12      # 0xa1d0
cmpb $0x0, 0x68(%r15)
je 0x73a4
cmpb $0x0, 0x61(%r15)
jne 0x738f
leaq 0x40(%r15), %rsi
movq %rbp, %rdi
callq 0x7524
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
cmpq %r13, %rax
sete %bl
jne 0x7375
jmp 0x73c6
leaq 0x40(%r15), %rsi
movq 0x40(%r15), %rcx
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x353a
testb %al, %al
jne 0x738f
testb $0x1, %bl
je 0x7505
movq %rbp, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x18(%r14), %r14
cmpq %r13, %r14
sete %bpl
je 0x74e1
cmpl $0x6, 0xb8(%r14)
jne 0x748e
movq 0xc0(%r14), %r12
movq (%r12), %rbx
cmpq 0x8(%r12), %rbx
je 0x744d
leaq 0x40(%r14), %r15
cmpl $0x0, 0x28(%rbx)
jne 0x741e
movq 0x20(%rbx), %rax
cmpl $0x4, 0x24(%rax)
jg 0x742b
cmpl $0x0, 0x2c(%rbx)
je 0x742b
addq $0x50, %rbx
cmpq 0x8(%r12), %rbx
jne 0x7408
jmp 0x744d
movq (%rbx), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rsi
leaq 0x2da7(%rip), %rdx      # 0xa1e4
xorl %eax, %eax
callq 0x3606
testb %al, %al
jne 0x741e
jmp 0x74e1
movq 0x18(%r12), %rax
testq %rax, %rax
je 0x746d
cmpl $0x0, 0x20(%r12)
jne 0x746d
cmpl $0x4, 0x24(%rax)
jg 0x74c2
cmpl $0x0, 0x24(%r12)
jns 0x74c2
movq 0x50(%r12), %rax
cmpq 0x48(%r12), %rax
je 0x748e
addq $0x48, %r12
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x85ac
testb %al, %al
je 0x74a1
movq %r14, %rdi
callq 0x3170
movq %rax, %r14
cmpq %r13, %rax
jmp 0x73da
leaq 0x40(%r14), %rsi
movq 0x40(%r14), %rcx
movq 0x8(%rsp), %rdi
leaq 0x2d69(%rip), %rdx      # 0xa21e
xorl %eax, %eax
callq 0x3606
testb %al, %al
jne 0x748e
jmp 0x74e1
leaq 0x40(%r14), %rsi
movq 0x40(%r14), %rcx
movq 0x8(%rsp), %rdi
leaq 0x2d28(%rip), %rdx      # 0xa1fe
xorl %eax, %eax
callq 0x3606
testb %al, %al
jne 0x746d
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x74f0
callq 0x7814
andb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x74f0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x751b
callq 0x7814
movq %rbx, %rdi
callq 0x33e0
nop