// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorHold.cpp
// Function: BehaviorHoldPlanner::Plan(std::__cxx11::list<ActiveBehavior, std::allocator<ActiveBehavior>>&)
void BehaviorHoldPlanner::Plan(std::list<ActiveBehavior> &behavior_list) {
  if (!mSelfState.IsKickable())
    return;
  if (mSelfState.IsGoalie())
    return;
  if (mStrategy.GetSureOppInterCycle() <= 2 &&
      mStrategy.GetSureOppInterCycle() != 0) {

    ActiveBehavior hold(mAgent, BT_Hold);
    double dDist;
    Vector posAgent = mSelfState.GetPos();
    PlayerState objOpp =
        mWorldState.GetOpponent(mPositionInfo.GetClosestOpponentToBall());
    Vector posOpp = objOpp.GetPos();
    dDist = (posOpp - posAgent).Mod();
    AngleDeg angOpp = objOpp.GetBodyDir();
    AngleDeg ang = 0.0;

    if (dDist < 5) {
      ang = (posAgent - posOpp).Dir();
      int iSign = (GetNormalizeAngleDeg(angOpp - ang)) > 0 ? -1 : 1;
      ang += iSign * 45 - mSelfState.GetBodyDir();
      ang = GetNormalizeAngleDeg(ang);
    }

    if (mBallState.GetPos().Dist(posAgent + Polar2Vector(0.7, ang)) < 0.3) {

      Vector posBallPred = mBallState.GetPredictedPos(1);
      Vector posPred = mSelfState.GetPredictedPos(1);
      if (posPred.Dist(posBallPred) < 0.85 * mSelfState.GetKickableArea()) {
        hold.mDetailType = BDT_Hold_Turn;
        hold.mEvaluation = 1.0 + FLOAT_EPS;
        hold.mAngle = (Vector(ServerParam::instance().PITCH_LENGTH / 2.0, 0.0) -
                       mSelfState.GetPos())
                          .Dir();
        mActiveBehaviorList.push_back(hold);
      }
    } else {
      hold.mDetailType = BDT_Hold_Kick;
      hold.mAngle = ang;
      hold.mEvaluation = 1.0 + FLOAT_EPS;
      mActiveBehaviorList.push_back(hold);
    }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x340(%rbp)
movq 0x20(%rax), %rdi
callq 0x10ef0
testb $0x1, %al
jne 0x201d0
jmp 0x2085d
movq -0x340(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1d780
testb $0x1, %al
jne 0x201e6
jmp 0x201eb
jmp 0x2085d
movq -0x340(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x20a40
cmpl $0x2, %eax
jg 0x2085d
movq -0x340(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x20a40
cmpl $0x0, %eax
je 0x2085d
movq -0x340(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xb8(%rbp), %rdi
movl $0x6, %edx
xorl %ecx, %ecx
callq 0x1b4d0
movq -0x340(%rbp), %rax
movq 0x20(%rax), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rcx
movq -0x340(%rbp), %rax
movups (%rcx), %xmm0
movaps %xmm0, -0xd0(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x350(%rbp)
movq 0x28(%rax), %rdi
callq 0x1d4b0
movq -0x350(%rbp), %rdi
movl %eax, -0x24c(%rbp)
leaq -0x24c(%rbp), %rsi
callq 0x1d480
movq %rax, %rsi
leaq -0x248(%rbp), %rdi
callq 0x1d510
leaq -0x240(%rbp), %rdi
callq 0x11090
movq %rax, -0x348(%rbp)
jmp 0x202b4
movq -0x348(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x260(%rbp)
leaq -0x260(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x110a0
movsd %xmm1, -0x360(%rbp)
movsd %xmm0, -0x358(%rbp)
jmp 0x202ea
movsd -0x360(%rbp), %xmm0
movsd -0x358(%rbp), %xmm1
movsd %xmm1, -0x280(%rbp)
movsd %xmm0, -0x278(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0x368(%rbp)
jmp 0x20320
movsd -0x368(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x11170
movq %rax, -0x370(%rbp)
jmp 0x20345
movq -0x370(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x288(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x290(%rbp)
movsd 0xa1605(%rip), %xmm0    # 0xc1970
ucomisd -0xc0(%rbp), %xmm0
jbe 0x20504
leaq -0xd0(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x110a0
movsd %xmm1, -0x380(%rbp)
movsd %xmm0, -0x378(%rbp)
jmp 0x2039e
movsd -0x380(%rbp), %xmm0
movsd -0x378(%rbp), %xmm1
movsd %xmm1, -0x2a0(%rbp)
movsd %xmm0, -0x298(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x10520
movsd %xmm0, -0x388(%rbp)
jmp 0x203d4
movsd -0x388(%rbp), %xmm0
movsd %xmm0, -0x290(%rbp)
movsd -0x288(%rbp), %xmm0
movsd -0x290(%rbp), %xmm1
subsd %xmm1, %xmm0
movabsq $-0x3f99800000000000, %rax # imm = 0xC066800000000000
movq %rax, -0x2b0(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x116b0
movsd %xmm0, -0x390(%rbp)
jmp 0x2041f
movq -0x340(%rbp), %rax
movsd -0x390(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
setbe %cl
movzbl %cl, %edx
movl %edx, %ecx
leal -0x1(%rcx,%rcx), %ecx
movl %ecx, -0x2a4(%rbp)
movl -0x2a4(%rbp), %edx
movl %edx, %ecx
leal (%rcx,%rcx,8), %edx
movl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, -0x3a0(%rbp)
movq 0x20(%rax), %rdi
callq 0x11170
movq %rax, -0x398(%rbp)
jmp 0x20475
movsd -0x3a0(%rbp), %xmm1
movq -0x398(%rbp), %rax
movsd (%rax), %xmm0
subsd %xmm0, %xmm1
movsd -0x290(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x290(%rbp)
movsd -0x290(%rbp), %xmm0
movabsq $-0x3f99800000000000, %rax # imm = 0xC066800000000000
movq %rax, -0x2b8(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x116b0
movsd %xmm0, -0x3a8(%rbp)
jmp 0x204cf
movsd -0x3a8(%rbp), %xmm0
movsd %xmm0, -0x290(%rbp)
jmp 0x20504
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x268(%rbp)
movl %eax, -0x26c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x12500
jmp 0x20866
movq -0x340(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, -0x3b0(%rbp)
jmp 0x20521
movabsq $0x3fe6666666666666, %rax # imm = 0x3FE6666666666666
movq %rax, -0x2e0(%rbp)
leaq -0x2e0(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x112c0
movsd %xmm1, -0x3c0(%rbp)
movsd %xmm0, -0x3b8(%rbp)
jmp 0x20557
movsd -0x3c0(%rbp), %xmm0
movsd -0x3b8(%rbp), %xmm1
movsd %xmm1, -0x2d8(%rbp)
movsd %xmm0, -0x2d0(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x11360
movsd %xmm1, -0x3d0(%rbp)
movsd %xmm0, -0x3c8(%rbp)
jmp 0x2059c
movq -0x3b0(%rbp), %rdi
movsd -0x3d0(%rbp), %xmm0
movsd -0x3c8(%rbp), %xmm1
movsd %xmm1, -0x2c8(%rbp)
movsd %xmm0, -0x2c0(%rbp)
leaq -0x2c8(%rbp), %rsi
callq 0x1d6d0
movsd %xmm0, -0x3d8(%rbp)
jmp 0x205d9
movsd -0x3d8(%rbp), %xmm1
movsd 0xa138f(%rip), %xmm0    # 0xc1978
ucomisd %xmm1, %xmm0
jbe 0x207ba
movq -0x340(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x1, %esi
callq 0x11fc0
movq %rax, -0x3e0(%rbp)
jmp 0x20611
movq -0x340(%rbp), %rax
movq -0x3e0(%rbp), %rcx
movups (%rcx), %xmm0
movaps %xmm0, -0x2f0(%rbp)
movq 0x20(%rax), %rdi
movl $0x1, %esi
callq 0x11fc0
movq %rax, -0x3e8(%rbp)
jmp 0x20640
movq -0x3e8(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x300(%rbp)
leaq -0x300(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x1d6d0
movsd %xmm0, -0x3f0(%rbp)
jmp 0x2066e
movq -0x340(%rbp), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, -0x3f8(%rbp)
jmp 0x2068b
movsd -0x3f0(%rbp), %xmm1
movq -0x3f8(%rbp), %rax
movsd 0xa12de(%rip), %xmm0    # 0xc1980
mulsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x207b8
movl $0xa, -0x20(%rbp)
movabsq $0x3ff000064a9cdc44, %rax # imm = 0x3FF000064A9CDC44
movq %rax, -0xa8(%rbp)
callq 0x855e0
jmp 0x206cf
leaq 0xa3962(%rip), %rax     # 0xc4038
movsd (%rax), %xmm0
movsd 0xa093e(%rip), %xmm1    # 0xc1020
mulsd %xmm1, %xmm0
movsd %xmm0, -0x328(%rbp)
movq $0x0, -0x330(%rbp)
leaq -0x320(%rbp), %rdi
leaq -0x328(%rbp), %rsi
leaq -0x330(%rbp), %rdx
callq 0x11a10
jmp 0x20715
movq -0x340(%rbp), %rax
movq 0x20(%rax), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, -0x400(%rbp)
jmp 0x20732
movq -0x400(%rbp), %rsi
leaq -0x320(%rbp), %rdi
callq 0x110a0
movsd %xmm1, -0x410(%rbp)
movsd %xmm0, -0x408(%rbp)
jmp 0x20757
movsd -0x410(%rbp), %xmm0
movsd -0x408(%rbp), %xmm1
movsd %xmm1, -0x310(%rbp)
movsd %xmm0, -0x308(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x10520
movsd %xmm0, -0x418(%rbp)
jmp 0x2078d
movq -0x340(%rbp), %rdi
movsd -0x418(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
addq $0x48, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x189a0
jmp 0x207b6
jmp 0x207b8
jmp 0x207fd
movq -0x340(%rbp), %rdi
movl $0xb, -0x20(%rbp)
movsd -0x290(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movabsq $0x3ff000064a9cdc44, %rax # imm = 0x3FF000064A9CDC44
movq %rax, -0xa8(%rbp)
addq $0x48, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x189a0
jmp 0x207fb
jmp 0x207fd
movq -0x340(%rbp), %rdi
addq $0x48, %rdi
callq 0x18580
testb $0x1, %al
jne 0x20851
movq -0x340(%rbp), %rdi
addq $0x48, %rdi
callq 0x185a0
jmp 0x20823
movq -0x340(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x420(%rbp)
addq $0x48, %rdi
callq 0x189e0
movq -0x420(%rbp), %rdi
movq %rax, %rsi
callq 0x189a0
jmp 0x2084f
jmp 0x20851
leaq -0x248(%rbp), %rdi
callq 0x12500
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
movq -0x268(%rbp), %rdi
callq 0xaa60
nopw %cs:(%rax,%rax)
nopl (%rax)