// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.cpp
// Function: Kicker::MultiCycleKick(Agent const&, int)
ActionPlan Kicker::MultiCycleKick(const Agent &agent, int cycle) {
  Assert(cycle > 1);

  UpdateKickData(agent);

  ActionPlan plan;
  AtomicAction act;

  /** 首先考虑能否先转身再踢，可以就不进行后面的搜索了 */
  act = GetTurnAction(agent);
  if (act.mSucceed == true) {
    plan.mCycle = 2;
    plan.mSucceed = true;
    plan.mActionQueue.clear();
    plan.mActionQueue.push_back(act);
    return plan;
  }

  /** 其次考虑能否先停再转身，再踢 */
  double speed_buf = 0.1;
  int index = -1;
  double turn_max_speed = 0.0;
  double turn_poss = 0.0;
  if (cycle >= 3) {
    act = TurnPlan(agent, index, turn_max_speed);
    if (act.mSucceed == true && index >= 0 &&
        turn_max_speed > mKickSpeed + 0.1) {
      turn_poss =
          mPointEva[index] *
          mSpeedCurve.GetOutput(turn_max_speed - mKickSpeed + speed_buf);
      turn_poss *= 1.2; /** 这里要仔细调下 */
    }
  }

  /** 下面进行多脚踢球的规划 */
  // target及mPoint都是在踢球的最后一个周期的坐标系中
  Vector target =
      mKickTarget -
      mInput.mPlayerVel * ((1 - pow(PlayerParam::instance()
                                        .HeteroPlayer(mInput.mPlayerType)
                                        .playerDecay(),
                                    cycle - 1)) /
                           (1 - PlayerParam::instance()
                                    .HeteroPlayer(mInput.mPlayerType)
                                    .playerDecay()));
  int best = -1;
  double poss = 0.0;
  double max_poss = 0.0;

  int idx = (int)GetNormalizeAngleDeg((target - mInput.mBallPos).Dir(),
                                      -FLOAT_EPS); /** 得到0到359的一个整数 */

  if (cycle < 4 && mMaxSpeedFlag[idx][cycle - 1] == mAgentID) {
    best = NearestPoint(mMaxSpeedOutFirstPos[idx][cycle - 1]);

    // std::cerr << agent.GetSelfUnum() << "@" <<
    // agent.GetWorldState().CurrentTime() << ": good" << std::endl;

    if (best >= 0) {
      poss = mPointEva[best] * mSpeedCurve.GetOutput(mMaxSpeed[idx][cycle - 1] -
                                                     mKickSpeed + speed_buf);
    }
  }

  if (poss < 0.001) {
    // std::cerr << agent.GetSelfUnum() << "@" <<
    // agent.GetWorldState().CurrentTime() << ": no good" << std::endl;

    for (int k = 0, v = cycle - 2, j = NearestPoint(mInput.mBallPos);
         k < POINTS_NUM; ++k) {
      int i =
          (int)(GetNormalizeAngleDeg((target - mPoint[k]).Dir(), -FLOAT_EPS) /
                STEP_KICK_ANGLE);
      if (mPointEva[k] > 0.001 &&
          (double)mKickerValue[v][i][j][k] >
              mKickSpeed - speed_buf) // 要大于期望的出球速度
      {
        // mPoint[k]+mInput.mPlayerVel是mPoint[k]在踢球的第一个周期的坐标系中的位置
        Vector ball_vel = (mPoint[k] + mInput.mPlayerVel - mInput.mBallPos) *
                          ServerParam::instance().ballDecay(); // 踢到k后的球速
        double speed = 0.0;

        if (cycle == 2) // 前向搜索1步
        {
          speed = GetOneKickMaxSpeed(ball_vel, (target - mPoint[k]).Dir(),
                                     mMaxAccel[k]);
        } else // 前向搜索2步
        {
          Vector ball_next = mPoint[k] + ball_vel;
          for (int l = 0; l < POINTS_NUM; ++l) // 从j踢到k，再踢到l
          {
            if (mPoint[l].Dist(ball_next) <
                mMaxAccel[k]) // 保证理论上可以从k踢到l
            {
              // mPoint[l]+PlayerVel*Decay是mPoint[l]在踢球的第二个周期的坐标系中的位置
              Vector ball_vel_next =
                  (mPoint[l] +
                   mInput.mPlayerVel * PlayerParam::instance()
                                           .HeteroPlayer(mInput.mPlayerType)
                                           .playerDecay() -
                   mPoint[k]) *
                  ServerParam::instance().ballDecay();
              if (cycle == 3) {
                speed =
                    Max(speed, GetOneKickMaxSpeed(ball_vel_next,
                                                  (target - mPoint[l]).Dir(),
                                                  mMaxAccel[l]));
              } else if (cycle ==
                         4) // 利用mKickerValue[1]的信息，没必要再前向了
              {
                int t = (int)(GetNormalizeAngleDeg((target - mPoint[l]).Dir(),
                                                   -FLOAT_EPS) /
                              STEP_KICK_ANGLE);
                speed = Max(speed, (double)mKickerValue[1][t][k][l]);
              }
            }
          }
        }

        if (speed > mKickSpeed - speed_buf) {
          poss = mPointEva[k] *
                 mSpeedCurve.GetOutput(speed - mKickSpeed + speed_buf);
        } else {
          poss = 0.0;
        }

        if (poss > max_poss) // 找到poss最大的点
        {
          best = k;
          max_poss = poss;
          // max_speed   = speed;
        }
      }
    }
  }

  if (turn_poss > max_poss) // 转身规划的收益较高
  {
    plan.mCycle = 3;
    plan.mSucceed = true;
    plan.mActionQueue.clear();
    plan.mActionQueue.push_back(act);
    return plan;
  }

  // 不进行转身的规划，进行多脚踢球
  plan.mCycle = cycle;
  plan.mSucceed = false;
  if (best >= 0) {
    act = GetOneKickAction(agent, mInput.mBallPos, mInput.mBallVel,
                           mInput.mPlayerVel + mPoint[best]);
    if (act.mSucceed == true) {
      plan.mSucceed = true;
      plan.mActionQueue.clear();
      plan.mActionQueue.push_back(act);
    }
  }
  return plan;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rcx, -0x40(%rbp)
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r12
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x2d494
movb $0x0, (%r12)
leaq 0x8(%r12), %r15
xorpd %xmm0, %xmm0
movupd %xmm0, 0x4(%r12)
movupd %xmm0, 0x14(%r12)
movupd %xmm0, 0x24(%r12)
movupd %xmm0, 0x34(%r12)
movupd %xmm0, 0x44(%r12)
movl $0x0, 0x54(%r12)
movq %r15, %rdi
xorl %esi, %esi
callq 0x32a30
leaq -0x120(%rbp), %rdi
movq %rbx, -0x30(%rbp)
movq %rbx, %rsi
movq %r13, %rdx
callq 0x31532
movupd -0x120(%rbp), %xmm0
movupd -0x110(%rbp), %xmm1
movupd -0x100(%rbp), %xmm2
movapd %xmm2, -0xd0(%rbp)
movapd %xmm1, -0xe0(%rbp)
movapd %xmm0, -0xf0(%rbp)
cmpb $0x1, -0xf0(%rbp)
jne 0x2f39e
movl $0x2, 0x4(%r12)
movb $0x1, (%r12)
movq %r15, %rdi
callq 0x327e2
movq 0x38(%r12), %rax
movq 0x48(%r12), %rcx
addq $-0x30, %rcx
cmpq %rcx, %rax
jne 0x2fdf1
leaq -0xf0(%rbp), %rsi
movq %r15, %rdi
callq 0x32c42
jmp 0x2fe20
cmpl $0x3, -0x40(%rbp)
movq %r15, -0x50(%rbp)
jl 0x2f3eb
leaq -0x120(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq %r13, %rdx
callq 0x31b0c
movupd -0x120(%rbp), %xmm0
movupd -0x110(%rbp), %xmm1
movupd -0x100(%rbp), %xmm2
movapd %xmm2, -0xd0(%rbp)
movapd %xmm1, -0xe0(%rbp)
movapd %xmm0, -0xf0(%rbp)
callq 0x43dce
movq -0x30(%rbp), %r14
movq 0x5c38(%rax), %rax
movslq 0x2b4580(%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3020(%rax,%rcx), %xmm0
movq -0x40(%rbp), %rax
leal -0x1(%rax), %ebx
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
callq 0x98a0
movsd %xmm0, -0x58(%rbp)
callq 0x43dce
movsd 0x39c21(%rip), %xmm0    # 0x69058
movapd %xmm0, %xmm1
subsd -0x58(%rbp), %xmm1
movq 0x5c38(%rax), %rax
movslq 0x2b4580(%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
subsd 0x3020(%rax,%rcx), %xmm0
divsd %xmm0, %xmm1
movsd 0x2b4598(%r14), %xmm0
mulsd %xmm1, %xmm0
mulsd 0x2b45a0(%r14), %xmm1
movsd 0x2b45d8(%r14), %xmm2
subsd %xmm0, %xmm2
movsd 0x2b45e0(%r14), %xmm0
subsd %xmm1, %xmm0
movsd %xmm2, -0x68(%rbp)
movapd %xmm2, %xmm1
subsd 0x2b45b0(%r14), %xmm1
movsd %xmm0, -0x60(%rbp)
movapd %xmm0, %xmm2
subsd 0x2b45b8(%r14), %xmm2
movapd %xmm1, %xmm0
andpd 0x39b4e(%rip), %xmm0    # 0x69010
movsd 0x39b76(%rip), %xmm3    # 0x69040
ucomisd %xmm0, %xmm3
jbe 0x2f4ee
movapd %xmm2, %xmm3
andpd 0x39b34(%rip), %xmm3    # 0x69010
xorpd %xmm0, %xmm0
movsd 0x39b58(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x2f54d
movapd %xmm2, %xmm0
callq 0x90d0
mulsd 0x39b49(%rip), %xmm0    # 0x69048
divsd 0x39b49(%rip), %xmm0    # 0x69050
movsd 0x39b69(%rip), %xmm1    # 0x69078
ucomisd %xmm0, %xmm1
jbe 0x2f529
movsd 0x39b53(%rip), %xmm2    # 0x69070
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x2f51d
jmp 0x2f54d
ucomisd 0x3b3c7(%rip), %xmm0    # 0x6a8f8
jb 0x2f54d
movsd 0x39b2d(%rip), %xmm1    # 0x69068
movsd 0x3b3b5(%rip), %xmm2    # 0x6a8f8
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jae 0x2f543
movq -0x30(%rbp), %rdi
leaq 0x2b45b0(%rdi), %rsi
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
cmpl $0x3, -0x40(%rbp)
movq %rsi, -0x70(%rbp)
jg 0x2f68a
cvttsd2si %xmm0, %eax
cltq
leaq (%rax,%rax,2), %r14
movq %r14, %rax
shlq $0x4, %rax
addq %rdi, %rax
movslq %ebx, %rbx
movq %rbx, %rcx
shlq $0x4, %rcx
movl 0x2b5018(%rcx,%rax), %edx
cmpl 0x8(%rdi), %edx
jne 0x2f68a
movl 0x4(%rdi), %edx
cmpl %edx, 0x2b5014(%rcx,%rax)
jne 0x2f68a
leaq (%rcx,%rax), %rdx
addq $0x2b5010, %rdx         # imm = 0x2B5010
movl (%rdx), %r8d
cmpl (%rdi), %r8d
jne 0x2f68a
movb 0xc(%rdx), %dl
cmpb 0xc(%rdi), %dl
jne 0x2f68a
leaq (%rcx,%rax), %rsi
addq $0x2bf8d0, %rsi         # imm = 0x2BF8D0
movq -0x30(%rbp), %rdi
callq 0x32858
testl %eax, %eax
movl %eax, -0x34(%rbp)
js 0x2f686
movl %eax, %eax
movq -0x30(%rbp), %rdx
leaq (%rdx,%r14,8), %rcx
movsd 0x2b9390(%rcx,%rbx,8), %xmm1
subsd 0x2b45d0(%rdx), %xmm1
addsd 0x3afb0(%rip), %xmm1    # 0x6a5c0
addsd 0x2b4568(%rdx), %xmm1
movsd 0x2b4d80(%rdx,%rax,8), %xmm0
movsd 0x2b4560(%rdx), %xmm2
divsd %xmm1, %xmm2
movsd 0x2b4570(%rdx), %xmm1
addsd 0x2b4558(%rdx), %xmm2
ucomisd %xmm2, %xmm1
movq -0x70(%rbp), %rsi
ja 0x2f661
movq -0x30(%rbp), %rcx
movsd 0x2b4578(%rcx), %xmm3
ucomisd %xmm3, %xmm2
movapd %xmm2, %xmm1
jbe 0x2f661
movapd %xmm3, %xmm1
mulsd %xmm1, %xmm0
movsd 0x3aacb(%rip), %xmm1    # 0x6a138
ucomisd %xmm0, %xmm1
ja 0x2f68a
movq -0x40(%rbp), %rcx
movl %ecx, 0x4(%r12)
movb $0x0, (%r12)
jmp 0x2fd41
movq -0x70(%rbp), %rsi
movq %r13, -0x128(%rbp)
movq %r12, -0xb0(%rbp)
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x32858
movq -0x40(%rbp), %rcx
addl $-0x2, %ecx
leaq 0x48(%rbx), %r15
leaq 0x558(%rbx), %rdx
movslq %ecx, %rcx
cltq
leaq 0x2b4870(%rbx), %rsi
movq %rsi, -0x58(%rbp)
leaq 0xe6fe8(%rbx), %rsi
movq %rsi, -0x130(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x78(%rbp)
xorl %r13d, %r13d
imulq $0xe6a90, %rcx, %rcx    # imm = 0xE6A90
addq %rdx, %rcx
imulq $0x144, %rax, %r12      # imm = 0x144
addq %rcx, %r12
movq %r12, -0x138(%rbp)
movq %r13, %r14
shlq $0x4, %r14
movsd -0x68(%rbp), %xmm1
subsd (%r15,%r14), %xmm1
movsd -0x60(%rbp), %xmm2
subsd 0x8(%r15,%r14), %xmm2
movapd %xmm1, %xmm0
andpd 0x398eb(%rip), %xmm0    # 0x69010
movsd 0x39913(%rip), %xmm3    # 0x69040
ucomisd %xmm0, %xmm3
jbe 0x2f751
movapd %xmm2, %xmm0
andpd 0x398d1(%rip), %xmm0    # 0x69010
movsd 0x398f9(%rip), %xmm3    # 0x69040
ucomisd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ja 0x2f792
movapd %xmm2, %xmm0
callq 0x90d0
mulsd 0x398e6(%rip), %xmm0    # 0x69048
divsd 0x398e6(%rip), %xmm0    # 0x69050
movsd 0x39906(%rip), %xmm1    # 0x69078
ucomisd %xmm0, %xmm1
jbe 0x2f9df
addsd 0x398ec(%rip), %xmm0    # 0x69070
movsd 0x398ec(%rip), %xmm1    # 0x69078
ucomisd %xmm0, %xmm1
ja 0x2f77c
movsd 0x2b4d80(%rbx,%r13,8), %xmm1
ucomisd 0x3a994(%rip), %xmm1    # 0x6a138
jbe 0x2f9cd
divsd 0x39fae(%rip), %xmm0    # 0x69760
cvttsd2si %xmm0, %eax
cltq
imulq $0x6684, %rax, %rax     # imm = 0x6684
addq %r12, %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r13,4), %xmm0
movsd 0x2b45d0(%rbx), %xmm1
addsd 0x3aded(%rip), %xmm1    # 0x6a5c8
ucomisd %xmm1, %xmm0
jbe 0x2f9cd
addq %r15, %r14
movsd (%r14), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd 0x8(%r14), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x2b4598(%rbx), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x2b45a0(%rbx), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x2b45b0(%rbx), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd 0x2b45b8(%rbx), %xmm0
movsd %xmm0, -0x80(%rbp)
callq 0x49360
movsd -0xa0(%rbp), %xmm2
addsd -0x88(%rbp), %xmm2
subsd -0x80(%rbp), %xmm2
movsd -0xa8(%rbp), %xmm1
addsd -0x98(%rbp), %xmm1
subsd -0x90(%rbp), %xmm1
movsd 0x30e0(%rax), %xmm0
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm2
movsd %xmm1, -0x120(%rbp)
movsd %xmm2, -0x118(%rbp)
cmpl $0x2, -0x40(%rbp)
jne 0x2f9f7
movsd -0x68(%rbp), %xmm1
subsd (%r14), %xmm1
movsd -0x60(%rbp), %xmm0
subsd 0x8(%r14), %xmm0
movapd %xmm1, %xmm2
andpd 0x39753(%rip), %xmm2    # 0x69010
movsd 0x3977b(%rip), %xmm3    # 0x69040
ucomisd %xmm2, %xmm3
jbe 0x2f8e9
movapd %xmm0, %xmm3
andpd 0x39739(%rip), %xmm3    # 0x69010
xorpd %xmm2, %xmm2
movsd 0x3975d(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x2f902
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x3974e(%rip), %xmm2    # 0x69048
divsd 0x3974e(%rip), %xmm2    # 0x69050
movsd %xmm2, -0xc0(%rbp)
movq -0x58(%rbp), %rax
leaq (%rax,%r13,8), %rcx
movq %rbx, %rdi
leaq -0x120(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x326fe
movsd %xmm0, -0x48(%rbp)
movq -0x30(%rbp), %rbx
movsd 0x2b45d0(%rbx), %xmm1
movapd %xmm1, %xmm2
addsd 0x3ac83(%rip), %xmm2    # 0x6a5c8
xorpd %xmm0, %xmm0
movsd -0x48(%rbp), %xmm3
ucomisd %xmm2, %xmm3
movq -0x138(%rbp), %r12
jbe 0x2f9b1
subsd %xmm1, %xmm3
addsd 0x3ac59(%rip), %xmm3    # 0x6a5c0
addsd 0x2b4568(%rbx), %xmm3
movsd 0x2b4560(%rbx), %xmm1
divsd %xmm3, %xmm1
movsd 0x2b4570(%rbx), %xmm0
addsd 0x2b4558(%rbx), %xmm1
ucomisd %xmm1, %xmm0
ja 0x2f9a7
movsd 0x2b4578(%rbx), %xmm2
ucomisd %xmm2, %xmm1
movapd %xmm1, %xmm0
jbe 0x2f9a7
movapd %xmm2, %xmm0
mulsd 0x2b4d80(%rbx,%r13,8), %xmm0
movsd -0x78(%rbp), %xmm1
ucomisd %xmm1, %xmm0
movl -0x34(%rbp), %eax
cmoval %r13d, %eax
movl %eax, -0x34(%rbp)
maxsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
incq %r13
cmpq $0x51, %r13
jne 0x2f6fb
jmp 0x2fceb
ucomisd 0x3af11(%rip), %xmm0    # 0x6a8f8
jb 0x2f792
addsd 0x39673(%rip), %xmm0    # 0x69068
jmp 0x2f9df
movapd %xmm1, %xmm0
movapd %xmm2, %xmm1
addsd (%r14), %xmm0
movsd %xmm0, -0xa8(%rbp)
addsd 0x8(%r14), %xmm1
movsd %xmm1, -0xa0(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
imulq $0x144, %r13, %rax      # imm = 0x144
addq -0x130(%rbp), %rax
movq %rax, -0x140(%rbp)
xorl %r12d, %r12d
movq %r12, %rbx
shlq $0x4, %rbx
movsd (%r15,%rbx), %xmm0
subsd -0xa8(%rbp), %xmm0
movsd 0x8(%r15,%rbx), %xmm1
subsd -0xa0(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movq -0x58(%rbp), %rax
movsd (%rax,%r13,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2fcc5
callq 0x43dce
addq %r15, %rbx
movq 0x5c38(%rax), %rax
movq -0x30(%rbp), %rdx
movslq 0x2b4580(%rdx), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x2b4598(%rdx), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd 0x2b45a0(%rdx), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x3020(%rax,%rcx), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd (%rbx), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x8(%rbx), %xmm0
movsd %xmm0, -0x150(%rbp)
movsd (%r14), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x8(%r14), %xmm0
movsd %xmm0, -0x148(%rbp)
callq 0x49360
movsd -0x98(%rbp), %xmm1
movsd -0x158(%rbp), %xmm0
mulsd %xmm0, %xmm1
addsd -0x150(%rbp), %xmm1
subsd -0x148(%rbp), %xmm1
movsd -0x90(%rbp), %xmm2
mulsd %xmm0, %xmm2
addsd -0x88(%rbp), %xmm2
subsd -0x80(%rbp), %xmm2
movsd 0x30e0(%rax), %xmm0
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm1
movsd %xmm2, -0xc0(%rbp)
movsd %xmm1, -0xb8(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x4, %eax
je 0x2fc0e
cmpl $0x3, %eax
jne 0x2fcc5
movsd -0x68(%rbp), %xmm1
subsd (%rbx), %xmm1
movsd -0x60(%rbp), %xmm0
subsd 0x8(%rbx), %xmm0
movapd %xmm1, %xmm2
andpd 0x39473(%rip), %xmm2    # 0x69010
movsd 0x3949b(%rip), %xmm3    # 0x69040
ucomisd %xmm2, %xmm3
jbe 0x2fbc9
movapd %xmm0, %xmm3
andpd 0x39459(%rip), %xmm3    # 0x69010
xorpd %xmm2, %xmm2
movsd 0x3947d(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x2fbe2
callq 0x90d0
movapd %xmm0, %xmm2
mulsd 0x3946e(%rip), %xmm2    # 0x69048
divsd 0x3946e(%rip), %xmm2    # 0x69050
movsd %xmm2, -0x160(%rbp)
movq -0x58(%rbp), %rax
leaq (%rax,%r12,8), %rcx
movq -0x30(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x160(%rbp), %rdx
callq 0x326fe
jmp 0x2fcbb
movsd -0x68(%rbp), %xmm1
subsd (%rbx), %xmm1
movsd -0x60(%rbp), %xmm2
subsd 0x8(%rbx), %xmm2
movapd %xmm1, %xmm0
andpd 0x393e3(%rip), %xmm0    # 0x69010
movsd 0x3940b(%rip), %xmm3    # 0x69040
ucomisd %xmm0, %xmm3
jbe 0x2fc59
movapd %xmm2, %xmm3
andpd 0x393c9(%rip), %xmm3    # 0x69010
xorpd %xmm0, %xmm0
movsd 0x393ed(%rip), %xmm4    # 0x69040
ucomisd %xmm3, %xmm4
ja 0x2fc96
movapd %xmm2, %xmm0
callq 0x90d0
mulsd 0x393de(%rip), %xmm0    # 0x69048
divsd 0x393de(%rip), %xmm0    # 0x69050
movsd 0x393fe(%rip), %xmm1    # 0x69078
ucomisd %xmm0, %xmm1
jbe 0x2fcd7
addsd 0x393e8(%rip), %xmm0    # 0x69070
movsd 0x393e8(%rip), %xmm1    # 0x69078
ucomisd %xmm0, %xmm1
ja 0x2fc80
divsd 0x39ac2(%rip), %xmm0    # 0x69760
cvttsd2si %xmm0, %eax
cltq
imulq $0x6684, %rax, %rax     # imm = 0x6684
addq -0x140(%rbp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r12,4), %xmm0
maxsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
incq %r12
cmpq $0x51, %r12
jne 0x2fa3b
jmp 0x2f92d
ucomisd 0x3ac19(%rip), %xmm0    # 0x6a8f8
jb 0x2fc96
addsd 0x3937f(%rip), %xmm0    # 0x69068
jmp 0x2fcd7
xorpd %xmm0, %xmm0
ucomisd -0x78(%rbp), %xmm0
movq -0x128(%rbp), %r13
jbe 0x2fd1b
movq -0xb0(%rbp), %r12
movl $0x3, 0x4(%r12)
movb $0x1, (%r12)
movq -0x50(%rbp), %r15
jmp 0x2fdd6
movq -0xb0(%rbp), %r12
movq -0x40(%rbp), %rax
movl %eax, 0x4(%r12)
movb $0x0, (%r12)
movl -0x34(%rbp), %eax
testl %eax, %eax
movq -0x50(%rbp), %r15
js 0x2fe20
movl %eax, %eax
shlq $0x4, %rax
movq -0x30(%rbp), %rsi
movsd 0x2b4598(%rsi), %xmm0
movsd 0x2b45a0(%rsi), %xmm1
addsd 0x48(%rsi,%rax), %xmm0
addsd 0x50(%rsi,%rax), %xmm1
leaq 0x2b45c0(%rsi), %r8
leaq -0xc0(%rbp), %r9
movsd %xmm0, (%r9)
movsd %xmm1, 0x8(%r9)
movl $0x1, (%rsp)
leaq -0x120(%rbp), %rdi
movq %r13, %rdx
movq -0x70(%rbp), %rcx
callq 0x30a2c
movupd -0x120(%rbp), %xmm0
movupd -0x110(%rbp), %xmm1
movupd -0x100(%rbp), %xmm2
movapd %xmm2, -0xd0(%rbp)
movapd %xmm1, -0xe0(%rbp)
movapd %xmm0, -0xf0(%rbp)
cmpb $0x1, -0xf0(%rbp)
jne 0x2fe20
movb $0x1, (%r12)
movq %r15, %rdi
callq 0x327e2
movq 0x38(%r12), %rax
movq 0x48(%r12), %rcx
addq $-0x30, %rcx
cmpq %rcx, %rax
je 0x2fe35
leaq 0x38(%r12), %rcx
movapd -0xf0(%rbp), %xmm0
movapd -0xe0(%rbp), %xmm1
movapd -0xd0(%rbp), %xmm2
movupd %xmm2, 0x20(%rax)
movupd %xmm1, 0x10(%rax)
movupd %xmm0, (%rax)
addq $0x30, (%rcx)
movq %r12, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xf0(%rbp), %rsi
movq %r15, %rdi
callq 0x32c42
jmp 0x2fe20
jmp 0x2fe62
jmp 0x2fe62
jmp 0x2fe62
jmp 0x2fe54
jmp 0x2fe62
jmp 0x2fe62
jmp 0x2fe62
movq %r15, -0x50(%rbp)
jmp 0x2fe62
jmp 0x2fe62
jmp 0x2fe62
jmp 0x2fe62
jmp 0x2fe62
movq %rax, %rbx
movq -0x50(%rbp), %rdi
callq 0x32bdc
movq %rbx, %rdi
callq 0x98b0