// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/ActionEffector.h
// Function: GetTackleProb(Vector const&, bool)
inline double GetTackleProb(const Vector &ball_2_player, const bool foul) {
  double tackle_dist =
      (ball_2_player.X() > 0.06 /*this is buffer*/ ? ServerParam::instance()
                                                         .tackleDist()
                                                   : ServerParam::instance()
                                                         .tackleBackDist());

  if (fabs(tackle_dist) < FLOAT_EPS) {
    return 0.0;
  } else {
    double dx = fabs(ball_2_player.X()) / tackle_dist;
    double dy = fabs(ball_2_player.Y()) / ServerParam::instance().tackleWidth();

    if (dx > 1.0 || dy > 1.0 ||
        ball_2_player.Mod() > ServerParam::instance().maxTackleArea()) {
      return 0.0;
    }

    double exponent = (foul) ? ServerParam::instance().foulExponent()
                             : ServerParam::instance().tackleExponent();
    // tackle failure probability
    double prob = pow(dx, exponent) + pow(dy, exponent);
    prob = MinMax(0.0, prob, 1.0);
    return 1.0 - prob;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rdi
callq 0x176f0
movsd (%rax), %xmm0
movsd 0x44f24(%rip), %xmm1    # 0xc2710
ucomisd %xmm1, %xmm0
jbe 0x7d80a
callq 0x855e0
movq %rax, %rdi
callq 0x7d9d0
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
jmp 0x7d820
callq 0x855e0
movq %rax, %rdi
callq 0x7d9f0
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm1
movaps 0x4382a(%rip), %xmm0    # 0xc1060
pand %xmm0, %xmm1
movsd 0x437c6(%rip), %xmm0    # 0xc1008
ucomisd %xmm1, %xmm0
jbe 0x7d855
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x7d9bb
movq -0x10(%rbp), %rdi
callq 0x176f0
movsd (%rax), %xmm0
movaps 0x437f7(%rip), %xmm1    # 0xc1060
pand %xmm1, %xmm0
divsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x17700
movsd (%rax), %xmm0
movaps 0x437d5(%rip), %xmm1    # 0xc1060
pand %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7da10
movsd -0x60(%rbp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0x43754(%rip), %xmm1    # 0xc1010
ucomisd %xmm1, %xmm0
ja 0x7d8fb
movsd -0x30(%rbp), %xmm0
movsd 0x43741(%rip), %xmm1    # 0xc1010
ucomisd %xmm1, %xmm0
ja 0x7d8fb
movq -0x10(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0x68(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x7da30
movsd -0x68(%rbp), %xmm0
ucomisd (%rax), %xmm0
jbe 0x7d908
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x7d9bb
testb $0x1, -0x11(%rbp)
je 0x7d926
callq 0x855e0
movq %rax, %rdi
callq 0x7da50
movsd (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
jmp 0x7d93c
callq 0x855e0
movq %rax, %rdi
callq 0x7da70
movsd (%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x28(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
callq 0xaa50
movsd %xmm0, -0x78(%rbp)
movsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
callq 0xaa50
movaps %xmm0, %xmm1
movsd -0x78(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x43686(%rip), %xmm0    # 0xc1010
movsd %xmm0, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x12a20
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x4365f(%rip), %xmm0    # 0xc1010
subsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)