
(/VERSIONCHECK 2) 

(DEFUN |MDDFACT;reduction| (|u| |p| $)
  (COND
    ((ZEROP |p|) |u|)
    ('T
     (SPADCALL (CONS #'|MDDFACT;reduction!0| (VECTOR $ |p|)) |u|
         (QREFELT $ 10))))) 

(DEFUN |MDDFACT;reduction!0| (|#1| $$)
  (SPADCALL |#1| (QREFELT $$ 1) (QREFELT (QREFELT $$ 0) 8))) 

(DEFUN |MDDFACT;merge| (|p| |q| $)
  (COND
    ((EQL |p| |q|) (CONS 0 |p|))
    ((EQL |p| 0) (CONS 0 |q|))
    ((EQL |q| 0) (CONS 0 |p|))
    ('T (CONS 1 "failed")))) 

(DEFUN |MDDFACT;modInverse| (|c| |p| $)
  (PROG (#0=#:G1839)
    (RETURN
      (QCAR (PROG2 (LETT #0# (SPADCALL |c| |p| 1 (QREFELT $ 15))
                         |MDDFACT;modInverse|)
                   (QCDR #0#)
              (|check-union| (QEQCAR #0# 0)
                  (|Record| (|:| |coef1| (|Integer|))
                      (|:| |coef2| (|Integer|)))
                  #0#)))))) 

(DEFUN |MDDFACT;exactquo| (|u| |v| |p| $)
  (PROG (|invlcv| |r|)
    (RETURN
      (SEQ (LETT |invlcv|
                 (|MDDFACT;modInverse| (SPADCALL |v| (QREFELT $ 16))
                     |p| $)
                 . #0=(|MDDFACT;exactquo|))
           (LETT |r|
                 (SPADCALL |u|
                     (|MDDFACT;reduction|
                         (SPADCALL |invlcv| |v| (QREFELT $ 17)) |p| $)
                     (QREFELT $ 19)) . #0#)
           (COND
             ((NULL (SPADCALL (|MDDFACT;reduction| (QCDR |r|) |p| $)
                        (|spadConstant| $ 11) (QREFELT $ 21)))
              (EXIT (CONS 1 "failed"))))
           (EXIT (CONS 0
                       (|MDDFACT;reduction|
                           (SPADCALL |invlcv| (QCAR |r|)
                               (QREFELT $ 17))
                           |p| $))))))) 

(DEFUN |MDDFACT;lc| (|u| $)
  (SPADCALL (SPADCALL |u| (QREFELT $ 23)) (QREFELT $ 16))) 

(DEFUN |MDDFACT;degree| (|u| $)
  (SPADCALL (SPADCALL |u| (QREFELT $ 23)) (QREFELT $ 25))) 

(DEFUN |MDDFACT;makeMonic| (|u| $)
  (SPADCALL
      (|MDDFACT;modInverse| (|MDDFACT;lc| |u| $)
          (SPADCALL |u| (QREFELT $ 26)) $)
      |u| (QREFELT $ 27))) 

(DEFUN |MDDFACT;exptmod| (|u1| |i| |u2| $)
  (PROG (|ans|)
    (RETURN
      (SEQ (COND
             ((< |i| 0)
              (|error| "negative exponentiation not allowed for exptMod"))
             ('T
              (SEQ (LETT |ans| (|spadConstant| $ 28)
                         . #0=(|MDDFACT;exptmod|))
                   (SEQ G190 (COND ((NULL (< 0 |i|)) (GO G191)))
                        (SEQ (COND
                               ((ODDP |i|)
                                (LETT |ans|
                                      (SPADCALL
                                       (SPADCALL |ans| |u1|
                                        (QREFELT $ 29))
                                       |u2| (QREFELT $ 30)) . #0#)))
                             (LETT |i| (QUOTIENT2 |i| 2) . #0#)
                             (EXIT (LETT |u1|
                                    (SPADCALL
                                     (SPADCALL |u1| |u1|
                                      (QREFELT $ 29))
                                     |u2| (QREFELT $ 30)) . #0#)))
                        NIL (GO G190) G191 (EXIT NIL))
                   (EXIT |ans|)))))))) 

(DEFUN |MDDFACT;exptMod;UIUIU;9| (|a| |i| |b| |q| $)
  (PROG (|ans|)
    (RETURN
      (SEQ (LETT |ans|
                 (|MDDFACT;exptmod| (SPADCALL |a| |q| (QREFELT $ 31))
                     |i| (SPADCALL |b| |q| (QREFELT $ 31)) $)
                 |MDDFACT;exptMod;UIUIU;9|)
           (EXIT (SPADCALL |ans| (QREFELT $ 23))))))) 

(DEFUN |MDDFACT;ddfactor| (|u| $)
  (PROG (|c| |ans| #0=#:G1865 |f| #1=#:G1866)
    (RETURN
      (SEQ (SEQ (LETT |c| (|MDDFACT;lc| |u| $)
                      . #2=(|MDDFACT;ddfactor|))
                (EXIT (COND
                        ((NULL (EQL |c| 1))
                         (LETT |u| (|MDDFACT;makeMonic| |u| $) . #2#)))))
           (LETT |ans|
                 (|MDDFACT;sepfact| (|MDDFACT;ddfact| |u| $) $) . #2#)
           (EXIT (CONS (SPADCALL |c| (QREFELT $ 33))
                       (PROGN
                         (LETT #0# NIL . #2#)
                         (SEQ (LETT |f| NIL . #2#)
                              (LETT #1# |ans| . #2#) G190
                              (COND
                                ((OR (ATOM #1#)
                                     (PROGN
                                       (LETT |f| (CAR #1#) . #2#)
                                       NIL))
                                 (GO G191)))
                              (SEQ (EXIT
                                    (COND
                                      ((< 0 (|MDDFACT;degree| |f| $))
                                       (LETT #0#
                                        (CONS
                                         (|MDDFACT;makeMonic| |f| $)
                                         #0#) . #2#)))))
                              (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                              (EXIT (NREVERSE0 #0#)))))))))) 

(DEFUN |MDDFACT;gcd;2UIU;11| (|u| |v| |q| $)
  (SPADCALL
      (SPADCALL (SPADCALL |u| |q| (QREFELT $ 31))
          (SPADCALL |v| |q| (QREFELT $ 31)) (QREFELT $ 34))
      (QREFELT $ 23))) 

(DEFUN |MDDFACT;factor;UIL;12| (|u| |q| $)
  (PROG (|v| |dv| |ans| #0=#:G1872 |f| #1=#:G1873)
    (RETURN
      (SEQ (LETT |v| (SPADCALL |u| |q| (QREFELT $ 31))
                 . #2=(|MDDFACT;factor;UIL;12|))
           (LETT |dv|
                 (SPADCALL (SPADCALL |u| (QREFELT $ 36)) |q|
                     (QREFELT $ 31)) . #2#)
           (EXIT (COND
                   ((< 0
                       (|MDDFACT;degree|
                           (SPADCALL |v| |dv| (QREFELT $ 34)) $))
                    (|error| "Modular factor: polynomial must be squarefree"))
                   ('T
                    (SEQ (LETT |ans| (|MDDFACT;ddfactor| |v| $) . #2#)
                         (EXIT (PROGN
                                 (LETT #0# NIL . #2#)
                                 (SEQ (LETT |f| NIL . #2#)
                                      (LETT #1# |ans| . #2#) G190
                                      (COND
                                        ((OR (ATOM #1#)
                                          (PROGN
                                            (LETT |f| (CAR #1#) . #2#)
                                            NIL))
                                         (GO G191)))
                                      (SEQ
                                       (EXIT
                                        (LETT #0#
                                         (CONS
                                          (SPADCALL |f| (QREFELT $ 23))
                                          #0#) . #2#)))
                                      (LETT #1# (CDR #1#) . #2#)
                                      (GO G190) G191
                                      (EXIT (NREVERSE0 #0#))))))))))))) 

(DEFUN |MDDFACT;ddfact| (|u| $)
  (PROG (|p| |m| |c| |w| |g| |ans| |d| #0=#:G1882 #1=#:G1878)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |p| (SPADCALL |u| (QREFELT $ 26))
                            . #2=(|MDDFACT;ddfact|))
                      (LETT |w|
                            (SPADCALL (SPADCALL 1 1 (QREFELT $ 39)) |p|
                                (QREFELT $ 31)) . #2#)
                      (LETT |m| |w| . #2#) (LETT |d| 1 . #2#)
                      (SEQ (LETT |c| (|MDDFACT;lc| |u| $) . #2#)
                           (EXIT (COND
                                   ((NULL (EQL |c| 1))
                                    (LETT |u|
                                     (|MDDFACT;makeMonic| |u| $) . #2#)))))
                      (LETT |ans| NIL . #2#)
                      (EXIT (SEQ G190 NIL
                                 (SEQ (LETT |w|
                                       (|MDDFACT;exptmod| |w| |p| |u|
                                        $) . #2#)
                                      (LETT |g|
                                       (SPADCALL
                                        (SPADCALL |w| |m|
                                         (QREFELT $ 40))
                                        |u| (QREFELT $ 34)) . #2#)
                                      (COND
                                        ((< 0 (|MDDFACT;degree| |g| $))
                                         (SEQ
                                          (LETT |g|
                                           (|MDDFACT;makeMonic| |g| $) . #2#)
                                          (LETT |ans|
                                           (CONS (CONS |g| |d|) |ans|) . #2#)
                                          (EXIT
                                           (LETT |u|
                                            (SPADCALL |u| |g|
                                             (QREFELT $ 41)) . #2#)))))
                                      (EXIT
                                       (COND
                                         ((EQL (|MDDFACT;degree| |u| $)
                                           0)
                                          (PROGN
                                            (LETT #0#
                                             (CONS
                                              (CONS
                                               (SPADCALL |c|
                                                (QREFELT $ 33))
                                               0)
                                              |ans|) . #2#)
                                            (GO #0#)))
                                         ('T
                                          (SEQ
                                           (EXIT
                                            (SEQ
                                             (LETT |d| (+ |d| 1) . #2#)
                                             (EXIT
                                              (COND
                                                ((<
                                                  (QUOTIENT2
                                                   (|MDDFACT;degree|
                                                    |u| $)
                                                   2)
                                                  |d|)
                                                 (PROGN
                                                   (LETT #1#
                                                    (PROGN
                                                      (LETT #0#
                                                       (CONS
                                                        (CONS
                                                         (SPADCALL |c|
                                                          (QREFELT $
                                                           33))
                                                         0)
                                                        (CONS
                                                         (CONS |u|
                                                          (|MDDFACT;degree|
                                                           |u| $))
                                                         |ans|)) . #2#)
                                                      (GO #0#)) . #2#)
                                                   (GO #1#)))))))
                                           #1# (EXIT #1#))))))
                                 NIL (GO G190) G191 (EXIT NIL)))))
           #0# (EXIT #0#))))) 

(DEFUN |MDDFACT;ddFact;UIL;14| (|u| |q| $)
  (PROG (|ans| #0=#:G1890 |dd| #1=#:G1891)
    (RETURN
      (SEQ (LETT |ans|
                 (|MDDFACT;ddfact| (SPADCALL |u| |q| (QREFELT $ 31)) $)
                 . #2=(|MDDFACT;ddFact;UIL;14|))
           (EXIT (PROGN
                   (LETT #0# NIL . #2#)
                   (SEQ (LETT |dd| NIL . #2#) (LETT #1# |ans| . #2#)
                        G190
                        (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |dd| (CAR #1#) . #2#) NIL))
                           (GO G191)))
                        (SEQ (EXIT (LETT #0#
                                    (CONS
                                     (CONS
                                      (SPADCALL (QCAR |dd|)
                                       (QREFELT $ 23))
                                      (QCDR |dd|))
                                     #0#) . #2#)))
                        (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                        (EXIT (NREVERSE0 #0#))))))))) 

(DEFUN |MDDFACT;linears;UIU;15| (|u| |q| $)
  (PROG (|uu| |m|)
    (RETURN
      (SEQ (LETT |uu| (SPADCALL |u| |q| (QREFELT $ 31))
                 . #0=(|MDDFACT;linears;UIU;15|))
           (LETT |m|
                 (SPADCALL (SPADCALL 1 1 (QREFELT $ 39)) |q|
                     (QREFELT $ 31)) . #0#)
           (EXIT (SPADCALL
                     (SPADCALL
                         (SPADCALL (|MDDFACT;exptmod| |m| |q| |uu| $)
                             |m| (QREFELT $ 40))
                         |uu| (QREFELT $ 34))
                     (QREFELT $ 23))))))) 

(DEFUN |MDDFACT;sepfact| (|factList| $)
  (PROG (|f| #0=#:G1899 #1=#:G1897 #2=#:G1895 #3=#:G1896)
    (RETURN
      (SEQ (PROGN
             (LETT #3# NIL . #4=(|MDDFACT;sepfact|))
             (SEQ (LETT |f| NIL . #4#) (LETT #0# |factList| . #4#) G190
                  (COND
                    ((OR (ATOM #0#)
                         (PROGN (LETT |f| (CAR #0#) . #4#) NIL))
                     (GO G191)))
                  (SEQ (EXIT (PROGN
                               (LETT #1#
                                     (|MDDFACT;sepFact1| |f| $) . #4#)
                               (COND
                                 (#3# (LETT #2# (APPEND #2# #1#) . #4#))
                                 ('T
                                  (PROGN
                                    (LETT #2# #1# . #4#)
                                    (LETT #3# 'T . #4#)))))))
                  (LETT #0# (CDR #0#) . #4#) (GO G190) G191 (EXIT NIL))
             (COND (#3# #2#) ('T NIL))))))) 

(DEFUN |MDDFACT;separateFactors;LIL;17| (|uddList| |q| $)
  (PROG (#0=#:G1906 |udd| #1=#:G1907 |ans| #2=#:G1908 |f| #3=#:G1909)
    (RETURN
      (SEQ (LETT |ans|
                 (|MDDFACT;sepfact|
                     (PROGN
                       (LETT #0# NIL
                             . #4=(|MDDFACT;separateFactors;LIL;17|))
                       (SEQ (LETT |udd| NIL . #4#)
                            (LETT #1# |uddList| . #4#) G190
                            (COND
                              ((OR (ATOM #1#)
                                   (PROGN
                                     (LETT |udd| (CAR #1#) . #4#)
                                     NIL))
                               #5=(GO G191)))
                            (SEQ (EXIT (LETT #0#
                                        (CONS
                                         (CONS
                                          (SPADCALL (QCAR |udd|) |q|
                                           (QREFELT $ 31))
                                          (QCDR |udd|))
                                         #0#) . #4#)))
                            (LETT #1# (CDR #1#) . #4#) #6=(GO G190)
                            G191 (EXIT (NREVERSE0 #0#))))
                     $) . #4#)
           (EXIT (PROGN
                   (LETT #2# NIL . #4#)
                   (SEQ (LETT |f| NIL . #4#) (LETT #3# |ans| . #4#)
                        G190
                        (COND
                          ((OR (ATOM #3#)
                               (PROGN (LETT |f| (CAR #3#) . #4#) NIL))
                           #5#))
                        (SEQ (EXIT (LETT #2#
                                    (CONS (SPADCALL |f| (QREFELT $ 23))
                                     #2#) . #4#)))
                        (LETT #3# (CDR #3#) . #4#) #6# G191
                        (EXIT (NREVERSE0 #2#))))))))) 

(DEFUN |MDDFACT;decode| (|s| |p| |x| $)
  (PROG (|qr|)
    (RETURN
      (SEQ (COND
             ((< |s| |p|) (SPADCALL |s| (QREFELT $ 47)))
             ('T
              (SEQ (LETT |qr| (DIVIDE2 |s| |p|) |MDDFACT;decode|)
                   (EXIT (SPADCALL
                             (SPADCALL (QCDR |qr|) (QREFELT $ 47))
                             (SPADCALL |x|
                                 (|MDDFACT;decode| (QCAR |qr|) |p| |x|
                                     $)
                                 (QREFELT $ 48))
                             (QREFELT $ 49)))))))))) 

(DEFUN |MDDFACT;sepFact1| (|f| $)
  (PROG (|p| |d| |c| |u| |i| |du| |y| #0=#:G1936 |t| |flist| |fact|
             #1=#:G1937 |f1| |df1| |stack| |ans| |s| |ss| |x|
             #2=#:G1928)
    (RETURN
      (SEQ (LETT |u| (QCAR |f|) . #3=(|MDDFACT;sepFact1|))
           (LETT |p| (SPADCALL |u| (QREFELT $ 26)) . #3#)
           (LETT |d| (QCDR |f|) . #3#)
           (EXIT (COND
                   ((EQL |d| 0) (LIST |u|))
                   (#4='T
                    (SEQ (SEQ (LETT |c| (|MDDFACT;lc| |u| $) . #3#)
                              (EXIT (COND
                                      ((NULL (EQL |c| 1))
                                       (LETT |u|
                                        (|MDDFACT;makeMonic| |u| $) . #3#)))))
                         (LETT |du| (|MDDFACT;degree| |u| $) . #3#)
                         (EXIT (COND
                                 ((EQL |d| |du|) (LIST |u|))
                                 (#4#
                                  (SEQ (LETT |ans| NIL . #3#)
                                       (LETT |x|
                                        (SPADCALL 1 1 (QREFELT $ 39)) . #3#)
                                       (COND
                                         ((EQL |d| 1)
                                          (COND
                                            ((< |p| 1000)
                                             (EXIT
                                              (SEQ
                                               (SEQ (LETT |i| 0 . #3#)
                                                G190
                                                (COND
                                                  ((NULL (< 0 |du|))
                                                   #5=(GO G191)))
                                                (SEQ
                                                 (EXIT
                                                  (COND
                                                    ((SPADCALL
                                                      (SPADCALL |u|
                                                       (SPADCALL |i|
                                                        (QREFELT $ 47))
                                                       (QREFELT $ 51))
                                                      (|spadConstant| $
                                                       11)
                                                      (QREFELT $ 21))
                                                     (SEQ
                                                      (LETT |ans|
                                                       (CONS
                                                        (SPADCALL
                                                         (SPADCALL |x|
                                                          (SPADCALL |i|
                                                           (QREFELT $
                                                            47))
                                                          (QREFELT $
                                                           52))
                                                         |p|
                                                         (QREFELT $ 31))
                                                        |ans|) . #3#)
                                                      (EXIT
                                                       (LETT |du|
                                                        (- |du| 1) . #3#)))))))
                                                (LETT |i|
                                                 (QSADD1 |i|) . #3#)
                                                #6=(GO G190) G191
                                                (EXIT NIL))
                                               (EXIT |ans|)))))))
                                       (LETT |y| |x| . #3#)
                                       (LETT |s| 0 . #3#)
                                       (LETT |ss| 1 . #3#)
                                       (LETT |stack| (LIST |u|) . #3#)
                                       (SEQ (LETT #0# NIL . #3#) G190
                                        (COND (#0# #5#))
                                        (SEQ
                                         (LETT |t|
                                          (SPADCALL
                                           (SPADCALL
                                            (SPADCALL |s|
                                             (QREFELT $ 47))
                                            |x| (QREFELT $ 49))
                                           |p| (QREFELT $ 31)) . #3#)
                                         (SEQ
                                          (LETT |flist|
                                           (|MDDFACT;probSplit|
                                            (|SPADfirst| |stack|) |t|
                                            |d| $) . #3#)
                                          (EXIT
                                           (COND
                                             ((NULL (QEQCAR |flist| 1))
                                              (SEQ
                                               (LETT |stack|
                                                (CDR |stack|) . #3#)
                                               (EXIT
                                                (SEQ
                                                 (LETT |fact|
                                                  NIL . #3#)
                                                 (LETT #1#
                                                  (QCDR |flist|) . #3#)
                                                 G190
                                                 (COND
                                                   ((OR (ATOM #1#)
                                                     (PROGN
                                                       (LETT |fact|
                                                        (CAR #1#) . #3#)
                                                       NIL))
                                                    #5#))
                                                 (SEQ
                                                  (LETT |f1|
                                                   (|MDDFACT;makeMonic|
                                                    |fact| $) . #3#)
                                                  (LETT |df1|
                                                   (|MDDFACT;degree|
                                                    |f1| $) . #3#)
                                                  (EXIT
                                                   (COND
                                                     ((EQL |df1| 0)
                                                      NIL)
                                                     ((< |d| |df1|)
                                                      (LETT |stack|
                                                       (CONS |f1|
                                                        |stack|) . #3#))
                                                     ('T
                                                      (LETT |ans|
                                                       (CONS |f1|
                                                        |ans|) . #3#)))))
                                                 (LETT #1#
                                                  (CDR #1#) . #3#)
                                                 #6# G191 (EXIT NIL))))))))
                                         (EXIT
                                          (COND
                                            ((EQL |p| 2)
                                             (SEQ
                                              (LETT |ss|
                                               (+ |ss| 1) . #3#)
                                              (EXIT
                                               (LETT |x|
                                                (SPADCALL |y|
                                                 (|MDDFACT;decode| |ss|
                                                  |p| |y| $)
                                                 (QREFELT $ 48)) . #3#))))
                                            ('T
                                             (SEQ
                                              (LETT |s|
                                               (+ |s| 1) . #3#)
                                              (EXIT
                                               (COND
                                                 ((EQL |s| |p|)
                                                  (SEQ
                                                   (EXIT
                                                    (SEQ
                                                     (LETT |s| 0 . #3#)
                                                     (LETT |ss|
                                                      (+ |ss| 1) . #3#)
                                                     (LETT |x|
                                                      (SPADCALL |y|
                                                       (|MDDFACT;decode|
                                                        |ss| |p| |y| $)
                                                       (QREFELT $ 48)) . #3#)
                                                     (EXIT
                                                      (COND
                                                        ((NULL
                                                          (EQL
                                                           (SPADCALL
                                                            |x|
                                                            (QREFELT $
                                                             16))
                                                           1))
                                                         (PROGN
                                                           (LETT #2#
                                                            (SEQ
                                                             (LETT |ss|
                                                              (EXPT |p|
                                                               (SPADCALL
                                                                |x|
                                                                (QREFELT
                                                                 $ 25))) . #3#)
                                                             (EXIT
                                                              (LETT |x|
                                                               (SPADCALL
                                                                |y|
                                                                (+
                                                                 (SPADCALL
                                                                  |x|
                                                                  (QREFELT
                                                                   $
                                                                   25))
                                                                 1)
                                                                (QREFELT
                                                                 $ 53)) . #3#))) . #3#)
                                                           (GO #2#)))))))
                                                   #2# (EXIT #2#))))))))))
                                        (LETT #0# (NULL |stack|) . #3#)
                                        #6# G191 (EXIT NIL))
                                       (EXIT
                                        (CONS
                                         (SPADCALL |c|
                                          (|SPADfirst| |ans|)
                                          (QREFELT $ 27))
                                         (CDR |ans|))))))))))))))) 

(DEFUN |MDDFACT;probSplit| (|u| |t| |d| $)
  (PROG (|p| |f1| #0=#:G1957 #1=#:G1958 |r| |n| |f2| |g|)
    (RETURN
      (SEQ (LETT |p| (SPADCALL |u| (QREFELT $ 26))
                 . #2=(|MDDFACT;probSplit|))
           (EXIT (COND
                   ((EQL |p| 2) (|MDDFACT;probSplit2| |u| |t| |d| $))
                   ('T
                    (SEQ (LETT |f1|
                               (SPADCALL |u| |t| (QREFELT $ 34)) . #2#)
                         (LETT |r|
                               (PROG1 (LETT #1#
                                       (QUOTIENT2
                                        (-
                                         (EXPT |p|
                                          (PROG1 (LETT #0# |d| . #2#)
                                            (|check-subtype| (>= #0# 0)
                                             '(|NonNegativeInteger|)
                                             #0#)))
                                         1)
                                        2) . #2#)
                                 (|check-subtype| (>= #1# 0)
                                     '(|NonNegativeInteger|) #1#)) . #2#)
                         (LETT |n|
                               (|MDDFACT;exptmod| |t| |r| |u| $) . #2#)
                         (LETT |f2|
                               (SPADCALL |u|
                                   (SPADCALL |n| (|spadConstant| $ 28)
                                    (QREFELT $ 54))
                                   (QREFELT $ 34)) . #2#)
                         (LETT |g|
                               (SPADCALL |f1| |f2| (QREFELT $ 29)) . #2#)
                         (EXIT (COND
                                 ((OR (SPADCALL |g|
                                       (|spadConstant| $ 28)
                                       (QREFELT $ 55))
                                      (SPADCALL |g| |u| (QREFELT $ 55)))
                                  (CONS 1 "failed"))
                                 ('T
                                  (CONS 0
                                        (LIST |f1| |f2|
                                         (SPADCALL |u| |g|
                                          (QREFELT $ 41))))))))))))))) 

(DEFUN |MDDFACT;probSplit2| (|u| |t| |d| $)
  (PROG (|f|)
    (RETURN
      (SEQ (LETT |f|
                 (SPADCALL |u| (|MDDFACT;trace| |t| |d| |u| $)
                     (QREFELT $ 34))
                 |MDDFACT;probSplit2|)
           (EXIT (COND
                   ((OR (SPADCALL |f| (|spadConstant| $ 28)
                            (QREFELT $ 55))
                        (EQL (|MDDFACT;degree| |u| $)
                             (|MDDFACT;degree| |f| $)))
                    (CONS 1 "failed"))
                   ('T
                    (CONS 0
                          (LIST (|spadConstant| $ 28) |f|
                                (SPADCALL |u| |f| (QREFELT $ 41))))))))))) 

(DEFUN |MDDFACT;trace| (|t| |d| |u| $)
  (PROG (|p| |tt|)
    (RETURN
      (SEQ (LETT |p| (SPADCALL |t| (QREFELT $ 26))
                 . #0=(|MDDFACT;trace|))
           (LETT |d| (- |d| 1) . #0#) (LETT |tt| |t| . #0#)
           (SEQ G190 (COND ((NULL (< 0 |d|)) (GO G191)))
                (SEQ (LETT |tt|
                           (SPADCALL
                               (SPADCALL |tt|
                                   (LETT |t|
                                    (|MDDFACT;exptmod| |t| |p| |u| $) . #0#)
                                   (QREFELT $ 54))
                               |u| (QREFELT $ 30)) . #0#)
                     (EXIT (LETT |d| (- |d| 1) . #0#)))
                NIL (GO G190) G191 (EXIT NIL))
           (EXIT |tt|))))) 

(DEFUN |ModularDistinctDegreeFactorizer| (#0=#:G1972)
  (PROG ()
    (RETURN
      (PROG (#1=#:G1973)
        (RETURN
          (COND
            ((LETT #1#
                   (|lassocShiftWithFunction| (LIST (|devaluate| #0#))
                       (HGET |$ConstructorCache|
                             '|ModularDistinctDegreeFactorizer|)
                       '|domainEqualList|)
                   . #2=(|ModularDistinctDegreeFactorizer|))
             (|CDRwithIncrement| #1#))
            ('T
             (UNWIND-PROTECT
               (PROG1 (|ModularDistinctDegreeFactorizer;| #0#)
                 (LETT #1# T . #2#))
               (COND
                 ((NOT #1#)
                  (HREM |$ConstructorCache|
                        '|ModularDistinctDegreeFactorizer|))))))))))) 

(DEFUN |ModularDistinctDegreeFactorizer;| (|#1|)
  (PROG (DV$1 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|)
              . #0=(|ModularDistinctDegreeFactorizer|))
        (LETT |dv$|
              (LIST '|ModularDistinctDegreeFactorizer| DV$1) . #0#)
        (LETT $ (GETREFV 56) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache|
            '|ModularDistinctDegreeFactorizer| (LIST DV$1) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 22
            (|EuclideanModularRing| (|Integer|) |#1| (|Integer|)
                (CONS (|function| |MDDFACT;reduction|) $)
                (CONS (|function| |MDDFACT;merge|) $)
                (CONS (|function| |MDDFACT;exactquo|) $)))
        $)))) 

(MAKEPROP '|ModularDistinctDegreeFactorizer| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|Integer|)
             (0 . |positiveRemainder|) (|Mapping| 7 7) (6 . |map|)
             (12 . |Zero|) (16 . |One|)
             (|Record| (|:| |coef1| $) (|:| |coef2| $))
             (|Union| 13 '"failed") (20 . |extendedEuclidean|)
             (27 . |leadingCoefficient|) (32 . *)
             (|Record| (|:| |quotient| $) (|:| |remainder| $))
             (38 . |monicDivide|) (|Boolean|) (44 . =) 'EMR
             (50 . |coerce|) (|NonNegativeInteger|) (55 . |degree|)
             (60 . |modulus|) (65 . *) (71 . |One|) (75 . *)
             (81 . |rem|) (87 . |reduce|) |MDDFACT;exptMod;UIUIU;9|
             (93 . |coerce|) (98 . |gcd|) |MDDFACT;gcd;2UIU;11|
             (104 . |differentiate|) (|List| 6) |MDDFACT;factor;UIL;12|
             (109 . |monomial|) (115 . -) (121 . |quo|)
             (|Record| (|:| |factor| 6) (|:| |degree| 7)) (|List| 42)
             |MDDFACT;ddFact;UIL;14| |MDDFACT;linears;UIU;15|
             |MDDFACT;separateFactors;LIL;17| (127 . |coerce|)
             (132 . *) (138 . +) (144 . |Zero|) (148 . |elt|) (154 . -)
             (160 . **) (166 . +) (172 . =))
          '#(|separateFactors| 178 |linears| 184 |gcd| 190 |factor| 197
             |exptMod| 203 |ddFact| 211)
          'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 55
                                '(2 7 0 0 0 8 2 6 0 9 0 10 0 6 0 11 0 6
                                  0 12 3 7 14 0 0 0 15 1 6 7 0 16 2 6 0
                                  7 0 17 2 6 18 0 0 19 2 6 20 0 0 21 1
                                  22 6 0 23 1 6 24 0 25 1 22 7 0 26 2
                                  22 0 7 0 27 0 22 0 28 2 22 0 0 0 29 2
                                  22 0 0 0 30 2 22 0 6 7 31 1 22 0 7 33
                                  2 22 0 0 0 34 1 6 0 0 36 2 6 0 7 24
                                  39 2 22 0 0 0 40 2 22 0 0 0 41 1 6 0
                                  7 47 2 6 0 0 0 48 2 6 0 0 0 49 0 22 0
                                  50 2 22 6 0 6 51 2 6 0 0 0 52 2 6 0 0
                                  24 53 2 22 0 0 0 54 2 22 20 0 0 55 2
                                  0 37 43 7 46 2 0 6 6 7 45 3 0 6 6 6 7
                                  35 2 0 37 6 7 38 4 0 6 6 7 6 7 32 2 0
                                  43 6 7 44)))))
          '|lookupComplete|)) 
