GENERATING EFFICIENT CODE WITH AUTOMATIC DIFFERENTIATION