/************* GCD ******************/ int main() { int n, m, gcd ; printf("Enter two non-negative integers: ") ; scanf("%d%d",&n,&m); asm( ".MyL1: # Label \n\t" "cmpl $0, %%ecx # if m == 0 \n\t" "je .MyL3 # goto .MyL3 \n\t" "movl $0, %%edx # edx <- 0 \n\t" "idivl %%ecx # edx:eax/ecx \n\t" "movl %%ecx, %%eax # eax <- dividend \n\t" "movl %%edx, %%ecx # ecx <- divisor \n\t" "jmp .MyL1 # goto .MyL1 \n\t" ".MyL3: # Label \n\t" "movl %%eax, %0 # gcd <- eax \n\t" :"=r"(gcd) :"a"(n), "c"(m) :"%edx" ); printf("\ngcd(%d,%d) = %d\n",n,m,gcd); }