// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/PlayerState.cpp
// Function: PlayerState::GetCatchProb(double const&) const
double PlayerState::GetCatchProb(const double &dist) const {
  if (dist < GetMinCatchArea()) {
    return ServerParam::instance().catchProb();
  } else {
    double min_length = ServerParam::instance().catchAreaLength() *
                        (2.0 - GetCatchAreaLStretch());
    double max_length =
        ServerParam::instance().catchAreaLength() * GetCatchAreaLStretch();
    if (max_length < min_length + FLOAT_EPS)
      return 0.0;
    double delt =
        Sqrt(dist * dist - ServerParam::instance().catchAreaWidth() *
                               ServerParam::instance().catchAreaWidth() / 4);
    if (delt > max_length)
      return 0.0;
    double dx = delt - min_length;
    return MinMax(0.0,
                  ServerParam::instance().catchProb() -
                      ServerParam::instance().catchProb() * dx /
                          (max_length - min_length),
                  ServerParam::instance().catchProb());
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x60(%rbp)
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
callq 0x7d720
movsd -0x58(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7cef7
callq 0x855e0
movq %rax, %rdi
callq 0x7d760
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x7d0ba
callq 0x855e0
movq %rax, %rdi
callq 0x328f0
movq -0x60(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
callq 0x7d780
movsd -0x70(%rbp), %xmm0
movsd 0x4458d(%rip), %xmm1    # 0xc14b0
subsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x328f0
movq -0x60(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
callq 0x7d780
movsd -0x68(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm1
movsd 0x4409e(%rip), %xmm0    # 0xc1008
addsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7cf82
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x7d0ba
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7b4e0
movsd (%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7b4e0
movsd -0x88(%rbp), %xmm1
movsd -0x80(%rbp), %xmm0
movsd -0x78(%rbp), %xmm2
mulsd (%rax), %xmm1
movsd 0x452b8(%rip), %xmm3    # 0xc2298
divsd %xmm3, %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x12420
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
ucomisd -0x28(%rbp), %xmm0
jbe 0x7d02f
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x7d0ba
movsd -0x30(%rbp), %xmm0
subsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7d760
movsd (%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7d760
movsd -0x90(%rbp), %xmm0
movsd (%rax), %xmm1
mulsd -0x40(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
subsd -0x20(%rbp), %xmm2
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7d760
movq %rax, %rdx
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x12a20
movsd (%rax), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)