// File: /workspace/github_cpp_makefile_star2_O1/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 0x629e5
leal -0x2(%rax), %ecx
cmpl $0x6, %ecx
ja 0x62aae
leaq 0xcdf2(%rip), %rax      # 0x6f7a0
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
callq 0x4a75c
leaq 0xb555(%rip), %rax      # 0x6df18
movsd 0x8ead(%rip), %xmm1     # 0x6b878
movsd (%rax), %xmm0
mulsd %xmm1, %xmm0
addsd 0x86bd(%rip), %xmm0     # 0x6b098
movsd %xmm0, -0x40(%rbp)
jmp 0x62c43
leal -0x20(%rax), %ecx
cmpl $0x7, %ecx
ja 0x62acf
leaq 0xcdc4(%rip), %rax      # 0x6f7bc
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 0x4a75c
leaq 0xb4bc(%rip), %rax      # 0x6df20
movsd (%rax), %xmm0
movapd 0x85b0(%rip), %xmm1     # 0x6b020
xorpd %xmm0, %xmm1
movapd -0x50(%rbp), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
mulsd 0x8deb(%rip), %xmm2     # 0x6b878
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r14)
movsd %xmm2, 0x8(%r14)
jmp 0x62cec
cmpl $0xe, %eax
je 0x62ad8
cmpl $0x16, %eax
jne 0x62d20
addq $0x30, %r14
xorpd %xmm0, %xmm0
leaq -0x30(%rbp), %r15
movapd %xmm0, (%r15)
jmp 0x62b1c
cmpl $0x31, %eax
jne 0x62d20
addq $0x30, %r14
callq 0x4a75c
leaq 0xb430(%rip), %rax      # 0x6df18
movsd (%rax), %xmm0
mulsd 0x8d84(%rip), %xmm0     # 0x6b878
movsd %xmm0, -0x40(%rbp)
callq 0x4a75c
movsd -0x40(%rbp), %xmm0
subsd 0x3268(%rax), %xmm0
leaq -0x30(%rbp), %r15
movsd %xmm0, (%r15)
movq $0x0, 0x8(%r15)
movsd 0x8534(%rip), %xmm0     # 0x6b058
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xf682
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
jmp 0x62d0d
addq $0x30, %r14
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movsd 0x84fd(%rip), %xmm0     # 0x6b058
movq %r14, %rdi
xorl %edx, %edx
callq 0xf64c
movslq 0x14(%rbx), %r14
movq 0x8(%rbx), %r15
cmpl 0x2110(%r15), %r14d
jne 0x62d20
callq 0x450ba
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 0x4a75c
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 0x33428
addsd -0xa8(%r14), %xmm0
addsd -0xa0(%r14), %xmm1
leaq -0x30(%rbp), %rsi
movsd %xmm0, (%rsi)
movsd %xmm1, 0x8(%rsi)
movsd 0x8451(%rip), %xmm0     # 0x6b058
movq %r15, %rdi
xorl %edx, %edx
callq 0xf682
jmp 0x62d20
callq 0x4a75c
leaq 0xb2f6(%rip), %rax      # 0x6df18
movsd 0x8c4e(%rip), %xmm1     # 0x6b878
movsd (%rax), %xmm0
mulsd %xmm1, %xmm0
movsd 0x845e(%rip), %xmm1     # 0x6b098
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 0x4a75c
leaq 0xb281(%rip), %rax      # 0x6df20
movsd 0x8bd1(%rip), %xmm1     # 0x6b878
mulsd (%rax), %xmm1
addsd 0x83e5(%rip), %xmm1     # 0x6b098
movapd -0x50(%rbp), %xmm2
movapd %xmm2, %xmm0
andpd %xmm1, %xmm0
xorpd 0x8358(%rip), %xmm1     # 0x6b020
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 0x8364(%rip), %xmm0     # 0x6b058
movq %r14, %rsi
xorl %edx, %edx
callq 0xf682
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
movsd 0x833d(%rip), %xmm0     # 0x6b058
callq 0xf64c
movq 0x8(%rbx), %rdi
movl 0x28(%rdi), %eax
cmpl 0x14(%rdi), %eax
jne 0x62f6b
movl 0x10(%rdi), %eax
cmpl %eax, 0x24(%rdi)
jne 0x62f6b
movl 0x1c(%rdi), %eax
leal -0x5(%rax), %ecx
cmpl $0x8, %ecx
jbe 0x62e35
addl $-0x28, %eax
cmpl $0x8, %eax
ja 0x62f6b
leaq 0xcaa2(%rip), %rcx      # 0x6f800
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x4a75c
leaq 0xb1a5(%rip), %r14      # 0x6df18
callq 0x4a75c
leaq 0xb1c9(%rip), %rax      # 0x6df48
movsd (%r14), %xmm0
mulsd 0x8aec(%rip), %xmm0     # 0x6b878
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 0x4a75c
leaq 0xb15f(%rip), %rax      # 0x6df50
movsd (%rax), %xmm0
movapd 0x8223(%rip), %xmm1     # 0x6b020
xorpd %xmm0, %xmm1
movapd -0x50(%rbp), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
mulsd 0x8a5e(%rip), %xmm2     # 0x6b878
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%r14)
jmp 0x62f31
leaq 0xc9a0(%rip), %rax      # 0x6f7dc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
addq $0x30, %rdi
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movsd 0x81fd(%rip), %xmm0     # 0x6b058
xorl %edx, %edx
jmp 0x62f66
callq 0x4a75c
leaq 0xb0aa(%rip), %r14      # 0x6df18
callq 0x4a75c
leaq 0xb0ce(%rip), %rax      # 0x6df48
movsd (%r14), %xmm0
mulsd 0x89f1(%rip), %xmm0     # 0x6b878
subsd (%rax), %xmm0
xorpd 0x818d(%rip), %xmm0     # 0x6b020
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 0x4a75c
leaq 0xb05c(%rip), %rax      # 0x6df50
movsd (%rax), %xmm0
movapd 0x8120(%rip), %xmm1     # 0x6b020
xorpd %xmm0, %xmm1
movapd -0x50(%rbp), %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
mulsd 0x895b(%rip), %xmm2     # 0x6b878
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
leaq -0x30(%rbp), %r14
movaps -0x40(%rbp), %xmm0
movlps %xmm0, (%r14)
movsd %xmm2, 0x8(%r14)
movsd 0x8119(%rip), %xmm0     # 0x6b058
movq %r14, %rsi
xorl %edx, %edx
callq 0xf682
movq 0x8(%rbx), %rdi
addq $0x30, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq -0x30(%rbp), %rsi
xorl %edx, %edx
movsd 0x80f2(%rip), %xmm0     # 0x6b058
callq 0xf64c
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq