
(/VERSIONCHECK 2) 

(DEFUN |UPDECOMP;rightFactorIfCan;UPNniRU;1| (|p| |dq| |lcq| $)
  (PROG (|dp| |nc| |n| |s| |lcp| |k| |i| #0=#:G1847 |c| |cquo|
              #1=#:G1846 #2=#:G1832 |q|)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |dp| (SPADCALL |p| (QREFELT $ 9))
                            . #3=(|UPDECOMP;rightFactorIfCan;UPNniRU;1|))
                      (EXIT (COND
                              ((SPADCALL |lcq| (QREFELT $ 11))
                               (|error| "rightFactorIfCan: leading coefficient may not be zero"))
                              ((OR (ZEROP |dp|) (ZEROP |dq|))
                               (CONS 1 "failed"))
                              ('T
                               (SEQ (LETT |nc|
                                     (SPADCALL |dp| |dq|
                                      (QREFELT $ 13)) . #3#)
                                    (EXIT
                                     (COND
                                       ((QEQCAR |nc| 1)
                                        (CONS 1 "failed"))
                                       ('T
                                        (SEQ
                                         (LETT |n| (QCDR |nc|) . #3#)
                                         (LETT |s|
                                          (PROG2
                                           (LETT #2#
                                            (SPADCALL |dq| 1
                                             (QREFELT $ 16)) . #3#)
                                           (QCDR #2#)
                                            (|check-union|
                                             (QEQCAR #2# 0)
                                             (|NonNegativeInteger|)
                                             #2#)) . #3#)
                                         (LETT |lcp|
                                          (SPADCALL |p| (QREFELT $ 17)) . #3#)
                                         (LETT |q|
                                          (SPADCALL |lcq| |dq|
                                           (QREFELT $ 18)) . #3#)
                                         (SEQ (LETT |k| 1 . #3#) G190
                                          (COND
                                            ((QSGREATERP |k| |s|)
                                             #4=(GO G191)))
                                          (SEQ
                                           (LETT |c|
                                            (|spadConstant| $ 19) . #3#)
                                           (SEQ (LETT |i| 0 . #3#)
                                            (LETT #0#
                                             (PROG2
                                              (LETT #2#
                                               (SPADCALL |k| 1
                                                (QREFELT $ 16)) . #3#)
                                              (QCDR #2#)
                                               (|check-union|
                                                (QEQCAR #2# 0)
                                                (|NonNegativeInteger|)
                                                #2#)) . #3#)
                                            G190
                                            (COND
                                              ((QSGREATERP |i| #0#)
                                               #4#))
                                            (SEQ
                                             (EXIT
                                              (LETT |c|
                                               (SPADCALL |c|
                                                (SPADCALL
                                                 (SPADCALL
                                                  (SPADCALL
                                                   (SPADCALL |k|
                                                    (QREFELT $ 21))
                                                   (SPADCALL
                                                    (SPADCALL
                                                     (SPADCALL |n|
                                                      (QREFELT $ 21))
                                                     (|spadConstant| $
                                                      14)
                                                     (QREFELT $ 22))
                                                    (SPADCALL |i|
                                                     (QREFELT $ 21))
                                                    (QREFELT $ 23))
                                                   (QREFELT $ 24))
                                                  (SPADCALL |q|
                                                   (PROG2
                                                    (LETT #2#
                                                     (SPADCALL |dq| |i|
                                                      (QREFELT $ 16)) . #3#)
                                                    (QCDR #2#)
                                                     (|check-union|
                                                      (QEQCAR #2# 0)
                                                      (|NonNegativeInteger|)
                                                      #2#))
                                                   (QREFELT $ 25))
                                                  (QREFELT $ 23))
                                                 (SPADCALL |p|
                                                  (PROG2
                                                   (LETT #2#
                                                    (SPADCALL
                                                     (+ |dp| |i|) |k|
                                                     (QREFELT $ 16)) . #3#)
                                                   (QCDR #2#)
                                                    (|check-union|
                                                     (QEQCAR #2# 0)
                                                     (|NonNegativeInteger|)
                                                     #2#))
                                                  (QREFELT $ 25))
                                                 (QREFELT $ 23))
                                                (QREFELT $ 22)) . #3#)))
                                            (LETT |i|
                                             (QSADD1 |i|) . #3#)
                                            #5=(GO G190) G191
                                            (EXIT NIL))
                                           (LETT |cquo|
                                            (SPADCALL |c|
                                             (SPADCALL
                                              (SPADCALL (* |k| |n|)
                                               (QREFELT $ 21))
                                              |lcp| (QREFELT $ 23))
                                             (QREFELT $ 26)) . #3#)
                                           (EXIT
                                            (COND
                                              ((QEQCAR |cquo| 1)
                                               (PROGN
                                                 (LETT #1#
                                                  (CONS 1 "failed") . #3#)
                                                 (GO #1#)))
                                              ('T
                                               (LETT |q|
                                                (SPADCALL |q|
                                                 (SPADCALL
                                                  (QCDR |cquo|)
                                                  (PROG2
                                                   (LETT #2#
                                                    (SPADCALL |dq| |k|
                                                     (QREFELT $ 16)) . #3#)
                                                   (QCDR #2#)
                                                    (|check-union|
                                                     (QEQCAR #2# 0)
                                                     (|NonNegativeInteger|)
                                                     #2#))
                                                  (QREFELT $ 18))
                                                 (QREFELT $ 27)) . #3#)))))
                                          (LETT |k| (QSADD1 |k|) . #3#)
                                          #5# G191 (EXIT NIL))
                                         (EXIT (CONS 0 |q|))))))))))))
           #1# (EXIT #1#))))) 

(DEFUN |UPDECOMP;monicRightFactorIfCan;UPNniU;2| (|p| |dq| $)
  (SPADCALL |p| |dq| (|spadConstant| $ 14) (QREFELT $ 29))) 

(DEFUN |UPDECOMP;leftFactorIfCan;2UPU;3| (|f| |h| $)
  (PROG (|i| |qrf| |qr| |r| #0=#:G1870 |g|)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |g| (|spadConstant| $ 31)
                            . #1=(|UPDECOMP;leftFactorIfCan;2UPU;3|))
                      (EXIT (COND
                              ((ZEROP (SPADCALL |h| (QREFELT $ 9)))
                               (CONS 1 "failed"))
                              ('T
                               (SEQ (SEQ (LETT |i| 0 . #1#) G190
                                     (COND
                                       ((NULL
                                         (COND
                                           ((SPADCALL |f|
                                             (QREFELT $ 32))
                                            'NIL)
                                           ('T 'T)))
                                        (GO G191)))
                                     (SEQ
                                      (LETT |qrf|
                                       (SPADCALL |f| |h|
                                        (QREFELT $ 36)) . #1#)
                                      (EXIT
                                       (COND
                                         ((QEQCAR |qrf| 1)
                                          (PROGN
                                            (LETT #0#
                                             (CONS 1 "failed") . #1#)
                                            (GO #0#)))
                                         ('T
                                          (SEQ
                                           (LETT |qr|
                                            (QCDR |qrf|) . #1#)
                                           (LETT |r| (QCDR |qr|) . #1#)
                                           (COND
                                             ((NULL
                                               (SPADCALL |r|
                                                (QREFELT $ 37)))
                                              (EXIT
                                               (PROGN
                                                 (LETT #0#
                                                  (CONS 1 "failed") . #1#)
                                                 (GO #0#)))))
                                           (LETT |g|
                                            (SPADCALL |g|
                                             (SPADCALL
                                              (SPADCALL |r|
                                               (QREFELT $ 38))
                                              |i| (QREFELT $ 18))
                                             (QREFELT $ 27)) . #1#)
                                           (EXIT
                                            (LETT |f|
                                             (QCAR |qr|) . #1#)))))))
                                     (LETT |i| (QSADD1 |i|) . #1#)
                                     (GO G190) G191 (EXIT NIL))
                                    (EXIT (CONS 0 |g|))))))))
           #0# (EXIT #0#))))) 

(DEFUN |UPDECOMP;monicDecomposeIfCan;UPU;4| (|f| $)
  (PROG (|df| |dh| #0=#:G1876 #1=#:G1891 |h| |g| #2=#:G1890)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |df| (SPADCALL |f| (QREFELT $ 9))
                            . #3=(|UPDECOMP;monicDecomposeIfCan;UPU;4|))
                      (EXIT (COND
                              ((ZEROP |df|) (CONS 1 "failed"))
                              ('T
                               (SEQ (SEQ (LETT |dh| 2 . #3#)
                                     (LETT #1#
                                      (PROG2
                                       (LETT #0#
                                        (SPADCALL |df| 1
                                         (QREFELT $ 16)) . #3#)
                                       (QCDR #0#)
                                        (|check-union| (QEQCAR #0# 0)
                                         (|NonNegativeInteger|) #0#)) . #3#)
                                     G190
                                     (COND
                                       ((QSGREATERP |dh| #1#)
                                        (GO G191)))
                                     (SEQ
                                      (EXIT
                                       (COND
                                         ((ZEROP
                                           (REMAINDER2 |df| |dh|))
                                          (SEQ
                                           (LETT |h|
                                            (SPADCALL |f| |dh|
                                             (QREFELT $ 30)) . #3#)
                                           (EXIT
                                            (COND
                                              ((QEQCAR |h| 0)
                                               (SEQ
                                                (LETT |g|
                                                 (SPADCALL |f|
                                                  (QCDR |h|)
                                                  (QREFELT $ 39)) . #3#)
                                                (EXIT
                                                 (COND
                                                   ((QEQCAR |g| 0)
                                                    (PROGN
                                                      (LETT #2#
                                                       (CONS 0
                                                        (CONS
                                                         (QCDR |g|)
                                                         (QCDR |h|))) . #3#)
                                                      (GO #2#))))))))))))))
                                     (LETT |dh| (QSADD1 |dh|) . #3#)
                                     (GO G190) G191 (EXIT NIL))
                                    (EXIT (CONS 1 "failed"))))))))
           #2# (EXIT #2#))))) 

(DEFUN |UPDECOMP;monicCompleteDecompose;UPL;5| (|f| $)
  (PROG (|cf| |lr|)
    (RETURN
      (SEQ (LETT |cf| (SPADCALL |f| (QREFELT $ 42))
                 . #0=(|UPDECOMP;monicCompleteDecompose;UPL;5|))
           (EXIT (COND
                   ((QEQCAR |cf| 1) (LIST |f|))
                   ('T
                    (SEQ (LETT |lr| (QCDR |cf|) . #0#)
                         (EXIT (APPEND (SPADCALL (QCAR |lr|)
                                        (QREFELT $ 44))
                                       (LIST (QCDR |lr|)))))))))))) 

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

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

(MAKEPROP '|UnivariatePolynomialDecompositionPackage| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|NonNegativeInteger|) (0 . |degree|) (|Boolean|)
             (5 . |zero?|) (|Union| $ '"failed") (10 . |exquo|)
             (16 . |One|) (20 . |One|) (24 . |subtractIfCan|)
             (30 . |leadingCoefficient|) (35 . |monomial|)
             (41 . |Zero|) (|Integer|) (45 . |coerce|) (50 . +)
             (56 . *) (62 . -) (68 . |coefficient|) (74 . |exquo|)
             (80 . +) (|Union| 7 '"failed")
             |UPDECOMP;rightFactorIfCan;UPNniRU;1|
             |UPDECOMP;monicRightFactorIfCan;UPNniU;2| (86 . |Zero|)
             (90 . |zero?|)
             (|Record| (|:| |quotient| 7) (|:| |remainder| 7))
             (|Union| 33 '"failed")
             (|UnivariatePolynomialDivisionPackage| 6 7)
             (95 . |divideIfCan|) (101 . |ground?|) (106 . |ground|)
             |UPDECOMP;leftFactorIfCan;2UPU;3|
             (|Record| (|:| |left| 7) (|:| |right| 7))
             (|Union| 40 '"failed")
             |UPDECOMP;monicDecomposeIfCan;UPU;4| (|List| 7)
             |UPDECOMP;monicCompleteDecompose;UPL;5|)
          '#(|rightFactorIfCan| 111 |monicRightFactorIfCan| 118
             |monicDecomposeIfCan| 124 |monicCompleteDecompose| 129
             |leftFactorIfCan| 134)
          'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 44
                                '(1 7 8 0 9 1 6 10 0 11 2 8 12 0 0 13 0
                                  6 0 14 0 7 0 15 2 8 12 0 0 16 1 7 6 0
                                  17 2 7 0 6 8 18 0 6 0 19 1 6 0 20 21
                                  2 6 0 0 0 22 2 6 0 0 0 23 2 6 0 0 0
                                  24 2 7 6 0 8 25 2 6 12 0 0 26 2 7 0 0
                                  0 27 0 7 0 31 1 7 10 0 32 2 35 34 7 7
                                  36 1 7 10 0 37 1 7 6 0 38 3 0 28 7 8
                                  6 29 2 0 28 7 8 30 1 0 41 7 42 1 0 43
                                  7 44 2 0 28 7 7 39)))))
          '|lookupComplete|)) 
