Spring 2001 CS100M -- detailed trace of E5.2 here is the code from E5.2, with some additional line#s: 1 x = 6; y = 11; X = x; Y = y; z = 0; % inv: X*Y = x*y + z 1.1 while x ~=0 & y ~= 0 1.2 if x < y 2 t = x; 3 x = y; 4 y = t; 4.1 end 4.2 if rem(y,2) == 0 5 x = x+x; 6 y = y/2; 6.1 else 7 z = z+x; 8 y = y-1; 8.1 end 9 end here is the tabular trace that was provided: snapshot: (a) (b) (c) (d) (e) (f) (g) (h) (i) (k) (l) (m) | | | | | | | | | | | | # 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 5 | 6 | 7 | 8 | X 6 | | | | | | | | | | | | Y 11 | | | | | | | | | | | | x 6 | | 11 | | 22 | | | | 44 | | | | y 11 | | | 6 | | 3 | | 2 | | 1 | | 0 | z 0 | | | | | | 22 | | | | 66 | | t | 6 | | | | | | | | | | | here is a detailed explanation of how the code is executed: line #1 is executed: we are now at snapshot (a) line #1.1 is executed: loop guard is true, so execute loop body line #1.2 is executed: condition x