Code Optimization for Quantum Computing