read a file, instrument it, and write it out