Program Flow Analysis: Theory and Application