Simplify instrumentation driver code.

This patch separates the instrumentation of the main() function from the
instrumentation of the loop or function under consideration. The result of this
patch is that code is not duplicated and control flow is easier to understand.