// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x300(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x2f8(%rbp)
movl $0x10, %edi
movl $0x4, %esi
callq 0x6c10
movl %eax, %edi
movl $0x20, %esi
callq 0x6c10
movq -0x2f8(%rbp), %rsi
movl %eax, %edx
leaq -0x218(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x34d0
movq -0x2f0(%rbp), %rdi
callq 0x31b0
movb %al, -0x2e1(%rbp)
jmp 0xec58
movb -0x2e1(%rbp), %al
testb $0x1, %al
jne 0xeccf
jmp 0xec64
movq 0xa385(%rip), %rdi      # 0x18ff0
leaq 0x27a2(%rip), %rsi      # 0x11414
callq 0x3230
movq %rax, -0x308(%rbp)
jmp 0xec80
movq -0x308(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3200
movq %rax, -0x310(%rbp)
jmp 0xec99
movq -0x310(%rbp), %rdi
movq 0xa311(%rip), %rsi      # 0x18fb8
callq 0x3280
jmp 0xecae
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0xf044
movq -0x10(%rbp), %rdi
callq 0xf6c0
movq -0x300(%rbp), %rdi
movl %eax, %edx
leaq -0x218(%rbp), %rsi
callq 0xf060
jmp 0xecef
movl $0x1, -0x228(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf6e0
movq %rax, -0x230(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf740
movq %rax, -0x238(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0xf710
testb $0x1, %al
jne 0xed35
jmp 0xedfd
movq -0x300(%rbp), %rdi
movl -0x228(%rbp), %edx
leaq -0x218(%rbp), %rsi
callq 0xf060
jmp 0xed50
leaq -0x230(%rbp), %rdi
callq 0xf770
movq -0x300(%rbp), %rdi
movzbl 0x98(%rax), %edx
leaq -0x218(%rbp), %rsi
callq 0xf0c0
jmp 0xed78
leaq -0x230(%rbp), %rdi
callq 0xf770
movq -0x300(%rbp), %rdi
movq %rax, %rdx
leaq -0x218(%rbp), %rsi
callq 0xf100
jmp 0xed9c
movl -0x228(%rbp), %eax
movl %eax, -0x31c(%rbp)
incl %eax
movl %eax, -0x228(%rbp)
leaq -0x230(%rbp), %rdi
callq 0xf770
movq -0x300(%rbp), %rdi
movq %rax, %rsi
callq 0xf7a0
movq %rax, -0x318(%rbp)
jmp 0xedd4
movq -0x318(%rbp), %rax
movl -0x31c(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
callq 0xf880
movq %rax, -0x240(%rbp)
jmp 0xed09
movq -0x10(%rbp), %rdi
callq 0xf6e0
movq %rax, -0x248(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf740
movq %rax, -0x250(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0xf710
testb $0x1, %al
jne 0xee39
jmp 0xf021
leaq -0x248(%rbp), %rdi
callq 0xf770
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x2d8(%rbp), %rdi
callq 0x7020
jmp 0xee5a
leaq -0x248(%rbp), %rdi
callq 0xf770
movq -0x300(%rbp), %rdi
movq %rax, %rsi
callq 0xf190
movl %eax, -0x320(%rbp)
jmp 0xee7d
movl -0x320(%rbp), %edx
movq -0x300(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0xf060
jmp 0xee98
movq -0x300(%rbp), %rdi
movl -0x2b4(%rbp), %edx
leaq -0x218(%rbp), %rsi
callq 0xf060
jmp 0xeeb3
movl -0x260(%rbp), %eax
movq %rax, -0x328(%rbp)
subq $0x6, %rax
ja 0xefc0
movq -0x328(%rbp), %rax
leaq 0x2520(%rip), %rcx      # 0x113f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x4350
jmp 0xf044
movq -0x300(%rbp), %rdi
movl -0x258(%rbp), %edx
leaq -0x218(%rbp), %rsi
callq 0xf1c0
jmp 0xef1f
jmp 0xeffb
movq -0x300(%rbp), %rdi
movq -0x258(%rbp), %rdx
leaq -0x218(%rbp), %rsi
callq 0xf1f0
jmp 0xef40
jmp 0xeffb
movq -0x300(%rbp), %rdi
movq -0x258(%rbp), %rdx
leaq -0x218(%rbp), %rsi
callq 0xf2f0
jmp 0xef61
jmp 0xeffb
movq -0x300(%rbp), %rdi
movq -0x258(%rbp), %rdx
leaq -0x218(%rbp), %rsi
callq 0xf3a0
jmp 0xef82
jmp 0xeffb
movq -0x300(%rbp), %rdi
movq -0x258(%rbp), %rdx
leaq -0x218(%rbp), %rsi
callq 0xf3a0
jmp 0xefa0
jmp 0xeffb
movq -0x300(%rbp), %rdi
movq -0x258(%rbp), %rdx
leaq -0x218(%rbp), %rsi
callq 0xf440
jmp 0xefbe
jmp 0xeffb
movq 0xa029(%rip), %rdi      # 0x18ff0
leaq 0x2458(%rip), %rsi      # 0x11426
callq 0x3230
movq %rax, -0x330(%rbp)
jmp 0xefdc
movq -0x330(%rbp), %rdi
movq 0x9fce(%rip), %rsi      # 0x18fb8
callq 0x3280
jmp 0xeff1
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32e0
leaq -0x2d8(%rbp), %rdi
callq 0x4350
leaq -0x248(%rbp), %rdi
xorl %esi, %esi
callq 0xf880
movq %rax, -0x2e0(%rbp)
jmp 0xee0d
leaq -0x218(%rbp), %rdi
callq 0x3390
jmp 0xf02f
leaq -0x218(%rbp), %rdi
callq 0x33d0
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x218(%rbp), %rdi
callq 0x33d0
movq -0x220(%rbp), %rdi
callq 0x3490
nopl (%rax)