Carbon star formation as seen through the non-monotonic initial–final mass relation