
(/VERSIONCHECK 2) 

(DEFUN |SMITH;test1| (|sm| |b| |m1| $)
  (PROG (|km| #1=#:G675 #2=#:G679)
    (RETURN
     (SEQ
      (EXIT
       (SEQ (LETT |km| |m1| . #3=(|SMITH;test1|))
            (SEQ G190
                 (COND
                  ((NULL
                    (SPADCALL (SPADCALL |sm| |km| |km| (QREFELT $ 11))
                              (QREFELT $ 13)))
                   (GO G191)))
                 (SEQ
                  (COND
                   ((NULL
                     (SPADCALL (SPADCALL |b| |km| (QREFELT $ 14))
                               (QREFELT $ 13)))
                    (PROGN (LETT #2# (CONS 1 "failed") . #3#) (GO #2#))))
                  (EXIT
                   (LETT |km|
                         (PROG1 (LETT #1# (- |km| 1) . #3#)
                           (|check-subtype| (>= #1# 0) '(|NonNegativeInteger|)
                                            #1#))
                         . #3#)))
                 NIL (GO G190) G191 (EXIT NIL))
            (EXIT (CONS 0 |km|))))
      #2# (EXIT #2#))))) 

(DEFUN |SMITH;test2| (|sm| |b| |n1| |dk| $)
  (PROG (#1=#:G693 |c| |k| |sol|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (LETT |sol| (SPADCALL |n1| (|spadConstant| $ 16) (QREFELT $ 18))
              . #2=(|SMITH;test2|))
        (SEQ (LETT |k| 1 . #2#) G190 (COND ((QSGREATERP |k| |dk|) (GO G191)))
             (SEQ
              (SEQ
               (LETT |c|
                     (SPADCALL (SPADCALL |b| |k| (QREFELT $ 14))
                               (SPADCALL |sm| |k| |k| (QREFELT $ 11))
                               (QREFELT $ 20))
                     . #2#)
               (EXIT
                (COND
                 ((QEQCAR |c| 1)
                  (PROGN (LETT #1# (CONS 1 "failed") . #2#) (GO #1#))))))
              (EXIT (SPADCALL |sol| |k| (QCDR |c|) (QREFELT $ 21))))
             (LETT |k| (QSADD1 |k|) . #2#) (GO G190) G191 (EXIT NIL))
        (EXIT (CONS 0 |sol|))))
      #1# (EXIT #1#))))) 

(DEFUN |SMITH;isDiagonal?| (|m| $)
  (PROG (#1=#:G698 |j| |i| |n1| |m1|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (LETT |m1| (SPADCALL |m| (QREFELT $ 22)) . #2=(|SMITH;isDiagonal?|))
        (LETT |n1| (SPADCALL |m| (QREFELT $ 23)) . #2#)
        (SEQ (LETT |i| 1 . #2#) G190
             (COND ((QSGREATERP |i| |m1|) #3=(GO G191)))
             (SEQ
              (EXIT
               (SEQ (LETT |j| 1 . #2#) G190 (COND ((QSGREATERP |j| |n1|) #3#))
                    (SEQ
                     (EXIT
                      (COND
                       ((COND ((EQL |j| |i|) 'NIL) ('T 'T))
                        (COND
                         ((NULL
                           (SPADCALL (SPADCALL |m| |i| |j| (QREFELT $ 11))
                                     (QREFELT $ 13)))
                          (PROGN (LETT #1# 'NIL . #2#) (GO #1#))))))))
                    (LETT |j| (QSADD1 |j|) . #2#) #4=(GO G190) G191
                    (EXIT NIL))))
             (LETT |i| (QSADD1 |i|) . #2#) #4# G191 (EXIT NIL))
        (EXIT 'T)))
      #1# (EXIT #1#))))) 

(DEFUN |SMITH;elRow1| (|m| |i| |j| $)
  (PROG (|vec|)
    (RETURN
     (SEQ (LETT |vec| (SPADCALL |m| |i| (QREFELT $ 24)) |SMITH;elRow1|)
          (SPADCALL |m| |i| (SPADCALL |m| |j| (QREFELT $ 24)) (QREFELT $ 25))
          (SPADCALL |m| |j| |vec| (QREFELT $ 25)) (EXIT |m|))))) 

(DEFUN |SMITH;elRow2| (|m| |a| |i| |j| $)
  (PROG (|vec|)
    (RETURN
     (SEQ
      (LETT |vec|
            (SPADCALL (CONS #'|SMITH;elRow2!0| (VECTOR $ |a|))
                      (SPADCALL |m| |j| (QREFELT $ 24)) (QREFELT $ 28))
            . #1=(|SMITH;elRow2|))
      (LETT |vec|
            (SPADCALL (ELT $ 29) (SPADCALL |m| |i| (QREFELT $ 24)) |vec|
                      (QREFELT $ 31))
            . #1#)
      (SPADCALL |m| |i| |vec| (QREFELT $ 25)) (EXIT |m|))))) 

(DEFUN |SMITH;elRow2!0| (|x| $$)
  (PROG (|a| $)
    (LETT |a| (QREFELT $$ 1) . #1=(|SMITH;elRow2|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (SPADCALL |a| |x| (QREFELT $ 26)))))) 

(DEFUN |SMITH;elColumn2| (|m| |a| |i| |j| $)
  (PROG (|vec|)
    (RETURN
     (SEQ
      (LETT |vec|
            (SPADCALL (CONS #'|SMITH;elColumn2!0| (VECTOR $ |a|))
                      (SPADCALL |m| |j| (QREFELT $ 32)) (QREFELT $ 33))
            . #1=(|SMITH;elColumn2|))
      (LETT |vec|
            (SPADCALL (ELT $ 29) (SPADCALL |m| |i| (QREFELT $ 32)) |vec|
                      (QREFELT $ 34))
            . #1#)
      (SPADCALL |m| |i| |vec| (QREFELT $ 35)) (EXIT |m|))))) 

(DEFUN |SMITH;elColumn2!0| (|x| $$)
  (PROG (|a| $)
    (LETT |a| (QREFELT $$ 1) . #1=(|SMITH;elColumn2|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (SPADCALL |a| |x| (QREFELT $ 26)))))) 

(DEFUN |SMITH;ijDivide| (|sf| |i| |j| $)
  (PROG (|rMat| |lMat| |mjj| #1=#:G711 |mii| |d| |extGcd| |m|)
    (RETURN
     (SEQ (LETT |m| (QVELT |sf| 0) . #2=(|SMITH;ijDivide|))
          (LETT |mii| (SPADCALL |m| |i| |i| (QREFELT $ 11)) . #2#)
          (LETT |mjj| (SPADCALL |m| |j| |j| (QREFELT $ 11)) . #2#)
          (LETT |extGcd| (SPADCALL |mii| |mjj| (QREFELT $ 37)) . #2#)
          (LETT |d| (QVELT |extGcd| 2) . #2#)
          (LETT |mii|
                (PROG2
                    (LETT #1# (SPADCALL |mii| |d| (QREFELT $ 20)) . #2#)
                    (QCDR #1#)
                  (|check-union| (QEQCAR #1# 0) (QREFELT $ 6) #1#))
                . #2#)
          (LETT |mjj|
                (PROG2
                    (LETT #1# (SPADCALL |mjj| |d| (QREFELT $ 20)) . #2#)
                    (QCDR #1#)
                  (|check-union| (QEQCAR #1# 0) (QREFELT $ 6) #1#))
                . #2#)
          (LETT |lMat|
                (|SMITH;elRow2| (QVELT |sf| 1) (QVELT |extGcd| 0) |j| |i| $)
                . #2#)
          (LETT |lMat| (|SMITH;elRow1| |lMat| |i| |j| $) . #2#)
          (LETT |lMat|
                (|SMITH;elRow2| |lMat| (SPADCALL |mii| (QREFELT $ 38)) |j| |i|
                 $)
                . #2#)
          (SPADCALL |m| |j| |j|
                    (SPADCALL (SPADCALL |m| |i| |i| (QREFELT $ 11)) |mjj|
                              (QREFELT $ 26))
                    (QREFELT $ 39))
          (SPADCALL |m| |i| |i| |d| (QREFELT $ 39))
          (LETT |rMat|
                (|SMITH;elColumn2| (QVELT |sf| 2) (QVELT |extGcd| 1) |i| |j| $)
                . #2#)
          (LETT |rMat|
                (|SMITH;elColumn2| |rMat| (SPADCALL |mjj| (QREFELT $ 38)) |j|
                 |i| $)
                . #2#)
          (SPADCALL |rMat| |j|
                    (SPADCALL (CONS #'|SMITH;ijDivide!0| $)
                              (SPADCALL |rMat| |j| (QREFELT $ 32))
                              (QREFELT $ 33))
                    (QREFELT $ 35))
          (EXIT (VECTOR |m| |lMat| |rMat|)))))) 

(DEFUN |SMITH;ijDivide!0| (|x| $)
  (SPADCALL (SPADCALL (|spadConstant| $ 41) |x| (QREFELT $ 42)) (QREFELT $ 38))) 

(DEFUN |SMITH;lastStep| (|sf| $)
  (PROG (#1=#:G723 |j| |mii| |i| |m1| |m|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ (LETT |m| (QVELT |sf| 0) . #2=(|SMITH;lastStep|))
            (LETT |m1|
                  (MIN (SPADCALL |m| (QREFELT $ 22))
                       (SPADCALL |m| (QREFELT $ 23)))
                  . #2#)
            (SEQ (LETT |i| 1 . #2#) G190
                 (COND
                  ((OR (QSGREATERP |i| |m1|)
                       (NULL
                        (SEQ
                         (LETT |mii| (SPADCALL |m| |i| |i| (QREFELT $ 11))
                               . #2#)
                         (EXIT
                          (COND
                           ((SPADCALL |mii| (|spadConstant| $ 16)
                                      (QREFELT $ 43))
                            'NIL)
                           ('T 'T))))))
                   #3=(GO G191)))
                 (SEQ
                  (EXIT
                   (SEQ (LETT |j| (+ |i| 1) . #2#) G190
                        (COND ((> |j| |m1|) #3#))
                        (SEQ
                         (EXIT
                          (COND
                           ((QEQCAR
                             (SPADCALL (SPADCALL |m| |j| |j| (QREFELT $ 11))
                                       |mii| (QREFELT $ 20))
                             1)
                            (PROGN
                             (LETT #1#
                                   (|SMITH;lastStep|
                                    (|SMITH;ijDivide| |sf| |i| |j| $) $)
                                   . #2#)
                             (GO #1#))))))
                        (LETT |j| (+ |j| 1) . #2#) #4=(GO G190) G191
                        (EXIT NIL))))
                 (LETT |i| (QSADD1 |i|) . #2#) #4# G191 (EXIT NIL))
            (EXIT |sf|)))
      #1# (EXIT #1#))))) 

(DEFUN |SMITH;findEqMat| (|m| |t| $)
  (PROG (#1=#:G754 |u1| #2=#:G736 #3=#:G746 #4=#:G745 #5=#:G747 #6=#:G760 |k|
         |j0| |tjj| |j| |i| |t11| |mm| |t1| |u| |mmh| #7=#:G759 #8=#:G729
         #9=#:G728 #10=#:G730 #11=#:G726 #12=#:G725 #13=#:G727 |n1| |m1|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ (LETT |m1| (SPADCALL |m| (QREFELT $ 22)) . #14=(|SMITH;findEqMat|))
            (LETT |n1| (SPADCALL |m| (QREFELT $ 23)) . #14#)
            (EXIT
             (COND
              ((PROGN
                (LETT #11# NIL . #14#)
                (SEQ (LETT |j| 1 . #14#) G190
                     (COND ((QSGREATERP |j| |n1|) #15=(GO G191)))
                     (SEQ
                      (EXIT
                       (PROGN
                        (LETT #13#
                              (SPADCALL (SPADCALL |t| |m1| |j| (QREFELT $ 11))
                                        (QREFELT $ 13))
                              . #14#)
                        (COND
                         (#11# (LETT #12# (COND (#12# #13#) ('T 'NIL)) . #14#))
                         ('T
                          (PROGN
                           (LETT #12# #13# . #14#)
                           (LETT #11# 'T . #14#)))))))
                     (LETT |j| (QSADD1 |j|) . #14#) #16=(GO G190) G191
                     (EXIT NIL))
                (COND (#11# #12#) (#17='T 'T)))
               (SEQ
                (COND
                 ((PROGN
                   (LETT #8# NIL . #14#)
                   (SEQ (LETT |j| 1 . #14#) G190
                        (COND ((QSGREATERP |j| |n1|) #15#))
                        (SEQ
                         (EXIT
                          (PROGN
                           (LETT #10#
                                 (SPADCALL (SPADCALL |t| 1 |j| (QREFELT $ 11))
                                           (QREFELT $ 13))
                                 . #14#)
                           (COND
                            (#8# (LETT #9# (COND (#9# #10#) ('T 'NIL)) . #14#))
                            ('T
                             (PROGN
                              (LETT #9# #10# . #14#)
                              (LETT #8# 'T . #14#)))))))
                        (LETT |j| (QSADD1 |j|) . #14#) #16# G191 (EXIT NIL))
                   (COND (#8# #9#) (#17# 'T)))
                  (PROGN
                   (LETT #7#
                         (CONS |m|
                               (SPADCALL |m1| (|spadConstant| $ 15)
                                         (QREFELT $ 44)))
                         . #14#)
                   (GO #7#))))
                (LETT |mm|
                      (SPADCALL |m|
                                (SPADCALL |m1| (|spadConstant| $ 15)
                                          (QREFELT $ 44))
                                (QREFELT $ 45))
                      . #14#)
                (LETT |mmh| (SPADCALL |mm| (QREFELT $ 46)) . #14#)
                (EXIT
                 (CONS (SPADCALL |mmh| 1 |m1| 1 |n1| (QREFELT $ 47))
                       (SPADCALL |mmh| 1 |m1| (+ |n1| 1) (+ |n1| |m1|)
                                 (QREFELT $ 47))))))
              (#17#
               (SEQ (LETT |u| (SPADCALL |m1| |m1| (QREFELT $ 48)) . #14#)
                    (LETT |j| 1 . #14#)
                    (SEQ G190
                         (COND
                          ((NULL
                            (SPADCALL (SPADCALL |t| 1 |j| (QREFELT $ 11))
                                      (|spadConstant| $ 16) (QREFELT $ 43)))
                           #15#))
                         (SEQ (EXIT (LETT |j| (+ |j| 1) . #14#))) NIL #16# G191
                         (EXIT NIL))
                    (LETT |t1| (SPADCALL |t| (QREFELT $ 49)) . #14#)
                    (LETT |mm| (SPADCALL |m| (QREFELT $ 49)) . #14#)
                    (COND
                     ((< 1 |j|)
                      (SEQ
                       (LETT |t1| (SPADCALL |t| 1 |m1| |j| |n1| (QREFELT $ 47))
                             . #14#)
                       (EXIT
                        (LETT |mm|
                              (SPADCALL |m| 1 |m1| |j| |n1| (QREFELT $ 47))
                              . #14#)))))
                    (LETT |t11| (SPADCALL |t1| 1 1 (QREFELT $ 11)) . #14#)
                    (SEQ (LETT |i| 1 . #14#) G190
                         (COND ((QSGREATERP |i| |m1|) #15#))
                         (SEQ
                          (SPADCALL |u| |i| 1
                                    (PROG2
                                        (LETT #2#
                                              (SPADCALL
                                               (SPADCALL |mm| |i| 1
                                                         (QREFELT $ 11))
                                               |t11| (QREFELT $ 20))
                                              . #14#)
                                        (QCDR #2#)
                                      (|check-union| (QEQCAR #2# 0)
                                                     (QREFELT $ 6) #2#))
                                    (QREFELT $ 39))
                          (EXIT
                           (SEQ (LETT |j| 2 . #14#) G190
                                (COND ((QSGREATERP |j| |m1|) #15#))
                                (SEQ (LETT |j0| |j| . #14#)
                                     (SEQ G190
                                          (COND
                                           ((NULL
                                             (SPADCALL
                                              (LETT |tjj|
                                                    (SPADCALL |t1| |j| |j0|
                                                              (QREFELT $ 11))
                                                    . #14#)
                                              (QREFELT $ 13)))
                                            #15#))
                                          (SEQ
                                           (EXIT
                                            (LETT |j0| (+ |j0| 1) . #14#)))
                                          NIL #16# G191 (EXIT NIL))
                                     (EXIT
                                      (SPADCALL |u| |i| |j|
                                                (PROG2
                                                    (LETT #2#
                                                          (SPADCALL
                                                           (SPADCALL
                                                            (SPADCALL |mm| |i|
                                                                      |j0|
                                                                      (QREFELT
                                                                       $ 11))
                                                            (PROGN
                                                             (LETT #3# NIL
                                                                   . #14#)
                                                             (SEQ
                                                              (LETT |k| 1
                                                                    . #14#)
                                                              (LETT #6#
                                                                    (- |j| 1)
                                                                    . #14#)
                                                              G190
                                                              (COND
                                                               ((QSGREATERP |k|
                                                                            #6#)
                                                                #15#))
                                                              (SEQ
                                                               (EXIT
                                                                (PROGN
                                                                 (LETT #5#
                                                                       (SPADCALL
                                                                        (SPADCALL
                                                                         |u|
                                                                         |i|
                                                                         |k|
                                                                         (QREFELT
                                                                          $
                                                                          11))
                                                                        (SPADCALL
                                                                         |t1|
                                                                         |k|
                                                                         |j0|
                                                                         (QREFELT
                                                                          $
                                                                          11))
                                                                        (QREFELT
                                                                         $ 26))
                                                                       . #14#)
                                                                 (COND
                                                                  (#3#
                                                                   (LETT #4#
                                                                         (SPADCALL
                                                                          #4#
                                                                          #5#
                                                                          (QREFELT
                                                                           $
                                                                           29))
                                                                         . #14#))
                                                                  ('T
                                                                   (PROGN
                                                                    (LETT #4#
                                                                          #5#
                                                                          . #14#)
                                                                    (LETT #3#
                                                                          'T
                                                                          . #14#)))))))
                                                              (LETT |k|
                                                                    (QSADD1
                                                                     |k|)
                                                                    . #14#)
                                                              #16# G191
                                                              (EXIT NIL))
                                                             (COND (#3# #4#)
                                                                   ('T
                                                                    (|spadConstant|
                                                                     $ 16))))
                                                            (QREFELT $ 50))
                                                           |tjj|
                                                           (QREFELT $ 20))
                                                          . #14#)
                                                    (QCDR #2#)
                                                  (|check-union| (QEQCAR #2# 0)
                                                                 (QREFELT $ 6)
                                                                 #2#))
                                                (QREFELT $ 39))))
                                (LETT |j| (QSADD1 |j|) . #14#) #16# G191
                                (EXIT NIL))))
                         (LETT |i| (QSADD1 |i|) . #14#) #16# G191 (EXIT NIL))
                    (LETT |u1| (SPADCALL (ELT $ 52) |u| (QREFELT $ 56)) . #14#)
                    (EXIT
                     (CONS |t|
                           (SPADCALL (ELT $ 57)
                                     (PROG2
                                         (LETT #1#
                                               (SPADCALL |u1| (QREFELT $ 58))
                                               . #14#)
                                         (QCDR #1#)
                                       (|check-union| (QEQCAR #1# 0)
                                                      (|Matrix|
                                                       (|Fraction|
                                                        (QREFELT $ 6)))
                                                      #1#))
                                     (QREFELT $ 61))))))))))
      #7# (EXIT #7#))))) 

(DEFUN |SMITH;hermite;2M;10| (|m| $) (SPADCALL |m| (QREFELT $ 46))) 

(DEFUN |SMITH;completeHermite;MR;11| (|m| $)
  (|SMITH;findEqMat| |m| (SPADCALL |m| (QREFELT $ 46)) $)) 

(DEFUN |SMITH;smith;2M;12| (|m| $) (QVELT (SPADCALL |m| (QREFELT $ 66)) 0)) 

(DEFUN |SMITH;completeSmith;MR;13| (|m| $)
  (PROG (|cm2| |m1| |rightm| |cm1| |nr| |leftm|)
    (RETURN
     (SEQ
      (LETT |cm1| (SPADCALL |m| (QREFELT $ 64))
            . #1=(|SMITH;completeSmith;MR;13|))
      (LETT |leftm| (QCDR |cm1|) . #1#) (LETT |m1| (QCAR |cm1|) . #1#)
      (EXIT
       (COND
        ((|SMITH;isDiagonal?| |m1| $)
         (|SMITH;lastStep|
          (VECTOR |m1| |leftm|
                  (SPADCALL (SPADCALL |m| (QREFELT $ 23)) (|spadConstant| $ 15)
                            (QREFELT $ 44)))
          $))
        (#2='T
         (SEQ (LETT |nr| (SPADCALL |m| (QREFELT $ 22)) . #1#)
              (LETT |cm1|
                    (SPADCALL (SPADCALL |m1| (QREFELT $ 68)) (QREFELT $ 64))
                    . #1#)
              (LETT |rightm| (SPADCALL (QCDR |cm1|) (QREFELT $ 68)) . #1#)
              (LETT |m1| (QCAR |cm1|) . #1#)
              (EXIT
               (COND
                ((|SMITH;isDiagonal?| |m1| $)
                 (SEQ
                  (LETT |cm2|
                        (|SMITH;lastStep| (VECTOR |m1| |leftm| |rightm|) $)
                        . #1#)
                  (EXIT
                   (COND
                    ((EQL
                      (SPADCALL (LETT |m| (QVELT |cm2| 0) . #1#)
                                (QREFELT $ 22))
                      |nr|)
                     |cm2|)
                    (#2#
                     (VECTOR (SPADCALL |m| (QREFELT $ 68)) (QVELT |cm2| 1)
                             (QVELT |cm2| 2)))))))
                (#2#
                 (SEQ (LETT |cm2| (SPADCALL |m1| (QREFELT $ 66)) . #1#)
                      (LETT |cm2|
                            (|SMITH;lastStep|
                             (VECTOR (QVELT |cm2| 0)
                                     (SPADCALL
                                      (SPADCALL (QVELT |cm2| 2) (QREFELT $ 68))
                                      |leftm| (QREFELT $ 69))
                                     (SPADCALL |rightm|
                                               (SPADCALL (QVELT |cm2| 1)
                                                         (QREFELT $ 68))
                                               (QREFELT $ 69)))
                             $)
                            . #1#)
                      (EXIT
                       (COND
                        ((EQL
                          (SPADCALL (LETT |m| (QVELT |cm2| 0) . #1#)
                                    (QREFELT $ 22))
                          |nr|)
                         |cm2|)
                        (#2#
                         (VECTOR (SPADCALL |m| (QREFELT $ 68)) (QVELT |cm2| 1)
                                 (QVELT |cm2| 2))))))))))))))))) 

(DEFUN |SMITH;diophantineSystem;MColR;14| (|m| |b| $)
  (PROG (|lsol| |i| #1=#:G785 |sol| |rm| |t2| |n1| |dk| |t1| |b1| |lm| |m1|
         |sm| |sf|)
    (RETURN
     (SEQ
      (LETT |sf| (SPADCALL |m| (QREFELT $ 66))
            . #2=(|SMITH;diophantineSystem;MColR;14|))
      (LETT |sm| (QVELT |sf| 0) . #2#)
      (LETT |m1| (SPADCALL |sm| (QREFELT $ 22)) . #2#)
      (LETT |lm| (QVELT |sf| 1) . #2#)
      (LETT |b1| (SPADCALL |lm| |b| (QREFELT $ 70)) . #2#)
      (LETT |t1| (|SMITH;test1| |sm| |b1| |m1| $) . #2#)
      (EXIT
       (COND ((QEQCAR |t1| 1) (CONS (CONS 1 "failed") NIL))
             (#3='T
              (SEQ (LETT |dk| (QCDR |t1|) . #2#)
                   (LETT |n1| (SPADCALL |sm| (QREFELT $ 23)) . #2#)
                   (LETT |t2| (|SMITH;test2| |sm| |b1| |n1| |dk| $) . #2#)
                   (EXIT
                    (COND ((QEQCAR |t2| 1) (CONS (CONS 1 "failed") NIL))
                          (#3#
                           (SEQ (LETT |rm| (QVELT |sf| 2) . #2#)
                                (LETT |sol|
                                      (SPADCALL |rm| (QCDR |t2|)
                                                (QREFELT $ 70))
                                      . #2#)
                                (EXIT
                                 (COND
                                  ((EQL |dk| |n1|)
                                   (CONS (CONS 0 |sol|)
                                         (SPADCALL
                                          (SPADCALL |n1| (|spadConstant| $ 16)
                                                    (QREFELT $ 18))
                                          (QREFELT $ 72))))
                                  (#3#
                                   (SEQ
                                    (LETT |lsol|
                                          (PROGN
                                           (LETT #1# NIL . #2#)
                                           (SEQ (LETT |i| (+ |dk| 1) . #2#)
                                                G190
                                                (COND ((> |i| |n1|) (GO G191)))
                                                (SEQ
                                                 (EXIT
                                                  (LETT #1#
                                                        (CONS
                                                         (SPADCALL |rm| |i|
                                                                   (QREFELT $
                                                                            32))
                                                         #1#)
                                                        . #2#)))
                                                (LETT |i| (+ |i| 1) . #2#)
                                                (GO G190) G191
                                                (EXIT (NREVERSE0 #1#))))
                                          . #2#)
                                    (EXIT
                                     (CONS (CONS 0 |sol|)
                                           |lsol|)))))))))))))))))) 

(DEFUN |SmithNormalForm| (&REST #1=#:G786)
  (PROG ()
    (RETURN
     (PROG (#2=#:G787)
       (RETURN
        (COND
         ((LETT #2#
                (|lassocShiftWithFunction| (|devaluateList| #1#)
                                           (HGET |$ConstructorCache|
                                                 '|SmithNormalForm|)
                                           '|domainEqualList|)
                . #3=(|SmithNormalForm|))
          (|CDRwithIncrement| #2#))
         ('T
          (UNWIND-PROTECT
              (PROG1 (APPLY (|function| |SmithNormalForm;|) #1#)
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#) (HREM |$ConstructorCache| '|SmithNormalForm|))))))))))) 

(DEFUN |SmithNormalForm;| (|#1| |#2| |#3| |#4|)
  (PROG (|pv$| $ |dv$| DV$4 DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|SmithNormalForm|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT DV$3 (|devaluate| |#3|) . #1#)
      (LETT DV$4 (|devaluate| |#4|) . #1#)
      (LETT |dv$| (LIST '|SmithNormalForm| DV$1 DV$2 DV$3 DV$4) . #1#)
      (LETT $ (GETREFV 76) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|SmithNormalForm|
                  (LIST DV$1 DV$2 DV$3 DV$4) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 |#4|)
      $)))) 

(MAKEPROP '|SmithNormalForm| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) (|local| |#4|) (|Integer|) (0 . |elt|) (|Boolean|)
              (7 . |zero?|) (12 . |elt|) (18 . |One|) (22 . |Zero|)
              (|NonNegativeInteger|) (26 . |new|) (|Union| $ '"failed")
              (32 . |exquo|) (38 . |setelt|) (45 . |nrows|) (50 . |ncols|)
              (55 . |row|) (61 . |setRow!|) (68 . *) (|Mapping| 6 6)
              (74 . |map|) (80 . +) (|Mapping| 6 6 6) (86 . |map|)
              (93 . |column|) (99 . |map|) (105 . |map|) (112 . |setColumn!|)
              (|Record| (|:| |coef1| $) (|:| |coef2| $) (|:| |generator| $))
              (119 . |extendedEuclidean|) (125 . -) (130 . |setelt|)
              (|PositiveInteger|) (138 . |One|) (142 . *) (148 . =)
              (154 . |scalarMatrix|) (160 . |horizConcat|) (166 . |rowEchelon|)
              (171 . |subMatrix|) (180 . |zero|) (186 . |copy|) (191 . -)
              (|Fraction| 6) (197 . |coerce|) (|Matrix| 51) (|Mapping| 51 6)
              (|MatrixCategoryFunctions2| 6 7 8 9 51 (|Vector| 51)
                                          (|Vector| 51) 53)
              (202 . |map|) (208 . |retract|) (213 . |inverse|)
              (|Mapping| 6 51)
              (|MatrixCategoryFunctions2| 51 (|Vector| 51) (|Vector| 51) 53 6 7
                                          8 9)
              (218 . |map|) |SMITH;hermite;2M;10|
              (|Record| (|:| |Hermite| 9) (|:| |eqMat| 9))
              |SMITH;completeHermite;MR;11|
              (|Record| (|:| |Smith| 9) (|:| |leftEqMat| 9)
                        (|:| |rightEqMat| 9))
              |SMITH;completeSmith;MR;13| |SMITH;smith;2M;12|
              (224 . |transpose|) (229 . *) (235 . *) (|List| 8) (241 . |list|)
              (|Union| 8 '"failed")
              (|Record| (|:| |particular| 73) (|:| |basis| 71))
              |SMITH;diophantineSystem;MColR;14|)
           '#(|smith| 246 |hermite| 251 |diophantineSystem| 256 |completeSmith|
              262 |completeHermite| 267)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 75
                                                 '(3 9 6 0 10 10 11 1 6 12 0 13
                                                   2 8 6 0 10 14 0 6 0 15 0 6 0
                                                   16 2 8 0 17 6 18 2 6 19 0 0
                                                   20 3 8 6 0 10 6 21 1 9 17 0
                                                   22 1 9 17 0 23 2 9 7 0 10 24
                                                   3 9 0 0 10 7 25 2 6 0 0 0 26
                                                   2 7 0 27 0 28 2 6 0 0 0 29 3
                                                   7 0 30 0 0 31 2 9 8 0 10 32
                                                   2 8 0 27 0 33 3 8 0 30 0 0
                                                   34 3 9 0 0 10 8 35 2 6 36 0
                                                   0 37 1 6 0 0 38 4 9 6 0 10
                                                   10 6 39 0 40 0 41 2 6 0 40 0
                                                   42 2 6 12 0 0 43 2 9 0 17 6
                                                   44 2 9 0 0 0 45 1 9 0 0 46 5
                                                   9 0 0 10 10 10 10 47 2 9 0
                                                   17 17 48 1 9 0 0 49 2 6 0 0
                                                   0 50 1 51 0 6 52 2 55 53 54
                                                   9 56 1 51 6 0 57 1 53 19 0
                                                   58 2 60 9 59 53 61 1 9 0 0
                                                   68 2 9 0 0 0 69 2 9 8 0 8 70
                                                   1 71 0 8 72 1 0 9 9 67 1 0 9
                                                   9 62 2 0 74 9 8 75 1 0 65 9
                                                   66 1 0 63 9 64)))))
           '|lookupComplete|)) 
