A Security Framework For Logic Locking Through Local And Global Structural Analysis