first half of bddop.c