title: Can someone explain these few lines of MSIL?
body: <p>Can someone explain these few lines of MSIL?  Why does it move a value off the evaluation stack to a local variable, only to move it back immediately and return it?</p>
  
  <p>The following MSIL code loads a single argument (a string), calls a method, which returns bool, and then returns that bool value.  What I don't understand is why it calls stloc.0 to store the method's return value in a local variable, then performs an explicit unconditional control transfer to the very next labeled line (seems unnecessary), only to move the value right back onto the evaluation stack before returning it.</p>
  
  <pre><code>.maxstack 1
  .locals init ([0] bool CS$1$0000)
  L_0000: nop
  L_0001: ldarg.0
  L_0002: call bool FuncNameNotImporant::MethodNameNotImporant(string)
  L_0007: stloc.0 
  L_0008: br.s L_000a
  L_000a: ldloc.0 
  L_000b: ret 
  </code></pre>
  
  <p>My best guess at why it does this is to perform some kind of type check to ensure the value on the evaluation stack is actually a boolean value before returning it.  But I am clueless about the explicit jump to the very next line; I mean, wouldn't it go there anyway?  The C# source code for the method is just one line, which returns the result of the method.</p>