der Krampf
cramp
A sudden, painful, and involuntary contraction of a muscle or muscle group.
Mitten in der Nacht wachte ich mit einem schrecklichen Krampf in der Wade auf.
In the middle of the night, I woke up with a terrible cramp in my calf.

cramp
Loading your saved state.
cramp
A sudden, painful, and involuntary contraction of a muscle or muscle group.
Mitten in der Nacht wachte ich mit einem schrecklichen Krampf in der Wade auf.
In the middle of the night, I woke up with a terrible cramp in my calf.

In connection with muscles, 'Krampf' (cramp) is often used with the verbs 'haben' (to have) or 'bekommen' (to get). You usually have a cramp 'in' a specific body part.
Beim Schwimmen habe ich plötzlich einen Krampf im Bein bekommen.
While swimming, I suddenly got a cramp in my leg.
The meaning 'mühsame Angelegenheit' (laborious matter/hassle) is purely colloquial. The expression is often used with the verb 'sein' (to be) and the word 'einzig' (one single/complete) to emphasize the effort involved.
Das Ausfüllen der Formulare war ein einziger Krampf.
Filling out the forms was a complete pain.
In the medical meaning, 'Krampf' (seizure/convulsion) is often combined with the verb 'erleiden' (to suffer). Common compounds are 'Fieberkrampf' (febrile convulsion) or 'epileptischer Krampf' (epileptic seizure/convulsion).
Der Patient erlitt während des Anfalls einen schweren Krampf.
The patient suffered a severe convulsion during the seizure.
You can recognize the meaning from the context: If a body part is mentioned, it is a muscle cramp. If an activity or task is described as a 'Krampf' (pain/hassle), it is the colloquial meaning. Medical terms like 'Fieber' (fever) or 'epileptisch' (epileptic) point to a seizure or convulsion.
Der Umzug ohne professionelle Hilfe war ein totaler Krampf.
Moving house without professional help was a total pain.
agony / torment
'Qual' and 'Krampf' can both have to do with pain or great effort. 'Qual' means severe physical or emotional suffering and tends to describe the whole painful state. 'Krampf' is literally a sudden muscle pain in which a muscle contracts involuntarily. Colloquially, 'Krampf' can also mean a very laborious or annoying thing. In that case, it sounds less serious than 'Qual'. For deep suffering, 'Qual' fits better. For a specific muscle pain or a strenuous task, 'Krampf' sounds more natural.

Beim Schwimmen bekam Lisa plötzlich einen Krampf im Bein.
While swimming, Lisa suddenly got a cramp in her leg.
Die langen Schmerzen nach dem Unfall waren für ihn eine große Qual.
The long-lasting pain after the accident was sheer agony for him.