Split BabyBear into imperative and functional parts.

Also moves it from benchmark directory to tests directory.