Extract buildTree into a C function
Add annotation tree equivalence test