// File: /workspace/github_cpp_makefile_star2_O1/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 $0x108, %rsp            # imm = 0x108
movl %r8d, -0x48(%rbp)
movl %ecx, %r13d
movsd %xmm0, -0x30(%rbp)
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
callq 0x2de9c
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x2b45d0(%r15)
movsd (%rbx), %xmm0
subsd 0x2b4588(%r15), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x8(%rbx), %xmm0
subsd 0x2b4590(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x2b45a8(%r15), %xmm0
mulsd 0x3bb92(%rip), %xmm0    # 0x6b0a0
divsd 0x3bb32(%rip), %xmm0    # 0x6b048
leaq -0xa0(%rbp), %rbx
leaq -0x100(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x92d0
movsd (%rbx), %xmm0
movsd (%r14), %xmm1
movsd -0x38(%rbp), %xmm3
movapd %xmm3, %xmm2
mulsd %xmm0, %xmm3
movsd -0x30(%rbp), %xmm4
mulsd %xmm4, %xmm0
mulsd %xmm1, %xmm2
subsd %xmm0, %xmm2
mulsd %xmm1, %xmm4
addsd %xmm3, %xmm4
movsd %xmm2, 0x2b45d8(%r15)
movsd %xmm4, 0x2b45e0(%r15)
movb $0x0, (%rbx)
leaq -0x98(%rbp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, -0x4(%rdi)
movupd %xmm0, 0xc(%rdi)
movupd %xmm0, 0x1c(%rdi)
movupd %xmm0, 0x2c(%rdi)
movupd %xmm0, 0x3c(%rdi)
movl $0x0, 0x4c(%rdi)
xorl %esi, %esi
callq 0x338f6
leal -0x2(%r13), %eax
cmpl $0x3, %eax
movq %r12, -0x40(%rbp)
jae 0x2f681
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
callq 0x2fd04
leaq -0xf8(%rbp), %r12
movq -0x8(%r12), %rax
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
movups (%rdi), %xmm0
movaps %xmm0, -0x130(%rbp)
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %r8
movq -0x78(%rbp), %r9
movq -0x70(%rbp), %r13
movupd -0x68(%rbp), %xmm0
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %r14
movl $0xa, %ecx
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movapd -0x130(%rbp), %xmm1
movupd %xmm1, (%r12)
movq %rdx, -0x30(%rbp)
movq %rdx, 0x10(%r12)
movq %r8, -0x38(%rbp)
movq %r8, 0x18(%r12)
movq %r9, -0x48(%rbp)
movq %r9, 0x20(%r12)
movq %r13, 0x28(%r12)
movupd %xmm0, 0x30(%r12)
movq %rax, 0x40(%r12)
movq %r14, 0x48(%r12)
cmpq %r14, %r13
jae 0x2f751
movq %r13, %rbx
movq 0x8(%rbx), %rdi
addq $0x8, %rbx
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x94e0
cmpq %r14, %rbx
jb 0x2f665
jmp 0x2f751
movl -0x48(%rbp), %eax
cmpl $0x1, %r13d
jne 0x2f783
movzbl %al, %ecx
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
movq -0x40(%rbp), %rdx
callq 0x2fb4e
leaq -0xf8(%rbp), %r12
movq -0x8(%r12), %rax
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
movups (%rdi), %xmm0
movaps %xmm0, -0x130(%rbp)
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %r8
movq -0x78(%rbp), %r9
movq -0x70(%rbp), %r13
movupd -0x68(%rbp), %xmm0
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rbx
movl $0xa, %ecx
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movapd -0x130(%rbp), %xmm1
movupd %xmm1, (%r12)
movq %rdx, -0x30(%rbp)
movq %rdx, 0x10(%r12)
movq %r8, -0x38(%rbp)
movq %r8, 0x18(%r12)
movq %r9, -0x48(%rbp)
movq %r9, 0x20(%r12)
movq %r13, 0x28(%r12)
movupd %xmm0, 0x30(%r12)
movq %rax, 0x40(%r12)
movq %rbx, 0x48(%r12)
cmpq %rbx, %r13
jae 0x2f751
movq %r13, %r14
movq 0x8(%r14), %rdi
addq $0x8, %r14
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x94e0
cmpq %rbx, %r14
jb 0x2f73a
movq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %r13, -0xb0(%rbp)
movq %r12, %rdi
callq 0x33aa2
jmp 0x2f78a
movb $0x0, -0xa0(%rbp)
movq -0x40(%rbp), %rbx
cmpb $0x0, -0xa0(%rbp)
jne 0x2fa98
movq -0x88(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x78(%rbp), %r12
movq -0x70(%rbp), %r14
movq -0x50(%rbp), %rbx
cmpq %rbx, %r14
jae 0x2f7d9
movq %r14, %r13
movq 0x8(%r13), %rdi
addq $0x8, %r13
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x94e0
cmpq %rbx, %r13
jb 0x2f7c2
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %r12, -0x58(%rbp)
movq %r14, -0x50(%rbp)
movb $0x0, -0x100(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0xfc(%rbp)
movupd %xmm0, -0xec(%rbp)
movupd %xmm0, -0xe0(%rbp)
movsd 0x2b45b0(%r15), %xmm0
addsd 0x2b45c0(%r15), %xmm0
movsd 0x2b45b8(%r15), %xmm1
addsd 0x2b45c8(%r15), %xmm1
movsd 0x2b4588(%r15), %xmm2
movsd 0x2b4590(%r15), %xmm3
addsd 0x2b4598(%r15), %xmm2
addsd 0x2b45a0(%r15), %xmm3
subsd %xmm2, %xmm0
subsd %xmm3, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2f880
sqrtsd %xmm0, %xmm0
jmp 0x2f885
callq 0x93c0
movsd %xmm0, -0x30(%rbp)
movq -0x40(%rbp), %rbx
callq 0x450ba
movq 0x5c38(%rax), %rax
movslq 0x2b4580(%r15), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3080(%rax,%rcx), %xmm0
addsd 0x3c697(%rip), %xmm0    # 0x6bf50
ucomisd -0x30(%rbp), %xmm0
jbe 0x2f9eb
leaq 0x2b45d8(%r15), %r12
movq %r12, %rdi
callq 0xe804
movsd 0x3b785(%rip), %xmm1    # 0x6b060
ucomisd %xmm0, %xmm1
jbe 0x2f8f5
movsd 0x3b787(%rip), %xmm2    # 0x6b070
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x2f8e9
jmp 0x2f919
ucomisd 0x3b74b(%rip), %xmm0    # 0x6b048
jb 0x2f919
movsd 0x3b761(%rip), %xmm1    # 0x6b068
movsd 0x3b739(%rip), %xmm2    # 0x6b048
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jae 0x2f90f
movsd %xmm0, -0xe8(%rbp)
andpd 0x3b6e7(%rip), %xmm0    # 0x6b010
ucomisd 0x3be2f(%rip), %xmm0    # 0x6b760
jbe 0x2f949
movl $0x1, -0xfc(%rbp)
movb $0x1, -0x100(%rbp)
jmp 0x2f9eb
leaq 0x2b45b0(%r15), %r13
leaq 0x2b45c0(%r15), %r14
xorpd %xmm0, %xmm0
movupd %xmm0, (%r12)
movsd 0x2b45b0(%r15), %xmm0
movsd 0x2b45b8(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2f98f
sqrtsd %xmm0, %xmm0
jmp 0x2f994
callq 0x93c0
movsd %xmm0, 0x2b45d0(%r15)
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
movq %r14, %r8
movl $0x1, %r9d
callq 0x308fc
movupd -0x130(%rbp), %xmm0
movupd -0x120(%rbp), %xmm1
movupd -0x110(%rbp), %xmm2
movapd %xmm2, -0xe0(%rbp)
movapd %xmm1, -0xf0(%rbp)
movapd %xmm0, -0x100(%rbp)
cmpb $0x0, -0x100(%rbp)
jne 0x2fa3b
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x30bc8
movupd -0x130(%rbp), %xmm0
movupd -0x120(%rbp), %xmm1
movupd -0x110(%rbp), %xmm2
movapd %xmm2, -0xe0(%rbp)
movapd %xmm1, -0xf0(%rbp)
movapd %xmm0, -0x100(%rbp)
movb -0x100(%rbp), %al
movb %al, -0xa0(%rbp)
movq -0x68(%rbp), %rax
movq -0x58(%rbp), %rcx
addq $-0x30, %rcx
cmpq %rcx, %rax
je 0x2fa85
movapd -0x100(%rbp), %xmm0
movapd -0xf0(%rbp), %xmm1
movapd -0xe0(%rbp), %xmm2
movupd %xmm2, 0x20(%rax)
movupd %xmm1, 0x10(%rax)
movupd %xmm0, (%rax)
addq $0x30, -0x68(%rbp)
jmp 0x2fa98
leaq -0x100(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x33afc
movq -0x50(%rbp), %rax
movq %rax, %rcx
subq -0x70(%rbp), %rcx
sarq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
leaq (%rcx,%rcx,4), %rax
movq -0x78(%rbp), %rcx
movq -0x68(%rbp), %rdx
subq -0x60(%rbp), %rdx
sarq $0x4, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rsi
leaq (%rsi,%rax,2), %rax
subq -0x88(%rbp), %rcx
sarq $0x4, %rcx
movabsq $0x5555555555555555, %rdx # imm = 0x5555555555555555
imulq %rcx, %rdx
cmpq %rdx, %rax
je 0x2fb02
leaq -0xa0(%rbp), %rdx
movq %rbx, %rsi
callq 0x30e66
movb -0xa0(%rbp), %r14b
leaq -0x98(%rbp), %rdi
callq 0x33aa2
movl %r14d, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2fb36
jmp 0x2fb36
jmp 0x2fb36
jmp 0x2fb36
jmp 0x2fb36
jmp 0x2fb36
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0x33aa2
movq %r14, %rdi
callq 0x98b0
nop