// File: /workspace/github_c_makefile_star2_O1/mrkite[P]regs/docmaker/output.cc
// Function: Output::save(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>>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Output::save(const std::map<std::string, Symbol> &symbols,
                  const std::string &filename) {
  std::ofstream f(filename, std::ios::out | std::ios::binary | std::ios::trunc);
  if (!f.is_open()) {
    std::cerr << "Failed to create " << filename << std::endl;
    exit(-1);
  }
  w32(&f, symbols.size());
  uint32_t id = 1;
  for (auto it = symbols.begin(); it != symbols.end(); it++) {
    w32(&f, id);
    w8(&f, it->second.kind);
    ws(&f, it->first);
    ids[it->first] = id++;
  }
  for (auto it = symbols.begin(); it != symbols.end(); it++) {
    auto symbol = it->second;
    w32(&f, lookup(it->first));
    w32(&f, symbol.size);
    switch (symbol.kind) {
      case isIntrinsic:
        setIntrinsic(&f, symbol.asIntrinsic);
        break;
      case isEnum:
        setEnum(&f, symbol.asEnum);
        break;
      case isAlias:
        setRef(&f, symbol.asAlias);
        break;
      case isStruct:
        setStruct(&f, symbol.asStruct);
        break;
      case isUnion:
        setStruct(&f, symbol.asStruct);
        break;
      case isFunction:
        setFunction(&f, symbol.asFunction);
        break;
      default:
        std::cerr << "Unknown symbol type" << std::endl;
        exit(-1);
    }
  }
  f.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xa8(%rsp), %rdi
movq %rdx, %rsi
movl $0x34, %edx
callq 0x3410
leaq 0x118(%rsp), %rdi
callq 0x3090
testb %al, %al
je 0x8bb5
movq %rbx, 0x10(%rsp)
movl 0x28(%r14), %eax
leaq 0x18(%rsp), %rsi
movl %eax, (%rsi)
leaq 0xa8(%rsp), %rdi
movl $0x4, %edx
callq 0x32a0
movq 0x18(%r14), %r15
movq %r14, 0xa0(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
cmpq %rax, %r15
je 0x8947
movl $0x1, %ebx
leaq 0xa8(%rsp), %r12
leaq 0x18(%rsp), %r13
movl %ebx, 0x18(%rsp)
movl $0x4, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x32a0
movb 0xb8(%r15), %al
movb %al, 0x18(%rsp)
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x32a0
movq 0x28(%r15), %rbp
movl $0xff, %eax
cmpq %rax, %rbp
cmovaeq %rax, %rbp
movb %bpl, 0x18(%rsp)
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x32a0
leaq 0x20(%r15), %r14
movq (%r14), %rsi
movq %r12, %rdi
movq %rbp, %rdx
callq 0x32a0
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x910c
movl %ebx, (%rax)
incl %ebx
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
cmpq 0x8(%rsp), %rax
jne 0x88ba
movq 0xa0(%rsp), %rax
movq 0x18(%rax), %r14
cmpq 0x8(%rsp), %r14
movq 0x10(%rsp), %rbx
je 0x8b30
leaq 0x28(%rsp), %r12
leaq 0xa8(%rsp), %rbp
leaq 0x4(%rsp), %r15
leaq 0x1aac(%rip), %r13      # 0xa428
movq %r12, 0x18(%rsp)
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x6368
movups 0x60(%r14), %xmm0
movups %xmm0, 0x10(%r12)
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x70(%r14), %rsi
movq 0x78(%r14), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x6368
movl 0x90(%r14), %eax
movl %eax, 0x68(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x98(%r14), %rsi
movq 0xa0(%r14), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x6368
leaq 0x20(%r14), %rsi
movups 0xb8(%r14), %xmm0
movups %xmm0, 0x68(%r12)
movq %rbx, %rdi
callq 0x9188
movl (%rax), %eax
movl %eax, 0x4(%rsp)
movl $0x4, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x32a0
movl 0x3c(%rsp), %eax
movl %eax, 0x4(%rsp)
movl $0x4, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x32a0
movl 0x90(%rsp), %eax
cmpq $0x6, %rax
ja 0x8b87
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x98(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x8e88
jmp 0x8ac5
movq 0x98(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x8eec
jmp 0x8ac5
movq 0x98(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x8cf6
jmp 0x8ac5
movb 0x98(%rsp), %al
movb %al, 0x4(%rsp)
movl $0x1, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x32a0
jmp 0x8ac5
movq 0x98(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x8dc0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x8ae7
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8b03
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x8b1a
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
movq %r14, %rdi
callq 0x3250
movq %rax, %r14
cmpq 0x8(%rsp), %rax
jne 0x897c
leaq 0xa8(%rsp), %rdi
callq 0x32e0
movq 0x547c(%rip), %rax      # 0xdfc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0xb0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0xa8(%rsp,%rcx)
callq 0x31b0
leaq 0x1a0(%rsp), %rdi
callq 0x30e0
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5462(%rip), %rdi      # 0xdff0
leaq 0x18c1(%rip), %rsi      # 0xa456
movl $0x13, %edx
callq 0x3240
movq 0x544a(%rip), %rdi      # 0xdff0
callq 0x3120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3260
movq 0x5434(%rip), %rdi      # 0xdff0
leaq 0x1881(%rip), %rsi      # 0xa444
movl $0x11, %edx
callq 0x3240
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x5415(%rip), %rdi      # 0xdff0
callq 0x3240
movq %rax, %rdi
callq 0x3120
jmp 0x8bab
jmp 0x8c3e
jmp 0x8c3e
jmp 0x8c2f
jmp 0x8c3e
movq %rax, %rbx
jmp 0x8c16
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8c16
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3210
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x8c41
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x8c41
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x61e8
jmp 0x8c41
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x3320
movq %rbx, %rdi
callq 0x33e0