
(/VERSIONCHECK 2) 

(DEFUN |SCACHE;expandCache| (|x| $)
  (PROG (|ocache| |k| #0=#:G1824)
    (RETURN
      (SEQ (COND
             ((EQL (QREFELT $ 8) (QREFELT $ 9))
              (SEQ (LETT |ocache| (QREFELT $ 7)
                         . #1=(|SCACHE;expandCache|))
                   (SETELT $ 8
                           (+ (SPADCALL 2 (QREFELT $ 8) (QREFELT $ 12))
                              10))
                   (SETELT $ 7
                           (SPADCALL (QREFELT $ 8) |x| (QREFELT $ 14)))
                   (EXIT (SEQ (LETT |k| 0 . #1#)
                              (LETT #0# (- (QREFELT $ 9) 1) . #1#) G190
                              (COND ((QSGREATERP |k| #0#) (GO G191)))
                              (SEQ (EXIT
                                    (SETELT (QREFELT $ 7) |k|
                                     (ELT |ocache| |k|))))
                              (LETT |k| (QSADD1 |k|) . #1#) (GO G190)
                              G191 (EXIT NIL))))))
           (EXIT (SPADCALL (QREFELT $ 16))))))) 

(DEFUN |SCACHE;insertBefore| (|l| |x| $)
  (PROG (|vscan| |k| #0=#:G1828)
    (RETURN
      (SEQ (|SCACHE;expandCache| |x| $)
           (LETT |vscan| (QREFELT $ 7) . #1=(|SCACHE;insertBefore|))
           (SEQ (LETT |k| 0 . #1#)
                (LETT #0# (- (- (QREFELT $ 9) |l|) 1) . #1#) G190
                (COND ((QSGREATERP |k| #0#) (GO G191)))
                (SEQ (EXIT (SETELT |vscan| (- (QREFELT $ 9) |k|)
                                   (ELT |vscan|
                                    (- (- (QREFELT $ 9) |k|) 1)))))
                (LETT |k| (QSADD1 |k|) . #1#) (GO G190) G191
                (EXIT NIL))
           (SETELT |vscan| |l| |x|) (SETELT $ 9 (+ (QREFELT $ 9) 1))
           (EXIT (SPADCALL (QREFELT $ 16))))))) 

(DEFUN |SCACHE;shiftCache| (|l| |n| $)
  (PROG (|vscan| |k| #0=#:G1833 |x|)
    (RETURN
      (SEQ (LETT |vscan| (QREFELT $ 7) . #1=(|SCACHE;shiftCache|))
           (SEQ (LETT |k| |l| . #1#)
                (LETT #0# (- (QREFELT $ 9) 1) . #1#) G190
                (COND ((> |k| #0#) (GO G191)))
                (SEQ (LETT |x| (ELT |vscan| |k|) . #1#)
                     (EXIT (SPADCALL |x|
                               (+ |n| (SPADCALL |x| (QREFELT $ 17)))
                               (QREFELT $ 18))))
                (LETT |k| (+ |k| 1) . #1#) (GO G190) G191 (EXIT NIL))
           (EXIT (SPADCALL (QREFELT $ 16))))))) 

(DEFUN |SCACHE;clearCache;V;4| ($)
  (PROG (|vscan| |k| #0=#:G1838 |x|)
    (RETURN
      (SEQ (LETT |vscan| (QREFELT $ 7) . #1=(|SCACHE;clearCache;V;4|))
           (SEQ (LETT |k| 0 . #1#) (LETT #0# (- (QREFELT $ 9) 1) . #1#)
                G190 (COND ((QSGREATERP |k| #0#) (GO G191)))
                (SEQ (LETT |x| (ELT |vscan| |k|) . #1#)
                     (EXIT (SPADCALL |x| 0 (QREFELT $ 18))))
                (LETT |k| (QSADD1 |k|) . #1#) (GO G190) G191
                (EXIT NIL))
           (SETELT $ 7 (GETREFV 0)) (SETELT $ 8 0) (SETELT $ 9 0)
           (EXIT (SPADCALL (QREFELT $ 16))))))) 

(DEFUN |SCACHE;insertAtEnd| (|x| $)
  (SEQ (|SCACHE;expandCache| |x| $)
       (SETELT (QREFELT $ 7) (QREFELT $ 9) |x|)
       (SETELT $ 9 (+ (QREFELT $ 9) 1))
       (EXIT (SPADCALL (QREFELT $ 16))))) 

(DEFUN |SCACHE;enterInCache;SMS;6| (|x| |equal?| $)
  (PROG (|vscan| |k| #0=#:G1847 |y| #1=#:G1846 #2=#:G1842)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |vscan| (QREFELT $ 7)
                            . #3=(|SCACHE;enterInCache;SMS;6|))
                      (SEQ (LETT |k| 0 . #3#)
                           (LETT #0# (- (QREFELT $ 9) 1) . #3#) G190
                           (COND ((QSGREATERP |k| #0#) (GO G191)))
                           (SEQ (EXIT (SEQ
                                       (LETT |y|
                                        (ELT |vscan| |k|) . #3#)
                                       (EXIT
                                        (COND
                                          ((SPADCALL |y| |equal?|)
                                           (PROGN
                                             (LETT #2#
                                              (SEQ
                                               (SPADCALL |x|
                                                (SPADCALL |y|
                                                 (QREFELT $ 17))
                                                (QREFELT $ 18))
                                               (EXIT
                                                (PROGN
                                                  (LETT #1# |y| . #3#)
                                                  (GO #1#)))) . #3#)
                                             (GO #2#)))))))
                                #2# (EXIT #2#))
                           (LETT |k| (QSADD1 |k|) . #3#) (GO G190) G191
                           (EXIT NIL))
                      (SPADCALL |x| (+ 1 (QREFELT $ 9)) (QREFELT $ 18))
                      (|SCACHE;insertAtEnd| |x| $) (EXIT |x|)))
           #1# (EXIT #1#))))) 

(DEFUN |SCACHE;enterInCache;SMS;7| (|x| |triage| $)
  (PROG (|vscan| |m0| |i| |y| |cp| |m| |l| #0=#:G1858 |pos| #1=#:G1853)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |vscan| (QREFELT $ 7)
                            . #2=(|SCACHE;enterInCache;SMS;7|))
                      (LETT |l| -1 . #2#)
                      (LETT |m| (QREFELT $ 9) . #2#)
                      (LETT |m0| |m| . #2#)
                      (EXIT (COND
                              ((ZEROP (QREFELT $ 9))
                               (SEQ (SPADCALL |x| 1024 (QREFELT $ 18))
                                    (|SCACHE;insertAtEnd| |x| $)
                                    (EXIT
                                     (PROGN
                                       (LETT #0# |x| . #2#)
                                       (GO #0#)))))
                              ('T
                               (SEQ (SEQ G190
                                     (COND
                                       ((NULL (< (+ |l| 1) |m|))
                                        (GO G191)))
                                     (SEQ
                                      (LETT |i|
                                       (ASH (+ |l| |m|) -1) . #2#)
                                      (LETT |cp|
                                       (SPADCALL |x|
                                        (LETT |y|
                                         (ELT |vscan| |i|) . #2#)
                                        |triage|) . #2#)
                                      (EXIT
                                       (COND
                                         ((ZEROP |cp|)
                                          (SEQ
                                           (SPADCALL |x|
                                            (SPADCALL |y|
                                             (QREFELT $ 17))
                                            (QREFELT $ 18))
                                           (EXIT
                                            (PROGN
                                              (LETT #0# |y| . #2#)
                                              (GO #0#)))))
                                         ((< |cp| 0)
                                          (LETT |m| |i| . #2#))
                                         ('T (LETT |l| |i| . #2#)))))
                                     NIL (GO G190) G191 (EXIT NIL))
                                    (EXIT
                                     (COND
                                       ((EQL |m| |m0|)
                                        (SEQ
                                         (SPADCALL |x|
                                          (+
                                           (SPADCALL
                                            (ELT |vscan| (- |m| 1))
                                            (QREFELT $ 17))
                                           1024)
                                          (QREFELT $ 18))
                                         (|SCACHE;insertAtEnd| |x| $)
                                         (EXIT
                                          (PROGN
                                            (LETT #0# |x| . #2#)
                                            (GO #0#)))))
                                       ('T
                                        (SEQ
                                         (LETT |pos|
                                          (COND
                                            ((< |l| 0) 0)
                                            ('T
                                             (SPADCALL
                                              (ELT |vscan| |l|)
                                              (QREFELT $ 17)))) . #2#)
                                         (EXIT
                                          (|SCACHE;insertInCache|
                                           (PROG1
                                            (LETT #1# (+ |l| 1) . #2#)
                                             (|check-subtype|
                                              (>= #1# 0)
                                              '(|NonNegativeInteger|)
                                              #1#))
                                           |x| |pos| $))))))))))))
           #0# (EXIT #0#))))) 

(DEFUN |SCACHE;insertInCache| (|before| |x| |pos| $)
  (PROG (|y| #0=#:G1860)
    (RETURN
      (SEQ (LETT |y| (ELT (QREFELT $ 7) |before|)
                 . #1=(|SCACHE;insertInCache|))
           (COND
             ((EQL (+ |pos| 1) (SPADCALL |y| (QREFELT $ 17)))
              (|SCACHE;shiftCache| |before| 1024 $)))
           (SPADCALL |x|
               (+ |pos|
                  (QUOTIENT2
                      (PROG1 (LETT #0#
                                   (- (SPADCALL |y| (QREFELT $ 17))
                                    |pos|) . #1#)
                        (|check-subtype| (>= #0# 0)
                            '(|NonNegativeInteger|) #0#))
                      2))
               (QREFELT $ 18))
           (|SCACHE;insertBefore| |before| |x| $) (EXIT |x|))))) 

(DEFUN |SortedCache| (#0=#:G1863)
  (PROG ()
    (RETURN
      (PROG (#1=#:G1864)
        (RETURN
          (COND
            ((LETT #1#
                   (|lassocShiftWithFunction| (LIST (|devaluate| #0#))
                       (HGET |$ConstructorCache| '|SortedCache|)
                       '|domainEqualList|)
                   . #2=(|SortedCache|))
             (|CDRwithIncrement| #1#))
            ('T
             (UNWIND-PROTECT
               (PROG1 (|SortedCache;| #0#) (LETT #1# T . #2#))
               (COND
                 ((NOT #1#) (HREM |$ConstructorCache| '|SortedCache|))))))))))) 

(DEFUN |SortedCache;| (|#1|)
  (PROG (DV$1 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|SortedCache|))
        (LETT |dv$| (LIST '|SortedCache| DV$1) . #0#)
        (LETT $ (GETREFV 24) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|SortedCache| (LIST DV$1)
            (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 (GETREFV 0))
        (QSETREFV $ 8 0)
        (QSETREFV $ 9 0)
        $)))) 

(MAKEPROP '|SortedCache| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) '|cache|
             '|cache_size| '|cache_use| (|PositiveInteger|)
             (|NonNegativeInteger|) (0 . *) (|PrimitiveArray| 6)
             (6 . |new|) (|Void|) (12 . |void|) (16 . |position|)
             (21 . |setPosition|) |SCACHE;clearCache;V;4|
             (|Mapping| (|Boolean|) 6) |SCACHE;enterInCache;SMS;6|
             (|Mapping| (|Integer|) 6 6) |SCACHE;enterInCache;SMS;7|)
          '#(|enterInCache| 27 |clearCache| 39) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 23
                                '(2 11 0 10 0 12 2 13 0 11 6 14 0 15 0
                                  16 1 6 11 0 17 2 6 15 0 11 18 2 0 6 6
                                  22 23 2 0 6 6 20 21 0 0 15 19)))))
          '|lookupComplete|)) 
