// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorSetplay.cpp
// Function: BehaviorSetplayPlanner::Plan(std::__cxx11::list<ActiveBehavior, std::allocator<ActiveBehavior>>&)
void BehaviorSetplayPlanner::Plan(std::list<ActiveBehavior> &behavior_list) {
  ActiveBehavior setplay(mAgent, BT_Setplay);

  setplay.mBuffer = 0.5;

  if (mWorldState.GetPlayMode() != PM_Play_On) {
    if (mWorldState.GetPlayMode() == PM_Before_Kick_Off) {
      setplay.mDetailType = BDT_Setplay_Move;
      setplay.mTarget = TeammateFormationTactic(KickOffPosition)(
          mSelfState.GetUnum(), mWorldState.GetKickOffMode() == KO_Ours);

      if (setplay.mTarget.Dist(mSelfState.GetPos()) < setplay.mBuffer) {
        setplay.mDetailType = BDT_Setplay_Scan;
      }

      setplay.mEvaluation =
          Evaluation::instance().EvaluatePosition(setplay.mTarget, true);

      behavior_list.push_back(setplay);
    } else if (mWorldState.GetPlayMode() < PM_Our_Mode) {
      if (mPositionInfo.GetClosestTeammateToBall() == mSelfState.GetUnum()) {
        if (!mSelfState.IsKickable()) {
          setplay.mDetailType = BDT_Setplay_GetBall;
          setplay.mTarget = mBallState.GetPos();
          setplay.mEvaluation =
              Evaluation::instance().EvaluatePosition(setplay.mTarget, true);

          behavior_list.push_back(setplay);
        } else {
          mStrategy.SetForbidenDribble(true); //禁止带球

          if (mWorldState.GetLastPlayMode() != PM_Before_Kick_Off) {
            if (mWorldState.CurrentTime().T() -
                    mWorldState.GetPlayModeTime().T() <
                20) {
              setplay.mDetailType = BDT_Setplay_Scan;
              setplay.mEvaluation = Evaluation::instance().EvaluatePosition(
                  setplay.mTarget, true);

              behavior_list.push_back(setplay);
            } else if (mWorldState.CurrentTime().T() -
                               mWorldState.GetPlayModeTime().T() ==
                           20 &&
                       mSelfState.IsGoalie()) {
              setplay.mDetailType = BDT_Setplay_Move;
              for (list<KeyPlayerInfo>::const_iterator it =
                       mPositionInfo.GetXSortTeammate().begin();
                   it != mPositionInfo.GetXSortTeammate().end(); ++it) {
                if (mWorldState.GetTeammate((*it).mUnum).GetPos().X() >
                        ServerParam::instance().ourPenaltyArea().Right() &&
                    (mWorldState
                         .GetOpponent(
                             mPositionInfo.GetClosestOpponentToTeammate(
                                 (*it).mUnum))
                         .GetPos() -
                     mWorldState.GetTeammate((*it).mUnum).GetPos())
                            .Mod() >= 1.0) {
                  double y = MinMax(
                      ServerParam::instance().ourPenaltyArea().Top() + 1,
                      mWorldState.GetTeammate((*it).mUnum).GetPos().Y(),
                      ServerParam::instance().ourPenaltyArea().Bottom() - 1);
                  setplay.mTarget = Vector(
                      ServerParam::instance().ourPenaltyArea().Right() - 1, y);
                  setplay.mEvaluation = Evaluation::instance().EvaluatePosition(
                      setplay.mTarget, true);
                  behavior_list.push_back(setplay);
                  break;
                }
              }
            }
          }
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movq 0x8(%rdi), %rax
movl $0x3, -0xd0(%rbp)
movq %rax, -0xc8(%rbp)
andq $0x0, -0xc0(%rbp)
andl $0x0, -0xb8(%rbp)
andl $0x0, -0x78(%rbp)
andq $0x0, -0x70(%rbp)
andl $0x0, -0x68(%rbp)
andq $0x0, -0x60(%rbp)
andl $0x0, -0x58(%rbp)
andq $0x0, -0x50(%rbp)
andl $0x0, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0xb0(%rbp)
movupd %xmm0, -0xa0(%rbp)
movupd %xmm0, -0x90(%rbp)
movb $0x0, -0x80(%rbp)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, -0x30(%rbp)
movq 0x10(%rdi), %rax
movl 0x1c(%rax), %eax
cmpl $0x1, %eax
je 0x16f99
movq %rdi, %r14
movq %rsi, %rbx
cmpl $0x16, %eax
jne 0x16f61
leaq -0xa8(%rbp), %r15
movl $0xf, 0x70(%r15)
movq 0x40(%r14), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
xorl %esi, %esi
callq *0x18(%rax)
movq 0x10(%r14), %rcx
movq 0x20(%r14), %rdx
movl 0x11c(%rdx), %esi
xorl %edx, %edx
cmpl $0x0, 0x18(%rcx)
sete %dl
movq %rax, %rdi
callq 0x23426
movups (%rax), %xmm0
movups %xmm0, (%r15)
movq 0x20(%r14), %rax
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
subsd 0x8(%rax), %xmm0
subsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x4091d(%rip), %xmm1    # 0x57848
ucomisd %xmm0, %xmm1
jbe 0x16f38
movl $0x10, -0x38(%rbp)
callq 0x1efde
pushq $0x1
popq %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x1f058
leaq -0xd0(%rbp), %rsi
movsd %xmm0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x10530
jmp 0x16f99
cmpl $0x14, %eax
jg 0x16f99
movq 0x28(%r14), %rdi
callq 0x114f0
movq 0x20(%r14), %rcx
cmpl 0x11c(%rcx), %eax
jne 0x16f99
cmpb $0x0, 0x128(%rcx)
je 0x16fa9
movq 0x38(%r14), %rax
movb $0x1, 0xa8(%rax)
movq 0x10(%r14), %rax
cmpl $0x16, 0x20(%rax)
jne 0x16fcb
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq -0xa8(%rbp), %r15
movl $0x11, 0x70(%r15)
movq 0x18(%r14), %rax
movupd 0x8(%rax), %xmm0
movupd %xmm0, (%r15)
jmp 0x16f38
movl 0x10(%rax), %edx
subl 0x24(%rax), %edx
cmpl $0x13, %edx
jg 0x16ff8
leaq -0xa8(%rbp), %r14
movl $0x10, 0x70(%r14)
callq 0x1efde
pushq $0x1
popq %rdx
movq %rax, %rdi
movq %r14, %rsi
jmp 0x16f46
cmpl $0x14, %edx
jne 0x16f99
cmpb $0x1, 0x175(%rcx)
jne 0x16f99
movl $0xf, -0x38(%rbp)
movq 0x28(%r14), %rdi
callq 0x3bac8
movq %rax, %r15
movq (%r15), %r15
movq 0x28(%r14), %rdi
callq 0x3bac8
cmpq %rax, %r15
je 0x16f99
movq 0x10(%r14), %rax
movslq 0x10(%r15), %rcx
imulq $0x178, %rcx, %rcx      # imm = 0x178
movsd -0xc8(%rax,%rcx), %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0x3db2c
movsd -0x28(%rbp), %xmm0
ucomisd 0x3838(%rax), %xmm0
jbe 0x17019
movq 0x10(%r14), %r12
movq 0x28(%r14), %rdi
movl 0x10(%r15), %esi
callq 0x14a28
decl %eax
cltq
imulq $0x178, %rax, %rax      # imm = 0x178
movq 0x10(%r14), %rcx
movslq 0x10(%r15), %rdx
movsd 0x10d8(%r12,%rax), %xmm0
movsd 0x10e0(%r12,%rax), %xmm1
imulq $0x178, %rdx, %rax      # imm = 0x178
subsd -0xc8(%rax,%rcx), %xmm0
subsd -0xc0(%rax,%rcx), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
ucomisd 0x3ff80(%rip), %xmm0    # 0x57048
jb 0x17019
callq 0x3db2c
movsd 0x3840(%rax), %xmm0
addsd 0x3ff65(%rip), %xmm0    # 0x57048
movsd %xmm0, -0x28(%rbp)
movq 0x10(%r14), %r14
movslq 0x10(%r15), %r15
callq 0x3db2c
movsd 0x3848(%rax), %xmm1
addsd 0x3ff6b(%rip), %xmm1    # 0x57070
imulq $0x178, %r15, %rax      # imm = 0x178
movsd -0xc0(%r14,%rax), %xmm0
maxsd -0x28(%rbp), %xmm0
minsd %xmm0, %xmm1
movsd %xmm1, -0x28(%rbp)
callq 0x3db2c
movsd 0x3ff3f(%rip), %xmm0    # 0x57070
addsd 0x3838(%rax), %xmm0
leaq -0xa8(%rbp), %r14
movsd %xmm0, (%r14)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, 0x8(%r14)
jmp 0x16fe5
nop