title: Why does C++ inline function has call instructions?
body: <p>I read that with inline functions where ever the function call is made we replace the function call with the body of the function definition.</p>
  <p>According to the above explanation there should not be any function call when <code>inline</code> is user.</p>
  <p>If that is the case <em>Why do I see three <code>call</code> instructions in the assembly code ?</em></p>
  <pre><code>#include &lt;iostream&gt;                                                                  
                                                                                       
  inline int add(int x, int y)                                                         
  {                                                                                    
          return x+ y;                                                                 
  }                                                                                    
                                                                                       
  int main()                                                                           
  {                                                                                    
          add(8,9);                                                                    
          add(20,10);                                                                  
          add(100,233);                                                                
  }
  
  meow@vikkyhacks ~/Arena/c/temp $ g++ -c a.cpp
  meow@vikkyhacks ~/Arena/c/temp $ objdump -M intel -d a.o
  0000000000000000 &lt;main&gt;:
     0:   55                      push   rbp
     1:   48 89 e5                mov    rbp,rsp
     4:   be 09 00 00 00          mov    esi,0x9
     9:   bf 08 00 00 00          mov    edi,0x8
     e:   e8 00 00 00 00          call   13 &lt;main+0x13&gt;
    13:   be 0a 00 00 00          mov    esi,0xa
    18:   bf 14 00 00 00          mov    edi,0x14
    1d:   e8 00 00 00 00          call   22 &lt;main+0x22&gt;
    22:   be e9 00 00 00          mov    esi,0xe9
    27:   bf 64 00 00 00          mov    edi,0x64
    2c:   e8 00 00 00 00          call   31 &lt;main+0x31&gt;
    31:   b8 00 00 00 00          mov    eax,0x0
    36:   5d                      pop    rbp
    37:   c3                      ret  
  </code></pre>
  <h2>NOTE</h2>
  <p>Complete dump of the object file is <a href="http://pastebin.com/DDXujHQD" rel="nofollow noreferrer">here</a></p>