// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/PositionInfo.cpp
// Function: PositionInfo::UpdateDistMatrix()
void PositionInfo::UpdateDistMatrix() {
  for (int i = 0; i < 1 + 2 * TEAMSIZE; ++i) {
    for (int j = 0; j < 1 + 2 * TEAMSIZE; ++j) {
      mDistMatrix[i][j] = -1.0;
    }
  }

  for (int i = 0; i < TEAMSIZE; ++i) {
    mTeammateDir2Ball[i] = 0.0;
    mOpponentDir2Ball[i] = 0.0;
  }

  const vector<PlayerState *> &player_list = mpWorldState->GetPlayerList();

  for (vector<PlayerState *>::const_iterator it = player_list.begin();
       it != player_list.end(); ++it) {
    if ((*it)->IsAlive()) {
      int index = Unum2Index((*it)->GetUnum());
      Vector rel_pos = (*it)->GetPos() - mpWorldState->GetBall().GetPos();
      mDistMatrix[0][index] = rel_pos.Mod();
      mDistMatrix[index][index] = 0.0;

      // 更新球员相对于球的角度
      if ((*it)->GetUnum() > 0) {
        mTeammateDir2Ball[(*it)->GetUnum() - 1] = rel_pos.Dir();
      } else {
        mOpponentDir2Ball[-(*it)->GetUnum() - 1] = rel_pos.Dir();
      }
    }
  }

  const uint player_list_size = player_list.size();
  for (unsigned int i = 0; i < player_list_size; ++i) {
    const PlayerState *pi = player_list[i];
    if (pi->IsAlive()) {
      for (unsigned int j = i + 1; j < player_list_size; ++j) {
        const PlayerState *pj = player_list[j];
        if (pj->IsAlive()) {
          int index1 = Unum2Index(pi->GetUnum());
          int index2 = Unum2Index(pj->GetUnum());
          mDistMatrix[index1][index2] = mDistMatrix[index2][index1] =
              pi->GetPos().Dist(pj->GetPos());
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x17, -0xc(%rbp)
jge 0x7e3a8
movl $0x0, -0x10(%rbp)
cmpl $0x17, -0x10(%rbp)
jge 0x7e39b
movq -0xe8(%rbp), %rdi
addq $0x20, %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %rsi
callq 0x80fe0
movq %rax, %rdi
movslq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x81000
movsd 0x4349c(%rip), %xmm0    # 0xc1828
movsd %xmm0, (%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x7e34e
jmp 0x7e39d
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x7e341
movl $0x0, -0x24(%rbp)
cmpl $0xb, -0x24(%rbp)
jge 0x7e40c
movq -0xe8(%rbp), %rdi
addq $0x17f8, %rdi           # imm = 0x17F8
movslq -0x24(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x81020
movq -0xe8(%rbp), %rdi
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
addq $0x1850, %rdi           # imm = 0x1850
movslq -0x24(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x81020
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7e3af
movq -0xe8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x81040
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x81060
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x810d0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x81090
testb $0x1, %al
jne 0x7e450
jmp 0x7e65c
leaq -0x48(%rbp), %rdi
callq 0x81100
movq (%rax), %rdi
callq 0x23f20
testb $0x1, %al
jne 0x7e46a
jmp 0x7e64c
leaq -0x48(%rbp), %rdi
callq 0x81100
movq (%rax), %rdi
callq 0x1b470
movq -0xe8(%rbp), %rdi
movl %eax, %esi
callq 0x81120
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x81100
movq (%rax), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rcx
movq -0xe8(%rbp), %rax
movq %rcx, -0xf8(%rbp)
movq 0x10(%rax), %rdi
callq 0x10570
movq %rax, %rdi
addq $0x8, %rdi
callq 0x11090
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
callq 0x110a0
movsd %xmm0, -0x68(%rbp)
movsd %xmm1, -0x60(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x104e0
movq -0xe8(%rbp), %rdi
movsd %xmm0, -0xf0(%rbp)
addq $0x20, %rdi
movq $0x0, -0x70(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x80fe0
movq %rax, %rdi
movslq -0x54(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x81000
movsd -0xf0(%rbp), %xmm0
movq -0xe8(%rbp), %rdi
movsd %xmm0, (%rax)
addq $0x20, %rdi
movslq -0x54(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x80fe0
movq %rax, %rdi
movslq -0x54(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x81000
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
leaq -0x48(%rbp), %rdi
callq 0x81100
movq (%rax), %rdi
callq 0x1b470
cmpl $0x0, %eax
jle 0x7e5e3
leaq -0x68(%rbp), %rdi
callq 0x10520
movq -0xe8(%rbp), %rax
movsd %xmm0, -0x100(%rbp)
addq $0x17f8, %rax           # imm = 0x17F8
movq %rax, -0x108(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x81100
movq (%rax), %rdi
callq 0x1b470
movq -0x108(%rbp), %rdi
subl $0x1, %eax
cltq
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rsi
callq 0x81020
movsd -0x100(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x7e64a
leaq -0x68(%rbp), %rdi
callq 0x10520
movq -0xe8(%rbp), %rax
movsd %xmm0, -0x110(%rbp)
addq $0x1850, %rax           # imm = 0x1850
movq %rax, -0x118(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x81100
movq (%rax), %rdi
callq 0x1b470
movq -0x118(%rbp), %rdi
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
subl $0x1, %eax
cltq
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %rsi
callq 0x81020
movsd -0x110(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x7e64c
jmp 0x7e64e
leaq -0x48(%rbp), %rdi
callq 0x81150
jmp 0x7e42d
movq -0x40(%rbp), %rdi
callq 0x81170
movl %eax, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x7e850
movq -0x40(%rbp), %rdi
movl -0xa0(%rbp), %eax
movl %eax, %esi
callq 0x81190
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x23f20
testb $0x1, %al
jne 0x7e6b7
jmp 0x7e83a
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x9c(%rbp), %eax
jae 0x7e838
movq -0x40(%rbp), %rdi
movl -0xac(%rbp), %eax
movl %eax, %esi
callq 0x81190
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
callq 0x23f20
testb $0x1, %al
jne 0x7e708
jmp 0x7e822
movq -0xa8(%rbp), %rdi
callq 0x1b470
movq -0xe8(%rbp), %rdi
movl %eax, %esi
callq 0x81120
movl %eax, -0xbc(%rbp)
movq -0xb8(%rbp), %rdi
callq 0x1b470
movq -0xe8(%rbp), %rdi
movl %eax, %esi
callq 0x81120
movl %eax, -0xc0(%rbp)
movq -0xa8(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, -0x128(%rbp)
movq -0xb8(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq -0x128(%rbp), %rdi
movq %rax, %rsi
callq 0x1d6d0
movq -0xe8(%rbp), %rdi
movsd %xmm0, -0x120(%rbp)
addq $0x20, %rdi
movslq -0xc0(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0xc8(%rbp), %rsi
callq 0x80fe0
movq %rax, %rdi
movslq -0xbc(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xd0(%rbp), %rsi
callq 0x81000
movq -0xe8(%rbp), %rdi
movsd -0x120(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x20, %rdi
movslq -0xbc(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x80fe0
movq %rax, %rdi
movslq -0xc0(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xe0(%rbp), %rsi
callq 0x81000
movsd -0x120(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x7e824
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x7e6c6
jmp 0x7e83a
jmp 0x7e83c
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x7e675
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax)