// File: /workspace/github_cpp_makefile_star2_O3/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 0x19e70(%rip), %rsi     # 0x2232c
leaq 0x19e6a(%rip), %rdx     # 0x2232d
leaq 0x10(%rsp), %rdi
callq 0xa09a
leaq 0x60(%rsp), %rdi
movq %r14, -0x8(%rdi)
leaq 0x18df2(%rip), %rsi     # 0x212cf
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x9b3a
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x8501
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 0xd32(%rip), %rax       # 0x927c
movq %rax, 0x18(%rsi)
leaq 0x10ad(%rip), %rax      # 0x9602
movq %rax, 0x10(%rsi)
callq 0x99be
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x8577
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8592
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6390
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x85bf
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x85ca
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x85ca
movq %rax, %rdi
callq 0x9ab7
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x85fe
movq 0x70(%rsp), %rsi
jmp 0x85f1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x85fe
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
jmp 0x85fe
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6640