C code to sort high rate data from GRIFFIN