
(/VERSIONCHECK 2) 

(DEFUN |SMITH;test1| (|sm| |b| |m1| $)
  (PROG (#0=#:G1833 #1=#:G1829 |km|)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |km| |m1| . #2=(|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 #0# (CONS 1 "failed") . #2#)
                                     (GO #0#))))
                                (EXIT (LETT |km|
                                       (PROG1
                                        (LETT #1# (- |km| 1) . #2#)
                                         (|check-subtype| (>= #1# 0)
                                          '(|NonNegativeInteger|) #1#)) . #2#)))
                           NIL (GO G190) G191 (EXIT NIL))
                      (EXIT (CONS 0 |km|))))
           #0# (EXIT #0#))))) 

(DEFUN |SMITH;test2| (|sm| |b| |n1| |dk| $)
  (PROG (|sol| |k| |c| #0=#:G1847)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |sol|
                            (SPADCALL |n1| (|spadConstant| $ 16)
                                (QREFELT $ 18))
                            . #1=(|SMITH;test2|))
                      (SEQ (LETT |k| 1 . #1#) 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)) . #1#)
                                     (EXIT
                                      (COND
                                        ((QEQCAR |c| 1)
                                         (PROGN
                                           (LETT #0#
                                            (CONS 1 "failed") . #1#)
                                           (GO #0#))))))
                                (EXIT (SPADCALL |sol| |k| (QCDR |c|)
                                       (QREFELT $ 21))))
                           (LETT |k| (QSADD1 |k|) . #1#) (GO G190) G191
                           (EXIT NIL))
                      (EXIT (CONS 0 |sol|))))
           #0# (EXIT #0#))))) 

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

(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))
                 . #0=(|SMITH;elRow2|))
           (LETT |vec|
                 (SPADCALL (ELT $ 29) (SPADCALL |m| |i| (QREFELT $ 24))
                     |vec| (QREFELT $ 31)) . #0#)
           (SPADCALL |m| |i| |vec| (QREFELT $ 25)) (EXIT |m|))))) 

(DEFUN |SMITH;elRow2!0| (|#1| $$)
  (SPADCALL (QREFELT $$ 1) |#1| (QREFELT (QREFELT $$ 0) 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))
                 . #0=(|SMITH;elColumn2|))
           (LETT |vec|
                 (SPADCALL (ELT $ 29) (SPADCALL |m| |i| (QREFELT $ 32))
                     |vec| (QREFELT $ 34)) . #0#)
           (SPADCALL |m| |i| |vec| (QREFELT $ 35)) (EXIT |m|))))) 

(DEFUN |SMITH;elColumn2!0| (|#1| $$)
  (SPADCALL (QREFELT $$ 1) |#1| (QREFELT (QREFELT $$ 0) 26))) 

(DEFUN |SMITH;ijDivide| (|sf| |i| |j| $)
  (PROG (|m| |extGcd| |d| |mii| #0=#:G1865 |mjj| |lMat| |rMat|)
    (RETURN
      (SEQ (LETT |m| (QVELT |sf| 0) . #1=(|SMITH;ijDivide|))
           (LETT |mii| (SPADCALL |m| |i| |i| (QREFELT $ 11)) . #1#)
           (LETT |mjj| (SPADCALL |m| |j| |j| (QREFELT $ 11)) . #1#)
           (LETT |extGcd| (SPADCALL |mii| |mjj| (QREFELT $ 37)) . #1#)
           (LETT |d| (QVELT |extGcd| 2) . #1#)
           (LETT |mii|
                 (PROG2 (LETT #0#
                              (SPADCALL |mii| |d| (QREFELT $ 20)) . #1#)
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0) (QREFELT $ 6) #0#)) . #1#)
           (LETT |mjj|
                 (PROG2 (LETT #0#
                              (SPADCALL |mjj| |d| (QREFELT $ 20)) . #1#)
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0) (QREFELT $ 6) #0#)) . #1#)
           (LETT |lMat|
                 (|SMITH;elRow2| (QVELT |sf| 1) (QVELT |extGcd| 0) |j|
                     |i| $) . #1#)
           (LETT |lMat| (|SMITH;elRow1| |lMat| |i| |j| $) . #1#)
           (LETT |lMat|
                 (|SMITH;elRow2| |lMat| (SPADCALL |mii| (QREFELT $ 38))
                     |j| |i| $) . #1#)
           (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| $) . #1#)
           (LETT |rMat|
                 (|SMITH;elColumn2| |rMat|
                     (SPADCALL |mjj| (QREFELT $ 38)) |j| |i| $) . #1#)
           (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| (|#1| $)
  (SPADCALL (SPADCALL (|spadConstant| $ 41) |#1| (QREFELT $ 42))
      (QREFELT $ 38))) 

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

(DEFUN |SMITH;findEqMat| (|m| |t| $)
  (PROG (|m1| |n1| #0=#:G1881 #1=#:G1879 #2=#:G1880 #3=#:G1884
              #4=#:G1882 #5=#:G1883 #6=#:G1913 |mmh| |u| |t1| |mm|
              |t11| |i| |j| |tjj| |j0| |k| #7=#:G1914 #8=#:G1901
              #9=#:G1899 #10=#:G1900 #11=#:G1890 |u1| #12=#:G1908)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |m1| (SPADCALL |m| (QREFELT $ 22))
                            . #13=(|SMITH;findEqMat|))
                      (LETT |n1| (SPADCALL |m| (QREFELT $ 23)) . #13#)
                      (EXIT (COND
                              ((PROGN
                                 (LETT #2# NIL . #13#)
                                 (SEQ (LETT |j| 1 . #13#) G190
                                      (COND
                                        ((QSGREATERP |j| |n1|)
                                         #14=(GO G191)))
                                      (SEQ
                                       (EXIT
                                        (PROGN
                                          (LETT #0#
                                           (SPADCALL
                                            (SPADCALL |t| |m1| |j|
                                             (QREFELT $ 11))
                                            (QREFELT $ 13)) . #13#)
                                          (COND
                                            (#2#
                                             (LETT #1#
                                              (COND
                                                (#1# #0#)
                                                ('T 'NIL)) . #13#))
                                            ('T
                                             (PROGN
                                               (LETT #1# #0# . #13#)
                                               (LETT #2# 'T . #13#)))))))
                                      (LETT |j| (QSADD1 |j|) . #13#)
                                      #15=(GO G190) G191 (EXIT NIL))
                                 (COND (#2# #1#) ('T 'T)))
                               (SEQ (COND
                                      ((PROGN
                                         (LETT #5# NIL . #13#)
                                         (SEQ (LETT |j| 1 . #13#) G190
                                          (COND
                                            ((QSGREATERP |j| |n1|)
                                             #14#))
                                          (SEQ
                                           (EXIT
                                            (PROGN
                                              (LETT #3#
                                               (SPADCALL
                                                (SPADCALL |t| 1 |j|
                                                 (QREFELT $ 11))
                                                (QREFELT $ 13)) . #13#)
                                              (COND
                                                (#5#
                                                 (LETT #4#
                                                  (COND
                                                    (#4# #3#)
                                                    ('T 'NIL)) . #13#))
                                                ('T
                                                 (PROGN
                                                   (LETT #4#
                                                    #3# . #13#)
                                                   (LETT #5# 'T . #13#)))))))
                                          (LETT |j|
                                           (QSADD1 |j|) . #13#)
                                          #15# G191 (EXIT NIL))
                                         (COND (#5# #4#) ('T 'T)))
                                       (PROGN
                                         (LETT #6#
                                          (CONS |m|
                                           (SPADCALL |m1|
                                            (|spadConstant| $ 15)
                                            (QREFELT $ 44))) . #13#)
                                         (GO #6#))))
                                    (LETT |mm|
                                     (SPADCALL |m|
                                      (SPADCALL |m1|
                                       (|spadConstant| $ 15)
                                       (QREFELT $ 44))
                                      (QREFELT $ 45)) . #13#)
                                    (LETT |mmh|
                                     (SPADCALL |mm| (QREFELT $ 46)) . #13#)
                                    (EXIT
                                     (CONS
                                      (SPADCALL |mmh| 1 |m1| 1 |n1|
                                       (QREFELT $ 47))
                                      (SPADCALL |mmh| 1 |m1| (+ |n1| 1)
                                       (+ |n1| |m1|) (QREFELT $ 47))))))
                              ('T
                               (SEQ (LETT |u|
                                     (SPADCALL |m1| |m1|
                                      (QREFELT $ 48)) . #13#)
                                    (LETT |j| 1 . #13#)
                                    (SEQ G190
                                     (COND
                                       ((NULL
                                         (SPADCALL
                                          (SPADCALL |t| 1 |j|
                                           (QREFELT $ 11))
                                          (|spadConstant| $ 16)
                                          (QREFELT $ 43)))
                                        #14#))
                                     (SEQ
                                      (EXIT
                                       (LETT |j| (+ |j| 1) . #13#)))
                                     NIL #15# G191 (EXIT NIL))
                                    (LETT |t1|
                                     (SPADCALL |t| (QREFELT $ 49)) . #13#)
                                    (LETT |mm|
                                     (SPADCALL |m| (QREFELT $ 49)) . #13#)
                                    (COND
                                      ((< 1 |j|)
                                       (SEQ
                                        (LETT |t1|
                                         (SPADCALL |t| 1 |m1| |j| |n1|
                                          (QREFELT $ 47)) . #13#)
                                        (EXIT
                                         (LETT |mm|
                                          (SPADCALL |m| 1 |m1| |j| |n1|
                                           (QREFELT $ 47)) . #13#)))))
                                    (LETT |t11|
                                     (SPADCALL |t1| 1 1 (QREFELT $ 11)) . #13#)
                                    (SEQ (LETT |i| 1 . #13#) G190
                                     (COND
                                       ((QSGREATERP |i| |m1|) #14#))
                                     (SEQ
                                      (SPADCALL |u| |i| 1
                                       (PROG2
                                        (LETT #11#
                                         (SPADCALL
                                          (SPADCALL |mm| |i| 1
                                           (QREFELT $ 11))
                                          |t11| (QREFELT $ 20)) . #13#)
                                        (QCDR #11#)
                                         (|check-union| (QEQCAR #11# 0)
                                          (QREFELT $ 6) #11#))
                                       (QREFELT $ 39))
                                      (EXIT
                                       (SEQ (LETT |j| 2 . #13#) G190
                                        (COND
                                          ((QSGREATERP |j| |m1|) #14#))
                                        (SEQ (LETT |j0| |j| . #13#)
                                         (SEQ G190
                                          (COND
                                            ((NULL
                                              (SPADCALL
                                               (LETT |tjj|
                                                (SPADCALL |t1| |j| |j0|
                                                 (QREFELT $ 11)) . #13#)
                                               (QREFELT $ 13)))
                                             #14#))
                                          (SEQ
                                           (EXIT
                                            (LETT |j0|
                                             (+ |j0| 1) . #13#)))
                                          NIL #15# G191 (EXIT NIL))
                                         (EXIT
                                          (SPADCALL |u| |i| |j|
                                           (PROG2
                                            (LETT #11#
                                             (SPADCALL
                                              (SPADCALL
                                               (SPADCALL |mm| |i| |j0|
                                                (QREFELT $ 11))
                                               (PROGN
                                                 (LETT #10# NIL . #13#)
                                                 (SEQ
                                                  (LETT |k| 1 . #13#)
                                                  (LETT #7#
                                                   (- |j| 1) . #13#)
                                                  G190
                                                  (COND
                                                    ((QSGREATERP |k|
                                                      #7#)
                                                     #14#))
                                                  (SEQ
                                                   (EXIT
                                                    (PROGN
                                                      (LETT #8#
                                                       (SPADCALL
                                                        (SPADCALL |u|
                                                         |i| |k|
                                                         (QREFELT $ 11))
                                                        (SPADCALL |t1|
                                                         |k| |j0|
                                                         (QREFELT $ 11))
                                                        (QREFELT $ 26)) . #13#)
                                                      (COND
                                                        (#10#
                                                         (LETT #9#
                                                          (SPADCALL #9#
                                                           #8#
                                                           (QREFELT $
                                                            29)) . #13#))
                                                        ('T
                                                         (PROGN
                                                           (LETT #9#
                                                            #8# . #13#)
                                                           (LETT #10#
                                                            'T . #13#)))))))
                                                  (LETT |k|
                                                   (QSADD1 |k|) . #13#)
                                                  #15# G191 (EXIT NIL))
                                                 (COND
                                                   (#10# #9#)
                                                   ('T
                                                    (|spadConstant| $
                                                     16))))
                                               (QREFELT $ 50))
                                              |tjj| (QREFELT $ 20)) . #13#)
                                            (QCDR #11#)
                                             (|check-union|
                                              (QEQCAR #11# 0)
                                              (QREFELT $ 6) #11#))
                                           (QREFELT $ 39))))
                                        (LETT |j| (QSADD1 |j|) . #13#)
                                        #15# G191 (EXIT NIL))))
                                     (LETT |i| (QSADD1 |i|) . #13#)
                                     #15# G191 (EXIT NIL))
                                    (LETT |u1|
                                     (SPADCALL
                                      (CONS #'|SMITH;findEqMat!0| $)
                                      |u| (QREFELT $ 56)) . #13#)
                                    (EXIT
                                     (CONS |t|
                                      (SPADCALL (ELT $ 57)
                                       (PROG2
                                        (LETT #12#
                                         (SPADCALL |u1| (QREFELT $ 58)) . #13#)
                                        (QCDR #12#)
                                         (|check-union| (QEQCAR #12# 0)
                                          (|Matrix|
                                           (|Fraction| (QREFELT $ 6)))
                                          #12#))
                                       (QREFELT $ 61))))))))))
           #6# (EXIT #6#))))) 

(DEFUN |SMITH;findEqMat!0| (|#1| $) (SPADCALL |#1| (QREFELT $ 52))) 

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

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

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

(DEFUN |SmithNormalForm;| (|#1| |#2| |#3| |#4|)
  (PROG (DV$1 DV$2 DV$3 DV$4 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|SmithNormalForm|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT DV$4 (|devaluate| |#4|) . #0#)
        (LETT |dv$|
              (LIST '|SmithNormalForm| DV$1 DV$2 DV$3 DV$4) . #0#)
        (LETT $ (GETREFV 76) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|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|)) 
