Remove all of the variable declarations from inner blocks and hoist them
to toplevel. Initialize `mp' variables once, and use their initial
values, rather than writing `MP_NEW' explicitly in the first assignment.
There's no functional change here.
Two small (temporary) warts. Firstly, the handling of `z' and `zz' in
the factoring loop is rather nasty, repeatedly freeing and recreating
`zz'; and secondly `p1' and `q1' are used in two separate places. To
prevent conflicts here, reset the relevant variables to `MP_NEW' after
freeing them.