// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::UpdateActionInfo()
void WorldStateUpdater::UpdateActionInfo() {
  const Vector &ball_pos = GetBall().GetPos();

  for (unsigned i = 0; i < mpWorldState->GetPlayerList().size(); ++i) {
    PlayerState &player =
        const_cast<PlayerState &>(*mpWorldState->GetPlayerList()[i]);
    if (!player.IsAlive())
      continue;

    Vector ball_2_player =
        (ball_pos - player.GetPos()).Rotate(-player.GetBodyDir());

    if (!player.IsIdling() &&
        ball_2_player.Mod() < player.GetKickableArea() -
                                  KICKABLE_BUFFER * Sign(player.GetUnum())) {
      player.UpdateKickable(true);
      player.UpdateKickRate(GetKickRate(ball_2_player, player.GetPlayerType()));
    } else {
      player.UpdateKickable(false);
      player.UpdateKickRate(0.0);
    }

    player.UpdateBallCatchable(false);
    if (player.GetUnum() == mpWorldState->GetTeammateGoalieUnum() ||
        player.GetUnum() == -mpWorldState->GetOpponentGoalieUnum()) {
      if ((mpWorldState->GetPlayMode() == PM_Play_On ||
           mpWorldState->GetPlayMode() == PM_Opp_Penalty_Taken) &&
          ball_2_player.Mod() <
              ServerParam::instance().maxCatchableArea() - CATCHABLE_BUFFER) {
        if (player.GetUnum() == mpWorldState->GetTeammateGoalieUnum()) {
          if (ServerParam::instance().ourPenaltyArea().IsWithin(ball_pos) &&
              ServerParam::instance().ourPenaltyArea().IsWithin(
                  player.GetPos())) {
            player.UpdateBallCatchable(true);
          }
        } else {
          if (ServerParam::instance().oppPenaltyArea().IsWithin(ball_pos) &&
              ServerParam::instance().oppPenaltyArea().IsWithin(
                  player.GetPos())) {
            player.UpdateBallCatchable(true);
          }
        }
      }
    }

    player.UpdateMaxTurnAngle(
        GetMaxTurnAngle(player.GetPlayerType(), player.GetVel().Mod()));
  }

  for (unsigned i = 0; i < mpWorldState->GetPlayerList().size();
       ++i) { //这里要等到可踢信息更新完才能更新
    PlayerState &player =
        const_cast<PlayerState &>(*mpWorldState->GetPlayerList()[i]);
    if (!player.IsAlive())
      continue;

    player.UpdateTackleProb(ComputeTackleProb(player.GetUnum(), false), false);
    player.UpdateTackleProb(ComputeTackleProb(player.GetUnum(), true), true);

    if (PlayerParam::instance().playerVersion() > 14.0) {
      player.UpdateDangerousTackleCondition(
          Tackler::MayDangerousIfTackle(player, *mpWorldState));
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %r14
leaq 0x38(%r14), %rax
movq %rax, -0x68(%rbp)
xorl %r15d, %r15d
leaq -0x60(%rbp), %r12
movq %r14, %rsi
movq %r14, -0x40(%rbp)
movl %r15d, %r15d
movq 0x20f8(%rsi), %rax
movq 0x2100(%rsi), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r15, %rdx
jbe 0x4d74d
movq (%rax,%r15,8), %r13
cmpb $0x1, 0x112(%r13)
jne 0x4d745
movsd 0x38(%r14), %xmm0
subsd 0x8(%r13), %xmm0
movsd 0x40(%r14), %xmm1
subsd 0x10(%r13), %xmm1
movsd %xmm0, -0x60(%rbp)
movsd %xmm1, -0x58(%rbp)
movsd 0xb0(%r13), %xmm0
xorpd 0x9ae3(%rip), %xmm0     # 0x57020
movlpd %xmm0, -0x38(%rbp)
movq %r12, %rdi
leaq -0x38(%rbp), %rsi
callq 0xd02c
movsd %xmm0, -0x50(%rbp)
movsd %xmm1, -0x48(%rbp)
cmpl $0x0, 0xc8(%r13)
jg 0x4d5c9
cmpl $0x0, 0x124(%r13)
jg 0x4d5c9
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x10(%rax)
movl 0x11c(%r13), %ecx
sarl $0x1f, %ecx
orl $0x1, %ecx
cvtsi2sd %ecx, %xmm0
mulsd 0xe10c(%rip), %xmm0     # 0x5b6b0
addsd (%rax), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x4d5c9
movb $0x1, 0x128(%r13)
movl 0x114(%r13), %esi
leaq -0x50(%rbp), %rdi
callq 0xd05c
jmp 0x4d5d5
movb $0x0, 0x128(%r13)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x130(%r13)
movb $0x0, 0x138(%r13)
movl 0x11c(%r13), %ecx
movq 0x8(%rbx), %rax
cmpl 0x2110(%rax), %ecx
je 0x4d605
addl 0x2114(%rax), %ecx
jne 0x4d710
movl 0x1c(%rax), %eax
cmpl $0x33, %eax
je 0x4d616
cmpl $0x1, %eax
jne 0x4d710
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3db2c
movsd 0x3458(%rax), %xmm0
addsd 0xe066(%rip), %xmm0     # 0x5b6b0
ucomisd -0x30(%rbp), %xmm0
jbe 0x4d710
leaq 0x8(%r13), %rax
movq %rax, -0x30(%rbp)
movl 0x11c(%r13), %r14d
movq 0x8(%rbx), %rax
movl 0x2110(%rax), %r12d
callq 0x3db2c
cmpl %r12d, %r14d
jne 0x4d6b2
addq $0x3830, %rax           # imm = 0x3830
movabsq $0x3ed92a737110e454, %r14 # imm = 0x3ED92A737110E454
movq %r14, -0x60(%rbp)
movq %rax, %rdi
movq -0x68(%rbp), %rsi
leaq -0x60(%rbp), %r12
movq %r12, %rdx
callq 0x12516
testb %al, %al
je 0x4d70c
callq 0x3db2c
leaq 0x3830(%rax), %rdi
jmp 0x4d6e9
addq $0x3850, %rax           # imm = 0x3850
movabsq $0x3ed92a737110e454, %r14 # imm = 0x3ED92A737110E454
movq %r14, -0x60(%rbp)
movq %rax, %rdi
movq -0x68(%rbp), %rsi
leaq -0x60(%rbp), %r12
movq %r12, %rdx
callq 0x12516
testb %al, %al
je 0x4d70c
callq 0x3db2c
leaq 0x3850(%rax), %rdi
movq %r14, -0x38(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x12516
testb %al, %al
movq -0x40(%rbp), %r14
je 0x4d710
movb $0x1, 0x138(%r13)
jmp 0x4d710
movq -0x40(%rbp), %r14
movl 0x114(%r13), %edi
movsd 0x30(%r13), %xmm0
movsd 0x38(%r13), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
callq 0x2ac27
movsd %xmm0, 0x158(%r13)
movq 0x8(%rbx), %rsi
incl %r15d
jmp 0x4d4d4
xorl %r13d, %r13d
leaq -0x50(%rbp), %r14
pushq $0x1
popq %r15
movl %r13d, %r13d
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x4d804
movq (%rax,%r13,8), %r12
cmpb $0x1, 0x112(%r12)
jne 0x4d7ee
movl 0x11c(%r12), %eax
movl %eax, -0x50(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x4d814
movsd %xmm0, 0x140(%r12)
movl 0x11c(%r12), %eax
movl %eax, -0x50(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x4d814
movsd %xmm0, 0x148(%r12)
callq 0x38d94
movsd 0x31a8(%rax), %xmm0
ucomisd 0x9a4c(%rip), %xmm0     # 0x57220
movq 0x8(%rbx), %rsi
jbe 0x4d7ee
movq %r12, %rdi
callq 0x416fc
movb %al, 0x150(%r12)
movq 0x8(%rbx), %rsi
incl %r13d
movq 0x20f8(%rsi), %rax
movq 0x2100(%rsi), %rcx
jmp 0x4d758
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop