Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Input a number and watch it get clobbered by another! */
- #include <stdio.h>
- #include <stdlib.h>
- #define answer(__op1) __asm__ ( \
- "movl $42, %0\n\t" \
- : "=r" (__op1) \
- : "0" (__op1) \
- );
- int main(int argc, char *argv[])
- {
- if (argc != 2) {
- fputs("Usage: asm_test NUMBER\n", stderr);
- exit(EXIT_FAILURE);
- }
- int x = strtol(argv[1], NULL, 10);
- answer(x);
- printf("%d\n", x);
- }
Add Comment
Please, Sign In to add comment