// File: 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
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq 0x10(%rax), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x25310
movq -0xd0(%rbp), %rdi
movl %eax, -0x1c(%rbp)
leaq -0x1c(%rbp), %rsi
callq 0x1d480
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
movl %eax, -0xc4(%rbp)
subl $0xf, %eax
je 0x242e5
jmp 0x2428c
movl -0xc4(%rbp), %eax
subl $0x10, %eax
je 0x242ad
jmp 0x24299
movl -0xc4(%rbp), %eax
subl $0x11, %eax
je 0x243bc
jmp 0x246e0
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x10430
callq 0xa47b0
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x25330
jmp 0x246e2
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1d780
testb $0x1, %al
jne 0x242fb
jmp 0x2436a
callq 0x2ec90
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movsd -0x30(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd 0x9d92c(%rip), %xmm2    # 0xc1c60
movsd 0x9d39c(%rip), %xmm3    # 0xc16d8
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x30f80
callq 0xa47b0
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
movsd 0x9ccad(%rip), %xmm0    # 0xc1010
callq 0x25370
jmp 0x243b7
callq 0x2ec90
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd 0x9d8bd(%rip), %xmm2    # 0xc1c60
movsd 0x9d32d(%rip), %xmm3    # 0xc16d8
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x30f80
jmp 0x246e2
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x10e40
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, -0xdc(%rbp)
movq 0x38(%rax), %rdi
callq 0x253b0
movl %eax, %ecx
movl -0xdc(%rbp), %eax
cmpl %ecx, %eax
jne 0x24644
movq -0xd8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10ed0
cmpl $0xf, %eax
jne 0x245ab
movq -0xd8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12100
movq %rax, %rcx
movq -0xd8(%rbp), %rax
movq %rcx, -0xe8(%rbp)
movq 0x10(%rax), %rdi
callq 0x253d0
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x9ed10
movl %eax, -0xe0(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x253f0
movl %eax, %ecx
movl -0xe0(%rbp), %eax
subl $0x6, %ecx
cmpl %ecx, %eax
jge 0x24505
callq 0x2ec90
movq %rax, %rsi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rdx
leaq -0x70(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x31340
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x70(%rbp), %rdi
callq 0xbef0
callq 0xa47b0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
movq %rcx, -0xf8(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1b470
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movl %eax, %edx
movsd 0x9cb2f(%rip), %xmm0    # 0xc1010
callq 0x1ded0
callq 0xa47b0
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x25330
jmp 0x245a6
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x10ef0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x24557
callq 0x4ff20
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
movq -0x10(%rbp), %rax
movsd 0x48(%rax), %xmm1
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x54130
jmp 0x245a4
callq 0x2ec90
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x30(%rax), %rax
movq %rax, -0x78(%rbp)
movsd -0x80(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movsd 0x9d6d0(%rip), %xmm2    # 0xc1c60
movsd 0x9d140(%rip), %xmm3    # 0xc16d8
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x30f80
jmp 0x245a6
jmp 0x2463f
movq -0xd8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10ed0
cmpl $0x10, %eax
jne 0x2461b
callq 0x2ec90
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq 0x30(%rax), %rax
movq %rax, -0x88(%rbp)
movsd -0x90(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
movsd 0x9d65b(%rip), %xmm2    # 0xc1c60
movsd 0x9d0cb(%rip), %xmm3    # 0xc16d8
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x30f80
jmp 0x2463d
movq 0xd99ce(%rip), %rdi     # 0xfdff0
leaq 0x9d6a6(%rip), %rsi     # 0xc1ccf
callq 0xa5a0
movq %rax, %rdi
movq 0xd9978(%rip), %rsi     # 0xfdfb0
callq 0xa630
jmp 0x2463f
jmp 0x246de
callq 0x2ec90
movq %rax, %rsi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rdx
leaq -0xc0(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x31340
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0xc0(%rbp), %rdi
callq 0xbef0
callq 0xa47b0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
movq %rcx, -0x108(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1b470
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rsi
movl %eax, %edx
movsd 0x9c951(%rip), %xmm0    # 0xc1010
callq 0x1ded0
callq 0xa47b0
movq %rax, %rdi
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x25330
jmp 0x246e2
jmp 0x246e2
movb $0x1, %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nop