// File: /workspace/github_cpp_makefile_star2_O1/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, -0x178(%rbp)
movq %rax, -0x170(%rbp)
xorl %eax, %eax
movq %rax, -0x168(%rbp)
movl %eax, -0x160(%rbp)
movl %eax, -0x120(%rbp)
movq %rax, -0x118(%rbp)
movl %eax, -0x110(%rbp)
movq %rax, -0x108(%rbp)
movl %eax, -0x100(%rbp)
movq %rax, -0xf8(%rbp)
movl %eax, -0xf0(%rbp)
movq %rax, -0xe8(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x158(%rbp)
movups %xmm0, -0x148(%rbp)
movups %xmm0, -0x138(%rbp)
movb $0x0, -0x128(%rbp)
movl %eax, -0xe0(%rbp)
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
movq %r12, -0xd8(%rbp)
movq 0x20(%rdi), %r14
callq 0x4a75c
movsd 0x33c0(%rax), %xmm0
movq %r14, %rdi
callq 0x470e2
movsd %xmm0, -0x140(%rbp)
movq 0x20(%r15), %rax
movq 0x48(%r15), %rcx
movslq 0x11c(%rax), %rdx
shlq $0x4, %rdx
movups 0x40(%rdx,%rcx), %xmm0
movups %xmm0, -0x150(%rbp)
movsd 0x8(%rax), %xmm0
ucomisd -0x150(%rbp), %xmm0
jbe 0x15609
movq 0x8(%r15), %rdi
callq 0x1356e
movq %rax, %rdi
callq 0x26e20
cmpl $0x3, 0x8(%rax)
jne 0x15609
movq 0x20(%r15), %r14
callq 0x4a75c
movsd 0x33c0(%rax), %xmm0
movq %r14, %rdi
callq 0x470e2
mulsd 0x56277(%rip), %xmm0    # 0x6b878
movsd %xmm0, -0x140(%rbp)
leaq -0x150(%rbp), %r13
movq 0x8(%r15), %rdi
callq 0x1356e
movq %rax, %rdi
callq 0x26e20
movl 0x8(%rax), %r14d
cmpl $0x1, %r14d
jne 0x159d2
movsd -0x150(%rbp), %xmm0
xorpd %xmm1, %xmm1
minsd %xmm1, %xmm0
movsd %xmm0, -0x150(%rbp)
movq 0x18(%r15), %rax
movsd 0x5622d(%rip), %xmm0    # 0x6b880
ucomisd 0x8(%rax), %xmm0
jbe 0x159d2
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, -0x60(%rbp)
movsd -0xc0(%rcx,%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
callq 0x4a75c
movsd 0x3910(%rax), %xmm0
addsd -0x60(%rbp), %xmm0
movsd 0x3918(%rax), %xmm1
addsd -0x90(%rbp), %xmm1
movsd 0x561bd(%rip), %xmm2    # 0x6b878
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movsd %xmm0, -0xb8(%rbp)
movsd %xmm1, -0xb0(%rbp)
callq 0x4a75c
movsd -0x90(%rbp), %xmm4
movapd -0x60(%rbp), %xmm3
movsd 0x3920(%rax), %xmm0
addsd %xmm3, %xmm0
movsd 0x3928(%rax), %xmm1
addsd %xmm4, %xmm1
movsd 0x56173(%rip), %xmm2    # 0x6b878
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movsd %xmm0, -0x88(%rbp)
movsd %xmm1, -0x80(%rbp)
movq 0x18(%r15), %rax
movsd 0x8(%rax), %xmm0
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
andpd 0x558dd(%rip), %xmm1    # 0x6b010
movsd 0x55905(%rip), %xmm2    # 0x6b040
ucomisd %xmm1, %xmm2
jbe 0x1575d
movq %r12, -0xd0(%rbp)
movq $0x0, -0xc8(%rbp)
xorpd 0x558c5(%rip), %xmm3    # 0x6b020
jmp 0x15793
movsd 0x10(%rax), %xmm1
subsd %xmm4, %xmm1
subsd %xmm3, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, -0xd0(%rbp)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, -0xc8(%rbp)
mulsd %xmm3, %xmm1
subsd %xmm1, %xmm4
movapd %xmm4, %xmm3
leaq -0xd0(%rbp), %r13
movsd %xmm3, 0x10(%r13)
callq 0x4a75c
leaq 0x38b0(%rax), %rdx
leaq -0xb8(%rbp), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x15bea
testb %al, %al
je 0x1588c
movq 0x28(%r15), %rsi
leaq -0x78(%rbp), %r13
leaq -0x2c(%rbp), %rcx
movq %r13, %rdi
movq %r12, %rdx
callq 0x48b8c
movq (%r13), %rcx
movl (%rcx), %eax
movq 0x20(%r15), %rdx
cmpl 0x11c(%rdx), %eax
leaq -0x150(%rbp), %r13
je 0x159b1
movq 0x28(%r15), %rsi
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %r12
movq %r12, %rdx
callq 0x48b8c
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl (%rdi), %eax
movl %eax, -0x60(%rbp)
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r13d
subq %rdi, %rsi
callq 0x94e0
cmpl %r13d, -0x60(%rbp)
leaq -0x150(%rbp), %r13
je 0x159b1
movq 0x28(%r15), %rsi
movq -0x78(%rbp), %rcx
leaq -0x48(%rbp), %rdi
movq %r12, %rdx
callq 0x48b8c
movq -0x48(%rbp), %rax
movl (%rax), %eax
movl -0x2c(%rbp), %r13d
cmpl %r13d, %eax
jne 0x1596d
movl %eax, -0x60(%rbp)
movq 0x28(%r15), %rsi
movq -0x78(%rbp), %rcx
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x48b8c
jmp 0x15950
movq 0x28(%r15), %rsi
leaq -0x78(%rbp), %r13
leaq -0x88(%rbp), %r12
leaq -0x2c(%rbp), %rcx
movq %r13, %rdi
movq %r12, %rdx
callq 0x48b8c
movq (%r13), %rcx
movl (%rcx), %eax
movq 0x20(%r15), %rdx
cmpl 0x11c(%rdx), %eax
leaq -0x150(%rbp), %r13
je 0x159b1
movq 0x28(%r15), %rsi
leaq -0x48(%rbp), %rdi
leaq -0xb8(%rbp), %r12
movq %r12, %rdx
callq 0x48b8c
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl (%rdi), %eax
movl %eax, -0x60(%rbp)
movq 0x20(%r15), %rax
movl 0x11c(%rax), %r13d
subq %rdi, %rsi
callq 0x94e0
cmpl %r13d, -0x60(%rbp)
leaq -0x150(%rbp), %r13
je 0x159b1
movq 0x28(%r15), %rsi
movq -0x78(%rbp), %rcx
leaq -0x48(%rbp), %rdi
movq %r12, %rdx
callq 0x48b8c
movq -0x48(%rbp), %rax
movl (%rax), %eax
movl -0x2c(%rbp), %r13d
cmpl %r13d, %eax
jne 0x1596d
movl %eax, -0x60(%rbp)
movq 0x28(%r15), %rsi
movq -0x78(%rbp), %rcx
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x48b8c
movq -0xa8(%rbp), %rax
movl 0x4(%rax), %eax
movq 0x20(%r15), %rcx
cmpl 0x11c(%rcx), %eax
sete %r15b
movl -0x60(%rbp), %eax
jmp 0x15970
xorl %r15d, %r15d
cmpl %r13d, %eax
leaq -0x150(%rbp), %r13
jne 0x15997
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x15997
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x159ac
movq -0x38(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
testb %r15b, %r15b
je 0x159bd
movupd (%r12), %xmm0
movupd %xmm0, (%r13)
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x159d2
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
xorl %r15d, %r15d
cmpl $0x1, %r14d
sete %r15b
callq 0x24ed2
movq %rax, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x24f4c
leaq -0x178(%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
jmp 0x15a3e
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x15a61
movq -0x38(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
jmp 0x15a61
jmp 0x15a5e
jmp 0x15a5e
jmp 0x15a5e
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x15a76
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x94e0
movq %rbx, %rdi
callq 0x98b0