
(/VERSIONCHECK 2) 

(DEFUN |APPRULE;applist| (|lrule| |arglist| $)
  (PROG (#1=#:G1812 |arg| #2=#:G1811)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|APPRULE;applist|))
       (SEQ (LETT |arg| NIL . #3#) (LETT #1# |arglist| . #3#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |arg| (CAR #1#) . #3#) NIL))
              (GO G191)))
            (SEQ
             (EXIT
              (LETT #2# (CONS (|APPRULE;app| |lrule| |arg| $) #2#) . #3#)))
            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |APPRULE;splitRules| (|l| $)
  (PROG (|lv| |lk| |ncr| |u| #1=#:G1830 |r|)
    (RETURN
     (SEQ (LETT |ncr| NIL . #2=(|APPRULE;splitRules|)) (LETT |lk| NIL . #2#)
          (LETT |lv| NIL . #2#)
          (SEQ (LETT |r| NIL . #2#) (LETT #1# |l| . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |r| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ (LETT |u| (SPADCALL |r| (QREFELT $ 11)) . #2#)
                    (EXIT
                     (COND ((QEQCAR |u| 1) (LETT |ncr| (CONS |r| |ncr|) . #2#))
                           ('T
                            (SEQ
                             (LETT |lk|
                                   (CONS
                                    (SPADCALL
                                     (SPADCALL (QCDR |u|) (QREFELT $ 13))
                                     (QREFELT $ 15))
                                    |lk|)
                                   . #2#)
                             (EXIT
                              (LETT |lv|
                                    (CONS (SPADCALL (QCDR |u|) (QREFELT $ 16))
                                          |lv|)
                                    . #2#)))))))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT (VECTOR |lk| |lv| |ncr|)))))) 

(DEFUN |APPRULE;applyRules;L2F;3| (|l| |s| $)
  (PROG (#1=#:G1835 |new| |rec|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (LETT |rec| (|APPRULE;splitRules| |l| $)
              . #2=(|APPRULE;applyRules;L2F;3|))
        (EXIT
         (SEQ G190 NIL
              (SEQ
               (LETT |new|
                     (|APPRULE;localApply| (QVELT |rec| 0) (QVELT |rec| 1)
                      (QVELT |rec| 2) |s| 1 $)
                     . #2#)
               (EXIT
                (COND
                 ((SPADCALL |new| |s| (QREFELT $ 18))
                  (PROGN (LETT #1# |s| . #2#) (GO #1#)))
                 ('T (LETT |s| |new| . #2#)))))
              NIL (GO G190) G191 (EXIT NIL)))))
      #1# (EXIT #1#))))) 

(DEFUN |APPRULE;applyRules;LFPiF;4| (|l| |s| |n| $)
  (PROG (|rec|)
    (RETURN
     (SEQ
      (LETT |rec| (|APPRULE;splitRules| |l| $) |APPRULE;applyRules;LFPiF;4|)
      (EXIT
       (|APPRULE;localApply| (QVELT |rec| 0) (QVELT |rec| 1) (QVELT |rec| 2)
        |s| |n| $)))))) 

(DEFUN |APPRULE;localApply| (|lk| |lv| |lrule| |subject| |n| $)
  (PROG (#1=#:G1845 |k| #2=#:G1846 |v| |i|)
    (RETURN
     (SEQ
      (SEQ (LETT |i| 1 . #3=(|APPRULE;localApply|)) G190
           (COND ((QSGREATERP |i| |n|) #4=(GO G191)))
           (SEQ
            (SEQ (LETT |v| NIL . #3#) (LETT #2# |lv| . #3#)
                 (LETT |k| NIL . #3#) (LETT #1# |lk| . #3#) G190
                 (COND
                  ((OR (ATOM #1#) (PROGN (LETT |k| (CAR #1#) . #3#) NIL)
                       (ATOM #2#) (PROGN (LETT |v| (CAR #2#) . #3#) NIL))
                   #4#))
                 (SEQ
                  (EXIT
                   (LETT |subject| (SPADCALL |subject| |k| |v| (QREFELT $ 23))
                         . #3#)))
                 (LETT #1# (PROG1 (CDR #1#) (LETT #2# (CDR #2#) . #3#)) . #3#)
                 #5=(GO G190) G191 (EXIT NIL))
            (EXIT (LETT |subject| (|APPRULE;app| |lrule| |subject| $) . #3#)))
           (LETT |i| (QSADD1 |i|) . #3#) #5# G191 (EXIT NIL))
      (EXIT |subject|))))) 

(DEFUN |APPRULE;rewrite| (|f| |res| |l| $)
  (PROG (|lv| |lk| #1=#:G1854 |rec|)
    (RETURN
     (SEQ (LETT |lk| NIL . #2=(|APPRULE;rewrite|)) (LETT |lv| NIL . #2#)
          (SEQ (LETT |rec| NIL . #2#)
               (LETT #1# (SPADCALL |res| (QREFELT $ 27)) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |rec| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ
                (LETT |lk| (CONS (SPADCALL (QCAR |rec|) (QREFELT $ 30)) |lk|)
                      . #2#)
                (EXIT (LETT |lv| (CONS (QCDR |rec|) |lv|) . #2#)))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT
           (SPADCALL (SPADCALL |f| |lk| |lv| (QREFELT $ 33)) |l|
                     (QREFELT $ 35))))))) 

(DEFUN |APPRULE;localUnquote;FLF;7| (|f| |l| $)
  (COND ((NULL |l|) |f|) ('T (SPADCALL |f| |l| (QREFELT $ 36))))) 

(PUT '|APPRULE;localUnquote;FLF;8| '|SPADreplace| '(XLAM (|f| |l|) |f|)) 

(DEFUN |APPRULE;localUnquote;FLF;8| (|f| |l| $) |f|) 

(DEFUN |APPRULE;isitwithpred| (|subject| |pat| |vars| |bad| $)
  (PROG (#1=#:G1868 #2=#:G1876 |v| #3=#:G1862 |u|)
    (RETURN
     (SEQ
      (COND
       ((OR
         (SPADCALL
          (LETT |u|
                (SPADCALL |subject| |pat| (SPADCALL (QREFELT $ 37))
                          (QREFELT $ 40))
                . #4=(|APPRULE;isitwithpred|))
          (QREFELT $ 41))
         (PROG2
             (LETT #3# (SPADCALL |u| |pat| (QREFELT $ 43)) . #4#)
             (QCDR #3#)
           (|check-union| (QEQCAR #3# 0) (|Boolean|) #3#)))
        |u|)
       ((SPADCALL |u| |bad| (QREFELT $ 45)) (SPADCALL (QREFELT $ 46)))
       ('T
        (SEQ
         (SEQ (LETT |v| NIL . #4#) (LETT #2# |vars| . #4#) G190
              (COND
               ((OR (ATOM #2#) (PROGN (LETT |v| (CAR #2#) . #4#) NIL))
                (GO G191)))
              (SEQ
               (EXIT
                (SPADCALL |v|
                          (PROG2
                              (LETT #1# (SPADCALL |v| |u| (QREFELT $ 48))
                                    . #4#)
                              (QCDR #1#)
                            (|check-union| (QEQCAR #1# 0) (QREFELT $ 8) #1#))
                          (QREFELT $ 50))))
              (LETT #2# (CDR #2#) . #4#) (GO G190) G191 (EXIT NIL))
         (EXIT
          (|APPRULE;isitwithpred| |subject| |pat| |vars| (CONS |u| |bad|)
           $))))))))) 

(DEFUN |APPRULE;isit| (|subject| |pat| $)
  (PROG (#1=#:G1881 |l| |v|)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL |pat| (QREFELT $ 51))
        (SEQ
         (SEQ (LETT |v| NIL . #2=(|APPRULE;isit|))
              (LETT #1# (LETT |l| (SPADCALL |pat| (QREFELT $ 52)) . #2#) . #2#)
              G190
              (COND
               ((OR (ATOM #1#) (PROGN (LETT |v| (CAR #1#) . #2#) NIL))
                (GO G191)))
              (SEQ (EXIT (SPADCALL |v| (QREFELT $ 53))))
              (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
         (EXIT (|APPRULE;isitwithpred| |subject| |pat| |l| NIL $))))
       ('T
        (SPADCALL |subject| |pat| (SPADCALL (QREFELT $ 37))
                  (QREFELT $ 40)))))))) 

(DEFUN |APPRULE;app| (|lrule| |subject| $)
  (PROG (#1=#:G1919 #2=#:G1916 #3=#:G1911 |f| |ee| #4=#:G1908 |e| #5=#:G1900
         #6=#:G1899 #7=#:G1901 #8=#:G1928 #9=#:G1894 #10=#:G1793 |l|
         #11=#:G1897 #12=#:G1896 #13=#:G1898 #14=#:G1927 #15=#:G1792 |k|
         #16=#:G1883 #17=#:G1925 |u| #18=#:G1926 |r|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (SEQ
         (EXIT
          (SEQ (LETT |r| NIL . #19=(|APPRULE;app|)) (LETT #18# |lrule| . #19#)
               G190
               (COND
                ((OR (ATOM #18#) (PROGN (LETT |r| (CAR #18#) . #19#) NIL))
                 #20=(GO G191)))
               (SEQ
                (EXIT
                 (COND
                  ((NULL
                    (SPADCALL
                     (LETT |u|
                           (|APPRULE;isit| |subject|
                            (SPADCALL |r| (QREFELT $ 54)) $)
                           . #19#)
                     (QREFELT $ 41)))
                   (PROGN
                    (LETT #16#
                          (PROGN
                           (LETT #17#
                                 (|APPRULE;rewrite|
                                  (SPADCALL |r| (QREFELT $ 55)) |u|
                                  (SPADCALL |r| (QREFELT $ 56)) $)
                                 . #19#)
                           (GO #17#))
                          . #19#)
                    (GO #16#))))))
               (LETT #18# (CDR #18#) . #19#) #21=(GO G190) G191 (EXIT NIL)))
         #16# (EXIT #16#))
        (LETT |k| (SPADCALL |subject| (QREFELT $ 58)) . #19#)
        (EXIT
         (COND
          ((QEQCAR |k| 0)
           (SPADCALL (SPADCALL (QCDR |k|) (QREFELT $ 60))
                     (|APPRULE;applist| |lrule|
                      (SPADCALL (QCDR |k|) (QREFELT $ 62)) $)
                     (QREFELT $ 63)))
          ((QEQCAR (LETT |l| (SPADCALL |subject| (QREFELT $ 65)) . #19#) 0)
           (PROGN
            (LETT #11# NIL . #19#)
            (SEQ (LETT #15# NIL . #19#)
                 (LETT #14#
                       (|APPRULE;applist| |lrule|
                        (PROG2
                            (LETT #9# |l| . #19#)
                            (QCDR #9#)
                          (|check-union| (QEQCAR #9# 0) (|List| (QREFELT $ 8))
                                         #9#))
                        $)
                       . #19#)
                 G190
                 (COND
                  ((OR (ATOM #14#) (PROGN (LETT #15# (CAR #14#) . #19#) NIL))
                   #20#))
                 (SEQ
                  (EXIT
                   (PROGN
                    (LETT #13# #15# . #19#)
                    (COND
                     (#11#
                      (LETT #12# (SPADCALL #12# #13# (QREFELT $ 66)) . #19#))
                     ('T
                      (PROGN
                       (LETT #12# #13# . #19#)
                       (LETT #11# 'T . #19#)))))))
                 (LETT #14# (CDR #14#) . #19#) #21# G191 (EXIT NIL))
            (COND (#11# #12#) (#22='T (|spadConstant| $ 67)))))
          ((QEQCAR (LETT |l| (SPADCALL |subject| (QREFELT $ 68)) . #19#) 0)
           (PROGN
            (LETT #5# NIL . #19#)
            (SEQ (LETT #10# NIL . #19#)
                 (LETT #8#
                       (|APPRULE;applist| |lrule|
                        (PROG2
                            (LETT #9# |l| . #19#)
                            (QCDR #9#)
                          (|check-union| (QEQCAR #9# 0) (|List| (QREFELT $ 8))
                                         #9#))
                        $)
                       . #19#)
                 G190
                 (COND
                  ((OR (ATOM #8#) (PROGN (LETT #10# (CAR #8#) . #19#) NIL))
                   #20#))
                 (SEQ
                  (EXIT
                   (PROGN
                    (LETT #7# #10# . #19#)
                    (COND
                     (#5# (LETT #6# (SPADCALL #6# #7# (QREFELT $ 69)) . #19#))
                     ('T
                      (PROGN (LETT #6# #7# . #19#) (LETT #5# 'T . #19#)))))))
                 (LETT #8# (CDR #8#) . #19#) #21# G191 (EXIT NIL))
            (COND (#5# #6#) (#22# (|spadConstant| $ 70)))))
          ((QEQCAR (LETT |e| (SPADCALL |subject| (QREFELT $ 73)) . #19#) 0)
           (SEQ
            (LETT |ee|
                  (PROG2
                      (LETT #4# |e| . #19#)
                      (QCDR #4#)
                    (|check-union| (QEQCAR #4# 0)
                                   (|Record| (|:| |val| (QREFELT $ 8))
                                             (|:| |exponent| (|Integer|)))
                                   #4#))
                  . #19#)
            (LETT |f| (|APPRULE;app| |lrule| (QCAR |ee|) $) . #19#)
            (EXIT
             (COND
              ((SPADCALL (QCDR |ee|) (QREFELT $ 75))
               (SPADCALL |f|
                         (PROG1 (LETT #3# (QCDR |ee|) . #19#)
                           (|check-subtype| (>= #3# 0) '(|NonNegativeInteger|)
                                            #3#))
                         (QREFELT $ 77)))
              (#22#
               (SPADCALL
                (PROG2
                    (LETT #2# (SPADCALL |f| (QREFELT $ 79)) . #19#)
                    (QCDR #2#)
                  (|check-union| (QEQCAR #2# 0) (QREFELT $ 8) #2#))
                (PROG1 (LETT #1# (- (QCDR |ee|)) . #19#)
                  (|check-subtype| (>= #1# 0) '(|NonNegativeInteger|) #1#))
                (QREFELT $ 77)))))))
          (#22# |subject|)))))
      #17# (EXIT #17#))))) 

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

(DEFUN |ApplyRules;| (|#1| |#2| |#3|)
  (PROG (|pv$| $ |dv$| DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|ApplyRules|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT DV$3 (|devaluate| |#3|) . #1#)
      (LETT |dv$| (LIST '|ApplyRules| DV$1 DV$2 DV$3) . #1#)
      (LETT $ (GETREFV 80) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|ApplyRules| (LIST DV$1 DV$2 DV$3)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (COND
       ((|HasCategory| |#2| '(|ConvertibleTo| (|InputForm|)))
        (QSETREFV $ 35
                  (CONS (|dispatchFunction| |APPRULE;localUnquote;FLF;7|) $)))
       ('T
        (QSETREFV $ 35
                  (CONS (|dispatchFunction| |APPRULE;localUnquote;FLF;8|) $))))
      $)))) 

(MAKEPROP '|ApplyRules| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) (|Union| 12 '#1="failed") (|RewriteRule| 6 7 8)
              (0 . |retractIfCan|) (|Equation| 8) (5 . |lhs|) (|Kernel| $)
              (10 . |retract|) (15 . |rhs|) (|Boolean|) (20 . =) (|List| 10)
              |APPRULE;applyRules;L2F;3| (|PositiveInteger|)
              |APPRULE;applyRules;LFPiF;4| (26 . |eval|)
              (|Record| (|:| |key| 28) (|:| |entry| 8)) (|List| 24)
              (|PatternMatchResult| 6 8) (33 . |destruct|) (|Symbol|)
              (|Kernel| 8) (38 . |kernel|) (|List| 14) (|List| $) (43 . |eval|)
              (|List| 28) (50 . |localUnquote|) (56 . |eval|) (62 . |new|)
              (|PatternMatchResult| 6 $) (|Pattern| 6) (66 . |patternMatch|)
              (73 . |failed?|) (|Union| 17 '"failed") (78 . |satisfy?|)
              (|List| 26) (84 . |member?|) (90 . |failed|)
              (|Union| 8 '"failed") (94 . |getMatch|) (|PatternFunctions1| 6 8)
              (100 . |addBadValue|) (106 . |hasTopPredicate?|)
              (111 . |variables|) (116 . |resetBadValues|) (121 . |pattern|)
              (126 . |rhs|) (131 . |quotedOperators|) (|Union| 14 '#1#)
              (136 . |retractIfCan|) (|BasicOperator|) (141 . |operator|)
              (|List| 8) (146 . |argument|) (151 . |elt|)
              (|Union| 32 '#2="failed") (157 . |isPlus|) (162 . +)
              (168 . |Zero|) (172 . |isTimes|) (177 . *) (183 . |One|)
              (|Record| (|:| |val| $) (|:| |exponent| 74)) (|Union| 71 '#2#)
              (187 . |isPower|) (|Integer|) (192 . |positive?|)
              (|NonNegativeInteger|) (197 . ^) (|Union| $ '"failed")
              (203 . |recip|))
           '#(|localUnquote| 208 |applyRules| 214) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 79
                                                 '(1 10 9 0 11 1 12 8 0 13 1 8
                                                   14 0 15 1 12 8 0 16 2 8 17 0
                                                   0 18 3 8 0 0 14 0 23 1 26 25
                                                   0 27 1 29 0 28 30 3 8 0 0 31
                                                   32 33 2 0 8 8 34 35 2 8 0 0
                                                   34 36 0 26 0 37 3 8 38 0 39
                                                   38 40 1 26 17 0 41 2 26 42 0
                                                   39 43 2 44 17 26 0 45 0 26 0
                                                   46 2 26 47 39 0 48 2 49 39
                                                   39 8 50 1 39 17 0 51 1 39 32
                                                   0 52 1 39 0 0 53 1 10 39 0
                                                   54 1 10 8 0 55 1 10 34 0 56
                                                   1 8 57 0 58 1 29 59 0 60 1
                                                   29 61 0 62 2 8 0 59 32 63 1
                                                   8 64 0 65 2 8 0 0 0 66 0 8 0
                                                   67 1 8 64 0 68 2 8 0 0 0 69
                                                   0 8 0 70 1 8 72 0 73 1 74 17
                                                   0 75 2 8 0 0 76 77 1 8 78 0
                                                   79 2 0 8 8 34 35 2 0 8 19 8
                                                   20 3 0 8 19 8 21 22)))))
           '|lookupComplete|)) 
