Switch lowering: use profile info to build weight-balanced binary search trees