
(/VERSIONCHECK 2) 

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

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

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

(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 (|i| |v| #0=#:G1859 |k| #1=#:G1858)
    (RETURN
      (SEQ (SEQ (LETT |i| 1 . #2=(|APPRULE;localApply|)) G190
                (COND ((QSGREATERP |i| |n|) #3=(GO G191)))
                (SEQ (SEQ (LETT |v| NIL . #2#) (LETT #0# |lv| . #2#)
                          (LETT |k| NIL . #2#) (LETT #1# |lk| . #2#)
                          G190
                          (COND
                            ((OR (ATOM #1#)
                                 (PROGN
                                   (LETT |k| (CAR #1#) . #2#)
                                   NIL)
                                 (ATOM #0#)
                                 (PROGN
                                   (LETT |v| (CAR #0#) . #2#)
                                   NIL))
                             #3#))
                          (SEQ (EXIT (LETT |subject|
                                      (SPADCALL |subject| |k| |v|
                                       (QREFELT $ 23)) . #2#)))
                          (LETT #1#
                                (PROG1 (CDR #1#)
                                  (LETT #0# (CDR #0#) . #2#)) . #2#)
                          #4=(GO G190) G191 (EXIT NIL))
                     (EXIT (LETT |subject|
                                 (|APPRULE;app| |lrule| |subject| $) . #2#)))
                (LETT |i| (QSADD1 |i|) . #2#) #4# G191 (EXIT NIL))
           (EXIT |subject|))))) 

(DEFUN |APPRULE;rewrite| (|f| |res| |l| $)
  (PROG (|rec| #0=#:G1867 |lk| |lv|)
    (RETURN
      (SEQ (LETT |lk| NIL . #1=(|APPRULE;rewrite|))
           (LETT |lv| NIL . #1#)
           (SEQ (LETT |rec| NIL . #1#)
                (LETT #0# (SPADCALL |res| (QREFELT $ 27)) . #1#) G190
                (COND
                  ((OR (ATOM #0#)
                       (PROGN (LETT |rec| (CAR #0#) . #1#) NIL))
                   (GO G191)))
                (SEQ (LETT |lk|
                           (CONS (SPADCALL (QCAR |rec|) (QREFELT $ 30))
                                 |lk|) . #1#)
                     (EXIT (LETT |lv| (CONS (QCDR |rec|) |lv|) . #1#)))
                (LETT #0# (CDR #0#) . #1#) (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 (|u| #0=#:G1875 |v| #1=#:G1889 #2=#:G1881)
    (RETURN
      (SEQ (COND
             ((OR (SPADCALL
                      (LETT |u|
                            (SPADCALL |subject| |pat|
                                (SPADCALL (QREFELT $ 37))
                                (QREFELT $ 40))
                            . #3=(|APPRULE;isitwithpred|))
                      (QREFELT $ 41))
                  (PROG2 (LETT #0#
                               (SPADCALL |u| |pat| (QREFELT $ 43)) . #3#)
                         (QCDR #0#)
                    (|check-union| (QEQCAR #0# 0) (|Boolean|) #0#)))
              |u|)
             ((SPADCALL |u| |bad| (QREFELT $ 45))
              (SPADCALL (QREFELT $ 46)))
             ('T
              (SEQ (SEQ (LETT |v| NIL . #3#) (LETT #1# |vars| . #3#)
                        G190
                        (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |v| (CAR #1#) . #3#) NIL))
                           (GO G191)))
                        (SEQ (EXIT (SPADCALL |v|
                                    (PROG2
                                     (LETT #2#
                                      (SPADCALL |v| |u| (QREFELT $ 48)) . #3#)
                                     (QCDR #2#)
                                      (|check-union| (QEQCAR #2# 0)
                                       (QREFELT $ 8) #2#))
                                    (QREFELT $ 50))))
                        (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                        (EXIT NIL))
                   (EXIT (|APPRULE;isitwithpred| |subject| |pat| |vars|
                             (CONS |u| |bad|) $))))))))) 

(DEFUN |APPRULE;isit| (|subject| |pat| $)
  (PROG (|v| |l| #0=#:G1894)
    (RETURN
      (SEQ (COND
             ((SPADCALL |pat| (QREFELT $ 51))
              (SEQ (SEQ (LETT |v| NIL . #1=(|APPRULE;isit|))
                        (LETT #0#
                              (LETT |l|
                                    (SPADCALL |pat| (QREFELT $ 52)) . #1#) . #1#)
                        G190
                        (COND
                          ((OR (ATOM #0#)
                               (PROGN (LETT |v| (CAR #0#) . #1#) NIL))
                           (GO G191)))
                        (SEQ (EXIT (SPADCALL |v| (QREFELT $ 53))))
                        (LETT #0# (CDR #0#) . #1#) (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 (|r| #0=#:G1939 |u| #1=#:G1938 #2=#:G1896 |k| #3=#:G1815
             #4=#:G1940 #5=#:G1911 #6=#:G1909 #7=#:G1910 |l| #8=#:G1816
             #9=#:G1907 #10=#:G1941 #11=#:G1914 #12=#:G1912 #13=#:G1913
             |e| #14=#:G1921 |ee| |f| #15=#:G1924 #16=#:G1929
             #17=#:G1932)
    (RETURN
      (SEQ (EXIT (SEQ (SEQ (EXIT (SEQ (LETT |r| NIL
                                       . #18=(|APPRULE;app|))
                                      (LETT #0# |lrule| . #18#) G190
                                      (COND
                                        ((OR (ATOM #0#)
                                          (PROGN
                                            (LETT |r| (CAR #0#) . #18#)
                                            NIL))
                                         #19=(GO G191)))
                                      (SEQ
                                       (EXIT
                                        (COND
                                          ((NULL
                                            (SPADCALL
                                             (LETT |u|
                                              (|APPRULE;isit| |subject|
                                               (SPADCALL |r|
                                                (QREFELT $ 54))
                                               $) . #18#)
                                             (QREFELT $ 41)))
                                           (PROGN
                                             (LETT #2#
                                              (PROGN
                                                (LETT #1#
                                                 (|APPRULE;rewrite|
                                                  (SPADCALL |r|
                                                   (QREFELT $ 55))
                                                  |u|
                                                  (SPADCALL |r|
                                                   (QREFELT $ 56))
                                                  $) . #18#)
                                                (GO #1#)) . #18#)
                                             (GO #2#))))))
                                      (LETT #0# (CDR #0#) . #18#)
                                      #20=(GO G190) G191 (EXIT NIL)))
                           #2# (EXIT #2#))
                      (LETT |k|
                            (SPADCALL |subject| (QREFELT $ 58)) . #18#)
                      (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)) . #18#)
                                       0)
                               (PROGN
                                 (LETT #7# NIL . #18#)
                                 (SEQ (LETT #3# NIL . #18#)
                                      (LETT #4#
                                       (|APPRULE;applist| |lrule|
                                        (PROG2 (LETT #9# |l| . #18#)
                                         (QCDR #9#)
                                          (|check-union| (QEQCAR #9# 0)
                                           (|List| (QREFELT $ 8)) #9#))
                                        $) . #18#)
                                      G190
                                      (COND
                                        ((OR (ATOM #4#)
                                          (PROGN
                                            (LETT #3# (CAR #4#) . #18#)
                                            NIL))
                                         #19#))
                                      (SEQ
                                       (EXIT
                                        (PROGN
                                          (LETT #5# #3# . #18#)
                                          (COND
                                            (#7#
                                             (LETT #6#
                                              (SPADCALL #6# #5#
                                               (QREFELT $ 66)) . #18#))
                                            ('T
                                             (PROGN
                                               (LETT #6# #5# . #18#)
                                               (LETT #7# 'T . #18#)))))))
                                      (LETT #4# (CDR #4#) . #18#) #20#
                                      G191 (EXIT NIL))
                                 (COND
                                   (#7# #6#)
                                   ('T (|spadConstant| $ 67)))))
                              ((QEQCAR (LETT |l|
                                        (SPADCALL |subject|
                                         (QREFELT $ 68)) . #18#)
                                       0)
                               (PROGN
                                 (LETT #13# NIL . #18#)
                                 (SEQ (LETT #8# NIL . #18#)
                                      (LETT #10#
                                       (|APPRULE;applist| |lrule|
                                        (PROG2 (LETT #9# |l| . #18#)
                                         (QCDR #9#)
                                          (|check-union| (QEQCAR #9# 0)
                                           (|List| (QREFELT $ 8)) #9#))
                                        $) . #18#)
                                      G190
                                      (COND
                                        ((OR (ATOM #10#)
                                          (PROGN
                                            (LETT #8#
                                             (CAR #10#) . #18#)
                                            NIL))
                                         #19#))
                                      (SEQ
                                       (EXIT
                                        (PROGN
                                          (LETT #11# #8# . #18#)
                                          (COND
                                            (#13#
                                             (LETT #12#
                                              (SPADCALL #12# #11#
                                               (QREFELT $ 69)) . #18#))
                                            ('T
                                             (PROGN
                                               (LETT #12# #11# . #18#)
                                               (LETT #13# 'T . #18#)))))))
                                      (LETT #10# (CDR #10#) . #18#)
                                      #20# G191 (EXIT NIL))
                                 (COND
                                   (#13# #12#)
                                   ('T (|spadConstant| $ 70)))))
                              ((QEQCAR (LETT |e|
                                        (SPADCALL |subject|
                                         (QREFELT $ 73)) . #18#)
                                       0)
                               (SEQ (LETT |ee|
                                     (PROG2 (LETT #14# |e| . #18#)
                                      (QCDR #14#)
                                       (|check-union| (QEQCAR #14# 0)
                                        (|Record|
                                         (|:| |val| (QREFELT $ 8))
                                         (|:| |exponent| (|Integer|)))
                                        #14#)) . #18#)
                                    (LETT |f|
                                     (|APPRULE;app| |lrule| (QCAR |ee|)
                                      $) . #18#)
                                    (EXIT
                                     (COND
                                       ((SPADCALL (QCDR |ee|)
                                         (QREFELT $ 75))
                                        (SPADCALL |f|
                                         (PROG1
                                          (LETT #15#
                                           (QCDR |ee|) . #18#)
                                           (|check-subtype| (>= #15# 0)
                                            '(|NonNegativeInteger|)
                                            #15#))
                                         (QREFELT $ 77)))
                                       ('T
                                        (SPADCALL
                                         (PROG2
                                          (LETT #16#
                                           (SPADCALL |f|
                                            (QREFELT $ 79)) . #18#)
                                          (QCDR #16#)
                                           (|check-union|
                                            (QEQCAR #16# 0)
                                            (QREFELT $ 8) #16#))
                                         (PROG1
                                          (LETT #17#
                                           (- (QCDR |ee|)) . #18#)
                                           (|check-subtype| (>= #17# 0)
                                            '(|NonNegativeInteger|)
                                            #17#))
                                         (QREFELT $ 77)))))))
                              ('T |subject|)))))
           #1# (EXIT #1#))))) 

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

(DEFUN |ApplyRules;| (|#1| |#2| |#3|)
  (PROG (DV$1 DV$2 DV$3 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|ApplyRules|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT |dv$| (LIST '|ApplyRules| DV$1 DV$2 DV$3) . #0#)
        (LETT $ (GETREFV 80) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|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 '"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 '"failed") (136 . |retractIfCan|)
             (|BasicOperator|) (141 . |operator|) (|List| 8)
             (146 . |argument|) (151 . |elt|) (|Union| 32 '"failed")
             (157 . |isPlus|) (162 . +) (168 . |Zero|)
             (172 . |isTimes|) (177 . *) (183 . |One|)
             (|Record| (|:| |val| $) (|:| |exponent| 74))
             (|Union| 71 '"failed") (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|)) 
