Quantum Spectral Curve and Analytic Bethe Ansatz