merge-ort: copy and adapt merge_3way() from merge-recursive.c