class Helper {

  static JacobianPoint clearH2(JacobianPoint p) {
    // (-x + 1) P
    JacobianPoint work = mxChain(p).add(p);
    // -psi(P)
    JacobianPoint minus_psi_p = psi(p).neg();
    // (-x + 1) P - psi(P)
    work = work.add(minus_psi_p);
    // (x^2 - x) P + x psi(P)
    work = mxChain(work);
    // (x^2 - x) P + (x - 1) psi(P)
    work = work.add(minus_psi_p);
    // (x^2 - x - 1) P + (x - 1) psi(P)
    work = work.add(p.neg());
    // psi(psi(2P))
    JacobianPoint psi_psi_2p = psi2(p.dbl());
    // (x^2 - x - 1) P + (x - 1) psi(P) + psi(psi(2P))
    work = work.add(psi_psi_2p);

    return work;
  }

}