// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorDribble.cpp
// Function: BehaviorDribbleExecuter::Execute(ActiveBehavior const&)
bool BehaviorDribbleExecuter::Execute(const ActiveBehavior &dribble) {
  Logger::instance().LogDribble(mBallState.GetPos(), dribble.mTarget,
                                "@Dribble", true);

  if (dribble.mDetailType == BDT_Dribble_Normal) {
    Vector ballpos = mBallState.GetPos();
    PlayerState oppState =
        mWorldState.GetOpponent(mPositionInfo.GetClosestOpponentToBall());
    Vector posOpp = oppState.GetPos();
    ballpos = mBallState.GetPredictedPos(1);
    Vector agentpos = mSelfState.GetPos();
    Vector agent_v = agentpos - mSelfState.GetPos();
    AngleDeg agentang = mSelfState.GetBodyDir();

    AtomicAction act;

    if (mSelfState.GetStamina() < 2700) {
      Dasher::instance().GoToPoint(mAgent, act, dribble.mTarget, 0.01, 30);
    } else {
      Dasher::instance().GoToPoint(mAgent, act, dribble.mTarget, 0.01, 100);
    }

    act.mDashPower =
        MinMax(-ServerParam::instance().maxDashPower(), act.mDashPower,
               ServerParam::instance().maxDashPower());

    agent_v = mSelfState.GetVel() * mSelfState.GetDecay();
    if (act.mType != CT_Dash) {
      agentpos = mSelfState.GetPredictedPos(1);
    } else
      agentpos =
          mSelfState.GetPredictedPosWithDash(1, act.mDashPower, act.mDashDir);

    bool collide = mSelfState.GetCollideWithPlayer();
    if (ballpos.Dist(agentpos) > 0.95 * (mSelfState.GetKickableArea()) ||
        collide) // will not be kickable or will make a collision ??
    {
      int p = ((mBallState.GetPos() - mSelfState.GetPos()).Dir() -
               mSelfState.GetBodyDir()) > 0
                  ? 1
                  : -1;
      double outSpeed = mSelfState.GetVel().Mod();
      if (act.mType == CT_Dash && fabs(act.mDashDir) < FLOAT_EPS)
        outSpeed += mSelfState.GetAccelerationFront(act.mDashPower);
      if ((agentpos +
           Polar2Vector(mSelfState.GetKickableArea(), agentang + p * 45) -
           mBallState.GetPos())
              .Mod() <
          (agentpos +
           Polar2Vector(mSelfState.GetKickableArea(), agentang + p * 45) -
           mSelfState.GetPos())
              .Mod()) {
        if (mSelfState.GetStamina() < 2700) {
          return Dasher::instance().GoToPoint(mAgent, dribble.mTarget, 0.01,
                                              30); // dash slow
        } else
          return Dasher::instance().GoToPoint(mAgent, dribble.mTarget, 0.01,
                                              100);
      }
      return Kicker::instance().KickBall(
          mAgent,
          agentpos +
              Polar2Vector(mSelfState.GetKickableArea(), agentang + p * 45),
          outSpeed, KM_Hard);
    } else {
      if (mSelfState.GetStamina() < 2700) {
        return Dasher::instance().GoToPoint(mAgent, dribble.mTarget, 0.01,
                                            30); // dash slow
      } else
        return Dasher::instance().GoToPoint(mAgent, dribble.mTarget, 0.01, 100);
    }
  } else /*if(dribble.mDetailType == BDT_Dribble_Fast)*/ {
    return Kicker::instance().KickBall(mAgent, dribble.mAngle,
                                       dribble.mKickSpeed, KM_Quick);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2ca2e
movq 0x18(%rbx), %rsi
addq $0x8, %rsi
leaq 0x28(%r14), %rdx
leaq 0x45fe1(%rip), %rcx     # 0x577a7
pushq $0x1
popq %r8
movq %rax, %rdi
callq 0x2d324
cmpl $0x6, 0x98(%r14)
jne 0x11876
movq 0x10(%rbx), %r15
movq 0x28(%rbx), %rdi
callq 0x12338
decl %eax
cltq
imulq $0x178, %rax, %rax      # imm = 0x178
leaq (%r15,%rax), %rsi
addq $0x10d0, %rsi           # imm = 0x10D0
leaq -0x218(%rbp), %rdi
callq 0x12368
movq 0x18(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0xd4c0
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movq 0x20(%rbx), %rax
movsd 0xb0(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movb $0x0, -0x90(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0x8c(%rbp)
movups %xmm0, -0x7c(%rbp)
movups %xmm0, -0x70(%rbp)
movsd 0x45ea0(%rip), %xmm0    # 0x57700
ucomisd 0x78(%rax), %xmm0
jbe 0x118a8
callq 0x1a77c
movsd 0x45e9c(%rip), %xmm3    # 0x57710
jmp 0x118b5
callq 0x26f9c
movq 0x8(%rbx), %rsi
movsd 0x20(%r14), %xmm0
movsd 0x48(%r14), %xmm1
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x29212
callq 0x1a77c
movsd 0x45e53(%rip), %xmm3    # 0x57708
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
leaq -0x90(%rbp), %rdx
movsd 0x45e44(%rip), %xmm2    # 0x57718
pushq $0x1
popq %rcx
movq %rax, %rdi
xorl %r8d, %r8d
callq 0x1a7d4
callq 0x3db2c
movsd 0x33c0(%rax), %xmm0
movapd %xmm0, -0x50(%rbp)
callq 0x3db2c
movapd -0x50(%rbp), %xmm0
xorpd 0x4571a(%rip), %xmm0    # 0x57020
movsd -0x70(%rbp), %xmm1
maxsd %xmm0, %xmm1
movsd 0x33c0(%rax), %xmm0
minsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq 0x20(%rbx), %rdi
cmpl $0x2, -0x8c(%rbp)
jne 0x11946
movsd -0x68(%rbp), %xmm1
pushq $0x1
popq %rsi
callq 0x3a78a
movsd %xmm0, -0x50(%rbp)
movsd %xmm1, -0x30(%rbp)
jmp 0x11961
pushq $0x1
popq %rsi
callq 0xd4c0
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x20(%rbx), %rdi
movb 0x121(%rdi), %r15b
movq (%rdi), %rax
callq *0x10(%rax)
movsd -0x28(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
subsd -0x30(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd (%rax), %xmm1
mulsd 0x45d7e(%rip), %xmm1    # 0x57720
ucomisd %xmm1, %xmm0
ja 0x119d6
testb %r15b, %r15b
jne 0x119d6
movq 0x20(%rbx), %rax
movsd 0x45d47(%rip), %xmm0    # 0x57700
ucomisd 0x78(%rax), %xmm0
jbe 0x11b67
callq 0x1a77c
movsd 0x45d3f(%rip), %xmm3    # 0x57710
jmp 0x11b74
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rcx
movsd 0x8(%rax), %xmm0
movsd 0x10(%rax), %xmm1
subsd 0x8(%rcx), %xmm0
subsd 0x10(%rcx), %xmm1
leaq -0xa0(%rbp), %rdi
movsd %xmm0, (%rdi)
movsd %xmm1, 0x8(%rdi)
callq 0xcd30
movsd %xmm0, -0x28(%rbp)
movq 0x20(%rbx), %rdi
movsd 0xb0(%rdi), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd 0x30(%rdi), %xmm0
movsd 0x38(%rdi), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
cmpl $0x2, -0x8c(%rbp)
jne 0x11a7b
movsd -0x68(%rbp), %xmm0
andpd 0x455be(%rip), %xmm0    # 0x57010
movsd 0x455e6(%rip), %xmm1    # 0x57040
ucomisd %xmm0, %xmm1
jbe 0x11a7b
leaq -0x70(%rbp), %rsi
callq 0x124ae
movsd -0x58(%rbp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq 0x20(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
xorl %ecx, %ecx
movsd -0x28(%rbp), %xmm0
ucomisd -0x20(%rbp), %xmm0
seta %cl
leaq 0x45cc9(%rip), %rdx     # 0x57760
movsd -0x38(%rbp), %xmm0
addsd (%rdx,%rcx,8), %xmm0
leaq -0xa0(%rbp), %rsi
movsd %xmm0, -0x38(%rbp)
movsd %xmm0, (%rsi)
movq %rax, %rdi
callq 0xd15b
addsd -0x50(%rbp), %xmm0
addsd -0x30(%rbp), %xmm1
movq 0x18(%rbx), %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movq 0x20(%rbx), %rdi
subsd 0x10(%rax), %xmm1
movsd %xmm1, -0x20(%rbp)
movq (%rdi), %rax
callq *0x10(%rax)
leaq -0x60(%rbp), %rsi
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rsi)
movq %rax, %rdi
callq 0xd15b
movsd -0x20(%rbp), %xmm3
mulsd %xmm3, %xmm3
movsd -0x28(%rbp), %xmm2
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
sqrtsd %xmm2, %xmm2
addsd -0x50(%rbp), %xmm0
addsd -0x30(%rbp), %xmm1
movq 0x20(%rbx), %rax
subsd 0x8(%rax), %xmm0
subsd 0x10(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
ucomisd %xmm2, %xmm0
jbe 0x11b9e
movsd 0x45bb6(%rip), %xmm0    # 0x57700
ucomisd 0x78(%rax), %xmm0
jbe 0x11c06
callq 0x1a77c
movsd 0x45bae(%rip), %xmm3    # 0x57710
jmp 0x11c13
callq 0x1a77c
movsd 0x45b94(%rip), %xmm3    # 0x57708
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x45b8c(%rip), %xmm2    # 0x57718
pushq $0x1
popq %rdx
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x1bd48
jmp 0x11c38
callq 0x26f9c
movq %rax, %r14
movq 0x8(%rbx), %r15
movq 0x20(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
leaq -0x60(%rbp), %rsi
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rsi)
movq %rax, %rdi
callq 0xd15b
movsd -0x50(%rbp), %xmm2
addsd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
leaq -0xa0(%rbp), %rdx
movsd %xmm2, (%rdx)
movsd %xmm0, 0x8(%rdx)
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movsd -0x58(%rbp), %xmm0
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2929c
jmp 0x11c38
callq 0x1a77c
movsd 0x45af5(%rip), %xmm3    # 0x57708
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x45aed(%rip), %xmm2    # 0x57718
pushq $0x1
popq %rdx
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x1bd48
movl %eax, %ebx
leaq -0x218(%rbp), %rdi
callq 0xd716
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
jmp 0x11c6e
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0xd716
movq %rbx, %rdi
callq 0x98b0
nop