Implement signature checks for control flow between functions.

This is a work in progress, opening to track which of the currently open issues it already adresses.