Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. void str_buf_append(const char&);
  2.  
  3. extern char byvalue( char );
  4. extern char byref( const char & );
  5. int main( int argc, char * argv[] )
  6. {
  7. char c = byvalue( argv[0][0] ) + byref( argv[0][1] );
  8. return c;
  9. }
  10.  
  11. $ g++ -O3 param.cpp -c -o param.o
  12. $ objdump -D param.o|less
  13.  
  14. 0000000000000000 <main>:
  15. 0: 55 push %rbp
  16. 1: 53 push %rbx
  17. 2: 48 89 f3 mov %rsi,%rbx
  18. 5: 48 83 ec 08 sub $0x8,%rsp
  19. 9: 48 8b 06 mov (%rsi),%rax
  20. c: 0f be 38 movsbl (%rax),%edi ; %edi is character
  21. f: e8 00 00 00 00 callq 14 <main+0x14> ; byvalue
  22. 14: 48 8b 3b mov (%rbx),%rdi
  23. 17: 89 c5 mov %eax,%ebp
  24. 19: 48 83 c7 01 add $0x1,%rdi ; %rdi is address of character
  25. 1d: e8 00 00 00 00 callq 22 <main+0x22> ; byref
  26. 22: 48 83 c4 08 add $0x8,%rsp
  27. 26: 01 e8 add %ebp,%eax
  28. 28: 5b pop %rbx
  29. 29: 0f be c0 movsbl %al,%eax
  30. 2c: 5d pop %rbp
  31. 2d: c3 retq
  32.  
  33. c: 0f be 38 movsbl (%rax),%edi ; %edi is character
  34. f: e8 00 00 00 00 callq 14 <main+0x14> ; byvalue
  35.  
  36. 19: 48 83 c7 01 add $0x1,%rdi ; %rdi is address of character
  37. 1d: e8 00 00 00 00 callq 22 <main+0x22> ; byref
  38.  
  39. void fun (char const & c) {use (c);}
  40. ...
  41. fun (x);
  42. [next line]
  43.  
  44. void fun (char const c) {use (c);}
  45. ...
  46. fun (x);
  47. [next line]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement