// File: /workspace/github_cpp_makefile_star2_O2/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 %rdi, %r15
movq 0x8(%rdi), %rax
movl $0xa, -0x150(%rbp)
movq %rax, -0x148(%rbp)
andq $0x0, -0x140(%rbp)
andl $0x0, -0x138(%rbp)
andl $0x0, -0xf8(%rbp)
andq $0x0, -0xf0(%rbp)
andl $0x0, -0xe8(%rbp)
andq $0x0, -0xe0(%rbp)
andl $0x0, -0xd8(%rbp)
andq $0x0, -0xd0(%rbp)
andl $0x0, -0xc8(%rbp)
andq $0x0, -0xc0(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x130(%rbp)
movups %xmm0, -0x120(%rbp)
movups %xmm0, -0x110(%rbp)
movb $0x0, -0x100(%rbp)
andl $0x0, -0xb8(%rbp)
movq %rsi, %rbx
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0xb0(%rbp)
movq 0x20(%rdi), %r14
callq 0x3db2c
movsd 0x33c0(%rax), %xmm0
movq %r14, %rdi
callq 0x3a8ce
movsd %xmm0, -0x118(%rbp)
movq 0x20(%r15), %rax
movq 0x48(%r15), %rcx
movslq 0x11c(%rax), %rdx
shlq $0x4, %rdx
movups 0x40(%rdx,%rcx), %xmm0
movups %xmm0, -0x128(%rbp)
movsd -0x128(%rbp), %xmm1
movsd 0x8(%rax), %xmm0
movsd %xmm1, -0x60(%rbp)
ucomisd %xmm1, %xmm0
jbe 0x129f7
movq 0x8(%r15), %rdi
callq 0x10dfe
movq %rax, %rdi
callq 0x20a4c
cmpl $0x3, 0x8(%rax)
jne 0x129f7
movq 0x20(%r15), %r14
callq 0x3db2c
movsd 0x33c0(%rax), %xmm0
movq %r14, %rdi
callq 0x3a8ce
mulsd 0x44e59(%rip), %xmm0    # 0x57848
movsd %xmm0, -0x118(%rbp)
leaq -0x128(%rbp), %r13
movq 0x8(%r15), %rdi
callq 0x10dfe
movq %rax, %rdi
callq 0x20a4c
cmpl $0x1, 0x8(%rax)
jne 0x12c18
xorpd %xmm0, %xmm0
movsd -0x60(%rbp), %xmm1
minsd %xmm0, %xmm1
movsd %xmm1, -0x128(%rbp)
movq 0x18(%r15), %rax
movsd 0x44e16(%rip), %xmm0    # 0x57850
ucomisd 0x8(%rax), %xmm0
jbe 0x12cab
movq 0x10(%r15), %rax
movslq 0x2110(%rax), %rcx
movl %ecx, -0x2c(%rbp)
imulq $0x178, %rcx, %rcx      # imm = 0x178
movups -0xc8(%rax,%rcx), %xmm0
leaq -0x160(%rbp), %r12
movaps %xmm0, (%r12)
callq 0x3db2c
movsd (%r12), %xmm1
movsd %xmm1, -0x60(%rbp)
movsd 0x8(%r12), %xmm2
movsd %xmm2, -0x90(%rbp)
movsd 0x3910(%rax), %xmm0
addsd %xmm1, %xmm0
movsd 0x3918(%rax), %xmm1
addsd %xmm2, %xmm1
movsd 0x44d9b(%rip), %xmm2    # 0x57848
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
leaq -0x70(%rbp), %r13
movsd %xmm0, (%r13)
movsd %xmm1, 0x8(%r13)
callq 0x3db2c
movsd -0x60(%rbp), %xmm0
addsd 0x3920(%rax), %xmm0
movsd -0x90(%rbp), %xmm1
addsd 0x3928(%rax), %xmm1
movsd 0x44d59(%rip), %xmm2    # 0x57848
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movsd %xmm0, -0x40(%rbp)
movsd %xmm1, -0x38(%rbp)
movq 0x18(%r15), %rdx
addq $0x8, %rdx
leaq -0x178(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x12e9a
callq 0x3db2c
leaq 0x38b0(%rax), %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x12f1c
testb %al, %al
je 0x12c2a
movq 0x28(%r15), %rsi
leaq -0x88(%rbp), %r14
leaq -0x70(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
movq %r14, %rdi
callq 0x3c024
movq (%r14), %rcx
movl (%rcx), %eax
movq 0x20(%r15), %rdx
cmpl 0x11c(%rdx), %eax
leaq -0x128(%rbp), %r13
je 0x12c94
movq 0x28(%r15), %rsi
leaq -0x58(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3c024
leaq -0x58(%rbp), %rdi
movq (%rdi), %rax
movl (%rax), %r14d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r12d
callq 0x13008
cmpl %r12d, %r14d
je 0x12c5d
movq 0x28(%r15), %rsi
movq -0x88(%rbp), %rcx
leaq -0x58(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3c024
movq -0x58(%rbp), %rax
movl (%rax), %eax
cmpl -0x2c(%rbp), %eax
jne 0x12d57
movq 0x28(%r15), %rsi
movq -0x88(%rbp), %rcx
leaq -0xa8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3c024
leaq -0xa8(%rbp), %rdi
movq (%rdi), %rax
movl 0x4(%rax), %r14d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r15d
callq 0x13008
leaq -0x58(%rbp), %rdi
callq 0x13008
cmpl %r15d, %r14d
je 0x12c5d
jmp 0x12c9f
callq 0x1efde
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
jmp 0x12cb9
movq 0x28(%r15), %rsi
leaq -0x88(%rbp), %r14
leaq -0x40(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
movq %r14, %rdi
callq 0x3c024
movq (%r14), %rcx
movl (%rcx), %eax
movq 0x20(%r15), %rdx
cmpl 0x11c(%rdx), %eax
leaq -0x128(%rbp), %r13
jne 0x12c64
movupd -0x40(%rbp), %xmm0
jmp 0x12c99
movq 0x28(%r15), %rsi
leaq -0x58(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x3c024
leaq -0x58(%rbp), %rdi
movq (%rdi), %rax
movl (%rax), %r14d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r12d
callq 0x13008
cmpl %r12d, %r14d
jne 0x12ce4
movupd -0x70(%rbp), %xmm0
movupd %xmm0, (%r13)
leaq -0x88(%rbp), %rdi
callq 0x13008
callq 0x1efde
pushq $0x1
popq %rdx
movq %rax, %rdi
movq %r13, %rsi
callq 0x1f058
leaq -0x150(%rbp), %rsi
movsd %xmm0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x10530
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%r15), %rsi
movq -0x88(%rbp), %rcx
leaq -0x58(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x3c024
movq -0x58(%rbp), %rax
movl (%rax), %eax
cmpl -0x2c(%rbp), %eax
jne 0x12d57
movq 0x28(%r15), %rsi
movq -0x88(%rbp), %rcx
leaq -0xa8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3c024
leaq -0xa8(%rbp), %rdi
movq (%rdi), %rax
movl 0x4(%rax), %r14d
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r15d
callq 0x13008
leaq -0x58(%rbp), %rdi
callq 0x13008
cmpl %r15d, %r14d
je 0x12c94
jmp 0x12c9f
leaq -0x58(%rbp), %rdi
callq 0x13008
jmp 0x12c9f
jmp 0x12d67
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x13008
jmp 0x12d7e
jmp 0x12d7b
jmp 0x12d7b
jmp 0x12d7b
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x13008
movq %rbx, %rdi
callq 0x98b0