C-based merge sort