// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::MaintainConsistency()
void WorldStateUpdater::MaintainConsistency() {
  for (unsigned int i = 0; i < mpWorldState->GetPlayerList().size(); ++i) {
    PlayerState *player = mpWorldState->GetPlayerList()[i];
    if (player->GetUnum() == mSelfUnum)
      continue;
    if (player->IsAlive()) {
      if (player->IsGoalie() || player->GetPlayerType() != 0) {
        Vector vel = player->GetVel();
        if (vel.Mod() > player->GetEffectiveSpeedMax() * player->GetDecay()) {
          vel = vel.Normalize() * player->GetEffectiveSpeedMax() *
                player->GetDecay();
          player->UpdateVel(vel, player->GetVelDelay(), player->GetVelConf());
        }
      }
    }
  }

  Vector vel = Ball().GetVel();
  if (vel.Mod() > ServerParam::instance().ballSpeedMax() *
                      ServerParam::instance().ballDecay()) {
    vel = vel.Normalize() * ServerParam::instance().ballSpeedMax() *
          ServerParam::instance().ballDecay();
    Ball().UpdateVel(vel, Ball().GetVelDelay(), Ball().GetVelConf());
  }

  {
    Vector pos = Ball().GetPos();

    if (pos.X() >= ServerParam::instance().PITCH_LENGTH * 0.5) {
      pos.SetX(ServerParam::instance().PITCH_LENGTH * 0.5 - FLOAT_EPS);
    } else if (pos.X() <= -ServerParam::instance().PITCH_LENGTH * 0.5) {
      pos.SetX(-ServerParam::instance().PITCH_LENGTH * 0.5 + FLOAT_EPS);
    }
    if (pos.Y() >= ServerParam::instance().PITCH_WIDTH * 0.5) {
      pos.SetY(ServerParam::instance().PITCH_WIDTH * 0.5 - FLOAT_EPS);
    } else if (pos.Y() <= -ServerParam::instance().PITCH_WIDTH * 0.5) {
      pos.SetY(-ServerParam::instance().PITCH_WIDTH * 0.5 + FLOAT_EPS);
    }

    Ball().UpdatePos(pos, Ball().GetPosDelay(), Ball().GetPosConf());
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
xorl %r12d, %r12d
leaq -0x40(%rbp), %r14
movl %r12d, %r12d
movq 0x8(%rbx), %rax
movq 0x20f8(%rax), %rcx
movq 0x2100(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0x515b8
movq (%rcx,%r12,8), %r15
movl 0x11c(%r15), %eax
cmpl 0x14(%rbx), %eax
je 0x515b0
cmpb $0x1, 0x112(%r15)
jne 0x515b0
cmpb $0x0, 0x175(%r15)
jne 0x51538
cmpl $0x0, 0x114(%r15)
je 0x515b0
movups 0x30(%r15), %xmm0
movaps %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd 0x60(%r15), %xmm1
mulsd 0x58(%r15), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x515b0
movq %r14, %rdi
callq 0x55a78
movsd 0x58(%r15), %xmm2
movsd 0x60(%r15), %xmm3
mulsd %xmm3, %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
movsd %xmm0, -0x40(%rbp)
movsd %xmm1, -0x38(%rbp)
movl 0x40(%r15), %edx
movsd 0x48(%r15), %xmm0
movq %r15, %rdi
movq %r14, %rsi
callq 0xdde8
incl %r12d
jmp 0x514dd
movups 0x60(%rax), %xmm0
movaps %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
callq 0x3db2c
movsd 0x30f8(%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3db2c
movsd -0x30(%rbp), %xmm1
mulsd 0x30e0(%rax), %xmm1
movsd -0x28(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x51693
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x55a78
movsd %xmm0, -0x30(%rbp)
movsd %xmm1, -0x28(%rbp)
callq 0x3db2c
movsd 0x30f8(%rax), %xmm0
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movsd -0x28(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, -0x28(%rbp)
callq 0x3db2c
movsd 0x30e0(%rax), %xmm0
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd -0x28(%rbp), %xmm2
mulsd %xmm0, %xmm2
movsd %xmm1, (%r14)
movsd %xmm2, 0x8(%r14)
movq 0x8(%rbx), %rax
leaq 0x30(%rax), %rdi
movl 0x70(%rax), %edx
movsd 0x78(%rax), %xmm0
movq %r14, %rsi
callq 0xdde8
movq 0x8(%rbx), %rax
movups 0x38(%rax), %xmm0
movaps %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3db2c
leaq 0x8813(%rip), %rax      # 0x59ec8
movsd (%rax), %xmm0
movsd 0x6187(%rip), %xmm1     # 0x57848
movsd %xmm0, -0x28(%rbp)
mulsd %xmm0, %xmm1
movsd %xmm1, -0x48(%rbp)
callq 0x3db2c
movsd -0x48(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x51710
movsd -0x28(%rbp), %xmm0
mulsd 0x596f(%rip), %xmm0     # 0x57060
ucomisd %xmm1, %xmm0
jb 0x5171d
movsd %xmm0, -0x28(%rbp)
callq 0x3db2c
movsd -0x28(%rbp), %xmm0
addsd 0x5932(%rip), %xmm0     # 0x57040
jmp 0x51718
addsd 0x5938(%rip), %xmm0     # 0x57050
movsd %xmm0, -0x60(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3db2c
leaq 0x879d(%rip), %rax      # 0x59ed0
movsd (%rax), %xmm0
movsd 0x6109(%rip), %xmm1     # 0x57848
movsd %xmm0, -0x28(%rbp)
mulsd %xmm0, %xmm1
movsd %xmm1, -0x48(%rbp)
callq 0x3db2c
movsd -0x48(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x5178e
movsd -0x28(%rbp), %xmm0
mulsd 0x58f1(%rip), %xmm0     # 0x57060
ucomisd %xmm1, %xmm0
jb 0x5179b
movsd %xmm0, -0x28(%rbp)
callq 0x3db2c
movsd -0x28(%rbp), %xmm0
addsd 0x58b4(%rip), %xmm0     # 0x57040
jmp 0x51796
addsd 0x58ba(%rip), %xmm0     # 0x57050
movsd %xmm0, -0x58(%rbp)
movq 0x8(%rbx), %rax
leaq 0x30(%rax), %rdi
movl 0x48(%rax), %edx
movsd 0x50(%rax), %xmm0
leaq -0x60(%rbp), %rsi
callq 0xde1c
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop