This question already has an answer here:
How do I re-write this using Intel syntax?
int main() {
int e;
asm( "movl $5, %0"
: "=a" (e)
);
printf("%d\n", e);
return 0;
}
I tried this with -masm=intel
, and it doesn't work, results in a segfault:
int EAX;
asm(
"mov %0, 5"
:"=a"(EAX)
);