You can write it in gcc as:
#include <stdio.h>
int main ()
{
int a = 0 ;
/*How can I write it on gcc*/
__asm__ __volatile__ (
"movl $2, %0\n\t"
"addl $4, %0\n\t"
:"=r"(a) /* =r(egister), =m(emory) both fine here */
);
printf ("%d\n",a );
return 0 ;
}
1
solved Following is some assembly code by VS2012, how can I write it on gcc?