
(/VERSIONCHECK 2) 

(DEFUN |GENPGCD;gcdPolynomial;3Sup;1| (|p1| |p2| $)
  (PROG (|v2| |v| #1=#:G738 |g| |v1| |pp2| |pp1| |vp2| |vp1| #2=#:G707 |c2|
         |c1| |#G9| |#G8|)
    (RETURN
     (SEQ
      (EXIT
       (COND ((SPADCALL |p1| (QREFELT $ 12)) |p2|)
             ((SPADCALL |p2| (QREFELT $ 12)) |p1|)
             ((EQL 0 (SPADCALL |p1| (QREFELT $ 18)))
              (|GENPGCD;gcdTrivial| |p1| |p2| $))
             ((EQL 0 (SPADCALL |p2| (QREFELT $ 18)))
              (|GENPGCD;gcdTrivial| |p2| |p1| $))
             (#3='T
              (SEQ
               (COND
                ((< (SPADCALL |p1| (QREFELT $ 18))
                    (SPADCALL |p2| (QREFELT $ 18)))
                 (PROGN
                  (LETT |#G8| |p2| . #4=(|GENPGCD;gcdPolynomial;3Sup;1|))
                  (LETT |#G9| |p1| . #4#)
                  (LETT |p1| |#G8| . #4#)
                  (LETT |p2| |#G9| . #4#))))
               (EXIT
                (COND
                 ((QEQCAR (SPADCALL |p1| |p2| (QREFELT $ 20)) 0)
                  (QVELT (SPADCALL |p2| (QREFELT $ 22)) 1))
                 (#3#
                  (SEQ (LETT |c1| (|GENPGCD;monomContentSup| |p1| $) . #4#)
                       (LETT |c2| (|GENPGCD;monomContentSup| |p2| $) . #4#)
                       (LETT |p1|
                             (PROG2
                                 (LETT #2# (SPADCALL |p1| |c1| (QREFELT $ 20))
                                       . #4#)
                                 (QCDR #2#)
                               (|check-union| (QEQCAR #2# 0)
                                              (|SparseUnivariatePolynomial|
                                               (QREFELT $ 9))
                                              #2#))
                             . #4#)
                       (LETT |p2|
                             (PROG2
                                 (LETT #2# (SPADCALL |p2| |c2| (QREFELT $ 20))
                                       . #4#)
                                 (QCDR #2#)
                               (|check-union| (QEQCAR #2# 0)
                                              (|SparseUnivariatePolynomial|
                                               (QREFELT $ 9))
                                              #2#))
                             . #4#)
                       (EXIT
                        (COND
                         ((QEQCAR (SPADCALL |p1| |p2| (QREFELT $ 20)) 0)
                          (SPADCALL (QVELT (SPADCALL |p2| (QREFELT $ 22)) 1)
                                    (SPADCALL |c1| |c2| (QREFELT $ 23))
                                    (QREFELT $ 24)))
                         (#3#
                          (SEQ (LETT |vp1| (|GENPGCD;variables| |p1| $) . #4#)
                               (LETT |vp2| (|GENPGCD;variables| |p2| $) . #4#)
                               (LETT |v1| (SPADCALL |vp1| |vp2| (QREFELT $ 26))
                                     . #4#)
                               (LETT |v2| (SPADCALL |vp2| |vp1| (QREFELT $ 26))
                                     . #4#)
                               (COND
                                ((EQL (LENGTH |v1|) 0)
                                 (COND
                                  ((EQL (LENGTH |v2|) 0)
                                   (EXIT
                                    (SPADCALL
                                     (|GENPGCD;gcdSameVariables| |p1| |p2|
                                      |vp1| $)
                                     (SPADCALL |c1| |c2| (QREFELT $ 23))
                                     (QREFELT $ 24)))))))
                               (LETT |v| (SPADCALL |vp1| |v1| (QREFELT $ 26))
                                     . #4#)
                               (LETT |pp1| (|GENPGCD;flatten| |p1| |v1| $)
                                     . #4#)
                               (LETT |pp2| (|GENPGCD;flatten| |p2| |v2| $)
                                     . #4#)
                               (LETT |g|
                                     (|GENPGCD;gcdSameVariables| |pp1| |pp2|
                                      |v| $)
                                     . #4#)
                               (EXIT
                                (COND
                                 ((SPADCALL |g| (|spadConstant| $ 29)
                                            (QREFELT $ 30))
                                  (SPADCALL |c1| |c2| (QREFELT $ 23)))
                                 (#3#
                                  (SEQ
                                   (COND
                                    ((OR (EQL (LENGTH |v1|) 0)
                                         (NULL
                                          (QEQCAR
                                           (SPADCALL |p1| |g| (QREFELT $ 20))
                                           1)))
                                     (COND
                                      ((OR (EQL (LENGTH |v2|) 0)
                                           (NULL
                                            (QEQCAR
                                             (SPADCALL |p2| |g| (QREFELT $ 20))
                                             1)))
                                       (EXIT
                                        (SPADCALL |g|
                                                  (SPADCALL |c1| |c2|
                                                            (QREFELT $ 23))
                                                  (QREFELT $ 24)))))))
                                   (LETT |v| (|GENPGCD;variables| |g| $) . #4#)
                                   (LETT |v1|
                                         (SPADCALL |vp1| |v| (QREFELT $ 26))
                                         . #4#)
                                   (LETT |v2|
                                         (SPADCALL |vp2| |v| (QREFELT $ 26))
                                         . #4#)
                                   (COND
                                    ((EQL (LENGTH |v1|) 0)
                                     (LETT |g|
                                           (|GENPGCD;gcdSameVariables| |g|
                                            (|GENPGCD;flatten| |p2| |v2| $) |v|
                                            $)
                                           . #4#))
                                    ((EQL (LENGTH |v2|) 0)
                                     (LETT |g|
                                           (|GENPGCD;gcdSameVariables| |g|
                                            (|GENPGCD;flatten| |p1| |v1| $) |v|
                                            $)
                                           . #4#))
                                    (#3#
                                     (LETT |g|
                                           (|GENPGCD;gcdSameVariables| |g|
                                            (SPADCALL
                                             (|GENPGCD;flatten| |p1| |v1| $)
                                             (|GENPGCD;flatten| |p2| |v2| $)
                                             (QREFELT $ 31))
                                            |v| $)
                                           . #4#)))
                                   (EXIT
                                    (COND
                                     ((SPADCALL |g| (|spadConstant| $ 29)
                                                (QREFELT $ 30))
                                      (SPADCALL |c1| |c2| (QREFELT $ 23)))
                                     (#3#
                                      (SEQ
                                       (COND
                                        ((OR (EQL (LENGTH |v1|) 0)
                                             (NULL
                                              (QEQCAR
                                               (SPADCALL |p1| |g|
                                                         (QREFELT $ 20))
                                               1)))
                                         (COND
                                          ((OR (EQL (LENGTH |v2|) 0)
                                               (NULL
                                                (QEQCAR
                                                 (SPADCALL |p2| |g|
                                                           (QREFELT $ 20))
                                                 1)))
                                           (EXIT
                                            (SPADCALL |g|
                                                      (SPADCALL |c1| |c2|
                                                                (QREFELT $ 23))
                                                      (QREFELT $ 24)))))))
                                       (LETT |v| (|GENPGCD;variables| |g| $)
                                             . #4#)
                                       (LETT |v1|
                                             (SPADCALL |vp1| |v|
                                                       (QREFELT $ 26))
                                             . #4#)
                                       (COND
                                        ((NULL (EQL (LENGTH |v1|) 0))
                                         (SEQ
                                          (LETT |g|
                                                (|GENPGCD;recursivelyGCDCoefficients|
                                                 |g| |v| |p1| |v1| $)
                                                . #4#)
                                          (EXIT
                                           (COND
                                            ((SPADCALL |g|
                                                       (|spadConstant| $ 29)
                                                       (QREFELT $ 30))
                                             (PROGN
                                              (LETT #1#
                                                    (SPADCALL |c1| |c2|
                                                              (QREFELT $ 23))
                                                    . #4#)
                                              (GO #1#)))
                                            (#3#
                                             (LETT |v|
                                                   (|GENPGCD;variables| |g| $)
                                                   . #4#)))))))
                                       (LETT |v2|
                                             (SPADCALL |vp2| |v|
                                                       (QREFELT $ 26))
                                             . #4#)
                                       (EXIT
                                        (SPADCALL
                                         (|GENPGCD;recursivelyGCDCoefficients|
                                          |g| |v| |p2| |v2| $)
                                         (SPADCALL |c1| |c2| (QREFELT $ 23))
                                         (QREFELT $ 24)))))))))))))))))))))))
      #1# (EXIT #1#))))) 

(DEFUN |GENPGCD;randomR;R;2| ($)
  (PROG (|v|)
    (RETURN
     (SEQ
      (LETT |v| (SPADCALL (QREFELT $ 34) (QREFELT $ 35)) |GENPGCD;randomR;R;2|)
      (EXIT
       (COND ((QEQCAR |v| 0) (SEQ (SETELT $ 34 (QCDR |v|)) (EXIT (QCDR |v|))))
             ('T
              (SEQ
               (SAY
                "Taking next stepthrough range in GeneralPolynomialGcdPackage")
               (SETELT $ 34 (|spadConstant| $ 33)) (EXIT (QREFELT $ 34)))))))))) 

(DEFUN |GENPGCD;randomR;R;3| ($) (SPADCALL (RANDOM 100) (QREFELT $ 38))) 

(DEFUN |GENPGCD;gcdSameVariables| (|p1| |p2| |lv| $)
  (PROG (#1=#:G771 #2=#:G784 |ans| |uu| |r| |count| |up2| #3=#:G766 |up1| |lr|
         |u| |v| |vp2| |vp1| |lrr| #4=#:G792 |vv| #5=#:G791 #6=#:G790 #7=#:G789
         #8=#:G788 #9=#:G787 #10=#:G786 #11=#:G785 |gcdLC|)
    (RETURN
     (SEQ
      (EXIT
       (COND
        ((EQL (LENGTH |lv|) 0)
         (SPADCALL (ELT $ 39)
                   (SPADCALL (SPADCALL (ELT $ 40) |p1| (QREFELT $ 44))
                             (SPADCALL (ELT $ 40) |p2| (QREFELT $ 44))
                             (QREFELT $ 46))
                   (QREFELT $ 49)))
        ((EQL (SPADCALL |p2| (QREFELT $ 18)) 1)
         (COND ((QEQCAR (SPADCALL |p1| |p2| (QREFELT $ 20)) 0) |p2|)
               (#12='T (|spadConstant| $ 29))))
        (#12#
         (SEQ
          (LETT |gcdLC|
                (SPADCALL (SPADCALL |p1| (QREFELT $ 50))
                          (SPADCALL |p2| (QREFELT $ 50)) (QREFELT $ 51))
                . #13=(|GENPGCD;gcdSameVariables|))
          (LETT |lr|
                (PROGN
                 (LETT #11# NIL . #13#)
                 (SEQ (LETT |vv| NIL . #13#) (LETT #10# |lv| . #13#) G190
                      (COND
                       ((OR (ATOM #10#)
                            (PROGN (LETT |vv| (CAR #10#) . #13#) NIL))
                        #14=(GO G191)))
                      (SEQ
                       (EXIT
                        (LETT #11# (CONS (SPADCALL (QREFELT $ 36)) #11#)
                              . #13#)))
                      (LETT #10# (CDR #10#) . #13#) #15=(GO G190) G191
                      (EXIT (NREVERSE0 #11#))))
                . #13#)
          (LETT |count| 0 . #13#)
          (SEQ G190 (COND ((NULL (< |count| 10)) #14#))
               (SEQ
                (SEQ G190
                     (COND
                      ((NULL
                        (COND
                         ((SPADCALL (SPADCALL |gcdLC| |lv| |lr| (QREFELT $ 53))
                                    (QREFELT $ 54))
                          (< |count| 10))
                         ('T 'NIL)))
                       #14#))
                     (SEQ
                      (LETT |lr|
                            (PROGN
                             (LETT #9# NIL . #13#)
                             (SEQ (LETT |vv| NIL . #13#) (LETT #8# |lv| . #13#)
                                  G190
                                  (COND
                                   ((OR (ATOM #8#)
                                        (PROGN
                                         (LETT |vv| (CAR #8#) . #13#)
                                         NIL))
                                    #14#))
                                  (SEQ
                                   (EXIT
                                    (LETT #9#
                                          (CONS (SPADCALL (QREFELT $ 36)) #9#)
                                          . #13#)))
                                  (LETT #8# (CDR #8#) . #13#) #15# G191
                                  (EXIT (NREVERSE0 #9#))))
                            . #13#)
                      (EXIT (LETT |count| (+ |count| 1) . #13#)))
                     NIL #15# G191 (EXIT NIL))
                (EXIT
                 (COND
                  ((EQL |count| 10)
                   (|error| "too many evaluations in GCD code"))
                  ('T
                   (SEQ
                    (LETT |up1|
                          (SPADCALL
                           (CONS #'|GENPGCD;gcdSameVariables!0|
                                 (VECTOR $ |lr| |lv|))
                           |p1| (QREFELT $ 44))
                          . #13#)
                    (LETT |up2|
                          (SPADCALL
                           (CONS #'|GENPGCD;gcdSameVariables!1|
                                 (VECTOR $ |lr| |lv|))
                           |p2| (QREFELT $ 44))
                          . #13#)
                    (LETT |u| (SPADCALL |up1| |up2| (QREFELT $ 46)) . #13#)
                    (EXIT
                     (COND
                      ((EQL (SPADCALL |u| (QREFELT $ 55)) 0)
                       (PROGN
                        (LETT #2# (|spadConstant| $ 29) . #13#)
                        (GO #2#)))
                      ('T
                       (SEQ
                        (LETT |lrr|
                              (PROGN
                               (LETT #7# NIL . #13#)
                               (SEQ (LETT |vv| NIL . #13#)
                                    (LETT #6# |lv| . #13#) G190
                                    (COND
                                     ((OR (ATOM #6#)
                                          (PROGN
                                           (LETT |vv| (CAR #6#) . #13#)
                                           NIL))
                                      #14#))
                                    (SEQ
                                     (EXIT
                                      (LETT #7#
                                            (CONS (SPADCALL (QREFELT $ 36))
                                                  #7#)
                                            . #13#)))
                                    (LETT #6# (CDR #6#) . #13#) #15# G191
                                    (EXIT (NREVERSE0 #7#))))
                              . #13#)
                        (SEQ G190
                             (COND
                              ((NULL
                                (COND
                                 ((SPADCALL
                                   (SPADCALL |gcdLC| |lv| |lrr| (QREFELT $ 53))
                                   (QREFELT $ 54))
                                  (< |count| 10))
                                 ('T 'NIL)))
                               #14#))
                             (SEQ
                              (LETT |lrr|
                                    (PROGN
                                     (LETT #5# NIL . #13#)
                                     (SEQ (LETT |vv| NIL . #13#)
                                          (LETT #4# |lv| . #13#) G190
                                          (COND
                                           ((OR (ATOM #4#)
                                                (PROGN
                                                 (LETT |vv| (CAR #4#) . #13#)
                                                 NIL))
                                            #14#))
                                          (SEQ
                                           (EXIT
                                            (LETT #5#
                                                  (CONS
                                                   (SPADCALL (QREFELT $ 36))
                                                   #5#)
                                                  . #13#)))
                                          (LETT #4# (CDR #4#) . #13#) #15# G191
                                          (EXIT (NREVERSE0 #5#))))
                                    . #13#)
                              (EXIT (LETT |count| (+ |count| 1) . #13#)))
                             NIL #15# G191 (EXIT NIL))
                        (EXIT
                         (COND
                          ((EQL |count| 10)
                           (|error| "too many evaluations in GCD code"))
                          ('T
                           (SEQ
                            (LETT |vp1|
                                  (SPADCALL
                                   (CONS #'|GENPGCD;gcdSameVariables!2|
                                         (VECTOR $ |lrr| |lv|))
                                   |p1| (QREFELT $ 44))
                                  . #13#)
                            (LETT |vp2|
                                  (SPADCALL
                                   (CONS #'|GENPGCD;gcdSameVariables!3|
                                         (VECTOR $ |lrr| |lv|))
                                   |p2| (QREFELT $ 44))
                                  . #13#)
                            (LETT |v| (SPADCALL |vp1| |vp2| (QREFELT $ 46))
                                  . #13#)
                            (EXIT
                             (COND
                              ((EQL (SPADCALL |v| (QREFELT $ 55)) 0)
                               (PROGN
                                (LETT #2# (|spadConstant| $ 29) . #13#)
                                (GO #2#)))
                              ('T
                               (SEQ
                                (COND
                                 ((< (SPADCALL |v| (QREFELT $ 55))
                                     (SPADCALL |u| (QREFELT $ 55)))
                                  (SEQ (LETT |u| |v| . #13#)
                                       (LETT |up1| |vp1| . #13#)
                                       (LETT |up2| |vp2| . #13#)
                                       (EXIT (LETT |lr| |lrr| . #13#)))))
                                (LETT |up1|
                                      (PROG2
                                          (LETT #3#
                                                (SPADCALL |up1| |u|
                                                          (QREFELT $ 56))
                                                . #13#)
                                          (QCDR #3#)
                                        (|check-union| (QEQCAR #3# 0)
                                                       (|SparseUnivariatePolynomial|
                                                        (QREFELT $ 8))
                                                       #3#))
                                      . #13#)
                                (EXIT
                                 (COND
                                  ((EQL
                                    (SPADCALL
                                     (SPADCALL |u| |up1| (QREFELT $ 57))
                                     (QREFELT $ 55))
                                    0)
                                   (SEQ
                                    (LETT |ans|
                                          (|GENPGCD;lift| |u| |p1| |up1| |lv|
                                           |lr| $)
                                          . #13#)
                                    (EXIT
                                     (COND
                                      ((QEQCAR |ans| 0)
                                       (PROGN
                                        (LETT #2# (QCDR |ans|) . #13#)
                                        (GO #2#)))
                                      ('T "next")))))
                                  ('T
                                   (SEQ
                                    (LETT |up2|
                                          (PROG2
                                              (LETT #3#
                                                    (SPADCALL |up2| |u|
                                                              (QREFELT $ 56))
                                                    . #13#)
                                              (QCDR #3#)
                                            (|check-union| (QEQCAR #3# 0)
                                                           (|SparseUnivariatePolynomial|
                                                            (QREFELT $ 8))
                                                           #3#))
                                          . #13#)
                                    (EXIT
                                     (COND
                                      ((EQL
                                        (SPADCALL
                                         (SPADCALL |u| |up2| (QREFELT $ 57))
                                         (QREFELT $ 55))
                                        0)
                                       (SEQ
                                        (LETT |ans|
                                              (|GENPGCD;lift| |u| |p2| |up2|
                                               |lv| |lr| $)
                                              . #13#)
                                        (EXIT
                                         (COND
                                          ((QEQCAR |ans| 0)
                                           (PROGN
                                            (LETT #2# (QCDR |ans|) . #13#)
                                            (GO #2#)))
                                          ('T "next")))))
                                      ('T
                                       (SEQ (LETT |count| 0 . #13#)
                                            (SEQ G190
                                                 (COND
                                                  ((NULL (< |count| 10)) #14#))
                                                 (SEQ
                                                  (EXIT
                                                   (SEQ
                                                    (LETT |r|
                                                          (SPADCALL
                                                           (QREFELT $ 36))
                                                          . #13#)
                                                    (LETT |uu|
                                                          (SPADCALL |up1|
                                                                    (SPADCALL
                                                                     |r| |up2|
                                                                     (QREFELT $
                                                                              58))
                                                                    (QREFELT $
                                                                             59))
                                                          . #13#)
                                                    (EXIT
                                                     (COND
                                                      ((EQL
                                                        (SPADCALL
                                                         (SPADCALL |u| |uu|
                                                                   (QREFELT $
                                                                            57))
                                                         (QREFELT $ 55))
                                                        0)
                                                       (PROGN
                                                        (LETT #1#
                                                              (SEQ
                                                               (LETT |ans|
                                                                     (|GENPGCD;lift|
                                                                      |u|
                                                                      (SPADCALL
                                                                       |p1|
                                                                       (SPADCALL
                                                                        (SPADCALL
                                                                         |r|
                                                                         (QREFELT
                                                                          $
                                                                          39))
                                                                        |p2|
                                                                        (QREFELT
                                                                         $ 60))
                                                                       (QREFELT
                                                                        $ 61))
                                                                      |uu| |lv|
                                                                      |lr| $)
                                                                     . #13#)
                                                               (EXIT
                                                                (COND
                                                                 ((QEQCAR |ans|
                                                                          0)
                                                                  (PROGN
                                                                   (LETT #2#
                                                                         (QCDR
                                                                          |ans|)
                                                                         . #13#)
                                                                   (GO #2#)))
                                                                 ('T "next"))))
                                                              . #13#)
                                                        (GO #1#)))))))
                                                  #1# (EXIT #1#))
                                                 NIL #15# G191 (EXIT NIL))
                                            (EXIT
                                             (|error|
                                              "too many evaluations in GCD code")))))))))))))))))))))))))))
               NIL #15# G191 (EXIT NIL))
          (EXIT
           (COND
            ((NULL (< |count| 10))
             (|error| "too many evaluations in GCD code"))))))))
      #2# (EXIT #2#))))) 

(DEFUN |GENPGCD;gcdSameVariables!3| (|x| $$)
  (PROG (|lv| |lrr| $)
    (LETT |lv| (QREFELT $$ 2) . #1=(|GENPGCD;gcdSameVariables|))
    (LETT |lrr| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (SPADCALL (SPADCALL |x| |lv| |lrr| (QREFELT $ 53)) (QREFELT $ 40)))))) 

(DEFUN |GENPGCD;gcdSameVariables!2| (|x| $$)
  (PROG (|lv| |lrr| $)
    (LETT |lv| (QREFELT $$ 2) . #1=(|GENPGCD;gcdSameVariables|))
    (LETT |lrr| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (SPADCALL (SPADCALL |x| |lv| |lrr| (QREFELT $ 53)) (QREFELT $ 40)))))) 

(DEFUN |GENPGCD;gcdSameVariables!1| (|x| $$)
  (PROG (|lv| |lr| $)
    (LETT |lv| (QREFELT $$ 2) . #1=(|GENPGCD;gcdSameVariables|))
    (LETT |lr| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (SPADCALL (SPADCALL |x| |lv| |lr| (QREFELT $ 53)) (QREFELT $ 40)))))) 

(DEFUN |GENPGCD;gcdSameVariables!0| (|x| $$)
  (PROG (|lv| |lr| $)
    (LETT |lv| (QREFELT $$ 2) . #1=(|GENPGCD;gcdSameVariables|))
    (LETT |lr| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (SPADCALL (SPADCALL |x| |lv| |lr| (QREFELT $ 53)) (QREFELT $ 40)))))) 

(DEFUN |GENPGCD;lift| (|gR| |p| |cfR| |lv| |lr| $)
  (PROG (#1=#:G811 #2=#:G814 |pn| |cf| |g| |step| #3=#:G810 |Ecart| |n|
         |origFactors| |prime| |d| #4=#:G798 #5=#:G797 #6=#:G799 #7=#:G815 |c|
         |thisp| |r| |v| |lcp|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ (LETT |lcp| (SPADCALL |p| (QREFELT $ 50)) . #8=(|GENPGCD;lift|))
            (LETT |g|
                  (SPADCALL
                   (SPADCALL |lcp| (SPADCALL |gR| (QREFELT $ 55))
                             (QREFELT $ 62))
                   (SPADCALL (ELT $ 39) (SPADCALL |gR| (QREFELT $ 63))
                             (QREFELT $ 49))
                   (QREFELT $ 61))
                  . #8#)
            (LETT |cf|
                  (SPADCALL
                   (SPADCALL |lcp| (SPADCALL |cfR| (QREFELT $ 55))
                             (QREFELT $ 62))
                   (SPADCALL (ELT $ 39) (SPADCALL |cfR| (QREFELT $ 63))
                             (QREFELT $ 49))
                   (QREFELT $ 61))
                  . #8#)
            (LETT |p| (SPADCALL |lcp| |p| (QREFELT $ 60)) . #8#)
            (SEQ G190
                 (COND
                  ((NULL
                    (COND ((SPADCALL |lv| NIL (QREFELT $ 64)) 'NIL) ('T 'T)))
                   #9=(GO G191)))
                 (SEQ
                  (EXIT
                   (SEQ (LETT |v| (|SPADfirst| |lv|) . #8#)
                        (LETT |r| (|SPADfirst| |lr|) . #8#)
                        (LETT |lv| (CDR |lv|) . #8#)
                        (LETT |lr| (CDR |lr|) . #8#)
                        (LETT |thisp|
                              (SPADCALL
                               (CONS #'|GENPGCD;lift!0| (VECTOR $ |lr| |lv|))
                               |p| (QREFELT $ 66))
                              . #8#)
                        (LETT |d|
                              (PROGN
                               (LETT #4# NIL . #8#)
                               (SEQ (LETT |c| NIL . #8#)
                                    (LETT #7# (SPADCALL |p| (QREFELT $ 68))
                                          . #8#)
                                    G190
                                    (COND
                                     ((OR (ATOM #7#)
                                          (PROGN
                                           (LETT |c| (CAR #7#) . #8#)
                                           NIL))
                                      #9#))
                                    (SEQ
                                     (EXIT
                                      (PROGN
                                       (LETT #6#
                                             (SPADCALL |c| |v| (QREFELT $ 69))
                                             . #8#)
                                       (COND
                                        (#4# (LETT #5# (MAX #5# #6#) . #8#))
                                        ('T
                                         (PROGN
                                          (LETT #5# #6# . #8#)
                                          (LETT #4# 'T . #8#)))))))
                                    (LETT #7# (CDR #7#) . #8#) #10=(GO G190)
                                    G191 (EXIT NIL))
                               (COND (#4# #5#) ('T (|IdentityError| '|max|))))
                              . #8#)
                        (LETT |prime|
                              (SPADCALL (SPADCALL |v| (QREFELT $ 70))
                                        (SPADCALL |r| (QREFELT $ 39))
                                        (QREFELT $ 71))
                              . #8#)
                        (LETT |pn| |prime| . #8#)
                        (LETT |origFactors| (LIST |g| |cf|) . #8#)
                        (SEQ
                         (EXIT
                          (SEQ (LETT |n| 1 . #8#) G190
                               (COND ((QSGREATERP |n| |d|) #9#))
                               (SEQ
                                (LETT |Ecart|
                                      (SPADCALL
                                       (SPADCALL |thisp|
                                                 (SPADCALL |g| |cf|
                                                           (QREFELT $ 24))
                                                 (QREFELT $ 31))
                                       |pn| (QREFELT $ 72))
                                      . #8#)
                                (EXIT
                                 (COND
                                  ((QEQCAR |Ecart| 1)
                                   (|error|
                                    "failed lifting in hensel in Complex Polynomial GCD"))
                                  ((SPADCALL (QCDR |Ecart|) (QREFELT $ 12))
                                   (PROGN
                                    (LETT #3# |$NoValue| . #8#)
                                    (GO #3#)))
                                  ('T
                                   (SEQ
                                    (LETT |step|
                                          (SPADCALL |origFactors|
                                                    (SPADCALL
                                                     (CONS #'|GENPGCD;lift!1|
                                                           (VECTOR $ |r| |v|))
                                                     (QCDR |Ecart|)
                                                     (QREFELT $ 66))
                                                    (QREFELT $ 76))
                                          . #8#)
                                    (EXIT
                                     (COND
                                      ((QEQCAR |step| 1)
                                       (PROGN
                                        (LETT #2# (CONS 1 "failed") . #8#)
                                        (GO #2#)))
                                      ('T
                                       (SEQ
                                        (LETT |g|
                                              (SPADCALL |g|
                                                        (SPADCALL |pn|
                                                                  (|SPADfirst|
                                                                   (QCDR
                                                                    |step|))
                                                                  (QREFELT $
                                                                           60))
                                                        (QREFELT $ 61))
                                              . #8#)
                                        (LETT |cf|
                                              (SPADCALL |cf|
                                                        (SPADCALL |pn|
                                                                  (SPADCALL
                                                                   (QCDR
                                                                    |step|)
                                                                   (QREFELT $
                                                                            78))
                                                                  (QREFELT $
                                                                           60))
                                                        (QREFELT $ 61))
                                              . #8#)
                                        (EXIT
                                         (LETT |pn|
                                               (SPADCALL |pn| |prime|
                                                         (QREFELT $ 79))
                                               . #8#)))))))))))
                               (LETT |n| (QSADD1 |n|) . #8#) #10# G191
                               (EXIT NIL)))
                         #3# (EXIT #3#))
                        (EXIT
                         (COND
                          ((NULL
                            (SPADCALL |thisp|
                                      (SPADCALL |g| |cf| (QREFELT $ 24))
                                      (QREFELT $ 30)))
                           (PROGN
                            (LETT #1#
                                  (PROGN
                                   (LETT #2# (CONS 1 "failed") . #8#)
                                   (GO #2#))
                                  . #8#)
                            (GO #1#)))))))
                  #1# (EXIT #1#))
                 NIL #10# G191 (EXIT NIL))
            (EXIT (CONS 0 |g|))))
      #2# (EXIT #2#))))) 

(DEFUN |GENPGCD;lift!1| (|x| $$)
  (PROG (|v| |r| $)
    (LETT |v| (QREFELT $$ 2) . #1=(|GENPGCD;lift|))
    (LETT |r| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (SPADCALL |x| |v| |r| (QREFELT $ 73)))))) 

(DEFUN |GENPGCD;lift!0| (|x| $$)
  (PROG (|lv| |lr| $)
    (LETT |lv| (QREFELT $$ 2) . #1=(|GENPGCD;lift|))
    (LETT |lr| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (SPADCALL |x| |lv| |lr| (QREFELT $ 53)))))) 

(DEFUN |GENPGCD;recursivelyGCDCoefficients| (|g| |v| |p| |pv| $)
  (PROG (|oldv| #1=#:G823 |oldg| |p1| |i| |d| #2=#:G817 #3=#:G816 #4=#:G818
         #5=#:G824 |u| |mv|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (LETT |mv| (|SPADfirst| |pv|)
              . #6=(|GENPGCD;recursivelyGCDCoefficients|))
        (LETT |pv| (CDR |pv|) . #6#)
        (LETT |d|
              (PROGN
               (LETT #2# NIL . #6#)
               (SEQ (LETT |u| NIL . #6#)
                    (LETT #5# (SPADCALL |p| (QREFELT $ 68)) . #6#) G190
                    (COND
                     ((OR (ATOM #5#) (PROGN (LETT |u| (CAR #5#) . #6#) NIL))
                      #7=(GO G191)))
                    (SEQ
                     (EXIT
                      (PROGN
                       (LETT #4# (SPADCALL |u| |mv| (QREFELT $ 69)) . #6#)
                       (COND (#2# (LETT #3# (MAX #3# #4#) . #6#))
                             ('T
                              (PROGN
                               (LETT #3# #4# . #6#)
                               (LETT #2# 'T . #6#)))))))
                    (LETT #5# (CDR #5#) . #6#) #8=(GO G190) G191 (EXIT NIL))
               (COND (#2# #3#) ('T (|IdentityError| '|max|))))
              . #6#)
        (SEQ (LETT |i| 0 . #6#) G190 (COND ((QSGREATERP |i| |d|) #7#))
             (SEQ
              (LETT |p1|
                    (SPADCALL
                     (CONS #'|GENPGCD;recursivelyGCDCoefficients!0|
                           (VECTOR $ |i| |mv|))
                     |p| (QREFELT $ 66))
                    . #6#)
              (LETT |oldg| |g| . #6#)
              (COND
               ((SPADCALL |pv| NIL (QREFELT $ 64))
                (LETT |g| (|GENPGCD;gcdSameVariables| |g| |p1| |v| $) . #6#))
               ('T
                (LETT |g|
                      (|GENPGCD;recursivelyGCDCoefficients| |p| |v| |p1| |pv|
                       $)
                      . #6#)))
              (EXIT
               (COND
                ((SPADCALL |g| (|spadConstant| $ 29) (QREFELT $ 30))
                 (PROGN (LETT #1# (|spadConstant| $ 29) . #6#) (GO #1#)))
                ((NULL (SPADCALL |g| |oldg| (QREFELT $ 30)))
                 (SEQ (LETT |oldv| |v| . #6#)
                      (LETT |v| (|GENPGCD;variables| |g| $) . #6#)
                      (EXIT
                       (LETT |pv|
                             (SPADCALL |pv|
                                       (SPADCALL |v| |oldv| (QREFELT $ 26))
                                       (QREFELT $ 81))
                             . #6#)))))))
             (LETT |i| (QSADD1 |i|) . #6#) #8# G191 (EXIT NIL))
        (EXIT |g|)))
      #1# (EXIT #1#))))) 

(DEFUN |GENPGCD;recursivelyGCDCoefficients!0| (|x| $$)
  (PROG (|mv| |i| $)
    (LETT |mv| (QREFELT $$ 2) . #1=(|GENPGCD;recursivelyGCDCoefficients|))
    (LETT |i| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (SPADCALL |x| |mv| |i| (QREFELT $ 80)))))) 

(DEFUN |GENPGCD;flatten| (|p1| |lv| $)
  (PROG (|lr| #1=#:G835 |vv| #2=#:G834 |ans| |dg| #3=#:G833 #4=#:G832)
    (RETURN
     (SEQ
      (COND ((EQL (LENGTH |lv|) 0) |p1|)
            ('T
             (SEQ
              (LETT |lr|
                    (PROGN
                     (LETT #4# NIL . #5=(|GENPGCD;flatten|))
                     (SEQ (LETT |vv| NIL . #5#) (LETT #3# |lv| . #5#) G190
                          (COND
                           ((OR (ATOM #3#)
                                (PROGN (LETT |vv| (CAR #3#) . #5#) NIL))
                            #6=(GO G191)))
                          (SEQ
                           (EXIT
                            (LETT #4# (CONS (SPADCALL (QREFELT $ 36)) #4#)
                                  . #5#)))
                          (LETT #3# (CDR #3#) . #5#) #7=(GO G190) G191
                          (EXIT (NREVERSE0 #4#))))
                    . #5#)
              (LETT |dg| (SPADCALL |p1| (QREFELT $ 18)) . #5#)
              (SEQ G190
                   (COND
                    ((NULL
                      (COND
                       ((EQL |dg|
                             (SPADCALL
                              (LETT |ans|
                                    (SPADCALL
                                     (CONS #'|GENPGCD;flatten!0|
                                           (VECTOR $ |lr| |lv|))
                                     |p1| (QREFELT $ 66))
                                    . #5#)
                              (QREFELT $ 18)))
                        'NIL)
                       ('T 'T)))
                     #6#))
                   (SEQ
                    (EXIT
                     (LETT |lr|
                           (PROGN
                            (LETT #2# NIL . #5#)
                            (SEQ (LETT |vv| NIL . #5#) (LETT #1# |lv| . #5#)
                                 G190
                                 (COND
                                  ((OR (ATOM #1#)
                                       (PROGN (LETT |vv| (CAR #1#) . #5#) NIL))
                                   #6#))
                                 (SEQ
                                  (EXIT
                                   (LETT #2#
                                         (CONS (SPADCALL (QREFELT $ 36)) #2#)
                                         . #5#)))
                                 (LETT #1# (CDR #1#) . #5#) #7# G191
                                 (EXIT (NREVERSE0 #2#))))
                           . #5#)))
                   NIL #7# G191 (EXIT NIL))
              (EXIT |ans|)))))))) 

(DEFUN |GENPGCD;flatten!0| (|x| $$)
  (PROG (|lv| |lr| $)
    (LETT |lv| (QREFELT $$ 2) . #1=(|GENPGCD;flatten|))
    (LETT |lr| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (SPADCALL |x| |lv| |lr| (QREFELT $ 53)))))) 

(DEFUN |GENPGCD;variables| (|p1| $)
  (PROG (#1=#:G837 #2=#:G836 #3=#:G838 #4=#:G840 |u|)
    (RETURN
     (SEQ
      (SPADCALL
       (PROGN
        (LETT #1# NIL . #5=(|GENPGCD;variables|))
        (SEQ (LETT |u| NIL . #5#)
             (LETT #4# (SPADCALL |p1| (QREFELT $ 68)) . #5#) G190
             (COND
              ((OR (ATOM #4#) (PROGN (LETT |u| (CAR #4#) . #5#) NIL))
               (GO G191)))
             (SEQ
              (EXIT
               (PROGN
                (LETT #3# (SPADCALL |u| (QREFELT $ 82)) . #5#)
                (COND (#1# (LETT #2# (SPADCALL #2# #3# (QREFELT $ 83)) . #5#))
                      ('T (PROGN (LETT #2# #3# . #5#) (LETT #1# 'T . #5#)))))))
             (LETT #4# (CDR #4#) . #5#) (GO G190) G191 (EXIT NIL))
        (COND (#1# #2#) ('T (|IdentityError| '|concat|))))
       (QREFELT $ 84)))))) 

(DEFUN |GENPGCD;gcdTrivial| (|p1| |p2| $)
  (PROG (|un?| |cp1|)
    (RETURN
     (SEQ
      (LETT |cp1| (SPADCALL |p1| (QREFELT $ 50)) . #1=(|GENPGCD;gcdTrivial|))
      (EXIT
       (COND
        ((SPADCALL |cp1| (|spadConstant| $ 28) (QREFELT $ 85))
         (|spadConstant| $ 29))
        ((EQL (SPADCALL |p2| (QREFELT $ 18)) 0)
         (SPADCALL
          (SPADCALL |cp1| (SPADCALL |p2| (QREFELT $ 50)) (QREFELT $ 51))
          (QREFELT $ 86)))
        (#2='T
         (SEQ (LETT |un?| (SPADCALL |cp1| (QREFELT $ 87)) . #1#)
              (SEQ G190
                   (COND
                    ((NULL
                      (COND ((OR (SPADCALL |p2| (QREFELT $ 12)) |un?|) 'NIL)
                            ('T 'T)))
                     (GO G191)))
                   (SEQ
                    (LETT |cp1|
                          (SPADCALL (SPADCALL |p2| (QREFELT $ 50)) |cp1|
                                    (QREFELT $ 51))
                          . #1#)
                    (LETT |un?| (SPADCALL |cp1| (QREFELT $ 87)) . #1#)
                    (EXIT (LETT |p2| (SPADCALL |p2| (QREFELT $ 88)) . #1#)))
                   NIL (GO G190) G191 (EXIT NIL))
              (EXIT
               (COND (|un?| (|spadConstant| $ 29))
                     (#2# (SPADCALL |cp1| (QREFELT $ 86))))))))))))) 

(DEFUN |GENPGCD;monomContentSup| (|u| $)
  (PROG (|md|)
    (RETURN
     (SEQ
      (COND ((EQL (SPADCALL |u| (QREFELT $ 18)) 0) (|spadConstant| $ 29))
            ('T
             (SEQ
              (LETT |md| (SPADCALL |u| (QREFELT $ 89))
                    |GENPGCD;monomContentSup|)
              (EXIT
               (SPADCALL
                (SPADCALL
                 (SPADCALL (CONS (|function| |GENPGCD;better|) $)
                           (SPADCALL |u| (QREFELT $ 68)) (QREFELT $ 91))
                 (QREFELT $ 93))
                (SPADCALL (|spadConstant| $ 28) |md| (QREFELT $ 62))
                (QREFELT $ 60)))))))))) 

(DEFUN |GENPGCD;better| (|p1| |p2| $)
  (PROG (#1=#:G856)
    (RETURN
     (COND ((SPADCALL |p1| (QREFELT $ 94)) 'T)
           ((SPADCALL |p2| (QREFELT $ 94)) 'NIL)
           ('T
            (<
             (SPADCALL |p1|
                       (PROG2
                           (LETT #1# (SPADCALL |p1| (QREFELT $ 96))
                                 . #2=(|GENPGCD;better|))
                           (QCDR #1#)
                         (|check-union| (QEQCAR #1# 0) (QREFELT $ 7) #1#))
                       (QREFELT $ 69))
             (SPADCALL |p2|
                       (PROG2
                           (LETT #1# (SPADCALL |p2| (QREFELT $ 96)) . #2#)
                           (QCDR #1#)
                         (|check-union| (QEQCAR #1# 0) (QREFELT $ 7) #1#))
                       (QREFELT $ 69)))))))) 

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

(DEFUN |GeneralPolynomialGcdPackage;| (|#1| |#2| |#3| |#4|)
  (PROG (|pv$| $ |dv$| DV$4 DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|GeneralPolynomialGcdPackage|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT DV$3 (|devaluate| |#3|) . #1#)
      (LETT DV$4 (|devaluate| |#4|) . #1#)
      (LETT |dv$| (LIST '|GeneralPolynomialGcdPackage| DV$1 DV$2 DV$3 DV$4)
            . #1#)
      (LETT $ (GETREFV 97) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|GeneralPolynomialGcdPackage|
                  (LIST DV$1 DV$2 DV$3 DV$4) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 |#4|)
      (COND
       ((|HasCategory| |#3| '(|StepThrough|))
        (PROGN
         (QSETREFV $ 34 (|spadConstant| $ 33))
         (QSETREFV $ 36 (CONS (|dispatchFunction| |GENPGCD;randomR;R;2|) $))))
       ('T
        (QSETREFV $ 36 (CONS (|dispatchFunction| |GENPGCD;randomR;R;3|) $))))
      $)))) 

(MAKEPROP '|GeneralPolynomialGcdPackage| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) (|local| |#4|) (|Boolean|)
              (|SparseUnivariatePolynomial| 9) (0 . |zero?|) (5 . |Zero|)
              (9 . |Zero|) (13 . |Zero|) (17 . |Zero|) (|NonNegativeInteger|)
              (21 . |degree|) (|Union| $ '"failed") (26 . |exquo|)
              (|Record| (|:| |unit| $) (|:| |canonical| $) (|:| |associate| $))
              (32 . |unitNormal|) (37 . |gcd|) (43 . *) (|List| 7)
              (49 . |setDifference|) (55 . |One|) (59 . |One|) (63 . |One|)
              (67 . =) (73 . -) |GENPGCD;gcdPolynomial;3Sup;1| (79 . |init|)
              '|randomCount| (83 . |nextItem|) (88 . |randomR|) (|Integer|)
              (92 . |coerce|) (97 . |coerce|) (102 . |ground|)
              (|SparseUnivariatePolynomial| 8) (|Mapping| 8 9)
              (|UnivariatePolynomialCategoryFunctions2| 9 11 8 41)
              (107 . |map|) (|SparseUnivariatePolynomial| $)
              (113 . |gcdPolynomial|) (|Mapping| 9 8)
              (|UnivariatePolynomialCategoryFunctions2| 8 41 9 11)
              (119 . |map|) (125 . |leadingCoefficient|) (130 . |gcd|)
              (|List| 8) (136 . |eval|) (143 . |zero?|) (148 . |degree|)
              (153 . |exquo|) (159 . |gcd|) (165 . *) (171 . +) (177 . *)
              (183 . +) (189 . |monomial|) (195 . |reductum|) (200 . =)
              (|Mapping| 9 9) (206 . |map|) (|List| 9) (212 . |coefficients|)
              (217 . |degree|) (223 . |coerce|) (228 . -) (234 . |exquo|)
              (240 . |eval|) (|Union| 75 '"failed") (|List| 45)
              (247 . |solveLinearPolynomialEquation|) (|List| 11)
              (253 . |second|) (258 . *) (264 . |coefficient|)
              (271 . |setUnion|) (277 . |variables|) (282 . |concat|)
              (288 . |removeDuplicates|) (293 . =) (299 . |coerce|)
              (304 . |unit?|) (309 . |reductum|) (314 . |minimumDegree|)
              (|Mapping| 10 9 9) (319 . |sort|) (|List| $) (325 . |gcd|)
              (330 . |ground?|) (|Union| 7 '"failed") (335 . |mainVariable|))
           '#(|randomR| 340 |gcdPolynomial| 344) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 96
                                                 '(1 11 10 0 12 0 6 0 13 0 8 0
                                                   14 0 9 0 15 0 11 0 16 1 11
                                                   17 0 18 2 11 19 0 0 20 1 11
                                                   21 0 22 2 11 0 0 0 23 2 11 0
                                                   0 0 24 2 25 0 0 0 26 0 8 0
                                                   27 0 9 0 28 0 11 0 29 2 11
                                                   10 0 0 30 2 11 0 0 0 31 0 8
                                                   0 33 1 8 19 0 35 0 0 8 36 1
                                                   8 0 37 38 1 9 0 8 39 1 9 8 0
                                                   40 2 43 41 42 11 44 2 8 45
                                                   45 45 46 2 48 11 47 41 49 1
                                                   11 9 0 50 2 9 0 0 0 51 3 9 0
                                                   0 25 52 53 1 9 10 0 54 1 41
                                                   17 0 55 2 41 19 0 0 56 2 41
                                                   0 0 0 57 2 41 0 8 0 58 2 41
                                                   0 0 0 59 2 11 0 9 0 60 2 11
                                                   0 0 0 61 2 11 0 9 17 62 1 41
                                                   0 0 63 2 25 10 0 0 64 2 11 0
                                                   65 0 66 1 11 67 0 68 2 9 17
                                                   0 7 69 1 9 0 7 70 2 9 0 0 0
                                                   71 2 11 19 0 9 72 3 9 0 0 7
                                                   8 73 2 9 74 75 45 76 1 77 11
                                                   0 78 2 9 0 0 0 79 3 9 0 0 7
                                                   17 80 2 25 0 0 0 81 1 9 25 0
                                                   82 2 25 0 0 0 83 1 25 0 0 84
                                                   2 9 10 0 0 85 1 11 0 9 86 1
                                                   9 10 0 87 1 11 0 0 88 1 11
                                                   17 0 89 2 67 0 90 0 91 1 9 0
                                                   92 93 1 9 10 0 94 1 9 95 0
                                                   96 0 0 8 36 2 0 11 11 11
                                                   32)))))
           '|lookupComplete|)) 
