// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movq 0x20(%rdi), %rax
cmpb $0x0, 0x128(%rax)
jne 0x17936
movq %rdi, %r14
movq 0x10(%rdi), %rcx
movl 0x1c(%rcx), %ecx
cmpq $0x33, %rcx
ja 0x17936
movabsq $0x8000000018002, %rdx  # imm = 0x8000000018002
btq %rcx, %rdx
jae 0x17936
movq %rsi, %rbx
movq 0x30(%r14), %rdi
movl 0x11c(%rax), %esi
callq 0x17ac8
testb %al, %al
je 0x17332
callq 0x4a75c
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 0x4a75c
movsd 0x3838(%rax), %xmm0
movq 0x38(%r14), %rdi
movl 0x64(%rdi), %eax
cmpl 0x68(%rdi), %eax
jg 0x172a1
movl 0x80(%rdi), %ecx
incl %ecx
cmpl %ecx, %eax
jg 0x172a1
movq 0x20(%r14), %rax
cmpb $0x0, 0x175(%rax)
je 0x17872
movsd %xmm0, -0x38(%rbp)
movq 0x28(%r14), %rdi
callq 0x150fe
testl %eax, %eax
je 0x1749a
movq 0x10(%r14), %r15
movq 0x28(%r14), %rdi
callq 0x13c00
decl %eax
cltq
imulq $0x178, %rax, %r12      # imm = 0x178
movq 0x10(%r14), %r13
movq 0x28(%r14), %rdi
callq 0x150fe
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
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1744d
sqrtsd %xmm0, %xmm0
jmp 0x17452
movq 0x20(%r14), %rax
cmpb $0x1, 0x175(%rax)
jne 0x17936
movq 0x8(%r14), %rax
movl $0x9, -0x108(%rbp)
movq %rax, -0x100(%rbp)
xorl %eax, %eax
movq %rax, -0xf8(%rbp)
movl %eax, -0xf0(%rbp)
movl %eax, -0xb0(%rbp)
movq %rax, -0xa8(%rbp)
movl %eax, -0xa0(%rbp)
movq %rax, -0x98(%rbp)
movl %eax, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movl %eax, -0x80(%rbp)
movq %rax, -0x78(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xe8(%rbp)
movups %xmm0, -0xd8(%rbp)
movups %xmm0, -0xc8(%rbp)
movb $0x0, -0xb8(%rbp)
movl $0x1, -0x70(%rbp)
movq %rax, -0x68(%rbp)
movq 0x18(%r14), %r15
leaq 0x30(%r15), %rdi
callq 0xe804
xorps %xmm1, %xmm1
movaps %xmm1, -0x120(%rbp)
movups 0x8(%r15), %xmm1
movaps %xmm1, -0x120(%rbp)
movsd %xmm0, -0x110(%rbp)
callq 0x4a75c
movq %rax, %r15
callq 0x4a75c
movsd 0x3910(%r15), %xmm0
movsd 0x3920(%rax), %xmm1
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
andpd 0x53bf8(%rip), %xmm2    # 0x6b010
movsd 0x53c20(%rip), %xmm3    # 0x6b040
ucomisd %xmm2, %xmm3
jbe 0x1777b
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
xorpd 0x53bd8(%rip), %xmm0    # 0x6b020
jmp 0x177b7
callq 0x93c0
movsd 0x53bfe(%rip), %xmm1    # 0x6b058
ucomisd %xmm0, %xmm1
jb 0x17536
movq 0x20(%r14), %rax
movq 0x28(%r14), %rdi
movl 0x11c(%rax), %r15d
callq 0x48db8
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq $0x1, %rdx
jbe 0x17948
cmpl 0x4(%rcx), %r15d
jne 0x17536
movq 0x8(%r14), %rax
leaq -0xe0(%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 0x4db36
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x24ed2
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x24f4c
movsd %xmm0, -0x18(%r15)
jmp 0x17905
movq 0x20(%r14), %rax
cmpb $0x1, 0x175(%rax)
jne 0x17670
movq 0x38(%r14), %rdi
callq 0x4db36
movsd 0x53b20(%rip), %xmm2    # 0x6b078
movsd -0x30(%rbp), %xmm3
addsd %xmm2, %xmm3
ucomisd %xmm3, %xmm0
jb 0x17670
movsd 0x53acd(%rip), %xmm3    # 0x6b040
movsd -0x38(%rbp), %xmm4
addsd %xmm3, %xmm4
ucomisd %xmm0, %xmm4
jb 0x17670
movsd -0x48(%rbp), %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
jb 0x17670
movsd -0x40(%rbp), %xmm0
addsd %xmm3, %xmm0
ucomisd %xmm1, %xmm0
jb 0x17670
movq 0x8(%r14), %rax
leaq -0xe0(%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 0x4db36
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x24ed2
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x24f4c
movsd %xmm0, -0x18(%r15)
movq 0x10(%r14), %rax
cmpl $0x33, 0x1c(%rax)
jne 0x17905
callq 0x24ed2
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x24f4c
movsd %xmm0, -0xf8(%rbp)
jmp 0x17905
movq 0x20(%r14), %rax
movq 0x28(%r14), %rdi
movl 0x11c(%rax), %r15d
callq 0x13c00
cmpl %eax, %r15d
jne 0x17696
movq 0x20(%r14), %rax
cmpb $0x0, 0x175(%rax)
je 0x176d0
movq 0x28(%r14), %rdi
callq 0x13c00
movq 0x10(%r14), %rcx
cmpl 0x2110(%rcx), %eax
jne 0x17936
movq 0x20(%r14), %rax
movq 0x28(%r14), %rdi
movl 0x11c(%rax), %r15d
callq 0x48db8
movq (%rax), %rax
cmpl 0x4(%rax), %r15d
jne 0x17936
movq 0x8(%r14), %rax
leaq -0xe0(%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 0x4db36
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x24ed2
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x24f4c
movsd %xmm0, -0x18(%r15)
leaq -0x108(%rbp), %rsi
movq %rbx, %rdi
callq 0x16f62
jmp 0x17936
movsd 0x3928(%rax), %xmm2
movsd 0x3918(%r15), %xmm3
subsd %xmm3, %xmm2
subsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, -0x60(%rbp)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, -0x58(%rbp)
mulsd %xmm0, %xmm2
subsd %xmm2, %xmm3
movapd %xmm3, %xmm0
leaq -0x60(%rbp), %rdi
movsd %xmm0, 0x10(%rdi)
leaq -0xe0(%rbp), %r15
leaq -0x120(%rbp), %rsi
movq %r15, %rdx
callq 0x29ecc
movsd 0x8(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x4a75c
movsd 0x3918(%rax), %xmm0
ucomisd -0x30(%rbp), %xmm0
ja 0x17936
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x4a75c
movsd -0x30(%rbp), %xmm0
ucomisd 0x3928(%rax), %xmm0
ja 0x17936
callq 0x24ed2
movq %rax, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x24f4c
leaq -0x108(%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 0x1723f
movq 0x8(%r14), %rax
leaq -0xe0(%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 0x4db36
movsd %xmm0, (%r14)
movsd %xmm1, 0x8(%r14)
callq 0x24ed2
movq %rax, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x24f4c
movsd %xmm0, -0x18(%r14)
movl $0xb8, %edi
callq 0x94c0
movq %rax, %r14
leaq 0x10(%rax), %rdi
leaq -0x108(%rbp), %rsi
movl $0xa8, %edx
callq 0x93e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x90b0
incq 0x10(%rbx)
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x541e4(%rip), %rdi     # 0x6bb33
movl $0x1, %esi
xorl %eax, %eax
callq 0x9750
nop