// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorDribble.cpp
// Function: BehaviorDribblePlanner::Plan(std::__cxx11::list<ActiveBehavior, std::allocator<ActiveBehavior>>&)
void BehaviorDribblePlanner::Plan(std::list<ActiveBehavior> &behavior_list) {
  if (!mSelfState.IsKickable())
    return;
  if (mStrategy.IsForbidenDribble())
    return;
  if (mSelfState.IsGoalie())
    return;

  for (AngleDeg dir = -90.0; dir < 90.0; dir += 2.5) {
    ActiveBehavior dribble(mAgent, BT_Dribble, BDT_Dribble_Normal);

    dribble.mAngle = dir;

    const std::vector<Unum> &opp2ball = mPositionInfo.GetCloseOpponentToBall();
    AngleDeg min_differ = HUGE_VALUE;

    for (uint j = 0; j < opp2ball.size(); ++j) {
      Vector rel_pos =
          mWorldState.GetOpponent(opp2ball[j]).GetPos() - mBallState.GetPos();
      if (rel_pos.Mod() > 15.0)
        continue;

      AngleDeg differ = GetAngleDegDiffer(dir, rel_pos.Dir());
      if (differ < min_differ) {
        min_differ = differ;
      }
    }

    if (min_differ < 10.0)
      continue;

    dribble.mTarget = mSelfState.GetPos() +
                      Polar2Vector(mSelfState.GetEffectiveSpeedMax(), dir);

    dribble.mEvaluation =
        Evaluation::instance().EvaluatePosition(dribble.mTarget, true);

    mActiveBehaviorList.push_back(dribble);
  }
  double speed = mSelfState.GetEffectiveSpeedMax();

  for (AngleDeg dir = -90.0; dir < 90.0; dir += 2.5) {
    ActiveBehavior dribble(mAgent, BT_Dribble, BDT_Dribble_Fast);
    dribble.mKickSpeed = speed;
    dribble.mAngle = dir;

    const std::vector<Unum> &opp2ball = mPositionInfo.GetCloseOpponentToBall();
    Vector target = mBallState.GetPos() +
                    Polar2Vector(dribble.mKickSpeed * 10, dribble.mAngle);
    if (!ServerParam::instance().pitchRectanglar().IsWithin(target)) {
      continue;
    }
    bool ok = true;
    for (uint j = 0; j < opp2ball.size(); ++j) {
      Vector rel_pos = mWorldState.GetOpponent(opp2ball[j]).GetPos() - target;
      if (rel_pos.Mod() < dribble.mKickSpeed * 12 ||
          mWorldState.GetOpponent(opp2ball[j]).GetPosConf() <
              PlayerParam::instance().minValidConf()) {
        ok = false;
        break;
      }
    }
    if (!ok) {
      continue;
    }
    dribble.mEvaluation = 0;
    for (int i = 1; i <= 8; ++i) {
      dribble.mEvaluation += Evaluation::instance().EvaluatePosition(
          mBallState.GetPos() +
              Polar2Vector(dribble.mKickSpeed * i, dribble.mAngle),
          true);
    }
    dribble.mEvaluation /= 8;
    dribble.mTarget = target;

    mActiveBehaviorList.push_back(dribble);
  }

  if (!mActiveBehaviorList.empty()) {
    mActiveBehaviorList.sort(std::greater<ActiveBehavior>());
    behavior_list.push_back(mActiveBehaviorList.front());
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq 0x20(%rdi), %rax
cmpb $0x1, 0x128(%rax)
jne 0x14d84
movq %rdi, %r14
movq 0x38(%rdi), %rcx
cmpb $0x0, 0xa8(%rcx)
jne 0x14d84
cmpb $0x0, 0x175(%rax)
jne 0x14d84
movq %rsi, -0x70(%rbp)
leaq -0x120(%rbp), %r12
leaq 0x48(%r14), %r15
movsd 0x54a0f(%rip), %xmm6    # 0x690b8
xorl %r13d, %r13d
movq %r15, -0x60(%rbp)
movsd %xmm6, -0x38(%rbp)
movq 0x8(%r14), %rax
movl $0x5, -0x148(%rbp)
movq %rax, -0x140(%rbp)
movq %r13, -0x138(%rbp)
movl %r13d, -0x130(%rbp)
movl %r13d, -0xf0(%rbp)
movq %r13, -0xe8(%rbp)
movl %r13d, -0xe0(%rbp)
movq %r13, -0xd8(%rbp)
movl %r13d, -0xd0(%rbp)
movq %r13, -0xc8(%rbp)
movl %r13d, -0xc0(%rbp)
movq %r13, -0xb8(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x19(%r12)
movupd %xmm0, 0x10(%r12)
movupd %xmm0, (%r12)
movl $0x6, -0xb0(%rbp)
movq %r13, -0xa8(%rbp)
movsd %xmm6, -0x128(%rbp)
movq 0x28(%r14), %rdi
callq 0x47ac0
movsd -0x38(%rbp), %xmm6
movq %rax, %rbx
movq (%rax), %rax
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
je 0x148f2
xorl %r15d, %r15d
movsd 0x54fe2(%rip), %xmm12   # 0x69750
movsd 0x548d2(%rip), %xmm4    # 0x69048
movsd 0x548c2(%rip), %xmm5    # 0x69040
movsd 0x54fd2(%rip), %xmm7    # 0x69758
movapd 0x54881(%rip), %xmm8    # 0x69010
movsd 0x548c8(%rip), %xmm9    # 0x69060
movsd 0x548cf(%rip), %xmm10   # 0x69070
movsd 0x548be(%rip), %xmm11   # 0x69068
movslq (%rax,%r15,4), %rdx
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdi
imulq $0x178, %rdx, %rdx      # imm = 0x178
movsd 0xf60(%rdx,%rsi), %xmm1
movsd 0xf68(%rdx,%rsi), %xmm0
subsd 0x8(%rdi), %xmm1
subsd 0x10(%rdi), %xmm0
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm1, %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
xorps %xmm2, %xmm2
sqrtsd %xmm3, %xmm2
ucomisd %xmm7, %xmm2
ja 0x148b6
movapd %xmm1, %xmm2
andpd %xmm8, %xmm2
ucomisd %xmm2, %xmm5
jbe 0x14820
movapd %xmm0, %xmm3
andpd %xmm8, %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm3, %xmm5
ja 0x14882
movsd %xmm12, -0x30(%rbp)
callq 0x90d0
movsd -0x30(%rbp), %xmm12
movsd 0x5482e(%rip), %xmm11   # 0x69068
movsd 0x5482d(%rip), %xmm10   # 0x69070
movsd 0x54814(%rip), %xmm9    # 0x69060
movapd 0x547bb(%rip), %xmm8    # 0x69010
movsd 0x54efb(%rip), %xmm7    # 0x69758
movsd -0x38(%rbp), %xmm6
movsd 0x547d6(%rip), %xmm5    # 0x69040
movsd 0x547d6(%rip), %xmm4    # 0x69048
movapd %xmm0, %xmm2
mulsd %xmm4, %xmm2
divsd 0x547ce(%rip), %xmm2    # 0x69050
movapd %xmm6, %xmm0
subsd %xmm2, %xmm0
ucomisd %xmm0, %xmm9
jbe 0x148ce
addsd %xmm10, %xmm0
ucomisd %xmm0, %xmm9
ja 0x14891
andpd 0x5476b(%rip), %xmm0    # 0x69010
minsd %xmm12, %xmm0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movapd %xmm0, %xmm12
incl %r15d
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
ja 0x147aa
jmp 0x148db
ucomisd %xmm4, %xmm0
jb 0x1489d
addsd %xmm11, %xmm0
jmp 0x148ce
movsd 0x54e7d(%rip), %xmm0    # 0x69760
ucomisd %xmm12, %xmm0
movq -0x60(%rbp), %r15
ja 0x1499d
movq 0x20(%r14), %rbx
movapd %xmm6, %xmm0
mulsd 0x5474e(%rip), %xmm0    # 0x69050
divsd 0x5473e(%rip), %xmm0    # 0x69048
leaq -0x40(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x92d0
movsd 0x60(%rbx), %xmm0
movsd -0xa0(%rbp), %xmm1
mulsd %xmm0, %xmm1
mulsd -0x40(%rbp), %xmm0
addsd 0x8(%rbx), %xmm1
addsd 0x10(%rbx), %xmm0
movsd %xmm1, -0x120(%rbp)
movsd %xmm0, -0x118(%rbp)
callq 0x24814
movq %rax, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2488e
movsd %xmm0, -0x138(%rbp)
movl $0xb8, %edi
callq 0x94c0
movq %rax, %rbx
leaq 0x10(%rax), %rdi
movl $0xa8, %edx
leaq -0x148(%rbp), %rsi
callq 0x93e0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x90b0
movsd -0x38(%rbp), %xmm6
incq 0x58(%r14)
addsd 0x54dc3(%rip), %xmm6    # 0x69768
movsd 0x54703(%rip), %xmm0    # 0x690b0
ucomisd %xmm6, %xmm0
ja 0x146b0
movq 0x20(%r14), %rax
movsd 0x60(%rax), %xmm0
movsd 0x54d98(%rip), %xmm1    # 0x69760
mulsd %xmm0, %xmm1
movsd %xmm1, -0x80(%rbp)
movsd 0x54d97(%rip), %xmm1    # 0x69770
movsd %xmm0, -0x68(%rbp)
mulsd %xmm0, %xmm1
movsd %xmm1, -0x78(%rbp)
movsd 0x546c9(%rip), %xmm1    # 0x690b8
leaq -0x148(%rbp), %rbx
movsd %xmm1, -0x58(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0x88(%rbp)
movq 0x28(%r14), %rdi
callq 0x47ac0
movq %rax, %r13
movq 0x18(%r14), %r12
movsd -0x58(%rbp), %xmm0
mulsd 0x5462d(%rip), %xmm0    # 0x69050
divsd 0x5461d(%rip), %xmm0    # 0x69048
movsd %xmm0, -0x90(%rbp)
movq %rbx, %rdi
leaq -0x40(%rbp), %rsi
callq 0x92d0
movsd -0x40(%rbp), %xmm2
movsd -0x80(%rbp), %xmm0
mulsd %xmm0, %xmm2
movsd -0x148(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x8(%r12), %xmm2
movsd %xmm2, -0x50(%rbp)
addsd 0x10(%r12), %xmm1
movsd %xmm1, -0x48(%rbp)
callq 0x49360
movsd -0x50(%rbp), %xmm2
movsd 0x545d5(%rip), %xmm1    # 0x69058
movsd 0x37f0(%rax), %xmm0
addsd 0x545e5(%rip), %xmm0    # 0x69078
ucomisd %xmm0, %xmm2
jb 0x14d1d
movsd 0x37f8(%rax), %xmm0
addsd 0x54593(%rip), %xmm0    # 0x69040
ucomisd %xmm2, %xmm0
jb 0x14d1d
movsd 0x3800(%rax), %xmm0
addsd 0x545b1(%rip), %xmm0    # 0x69078
movsd -0x48(%rbp), %xmm3
ucomisd %xmm0, %xmm3
jb 0x14d1d
movsd 0x3808(%rax), %xmm0
addsd 0x5455a(%rip), %xmm0    # 0x69040
ucomisd -0x48(%rbp), %xmm0
jb 0x14d1d
movq (%r13), %rax
cmpq %rax, 0x8(%r13)
je 0x14ba6
movl $0x1, %r12d
xorl %ecx, %ecx
movq 0x10(%r14), %rdx
movslq (%rax,%rcx,4), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
movsd 0xf60(%rax,%rdx), %xmm0
movsd 0xf68(%rax,%rdx), %xmm1
subsd %xmm2, %xmm0
subsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd -0x78(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x14d1d
addq %rdx, %rax
addq $0xf60, %rax            # imm = 0xF60
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x43dce
movsd -0x50(%rbp), %xmm2
movsd 0x544e3(%rip), %xmm1    # 0x69058
movsd 0x31e8(%rax), %xmm0
ucomisd -0x30(%rbp), %xmm0
ja 0x14d1d
movl %r12d, %ecx
movq (%r13), %rax
movq 0x8(%r13), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %r12d
cmpq %rcx, %rdx
ja 0x14b07
xorpd %xmm0, %xmm0
movl $0x8, %r12d
movsd %xmm1, -0x38(%rbp)
movsd %xmm0, -0x30(%rbp)
callq 0x24814
movq %rax, %r13
movq 0x18(%r14), %r15
movsd -0x68(%rbp), %xmm0
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x90(%rbp), %xmm0
leaq -0x148(%rbp), %rbx
movq %rbx, %rdi
leaq -0x40(%rbp), %rsi
callq 0x92d0
movsd -0x40(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
mulsd %xmm1, %xmm0
mulsd -0x148(%rbp), %xmm1
addsd 0x8(%r15), %xmm0
addsd 0x10(%r15), %xmm1
movsd %xmm0, -0x148(%rbp)
movsd %xmm1, -0x140(%rbp)
movq %r13, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x2488e
movsd -0x30(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
addsd 0x54400(%rip), %xmm1    # 0x69058
movsd %xmm1, -0x38(%rbp)
decl %r12d
jne 0x14bb5
mulsd 0x54b0a(%rip), %xmm0    # 0x69778
movsd %xmm0, -0x30(%rbp)
movl $0xb8, %edi
callq 0x94c0
movl $0x5, %ecx
movl %ecx, 0x10(%rax)
movq -0x88(%rbp), %rdx
movq %rdx, 0x18(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
xorl %edx, %edx
movl %edx, 0x28(%rax)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, 0x30(%rax)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, 0x38(%rax)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, 0x40(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rax)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, 0x58(%rax)
movq %rdx, 0x60(%rax)
movl %edx, 0x68(%rax)
movq %rdx, 0x70(%rax)
movl %edx, 0x78(%rax)
movq %rdx, 0x80(%rax)
movl %edx, 0x88(%rax)
movq %rdx, 0x90(%rax)
movl %edx, 0x98(%rax)
movq %rdx, 0xa0(%rax)
movl %ecx, 0xa8(%rax)
movq %rdx, 0xb0(%rax)
movq %rax, %rdi
movq -0x60(%rbp), %r15
movq %r15, %rsi
callq 0x90b0
incq 0x58(%r14)
movsd -0x58(%rbp), %xmm1
addsd 0x54a3e(%rip), %xmm1    # 0x69768
movsd 0x5437e(%rip), %xmm0    # 0x690b0
ucomisd %xmm1, %xmm0
ja 0x149f6
cmpq %r15, (%r15)
movq %r15, %rbx
movq -0x70(%rbp), %r15
je 0x14d84
movq %rbx, %rdi
callq 0x12934
movq (%rbx), %rbx
addq $0x10, %rbx
movl $0xb8, %edi
callq 0x94c0
movq %rax, %r14
leaq 0x10(%rax), %rdi
movl $0xa8, %edx
movq %rbx, %rsi
callq 0x93e0
movq %r14, %rdi
movq %r15, %rsi
callq 0x90b0
incq 0x10(%r15)
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq