We have developed an efficient algorithm for the subtraction of infrared divergences that arise in the evaluation of QED corrections to the anomalous magnetic moment of lepton (g-2). By incorporating this new algorithm, we have extended the automated code-generating system developed previously to deal with diagrams without internal lepton loops (called q-type), which produced convergent integrals when applied to diagrams that have only ultraviolet-divergent subdiagrams of vertex type. The new system produces finite integrals for all q-type diagrams, including those that contain self-energy subdiagrams and thus exhibit infrared-divergent behavior. We have thus far verified the system for the sixth- and eighth-order cases. We are now evaluating 6354 vertex diagrams of q-type that contribute to the tenth-order lepton g-2.