// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Dasher.cpp
// Function: Dasher::GoToPoint(Agent&, AtomicAction&, Vector, double, double, bool, bool)
void Dasher::GoToPoint(Agent &agent, AtomicAction &act, Vector target,
                       double buffer, double power, bool can_inverse,
                       bool turn_first) {
  act.Clear();

  const Vector &my_pre_pos = agent.Self().GetPredictedPos(1);
  double dist = my_pre_pos.Dist(target);

  if (dist < buffer) {
    act.mSucceed = true;
    return;
  }
  AngleDeg dirdiff = GetNormalizeAngleDeg((target - my_pre_pos).Dir() -
                                          agent.GetSelf().GetBodyDir());

  if (fabs(dirdiff) < 90.0) {
    can_inverse = false; //不需要倒着跑
  }

  bool inverse = false;
  if (can_inverse) {
    int cycle = CycleNeedToPointWithCertainPosture(agent.Self(), target, true);
    if (cycle < 9 && cycle < CycleNeedToPointWithCertainPosture(
                                 agent.Self(), target, false)) {
      inverse = true;
    }
  }

  GoToPointWithCertainPosture(agent, act, target, buffer, power, inverse,
                              turn_first);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb %r8b, %al
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movsd %xmm2, -0x30(%rbp)
movsd %xmm3, -0x38(%rbp)
andb $0x1, %cl
movb %cl, -0x39(%rbp)
andb $0x1, %al
movb %al, -0x3a(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x28(%rbp), %rdi
callq 0x32480
movq -0x20(%rbp), %rdi
callq 0x1a3d0
movq %rax, %rdi
movl $0x1, %esi
callq 0x11fc0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x1d6d0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2edb5
movq -0x28(%rbp), %rax
movb $0x1, (%rax)
jmp 0x2ef44
movq -0x48(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x110a0
movsd %xmm0, -0x68(%rbp)
movsd %xmm1, -0x60(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x10520
movsd %xmm0, -0xb8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x10590
movq %rax, %rdi
callq 0x11170
movsd -0xb8(%rbp), %xmm0
subsd (%rax), %xmm0
movsd 0x9222e(%rip), %xmm1    # 0xc1030
movsd %xmm1, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x116b0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm1
movaps 0x9223f(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x92213(%rip), %xmm0    # 0xc1040
ucomisd %xmm1, %xmm0
jbe 0x2ee37
movb $0x0, -0x39(%rbp)
movb $0x0, -0x71(%rbp)
testb $0x1, -0x39(%rbp)
je 0x2eeee
movq -0x20(%rbp), %rdi
callq 0x1a3d0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movsd -0x88(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2ef50
movl %eax, -0x78(%rbp)
cmpl $0x9, -0x78(%rbp)
jge 0x2eeec
movl -0x78(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1a3d0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movsd -0x98(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2ef50
movl %eax, %ecx
movl -0xbc(%rbp), %eax
cmpl %ecx, %eax
jge 0x2eeec
movb $0x1, -0x71(%rbp)
jmp 0x2eeee
movq -0xb0(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movsd -0x30(%rbp), %xmm2
movsd -0x38(%rbp), %xmm3
movb -0x71(%rbp), %cl
movb -0x3a(%rbp), %al
movsd -0xa8(%rbp), %xmm0
movsd -0xa0(%rbp), %xmm1
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0x2fc80
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)