// File: harry830622[P]floorplanner/src/floorplanner.cpp
// Function: Floorplanner::SA()
void Floorplanner::SA() {
  const double initial_uphill_probability = 0.99;
  const double r = 0.75;
  const double initial_temperature =
      average_uphill_cost_ / (-1 * log(initial_uphill_probability));
  const int num_perturbations =
      database_.num_macros() * database_.num_macros() * 3;
  const double frozen_temperature = initial_temperature / 1.0e50;
  const double frozen_acceptance_rate = 0.01;
  const double alpha = alpha_;
  const double beta = (1 - alpha);
  const double adaptive_alpha_base = alpha / 4.0;
  const double adaptive_beta_base = beta / 4.0;

  if (is_drawing_) {
    drawing_ = Json::object();
    drawing_["config"] = {{"initialTemperature", initial_temperature},
                          {"r", r},
                          {"numPerturbations", num_perturbations}};
    drawing_["iterations"] = Json::array();
  }

  Floorplan floorplan(best_floorplan_);
  floorplan.Pack(database_);

  if (is_drawing_) {
    drawing_["initialFloorplan"] = floorplan.drawing();
  }

  double adaptive_alpha = adaptive_alpha_base;
  double adaptive_beta = adaptive_beta_base;
  double best_cost = ComputeCost(floorplan, adaptive_alpha, adaptive_beta);
  double last_cost = best_cost;
  double temperature = initial_temperature;
  int nth_iteration = 0;
  while (temperature > frozen_temperature) {
    ++nth_iteration;

    int num_accepted_floorplans = 0;
    int num_feasible_floorplans = 0;

    if (is_drawing_) {
      Json iteration = Json::object();
      iteration["temperature"] = temperature;
      iteration["floorplans"] = Json::array();
      drawing_["iterations"].push_back(iteration);
    }

    for (int i = 0; i < num_perturbations; ++i) {
      Floorplan new_floorplan(floorplan);
      new_floorplan.Perturb(database_);
      new_floorplan.Pack(database_);

      const double cost =
          ComputeCost(new_floorplan, adaptive_alpha, adaptive_beta);
      const double delta_cost = cost - last_cost;
      if (delta_cost < 0) {
        ++num_accepted_floorplans;
        floorplan = new_floorplan;
        last_cost = cost;

        const double outline_width = database_.outline_width();
        const double outline_height = database_.outline_height();
        if (floorplan.width() <= outline_width &&
            floorplan.height() <= outline_height) {
          ++num_feasible_floorplans;
          if (cost < best_cost) {
            best_floorplan_ = floorplan;
            best_cost = cost;
          }
        }

        if (is_drawing_) {
          Json floorplan_drawing = floorplan.drawing();
          floorplan_drawing["isAccepted"] = true;
          floorplan_drawing["cost"] = cost;
          Json& iteration = drawing_["iterations"].back();
          iteration["floorplans"].push_back(floorplan_drawing);
        }
      } else {
        const double p = exp(-1 * delta_cost / temperature);
        if (rand() / static_cast<double>(RAND_MAX) < p) {
          ++num_accepted_floorplans;
          floorplan = new_floorplan;
          last_cost = cost;

          if (is_drawing_) {
            Json floorplan_drawing = floorplan.drawing();
            floorplan_drawing["isAccepted"] = true;
            floorplan_drawing["cost"] = cost;
            Json& iteration = drawing_["iterations"].back();
            iteration["floorplans"].push_back(floorplan_drawing);
          }
        } else {
          if (is_drawing_) {
            Json new_floorplan_drawing = new_floorplan.drawing();
            new_floorplan_drawing["isAccepted"] = false;
            new_floorplan_drawing["cost"] = cost;
            Json& iteration = drawing_["iterations"].back();
            iteration["floorplans"].push_back(new_floorplan_drawing);
          }
        }
      }
    }

    if (is_verbose_) {
      cout << "  nth_iteration: " << nth_iteration << endl;
      cout << "    temperature: " << temperature << endl;
      cout << "    num_accepted_floorplans: " << num_accepted_floorplans
           << endl;
      cout << "    num_feasible_floorplans: " << num_feasible_floorplans
           << endl;
      cout << "    num_perturbations: " << num_perturbations << endl;
      cout << "    adaptive_alpha: " << adaptive_alpha
           << "\tadaptive_beta: " << adaptive_beta << endl;
      cout << "    Best area: " << best_floorplan_.area()
           << "\tBest wirelength: " << best_floorplan_.wirelength() << endl;
    }

    if (num_accepted_floorplans / static_cast<double>(num_perturbations) <
        frozen_acceptance_rate) {
      break;
    }

    adaptive_alpha =
        adaptive_alpha_base +
        (alpha - adaptive_alpha_base) *
            (num_feasible_floorplans / static_cast<double>(num_perturbations));
    adaptive_beta =
        adaptive_beta_base +
        (beta - adaptive_beta_base) *
            (num_feasible_floorplans / static_cast<double>(num_perturbations));

    temperature *= r;

    if (is_drawing_) {
      Json& iteration = drawing_["iterations"].back();
      iteration["numFeasibleFloorplans"] = num_feasible_floorplans;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7d0, %rsp            # imm = 0x7D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x4a8(%rbp)
movsd 0x221ee(%rip), %xmm0    # 0x4b280
movsd %xmm0, -0x10(%rbp)
movsd 0x221e9(%rip), %xmm0    # 0x4b288
movsd %xmm0, -0x18(%rbp)
movsd 0x68(%rax), %xmm0
movsd %xmm0, -0x4b8(%rbp)
movsd 0x221c7(%rip), %xmm0    # 0x4b280
callq 0x93f0
movq -0x4a8(%rbp), %rax
movaps %xmm0, %xmm2
movsd -0x4b8(%rbp), %xmm0
movsd 0x221a0(%rip), %xmm1    # 0x4b278
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movq (%rax), %rdi
callq 0xddf0
movl %eax, %ecx
movq -0x4a8(%rbp), %rax
movl %ecx, -0x4ac(%rbp)
movq (%rax), %rdi
callq 0xddf0
movl -0x4ac(%rbp), %ecx
movl %eax, %edx
movq -0x4a8(%rbp), %rax
imull %edx, %ecx
imull $0x3, %ecx, %ecx
movl %ecx, -0x24(%rbp)
movsd -0x20(%rbp), %xmm0
movsd 0x22147(%rip), %xmm1    # 0x4b270
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x2212e(%rip), %xmm0    # 0x4b268
movsd %xmm0, -0x38(%rbp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x220f7(%rip), %xmm0    # 0x4b248
subsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x40(%rbp), %xmm0
movsd 0x220f8(%rip), %xmm1    # 0x4b260
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x48(%rbp), %xmm0
movsd 0x220e2(%rip), %xmm1    # 0x4b260
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
testb $0x1, 0x31(%rax)
je 0x298d8
leaq -0x78(%rbp), %rdi
callq 0x1bdd0
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x68(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x1bd80
movq -0x4a8(%rbp), %rdi
movq -0x4c0(%rbp), %rsi
addq $0x118, %rdi            # imm = 0x118
callq 0x1c590
movq -0x4c0(%rbp), %rdi
callq 0x1c060
movb $0x1, -0x189(%rbp)
leaq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0x100(%rbp), %rdi
movq %rdi, -0x108(%rbp)
leaq 0x220d5(%rip), %rsi     # 0x4b2d7
callq 0x2c650
jmp 0x29209
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x108(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x2c6a0
leaq -0x100(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq $0x2, -0xd8(%rbp)
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
movl $0x1, %ecx
movl $0x2, %r8d
callq 0x1c180
jmp 0x29260
leaq -0xb8(%rbp), %rax
movq %rax, -0x4c8(%rbp)
movq %rax, -0xd0(%rbp)
leaq -0x148(%rbp), %rdi
movq %rdi, -0x150(%rbp)
leaq 0x21876(%rip), %rsi     # 0x4ab00
callq 0x1ca90
jmp 0x29291
leaq -0x138(%rbp), %rdi
movq %rdi, -0x150(%rbp)
leaq -0x18(%rbp), %rsi
callq 0x2c6a0
movq -0x4c8(%rbp), %rdi
leaq -0x148(%rbp), %rax
movq %rax, -0x128(%rbp)
movq $0x2, -0x120(%rbp)
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
movl $0x1, %ecx
movl $0x2, %r8d
callq 0x1c180
jmp 0x292e8
leaq -0xa8(%rbp), %rax
movq %rax, -0x4d0(%rbp)
movq %rax, -0xd0(%rbp)
leaq -0x180(%rbp), %rdi
movq %rdi, -0x188(%rbp)
leaq 0x21fd8(%rip), %rsi     # 0x4b2ea
callq 0x2c6f0
jmp 0x29319
leaq -0x170(%rbp), %rdi
movq %rdi, -0x188(%rbp)
leaq -0x24(%rbp), %rsi
callq 0x2c740
movq -0x4d0(%rbp), %rdi
leaq -0x180(%rbp), %rax
movq %rax, -0x160(%rbp)
movq $0x2, -0x158(%rbp)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
movl $0x1, %ecx
movl $0x2, %r8d
callq 0x1c180
jmp 0x29370
movb $0x0, -0x189(%rbp)
leaq -0xc8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $0x3, -0x90(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x88(%rbp), %rdi
movl $0x1, %ecx
movl $0x2, %r8d
callq 0x1c180
jmp 0x293b7
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x21f2f(%rip), %rsi     # 0x4b2fb
callq 0x1c390
movq %rax, -0x4d8(%rbp)
jmp 0x293da
movq -0x4d8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1c590
leaq -0x88(%rbp), %rdi
callq 0x1c060
leaq -0xc8(%rbp), %rax
movq %rax, -0x4e8(%rbp)
addq $0x30, %rax
movq %rax, -0x4e0(%rbp)
movq -0x4e0(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x1c060
movq -0x4e8(%rbp), %rcx
movq -0x4f0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4e0(%rbp)
jne 0x29412
leaq -0x180(%rbp), %rax
movq %rax, -0x500(%rbp)
addq $0x20, %rax
movq %rax, -0x4f8(%rbp)
movq -0x4f8(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x508(%rbp)
callq 0x1c060
movq -0x500(%rbp), %rcx
movq -0x508(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4f8(%rbp)
jne 0x2945c
leaq -0x148(%rbp), %rax
movq %rax, -0x518(%rbp)
addq $0x20, %rax
movq %rax, -0x510(%rbp)
movq -0x510(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x520(%rbp)
callq 0x1c060
movq -0x518(%rbp), %rcx
movq -0x520(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x510(%rbp)
jne 0x294a6
leaq -0x100(%rbp), %rax
movq %rax, -0x530(%rbp)
addq $0x20, %rax
movq %rax, -0x528(%rbp)
movq -0x528(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x538(%rbp)
callq 0x1c060
movq -0x530(%rbp), %rcx
movq -0x538(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x528(%rbp)
jne 0x294f0
leaq -0x1b0(%rbp), %rdi
callq 0x1bdd0
movq -0x1b0(%rbp), %rsi
movq -0x1a8(%rbp), %rdx
leaq -0x1a0(%rbp), %rdi
callq 0x1c860
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x21da6(%rip), %rsi     # 0x4b302
callq 0x1c390
movq %rax, -0x540(%rbp)
jmp 0x2956a
movq -0x540(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x1c590
leaq -0x1a0(%rbp), %rdi
callq 0x1c060
jmp 0x298d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
movq -0x108(%rbp), %rax
leaq -0x100(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x548(%rbp)
je 0x295eb
movq -0x548(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x550(%rbp)
callq 0x1c060
movq -0x550(%rbp), %rax
leaq -0x100(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x548(%rbp)
jne 0x295ba
jmp 0x29858
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x2980c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
movq -0x150(%rbp), %rax
leaq -0x148(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x558(%rbp)
je 0x29664
movq -0x558(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x560(%rbp)
callq 0x1c060
movq -0x560(%rbp), %rax
leaq -0x148(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x558(%rbp)
jne 0x29633
jmp 0x2980c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x297c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
movq -0x188(%rbp), %rax
leaq -0x180(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x568(%rbp)
je 0x296dd
movq -0x568(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x570(%rbp)
callq 0x1c060
movq -0x570(%rbp), %rax
leaq -0x180(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x568(%rbp)
jne 0x296ac
jmp 0x297c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x29774
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x29728
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x1c060
leaq -0xc8(%rbp), %rax
movq %rax, -0x580(%rbp)
addq $0x30, %rax
movq %rax, -0x578(%rbp)
movq -0x578(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x588(%rbp)
callq 0x1c060
movq -0x580(%rbp), %rcx
movq -0x588(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x578(%rbp)
jne 0x29741
jmp 0x29774
leaq -0x180(%rbp), %rax
movq %rax, -0x598(%rbp)
addq $0x20, %rax
movq %rax, -0x590(%rbp)
movq -0x590(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x5a0(%rbp)
callq 0x1c060
movq -0x598(%rbp), %rcx
movq -0x5a0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x590(%rbp)
jne 0x2978d
jmp 0x297c0
leaq -0x148(%rbp), %rax
movq %rax, -0x5b0(%rbp)
addq $0x20, %rax
movq %rax, -0x5a8(%rbp)
movq -0x5a8(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x5b8(%rbp)
callq 0x1c060
movq -0x5b0(%rbp), %rcx
movq -0x5b8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x5a8(%rbp)
jne 0x297d9
jmp 0x2980c
leaq -0x100(%rbp), %rax
movq %rax, -0x5c8(%rbp)
addq $0x20, %rax
movq %rax, -0x5c0(%rbp)
movq -0x5c0(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x5d0(%rbp)
callq 0x1c060
movq -0x5c8(%rbp), %rcx
movq -0x5d0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x5c0(%rbp)
jne 0x29825
jmp 0x29858
testb $0x1, -0x189(%rbp)
jne 0x29863
jmp 0x298b0
movq -0xd0(%rbp), %rax
leaq -0xc8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x5d8(%rbp)
je 0x298ae
movq -0x5d8(%rbp), %rdi
addq $-0x10, %rdi
movq %rdi, -0x5e0(%rbp)
callq 0x1c060
movq -0x5e0(%rbp), %rax
leaq -0xc8(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x5d8(%rbp)
jne 0x2987d
jmp 0x298b0
jmp 0x2a8ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x1c060
jmp 0x2a8ba
movq -0x4a8(%rbp), %rsi
addq $0x70, %rsi
leaq -0x258(%rbp), %rdi
movq %rdi, -0x5e8(%rbp)
callq 0x2c3f0
movq -0x4a8(%rbp), %rax
movq -0x5e8(%rbp), %rdi
movq (%rax), %rsi
callq 0x17e90
jmp 0x2990e
movq -0x4a8(%rbp), %rax
testb $0x1, 0x31(%rax)
je 0x299c7
leaq -0x258(%rbp), %rdi
callq 0x16740
movq %rax, -0x5f0(%rbp)
jmp 0x29934
movq -0x5f0(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x22df0
jmp 0x29949
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x219af(%rip), %rsi     # 0x4b30d
callq 0x1c390
movq %rax, -0x5f8(%rbp)
jmp 0x2996c
movq -0x5f8(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x1c590
leaq -0x268(%rbp), %rdi
callq 0x1c060
jmp 0x299c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x2a8ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x1c060
jmp 0x2a8ae
movq -0x4a8(%rbp), %rdi
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x270(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x278(%rbp)
movsd -0x270(%rbp), %xmm0
movsd -0x278(%rbp), %xmm1
leaq -0x258(%rbp), %rsi
callq 0x285e0
movsd %xmm0, -0x600(%rbp)
jmp 0x29a0e
movsd -0x600(%rbp), %xmm0
movsd %xmm0, -0x280(%rbp)
movsd -0x280(%rbp), %xmm0
movsd %xmm0, -0x288(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x290(%rbp)
movl $0x0, -0x294(%rbp)
movsd -0x290(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x2a899
movq -0x4a8(%rbp), %rax
movl -0x294(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x294(%rbp)
movl $0x0, -0x298(%rbp)
movl $0x0, -0x29c(%rbp)
testb $0x1, 0x31(%rax)
je 0x29c1c
leaq -0x2c0(%rbp), %rdi
callq 0x1bdd0
movq -0x2c0(%rbp), %rsi
movq -0x2b8(%rbp), %rdx
leaq -0x2b0(%rbp), %rdi
callq 0x1bd80
jmp 0x29ab4
leaq -0x2d0(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x2c790
leaq 0x21850(%rip), %rsi     # 0x4b31e
leaq -0x2b0(%rbp), %rdi
callq 0x1c390
movq %rax, -0x608(%rbp)
jmp 0x29ae3
movq -0x608(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
movq %rsi, -0x610(%rbp)
callq 0x1c590
movq -0x610(%rbp), %rdi
callq 0x1c060
leaq -0x2f0(%rbp), %rdi
callq 0x1bdd0
movq -0x2f0(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
leaq -0x2e0(%rbp), %rdi
callq 0x1c860
jmp 0x29b31
leaq 0x220d7(%rip), %rsi     # 0x4bc0f
leaq -0x2b0(%rbp), %rdi
callq 0x1c390
movq %rax, -0x618(%rbp)
jmp 0x29b4d
movq -0x618(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
movq %rsi, -0x628(%rbp)
callq 0x1c590
movq -0x628(%rbp), %rdi
callq 0x1c060
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x2177a(%rip), %rsi     # 0x4b302
callq 0x1c390
movq %rax, -0x620(%rbp)
jmp 0x29b96
movq -0x620(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x2c7e0
jmp 0x29bab
leaq -0x2b0(%rbp), %rdi
callq 0x1c060
jmp 0x29c1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x1c060
jmp 0x29c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x29c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x1c060
leaq -0x2b0(%rbp), %rdi
callq 0x1c060
jmp 0x2a8ae
movl $0x0, -0x2f4(%rbp)
movl -0x2f4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x2a461
leaq -0x3a0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x2c3f0
jmp 0x29c4a
movq -0x4a8(%rbp), %rax
movq (%rax), %rsi
leaq -0x3a0(%rbp), %rdi
callq 0x16830
jmp 0x29c62
movq -0x4a8(%rbp), %rax
movq (%rax), %rsi
leaq -0x3a0(%rbp), %rdi
callq 0x17e90
jmp 0x29c7a
movq -0x4a8(%rbp), %rdi
movsd -0x270(%rbp), %xmm0
movsd -0x278(%rbp), %xmm1
leaq -0x3a0(%rbp), %rsi
callq 0x285e0
movsd %xmm0, -0x630(%rbp)
jmp 0x29ca7
movsd -0x630(%rbp), %xmm0
movsd %xmm0, -0x3a8(%rbp)
movsd -0x3a8(%rbp), %xmm0
subsd -0x288(%rbp), %xmm0
movsd %xmm0, -0x3b0(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x3b0(%rbp), %xmm0
jbe 0x2a003
movl -0x298(%rbp), %eax
incl %eax
movl %eax, -0x298(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x2c570
jmp 0x29d03
movq -0x4a8(%rbp), %rax
movsd -0x3a8(%rbp), %xmm0
movsd %xmm0, -0x288(%rbp)
movq (%rax), %rdi
callq 0xdd40
movsd %xmm0, -0x638(%rbp)
jmp 0x29d2c
movq -0x4a8(%rbp), %rax
movsd -0x638(%rbp), %xmm0
movsd %xmm0, -0x3b8(%rbp)
movq (%rax), %rdi
callq 0xdd60
movsd %xmm0, -0x640(%rbp)
jmp 0x29d55
movsd -0x640(%rbp), %xmm0
movsd %xmm0, -0x3c0(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x16780
movsd %xmm0, -0x648(%rbp)
jmp 0x29d7b
movsd -0x648(%rbp), %xmm1
movsd -0x3b8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x29e2a
leaq -0x258(%rbp), %rdi
callq 0x167a0
movsd %xmm0, -0x650(%rbp)
jmp 0x29dab
movsd -0x650(%rbp), %xmm1
movsd -0x3c0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x29e2a
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
movsd -0x3a8(%rbp), %xmm1
movsd -0x280(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x29e28
movq -0x4a8(%rbp), %rdi
addq $0x70, %rdi
leaq -0x258(%rbp), %rsi
callq 0x2c570
jmp 0x29dff
movsd -0x3a8(%rbp), %xmm0
movsd %xmm0, -0x280(%rbp)
jmp 0x29e28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x2a450
jmp 0x29e2a
movq -0x4a8(%rbp), %rax
testb $0x1, 0x31(%rax)
je 0x29ffe
leaq -0x258(%rbp), %rdi
callq 0x16740
movq %rax, -0x658(%rbp)
jmp 0x29e50
movq -0x658(%rbp), %rsi
leaq -0x3d0(%rbp), %rdi
callq 0x22df0
jmp 0x29e65
movb $0x1, -0x3e1(%rbp)
leaq -0x3e0(%rbp), %rdi
leaq -0x3e1(%rbp), %rsi
callq 0x2c930
leaq 0x214a4(%rip), %rsi     # 0x4b32a
leaq -0x3d0(%rbp), %rdi
callq 0x1c390
movq %rax, -0x660(%rbp)
jmp 0x29e9b
movq -0x660(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
movq %rsi, -0x670(%rbp)
callq 0x1c590
movq -0x670(%rbp), %rdi
callq 0x1c060
leaq -0x3f8(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x2c6a0
leaq 0x2145a(%rip), %rsi     # 0x4b335
leaq -0x3d0(%rbp), %rdi
callq 0x1c390
movq %rax, -0x668(%rbp)
jmp 0x29ef0
movq -0x668(%rbp), %rdi
leaq -0x3f8(%rbp), %rsi
movq %rsi, -0x680(%rbp)
callq 0x1c590
movq -0x680(%rbp), %rdi
callq 0x1c060
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x213d7(%rip), %rsi     # 0x4b302
callq 0x1c390
movq %rax, -0x678(%rbp)
jmp 0x29f39
movq -0x678(%rbp), %rdi
callq 0x2c980
movq %rax, -0x688(%rbp)
jmp 0x29f4e
movq -0x688(%rbp), %rax
movq %rax, -0x400(%rbp)
movq -0x400(%rbp), %rdi
leaq 0x21ca5(%rip), %rsi     # 0x4bc0f
callq 0x1c390
movq %rax, -0x690(%rbp)
jmp 0x29f78
movq -0x690(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x2c7e0
jmp 0x29f8d
leaq -0x3d0(%rbp), %rdi
callq 0x1c060
jmp 0x29ffe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x1c060
jmp 0x29fed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x3f8(%rbp), %rdi
callq 0x1c060
jmp 0x29fed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x1c060
jmp 0x2a450
jmp 0x2a430
movsd 0x2126d(%rip), %xmm0    # 0x4b278
mulsd -0x3b0(%rbp), %xmm0
divsd -0x290(%rbp), %xmm0
callq 0x9920
movsd %xmm0, -0x408(%rbp)
callq 0x9150
cvtsi2sd %eax, %xmm1
movsd 0x21257(%rip), %xmm0    # 0x4b290
divsd %xmm0, %xmm1
movsd -0x408(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2a25b
movl -0x298(%rbp), %eax
incl %eax
movl %eax, -0x298(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x2c570
jmp 0x2a072
movq -0x4a8(%rbp), %rax
movsd -0x3a8(%rbp), %xmm0
movsd %xmm0, -0x288(%rbp)
testb $0x1, 0x31(%rax)
je 0x2a256
leaq -0x258(%rbp), %rdi
callq 0x16740
movq %rax, -0x698(%rbp)
jmp 0x2a0a8
movq -0x698(%rbp), %rsi
leaq -0x418(%rbp), %rdi
callq 0x22df0
jmp 0x2a0bd
movb $0x1, -0x429(%rbp)
leaq -0x428(%rbp), %rdi
leaq -0x429(%rbp), %rsi
callq 0x2c930
leaq 0x2124c(%rip), %rsi     # 0x4b32a
leaq -0x418(%rbp), %rdi
callq 0x1c390
movq %rax, -0x6a0(%rbp)
jmp 0x2a0f3
movq -0x6a0(%rbp), %rdi
leaq -0x428(%rbp), %rsi
movq %rsi, -0x6b0(%rbp)
callq 0x1c590
movq -0x6b0(%rbp), %rdi
callq 0x1c060
leaq -0x440(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x2c6a0
leaq 0x21202(%rip), %rsi     # 0x4b335
leaq -0x418(%rbp), %rdi
callq 0x1c390
movq %rax, -0x6a8(%rbp)
jmp 0x2a148
movq -0x6a8(%rbp), %rdi
leaq -0x440(%rbp), %rsi
movq %rsi, -0x6c0(%rbp)
callq 0x1c590
movq -0x6c0(%rbp), %rdi
callq 0x1c060
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x2117f(%rip), %rsi     # 0x4b302
callq 0x1c390
movq %rax, -0x6b8(%rbp)
jmp 0x2a191
movq -0x6b8(%rbp), %rdi
callq 0x2c980
movq %rax, -0x6c8(%rbp)
jmp 0x2a1a6
movq -0x6c8(%rbp), %rax
movq %rax, -0x448(%rbp)
movq -0x448(%rbp), %rdi
leaq 0x21a4d(%rip), %rsi     # 0x4bc0f
callq 0x1c390
movq %rax, -0x6d0(%rbp)
jmp 0x2a1d0
movq -0x6d0(%rbp), %rdi
leaq -0x418(%rbp), %rsi
callq 0x2c7e0
jmp 0x2a1e5
leaq -0x418(%rbp), %rdi
callq 0x1c060
jmp 0x2a256
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x1c060
jmp 0x2a245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x440(%rbp), %rdi
callq 0x1c060
jmp 0x2a245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x418(%rbp), %rdi
callq 0x1c060
jmp 0x2a450
jmp 0x2a42e
movq -0x4a8(%rbp), %rax
testb $0x1, 0x31(%rax)
je 0x2a42c
leaq -0x3a0(%rbp), %rdi
callq 0x16740
movq %rax, -0x6d8(%rbp)
jmp 0x2a281
movq -0x6d8(%rbp), %rsi
leaq -0x458(%rbp), %rdi
callq 0x22df0
jmp 0x2a296
movb $0x0, -0x469(%rbp)
leaq -0x468(%rbp), %rdi
leaq -0x469(%rbp), %rsi
callq 0x2c930
leaq 0x21073(%rip), %rsi     # 0x4b32a
leaq -0x458(%rbp), %rdi
callq 0x1c390
movq %rax, -0x6e0(%rbp)
jmp 0x2a2cc
movq -0x6e0(%rbp), %rdi
leaq -0x468(%rbp), %rsi
movq %rsi, -0x6f0(%rbp)
callq 0x1c590
movq -0x6f0(%rbp), %rdi
callq 0x1c060
leaq -0x480(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x2c6a0
leaq 0x21029(%rip), %rsi     # 0x4b335
leaq -0x458(%rbp), %rdi
callq 0x1c390
movq %rax, -0x6e8(%rbp)
jmp 0x2a321
movq -0x6e8(%rbp), %rdi
leaq -0x480(%rbp), %rsi
movq %rsi, -0x700(%rbp)
callq 0x1c590
movq -0x700(%rbp), %rdi
callq 0x1c060
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x20fa6(%rip), %rsi     # 0x4b302
callq 0x1c390
movq %rax, -0x6f8(%rbp)
jmp 0x2a36a
movq -0x6f8(%rbp), %rdi
callq 0x2c980
movq %rax, -0x708(%rbp)
jmp 0x2a37f
movq -0x708(%rbp), %rax
movq %rax, -0x488(%rbp)
movq -0x488(%rbp), %rdi
leaq 0x21874(%rip), %rsi     # 0x4bc0f
callq 0x1c390
movq %rax, -0x710(%rbp)
jmp 0x2a3a9
movq -0x710(%rbp), %rdi
leaq -0x458(%rbp), %rsi
callq 0x2c7e0
jmp 0x2a3be
leaq -0x458(%rbp), %rdi
callq 0x1c060
jmp 0x2a42c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x1c060
jmp 0x2a41e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x1c060
jmp 0x2a41e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x458(%rbp), %rdi
callq 0x1c060
jmp 0x2a450
jmp 0x2a42e
jmp 0x2a430
leaq -0x3a0(%rbp), %rdi
callq 0x2c510
movl -0x2f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2f4(%rbp)
jmp 0x29c26
leaq -0x3a0(%rbp), %rdi
callq 0x2c510
jmp 0x2a8ae
movq -0x4a8(%rbp), %rax
testb $0x1, 0x30(%rax)
je 0x2a731
movq 0x41b27(%rip), %rdi     # 0x6bfa0
leaq 0x20eba(%rip), %rsi     # 0x4b33a
callq 0x94c0
movq %rax, -0x718(%rbp)
jmp 0x2a48e
movq -0x718(%rbp), %rdi
movl -0x294(%rbp), %esi
callq 0x98c0
movq %rax, -0x720(%rbp)
jmp 0x2a4a9
movq -0x720(%rbp), %rdi
movq 0x41a81(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a4be
movq 0x41adb(%rip), %rdi     # 0x6bfa0
leaq 0x20e80(%rip), %rsi     # 0x4b34c
callq 0x94c0
movq %rax, -0x728(%rbp)
jmp 0x2a4da
movq -0x728(%rbp), %rdi
movsd -0x290(%rbp), %xmm0
callq 0x99a0
movq %rax, -0x730(%rbp)
jmp 0x2a4f7
movq -0x730(%rbp), %rdi
movq 0x41a33(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a50c
movq 0x41a8d(%rip), %rdi     # 0x6bfa0
leaq 0x20e44(%rip), %rsi     # 0x4b35e
callq 0x94c0
movq %rax, -0x738(%rbp)
jmp 0x2a528
movq -0x738(%rbp), %rdi
movl -0x298(%rbp), %esi
callq 0x98c0
movq %rax, -0x740(%rbp)
jmp 0x2a543
movq -0x740(%rbp), %rdi
movq 0x419e7(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a558
movq 0x41a41(%rip), %rdi     # 0x6bfa0
leaq 0x20e16(%rip), %rsi     # 0x4b37c
callq 0x94c0
movq %rax, -0x748(%rbp)
jmp 0x2a574
movq -0x748(%rbp), %rdi
movl -0x29c(%rbp), %esi
callq 0x98c0
movq %rax, -0x750(%rbp)
jmp 0x2a58f
movq -0x750(%rbp), %rdi
movq 0x4199b(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a5a4
movq 0x419f5(%rip), %rdi     # 0x6bfa0
leaq 0x20de8(%rip), %rsi     # 0x4b39a
callq 0x94c0
movq %rax, -0x758(%rbp)
jmp 0x2a5c0
movq -0x758(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x98c0
movq %rax, -0x760(%rbp)
jmp 0x2a5d8
movq -0x760(%rbp), %rdi
movq 0x41952(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a5ed
movq 0x419ac(%rip), %rdi     # 0x6bfa0
leaq 0x20db7(%rip), %rsi     # 0x4b3b2
callq 0x94c0
movq %rax, -0x768(%rbp)
jmp 0x2a609
movq -0x768(%rbp), %rdi
movsd -0x270(%rbp), %xmm0
callq 0x99a0
movq %rax, -0x770(%rbp)
jmp 0x2a626
movq -0x770(%rbp), %rdi
leaq 0x20d93(%rip), %rsi     # 0x4b3c7
callq 0x94c0
movq %rax, -0x778(%rbp)
jmp 0x2a642
movq -0x778(%rbp), %rdi
movsd -0x278(%rbp), %xmm0
callq 0x99a0
movq %rax, -0x780(%rbp)
jmp 0x2a65f
movq -0x780(%rbp), %rdi
movq 0x418cb(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a674
movq 0x41925(%rip), %rdi     # 0x6bfa0
leaq 0x20d56(%rip), %rsi     # 0x4b3d8
callq 0x94c0
movq %rax, -0x788(%rbp)
jmp 0x2a690
movq -0x4a8(%rbp), %rdi
addq $0x70, %rdi
callq 0x167c0
movsd %xmm0, -0x790(%rbp)
jmp 0x2a6aa
movsd -0x790(%rbp), %xmm0
movq -0x788(%rbp), %rdi
callq 0x99a0
movq %rax, -0x798(%rbp)
jmp 0x2a6c7
movq -0x798(%rbp), %rdi
leaq 0x20d13(%rip), %rsi     # 0x4b3e8
callq 0x94c0
movq %rax, -0x7a0(%rbp)
jmp 0x2a6e3
movq -0x4a8(%rbp), %rdi
addq $0x70, %rdi
callq 0x167e0
movsd %xmm0, -0x7a8(%rbp)
jmp 0x2a6fd
movsd -0x7a8(%rbp), %xmm0
movq -0x7a0(%rbp), %rdi
callq 0x99a0
movq %rax, -0x7b0(%rbp)
jmp 0x2a71a
movq -0x7b0(%rbp), %rdi
movq 0x41810(%rip), %rsi     # 0x6bf38
callq 0x9500
jmp 0x2a72f
jmp 0x2a731
cvtsi2sdl -0x298(%rbp), %xmm1
cvtsi2sdl -0x24(%rbp), %xmm0
divsd %xmm0, %xmm1
movsd 0x20b1e(%rip), %xmm0    # 0x4b268
ucomisd %xmm1, %xmm0
jbe 0x2a755
jmp 0x2a899
movq -0x4a8(%rbp), %rax
movsd -0x50(%rbp), %xmm1
movsd -0x40(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
cvtsi2sdl -0x29c(%rbp), %xmm2
cvtsi2sdl -0x24(%rbp), %xmm3
divsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x270(%rbp)
movsd -0x58(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
subsd -0x58(%rbp), %xmm0
cvtsi2sdl -0x29c(%rbp), %xmm2
cvtsi2sdl -0x24(%rbp), %xmm3
divsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x278(%rbp)
movsd 0x20ac4(%rip), %xmm0    # 0x4b288
mulsd -0x290(%rbp), %xmm0
movsd %xmm0, -0x290(%rbp)
testb $0x1, 0x31(%rax)
je 0x2a894
movq -0x4a8(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
leaq 0x20b0f(%rip), %rsi     # 0x4b302
callq 0x1c390
movq %rax, -0x7b8(%rbp)
jmp 0x2a801
movq -0x7b8(%rbp), %rdi
callq 0x2c980
movq %rax, -0x7c0(%rbp)
jmp 0x2a816
movq -0x7c0(%rbp), %rax
movq %rax, -0x490(%rbp)
leaq -0x4a0(%rbp), %rdi
leaq -0x29c(%rbp), %rsi
callq 0x2c9c0
movq -0x490(%rbp), %rdi
leaq 0x20bb6(%rip), %rsi     # 0x4b3fb
callq 0x1c390
movq %rax, -0x7c8(%rbp)
jmp 0x2a853
movq -0x7c8(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
callq 0x1c590
leaq -0x4a0(%rbp), %rdi
callq 0x1c060
jmp 0x2a894
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x4a0(%rbp), %rdi
callq 0x1c060
jmp 0x2a8ae
jmp 0x29a45
leaq -0x258(%rbp), %rdi
callq 0x2c510
addq $0x7d0, %rsp            # imm = 0x7D0
popq %rbp
retq
leaq -0x258(%rbp), %rdi
callq 0x2c510
movq -0x110(%rbp), %rdi
callq 0x98f0
nopw %cs:(%rax,%rax)