



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Done many ways
y := x; // 1 z := 1; // 2 while y > 1 do { // 3 z := zy; // 4 y := y-1 }; // 5 y := 0 // 6 Entry 1 y := x 2 z := 1 3 y > 1 4 z := zy 5 y := y- 6 y := 0 Exit
Original x = 1 y = x+ x = x+ z = x+y In SSA form x 1 = 1 y 1 = x 1 + x 2 = x 1 + z 1 = x 2 +y 1
Entry x = read() if x > 0 y = -x y = x write(y) Entry x 1 = read() if x 1 > 0 y 1 = -x 1 y 2 = x 1 y 3 = f(y 1 , y 2 ) write(y 3 ) Exit (^) Exit
Entry x = read() if x > 0 x = x+ write(x) Exit Entry x 1 = read() x 3 = f(x 1 , x 2 ) if x 3 > 0 x 2 = x 3 + write(x 3 ) Exit