I am looking for an algorithm or some tips on how to find scope changes when doing static analysis of a decompiled ASM source. I need to know the scope changes for tracking stack usage and reaching definitions for variables. If I have a program likeint somefunc(int b) {// Scope 1a = b + 1;if(a > 0) {  // Scope 2  a = 0} else {  // Scope 3  a = b;}return a;Once I have constructed the flow graph from the assembly, how do I know then scope changes from 1-2 and back from 2-1 etc? My only guess so far is it would have something to do with dominance and checking for subgraphs. Some of the issues that I would see with this approach would be the loops or statements that have early terminations such as break; continue; return - they will produce a graph where you can not determine dominance and won't be able to tell when your scope increases or decreases.
Static Analysis - Scope Changes
static analysis