Main function-generating code
Adding some code that generates a main function, hopefully to help
with profiling, but profiling is not working yet. :C