Refactoring functions that write assembly.

This ensures our assembly is always indented correctly, and callers do
not need to worry about it or call fprintf manually.