// File: 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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq 0x8(%rax), %rdi
callq 0x6e590
movb (%rax), %al
subb $0x6c, %al
sete -0xd(%rbp)
movl $0x0, -0x14(%rbp)
movl -0xc(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x2f, %eax
ja 0x94fbd
movq -0x20(%rbp), %rax
leaq 0x300b6(%rip), %rcx     # 0xc4d94
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x3, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x5, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x7, %eax
movl $0x6, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0xb, %eax
movl $0xa, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0xd, %eax
movl $0xc, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x9, %eax
movl $0x8, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x27, %eax
movl $0x26, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x11, %eax
movl $0x12, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x20, %eax
movl $0x21, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x22, %eax
movl $0x23, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x24, %eax
movl $0x25, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x18, %eax
movl $0x19, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movl $0x1, -0x14(%rbp)
jmp 0x9501d
movl $0x10, -0x14(%rbp)
jmp 0x9501d
movl $0x15, -0x14(%rbp)
jmp 0x9501d
movl $0x2, -0x14(%rbp)
jmp 0x9501d
movl $0x3d, -0x14(%rbp)
jmp 0x9501d
movl $0x3e, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x35, %eax
movl $0x34, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x34, %eax
movl $0x35, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x4, %eax
movl $0x5, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x6, %eax
movl $0x7, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0xa, %eax
movl $0xb, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0xc, %eax
movl $0xd, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x8, %eax
movl $0x9, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x26, %eax
movl $0x27, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x12, %eax
movl $0x11, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x23, %eax
movl $0x22, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x21, %eax
movl $0x20, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x25, %eax
movl $0x24, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
movb -0xd(%rbp), %dl
movl $0x19, %eax
movl $0x18, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x9501d
jmp 0x94fbf
movq 0x6902a(%rip), %rdi     # 0xfdff0
leaq 0x2fecc(%rip), %rsi     # 0xc4e99
callq 0xa5a0
movq %rax, %rdi
leaq 0x30275(%rip), %rsi     # 0xc5251
callq 0xa5a0
movq %rax, %rdi
movl $0x126, %esi            # imm = 0x126
callq 0xaa40
movq %rax, %rdi
leaq 0x2e567(%rip), %rsi     # 0xc355f
callq 0xa5a0
movq %rax, %rdi
leaq 0x2fea5(%rip), %rsi     # 0xc4eac
callq 0xa5a0
movq %rax, %rdi
movq 0x68f9a(%rip), %rsi     # 0xfdfb0
callq 0xa630
jmp 0x9502d
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x14(%rbp), %esi
callq 0x97cc0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)