// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.cpp
// Function: Kicker::GetStopBallAction(Agent const&, bool)
AtomicAction Kicker::GetStopBallAction(const Agent &agent, bool forceStop) {
  UpdateKickData(agent);

  int best = -1;
  double speed = 0.0;
  double min_speed = ServerParam::instance().ballSpeedMax();

  for (int i = 0; i < POINTS_NUM; i++) {
    if (mPointEva[i] > FLOAT_EPS) {
      speed = (mInput.mPlayerVel + mPoint[i] - mInput.mBallPos).Mod();
      if (speed < min_speed) /** 找出踢完后球速最小的点 */
      {
        best = i;
        min_speed = speed;
      }
    }
  }

  AtomicAction b;
  if (best >= 0) {
    b = GetOneKickAction(agent, mInput.mBallPos, mInput.mBallVel,
                         mInput.mPlayerVel + mPoint[best]);
  }

  if (b.mSucceed == false && forceStop) {
    b.mType = CT_Kick;
    if (mInput.mBallVel.Mod() > FLOAT_EPS) {
      b.mKickVel = mInput.mBallVel.Rotate(180.0).SetLength(
          ServerParam::instance().maxPower());
      b.mSucceed = true;
    } else {
      b.mKickVel = Vector(0.0, 0.0);
      b.mSucceed = false;
    }
  }
  return b;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x108(%rbp)
movb %cl, %al
movq %rdi, -0x100(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
movq -0x10(%rbp), %rsi
callq 0x50020
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x23d60
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x51, -0x2c(%rbp)
jge 0x53ea5
movq -0xf8(%rbp), %rdi
addq $0x2b4d80, %rdi         # imm = 0x2B4D80
movslq -0x2c(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x568c0
movsd (%rax), %xmm0
movsd 0x6d21b(%rip), %xmm1    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x53e95
movq -0xf8(%rbp), %rdi
movq %rdi, %rax
addq $0x2b4580, %rax         # imm = 0x2B4580
addq $0x18, %rax
movq %rax, -0x110(%rbp)
addq $0x48, %rdi
movslq -0x2c(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x56650
movq -0x110(%rbp), %rdi
movq %rax, %rsi
callq 0x11360
movq -0xf8(%rbp), %rsi
movsd %xmm0, -0x58(%rbp)
movsd %xmm1, -0x50(%rbp)
addq $0x2b4580, %rsi         # imm = 0x2B4580
addq $0x30, %rsi
leaq -0x58(%rbp), %rdi
callq 0x110a0
movsd %xmm0, -0x48(%rbp)
movsd %xmm1, -0x40(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x53e93
movl -0x2c(%rbp), %eax
movl %eax, -0x18(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x53e95
jmp 0x53e97
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x53db8
movq -0x108(%rbp), %rdi
xorl %esi, %esi
callq 0x1d620
cmpl $0x0, -0x18(%rbp)
jl 0x53f93
movq -0xf8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
movq %rdi, %rax
addq $0x2b4580, %rax         # imm = 0x2B4580
addq $0x30, %rax
movq %rax, -0x120(%rbp)
movq %rdi, %rax
addq $0x2b4580, %rax         # imm = 0x2B4580
addq $0x40, %rax
movq %rax, -0x118(%rbp)
movq %rdi, %rax
addq $0x2b4580, %rax         # imm = 0x2B4580
addq $0x18, %rax
movq %rax, -0x130(%rbp)
addq $0x48, %rdi
movslq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0x56650
movq -0x130(%rbp), %rdi
movq %rax, %rsi
callq 0x11360
movq -0xf8(%rbp), %rsi
movq -0x128(%rbp), %rdx
movq -0x120(%rbp), %rcx
movq -0x118(%rbp), %r8
movsd %xmm0, -0xa0(%rbp)
movsd %xmm1, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %r9
movl $0x1, (%rsp)
callq 0x54ac0
movq -0x108(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x30, %edx
callq 0xa4b0
movq -0x108(%rbp), %rax
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x540c9
testb $0x1, -0x11(%rbp)
je 0x540c9
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl $0x6, 0x4(%rax)
addq $0x2b4580, %rdi         # imm = 0x2B4580
addq $0x40, %rdi
callq 0x104e0
movsd 0x6d027(%rip), %xmm1    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x54077
movq -0xf8(%rbp), %rdi
addq $0x2b4580, %rdi         # imm = 0x2B4580
addq $0x40, %rdi
movsd 0x6d023(%rip), %xmm0    # 0xc1028
movsd %xmm0, -0xd0(%rbp)
leaq -0xd0(%rbp), %rsi
callq 0x11110
movsd %xmm0, -0xc8(%rbp)
movsd %xmm1, -0xc0(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x10f10
movq %rax, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x3fcd0
movq -0x108(%rbp), %rax
movsd %xmm0, -0xb8(%rbp)
movsd %xmm1, -0xb0(%rbp)
movq -0xb8(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xb0(%rbp), %rcx
movq %rcx, 0x10(%rax)
movb $0x1, (%rax)
jmp 0x540c7
xorps %xmm0, %xmm0
movsd %xmm0, -0xe8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xf0(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x11a10
movq -0x108(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xd8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movb $0x0, (%rax)
jmp 0x540c9
movq -0x100(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax)