// File: /workspace/github_cpp_makefile_star2_O1/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, -0x3c(%rbp)
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 0x134ce
movq 0x68(%rax), %rbx
movl $0x1, -0x40(%rbp)
cmpl $0x0, 0x668(%rbx)
jle 0x1f6aa
addq $0x18, %rbx
jmp 0x1f6c8
leaq -0x40(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xf062
movslq (%r12), %rax
shlq $0x4, %rax
addq %rax, %rbx
addq $0x8, %rbx
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
movsd -0x30(%rbp), %xmm3
subsd %xmm3, %xmm0
movsd -0x38(%rbp), %xmm2
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1f6ff
sqrtsd %xmm0, %xmm0
jmp 0x1f70e
callq 0x93c0
movsd -0x30(%rbp), %xmm3
movsd -0x38(%rbp), %xmm2
movsd -0x48(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1f722
movb $0x1, (%r14)
jmp 0x1f88c
movapd %xmm3, %xmm1
subsd (%rbx), %xmm1
movapd %xmm2, %xmm0
subsd 0x8(%rbx), %xmm0
movapd 0x4b8d5(%rip), %xmm2    # 0x6b010
movapd %xmm1, %xmm4
andpd %xmm2, %xmm4
movsd 0x4b8f5(%rip), %xmm3    # 0x6b040
ucomisd %xmm4, %xmm3
jbe 0x1f75f
andpd %xmm0, %xmm2
xorpd %xmm4, %xmm4
ucomisd %xmm2, %xmm3
ja 0x1f778
callq 0x90d0
movapd %xmm0, %xmm4
mulsd 0x4b8d8(%rip), %xmm4    # 0x6b048
divsd 0x4b8d8(%rip), %xmm4    # 0x6b050
movapd %xmm4, -0x70(%rbp)
movq %r15, %rdi
callq 0xe85a
movapd -0x70(%rbp), %xmm2
subsd 0xb0(%rax), %xmm2
movsd 0x4b8c6(%rip), %xmm0    # 0x6b060
ucomisd %xmm2, %xmm0
jbe 0x1f7b4
movsd 0x4b8c8(%rip), %xmm1    # 0x6b070
addsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
ja 0x1f7a8
jmp 0x1f7d8
ucomisd 0x4b88c(%rip), %xmm2    # 0x6b048
jb 0x1f7d8
movsd 0x4b8a2(%rip), %xmm0    # 0x6b068
movsd 0x4b87a(%rip), %xmm1    # 0x6b048
addsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jae 0x1f7ce
andpd 0x4b830(%rip), %xmm2    # 0x6b010
movsd 0x4b8c8(%rip), %xmm0    # 0x6b0b0
ucomisd %xmm2, %xmm0
seta %al
xorb $0x1, %r13b
orb %al, %r13b
jne 0x1f85d
movq %r15, %rdi
callq 0x134ce
xorl %r12d, %r12d
movq %rax, %rsi
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x1f89c
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
cmpl $0x8, %eax
jg 0x1f86a
movl %eax, %ebx
movq %r15, %rdi
callq 0x134ce
movq %rax, %rsi
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1f89c
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
cmpl %eax, %ebx
setl %r12b
jmp 0x1f86a
xorl %r12d, %r12d
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
movzbl %r12b, %ecx
movzbl -0x3c(%rbp), %r8d
movq -0x50(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movsd -0x48(%rbp), %xmm2
movsd -0x58(%rbp), %xmm3
callq 0x201ea
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop