// File: /workspace/github_cpp_makefile_star2_O3/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 $0x138, %rsp            # imm = 0x138
movl %r8d, -0x40(%rbp)
movl %ecx, %r13d
movsd %xmm0, -0x30(%rbp)
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
callq 0x2d494
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 0x3a638(%rip), %xmm0    # 0x690a0
divsd 0x3a5d8(%rip), %xmm0    # 0x69048
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), %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, -0x4(%rbx)
movupd %xmm0, 0xc(%rbx)
movupd %xmm0, 0x1c(%rbx)
movupd %xmm0, 0x2c(%rbx)
movupd %xmm0, 0x3c(%rbx)
movl $0x0, 0x4c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x32a30
leal -0x2(%r13), %eax
cmpl $0x3, %eax
movq %r12, -0x48(%rbp)
jae 0x2ebda
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
callq 0x2f29e
leaq -0xf8(%rbp), %r12
movq -0x8(%r12), %rax
movq %rax, -0xa0(%rbp)
movups (%rbx), %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 %rbx, %rdi
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, -0x40(%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 0x2eca6
movq %r13, %rbx
movq 0x8(%rbx), %rdi
addq $0x8, %rbx
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x94e0
cmpq %r14, %rbx
jb 0x2ebbe
jmp 0x2eca6
movl -0x40(%rbp), %eax
cmpl $0x1, %r13d
jne 0x2ecf0
movzbl %al, %ecx
leaq -0x100(%rbp), %rdi
movq %r15, %rsi
movq -0x48(%rbp), %rdx
callq 0x2f0e8
leaq -0xf8(%rbp), %r12
movq -0x8(%r12), %rax
movq %rax, -0xa0(%rbp)
movups (%rbx), %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 %rbx, %rdi
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, -0x40(%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 0x2eca6
movq %r13, %r14
movq 0x8(%r14), %rdi
addq $0x8, %r14
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x94e0
cmpq %rbx, %r14
jb 0x2ec8f
movq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %r13, -0xb0(%rbp)
movq %r12, %rdi
callq 0x32bdc
cmpb $0x0, -0xa0(%rbp)
leaq -0x98(%rbp), %rbx
movq -0x48(%rbp), %r14
jne 0x2f036
jmp 0x2ecf7
movb $0x0, -0xa0(%rbp)
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 0x2ed35
movq %r14, %r13
movq 0x8(%r13), %rdi
addq $0x8, %r13
movl $0x1e0, %esi            # imm = 0x1E0
callq 0x94e0
cmpq %rbx, %r13
jb 0x2ed1e
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %r12, -0x58(%rbp)
movq %r14, -0x50(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0xe8(%rbp)
movupd %xmm0, -0xf8(%rbp)
movq $0x0, -0xd8(%rbp)
movsd 0x2b45b0(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x2b45c0(%r15), %xmm0
movsd %xmm0, -0x140(%rbp)
movsd 0x2b45b8(%r15), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x2b45c8(%r15), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd 0x2b4588(%r15), %xmm0
movsd %xmm0, -0x148(%rbp)
movsd 0x2b4590(%r15), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x2b4598(%r15), %xmm0
movsd %xmm0, -0x138(%rbp)
movsd 0x2b45a0(%r15), %xmm0
movsd %xmm0, -0x150(%rbp)
callq 0x43dce
movsd -0x30(%rbp), %xmm0
addsd -0x140(%rbp), %xmm0
movsd -0x148(%rbp), %xmm1
addsd -0x138(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd -0x38(%rbp), %xmm1
addsd -0x158(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
addsd -0x150(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movq 0x5c38(%rax), %rax
movslq 0x2b4580(%r15), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3080(%rax,%rcx), %xmm1
addsd 0x3b0eb(%rip), %xmm1    # 0x69f50
ucomisd %xmm0, %xmm1
leaq -0x98(%rbp), %rbx
movq -0x48(%rbp), %r14
jbe 0x2ef96
leaq 0x2b45d8(%r15), %r12
movq %r12, %rdi
callq 0xe702
movsd 0x3a1cf(%rip), %xmm1    # 0x69060
ucomisd %xmm0, %xmm1
jbe 0x2eeab
movsd 0x3a1d1(%rip), %xmm2    # 0x69070
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x2ee9f
jmp 0x2eecf
ucomisd 0x3a195(%rip), %xmm0    # 0x69048
jb 0x2eecf
movsd 0x3a1ab(%rip), %xmm1    # 0x69068
movsd 0x3a183(%rip), %xmm2    # 0x69048
addsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jae 0x2eec5
movsd %xmm0, -0xe8(%rbp)
andpd 0x3a131(%rip), %xmm0    # 0x69010
ucomisd 0x3a879(%rip), %xmm0    # 0x69760
jbe 0x2ef01
movl $0x1, -0xfc(%rbp)
movb $0x1, -0x100(%rbp)
movb $0x1, %al
jmp 0x2efe3
leaq 0x2b45b0(%r15), %rcx
leaq 0x2b45c0(%r15), %r8
xorpd %xmm0, %xmm0
movupd %xmm0, (%r12)
movsd 0x2b45b0(%r15), %xmm0
movsd 0x2b45b8(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, 0x2b45d0(%r15)
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x1, %r9d
callq 0x2fe76
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
testb %al, %al
jne 0x2efe3
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x30116
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 0x2f027
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 0x2f036
leaq -0x100(%rbp), %rsi
movq %rbx, %rdi
callq 0x32c42
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 0x2f0a0
leaq -0xa0(%rbp), %rdx
movq %r14, %rsi
callq 0x3032c
movb -0xa0(%rbp), %r14b
movq %rbx, %rdi
callq 0x32bdc
movl %r14d, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2f0d0
jmp 0x2f0d0
jmp 0x2f0d0
jmp 0x2f0d0
jmp 0x2f0d0
jmp 0x2f0d0
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0x32bdc
movq %r14, %rdi
callq 0x98b0
nop