
(/VERSIONCHECK 2) 

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

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

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

(DEFUN |UNIFACT;eisenstein| (|m| $)
  (PROG (#1=#:G1875 #2=#:G1876 |r| |fc| |trail| |lead| |c|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (LETT |c| (SPADCALL (SPADCALL |m| (QREFELT $ 25)) (QREFELT $ 26))
              . #3=(|UNIFACT;eisenstein|))
        (EXIT
         (COND ((OR (EQL |c| 0) (EQL |c| 1)) 'NIL)
               ('T
                (SEQ (LETT |lead| (SPADCALL |m| (QREFELT $ 28)) . #3#)
                     (LETT |trail| |lead| . #3#)
                     (LETT |m| (SPADCALL |m| (QREFELT $ 25)) . #3#)
                     (SEQ G190
                          (COND
                           ((NULL
                             (COND
                              ((SPADCALL |m| (|spadConstant| $ 22)
                                         (QREFELT $ 29))
                               'NIL)
                              ('T 'T)))
                            #4=(GO G191)))
                          (SEQ
                           (LETT |trail| (SPADCALL |m| (QREFELT $ 28)) . #3#)
                           (EXIT
                            (LETT |m| (SPADCALL |m| (QREFELT $ 25)) . #3#)))
                          NIL #5=(GO G190) G191 (EXIT NIL))
                     (LETT |fc| (SPADCALL |c| (QREFELT $ 31)) . #3#)
                     (SEQ (LETT |r| NIL . #3#)
                          (LETT #2# (SPADCALL |fc| (QREFELT $ 35)) . #3#) G190
                          (COND
                           ((OR (ATOM #2#)
                                (PROGN (LETT |r| (CAR #2#) . #3#) NIL))
                            #4#))
                          (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 . #3#) (GO #1#))))))))))
                          (LETT #2# (CDR #2#) . #3#) #5# 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| $)
  (PROG ()
    (RETURN
     (SPADCALL (CONS #'|UNIFACT;negShiftp!0| (VECTOR $ |Modulus|)) |pp|
               (QREFELT $ 37))))) 

(DEFUN |UNIFACT;negShiftp!0| (|x| $$)
  (PROG (|Modulus| $)
    (LETT |Modulus| (QREFELT $$ 1) . #1=(|UNIFACT;negShiftp|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (|UNIFACT;negShiftz| |x| |Modulus| $))))) 

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

(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 (|ans| #1=#:G1908 |d| #2=#:G1914 |dd|)
    (RETURN
     (SEQ (LETT |ans| 0 . #3=(|UNIFACT;numFactors|))
          (SEQ (LETT |dd| NIL . #3#) (LETT #2# |ddlist| . #3#) G190
               (COND
                ((OR (ATOM #2#) (PROGN (LETT |dd| (CAR #2#) . #3#) NIL))
                 (GO G191)))
               (SEQ (LETT |d| (SPADCALL (QCAR |dd|) (QREFELT $ 39)) . #3#)
                    (EXIT
                     (COND ((EQL |d| 0) NIL)
                           ('T
                            (LETT |ans|
                                  (+ |ans|
                                     (PROG2
                                         (LETT #1#
                                               (SPADCALL |d| (QCDR |dd|)
                                                         (QREFELT $ 43))
                                               . #3#)
                                         (QCDR #1#)
                                       (|check-union| (QEQCAR #1# 0)
                                                      (|Integer|) #1#)))
                                  . #3#)))))
               (LETT #2# (CDR #2#) . #3#) (GO G190) G191 (EXIT NIL))
          (EXIT |ans|))))) 

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

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

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

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

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

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

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