// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rdi, %rbx
leaq 0x139d3(%rip), %rsi     # 0x1c27c
leaq 0x38(%rsp), %rdi
leaq 0xc(%rsp), %r14
movq %r14, %rdx
callq 0x95d4
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %r15, %rsi
callq 0x9610
leaq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x7758
andl $0x0, (%r15)
andl $0x0, 0xc(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, 0x4(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
pushq $0x28
popq %rdi
callq 0x7390
movq %rbx, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
leaq 0x8(%rsp), %rcx
movq %rcx, 0x18(%rax)
leaq 0x4(%rsp), %rcx
movq %rcx, 0x20(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x488(%rip), %rax       # 0x8db6
movq %rax, 0x18(%rsi)
leaq 0x76d(%rip), %rax       # 0x90a6
movq %rax, 0x10(%rsi)
leaq 0x58(%rsp), %rdi
callq 0x9626
leaq 0x10(%rsp), %rdi
callq 0x96d2
leaq 0x60(%rsp), %rdi
callq 0x7758
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x896a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x96d2
leaq 0x60(%rsp), %rdi
jmp 0x8986
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x7758
jmp 0x8990
movq %rax, %rbx
movq %rbx, %rdi
callq 0x7660