C Code to sort high rate GRIFFIN data