@@ -0,0 +1,619 @@
+#!/usr/bin/env python3%0Aimport sys%0Aimport functools%0Aimport struct%0A%0Anodes = int(sys.argv%5B1%5D) if len(sys.argv) %3E 1 else 1%0A%0Adef binsearch_depth(nums, num):%0A    if not nums:%0A        raise ValueError('should never happen')%0A%0A    at = len(nums) // 2%0A    if nums%5Bat%5D == num:%0A        return 1%0A    elif num %3C nums%5Bat%5D:%0A        return 1 + binsearch_depth(nums%5B:at%5D, num)%0A    else:%0A        return 1 + binsearch_depth(nums%5Bat+1:%5D, num)%0A%0Avalues = list(range(1, nodes+1))%0Aordered_values = sorted(values, key=functools.partial(binsearch_depth, values))%0Afor num in ordered_values:%0A    sys.stdout.buffer.write(struct.pack('=BI', 0, num))%0A

Add fuzz input generator