During which two processes does a substance release energy?