Differentiable generalized inverses