// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorFormation.cpp
// Function: BehaviorFormationPlanner::Plan(std::__cxx11::list<ActiveBehavior, std::allocator<ActiveBehavior>>&)
void BehaviorFormationPlanner::Plan(std::list<ActiveBehavior> &behavior_list) {
  ActiveBehavior formation(mAgent, BT_Formation);

  formation.mBuffer = 1.0;
  formation.mPower = mSelfState.CorrectDashPowerForStamina(
      ServerParam::instance().maxDashPower());
  formation.mTarget = mAnalyser.mHome[mSelfState.GetUnum()];
  if (formation.mTarget.X() < mSelfState.GetPos().X() &&
      mAgent.GetFormation().GetMyRole().mLineType == LT_Forward) {
    formation.mPower = mSelfState.CorrectDashPowerForStamina(
                           ServerParam::instance().maxDashPower()) /
                       2;
  }

  if (mAgent.GetFormation().GetMyRole().mLineType == LT_Defender) {
    formation.mTarget.SetX(Min(0.0, formation.mTarget.X()));
    if (mBallState.GetPos().X() < -25) {
      Unum goalie = mWorldState.GetTeammateGoalieUnum();
      Vector gpos = mWorldState.GetTeammate(goalie).GetPos();
      Vector left = (ServerParam::instance().ourLeftGoalPost() + gpos) / 2;
      Vector right = (ServerParam::instance().ourRightGoalPost() + gpos) / 2;
      Line l(gpos, mBallState.GetPos());
      if (l.IsPointInSameSide(left, ServerParam::instance().ourGoal())) {
        const std::vector<Unum> &t2t =
            mPositionInfo.GetClosePlayerToPoint(left, goalie);
        if (t2t[0] == mSelfState.GetUnum()) {
          formation.mTarget = left;
        } else if (mPositionInfo.GetClosePlayerToPoint(right, t2t[0])[0] ==
                   mSelfState.GetUnum()) {
          formation.mTarget = right;
        } else if (mPositionInfo.GetClosePlayerToPoint(right, t2t[0])[0] ==
                       goalie &&
                   mPositionInfo.GetClosePlayerToPoint(right, t2t[0])[1] ==
                       mSelfState.GetUnum()) {
          formation.mTarget = right;
        }
      } else {
        const std::vector<Unum> &t2t =
            mPositionInfo.GetClosePlayerToPoint(right, goalie);
        if (t2t[0] == mSelfState.GetUnum()) {
          formation.mTarget = right;
        } else if (mPositionInfo.GetClosePlayerToPoint(left, t2t[0])[0] ==
                   mSelfState.GetUnum()) {
          formation.mTarget = left;
        } else if (mPositionInfo.GetClosePlayerToPoint(left, t2t[0])[0] ==
                       goalie &&
                   mPositionInfo.GetClosePlayerToPoint(right, t2t[0])[1] ==
                       mSelfState.GetUnum()) {
          formation.mTarget = left;
        }
      }
    }
    formation.mEvaluation =
        Evaluation::instance().EvaluatePosition(formation.mTarget, true);
  }

  else
    formation.mEvaluation =
        Evaluation::instance().EvaluatePosition(formation.mTarget, false);

  behavior_list.push_back(formation);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %rax
movl $0xa, -0x160(%rbp)
movq %rax, -0x158(%rbp)
xorl %eax, %eax
movq %rax, -0x150(%rbp)
movl %eax, -0x148(%rbp)
movl %eax, -0x108(%rbp)
movq %rax, -0x100(%rbp)
movl %eax, -0xf8(%rbp)
movq %rax, -0xf0(%rbp)
movl %eax, -0xe8(%rbp)
movq %rax, -0xe0(%rbp)
movl %eax, -0xd8(%rbp)
movq %rax, -0xd0(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x140(%rbp)
movups %xmm0, -0x130(%rbp)
movups %xmm0, -0x120(%rbp)
movb $0x0, -0x110(%rbp)
movl %eax, -0xc8(%rbp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0xc0(%rbp)
movq 0x20(%rdi), %r14
callq 0x49360
movsd 0x33c0(%rax), %xmm0
movq %r14, %rdi
callq 0x45d84
movsd %xmm0, -0x128(%rbp)
movq 0x20(%r15), %rax
movq 0x48(%r15), %rcx
movslq 0x11c(%rax), %rdx
shlq $0x4, %rdx
movups 0x40(%rdx,%rcx), %xmm0
movups %xmm0, -0x138(%rbp)
movsd -0x138(%rbp), %xmm1
movsd 0x8(%rax), %xmm0
movsd %xmm1, -0xa0(%rbp)
ucomisd %xmm1, %xmm0
jbe 0x153fd
movq 0x8(%r15), %rdi
callq 0x13432
movq %rax, %rdi
callq 0x266bc
cmpl $0x3, 0x8(%rax)
jne 0x153fd
movq 0x20(%r15), %r14
callq 0x49360
movsd 0x33c0(%rax), %xmm0
movq %r14, %rdi
callq 0x45d84
mulsd 0x54483(%rip), %xmm0    # 0x69878
movsd %xmm0, -0x128(%rbp)
leaq -0x138(%rbp), %r14
movq 0x8(%r15), %rdi
callq 0x13432
movq %rax, %rdi
callq 0x266bc
cmpl $0x1, 0x8(%rax)
jne 0x15547
xorpd %xmm0, %xmm0
movsd -0xa0(%rbp), %xmm1
minsd %xmm0, %xmm1
movsd %xmm1, -0x138(%rbp)
movq 0x18(%r15), %rax
movsd 0x5443d(%rip), %xmm0    # 0x69880
ucomisd 0x8(%rax), %xmm0
jbe 0x15724
movq 0x10(%r15), %rax
movslq 0x2110(%rax), %rcx
movl %ecx, -0x2c(%rbp)
imulq $0x178, %rcx, %rcx      # imm = 0x178
movsd -0xc8(%rcx,%rax), %xmm0
movaps %xmm0, -0xa0(%rbp)
movsd -0xc0(%rcx,%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
callq 0x49360
movsd 0x3910(%rax), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd 0x3918(%rax), %xmm1
addsd -0x88(%rbp), %xmm1
movsd 0x543c7(%rip), %xmm2    # 0x69878
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movsd %xmm0, -0x80(%rbp)
movsd %xmm1, -0x78(%rbp)
callq 0x49360
movsd -0x88(%rbp), %xmm4
movapd -0xa0(%rbp), %xmm3
movsd 0x3920(%rax), %xmm0
addsd %xmm3, %xmm0
movsd 0x3928(%rax), %xmm1
addsd %xmm4, %xmm1
movsd 0x54380(%rip), %xmm2    # 0x69878
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movsd %xmm0, -0x58(%rbp)
movsd %xmm1, -0x50(%rbp)
movq 0x18(%r15), %rax
movsd 0x8(%rax), %xmm1
movapd %xmm3, %xmm0
subsd %xmm1, %xmm0
andpd 0x53aed(%rip), %xmm0    # 0x69010
movsd 0x53b15(%rip), %xmm2    # 0x69040
ucomisd %xmm0, %xmm2
jbe 0x15559
xorpd 0x53ae7(%rip), %xmm3    # 0x69020
xorpd %xmm1, %xmm1
movsd 0x53b13(%rip), %xmm0    # 0x69058
jmp 0x1557e
callq 0x24814
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
jmp 0x15734
movsd 0x10(%rax), %xmm0
subsd %xmm4, %xmm0
subsd %xmm3, %xmm1
divsd %xmm1, %xmm0
mulsd %xmm0, %xmm3
subsd %xmm3, %xmm4
movsd 0x53b1e(%rip), %xmm1    # 0x69098
movapd %xmm4, %xmm3
leaq -0x178(%rbp), %r12
movsd %xmm0, (%r12)
movsd %xmm1, 0x8(%r12)
movsd %xmm3, 0x10(%r12)
callq 0x49360
leaq 0x38b0(%rax), %rdx
leaq -0x80(%rbp), %rsi
movq %r12, %rdi
callq 0x159c4
testb %al, %al
je 0x1569c
movq 0x28(%r15), %rsi
leaq -0x70(%rbp), %r12
leaq -0x80(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
movq %r12, %rdi
callq 0x477b6
movq (%r12), %rcx
movl (%rcx), %eax
movq 0x20(%r15), %rdx
cmpl 0x11c(%rdx), %eax
je 0x15705
movq 0x28(%r15), %rsi
leaq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x477b6
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl (%rdi), %r12d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r13d
subq %rdi, %rsi
callq 0x94e0
cmpl %r13d, %r12d
je 0x156c6
movq 0x28(%r15), %rsi
movq -0x70(%rbp), %rcx
leaq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x477b6
movq -0x48(%rbp), %rdi
movl (%rdi), %eax
cmpl -0x2c(%rbp), %eax
jne 0x15805
movq 0x28(%r15), %rsi
movq -0x70(%rbp), %rcx
leaq -0xb8(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x477b6
movq -0xb8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movl 0x4(%rdi), %r12d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r15d
subq %rdi, %rsi
callq 0x94e0
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x15695
movq -0x38(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
cmpl %r15d, %r12d
je 0x156c6
jmp 0x1570f
movq 0x28(%r15), %rsi
leaq -0x70(%rbp), %r12
leaq -0x58(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
movq %r12, %rdi
callq 0x477b6
movq (%r12), %rcx
movl (%rcx), %eax
movq 0x20(%r15), %rdx
cmpl 0x11c(%rdx), %eax
jne 0x156cd
movupd -0x58(%rbp), %xmm0
jmp 0x1570a
movq 0x28(%r15), %rsi
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x477b6
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl (%rdi), %r12d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r13d
subq %rdi, %rsi
callq 0x94e0
cmpl %r13d, %r12d
jne 0x15785
movupd -0x80(%rbp), %xmm0
movupd %xmm0, (%r14)
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x15724
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
callq 0x24814
movq %rax, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x2488e
leaq -0x160(%rbp), %r14
movsd %xmm0, 0x10(%r14)
movl $0xb8, %edi
callq 0x94c0
movq %rax, %r15
leaq 0x10(%rax), %rdi
movl $0xa8, %edx
movq %r14, %rsi
callq 0x93e0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x90b0
incq 0x10(%rbx)
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%r15), %rsi
movq -0x70(%rbp), %rcx
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x477b6
movq -0x48(%rbp), %rdi
movl (%rdi), %eax
cmpl -0x2c(%rbp), %eax
jne 0x15805
movq 0x28(%r15), %rsi
movq -0x70(%rbp), %rcx
leaq -0xb8(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x477b6
movq -0xb8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movl 0x4(%rdi), %r12d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r15d
subq %rdi, %rsi
callq 0x94e0
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x157f7
movq -0x38(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
cmpl %r15d, %r12d
je 0x15705
jmp 0x1570f
movq -0x38(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
jmp 0x1570f
jmp 0x15818
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x1583b
movq -0x38(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
jmp 0x1583b
jmp 0x15838
jmp 0x15838
jmp 0x15838
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x15850
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0