Simplified and HTML lowered statement dumps

Initial import, adaptation, and cleanup of statement simplification, HTML dump. Original code by @zingales. This needs a review.
Don't leave commented-out bits in place; if it's not necessary, just remove it.