// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %r12d
movl %ecx, %r13d
movsd %xmm3, -0x58(%rbp)
movsd %xmm2, -0x48(%rbp)
movsd %xmm1, -0x38(%rbp)
movsd %xmm0, -0x30(%rbp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, -0x50(%rbp)
movb $0x0, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rdx)
movups %xmm0, 0x14(%rdx)
movups %xmm0, 0x20(%rdx)
movq %rsi, %rdi
callq 0x13392
movq 0x68(%rax), %rbx
movl $0x1, -0x3c(%rbp)
movl $0x1, %eax
cmpl $0x0, 0x668(%rbx)
jg 0x1f21b
leaq -0x3c(%rbp), %rsi
movq %rbx, %rdi
callq 0xef58
leaq -0x3c(%rbp), %rax
movslq (%rax), %rax
shlq $0x4, %rax
movsd 0x8(%rbx,%rax), %xmm0
movsd 0x10(%rbx,%rax), %xmm2
movapd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm5
subsd %xmm5, %xmm1
movapd %xmm2, %xmm3
movsd -0x38(%rbp), %xmm4
subsd %xmm4, %xmm3
mulsd %xmm3, %xmm3
mulsd %xmm1, %xmm1
addsd %xmm3, %xmm1
sqrtsd %xmm1, %xmm1
movsd -0x48(%rbp), %xmm3
ucomisd %xmm1, %xmm3
jbe 0x1f269
movb $0x1, (%r14)
jmp 0x1f3d3
movapd %xmm4, %xmm3
movapd %xmm5, %xmm1
subsd %xmm0, %xmm1
movapd %xmm3, %xmm0
subsd %xmm2, %xmm0
movapd 0x49d8b(%rip), %xmm2    # 0x69010
movapd %xmm1, %xmm4
andpd %xmm2, %xmm4
movsd 0x49dab(%rip), %xmm3    # 0x69040
ucomisd %xmm4, %xmm3
jbe 0x1f2a9
andpd %xmm0, %xmm2
xorpd %xmm4, %xmm4
ucomisd %xmm2, %xmm3
ja 0x1f2c2
callq 0x90d0
movapd %xmm0, %xmm4
mulsd 0x49d8e(%rip), %xmm4    # 0x69048
divsd 0x49d8e(%rip), %xmm4    # 0x69050
movapd %xmm4, -0x70(%rbp)
movq %r15, %rdi
callq 0xe75a
movapd -0x70(%rbp), %xmm2
subsd 0xb0(%rax), %xmm2
movsd 0x49d7c(%rip), %xmm0    # 0x69060
ucomisd %xmm2, %xmm0
jbe 0x1f2fe
movsd 0x49d7e(%rip), %xmm1    # 0x69070
addsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
ja 0x1f2f2
jmp 0x1f322
ucomisd 0x49d42(%rip), %xmm2    # 0x69048
jb 0x1f322
movsd 0x49d58(%rip), %xmm0    # 0x69068
movsd 0x49d30(%rip), %xmm1    # 0x69048
addsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jae 0x1f318
andpd 0x49ce6(%rip), %xmm2    # 0x69010
movsd 0x49d7e(%rip), %xmm0    # 0x690b0
ucomisd %xmm2, %xmm0
seta %al
xorb $0x1, %r13b
orb %al, %r13b
jne 0x1f3a7
movq %r15, %rdi
callq 0x13392
xorl %ebx, %ebx
movq %rax, %rsi
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x1f3e2
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
cmpl $0x8, %eax
jg 0x1f3b3
movl %eax, %r13d
movq %r15, %rdi
callq 0x13392
movq %rax, %rsi
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1f3e2
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
cmpl %eax, %r13d
setl %bl
jmp 0x1f3b3
xorl %ebx, %ebx
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movzbl %bl, %ecx
movzbl %r12b, %r8d
movq -0x50(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movsd -0x48(%rbp), %xmm2
movsd -0x58(%rbp), %xmm3
callq 0x1fc94
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq