I am adding the baseline c version of the code