Fix bug in bounds inference

We were early-simplifying min and max incorrectly.
fix for test_code_explosion

Bounds inference caused a code explosion again, probably due to the bugfix
commit before this one. Solved via explicit CSE during bounds inference.
Not a good solution. Really need graph-aware bounds inference instead.
Added a boundary condition to interpolate to speed it up.
Added a test for a bug found by the autotuner.