// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: Formation::GetTeammateFormationPoint(int, int, Vector)
Vector Formation::GetTeammateFormationPoint(Unum unum, Unum focusTm,
                                            Vector focusPt) {
  Assert(unum >= 1 && unum <= TEAMSIZE);
  if (unum == mAgent.GetWorldState().GetTeammateGoalieUnum()) {
    return Vector(-47.5, 0);
  }

  if (focusTm == mAgent.GetWorldState().GetTeammateGoalieUnum()) {
    int back_center = mpTeammateFormation->GetLineArrange(1) / 2 + 1; // 中后卫
    focusTm = mpTeammateFormation->GetUnumFromPos(1, back_center);
    focusPt.SetX(focusPt.X() + 9.0);
  } else if (focusTm <= Unum_Unknown ||
             mAgent.GetWorldState().CurrentTime().T() < 1) {
    return GetTeammateFormationPoint(unum);
  }

  focusPt = mpTeammateFormation->GetActiveField(focusTm).AdjustToWithin(
      focusPt); //调整到有效范围
  if (focusTm == unum) {
    return focusPt;
  }
  return focusPt + mpTeammateFormation->GetOffside(focusTm, unum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x18(%rbp)
movq %rdi, -0x28(%rbp)
movl %esi, -0x2c(%rbp)
movl %edx, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x2c(%rbp), %ecx
movl %ecx, -0x64(%rbp)
movq 0x8(%rax), %rdi
callq 0x10550
movq %rax, %rdi
callq 0x1eeb0
movl %eax, %ecx
movl -0x64(%rbp), %eax
cmpl %ecx, %eax
jne 0x3dd12
movsd 0x84861(%rip), %xmm0    # 0xc2550
movsd %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x11a10
jmp 0x3de5c
movq -0x70(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, -0x74(%rbp)
movq 0x8(%rax), %rdi
callq 0x10550
movq %rax, %rdi
callq 0x1eeb0
movl %eax, %ecx
movl -0x74(%rbp), %eax
cmpl %ecx, %eax
jne 0x3dd99
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %esi
callq 0x40620
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x70(%rbp), %rax
addl $0x1, %ecx
movl %ecx, -0x44(%rbp)
movq 0x10(%rax), %rdi
movl -0x44(%rbp), %edx
movl $0x1, %esi
callq 0x385d0
movl %eax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x176f0
movsd 0x847d7(%rip), %xmm0    # 0xc2558
addsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1ee90
jmp 0x3dde3
cmpl $0x0, -0x30(%rbp)
jle 0x3ddc1
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x10550
movq %rax, %rdi
callq 0x12100
movq %rax, %rdi
callq 0x13040
cmpl $0x1, %eax
jge 0x3dde1
movq -0x70(%rbp), %rdi
movl -0x2c(%rbp), %esi
movsd 0x83b98(%rip), %xmm0    # 0xc1968
callq 0x3d6c0
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
jmp 0x3de5c
jmp 0x3dde3
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x30(%rbp), %esi
callq 0x40650
movq %rax, %rdi
leaq -0x20(%rbp), %rsi
callq 0x3fbb0
movsd %xmm0, -0x60(%rbp)
movsd %xmm1, -0x58(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x3de33
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3de5c
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x40570
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x11360
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
movsd -0x10(%rbp), %xmm0
movsd -0x8(%rbp), %xmm1
addq $0x80, %rsp
popq %rbp
retq
nop