// File: 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
subq $0x550, %rsp            # imm = 0x550
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x4e8(%rbp)
movq 0x20(%rax), %rdi
callq 0x10ef0
testb $0x1, %al
jne 0x20dad
jmp 0x20db2
jmp 0x21676
movq -0x4e8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10ed0
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
je 0x20de2
cmpl $0xf, -0x14(%rbp)
je 0x20de2
cmpl $0x10, -0x14(%rbp)
je 0x20de2
cmpl $0x33, -0x14(%rbp)
je 0x20de2
jmp 0x21676
movq -0x4e8(%rbp), %rax
movq 0x30(%rax), %rcx
movq %rcx, -0x4f0(%rbp)
movq 0x20(%rax), %rdi
callq 0x1b470
movq -0x4f0(%rbp), %rdi
movl %eax, %esi
callq 0x21840
testb $0x1, %al
jne 0x20fbf
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1d780
testb $0x1, %al
jne 0x20e2c
jmp 0x20fb8
movq -0x4e8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xc0(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x1b4d0
movq -0x4e8(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rcx
movq -0x4e8(%rbp), %rax
movq %rcx, -0x508(%rbp)
movq 0x18(%rax), %rdi
callq 0x10a80
movq %rax, %rdi
callq 0x10520
movq -0x508(%rbp), %rsi
movsd %xmm0, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0x1fde0
callq 0x855e0
movq %rax, %rdi
callq 0x1eed0
movq %rax, -0x500(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1efa0
movq -0x500(%rbp), %rsi
movq %rax, %rdx
leaq -0xf8(%rbp), %rdi
callq 0x1efc0
leaq -0xc0(%rbp), %rdx
addq $0x28, %rdx
leaq -0xf8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x47af0
leaq -0xc0(%rbp), %rdi
addq $0x28, %rdi
callq 0x17700
movsd (%rax), %xmm0
movsd %xmm0, -0x4f8(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1eed0
movq %rax, %rdi
callq 0x17700
movsd -0x4f8(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
ja 0x20f7c
leaq -0xc0(%rbp), %rdi
addq $0x28, %rdi
callq 0x17700
movsd (%rax), %xmm0
movsd %xmm0, -0x510(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1efa0
movq %rax, %rdi
callq 0x17700
movsd -0x510(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0x20f81
jmp 0x21676
callq 0x38230
movq %rax, %rdi
leaq -0xc0(%rbp), %rsi
addq $0x28, %rsi
movl $0x1, %edx
callq 0x382c0
movsd %xmm0, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x189a0
jmp 0x20fbd
jmp 0x21676
jmp 0x20fbf
callq 0x855e0
movq %rax, %rdi
callq 0x1fe30
movq (%rax), %rcx
movq %rcx, -0x118(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x110(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x108(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x100(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1fe50
movq %rax, %rdi
callq 0x218c0
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
callq 0x218a0
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x1b490
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movl %ecx, -0x514(%rbp)
movq 0x38(%rax), %rdi
callq 0x218e0
movl %eax, %ecx
movl -0x514(%rbp), %eax
cmpl %ecx, %eax
jg 0x2113d
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x1b490
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movl %ecx, -0x518(%rbp)
movq 0x38(%rax), %rdi
callq 0x20a40
movl %eax, %ecx
movl -0x518(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x2113d
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1d780
testb $0x1, %al
jne 0x2113d
movq -0x4e8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x1c0(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x1b4d0
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8aa60
movsd %xmm0, -0x1d0(%rbp)
movsd %xmm1, -0x1c8(%rbp)
movq -0x1d0(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x1c8(%rbp), %rax
movq %rax, -0x190(%rbp)
callq 0x38230
movq %rax, %rdi
leaq -0x1c0(%rbp), %rsi
addq $0x28, %rsi
movl $0x1, %edx
callq 0x382c0
movsd %xmm0, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x189a0
jmp 0x21676
movq -0x4e8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x1d4b0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x519(%rbp)
je 0x21283
movq -0x4e8(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x538(%rbp)
movq 0x28(%rax), %rdi
callq 0x1b410
movq -0x538(%rbp), %rdi
movl %eax, -0x1e4(%rbp)
leaq -0x1e4(%rbp), %rsi
callq 0x12520
movq %rax, %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rcx
movq -0x4e8(%rbp), %rax
movq %rcx, -0x528(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x530(%rbp)
movq 0x28(%rax), %rdi
callq 0x1d4b0
movq -0x530(%rbp), %rdi
movl %eax, -0x1e8(%rbp)
leaq -0x1e8(%rbp), %rsi
callq 0x1d480
movq %rax, %rdi
addq $0x8, %rdi
callq 0x11090
movq -0x528(%rbp), %rdi
movq %rax, %rsi
callq 0x110a0
movsd %xmm0, -0x1e0(%rbp)
movsd %xmm1, -0x1d8(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x104e0
movaps %xmm0, %xmm1
xorl %eax, %eax
movsd 0x9fdee(%rip), %xmm0    # 0xc1010
ucomisd %xmm1, %xmm0
movb %al, -0x51a(%rbp)
jb 0x21277
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1b470
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movl %ecx, -0x53c(%rbp)
movq 0x28(%rax), %rdi
callq 0x802c0
movq %rax, %rdi
movl $0x1, %esi
callq 0x21900
movq %rax, %rcx
movl -0x53c(%rbp), %eax
cmpl (%rcx), %eax
sete %al
movb %al, -0x51a(%rbp)
movb -0x51a(%rbp), %al
movb %al, -0x519(%rbp)
movb -0x519(%rbp), %al
testb $0x1, %al
jne 0x21292
jmp 0x21329
movq -0x4e8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x290(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x1b4d0
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8aa60
movsd %xmm0, -0x2a0(%rbp)
movsd %xmm1, -0x298(%rbp)
movq -0x2a0(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x298(%rbp), %rax
movq %rax, -0x260(%rbp)
callq 0x38230
movq %rax, %rdi
leaq -0x290(%rbp), %rsi
addq $0x28, %rsi
movl $0x1, %edx
callq 0x382c0
movsd %xmm0, -0x280(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x189a0
jmp 0x21674
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1d780
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x53d(%rbp)
jne 0x2134a
jmp 0x2139a
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8aa60
movsd %xmm0, -0x2b0(%rbp)
movsd %xmm1, -0x2a8(%rbp)
movsd 0x9fc96(%rip), %xmm0    # 0xc1008
movsd %xmm0, -0x2b8(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
leaq -0x2b8(%rbp), %rdx
callq 0x1d850
movb %al, -0x53d(%rbp)
movb -0x53d(%rbp), %al
testb $0x1, %al
jne 0x213a9
jmp 0x21477
movq -0x4e8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x360(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x1b4d0
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8aa60
movsd %xmm0, -0x370(%rbp)
movsd %xmm1, -0x368(%rbp)
movq -0x370(%rbp), %rax
movq %rax, -0x338(%rbp)
movq -0x368(%rbp), %rax
movq %rax, -0x330(%rbp)
callq 0x38230
movq %rax, %rdi
leaq -0x360(%rbp), %rsi
addq $0x28, %rsi
movl $0x1, %edx
callq 0x382c0
movq -0x4e8(%rbp), %rax
movsd %xmm0, -0x350(%rbp)
movq 0x10(%rax), %rdi
callq 0x10ed0
cmpl $0x33, %eax
jne 0x21462
callq 0x38230
movq %rax, %rdi
leaq -0x360(%rbp), %rsi
addq $0x28, %rsi
xorl %edx, %edx
callq 0x382c0
movsd %xmm0, -0x350(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x189a0
jmp 0x21672
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1b470
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movl %ecx, -0x544(%rbp)
movq 0x28(%rax), %rdi
callq 0x1b410
movl %eax, %ecx
movl -0x544(%rbp), %eax
cmpl %ecx, %eax
jne 0x2155e
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1d780
testb $0x1, %al
jne 0x2155e
movq -0x4e8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x418(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x1b4d0
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8aa60
movsd %xmm0, -0x428(%rbp)
movsd %xmm1, -0x420(%rbp)
movq -0x428(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movq -0x420(%rbp), %rax
movq %rax, -0x3e8(%rbp)
callq 0x38230
movq %rax, %rdi
leaq -0x418(%rbp), %rsi
addq $0x28, %rsi
movl $0x1, %edx
callq 0x382c0
movsd %xmm0, -0x408(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x418(%rbp), %rsi
callq 0x189a0
jmp 0x21670
movq -0x4e8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x1b410
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movl %ecx, -0x548(%rbp)
movq 0x10(%rax), %rdi
callq 0x1eeb0
movl %eax, %ecx
movl -0x548(%rbp), %eax
cmpl %ecx, %eax
jne 0x2166e
movq -0x4e8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1b470
movl %eax, %ecx
movq -0x4e8(%rbp), %rax
movl %ecx, -0x54c(%rbp)
movq 0x28(%rax), %rdi
callq 0x802c0
movq %rax, %rdi
movl $0x1, %esi
callq 0x1b610
movq %rax, %rcx
movl -0x54c(%rbp), %eax
cmpl (%rcx), %eax
jne 0x2166e
movq -0x4e8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x4d0(%rbp), %rdi
movl $0x9, %edx
movl $0x1, %ecx
callq 0x1b4d0
movq -0x4e8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8aa60
movsd %xmm0, -0x4e0(%rbp)
movsd %xmm1, -0x4d8(%rbp)
movq -0x4e0(%rbp), %rax
movq %rax, -0x4a8(%rbp)
movq -0x4d8(%rbp), %rax
movq %rax, -0x4a0(%rbp)
callq 0x38230
movq %rax, %rdi
leaq -0x4d0(%rbp), %rsi
addq $0x28, %rsi
movl $0x1, %edx
callq 0x382c0
movsd %xmm0, -0x4c0(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x4d0(%rbp), %rsi
callq 0x189a0
jmp 0x21670
jmp 0x21672
jmp 0x21674
jmp 0x21676
addq $0x550, %rsp            # imm = 0x550
popq %rbp
retq
nop