Rework and add new rules for simplifying ramp/x and ramp%x

Fixes issue #458 

I'd appreciate another set of eyes, because these rules are pretty nuts. They should be tested by the test cases at the bottom, and also by the simplify fuzz-tester.