// File: /workspace/github_c_makefile_star2_O0/mrkite[P]regs/src/map.cc
// Function: Map::save()
void Map::save() {
  std::map<uint32_t, Field> fields;
  fields[this->org].isOrg = true;
  if (b) {
    fields[b << 16].isB = true;
  }
  for (auto & entryPoint : entryPoints) {
    auto org = entryPoint.org;
    fields[org].isEntry = true;
    if (entryPoint.flags & IsEmu) {
      fields[org].flags += 'e';
    } else {  // only if not emu, otherwise its redundant
      if (entryPoint.flags & IsM8) {
        fields[org].flags += 'm';
      }
      if (entryPoint.flags & IsX8) {
        fields[org].flags += 'x';
      }
    }
  }
  for (auto sym : symbols) {
    fields[sym.first].symbol = sym.second;
  }
  std::vector<Field> outFields;
  for (auto field : fields) {
    field.second.org = field.first;
    outFields.push_back(field.second);
  }
  std::sort(outFields.begin(), outFields.end(), compareFields);
  std::ofstream f(mapname, std::ios::out | std::ios::binary | std::ios::trunc);
  for (auto field : outFields) {
    f << toAddress(field.org);
    if (field.isOrg) {
      f << "!";
    }
    if (field.isB) {
      f << "*";
    }
    if (field.isEntry) {
      f << ":";
    }
    if (!field.flags.empty()) {
      f << field.flags;
    }
    if (!field.symbol.empty()) {
      f << "<" << field.symbol << ">";
    }
    f << std::endl;
  }
  f.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x13f60
movq -0x3e8(%rbp), %rdi
movq -0x3e0(%rbp), %rsi
callq 0x13f80
movq %rax, -0x3d8(%rbp)
jmp 0x13196
movq -0x3e0(%rbp), %rax
movq -0x3d8(%rbp), %rcx
movb $0x1, 0x29(%rcx)
cmpb $0x0, 0x4(%rax)
je 0x131f3
movq -0x3e0(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0x10, %eax
movl %eax, -0x48(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x14060
movq %rax, -0x3f0(%rbp)
jmp 0x131d5
movq -0x3f0(%rbp), %rax
movb $0x1, 0x2a(%rax)
jmp 0x131f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x137f7
movq -0x3e0(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x14140
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x14170
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x141a0
testb $0x1, %al
jne 0x13232
jmp 0x13337
leaq -0x58(%rbp), %rdi
callq 0x141e0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x13f80
movq %rax, -0x3f8(%rbp)
jmp 0x1325e
movq -0x3f8(%rbp), %rax
movb $0x1, 0x28(%rax)
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x132a9
leaq -0x38(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x13f80
movq %rax, -0x400(%rbp)
jmp 0x13290
movq -0x400(%rbp), %rdi
addq $0x8, %rdi
movl $0x65, %esi
callq 0x61f0
jmp 0x132a7
jmp 0x13327
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x132e7
leaq -0x38(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x13f80
movq %rax, -0x408(%rbp)
jmp 0x132ce
movq -0x408(%rbp), %rdi
addq $0x8, %rdi
movl $0x6d, %esi
callq 0x61f0
jmp 0x132e5
jmp 0x132e7
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x13325
leaq -0x38(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x13f80
movq %rax, -0x410(%rbp)
jmp 0x1330c
movq -0x410(%rbp), %rdi
addq $0x8, %rdi
movl $0x78, %esi
callq 0x61f0
jmp 0x13323
jmp 0x13325
jmp 0x13327
jmp 0x13329
leaq -0x58(%rbp), %rdi
callq 0x14200
jmp 0x1321c
movq -0x3e0(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x14220
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0x14250
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x14280
testb $0x1, %al
jne 0x1337c
jmp 0x1340d
leaq -0x80(%rbp), %rdi
callq 0x142b0
movq %rax, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x142d0
jmp 0x13396
leaq -0xa8(%rbp), %rax
movq %rax, -0x420(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x13f80
movq %rax, -0x418(%rbp)
jmp 0x133bd
movq -0x420(%rbp), %rsi
movq -0x418(%rbp), %rdi
addq $0x30, %rdi
callq 0x6060
jmp 0x133d6
leaq -0xb0(%rbp), %rdi
callq 0x8a60
leaq -0x80(%rbp), %rdi
callq 0x14310
jmp 0x13363
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x8a60
jmp 0x137f7
leaq -0xc8(%rbp), %rdi
callq 0x14340
leaq -0x38(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x14360
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x14390
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x143c0
testb $0x1, %al
jne 0x13466
jmp 0x134ec
leaq -0xd8(%rbp), %rdi
callq 0x143f0
movq %rax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x14410
jmp 0x13483
movl -0x138(%rbp), %eax
leaq -0x130(%rbp), %rsi
movl %eax, -0x130(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x14450
jmp 0x134a4
leaq -0x138(%rbp), %rdi
callq 0x144c0
leaq -0xd8(%rbp), %rdi
callq 0x144e0
jmp 0x1344a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x137eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x144c0
jmp 0x137eb
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x428(%rbp)
callq 0x14560
movq -0x428(%rbp), %rdi
movq %rax, -0x140(%rbp)
callq 0x14590
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rdi
movq -0x148(%rbp), %rsi
leaq 0x2e2(%rip), %rdx       # 0x13810
callq 0x14510
jmp 0x13535
movq -0x3e0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x438(%rbp)
movl $0x10, %edi
movl $0x4, %esi
callq 0x122b0
movl %eax, -0x42c(%rbp)
jmp 0x1355e
movl -0x42c(%rbp), %edi
movl $0x20, %esi
callq 0x122b0
movl %eax, -0x43c(%rbp)
jmp 0x13576
movl -0x43c(%rbp), %edx
movq -0x438(%rbp), %rsi
leaq -0x348(%rbp), %rdi
callq 0x65c0
jmp 0x13591
leaq -0xc8(%rbp), %rax
movq %rax, -0x350(%rbp)
movq -0x350(%rbp), %rdi
callq 0x14560
movq %rax, -0x358(%rbp)
movq -0x350(%rbp), %rdi
callq 0x14590
movq %rax, -0x360(%rbp)
leaq -0x358(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x145c0
testb $0x1, %al
jne 0x135e1
jmp 0x137a7
leaq -0x358(%rbp), %rdi
callq 0x14600
movq %rax, %rsi
leaq -0x3b0(%rbp), %rdi
callq 0x14620
jmp 0x135fe
movq -0x3e0(%rbp), %rsi
movl -0x3b0(%rbp), %edx
leaq -0x3d0(%rbp), %rdi
callq 0x13830
jmp 0x13619
leaq -0x348(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x62b0
jmp 0x1362e
leaq -0x3d0(%rbp), %rdi
callq 0x61e0
testb $0x1, -0x387(%rbp)
je 0x13699
leaq 0x27527(%rip), %rsi     # 0x3ab71
leaq -0x348(%rbp), %rdi
callq 0x62f0
jmp 0x13658
jmp 0x13699
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x137df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x13799
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x61e0
jmp 0x13799
testb $0x1, -0x386(%rbp)
je 0x136b9
leaq 0x26c36(%rip), %rsi     # 0x3a2df
leaq -0x348(%rbp), %rdi
callq 0x62f0
jmp 0x136b7
jmp 0x136b9
testb $0x1, -0x388(%rbp)
je 0x136d9
leaq 0x26ea4(%rip), %rsi     # 0x3a56d
leaq -0x348(%rbp), %rdi
callq 0x62f0
jmp 0x136d7
jmp 0x136d9
leaq -0x3b0(%rbp), %rdi
addq $0x8, %rdi
callq 0x6510
testb $0x1, %al
jne 0x13704
leaq -0x3a8(%rbp), %rsi
leaq -0x348(%rbp), %rdi
callq 0x62b0
jmp 0x13702
jmp 0x13704
leaq -0x3b0(%rbp), %rdi
addq $0x30, %rdi
callq 0x6510
testb $0x1, %al
jne 0x13767
leaq 0x26bc2(%rip), %rsi     # 0x3a2e1
leaq -0x348(%rbp), %rdi
callq 0x62f0
movq %rax, -0x448(%rbp)
jmp 0x13734
movq -0x448(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x62b0
movq %rax, -0x450(%rbp)
jmp 0x13750
movq -0x450(%rbp), %rdi
leaq 0x26b85(%rip), %rsi     # 0x3a2e3
callq 0x62f0
jmp 0x13765
jmp 0x13767
movq 0x4383a(%rip), %rsi     # 0x56fa8
leaq -0x348(%rbp), %rdi
callq 0x6330
jmp 0x1377c
leaq -0x3b0(%rbp), %rdi
callq 0x146b0
leaq -0x358(%rbp), %rdi
callq 0x146e0
jmp 0x135c5
leaq -0x3b0(%rbp), %rdi
callq 0x146b0
jmp 0x137df
leaq -0x348(%rbp), %rdi
callq 0x6440
jmp 0x137b5
leaq -0x348(%rbp), %rdi
callq 0x6470
leaq -0xc8(%rbp), %rdi
callq 0x14700
leaq -0x38(%rbp), %rdi
callq 0x14760
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
leaq -0x348(%rbp), %rdi
callq 0x6470
leaq -0xc8(%rbp), %rdi
callq 0x14700
leaq -0x38(%rbp), %rdi
callq 0x14760
movq -0x40(%rbp), %rdi
callq 0x6540
nopl (%rax)