Greatest common divisor

You are encouraged to solve this task according to the task description, using any language you may know.
Task

Find the greatest common divisor   (GCD)   of two integers.


Greatest common divisor   is also known as   greatest common factor (gcf)   and   greatest common measure.



Related task

   least common multiple.


See also

   MathWorld entry:   greatest common divisor.
   Wikipedia entry:     greatest common divisor.


*        Greatest common divisor   04/05/2016
GCD      CSECT
         USING  GCD,R15            use calling register
         L      R6,A               u=a
         L      R7,B               v=b
LOOPW    LTR    R7,R7              while v<>0 
         BZ     ELOOPW               leave while
         LR     R8,R6                t=u
         LR     R6,R7                u=v
         LR     R4,R8                t
         SRDA   R4,32                shift to next reg
         DR     R4,R7                t/v
         LR     R7,R4                v=mod(t,v)
         B      LOOPW              end while
ELOOPW   LPR    R9,R6              c=abs(u)
         L      R1,A               a	
         XDECO  R1,XDEC            edit a
         MVC    PG+4(5),XDEC+7     move a to buffer
         L      R1,B               b
         XDECO  R1,XDEC            edit b
         MVC    PG+10(5),XDEC+7    move b to buffer
         XDECO  R9,XDEC            edit c
         MVC    PG+17(5),XDEC+7    move c to buffer
         XPRNT  PG,80              print buffer
         XR     R15,R15            return code =0
         BR     R14                return to caller
A        DC     F'1071'            a
B        DC     F'1029'            b
PG       DC     CL80'gcd(00000,00000)=00000'  buffer
XDEC     DS     CL12               temp for edit
         YREGS
         END    GCD