// File: 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
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq 0x8(%rax), %rdi
movl $0x7, %esi
callq 0x18520
testb $0x1, %al
jne 0x1f8fb
movq -0x1f0(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x5, %esi
callq 0x18520
testb $0x1, %al
jne 0x1f8fb
jmp 0x1f900
jmp 0x1fbe6
movq -0x1f0(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x184c0
testb $0x1, %al
jne 0x1f916
jmp 0x1f972
movq -0x1f0(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x18500
testb $0x1, %al
jne 0x1f92c
jmp 0x1f972
movq -0x1f0(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xb8(%rbp), %rdi
movl $0x2, %edx
movl $0xd, %ecx
callq 0x1b4d0
movsd 0xa1c43(%rip), %xmm0    # 0xc1598
movsd %xmm0, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x189a0
jmp 0x1fbe6
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd8(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x11a10
callq 0x855e0
movq %rax, %rdi
callq 0x1f240
movq %rax, %rcx
movq -0x1f0(%rbp), %rax
movq %rcx, -0x1f8(%rbp)
movq 0x48(%rax), %rax
addq $0x40, %rax
movq %rax, -0x200(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1f240
movq -0x200(%rbp), %rdi
movq %rax, %rsi
callq 0x110a0
movsd %xmm0, -0x108(%rbp)
movsd %xmm1, -0x100(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x10520
movq -0x1f8(%rbp), %rsi
movsd %xmm0, -0xf8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x1fde0
callq 0x855e0
movq %rax, %rdi
callq 0x1fe30
movq %rax, %rdi
leaq -0xf0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x47cb0
movq -0x1f0(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x1b0(%rbp), %rdi
movl $0x2, %edx
movl $0xc, %ecx
callq 0x1b4d0
movq -0xc8(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x180(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1fe50
movq %rax, %rdi
movsd 0xa1567(%rip), %xmm0    # 0xc1008
movsd %xmm0, -0x1b8(%rbp)
leaq -0xc8(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
callq 0x1d850
testb $0x1, %al
jne 0x1fac2
jmp 0x1fae9
callq 0x38230
movq %rax, %rdi
leaq -0x1b0(%rbp), %rsi
addq $0x28, %rsi
xorl %edx, %edx
callq 0x382c0
movsd %xmm0, -0x1a0(%rbp)
jmp 0x1fbd6
callq 0x855e0
movq %rax, %rdi
callq 0x1f240
movq %rax, %rcx
movq -0x1f0(%rbp), %rax
movq %rcx, -0x208(%rbp)
movq 0x18(%rax), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, -0x210(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x1f240
movq -0x210(%rbp), %rdi
movq %rax, %rsi
callq 0x110a0
movsd %xmm0, -0x1e8(%rbp)
movsd %xmm1, -0x1e0(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x10520
movq -0x208(%rbp), %rsi
movsd %xmm0, -0x1d8(%rbp)
leaq -0x1d0(%rbp), %rdi
leaq -0x1d8(%rbp), %rdx
callq 0x1fde0
callq 0x855e0
movq %rax, %rdi
callq 0x1fe30
movq %rax, %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x47cb0
callq 0x38230
movq %rax, %rdi
leaq -0x1b0(%rbp), %rsi
addq $0x28, %rsi
xorl %edx, %edx
callq 0x382c0
movsd %xmm0, -0x1a0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x189a0
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
nop