// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/Dasher.cpp
// Function: Dasher::GetBall(Agent&, AtomicAction&, int, bool, bool)
double Dasher::GetBall(Agent &agent, AtomicAction &act, int int_cycle,
                       bool can_inverse, bool turn_first) {
  Assert(int_cycle == -1 || int_cycle >= 0);

  if (int_cycle == -1) {
    double min_diff = HUGE_VALUE;

    const int max_consider_cycle =
        Min(int(MobileState::Predictor::MAX_STEP),
            agent.GetStrategy().GetSureOppInterCycle() - 1);
    for (int i = 0; i <= max_consider_cycle; ++i) {
      Vector target = agent.GetWorldState().GetBall().GetPredictedPos(i);
      double my_cycle =
          RealCycleNeedToPoint(agent.GetSelf(), target, can_inverse);
      double diff = fabs(my_cycle - i + 1.0);

      if (diff < min_diff) {
        min_diff = diff;
        int_cycle = i;
      }
    }
  }

  if (int_cycle == -1) {
    int_cycle = Max(0, agent.GetStrategy().GetMyInterCycle());
  }

  GoToPoint(agent, act,
            agent.GetWorldState().GetBall().GetPredictedPos(int_cycle),
            agent.GetSelf().GetKickableArea() - GETBALL_BUFFER,
            agent.GetSelf().CorrectDashPowerForStamina(
                ServerParam::instance().maxDashPower()),
            can_inverse, turn_first);

  return RealCycleNeedToPoint(
      agent.GetSelf(),
      agent.GetWorldState().GetBall().GetPredictedPos(int_cycle), can_inverse);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, -0x4c(%rbp)
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movzbl %r8b, %eax
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %ecx
jne 0x1c2b1
movq %rbx, -0x58(%rbp)
movq %r15, %rdi
callq 0xdd50
movl 0x80(%rax), %eax
cmpl $0x33, %eax
pushq $0x33
popq %rbx
cmovll %eax, %ebx
xorl %r13d, %r13d
testl %ebx, %ebx
cmovlel %r13d, %ebx
pushq $-0x1
popq %r12
movsd 0x3b549(%rip), %xmm0    # 0x57748
xorpd %xmm1, %xmm1
cmpl %r13d, %ebx
je 0x1c293
movq 0x18(%r15), %rdi
addq $0x30, %rdi
movl %r13d, %esi
movsd %xmm1, -0x48(%rbp)
movsd %xmm0, -0x40(%rbp)
callq 0xd4c0
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movq %r15, %rdi
callq 0xcd42
movq %r14, %rdi
movq %rax, %rsi
movsd -0x38(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movl -0x2c(%rbp), %edx
callq 0x1cd4c
movsd -0x48(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd 0x3adde(%rip), %xmm2    # 0x57048
addsd %xmm2, %xmm0
andpd 0x3ad9a(%rip), %xmm0    # 0x57010
movsd -0x40(%rbp), %xmm3
ucomisd %xmm0, %xmm3
cmoval %r13d, %r12d
minsd %xmm3, %xmm0
addsd %xmm2, %xmm1
incl %r13d
jmp 0x1c203
cmpl $-0x1, %r12d
movq -0x58(%rbp), %rbx
jne 0x1c2b1
movq %r15, %rdi
callq 0xdd50
movl 0x64(%rax), %eax
xorl %r12d, %r12d
testl %eax, %eax
cmovgl %eax, %r12d
movq 0x18(%r15), %rdi
addq $0x30, %rdi
movl %r12d, %esi
callq 0xd4c0
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r15, %rdi
callq 0xcd42
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movsd (%rax), %xmm0
subsd 0x5b227(%rip), %xmm0    # 0x77518
movsd %xmm0, -0x38(%rbp)
movq %r15, %rdi
callq 0xcd42
movq %rax, %r13
callq 0x3db2c
movsd 0x33c0(%rax), %xmm0
movq %r13, %rdi
callq 0x3a8ce
movaps %xmm0, %xmm3
movzbl -0x4c(%rbp), %r8d
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movsd -0x48(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
movl -0x2c(%rbp), %ebx
movl %ebx, %ecx
callq 0x1a7d4
movq %r15, %rdi
callq 0xcd42
movq %rax, %r13
movq 0x18(%r15), %rdi
addq $0x30, %rdi
movl %r12d, %esi
callq 0xd4c0
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cd4c
nop