// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/Trainer.cpp
// Function: Trainer::ChangePlayMode(PlayMode)
void Trainer::ChangePlayMode(PlayMode pm) {
  bool isOurLeft = (mpObserver->OurInitSide() == 'l'); //我们是否在左侧
  ServerPlayMode spm = SPM_Null;
  switch (pm) {
  case PM_Play_On:
    spm = SPM_PlayOn;
    break;
  case PM_Our_Kick_Off:
    spm = isOurLeft ? SPM_KickOff_Left : SPM_KickOff_Right;
    break;
  case PM_Our_Kick_In:
    spm = isOurLeft ? SPM_KickIn_Left : SPM_KickIn_Right;
    break;
  case PM_Our_Corner_Kick:
    spm = isOurLeft ? SPM_CornerKick_Left : SPM_CornerKick_Right;
    break;
  case PM_Our_Goal_Kick:
    spm = isOurLeft ? SPM_GoalKick_Left : SPM_GoalKick_Right;
    break;
  case PM_Our_Free_Kick:
    spm = isOurLeft ? SPM_FreeKick_Left : SPM_FreeKick_Right;
    break;
  case PM_Our_Indirect_Free_Kick:
    spm = isOurLeft ? SPM_IndFreeKick_Left : SPM_IndFreeKick_Right;
    break;
    // case PM_Our_Goalie_Free_Kick,    /* not a real play mode */
  case PM_Our_Offside_Kick:
    spm = isOurLeft ? SPM_OffSide_Right
                    : SPM_OffSide_Left; //对方越位，我们才能踢球
    break;
  case PM_Our_Back_Pass_Kick:
    spm = isOurLeft ? SPM_Back_Pass_Right : SPM_Back_Pass_Left;
    break;
  case PM_Our_Free_Kick_Fault_Kick:
    spm = isOurLeft ? SPM_Free_Kick_Fault_Right : SPM_Free_Kick_Fault_Left;
    break;
  case PM_Our_CatchFault_Kick:
    spm = isOurLeft ? SPM_CatchFault_Right : SPM_CatchFault_Left;
    break;
  case PM_Our_Foul_Charge_Kick:
    spm = isOurLeft ? SPM_Foul_Charge_Right : SPM_Foul_Charge_Left;
    break;
    //    	case PM_Our_Penalty_Setup:
    //    	case PM_Our_Penalty_Ready:
    //    	case PM_Our_Penalty_Taken:
    //    	case PM_Our_Penalty_Score:
    //    	case PM_Our_Penalty_Miss:
    //    	case PM_Our_Penalty_Foul:
    //    	case PM_Our_Penalty_Winner:

    // PM_Our_Mode,

  case PM_Before_Kick_Off:
    spm = SPM_BeforeKickOff;
    break;
    //    	case PM_Penalty_On_Our_Field:
    //    	case PM_Our_Penalty:
    //    	case PM_Opp_Penalty:
    //    	case PM_Penalty_On_Opp_Field:
  case PM_Drop_Ball:
    spm = SPM_Drop_Ball;
    break;
  case PM_Half_Time:
    spm = SPM_FirstHalfOver;
    break;
  case PM_Time_Over:
    spm = SPM_TimeOver;
    break;
  case PM_Time_Up:
    spm = SPM_TimeUp;
    break;
  case PM_Extended_Time:
    spm = SPM_TimeExtended;
    break;
    //    	case PM_Goal_Ours:
    //    	case PM_Goal_Opps:
  case PM_Our_Foul:
    spm = isOurLeft ? SPM_Foul_Left : SPM_Foul_Right;
    break;
  case PM_Opp_Foul:
    spm = isOurLeft ? SPM_Foul_Right : SPM_Foul_Left;
    break;

    // PM_Opp_Mode,

  case PM_Opp_Kick_Off:
    spm = isOurLeft ? SPM_KickOff_Right : SPM_KickOff_Left;
    break;
  case PM_Opp_Kick_In:
    spm = isOurLeft ? SPM_KickIn_Right : SPM_KickIn_Left;
    break;
  case PM_Opp_Corner_Kick:
    spm = isOurLeft ? SPM_CornerKick_Right : SPM_CornerKick_Left;
    break;
  case PM_Opp_Goal_Kick:
    spm = isOurLeft ? SPM_GoalKick_Right : SPM_GoalKick_Left;
    break;
  case PM_Opp_Free_Kick:
    spm = isOurLeft ? SPM_FreeKick_Right : SPM_FreeKick_Left;
    break;
  case PM_Opp_Indirect_Free_Kick:
    spm = isOurLeft ? SPM_IndFreeKick_Right : SPM_IndFreeKick_Left;
    break;
    //	case PM_Opp_Goalie_Free_Kick,  /* not a real play mode */
  case PM_Opp_Offside_Kick:
    spm = isOurLeft ? SPM_OffSide_Left
                    : SPM_OffSide_Right; //我方越位，对方才能踢球
    break;
  case PM_Opp_Free_Kick_Fault_Kick:
    spm = isOurLeft ? SPM_Free_Kick_Fault_Left : SPM_Free_Kick_Fault_Right;
    break;
  case PM_Opp_Back_Pass_Kick:
    spm = isOurLeft ? SPM_Back_Pass_Left : SPM_Back_Pass_Right;
    break;
  case PM_Opp_CatchFault_Kick:
    spm = isOurLeft ? SPM_CatchFault_Left : SPM_CatchFault_Right;
    break;
  case PM_Opp_Foul_Charge_Kick:
    spm = isOurLeft ? SPM_Foul_Charge_Left : SPM_Foul_Charge_Right;
    break;
    //    	case PM_Opp_Penalty_Setup:
    //    	case PM_Opp_Penalty_Ready:
    //    	case PM_Opp_Penalty_Taken:
    //    	case PM_Opp_Penalty_Score:
    //    	case PM_Opp_Penalty_Miss:
    //    	case PM_Opp_Penalty_Foul:
    //    	case PM_Opp_Penalty_Winner:
  default:
    PRINT_ERROR("Cannot change to this play mode");
    return;
  }

  mpAgent->ChangePlayMode(spm);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
decl %esi
cmpl $0x2f, %esi
ja 0x50ac2
movq 0x8(%rdi), %rax
movb 0x28(%rax), %al
leaq 0x1c2c1(%rip), %rcx     # 0x6cca8
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl $0x3, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x35, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x6, %ebx
jmp 0x50c06
movl $0x10, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x26, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0xc, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x24, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x21, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0xa, %ebx
jmp 0x50c06
movl $0x1, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x34, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x7, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x25, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x9, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x18, %ebx
jmp 0x50c06
movq 0x33527(%rip), %rbx     # 0x83ff0
leaq 0x1c30a(%rip), %rsi     # 0x6cdda
movl $0x12, %edx
movq %rbx, %rdi
callq 0x9560
leaq 0x1c6ae(%rip), %rsi     # 0x6d192
movl $0x1, %edx
movq %rbx, %rdi
callq 0x9560
movq %rbx, %rdi
movl $0x126, %esi            # imm = 0x126
callq 0x9880
movq %rax, %rbx
leaq 0x1a94f(%rip), %rsi     # 0x6b457
movl $0x3, %edx
movq %rax, %rdi
callq 0x9560
leaq 0x1c2d1(%rip), %rsi     # 0x6cded
movl $0x1f, %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
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x9330
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x8, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x5, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x27, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
jmp 0x50c03
movl $0x15, %ebx
jmp 0x50c06
movl $0x2, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x19, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0xb, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0xd, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x22, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x20, %ebx
jmp 0x50c06
movl $0x3e, %ebx
jmp 0x50c06
movl $0x3d, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
orl $0x4, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
sete %bl
xorl $0x23, %ebx
jmp 0x50c06
xorl %ebx, %ebx
cmpb $0x6c, %al
setne %bl
addl $0x11, %ebx
movq 0x18(%rdi), %rdi
callq 0xee28
movq %rax, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xcadc
nop