// File: /workspace/github_cpp_makefile_star2_O1/harry830622[P]floorplanner/src/database.cpp
// Function: Database::ParseNets(std::istream&)
void Database::ParseNets(istream& net_input) {
  simple_parser::Parser net_parser(net_input, ":");
  int num_nets = 0;
  int nth_net = 0;
  net_parser.Parse([&](const simple_parser::Tokens& tokens) -> bool {
    if (!tokens.empty()) {
      string first_word = tokens[0];
      if (first_word == "NumNets") {
        num_nets = stoi(tokens[1]);
      } else if (first_word == "NetDegree") {
        ++nth_net;
        const int num_terminals = stoi(tokens[1]);
        int nth_terminal = 0;
        vector<int> net_macro_ids;
        vector<Point> net_terminal_coordinates;
        net_parser.Parse([&](const simple_parser::Tokens& tokens) -> bool {
          if (!tokens.empty()) {
            ++nth_terminal;
            const string name = tokens[0];
            if (is_terminal_existed(name)) {
              const int terminal_id = terminal_id_by_name(name);
              net_terminal_coordinates.push_back(
                  terminal(terminal_id).coordinates());
            } else {
              net_macro_ids.push_back(macro_id_by_name(name));
            }
            if (nth_terminal == num_terminals) {
              return false;
            }
          }
          return true;
        });
        nets_.push_back(Net(net_macro_ids, net_terminal_coordinates));
        if (nth_net == num_nets) {
          return false;
        }
      }
    }
    return true;
  });
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1a3e0(%rip), %rsi     # 0x2225c
leaq 0x1a3da(%rip), %rdx     # 0x2225d
leaq 0x10(%rsp), %rdi
callq 0x9a8c
leaq 0x60(%rsp), %rdi
movq %r14, -0x8(%rdi)
leaq 0x19386(%rip), %rsi     # 0x21223
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x94fc
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x7ec1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
xorl %eax, %eax
movl %eax, 0x10(%rsp)
movl %eax, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movl $0x20, %edi
callq 0x6380
movq %r14, (%rax)
leaq 0xc(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x58(%rsp), %rdi
movq %rdi, 0x10(%rax)
movq %rbx, 0x18(%rax)
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xd36(%rip), %rax       # 0x8c40
movq %rax, 0x18(%rsi)
leaq 0x10b1(%rip), %rax      # 0x8fc6
movq %rax, 0x10(%rsi)
callq 0x9380
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x7f37
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7f52
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6390
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x7f7f
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x7f8a
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x7f8a
movq %rax, %rdi
callq 0x9479
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7fbe
movq 0x70(%rsp), %rsi
jmp 0x7fb1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x7fbe
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
jmp 0x7fbe
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6640