Guest User

Untitled

a guest
May 27th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. /* Input a number and watch it get clobbered by another! */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. #define answer(__op1) __asm__ ( \
  7. "movl $42, %0\n\t" \
  8. : "=r" (__op1) \
  9. : "0" (__op1) \
  10. );
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14. if (argc != 2) {
  15. fputs("Usage: asm_test NUMBER\n", stderr);
  16. exit(EXIT_FAILURE);
  17. }
  18.  
  19. int x = strtol(argv[1], NULL, 10);
  20. answer(x);
  21.  
  22. printf("%d\n", x);
  23. }
Add Comment
Please, Sign In to add comment