Three-term spectral asymptotics for nonlinear Sturm-Liouville problems