:- module( _, [gcd/2], [assertions , regtypes , basicmodes , nativeprops] ).

gcd([[num(int(A)),num(int(0))]],[num(int(A))]).
gcd([[num(int(A)),num(int(B))]],[C]) :-
        B\=0,
        B=\=0,
        D is A rem B,
        execute_notrace_1(B,D,_1,_2,_3,_4,_5,C,_6) .

execute_notrace_1(A,0,[],_1,_2,_3,_4,num(int(A)),[]).
execute_notrace_1(A,B,C,D,E,F,G,H,I) :-
        B\=0,
        B=\=0,
        J is A rem B,
        execute_notrace_1(B,J,C,D,E,F,G,H,I) .


