HI, thanks for using healthcare magic
The coughing is due to the inflammation of the airway, increased mucous production and possibly some airway closure.
You may want to consider the use of a mucolytic
to break up the mucous and allow it to be expelled easier. In addition medication to help reopen the airways maybe helpful. These can sometimes be combined.
Some examples of mucolytics are bromohexine, guiafenesin, acetylcysteine
In addition you can used cough suppressant medications. Honey can also helps with coughs.
The persistent coughing would cause the rib pain
, if this is reduced the coughing should be better.
If there is no relief then you may want to consider visiting your doctor for an assessment.
I hope this helps