Split up tree diff functions into tree-diff.c library