compiling heapify rewrite