
(/VERSIONCHECK 2) 

(DEFUN |UNIFACT;factor;ZPF;1| (|m| $)
  (PROG (|flist| |ctp| #0=#:G1860 |u| #1=#:G1861)
    (RETURN
      (SEQ (LETT |flist| (SPADCALL |m| 'NIL (QREFELT $ 10))
                 . #2=(|UNIFACT;factor;ZPF;1|))
           (LETT |ctp| (SPADCALL (QCAR |flist|) (QREFELT $ 13)) . #2#)
           (EXIT (SPADCALL (SPADCALL (QVELT |ctp| 0) (QREFELT $ 14))
                     (CONS (VECTOR (CONS 0 "nil")
                                   (SPADCALL (QVELT |ctp| 1)
                                    (QREFELT $ 14))
                                   1)
                           (PROGN
                             (LETT #0# NIL . #2#)
                             (SEQ (LETT |u| NIL . #2#)
                                  (LETT #1# (QCDR |flist|) . #2#) G190
                                  (COND
                                    ((OR (ATOM #1#)
                                      (PROGN
                                        (LETT |u| (CAR #1#) . #2#)
                                        NIL))
                                     (GO G191)))
                                  (SEQ (EXIT
                                        (LETT #0#
                                         (CONS
                                          (VECTOR (CONS 3 "prime")
                                           (QCAR |u|) (QCDR |u|))
                                          #0#) . #2#)))
                                  (LETT #1# (CDR #1#) . #2#) (GO G190)
                                  G191 (EXIT (NREVERSE0 #0#)))))
                     (QREFELT $ 19))))))) 

(DEFUN |UNIFACT;factorSquareFree;ZPF;2| (|m| $)
  (PROG (|flist| |ctp| #0=#:G1874 |u| #1=#:G1875)
    (RETURN
      (SEQ (LETT |flist| (SPADCALL |m| 'T (QREFELT $ 10))
                 . #2=(|UNIFACT;factorSquareFree;ZPF;2|))
           (LETT |ctp| (SPADCALL (QCAR |flist|) (QREFELT $ 13)) . #2#)
           (EXIT (SPADCALL (SPADCALL (QVELT |ctp| 0) (QREFELT $ 14))
                     (CONS (VECTOR (CONS 0 "nil")
                                   (SPADCALL (QVELT |ctp| 1)
                                    (QREFELT $ 14))
                                   1)
                           (PROGN
                             (LETT #0# NIL . #2#)
                             (SEQ (LETT |u| NIL . #2#)
                                  (LETT #1# (QCDR |flist|) . #2#) G190
                                  (COND
                                    ((OR (ATOM #1#)
                                      (PROGN
                                        (LETT |u| (CAR #1#) . #2#)
                                        NIL))
                                     (GO G191)))
                                  (SEQ (EXIT
                                        (LETT #0#
                                         (CONS
                                          (VECTOR (CONS 3 "prime")
                                           (QCAR |u|) (QCDR |u|))
                                          #0#) . #2#)))
                                  (LETT #1# (CDR #1#) . #2#) (GO G190)
                                  G191 (EXIT (NREVERSE0 #0#)))))
                     (QREFELT $ 19))))))) 

(DEFUN |UNIFACT;sqroot| (|t| $)
  (PROG (|s|)
    (RETURN
      (SEQ (COND
             ((< 0 |t|)
              (SEQ (LETT |s| |t| . #0=(|UNIFACT;sqroot|))
                   (LETT |s| (SPADCALL |s| (QREFELT $ 24)) . #0#)
                   (LETT |t| |s| . #0#) (EXIT |t|)))
             ('T 0)))))) 

(DEFUN |UNIFACT;eisenstein| (|m| $)
  (PROG (|c| |lead| |trail| |fc| |r| #0=#:G1890 #1=#:G1889)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |c|
                            (SPADCALL (SPADCALL |m| (QREFELT $ 25))
                                (QREFELT $ 26))
                            . #2=(|UNIFACT;eisenstein|))
                      (EXIT (COND
                              ((OR (EQL |c| 0) (EQL |c| 1)) 'NIL)
                              ('T
                               (SEQ (LETT |lead|
                                     (SPADCALL |m| (QREFELT $ 28)) . #2#)
                                    (LETT |trail| |lead| . #2#)
                                    (LETT |m|
                                     (SPADCALL |m| (QREFELT $ 25)) . #2#)
                                    (SEQ G190
                                     (COND
                                       ((NULL
                                         (COND
                                           ((SPADCALL |m|
                                             (|spadConstant| $ 22)
                                             (QREFELT $ 29))
                                            'NIL)
                                           ('T 'T)))
                                        #3=(GO G191)))
                                     (SEQ
                                      (LETT |trail|
                                       (SPADCALL |m| (QREFELT $ 28)) . #2#)
                                      (EXIT
                                       (LETT |m|
                                        (SPADCALL |m| (QREFELT $ 25)) . #2#)))
                                     NIL #4=(GO G190) G191 (EXIT NIL))
                                    (LETT |fc|
                                     (SPADCALL |c| (QREFELT $ 31)) . #2#)
                                    (SEQ (LETT |r| NIL . #2#)
                                     (LETT #0#
                                      (SPADCALL |fc| (QREFELT $ 35)) . #2#)
                                     G190
                                     (COND
                                       ((OR (ATOM #0#)
                                         (PROGN
                                           (LETT |r| (CAR #0#) . #2#)
                                           NIL))
                                        #3#))
                                     (SEQ
                                      (EXIT
                                       (COND
                                         ((EQL (QCDR |r|) 1)
                                          (COND
                                            ((NULL
                                              (EQL 0
                                               (REMAINDER2 |lead|
                                                (QCAR |r|))))
                                             (COND
                                               ((NULL
                                                 (EQL 0
                                                  (REMAINDER2 |trail|
                                                   (EXPT (QCAR |r|) 2))))
                                                (PROGN
                                                  (LETT #1# 'T . #2#)
                                                  (GO #1#))))))))))
                                     (LETT #0# (CDR #0#) . #2#) #4#
                                     G191 (EXIT NIL))
                                    (EXIT 'NIL)))))))
           #1# (EXIT #1#))))) 

(DEFUN |UNIFACT;negShiftz| (|n| |Modulus| $)
  (SEQ (COND
         ((< |n| 0) (LETT |n| (+ |n| |Modulus|) |UNIFACT;negShiftz|)))
       (EXIT (COND
               ((< (QUOTIENT2 |Modulus| 2) |n|) (- |n| |Modulus|))
               ('T |n|))))) 

(DEFUN |UNIFACT;negShiftp| (|pp| |Modulus| $)
  (SPADCALL (CONS #'|UNIFACT;negShiftp!0| (VECTOR $ |Modulus|)) |pp|
      (QREFELT $ 37))) 

(DEFUN |UNIFACT;negShiftp!0| (|#1| $$)
  (|UNIFACT;negShiftz| |#1| (QREFELT $$ 1) (QREFELT $$ 0))) 

(DEFUN |UNIFACT;bound| (|m| $)
  (PROG (#0=#:G1895 |lcm| |nmq2| |k| #1=#:G1898 #2=#:G1896 #3=#:G1897
            |norm| #4=#:G1899 |nm| #5=#:G1900 |i| #6=#:G1902 #7=#:G1910
            |bin1| #8=#:G1903 |bin0| #9=#:G1904 |j| |cbound|
            #10=#:G1907)
    (RETURN
      (SEQ (LETT |lcm|
                 (PROG1 (LETT #0# (ABS (SPADCALL |m| (QREFELT $ 28)))
                              . #11=(|UNIFACT;bound|))
                   (|check-subtype| (>= #0# 0) '(|NonNegativeInteger|)
                       #0#)) . #11#)
           (LETT |nm| (SPADCALL |m| (QREFELT $ 39)) . #11#)
           (LETT |nmq2| (QUOTIENT2 |nm| 2) . #11#)
           (LETT |norm|
                 (|UNIFACT;sqroot|
                     (PROGN
                       (LETT #3# NIL . #11#)
                       (SEQ (LETT |k| 0 . #11#) G190
                            (COND
                              ((QSGREATERP |k| |nm|) #12=(GO G191)))
                            (SEQ (EXIT (PROGN
                                         (LETT #1#
                                          (EXPT
                                           (SPADCALL |m| |k|
                                            (QREFELT $ 40))
                                           2) . #11#)
                                         (COND
                                           (#3#
                                            (LETT #2#
                                             (+ #2# #1#) . #11#))
                                           ('T
                                            (PROGN
                                              (LETT #2# #1# . #11#)
                                              (LETT #3# 'T . #11#)))))))
                            (LETT |k| (QSADD1 |k|) . #11#)
                            #13=(GO G190) G191 (EXIT NIL))
                       (COND (#3# #2#) (#14='T 0)))
                     $) . #11#)
           (COND
             ((EQL |nmq2| 1) (LETT |nm| |nmq2| . #11#))
             (#14#
              (LETT |nm|
                    (PROG1 (LETT #4# (- |nmq2| 1) . #11#)
                      (|check-subtype| (>= #4# 0)
                          '(|NonNegativeInteger|) #4#)) . #11#)))
           (LETT |bin0| |nm| . #11#)
           (LETT |cbound|
                 (PROG1 (LETT #5#
                              (+ (SPADCALL |bin0| |norm|
                                     (QREFELT $ 41))
                                 |lcm|) . #11#)
                   (|check-subtype| (> #5# 0) '(|PositiveInteger|) #5#)) . #11#)
           (SEQ (LETT |i| 2 . #11#)
                (LETT #7#
                      (PROG1 (LETT #6# (- |nm| 1) . #11#)
                        (|check-subtype| (>= #6# 0)
                            '(|NonNegativeInteger|) #6#)) . #11#)
                G190 (COND ((QSGREATERP |i| #7#) #12#))
                (SEQ (LETT |bin1| |bin0| . #11#)
                     (LETT |bin0|
                           (QUOTIENT2
                               (* |bin0|
                                  (PROG1 (LETT #8#
                                          (- (+ |nm| 1) |i|) . #11#)
                                    (|check-subtype| (>= #8# 0)
                                     '(|NonNegativeInteger|) #8#)))
                               |i|) . #11#)
                     (LETT |j|
                           (PROG1 (LETT #9#
                                        (+
                                         (SPADCALL |bin0| |norm|
                                          (QREFELT $ 41))
                                         (* |bin1| |lcm|)) . #11#)
                             (|check-subtype| (> #9# 0)
                                 '(|PositiveInteger|) #9#)) . #11#)
                     (EXIT (COND
                             ((< |cbound| |j|)
                              (LETT |cbound| |j| . #11#)))))
                (LETT |i| (QSADD1 |i|) . #11#) #13# G191 (EXIT NIL))
           (EXIT (PROG1 (LETT #10# (* (* 2 |cbound|) |lcm|) . #11#)
                   (|check-subtype| (> #10# 0) '(|PositiveInteger|)
                       #10#))))))) 

(DEFUN |UNIFACT;remp| (|t| |q| $)
  (SEQ (LETT |t| (REMAINDER2 |t| |q|) |UNIFACT;remp|)
       (EXIT (COND ((< |t| 0) (+ |t| |q|)) ('T |t|))))) 

(DEFUN |UNIFACT;numFactors| (|ddlist| $)
  (PROG (|dd| #0=#:G1924 |d| #1=#:G1918 |ans|)
    (RETURN
      (SEQ (LETT |ans| 0 . #2=(|UNIFACT;numFactors|))
           (SEQ (LETT |dd| NIL . #2#) (LETT #0# |ddlist| . #2#) G190
                (COND
                  ((OR (ATOM #0#)
                       (PROGN (LETT |dd| (CAR #0#) . #2#) NIL))
                   (GO G191)))
                (SEQ (LETT |d|
                           (SPADCALL (QCAR |dd|) (QREFELT $ 39)) . #2#)
                     (EXIT (COND
                             ((EQL |d| 0) NIL)
                             ('T
                              (LETT |ans|
                                    (+ |ans|
                                     (PROG2
                                      (LETT #1#
                                       (SPADCALL |d| (QCDR |dd|)
                                        (QREFELT $ 43)) . #2#)
                                      (QCDR #1#)
                                       (|check-union| (QEQCAR #1# 0)
                                        (|Integer|) #1#))) . #2#)))))
                (LETT #0# (CDR #0#) . #2#) (GO G190) G191 (EXIT NIL))
           (EXIT |ans|))))) 

(DEFUN |UNIFACT;choose| (|m| $)
  (PROG (|lcm| |ddRep| |q| |rr| |disc| |newdd| |n| |k| |ddSave| |qSave|
               |numberOfFactors|)
    (RETURN
      (SEQ (LETT |qSave| 1 . #0=(|UNIFACT;choose|))
           (LETT |ddSave| NIL . #0#) (LETT |numberOfFactors| 0 . #0#)
           (LETT |lcm| (SPADCALL |m| (QREFELT $ 28)) . #0#)
           (LETT |k| 1 . #0#) (LETT |ddRep| 5 . #0#)
           (LETT |disc| (|spadConstant| $ 22) . #0#) (LETT |q| 2 . #0#)
           (SEQ G190 (COND ((NULL (< |k| |ddRep|)) (GO G191)))
                (SEQ (LETT |q| (SPADCALL |q| (QREFELT $ 45)) . #0#)
                     (LETT |rr| (REMAINDER2 |lcm| |q|) . #0#)
                     (EXIT (COND
                             ((EQL |rr| 0) "next prime")
                             ('T
                              (SEQ (LETT |disc|
                                    (SPADCALL |m|
                                     (SPADCALL |m| (QREFELT $ 46)) |q|
                                     (QREFELT $ 48)) . #0#)
                                   (COND
                                     ((NULL
                                       (EQL
                                        (SPADCALL |disc|
                                         (QREFELT $ 39))
                                        0))
                                      (EXIT "next prime")))
                                   (LETT |k| (+ |k| 1) . #0#)
                                   (LETT |newdd|
                                    (SPADCALL |m| |q| (QREFELT $ 51)) . #0#)
                                   (LETT |n|
                                    (|UNIFACT;numFactors| |newdd| $) . #0#)
                                   (EXIT
                                    (COND
                                      ((< |n| 9)
                                       (SEQ
                                        (LETT |ddSave| |newdd| . #0#)
                                        (LETT |qSave| |q| . #0#)
                                        (EXIT (LETT |k| 5 . #0#))))
                                      ((OR (EQL |numberOfFactors| 0)
                                        (< |n| |numberOfFactors|))
                                       (SEQ
                                        (LETT |ddSave| |newdd| . #0#)
                                        (LETT |qSave| |q| . #0#)
                                        (EXIT
                                         (LETT |numberOfFactors|
                                          |n| . #0#)))))))))))
                NIL (GO G190) G191 (EXIT NIL))
           (EXIT (CONS |qSave| |ddSave|)))))) 

(DEFUN |UNIFACT;henselfact1| (|m| $)
  (PROG (|selected| |q| |fl| |cbound|)
    (RETURN
      (SEQ (COND
             ((ZEROP (SPADCALL |m| (QREFELT $ 39)))
              (COND
                ((SPADCALL |m| (|spadConstant| $ 27) (QREFELT $ 29))
                 NIL)
                ('T (LIST |m|))))
             ('T
              (SEQ (LETT |selected| (|UNIFACT;choose| |m| $)
                         . #0=(|UNIFACT;henselfact1|))
                   (EXIT (COND
                           ((EQL (|UNIFACT;numFactors|
                                     (QCDR |selected|) $)
                                 1)
                            (LIST |m|))
                           ('T
                            (SEQ (LETT |q| (QCAR |selected|) . #0#)
                                 (LETT |fl|
                                       (SPADCALL (QCDR |selected|) |q|
                                        (QREFELT $ 53)) . #0#)
                                 (LETT |cbound|
                                       (|UNIFACT;bound| |m| $) . #0#)
                                 (EXIT (SPADCALL |m| |fl| |q| |cbound|
                                        (QREFELT $ 56)))))))))))))) 

(DEFUN |UNIFACT;henselfact| (|m| $)
  (PROG (|deggcd| #0=#:G1947 |faclist| |mm| #1=#:G1956 #2=#:G1951
            #3=#:G1949 #4=#:G1950)
    (RETURN
      (SEQ (LETT |deggcd| (SPADCALL |m| (QREFELT $ 39))
                 . #5=(|UNIFACT;henselfact|))
           (LETT |mm| |m| . #5#)
           (SEQ G190
                (COND
                  ((NULL (COND
                           ((SPADCALL |mm| (QREFELT $ 57)) 'NIL)
                           ('T 'T)))
                   #6=(GO G191)))
                (SEQ (LETT |deggcd|
                           (GCD |deggcd|
                                (SPADCALL |mm| (QREFELT $ 39))) . #5#)
                     (EXIT (LETT |mm|
                                 (SPADCALL |mm| (QREFELT $ 25)) . #5#)))
                NIL #7=(GO G190) G191 (EXIT NIL))
           (COND
             ((< 1 |deggcd|)
              (COND
                ((< |deggcd| (SPADCALL |m| (QREFELT $ 39)))
                 (EXIT (SEQ (LETT |faclist|
                                  (|UNIFACT;henselfact1|
                                      (PROG2
                                       (LETT #0#
                                        (SPADCALL |m| |deggcd|
                                         (QREFELT $ 58)) . #5#)
                                       (QCDR #0#)
                                        (|check-union| (QEQCAR #0# 0)
                                         (QREFELT $ 6) #0#))
                                      $) . #5#)
                            (EXIT (PROGN
                                    (LETT #4# NIL . #5#)
                                    (SEQ (LETT |mm| NIL . #5#)
                                     (LETT #1# |faclist| . #5#) G190
                                     (COND
                                       ((OR (ATOM #1#)
                                         (PROGN
                                           (LETT |mm| (CAR #1#) . #5#)
                                           NIL))
                                        #6#))
                                     (SEQ
                                      (EXIT
                                       (PROGN
                                         (LETT #2#
                                          (|UNIFACT;henselfact1|
                                           (SPADCALL |mm| |deggcd|
                                            (QREFELT $ 59))
                                           $) . #5#)
                                         (COND
                                           (#4#
                                            (LETT #3#
                                             (APPEND #3# #2#) . #5#))
                                           ('T
                                            (PROGN
                                              (LETT #3# #2# . #5#)
                                              (LETT #4# 'T . #5#)))))))
                                     (LETT #1# (CDR #1#) . #5#) #7#
                                     G191 (EXIT NIL))
                                    (COND (#4# #3#) ('T NIL))))))))))
           (EXIT (|UNIFACT;henselfact1| |m| $)))))) 

(DEFUN |UNIFACT;quadratic| (|m| $)
  (PROG (|d2| |d| |alpha| |beta| |m0| #0=#:G1960)
    (RETURN
      (SEQ (LETT |d|
                 (- (EXPT (SPADCALL |m| 1 (QREFELT $ 40)) 2)
                    (* (SPADCALL 4 (SPADCALL |m| 0 (QREFELT $ 40))
                           (QREFELT $ 60))
                       (SPADCALL |m| 2 (QREFELT $ 40))))
                 . #1=(|UNIFACT;quadratic|))
           (LETT |d2| (|UNIFACT;sqroot| |d| $) . #1#)
           (COND
             ((NULL (EQL (- |d| (SPADCALL |d2| 2 (QREFELT $ 61))) 0))
              (EXIT (LIST |m|))))
           (LETT |alpha|
                 (+ (SPADCALL |m| 1 (QREFELT $ 40)) |d2|) . #1#)
           (LETT |beta|
                 (SPADCALL 2 (SPADCALL |m| 2 (QREFELT $ 40))
                     (QREFELT $ 60)) . #1#)
           (LETT |d| (GCD |alpha| |beta|) . #1#)
           (COND
             ((NULL (EQL |d| 1))
              (SEQ (LETT |alpha| (QUOTIENT2 |alpha| |d|) . #1#)
                   (EXIT (LETT |beta| (QUOTIENT2 |beta| |d|) . #1#)))))
           (LETT |m0|
                 (SPADCALL (SPADCALL |beta| 1 (QREFELT $ 62))
                     (SPADCALL |alpha| 0 (QREFELT $ 62))
                     (QREFELT $ 63)) . #1#)
           (EXIT (CONS |m0|
                       (LIST (PROG2 (LETT #0#
                                     (SPADCALL |m| |m0| (QREFELT $ 64)) . #1#)
                                    (QCDR #0#)
                               (|check-union| (QEQCAR #0# 0)
                                   (QREFELT $ 6) #0#))))))))) 

(DEFUN |UNIFACT;isPowerOf2| (|n| $)
  (PROG (|qr|)
    (RETURN
      (SEQ (COND
             ((EQL |n| 1) 'T)
             ('T
              (SEQ (LETT |qr| (DIVIDE2 |n| 2) |UNIFACT;isPowerOf2|)
                   (EXIT (COND
                           ((EQL (QCDR |qr|) 1) 'NIL)
                           ('T (|UNIFACT;isPowerOf2| (QCAR |qr|) $))))))))))) 

(DEFUN |UNIFACT;subMinusX| (|supPol| $)
  (PROG (|minusX|)
    (RETURN
      (SEQ (LETT |minusX| (SPADCALL -1 1 (QREFELT $ 66))
                 |UNIFACT;subMinusX|)
           (EXIT (SPADCALL |supPol| |minusX| (QREFELT $ 67))))))) 

(DEFUN |UNIFACT;henselFact;ZPBR;16| (|m| |test| $)
  (PROG (#0=#:G1972 |c| |d| |lcPol| #1=#:G2012 |sfac| #2=#:G2013 |fac|
            |lfq| |#G34| |#G35| |lf0| |lf1| #3=#:G2014 |v| #4=#:G2015
            #5=#:G2016 #6=#:G2017 |irrFact| |llf| |l1| #7=#:G2018 |d1|
            |pol| #8=#:G2019 #9=#:G2020 |fln| #10=#:G2021 |pf|
            #11=#:G2022 |factorlist|)
    (RETURN
      (SEQ (LETT |factorlist| NIL . #12=(|UNIFACT;henselFact;ZPBR;16|))
           (LETT |c| (SPADCALL |m| (QREFELT $ 26)) . #12#)
           (LETT |m|
                 (PROG2 (LETT #0#
                              (SPADCALL |m| |c| (QREFELT $ 68)) . #12#)
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0) (QREFELT $ 6) #0#)) . #12#)
           (COND
             ((< (SPADCALL |m| (QREFELT $ 28)) 0)
              (SEQ (LETT |c| (- |c|) . #12#)
                   (EXIT (LETT |m|
                               (SPADCALL |m| (QREFELT $ 69)) . #12#)))))
           (SEQ (LETT |d| (SPADCALL |m| (QREFELT $ 70)) . #12#)
                (EXIT (COND
                        ((< 0 |d|)
                         (SEQ (LETT |m|
                                    (QCAR
                                     (SPADCALL |m|
                                      (SPADCALL 1 |d| (QREFELT $ 62))
                                      (QREFELT $ 72))) . #12#)
                              (EXIT (LETT |factorlist|
                                     (LIST
                                      (CONS
                                       (SPADCALL 1 1 (QREFELT $ 62))
                                       |d|)) . #12#)))))))
           (LETT |d| (SPADCALL |m| (QREFELT $ 39)) . #12#)
           (EXIT (COND
                   ((EQL |d| 0) (CONS |c| |factorlist|))
                   ((EQL |d| 1)
                    (CONS |c| (CONS (CONS |m| 1) |factorlist|)))
                   ('T
                    (COND
                      ((|UNIFACT;eisenstein| |m| $)
                       (CONS |c| (CONS (CONS |m| 1) |factorlist|)))
                      ('T
                       (SEQ (LETT |lcPol|
                                  (SPADCALL
                                      (SPADCALL |m| (QREFELT $ 28))
                                      (QREFELT $ 14)) . #12#)
                            (EXIT (COND
                                    ((SPADCALL
                                      (SPADCALL |lcPol| (QREFELT $ 69))
                                      (SPADCALL |m| (QREFELT $ 25))
                                      (QREFELT $ 29))
                                     (SEQ
                                      (SEQ (LETT |fac| NIL . #12#)
                                       (LETT #1#
                                        (SPADCALL
                                         (SPADCALL |m| (QREFELT $ 39))
                                         (QREFELT $ 75)) . #12#)
                                       G190
                                       (COND
                                         ((OR (ATOM #1#)
                                           (PROGN
                                             (LETT |fac|
                                              (CAR #1#) . #12#)
                                             NIL))
                                          #13=(GO G191)))
                                       (SEQ
                                        (EXIT
                                         (LETT |factorlist|
                                          (CONS (CONS |fac| 1)
                                           |factorlist|) . #12#)))
                                       (LETT #1# (CDR #1#) . #12#)
                                       #14=(GO G190) G191 (EXIT NIL))
                                      (EXIT (CONS |c| |factorlist|))))
                                    ('T
                                     (SEQ
                                      (COND
                                        ((ODDP |d|)
                                         (COND
                                           ((SPADCALL |lcPol|
                                             (SPADCALL |m|
                                              (QREFELT $ 25))
                                             (QREFELT $ 29))
                                            (EXIT
                                             (SEQ
                                              (SEQ
                                               (LETT |sfac| NIL . #12#)
                                               (LETT #2#
                                                (SPADCALL
                                                 (SPADCALL |m|
                                                  (QREFELT $ 39))
                                                 (QREFELT $ 75)) . #12#)
                                               G190
                                               (COND
                                                 ((OR (ATOM #2#)
                                                   (PROGN
                                                     (LETT |sfac|
                                                      (CAR #2#) . #12#)
                                                     NIL))
                                                  #13#))
                                               (SEQ
                                                (LETT |fac|
                                                 (|UNIFACT;subMinusX|
                                                  |sfac| $) . #12#)
                                                (COND
                                                  ((<
                                                    (SPADCALL |fac|
                                                     (QREFELT $ 28))
                                                    0)
                                                   (LETT |fac|
                                                    (SPADCALL |fac|
                                                     (QREFELT $ 69)) . #12#)))
                                                (EXIT
                                                 (LETT |factorlist|
                                                  (CONS (CONS |fac| 1)
                                                   |factorlist|) . #12#)))
                                               (LETT #2#
                                                (CDR #2#) . #12#)
                                               #14# G191 (EXIT NIL))
                                              (EXIT
                                               (CONS |c| |factorlist|))))))))
                                      (COND
                                        ((|UNIFACT;isPowerOf2| |d| $)
                                         (COND
                                           ((SPADCALL |lcPol|
                                             (SPADCALL |m|
                                              (QREFELT $ 25))
                                             (QREFELT $ 29))
                                            (EXIT
                                             (SEQ
                                              (LETT |factorlist|
                                               (CONS (CONS |m| 1)
                                                |factorlist|) . #12#)
                                              (EXIT
                                               (CONS |c| |factorlist|))))))))
                                      (EXIT
                                       (COND
                                         ((EQL |d| 2)
                                          (SEQ
                                           (LETT |lfq|
                                            (|UNIFACT;quadratic| |m| $) . #12#)
                                           (EXIT
                                            (COND
                                              ((EQL (LENGTH |lfq|) 1)
                                               (CONS |c|
                                                (CONS
                                                 (CONS
                                                  (|SPADfirst| |lfq|)
                                                  1)
                                                 |factorlist|)))
                                              ('T
                                               (SEQ
                                                (PROGN
                                                  (LETT |#G34|
                                                   (|SPADfirst| |lfq|) . #12#)
                                                  (LETT |#G35|
                                                   (SPADCALL |lfq|
                                                    (QREFELT $ 76)) . #12#)
                                                  (LETT |lf0|
                                                   |#G34| . #12#)
                                                  (LETT |lf1|
                                                   |#G35| . #12#))
                                                (COND
                                                  ((SPADCALL |lf0|
                                                    |lf1|
                                                    (QREFELT $ 29))
                                                   (LETT |factorlist|
                                                    (CONS
                                                     (CONS |lf0| 2)
                                                     |factorlist|) . #12#))
                                                  ('T
                                                   (LETT |factorlist|
                                                    (APPEND
                                                     (PROGN
                                                       (LETT #3#
                                                        NIL . #12#)
                                                       (SEQ
                                                        (LETT |v|
                                                         NIL . #12#)
                                                        (LETT #4#
                                                         |lfq| . #12#)
                                                        G190
                                                        (COND
                                                          ((OR
                                                            (ATOM #4#)
                                                            (PROGN
                                                              (LETT |v|
                                                               (CAR
                                                                #4#) . #12#)
                                                              NIL))
                                                           #13#))
                                                        (SEQ
                                                         (EXIT
                                                          (LETT #3#
                                                           (CONS
                                                            (CONS |v|
                                                             1)
                                                            #3#) . #12#)))
                                                        (LETT #4#
                                                         (CDR #4#) . #12#)
                                                        #14# G191
                                                        (EXIT
                                                         (NREVERSE0
                                                          #3#))))
                                                     |factorlist|) . #12#)))
                                                (EXIT
                                                 (CONS |c|
                                                  |factorlist|))))))))
                                         (|test|
                                          (SEQ
                                           (LETT |fln|
                                            (|UNIFACT;henselfact| |m|
                                             $) . #12#)
                                           (EXIT
                                            (CONS |c|
                                             (APPEND |factorlist|
                                              (PROGN
                                                (LETT #5# NIL . #12#)
                                                (SEQ
                                                 (LETT |pf| NIL . #12#)
                                                 (LETT #6#
                                                  |fln| . #12#)
                                                 G190
                                                 (COND
                                                   ((OR (ATOM #6#)
                                                     (PROGN
                                                       (LETT |pf|
                                                        (CAR #6#) . #12#)
                                                       NIL))
                                                    #13#))
                                                 (SEQ
                                                  (EXIT
                                                   (LETT #5#
                                                    (CONS (CONS |pf| 1)
                                                     #5#) . #12#)))
                                                 (LETT #6#
                                                  (CDR #6#) . #12#)
                                                 #14# G191
                                                 (EXIT (NREVERSE0 #5#)))))))))
                                         ('T
                                          (SEQ
                                           (LETT |irrFact|
                                            (SPADCALL |m|
                                             (QREFELT $ 77)) . #12#)
                                           (LETT |llf|
                                            (SPADCALL |irrFact|
                                             (QREFELT $ 80)) . #12#)
                                           (SEQ (LETT |l1| NIL . #12#)
                                            (LETT #7# |llf| . #12#)
                                            G190
                                            (COND
                                              ((OR (ATOM #7#)
                                                (PROGN
                                                  (LETT |l1|
                                                   (CAR #7#) . #12#)
                                                  NIL))
                                               #13#))
                                            (SEQ
                                             (LETT |d1|
                                              (QCDR |l1|) . #12#)
                                             (LETT |pol|
                                              (QCAR |l1|) . #12#)
                                             (EXIT
                                              (COND
                                                ((EQL
                                                  (SPADCALL |pol|
                                                   (QREFELT $ 39))
                                                  1)
                                                 (LETT |factorlist|
                                                  (CONS
                                                   (CONS |pol| |d1|)
                                                   |factorlist|) . #12#))
                                                ((EQL
                                                  (SPADCALL |pol|
                                                   (QREFELT $ 39))
                                                  2)
                                                 (SEQ
                                                  (LETT |fln|
                                                   (|UNIFACT;quadratic|
                                                    |pol| $) . #12#)
                                                  (EXIT
                                                   (LETT |factorlist|
                                                    (APPEND
                                                     (PROGN
                                                       (LETT #8#
                                                        NIL . #12#)
                                                       (SEQ
                                                        (LETT |pf|
                                                         NIL . #12#)
                                                        (LETT #9#
                                                         |fln| . #12#)
                                                        G190
                                                        (COND
                                                          ((OR
                                                            (ATOM #9#)
                                                            (PROGN
                                                              (LETT
                                                               |pf|
                                                               (CAR
                                                                #9#) . #12#)
                                                              NIL))
                                                           #13#))
                                                        (SEQ
                                                         (EXIT
                                                          (LETT #8#
                                                           (CONS
                                                            (CONS |pf|
                                                             |d1|)
                                                            #8#) . #12#)))
                                                        (LETT #9#
                                                         (CDR #9#) . #12#)
                                                        #14# G191
                                                        (EXIT
                                                         (NREVERSE0
                                                          #8#))))
                                                     |factorlist|) . #12#))))
                                                ('T
                                                 (SEQ
                                                  (LETT |fln|
                                                   (|UNIFACT;henselfact|
                                                    |pol| $) . #12#)
                                                  (EXIT
                                                   (LETT |factorlist|
                                                    (APPEND
                                                     (PROGN
                                                       (LETT #10#
                                                        NIL . #12#)
                                                       (SEQ
                                                        (LETT |pf|
                                                         NIL . #12#)
                                                        (LETT #11#
                                                         |fln| . #12#)
                                                        G190
                                                        (COND
                                                          ((OR
                                                            (ATOM #11#)
                                                            (PROGN
                                                              (LETT
                                                               |pf|
                                                               (CAR
                                                                #11#) . #12#)
                                                              NIL))
                                                           #13#))
                                                        (SEQ
                                                         (EXIT
                                                          (LETT #10#
                                                           (CONS
                                                            (CONS |pf|
                                                             |d1|)
                                                            #10#) . #12#)))
                                                        (LETT #11#
                                                         (CDR #11#) . #12#)
                                                        #14# G191
                                                        (EXIT
                                                         (NREVERSE0
                                                          #10#))))
                                                     |factorlist|) . #12#)))))))
                                            (LETT #7# (CDR #7#) . #12#)
                                            #14# G191 (EXIT NIL))
                                           (EXIT
                                            (CONS |c| |factorlist|)))))))))))))))))))) 

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

(DEFUN |UnivariateFactorize;| (|#1|)
  (PROG (DV$1 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|UnivariateFactorize|))
        (LETT |dv$| (LIST '|UnivariateFactorize| DV$1) . #0#)
        (LETT $ (GETREFV 81) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|UnivariateFactorize|
            (LIST DV$1) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        $)))) 

(MAKEPROP '|UnivariateFactorize| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|)
             (|Record| (|:| |irr| 6) (|:| |pow| 12))
             (|Record| (|:| |contp| 12) (|:| |factors| (|List| 7)))
             (|Boolean|) |UNIFACT;henselFact;ZPBR;16|
             (|Record| (|:| |unit| $) (|:| |canonical| $)
                 (|:| |associate| $))
             (|Integer|) (0 . |unitNormal|) (5 . |coerce|)
             (|Union| '"nil" '"sqfr" '"irred" '"prime")
             (|Record| (|:| |flg| 15) (|:| |fctr| 6) (|:| |xpnt| 12))
             (|List| 16) (|Factored| 6) (10 . |makeFR|)
             |UNIFACT;factor;ZPF;1| |UNIFACT;factorSquareFree;ZPF;2|
             (16 . |Zero|) (|IntegerRoots| 12) (20 . |approxSqrt|)
             (25 . |reductum|) (30 . |content|) (35 . |One|)
             (39 . |leadingCoefficient|) (44 . =) (|Factored| $)
             (50 . |factor|)
             (|Record| (|:| |factor| 12) (|:| |exponent| 12))
             (|List| 32) (|Factored| 12) (55 . |factors|)
             (|Mapping| 12 12) (60 . |map|) (|NonNegativeInteger|)
             (66 . |degree|) (71 . |coefficient|) (77 . *)
             (|Union| $ '"failed") (83 . |exquo|)
             (|IntegerPrimesPackage| 12) (89 . |nextPrime|)
             (94 . |differentiate|)
             (|ModularDistinctDegreeFactorizer| 6) (99 . |gcd|)
             (|Record| (|:| |factor| 6) (|:| |degree| 12)) (|List| 49)
             (106 . |ddFact|) (|List| 6) (112 . |separateFactors|)
             (|PositiveInteger|) (|GeneralHenselPackage| 12 6)
             (118 . |completeHensel|) (126 . |zero?|)
             (131 . |divideExponents|) (137 . |multiplyExponents|)
             (143 . *) (149 . **) (155 . |monomial|) (161 . +)
             (167 . |exquo|) (|SparseUnivariatePolynomial| 12)
             (173 . |monomial|) (179 . |elt|) (185 . |exquo|) (191 . -)
             (196 . |minimumDegree|)
             (|Record| (|:| |quotient| $) (|:| |remainder| $))
             (201 . |monicDivide|) (|List| 65)
             (|CyclotomicPolynomialPackage|)
             (207 . |cyclotomicDecomposition|) (212 . |second|)
             (217 . |squareFree|)
             (|Record| (|:| |factor| 6) (|:| |exponent| 12))
             (|List| 78) (222 . |factors|))
          '#(|henselFact| 227 |factorSquareFree| 233 |factor| 238) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 80
                                '(1 12 11 0 13 1 6 0 12 14 2 18 0 6 17
                                  19 0 6 0 22 1 23 12 12 24 1 6 0 0 25
                                  1 6 12 0 26 0 6 0 27 1 6 12 0 28 2 6
                                  9 0 0 29 1 12 30 0 31 1 34 33 0 35 2
                                  6 0 36 0 37 1 6 38 0 39 2 6 12 0 38
                                  40 2 12 0 38 0 41 2 12 42 0 0 43 1 44
                                  12 12 45 1 6 0 0 46 3 47 6 6 6 12 48
                                  2 47 50 6 12 51 2 47 52 50 12 53 4 55
                                  52 6 52 12 54 56 1 6 9 0 57 2 6 42 0
                                  38 58 2 6 0 0 38 59 2 12 0 54 0 60 2
                                  12 0 0 54 61 2 6 0 12 38 62 2 6 0 0 0
                                  63 2 6 42 0 0 64 2 65 0 12 38 66 2 65
                                  0 0 0 67 2 6 42 0 12 68 1 6 0 0 69 1
                                  6 38 0 70 2 6 71 0 0 72 1 74 73 12 75
                                  1 52 6 0 76 1 6 30 0 77 1 18 79 0 80
                                  2 0 8 6 9 10 1 0 18 6 21 1 0 18 6 20)))))
          '|lookupComplete|)) 
