Linear quadratic optimal control of singular nonlinear systems