Reorder code to resemble the flow graph