// File: /workspace/github_cpp_makefile_star2_O1/harry830622[P]floorplanner/src/database.cpp
// Function: Database::ParseBlocks(std::istream&)
void Database::ParseBlocks(istream& block_input) {
  simple_parser::Parser block_parser(block_input, ":");
  int num_macros = 0;
  int num_terminals = 0;
  int nth_macro = 0;
  int nth_terminal = 0;
  block_parser.Parse([&](const simple_parser::Tokens& tokens) -> bool {
    if (!tokens.empty()) {
      string first_word = tokens[0];
      if (first_word == "Outline") {
        outline_width_ = stod(tokens[1]);
        outline_height_ = stod(tokens[2]);
      } else if (first_word == "NumBlocks") {
        num_macros = stoi(tokens[1]);
      } else if (first_word == "NumTerminals") {
        num_terminals = stoi(tokens[1]);
      } else {
        if (nth_macro < num_macros) {
          ++nth_macro;
          const string macro_name = tokens[0];
          double macro_width = stod(tokens[1]);
          double macro_height = stod(tokens[2]);
          bool is_macro_rotatable = true;
          if (macro_width > outline_width_ || macro_height > outline_height_) {
            swap(macro_width, macro_height);
            is_macro_rotatable = false;
          } else if (macro_width > outline_height_ ||
                     macro_height > outline_width_) {
            is_macro_rotatable = false;
          }
          macros_.push_back(
              Macro(macro_name, macro_width, macro_height, is_macro_rotatable));
          const int macro_id = macros_.size() - 1;
          macro_id_by_name_.insert({macro_name, macro_id});
        } else if (nth_terminal < num_terminals) {
          ++nth_terminal;
          const string terminal_name = tokens[0];
          const double terminal_x = stod(tokens[2]);
          const double terminal_y = stod(tokens[3]);
          terminals_.push_back(Terminal(terminal_name, terminal_x, terminal_y));
          const int terminal_id = terminals_.size() - 1;
          terminal_id_by_name_.insert({terminal_name, terminal_id});
        }
      }
    }
    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 0x1a562(%rip), %rsi     # 0x2225c
leaq 0x1a55c(%rip), %rdx     # 0x2225d
leaq 0x10(%rsp), %rdi
callq 0x9a8c
leaq 0x60(%rsp), %rdi
movq %r14, -0x8(%rdi)
leaq 0x19508(%rip), %rsi     # 0x21223
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x94fc
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x7d3f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
xorl %eax, %eax
movl %eax, 0x10(%rsp)
movl %eax, 0xc(%rsp)
movl %eax, 0x8(%rsp)
movl %eax, 0x4(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movl $0x28, %edi
callq 0x6380
movq %rbx, (%rax)
movq %r14, 0x8(%rax)
leaq 0xc(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x8(%rsp), %rcx
movq %rcx, 0x18(%rax)
leaq 0x4(%rsp), %rcx
movq %rcx, 0x20(%rax)
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x77f(%rip), %rax       # 0x8518
movq %rax, 0x18(%rsi)
leaq 0xe2a(%rip), %rax       # 0x8bce
movq %rax, 0x10(%rsi)
leaq 0x58(%rsp), %rdi
callq 0x9380
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x7dcb
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7de6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6390
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x7e13
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x7e1e
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x7e1e
movq %rax, %rdi
callq 0x9479
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7e52
movq 0x70(%rsp), %rsi
jmp 0x7e45
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x7e52
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
jmp 0x7e52
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6640