// File: /workspace/github_cpp_makefile_star2_O2/harry830622[P]floorplanner/src/floorplanner.cpp
// Function: Floorplanner::Run()
void Floorplanner::Run() {
  if (sa_mode_ == "classical") {
    int nth_sa = 0;
    do {
      ++nth_sa;
      if (is_verbose_) {
        cout << nth_sa << " th SA" << endl;
      }

      SA();
    } while (best_floorplan_.area() == 0.0);
  } else if (sa_mode_ == "fast") {
    int nth_fsa = 0;
    do {
      ++nth_fsa;
      if (is_verbose_) {
        cout << nth_fsa << " th Fast SA" << endl;
      }

      FastSA();
    } while (best_floorplan_.area() == 0.0);
  } else if (sa_mode_ == "both") {
    Floorplan initial_floorplan(best_floorplan_);

    int nth_sa = 0;
    do {
      ++nth_sa;
      if (is_verbose_) {
        cout << nth_sa << " th SA" << endl;
      }

      SA();
    } while (best_floorplan_.area() == 0.0);
    Floorplan floorplan_sa(best_floorplan_);

    best_floorplan_ = initial_floorplan;
    int nth_fsa = 0;
    do {
      ++nth_fsa;
      if (is_verbose_) {
        cout << nth_fsa << " th Fast SA" << endl;
      }

      FastSA();
    } while (best_floorplan_.area() == 0.0);
    Floorplan floorplan_fsa(best_floorplan_);

    const double beta = 1.0 - alpha_;
    if (ComputeCost(floorplan_sa, alpha_, beta) <
        ComputeCost(floorplan_fsa, alpha_, beta)) {
      best_floorplan_ = floorplan_sa;
    } else {
      best_floorplan_ = floorplan_fsa;
    }
  } else if (sa_mode_ == "fast-5") {
    const int num_fsa = 5;

    Floorplan initial_floorplan(best_floorplan_);
    Floorplan best_floorplan(initial_floorplan);
    int nth_fsa = 0;
    for (int i = 0; i < num_fsa; ++i) {
      ++nth_fsa;

      if (is_verbose_) {
        cout << nth_fsa << " th Fast SA" << endl;
      }

      FastSA();

      if (best_floorplan_.area() != 0.0) {
        const double beta = 1.0 - alpha_;
        if (best_floorplan.area() == 0.0 ||
            ComputeCost(best_floorplan_, alpha_, beta) <
                ComputeCost(best_floorplan, alpha_, beta)) {
          best_floorplan = best_floorplan_;
        }
      }

      best_floorplan_ = initial_floorplan;
    }

    best_floorplan_ = best_floorplan;

    while (best_floorplan_.area() == 0.0) {
      ++nth_fsa;

      if (is_verbose_) {
        cout << nth_fsa << " th Fast SA" << endl;
      }

      FastSA();
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
leaq 0xb7f5(%rip), %rsi      # 0x1b760
movq %r14, %rdi
callq 0x9e55
testb %al, %al
je 0xffd6
leaq 0x70(%rbx), %r14
pushq $0x1
popq %rbp
movq 0x1a01b(%rip), %r15     # 0x29fa0
leaq 0xb7de(%rip), %r12      # 0x1b76a
cmpb $0x1, 0x30(%rbx)
jne 0xffaf
movq %r15, %rdi
movl %ebp, %esi
callq 0x7640
movq %rax, %rdi
movq %r12, %rsi
callq 0x7380
movq %rax, %rdi
callq 0x71c0
movq %rbx, %rdi
callq 0x103a8
movq %r14, %rdi
callq 0xacd8
incl %ebp
ucomisd 0xb727(%rip), %xmm0     # 0x1b6f0
jne 0x102e4
jnp 0xff8c
jmp 0x102e4
leaq 0xb794(%rip), %rsi      # 0x1b771
movq %r14, %rdi
callq 0x9e55
testb %al, %al
je 0x10048
leaq 0x70(%rbx), %r14
pushq $0x1
popq %rbp
movq 0x19fa9(%rip), %r15     # 0x29fa0
leaq 0xb778(%rip), %r12      # 0x1b776
cmpb $0x1, 0x30(%rbx)
jne 0x10021
movq %r15, %rdi
movl %ebp, %esi
callq 0x7640
movq %rax, %rdi
movq %r12, %rsi
callq 0x7380
movq %rax, %rdi
callq 0x71c0
movq %rbx, %rdi
callq 0x11098
movq %r14, %rdi
callq 0xacd8
incl %ebp
ucomisd 0xb6b5(%rip), %xmm0     # 0x1b6f0
jne 0x102e4
jnp 0xfffe
jmp 0x102e4
leaq 0xb733(%rip), %rsi      # 0x1b782
movq %r14, %rdi
callq 0x9e55
testb %al, %al
je 0x101cb
leaq 0x70(%rbx), %r14
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x11ef8
pushq $0x1
popq %rbp
movq 0x19f23(%rip), %r15     # 0x29fa0
leaq 0xb6e6(%rip), %r12      # 0x1b76a
cmpb $0x1, 0x30(%rbx)
jne 0x100a7
movq %r15, %rdi
movl %ebp, %esi
callq 0x7640
movq %rax, %rdi
movq %r12, %rsi
callq 0x7380
movq %rax, %rdi
callq 0x71c0
movq %rbx, %rdi
callq 0x103a8
movq %r14, %rdi
callq 0xacd8
incl %ebp
ucomisd 0xb62f(%rip), %xmm0     # 0x1b6f0
jne 0x100c5
jnp 0x10084
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x11ef8
leaq 0xb8(%rsp), %rsi
movq %r14, %rdi
callq 0x11fee
pushq $0x1
popq %rbp
movq 0x19eb4(%rip), %r15     # 0x29fa0
leaq 0xb683(%rip), %r12      # 0x1b776
cmpb $0x1, 0x30(%rbx)
jne 0x10116
movq %r15, %rdi
movl %ebp, %esi
callq 0x7640
movq %rax, %rdi
movq %r12, %rsi
callq 0x7380
movq %rax, %rdi
callq 0x71c0
movq %rbx, %rdi
callq 0x11098
movq %r14, %rdi
callq 0xacd8
incl %ebp
ucomisd 0xb5c0(%rip), %xmm0     # 0x1b6f0
jne 0x10134
jnp 0x100f3
leaq 0x160(%rsp), %rdi
movq %r14, %rsi
callq 0x11ef8
movsd 0x8(%rbx), %xmm0
movsd 0xb597(%rip), %xmm1     # 0x1b6e8
subsd %xmm0, %xmm1
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movsd %xmm1, (%rsp)
callq 0xfdc6
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rbx), %xmm0
leaq 0x160(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
movsd (%rsp), %xmm1
callq 0xfdc6
ucomisd 0x8(%rsp), %xmm0
cmovaq %r15, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x11fee
leaq 0x160(%rsp), %rdi
callq 0x11fb2
leaq 0x10(%rsp), %rdi
callq 0x11fb2
leaq 0xb8(%rsp), %rdi
callq 0x11fb2
jmp 0x102e4
leaq 0xbd4a(%rip), %rsi      # 0x1bf1c
movq %r14, %rdi
callq 0x9e55
testb %al, %al
je 0x102e4
leaq 0x70(%rbx), %r14
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x11ef8
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x11ef8
pushq $0x1
popq %rbp
leaq 0xb566(%rip), %r12      # 0x1b776
leaq 0x10(%rsp), %r13
leaq 0xb8(%rsp), %r15
cmpl $0x6, %ebp
je 0x102f6
cmpb $0x1, 0x30(%rbx)
jne 0x1024d
movq 0x19d6d(%rip), %rdi     # 0x29fa0
movl %ebp, %esi
callq 0x7640
movq %rax, %rdi
movq %r12, %rsi
callq 0x7380
movq %rax, %rdi
callq 0x71c0
movq %rbx, %rdi
callq 0x11098
movq %r14, %rdi
callq 0xacd8
ucomisd 0xb48b(%rip), %xmm0     # 0x1b6f0
jne 0x10269
jnp 0x102d2
movsd 0xb477(%rip), %xmm0     # 0x1b6e8
subsd 0x8(%rbx), %xmm0
movsd %xmm0, (%rsp)
movq %r13, %rdi
callq 0xacd8
ucomisd 0xb465(%rip), %xmm0     # 0x1b6f0
jne 0x1028f
jnp 0x102c7
movsd 0x8(%rbx), %xmm0
movq %rbx, %rdi
movq %r14, %rsi
movsd (%rsp), %xmm1
callq 0xfdc6
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rbx), %xmm0
movq %rbx, %rdi
movq %r13, %rsi
movsd (%rsp), %xmm1
callq 0xfdc6
ucomisd 0x8(%rsp), %xmm0
jbe 0x102d2
movq %r13, %rdi
movq %r14, %rsi
callq 0x11fee
incl %ebp
movq %r14, %rdi
movq %r15, %rsi
callq 0x11fee
jmp 0x1021d
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x11fee
pushq $0x6
popq %rbp
movq 0x19c93(%rip), %r15     # 0x29fa0
leaq 0xb462(%rip), %r12      # 0x1b776
movq %r14, %rdi
callq 0xacd8
ucomisd 0xb3cc(%rip), %xmm0     # 0x1b6f0
jne 0x101af
jp 0x101af
cmpb $0x1, 0x30(%rbx)
jne 0x10353
movq %r15, %rdi
movl %ebp, %esi
callq 0x7640
movq %rax, %rdi
movq %r12, %rsi
callq 0x7380
movq %rax, %rdi
callq 0x71c0
incl %ebp
movq %rbx, %rdi
callq 0x11098
jmp 0x10314
jmp 0x10381
jmp 0x10390
jmp 0x10381
jmp 0x10381
jmp 0x10390
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x11fb2
jmp 0x10384
jmp 0x10381
jmp 0x10381
jmp 0x10381
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x11fb2
jmp 0x10393
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x11fb2
movq %rbx, %rdi
callq 0x7660