// File: /workspace/github_cpp_makefile_star2_O1/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 0x199bf
cmpl $0x11, %eax
je 0x198e6
cmpl $0x10, %eax
jne 0x19ade
movq 0x8(%rbx), %rdi
movsd 0x20(%r14), %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0xef28
movq %rax, %rdi
movsd -0x28(%rbp), %xmm0
callq 0xbc38
jmp 0x199a0
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 0x19952
movl 0x1c(%rsi), %eax
cmpl $0x10, %eax
je 0x19aaa
cmpl $0xf, %eax
jne 0x19a30
leaq 0x10(%rsi), %rdi
addq $0x24, %rsi
callq 0x55ef4
movl %eax, %r15d
callq 0x4a75c
movl 0x3254(%rax), %eax
addl $-0x6, %eax
cmpl %eax, %r15d
jge 0x19a74
callq 0x1f5e8
movq 0x8(%rbx), %rdx
leaq -0x58(%rbp), %r14
xorps %xmm0, %xmm0
movq %r14, %rdi
movq %rax, %rsi
callq 0x2182c
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0xb38c
callq 0x57e2a
movq 0x8(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x199a0
movl 0x11c(%r12), %esi
movsd 0x516c0(%rip), %xmm0    # 0x6b058
movq %rax, %rdi
callq 0x58f34
callq 0x57e2a
movq 0x8(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x19ade
movb $0x0, 0x63c(%rax)
jmp 0x19ade
movq 0x20(%rbx), %rax
movb 0x175(%rax), %r15b
callq 0x1f5e8
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x522e9(%rip), %xmm2    # 0x6bcd0
movsd 0x51d41(%rip), %xmm3    # 0x6b730
movq %rax, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x2157e
cmpb $0x1, %r15b
jne 0x19ade
callq 0x57e2a
movq 0x8(%rax), %rcx
cmpq 0x8(%rbx), %rcx
jne 0x19ade
movsd 0x51635(%rip), %xmm0    # 0x6b058
movq %rax, %rdi
callq 0x59178
jmp 0x19ade
movq 0x6d5b9(%rip), %rbx     # 0x86ff0
leaq 0x52309(%rip), %rsi     # 0x6bd47
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 0x19ade
movq 0x20(%rbx), %rax
cmpb $0x1, 0x128(%rax)
jne 0x19aaa
callq 0x2ddfa
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 0x30ece
jmp 0x19ade
callq 0x1f5e8
movq 0x8(%rbx), %rsi
movsd 0x28(%r14), %xmm0
movsd 0x30(%r14), %xmm1
movsd 0x52209(%rip), %xmm2    # 0x6bcd0
movsd 0x51c61(%rip), %xmm3    # 0x6b730
movq %rax, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x2157e
movb $0x1, %al
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop