
(/VERSIONCHECK 2) 

(DEFUN |CRAPACK;modTree;R2L;1| (|a| |lm| $)
  (PROG (|t|)
    (RETURN
     (SEQ
      (LETT |t| (SPADCALL (LENGTH |lm|) (|spadConstant| $ 8) (QREFELT $ 10))
            |CRAPACK;modTree;R2L;1|)
      (SPADCALL |t| |lm| (QREFELT $ 12))
      (SPADCALL |t| (ELT $ 13) (QREFELT $ 15))
      (EXIT
       (SPADCALL (SPADCALL |t| |a| (ELT $ 16) (QREFELT $ 17))
                 (QREFELT $ 18))))))) 

(DEFUN |CRAPACK;chineseRemainder;2LR;2| (|lv| |lm| $)
  (PROG (|y| |l| #1=#:G681 |v| #2=#:G682 |u| #3=#:G683 |m| #4=#:G680 |linv|
         |inv| |x|)
    (RETURN
     (SEQ
      (COND
       ((NULL (EQL (LENGTH |lm|) (LENGTH |lv|)))
        (|error| "lists of moduli and values not of same length"))
       ('T
        (SEQ
         (LETT |x| (SPADCALL (LENGTH |lm|) (|spadConstant| $ 8) (QREFELT $ 10))
               . #5=(|CRAPACK;chineseRemainder;2LR;2|))
         (LETT |x| (SPADCALL |x| |lm| (QREFELT $ 12)) . #5#)
         (SPADCALL |x| (ELT $ 13) (QREFELT $ 15))
         (LETT |y|
               (SPADCALL (LENGTH |lm|) (|spadConstant| $ 20) (QREFELT $ 10))
               . #5#)
         (LETT |y|
               (SPADCALL (SPADCALL |y| (QREFELT $ 21)) |x|
                         (CONS #'|CRAPACK;chineseRemainder;2LR;2!0| $)
                         (QREFELT $ 24))
               . #5#)
         (LETT |u|
               (SPADCALL (SPADCALL |y| (QREFELT $ 25))
                         (SPADCALL |x| (QREFELT $ 25)) (|spadConstant| $ 20)
                         (QREFELT $ 28))
               . #5#)
         (EXIT
          (COND ((QEQCAR |u| 1) (|error| "moduli not relatively prime"))
                ('T
                 (SEQ (LETT |inv| (QCAR (QCDR |u|)) . #5#)
                      (LETT |linv| (SPADCALL |inv| |lm| (QREFELT $ 19)) . #5#)
                      (LETT |l|
                            (PROGN
                             (LETT #4# NIL . #5#)
                             (SEQ (LETT |m| NIL . #5#) (LETT #3# |lm| . #5#)
                                  (LETT |u| NIL . #5#) (LETT #2# |linv| . #5#)
                                  (LETT |v| NIL . #5#) (LETT #1# |lv| . #5#)
                                  G190
                                  (COND
                                   ((OR (ATOM #1#)
                                        (PROGN (LETT |v| (CAR #1#) . #5#) NIL)
                                        (ATOM #2#)
                                        (PROGN (LETT |u| (CAR #2#) . #5#) NIL)
                                        (ATOM #3#)
                                        (PROGN (LETT |m| (CAR #3#) . #5#) NIL))
                                    (GO G191)))
                                  (SEQ
                                   (EXIT
                                    (LETT #4#
                                          (CONS
                                           (SPADCALL
                                            (SPADCALL |u| |v| (QREFELT $ 13))
                                            |m| (QREFELT $ 16))
                                           #4#)
                                          . #5#)))
                                  (LETT #1#
                                        (PROG1 (CDR #1#)
                                          (LETT #2#
                                                (PROG1 (CDR #2#)
                                                  (LETT #3# (CDR #3#) . #5#))
                                                . #5#))
                                        . #5#)
                                  (GO G190) G191 (EXIT (NREVERSE0 #4#))))
                            . #5#)
                      (LETT |y| (SPADCALL |y| |l| (QREFELT $ 12)) . #5#)
                      (EXIT
                       (SPADCALL
                        (SPADCALL
                         (SPADCALL |y| |x|
                                   (CONS #'|CRAPACK;chineseRemainder;2LR;2!1|
                                         $)
                                   (QREFELT $ 24))
                         (QREFELT $ 25))
                        (SPADCALL |x| (QREFELT $ 25))
                        (QREFELT $ 16)))))))))))))) 

(DEFUN |CRAPACK;chineseRemainder;2LR;2!1| (|x1| |x2| |x3| |x4| $)
  (SPADCALL (SPADCALL |x1| |x4| (QREFELT $ 13))
            (SPADCALL |x2| |x3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;chineseRemainder;2LR;2!0| (|x1| |x2| |x3| |x4| $)
  (SPADCALL (SPADCALL |x1| |x4| (QREFELT $ 13))
            (SPADCALL |x2| |x3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;chineseRemainder;L2L;3| (|llv| |lm| $)
  (PROG (|retVal| |y| |l| #1=#:G696 |v| #2=#:G697 |u3| #3=#:G698 |m| #4=#:G695
         #5=#:G694 |lv| |linv| |inv| |u| |x|)
    (RETURN
     (SEQ
      (LETT |x| (SPADCALL (LENGTH |lm|) (|spadConstant| $ 8) (QREFELT $ 10))
            . #6=(|CRAPACK;chineseRemainder;L2L;3|))
      (LETT |x| (SPADCALL |x| |lm| (QREFELT $ 12)) . #6#)
      (SPADCALL |x| (ELT $ 13) (QREFELT $ 15))
      (LETT |y| (SPADCALL (LENGTH |lm|) (|spadConstant| $ 20) (QREFELT $ 10))
            . #6#)
      (LETT |y|
            (SPADCALL (SPADCALL |y| (QREFELT $ 21)) |x|
                      (CONS #'|CRAPACK;chineseRemainder;L2L;3!0| $)
                      (QREFELT $ 24))
            . #6#)
      (LETT |u|
            (SPADCALL (SPADCALL |y| (QREFELT $ 25))
                      (SPADCALL |x| (QREFELT $ 25)) (|spadConstant| $ 20)
                      (QREFELT $ 28))
            . #6#)
      (EXIT
       (COND ((QEQCAR |u| 1) (|error| "moduli not relatively prime"))
             ('T
              (SEQ (LETT |inv| (QCAR (QCDR |u|)) . #6#)
                   (LETT |linv| (SPADCALL |inv| |lm| (QREFELT $ 19)) . #6#)
                   (LETT |retVal| NIL . #6#)
                   (SEQ (LETT |lv| NIL . #6#) (LETT #5# |llv| . #6#) G190
                        (COND
                         ((OR (ATOM #5#)
                              (PROGN (LETT |lv| (CAR #5#) . #6#) NIL))
                          #7=(GO G191)))
                        (SEQ
                         (LETT |l|
                               (PROGN
                                (LETT #4# NIL . #6#)
                                (SEQ (LETT |m| NIL . #6#) (LETT #3# |lm| . #6#)
                                     (LETT |u3| NIL . #6#)
                                     (LETT #2# |linv| . #6#)
                                     (LETT |v| NIL . #6#) (LETT #1# |lv| . #6#)
                                     G190
                                     (COND
                                      ((OR (ATOM #1#)
                                           (PROGN
                                            (LETT |v| (CAR #1#) . #6#)
                                            NIL)
                                           (ATOM #2#)
                                           (PROGN
                                            (LETT |u3| (CAR #2#) . #6#)
                                            NIL)
                                           (ATOM #3#)
                                           (PROGN
                                            (LETT |m| (CAR #3#) . #6#)
                                            NIL))
                                       #7#))
                                     (SEQ
                                      (EXIT
                                       (LETT #4#
                                             (CONS
                                              (SPADCALL
                                               (SPADCALL |u3| |v|
                                                         (QREFELT $ 13))
                                               |m| (QREFELT $ 16))
                                              #4#)
                                             . #6#)))
                                     (LETT #1#
                                           (PROG1 (CDR #1#)
                                             (LETT #2#
                                                   (PROG1 (CDR #2#)
                                                     (LETT #3# (CDR #3#)
                                                           . #6#))
                                                   . #6#))
                                           . #6#)
                                     #8=(GO G190) G191 (EXIT (NREVERSE0 #4#))))
                               . #6#)
                         (LETT |y| (SPADCALL |y| |l| (QREFELT $ 12)) . #6#)
                         (EXIT
                          (LETT |retVal|
                                (CONS
                                 (SPADCALL
                                  (SPADCALL
                                   (SPADCALL |y| |x|
                                             (CONS
                                              #'|CRAPACK;chineseRemainder;L2L;3!1|
                                              $)
                                             (QREFELT $ 24))
                                   (QREFELT $ 25))
                                  (SPADCALL |x| (QREFELT $ 25)) (QREFELT $ 16))
                                 |retVal|)
                                . #6#)))
                        (LETT #5# (CDR #5#) . #6#) #8# G191 (EXIT NIL))
                   (EXIT (REVERSE |retVal|)))))))))) 

(DEFUN |CRAPACK;chineseRemainder;L2L;3!1| (|x1| |x2| |x3| |x4| $)
  (SPADCALL (SPADCALL |x1| |x4| (QREFELT $ 13))
            (SPADCALL |x2| |x3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;chineseRemainder;L2L;3!0| (|x1| |x2| |x3| |x4| $)
  (SPADCALL (SPADCALL |x1| |x4| (QREFELT $ 13))
            (SPADCALL |x2| |x3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;extEuclidean| (|a| |b| |c| $)
  (PROG (|u|)
    (RETURN
     (SEQ
      (LETT |u| (SPADCALL |a| |b| |c| (QREFELT $ 28)) |CRAPACK;extEuclidean|)
      (EXIT
       (COND
        ((QEQCAR |u| 1)
         (|error|
          (LIST (SPADCALL |c| (QREFELT $ 33)) " not spanned by "
                (SPADCALL |a| (QREFELT $ 33)) " and "
                (SPADCALL |b| (QREFELT $ 33)))))
        ('T (LIST (QCDR (QCDR |u|)) (QCAR (QCDR |u|)))))))))) 

(DEFUN |CRAPACK;multiEuclideanTree;LRL;5| (|fl| |rhs| $)
  (PROG (|x|)
    (RETURN
     (SEQ
      (LETT |x| (SPADCALL (LENGTH |fl|) |rhs| (QREFELT $ 10))
            . #1=(|CRAPACK;multiEuclideanTree;LRL;5|))
      (LETT |x| (SPADCALL |x| |fl| (QREFELT $ 12)) . #1#)
      (SPADCALL |x| (ELT $ 13) (QREFELT $ 15))
      (EXIT
       (SPADCALL
        (SPADCALL |x| |rhs| (CONS (|function| |CRAPACK;extEuclidean|) $)
                  (QREFELT $ 35))
        (QREFELT $ 18))))))) 

(DEFUN |CRApackage| (#1=#:G708)
  (PROG ()
    (RETURN
     (PROG (#2=#:G709)
       (RETURN
        (COND
         ((LETT #2#
                (|lassocShiftWithFunction| (LIST (|devaluate| #1#))
                                           (HGET |$ConstructorCache|
                                                 '|CRApackage|)
                                           '|domainEqualList|)
                . #3=(|CRApackage|))
          (|CDRwithIncrement| #2#))
         ('T
          (UNWIND-PROTECT (PROG1 (|CRApackage;| #1#) (LETT #2# T . #3#))
            (COND ((NOT #2#) (HREM |$ConstructorCache| '|CRApackage|))))))))))) 

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

(MAKEPROP '|CRApackage| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) 'BB (0 . |Zero|)
              (|NonNegativeInteger|) (4 . |balancedBinaryTree|) (|List| 6)
              (10 . |setleaves!|) (16 . *) (|Mapping| 6 6 6) (22 . |mapUp!|)
              (28 . |rem|) (34 . |mapDown!|) (41 . |leaves|)
              |CRAPACK;modTree;R2L;1| (46 . |One|) (50 . |copy|) (55 . +)
              (|Mapping| 6 6 6 6 6) (61 . |mapUp!|) (68 . |value|)
              (|Record| (|:| |coef1| $) (|:| |coef2| $)) (|Union| 26 '"failed")
              (73 . |extendedEuclidean|) |CRAPACK;chineseRemainder;2LR;2|
              (|List| 11) |CRAPACK;chineseRemainder;L2L;3| (|OutputForm|)
              (80 . |coerce|) (|Mapping| 11 6 6 6) (85 . |mapDown!|)
              |CRAPACK;multiEuclideanTree;LRL;5|)
           '#(|multiEuclideanTree| 92 |modTree| 98 |chineseRemainder| 104) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 36
                                                 '(0 6 0 8 2 7 0 9 6 10 2 7 0 0
                                                   11 12 2 6 0 0 0 13 2 7 6 0
                                                   14 15 2 6 0 0 0 16 3 7 0 0 6
                                                   14 17 1 7 11 0 18 0 6 0 20 1
                                                   7 0 0 21 2 6 0 0 0 22 3 7 0
                                                   0 0 23 24 1 7 6 0 25 3 6 27
                                                   0 0 0 28 1 6 32 0 33 3 7 0 0
                                                   6 34 35 2 0 11 11 6 36 2 0
                                                   11 6 11 19 2 0 6 11 11 29 2
                                                   0 11 30 11 31)))))
           '|lookupComplete|)) 
