Preprocessing, mass-loss and mass segregation of galaxies in dark matter simulations