Save and restore all variables