Euclidean algorithm in C