  This is the second paper in a series aimed at modeling the black hole (BH)
mass function, from the stellar to the (super)massive regime. In the present
work we focus on (super)massive BHs and provide an ab-initio computation of
their mass function across cosmic times. We consider two main mechanisms to
grow the central BH, that are expected to cooperate in the high-redshift
star-forming progenitors of local massive galaxies. The first is the gaseous
dynamical friction process, that can cause the migration toward the nuclear
regions of stellar-mass BHs originated during the intense bursts of star
formation in the gas-rich host progenitor galaxy, and the buildup of a central
heavy BH seed $M_\bullet\sim 10^{3-5}\, M_\odot$ within short timescales
$\lesssim$ some $10^7$ yr. The second mechanism is the standard Eddington-type
gas disk accretion onto the heavy BH seed, through which the central BH can
become (super)massive $M_\bullet\sim 10^{6-10}\, M_\odot$ within the typical
star-formation duration $\lesssim 1$ Gyr of the host. We validate our
semi-empirical approach by reproducing the observed redshift-dependent
bolometric AGN luminosity functions and Eddington ratio distributions, and the
relationship between the star-formation and the bolometric luminosity of the
accreting central BH. We then derive the relic (super)massive BH mass function
at different redshifts via a generalized continuity equation approach, and
compare it with present observational estimates. Finally, we reconstruct the
overall BH mass function from the stellar to the (super)massive regime, over
more than ten orders of magnitudes in BH mass.
