optimization of generated code