// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Formation.cpp
// Function: Formation::GetTeammateExpectedGoaliePos(Vector, double)
Vector Formation::GetTeammateExpectedGoaliePos(Vector bp, double run) {
  const WorldState &world_state = mAgent.GetWorldState();

  Vector gPos;
  int Uncyc;
  if (world_state.GetTeammateGoalieUnum() == 0 ||
      world_state.GetTeammate(world_state.GetTeammateGoalieUnum())
              .GetPosConf() < FLOAT_EPS) { //取守门员的位置以及没有见到的周期
    gPos = Vector(ServerParam::instance().PITCH_LENGTH / 2.0, 0.0); // 估值而已

    Vector p[2];
    double dist[2];
    p[0] = Vector(ServerParam::instance().PITCH_LENGTH / 2.0,
                  -ServerParam::instance().goalWidth() / 2.0 + 0.1); // top
    p[1] = Vector(ServerParam::instance().PITCH_LENGTH / 2.0,
                  ServerParam::instance().goalWidth() / 2.0 - 0.1); // down
    dist[0] = bp.Dist(p[0]);
    dist[1] = bp.Dist(p[1]);
    Uncyc = (int)(Min(dist[0], dist[1]) / 5.0);
  } else {
    gPos =
        world_state.GetTeammate(world_state.GetTeammateGoalieUnum()).GetPos();
    Uncyc = world_state.GetTeammate(world_state.GetTeammateGoalieUnum())
                .GetPosDelay();
  }

  return mpTeammateFormation->GetExpectedGoaliePos(bp, run, gPos, Uncyc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x18(%rbp)
movq %rdi, -0x28(%rbp)
movsd %xmm2, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x118(%rbp)
movq 0x8(%rax), %rdi
callq 0x10550
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x11a10
movq -0x38(%rbp), %rdi
callq 0x1eeb0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x109(%rbp)
je 0x3d7d7
movq -0x38(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1eeb0
movq -0x120(%rbp), %rdi
movl %eax, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x12520
movq %rax, %rdi
addq $0x8, %rdi
callq 0x1d930
movsd 0x8383e(%rip), %xmm0    # 0xc1008
ucomisd (%rax), %xmm0
seta %al
movb %al, -0x109(%rbp)
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x3d7e6
jmp 0x3da35
callq 0x855e0
leaq 0x86846(%rip), %rax     # 0xc4038
movsd (%rax), %xmm0
movsd 0x83cb2(%rip), %xmm1    # 0xc14b0
divsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x11a10
movq -0x70(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, %rcx
addq $0x20, %rcx
movq %rcx, -0x130(%rbp)
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rdi
movq %rdi, -0x138(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
leaq -0xa8(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x11a10
movq -0x138(%rbp), %rax
movq -0x130(%rbp), %rcx
addq $0x10, %rax
cmpq %rcx, %rax
movq %rax, -0x128(%rbp)
jne 0x3d84c
callq 0x855e0
leaq 0x8678b(%rip), %rax     # 0xc4038
movsd (%rax), %xmm0
movsd 0x83bf7(%rip), %xmm1    # 0xc14b0
divsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x3fcb0
movsd (%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x83bbb(%rip), %xmm1    # 0xc14b0
divsd %xmm1, %xmm0
movsd 0x84c0f(%rip), %xmm1    # 0xc2510
addsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x11a10
movq -0xd0(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x98(%rbp)
callq 0x855e0
leaq 0x866e9(%rip), %rax     # 0xc4038
movsd (%rax), %xmm0
movsd 0x83b55(%rip), %xmm1    # 0xc14b0
divsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x3fcb0
movsd (%rax), %xmm0
movsd 0x83b30(%rip), %xmm1    # 0xc14b0
divsd %xmm1, %xmm0
movsd 0x84b84(%rip), %xmm1    # 0xc2510
subsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x11a10
movq -0xf0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0xa0(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x1d6d0
movsd %xmm0, -0xc0(%rbp)
leaq -0xa0(%rbp), %rsi
addq $0x10, %rsi
leaq -0x20(%rbp), %rdi
callq 0x1d6d0
movsd %xmm0, -0xb8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
addq $0x8, %rsi
callq 0x12a60
movsd (%rax), %xmm0
movsd 0x83f4b(%rip), %xmm1    # 0xc1970
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x5c(%rbp)
jmp 0x3dab9
movq -0x38(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1eeb0
movq -0x148(%rbp), %rdi
movl %eax, -0x104(%rbp)
leaq -0x104(%rbp), %rsi
callq 0x12520
movq %rax, %rdi
addq $0x8, %rdi
callq 0x11090
movq (%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1eeb0
movq -0x140(%rbp), %rdi
movl %eax, -0x108(%rbp)
leaq -0x108(%rbp), %rsi
callq 0x12520
movq %rax, %rdi
addq $0x8, %rdi
callq 0x1ddd0
movl %eax, -0x5c(%rbp)
movq -0x118(%rbp), %rax
movq 0x10(%rax), %rdi
movsd -0x30(%rbp), %xmm0
movl -0x5c(%rbp), %ecx
leaq -0x20(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x38da0
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x8(%rbp)
movsd -0x10(%rbp), %xmm0
movsd -0x8(%rbp), %xmm1
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)