Translating Basic Blocks to SSA Form

y = 0
x = a
x = x + y
y = y + x
x = x * b

We introduce index for each assignment to variable assignment

When we use the variable, we refer to the variable together with its index (last place where it was assigned)

y0 = 0
x0 = a
x1 = x0 + y0
y1 = y0 + x1
x2 = x1 * b

To do this, we can simply maintain a map from variable names to their current indices

What if we have control-flow graphs?