title: x86 linux - GAS - AT&T - Stosb?
body: <p>I am currently trying to teach myself x86 under the circumstances posted in my title. Please note I do not just want an answer, I want to learn this and be fluent in it.  </p>
  
  <p>I am having a lot of trouble storing data in memory addresses other than the main registers (<code>eax</code>, <code>ebx</code>, <code>ecx</code>, <code>edx</code>).  </p>
  
  <pre><code>.global main
  
  .text
  
  str: .string "data: %d\n"
  
  main:
  
  pushl   $3 
  call    malloc
  popl    %ecx
  movl    $4, %esi          #source 
  movl    %eax, %edi       #destination
  stosb
  movl    %eax, %esi
  lodsb
  pushl   %edi
  pushl   $str
  call    printf
  popl    %ecx
  popl    %ecx
  </code></pre>
  
  <p>After the <code>stosb</code>, shouldn't <code>movl</code> put the destination address (memory address produced from <code>malloc</code>, and original source address) into the destination address, and move the <code>$4</code> in <code>%esi</code> back into <code>%edi</code>?</p>