// File: /workspace/github_cpp_makefile_star2_O1/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 $0x138, %rsp            # imm = 0x138
movq 0x20(%rdi), %rax
cmpb $0x1, 0x128(%rax)
jne 0x14f80
movq %rdi, %r14
movq 0x38(%rdi), %rcx
cmpb $0x0, 0xa8(%rcx)
jne 0x14f80
cmpb $0x0, 0x175(%rax)
jne 0x14f80
movq %rsi, -0x90(%rbp)
leaq -0x140(%rbp), %rbx
leaq 0x48(%r14), %rax
movq %rax, -0x58(%rbp)
movsd 0x56884(%rip), %xmm0    # 0x6b0b8
xorl %r12d, %r12d
movsd %xmm0, -0x38(%rbp)
movq 0x8(%r14), %rax
movl $0x5, -0x160(%rbp)
movq %rax, -0x158(%rbp)
movq %r12, -0x150(%rbp)
movl %r12d, -0x148(%rbp)
movl %r12d, -0x108(%rbp)
movq %r12, -0x100(%rbp)
movl %r12d, -0xf8(%rbp)
movq %r12, -0xf0(%rbp)
movl %r12d, -0xe8(%rbp)
movq %r12, -0xe0(%rbp)
movl %r12d, -0xd8(%rbp)
movq %r12, -0xd0(%rbp)
xorps %xmm1, %xmm1
movups %xmm1, 0x20(%rbx)
movups %xmm1, 0x10(%rbx)
movups %xmm1, (%rbx)
movb $0x0, 0x30(%rbx)
movl $0x6, -0xc8(%rbp)
movq %r12, -0xc0(%rbp)
movsd %xmm0, -0x140(%rbp)
movq 0x28(%r14), %rdi
callq 0x48e36
movsd -0x38(%rbp), %xmm1
movq %rax, %r13
movq (%rax), %rax
cmpq %rax, 0x8(%r13)
je 0x14a7b
xorl %r15d, %r15d
movsd 0x56e65(%rip), %xmm0    # 0x6b750
movsd %xmm0, -0x30(%rbp)
movsd 0x56768(%rip), %xmm3    # 0x6b060
movsd 0x56770(%rip), %xmm4    # 0x6b070
movsd 0x56760(%rip), %xmm5    # 0x6b068
movslq (%rax,%r15,4), %rax
movq 0x10(%r14), %rcx
movq 0x18(%r14), %rdx
imulq $0x178, %rax, %rax      # imm = 0x178
movsd 0xf60(%rax,%rcx), %xmm6
movsd 0xf68(%rax,%rcx), %xmm7
subsd 0x8(%rdx), %xmm6
subsd 0x10(%rdx), %xmm7
movapd %xmm7, %xmm1
mulsd %xmm7, %xmm1
movapd %xmm6, %xmm0
mulsd %xmm6, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x5673d(%rip), %xmm0    # 0x6b090
jb 0x1495b
sqrtsd %xmm0, %xmm0
jmp 0x1498c
movapd %xmm6, -0x80(%rbp)
movapd %xmm7, -0x70(%rbp)
callq 0x93c0
movapd -0x70(%rbp), %xmm7
movapd -0x80(%rbp), %xmm6
movsd 0x566ec(%rip), %xmm5    # 0x6b068
movsd 0x566ec(%rip), %xmm4    # 0x6b070
movsd 0x566d4(%rip), %xmm3    # 0x6b060
ucomisd 0x56dc4(%rip), %xmm0    # 0x6b758
ja 0x14a32
movapd %xmm6, %xmm0
andpd 0x5666a(%rip), %xmm0    # 0x6b010
movsd 0x56692(%rip), %xmm1    # 0x6b040
ucomisd %xmm0, %xmm1
jbe 0x149d2
movapd %xmm7, %xmm1
andpd 0x56650(%rip), %xmm1    # 0x6b010
xorpd %xmm0, %xmm0
movsd 0x56674(%rip), %xmm2    # 0x6b040
ucomisd %xmm1, %xmm2
ja 0x14a07
movapd %xmm7, %xmm0
movapd %xmm6, %xmm1
callq 0x90d0
movsd 0x56681(%rip), %xmm5    # 0x6b068
movsd 0x56681(%rip), %xmm4    # 0x6b070
movsd 0x56669(%rip), %xmm3    # 0x6b060
mulsd 0x56649(%rip), %xmm0    # 0x6b048
divsd 0x56649(%rip), %xmm0    # 0x6b050
movsd -0x38(%rbp), %xmm1
subsd %xmm0, %xmm1
ucomisd %xmm1, %xmm3
jbe 0x14a4f
addsd %xmm4, %xmm1
ucomisd %xmm1, %xmm3
ja 0x14a16
andpd 0x565e8(%rip), %xmm1    # 0x6b010
minsd -0x30(%rbp), %xmm1
movsd %xmm1, -0x30(%rbp)
incl %r15d
movq (%r13), %rax
movq 0x8(%r13), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x14908
jmp 0x14a63
movsd 0x565f1(%rip), %xmm0    # 0x6b048
ucomisd %xmm0, %xmm1
jb 0x14a20
addsd %xmm5, %xmm1
jmp 0x14a57
movsd 0x56cf5(%rip), %xmm0    # 0x6b760
ucomisd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
ja 0x14b2e
movq 0x20(%r14), %r15
movapd %xmm1, %xmm0
mulsd 0x565c5(%rip), %xmm0    # 0x6b050
divsd 0x565b5(%rip), %xmm0    # 0x6b048
leaq -0x40(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x92d0
movsd 0x60(%r15), %xmm0
movsd -0xb8(%rbp), %xmm1
mulsd %xmm0, %xmm1
mulsd -0x40(%rbp), %xmm0
addsd 0x8(%r15), %xmm1
addsd 0x10(%r15), %xmm0
movsd %xmm1, -0x138(%rbp)
movsd %xmm0, -0x130(%rbp)
callq 0x24ed2
movq %rax, %rdi
leaq -0x138(%rbp), %rsi
movl $0x1, %edx
callq 0x24f4c
movsd %xmm0, -0x150(%rbp)
movl $0xb8, %edi
callq 0x94c0
movq %rax, %r13
leaq 0x10(%rax), %rdi
movl $0xa8, %edx
leaq -0x160(%rbp), %rsi
callq 0x93e0
movq %r13, %rdi
movq -0x58(%rbp), %rsi
callq 0x90b0
movsd -0x38(%rbp), %xmm1
incq 0x58(%r14)
addsd 0x56c32(%rip), %xmm1    # 0x6b768
movsd 0x56572(%rip), %xmm0    # 0x6b0b0
ucomisd %xmm1, %xmm0
movapd %xmm1, %xmm0
ja 0x14837
movq 0x20(%r14), %rax
movsd 0x60(%rax), %xmm0
movsd 0x56c03(%rip), %xmm1    # 0x6b760
mulsd %xmm0, %xmm1
movsd %xmm1, -0xa8(%rbp)
movsd 0x56bff(%rip), %xmm1    # 0x6b770
movsd %xmm0, -0x88(%rbp)
mulsd %xmm0, %xmm1
movsd %xmm1, -0xa0(%rbp)
movsd 0x5652b(%rip), %xmm1    # 0x6b0b8
leaq -0x160(%rbp), %r12
movsd %xmm1, -0x70(%rbp)
movq 0x8(%r14), %r13
movq 0x28(%r14), %rdi
callq 0x48e36
movq %rax, %rbx
movq 0x18(%r14), %r15
movsd -0x70(%rbp), %xmm0
mulsd 0x56496(%rip), %xmm0    # 0x6b050
divsd 0x56486(%rip), %xmm0    # 0x6b048
movsd %xmm0, -0xb0(%rbp)
movq %r12, %rdi
leaq -0x40(%rbp), %rsi
callq 0x92d0
movsd -0x40(%rbp), %xmm2
movsd -0xa8(%rbp), %xmm0
mulsd %xmm0, %xmm2
movsd -0x160(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd 0x8(%r15), %xmm2
movsd %xmm2, -0x50(%rbp)
addsd 0x10(%r15), %xmm1
movsd %xmm1, -0x48(%rbp)
callq 0x4a75c
movsd -0x50(%rbp), %xmm3
movsd 0x5643d(%rip), %xmm2    # 0x6b058
movsd 0x37f0(%rax), %xmm0
addsd 0x5644d(%rip), %xmm0    # 0x6b078
ucomisd %xmm0, %xmm3
jb 0x14f14
movsd 0x37f8(%rax), %xmm0
addsd 0x563fb(%rip), %xmm0    # 0x6b040
ucomisd %xmm3, %xmm0
jb 0x14f14
movsd 0x3800(%rax), %xmm0
addsd 0x56419(%rip), %xmm0    # 0x6b078
movsd -0x48(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x14f14
movsd 0x3808(%rax), %xmm0
addsd 0x563c2(%rip), %xmm0    # 0x6b040
ucomisd -0x48(%rbp), %xmm0
jb 0x14f14
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
movq %r13, -0x98(%rbp)
je 0x14d97
movb $0x1, %r15b
movl $0x1, %r13d
xorl %r12d, %r12d
movq 0x10(%r14), %rcx
movslq (%rax,%r12,4), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
movsd 0xf60(%rax,%rcx), %xmm0
movsd 0xf68(%rax,%rcx), %xmm1
subsd %xmm3, %xmm0
subsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x563a9(%rip), %xmm0    # 0x6b090
jb 0x14cef
sqrtsd %xmm0, %xmm0
jmp 0x14d01
callq 0x93c0
movsd -0x50(%rbp), %xmm3
movsd 0x56357(%rip), %xmm2    # 0x6b058
xorl %eax, %eax
movsd -0xa0(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movl $0x0, %ecx
ja 0x14d63
movq 0x10(%r14), %rax
movq (%rbx), %rcx
movslq (%rcx,%r12,4), %rcx
imulq $0x178, %rcx, %rcx      # imm = 0x178
movsd 0xf78(%rax,%rcx), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x450ba
movsd -0x50(%rbp), %xmm3
movsd 0x56310(%rip), %xmm2    # 0x6b058
movsd 0x31e8(%rax), %xmm0
xorl %eax, %eax
ucomisd -0x30(%rbp), %xmm0
movl $0x0, %ecx
ja 0x14d63
movb $0x1, %al
movl %r15d, %ecx
testb %al, %al
je 0x14d87
movl %r13d, %r12d
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %r13d
movl %ecx, %r15d
cmpq %r12, %rdx
ja 0x14ca9
testb $0x1, %cl
leaq -0x160(%rbp), %r12
je 0x14f14
xorpd %xmm0, %xmm0
movl $0x8, %r15d
movsd %xmm2, -0x80(%rbp)
leaq -0x40(%rbp), %r13
movsd %xmm0, -0x30(%rbp)
callq 0x24ed2
movq %rax, %rbx
movq 0x18(%r14), %r12
movsd -0x88(%rbp), %xmm0
mulsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0xb0(%rbp), %xmm0
leaq -0x160(%rbp), %rdi
movq %r13, %rsi
callq 0x92d0
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm0
mulsd -0x160(%rbp), %xmm1
addsd 0x8(%r12), %xmm0
addsd 0x10(%r12), %xmm1
leaq -0x160(%rbp), %r12
movsd %xmm0, -0x160(%rbp)
movsd %xmm1, -0x158(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x24f4c
movsd -0x30(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
addsd 0x56209(%rip), %xmm1    # 0x6b058
movsd %xmm1, -0x80(%rbp)
decl %r15d
jne 0x14daa
mulsd 0x56913(%rip), %xmm0    # 0x6b778
movsd %xmm0, -0x30(%rbp)
movl $0xb8, %edi
callq 0x94c0
movl $0x5, %ecx
movl %ecx, 0x10(%rax)
movq -0x98(%rbp), %rdx
movq %rdx, 0x18(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x20(%rax)
xorl %edx, %edx
movl %edx, 0x28(%rax)
movsd -0x70(%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 -0x88(%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 -0x58(%rbp), %rsi
callq 0x90b0
incq 0x58(%r14)
movsd -0x70(%rbp), %xmm1
addsd 0x56847(%rip), %xmm1    # 0x6b768
movsd 0x56187(%rip), %xmm0    # 0x6b0b0
ucomisd %xmm1, %xmm0
ja 0x14b94
movq -0x58(%rbp), %rbx
cmpq %rbx, 0x48(%r14)
movq -0x90(%rbp), %r15
je 0x14f80
movq %rbx, %rdi
callq 0x12a4c
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 $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq