Analytic smoothing of geometric maps with applications to KAM theory