title: Assembly: How does fld st(0) duplicates the top stack value in the following code?
body: <p>In the following code, I am wondering about the role of <code>fld ST(0)</code>. I have heard it duplicates the top value in the stack but I don't know where does it bring that value in the following code?</p>
  
  <pre><code>fild    dword ptr [L1000F140]
  fstp    qword ptr [esp+20h]
  fld ST(0)
  fdiv    qword ptr [L1000F148]
  fmul    qword ptr [L1000A520]
  </code></pre>
  
  <p>My interpret is that code above in symbolic way means: </p>
  
  <pre><code>value[esp+20h]= value[L1000F140]
  new stack top value=value[esp+20h]/value[L1000F148]*value[L1000A520]
  </code></pre>
  
  <p>Am I correct?</p>
  
  <p>I wonder why <code>fstp</code> does not pop the loaded value so <code>fld</code> has duplicated <code>value[L1000F140]</code> it?</p>