title: Backward Analysis of Expression
body: <p>Suppose I have following code segment in C.</p>
  
  <pre><code>i = j = k = 1;
  
  j = (i++) + (++k);
  
  result = i + j + k; //POI
  //Expected result = 7
  </code></pre>
  
  <p>Here, I want to find value of <code>result</code> through backward analysis. When I perform backward analysis, I will go through following expressions in order.</p>
  
  <pre><code>j = (i++) + (++k);
  ++k;
  i++;
  i = j = k = 1;
  j = k = 1;
  k = 1;
  </code></pre>
  
  <p>During backward analysis I will replace each variable by corresponding expression, whenever it is applicable. But I'm confused how to deal with increment/decrement operations.</p>
  
  <p>My current strategy will produce following result</p>
  
  <pre><code>result = i + j + k
  
  //after j = i++ + ++k
  result = (i+(i+(k+1)))+k
  
  //after ++k
  result = (i+(i+((k+1)+1)))+(k+1)
  
  //after i++
  result = ((i+1)+((i+1)+((k+1)+1)))+(k+1)
  
  //after i = j = k = 1
  result = ((1+1)+((1+1)+((k+1)+1)))+(k+1)
  
  //after k = 1
  result = (((1+1)+((1+1)+((1+1)+1)))+(1+1))
  
  //Simplifying
  result = 9
  </code></pre>
  
  <p>which is ofcourse not true.</p>
  
  <p>Can anyone help me with this? </p>