Cod sursa(job #870574)

Utilizator Vlad.PPetcu Vlad Vlad.P Data 3 februarie 2013 17:13:30
Problema A+B Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
/*
#include<stdio.h>
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d\n",a+b);
    return 0;
}
*/
#include<stdio.h>
int main(){
    int a,b,j;
    char format1[]={"%d%d"};
    char format2[]={"%d\n"};
    asm("push %%eax;"
        "push %%ebx;"
        "push %%ecx;"
        "call scanf;"
        "pop %%ecx;"
        "pop %%ebx;"
        "pop %%eax;"
        :"=a"(j)
        :"a"(&b),"b"(&a),"c"(format1));
    asm("addl %%ebx,%%eax;"
        :"=a"(a)
        :"a"(a),"b"(b));
    asm("push %%eax;"
        "push %%ebx;"
        "call printf;"
        "pop %%ebx;"
        "pop %%eax;"
        :"=a"(j)
        :"a"(a),"b"(format2));
    return 0;
}
//Sper sa mearga assemblerul pe infoarena :D