The relative roles of mergers and star formation in regulating galaxy growth are still a matter of intense debate. We here present our decode, a new Discrete statistical sEmi-empiriCal mODEl specifically designed to predict rapidly and efficiently, in a full cosmological context, galaxy assembly, and merger histories for any given input stellar mass–halo mass (SMHM) relation. decode generates object-by-object dark matter merger trees (hence discrete) from accurate subhalo mass and infall redshift probability functions (hence statistical) for all subhaloes, including those residing within other subhaloes, with virtually no resolution limits on mass or volume. Merger trees are then converted into galaxy assembly histories via an input, redshift-dependent SMHM relation, which is highly sensitive to the significant systematics in the galaxy stellar mass function and on its evolution with cosmic time. decode can accurately reproduce the predicted mean galaxy merger rates and assembly histories of hydrodynamic simulations and semi-analytical models, when adopting in input their SMHM relations. In this work, we use decode to prove that only SMHM relations implied by stellar mass functions characterized by large abundances of massive galaxies and significant redshift evolution, at least at $M_\star \gtrsim 10^{11} \, \mathrm{M}_\odot$, can simultaneously reproduce the local abundances of satellite galaxies, the galaxy (major merger) pairs since z ∼ 3, and the growth of Brightest Cluster Galaxies. The same models can also reproduce the local fraction of elliptical galaxies, on the assumption that these are strictly formed by major mergers, but not the full bulge-to-disc ratio distributions, which require additional processes.