// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/BehaviorPenalty.cpp
// Function: BehaviorPenaltyExecuter::Execute(ActiveBehavior const&)
bool BehaviorPenaltyExecuter::Execute(const ActiveBehavior &beh) {
  const PlayerState &opp_goalie_state =
      mWorldState.GetOpponent(mWorldState.GetOpponentGoalieUnum());

  switch (beh.mDetailType) {
  case BDT_Setplay_Scan:
    mAgent.Turn(beh.mAngle);
    VisualSystem::instance().SetCanTurn(mAgent, false);
    break;
  case BDT_Setplay_Move:
    if (mSelfState.IsGoalie()) {
      Dasher::instance().GoToPoint(mAgent, beh.mTarget, 0.26);
      VisualSystem::instance().RaiseBall(mAgent, 1.0);
    } else {
      Dasher::instance().GoToPoint(mAgent, beh.mTarget, 0.26);
    }
    break;
  case BDT_Setplay_GetBall:
    if (mAgent.GetSelfUnum() == mStrategy.GetPenaltyTaker()) {
      if (mWorldState.GetPlayMode() == PM_Our_Penalty_Ready) {
        if (mWorldState.CurrentTime() - mWorldState.GetPlayModeTime() <
            ServerParam::instance().penReadyWait() - 6) // wait
        {
          Dasher::instance()
              .GetTurnBodyToAngleAction(mAgent, 0.0)
              .Execute(mAgent);
          VisualSystem::instance().RaisePlayer(mAgent,
                                               opp_goalie_state.GetUnum(), 1.0);
          VisualSystem::instance().SetCanTurn(mAgent, false);
        } else if (mSelfState.IsKickable() == true) {
          Kicker::instance().KickBall(mAgent, beh.mAngle, beh.mKickSpeed);
        } else // 一般不会刚开始就不可踢，以防万一
        {
          Dasher::instance().GoToPoint(mAgent, beh.mTarget, 0.26);
        }
      } else if (mWorldState.GetPlayMode() == PM_Our_Penalty_Taken) {
        Dasher::instance().GoToPoint(mAgent, beh.mTarget, 0.26);
      } else {
        std::cerr << "what penalty_taker will do ???" << std::endl;
      }
    } else {
      Dasher::instance().GetTurnBodyToAngleAction(mAgent, 0.0).Execute(mAgent);
      VisualSystem::instance().RaisePlayer(mAgent, opp_goalie_state.GetUnum(),
                                           1.0);
      VisualSystem::instance().SetCanTurn(mAgent, false);
    }
    break;
  default:
    break;
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x98(%rsi), %eax
cmpl $0xf, %eax
je 0x1967f
cmpl $0x11, %eax
je 0x195a6
cmpl $0x10, %eax
jne 0x1979e
movq 0x8(%rbx), %rdi
movsd 0x20(%r14), %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0xee28
movq %rax, %rdi
movsd -0x28(%rbp), %xmm0
callq 0xbb88
jmp 0x19660
movq 0x10(%rbx), %rsi
movslq 0x2114(%rsi), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
leaq (%rax,%rsi), %r12
addq $0xf58, %r12            # imm = 0xF58
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movl 0x8(%rax), %eax
cmpl 0x148(%rcx), %eax
jne 0x19612
movl 0x1c(%rsi), %eax
cmpl $0x10, %eax
je 0x1976a
cmpl $0xf, %eax
jne 0x196f0
leaq 0x10(%rsi), %rdi
addq $0x24, %rsi
callq 0x546de
movl %eax, %r15d
callq 0x49360
movl 0x3254(%rax), %eax
addl $-0x6, %eax
cmpl %eax, %r15d
jge 0x19734
callq 0x1f148
movq 0x8(%rbx), %rdx
leaq -0x58(%rbp), %r14
xorps %xmm0, %xmm0
movq %r14, %rdi
movq %rax, %rsi
callq 0x21200
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0xb2fc
callq 0x565ee
movq 0x8(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x19660
movl 0x11c(%r12), %esi
movsd 0x4fa00(%rip), %xmm0    # 0x69058
movq %rax, %rdi
callq 0x576ea
callq 0x565ee
movq 0x8(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x1979e
movb $0x0, 0x63c(%rax)
jmp 0x1979e
movq 0x20(%rbx), %rax
movb 0x175(%rax), %r15b
callq 0x1f148
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x50629(%rip), %xmm2    # 0x69cd0
movsd 0x50081(%rip), %xmm3    # 0x69730
movq %rax, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x20f68
cmpb $0x1, %r15b
jne 0x1979e
callq 0x565ee
movq 0x8(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x1979e
movsd 0x4f975(%rip), %xmm0    # 0x69058
movq %rax, %rdi
callq 0x57908
jmp 0x1979e
movq 0x6a8f9(%rip), %rbx     # 0x83ff0
leaq 0x50649(%rip), %rsi     # 0x69d47
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x9560
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x9480
movsbl %al, %esi
movq %rbx, %rdi
callq 0x9070
movq %rax, %rdi
callq 0x9330
jmp 0x1979e
movq 0x20(%rbx), %rax
cmpb $0x1, 0x128(%rax)
jne 0x1976a
callq 0x2d3f2
movq 0x8(%rbx), %rsi
movsd 0x20(%r14), %xmm0
movsd 0x48(%r14), %xmm1
movq %rax, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x30394
jmp 0x1979e
callq 0x1f148
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x50549(%rip), %xmm2    # 0x69cd0
movsd 0x4ffa1(%rip), %xmm3    # 0x69730
movq %rax, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x20f68
movb $0x1, %al
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop