title: inline asm, when to use r and when to use m? why this behavior?
body: <p>I am trying to delve into some inline assembly. It is interesting stuff but the documentation is scarce and newb unfriendly.</p>
  
  <p>This code works as expected, it correctly multiplies</p>
  
  <pre><code>{
  int other_var=3;
  asm volatile
  (
      "mov $3,%0\n\t"
      "roll $2,%0;"
      :"=r"(other_var)
      :"r"(other_var)
  );
  cout &lt;&lt; "other_var equals " &lt;&lt; other_var &lt;&lt;endl;
  return 0;
  }
  </code></pre>
  
  <p>but this</p>
  
  <pre><code>int other_var=3;
  cout &lt;&lt; "other_var equals " &lt;&lt; other_var &lt;&lt;endl;
  asm volatile
  (
  
      "roll $2,%0;"
      :"=r"(other_var)
      :"r"(other_var)
  );
  cout &lt;&lt; "other_var equals " &lt;&lt;hex&lt;&lt; other_var &lt;&lt;endl;
  return 0;
  }
  </code></pre>
  
  <p>When I remove the seemingly arbitrary mov, the code behaves as if undefined and outputs garbage. Suddenly the program does not load other_var from memory to register and the "=m" and "m" option is needed. Why is that? What is the piece of information I am missing here?</p>