// File: /workspace/github_cpp_makefile_star2_O2/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:
decl %esi
cmpl $0x2f, %esi
ja 0x44327
movq 0x8(%rdi), %rax
movb 0x28(%rax), %al
leaq 0x16a3f(%rip), %rcx     # 0x5ac88
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
pushq $0x3
jmp 0x4440a
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x35, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x6, %esi
jmp 0x44432
pushq $0x10
jmp 0x4440a
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x26, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0xc, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x24, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x21, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0xa, %esi
jmp 0x44432
pushq $0x1
jmp 0x4440a
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x34, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x7, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x25, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x9, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x18, %esi
jmp 0x44432
pushq %rbp
movq %rsp, %rbp
movq 0x32cbe(%rip), %rdi     # 0x76ff0
leaq 0x16a81(%rip), %rsi     # 0x5adba
callq 0x94b0
leaq 0x16e2d(%rip), %rsi     # 0x5b172
movq %rax, %rdi
callq 0x94b0
movq %rax, %rdi
movl $0x126, %esi            # imm = 0x126
callq 0x9890
leaq 0x150be(%rip), %rsi     # 0x5941f
movq %rax, %rdi
callq 0x94b0
leaq 0x16a5d(%rip), %rsi     # 0x5adcd
movq %rax, %rdi
callq 0x94b0
movq %rax, %rdi
popq %rbp
jmp 0x99e8
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x8, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x5, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x27, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
jmp 0x4442f
pushq $0x15
jmp 0x4440a
pushq $0x2
jmp 0x4440a
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x19, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0xb, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0xd, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x22, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x20, %esi
jmp 0x44432
pushq $0x3e
jmp 0x4440a
pushq $0x3d
popq %rsi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
orl $0x4, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
sete %sil
xorl $0x23, %esi
jmp 0x44432
xorl %esi, %esi
cmpb $0x6c, %al
setne %sil
addl $0x11, %esi
movq 0x18(%rdi), %rdi
jmp 0x45cc0
nop