突发奇想的汇编解法233
#include <stdio.h> int main() { int a,b; while(~scanf("%d%d",&a,&b)) { asm("movl %1,%%eax;movl %2,%%ebx;addl %%eax,%%ebx;movl %%ebx,%0;" :"=r"(b) :"r"(a),"r"(b) :"%eax","%ebx"); printf("%d\n",b); } return 0; }
#include <stdio.h> int main() { int a,b; while(~scanf("%d%d",&a,&b)) { asm("movl %1,%%eax;movl %2,%%ebx;addl %%eax,%%ebx;movl %%ebx,%0;" :"=r"(b) :"r"(a),"r"(b) :"%eax","%ebx"); printf("%d\n",b); } return 0; }
相关推荐