first-cut port to gmp

Non optimized port to GMP.