Simulated populations of white dwarfs and N type carbon stars were generated for a Salpeter initial mass function and constant stellar birth rate history. The effect of very strong mass loss on the mass distribution of white dwarfs and the luminosity distribution of carbon stars is discussed and the results are compared with observations. A significant mass loss by stars on the TP-AGB occurs besides regular stellar wind and planetary nebulae ejection. Thus it is possible to explain the luminosity functions of carbon and M stars in the Magellanic Clouds (with very few stars brighter than Mbol = -6.0), the very narrow mass distribution of white dwarfs, and the very small number of white dwarfs with M > 1.0 MΘ. The luminosity of some AGB stars in the SMC is so high that they may be supernova of type 1 1/2 precursors. There are no such stars in the LMC. Comparison of the theoretical and observed luminosity distributions of high-luminosity AGB stars in the Magellanic Clouds shows that the mass-loss rate of these stars in the LMC is about an order of magnitude larger than in the SMC. In the Galaxy carbon stars may form only from stars with initial mass less than 1.5 MΘ due to the relatively small initial heavy element abundance in these stars; this is perhaps the main reason for the absence of carbon stars in open clusters in the Galaxy.