There is a passage in the Buddhist Sutra on Mindfulness called the Nine Cemetery Contemplations. Apprentice monks are instructed to meditate on a series of decomposing bodies in the charnel ground, starting with a body "swollen and blue and festering," progressing to one "being eaten by…different kinds of worms," and moving on to a skeleton, "without flesh and blood, held together by the tendons." The monks were told to keep meditating until they were calm and a smile appeared on their faces.
The Buddhist Sutra on Mindfulness includes the Nine Cemetery Contemplations, where apprentice monks meditate on various stages of decay in bodies found in a charnel ground. They begin with a swollen, festering body and move through various decomposing forms, including one being consumed by worms, ultimately culminating in a skeleton held together by tendons.
The purpose of these meditations is to confront the reality of death and decay, guiding monks to a state of calmness. As they continue their practice, they eventually find peace and even experience a smile, reflecting acceptance and understanding of the impermanence of life.