The regularized Siegel–Weil formula (the second term identity) and the Rallis inner product formula