def recover_x
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/ecdsa.bend as Ecdsaimport Base
222def recover_x(+one: Nat, +e: Nat, +r: Nat, +s: Nat, +id: Nat) -> Maybe<&2, List<&2, U32>>:
223 +x = Nat.add(r, Nat.mul(Nat.div(id, 2n), n(one)))
224 recover_x_if(one, e, r, s, id, x, Nat.is_lt(x, p(one)))