gas exchange and energy production