// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorGoalie.cpp
// Function: BehaviorGoaliePlanner::Plan(std::__cxx11::list<ActiveBehavior, std::allocator<ActiveBehavior>>&)
void BehaviorGoaliePlanner::Plan(std::list<ActiveBehavior> &behavior_list) {
  if (mAgent.IsLastActiveBehaviorInActOf(BT_Pass) ||
      mAgent.IsLastActiveBehaviorInActOf(BT_Dribble))
    return;

  if (mSelfState.IsBallCatchable() && mStrategy.IsLastOppControl()) {
    ActiveBehavior catchball(mAgent, BT_Goalie, BDT_Goalie_Catch);

    catchball.mEvaluation = 1.0 + FLOAT_EPS;

    behavior_list.push_back(catchball);
  } else {
    Vector target;
    Ray ball_ray(
        ServerParam::instance().ourGoal(),
        (mAnalyser.mLightHouse - ServerParam::instance().ourGoal()).Dir());
    ServerParam::instance().ourGoalArea().Intersection(ball_ray, target);

    ActiveBehavior position(mAgent, BT_Goalie, BDT_Goalie_Position);

    position.mTarget = target;
    if (ServerParam::instance().ourPenaltyArea().IsWithin(target)) {
      position.mEvaluation =
          Evaluation::instance().EvaluatePosition(position.mTarget, false);
    } else {
      Ray ball_ray(
          ServerParam::instance().ourGoal(),
          (mBallState.GetPos() - ServerParam::instance().ourGoal()).Dir());
      ServerParam::instance().ourGoalArea().Intersection(ball_ray, target);
      position.mEvaluation =
          Evaluation::instance().EvaluatePosition(position.mTarget, false);
      position.mTarget = target;
    }
    behavior_list.push_back(position);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0xc0(%rax), %rcx
testq %rcx, %rcx
je 0x13250
movl (%rcx), %ecx
orl $0x2, %ecx
cmpl $0x7, %ecx
je 0x13462
movq 0x20(%r14), %rcx
cmpb $0x1, 0x175(%rcx)
jne 0x13274
testb $0x1, 0x138(%rcx)
je 0x13274
movq 0x38(%r14), %rcx
cmpl $0x0, 0x5c(%rcx)
js 0x13474
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r12
movaps %xmm0, (%r12)
callq 0x3db2c
movq %rax, %r13
movq 0x48(%r14), %r15
callq 0x3db2c
movsd 0x40(%r15), %xmm0
movsd 0x48(%r15), %xmm1
subsd 0x38b0(%rax), %xmm0
subsd 0x38b8(%rax), %xmm1
leaq -0x138(%rbp), %r15
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
movq %r15, %rdi
callq 0xcd30
movups 0x38b0(%r13), %xmm1
leaq -0x90(%rbp), %r13
movaps %xmm1, (%r13)
movsd %xmm0, 0x10(%r13)
callq 0x3db2c
leaq 0x3870(%rax), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x23a4e
movq 0x8(%r14), %rax
movl $0x2, (%r15)
movq %rax, 0x8(%r15)
andq $0x0, 0x10(%r15)
andl $0x0, 0x18(%r15)
andl $0x0, 0x58(%r15)
andq $0x0, 0x60(%r15)
andl $0x0, 0x68(%r15)
andq $0x0, 0x70(%r15)
andl $0x0, 0x78(%r15)
andq $0x0, 0x80(%r15)
andl $0x0, 0x88(%r15)
andq $0x0, 0x90(%r15)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x30(%r15)
movupd %xmm0, 0x20(%r15)
movupd %xmm0, 0x40(%r15)
movb $0x0, 0x50(%r15)
movl $0xc, 0x98(%r15)
andq $0x0, 0xa0(%r15)
leaq -0x110(%rbp), %r15
movapd (%r12), %xmm0
movupd %xmm0, (%r15)
callq 0x3db2c
leaq 0x3830(%rax), %rdi
movabsq $0x3ed92a737110e454, %rax # imm = 0x3ED92A737110E454
leaq -0x60(%rbp), %rdx
movq %rax, (%rdx)
movq %r12, %rsi
callq 0x12516
testb %al, %al
je 0x133c2
callq 0x1efde
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x1f058
jmp 0x1344e
callq 0x3db2c
movq %rax, %r12
movq 0x18(%r14), %r14
callq 0x3db2c
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
subsd 0x38b0(%rax), %xmm0
subsd 0x38b8(%rax), %xmm1
leaq -0x70(%rbp), %rdi
movsd %xmm0, (%rdi)
movsd %xmm1, 0x8(%rdi)
callq 0xcd30
movups 0x38b0(%r12), %xmm1
leaq -0x60(%rbp), %r14
movaps %xmm1, (%r14)
movsd %xmm0, 0x10(%r14)
callq 0x3db2c
leaq 0x3870(%rax), %rdi
leaq -0x40(%rbp), %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x23a4e
callq 0x1efde
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x1f058
movaps (%r12), %xmm1
movups %xmm1, (%r15)
leaq -0x138(%rbp), %rsi
movsd %xmm0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x10530
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x138(%rbp), %rsi
movl $0x2, (%rsi)
movq %rax, 0x8(%rsi)
andl $0x0, 0x18(%rsi)
andl $0x0, 0x58(%rsi)
andq $0x0, 0x60(%rsi)
andl $0x0, 0x68(%rsi)
andq $0x0, 0x70(%rsi)
andl $0x0, 0x78(%rsi)
andq $0x0, 0x80(%rsi)
andl $0x0, 0x88(%rsi)
andq $0x0, 0x90(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsi)
movupd %xmm0, 0x30(%rsi)
movupd %xmm0, 0x40(%rsi)
movb $0x0, 0x50(%rsi)
movl $0xd, 0x98(%rsi)
andq $0x0, 0xa0(%rsi)
movabsq $0x3ff000064a9cdc44, %rax # imm = 0x3FF000064A9CDC44
movq %rax, 0x10(%rsi)
jmp 0x1345a