I\'m tring to convert a simple assembly code of MS to use with gcc, the MS assembly I try to convert is right below. I have two int
variables, number
Try something like:
#include
#include
int main(int ac,char**av)
{
int n=ac>1?atoi(av[1]):42;
asm ("movl %0, %%eax \n\t"
"neg %%eax \n\t"
"movl %%eax, %0 \n\t" : "+r" (n)::"eax");
printf("%d\n",n);
}
The issues are:
instr src,dst
And to make it even more efficient:
asm("neg %0" : "+r" (n) ::); // works as well