title: assembly, two functions in 1 file, getting Error: junk `(%ebp)' after expression
body: <p>The assembly functions with commented c version:</p>
  
  <pre><code>/*
  int f (int x) 
  { 
      return x+2; 
  }
  
  void map2 (int* one, int * another, int n) 
  {
      int i;
      for (i=0; i&lt;n; i++)
        *(another+i) = f(*(one+i));
  }
  */
  
  .text
  
  .globl f
  f:
  
  /********************************** prologue *************************************/
      pushl   %ebp        
      movl    %esp, %ebp          
  /********************************************************************************/
  
      movl    8(%ebp), %eax
      addl    $2, %eax
  
  /************************************* end **************************************/
      movl    %ebp, %esp
      popl    %ebp
      ret
  /*********************************************************************************/
  
  .text
  
  .globl map2
  map2:
  /********************************** prologue *************************************/
      pushl   %ebp        
      movl    %esp, %ebp
      pushl   %ebx
      pushl   %esi
      pushl   %edi            
  /********************************************************************************/
  
      movl    $0, %ebx
  L1: cmpl    $16(%ebp), %ebx         // error
      jge     out
  
      movl    $12(%ebp), %esi         // error
      addl    %ebx, %esi  
  
      movl    $8(%ebp), %edi          // error
      addl    %ebx, %edi
  
  /********************************** calls f *************************************/
      pushl   %eax
      pushl   %ecx
      pushl   %edx
  
      pushl   (%edi)
      call    f
      movl    %eax, (%esi)    /* *(another+i) = f(*(one+i));              */
  
      popl    %edx
      popl    %ecx
      popl    %eax
  /********************************************************************************/
  
  /************************************* end **************************************/
      popl    %edi
      popl    %esi
      popl    %ebx
      movl    %ebp, %esp
      popl    %ebp
      ret
  /********************************************************************************/
  </code></pre>
  
  <p>I'm getting </p>
  
  <pre><code>fmap2.s:44: Error: junk `(%ebp)' after expression
  fmap2.s:47: Error: junk `(%ebp)' after expression
  fmap2.s:50: Error: junk `(%ebp)' after expression
  </code></pre>
  
  <p>Why? There is something to do with having 2 prologues and endings in the same file?
  The base-dislocation numbers of those error lines are correct.</p>