内联汇编_把a值赋给b的汇编代码
int main(int argc, char *argv[])
{
int a = 10, b;
__asm__("movl %1, %%eax\n\t"
"movl %%eax, %0\n\t"
:"=r"(b)
:"r"(a)
:"%eax"
);
printf("ret: %d, %d\n", a, b);
return 0;
}
int main(int argc, char *argv[])
{
int a = 10, b;
__asm__("movl %1, %%eax\n\t"
"movl %%eax, %0\n\t"
:"=r"(b)
:"r"(a)
:"%eax"
);
printf("ret: %d, %d\n", a, b);
return 0;
}