Kill some accidentally-left-over debug prints.
Basic initial implementation of loop analysis.

This is largely just a first attempt, and isn't yet tested. The analyzer
module is getting a bit messy so I'm just dropping this in here with the
intention of doing some refactoring later, after which some more tests
can be written.