Refactor to share code to find the position of a basic block successor in the