Added assembly functions for saving and restoring the registers