
(/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 (|x| |inv| |linv| #0=#:G1834 |m| #1=#:G1837 |u| #2=#:G1836 |v|
             #3=#:G1835 |l| |y|)
    (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))
                         . #4=(|CRAPACK;chineseRemainder;2LR;2|))
                   (LETT |x| (SPADCALL |x| |lm| (QREFELT $ 12)) . #4#)
                   (SPADCALL |x| (ELT $ 13) (QREFELT $ 15))
                   (LETT |y|
                         (SPADCALL (LENGTH |lm|) (|spadConstant| $ 20)
                             (QREFELT $ 10)) . #4#)
                   (LETT |y|
                         (SPADCALL (SPADCALL |y| (QREFELT $ 21)) |x|
                             (CONS #'|CRAPACK;chineseRemainder;2LR;2!0|
                                   $)
                             (QREFELT $ 24)) . #4#)
                   (LETT |u|
                         (SPADCALL (SPADCALL |y| (QREFELT $ 25))
                             (SPADCALL |x| (QREFELT $ 25))
                             (|spadConstant| $ 20) (QREFELT $ 28)) . #4#)
                   (EXIT (COND
                           ((QEQCAR |u| 1)
                            (|error| "moduli not relatively prime"))
                           ('T
                            (SEQ (LETT |inv| (QCAR (QCDR |u|)) . #4#)
                                 (LETT |linv|
                                       (SPADCALL |inv| |lm|
                                        (QREFELT $ 19)) . #4#)
                                 (LETT |l|
                                       (PROGN
                                         (LETT #0# NIL . #4#)
                                         (SEQ (LETT |m| NIL . #4#)
                                          (LETT #1# |lm| . #4#)
                                          (LETT |u| NIL . #4#)
                                          (LETT #2# |linv| . #4#)
                                          (LETT |v| NIL . #4#)
                                          (LETT #3# |lv| . #4#) G190
                                          (COND
                                            ((OR (ATOM #3#)
                                              (PROGN
                                                (LETT |v|
                                                 (CAR #3#) . #4#)
                                                NIL)
                                              (ATOM #2#)
                                              (PROGN
                                                (LETT |u|
                                                 (CAR #2#) . #4#)
                                                NIL)
                                              (ATOM #1#)
                                              (PROGN
                                                (LETT |m|
                                                 (CAR #1#) . #4#)
                                                NIL))
                                             (GO G191)))
                                          (SEQ
                                           (EXIT
                                            (LETT #0#
                                             (CONS
                                              (SPADCALL
                                               (SPADCALL |u| |v|
                                                (QREFELT $ 13))
                                               |m| (QREFELT $ 16))
                                              #0#) . #4#)))
                                          (LETT #3#
                                           (PROG1 (CDR #3#)
                                             (LETT #2#
                                              (PROG1 (CDR #2#)
                                                (LETT #1#
                                                 (CDR #1#) . #4#)) . #4#)) . #4#)
                                          (GO G190) G191
                                          (EXIT (NREVERSE0 #0#)))) . #4#)
                                 (LETT |y|
                                       (SPADCALL |y| |l|
                                        (QREFELT $ 12)) . #4#)
                                 (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| (|#1| |#2| |#3| |#4| $)
  (SPADCALL (SPADCALL |#1| |#4| (QREFELT $ 13))
      (SPADCALL |#2| |#3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;chineseRemainder;2LR;2!0| (|#1| |#2| |#3| |#4| $)
  (SPADCALL (SPADCALL |#1| |#4| (QREFELT $ 13))
      (SPADCALL |#2| |#3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;chineseRemainder;L2L;3| (|llv| |lm| $)
  (PROG (|x| |u| |inv| |linv| |lv| #0=#:G1848 #1=#:G1849 |m| #2=#:G1852
             |u3| #3=#:G1851 |v| #4=#:G1850 |l| |y| |retVal|)
    (RETURN
      (SEQ (LETT |x|
                 (SPADCALL (LENGTH |lm|) (|spadConstant| $ 8)
                     (QREFELT $ 10))
                 . #5=(|CRAPACK;chineseRemainder;L2L;3|))
           (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;L2L;3!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 |retVal| NIL . #5#)
                         (SEQ (LETT |lv| NIL . #5#)
                              (LETT #0# |llv| . #5#) G190
                              (COND
                                ((OR (ATOM #0#)
                                     (PROGN
                                       (LETT |lv| (CAR #0#) . #5#)
                                       NIL))
                                 #6=(GO G191)))
                              (SEQ (LETT |l|
                                    (PROGN
                                      (LETT #1# NIL . #5#)
                                      (SEQ (LETT |m| NIL . #5#)
                                       (LETT #2# |lm| . #5#)
                                       (LETT |u3| NIL . #5#)
                                       (LETT #3# |linv| . #5#)
                                       (LETT |v| NIL . #5#)
                                       (LETT #4# |lv| . #5#) G190
                                       (COND
                                         ((OR (ATOM #4#)
                                           (PROGN
                                             (LETT |v| (CAR #4#) . #5#)
                                             NIL)
                                           (ATOM #3#)
                                           (PROGN
                                             (LETT |u3|
                                              (CAR #3#) . #5#)
                                             NIL)
                                           (ATOM #2#)
                                           (PROGN
                                             (LETT |m| (CAR #2#) . #5#)
                                             NIL))
                                          #6#))
                                       (SEQ
                                        (EXIT
                                         (LETT #1#
                                          (CONS
                                           (SPADCALL
                                            (SPADCALL |u3| |v|
                                             (QREFELT $ 13))
                                            |m| (QREFELT $ 16))
                                           #1#) . #5#)))
                                       (LETT #4#
                                        (PROG1 (CDR #4#)
                                          (LETT #3#
                                           (PROG1 (CDR #3#)
                                             (LETT #2# (CDR #2#) . #5#)) . #5#)) . #5#)
                                       #7=(GO G190) G191
                                       (EXIT (NREVERSE0 #1#)))) . #5#)
                                   (LETT |y|
                                    (SPADCALL |y| |l| (QREFELT $ 12)) . #5#)
                                   (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|) . #5#)))
                              (LETT #0# (CDR #0#) . #5#) #7# G191
                              (EXIT NIL))
                         (EXIT (REVERSE |retVal|)))))))))) 

(DEFUN |CRAPACK;chineseRemainder;L2L;3!1| (|#1| |#2| |#3| |#4| $)
  (SPADCALL (SPADCALL |#1| |#4| (QREFELT $ 13))
      (SPADCALL |#2| |#3| (QREFELT $ 13)) (QREFELT $ 22))) 

(DEFUN |CRAPACK;chineseRemainder;L2L;3!0| (|#1| |#2| |#3| |#4| $)
  (SPADCALL (SPADCALL |#1| |#4| (QREFELT $ 13))
      (SPADCALL |#2| |#3| (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))
                 . #0=(|CRAPACK;multiEuclideanTree;LRL;5|))
           (LETT |x| (SPADCALL |x| |fl| (QREFELT $ 12)) . #0#)
           (SPADCALL |x| (ELT $ 13) (QREFELT $ 15))
           (EXIT (SPADCALL
                     (SPADCALL |x| |rhs|
                         (CONS (|function| |CRAPACK;extEuclidean|) $)
                         (QREFELT $ 35))
                     (QREFELT $ 18))))))) 

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

(DEFUN |CRApackage;| (|#1|)
  (PROG (DV$1 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|CRApackage|))
        (LETT |dv$| (LIST '|CRApackage| DV$1) . #0#)
        (LETT $ (GETREFV 37) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|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|)) 
