// File: /workspace/github_cpp_makefile_star2_O3/wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::UpdateInfoFromPlayMode()
void WorldStateUpdater::UpdateInfoFromPlayMode() {
  double x, y;

  switch (mpWorldState->GetPlayMode()) {
  case PM_Our_Kick_Off:
  case PM_Opp_Kick_Off:
  case PM_Before_Kick_Off:
  case PM_Goal_Opps:
  case PM_Goal_Ours:
    Ball().UpdatePos(Vector(0, 0));
    Ball().UpdateVel(Vector(0, 0));
    break;

  case PM_Our_Penalty_Setup:
  case PM_Opp_Penalty_Setup:
    Ball().UpdatePos(Vector(ServerParam::instance().PITCH_LENGTH / 2.0 -
                                ServerParam::instance().penDistX(),
                            0.0));
    Ball().UpdateVel(Vector(0, 0));
    break;

  case PM_Our_Goalie_Free_Kick:
    Ball().UpdateVel(Vector(0, 0));
    if (mSelfUnum == mpWorldState->GetTeammateGoalieUnum()) {
      const PlayerState &self_state = mpWorldState->GetTeammate(mSelfUnum);
      const double dist =
          self_state.GetPlayerSize() + ServerParam::instance().ballSize();
      Ball().UpdatePos(self_state.GetPos() +
                       Vector(dist, 0.0).Rotate(self_state.GetBodyDir()));
    }
    break;

  case PM_Our_Kick_In:
  case PM_Opp_Kick_In:
    x = Ball().GetPos().X();
    y = Sign(mpWorldState->GetHistory(1)->GetBall().GetPos().Y()) *
        ServerParam::instance().PITCH_WIDTH * 0.5;
    Ball().UpdatePos(Vector(x, y));
    Ball().UpdateVel(Vector(0, 0));
    break;

  case PM_Our_Corner_Kick:
    x = ServerParam::instance().PITCH_LENGTH * 0.5 - 1.0;
    y = Sign(mpWorldState->GetHistory(1)->GetBall().GetPos().Y()) *
        (ServerParam::instance().PITCH_WIDTH * 0.5 - 1.0);
    Ball().UpdatePos(Vector(x, y));
    Ball().UpdateVel(Vector(0, 0));
    break;

  case PM_Opp_Corner_Kick:
    x = -ServerParam::instance().PITCH_LENGTH * 0.5 - 1.0;
    y = Sign(mpWorldState->GetHistory(1)->GetBall().GetPos().Y()) *
        (ServerParam::instance().PITCH_WIDTH * 0.5 - 1.0);
    Ball().UpdatePos(Vector(x, y));
    Ball().UpdateVel(Vector(0, 0));
    break;

  default:
    break;
  }

  //以下信息只在playMode改变时更新
  if (mpWorldState->GetPlayModeTime() == mpWorldState->CurrentTime()) {
    switch (mpWorldState->GetPlayMode()) {
    case PM_Our_Kick_Off:
    case PM_Opp_Kick_Off:
      // Ball().UpdatePos(Vector(0,0));
      // Ball().UpdateVel(Vector(0,0));
      break;
    case PM_Our_Goal_Kick:
      x = -1.0 * (ServerParam::instance().PITCH_LENGTH * 0.5 -
                  ServerParam::instance().GOAL_AREA_LENGTH);
      y = Sign(mpWorldState->GetHistory(1)->GetBall().GetPos().Y()) *
          ServerParam::instance().GOAL_AREA_WIDTH * 0.5;
      Ball().UpdatePos(Vector(x, y));
      Ball().UpdateVel(Vector(0, 0));
      break;
    case PM_Opp_Goal_Kick:
      x = 1.0 * (ServerParam::instance().PITCH_LENGTH * 0.5 -
                 ServerParam::instance().GOAL_AREA_LENGTH);
      y = Sign(mpWorldState->GetHistory(1)->GetBall().GetPos().Y()) *
          ServerParam::instance().GOAL_AREA_WIDTH * 0.5;
      Ball().UpdatePos(Vector(x, y));
      Ball().UpdateVel(Vector(0, 0));
      break;
    case PM_Our_Back_Pass_Kick:
    case PM_Opp_Back_Pass_Kick:
    case PM_Our_Foul_Charge_Kick:
    case PM_Opp_Foul_Charge_Kick:
      // TODO:we2008算法使用到了截球点,但是WE2009中此结果不支持使用截球信息,因此对此做了简化.
      Ball().UpdateVel(Vector(0, 0));
      break;
    case PM_Our_Offside_Kick:
    case PM_Opp_Offside_Kick:
      Ball().UpdateVel(Vector(0, 0));
      break;
    default:
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movl 0x1c(%r14), %eax
cmpl $0x1f, %eax
jg 0x60a1d
leal -0x2(%rax), %ecx
cmpl $0x6, %ecx
ja 0x60ae6
leaq 0xcd7a(%rip), %rax      # 0x6d760
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
callq 0x49360
leaq 0xb4ed(%rip), %rax      # 0x6bee8
movsd 0x8e75(%rip), %xmm1     # 0x69878
movsd (%rax), %xmm0
mulsd %xmm1, %xmm0
addsd 0x8685(%rip), %xmm0     # 0x69098
movsd %xmm0, -0x40(%rbp)
jmp 0x60c7b
leal -0x20(%rax), %ecx
cmpl $0x7, %ecx
ja 0x60b07
leaq 0xcd4c(%rip), %rax      # 0x6d77c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movsd 0x38(%r14), %xmm0
movsd %xmm0, -0x40(%rbp)
movq 0x8(%r14), %rax
movl 0x14b90(%rax), %ecx
movl %ecx, %edx
addl $0x9, %edx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
negl %edx
addl %edx, %ecx
addl $0x9, %ecx
movslq %ecx, %rcx
imulq $0x2128, %rcx, %rcx     # imm = 0x2128
xorpd %xmm0, %xmm0
cmplesd 0x40(%rax,%rcx), %xmm0
movapd %xmm0, -0x50(%rbp)
callq 0x49360
leaq 0xb454(%rip), %rax      # 0x6bef0
movsd (%rax), %xmm0
movapd 0x8578(%rip), %xmm1     # 0x69020
xorpd %xmm0, %xmm1
movapd -0x50(%rbp), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
mulsd 0x8db3(%rip), %xmm2     # 0x69878
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r14)
movsd %xmm2, 0x8(%r14)
jmp 0x60d24
cmpl $0xe, %eax
je 0x60b10
cmpl $0x16, %eax
jne 0x60d58
addq $0x30, %r14
xorpd %xmm0, %xmm0
leaq -0x30(%rbp), %r15
movapd %xmm0, (%r15)
jmp 0x60b54
cmpl $0x31, %eax
jne 0x60d58
addq $0x30, %r14
callq 0x49360
leaq 0xb3c8(%rip), %rax      # 0x6bee8
movsd (%rax), %xmm0
mulsd 0x8d4c(%rip), %xmm0     # 0x69878
movsd %xmm0, -0x40(%rbp)
callq 0x49360
movsd -0x40(%rbp), %xmm0
subsd 0x3268(%rax), %xmm0
leaq -0x30(%rbp), %r15
movsd %xmm0, (%r15)
movq $0x0, 0x8(%r15)
movsd 0x84fc(%rip), %xmm0     # 0x69058
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xf572
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
jmp 0x60d45
addq $0x30, %r14
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movsd 0x84c5(%rip), %xmm0     # 0x69058
movq %r14, %rdi
xorl %edx, %edx
callq 0xf53c
movslq 0x14(%rbx), %r14
movq 0x8(%rbx), %r15
cmpl 0x2110(%r15), %r14d
jne 0x60d58
callq 0x43dce
movq 0x5c38(%rax), %rax
imulq $0x178, %r14, %rcx      # imm = 0x178
leaq (%rcx,%r15), %r14
addq $-0x20, %r14
movslq 0x64(%r14), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3038(%rax,%rcx), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x49360
movsd -0x40(%rbp), %xmm0
addsd 0x30d8(%rax), %xmm0
movq 0x8(%rbx), %r15
addq $0x30, %r15
leaq -0x60(%rbp), %rdi
movsd %xmm0, (%rdi)
movq $0x0, 0x8(%rdi)
movq %r14, %rsi
callq 0x3268c
addsd -0xa8(%r14), %xmm0
addsd -0xa0(%r14), %xmm1
leaq -0x30(%rbp), %rsi
movsd %xmm0, (%rsi)
movsd %xmm1, 0x8(%rsi)
movsd 0x8419(%rip), %xmm0     # 0x69058
movq %r15, %rdi
xorl %edx, %edx
callq 0xf572
jmp 0x60d58
callq 0x49360
leaq 0xb28e(%rip), %rax      # 0x6bee8
movsd 0x8c16(%rip), %xmm1     # 0x69878
movsd (%rax), %xmm0
mulsd %xmm1, %xmm0
movsd 0x8426(%rip), %xmm1     # 0x69098
subsd %xmm0, %xmm1
movsd %xmm1, -0x40(%rbp)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movl 0x14b90(%rax), %ecx
movl %ecx, %edx
addl $0x9, %edx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
negl %edx
addl %edx, %ecx
addl $0x9, %ecx
movslq %ecx, %rcx
imulq $0x2128, %rcx, %rcx     # imm = 0x2128
xorpd %xmm0, %xmm0
cmplesd 0x40(%rax,%rcx), %xmm0
movapd %xmm0, -0x50(%rbp)
callq 0x49360
leaq 0xb219(%rip), %rax      # 0x6bef0
movsd 0x8b99(%rip), %xmm1     # 0x69878
mulsd (%rax), %xmm1
addsd 0x83ad(%rip), %xmm1     # 0x69098
movapd -0x50(%rbp), %xmm2
movapd %xmm2, %xmm0
andpd %xmm1, %xmm0
xorpd 0x8320(%rip), %xmm1     # 0x69020
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r14)
movlpd %xmm2, 0x8(%r14)
movsd 0x832c(%rip), %xmm0     # 0x69058
movq %r14, %rsi
xorl %edx, %edx
callq 0xf572
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
movsd 0x8305(%rip), %xmm0     # 0x69058
callq 0xf53c
movq 0x8(%rbx), %rdi
movl 0x28(%rdi), %eax
cmpl 0x14(%rdi), %eax
jne 0x60fa3
movl 0x10(%rdi), %eax
cmpl %eax, 0x24(%rdi)
jne 0x60fa3
movl 0x1c(%rdi), %eax
leal -0x5(%rax), %ecx
cmpl $0x8, %ecx
jbe 0x60e6d
addl $-0x28, %eax
cmpl $0x8, %eax
ja 0x60fa3
leaq 0xca2a(%rip), %rcx      # 0x6d7c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x49360
leaq 0xb13d(%rip), %r14      # 0x6bee8
callq 0x49360
leaq 0xb161(%rip), %rax      # 0x6bf18
movsd (%r14), %xmm0
mulsd 0x8ab4(%rip), %xmm0     # 0x69878
subsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movl 0x14b90(%rax), %ecx
movl %ecx, %edx
addl $0x9, %edx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
negl %edx
addl %edx, %ecx
addl $0x9, %ecx
movslq %ecx, %rcx
imulq $0x2128, %rcx, %rcx     # imm = 0x2128
xorpd %xmm0, %xmm0
cmplesd 0x40(%rax,%rcx), %xmm0
movapd %xmm0, -0x50(%rbp)
callq 0x49360
leaq 0xb0f7(%rip), %rax      # 0x6bf20
movsd (%rax), %xmm0
movapd 0x81eb(%rip), %xmm1     # 0x69020
xorpd %xmm0, %xmm1
movapd -0x50(%rbp), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
mulsd 0x8a26(%rip), %xmm2     # 0x69878
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r14)
jmp 0x60f69
leaq 0xc928(%rip), %rax      # 0x6d79c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
addq $0x30, %rdi
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movsd 0x81c5(%rip), %xmm0     # 0x69058
xorl %edx, %edx
jmp 0x60f9e
callq 0x49360
leaq 0xb042(%rip), %r14      # 0x6bee8
callq 0x49360
leaq 0xb066(%rip), %rax      # 0x6bf18
movsd (%r14), %xmm0
mulsd 0x89b9(%rip), %xmm0     # 0x69878
subsd (%rax), %xmm0
xorpd 0x8155(%rip), %xmm0     # 0x69020
movapd %xmm0, -0x40(%rbp)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movl 0x14b90(%rax), %ecx
movl %ecx, %edx
addl $0x9, %edx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rdx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
negl %edx
addl %edx, %ecx
addl $0x9, %ecx
movslq %ecx, %rcx
imulq $0x2128, %rcx, %rcx     # imm = 0x2128
xorpd %xmm0, %xmm0
cmplesd 0x40(%rax,%rcx), %xmm0
movapd %xmm0, -0x50(%rbp)
callq 0x49360
leaq 0xaff4(%rip), %rax      # 0x6bf20
movsd (%rax), %xmm0
movapd 0x80e8(%rip), %xmm1     # 0x69020
xorpd %xmm0, %xmm1
movapd -0x50(%rbp), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
mulsd 0x8923(%rip), %xmm2     # 0x69878
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movaps -0x40(%rbp), %xmm0
movlps %xmm0, (%r14)
movsd %xmm2, 0x8(%r14)
movsd 0x80e1(%rip), %xmm0     # 0x69058
movq %r14, %rsi
xorl %edx, %edx
callq 0xf572
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
movsd 0x80ba(%rip), %xmm0     # 0x69058
callq 0xf53c
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq