Learning a little about types of muscle cramps, ATP, and the Krebs/citric acid cycle will most likely lead to figuring out which muscle cramps/spasms are being experienced, then to discovering a solution.
I discovered slightly unbalanced electrolytes and insufficient water had been the culprit for muscle cramps since high school through age 40ish. I was born with sodium and chloride imbalances that became a combined lifelong adversary until I made a concentrated effort to keep electrolytes happy ^.^ I learned the hard way that electrolytes always win over stupendous amounts of my stubborness :=)
How stubborn was I? I used to run cross country in high school and practiced bodybuilding in early 20s. Muscle cramps were ever present. Muscle repair/recovery was slow, though I hadn't realized it then. In high school I fell out at the finish line, face planting on a clay track, after having ignored a coach's advice to sip some slightly salty lemonade before starting. Who wants warm lemonade? Salted? And there, need over want snickered at me again. I made up all manner of justifications until I was about 40 and eventually got thoroughly disgusted with being unable to do what I considered to be ordinary activities without intermitten muscle cramps in sides, feet, calves, thighs, or lower back. I also discovered too much
or too little of a nutrient could result in similar un-fun physical experiences. And that no nutrient works alone. Everything within us is so connected that a single nutrient or activity is seldom (if ever?) a sole cause or solution. (An aside, a prolapsed mitral valve condition resolved when electrolytes were balanced.)
I found this page, where about halfway down ATP is discussed specific to muscle cramps.
https://www.ncbi.nlm.nih.gov/books/NBK376/
If asked, I would suggest reading at least several sources of information about the Krebs / citric acid cycle. There is so much funding-related bias, that reading about something so vital begs delving. Note the difference between citric acid and ascorbic acid:
https://www.fooducate.com/community/post/What-s-the-difference-between-Citric-Acid-Ascorbic-Acid-and-Vitamin-C%3F/55F1712B-81E3-CCE7-462B-AB4E18ED0BE3
Also because ascorbic acid/vitamin C is mentioned here, note there is a half life of about 30 minutes with fresh/whole food/fruit/veggie sources of ascorbic acid/vitamin C. So best to consume a whole fruit or vegetable completely within minutes rather than spend an hour sipping or nibbling. Alka Seltzer is a good example and can be used to prove the half life. When there is reason to use an Alka Seltzer tablet, mix a tablet in water and let it sit a couple hours. Drink it and wait about 30 minutes. After noticing the lack of efficacy, try a fresh tablet in water and drink immediately and the effects are usually felt fairly quickly. I use Alka Seltzer as an example because the active ingredients are bisodium carbonate (baking soda) and ascorbic acid (vitamin C). Or you can prove the half life by mixing straight ascorbic acid crystals 2:1 with baking soda, then continue experimenting as with the Alka Seltzer example. Saturation might be felt in either experiment, but not the benefits that feed adrenal and other functions that work synergistically to relieve symptoms.
Stabilizers and preservatives can be added, however I prefer straight ascorbic acid crystals (1 teaspoon) + baking soda (1/2 teaspoon) which dissolves easily in water without additives. Also less expensive. An exception to processing and additives, in my opinion, is liposomal C, which became an extremely useful source of very concentrated ascorbic acid. I used to buy this directly from Abram Hoffer's clinic in Canada when I had a blood cancer and liposomal C allowed me to consume about 27 grams (my personal saturation level) of ascorbic acid/vitamin C daily until symptoms were relieved. This was in conjunction with other nutrients/vitamins/minerals/ temporarily, with emphasis on dark greens permanently. However, the liposomal C was a huge part in my recovery aside major dietary changes, and there are now groups online who teach how to make liposomal C at home. Yay for open source sharing of information!
And, because ascorbic acid is a chemical compound even as found in natural whole food sources, no brand can legitimately claim one source is better than another. Not ester C. Not birch. Not whatever is erroneously claimed. However it does seem to be more truthful to consider that what comes with ascorbic acid in a whole food might be additionally, more synergistically beneficial. Just not the begin or end all, since in the world of nutrients no single thing is ever that. Life is dependent on symbiotic relationships and very permie-oriented :.)
Another interesting factoid: there is more ascorbic acid in a raw potato than in an equivalent amount of orange juice. (Medium potato = small glass of orange juice.) Not knocking citrus juices, just saying :.) Most of us don't eat raw potatoes, however. Maybe somewhere else in the world, but not in North America that I am aware of.
I've read various high temperatures ranging from 112-122 degrees fahrenheit/44-50 centigrade cause destablization, which one source explained generally means ascorbic acid/vitamin C is no longer exactly that at those temperatures. Cooking fruits kills delicate nutrients, so the full benefit does not manifest. That said, sometimes I do it anyway ^.^ Same at freezing temperatures - supposedly about 38 fahrenheit for ascorbic acid. I keep ascorbic acid/vitamin C at room temperatures that keep most fruits pleasantly edible. There are exceptions with other nutrients, yet "comfortable room temperatures" are my personal guideline for all supplements. An example of an exception is vitamin E in sunflower oil that can be cooked with medium to high-ish temperatures while retaining valuable qualities.
Ok... digressing so stopping before this turns into a longer, off-topic rambling rant.