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

lcm([[num(int(A)),num(int(0))]],[num(int(B))]) :-
        C is A*0,
        A=\=0,
        B is C//A .
lcm([[num(int(0)),num(int(0))]],[refE(loc(1))]).
lcm([[num(int(A)),num(int(B))]],[C]) :-
        B\=0,
        B=\=0,
        D is A rem B,
        execute_notrace_1(B,D,D,A,B,_1,_2,_3,_4,_5,C,_6) .

execute_notrace_1(A,0,_1,B,C,[],_2,_3,_4,_5,num(int(D)),[]) :-
        E is B*C,
        A=\=0,
        D is E//A .
execute_notrace_1(0,0,_1,A,B,[[]],_2,_3,_4,_5,refE(loc(1)),[]) :-
        _6 is A*B .
execute_notrace_1(A,B,_1,C,D,E,F,G,H,I,J,K) :-
        B\=0,
        B=\=0,
        L is A rem B,
        execute_notrace_1(B,L,L,C,D,E,F,G,H,I,J,K) .


