
(/VERSIONCHECK 2) 

(DEFUN |PMKERNEL;patternMatchArg| (|ls| |lp| |l| $)
  (PROG (#1=#:G686 #2=#:G688 #3=#:G691 |p| #4=#:G692 |s| #5=#:G683 #6=#:G689
         #7=#:G690)
    (RETURN
     (SEQ
      (EXIT
       (COND
        ((NULL (EQL (LENGTH |ls|) (LENGTH |lp|))) (SPADCALL (QREFELT $ 9)))
        ('T
         (SEQ
          (SEQ
           (EXIT
            (SEQ (LETT |s| NIL . #8=(|PMKERNEL;patternMatchArg|))
                 (LETT #7# |ls| . #8#) (LETT |p| NIL . #8#)
                 (LETT #6# |lp| . #8#) G190
                 (COND
                  ((OR (ATOM #6#) (PROGN (LETT |p| (CAR #6#) . #8#) NIL)
                       (ATOM #7#) (PROGN (LETT |s| (CAR #7#) . #8#) NIL))
                   #9=(GO G191)))
                 (SEQ
                  (EXIT
                   (COND
                    ((SPADCALL |p| (QREFELT $ 12))
                     (COND
                      ((SPADCALL
                        (LETT |l| (SPADCALL |p| |s| |l| (QREFELT $ 13)) . #8#)
                        (QREFELT $ 14))
                       (PROGN
                        (LETT #5#
                              (PROGN
                               (LETT #2# (SPADCALL (QREFELT $ 9)) . #8#)
                               (GO #2#))
                              . #8#)
                        (GO #5#))))))))
                 (LETT #6# (PROG1 (CDR #6#) (LETT #7# (CDR #7#) . #8#)) . #8#)
                 #10=(GO G190) G191 (EXIT NIL)))
           #5# (EXIT #5#))
          (SEQ
           (EXIT
            (SEQ (LETT |s| NIL . #8#) (LETT #4# |ls| . #8#)
                 (LETT |p| NIL . #8#) (LETT #3# |lp| . #8#) G190
                 (COND
                  ((OR (ATOM #3#) (PROGN (LETT |p| (CAR #3#) . #8#) NIL)
                       (ATOM #4#) (PROGN (LETT |s| (CAR #4#) . #8#) NIL))
                   #9#))
                 (SEQ
                  (EXIT
                   (COND
                    ((NULL (SPADCALL |p| (QREFELT $ 12)))
                     (COND
                      ((SPADCALL
                        (LETT |l| (SPADCALL |s| |p| |l| (QREFELT $ 16)) . #8#)
                        (QREFELT $ 14))
                       (PROGN
                        (LETT #1#
                              (PROGN
                               (LETT #2# (SPADCALL (QREFELT $ 9)) . #8#)
                               (GO #2#))
                              . #8#)
                        (GO #1#))))))))
                 (LETT #3# (PROG1 (CDR #3#) (LETT #4# (CDR #4#) . #8#)) . #8#)
                 #10# G191 (EXIT NIL)))
           #1# (EXIT #1#))
          (EXIT |l|)))))
      #2# (EXIT #2#))))) 

(DEFUN |PMKERNEL;patternMatchInner| (|s| |p| |l| $)
  (PROG (#1=#:G713 |w| |v| |ur| #2=#:G702 |u|)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL |p| (QREFELT $ 12))
        (CONS 0
              (SPADCALL |p| (SPADCALL |s| (QREFELT $ 18)) |l| (QREFELT $ 13))))
       ((QEQCAR
         (LETT |u| (SPADCALL |p| (QREFELT $ 21))
               . #3=(|PMKERNEL;patternMatchInner|))
         0)
        (SEQ
         (LETT |ur|
               (PROG2
                   (LETT #2# |u| . #3#)
                   (QCDR #2#)
                 (|check-union| (QEQCAR #2# 0)
                                (|Record| (|:| |op| (|BasicOperator|))
                                          (|:| |arg|
                                               (|List|
                                                (|Pattern| (QREFELT $ 6)))))
                                #2#))
               . #3#)
         (EXIT
          (COND
           ((SPADCALL (QCAR |ur|) (SPADCALL |s| (QREFELT $ 24)) (QREFELT $ 25))
            (CONS 0
                  (|PMKERNEL;patternMatchArg| (SPADCALL |s| (QREFELT $ 27))
                   (QCDR |ur|) |l| $)))
           (#4='T (CONS 0 (SPADCALL (QREFELT $ 9))))))))
       ((SPADCALL |p| (QREFELT $ 28))
        (SEQ
         (EXIT
          (SEQ
           (SEQ (LETT |v| (SPADCALL |p| (QREFELT $ 30)) . #3#)
                (EXIT
                 (COND
                  ((QEQCAR |v| 0)
                   (SEQ (LETT |w| (SPADCALL |s| (QREFELT $ 31)) . #3#)
                        (EXIT
                         (COND
                          ((QEQCAR |w| 0)
                           (COND
                            ((EQUAL (QCDR |v|) (QCDR |w|))
                             (PROGN
                              (LETT #1# (CONS 0 |l|) . #3#)
                              (GO #1#))))))))))))
           (EXIT (CONS 0 (SPADCALL (QREFELT $ 9))))))
         #1# (EXIT #1#)))
       (#4# (CONS 1 "failed"))))))) 

(DEFUN |PMKERNEL;patternMatchOpt| (|x| |lp| |l| |id| $)
  (PROG (#1=#:G722 |u|)
    (RETURN
     (COND
      ((QEQCAR
        (LETT |u| (SPADCALL |lp| (QREFELT $ 34))
              . #2=(|PMKERNEL;patternMatchOpt|))
        0)
       (COND
        ((SPADCALL
          (LETT |l|
                (SPADCALL
                 (|SPADfirst|
                  (PROG2
                      (LETT #1# |u| . #2#)
                      (QCDR #1#)
                    (|check-union| (QEQCAR #1# 0)
                                   (|List| (|Pattern| (QREFELT $ 6))) #1#)))
                 |id| |l| (QREFELT $ 13))
                . #2#)
          (QREFELT $ 14))
         (SPADCALL (QREFELT $ 9)))
        (#3='T
         (SPADCALL |x|
                   (SPADCALL
                    (PROG2
                        (LETT #1# |u| . #2#)
                        (QCDR #1#)
                      (|check-union| (QEQCAR #1# 0)
                                     (|List| (|Pattern| (QREFELT $ 6))) #1#))
                    (QREFELT $ 36))
                   |l| (QREFELT $ 16)))))
      (#3# (SPADCALL (QREFELT $ 9))))))) 

(DEFUN |PMKERNEL;patternMatchMonoid| (|s| |p| |l| $)
  (PROG (#1=#:G750 |w| #2=#:G747 |r| |arg| |op| |vr| #3=#:G736 |v| |u|)
    (RETURN
     (SEQ
      (LETT |u| (|PMKERNEL;patternMatchInner| |s| |p| |l| $)
            . #4=(|PMKERNEL;patternMatchMonoid|))
      (EXIT
       (COND ((QEQCAR |u| 0) (CONS 0 (QCDR |u|)))
             ((QEQCAR (LETT |v| (SPADCALL |p| (QREFELT $ 39)) . #4#) 0)
              (SEQ
               (LETT |vr|
                     (PROG2
                         (LETT #3# |v| . #4#)
                         (QCDR #3#)
                       (|check-union| (QEQCAR #3# 0)
                                      (|Record|
                                       (|:| |val| (|Pattern| (QREFELT $ 6)))
                                       (|:| |exponent|
                                            (|Pattern| (QREFELT $ 6))))
                                      #3#))
                     . #4#)
               (EXIT
                (COND
                 ((SPADCALL (LETT |op| (SPADCALL |s| (QREFELT $ 24)) . #4#)
                            '|%power| (QREFELT $ 41))
                  (CONS 0
                        (|PMKERNEL;patternMatchArg|
                         (SPADCALL |s| (QREFELT $ 27))
                         (LIST (QCAR |vr|) (QCDR |vr|)) |l| $)))
                 (#5='T
                  (SEQ
                   (EXIT
                    (SEQ
                     (COND
                      ((SPADCALL |op| '|nthRoot| (QREFELT $ 41))
                       (SEQ
                        (LETT |r|
                              (SPADCALL
                               (SPADCALL
                                (LETT |arg| (SPADCALL |s| (QREFELT $ 27))
                                      . #4#)
                                (QREFELT $ 42))
                               (QREFELT $ 44))
                              . #4#)
                        (EXIT
                         (COND
                          ((QEQCAR |r| 0)
                           (PROGN
                            (LETT #2#
                                  (CONS 0
                                        (|PMKERNEL;patternMatchArg|
                                         (LIST (|SPADfirst| |arg|) (QCDR |r|))
                                         (LIST (QCAR |vr|) (QCDR |vr|)) |l| $))
                                  . #4#)
                            (GO #2#))))))))
                     (EXIT
                      (COND
                       ((SPADCALL (QCDR |vr|) (QREFELT $ 45))
                        (COND
                         ((SPADCALL
                           (LETT |l|
                                 (SPADCALL (QCDR |vr|) (|spadConstant| $ 46)
                                           |l| (QREFELT $ 13))
                                 . #4#)
                           (QREFELT $ 14))
                          (CONS 0 (SPADCALL (QREFELT $ 9))))
                         (#5#
                          (CONS 0
                                (SPADCALL (SPADCALL |s| (QREFELT $ 18))
                                          (QCAR |vr|) |l| (QREFELT $ 16))))))
                       (#5# (CONS 0 (SPADCALL (QREFELT $ 9))))))))
                   #2# (EXIT #2#)))))))
             ((QEQCAR (LETT |w| (SPADCALL |p| (QREFELT $ 47)) . #4#) 0)
              (CONS 0
                    (|PMKERNEL;patternMatchOpt| (SPADCALL |s| (QREFELT $ 18))
                     (PROG2
                         (LETT #1# |w| . #4#)
                         (QCDR #1#)
                       (|check-union| (QEQCAR #1# 0)
                                      (|List| (|Pattern| (QREFELT $ 6))) #1#))
                     |l| (|spadConstant| $ 46) $)))
             (#5# (CONS 1 "failed")))))))) 

(DEFUN |PMKERNEL;patternMatch;KP2Pmr;5| (|s| |p| |l| $)
  (PROG (#1=#:G760 |w| |u|)
    (RETURN
     (SEQ
      (LETT |u| (|PMKERNEL;patternMatchMonoid| |s| |p| |l| $)
            . #2=(|PMKERNEL;patternMatch;KP2Pmr;5|))
      (EXIT
       (COND ((QEQCAR |u| 0) (QCDR |u|))
             ((QEQCAR (LETT |w| (SPADCALL |p| (QREFELT $ 48)) . #2#) 0)
              (|PMKERNEL;patternMatchOpt| (SPADCALL |s| (QREFELT $ 18))
               (PROG2
                   (LETT #1# |w| . #2#)
                   (QCDR #1#)
                 (|check-union| (QEQCAR #1# 0)
                                (|List| (|Pattern| (QREFELT $ 6))) #1#))
               |l| (|spadConstant| $ 49) $))
             ('T (SPADCALL (QREFELT $ 9))))))))) 

(DEFUN |PMKERNEL;patternMatch;KP2Pmr;6| (|s| |p| |l| $)
  (PROG (|u|)
    (RETURN
     (SEQ
      (LETT |u| (|PMKERNEL;patternMatchMonoid| |s| |p| |l| $)
            |PMKERNEL;patternMatch;KP2Pmr;6|)
      (EXIT
       (COND ((QEQCAR |u| 0) (QCDR |u|)) ('T (SPADCALL (QREFELT $ 9))))))))) 

(DEFUN |PMKERNEL;patternMatch;KP2Pmr;7| (|s| |p| |l| $)
  (PROG (|u|)
    (RETURN
     (SEQ
      (LETT |u| (|PMKERNEL;patternMatchInner| |s| |p| |l| $)
            |PMKERNEL;patternMatch;KP2Pmr;7|)
      (EXIT
       (COND ((QEQCAR |u| 0) (QCDR |u|)) ('T (SPADCALL (QREFELT $ 9))))))))) 

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

(DEFUN |PatternMatchKernel;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|PatternMatchKernel|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|PatternMatchKernel| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 51) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|PatternMatchKernel| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (COND
       ((|HasCategory| |#2| '(|Monoid|))
        (PROGN
         (COND
          ((|HasCategory| |#2| '(|AbelianMonoid|))
           (QSETREFV $ 50
                     (CONS
                      (|dispatchFunction| |PMKERNEL;patternMatch;KP2Pmr;5|)
                      $)))
          ('T
           (QSETREFV $ 50
                     (CONS
                      (|dispatchFunction| |PMKERNEL;patternMatch;KP2Pmr;6|)
                      $))))))
       ('T
        (QSETREFV $ 50
                  (CONS (|dispatchFunction| |PMKERNEL;patternMatch;KP2Pmr;7|)
                        $))))
      $)))) 

(MAKEPROP '|PatternMatchKernel| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|PatternMatchResult| 6 7) (0 . |failed|) (|Boolean|)
              (|Pattern| 6) (4 . |generic?|) (9 . |addMatch|) (16 . |failed?|)
              (|PatternMatchResult| 6 $) (21 . |patternMatch|) (|Kernel| $)
              (28 . |coerce|) (|Record| (|:| |op| 22) (|:| |arg| 33))
              (|Union| 19 '"failed") (33 . |isOp|) (|BasicOperator|)
              (|Kernel| 7) (38 . |operator|) (43 . =) (|List| 7)
              (49 . |argument|) (54 . |constant?|) (|Union| 40 '"failed")
              (59 . |retractIfCan|) (64 . |symbolIfCan|) (|Union| 33 '"failed")
              (|List| $) (69 . |optpair|) (|List| 11) (74 . |second|)
              (|Record| (|:| |val| $) (|:| |exponent| $))
              (|Union| 37 '"failed") (79 . |isPower|) (|Symbol|) (84 . |is?|)
              (90 . |second|) (|Union| $ '"failed") (95 . |recip|)
              (100 . |optional?|) (105 . |One|) (109 . |isTimes|)
              (114 . |isPlus|) (119 . |Zero|) (123 . |patternMatch|))
           '#(|patternMatch| 130) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 50
                                                 '(0 8 0 9 1 11 10 0 12 3 8 0
                                                   11 7 0 13 1 8 10 0 14 3 7 15
                                                   0 11 15 16 1 7 0 17 18 1 11
                                                   20 0 21 1 23 22 0 24 2 22 10
                                                   0 0 25 1 23 26 0 27 1 11 10
                                                   0 28 1 11 29 0 30 1 23 29 0
                                                   31 1 11 32 33 34 1 35 11 0
                                                   36 1 11 38 0 39 2 22 10 0 40
                                                   41 1 26 7 0 42 1 7 43 0 44 1
                                                   11 10 0 45 0 7 0 46 1 11 32
                                                   0 47 1 11 32 0 48 0 7 0 49 3
                                                   0 8 23 11 8 50 3 0 8 23 11 8
                                                   50)))))
           '|lookupComplete|)) 
