
(/VERSIONCHECK 2) 

(DEFUN |SORTPAK;bubbleSort!;AMA;1| (|m| |f| $)
  (PROG (#1=#:G1806 |j| #2=#:G1805 |i| |n|)
    (RETURN
     (SEQ
      (LETT |n| (SPADCALL |m| (QREFELT $ 9))
            . #3=(|SORTPAK;bubbleSort!;AMA;1|))
      (SEQ (LETT |i| 1 . #3#) (LETT #2# (- |n| 1) . #3#) G190
           (COND ((QSGREATERP |i| #2#) #4=(GO G191)))
           (SEQ
            (EXIT
             (SEQ (LETT |j| |n| . #3#) (LETT #1# (+ |i| 1) . #3#) G190
                  (COND ((< |j| #1#) #4#))
                  (SEQ
                   (EXIT
                    (COND
                     ((SPADCALL (SPADCALL |m| |j| (QREFELT $ 11))
                                (SPADCALL |m| (- |j| 1) (QREFELT $ 11)) |f|)
                      (SPADCALL |m| |j| (- |j| 1) (QREFELT $ 13))))))
                  (LETT |j| (+ |j| -1) . #3#) #5=(GO G190) G191 (EXIT NIL))))
           (LETT |i| (QSADD1 |i|) . #3#) #5# G191 (EXIT NIL))
      (EXIT |m|))))) 

(DEFUN |SORTPAK;insertionSort!;AMA;2| (|m| |f| $)
  (PROG (|j| #1=#:G1813 |i|)
    (RETURN
     (SEQ
      (SEQ (LETT |i| 2 . #2=(|SORTPAK;insertionSort!;AMA;2|))
           (LETT #1# (SPADCALL |m| (QREFELT $ 9)) . #2#) G190
           (COND ((QSGREATERP |i| #1#) #3=(GO G191)))
           (SEQ (LETT |j| |i| . #2#)
                (EXIT
                 (SEQ G190
                      (COND
                       ((NULL
                         (COND
                          ((< 1 |j|)
                           (SPADCALL (SPADCALL |m| |j| (QREFELT $ 11))
                                     (SPADCALL |m| (- |j| 1) (QREFELT $ 11))
                                     |f|))
                          ('T 'NIL)))
                        #3#))
                      (SEQ (SPADCALL |m| |j| (- |j| 1) (QREFELT $ 13))
                           (EXIT (LETT |j| (- |j| 1) . #2#)))
                      NIL #4=(GO G190) G191 (EXIT NIL))))
           (LETT |i| (QSADD1 |i|) . #2#) #4# G191 (EXIT NIL))
      (EXIT |m|))))) 

(DEFUN |SORTPAK;bubbleSort!;2A;3| (|m| $)
  (SPADCALL |m| (ELT $ 18) (QREFELT $ 15))) 

(DEFUN |SORTPAK;insertionSort!;2A;4| (|m| $)
  (SPADCALL |m| (ELT $ 18) (QREFELT $ 16))) 

(DEFUN |SORTPAK;bubbleSort!;AMA;5| (|m| |fn| $)
  (PROG (|l| |x| |r|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |m| (QREFELT $ 21)) |m|)
            ('T
             (SEQ (LETT |l| |m| . #1=(|SORTPAK;bubbleSort!;AMA;5|))
                  (SEQ G190
                       (COND
                        ((NULL
                          (COND
                           ((SPADCALL
                             (LETT |r| (SPADCALL |l| '|rest| (QREFELT $ 23))
                                   . #1#)
                             (QREFELT $ 21))
                            'NIL)
                           ('T 'T)))
                         (GO G191)))
                       (SEQ (LETT |r| (SPADCALL |r| |fn| (QREFELT $ 15)) . #1#)
                            (LETT |x| (SPADCALL |l| '|first| (QREFELT $ 25))
                                  . #1#)
                            (COND
                             ((SPADCALL (SPADCALL |r| '|first| (QREFELT $ 25))
                                        |x| |fn|)
                              (SEQ
                               (SPADCALL |l| '|first|
                                         (SPADCALL |r| '|first| (QREFELT $ 25))
                                         (QREFELT $ 26))
                               (EXIT
                                (SPADCALL |r| '|first| |x| (QREFELT $ 26))))))
                            (SPADCALL |l| '|rest| |r| (QREFELT $ 27))
                            (EXIT
                             (LETT |l| (SPADCALL |l| '|rest| (QREFELT $ 23))
                                   . #1#)))
                       NIL (GO G190) G191 (EXIT NIL))
                  (EXIT |m|)))))))) 

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

(DEFUN |SortPackage;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|SortPackage|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|SortPackage| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 28) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#1|
                                                         '(|OrderedSet|))))
                      . #1#))
      (|haddProp| |$ConstructorCache| '|SortPackage| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (COND
       ((|testBitVector| |pv$| 1)
        (PROGN
         (QSETREFV $ 19
                   (CONS (|dispatchFunction| |SORTPAK;bubbleSort!;2A;3|) $))
         (QSETREFV $ 20
                   (CONS (|dispatchFunction| |SORTPAK;insertionSort!;2A;4|)
                         $)))))
      (COND
       ((|HasCategory| |#2|
                       (LIST '|UnaryRecursiveAggregate| (|devaluate| |#1|)))
        (QSETREFV $ 15
                  (CONS (|dispatchFunction| |SORTPAK;bubbleSort!;AMA;5|) $))))
      $)))) 

(MAKEPROP '|SortPackage| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|NonNegativeInteger|) (0 . |#|) (|Integer|) (5 . |elt|) (|Void|)
              (11 . |swap!|) (|Mapping| 17 6 6) |SORTPAK;bubbleSort!;AMA;1|
              |SORTPAK;insertionSort!;AMA;2| (|Boolean|) (18 . <)
              (24 . |bubbleSort!|) (29 . |insertionSort!|) (34 . |empty?|)
              '"rest" (39 . |elt|) '"first" (45 . |elt|) (51 . |setelt|)
              (58 . |setelt|))
           '#(|insertionSort!| 65 |bubbleSort!| 76) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 27
                                                 '(1 7 8 0 9 2 7 6 0 10 11 3 7
                                                   12 0 10 10 13 2 6 17 0 0 18
                                                   1 0 7 7 19 1 0 7 7 20 1 7 17
                                                   0 21 2 7 0 0 22 23 2 7 6 0
                                                   24 25 3 7 6 0 24 6 26 3 7 0
                                                   0 22 0 27 1 1 7 7 20 2 0 7 7
                                                   14 16 1 1 7 7 19 2 0 7 7 14
                                                   15)))))
           '|lookupComplete|)) 
