// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/Strategy.cpp
// Function: Strategy::AdjustTargetForSetplay(Vector)
Vector Strategy::AdjustTargetForSetplay(Vector target) {
  if (mWorldState.GetPlayMode() > PM_Opp_Mode) {
    while (target.Dist(mBallState.GetPos()) <
           ServerParam::instance().offsideKickMargin() + 0.5) {
      target.SetX(target.X() - 0.5);
    }

    if (mWorldState.GetPlayMode() == PM_Opp_Kick_Off) {
      target.SetX(Min(target.X(), -0.1));
    } else if (mWorldState.GetPlayMode() == PM_Opp_Offside_Kick) {
      target.SetX(Min(target.X(), mBallState.GetPos().X() - 0.5));
    } else if (mWorldState.GetPlayMode() == PM_Opp_Goal_Kick) {
      if (ServerParam::instance().oppPenaltyArea().IsWithin(target)) {
        if (mSelfState.GetPos().X() <
            ServerParam::instance().oppPenaltyArea().Left()) {
          if (mSelfState.GetPos().Y() <
              ServerParam::instance().oppPenaltyArea().Top()) {
            target = ServerParam::instance().oppPenaltyArea().TopLeftCorner();
          } else if (mSelfState.GetPos().Y() >
                     ServerParam::instance().oppPenaltyArea().Bottom()) {
            target =
                ServerParam::instance().oppPenaltyArea().BottomLeftCorner();
          } else {
            target.SetX(
                Min(target.X(),
                    ServerParam::instance().oppPenaltyArea().Left() - 0.5));
          }
        } else {
          if (mSelfState.GetPos().Y() <
              ServerParam::instance().oppPenaltyArea().Top()) {
            target.SetY(
                Min(target.Y(),
                    ServerParam::instance().oppPenaltyArea().Top() - 0.5));
          } else if (mSelfState.GetPos().Y() >
                     ServerParam::instance().oppPenaltyArea().Bottom()) {
            target.SetY(
                Max(target.Y(),
                    ServerParam::instance().oppPenaltyArea().Bottom() + 0.5));
          } else {
            target = mSelfState.GetPos(); // do nothing
          }
        }
      }
    }
  }

  return target;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq 0x18(%rdi), %rax
cmpl $0x25, 0x1c(%rax)
jl 0x4c8db
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movsd %xmm0, -0x10(%rbp)
subsd 0x8(%rax), %xmm0
movsd %xmm1, -0x20(%rbp)
subsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x49360
movsd 0x32a8(%rax), %xmm0
addsd 0x1d1ee(%rip), %xmm0    # 0x69878
ucomisd -0x18(%rbp), %xmm0
jbe 0x4c6f3
movsd -0x10(%rbp), %xmm0
addsd 0x1c9ea(%rip), %xmm0    # 0x69088
movsd %xmm0, -0x10(%rbp)
movq 0x20(%rbx), %rax
movsd -0x10(%rbp), %xmm0
subsd 0x8(%rax), %xmm0
movsd -0x20(%rbp), %xmm1
subsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x49360
movsd 0x32a8(%rax), %xmm0
addsd 0x1d193(%rip), %xmm0    # 0x69878
ucomisd -0x18(%rbp), %xmm0
movsd -0x10(%rbp), %xmm0
ja 0x4c696
jmp 0x4c6f8
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movq 0x18(%rbx), %rax
movl 0x1c(%rax), %eax
cmpl $0x2c, %eax
movsd -0x20(%rbp), %xmm1
je 0x4c754
cmpl $0x28, %eax
je 0x4c726
cmpl $0x25, %eax
jne 0x4c8d6
movsd 0x1dea4(%rip), %xmm0    # 0x6a5c8
jmp 0x4c765
callq 0x49360
movsd 0x3850(%rax), %xmm0
addsd 0x1c93d(%rip), %xmm0    # 0x69078
movsd -0x10(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x4c76f
movapd %xmm1, %xmm0
movsd -0x20(%rbp), %xmm1
jmp 0x4c8db
movq 0x20(%rbx), %rax
movsd 0x8(%rax), %xmm0
addsd 0x1c923(%rip), %xmm0    # 0x69088
minsd -0x10(%rbp), %xmm0
jmp 0x4c8db
movsd 0x3858(%rax), %xmm0
addsd 0x1c8c1(%rip), %xmm0    # 0x69040
ucomisd -0x10(%rbp), %xmm0
movsd -0x10(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
jb 0x4c8db
movsd 0x3860(%rax), %xmm0
addsd 0x1c8d4(%rip), %xmm0    # 0x69078
ucomisd %xmm0, %xmm1
jb 0x4c8d6
movsd 0x3868(%rax), %xmm0
addsd 0x1c882(%rip), %xmm0    # 0x69040
ucomisd %xmm1, %xmm0
jb 0x4c8d6
movq 0x28(%rbx), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x49360
movsd 0x3850(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x28(%rbx), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0x49360
movsd -0x30(%rbp), %xmm0
ucomisd -0x18(%rbp), %xmm0
movsd 0x3860(%rax), %xmm0
jbe 0x4c830
ucomisd -0x28(%rbp), %xmm0
jbe 0x4c853
callq 0x49360
movsd 0x3850(%rax), %xmm0
movsd 0x3860(%rax), %xmm1
jmp 0x4c8db
ucomisd -0x28(%rbp), %xmm0
jbe 0x4c896
callq 0x49360
movsd 0x3860(%rax), %xmm0
addsd 0x1c83c(%rip), %xmm0    # 0x69088
minsd -0x20(%rbp), %xmm0
jmp 0x4c8d2
movq 0x28(%rbx), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x49360
movsd 0x3868(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0x49360
movsd -0x18(%rbp), %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x4c8e2
movsd 0x3850(%rax), %xmm0
movsd 0x3868(%rax), %xmm1
jmp 0x4c8db
movq 0x28(%rbx), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
callq 0x49360
movsd -0x18(%rbp), %xmm0
ucomisd 0x3868(%rax), %xmm0
jbe 0x4c8fc
callq 0x49360
movsd 0x3868(%rax), %xmm0
addsd 0x1cfab(%rip), %xmm0    # 0x69878
maxsd -0x20(%rbp), %xmm0
movapd %xmm0, %xmm1
movsd -0x10(%rbp), %xmm0
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movsd 0x3850(%rax), %xmm0
addsd 0x1c796(%rip), %xmm0    # 0x69088
minsd -0x10(%rbp), %xmm0
jmp 0x4c74a
movq 0x28(%rbx), %rax
movsd 0x8(%rax), %xmm0
movsd 0x10(%rax), %xmm1
jmp 0x4c8db