2023-02-15 16:24:24 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int add(int x,int y) {
|
|
|
|
int result;
|
|
|
|
asm (
|
|
|
|
"movl %%eax, %1 \n"
|
|
|
|
"addl %%eax, %2 \n"
|
|
|
|
"movl %0, %%eax \n"
|
2023-02-21 22:41:37 +08:00
|
|
|
:"=r"(result) //output operands used in the instructions
|
|
|
|
:"r"(x),"r"(y) //input operands used in the instructions
|
2023-02-15 16:24:24 +08:00
|
|
|
:"eax" //registers changed by the assembler instructions
|
|
|
|
);
|
2023-02-21 22:41:37 +08:00
|
|
|
return result;
|
2023-02-15 16:24:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int a,b,c;
|
|
|
|
scanf("%d,%d",&a,&b);
|
|
|
|
c=a+b;
|
|
|
|
printf("%d\n",c);
|
|
|
|
return 0;
|
|
|
|
}
|