Logic Synthesis For Integrated Optics