
(/VERSIONCHECK 2) 

(DEFUN |INTALG;F2UPR| (|f| $)
  (SPADCALL (|INTALG;F2R| |f| $) (QREFELT $ 20))) 

(DEFUN |INTALG;F2R| (|f| $)
  (SPADCALL (SPADCALL (SPADCALL |f| (QREFELT $ 21)) (QREFELT $ 23))
      (QREFELT $ 24))) 

(DEFUN |INTALG;algintexp| (|f| |derivation| $)
  (PROG (|c| |d| |v| |n| |vp| |vf| |i| #0=#:G1863 |r| |w| |ff| |h| |p|
             |u|)
    (RETURN
      (SEQ (LETT |d|
                 (QCDR (LETT |c| (SPADCALL |f| (QREFELT $ 26))
                             . #1=(|INTALG;algintexp|))) . #1#)
           (LETT |v| (QCAR |c|) . #1#)
           (LETT |vp|
                 (SPADCALL (LETT |n| (QVSIZE |v|) . #1#)
                     (|spadConstant| $ 28) (QREFELT $ 31)) . #1#)
           (LETT |vf|
                 (SPADCALL |n| (|spadConstant| $ 34) (QREFELT $ 36)) . #1#)
           (SEQ (LETT |i| (SPADCALL |v| (QREFELT $ 39)) . #1#)
                (LETT #0# (QVSIZE |v|) . #1#) G190
                (COND ((> |i| #0#) (GO G191)))
                (SEQ (LETT |r|
                           (SPADCALL
                               (SPADCALL
                                   (SPADCALL |v| |i| (QREFELT $ 40))
                                   |d| (QREFELT $ 41))
                               (QREFELT $ 43)) . #1#)
                     (SPADCALL |vf| |i| (QCDR |r|) (QREFELT $ 44))
                     (EXIT (SPADCALL |vp| |i| (QCAR |r|)
                               (QREFELT $ 45))))
                (LETT |i| (+ |i| 1) . #1#) (GO G190) G191 (EXIT NIL))
           (LETT |ff|
                 (SPADCALL |vf|
                     (LETT |w| (SPADCALL (QREFELT $ 47)) . #1#)
                     (QREFELT $ 48)) . #1#)
           (LETT |h| (SPADCALL |ff| |derivation| (QREFELT $ 52)) . #1#)
           (LETT |p|
                 (SPADCALL
                     (SPADCALL (CONS #'|INTALG;algintexp!0| $) |vp|
                         (QREFELT $ 56))
                     |w| (QREFELT $ 48)) . #1#)
           (COND
             ((SPADCALL (QCDR |h|) (QREFELT $ 58))
              (COND
                ((SPADCALL |p| (QREFELT $ 58))
                 (EXIT (SPADCALL (QCAR |h|) (QREFELT $ 60)))))))
           (LETT |u|
                 (|INTALG;alglogint| (QCDR |h|) |derivation| $) . #1#)
           (EXIT (COND
                   ((QEQCAR |u| 1)
                    (SPADCALL (QCAR |h|) NIL
                        (LIST (CONS (SPADCALL |p| (QCDR |h|)
                                     (QREFELT $ 61))
                                    (QREFELT $ 12)))
                        (QREFELT $ 66)))
                   ((SPADCALL |p| (QREFELT $ 58))
                    (SPADCALL (QCAR |h|) (QCDR |u|) NIL (QREFELT $ 66)))
                   ('T
                    (|error| "integrate: implementation incomplete (has polynomial part)")))))))) 

(DEFUN |INTALG;algintexp!0| (|#1| $) (SPADCALL |#1| (QREFELT $ 53))) 

(DEFUN |INTALG;algintprim| (|f| |derivation| $)
  (PROG (|h| |u|)
    (RETURN
      (SEQ (LETT |h| (SPADCALL |f| |derivation| (QREFELT $ 52))
                 . #0=(|INTALG;algintprim|))
           (EXIT (COND
                   ((SPADCALL (QCDR |h|) (QREFELT $ 58))
                    (SPADCALL (QCAR |h|) (QREFELT $ 60)))
                   ('T
                    (SEQ (LETT |u|
                               (|INTALG;alglogint| (QCDR |h|)
                                   |derivation| $) . #0#)
                         (EXIT (COND
                                 ((QEQCAR |u| 1)
                                  (SPADCALL (QCAR |h|) NIL
                                      (LIST
                                       (CONS (QCDR |h|) (QREFELT $ 12)))
                                      (QREFELT $ 66)))
                                 ('T
                                  (SPADCALL (QCAR |h|) (QCDR |u|) NIL
                                      (QREFELT $ 66))))))))))))) 

(DEFUN |INTALG;palglogint| (|f| |derivation| $)
  (PROG (|rec| |r| |u| |lf| |fc| #0=#:G1947 |q| #1=#:G1948 |la|
               #2=#:G1949 |b| #3=#:G1950 |ld| |pp| #4=#:G1935 |bb| |cd|
               |g| |dv| #5=#:G1952 |a| #6=#:G1951 #7=#:G1940 #8=#:G1938
               #9=#:G1939 |dv0|)
    (RETURN
      (SEQ (LETT |rec| (SPADCALL |f| |derivation| (QREFELT $ 68))
                 . #10=(|INTALG;palglogint|))
           (EXIT (COND
                   ((SPADCALL
                        (LETT |r|
                              (SPADCALL |f| |derivation|
                                  (QREFELT $ 70)) . #10#)
                        (QREFELT $ 71))
                    (CONS 1 "failed"))
                   ('T
                    (SEQ (LETT |u|
                               (SPADCALL |r| (QREFELT $ 74)) . #10#)
                         (EXIT (COND
                                 ((QEQCAR |u| 1)
                                  (|INTALG;nonQ| |rec| |r| $))
                                 ('T
                                  (SEQ (LETT |fc|
                                        (|INTALG;nonLinear|
                                         (LETT |lf|
                                          (SPADCALL (QCDR |u|)
                                           (QREFELT $ 78)) . #10#)
                                         $) . #10#)
                                       (EXIT
                                        (COND
                                          ((QEQCAR |fc| 1)
                                           (|error|
                                            "integrate: implementation incomplete (residue poly has multiple non-linear factors)"))
                                          ('T
                                           (SEQ
                                            (LETT |la|
                                             (PROGN
                                               (LETT #0# NIL . #10#)
                                               (SEQ
                                                (LETT |q| NIL . #10#)
                                                (LETT #1#
                                                 (SPADCALL (QCDR |fc|)
                                                  |lf| (QREFELT $ 79)) . #10#)
                                                G190
                                                (COND
                                                  ((OR (ATOM #1#)
                                                    (PROGN
                                                      (LETT |q|
                                                       (CAR #1#) . #10#)
                                                      NIL))
                                                   #11=(GO G191)))
                                                (SEQ
                                                 (EXIT
                                                  (LETT #0#
                                                   (CONS
                                                    (SPADCALL
                                                     (SPADCALL
                                                      (QCAR |q|) 0
                                                      (QREFELT $ 82))
                                                     (QREFELT $ 83))
                                                    #0#) . #10#)))
                                                (LETT #1#
                                                 (CDR #1#) . #10#)
                                                #12=(GO G190) G191
                                                (EXIT (NREVERSE0 #0#)))) . #10#)
                                            (LETT |ld|
                                             (PROGN
                                               (LETT #2# NIL . #10#)
                                               (SEQ
                                                (LETT |b| NIL . #10#)
                                                (LETT #3# |la| . #10#)
                                                G190
                                                (COND
                                                  ((OR (ATOM #3#)
                                                    (PROGN
                                                      (LETT |b|
                                                       (CAR #3#) . #10#)
                                                      NIL))
                                                   #11#))
                                                (SEQ
                                                 (EXIT
                                                  (LETT #2#
                                                   (CONS
                                                    (SPADCALL
                                                     (QVELT |rec| 0)
                                                     (QVELT |rec| 1)
                                                     (QVELT |rec| 2)
                                                     (QVELT |rec| 3)
                                                     (SPADCALL |b|
                                                      (QREFELT $ 84))
                                                     (QREFELT $ 86))
                                                    #2#) . #10#)))
                                                (LETT #3#
                                                 (CDR #3#) . #10#)
                                                #12# G191
                                                (EXIT (NREVERSE0 #2#)))) . #10#)
                                            (LETT |pp|
                                             (|INTALG;UPQ2F|
                                              (QCAR (QCDR |fc|)) $) . #10#)
                                            (EXIT
                                             (COND
                                               ((SPADCALL
                                                 (LETT |bb|
                                                  (SPADCALL
                                                   (QCAR (QCDR |fc|))
                                                   (PROG1
                                                    (LETT #4#
                                                     (-
                                                      (SPADCALL
                                                       (QCAR
                                                        (QCDR |fc|))
                                                       (QREFELT $ 87))
                                                      1) . #10#)
                                                     (|check-subtype|
                                                      (>= #4# 0)
                                                      '(|NonNegativeInteger|)
                                                      #4#))
                                                   (QREFELT $ 82)) . #10#)
                                                 (QREFELT $ 89))
                                                (SEQ
                                                 (LETT |cd|
                                                  (SPADCALL |la|
                                                   (QREFELT $ 93)) . #10#)
                                                 (LETT |g|
                                                  (SPADCALL (QCAR |cd|)
                                                   (QREFELT $ 95)) . #10#)
                                                 (LETT |dv0|
                                                  (PROGN
                                                    (LETT #9#
                                                     NIL . #10#)
                                                    (SEQ
                                                     (LETT |dv|
                                                      NIL . #10#)
                                                     (LETT #5#
                                                      |ld| . #10#)
                                                     (LETT |a|
                                                      NIL . #10#)
                                                     (LETT #6#
                                                      (QCAR |cd|) . #10#)
                                                     G190
                                                     (COND
                                                       ((OR (ATOM #6#)
                                                         (PROGN
                                                           (LETT |a|
                                                            (CAR #6#) . #10#)
                                                           NIL)
                                                         (ATOM #5#)
                                                         (PROGN
                                                           (LETT |dv|
                                                            (CAR #5#) . #10#)
                                                           NIL))
                                                        #11#))
                                                     (SEQ
                                                      (EXIT
                                                       (PROGN
                                                         (LETT #7#
                                                          (SPADCALL
                                                           (QUOTIENT2
                                                            |a| |g|)
                                                           |dv|
                                                           (QREFELT $
                                                            96)) . #10#)
                                                         (COND
                                                           (#9#
                                                            (LETT #8#
                                                             (SPADCALL
                                                              #8# #7#
                                                              (QREFELT
                                                               $ 97)) . #10#))
                                                           ('T
                                                            (PROGN
                                                              (LETT #8#
                                                               #7# . #10#)
                                                              (LETT #9#
                                                               'T . #10#)))))))
                                                     (LETT #6#
                                                      (PROG1 (CDR #6#)
                                                        (LETT #5#
                                                         (CDR #5#) . #10#)) . #10#)
                                                     #12# G191
                                                     (EXIT NIL))
                                                    (COND
                                                      (#9# #8#)
                                                      ('T
                                                       (|spadConstant|
                                                        $ 98)))) . #10#)
                                                 (EXIT
                                                  (|INTALG;trace0|
                                                   |rec| |pp|
                                                   (SPADCALL |g|
                                                    (QCDR |cd|)
                                                    (QREFELT $ 99))
                                                   |dv0| $))))
                                               ('T
                                                (|INTALG;trace1| |rec|
                                                 |pp| |la| |ld| |bb| $)))))))))))))))))))) 

(DEFUN |INTALG;UPQ2F| (|p| $)
  (SPADCALL (CONS #'|INTALG;UPQ2F!0| $) |p| (QREFELT $ 102))) 

(DEFUN |INTALG;UPQ2F!0| (|#1| $) (SPADCALL |#1| (QREFELT $ 84))) 

(DEFUN |INTALG;UP2SUP| (|p| $)
  (SPADCALL (LIST #'|INTALG;UP2SUP!0|) |p| (QREFELT $ 106))) 

(DEFUN |INTALG;UP2SUP!0| (|#1| $$) |#1|) 

(DEFUN |INTALG;SUP2UP| (|p| $)
  (SPADCALL (LIST #'|INTALG;SUP2UP!0|) |p| (QREFELT $ 108))) 

(DEFUN |INTALG;SUP2UP!0| (|#1| $$) |#1|) 

(DEFUN |INTALG;varRoot?| (|p| |derivation| $)
  (PROG (|c| #0=#:G1962 #1=#:G1961 #2=#:G1959)
    (RETURN
      (SEQ (EXIT (SEQ (SEQ (EXIT (SEQ (LETT |c| NIL
                                       . #3=(|INTALG;varRoot?|))
                                      (LETT #0#
                                       (SPADCALL
                                        (SPADCALL |p| (QREFELT $ 109))
                                        (QREFELT $ 111)) . #3#)
                                      G190
                                      (COND
                                        ((OR (ATOM #0#)
                                          (PROGN
                                            (LETT |c| (CAR #0#) . #3#)
                                            NIL))
                                         (GO G191)))
                                      (SEQ
                                       (EXIT
                                        (COND
                                          ((NULL
                                            (SPADCALL
                                             (SPADCALL |c|
                                              |derivation|)
                                             (|spadConstant| $ 33)
                                             (QREFELT $ 112)))
                                           (PROGN
                                             (LETT #2#
                                              (PROGN
                                                (LETT #1# 'T . #3#)
                                                (GO #1#)) . #3#)
                                             (GO #2#))))))
                                      (LETT #0# (CDR #0#) . #3#)
                                      (GO G190) G191 (EXIT NIL)))
                           #2# (EXIT #2#))
                      (EXIT 'NIL)))
           #1# (EXIT #1#))))) 

(DEFUN |INTALG;pLogDeriv| (|log| |derivation| $)
  (PROG (|n| |c| |numlog| |diflog| |i| #0=#:G1981 |algans| |ans|)
    (RETURN
      (SEQ (COND
             ((NULL (SPADCALL
                        (SPADCALL |derivation| (QVELT |log| 1)
                            (QREFELT $ 114))
                        (|spadConstant| $ 115) (QREFELT $ 116)))
              (|error| "can only handle logs with constant coefficients"))
             ('T
              (SEQ (LETT |n| (SPADCALL (QVELT |log| 1) (QREFELT $ 117))
                         . #1=(|INTALG;pLogDeriv|))
                   (EXIT (COND
                           ((EQL |n| 1)
                            (SEQ (LETT |c|
                                       (SPADCALL
                                        (SPADCALL
                                         (SPADCALL
                                          (SPADCALL (QVELT |log| 1)
                                           (QREFELT $ 119))
                                          (QREFELT $ 120))
                                         (SPADCALL (QVELT |log| 1)
                                          (QREFELT $ 120))
                                         (QREFELT $ 121))
                                        (QREFELT $ 122)) . #1#)
                                 (LETT |ans|
                                       (SPADCALL (QVELT |log| 2) |c|
                                        (QREFELT $ 123)) . #1#)
                                 (EXIT (SPADCALL
                                        (SPADCALL
                                         (SPADCALL
                                          (SPADCALL (QVELT |log| 0)
                                           (QREFELT $ 124))
                                          |c| (QREFELT $ 125))
                                         (SPADCALL |ans| |derivation|)
                                         (QREFELT $ 125))
                                        |ans| (QREFELT $ 121)))))
                           (#2='T
                            (SEQ (LETT |numlog|
                                       (SPADCALL |derivation|
                                        (QVELT |log| 2)
                                        (QREFELT $ 114)) . #1#)
                                 (LETT |diflog|
                                       (SPADCALL (QVELT |log| 2)
                                        (QVELT |log| 1) |numlog|
                                        (QREFELT $ 128)) . #1#)
                                 (EXIT (COND
                                         ((QEQCAR |diflog| 1)
                                          (|error|
                                           "this shouldn't happen"))
                                         (#2#
                                          (SEQ
                                           (LETT |algans|
                                            (QCAR (QCDR |diflog|)) . #1#)
                                           (LETT |ans|
                                            (|spadConstant| $ 11) . #1#)
                                           (SEQ (LETT |i| 0 . #1#)
                                            (LETT #0# (- |n| 1) . #1#)
                                            G190
                                            (COND
                                              ((QSGREATERP |i| #0#)
                                               (GO G191)))
                                            (SEQ
                                             (LETT |algans|
                                              (SPADCALL
                                               (SPADCALL |algans|
                                                (SPADCALL
                                                 (|spadConstant| $ 129)
                                                 1 (QREFELT $ 130))
                                                (QREFELT $ 131))
                                               (QVELT |log| 1)
                                               (QREFELT $ 132)) . #1#)
                                             (EXIT
                                              (LETT |ans|
                                               (SPADCALL |ans|
                                                (SPADCALL |algans| |i|
                                                 (QREFELT $ 133))
                                                (QREFELT $ 61)) . #1#)))
                                            (LETT |i|
                                             (QSADD1 |i|) . #1#)
                                            (GO G190) G191 (EXIT NIL))
                                           (EXIT
                                            (SPADCALL
                                             (SPADCALL (QVELT |log| 0)
                                              (QREFELT $ 124))
                                             |ans| (QREFELT $ 125)))))))))))))))))) 

(DEFUN |INTALG;R2UP| (|f| |k| $)
  (PROG (|x| |y| |g|)
    (RETURN
      (SEQ (LETT |x| (SPADCALL (QREFELT $ 17) (QREFELT $ 135))
                 . #0=(|INTALG;R2UP|))
           (LETT |g|
                 (SPADCALL
                     (SPADCALL (CONS #'|INTALG;R2UP!0| (VECTOR $ |x|))
                         (SPADCALL |f| (QREFELT $ 138))
                         (QREFELT $ 141))
                     (LETT |y|
                           (SPADCALL (QREFELT $ 18) (QREFELT $ 135)) . #0#)
                     (QREFELT $ 142)) . #0#)
           (EXIT (SPADCALL
                     (CONS #'|INTALG;R2UP!1|
                           (VECTOR $ (QREFELT $ 18) (QREFELT $ 17)))
                     (SPADCALL |g| |k| (SPADCALL |k| (QREFELT $ 144))
                         (QREFELT $ 146))
                     (QREFELT $ 149))))))) 

(DEFUN |INTALG;R2UP!1| (|#1| $$)
  (|INTALG;rlift| |#1| (QREFELT $$ 2) (QREFELT $$ 1) (QREFELT $$ 0))) 

(DEFUN |INTALG;R2UP!0| (|#1| $$)
  (SPADCALL |#1| (QREFELT $$ 1) (QREFELT (QREFELT $$ 0) 137))) 

(DEFUN |INTALG;univ| (|f| |k| $)
  (PROG (|g|)
    (RETURN
      (SEQ (LETT |g| (SPADCALL |f| |k| (QREFELT $ 151)) |INTALG;univ|)
           (EXIT (SPADCALL
                     (|INTALG;SUP2UP| (SPADCALL |g| (QREFELT $ 153)) $)
                     (|INTALG;SUP2UP| (SPADCALL |g| (QREFELT $ 154)) $)
                     (QREFELT $ 41))))))) 

(DEFUN |INTALG;rlift| (|f| |kx| |ky| $)
  (SPADCALL
      (SPADCALL (CONS #'|INTALG;rlift!0| (VECTOR $ |kx|))
          (SPADCALL (SPADCALL |f| |ky| (QREFELT $ 151))
              (QREFELT $ 155))
          (QREFELT $ 158))
      (QREFELT $ 159))) 

(DEFUN |INTALG;rlift!0| (|#1| $$)
  (|INTALG;univ| |#1| (QREFELT $$ 1) (QREFELT $$ 0))) 

(DEFUN |INTALG;nonQ| (|rec| |p| $)
  (PROG (|lf|)
    (RETURN
      (COND
        ((NULL (CDR (LETT |lf|
                          (SPADCALL
                              (SPADCALL (SPADCALL |p| (QREFELT $ 109))
                                  (QREFELT $ 161))
                              (QREFELT $ 164))
                          |INTALG;nonQ|)))
         (|INTALG;trace00| |rec| (QCAR (|SPADfirst| |lf|)) NIL $))
        ('T
         (|error| "integrate: implementation incomplete (non-algebraic residues)")))))) 

(DEFUN |INTALG;trace0| (|rec| |q| |r| |dv0| $)
  (PROG (|rc0| |lg|)
    (RETURN
      (SEQ (LETT |lg|
                 (COND
                   ((SPADCALL |dv0| (QREFELT $ 165)) NIL)
                   ('T
                    (SEQ (LETT |rc0| (SPADCALL |dv0| (QREFELT $ 169))
                               . #0=(|INTALG;trace0|))
                         (EXIT (COND
                                 ((QEQCAR |rc0| 1)
                                  (|error| "Not integrable (provided residues have no relations)"))
                                 ('T
                                  (|INTALG;mkLog|
                                      (|spadConstant| $ 170)
                                      (SPADCALL |r|
                                       (SPADCALL (QCAR (QCDR |rc0|))
                                        (QREFELT $ 171))
                                       (QREFELT $ 172))
                                      (QCDR (QCDR |rc0|))
                                      (|spadConstant| $ 118) $))))))) . #0#)
           (EXIT (|INTALG;trace00| |rec| |q| |lg| $)))))) 

(DEFUN |INTALG;trace00| (|rec| |pp| |lg| $)
  (PROG (|alpha0| |p0| #0=#:G2026 |q| |alpha| |dvr| |rc|)
    (RETURN
      (SEQ (LETT |p0|
                 (SPADCALL (QVELT |rec| 0) (QVELT |rec| 1)
                     (QVELT |rec| 2) (QVELT |rec| 3)
                     (LETT |alpha0|
                           (SPADCALL (|INTALG;UP2SUP| |pp| $)
                               (QREFELT $ 173))
                           . #1=(|INTALG;trace00|))
                     (QREFELT $ 86)) . #1#)
           (LETT |q|
                 (PROG2 (LETT #0#
                              (SPADCALL |pp|
                                  (SPADCALL
                                      (SPADCALL (|spadConstant| $ 118)
                                       1 (QREFELT $ 174))
                                      (SPADCALL |alpha0|
                                       (QREFELT $ 21))
                                      (QREFELT $ 175))
                                  (QREFELT $ 177)) . #1#)
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0) (QREFELT $ 8) #0#)) . #1#)
           (LETT |alpha|
                 (SPADCALL (|INTALG;UP2SUP| |q| $) (QREFELT $ 178)) . #1#)
           (LETT |dvr|
                 (SPADCALL
                     (SPADCALL (QVELT |rec| 0) (QVELT |rec| 1)
                         (QVELT |rec| 2) (QVELT |rec| 3) |alpha|
                         (QREFELT $ 86))
                     |p0| (QREFELT $ 179)) . #1#)
           (LETT |rc| (SPADCALL |dvr| (QREFELT $ 169)) . #1#)
           (EXIT (COND
                   ((QEQCAR |rc| 1)
                    (COND
                      ((NULL (< 2 (SPADCALL |pp| (QREFELT $ 180))))
                       (CONS 1 "failed"))
                      ('T
                       (|error| "Not integrable (provided residues have no relations)"))))
                   ('T
                    (CONS 0
                          (SPADCALL |lg|
                              (|INTALG;mkLog| |q|
                                  (SPADCALL
                                      (SPADCALL (QCAR (QCDR |rc|))
                                       (QREFELT $ 171))
                                      (QREFELT $ 181))
                                  (QCDR (QCDR |rc|)) |alpha| $)
                              (QREFELT $ 182)))))))))) 

(DEFUN |INTALG;trace1| (|rec| |q| |la| |ld| |b| $)
  (PROG (#0=#:G2054 #1=#:G2055 |cd| |dv| #2=#:G2057 |a| #3=#:G2056
            #4=#:G2045 #5=#:G2043 #6=#:G2044 |v0| |alpha| |v| |rc|)
    (RETURN
      (SEQ (LETT |cd|
                 (SPADCALL
                     (PROGN
                       (LETT #0# NIL . #7=(|INTALG;trace1|))
                       (SEQ (LETT |a| NIL . #7#) (LETT #1# |la| . #7#)
                            G190
                            (COND
                              ((OR (ATOM #1#)
                                   (PROGN
                                     (LETT |a| (CAR #1#) . #7#)
                                     NIL))
                               #8=(GO G191)))
                            (SEQ (EXIT (LETT #0#
                                        (CONS
                                         (SPADCALL |a| |b|
                                          (QREFELT $ 172))
                                         #0#) . #7#)))
                            (LETT #1# (CDR #1#) . #7#) #9=(GO G190)
                            G191 (EXIT (NREVERSE0 #0#))))
                     (QREFELT $ 93)) . #7#)
           (LETT |v0|
                 (PROGN
                   (LETT #6# NIL . #7#)
                   (SEQ (LETT |dv| NIL . #7#) (LETT #2# |ld| . #7#)
                        (LETT |a| NIL . #7#)
                        (LETT #3# (QCAR |cd|) . #7#) G190
                        (COND
                          ((OR (ATOM #3#)
                               (PROGN (LETT |a| (CAR #3#) . #7#) NIL)
                               (ATOM #2#)
                               (PROGN (LETT |dv| (CAR #2#) . #7#) NIL))
                           #8#))
                        (SEQ (EXIT (PROGN
                                     (LETT #4#
                                      (SPADCALL |a| |dv|
                                       (QREFELT $ 96)) . #7#)
                                     (COND
                                       (#6#
                                        (LETT #5#
                                         (SPADCALL #5# #4#
                                          (QREFELT $ 97)) . #7#))
                                       ('T
                                        (PROGN
                                          (LETT #5# #4# . #7#)
                                          (LETT #6# 'T . #7#)))))))
                        (LETT #3#
                              (PROG1 (CDR #3#)
                                (LETT #2# (CDR #2#) . #7#)) . #7#)
                        #9# G191 (EXIT NIL))
                   (COND (#6# #5#) (#10='T (|spadConstant| $ 98)))) . #7#)
           (LETT |alpha|
                 (SPADCALL (|INTALG;UP2SUP| |q| $) (QREFELT $ 178)) . #7#)
           (LETT |v|
                 (SPADCALL |v0|
                     (SPADCALL (QCDR |cd|)
                         (SPADCALL (QVELT |rec| 0) (QVELT |rec| 1)
                             (QVELT |rec| 2) (QVELT |rec| 3) |alpha|
                             (QREFELT $ 86))
                         (QREFELT $ 96))
                     (QREFELT $ 179)) . #7#)
           (LETT |rc| (SPADCALL |v| (QREFELT $ 169)) . #7#)
           (EXIT (COND
                   ((QEQCAR |rc| 1)
                    (COND
                      ((NULL (< 2 (SPADCALL |q| (QREFELT $ 180))))
                       (CONS 1 "failed"))
                      ('T
                       (|error| "Not integrable (provided residues have no relations)"))))
                   (#10#
                    (CONS 0
                          (|INTALG;mkLog| |q|
                              (SPADCALL
                                  (SPADCALL
                                      (-
                                       (* (QCAR (QCDR |rc|))
                                        (QCDR |cd|)))
                                      (QREFELT $ 171))
                                  (QREFELT $ 181))
                              (QCDR (QCDR |rc|)) |alpha| $))))))))) 

(DEFUN |INTALG;mkLog| (|q| |scalr| |lgd| |alpha| $)
  (COND
    ((NULL (< 1 (SPADCALL |q| (QREFELT $ 180))))
     (LIST (VECTOR |scalr|
                   (SPADCALL
                       (SPADCALL (|spadConstant| $ 129) 1
                           (QREFELT $ 130))
                       (|INTALG;F2UPR| |alpha| $) (QREFELT $ 185))
                   (SPADCALL |lgd| (QREFELT $ 20)))))
    ('T
     (LIST (VECTOR |scalr|
                   (SPADCALL (CONS (|function| |INTALG;F2R|) $) |q|
                       (QREFELT $ 187))
                   (|INTALG;R2UP| |lgd|
                       (SPADCALL |alpha| (QREFELT $ 188)) $)))))) 

(DEFUN |INTALG;nonLinear| (|l| $)
  (PROG (|q| #0=#:G2071 #1=#:G2070 |found| |ans|)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |found| 'NIL . #2=(|INTALG;nonLinear|))
                      (LETT |ans| (|SPADfirst| |l|) . #2#)
                      (SEQ (LETT |q| NIL . #2#) (LETT #0# |l| . #2#)
                           G190
                           (COND
                             ((OR (ATOM #0#)
                                  (PROGN
                                    (LETT |q| (CAR #0#) . #2#)
                                    NIL))
                              (GO G191)))
                           (SEQ (EXIT (COND
                                        ((< 1
                                          (SPADCALL (QCAR |q|)
                                           (QREFELT $ 87)))
                                         (COND
                                           (|found|
                                            (PROGN
                                              (LETT #1#
                                               (CONS 1 "failed") . #2#)
                                              (GO #1#)))
                                           ('T
                                            (SEQ
                                             (LETT |found| 'T . #2#)
                                             (EXIT
                                              (LETT |ans| |q| . #2#)))))))))
                           (LETT #0# (CDR #0#) . #2#) (GO G190) G191
                           (EXIT NIL))
                      (EXIT (CONS 0 |ans|))))
           #1# (EXIT #1#))))) 

(DEFUN |INTALG;palginfieldint;RMU;20| (|f| |derivation| $)
  (PROG (|h|)
    (RETURN
      (SEQ (LETT |h| (SPADCALL |f| |derivation| (QREFELT $ 52))
                 |INTALG;palginfieldint;RMU;20|)
           (EXIT (COND
                   ((SPADCALL (QCDR |h|) (QREFELT $ 58))
                    (CONS 0 (QCAR |h|)))
                   ('T (CONS 1 "failed")))))))) 

(DEFUN |INTALG;palgintegrate;RMIr;21| (|f| |derivation| $)
  (PROG (|h| |u| #0=#:G2167 |lg| #1=#:G2170 #2=#:G2166 #3=#:G2164
             #4=#:G2165 |difFirstKind|)
    (RETURN
      (SEQ (LETT |h| (SPADCALL |f| |derivation| (QREFELT $ 52))
                 . #5=(|INTALG;palgintegrate;RMIr;21|))
           (EXIT (COND
                   ((SPADCALL (QCDR |h|) (QREFELT $ 58))
                    (SPADCALL (QCAR |h|) (QREFELT $ 60)))
                   ('T
                    (SEQ (EXIT (SEQ (COND
                                      ((SPADCALL (QCDR |h|)
                                        (QREFELT $ 192))
                                       (SEQ
                                        (LETT |u|
                                         (|INTALG;palglogint|
                                          (QCDR |h|) |derivation| $) . #5#)
                                        (EXIT
                                         (COND
                                           ((QEQCAR |u| 1)
                                            (PROGN
                                              (LETT #0#
                                               (SPADCALL (QCAR |h|) NIL
                                                (LIST
                                                 (CONS (QCDR |h|)
                                                  (QREFELT $ 12)))
                                                (QREFELT $ 66)) . #5#)
                                              (GO #0#)))))))
                                      ('T
                                       (EXIT
                                        (SPADCALL (QCAR |h|) NIL
                                         (LIST
                                          (CONS (QCDR |h|)
                                           (QREFELT $ 12)))
                                         (QREFELT $ 66)))))
                                    (EXIT
                                     (COND
                                       ((SPADCALL
                                         (LETT |difFirstKind|
                                          (SPADCALL (QCDR |h|)
                                           (PROGN
                                             (LETT #4# NIL . #5#)
                                             (SEQ (LETT |lg| NIL . #5#)
                                              (LETT #1#
                                               (QCDR |u|) . #5#)
                                              G190
                                              (COND
                                                ((OR (ATOM #1#)
                                                  (PROGN
                                                    (LETT |lg|
                                                     (CAR #1#) . #5#)
                                                    NIL))
                                                 (GO G191)))
                                              (SEQ
                                               (EXIT
                                                (PROGN
                                                  (LETT #2#
                                                   (|INTALG;pLogDeriv|
                                                    |lg|
                                                    (CONS
                                                     #'|INTALG;palgintegrate;RMIr;21!0|
                                                     (VECTOR $
                                                      |derivation|))
                                                    $) . #5#)
                                                  (COND
                                                    (#4#
                                                     (LETT #3#
                                                      (SPADCALL #3# #2#
                                                       (QREFELT $ 61)) . #5#))
                                                    ('T
                                                     (PROGN
                                                       (LETT #3#
                                                        #2# . #5#)
                                                       (LETT #4#
                                                        'T . #5#)))))))
                                              (LETT #1#
                                               (CDR #1#) . #5#)
                                              (GO G190) G191
                                              (EXIT NIL))
                                             (COND
                                               (#4# #3#)
                                               ('T
                                                (|spadConstant| $ 11))))
                                           (QREFELT $ 194)) . #5#)
                                         (QREFELT $ 58))
                                        (SPADCALL (QCAR |h|) (QCDR |u|)
                                         NIL (QREFELT $ 66)))
                                       ('T
                                        (SPADCALL (QCAR |h|) (QCDR |u|)
                                         (LIST
                                          (CONS |difFirstKind|
                                           (QREFELT $ 12)))
                                         (QREFELT $ 66)))))))
                         #0# (EXIT #0#))))))))) 

(DEFUN |INTALG;palgintegrate;RMIr;21!0| (|#1| $$)
  (SPADCALL |#1| (QREFELT $$ 1) (QREFELT (QREFELT $$ 0) 193))) 

(DEFUN |INTALG;algintegrate;RMIr;22| (|f| |derivation| $)
  (PROG (|x| |x'| |xx| #0=#:G2182)
    (RETURN
      (SEQ (COND
             ((ZEROP (SPADCALL
                         (LETT |x'|
                               (SPADCALL
                                   (LETT |x|
                                    (SPADCALL (|spadConstant| $ 118) 1
                                     (QREFELT $ 174))
                                    . #1=(|INTALG;algintegrate;RMIr;22|))
                                   |derivation|) . #1#)
                         (QREFELT $ 180)))
              (|INTALG;algintprim| |f| |derivation| $))
             ('T
              (SEQ (EXIT (SEQ (SEQ (LETT |xx|
                                    (SPADCALL |x'| |x| (QREFELT $ 177)) . #1#)
                                   (EXIT
                                    (COND
                                      ((QEQCAR |xx| 0)
                                       (COND
                                         ((QEQCAR
                                           (SPADCALL (QCDR |xx|)
                                            (QREFELT $ 197))
                                           0)
                                          (PROGN
                                            (LETT #0#
                                             (|INTALG;algintexp| |f|
                                              |derivation| $) . #1#)
                                            (GO #0#))))))))
                              (EXIT (|error| "should not happen"))))
                   #0# (EXIT #0#)))))))) 

(DEFUN |INTALG;alglogint| (|f| |derivation| $)
  (PROG ()
    (RETURN
      (COND
        ((|INTALG;varRoot?| (SPADCALL |f| |derivation| (QREFELT $ 70))
             (CONS #'|INTALG;alglogint!0| (VECTOR |derivation| $)) $)
         (CONS 1 "failed"))
        ('T
         (|error| "integrate: implementation incomplete (constant residues)")))))) 

(DEFUN |INTALG;alglogint!0| (|#1| $$)
  (PROG ($)
    (LETT $ (QREFELT $$ 1) |INTALG;alglogint|)
    (RETURN
      (PROGN
        (SPADCALL
            (SPADCALL (SPADCALL |#1| (QREFELT $ 21)) (QREFELT $$ 0))
            (QREFELT $ 199)))))) 

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

(DEFUN |AlgebraicIntegrate;| (|#1| |#2| |#3| |#4| |#5|)
  (PROG (DV$1 DV$2 DV$3 DV$4 DV$5 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|AlgebraicIntegrate|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT DV$4 (|devaluate| |#4|) . #0#)
        (LETT DV$5 (|devaluate| |#5|) . #0#)
        (LETT |dv$|
              (LIST '|AlgebraicIntegrate| DV$1 DV$2 DV$3 DV$4 DV$5) . #0#)
        (LETT $ (GETREFV 200) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|AlgebraicIntegrate|
            (LIST DV$1 DV$2 DV$3 DV$4 DV$5) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 |#2|)
        (QSETREFV $ 8 |#3|)
        (QSETREFV $ 9 |#4|)
        (QSETREFV $ 10 |#5|)
        (QSETREFV $ 12 (|spadConstant| $ 11))
        (QSETREFV $ 17
            (SPADCALL (SPADCALL (QREFELT $ 14)) (QREFELT $ 16)))
        (QSETREFV $ 18
            (SPADCALL (SPADCALL (QREFELT $ 14)) (QREFELT $ 16)))
        $)))) 

(MAKEPROP '|AlgebraicIntegrate| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|local| |#3|) (|local| |#4|) (|local| |#5|) (0 . |Zero|)
             '|dummy| (|Symbol|) (4 . |new|) (|Kernel| 7)
             (8 . |kernel|) '|dumx| '|dumy|
             (|SparseUnivariatePolynomial| 10) (13 . |coerce|)
             (18 . |coerce|) (|Fraction| 8) (23 . |coerce|)
             (28 . |coerce|) (|Record| (|:| |num| 38) (|:| |den| 8))
             (33 . |integralCoordinates|) (|LaurentPolynomial| 7 8)
             (38 . |Zero|) (|NonNegativeInteger|) (|Vector| 27)
             (42 . |new|) (48 . |Zero|) (52 . |Zero|) (56 . |Zero|)
             (|Vector| 22) (60 . |new|) (|Integer|) (|Vector| 8)
             (66 . |minIndex|) (71 . |qelt|) (77 . /)
             (|Record| (|:| |polyPart| $) (|:| |fracPart| 22))
             (83 . |separate|) (88 . |qsetelt!|) (95 . |qsetelt!|)
             (|Vector| $) (102 . |integralBasis|) (106 . |represents|)
             (|Record| (|:| |answer| 10) (|:| |logpart| 10))
             (|Mapping| 8 8) (|AlgebraicHermiteIntegration| 7 8 9 10)
             (112 . |HermiteIntegrate|) (118 . |convert|)
             (|Mapping| 22 27) (|VectorFunctions2| 27 22) (123 . |map|)
             (|Boolean|) (129 . |zero?|) (|IntegrationResult| 10)
             (134 . |coerce|) (139 . +)
             (|Record| (|:| |scalar| 80) (|:| |coeff| 19)
                 (|:| |logand| 19))
             (|List| 62)
             (|Record| (|:| |integrand| 10) (|:| |intvar| 10))
             (|List| 64) (145 . |mkAnswer|)
             (|Record| (|:| |num| $) (|:| |den| 8) (|:| |derivden| 8)
                 (|:| |gd| 8))
             (152 . |algSplitSimple|)
             (|DoubleResultantPackage| 7 8 9 10)
             (158 . |doubleResultant|) (164 . |ground?|)
             (|Union| 77 '"failed")
             (|FunctionSpaceUnivariatePolynomialFactor| 6 7 8)
             (169 . |qfactor|)
             (|Record| (|:| |factor| 81) (|:| |exponent| 37))
             (|List| 75) (|Factored| 81) (174 . |factors|)
             (179 . |remove!|) (|Fraction| 37)
             (|SparseUnivariatePolynomial| 80) (185 . |coefficient|)
             (191 . -) (196 . |coerce|) (|FiniteDivisor| 7 8 9 10)
             (201 . |divisor|) (210 . |degree|) (215 . |One|)
             (219 . |zero?|)
             (|Record| (|:| |num| (|List| 37)) (|:| |den| 37))
             (|List| 80)
             (|InnerCommonDenominator| 37 80 (|List| 37) 91)
             (224 . |splitDenominator|) (|List| $) (229 . |gcd|)
             (234 . *) (240 . +) (246 . |Zero|) (250 . /)
             (|Mapping| 7 80)
             (|UnivariatePolynomialCategoryFunctions2| 80 81 7 8)
             (256 . |map|) (|SparseUnivariatePolynomial| 7)
             (|Mapping| 7 7)
             (|UnivariatePolynomialCategoryFunctions2| 7 8 7 103)
             (262 . |map|)
             (|UnivariatePolynomialCategoryFunctions2| 7 103 7 8)
             (268 . |map|) (274 . |primitivePart|) (|List| 7)
             (279 . |coefficients|) (284 . =) (|Mapping| 10 10)
             (290 . |map|) (296 . |Zero|) (300 . =) (306 . |degree|)
             (311 . |One|) (315 . |reductum|)
             (320 . |leadingCoefficient|) (325 . /) (331 . -)
             (336 . |elt|) (342 . |coerce|) (347 . *)
             (|Record| (|:| |coef1| $) (|:| |coef2| $))
             (|Union| 126 '"failed") (353 . |extendedEuclidean|)
             (360 . |One|) (364 . |monomial|) (370 . *) (376 . |rem|)
             (382 . |coefficient|) (|Kernel| $) (388 . |coerce|)
             (|Fraction| $) (393 . |elt|) (399 . |lift|)
             (|Mapping| 7 22)
             (|UnivariatePolynomialCategoryFunctions2| 22 9 7 8)
             (404 . |map|) (410 . |elt|)
             (|SparseUnivariatePolynomial| $) (416 . |minPoly|)
             (|PolynomialCategoryQuotientFunctions|
                 (|IndexedExponents| 15) 15 6
                 (|SparseMultivariatePolynomial| 6 15) 7)
             (421 . |univariate|) (|Mapping| 10 7)
             (|UnivariatePolynomialCategoryFunctions2| 7 103 10 19)
             (428 . |map|) (|Fraction| 143) (434 . |univariate|)
             (|Fraction| 103) (440 . |numer|) (445 . |denom|)
             (450 . |retract|) (|Mapping| 22 7)
             (|UnivariatePolynomialCategoryFunctions2| 7 103 22 9)
             (455 . |map|) (461 . |reduce|) (|Factored| 8)
             (466 . |ffactor|)
             (|Record| (|:| |factor| 8) (|:| |exponent| 37))
             (|List| 162) (471 . |factors|) (476 . |zero?|)
             (|Record| (|:| |order| 29) (|:| |function| 10))
             (|Union| 166 '"failed") (|PointsOfFiniteOrder| 6 7 8 9 10)
             (481 . |torsionIfCan|) (486 . |One|) (490 . |coerce|)
             (495 . /) (501 . |zeroOf|) (506 . |monomial|) (512 . -)
             (|Union| $ '"failed") (518 . |exquo|) (524 . |rootOf|)
             (529 . -) (535 . |degree|) (540 . |inv|) (545 . |concat|)
             (551 . |One|) (555 . |One|) (559 . -)
             (|UnivariatePolynomialCategoryFunctions2| 7 8 10 19)
             (565 . |map|) (571 . |retract|) (576 . |One|)
             (|Union| 10 '"failed") |INTALG;palginfieldint;RMU;20|
             (580 . |integralAtInfinity?|) (585 . |differentiate|)
             (591 . -) |INTALG;palgintegrate;RMIr;21|
             (|Union| 7 '"failed") (597 . |retractIfCan|)
             |INTALG;algintegrate;RMIr;22| (602 . |retract|))
          '#(|palgintegrate| 607 |palginfieldint| 613 |algintegrate|
             619)
          'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 199
                                '(0 10 0 11 0 13 0 14 1 15 0 13 16 1 19
                                  0 10 20 1 8 0 7 21 1 22 0 8 23 1 10 0
                                  22 24 1 10 25 0 26 0 27 0 28 2 30 0
                                  29 27 31 0 6 0 32 0 7 0 33 0 22 0 34
                                  2 35 0 29 22 36 1 38 37 0 39 2 38 8 0
                                  37 40 2 22 0 8 8 41 1 27 42 22 43 3
                                  35 22 0 37 22 44 3 30 27 0 37 27 45 0
                                  10 46 47 2 10 0 35 46 48 2 51 49 10
                                  50 52 1 27 22 0 53 2 55 35 54 30 56 1
                                  10 57 0 58 1 59 0 10 60 2 10 0 0 0 61
                                  3 59 0 10 63 65 66 2 10 67 0 50 68 2
                                  69 8 10 50 70 1 8 57 0 71 1 73 72 8
                                  74 1 77 76 0 78 2 76 0 75 0 79 2 81
                                  80 0 29 82 1 80 0 0 83 1 7 0 80 84 5
                                  85 0 10 8 8 8 7 86 1 81 29 0 87 0 6 0
                                  88 1 80 57 0 89 1 92 90 91 93 1 37 0
                                  94 95 2 85 0 37 0 96 2 85 0 0 0 97 0
                                  85 0 98 2 80 0 37 37 99 2 101 8 100
                                  81 102 2 105 103 104 8 106 2 107 8
                                  104 103 108 1 8 0 0 109 1 8 110 0 111
                                  2 7 57 0 0 112 2 19 0 113 0 114 0 19
                                  0 115 2 19 57 0 0 116 1 19 29 0 117 0
                                  7 0 118 1 19 0 0 119 1 19 10 0 120 2
                                  10 0 0 0 121 1 10 0 0 122 2 19 10 0
                                  10 123 1 10 0 80 124 2 10 0 0 0 125 3
                                  19 127 0 0 0 128 0 10 0 129 2 19 0 10
                                  29 130 2 19 0 0 0 131 2 19 0 0 0 132
                                  2 19 10 0 29 133 1 7 0 134 135 2 8 7
                                  136 7 137 1 10 9 0 138 2 140 8 139 9
                                  141 2 8 7 0 7 142 1 7 143 134 144 3
                                  145 103 7 15 103 146 2 148 19 147 103
                                  149 2 7 150 0 134 151 1 152 103 0 153
                                  1 152 103 0 154 1 152 103 0 155 2 157
                                  9 156 103 158 1 10 0 9 159 1 73 160 8
                                  161 1 160 163 0 164 1 85 57 0 165 1
                                  168 167 85 169 0 8 0 170 1 80 0 37
                                  171 2 80 0 0 0 172 1 7 0 143 173 2 8
                                  0 7 29 174 2 8 0 0 0 175 2 8 176 0 0
                                  177 1 7 0 143 178 2 85 0 0 0 179 1 8
                                  29 0 180 1 80 0 0 181 2 63 0 0 0 182
                                  0 9 0 183 0 80 0 184 2 19 0 0 0 185 2
                                  186 19 147 8 187 1 7 134 0 188 0 81 0
                                  189 1 10 57 0 192 2 10 0 0 50 193 2
                                  10 0 0 0 194 1 8 196 0 197 1 8 7 0
                                  199 2 0 59 10 50 195 2 0 190 10 50
                                  191 2 0 59 10 50 198)))))
          '|lookupComplete|)) 
