A precise asymptotic analysis of learning diffusion models: theory and insights