// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorIntercept.cpp
// Function: BehaviorInterceptPlanner::Plan(std::__cxx11::list<ActiveBehavior, std::allocator<ActiveBehavior>>&)
void BehaviorInterceptPlanner::Plan(std::list<ActiveBehavior> &behavior_list) {
  if (mSelfState.IsKickable())
    return;
  PlayMode play_mode = mWorldState.GetPlayMode();
  if (play_mode != PM_Play_On && play_mode != PM_Our_Penalty_Ready &&
      play_mode != PM_Our_Penalty_Taken && play_mode != PM_Opp_Penalty_Taken) {
    return;
  }
  if (!mInterceptInfo.IsPlayerBallInterceptable(mSelfState.GetUnum())) {
    if (mSelfState.IsGoalie()) {
      ActiveBehavior intercept(mAgent, BT_Intercept, BDT_Intercept_Normal);
      Ray a(mBallState.GetPos(), mBallState.GetVel().Dir());
      Line c(ServerParam::instance().ourLeftGoalPost(),
             ServerParam::instance().ourRightGoalPost());
      c.Intersection(a, intercept.mTarget);
      if (intercept.mTarget.Y() <
              ServerParam::instance().ourLeftGoalPost().Y() ||
          intercept.mTarget.Y() >
              ServerParam::instance().ourRightGoalPost().Y()) {
        return;
      } else {
        intercept.mEvaluation =
            Evaluation::instance().EvaluatePosition(intercept.mTarget, true);
        behavior_list.push_back(intercept);
      }
    } else {
      return;
    }
  }

  Rectangular GoalieInterRec = ServerParam::instance().ourGoalArea();
  GoalieInterRec.SetRight(ServerParam::instance().ourPenaltyArea().Right());

  if (mStrategy.GetMyInterCycle() <= mStrategy.GetMinTmInterCycle() &&
      mStrategy.GetMyInterCycle() <= mStrategy.GetSureOppInterCycle() + 1 &&
      (!mSelfState.IsGoalie())) {
    ActiveBehavior intercept(mAgent, BT_Intercept, BDT_Intercept_Normal);

    intercept.mTarget = mStrategy.GetMyInterPos();
    intercept.mEvaluation =
        Evaluation::instance().EvaluatePosition(intercept.mTarget, true);

    behavior_list.push_back(intercept);
  } else if (mPositionInfo.GetClosestOpponentToBall() == 0 ||
             ((mWorldState.GetTeammate(mPositionInfo.GetClosestTeammateToBall())
                   .GetPos() -
               mWorldState.GetOpponent(mPositionInfo.GetClosestOpponentToBall())
                   .GetPos())
                      .Mod() <= 1 &&
              mSelfState.GetUnum() ==
                  mPositionInfo.GetCloseTeammateToBall().at(
                      1))) // 0.4受PlayerSize影响，这里直接使用0.3
  {
    ActiveBehavior intercept(mAgent, BT_Intercept, BDT_Intercept_Normal);
    intercept.mTarget = mStrategy.GetMyInterPos();
    intercept.mEvaluation =
        Evaluation::instance().EvaluatePosition(intercept.mTarget, true);
    behavior_list.push_back(intercept);

  } else if (mSelfState.IsGoalie() &&
             GoalieInterRec.IsWithin(mStrategy.GetMyInterPos())) {
    ActiveBehavior intercept(mAgent, BT_Intercept, BDT_Intercept_Normal);
    intercept.mTarget = mStrategy.GetMyInterPos();
    intercept.mEvaluation =
        Evaluation::instance().EvaluatePosition(intercept.mTarget, true);
    if (mWorldState.GetPlayMode() == PM_Opp_Penalty_Taken) {
      intercept.mEvaluation =
          Evaluation::instance().EvaluatePosition(intercept.mTarget, false);
    }
    behavior_list.push_back(intercept);
  } else if (mSelfState.GetUnum() == mPositionInfo.GetClosestTeammateToBall() &&
             !mSelfState.IsGoalie()) {
    ActiveBehavior intercept(mAgent, BT_Intercept, BDT_Intercept_Normal);
    intercept.mTarget = mStrategy.GetMyInterPos();
    intercept.mEvaluation =
        Evaluation::instance().EvaluatePosition(intercept.mTarget, true);
    behavior_list.push_back(intercept);
  } else if (mPositionInfo.GetClosestTeammateToBall() ==
                 mWorldState.GetTeammateGoalieUnum() &&
             mSelfState.GetUnum() ==
                 mPositionInfo.GetCloseTeammateToBall()[1]) {

    ActiveBehavior intercept(mAgent, BT_Intercept, BDT_Intercept_Normal);
    intercept.mTarget = mStrategy.GetMyInterPos();
    intercept.mEvaluation =
        Evaluation::instance().EvaluatePosition(intercept.mTarget, true);
    behavior_list.push_back(intercept);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x20(%rdi), %rax
cmpb $0x0, 0x128(%rax)
jne 0x1755f
movq %rdi, %r14
movq 0x10(%rdi), %rcx
movl 0x1c(%rcx), %ecx
cmpq $0x33, %rcx
ja 0x1755f
movabsq $0x8000000018002, %rdx  # imm = 0x8000000018002
btq %rcx, %rdx
jae 0x1755f
movq %rsi, %rbx
movq 0x30(%r14), %rdi
movl 0x11c(%rax), %esi
callq 0x177f4
testb %al, %al
je 0x1716b
callq 0x49360
movsd 0x3870(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x3880(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x3888(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x49360
movsd 0x3838(%rax), %xmm0
movq 0x38(%r14), %rdi
movl 0x64(%rdi), %eax
cmpl 0x68(%rdi), %eax
jg 0x17009
movl 0x80(%rdi), %ecx
incl %ecx
cmpl %ecx, %eax
jg 0x17009
movq 0x20(%r14), %rax
cmpb $0x0, 0x175(%rax)
je 0x1749b
movsd %xmm0, -0x38(%rbp)
movq 0x28(%r14), %rdi
callq 0x14f02
testl %eax, %eax
je 0x170cf
movq 0x10(%r14), %r15
movq 0x28(%r14), %rdi
callq 0x13ab2
decl %eax
cltq
imulq $0x178, %rax, %r12      # imm = 0x178
movq 0x10(%r14), %r13
movq 0x28(%r14), %rdi
callq 0x14f02
decl %eax
cltq
imulq $0x178, %rax, %rax      # imm = 0x178
movsd 0xb0(%r15,%r12), %xmm0
movsd 0xb8(%r15,%r12), %xmm1
subsd 0x10d8(%r13,%rax), %xmm0
subsd 0x10e0(%r13,%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x51fc9(%rip), %xmm1    # 0x69058
ucomisd %xmm0, %xmm1
jb 0x17269
movq 0x20(%r14), %rax
movq 0x28(%r14), %rdi
movl 0x11c(%rax), %r15d
callq 0x47a42
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq $0x1, %rdx
jbe 0x17674
cmpl 0x4(%rcx), %r15d
jne 0x17269
movq 0x8(%r14), %rax
leaq -0xc8(%rbp), %r15
movl $0x9, -0x28(%r15)
movq %rax, -0x20(%r15)
xorl %eax, %eax
movq %rax, -0x18(%r15)
movl %eax, -0x10(%r15)
movl %eax, 0x30(%r15)
movq %rax, 0x38(%r15)
movl %eax, 0x40(%r15)
movq %rax, 0x48(%r15)
movl %eax, 0x50(%r15)
movq %rax, 0x58(%r15)
movl %eax, 0x60(%r15)
movq %rax, 0x68(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x8(%r15)
movupd %xmm0, 0x8(%r15)
movupd %xmm0, 0x18(%r15)
movb $0x0, 0x28(%r15)
movl $0x1, 0x70(%r15)
movq %rax, 0x78(%r15)
movq 0x38(%r14), %rdi
callq 0x4c610
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x24814
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2488e
movsd %xmm0, -0x18(%r15)
jmp 0x1752e
movq 0x20(%r14), %rax
cmpb $0x1, 0x175(%rax)
jne 0x1755f
movq 0x8(%r14), %rax
movl $0x9, -0xf0(%rbp)
movq %rax, -0xe8(%rbp)
xorl %eax, %eax
movq %rax, -0xe0(%rbp)
movl %eax, -0xd8(%rbp)
movl %eax, -0x98(%rbp)
movq %rax, -0x90(%rbp)
movl %eax, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movl %eax, -0x78(%rbp)
movq %rax, -0x70(%rbp)
movl %eax, -0x68(%rbp)
movq %rax, -0x60(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xd0(%rbp)
movups %xmm0, -0xc0(%rbp)
movups %xmm0, -0xb0(%rbp)
movb $0x0, -0xa0(%rbp)
movl $0x1, -0x58(%rbp)
movq %rax, -0x50(%rbp)
movq 0x18(%r14), %r15
leaq 0x30(%r15), %rdi
callq 0xe702
movups 0x8(%r15), %xmm1
movaps %xmm1, -0x110(%rbp)
movsd %xmm0, -0x100(%rbp)
callq 0x49360
movq %rax, %r15
callq 0x49360
movsd 0x3910(%r15), %xmm0
movsd 0x3920(%rax), %xmm2
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
andpd 0x51dd2(%rip), %xmm1    # 0x69010
movsd 0x51dfa(%rip), %xmm3    # 0x69040
ucomisd %xmm1, %xmm3
jbe 0x173a3
xorpd 0x51dc8(%rip), %xmm0    # 0x69020
xorpd %xmm2, %xmm2
movsd 0x51df4(%rip), %xmm1    # 0x69058
jmp 0x173d4
movq 0x20(%r14), %rax
cmpb $0x1, 0x175(%rax)
jne 0x17575
movq 0x38(%r14), %rdi
callq 0x4c610
movsd 0x51ded(%rip), %xmm2    # 0x69078
movsd -0x30(%rbp), %xmm3
addsd %xmm2, %xmm3
ucomisd %xmm3, %xmm0
jb 0x17571
movsd 0x51d9a(%rip), %xmm3    # 0x69040
movsd -0x38(%rbp), %xmm4
addsd %xmm3, %xmm4
ucomisd %xmm0, %xmm4
jb 0x17571
movsd -0x48(%rbp), %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
jb 0x17571
movsd -0x40(%rbp), %xmm0
addsd %xmm3, %xmm0
ucomisd %xmm1, %xmm0
jb 0x17571
movq 0x8(%r14), %rax
leaq -0xc8(%rbp), %r15
movl $0x9, -0x28(%r15)
movq %rax, -0x20(%r15)
xorl %eax, %eax
movq %rax, -0x18(%r15)
movl %eax, -0x10(%r15)
movl %eax, 0x30(%r15)
movq %rax, 0x38(%r15)
movl %eax, 0x40(%r15)
movq %rax, 0x48(%r15)
movl %eax, 0x50(%r15)
movq %rax, 0x58(%r15)
movl %eax, 0x60(%r15)
movq %rax, 0x68(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x8(%r15)
movupd %xmm0, 0x8(%r15)
movupd %xmm0, 0x18(%r15)
movb $0x0, 0x28(%r15)
movl $0x1, 0x70(%r15)
movq %rax, 0x78(%r15)
movq 0x38(%r14), %rdi
callq 0x4c610
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x24814
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2488e
movsd %xmm0, -0x18(%r15)
movq 0x10(%r14), %rax
cmpl $0x33, 0x1c(%rax)
jne 0x1752e
callq 0x24814
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2488e
movsd %xmm0, -0xe0(%rbp)
jmp 0x1752e
movsd 0x3928(%rax), %xmm1
movsd 0x3918(%r15), %xmm3
subsd %xmm3, %xmm1
subsd %xmm0, %xmm2
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
subsd %xmm0, %xmm3
movsd 0x51cc8(%rip), %xmm2    # 0x69098
movapd %xmm3, %xmm0
leaq -0x128(%rbp), %rdi
movsd %xmm1, (%rdi)
movsd %xmm2, 0x8(%rdi)
movsd %xmm0, 0x10(%rdi)
leaq -0xc8(%rbp), %r15
leaq -0x110(%rbp), %rsi
movq %r15, %rdx
callq 0x29634
movsd 0x8(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x49360
movsd 0x3918(%rax), %xmm0
ucomisd -0x30(%rbp), %xmm0
ja 0x1755f
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x49360
movsd -0x30(%rbp), %xmm0
ucomisd 0x3928(%rax), %xmm0
ja 0x1755f
callq 0x24814
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2488e
leaq -0xf0(%rbp), %r15
movsd %xmm0, 0x10(%r15)
movl $0xb8, %edi
callq 0x94c0
movq %rax, %r12
leaq 0x10(%rax), %rdi
movl $0xa8, %edx
movq %r15, %rsi
callq 0x93e0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x90b0
incq 0x10(%rbx)
jmp 0x16fa7
movq 0x8(%r14), %rax
leaq -0xc8(%rbp), %r14
movl $0x9, -0x28(%r14)
movq %rax, -0x20(%r14)
xorl %eax, %eax
movq %rax, -0x18(%r14)
movl %eax, -0x10(%r14)
movl %eax, 0x30(%r14)
movq %rax, 0x38(%r14)
movl %eax, 0x40(%r14)
movq %rax, 0x48(%r14)
movl %eax, 0x50(%r14)
movq %rax, 0x58(%r14)
movl %eax, 0x60(%r14)
movq %rax, 0x68(%r14)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x8(%r14)
movupd %xmm0, 0x8(%r14)
movupd %xmm0, 0x18(%r14)
movb $0x0, 0x28(%r14)
movl $0x1, 0x70(%r14)
movq %rax, 0x78(%r14)
callq 0x4c610
movsd %xmm0, (%r14)
movsd %xmm1, 0x8(%r14)
callq 0x24814
movq %rax, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x2488e
movsd %xmm0, -0x18(%r14)
movl $0xb8, %edi
callq 0x94c0
movq %rax, %r14
leaq 0x10(%rax), %rdi
leaq -0xf0(%rbp), %rsi
movl $0xa8, %edx
callq 0x93e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x90b0
incq 0x10(%rbx)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%r14), %rax
movl 0x11c(%rax), %r15d
movq 0x28(%r14), %rdi
callq 0x13ab2
cmpl %eax, %r15d
jne 0x17597
movq 0x20(%r14), %rax
cmpb $0x0, 0x175(%rax)
je 0x175c9
movq 0x28(%r14), %rdi
callq 0x13ab2
movq 0x10(%r14), %rcx
cmpl 0x2110(%rcx), %eax
jne 0x1755f
movq 0x20(%r14), %rax
movq 0x28(%r14), %rdi
movl 0x11c(%rax), %r15d
callq 0x47a42
movq (%rax), %rax
cmpl 0x4(%rax), %r15d
jne 0x1755f
movq 0x8(%r14), %rax
leaq -0xc8(%rbp), %r15
movl $0x9, -0x28(%r15)
movq %rax, -0x20(%r15)
xorl %eax, %eax
movq %rax, -0x18(%r15)
movl %eax, -0x10(%r15)
movl %eax, 0x30(%r15)
movq %rax, 0x38(%r15)
movl %eax, 0x40(%r15)
movq %rax, 0x48(%r15)
movl %eax, 0x50(%r15)
movq %rax, 0x58(%r15)
movl %eax, 0x60(%r15)
movq %rax, 0x68(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x8(%r15)
movupd %xmm0, 0x8(%r15)
movupd %xmm0, 0x18(%r15)
movb $0x0, 0x28(%r15)
movl $0x1, 0x70(%r15)
movq %rax, 0x78(%r15)
movq 0x38(%r14), %rdi
callq 0x4c610
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x24814
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x2488e
movsd %xmm0, -0x18(%r15)
leaq -0xf0(%rbp), %rsi
movq %rbx, %rdi
callq 0x16cca
jmp 0x1755f
leaq 0x524b8(%rip), %rdi     # 0x69b33
movl $0x1, %esi
xorl %eax, %eax
callq 0x9750
nop