Insert variable disposal instructions in the IR

This should help fix #578