I have been thinking if using asm cud help me improoving my time.So i tried it for the problem http://www.spoj.pl/problems/STREETR/.But it gives compilation error.I am not still a novice at asm,but still it seems to work fine on my system.Please help.
int gcd( int a, int b ) {
int gcd;
__asm__ __volatile__ ("movl %1, %%eax;"
"movl %2, %%ebx;"
"A: cmpl $0, %%ebx;"
"je B;"
"xorl %%edx, %%edx;"
"idivl %%ebx;"
"movl %%ebx, %%eax;"
"movl %%edx, %%ebx;"
"jmp A;"
"B: movl %%eax, %0;":"=g"(gcd):"g"(a),"g"(b));
return gcd ;
}
Please help...