Have you talked about this with her pediatrician? This is a medical problem. The reason it becomes soft and smells bad, etc. as you describe is because she is constipated and her body finds a way to get rid of it. She holds it for 4 or 5 days because she fears the pain that expelling it will give her. She's now in a terribly painful cycle and does need your extra attention, holding, soothing.
The exhaustion, sweaty and clammy skin are the result of having to work so hard to get the poop past the plug her body has made. Her body has made the plug because when she first had stuff to poop out she didn't get it out. What you need to know is why? Now, it may just be because she's afraid to try to get it out until it's too uncomfortable to not try. It may have started when you didn't realize that she was constipated and now the pain keeps her from pushing it out until she's so uncomfortable she has to push. Or there may be a physical reason why her body doesn't push it out sooner.
Her poop is not soft! She does not have diarrhea. I cannot emphasize that enough! It's soft on that one day but it's either too firm to come out or her body won't let it out the other 4-5 days. Explain this to the doctor in the way you've explained it here.
By the way, stopping diarrhea uses the same techniques as stopping constipation. Both respond, by changing to a normal bm, to increased fiber, liquids, and exercise unless there is a physical reason for the constipation or diarrhea. We use the b.r.a.t diet when a baby has chronic diarrhea because of illness.
Take her to the doctor and together find a way to end the constipation. You're well into a painful cycle and need medical intervention. First to discover if there is a physical reason that started the cycle with constipation. Then, if her body is healthy, to begin a diet and medication to stop the constipation as well as ways to help her poop in spite of her memory of pain.
My grandson had this problem at this age. For some reason he never did seem to avoid the pain. He was banned from one preschool because he screamed when he one time had a bm there. But he did have the bm and lay down for a nap with the rest of kids after wards. The owner just could not deal with the possibility of having another such episode.
My son was constipated. He never tried to hold it in to the point that a bm was a smelly mess. He did go for days without a bm and was uncomfortable and irritable. He finally outgrew it. In the meantime, his doctor did a thorough exam and didn't find a physical reason for the constipation.
The doctor told my daughter to give him as much food with fiber as she could, to stop giving him dairy products as well as the foods on the b.r.a.t. diet, no bananas, rice, or applesauce. He could have toast made with a high fiber bread. Read labels. Most whole wheat toast has 1 g. of fiber if that. I look for bread with at least 3 g of fiber. He was also to have plenty of fluids including grape and prune/plum. The doctor also prescribed natural ingredient stool softeners.
It took several months to find a combination that worked enough that it didn't hurt when when he pooped. He still frequently has firm stools that are sometimes in pill form but he does poop everyday and is comfortable.
During that time his mother or myself took him to the toilet everyday to try. If he didn't poop it was no big deal. Ten minutes on was all that we required. We entertained and played with him during that time.
Perhaps this started when she was constipated and you didn't realize it or perhaps she does have a medical condition that causes this. It's important to get a medical exam asap tho you can start focusing on her diet immediately.
You can try helping her to poop each day by having her squat. Be very patient and make the squatting fun. Perhaps use a potty sitting on the floor under her. Most of us poop an hour or so after meals and when we first get up in the morning. Try those times.
Please, continue to give her comfort all day on those days this happens every 15 minutes. She needs that comfort. Because this goes on all day I am prone to think that there is a medical issue here.
One of my brothers had constipation issues at this age. When my mother was changing his diaper she helped the poop to come out by poking her finger inside his anus and wiggling it. One time when my grandson was at his aunts, he couldn't get the poop our and screamed inconsolably. His aunt called 911 and they sent out an ambulance. The EMT poked inside his anus with a gloved hand and pulled the poop out. I'm not suggesting that you do this but letting you know that if you're comfortable doing this in a safe way, it's an option. But only if you do it early on; say the next day or two after an all day bout.
The most important thing for you to do right away is to make an appointment with a pediatrician and tell him her poop is not soft.