Reversed order of save_registers and clean_cache so as to not overwrite registers prematurely