// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.cpp
// Function: Kicker::KickBall(Agent&, Vector const&, double, int, bool)
bool Kicker::KickBall(Agent &agent, const Vector &target, double speed_out,
                      int cycle, bool is_shoot) {
  UpdateKickData(agent);

  mKickSpeed = speed_out;
  mKickTarget = (target - mInput.mPlayerPos).Rotate(-mInput.mPlayerBodyDir);

  ActionPlan p;
  switch (cycle) {
  case 1:
    p = OneCycleKick(agent, is_shoot);
    break;
  case 2:
  case 3:
  case 4:
    p = MultiCycleKick(agent, cycle);
    break;
  default:
    p.mSucceed = false;
    break;
  }

  if (p.mSucceed == false) // 后备处理
  {
    p.mActionQueue.clear();
    AtomicAction a;
    a.mSucceed = false;
    if ((mInput.mBallPos + mInput.mBallVel)
            .Dist(mInput.mPlayerPos + mInput.mPlayerVel) <
        PlayerParam::instance()
                .HeteroPlayer(mInput.mPlayerType)
                .kickableArea() -
            0.05) {
      // a.mTurnAngle = mKickTarget.Dir();
      a.mTurnAngle = GetNormalizeAngleDeg(mKickTarget.Dir());
      if (fabs(a.mTurnAngle) > 10) {
        a.mType = CT_Turn;
        a.mSucceed = true;
      } else // try kick to body
      {
        mKickTarget = Vector(0, 0);
        mKickSpeed = mInput.mBallPos.Mod();
        a = GetKickOutAction(agent, mInput.mBallPos, mInput.mBallVel);
      }
    }
    if (a.mSucceed == false) // 实在不行先停球
    {
      a = GetStopBallAction(agent);
    }
    p.mSucceed = a.mSucceed;
    p.mActionQueue.push_back(a);
  }

  if (p.mActionQueue.size() > 0) {
    Execute(agent, p); // 执行动作
  }
  return p.mSucceed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %r8d, %r15d
movl %ecx, %r12d
movsd %xmm0, -0x30(%rbp)
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2703e
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x2b45d0(%r14)
movsd (%r13), %xmm0
movsd 0x8(%r13), %xmm1
subsd 0x2b4588(%r14), %xmm0
subsd 0x2b4590(%r14), %xmm1
leaq -0x150(%rbp), %rdi
movsd %xmm0, (%rdi)
movsd %xmm1, 0x8(%rdi)
movsd 0x2b45a8(%r14), %xmm0
xorpd 0x2ef2a(%rip), %xmm0    # 0x57020
leaq -0x90(%rbp), %rsi
movlpd %xmm0, (%rsi)
callq 0xd02c
movsd %xmm0, 0x2b45d8(%r14)
movsd %xmm1, 0x2b45e0(%r14)
leaq -0x150(%rbp), %rdi
callq 0x2a916
leal -0x2(%r12), %eax
cmpl $0x3, %eax
jae 0x28145
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x28590
jmp 0x28161
cmpl $0x1, %r12d
jne 0x2818f
movzbl %r15b, %ecx
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x28470
leaq -0x150(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x2a92c
leaq -0x88(%rbp), %rdi
callq 0x2b0c6
cmpb $0x0, -0x150(%rbp)
jne 0x28408
jmp 0x28196
movb $0x0, -0x150(%rbp)
leaq -0x148(%rbp), %r15
movq %r15, %rdi
callq 0x2a952
xorpd %xmm0, %xmm0
movupd %xmm0, -0x78(%rbp)
movupd %xmm0, -0x88(%rbp)
andq $0x0, -0x68(%rbp)
movsd 0x2b45b0(%r14), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x2b45c0(%r14), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x2b45b8(%r14), %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd 0x2b45c8(%r14), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd 0x2b4588(%r14), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd 0x2b4590(%r14), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd 0x2b4598(%r14), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd 0x2b45a0(%r14), %xmm0
movsd %xmm0, -0xb0(%rbp)
callq 0x38d94
movsd -0x30(%rbp), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd -0xa8(%rbp), %xmm1
addsd -0x98(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd -0xc8(%rbp), %xmm1
addsd -0xb8(%rbp), %xmm1
movsd -0xc0(%rbp), %xmm2
addsd -0xb0(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movq 0x5c38(%rax), %rax
movslq 0x2b4580(%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3080(%rax,%rcx), %xmm1
addsd 0x2fc50(%rip), %xmm1    # 0x57f10
ucomisd %xmm0, %xmm1
jbe 0x283ae
leaq 0x2b45d8(%r14), %r12
movq %r12, %rdi
callq 0xcd30
movabsq $-0x3f99800000000000, %rax # imm = 0xC066800000000000
leaq -0xf8(%rbp), %rdi
movq %rax, (%rdi)
callq 0xd305
movsd %xmm0, -0x78(%rbp)
andpd 0x2ed11(%rip), %xmm0    # 0x57010
ucomisd 0x2f421(%rip), %xmm0    # 0x57728
jbe 0x28321
movl $0x1, -0x8c(%rbp)
movb $0x1, -0x90(%rbp)
movb $0x1, %al
jmp 0x283f3
leaq 0x2b45b0(%r14), %rcx
leaq 0x2b45c0(%r14), %r8
xorpd %xmm0, %xmm0
movupd %xmm0, (%r12)
movsd 0x2b45b0(%r14), %xmm0
movsd 0x2b45b8(%r14), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, 0x2b45d0(%r14)
leaq -0xf8(%rbp), %rdi
pushq $0x1
popq %r9
movq %r14, %rsi
movq %rbx, %rdx
callq 0x28efa
movupd -0xf8(%rbp), %xmm0
movupd -0xe8(%rbp), %xmm1
movupd -0xd8(%rbp), %xmm2
movapd %xmm2, -0x70(%rbp)
movapd %xmm1, -0x80(%rbp)
movapd %xmm0, -0x90(%rbp)
movb -0x90(%rbp), %al
testb %al, %al
jne 0x283f3
leaq -0xf8(%rbp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
movq %rbx, %rdx
callq 0x29008
movupd -0xf8(%rbp), %xmm0
movupd -0xe8(%rbp), %xmm1
movupd -0xd8(%rbp), %xmm2
movapd %xmm2, -0x70(%rbp)
movapd %xmm1, -0x80(%rbp)
movapd %xmm0, -0x90(%rbp)
movb -0x90(%rbp), %al
movb %al, -0x150(%rbp)
leaq -0x90(%rbp), %rsi
movq %r15, %rdi
callq 0x2a988
leaq -0x148(%rbp), %r14
movq %r14, %rdi
callq 0x2a9c0
testq %rax, %rax
je 0x2842b
leaq -0x150(%rbp), %rdx
movq %rbx, %rsi
callq 0x291e2
movb -0x150(%rbp), %bl
movq %r14, %rdi
callq 0x2b0c6
movl %ebx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x28459
jmp 0x28459
jmp 0x28459
jmp 0x28459
jmp 0x28459
jmp 0x28459
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
callq 0x2b0c6
movq %rbx, %rdi
callq 0x98b0