Index: /cegar_dev/cegar/Makefile
===================================================================
--- /cegar_dev/cegar/Makefile	(revision 5)
+++ /cegar_dev/cegar/Makefile	(revision 6)
@@ -1,3 +1,3 @@
- VIS_PATH=/dsk/l1/misc/Soft
+ VIS_PATH=/dsk/l1/misc/TOOLS
  LIB_VIS=$(VIS_PATH)/lib
  LIB_OPT= -lMonvis   -lcu -lglu -lm -lbsd  -lreadline -ltermcap -lfl
Index: /cegar_dev/cegar/concrete_model/SATcnf_c1.cnf
===================================================================
--- /cegar_dev/cegar/concrete_model/SATcnf_c1.cnf	(revision 5)
+++ /cegar_dev/cegar/concrete_model/SATcnf_c1.cnf	(revision 6)
@@ -1,318 +1,318 @@
-c o1_0_0 58
-c Nd25_36_3 38
-c Nd25_36_2 25
-c Nd24_36_4 56
-c Nd25_36_1 11
-c Nd24_36_3 43
-c Nd25_36_0 15
-c Nd24_36_2 30
-c Nd25_37_4 45
-c Nd24_36_1 17
-c Nd25_37_3 32
-c Nd25_37_2 19
-c r_i1_0_0 76
-c Nd25_37_1 5
-c Nd24_37_4 54
-c r_i1_0_1 80
-c Nd25_37_0 1
-c Nd24_37_3 41
-c r_i1_0_2 83
-c Nd24_37_2 28
-c r_i1_0_3 86
-c Nd13_84_3 48
-c Nd24_37_1 14
-c r_i1_0_4 89
-c Nd13_84_2 35
-c machine_concret1.m_state_1_0 3
-c i1_0_-1 77
-c Nd13_84_1 22
-c Nd277_301_3 73
-c machine_concret1.m_state_1_1 7
-c Nd13_84_0 8
-c Nd277_301_2 69
-c Nd12_84_3 52
-c Nd277_301_1 65
-c Nd12_84_2 39
-c machine_concret1.m_state_1_2 21
-c Nd277_301_0 61
-c Nd12_84_1 26
-c machine_concret1.m_state_1_3 34
-c Nd12_84_0 12
-c machine_concret1.m_state_1_4 47
-c o2_0_4 103
-c machine_concret1.m_state_0_0 2
-c i1_0_0 9
-c o2_0_3 100
-c machine_concret1.m_state_0_1 6
-c i1_0_1 23
-c o2_0_2 97
-c o1_0_4 72
-c machine_concret1.m_state_0_2 20
-c i1_0_2 36
-c o2_0_1 94
-c machine_concret1.m_state_0_3 33
-c i1_0_3 49
-c o1_0_3 68
-c o2_0_0 92
-c machine_concret1.m_state_0_4 46
-c o1_0_2 64
-c Nd25_36_4 51
-c o1_0_1 60
+c Nd253_277_1 79
+c o1_0_0 72
+c Nd25_36_3 52
+c Nd253_277_0 75
+c Nd25_36_2 42
+c Nd24_36_4 70
+c Nd25_36_1 31
+c Nd24_36_3 57
+c Nd25_36_0 35
+c Nd24_36_2 47
+c Nd25_37_4 59
+c Nd24_36_1 37
+c Nd25_37_3 22
+c Nd25_37_2 16
+c r_i1_0_0 90
+c r_i1_0_1 94
+c Nd25_37_1 10
+c Nd24_37_4 68
+c r_i1_0_2 97
+c Nd25_37_0 4
+c Nd24_37_3 55
+c r_i1_0_3 100
+c Nd24_37_2 45
+c r_i1_0_4 103
+c Nd13_84_3 62
+c Nd24_37_1 34
+c Nd13_84_2 49
+c i1_0_-1 91
+c machine_concret1.m_state_1_0 6
+c Nd13_84_1 39
+c machine_concret1.m_state_1_1 12
+c Nd13_84_0 28
+c Nd12_84_3 66
+c Nd12_84_2 53
+c machine_concret1.m_state_1_2 18
+c Nd12_84_1 43
+c machine_concret1.m_state_1_3 24
+c Nd12_84_0 32
+c machine_concret1.m_state_1_4 61
+c machine_concret1.m_state_0_0 5
+c o2_0_4 21
+c i1_0_0 29
+c machine_concret1.m_state_0_1 11
+c o2_0_3 15
+c i1_0_1 40
+c o1_0_4 86
+c machine_concret1.m_state_0_2 17
+c o2_0_2 9
+c i1_0_2 50
+c machine_concret1.m_state_0_3 23
+c o2_0_1 3
+c i1_0_3 63
+c o1_0_3 82
+c machine_concret1.m_state_0_4 60
+c o2_0_0 1
+c Nd253_277_3 87
+c o1_0_2 78
+c Nd25_36_4 65
+c Nd253_277_2 83
+c o1_0_1 74
 p cnf 105 257
-2 3 1 0
--2 -1 0
--3 -1 0
--1 4 0
-1 -4 0
-4 0
-6 7 5 0
--6 -5 0
--7 -5 0
-9 -1 8 0
--9 -8 0
-1 -8 0
--5 -8 10 0
-5 -10 0
-8 -10 0
-6 -7 11 0
--6 -11 0
-7 -11 0
--9 -1 12 0
-9 -12 0
-1 -12 0
--11 -12 13 0
-11 -13 0
-12 -13 0
--6 7 14 0
-6 -14 0
--7 -14 0
-2 -3 15 0
--2 -15 0
-3 -15 0
--14 -15 16 0
-14 -16 0
-15 -16 0
--6 -7 17 0
-6 -17 0
-7 -17 0
--17 -2 18 0
-17 -18 0
-2 -18 0
-10 13 16 18 0
-20 21 19 0
--20 -19 0
--21 -19 0
-23 -5 22 0
+1 2 0
+-1 -2 0
+2 0
+5 6 4 0
+-5 -4 0
+-6 -4 0
+3 -4 7 0
+-3 -7 0
+4 -7 0
+-3 4 8 0
+3 -8 0
+-4 -8 0
+7 8 0
+11 12 10 0
+-11 -10 0
+-12 -10 0
+9 -10 13 0
+-9 -13 0
+10 -13 0
+-9 10 14 0
+9 -14 0
+-10 -14 0
+13 14 0
+17 18 16 0
+-17 -16 0
+-18 -16 0
+15 -16 19 0
+-15 -19 0
+16 -19 0
+-15 16 20 0
+15 -20 0
+-16 -20 0
+19 20 0
+23 24 22 0
 -23 -22 0
-5 -22 0
--19 -22 24 0
-19 -24 0
-22 -24 0
-20 -21 25 0
--20 -25 0
-21 -25 0
--23 -5 26 0
-23 -26 0
-5 -26 0
--25 -26 27 0
-25 -27 0
-26 -27 0
--20 21 28 0
-20 -28 0
--21 -28 0
--28 -11 29 0
-28 -29 0
-11 -29 0
--20 -21 30 0
-20 -30 0
-21 -30 0
--30 -6 31 0
-30 -31 0
-6 -31 0
-24 27 29 31 0
-33 34 32 0
--33 -32 0
--34 -32 0
-36 -19 35 0
--36 -35 0
-19 -35 0
--32 -35 37 0
-32 -37 0
-35 -37 0
-33 -34 38 0
--33 -38 0
-34 -38 0
--36 -19 39 0
-36 -39 0
-19 -39 0
--38 -39 40 0
-38 -40 0
-39 -40 0
--33 34 41 0
-33 -41 0
--34 -41 0
--41 -25 42 0
-41 -42 0
-25 -42 0
--33 -34 43 0
-33 -43 0
-34 -43 0
--43 -20 44 0
+-24 -22 0
+21 -22 25 0
+-21 -25 0
+22 -25 0
+-21 22 26 0
+21 -26 0
+-22 -26 0
+25 26 0
+-4 27 0
+4 -27 0
+27 0
+29 -4 28 0
+-29 -28 0
+4 -28 0
+-10 -28 30 0
+10 -30 0
+28 -30 0
+11 -12 31 0
+-11 -31 0
+12 -31 0
+-29 -4 32 0
+29 -32 0
+4 -32 0
+-31 -32 33 0
+31 -33 0
+32 -33 0
+-11 12 34 0
+11 -34 0
+-12 -34 0
+5 -6 35 0
+-5 -35 0
+6 -35 0
+-34 -35 36 0
+34 -36 0
+35 -36 0
+-11 -12 37 0
+11 -37 0
+12 -37 0
+-37 -5 38 0
+37 -38 0
+5 -38 0
+30 33 36 38 0
+40 -10 39 0
+-40 -39 0
+10 -39 0
+-16 -39 41 0
+16 -41 0
+39 -41 0
+17 -18 42 0
+-17 -42 0
+18 -42 0
+-40 -10 43 0
+40 -43 0
+10 -43 0
+-42 -43 44 0
+42 -44 0
 43 -44 0
-20 -44 0
-37 40 42 44 0
-46 47 45 0
--46 -45 0
--47 -45 0
-49 -32 48 0
--49 -48 0
-32 -48 0
--45 -48 50 0
-45 -50 0
-48 -50 0
-46 -47 51 0
--46 -51 0
-47 -51 0
--49 -32 52 0
-49 -52 0
-32 -52 0
--51 -52 53 0
-51 -53 0
-52 -53 0
--46 47 54 0
-46 -54 0
--47 -54 0
--54 -38 55 0
-54 -55 0
-38 -55 0
--46 -47 56 0
-46 -56 0
-47 -56 0
--56 -33 57 0
-56 -57 0
-33 -57 0
-50 53 55 57 0
-58 59 0
--58 -59 0
-59 0
-8 15 61 0
--8 -61 0
--15 -61 0
-60 61 62 0
--60 -62 0
--61 -62 0
--60 -61 63 0
-60 -63 0
-61 -63 0
-62 63 0
-22 11 65 0
--22 -65 0
--11 -65 0
-64 65 66 0
--64 -66 0
--65 -66 0
--64 -65 67 0
-64 -67 0
+-17 18 45 0
+17 -45 0
+-18 -45 0
+-45 -31 46 0
+45 -46 0
+31 -46 0
+-17 -18 47 0
+17 -47 0
+18 -47 0
+-47 -11 48 0
+47 -48 0
+11 -48 0
+41 44 46 48 0
+50 -16 49 0
+-50 -49 0
+16 -49 0
+-22 -49 51 0
+22 -51 0
+49 -51 0
+23 -24 52 0
+-23 -52 0
+24 -52 0
+-50 -16 53 0
+50 -53 0
+16 -53 0
+-52 -53 54 0
+52 -54 0
+53 -54 0
+-23 24 55 0
+23 -55 0
+-24 -55 0
+-55 -42 56 0
+55 -56 0
+42 -56 0
+-23 -24 57 0
+23 -57 0
+24 -57 0
+-57 -17 58 0
+57 -58 0
+17 -58 0
+51 54 56 58 0
+60 61 59 0
+-60 -59 0
+-61 -59 0
+63 -22 62 0
+-63 -62 0
+22 -62 0
+-59 -62 64 0
+59 -64 0
+62 -64 0
+60 -61 65 0
+-60 -65 0
+61 -65 0
+-63 -22 66 0
+63 -66 0
+22 -66 0
+-65 -66 67 0
 65 -67 0
-66 67 0
-35 25 69 0
--35 -69 0
--25 -69 0
-68 69 70 0
--68 -70 0
--69 -70 0
--68 -69 71 0
-68 -71 0
-69 -71 0
-70 71 0
-48 38 73 0
--48 -73 0
--38 -73 0
-72 73 74 0
--72 -74 0
--73 -74 0
--72 -73 75 0
-72 -75 0
-73 -75 0
-74 75 0
-76 77 78 0
--76 -78 0
--77 -78 0
--76 -77 79 0
-76 -79 0
-77 -79 0
-78 79 0
-80 9 81 0
--80 -81 0
--9 -81 0
--80 -9 82 0
-80 -82 0
-9 -82 0
-81 82 0
-83 23 84 0
+66 -67 0
+-60 61 68 0
+60 -68 0
+-61 -68 0
+-68 -52 69 0
+68 -69 0
+52 -69 0
+-60 -61 70 0
+60 -70 0
+61 -70 0
+-70 -23 71 0
+70 -71 0
+23 -71 0
+64 67 69 71 0
+72 73 0
+-72 -73 0
+73 0
+28 35 75 0
+-28 -75 0
+-35 -75 0
+74 75 76 0
+-74 -76 0
+-75 -76 0
+-74 -75 77 0
+74 -77 0
+75 -77 0
+76 77 0
+39 31 79 0
+-39 -79 0
+-31 -79 0
+78 79 80 0
+-78 -80 0
+-79 -80 0
+-78 -79 81 0
+78 -81 0
+79 -81 0
+80 81 0
+49 42 83 0
+-49 -83 0
+-42 -83 0
+82 83 84 0
+-82 -84 0
 -83 -84 0
--23 -84 0
--83 -23 85 0
+-82 -83 85 0
+82 -85 0
 83 -85 0
-23 -85 0
 84 85 0
-86 36 87 0
--86 -87 0
--36 -87 0
--86 -36 88 0
-86 -88 0
-36 -88 0
-87 88 0
-89 49 90 0
--89 -90 0
--49 -90 0
--89 -49 91 0
-89 -91 0
-49 -91 0
-90 91 0
+62 52 87 0
+-62 -87 0
+-52 -87 0
+86 87 88 0
+-86 -88 0
+-87 -88 0
+-86 -87 89 0
+86 -89 0
+87 -89 0
+88 89 0
+90 91 92 0
+-90 -92 0
+-91 -92 0
+-90 -91 93 0
+90 -93 0
+91 -93 0
 92 93 0
--92 -93 0
-93 0
-94 -1 95 0
+94 29 95 0
 -94 -95 0
-1 -95 0
--94 1 96 0
+-29 -95 0
+-94 -29 96 0
 94 -96 0
--1 -96 0
+29 -96 0
 95 96 0
-97 -5 98 0
+97 40 98 0
 -97 -98 0
-5 -98 0
--97 5 99 0
+-40 -98 0
+-97 -40 99 0
 97 -99 0
--5 -99 0
+40 -99 0
 98 99 0
-100 -19 101 0
+100 50 101 0
 -100 -101 0
-19 -101 0
--100 19 102 0
+-50 -101 0
+-100 -50 102 0
 100 -102 0
--19 -102 0
+50 -102 0
 101 102 0
-103 -32 104 0
+103 63 104 0
 -103 -104 0
-32 -104 0
--103 32 105 0
+-63 -104 0
+-103 -63 105 0
 103 -105 0
--32 -105 0
+63 -105 0
 104 105 0
--58 0
--92 0
--76 0
-60 0
+-72 0
+-1 0
+-90 0
+74 0
+-3 0
 -94 0
--80 0
-64 0
+78 0
+-9 0
 -97 0
--83 0
-68 0
+82 0
+-15 0
 -100 0
--86 0
-72 0
+86 0
+-21 0
 -103 0
--89 0
Index: /vis_dev/glu-2.1/INSTALL
===================================================================
--- /vis_dev/glu-2.1/INSTALL	(revision 6)
+++ /vis_dev/glu-2.1/INSTALL	(revision 6)
@@ -0,0 +1,176 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
Index: /vis_dev/glu-2.1/Makefile.in
===================================================================
--- /vis_dev/glu-2.1/Makefile.in	(revision 6)
+++ /vis_dev/glu-2.1/Makefile.in	(revision 6)
@@ -0,0 +1,796 @@
+# FileName	[ Makefile.in ]
+#
+# PackageName	[ glu ]
+#
+# Synopsis	[ Package-wide Makefile ]
+#
+# Description	[ This file requires GNU's make program.
+#		  Run "configure" to generate the Makefile, or use
+#		  "config.status" (created by configure) to regenerate the
+#		  Makefile after modifying this file.
+#
+#		  Type "gmake help" for a list of valid targets. ]
+#
+# SeeAlso	[ configure.in ]
+#
+# Author	[ Stephen Edwards <sedwards@eecs.berkeley.edu> ]
+#
+# Copyright	[
+#  Copyright (c) 1994-1998 The Regents of the Univ. of California.
+#  All rights reserved.
+#
+#  Permission is hereby granted, without written agreement and without license
+#  or royalty fees, to use, copy, modify, and distribute this software and its
+#  documentation for any purpose, provided that the above copyright notice and
+#  the following two paragraphs appear in all copies of this software.
+#
+#  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+#  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+#  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+#  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+#  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+#  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+#  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+#  ]
+#
+# Revision	[$Id: Makefile.in,v 1.60 2005/05/15 05:43:36 fabio Exp $]
+
+# Default target: 
+
+.PHONY : default
+
+default : all
+
+#----------------------------------------------------------------------
+# Lists of packages to compile.  Change this if you are only compiling
+# part of GLU
+#----------------------------------------------------------------------
+
+#PKGS = array
+PKGS = $(ALL_BASIC_PKGS)
+
+#BDD_PKGS = cmu
+BDD_PKGS = $(ALL_BDD_PKGS)
+
+#MDD_PKGS =
+MDD_PKGS = $(ALL_MDD_PKGS)
+
+#----------------------------------------------------------------------
+# This Makefile is designed for three different situations:
+#
+# 1. Single platform build (the default)
+#
+#    All packages listed in the PKGS variable
+#    local_srcdir = master_srcdir = .
+#
+# 2. Multi-platform build
+#
+#    All packages listed in the PKGS variable
+#    local_srcdir = master_srcdir = /where/source/files/reside
+#
+# 3. Multi-platform development (used at Berkeley)
+#
+#    Packages under development listed in the PKGS variable
+#    local_srcdir = ../common
+#    master_srcdir = /projects/glu/glu-devel/common
+#
+#    User has a directory structure that looks like
+#
+#	glu/common/src/		Subdirectory with package source files
+#				under development.
+#
+#	glu/$PLATFORM/		Subdirectory with this Makefile.
+#				Compilation is invoked here.
+#
+#	$PLATFORM is something like "alpha-g" (DEC Alpha, debug version)
+#
+#----------------------------------------------------------------------
+
+#----------------------------------------------------------------------
+# Information about all the packages
+#----------------------------------------------------------------------
+
+# Note: To add another BDD package, add it to this list and add a rule
+# of the form libbdd.a (see the existing ones for an example)
+
+ALL_BASIC_PKGS = array avl bdd epd error graph heap list mem mtr sparse st \
+		 util var_set
+ALL_BDD_PKGS = cal cu cmu
+ALL_MDD_PKGS = mdd
+
+# Generate the list of all packages NOT in the PKGS list
+
+MISSING_PKGS = $(filter-out $(PKGS), $(ALL_BASIC_PKGS))
+MISSING_BDD_PKGS = $(filter-out $(BDD_PKGS), $(ALL_BDD_PKGS))
+MISSING_MDD_PKGS = $(filter-out $(MDD_PKGS), $(ALL_MDD_PKGS))
+
+FULL_PKGS = $(PKGS) $(foreach bdd, $(BDD_PKGS), $(bdd)Bdd $(bdd)Port) \
+	    $(MDD_PKGS)
+FULL_MISSING_PKGS = $(MISSING_PKGS) \
+	$(foreach bdd, $(MISSING_BDD_PKGS), $(bdd)Bdd $(bdd)Port) \
+	$(MISSING_MDD_PKGS)
+
+#----------------------------------------------------------------------
+# For safety
+#----------------------------------------------------------------------
+
+SHELL = /bin/sh
+.SUFFIXES:
+
+#----------------------------------------------------------------------
+# The name of the product and its version
+#----------------------------------------------------------------------
+
+PRODUCT = glu
+VERSION = 2.1
+
+#----------------------------------------------------------------------
+# Source directories
+#----------------------------------------------------------------------
+
+# Directory containing master source files.  This directory is searched
+# for packages NOT listed in the PKGS variable.  Defaults to "."
+# Override with  ./configure --srcdir=
+master_srcdir = @srcdir@
+
+# Directory containing local source files.  This directory is searched
+# for packages listed in the PKGS variable.  Defaults to the master source
+# directory (see above).
+# Override with ./configure --with-local-srcdir=
+local_srcdir =  @local_srcdir@
+
+#----------------------------------------------------------------------
+# Directories used while building
+#----------------------------------------------------------------------
+
+# Directory where object files will be placed during the build
+objectdir =	obj
+
+# Directory where links to header files will be placed during the build
+headerdir =	$(local_srcdir)/include
+
+#----------------------------------------------------------------------
+# Installation names and directories
+#----------------------------------------------------------------------
+
+# Name of the library to create
+LIBRARY =	lib$(PRODUCT).a
+
+# Names of the BDD libraries to create
+BDD_LIBRARIES =	$(foreach bdd, $(BDD_PKGS), lib$(bdd).a)
+
+# Directory in which to install architecture-independent files
+# Set by ./configure --prefix=...
+prefix =	@prefix@
+
+# Directory in which to install architecture-dependent files
+# Set by ./configure --exec-prefix=...
+exec_prefix =	@exec_prefix@
+
+# Directory in which to install libraries
+libdir =	$(exec_prefix)/lib
+
+# Directory in which to install headers
+includedir =	$(prefix)/include
+
+#----------------------------------------------------------------------
+# The following are set by the configure script
+#----------------------------------------------------------------------
+
+AC_FLAGS =	@DEFS@
+RANLIB =	@RANLIB@
+AR =		@AR@
+CC =		@CC@
+CFLAGS =	@CFLAGS@
+INSTALL =	@INSTALL@
+INSTALL_DATA =	@INSTALL_DATA@
+
+#----------------------------------------------------------------------
+# Include the make templates from all the packages
+#
+# Each of these templates (e.g., array/array.make) should contains lines
+# of the form
+#
+# CSRC += source1.c source2.c
+# HEADERS += header1.h header2.h
+# MISC += misc1 misc2
+#
+# For BDD packages (both Port and Bdd), these should be, e.g.,
+#
+# CSRC_cmu += source1.c source2.c
+# HEADERS_cmu += header1.h
+#
+# For the MDD package the definition is
+#
+# CSRC_mdd = source1.c source2.c
+# HEADERS_mdd = header1.h 
+# MISC += misc1 misc2
+#----------------------------------------------------------------------
+
+MAKEINCLUDES = \
+	$(foreach package, $(FULL_PKGS), \
+		$(local_srcdir)/src/$(package)/$(package).make )
+
+include $(MAKEINCLUDES)
+
+OBJECTS = $(addprefix $(objectdir)/,$(CSRC:.c=.o))
+
+# Collect the names of all the bdd package source files
+BDD_CSRC = $(foreach bdd_package, $(BDD_PKGS), $(CSRC_$(bdd_package)))
+BDD_HEADERS = $(foreach bdd_package, $(BDD_PKGS), $(HEADERS_$(bdd_package)))
+BDD_OBJECTS = $(addprefix $(objectdir)/,$(BDD_CSRC:.c=.o))
+
+CAL_OBJECTS = $(addprefix $(objectdir)/,$(CSRC_cal:.c=.o))
+CMU_OBJECTS = $(addprefix $(objectdir)/,$(CSRC_cmu:.c=.o))
+CU_OBJECTS = $(addprefix $(objectdir)/,$(CSRC_cu:.c=.o))
+
+# Save the names of the mdd package source files
+MDD_CSRC = $(CSRC_mdd)
+MDD_HEADERS = $(HEADERS_mdd) $(BDD_HEADERS)
+MDD_OBJECTS = $(addprefix $(objectdir)/,$(CSRC_mdd:.c=.o))
+
+#----------------------------------------------------------------------
+# Include the dependency files from each package directory.
+# A missing dependency file does not produce an error.
+#----------------------------------------------------------------------
+
+DEPENDENCIES = $(foreach package, $(PKGS) $(MDD_PKGS) \
+	         $(foreach bdd, $(BDD_PKGS), $(bdd)Bdd $(bdd)Port), \
+	         $(local_srcdir)/src/$(package)/$(package).d)
+
+-include $(DEPENDENCIES)
+
+#----------------------------------------------------------------------
+# Form the the list of directories to search for header files.
+#
+# INCLUDEDIRS looks like "-I/projects/glu/ -I/projects/vis/ ..."
+#----------------------------------------------------------------------
+
+INCLUDEDIRS = \
+	$(foreach package, $(FULL_PKGS), \
+		-I$(local_srcdir)/src/$(package) ) \
+	$(foreach package, $(FULL_MISSING_PKGS), \
+		-I$(master_srcdir)/src/$(package) ) \
+	-I$(objectdir)
+
+#----------------------------------------------------------------------
+# Form the list of directories to search for files listed in make rules.
+#
+# VPATH looks like /projects/vis:/projects/glu/: ...
+#----------------------------------------------------------------------
+
+VPATH = $(local_srcdir): \
+	$(master_srcdir): \
+	$(addprefix :$(local_srcdir)/src/,$(FULL_PKGS)): \
+	$(addprefix :$(master_srcdir)/src/,$(FULL_MISSING_PKGS)): \
+	$(objectdir)
+
+#----------------------------------------------------------------------
+# Definitions for the distribution file
+#----------------------------------------------------------------------
+
+DISTRIBUTION = $(PRODUCT)-$(VERSION)
+
+# Directories to include in the distribution file
+
+DISTDIRS = src obj $(addprefix src/,$(FULL_PKGS)) src/cuBdd/doc \
+	   helpers src/cuBdd/doc/icons
+
+# Build/install helper files
+
+HELPERS = $(addprefix helpers/, \
+	install-sh mkinstalldirs config.guess config.sub dependency.make)
+
+# Files to include in the distribution file
+
+DISTFILES = \
+	README INSTALL NEWS \
+	configure configure.in Makefile.in $(HELPERS) \
+	$(CSRC) $(BDD_CSRC) $(MDD_CSRC) $(HEADERS) $(BDD_HEADERS) \
+	$(MDD_HEADERS) $(MAKEINCLUDES) \
+	$(MISC)
+
+#----------------------------------------------------------------------
+# Variables used by for Revision Control
+#----------------------------------------------------------------------
+
+# The root RCS directory
+rcs_rootdir          = /projects/glu/rcsRoot/common
+
+RCSFILES        = $(CSRC) $(BDD_CSRC) $(MDD_CSRC) $(HEADERS) $(BDD_HEADERS) \
+			$(MDD_HEADERS) $(MISC) $(MAKEINCLUDES)
+
+RCSMISCFILES    = README INSTALL NEWS Makefile.in configure.in localconfigure \
+		  masterconfigure $(HELPERS)
+
+#----------------------------------------------------------------------
+# Implicit rules for compiling and archiving
+#----------------------------------------------------------------------
+
+# For compiling a source file into the object directory
+
+$(objectdir)/%.o : %.c
+	umask 2; $(CC) -c $(CFLAGS) $(AC_FLAGS) $(INCLUDEDIRS) -o $@  $<
+
+# Place object files into an archive
+
+%.a :
+	rm -f $@
+	umask 2; $(AR) cq $@ $^
+	$(RANLIB) $@
+
+######################################################################
+# 				RULES				     #
+######################################################################
+
+#:
+#: Useful targets:
+#:
+
+#----------------------------------------------------------------------
+# Rule for getting help
+#----------------------------------------------------------------------
+
+.PHONY : help
+
+#: help -- Print a list of targets
+
+# This prints all lines in this Makefile that begin with #:
+
+help :
+	@sed -n "s/^#://p" Makefile
+
+#----------------------------------------------------------------------
+# Always executed once when the Makefile is run
+#----------------------------------------------------------------------
+
+# Make sure the directory in which to place the objects exists
+
+ignored := $(shell umask 2; test -d $(objectdir) || mkdir $(objectdir))
+
+#----------------------------------------------------------------------
+# Rules to compile and build libraries
+#----------------------------------------------------------------------
+
+.PHONY : all
+
+#:
+#: all (the default) -- Create the libraries
+
+all : $(headerdir) $(LIBRARY) $(BDD_LIBRARIES)
+
+$(LIBRARY) : $(OBJECTS)
+
+libcal.a : $(CAL_OBJECTS) $(MDD_OBJECTS)
+
+libcmu.a : $(CMU_OBJECTS) $(MDD_OBJECTS)
+
+libcu.a : $(CU_OBJECTS) $(MDD_OBJECTS)
+
+$(headerdir) : $(HEADERS) $(MDD_HEADERS)
+	rm -rf $(headerdir)
+	umask 2; mkdir $(headerdir)
+	for header in $(HEADERS) $(MDD_HEADERS); do \
+	  ln $(local_srcdir)/src/*/$$header $(headerdir)/$$header; \
+	done
+
+#----------------------------------------------------------------------
+# Warts
+#----------------------------------------------------------------------
+
+# Work around an optimizer bug in the native Ultrix compiler
+
+ifeq (@target@,mips-dec-ultrix4.5)
+$(objectdir)/calReduce.o : calReduce.c
+	umask 2; $(CC) -c -std1 -g $(AC_FLAGS) $(INCLUDEDIRS) -o $@  $<
+endif
+
+# Work around a bug in gcc 2.7.0
+
+ifeq ($(CC),gcc)
+  ifeq ($(shell gcc --version),2.7.0)
+
+$(objectdir)/cal.o : cal.c
+	umask 2; $(CC) -c -g $(AC_FLAGS) $(INCLUDEDIRS) -o $@  $<
+
+$(objectdir)/calBddSwapVars.o : calBddSwapVars.c
+	umask 2; $(CC) -c -g $(AC_FLAGS) $(INCLUDEDIRS) -o $@  $<
+
+  endif
+endif
+
+#----------------------------------------------------------------------
+# Rules to build test programs
+#----------------------------------------------------------------------
+
+.PHONY : check check-bdd check-cal check-cmu check-cu
+
+#:
+#: check -- Test the libraries (runs check-bdd)
+
+check : check-bdd
+
+#: check-bdd -- Compile simple test programs for each of the BDD packages
+#:              and run them
+
+check-bdd : check-cmu check-cal check-cu
+
+check-cal : obj/checkcal
+	obj/checkcal > checkcal.out
+	@echo "Test appears successful -- results in checkcal.out"
+
+obj/checkcal : libcal.a calTest.c
+	$(CC) -o obj/checkcal -DTEST $(CFLAGS) $(AC_FLAGS) $(INCLUDEDIRS) \
+		$(filter %.c, $^) -L. -lcal
+
+check-cmu : obj/checkcmu
+	obj/checkcmu > checkcmu.out
+	@echo "Test appears successful -- results in checkcmu.out"
+
+obj/checkcmu : libcmu.a $(LIBRARY) testbdd.c
+	$(CC) -o obj/checkcmu $(CFLAGS) $(AC_FLAGS) $(INCLUDEDIRS) \
+		$(filter %.c, $^) -L. -lcmu -l$(PRODUCT)
+
+check-cu : obj/checkcu src/cuBdd/r7x8.1.mat
+	obj/checkcu -p 2 $(filter %.mat, $^) > checkcu.out
+	@echo "Test appears successful -- results in checkcu.out"
+
+obj/checkcu : libcu.a $(LIBRARY) testcudd.c
+	$(CC) -o obj/checkcu $(CFLAGS) $(AC_FLAGS) $(INCLUDEDIRS) \
+		$(filter %.c, $^) -L. -lcu -l$(PRODUCT) -lm
+
+#----------------------------------------------------------------------
+# Rules that produce/delete the dependency file for every package
+#----------------------------------------------------------------------
+
+.PHONY : dependencies cleandependencies
+
+#:
+#: dependencies -- Create a list of dependency files.
+#:                 Useful when modifying header files.
+
+# Invoke the "dependency.make" Makefile on each package subdirectory,
+# passing the path, etc. to it.
+#
+# There's a strange feature in autoconf where lines of the form " VPATH="
+# are removed from the Makefile.  Thus, a flag is placed before the 
+# VPATH= argument below. 
+
+dependencies:
+ifneq ($(findstring <$(CC)>,<gcc> <g++>),)
+	for pkg in $(PKGS) $(foreach bdd, $(BDD_PKGS), $(bdd)Bdd $(bdd)Port) \
+		    $(MDD_PKGS) ; do \
+		$(MAKE) --no-print-directory \
+			-f $(master_srcdir)/helpers/dependency.make \
+			CC="$(CC)" \
+			CFLAGS="$(CFLAGS)" VPATH="$(local_srcdir)/src/$$pkg" \
+			AC_FLAGS="$(AC_FLAGS)" \
+			INCLUDEDIRS="$(INCLUDEDIRS)" objectdir=$(objectdir) \
+			PKGNAME=$(local_srcdir)/src/$$pkg/$$pkg \
+			$(local_srcdir)/src/$$pkg/$$pkg.d ; \
+	done
+else
+	@echo "dependency requires gcc or g++"
+	@echo "Reconfigure with gcc or g++"
+endif
+
+cleandependencies:
+	rm -f $(local_srcdir)/src/*/*.d	
+
+#----------------------------------------------------------------------
+# Rules for installation
+#----------------------------------------------------------------------
+
+.PHONY : install uninstall installdirs
+
+#:
+#: install -- Install the libraries and headers in libdir and includedir
+
+install : $(LIBRARY) $(BDD_LIBRARIES) installdirs
+	@if [ ! -f $(libdir)/$(LIBRARY) ] ; \
+        then \
+                echo "Installing $(libdir)/$(LIBRARY)"; \
+                $(INSTALL_DATA) $(LIBRARY) $(libdir)/$(LIBRARY); \
+        else \
+                echo "Warning: $(libdir)/$(LIBRARY) already exists" ; \
+        fi
+	@for lib in $(BDD_LIBRARIES); do \
+                if [ ! -f $(libdir)/$$lib ] ; \
+                then \
+                        echo "Installing $(libdir)/$$lib"; \
+                        $(INSTALL_DATA) $$lib $(libdir)/$$lib; \
+                else \
+                        echo "Warning: $(libdir)/$$lib already exists" ; \
+                fi ; \
+        done
+	@for header in $(HEADERS) $(MDD_HEADERS); do \
+                if [ ! -f $(includedir)/$$header ] ; \
+                then \
+                        echo "Installing $(includedir)/$$header"; \
+                        $(INSTALL_DATA) $(master_srcdir)/src/*/$$header \
+                                $(includedir)/$$header; \
+                else \
+                        echo "Warning: $(includedir)/$$header already exists"; \
+                fi ; \
+        done
+
+#: uninstall -- Reverse the effects of "install"
+
+uninstall :
+	rm -f $(libdir)/$(LIBRARY) $(addprefix $(libdir)/, $(BDD_LIBRARIES))
+	@for header in $(HEADERS) $(MDD_HEADERS); do \
+		echo "Removing $(includedir)/$$header"; \
+		rm -f $(includedir)/$$header; \
+	done
+
+installdirs :
+	$(master_srcdir)/helpers/mkinstalldirs $(libdir) $(includedir)
+
+#----------------------------------------------------------------------
+# Rules for making a distribution file
+# This only works when ALL of the packages are considered "local"
+#----------------------------------------------------------------------
+
+.PHONY : dist
+
+#:
+#: dist -- Create a tarred, gzipped distribution file
+
+# Warning: "tar" under Digital Unix (on DEC Alphas) writes directories
+# that don't work under SunOS tar
+
+dist : $(DISTRIBUTION).tar.gz
+
+$(DISTRIBUTION).tar.gz : $(DISTFILES)
+ifeq ($(strip $(FULL_MISSING_PKGS)),)
+	rm -rf $(DISTRIBUTION)
+	umask 022; mkdir $(DISTRIBUTION)
+	for dir in $(DISTDIRS); do \
+	  umask 022; mkdir $(DISTRIBUTION)/$$dir; \
+	done
+	@echo "Copying distribution files"
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); do \
+	  echo "  $$file"; \
+	  cp -p $(local_srcdir)/$$file $(DISTRIBUTION)/$$file; \
+	done
+	- chmod -R a+r $(DISTRIBUTION)
+	- chmod -R u+w $(DISTRIBUTION)
+	tar cf - $(DISTRIBUTION) | gzip -9 > $(DISTRIBUTION).tar.gz
+	rm -rf $(DISTRIBUTION)
+else
+	@echo "Missing packages: $(FULL_MISSING_PKGS)"
+	@echo "Make sure PKGS, BDD_PKGS, and MDD_PKGS list all the packages"
+	@exit 1
+endif
+
+#----------------------------------------------------------------------
+# Rules for rebuilding the configure file and Makefile
+#----------------------------------------------------------------------
+
+${master_srcdir}/configure : configure.in
+	cd ${master_srcdir} && autoconf
+	chmod -f 0775 ${master_srcdir}/config*
+
+config.status : configure
+	./config.status --recheck
+
+Makefile : Makefile.in config.status
+	@echo "The master Makefile.in has been changed:"
+	@echo "run config.status"
+	@echo "Warning: This will overwrite any local Makefile modifications"
+	@exit 1
+
+#----------------------------------------------------------------------
+# Rules for cleaning
+#----------------------------------------------------------------------
+
+.PHONY : clean mostlyclean distclean
+
+clean mostlyclean :
+	rm -rf $(objectdir)/* include checkcal.out checkcmu.out checkcu.out
+
+distclean : clean cleandependencies
+	rm -f Makefile config.status config.cache config.log $(LIBRARY) \
+	      $(BDD_LIBRARIES)
+
+#----------------------------------------------------------------------
+# Rule for performing a lint-like check on the source code
+#
+# Note: This requires gcc or g++
+#----------------------------------------------------------------------
+
+.PHONY : check_code
+
+#:
+#: check-code -- Run a lint-like check on the source code.
+#:               (useful for development)
+
+CHECK_FLAGS := -Wall -pedantic
+ifeq ($(CC),gcc)
+  CHECK_FLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
+endif
+
+check-code : $(CSRC) $(BDD_CSRC) $(MDD_CSRC)
+ifneq ($(findstring <$(CC)>,<gcc> <g++>),)
+	@rm -f *.o_checkcode
+	@for file in $^; do \
+	  echo "------------------------ Checking $$file"; \
+	  $(CC) -c $(CFLAGS) $(AC_FLAGS) $(CHECK_FLAGS) \
+		$(VERDATE) $(INCLUDEDIRS) \
+		-o $(objectdir)/checkcode_output.o $$file; \
+	  rm -f $(objectdir)/checkcode_output.o; \
+	done
+	@rm -f *.o_checkcode
+else
+	@echo "check-code requires gcc or g++"
+	@echo "Reconfigure with gcc or g++"
+endif
+
+#----------------------------------------------------------------------
+# Revision control rules
+#
+# May be invoked with command-line overrides, e.g.,
+# gmake RCSFILES=foo.c rcs_co
+# gmake PKGS=array rcs_ci
+#----------------------------------------------------------------------
+
+.PHONY: rcs_ci rcs_co rcs_diff rcs_ident rcs_status
+
+#:
+#:       You may want to invoke the RCS rules with
+#:         gmake "PKGS=tst tbl" rcs_ci
+#:         gmake "RCSFILES=tstMain.c" rcs_co
+#:
+#: rcs_ci -- check in user-modified files and put an updated copy
+#:           in the central area
+
+rcs_ci: $(RCSFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  ci -u $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	  co -u $(RCSFLAGS) $(master_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	done
+
+#: rcs_co -- check out files for modification
+
+rcs_co: $(RCSFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  co -l $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	done
+
+#: rcs_diff -- Report differences between local files and checked-in versions
+
+rcs_diff: $(RCSFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  rcsdiff $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	done
+
+#: rcs_ident -- Print the RCS identifier in each file
+
+rcs_ident: $(RCSFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  ident $(RCSFLAGS) $(local_srcdir)/$$file; \
+	done
+
+#: rcs_status -- Report who has checked out files
+
+rcs_status: $(RCSFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  rlog -L -h $(RCSFLAGS) $(rcs_rootdir)/$$file,v; \
+        done
+
+#----------------------------------------------------------------------
+# RCS rules for common/{Makefile.in, configure.in, localconfigure, 
+# masterconfigure, mkinstalldirs, install-sh}
+#----------------------------------------------------------------------
+
+.PHONY : rcs_ci_misc rcs_co_misc rcs_diff_misc
+
+#: rcs_ci_misc -- Check in miscellaneous files, updating central area
+
+rcs_ci_misc: $(RCSMISCFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  ci -u $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	  co -u $(RCSFLAGS) $(master_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	done
+
+#: rcs_co_misc -- Check out miscellaneous files
+
+rcs_co_misc: $(RCSMISCFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  co -l $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	done
+
+#: rcs_diff_misc -- Report differences in miscellaneous files
+
+rcs_diff_misc: $(RCSMISCFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  rcsdiff $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \
+	done
+
+#: rcs_ident_misc -- Report RCS identifiers
+
+rcs_ident_misc: $(RCSMISCFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  ident $(RCSFLAGS) $(local_srcdir)/$$file; \
+	done
+
+#: rcs_status_misc -- Report checked in/out status, ownership
+
+rcs_status_misc: $(RCSMISCFILES)
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  rlog -L -h $(RCSFLAGS) $(rcs_rootdir)/$$file,v; \
+        done
+
+#----------------------------------------------------------------------
+# Rules for debugging the Makefile
+#----------------------------------------------------------------------
+
+DEBUG_VARS = 	PKGS \
+	BDD_PKGS \
+	ALL_BASIC_PKGS \
+	ALL_BDD_PKGS \
+	ALL_MDD_PKGS \
+	MISSING_PKGS \
+	MISSING_BDD_PKGS \
+	MISSING_MDD_PKGS \
+	FULL_PKGS \
+	FULL_MISSING_PKGS \
+	SHELL \
+	PRODUCT \
+	VERSION \
+	prefix \
+	exec_prefix \
+	master_srcdir \
+	local_srcdir \
+	libdir \
+	includedir \
+	objectdir \
+	headerdir \
+	LIBRARY \
+	BDD_LIBRARIES \
+	AC_FLAGS \
+	RANLIB \
+	CC \
+	CFLAGS \
+	INSTALL \
+	INSTALL_DATA \
+	MAKEINCLUDES \
+	OBJECTS \
+	BDD_CSRC \
+	BDD_HEADERS \
+	CAL_OBJECTS \
+	CMU_OBJECTS \
+	CU_OBJECTS \
+	MDD_CSRC \
+	MDD_HEADERS \
+	MDD_OBJECTS \
+	INCLUDEDIRS \
+	VPATH \
+	DISTRIBUTION \
+	DISTDIRS \
+	DISTFILES \
+	GLU \
+	RCSFILES \
+	rcs_rootdir \
+	RCSMISCFILES
+
+.PHONY : debug-make
+
+#:
+#: debug-make - Print a list of Makefile variables
+
+debug-make:
+	@$(foreach var, $(DEBUG_VARS), echo $(var)=$($(var)) ; )
Index: /vis_dev/glu-2.1/NEWS
===================================================================
--- /vis_dev/glu-2.1/NEWS	(revision 6)
+++ /vis_dev/glu-2.1/NEWS	(revision 6)
@@ -0,0 +1,34 @@
+GLU NEWS				-*-indented-text-*-
+  History of user-visible changes.
+
+Please send bug reports to vis-users@colorado.edu
+
+Version 2.1
+
+* A new version of CUDD (2.4.1) is included.
+
+* The heap package has been extended.
+
+* Extensive clean up of the code for gcc 3.3 and stricter POSIX compliance.
+
+Version 2.0
+
+* A new version of CUDD (2.3.2) is included.
+
+* A new heap package is included.
+
+* The graph package has been extended.
+
+* Extensive clean-up of the code.
+
+
+Version 1.4
+
+* The supported platforms have changed.  We have dropped SunOs 4 and Ultrix,
+  and we have added Solaris for Intel processors.
+
+* A new version of Cudd (2.3.1) is included.
+
+* Cal now works under Cygwin.
+
+* A patch to Cmu allows it to work with recent versions of GCC.
Index: /vis_dev/glu-2.1/README
===================================================================
--- /vis_dev/glu-2.1/README	(revision 6)
+++ /vis_dev/glu-2.1/README	(revision 6)
@@ -0,0 +1,176 @@
+This is release 2.1 of GLU, a set of BDD packages and low-level utilities.
+
+If you downloaded this to compile it with VIS, stop here -- see the README
+file in the VIS distribution for build and installation instructions.
+
+---------------------------------------------------------------------------
+To build GLU, you will need
+
+	* An ANSI C compiler (gcc will do, as will several versions of cc)
+	* GNU's make utility
+	* GNU's gzip utility
+	* Approximately 20 MB of free disk for the build
+	* Approximately 10 MB of free disk space for the installation
+
+---------------------------------------------------------------------------
+* Useful Addresses
+
+For the most recent version of GLU:
+	ftp://vlsi.colorado.edu/pub/vis/
+
+The VIS home page:
+	http://vlsi.colorado.edu/~vis/
+
+For the most recent version of the GNU tools:
+	http://www.gnu.org
+
+---------------------------------------------------------------------------
+This is the list of architecture/operating system/compiler
+combinations we have tested. (For installation with compilers marked
+with (*) please refer to the Platform Specific Instructions.)
+
+	* IBM RISC System/6000 / AIX Version 4.3.3 / gcc(*)
+        * Intel ix86 / Linux / gcc, g++, icc
+	* Intel ix86 / Windows XP with Cygwin 1.5.16-1 / gcc, g++(*)
+	* Intel ia64 / Linux / gcc
+        * Sun Sparc/ Solaris 2.8 / gcc, g++, cc(*)
+
+The following instructions are for the generic build process.  Before
+building the tool please refer to the section "* Platform Specific
+Instructions".
+
+---------------------------------------------------------------------------
+To build GLU for a single operating system:
+
+* Download the most recent versions of GLU from the address above
+
+* Move to where you would like the GLU source to reside and unpack
+  the distribution:
+
+	% cd /home/vis					# for example
+	% gzip -dc /tmp/glu-2.1.tar.gz | tar xf -
+
+* Move into the glu-2.1 directory and run configure, which will determine
+  some system-specific parameters and create the Makefile:
+
+	% cd glu-2.1
+	% ./configure
+
+  By default, this will use your system's native compiler.  To use gcc,
+  
+        % ./configure --enable-gcc
+
+  (You may wish to do this because you don't have the native compiler
+  installed or because it is not ANSI.)
+
+  Note: For some platforms where VIS is not supported for the native
+  compiler, the default compiler is set to gcc.
+
+  You can also compile glu with g++.  To do so,
+
+        % ./configure --enable-gcc=g++
+
+  Note: The Makefile by default uses the "-g" option for
+  compilation.  The resultant executables may be much larger than
+  those generated without using the "-g" option.  Using the
+  "-g" option however, provides debugging capabilities.
+
+  Note: The following is of interest only to people developing code
+  within vis.  For full debugging support, specify
+  --with-comp-mode=debug.  This will turn off optimization, and turn
+  on the assertions (sanity checks) in the code.  Similarly,
+  --with-comp-mode=purify and --with-comp-mode=quantify will link vis
+  with IBM Rational's Purify or Quantify tool.
+
+* Build the GLU system by running GNU's gmake utility:
+
+	% gmake
+
+  You may not have GNU make installed on your system under the name
+  'gmake' -- try make.  If this fails, you probably need the latest
+  version of GNU's make program -- download it from the address above.
+
+* (Optional) Test the build by invoking
+
+	% gmake check
+
+  This make take some time on slower machines.
+
+* Install the GLU library and its headers:
+
+	% gmake install					# optional
+
+  By default, this will put binaries, libraries, headers, and help files
+  in /usr/local/bin, /usr/local/lib, /usr/local/include, and /usr/local/share
+  respectively.  To choose a different location, provide a default prefix
+  when you invoke configure, e.g., to install in /projects/glu/bin, etc.,
+  use
+
+	% ./configure --prefix=/projects/glu
+
+  when configuring GLU.
+
+---------------------------------------------------------------------------
+To install GLU on multiple operating systems off the same source tree,
+see the file "INSTALL" in this directory.
+---------------------------------------------------------------------------
+
+* Platform Specific Instructions
+
+Note: some instructions apply to platforms we no longer support.
+
+** Little-endian machines:
+
+  vis-cal will occasionally fail when compiled with
+  --with-comp-mode=debug on little-endian machines like the Alphas and
+  the Intel ix86 CPUs.
+
+** DEC Alpha:
+
+  Warnings about MIN and MAX are harmless. 
+  Warnings in the cuBdd package related to floating point are
+  also harmless.
+
+  The cc compiler will use 32-bit pointers by default.  To use 64-bit
+  pointers, invoke configure as follows: 
+
+	% ./configure --enable-64
+
+  The gcc compiler will always use 64-bit pointers.
+
+** Solaris:
+
+  If Sun's C compiler is not installed on your system, use gcc
+  (./configure --enable-gcc).
+
+  Warnings about redefined symbol are harmless, so are the warnings that say
+  "end-of-loop code not reached".
+
+  The target check-cmu (which is executed as part of "make check")
+  fails with Solaris's native compiler unless -dalign is removed from
+  CFLAGS.  Although vis-cmu executes correctly even if compiled with
+  -dalign, if you plan to extensively use vis-cmu (especially develop
+  new code that uses MTBDDs) you should not compile with -dalign.
+
+  The sun cc compiler (Workshop 6 update 1) on ix86 appears to have a
+  bug in the optimization routines.  The -xO4 an -xO5 compiler options
+  will make vis crash.  As a safety precaution, we have changed the
+  optimization flag to be -xO3 for all Sun platforms that use the cc
+  compiler.  You can try higher optimization flags on your machine.
+  In general, it is hard to determine cc options that will give
+  optimal results on every platform, so it may pay off to play around
+  with the optimization options.
+
+** MS Windows with Cygwin:
+
+  You need Red Hat's Cygwin environment (freely available from
+  http://www.cygwin.com) to build GLU and VIS.
+
+  With Cygwin the configuration script automatically selects gcc.
+
+** AIX:
+
+  The configuration script automatically selects gcc.  The cal package
+  occasionally produces incorrect result if compiled with optimization
+  turned on.  If you plan to use the cal BDD package with AIX, you
+  should configure glu with --with-comp-mode=debug.
Index: /vis_dev/glu-2.1/configure
===================================================================
--- /vis_dev/glu-2.1/configure	(revision 6)
+++ /vis_dev/glu-2.1/configure	(revision 6)
@@ -0,0 +1,8271 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.63.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes &&	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+	done
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell bug-autoconf@gnu.org about your system,
+  echo including any error possibly output before this message.
+  echo This can help us improve future autoconf versions.
+  echo Configuration will now proceed without shell functions.
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="src/array/array.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+EGREP
+GREP
+CPP
+PLINKER
+LINKER
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+RANLIB
+AR
+local_srcdir
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_times_resolution
+with_local_srcdir
+with_datasize
+enable_gcc
+enable_64
+with_comp_mode
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
+   { (exit 1); exit 1; }; } ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { $as_echo "$as_me: error: working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-times-resolution=<hertz>
+			  Set the resolution of the times() function (only
+			  necessary for non-POSIX systems).
+  --enable-gcc            Allow use of gcc if available
+  --enable-64             Use 64-bit pointers on 64-bit Alpha machines
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-local-srcdir=<srcdir> Specify the root directory to search for
+                          source for packages (the PKGS list).
+                          Expects to find, e.g., <srcdir>/array/array.c
+  --with-datasize=<size>  (Default: 67108864.) Specify maximum datasize in
+                          bytes for systems without working getrlimit.
+                          The application may use this value to size some
+                          data structures, but may still try to exceed it.
+  --with-comp-mode=<mode> Specify a special compilation mode:
+			  optimize (the default): Produce optimized
+				code, with symbol table information
+				if supported on the platform/compiler,
+				and without asserts.
+			  debug: Produce unoptimized code with symbol table
+				information and asserts enabled
+			  purify: Unoptimized code linked with purify
+			  quantify: Optimized code without asserts
+				linked with quantify
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.63
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.63.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  $as_echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test -r "$ac_site_file"; then
+    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Look for install.sh, config.guess, and config.sub in the "helpers" dir
+ac_aux_dir=
+for ac_dir in helpers "$srcdir"/helpers; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in helpers \"$srcdir\"/helpers" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in helpers \"$srcdir\"/helpers" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+
+# Check whether --enable-times-resolution was given.
+if test "${enable_times_resolution+set}" = set; then
+  enableval=$enable_times_resolution; cat >>confdefs.h <<_ACEOF
+#define CLOCK_RESOLUTION $enableval
+_ACEOF
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define CLOCK_RESOLUTION 60
+_ACEOF
+
+fi
+
+
+#----------------------------------------------------------------------
+# Set local_srcdir
+#----------------------------------------------------------------------
+# Give the configurer a chance to set a different location for the GLU
+# source.  When specified, "srcdir" points to "master" source, and
+# "local_srcdir" points to the source under local development.
+
+
+
+# Check whether --with-local-srcdir was given.
+if test "${with_local_srcdir+set}" = set; then
+  withval=$with_local_srcdir; local_srcdir=$withval
+else
+  local_srcdir=$srcdir
+fi
+
+
+
+# Check whether --with-datasize was given.
+if test "${with_datasize+set}" = set; then
+  withval=$with_datasize; datasize=$withval
+else
+  datasize=67108864
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define RLIMIT_DATA_DEFAULT $datasize
+_ACEOF
+
+
+#----------------------------------------------------------------------
+# Checks for programs we need
+#----------------------------------------------------------------------
+
+# Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_AR+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $AR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AR="$AR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_AR" && ac_cv_path_AR="ar"
+  ;;
+esac
+fi
+AR=$ac_cv_path_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:$LINENO: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
+$as_echo "$as_me: error: invalid value of canonical target" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+# Determine the name of the C compiler we're going to use
+
+# Check whether --enable-gcc was given.
+if test "${enable_gcc+set}" = set; then
+  enableval=$enable_gcc; gcc_ok=$enableval
+else
+  gcc_ok=no
+fi
+
+
+# We cannot set CC=g++ directly because many configuration test programs
+# do not compile with g++.  Hence, when the user specifies --enable-gcc=g++,
+# we set CC=gcc during configuration, and then CC=g++ at the end.
+# The same applies to icpc and icc.
+if test "$gcc_ok" != no; then
+  case "$gcc_ok" in
+    yes | g++)
+      CC=gcc ;;
+    icpc)
+      CC=icc ;;
+    *)
+      CC=$gcc_ok
+  esac
+else
+  if test -z "$CC" ; then
+    # Balakrishna Kumthekar <kumtheka@colorado.edu>
+    # As we do not support cc on RS6000, Cygwin and SunOS.
+    case "$target" in
+    rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
+      CC=gcc ;;
+    *)
+      CC=cc ;;
+    esac
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Icc fools AC_PROG_CC into believing it is gcc because it defines __GNUC__.
+# To avoid this confusion we add the following test.
+if test "$CC" = icc; then
+  GCC=
+fi
+
+# Check whether --enable-64 was given.
+if test "${enable_64+set}" = set; then
+  enableval=$enable_64; use_sixty_four=$enableval
+else
+  use_sixty_four=no
+fi
+
+
+# Gcc does not support 32-bit pointers on the Alphas.
+if test "$gcc_ok" != no; then
+  use_sixty_four=yes
+fi
+
+
+# Balakrisha Kumthekar <kumtheka@colorado.edu>: making a special case
+# for ultrix install, since it's annoying about setting groupids.
+case "$target" in
+  mips-dec-ultrix*)
+    INSTALL="helpers/install-sh -c"
+    INSTALL_PROGRAM="\${INSTALL}"
+    INSTALL_DATA="\${INSTALL} -m 644";;
+
+  *)
+  # Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+ ;;
+esac
+
+# Determine the compiler flags to use
+
+DEBUG_CFLAGS="-g"
+DEBUG_LDFLAGS=""
+
+case "$target" in
+
+  i686-pc-linux-gnu)
+	# Linux with Intel compiler
+	# -ansi: ANSI C conformance
+	# -ip: inter-procedural optimization
+	OPTIMIZE_CFLAGS="-g -O3 -ansi -ip"
+	;;
+
+  sparc-sun-solaris* | i386-pc-solaris*)
+	# Sparc and X86 Solaris:
+	# -xO3: Highest safe level of optimization
+	# -native: Optimize for the native processor (if supported)
+	# -dalign: Generate double-word load/store for performance
+	#          (only for SPARC)
+	# and other arcane compilation flags.
+	if test "$GCC" = yes; then
+	  OPTIMIZE_CFLAGS="-O"
+	else
+	  case "$target" in
+            sparc-sun-solaris*)
+	      ALIGN=" -dalign" ;;
+	    *)
+	      ALIGN="" ;;
+          esac
+	  { $as_echo "$as_me:$LINENO: checking for -native" >&5
+$as_echo_n "checking for -native... " >&6; }
+	  CFLAGS="-xO3 -native$ALIGN"
+
+if test "${ac_cv_have_native+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_have_native=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	  main(){exit(0);}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_native=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_have_native=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+	  if test $ac_cv_have_native = yes ; then
+	    { $as_echo "$as_me:$LINENO: result: working" >&5
+$as_echo "working" >&6; }
+	    OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
+	  else
+	    { $as_echo "$as_me:$LINENO: result: broken" >&5
+$as_echo "broken" >&6; }
+	    { $as_echo "$as_me:$LINENO: checking for fallback optimization flags" >&5
+$as_echo_n "checking for fallback optimization flags... " >&6; }
+	    CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    if test "${ac_cv_have_fallback+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_have_fallback=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	    main(){exit(0);}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_fallback=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_have_fallback=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+	    if test $ac_cv_have_fallback = yes ; then
+	      { $as_echo "$as_me:$LINENO: result: working" >&5
+$as_echo "working" >&6; }
+	      OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    else
+	      { $as_echo "$as_me:$LINENO: result: broken" >&5
+$as_echo "broken" >&6; }
+	      OPTIMIZE_CFLAGS="-O"
+	    fi
+	  fi
+	fi
+        ;;
+
+  mips-dec-ultrix*)
+	# MIPS-based DECstations running Ultrix:
+	# -std1: Produce non-ANSI code warnings, and define __STDC__
+	# -O: Use the global "ucode" optimizer
+	# -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks
+	OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;;
+
+  alpha-dec-osf*)
+	# DEC Alpha running OSF:
+
+	# 64-bit mode:
+	# -g3: Produce symbol table information for optimized code
+	# -O4: Enable every optimization
+	# -std: Enforce the ANSI standard with extensions, define __STDC__
+	# -ieee_with_no_inexact: Disable (potentially slow) signaling
+	#   for inexact floating-point results
+	# -tune host: Tune instructions for the compilation host machine
+	OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
+	DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
+
+	# -non_shared: Do not use shared libraries
+	# -om: Generate an OMAGIC file for the om optimizer
+	OPTIMIZE_LDFLAGS="-non_shared"
+
+	if test "$use_sixty_four" = "no"; then
+	  # 32-bit mode:
+	  # -xtaso: Make the compiler respond to #pragma pointer_size directives
+          OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
+          DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
+
+	  # -taso: Load the executable into the lower 31-bit address space
+	  OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
+	  DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
+
+	  cat >>confdefs.h <<\_ACEOF
+#define SIZEOF_VOID_P 4
+_ACEOF
+
+          ac_sizeof_voidp=4
+        fi
+	;;
+
+  hppa*-*-hpux*)
+	# HP running HPUX
+	# -Aa: Behave as an ANSI compiler
+	# -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
+	#   files (e.g., this means sys/resource.h has struct rusage)
+	OPTIMIZE_CFLAGS="-O -Aa -D_HPUX_SOURCE"
+	DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
+
+     *)
+	# Other systems:
+	OPTIMIZE_CFLAGS="-O" ;;
+
+esac
+
+if test "$GCC" = yes; then
+  case "$target" in
+    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32 | i386-*-freebsd*)
+      { $as_echo "$as_me:$LINENO: checking for -mcpu and -malign compiler options" >&5
+$as_echo_n "checking for -mcpu and -malign compiler options... " >&6; }
+      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_have_mcpu=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_have_mcpu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      if test "$ac_have_mcpu" = yes; then
+        { $as_echo "$as_me:$LINENO: result: working" >&5
+$as_echo "working" >&6; }
+        OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      else
+        { $as_echo "$as_me:$LINENO: result: broken" >&5
+$as_echo "broken" >&6; }
+        OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    sparc-sun-solaris*)
+      { $as_echo "$as_me:$LINENO: checking for -mtune compiler option" >&5
+$as_echo_n "checking for -mtune compiler option... " >&6; }
+      CFLAGS="-g -O6 -mtune=ultrasparc"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_have_mtune=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_have_mtune=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      if test "$ac_have_mtune" = yes; then
+        { $as_echo "$as_me:$LINENO: result: working" >&5
+$as_echo "working" >&6; }
+        OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
+      else
+        { $as_echo "$as_me:$LINENO: result: not working" >&5
+$as_echo "not working" >&6; }
+        OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    *)
+      OPTIMIZE_CFLAGS="-g -O3"
+      ;;
+  esac
+  OPTIMIZE_LDFLAGS=""
+  DEBUG_CFLAGS="-g"
+  DEBUG_LDFLAGS=""
+fi
+
+
+# Check whether --with-comp-mode was given.
+if test "${with_comp_mode+set}" = set; then
+  withval=$with_comp_mode; comp_mode=$withval
+else
+  comp_mode=optimize
+fi
+
+
+
+
+LINKER="$CC"
+
+case "$comp_mode" in
+  debug)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS" ;;
+  purify)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS"
+       cat >>confdefs.h <<\_ACEOF
+#define PURIFY 1
+_ACEOF
+
+       LINKER="purify -cache-dir=/tmp $CC"
+       PLINKER="purify -log-file=./purify.log -cachedir=/tmp $CC" ;;
+  quantify)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       cat >>confdefs.h <<\_ACEOF
+#define QUANTIFY 1
+_ACEOF
+
+       cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+
+       LINKER="quantify $CC" ;;
+  optimize | *)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+ ;;
+esac
+
+#----------------------------------------------------------------------
+# Checks for libraries
+#----------------------------------------------------------------------
+
+# Define STDC_HEADERS if the system has ANSI C header files
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+# Define HAVE_SYS_WAIT_H if sys/wait.h exists and is POSIX-compliant
+{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+  int s;
+  wait (&s);
+  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_sys_wait_h=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_sys_wait_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_WAIT_H 1
+_ACEOF
+
+fi
+
+
+# Check for these system header files
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in sys/file.h sys/stat.h unistd.h errno.h assert.h sys/wait.h pwd.h sys/types.h sys/times.h sys/time.h sys/resource.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Check how the compiler handles functions with variable argument lists
+#
+# If there's a <stdarg.h>, this is probably an ANSI compiler and the "..."
+# notation will probably work.  If not, there may be another version
+# called <varargs.h>, that uses an argument of the type "va_alist"
+# (see, e.g., Ultrix, Digital Unix)
+
+
+for ac_header in stdarg.h varargs.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+#----------------------------------------------------------------------
+# Checks for typedefs, structures, and compiler characteristics.
+#----------------------------------------------------------------------
+
+# Check to see if the compiler understands "const"
+# #define it empty otherwise
+{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset cs;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_const=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const /**/
+_ACEOF
+
+fi
+
+
+# Check the size of pointers, longs and ints
+
+if test -z "$ac_sizeof_voidp"; then
+  # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if test "${ac_cv_sizeof_void_p+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_void_p=$ac_lo;;
+'') if test "$ac_cv_type_void_p" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (void *)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_void_p=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+static long int longval () { return (long int) (sizeof (void *)); }
+static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (void *))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (void *))))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (void *))))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_void_p=`cat conftest.val`
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_void_p" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (void *)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_void_p=0
+   fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+
+fi
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if test "${ac_cv_sizeof_int+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') if test "$ac_cv_type_int" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+static long int longval () { return (long int) (sizeof (int)); }
+static unsigned long int ulongval () { return (long int) (sizeof (int)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (int))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (int))))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (int))))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_int=`cat conftest.val`
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_int" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (int)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr $ac_mid + 1`
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_hi=`expr '(' $ac_mid ')' - 1`
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+static long int longval () { return (long int) (sizeof (long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (long))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (long))))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (long))))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_long=`cat conftest.val`
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+
+# Check for a working implementation of IEEE 754 floating point
+# Specifically, check for correct treatment of +Infinity
+{ $as_echo "$as_me:$LINENO: checking for +Infinity (IEEE 754 floating point)" >&5
+$as_echo_n "checking for +Infinity (IEEE 754 floating point)... " >&6; }
+if test "${ac_cv_have_ieee_754+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_have_ieee_754=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <math.h>
+main()
+{
+    if (HUGE_VAL != HUGE_VAL * 3 || HUGE_VAL != HUGE_VAL / 3) exit(1);
+    exit(0);
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_ieee_754=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_have_ieee_754=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test $ac_cv_have_ieee_754 = yes ; then
+  { $as_echo "$as_me:$LINENO: result: working" >&5
+$as_echo "working" >&6; }
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_IEEE_754 1
+_ACEOF
+
+else
+  { $as_echo "$as_me:$LINENO: result: broken" >&5
+$as_echo "broken" >&6; }
+fi
+
+# Check the size of the virtual memory page
+#
+# The Cal BDD package uses this
+#
+# This compiles and runs a small program that gets the pagesize from
+# the "getpagesize()" UNIX system function.
+
+{ $as_echo "$as_me:$LINENO: checking the size of the virtual memory system's page" >&5
+$as_echo_n "checking the size of the virtual memory system's page... " >&6; }
+if test "${ac_cv_sys_pagesize+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_sys_pagesize=unknown
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+main() {
+  FILE * f = fopen( "conftestval", "w" );
+  if ( f == NULL ) exit(1);
+  fprintf( f, "%d\n", (int) getpagesize() );
+  exit(0);
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_pagesize=`cat conftestval`
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_sys_pagesize=unknown
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+case "$ac_cv_sys_pagesize" in
+   512)
+     { $as_echo "$as_me:$LINENO: result: 512" >&5
+$as_echo "512" >&6; }
+     PAGE_SIZE=512
+     LG_PAGE_SIZE=9 ;;
+   1024)
+     { $as_echo "$as_me:$LINENO: result: 1K" >&5
+$as_echo "1K" >&6; }
+     PAGE_SIZE=1024
+     LG_PAGE_SIZE=10 ;;
+   2048)
+     { $as_echo "$as_me:$LINENO: result: 2K" >&5
+$as_echo "2K" >&6; }
+     PAGE_SIZE=2048
+     LG_PAGE_SIZE=11 ;;
+   4096)
+     { $as_echo "$as_me:$LINENO: result: 4K" >&5
+$as_echo "4K" >&6; }
+     PAGE_SIZE=4096
+     LG_PAGE_SIZE=12 ;;
+   8192)
+     { $as_echo "$as_me:$LINENO: result: 8K" >&5
+$as_echo "8K" >&6; }
+     PAGE_SIZE=8192
+     LG_PAGE_SIZE=13 ;;
+   16384)
+     { $as_echo "$as_me:$LINENO: result: 16K" >&5
+$as_echo "16K" >&6; }
+     PAGE_SIZE=16384
+     LG_PAGE_SIZE=14 ;;
+   32768)
+     { $as_echo "$as_me:$LINENO: result: 32K" >&5
+$as_echo "32K" >&6; }
+     PAGE_SIZE=32768
+     LG_PAGE_SIZE=15 ;;
+   65536)
+     { $as_echo "$as_me:$LINENO: result: 64K" >&5
+$as_echo "64K" >&6; }
+     PAGE_SIZE=65536
+     LG_PAGE_SIZE=16 ;;
+   unknown)
+     { $as_echo "$as_me:$LINENO: result: could not determine -- assuming 4K" >&5
+$as_echo "could not determine -- assuming 4K" >&6; }
+     PAGE_SIZE=4096
+     LG_PAGE_SIZE=12 ;;
+   *)
+     { $as_echo "$as_me:$LINENO: result: Invalid page size $ac_cv_sys_pagesize -- assuming 4K" >&5
+$as_echo "Invalid page size $ac_cv_sys_pagesize -- assuming 4K" >&6; }
+     PAGE_SIZE=4096
+     LG_PAGE_SIZE=12 ;;
+esac
+cat >>confdefs.h <<_ACEOF
+#define PAGE_SIZE $PAGE_SIZE
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define LG_PAGE_SIZE $LG_PAGE_SIZE
+_ACEOF
+
+
+# Check the endianness
+#
+# This compiles and runs a small program that gets endian type.
+
+{ $as_echo "$as_me:$LINENO: checking endian type" >&5
+$as_echo_n "checking endian type... " >&6; }
+if test "${ac_cv_sys_endian+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_sys_endian=unknown
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+typedef struct EpDoubleStruct {
+  union {
+    double	value;
+    struct IeeeDoubleStruct {	/* LITTLE_ENDIAN */
+      unsigned int mantissa1: 32;
+      unsigned int mantissa0: 20;
+      unsigned int exponent: 11;
+      unsigned int sign: 1;
+    } bits;
+  } type;
+  int		exponent;
+} EpDouble;
+
+main()
+{
+  EpDouble	epd;
+  FILE		*f = fopen("conftestval", "w" );
+
+  if (!f) exit(1);
+  epd.type.value = -1.0;
+  if (epd.type.bits.sign == 1 && epd.type.bits.exponent == 1023 &&
+      epd.type.bits.mantissa0 == 0 && epd.type.bits.mantissa1 == 0)
+    fprintf(f, "0\n");
+  else
+    fprintf(f, "1\n");
+  fclose(f);
+  exit(0);
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_endian=`cat conftestval`
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_sys_endian=unknown
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+case "$ac_cv_sys_endian" in
+   0)
+     { $as_echo "$as_me:$LINENO: result: LITTLE_ENDIAN" >&5
+$as_echo "LITTLE_ENDIAN" >&6; }
+     cat >>confdefs.h <<_ACEOF
+#define EPD_LITTLE_ENDIAN 1
+_ACEOF
+ ;;
+   1)
+     { $as_echo "$as_me:$LINENO: result: BIG_ENDIAN" >&5
+$as_echo "BIG_ENDIAN" >&6; }
+     cat >>confdefs.h <<_ACEOF
+#define EPD_BIG_ENDIAN 1
+_ACEOF
+ ;;
+   *)
+     { $as_echo "$as_me:$LINENO: result: Invalid endian size $ac_cv_sys_endian -- assuming LITTLE_ENDIAN" >&5
+$as_echo "Invalid endian size $ac_cv_sys_endian -- assuming LITTLE_ENDIAN" >&6; }
+     cat >>confdefs.h <<_ACEOF
+#define EPD_LITTLE_ENDIAN 1
+_ACEOF
+ ;;
+esac
+
+#----------------------------------------------------------------------
+# Checks for library functions.
+#----------------------------------------------------------------------
+
+# Add memcmp.o to LIBOBJS if the memcmp() function is unavailable or broken
+{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if test "${ac_cv_func_memcmp_working+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_working=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = '\100', c1 = '\200', c2 = '\201';
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    return 1;
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+	char *a = foo + i;
+	char *b = bar + i;
+	strcpy (a, "--------01111111");
+	strcpy (b, "--------10000000");
+	if (memcmp (a, b, 16) >= 0)
+	  return 1;
+      }
+    return 0;
+  }
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_memcmp_working=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_memcmp_working=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
+  *" memcmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
+esac
+
+
+
+# Define RETSIGTYPE to be void or int depending on the expected return type of
+# a signal handler
+{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if test "${ac_cv_type_signal+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_signal=int
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_signal=void
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+# Define HAVE_STRCOLL if the strcoll function exists and works
+{ $as_echo "$as_me:$LINENO: checking for working strcoll" >&5
+$as_echo_n "checking for working strcoll... " >&6; }
+if test "${ac_cv_func_strcoll_works+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_strcoll_works=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+return (strcoll ("abc", "def") >= 0 ||
+	 strcoll ("ABC", "DEF") >= 0 ||
+	 strcoll ("123", "456") >= 0)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_strcoll_works=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_strcoll_works=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strcoll_works" >&5
+$as_echo "$ac_cv_func_strcoll_works" >&6; }
+if test $ac_cv_func_strcoll_works = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRCOLL 1
+_ACEOF
+
+fi
+
+
+# Define HAVE_VFORK_H if vfork.h is present, otherwise define "vfork" to be
+# "fork"
+{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
+$as_echo_n "checking for pid_t... " >&6; }
+if test "${ac_cv_type_pid_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_pid_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (pid_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((pid_t)))
+	  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_pid_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+$as_echo "$ac_cv_type_pid_t" >&6; }
+if test "x$ac_cv_type_pid_t" = x""yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+
+for ac_header in vfork.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_func in fork vfork
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then
+  eval "$as_ac_var=yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+  { $as_echo "$as_me:$LINENO: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if test "${ac_cv_func_fork_works+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_fork_works=cross
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+	  /* By Ruediger Kuhlmann. */
+	  return fork () < 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_fork_works=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_fork_works=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+  ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+  case $host in
+    *-*-amigaos* | *-*-msdosdjgpp*)
+      # Override, as these systems have only a dummy fork() stub
+      ac_cv_func_fork_works=no
+      ;;
+    *)
+      ac_cv_func_fork_works=yes
+      ;;
+  esac
+  { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+  { $as_echo "$as_me:$LINENO: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if test "${ac_cv_func_vfork_works+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_vfork_works=cross
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Thanks to Paul Eggert for this test.  */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include <vfork.h>, but some compilers
+   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
+
+int
+main ()
+{
+  pid_t parent = getpid ();
+  pid_t child;
+
+  sparc_address_test (0);
+
+  child = vfork ();
+
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+	|| p != p5 || p != p6 || p != p7)
+      _exit(1);
+
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
+
+    while (wait(&status) != child)
+      ;
+    return (
+	 /* Was there some problem with vforking?  */
+	 child < 0
+
+	 /* Did the child fail?  (This shouldn't happen.)  */
+	 || status
+
+	 /* Did the vfork/compiler bug occur?  */
+	 || parent != getpid()
+
+	 /* Did the file descriptor bug occur?  */
+	 || fstat(fileno(stdout), &st) != 0
+	 );
+  }
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_vfork_works=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_vfork_works=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+  ac_cv_func_vfork_works=$ac_cv_func_vfork
+  { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WORKING_VFORK 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define vfork fork
+_ACEOF
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WORKING_FORK 1
+_ACEOF
+
+fi
+
+
+# Look for these functions and define HAVE_... for each if present
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in sysconf gethostname strcspn strerror strspn strstr getenv strchr getrlimit getrusage valloc
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then
+  eval "$as_ac_var=yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+		 $as_echo "$as_val"'`
+	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+		 $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+#----------------------------------------------------------------------
+# Create the Makefile from Makefile.in
+#----------------------------------------------------------------------
+if test "$gcc_ok" = "g++"; then
+  CC=$gcc_ok
+fi
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+	g
+	s/^\n//
+	s/\n/ /g
+	p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.63.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="`echo $ac_config_files`"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.63,
+  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h |  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   $as_echo "$as_me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr='
+'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = ""
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+   { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X "  :F $CONFIG_FILES      "
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      ac_file_inputs="$ac_file_inputs '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	`' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; } ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
+ ;;
+
+
+
+  esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
Index: /vis_dev/glu-2.1/configure.in
===================================================================
--- /vis_dev/glu-2.1/configure.in	(revision 6)
+++ /vis_dev/glu-2.1/configure.in	(revision 6)
@@ -0,0 +1,540 @@
+dnl	Run autoconf on this file to produce the system configuration
+dnl	script "configure"
+
+# FileName	[ configure.in ]
+#
+# PackageName	[ glu ]
+#
+# Synopsis	[ System configuration script for autoconf ]
+#
+# SeeAlso	[ Makefile.in ]
+#
+# Author	[ Stephen Edwards <sedwards@eecs.berkeley.edu> ]
+#
+# Copyright	[
+#  Copyright (c) 1994-1996 The Regents of the Univ. of California.
+#  All rights reserved.
+#
+#  Permission is hereby granted, without written agreement and without license
+#  or royalty fees, to use, copy, modify, and distribute this software and its
+#  documentation for any purpose, provided that the above copyright notice and
+#  the following two paragraphs appear in all copies of this software.
+#
+#  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+#  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+#  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+#  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+#  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+#  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+#  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+#  ]
+#
+# Revision	[$Id: configure.in,v 1.50 2004/09/09 17:48:10 fabio Exp $]
+
+# Require version 2.11 or above -- it checks to see if the C compiler
+# actually works!
+
+AC_PREREQ(2.11)
+
+AC_INIT(src/array/array.c)
+
+# Look for install.sh, config.guess, and config.sub in the "helpers" dir
+AC_CONFIG_AUX_DIR(helpers)
+
+AC_ARG_ENABLE(times-resolution, [  --enable-times-resolution=<hertz>
+			  Set the resolution of the times() function (only
+			  necessary for non-POSIX systems).],
+	[AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,$enableval)],
+	[AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,60)])
+
+#----------------------------------------------------------------------
+# Set local_srcdir
+#----------------------------------------------------------------------
+# Give the configurer a chance to set a different location for the GLU
+# source.  When specified, "srcdir" points to "master" source, and
+# "local_srcdir" points to the source under local development.
+
+AC_SUBST(local_srcdir)
+AC_ARG_WITH(local-srcdir,
+[  --with-local-srcdir=<srcdir> Specify the root directory to search for
+                          source for packages (the PKGS list).
+                          Expects to find, e.g., <srcdir>/array/array.c],
+[local_srcdir=$withval],
+[local_srcdir=$srcdir])
+
+AC_ARG_WITH(datasize,
+[  --with-datasize=<size>  (Default: 67108864.) Specify maximum datasize in 
+                          bytes for systems without working getrlimit.
+                          The application may use this value to size some
+                          data structures, but may still try to exceed it.],
+[datasize=$withval],
+[datasize=67108864])
+AC_DEFINE_UNQUOTED(RLIMIT_DATA_DEFAULT,$datasize)
+
+#----------------------------------------------------------------------
+# Checks for programs we need
+#----------------------------------------------------------------------
+
+AC_PATH_PROG(AR, ar, ar)
+AC_PROG_RANLIB
+
+AC_CANONICAL_SYSTEM
+AC_SUBST(target)
+
+# Determine the name of the C compiler we're going to use
+
+AC_ARG_ENABLE(gcc,
+  [  --enable-gcc            Allow use of gcc if available],
+  [gcc_ok=$enableval], [gcc_ok=no])
+
+# We cannot set CC=g++ directly because many configuration test programs
+# do not compile with g++.  Hence, when the user specifies --enable-gcc=g++,
+# we set CC=gcc during configuration, and then CC=g++ at the end.
+# The same applies to icpc and icc.
+if test "$gcc_ok" != no; then
+  case "$gcc_ok" in
+    yes | g++)
+      CC=gcc ;;
+    icpc)
+      CC=icc ;;
+    *)
+      CC=$gcc_ok
+  esac
+else
+  if test -z "$CC" ; then
+    # Balakrishna Kumthekar <kumtheka@colorado.edu>
+    # As we do not support cc on RS6000, Cygwin and SunOS.
+    case "$target" in
+    rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
+      CC=gcc ;;
+    *)
+      CC=cc ;;
+    esac
+  fi
+fi
+AC_PROG_CC
+
+# Icc fools AC_PROG_CC into believing it is gcc because it defines __GNUC__.
+# To avoid this confusion we add the following test.
+if test "$CC" = icc; then
+  GCC=
+fi
+
+AC_ARG_ENABLE(64,
+  [  --enable-64             Use 64-bit pointers on 64-bit Alpha machines],
+  [use_sixty_four=$enableval], [use_sixty_four=no])
+
+# Gcc does not support 32-bit pointers on the Alphas.
+if test "$gcc_ok" != no; then
+  use_sixty_four=yes
+fi
+
+
+# Balakrisha Kumthekar <kumtheka@colorado.edu>: making a special case
+# for ultrix install, since it's annoying about setting groupids.
+case "$target" in
+  mips-dec-ultrix*)
+    INSTALL="helpers/install-sh -c"
+    INSTALL_PROGRAM="\${INSTALL}"
+    INSTALL_DATA="\${INSTALL} -m 644";;
+
+  *)
+  AC_PROG_INSTALL ;;
+esac
+
+# Determine the compiler flags to use
+
+DEBUG_CFLAGS="-g"
+DEBUG_LDFLAGS=""
+
+case "$target" in
+
+  i686-pc-linux-gnu)
+	# Linux with Intel compiler
+	# -ansi: ANSI C conformance
+	# -ip: inter-procedural optimization
+	OPTIMIZE_CFLAGS="-g -O3 -ansi -ip"
+	;;
+
+  sparc-sun-solaris* | i386-pc-solaris*)
+	# Sparc and X86 Solaris:
+	# -xO3: Highest safe level of optimization
+	# -native: Optimize for the native processor (if supported)
+	# -dalign: Generate double-word load/store for performance
+	#          (only for SPARC)
+	# and other arcane compilation flags.
+	if test "$GCC" = yes; then
+	  OPTIMIZE_CFLAGS="-O"
+	else
+	  case "$target" in
+            sparc-sun-solaris*)
+	      ALIGN=" -dalign" ;;
+	    *)
+	      ALIGN="" ;;
+          esac
+	  AC_MSG_CHECKING([for -native])
+	  CFLAGS="-xO3 -native$ALIGN"
+	  AC_CACHE_VAL(ac_cv_have_native,
+	  [ AC_TRY_RUN([
+	  main(){exit(0);}
+	  ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)])
+	  if test $ac_cv_have_native = yes ; then
+	    AC_MSG_RESULT(working)
+	    OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
+	  else
+	    AC_MSG_RESULT(broken)
+	    AC_MSG_CHECKING([for fallback optimization flags])
+	    CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    AC_CACHE_VAL(ac_cv_have_fallback,
+	    [ AC_TRY_RUN([
+	    main(){exit(0);}
+	    ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)])
+	    if test $ac_cv_have_fallback = yes ; then
+	      AC_MSG_RESULT(working)
+	      OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    else
+	      AC_MSG_RESULT(broken)
+	      OPTIMIZE_CFLAGS="-O"
+	    fi
+	  fi
+	fi
+        ;;
+
+  mips-dec-ultrix*)
+	# MIPS-based DECstations running Ultrix:
+	# -std1: Produce non-ANSI code warnings, and define __STDC__
+	# -O: Use the global "ucode" optimizer
+	# -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks
+	OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;;
+   
+  alpha-dec-osf*)
+	# DEC Alpha running OSF:
+
+	# 64-bit mode:
+	# -g3: Produce symbol table information for optimized code
+	# -O4: Enable every optimization
+	# -std: Enforce the ANSI standard with extensions, define __STDC__
+	# -ieee_with_no_inexact: Disable (potentially slow) signaling
+	#   for inexact floating-point results
+	# -tune host: Tune instructions for the compilation host machine
+	OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
+	DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
+
+	# -non_shared: Do not use shared libraries
+	# -om: Generate an OMAGIC file for the om optimizer
+	OPTIMIZE_LDFLAGS="-non_shared"
+
+	if test "$use_sixty_four" = "no"; then
+	  # 32-bit mode:
+	  # -xtaso: Make the compiler respond to #pragma pointer_size directives
+          OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
+          DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
+
+	  # -taso: Load the executable into the lower 31-bit address space
+	  OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
+	  DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
+
+	  AC_DEFINE(SIZEOF_VOID_P, 4)
+          ac_sizeof_voidp=4
+        fi
+	;;
+
+  hppa*-*-hpux*)
+	# HP running HPUX
+	# -Aa: Behave as an ANSI compiler
+	# -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
+	#   files (e.g., this means sys/resource.h has struct rusage)
+	OPTIMIZE_CFLAGS="-O -Aa -D_HPUX_SOURCE"
+	DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
+
+     *)
+	# Other systems:
+	OPTIMIZE_CFLAGS="-O" ;;
+
+esac
+
+if test "$GCC" = yes; then
+  case "$target" in
+    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32 | i386-*-freebsd*)
+      AC_MSG_CHECKING([for -mcpu and -malign compiler options])
+      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no)
+      if test "$ac_have_mcpu" = yes; then
+        AC_MSG_RESULT(working)
+        OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      else
+        AC_MSG_RESULT(broken)
+        OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    sparc-sun-solaris*)
+      AC_MSG_CHECKING([for -mtune compiler option])
+      CFLAGS="-g -O6 -mtune=ultrasparc"
+      AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no)
+      if test "$ac_have_mtune" = yes; then
+        AC_MSG_RESULT(working)
+        OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
+      else
+        AC_MSG_RESULT(not working)
+        OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    *)
+      OPTIMIZE_CFLAGS="-g -O3"
+      ;;
+  esac
+  OPTIMIZE_LDFLAGS=""
+  DEBUG_CFLAGS="-g"
+  DEBUG_LDFLAGS=""
+fi
+
+AC_ARG_WITH(comp-mode,
+[  --with-comp-mode=<mode> Specify a special compilation mode:
+			  optimize (the default): Produce optimized
+				code, with symbol table information
+				if supported on the platform/compiler,
+				and without asserts.
+			  debug: Produce unoptimized code with symbol table
+				information and asserts enabled
+			  purify: Unoptimized code linked with purify
+			  quantify: Optimized code without asserts
+				linked with quantify],
+[comp_mode=$withval],
+[comp_mode=optimize])
+AC_SUBST(LINKER)
+AC_SUBST(PLINKER)
+
+LINKER="$CC"
+
+case "$comp_mode" in
+  debug)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS" ;;
+  purify)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS"
+       AC_DEFINE(PURIFY)
+       LINKER="purify -cache-dir=/tmp $CC"
+       PLINKER="purify -log-file=./purify.log -cachedir=/tmp $CC" ;;
+  quantify)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       AC_DEFINE(QUANTIFY)
+       AC_DEFINE(NDEBUG)
+       LINKER="quantify $CC" ;;
+  optimize | *)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       AC_DEFINE(NDEBUG) ;;
+esac
+
+#----------------------------------------------------------------------
+# Checks for libraries
+#----------------------------------------------------------------------
+
+# Define STDC_HEADERS if the system has ANSI C header files
+AC_HEADER_STDC
+
+# Define HAVE_SYS_WAIT_H if sys/wait.h exists and is POSIX-compliant
+AC_HEADER_SYS_WAIT
+
+# Check for these system header files
+AC_CHECK_HEADERS(sys/file.h sys/stat.h unistd.h errno.h assert.h sys/wait.h pwd.h sys/types.h sys/times.h sys/time.h sys/resource.h)
+
+# Check how the compiler handles functions with variable argument lists
+#
+# If there's a <stdarg.h>, this is probably an ANSI compiler and the "..."
+# notation will probably work.  If not, there may be another version
+# called <varargs.h>, that uses an argument of the type "va_alist"
+# (see, e.g., Ultrix, Digital Unix)
+AC_CHECK_HEADERS(stdarg.h varargs.h)
+
+#----------------------------------------------------------------------
+# Checks for typedefs, structures, and compiler characteristics.
+#----------------------------------------------------------------------
+
+# Check to see if the compiler understands "const"
+# #define it empty otherwise
+AC_C_CONST
+
+# Check the size of pointers, longs and ints
+
+if test -z "$ac_sizeof_voidp"; then
+  AC_CHECK_SIZEOF(void *,4)
+fi
+AC_CHECK_SIZEOF(int,4)
+AC_CHECK_SIZEOF(long,4)
+
+# Check for a working implementation of IEEE 754 floating point
+# Specifically, check for correct treatment of +Infinity
+AC_MSG_CHECKING([for +Infinity (IEEE 754 floating point)])
+AC_CACHE_VAL(ac_cv_have_ieee_754,
+[ AC_TRY_RUN([
+#include <math.h>
+main()
+{
+    if (HUGE_VAL != HUGE_VAL * 3 || HUGE_VAL != HUGE_VAL / 3) exit(1);
+    exit(0);
+}
+],ac_cv_have_ieee_754=yes,ac_cv_have_ieee_754=no,ac_cv_have_ieee_754=no)])
+if test $ac_cv_have_ieee_754 = yes ; then
+  AC_MSG_RESULT(working)
+  AC_DEFINE(HAVE_IEEE_754)
+else
+  AC_MSG_RESULT(broken)
+fi
+
+# Check the size of the virtual memory page
+#
+# The Cal BDD package uses this
+#
+# This compiles and runs a small program that gets the pagesize from
+# the "getpagesize()" UNIX system function.
+
+AC_MSG_CHECKING([the size of the virtual memory system's page])
+AC_CACHE_VAL(ac_cv_sys_pagesize,
+[ AC_TRY_RUN([
+
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+main() {
+  FILE * f = fopen( "conftestval", "w" );
+  if ( f == NULL ) exit(1);
+  fprintf( f, "%d\n", (int) getpagesize() );
+  exit(0);
+}
+], ac_cv_sys_pagesize=`cat conftestval`, ac_cv_sys_pagesize=unknown, ac_cv_sys_pagesize=unknown)])
+case "$ac_cv_sys_pagesize" in
+   512)
+     AC_MSG_RESULT(512)
+     PAGE_SIZE=512
+     LG_PAGE_SIZE=9 ;;
+   1024)
+     AC_MSG_RESULT(1K)
+     PAGE_SIZE=1024
+     LG_PAGE_SIZE=10 ;;
+   2048)
+     AC_MSG_RESULT(2K)
+     PAGE_SIZE=2048
+     LG_PAGE_SIZE=11 ;;
+   4096)
+     AC_MSG_RESULT(4K)
+     PAGE_SIZE=4096
+     LG_PAGE_SIZE=12 ;;
+   8192)
+     AC_MSG_RESULT(8K)
+     PAGE_SIZE=8192
+     LG_PAGE_SIZE=13 ;;
+   16384)
+     AC_MSG_RESULT(16K)
+     PAGE_SIZE=16384
+     LG_PAGE_SIZE=14 ;;
+   32768)
+     AC_MSG_RESULT(32K)
+     PAGE_SIZE=32768
+     LG_PAGE_SIZE=15 ;;
+   65536)
+     AC_MSG_RESULT(64K)
+     PAGE_SIZE=65536
+     LG_PAGE_SIZE=16 ;;
+   unknown)
+     AC_MSG_RESULT([could not determine -- assuming 4K])
+     PAGE_SIZE=4096
+     LG_PAGE_SIZE=12 ;;
+   *)
+     AC_MSG_RESULT(Invalid page size $ac_cv_sys_pagesize -- assuming 4K)
+     PAGE_SIZE=4096
+     LG_PAGE_SIZE=12 ;;
+esac
+AC_DEFINE_UNQUOTED(PAGE_SIZE, $PAGE_SIZE)
+AC_DEFINE_UNQUOTED(LG_PAGE_SIZE, $LG_PAGE_SIZE)
+
+# Check the endianness
+#
+# This compiles and runs a small program that gets endian type.
+
+AC_MSG_CHECKING([endian type])
+AC_CACHE_VAL(ac_cv_sys_endian,
+[ AC_TRY_RUN([
+
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+typedef struct EpDoubleStruct {
+  union {
+    double	value;
+    struct IeeeDoubleStruct {	/* LITTLE_ENDIAN */
+      unsigned int mantissa1: 32;
+      unsigned int mantissa0: 20;
+      unsigned int exponent: 11;
+      unsigned int sign: 1;
+    } bits;
+  } type;
+  int		exponent;
+} EpDouble;
+
+main()
+{
+  EpDouble	epd;
+  FILE		*f = fopen("conftestval", "w" );
+
+  if (!f) exit(1);
+  epd.type.value = -1.0;
+  if (epd.type.bits.sign == 1 && epd.type.bits.exponent == 1023 &&
+      epd.type.bits.mantissa0 == 0 && epd.type.bits.mantissa1 == 0)
+    fprintf(f, "0\n");
+  else
+    fprintf(f, "1\n");
+  fclose(f);
+  exit(0);
+}
+], ac_cv_sys_endian=`cat conftestval`, ac_cv_sys_endian=unknown, ac_cv_sys_endian=unknown)])
+case "$ac_cv_sys_endian" in
+   0)
+     AC_MSG_RESULT(LITTLE_ENDIAN)
+     AC_DEFINE_UNQUOTED(EPD_LITTLE_ENDIAN, 1) ;;
+   1)
+     AC_MSG_RESULT(BIG_ENDIAN)
+     AC_DEFINE_UNQUOTED(EPD_BIG_ENDIAN, 1) ;;
+   *)
+     AC_MSG_RESULT(Invalid endian size $ac_cv_sys_endian -- assuming LITTLE_ENDIAN)
+     AC_DEFINE_UNQUOTED(EPD_LITTLE_ENDIAN, 1) ;;
+esac
+
+#----------------------------------------------------------------------
+# Checks for library functions.
+#----------------------------------------------------------------------
+
+# Add memcmp.o to LIBOBJS if the memcmp() function is unavailable or broken
+AC_FUNC_MEMCMP
+
+# Define RETSIGTYPE to be void or int depending on the expected return type of
+# a signal handler
+AC_TYPE_SIGNAL
+
+# Define HAVE_STRCOLL if the strcoll function exists and works
+AC_FUNC_STRCOLL
+
+# Define HAVE_VFORK_H if vfork.h is present, otherwise define "vfork" to be
+# "fork"
+AC_FUNC_VFORK
+
+# Look for these functions and define HAVE_... for each if present
+AC_CHECK_FUNCS(sysconf gethostname strcspn strerror strspn strstr getenv strchr getrlimit getrusage valloc)
+
+#----------------------------------------------------------------------
+# Create the Makefile from Makefile.in
+#----------------------------------------------------------------------
+if test "$gcc_ok" = "g++"; then
+  CC=$gcc_ok
+fi
+AC_OUTPUT(Makefile)
+
Index: /vis_dev/glu-2.1/helpers/config.guess
===================================================================
--- /vis_dev/glu-2.1/helpers/config.guess	(revision 6)
+++ /vis_dev/glu-2.1/helpers/config.guess	(revision 6)
@@ -0,0 +1,1400 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-11-30'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	rm -f $files ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;
+unset files'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	if test $UNAME_RELEASE = "V4.0"; then
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+	fi
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	eval $set_cc_for_build
+	cat <<EOF >$dummy.s
+	.data
+\$Lformat:
+	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+
+	.text
+	.globl main
+	.align 4
+	.ent main
+main:
+	.frame \$30,16,\$26,0
+	ldgp \$29,0(\$27)
+	.prologue 1
+	.long 0x47e03d80 # implver \$0
+	lda \$2,-1
+	.long 0x47e20c21 # amask \$2,\$1
+	lda \$16,\$Lformat
+	mov \$0,\$17
+	not \$1,\$18
+	jsr \$26,printf
+	ldgp \$29,0(\$26)
+	mov 0,\$16
+	jsr \$26,exit
+	.end main
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
+	if test "$?" = 0 ; then
+		case `$dummy` in
+			0-0)
+				UNAME_MACHINE="alpha"
+				;;
+			1-0)
+				UNAME_MACHINE="alphaev5"
+				;;
+			1-1)
+				UNAME_MACHINE="alphaev56"
+				;;
+			1-101)
+				UNAME_MACHINE="alphapca56"
+				;;
+			2-303)
+				UNAME_MACHINE="alphaev6"
+				;;
+			2-307)
+				UNAME_MACHINE="alphaev67"
+				;;
+			2-1307)
+				UNAME_MACHINE="alphaev68"
+				;;
+			3-1307)
+				UNAME_MACHINE="alphaev7"
+				;;
+		esac
+	fi
+	rm -f $dummy.s $dummy && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit 0 ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit 0 ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c \
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+		rm -f $dummy.c $dummy && rmdir $tmpdir
+		echo rs6000-ibm-aix3.2.5
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit 0 ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+		    rm -f $dummy.c $dummy && rmdir $tmpdir
+		fi ;;
+	esac
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit 0 ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3D:*:*:*)
+	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	exit 0 ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit 0 ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
+    x86:Interix*:3*)
+	echo i586-pc-interix3
+	exit 0 ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit 0 ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit 0 ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit 0 ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0 ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0 ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit 0 ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit 0 ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit 0 ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit 0 ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit 0 ;;
+    i*86:*:5:[78]*)
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit 0 ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit 0 ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit 0 ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit 0 ;;
+    M68*:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit 0 ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit 0 ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit 0 ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit 0 ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit 0 ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Darwin:*:*)
+	echo `uname -p`-apple-darwin${UNAME_RELEASE}
+	exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit 0 ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: /vis_dev/glu-2.1/helpers/config.sub
===================================================================
--- /vis_dev/glu-2.1/helpers/config.sub	(revision 6)
+++ /vis_dev/glu-2.1/helpers/config.sub	(revision 6)
@@ -0,0 +1,1469 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-11-30'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k \
+	| m32r | m68000 | m68k | m88k | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| ns16k | ns32k \
+	| openrisc | or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+	| clipper-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* \
+	| m32r-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39 | mipstx39el \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	or32 | or32-*)
+		basic_machine=or32-unknown
+		os=-coff
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2)
+		basic_machine=i686-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3d)
+		basic_machine=alpha-cray
+		os=-unicos
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+        tic4x | c4x*)
+		basic_machine=tic4x-unknown
+		os=-coff
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+		basic_machine=sh-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparc | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: /vis_dev/glu-2.1/helpers/dependency.make
===================================================================
--- /vis_dev/glu-2.1/helpers/dependency.make	(revision 6)
+++ /vis_dev/glu-2.1/helpers/dependency.make	(revision 6)
@@ -0,0 +1,32 @@
+# FileName	[dependency.make]
+#
+# PackageName	[vis]
+#
+# Synopsis	[Makefile to automatically create the dependency files.]
+#
+# Description	[This file is called from the main Makefile.]
+#
+# SeeAlso	[Makefile.in]
+#
+# Author	[Abelardo Pardo <abel@boulder.colorado.edu>]
+#
+# Copyright	[This file was created at the University of Colorado at Boulder.
+#  The University of Colorado at Boulder makes no warranty about the suitability
+#  of this software for any purpose.  It is presented on an AS IS basis.]
+#
+# Revision	[$Id: dependency.make,v 1.3 1998/09/18 18:30:23 hsv Exp $]
+
+include $(PKGNAME).make
+
+ifdef DEPENDENCYFILES
+$(PKGNAME).d : $(DEPENDENCYFILES) $(HEADERS) $(PKGNAME).make
+	@echo -n "Dependency file $(PKGNAME).d->"
+	@$(CC) -MM $(CFLAGS) $(AC_FLAGS) $(INCLUDEDIRS) \
+	$(filter %.c, $^) | \
+	sed 's/^[a-zA-Z0-9_]*\.o[ :]*/$(objectdir)\/&/g' > $@
+	@echo "Created."
+else
+$(PKGNAME).d :
+	@echo "No dependency files given in $(PKGNAME).make"
+	@echo "Define the variable DEPENDENCYFILES to create the dependencies"
+endif
Index: /vis_dev/glu-2.1/helpers/install-sh
===================================================================
--- /vis_dev/glu-2.1/helpers/install-sh	(revision 6)
+++ /vis_dev/glu-2.1/helpers/install-sh	(revision 6)
@@ -0,0 +1,276 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd=$cpprog
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd=$stripprog
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "$0: no input file specified" >&2
+	exit 1
+else
+	:
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+
+	if [ -d "$dst" ]; then
+		instcmd=:
+		chmodcmd=""
+	else
+		instcmd=$mkdirprog
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f "$src" ] || [ -d "$src" ]
+	then
+		:
+	else
+		echo "$0: $src does not exist" >&2
+		exit 1
+	fi
+
+	if [ x"$dst" = x ]
+	then
+		echo "$0: no destination specified" >&2
+		exit 1
+	else
+		:
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d "$dst" ]
+	then
+		dst=$dst/`basename "$src"`
+	else
+		:
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+	'
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp=$pathcomp$1
+	shift
+
+	if [ ! -d "$pathcomp" ] ;
+        then
+		$mkdirprog "$pathcomp"
+	else
+		:
+	fi
+
+	pathcomp=$pathcomp/
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd "$dst" &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ]
+	then
+		dstfile=`basename "$dst"`
+	else
+		dstfile=`basename "$dst" $transformbasename |
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ]
+	then
+		dstfile=`basename "$dst"`
+	else
+		:
+	fi
+
+# Make a couple of temp file names in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+	rmtmp=$dstdir/#rm.$$#
+
+# Trap to clean up temp files at exit.
+
+	trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+	trap '(exit $?); exit' 1 2 13 15
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd "$src" "$dsttmp" &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
+
+# Now remove or move aside any old file at destination location.  We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons.  In this case, the final cleanup
+# might fail but the new file should still install successfully.
+
+{
+	if [ -f "$dstdir/$dstfile" ]
+	then
+		$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+		$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+		{
+		  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		  (exit 1); exit
+		}
+	else
+		:
+	fi
+} &&
+
+# Now rename the file to the real destination.
+
+	$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+
+fi &&
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+
+{
+	(exit 0); exit
+}
Index: /vis_dev/glu-2.1/helpers/mkinstalldirs
===================================================================
--- /vis_dev/glu-2.1/helpers/mkinstalldirs	(revision 6)
+++ /vis_dev/glu-2.1/helpers/mkinstalldirs	(revision 6)
@@ -0,0 +1,111 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage" 1>&2
+      exit 0
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+  0) exit 0 ;;
+esac
+
+case $dirmode in
+  '')
+    if mkdir -p -- . 2>/dev/null; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    fi
+    ;;
+esac
+
+for file
+do
+  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  shift
+
+  pathcomp=
+  for d
+  do
+    pathcomp="$pathcomp$d"
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
+
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+  	errstatus=$lasterr
+      else
+  	if test ! -z "$dirmode"; then
+	  echo "chmod $dirmode $pathcomp"
+    	  lasterr=""
+  	  chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+  	  if test ! -z "$lasterr"; then
+  	    errstatus=$lasterr
+  	  fi
+  	fi
+      fi
+    fi
+
+    pathcomp="$pathcomp/"
+  done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# End:
+# mkinstalldirs ends here
Index: /vis_dev/glu-2.1/src/avl/avl.c
===================================================================
--- /vis_dev/glu-2.1/src/avl/avl.c	(revision 6)
+++ /vis_dev/glu-2.1/src/avl/avl.c	(revision 6)
@@ -0,0 +1,534 @@
+/*
+ * $Id: avl.c,v 1.11 2005/04/30 03:03:05 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+
+#include <stdio.h>
+
+#ifndef PACKAGE
+#include "util.h"
+#endif
+
+#include "avl.h"
+
+#ifdef PACKAGE
+extern char *malloc();
+#ifdef ultrix
+extern void free();
+#endif
+
+#define MAX(a,b)	((a) > (b) ? (a) : (b))
+
+#define NIL(type)		\
+    ((type *) 0)
+#define ALLOC(type, num)	\
+    ((type *) malloc(sizeof(type) * (num)))
+#define REALLOC(type, obj, num)	\
+    ((type *) realloc((char *) obj, sizeof(type) * (num)))
+#define FREE(obj)		\
+    free((char *) (obj))
+#endif
+
+
+#define HEIGHT(node) (node == NIL(avl_node) ? -1 : (node)->height)
+#define BALANCE(node) (HEIGHT((node)->right) - HEIGHT((node)->left))
+
+#define compute_height(node) {				\
+    int x=HEIGHT(node->left), y=HEIGHT(node->right);	\
+    (node)->height = MAX(x,y) + 1;			\
+}
+
+#define COMPARE(key, nodekey, compare)	 		\
+    ((compare == avl_numcmp) ? 				\
+	(long) key - (long) nodekey : 			\
+	(*compare)(key, nodekey))
+
+
+#define STACK_SIZE	50
+
+static avl_node *new_node(char *key, char *value);
+static avl_node *find_rightmost(avl_node **node_p);
+static void do_rebalance(avl_node ***stack_nodep, int stack_n); 
+static int rotate_left(avl_node **node_p);
+static int rotate_right(avl_node **node_p);
+static int do_check_tree(avl_node *node, int (*compar)(const void *, const void *), int *error);
+
+avl_tree *
+avl_init_table(int (*compar)(const void *, const void *))
+{
+    avl_tree *tree;
+
+    tree = ALLOC(avl_tree, 1);
+    tree->root = NIL(avl_node);
+    tree->compar = compar;
+    tree->num_entries = 0;
+    return tree;
+}
+
+
+int
+avl_lookup(avl_tree *tree, const void *key, void *value_p)
+{
+    avl_node *node;
+    int (*compare)(const void *, const void *) = tree->compar, diff;
+
+    node = tree->root;
+    while (node != NIL(avl_node)) {
+	diff = COMPARE(key, node->key, compare);
+	if (diff == 0) {
+	    /* got a match */
+	    if (value_p != NULL) *(char **)value_p = node->value;
+	    return 1;
+	}
+	node = (diff < 0) ? node->left : node->right;
+    }
+    return 0;
+}
+
+int
+avl_first(avl_tree *tree, char **key_p, char **value_p)
+{
+    register avl_node *node;
+
+    if (tree->root == 0) {
+	return 0;		/* no entries */
+    } else {
+	/* walk down the tree; stop at leftmost leaf */
+	for(node = tree->root; node->left != 0; node = node->left) {
+	}
+	if (key_p != NIL(char *)) *key_p = node->key;
+	if (value_p != NIL(char *)) *value_p = node->value;
+	return 1;
+    }
+}
+
+int
+avl_last(avl_tree *tree, char **key_p, char **value_p)
+{
+    register avl_node *node;
+
+    if (tree->root == 0) {
+	return 0;		/* no entries */
+    } else {
+	/* walk down the tree; stop at rightmost leaf */
+	for(node = tree->root; node->right != 0; node = node->right) {
+	}
+	if (key_p != NIL(char *)) *key_p = node->key;
+	if (value_p != NIL(char *)) *value_p = node->value;
+	return 1;
+    }
+}
+
+int
+avl_insert(avl_tree *tree, void *key, void *value)
+{
+    avl_node **node_p, *node;
+    int stack_n = 0;
+    int (*compare)(const void *, const void *) = tree->compar;
+    avl_node **stack_nodep[STACK_SIZE];
+    int diff, status;
+
+    node_p = &tree->root;
+
+    /* walk down the tree (saving the path); stop at insertion point */
+    status = 0;
+    while ((node = *node_p) != NIL(avl_node)) {
+	stack_nodep[stack_n++] = node_p;
+	diff = COMPARE(key, node->key, compare);
+	if (diff == 0) status = 1;
+	node_p = (diff < 0) ? &node->left : &node->right;
+    }
+
+    /* insert the item and re-balance the tree */
+    *node_p = new_node((char *)key, (char *)value);
+    do_rebalance(stack_nodep, stack_n);
+    tree->num_entries++;
+    tree->modified = 1;
+    return status;
+}
+
+
+int
+avl_find_or_add(avl_tree *tree, char *key, char ***slot_p)
+{
+    register avl_node **node_p, *node;
+    register int stack_n = 0;
+    register int (*compare)(const void *, const void *) = tree->compar;
+    avl_node **stack_nodep[STACK_SIZE];
+    int diff;
+
+    node_p = &tree->root;
+
+    /* walk down the tree (saving the path); stop at insertion point */
+    while ((node = *node_p) != NIL(avl_node)) {
+	stack_nodep[stack_n++] = node_p;
+	diff = COMPARE(key, node->key, compare);
+	if (diff == 0) {
+	    if (slot_p != 0) *slot_p = &node->value;
+	    return 1;		/* found */
+	}
+	node_p = (diff < 0) ? &node->left : &node->right;
+    }
+
+    /* insert the item and re-balance the tree */
+    *node_p = new_node(key, NIL(char));
+    if (slot_p != 0) *slot_p = &(*node_p)->value;
+    do_rebalance(stack_nodep, stack_n);
+    tree->num_entries++;
+    tree->modified = 1;
+    return 0;			/* not already in tree */
+}
+
+int
+avl_delete(avl_tree *tree, void *key_p, void *value_p)
+{
+    avl_node **node_p, *node, *rightmost;
+    int stack_n = 0;
+    char *key = *(char **) key_p;
+    int (*compare)(const void *, const void *) = tree->compar, diff;
+    avl_node **stack_nodep[STACK_SIZE];
+
+    node_p = &tree->root;
+
+    /* Walk down the tree saving the path; return if not found */
+    while ((node = *node_p) != NIL(avl_node)) {
+	diff = COMPARE(key, node->key, compare);
+	if (diff == 0) goto delete_item;
+	stack_nodep[stack_n++] = node_p;
+	node_p = (diff < 0) ? &node->left : &node->right;
+    }
+    return 0;		/* not found */
+
+    /* prepare to delete node and replace it with rightmost of left tree */
+delete_item:
+    *(char **) key_p = node->key;
+    if (value_p != NULL) *(char **)value_p = node->value;
+    if (node->left == NIL(avl_node)) {
+	*node_p = node->right;
+    } else {
+	rightmost = find_rightmost(&node->left);
+	rightmost->left = node->left;
+	rightmost->right = node->right;
+	rightmost->height = -2; 	/* mark bogus height for do_rebal */
+	*node_p = rightmost;
+	stack_nodep[stack_n++] = node_p;
+    }
+    FREE(node);
+
+    /* work our way back up, re-balancing the tree */
+    do_rebalance(stack_nodep, stack_n);
+    tree->num_entries--;
+    tree->modified = 1;
+    return 1;
+}
+
+static void 
+avl_record_gen_forward(avl_node *node, avl_generator *gen)
+{
+    if (node != NIL(avl_node)) {
+	avl_record_gen_forward(node->left, gen);
+	gen->nodelist[gen->count++] = node;
+	avl_record_gen_forward(node->right, gen);
+    }
+}
+
+
+static void 
+avl_record_gen_backward(avl_node *node, avl_generator *gen)
+{
+    if (node != NIL(avl_node)) {
+	avl_record_gen_backward(node->right, gen);
+	gen->nodelist[gen->count++] = node;
+	avl_record_gen_backward(node->left, gen);
+    }
+}
+
+
+avl_generator *
+avl_init_gen(avl_tree *tree, int dir)
+{
+    avl_generator *gen;
+
+    /* what a hack */
+    gen = ALLOC(avl_generator, 1);
+    gen->tree = tree;
+    gen->nodelist = ALLOC(avl_node *, avl_count(tree));
+    gen->count = 0;
+    if (dir == AVL_FORWARD) {
+	avl_record_gen_forward(tree->root, gen);
+    } else {
+	avl_record_gen_backward(tree->root, gen);
+    }
+    gen->count = 0;
+
+    /* catch any attempt to modify the tree while we generate */
+    tree->modified = 0;
+    return gen;
+}
+
+
+int
+avl_gen(avl_generator *gen, char **key_p, char **value_p)
+{
+    avl_node *node;
+
+    if (gen->count == gen->tree->num_entries) {
+	return 0;
+    } else {
+	node = gen->nodelist[gen->count++];
+	if (key_p != NIL(char *)) *key_p = node->key;
+	if (value_p != NIL(char *)) *value_p = node->value;
+	return 1;
+    }
+}
+
+
+void
+avl_free_gen(avl_generator *gen)
+{
+    FREE(gen->nodelist);
+    FREE(gen);
+}
+
+
+static avl_node *
+find_rightmost(avl_node **node_p)
+{
+    register avl_node *node;
+    register int stack_n = 0;
+    avl_node **stack_nodep[STACK_SIZE];
+
+    node = *node_p;
+    while (node->right != NIL(avl_node)) {
+	stack_nodep[stack_n++] = node_p;
+	node_p = &node->right;
+	node = *node_p;
+    }
+    *node_p = node->left;
+
+    do_rebalance(stack_nodep, stack_n);
+    return node;
+}
+
+
+static void
+do_rebalance(avl_node ***stack_nodep, int stack_n)
+{
+    register avl_node **node_p, *node;
+    register int hl, hr;
+    int height;
+
+    /* work our way back up, re-balancing the tree */
+    while (--stack_n >= 0) {
+	node_p = stack_nodep[stack_n];
+	node = *node_p;
+	hl = HEIGHT(node->left);		/* watch for NIL */
+	hr = HEIGHT(node->right);		/* watch for NIL */
+	if ((hr - hl) < -1) {
+	    rotate_right(node_p);
+	} else if ((hr - hl) > 1) {
+	    rotate_left(node_p);
+	} else {
+	    height = MAX(hl, hr) + 1;
+	    if (height == node->height) break;
+	    node->height = height;
+	}
+    }
+}
+
+static int
+rotate_left(avl_node **node_p)
+{
+    register avl_node *old_root = *node_p, *new_root, *new_right;
+
+    if (BALANCE(old_root->right) >= 0) {
+	*node_p = new_root = old_root->right;
+	old_root->right = new_root->left;
+	new_root->left = old_root;
+    } else {
+	new_right = old_root->right;
+	*node_p = new_root = new_right->left;
+	old_root->right = new_root->left;
+	new_right->left = new_root->right;
+	new_root->right = new_right;
+	new_root->left = old_root;
+	compute_height(new_right);
+    }
+    compute_height(old_root);
+    compute_height(new_root);
+
+    return 0;
+}
+
+
+static int
+rotate_right(avl_node **node_p)
+{
+    register avl_node *old_root = *node_p, *new_root, *new_left;
+
+    if (BALANCE(old_root->left) <= 0) {
+	*node_p = new_root = old_root->left;
+	old_root->left = new_root->right;
+	new_root->right = old_root;
+    } else {
+	new_left = old_root->left;
+	*node_p = new_root = new_left->right;
+	old_root->left = new_root->right;
+	new_left->right = new_root->left;
+	new_root->left = new_left;
+	new_root->right = old_root;
+	compute_height(new_left);
+    }
+    compute_height(old_root);
+    compute_height(new_root);
+
+    return 0;
+}
+
+static void 
+avl_walk_forward(avl_node *node, void (*func)(const void *, const void *))
+{
+    if (node != NIL(avl_node)) {
+	avl_walk_forward(node->left, func);
+	(*func)(node->key, node->value);
+	avl_walk_forward(node->right, func);
+    }
+}
+
+
+static void 
+avl_walk_backward(avl_node *node, void (*func)(const void *, const void *))
+{
+    if (node != NIL(avl_node)) {
+	avl_walk_backward(node->right, func);
+	(*func)(node->key, node->value);
+	avl_walk_backward(node->left, func);
+    }
+}
+
+
+void
+avl_foreach(
+  avl_tree *tree,
+  void (*func)(const void *, const void *),
+  int direction)
+{
+    if (direction == AVL_FORWARD) {
+	avl_walk_forward(tree->root, func);
+    } else {
+	avl_walk_backward(tree->root, func);
+    }
+}
+
+
+static void
+free_entry(
+  avl_node *node,
+  void (*key_free)(char *),
+  void (*value_free)(char *))
+{
+    if (node != NIL(avl_node)) {
+	free_entry(node->left, key_free, value_free);
+	free_entry(node->right, key_free, value_free);
+	if (key_free != 0) (*key_free)(node->key);
+	if (value_free != 0) (*value_free)(node->value);
+	FREE(node);
+    }
+}
+   
+
+void 
+avl_free_table(
+  avl_tree *tree,
+  void (*key_free)(char *),
+  void (*value_free)(char *))
+{
+    free_entry(tree->root, key_free, value_free);
+    FREE(tree);
+}
+
+
+int 
+avl_count(avl_tree *tree)
+{
+    return tree->num_entries;
+}
+
+
+static avl_node *
+new_node(char *key, char *value)
+{
+    register avl_node *newn;
+
+    newn = ALLOC(avl_node, 1);
+    newn->key = key;
+    newn->value = value;
+    newn->height = 0;
+    newn->left = newn->right = NIL(avl_node);
+    return newn;
+}
+
+
+int 
+avl_numcmp(const void *x, const void *y)
+{
+    return (long) x - (long) y;
+}
+
+int
+avl_check_tree(avl_tree *tree)
+{
+    int error = 0;
+    (void) do_check_tree(tree->root, tree->compar, &error);
+    return error;
+}
+
+
+static int
+do_check_tree(
+  avl_node *node,
+  int (*compar)(const void *, const void *),
+  int *error)
+{
+    int l_height, r_height, comp_height, bal;
+    
+    if (node == NIL(avl_node)) {
+	return -1;
+    }
+
+    r_height = do_check_tree(node->right, compar, error);
+    l_height = do_check_tree(node->left, compar, error);
+
+    comp_height = MAX(l_height, r_height) + 1;
+    bal = r_height - l_height;
+    
+    if (comp_height != node->height) {
+	(void) printf("Bad height for 0x%p: computed=%d stored=%d\n",
+	    (void *) node, comp_height, node->height);
+	++*error;
+    }
+
+    if (bal > 1 || bal < -1) {
+	(void) printf("Out of balance at node 0x%p, balance = %d\n", 
+	    (void *) node, bal);
+	++*error;
+    }
+
+    if (node->left != NIL(avl_node) && 
+		    (*compar)(node->left->key, node->key) > 0) {
+	(void) printf("Bad ordering between 0x%p and 0x%p", 
+	    (void *) node, (void *) node->left);
+	++*error;
+    }
+    
+    if (node->right != NIL(avl_node) && 
+		    (*compar)(node->key, node->right->key) > 0) {
+	(void) printf("Bad ordering between 0x%p and 0x%p", 
+	    (void *) node, (void *) node->right);
+	++*error;
+    }
+
+    return comp_height;
+}
Index: /vis_dev/glu-2.1/src/avl/avl.h
===================================================================
--- /vis_dev/glu-2.1/src/avl/avl.h	(revision 6)
+++ /vis_dev/glu-2.1/src/avl/avl.h	(revision 6)
@@ -0,0 +1,66 @@
+/*
+ * Revision Control Information
+ *
+ * /projects/hsis/CVS/utilities/avl/avl.h,v
+ * rajeev
+ * 1.3
+ * 1995/08/08 22:36:24
+ *
+ */
+#ifndef AVL_INCLUDED
+#define AVL_INCLUDED
+
+
+typedef struct avl_node_struct avl_node;
+struct avl_node_struct {
+    avl_node *left, *right;
+    char *key;
+    char *value;
+    int height;
+};
+
+
+typedef struct avl_tree_struct avl_tree;
+struct avl_tree_struct {
+    avl_node *root;
+    int (*compar)(const void *, const void *);
+    int num_entries;
+    int modified;
+};
+
+
+typedef struct avl_generator_struct avl_generator;
+struct avl_generator_struct {
+    avl_tree *tree;
+    avl_node **nodelist;
+    int count;
+};
+
+
+#define AVL_FORWARD 	0
+#define AVL_BACKWARD 	1
+
+
+EXTERN avl_tree *avl_init_table ARGS((int (*)(const void *, const void *)));
+EXTERN int avl_delete ARGS((avl_tree *, void *, void *));
+EXTERN int avl_insert ARGS((avl_tree *, void *, void *));
+EXTERN int avl_lookup ARGS((avl_tree *, const void *, void *));
+EXTERN int avl_first ARGS((avl_tree *, char **, char **));
+EXTERN int avl_last ARGS((avl_tree *, char **, char **));
+EXTERN int avl_find_or_add ARGS((avl_tree *, char *, char ***));
+EXTERN int avl_count ARGS((avl_tree *));
+EXTERN int avl_numcmp ARGS((const void *, const void *));
+EXTERN int avl_check_tree ARGS((avl_tree *tree));
+EXTERN int avl_gen ARGS((avl_generator *, char **, char **));
+EXTERN void avl_foreach ARGS((avl_tree *, void (*)(const void *, const void *), int));
+EXTERN void avl_free_table ARGS((avl_tree *, void (*)(char *), void (*)(char *)));
+EXTERN void avl_free_gen ARGS((avl_generator *));
+EXTERN avl_generator *avl_init_gen ARGS((avl_tree *, int));
+
+#define avl_is_member(tree, key)	avl_lookup(tree, key, (char **) 0)
+
+#define avl_foreach_item(table, gen, dir, key_p, value_p) 	\
+    for(gen = avl_init_gen(table, dir); 			\
+	    avl_gen(gen, key_p, value_p) || (avl_free_gen(gen),0);)
+
+#endif
Index: /vis_dev/glu-2.1/src/avl/avl.make
===================================================================
--- /vis_dev/glu-2.1/src/avl/avl.make	(revision 6)
+++ /vis_dev/glu-2.1/src/avl/avl.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += avl.c
+HEADERS += avl.h
+MISC += avl.doc avl_bench1.c
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/avl/avl_bench1.c
===================================================================
--- /vis_dev/glu-2.1/src/avl/avl_bench1.c	(revision 6)
+++ /vis_dev/glu-2.1/src/avl/avl_bench1.c	(revision 6)
@@ -0,0 +1,72 @@
+/*
+ * Revision Control Information
+ *
+ * /projects/hsis/CVS/utilities/avl/avl_bench1.c,v
+ * rajeev
+ * 1.3
+ * 1995/08/08 22:36:26
+ *
+ */
+#include <stdio.h>
+#include "array.h"
+#include "avl.h"
+#include "util.h"
+
+#define MAX_WORD	1024
+
+extern long random();
+
+/* ARGSUSED */
+main(argc, argv)
+char *argv;
+{
+    array_t *words;
+    avl_tree *table;
+    char word[MAX_WORD], *tempi, *tempj;
+    register int i, j;
+    long time;
+#ifdef TEST
+    avl_generator *gen;
+    char *key;
+#endif
+
+    /* read the words */
+    words = array_alloc(char *, 1000);
+    while (gets(word) != NIL(char)) {
+	array_insert_last(char *, words, util_strsav(word));
+	if (array_n(words) == 100000) break;
+    }
+
+    /* scramble them */
+    for(i = array_n(words)-1; i >= 1; i--) {
+	j = random() % i;
+	tempi = array_fetch(char *, words, i);
+	tempj = array_fetch(char *, words, j);
+	array_insert(char *, words, i, tempj);
+	array_insert(char *, words, j, tempi);
+    }
+
+#ifdef TEST
+    (void) printf("Initial data is\n");
+    for(i = array_n(words)-1; i >= 0; i--) {
+	(void) printf("%s\n", array_fetch(char *, words, i));
+    }
+#endif
+
+    /* time putting them into an avl tree */
+    time = util_cpu_time();
+    table = avl_init_table(strcmp);
+    for(i = array_n(words)-1; i >= 0; i--) {
+	(void) avl_insert(table, array_fetch(char *, words, i), NIL(char));
+    }
+    (void) printf("Elapsed time for insert of %d objects was %s\n",
+	array_n(words), util_print_time(util_cpu_time() - time));
+
+#ifdef TEST
+    (void) printf("Sorted data is\n");
+    avl_foreach_item(table, gen, AVL_FORWARD, &key, NIL(char *)) {
+	(void) printf("%s\n", key);
+    }
+#endif
+    return 0;
+}
Index: /vis_dev/glu-2.1/src/bdd/bdd.h
===================================================================
--- /vis_dev/glu-2.1/src/bdd/bdd.h	(revision 6)
+++ /vis_dev/glu-2.1/src/bdd/bdd.h	(revision 6)
@@ -0,0 +1,546 @@
+/******************************************************************************
+
+  PackageName [bdd]
+
+  Synopsis    [Package-independent BDD interface functions.]
+
+  Description []
+
+  SeeAlso     []
+
+  Author      [Thomas R. Shiple. Modified by Rajeev K. Ranjan.]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: bdd.h,v 1.78 2004/02/06 22:21:55 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _BDD_H
+#define _BDD_H
+#include "util.h"  
+#include "array.h"
+#include "st.h"
+#include "var_set.h"
+#include "avl.h"
+#ifndef	EPD_MAX_BIN
+#include "epd.h"
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef int boolean;
+typedef void bdd_manager;
+typedef unsigned int bdd_variableId; /* the id of the variable in a bdd node */
+typedef void bdd_mgr_init; /* Typecasting to void to avoid error messages */
+typedef int bdd_literal;	        /* integers in the set { 0, 1, 2 } */
+typedef struct bdd_t bdd_t;
+typedef void bdd_node;
+typedef void bdd_gen;
+typedef struct bdd_external_hooks_struct bdd_external_hooks;
+typedef void bdd_block;
+typedef double BDD_VALUE_TYPE;
+
+/*---------------------------------------------------------------------------*/
+/* Enumerated type declarations                                              */
+/*---------------------------------------------------------------------------*/
+
+/*
+ * Dynamic reordering.
+ */
+typedef enum {
+  BDD_REORDER_SIFT,
+  BDD_REORDER_WINDOW,
+  BDD_REORDER_SAME,
+  BDD_REORDER_RANDOM,
+  BDD_REORDER_RANDOM_PIVOT,
+  BDD_REORDER_SIFT_CONVERGE,
+  BDD_REORDER_SYMM_SIFT,
+  BDD_REORDER_SYMM_SIFT_CONV,
+  BDD_REORDER_LINEAR,
+  BDD_REORDER_LINEAR_CONVERGE,
+  BDD_REORDER_EXACT,
+  BDD_REORDER_WINDOW2,
+  BDD_REORDER_WINDOW3,
+  BDD_REORDER_WINDOW4,
+  BDD_REORDER_WINDOW2_CONV,
+  BDD_REORDER_WINDOW3_CONV,
+  BDD_REORDER_WINDOW4_CONV,
+  BDD_REORDER_GROUP_SIFT,
+  BDD_REORDER_GROUP_SIFT_CONV,
+  BDD_REORDER_ANNEALING,
+  BDD_REORDER_GENETIC,
+  BDD_REORDER_LAZY_SIFT,
+  BDD_REORDER_NONE
+} bdd_reorder_type_t;
+
+typedef enum {
+  CMU,
+  CAL,
+  CUDD
+} bdd_package_type_t;
+
+typedef enum {
+    bdd_EMPTY,
+    bdd_NONEMPTY
+} bdd_gen_status;
+
+typedef enum {
+    BDD_PRE_GC_HOOK,
+    BDD_POST_GC_HOOK,
+    BDD_PRE_REORDERING_HOOK,
+    BDD_POST_REORDERING_HOOK
+} bdd_hook_type_t;
+
+typedef enum {
+    BDD_OVER_APPROX,
+    BDD_UNDER_APPROX
+} bdd_approx_dir_t;
+
+typedef enum {
+    BDD_CONJUNCTS,
+    BDD_DISJUNCTS
+} bdd_partition_type_t;
+
+typedef enum {
+  BDD_REORDER_VERBOSITY_DEFAULT,
+  BDD_REORDER_NO_VERBOSITY,
+  BDD_REORDER_VERBOSITY
+}bdd_reorder_verbosity_t;
+
+typedef enum {
+  BDD_APPROX_HB,
+  BDD_APPROX_SP,
+  BDD_APPROX_COMP,
+  BDD_APPROX_UA,
+  BDD_APPROX_RUA,
+  BDD_APPROX_BIASED_RUA
+} bdd_approx_type_t;
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+struct bdd_external_hooks_struct {
+    char *network;
+    char *mdd;
+    char *undef1;
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+/*
+** It is assumed that dynamic reordering will not occur while there are open
+** generators.  It is the user's responsibility to make sure dynamic
+** reordering doesn't occur. As long as new nodes are not created during
+** generation, and you don't explicitly call dynamic reordering, you should be
+** okay. 
+*/
+
+/*
+ *    foreach_bdd_cube(fn, gen, cube)
+ *    bdd_t *fn;
+ *    bdd_gen *gen;
+ *    array_t *cube;	- return
+ *
+ *    foreach_bdd_cube(fn, gen, cube) {
+ *        ...
+ *    }
+ */
+#define foreach_bdd_cube(fn, gen, cube)\
+  for((gen) = bdd_first_cube(fn, &cube);\
+      (bdd_gen_read_status(gen) != bdd_EMPTY) ? TRUE: bdd_gen_free(gen);\
+      (void) bdd_next_cube(gen, &cube))
+
+/*
+ *    foreach_bdd_disjoint_cube(fn, gen, cube)
+ *    bdd_t *fn;
+ *    bdd_gen *gen;
+ *    array_t *cube;	- return
+ *
+ *    foreach_bdd_disjoint_cube(fn, gen, cube) {
+ *        ...
+ *    }
+ */
+#define foreach_bdd_disjoint_cube(fn, gen, cube)\
+  for((gen) = bdd_first_disjoint_cube(fn, &cube);\
+      (bdd_gen_read_status(gen) != bdd_EMPTY) ? TRUE: bdd_gen_free(gen);\
+      (void) bdd_next_disjoint_cube(gen, &cube))
+
+/*
+ *    foreach_bdd_node(fn, gen, node)
+ *    bdd_t *fn;
+ *    bdd_gen *gen;
+ *    bdd_node *node;	- return
+ */
+#define foreach_bdd_node(fn, gen, node)\
+  for((gen) = bdd_first_node(fn, &node);\
+      (bdd_gen_read_status(gen) != bdd_EMPTY) ? TRUE: bdd_gen_free(gen);\
+      (void) bdd_next_node(gen, &node))
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+EXTERN bdd_package_type_t bdd_get_package_name ARGS((void));
+
+/*
+ * BDD Manager Allocation And Destruction
+ */
+EXTERN bdd_manager *bdd_start ARGS((int));
+EXTERN void bdd_end ARGS((bdd_manager *));
+
+/*
+ * BDD variable management
+ */
+EXTERN bdd_t *bdd_create_variable ARGS((bdd_manager *));		
+EXTERN bdd_t *bdd_create_variable_after ARGS((bdd_manager *, bdd_variableId));
+EXTERN bdd_t *bdd_get_variable ARGS((bdd_manager *, bdd_variableId));	
+EXTERN bdd_t *bdd_create_variable_after ARGS((bdd_manager *, bdd_variableId));
+EXTERN bdd_t * bdd_var_with_index ARGS((bdd_manager *manager, int index));
+EXTERN bdd_node *bdd_add_ith_var ARGS((bdd_manager *mgr, int i));
+
+
+/*
+ * BDD Formula Management
+ */
+EXTERN bdd_t *bdd_dup ARGS((bdd_t *));
+EXTERN void bdd_free ARGS((bdd_t *));
+
+/* 
+ * Operations on BDD Formulas
+ */
+EXTERN bdd_t *bdd_and ARGS((bdd_t *, bdd_t *, boolean, boolean));
+EXTERN bdd_t *bdd_and_with_limit ARGS((bdd_t *, bdd_t *, boolean, boolean, unsigned int));
+EXTERN bdd_t *bdd_and_array ARGS((bdd_t *, array_t *, boolean, boolean));
+EXTERN bdd_t *bdd_and_smooth ARGS((bdd_t *, bdd_t *, array_t *));
+EXTERN bdd_t *bdd_and_smooth_with_limit ARGS((bdd_t *, bdd_t *, array_t *, unsigned int));
+EXTERN bdd_t *bdd_and_smooth_with_cube ARGS((bdd_t *, bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_clipping_and_smooth ARGS((bdd_t *, bdd_t *, array_t *, int , int ));
+EXTERN bdd_t *bdd_xor_smooth ARGS((bdd_t *, bdd_t *, array_t *));
+EXTERN bdd_t *bdd_between ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_cofactor ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_cofactor_array ARGS((bdd_t *, array_t *));
+EXTERN bdd_t *bdd_var_cofactor ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_compose ARGS((bdd_t *, bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_vector_compose ARGS((bdd_t *, array_t *, array_t *));
+EXTERN bdd_t *bdd_consensus ARGS((bdd_t *, array_t *));
+EXTERN bdd_t *bdd_consensus_with_cube ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_cproject ARGS((bdd_t *, array_t *));
+EXTERN bdd_t *bdd_else ARGS((bdd_t *));
+EXTERN bdd_t *bdd_ite ARGS((bdd_t *, bdd_t *, bdd_t *, boolean, boolean, boolean));
+EXTERN bdd_t *bdd_minimize ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_minimize_array ARGS((bdd_t *, array_t *));
+EXTERN bdd_t *bdd_compact ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_squeeze ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_not ARGS((bdd_t *));
+EXTERN bdd_t *bdd_one ARGS((bdd_manager *));
+EXTERN bdd_t *bdd_or ARGS((bdd_t *, bdd_t *, boolean, boolean));
+EXTERN bdd_t *bdd_smooth ARGS((bdd_t *, array_t *));
+EXTERN bdd_t *bdd_smooth_with_cube ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_substitute ARGS((bdd_t *, array_t *, array_t *));
+EXTERN bdd_t *bdd_substitute_with_permut ARGS((bdd_t *, int *));
+EXTERN array_t *bdd_substitute_array ARGS((array_t *, array_t *, array_t *));
+EXTERN array_t *bdd_substitute_array_with_permut ARGS((array_t *, int *));
+EXTERN void *bdd_pointer ARGS((bdd_t *));
+EXTERN bdd_t *bdd_then ARGS((bdd_t *));
+EXTERN bdd_t *bdd_top_var ARGS((bdd_t *));
+EXTERN bdd_t *bdd_xnor ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_xor ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_zero ARGS((bdd_manager *));
+EXTERN bdd_t *bdd_multiway_and ARGS((bdd_manager *, array_t *));
+EXTERN bdd_t *bdd_multiway_or ARGS((bdd_manager *, array_t *));
+EXTERN bdd_t *bdd_multiway_xor ARGS((bdd_manager *, array_t *));
+EXTERN array_t * bdd_pairwise_or ARGS((bdd_manager *manager, array_t *bddArray1, array_t *bddArray2));
+EXTERN array_t * bdd_pairwise_and ARGS((bdd_manager *manager, array_t *bddArray1, array_t *bddArray2));
+EXTERN array_t * bdd_pairwise_xor ARGS((bdd_manager *manager, array_t *bddArray1, array_t *bddArray2));
+EXTERN bdd_t *bdd_approx_hb ARGS((bdd_t *, bdd_approx_dir_t , int , int ));
+EXTERN bdd_t *bdd_approx_sp ARGS((bdd_t *, bdd_approx_dir_t , int , int , int ));
+EXTERN bdd_t *bdd_approx_ua ARGS((bdd_t *, bdd_approx_dir_t , int , int , int , double ));
+EXTERN bdd_t *bdd_approx_remap_ua ARGS((bdd_t *, bdd_approx_dir_t , int , int , double ));
+EXTERN bdd_t *bdd_approx_biased_rua ARGS((bdd_t *, bdd_approx_dir_t , bdd_t *, int , int , double, double ));
+EXTERN bdd_t *bdd_approx_compress ARGS((bdd_t *, bdd_approx_dir_t , int , int ));
+EXTERN int bdd_var_decomp ARGS((bdd_t *, bdd_partition_type_t , bdd_t ***));
+EXTERN int bdd_gen_decomp ARGS((bdd_t *, bdd_partition_type_t , bdd_t ***));
+EXTERN int bdd_approx_decomp ARGS((bdd_t *, bdd_partition_type_t , bdd_t ***));
+EXTERN int bdd_iter_decomp ARGS((bdd_t *, bdd_partition_type_t , bdd_t ***));
+EXTERN bdd_t *bdd_shortest_path ARGS((bdd_t *f, int *weight, int *support, int *length));
+
+EXTERN bdd_t *bdd_compute_cube ARGS((bdd_manager *mgr, array_t *vars));
+EXTERN bdd_t *bdd_compute_cube_with_phase ARGS((bdd_manager *mgr, array_t *vars, array_t *phase));
+EXTERN bdd_node *bdd_add_compose ARGS((bdd_manager *mgr, bdd_node *fn1, bdd_node *fn2, int var));
+EXTERN bdd_node *bdd_add_xnor ARGS((bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2 ));
+EXTERN bdd_node *bdd_add_times ARGS((bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2));
+EXTERN bdd_node *bdd_add_vector_compose ARGS((bdd_manager *mgr, bdd_node *fn, bdd_node **vector));
+EXTERN bdd_node *bdd_add_residue ARGS((bdd_manager *mgr, int n, int m, int options, int top));
+EXTERN bdd_node *bdd_add_nonsim_compose ARGS((bdd_manager *mgr, bdd_node *fn, bdd_node **vector));
+EXTERN bdd_node *bdd_add_apply ARGS((bdd_manager *mgr, bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **), bdd_node *fn1, bdd_node *fn2));
+EXTERN bdd_node *bdd_add_exist_abstract ARGS((bdd_manager *mgr, bdd_node *fn, bdd_node *vars));
+EXTERN void bdd_recursive_deref ARGS((bdd_manager *mgr, bdd_node *f));
+EXTERN void bdd_ref ARGS((bdd_node *fn));
+EXTERN bdd_node *bdd_bdd_to_add ARGS((bdd_manager *mgr, bdd_node *fn));
+EXTERN bdd_node *bdd_add_permute ARGS((bdd_manager *mgr, bdd_node *fn, int *permut));
+EXTERN bdd_node *bdd_bdd_permute ARGS((bdd_manager *mgr, bdd_node *fn, int *permut));
+EXTERN bdd_node * bdd_bdd_exist_abstract ARGS((bdd_manager *mgr, bdd_node *fn, bdd_node *cube));
+/* Added by Balakrishna Kumthekar. There are potential duplicates. */
+
+EXTERN int  bdd_equal_sup_norm  ARGS((bdd_manager *mgr, bdd_node *fn, bdd_node *gn, BDD_VALUE_TYPE tolerance, int pr));
+EXTERN bdd_node * bdd_read_logic_zero ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_bdd_ith_var ARGS((bdd_manager *mgr, int i));
+EXTERN bdd_node * bdd_add_divide ARGS((bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2));
+EXTERN bdd_node * bdd_bdd_constrain ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *c));
+EXTERN bdd_node * bdd_bdd_restrict ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *c));
+EXTERN bdd_node * bdd_add_hamming ARGS((bdd_manager *mgr, bdd_node **xVars, bdd_node **yVars, int nVars));
+EXTERN bdd_node * bdd_add_ite ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g, bdd_node *h));
+EXTERN bdd_node * bdd_add_find_max ARGS((bdd_manager *mgr, bdd_node *f));
+EXTERN int bdd_bdd_pick_one_cube ARGS((bdd_manager *mgr, bdd_node *node, char *string));
+EXTERN bdd_node * bdd_add_swap_variables ARGS((bdd_manager *mgr, bdd_node *f, bdd_node **x, bdd_node **y, int n));
+EXTERN bdd_node * bdd_bdd_or ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_bdd_compute_cube ARGS((bdd_manager *mgr, bdd_node **vars, int *phase, int n));
+EXTERN bdd_node * bdd_indices_to_cube ARGS((bdd_manager *mgr, int *idArray, int n));
+EXTERN bdd_node * bdd_bdd_and ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_add_matrix_multiply ARGS((bdd_manager *mgr, bdd_node *A, bdd_node *B, bdd_node **z, int nz));
+EXTERN bdd_node * bdd_add_compute_cube ARGS((bdd_manager *mgr, bdd_node **vars, int *phase, int n));
+EXTERN bdd_node * bdd_add_const ARGS((bdd_manager *mgr, BDD_VALUE_TYPE c));
+EXTERN bdd_node * bdd_bdd_swap_variables ARGS((bdd_manager *mgr, bdd_node *f, bdd_node **x, bdd_node **y, int n));
+EXTERN double bdd_count_minterm ARGS((bdd_manager *mgr, bdd_node *f, int n));
+EXTERN bdd_node * bdd_add_bdd_threshold ARGS((bdd_manager *mgr, bdd_node *f, BDD_VALUE_TYPE value));
+EXTERN bdd_node * bdd_add_bdd_strict_threshold ARGS((bdd_manager *mgr,bdd_node *f,BDD_VALUE_TYPE value));
+EXTERN BDD_VALUE_TYPE bdd_read_epsilon ARGS((bdd_manager *mgr)); 
+EXTERN bdd_node * bdd_read_one ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_bdd_pick_one_minterm ARGS((bdd_manager *mgr, bdd_node *f, bdd_node **vars, int n));
+EXTERN bdd_t * bdd_pick_one_minterm ARGS((bdd_t *f, array_t *varsArray));
+EXTERN array_t * bdd_bdd_pick_arbitrary_minterms ARGS((bdd_t *f, array_t *varsArray, int n, int k));
+EXTERN bdd_t * bdd_subset_with_mask_vars ARGS((bdd_t *f, array_t *varsArray, array_t *maskVarsArray));
+EXTERN bdd_node * bdd_read_zero ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_bdd_new_var ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_bdd_and_abstract ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g, bdd_node *cube));
+
+EXTERN int bdd_test_unate ARGS((bdd_t *f, int varId, int phase));
+EXTERN array_t * bdd_find_essential ARGS((bdd_t *));
+EXTERN bdd_t * bdd_find_essential_cube ARGS((bdd_t *));
+EXTERN void bdd_deref ARGS((bdd_node *f));
+EXTERN bdd_node * bdd_add_plus ARGS((bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2));
+EXTERN int bdd_read_reorderings ARGS((bdd_manager *mgr));
+EXTERN int bdd_read_next_reordering ARGS((bdd_manager *mgr));
+EXTERN void bdd_set_next_reordering ARGS((bdd_manager *mgr, int next));
+EXTERN bdd_node * bdd_bdd_xnor ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_bdd_xor ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_bdd_vector_compose ARGS((bdd_manager *mgr, bdd_node *f, bdd_node **vector));
+
+EXTERN bdd_node * bdd_zdd_get_node ARGS((bdd_manager *mgr, int id, bdd_node *g, bdd_node *h));
+EXTERN bdd_node * bdd_zdd_product ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_product_recur ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_union ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_union_recur ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_weak_div ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_weak_div_recur ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_isop_recur ARGS((bdd_manager *mgr, bdd_node *L, bdd_node *U, bdd_node **zdd_I));
+EXTERN bdd_node * bdd_zdd_isop ARGS((bdd_manager *mgr, bdd_node *L, bdd_node *U, bdd_node **zdd_I));
+EXTERN int bdd_zdd_get_cofactors3 ARGS((bdd_manager *mgr, bdd_node *f, int v, bdd_node **f1, bdd_node **f0, bdd_node **fd));
+EXTERN bdd_node * bdd_bdd_and_recur ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_unique_inter ARGS((bdd_manager *mgr, int v, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_unique_inter_ivo ARGS((bdd_manager *mgr, int v, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_diff ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_zdd_diff_recur ARGS((bdd_manager *mgr, bdd_node *f, bdd_node *g));
+EXTERN int bdd_num_zdd_vars ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_regular ARGS((bdd_node *f));
+EXTERN int bdd_is_constant ARGS((bdd_node *f));
+EXTERN int bdd_is_complement ARGS((bdd_node *f));
+EXTERN bdd_node * bdd_bdd_T ARGS((bdd_node *f));
+EXTERN bdd_node * bdd_bdd_E ARGS((bdd_node *f));
+EXTERN bdd_node * bdd_not_bdd_node ARGS((bdd_node *f));
+EXTERN void bdd_recursive_deref_zdd ARGS((bdd_manager *mgr, bdd_node *f));
+EXTERN int bdd_zdd_count ARGS((bdd_manager *mgr, bdd_node *f));
+EXTERN int bdd_read_zdd_level ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_zdd_vars_from_bdd_vars ARGS((bdd_manager *mgr, int multiplicity));
+EXTERN void bdd_zdd_realign_enable ARGS((bdd_manager *mgr));
+EXTERN void bdd_zdd_realign_disable ARGS((bdd_manager *mgr));
+EXTERN int bdd_zdd_realignment_enabled ARGS((bdd_manager *mgr));
+EXTERN void bdd_realign_enable ARGS((bdd_manager *mgr));
+EXTERN void bdd_realign_disable ARGS((bdd_manager *mgr));
+EXTERN int bdd_realignment_enabled ARGS((bdd_manager *mgr));
+EXTERN int bdd_node_read_index ARGS((bdd_node *f));
+EXTERN bdd_node * bdd_read_next ARGS((bdd_node *f));
+/* This function should not be used by an external user. This will not be a
+ * part of any future releases.
+ */
+EXTERN void bdd_set_next ARGS((bdd_node *f, bdd_node *g));
+EXTERN bdd_node * bdd_add_apply_recur ARGS((bdd_manager *mgr, bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **), bdd_node *fn1, bdd_node *fn2));
+EXTERN BDD_VALUE_TYPE bdd_add_value ARGS((bdd_node *f));
+
+EXTERN bdd_node * bdd_read_plus_infinity ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_priority_select ARGS((bdd_manager *mgr,bdd_node *R,bdd_node **x,bdd_node **y,bdd_node **z,bdd_node *Pi,int n, bdd_node *(*Pifunc)(bdd_manager *, int, bdd_node **, bdd_node **, bdd_node **)));
+EXTERN void bdd_set_background ARGS((bdd_manager *mgr,bdd_node *f));
+EXTERN bdd_node * bdd_read_background ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_bdd_cofactor ARGS((bdd_manager *mgr,bdd_node *f,bdd_node *g));
+EXTERN bdd_node * bdd_bdd_ite ARGS((bdd_manager *mgr,bdd_node *f,bdd_node *g,bdd_node *h));
+EXTERN bdd_node * bdd_add_minus ARGS((bdd_manager *mgr,bdd_node **fn1,bdd_node **fn2));
+EXTERN bdd_node * bdd_dxygtdxz ARGS((bdd_manager *mgr,int N,bdd_node **x, bdd_node **y, bdd_node **z));
+EXTERN bdd_node * bdd_bdd_univ_abstract ARGS((bdd_manager *mgr,bdd_node *fn,bdd_node *vars));
+EXTERN bdd_node * bdd_bdd_cprojection ARGS((bdd_manager *mgr,bdd_node *R,bdd_node *Y));
+EXTERN double *bdd_cof_minterm ARGS((bdd_t *));
+EXTERN int bdd_var_is_dependent ARGS((bdd_t *, bdd_t *));
+EXTERN int bdd_debug_check ARGS((bdd_manager *mgr));
+EXTERN bdd_node * bdd_xeqy ARGS((bdd_manager *mgr, int N, bdd_node **x, bdd_node **y));
+EXTERN bdd_node * bdd_add_roundoff ARGS((bdd_manager *mgr, bdd_node *f, int N));
+EXTERN bdd_node * bdd_xgty ARGS((bdd_manager *mgr, int N, bdd_node **x, bdd_node **y));
+EXTERN bdd_node * bdd_add_cmpl ARGS((bdd_manager *mgr, bdd_node *f));
+EXTERN bdd_node * bdd_split_set ARGS((bdd_manager *mgr, bdd_node *f, bdd_node ** x, int n, double m));
+
+/*
+ * Queries about BDD Formulas
+ */
+EXTERN boolean bdd_equal ARGS((bdd_t *, bdd_t *));
+EXTERN boolean bdd_equal_mod_care_set ARGS((bdd_t *, bdd_t *, bdd_t *));
+EXTERN boolean bdd_equal_mod_care_set_array ARGS((bdd_t *, bdd_t *, array_t *));
+EXTERN bdd_t *bdd_intersects ARGS((bdd_t *, bdd_t *));
+EXTERN bdd_t *bdd_closest_cube ARGS((bdd_t *, bdd_t *, int *));
+EXTERN boolean bdd_is_tautology ARGS((bdd_t *, boolean));
+EXTERN boolean bdd_leq ARGS((bdd_t *, bdd_t *, boolean, boolean));
+EXTERN boolean bdd_lequal_mod_care_set ARGS((bdd_t *, bdd_t *, boolean, boolean, bdd_t *));
+EXTERN boolean bdd_lequal_mod_care_set_array ARGS((bdd_t *, bdd_t *, boolean, boolean, array_t *));
+EXTERN boolean bdd_leq_array ARGS((bdd_t *, array_t *, boolean, boolean));
+EXTERN double bdd_count_onset ARGS((bdd_t *, array_t *));
+EXTERN int bdd_epd_count_onset ARGS((bdd_t *, array_t *, EpDouble *epd));
+EXTERN int bdd_print_apa_minterm ARGS((FILE *, bdd_t *, int, int));
+EXTERN int bdd_apa_compare_ratios ARGS((int, bdd_t *, bdd_t *, int, int));
+
+EXTERN double bdd_correlation ARGS((bdd_t *, bdd_t *));
+EXTERN int bdd_get_free ARGS((bdd_t *));
+EXTERN bdd_manager *bdd_get_manager ARGS((bdd_t *));
+EXTERN bdd_node *bdd_get_node ARGS((bdd_t *, boolean *));
+EXTERN bdd_node *bdd_extract_node_as_is ARGS((bdd_t *));
+EXTERN var_set_t *bdd_get_support ARGS((bdd_t *));
+EXTERN int bdd_is_support_var ARGS((bdd_t *, bdd_t *));
+EXTERN int bdd_is_support_var_id ARGS((bdd_t *, int));
+EXTERN array_t *bdd_get_varids ARGS((array_t *));
+EXTERN unsigned int bdd_num_vars ARGS((bdd_manager *));
+EXTERN int bdd_read_node_count ARGS((bdd_manager *mgr));
+EXTERN void bdd_print ARGS((bdd_t *));
+EXTERN int bdd_print_minterm ARGS((bdd_t *));
+EXTERN void bdd_print_stats ARGS((bdd_manager *, FILE *));
+EXTERN int bdd_set_parameters ARGS((bdd_manager *, avl_tree *valueTable, FILE *));
+EXTERN int bdd_size ARGS((bdd_t *));
+EXTERN int bdd_node_size ARGS((bdd_node *));
+EXTERN long bdd_size_multiple ARGS((array_t *));
+EXTERN boolean bdd_is_cube ARGS((bdd_t*));
+EXTERN bdd_block * bdd_new_var_block(bdd_t *f, long length);
+EXTERN long bdd_top_var_level ARGS((bdd_manager *manager, bdd_t *fn));
+EXTERN bdd_variableId bdd_get_id_from_level ARGS((bdd_manager *, long));
+EXTERN bdd_variableId bdd_top_var_id ARGS((bdd_t *));
+EXTERN int bdd_get_level_from_id ARGS((bdd_manager *mgr, int id));
+EXTERN int bdd_check_zero_ref ARGS((bdd_manager *mgr));
+EXTERN int bdd_estimate_cofactor ARGS((bdd_t *, bdd_t *, int ));
+/* Reordering related stuff */
+EXTERN void bdd_dynamic_reordering ARGS((bdd_manager *, bdd_reorder_type_t, bdd_reorder_verbosity_t));
+EXTERN void bdd_dynamic_reordering_zdd ARGS((bdd_manager *, bdd_reorder_type_t, bdd_reorder_verbosity_t));
+EXTERN int bdd_reordering_status ARGS((bdd_manager *mgr, bdd_reorder_type_t *method));
+EXTERN int bdd_reordering_zdd_status ARGS((bdd_manager *mgr, bdd_reorder_type_t *method));
+EXTERN void bdd_reorder ARGS((bdd_manager *));
+EXTERN int bdd_shuffle_heap ARGS((bdd_manager *mgr, int *permut));
+EXTERN void bdd_dynamic_reordering_disable ARGS((bdd_manager *mgr));
+EXTERN void bdd_dynamic_reordering_zdd_disable ARGS((bdd_manager *mgr));
+EXTERN int bdd_read_reordered_field ARGS((bdd_manager *mgr));
+EXTERN int bdd_add_hook ARGS((bdd_manager *, int (*procedure)(bdd_manager *, char *, void *), bdd_hook_type_t ));
+EXTERN int bdd_remove_hook ARGS((bdd_manager *, int (*procedure)(bdd_manager *, char *, void *), bdd_hook_type_t ));
+EXTERN int bdd_enable_reordering_reporting ARGS((bdd_manager *));
+EXTERN int bdd_disable_reordering_reporting ARGS((bdd_manager *));
+EXTERN bdd_reorder_verbosity_t bdd_reordering_reporting ARGS((bdd_manager *));
+/* This function should not be used by an external user. It will
+ * not be a part of any future release.
+ */
+EXTERN void bdd_set_reordered_field ARGS((bdd_manager *mgr, int n));
+EXTERN bdd_node *bdd_bdd_vector_support ARGS((bdd_manager *mgr,bdd_node **F,int n));
+EXTERN int bdd_bdd_vector_support_size ARGS((bdd_manager *mgr,bdd_node **F, int n));
+EXTERN int bdd_bdd_support_size ARGS((bdd_manager *mgr,bdd_node *F));
+EXTERN bdd_node *bdd_bdd_support ARGS((bdd_manager *mgr,bdd_node *F));
+EXTERN bdd_node *bdd_add_general_vector_compose ARGS((bdd_manager *mgr,bdd_node *f,bdd_node **vectorOn,bdd_node **vectorOff));
+EXTERN int bdd_bdd_leq ARGS((bdd_manager *mgr,bdd_node *f,bdd_node *g));
+EXTERN bdd_node *bdd_bdd_boolean_diff ARGS((bdd_manager *mgr,bdd_node *f,int x));
+
+/*
+** Generator related functions.
+** These are NOT to be used directly; only indirectly in the macros.
+*/
+EXTERN bdd_gen_status bdd_gen_read_status ARGS((bdd_gen *gen));
+EXTERN bdd_gen *bdd_first_cube ARGS((bdd_t *, array_t **));
+EXTERN boolean bdd_next_cube ARGS((bdd_gen *, array_t **));
+EXTERN bdd_gen *bdd_first_disjoint_cube ARGS((bdd_t *, array_t **));
+EXTERN boolean bdd_next_disjoint_cube ARGS((bdd_gen *, array_t **));
+EXTERN bdd_gen *bdd_first_node ARGS((bdd_t *, bdd_node **));
+EXTERN boolean bdd_next_node ARGS((bdd_gen *, bdd_node **));
+EXTERN int bdd_gen_free ARGS((bdd_gen *));
+
+/* 
+ * Miscellaneous
+ */
+EXTERN void bdd_set_gc_mode ARGS((bdd_manager *, boolean));
+EXTERN bdd_external_hooks *bdd_get_external_hooks ARGS((bdd_manager *));
+EXTERN bdd_t *bdd_construct_bdd_t ARGS((bdd_manager *mgr, bdd_node * fn));
+EXTERN void bdd_dump_blif ARGS((bdd_manager *mgr, int nBdds, bdd_node **bdds, char **inames, char **onames, char *model, FILE *fp));
+EXTERN void bdd_dump_blif_body ARGS((bdd_manager *mgr, int nBdds, bdd_node **bdds, char **inames, char **onames, FILE *fp));
+EXTERN void bdd_dump_dot ARGS((bdd_manager *mgr, int nBdds, bdd_node **bdds, char **inames, char **onames, FILE *fp));
+EXTERN bdd_node *bdd_make_bdd_from_zdd_cover ARGS((bdd_manager *mgr, bdd_node *node));
+EXTERN bdd_node *bdd_zdd_complement ARGS((bdd_manager *mgr, bdd_node *node));
+EXTERN int bdd_ptrcmp ARGS((bdd_t *f, bdd_t *g));
+EXTERN int bdd_ptrhash ARGS((bdd_t *f,int size));
+EXTERN long bdd_read_peak_memory ARGS (( bdd_manager *mgr));
+EXTERN int bdd_read_peak_live_node ARGS (( bdd_manager *mgr));
+EXTERN int bdd_set_pi_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_set_ps_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_set_ns_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_pi_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_ps_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_ns_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_set_pair_index ARGS((bdd_manager *mgr, int index, int pairIndex));
+EXTERN int bdd_read_pair_index ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_set_var_to_be_grouped ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_set_var_hard_group ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_reset_var_to_be_grouped ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_var_to_be_grouped ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_var_hard_group ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_var_to_be_ungrouped ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_set_var_to_be_ungrouped ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_bind_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_unbind_var ARGS((bdd_manager *mgr, int index));
+EXTERN int bdd_is_lazy_sift ARGS((bdd_manager *mgr));
+EXTERN void bdd_discard_all_var_groups ARGS((bdd_manager *mgr));
+#endif 
+
Index: /vis_dev/glu-2.1/src/bdd/bdd.make
===================================================================
--- /vis_dev/glu-2.1/src/bdd/bdd.make	(revision 6)
+++ /vis_dev/glu-2.1/src/bdd/bdd.make	(revision 6)
@@ -0,0 +1,1 @@
+HEADERS += bdd.h
Index: /vis_dev/glu-2.1/src/calBdd/cal.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/cal.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/cal.c	(revision 6)
@@ -0,0 +1,1034 @@
+/**CFile***********************************************************************
+
+  FileName    [cal.c]
+
+  PackageName [cal]
+
+  Synopsis    [Miscellaneous collection of exported BDD functions]
+
+  Description []
+
+  SeeAlso     []
+
+  Author      [
+               Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu
+              ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: cal.c,v 1.1.1.5 1998/05/04 00:58:48 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static Cal_Bdd_t BddIntersectsStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t g);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if argument BDDs are equal, 0 otherwise.]
+
+  Description [Returns 1 if argument BDDs are equal, 0 otherwise.]
+
+  SideEffects [None.]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Cal_BddIsEqual(Cal_BddManager bddManager, Cal_Bdd userBdd1, Cal_Bdd userBdd2)
+{
+  return (userBdd1 == userBdd2);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the argument BDD is constant one, 0 otherwise.]
+
+  Description [Returns 1 if the argument BDD is constant one, 0 otherwise.]
+
+  SideEffects [None.]
+
+  SeeAlso     [Cal_BddIsBddZero]
+
+******************************************************************************/
+int
+Cal_BddIsBddOne(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  return (userBdd == bddManager->userOneBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the argument BDD is constant zero, 0 otherwise.]
+
+  Description [Returns 1 if the argument BDD is constant zero, 0 otherwise.]
+
+  SideEffects [None.]
+
+  SeeAlso     [Cal_BddIsBddOne]
+
+******************************************************************************/
+int
+Cal_BddIsBddZero(
+  Cal_BddManager bddManager,
+  Cal_Bdd userBdd)
+{
+  return (userBdd == bddManager->userZeroBdd);
+}
+  
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the argument BDD is NULL, 0 otherwise.]
+
+  Description [Returns 1 if the argument BDD is NULL, 0 otherwise.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+int
+Cal_BddIsBddNull(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  return (userBdd == 0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the argument BDD is a constant, 0 otherwise.]
+
+  Description [Returns 1 if the argument BDD is either constant one or
+  constant zero, otherwise returns 0.]
+
+  SideEffects [None.]
+
+  SeeAlso     [Cal_BddIsBddOne, Cal_BddIsBddZero]
+
+******************************************************************************/
+int
+Cal_BddIsBddConst(
+  Cal_BddManager bddManager,
+  Cal_Bdd userBdd)
+{
+  return ((userBdd == bddManager->userOneBdd) ||
+          (userBdd == bddManager->userZeroBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the duplicate BDD of the argument BDD.]
+
+  Description [Returns the duplicate BDD of the argument BDD.]
+
+  SideEffects [The reference count of the BDD is increased by 1.]
+
+  SeeAlso     [Cal_BddNot]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddIdentity(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  /* Interface BDD reference count */
+  CalBddNode_t *bddNode = CAL_BDD_POINTER(userBdd);
+  CalBddNodeIcrRefCount(bddNode);
+  return userBdd;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for the constant one]
+
+  Description [Returns the BDD for the constant one]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddZero]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddOne(Cal_BddManager bddManager)
+{
+  return bddManager->userOneBdd;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for the constant zero]
+
+  Description [Returns the BDD for the constant zero]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddOne]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddZero(Cal_BddManager bddManager)
+{
+  return bddManager->userZeroBdd;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the complement of the argument BDD.]
+
+  Description [Returns the complement of the argument BDD.]
+
+  SideEffects [The reference count of the argument BDD is increased by 1.]
+
+  SeeAlso     [Cal_BddIdentity]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddNot(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  /* Interface BDD reference count */
+  CalBddNode_t *bddNode = CAL_BDD_POINTER(userBdd);
+  CalBddNodeIcrRefCount(bddNode);
+  return CalBddNodeNot(userBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the index of the top variable of the argument BDD.]
+
+  Description [Returns the index of the top variable of the argument BDD.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddGetIfId]
+
+******************************************************************************/
+Cal_BddId_t
+Cal_BddGetIfIndex(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t F;
+  if (CalBddPreProcessing(bddManager, 1, userBdd) == 1){
+    F = CalBddGetInternalBdd(bddManager, userBdd);
+    if (CalBddIsBddConst(F)){
+      return -1;
+    }
+    return CalBddGetBddIndex(bddManager, F);
+  }
+  return -1;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the id of the top variable of the argument BDD.]
+
+  Description [Returns the id of the top variable of the argument BDD.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddGetIfIndex]
+
+******************************************************************************/
+Cal_BddId_t
+Cal_BddGetIfId(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t F;
+  if (CalBddPreProcessing(bddManager, 1, userBdd) == 1){
+    F = CalBddGetInternalBdd(bddManager, userBdd);
+    if (CalBddIsBddConst(F)){
+      return 0;
+    }
+    return CalBddGetBddId(F);
+  }
+  return -1;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD corresponding to the top variable of
+  the argument BDD.]
+
+  Description [Returns the BDD corresponding to the top variable of
+  the argument BDD.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddIf(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t F;
+  if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+    return (Cal_Bdd)0;
+  }
+  F = CalBddGetInternalBdd(bddManager, userBdd);
+  if (CalBddIsBddConst(F)){
+    CalBddWarningMessage("Cal_BddIf: argument is constant");
+  }
+  return CalBddGetExternalBdd(bddManager, bddManager->varBdds[CalBddGetBddId(F)]);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.]
+
+  Description [Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.]
+
+  SideEffects [The reference count of the returned BDD is increased by 1.]
+
+  SeeAlso     [Cal_BddElse]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddThen(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t thenBdd;
+  Cal_Bdd_t F;
+  if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+    return (Cal_Bdd)0;
+  }
+  F = CalBddGetInternalBdd(bddManager, userBdd);
+  CalBddGetThenBdd(F, thenBdd);
+  return CalBddGetExternalBdd(bddManager, thenBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.]
+
+  Description [Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.]
+
+  SideEffects [The reference count of the returned BDD is increased by 1.]
+
+  SeeAlso     [Cal_BddThen]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddElse(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t elseBdd;
+  Cal_Bdd_t F;
+  if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+    return (Cal_Bdd) 0;
+  }
+  F = CalBddGetInternalBdd(bddManager, userBdd);
+  CalBddGetElseBdd(F, elseBdd);
+  return CalBddGetExternalBdd(bddManager, elseBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Frees the argument BDD.]
+
+  Description [Frees the argument BDD. It is an error to free a BDD
+  more than once.]
+
+  SideEffects [The reference count of the argument BDD is decreased by 1.]
+
+  SeeAlso     [Cal_BddUnFree]
+
+******************************************************************************/
+void
+Cal_BddFree(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  /* Interface BDD reference count */
+  CalBddNodeDcrRefCount(CAL_BDD_POINTER(userBdd));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Unfrees the argument BDD.]
+
+  Description [Unfrees the argument BDD. It is an error to pass a BDD
+  with reference count of zero to be unfreed.]
+
+  SideEffects [The reference count of the argument BDD is increased by 1.]
+
+  SeeAlso     [Cal_BddFree]
+
+******************************************************************************/
+void
+Cal_BddUnFree(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  /* Interface BDD reference count */
+  CalBddNode_t *bddNode = CAL_BDD_POINTER(userBdd);
+  CalBddNodeIcrRefCount(bddNode);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a BDD with positive from a given BDD with arbitrary phase]
+
+  Description [Returns a BDD with positive from a given BDD with arbitrary phase]
+
+  SideEffects [None.]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddGetRegular(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  return CAL_BDD_POINTER(userBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Computes a BDD that implies conjunction of f and g.]
+
+  Description [Computes a BDD that implies conjunction of f and g.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddImplies]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddIntersects(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd
+                  gUserBdd) 
+{
+  Cal_Bdd_t result;
+  Cal_Bdd_t f, g;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd) == 0){
+    return (Cal_Bdd) 0;
+  }
+  f = CalBddGetInternalBdd(bddManager, fUserBdd);
+  g = CalBddGetInternalBdd(bddManager, gUserBdd);
+  result = BddIntersectsStep(bddManager,f,g);
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Computes a BDD that implies conjunction of f and Cal_BddNot(g)]
+
+  Description [Computes a BDD that implies conjunction of f and Cal_BddNot(g)]
+
+  SideEffects [none]
+
+  SeeAlso     [Cal_BddIntersects]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddImplies(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd_t f, g;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    Cal_Bdd_t gNot;
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    g = CalBddGetInternalBdd(bddManager, gUserBdd);
+    CalBddNot(g, gNot);
+    result = BddIntersectsStep(bddManager,f, gNot);
+  }
+  else{
+    return (Cal_Bdd) 0;
+  }
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of nodes in the Unique table]
+
+  Description [Returns the number of nodes in the Unique table]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddManagerGetNumNodes]
+
+******************************************************************************/
+unsigned long
+Cal_BddTotalSize(Cal_BddManager bddManager)
+{
+  return Cal_BddManagerGetNumNodes(bddManager);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints miscellaneous BDD statistics]
+
+  Description [Prints miscellaneous BDD statistics]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+Cal_BddStats(Cal_BddManager bddManager, FILE * fp)
+{
+  unsigned long cacheInsertions = 0;
+  unsigned long cacheEntries = 0;
+  unsigned long cacheSize = 0;
+  unsigned long cacheHits = 0;
+  unsigned long cacheLookups = 0;
+  unsigned long cacheCollisions = 0;
+  unsigned long numLockedNodes = 0;
+  int i, id, depth;
+  long numPages;
+  unsigned long totalBytes;
+  
+  
+  fprintf(fp, "**** CAL modifiable parameters ****\n");
+  fprintf(fp, "Node limit: %ld\n", bddManager->nodeLimit);
+  fprintf(fp, "Garbage collection enabled: %s\n",
+          ((bddManager->gcMode) ? "yes" : "no"));
+  fprintf(fp, "Maximum number of variables sifted per reordering: %ld\n", 
+          bddManager->maxNumVarsSiftedPerReordering);
+  fprintf(fp, "Maximum number of variable swaps per reordering: %ld\n",
+          bddManager->maxNumSwapsPerReordering);
+  fprintf(fp, "Maximum growth while sifting a variable: %2.2f\n",
+          bddManager->maxSiftingGrowth);
+  fprintf(fp, "Dynamic reordering of BDDs enabled: %s\n", 
+          ((bddManager->dynamicReorderingEnableFlag) ? "yes" : "no"));
+  fprintf(fp, "Repacking after GC Threshold: %f\n", 
+          bddManager->repackAfterGCThreshold);
+  fprintf(fp, "**** CAL statistics ****\n");
+  fprintf(fp, "Total BDD Node Usage : %ld nodes, %ld Bytes\n",
+          bddManager->numNodes, bddManager->numNodes*sizeof(CalBddNode_t));
+  fprintf(fp, "Peak BDD Node Usage : %ld nodes, %ld Bytes\n",
+          bddManager->numPeakNodes,
+          bddManager->numPeakNodes*sizeof(CalBddNode_t)); 
+  for (i=1; i<=bddManager->numVars; i++){
+    numLockedNodes += CalBddUniqueTableNumLockedNodes(bddManager,
+                                                      bddManager->uniqueTable[i]);
+  }
+  fprintf(fp, "Number of nodes locked: %ld\n", numLockedNodes);
+  fprintf(fp, "Total Number of variables: %d\n", bddManager->numVars);
+  numPages =
+      bddManager->pageManager1->totalNumPages+
+      bddManager->pageManager2->totalNumPages;
+  fprintf(fp, "Total memory allocated for BDD nodes: %ld pages (%ld Bytes)\n",
+          numPages, PAGE_SIZE*numPages);
+  /* Calculate the memory consumed */
+  totalBytes =
+      /* Over all bdd manager */
+      sizeof(Cal_BddManager_t)+
+      bddManager->maxNumVars*(sizeof(Cal_Bdd_t)+sizeof(CalNodeManager_t *)+
+                              sizeof(CalHashTable_t *) +
+                              sizeof(CalHashTable_t *) + sizeof(CalRequestNode_t*)*2)+
+      sizeof(CalPageManager_t)*2+
+      /* Page manager */
+      bddManager->pageManager1->maxNumSegments*(sizeof(CalAddress_t *)+sizeof(int))+
+      bddManager->pageManager2->maxNumSegments*
+      (sizeof(CalAddress_t *)+sizeof(int)); 
+
+  for (id=0; id <= bddManager->numVars; id++){
+    totalBytes += bddManager->nodeManagerArray[id]->maxNumPages*sizeof(int);;
+  }
+  /* IndexToId and IdToIndex */
+  totalBytes += 2*bddManager->maxNumVars*(sizeof(Cal_BddIndex_t));
+  for (id=0; id <= bddManager->numVars; id++){
+    totalBytes += bddManager->uniqueTable[id]->numBins*sizeof(int);;
+  }
+  /* Cache Table */
+  totalBytes += CalCacheTableMemoryConsumption(bddManager->cacheTable);
+  
+  /* Req que */
+  totalBytes += bddManager->maxDepth*sizeof(CalHashTable_t **);
+  for (depth = 0; depth < bddManager->depth; depth++){
+    for (id=0; id <= bddManager->numVars; id++){
+      if (bddManager->reqQue[depth][id]){
+        totalBytes +=
+            bddManager->reqQue[depth][id]->numBins*
+            sizeof(CalBddNode_t*);
+      }
+    }
+  }
+  /* Association */
+  totalBytes += sizeof(CalAssociation_t)*2;
+  /* Block */
+  totalBytes += CalBlockMemoryConsumption(bddManager->superBlock);
+
+  fprintf(fp, "Total memory consumed: %ld Pages (%ld Bytes)\n",
+          numPages+totalBytes/PAGE_SIZE,
+          PAGE_SIZE*numPages+totalBytes);  
+
+  CalBddManagerGetCacheTableData(bddManager, &cacheSize,
+                                 &cacheEntries, &cacheInsertions, 
+                                 &cacheLookups, &cacheHits, &cacheCollisions);
+  fprintf(fp, "Cache Size: %ld\n", cacheSize);
+  fprintf(fp, "Cache Entries: %ld\n", cacheEntries);
+  fprintf(fp, "Cache Insertions: %ld\n", cacheInsertions);
+  fprintf(fp, "Cache Collisions: %ld\n", cacheCollisions);
+  fprintf(fp, "Cache Hits: %ld\n", cacheHits);
+  if (cacheLookups){
+    fprintf(fp, "Cache Lookup: %ld\n", cacheLookups);
+    fprintf(fp, "Cache hit ratio: %-.2f\n", ((double)cacheHits)/cacheLookups);
+  }
+  fprintf(fp, "Number of nodes garbage collected: %ld\n",
+          bddManager->numNodesFreed);
+  fprintf(fp,"number of garbage collections: %d\n", bddManager->numGC);
+  fprintf(fp,"number of dynamic reorderings: %d\n",
+          bddManager->numReorderings); 
+  fprintf(fp,"number of trivial swaps: %ld\n", bddManager->numTrivialSwaps); 
+  fprintf(fp,"number of swaps in last reordering: %ld\n", bddManager->numSwaps); 
+  fprintf(fp,"garbage collection limit: %ld\n", bddManager->uniqueTableGCLimit);
+  fflush(fp);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Specify dynamic reordering technique.]
+
+  Description [Selects the method for dynamic reordering.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddReorder]
+
+******************************************************************************/
+void
+Cal_BddDynamicReordering(Cal_BddManager bddManager, int technique)
+{
+  bddManager->reorderTechnique = technique;
+  bddManager->dynamicReorderingEnableFlag = 1;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Invoke the current dynamic reodering method.]
+
+  Description [Invoke the current dynamic reodering method.]
+
+  SideEffects [Index of a variable may change due to reodering]
+
+  SeeAlso     [Cal_BddDynamicReordering]
+
+******************************************************************************/
+void
+Cal_BddReorder(Cal_BddManager bddManager)
+{
+  if ((bddManager->dynamicReorderingEnableFlag == 0) ||
+      (bddManager->reorderTechnique == CAL_REORDER_NONE)){
+    return;
+  }
+  CalCacheTableTwoFlush(bddManager->cacheTable);
+  if (bddManager->reorderMethod == CAL_REORDER_METHOD_DF){
+    CalBddReorderAuxDF(bddManager);
+  }
+  else if (bddManager->reorderMethod == CAL_REORDER_METHOD_BF){ 
+    Cal_BddManagerGC(bddManager);
+    CalBddReorderAuxBF(bddManager);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns type of a BDD ( 0, 1, +var, -var, ovrflow, nonterminal)]
+
+  Description [Returns BDD_TYPE_ZERO if f is false, BDD_TYPE_ONE 
+  if f is true, BDD_TYPE_POSVAR is f is an unnegated variable,
+  BDD_TYPE_NEGVAR if f is a negated variable, BDD_TYPE_OVERFLOW if f
+  is null, and BDD_TYPE_NONTERMINAL otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+int
+Cal_BddType(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  Cal_Bdd_t f;
+  if (CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    return (CalBddTypeAux(bddManager, f));
+  }
+  return (CAL_BDD_TYPE_OVERFLOW);
+}
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of BDD variables]
+
+  Description [Returns the number of BDD variables]
+
+  SideEffects [None]
+
+******************************************************************************/
+long
+Cal_BddVars(Cal_BddManager bddManager)
+{
+  return (bddManager->numVars);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets the node limit to new_limit and returns the old limit.]
+
+  Description [Sets the node limit to new_limit and returns the old limit.]
+
+  SideEffects [Threshold for garbage collection may change]
+
+  SeeAlso     [Cal_BddManagerGC]
+
+******************************************************************************/
+long
+Cal_BddNodeLimit(
+  Cal_BddManager bddManager,
+  long  newLimit)
+{
+  long oldLimit;
+
+  oldLimit = bddManager->nodeLimit;
+  if (newLimit < 0){
+    newLimit=0;
+  }
+  bddManager->nodeLimit = newLimit;
+  if (newLimit && (bddManager->uniqueTableGCLimit > newLimit)){
+    bddManager->uniqueTableGCLimit = newLimit;
+  }
+  return (oldLimit);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.]
+
+  Description [Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddNodeLimit]
+
+******************************************************************************/
+int
+Cal_BddOverflow(Cal_BddManager bddManager)
+{
+  int result;
+  result = bddManager->overflow;
+  bddManager->overflow = 0;
+  return (result);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Returns 1 if the argument BDD is a cube, 0 otherwise]
+
+  Description        [Returns 1 if the argument BDD is a cube, 0 otherwise]
+
+  SideEffects        [None]
+
+******************************************************************************/
+int
+Cal_BddIsCube(
+  Cal_BddManager bddManager,
+  Cal_Bdd fUserBdd)
+{
+  Cal_Bdd_t f0, f1;
+  Cal_Bdd_t f;
+  f = CalBddGetInternalBdd(bddManager, fUserBdd);
+  if (CalBddIsBddConst(f)){
+    if (CalBddIsBddZero(bddManager, f)){
+      CalBddFatalMessage("Cal_BddIsCube called with 0");
+    }
+    else return 1;
+  }
+
+  CalBddGetThenBdd(f, f1);
+  CalBddGetElseBdd(f, f0);
+  /*
+   * Exactly one branch of f must point to ZERO to be a cube.
+   */
+  if (CalBddIsBddZero(bddManager, f1)){
+	return (CalBddIsCubeStep(bddManager, f0));
+  } else if (CalBddIsBddZero(bddManager, f0)){
+	return (CalBddIsCubeStep(bddManager, f1));
+  } else { /* not a cube, because neither branch is zero */
+	return 0;
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Returns the hooks field of the manager.]
+
+  Description        [Returns the hooks field of the manager.]
+
+  SideEffects        [None]
+
+  SeeAlso            []
+
+******************************************************************************/
+void *
+Cal_BddManagerGetHooks(Cal_BddManager bddManager)
+{
+  return bddManager->hooks;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Sets the hooks field of the manager.]
+
+  Description        [Sets the hooks field of the manager.]
+
+  SideEffects        [Hooks field changes. ]
+
+  SeeAlso            []
+
+******************************************************************************/
+void 
+Cal_BddManagerSetHooks(Cal_BddManager bddManager, void *hooks)
+{
+  bddManager->hooks = hooks;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD corresponding to the top variable of
+  the argument BDD.]
+
+  Description [Returns the BDD corresponding to the top variable of
+  the argument BDD.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddIf(Cal_BddManager bddManager, Cal_Bdd_t F)
+{
+  if (CalBddIsBddConst(F)){
+    CalBddWarningMessage("CalBddIf: argument is constant");
+  }
+  return bddManager->varBdds[CalBddGetBddId(F)];
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Returns 1 if the argument BDD is a cube, 0 otherwise]
+
+  Description        [Returns 1 if the argument BDD is a cube, 0 otherwise]
+
+  SideEffects        [None]
+
+******************************************************************************/
+int
+CalBddIsCubeStep(Cal_BddManager bddManager, Cal_Bdd_t f)
+{
+  Cal_Bdd_t f0, f1;
+  if (CalBddIsBddConst(f)){
+    if (CalBddIsBddZero(bddManager, f)){
+      CalBddFatalMessage("Cal_BddIsCube called with 0");
+    }
+    else return 1;
+  }
+
+  CalBddGetThenBdd(f, f1);
+  CalBddGetElseBdd(f, f0);
+  /*
+   * Exactly one branch of f must point to ZERO to be a cube.
+   */
+  if (CalBddIsBddZero(bddManager, f1)){
+	return (CalBddIsCubeStep(bddManager, f0));
+  } else if (CalBddIsBddZero(bddManager, f0)){
+	return (CalBddIsCubeStep(bddManager, f1));
+  } else { /* not a cube, because neither branch is zero */
+	return 0;
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD type by recursively traversing the argument BDD]
+
+  Description [Returns the BDD type by recursively traversing the argument BDD]
+
+  SideEffects [None]
+
+******************************************************************************/
+int
+CalBddTypeAux(Cal_BddManager_t * bddManager, Cal_Bdd_t f)
+{
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  if (CalBddIsBddConst(f)){
+    if (CalBddIsBddZero(bddManager, f)) return (CAL_BDD_TYPE_ZERO);
+    if (CalBddIsBddOne(bddManager, f)) return (CAL_BDD_TYPE_ONE);
+  }
+  CalBddGetThenBdd(f, thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  if (CalBddIsBddOne(bddManager, thenBdd) &&
+      CalBddIsBddZero(bddManager, elseBdd))
+    return CAL_BDD_TYPE_POSVAR;
+  if (CalBddIsBddZero(bddManager, thenBdd) &&
+      CalBddIsBddOne(bddManager, elseBdd))
+    return (CAL_BDD_TYPE_NEGVAR);
+  return (CAL_BDD_TYPE_NONTERMINAL);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the duplicate BDD of the argument BDD.]
+
+  Description [Returns the duplicate BDD of the argument BDD.]
+
+  SideEffects [The reference count of the BDD is increased by 1.]
+
+  SeeAlso     [Cal_BddNot]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddIdentity(Cal_BddManager_t *bddManager, Cal_Bdd_t calBdd)
+{
+  CalBddIcrRefCount(calBdd);
+  return calBdd;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Recursive routine to returns a BDD that implies conjunction of
+  argument BDDs]
+
+  Description [Recursive routine to returns a BDD that implies conjunction of
+  argument BDDs]
+
+  SideEffects [None]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddIntersectsStep(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, Cal_Bdd_t  g)
+{
+  Cal_Bdd_t f1, f2, g1, g2, result, temp;
+  Cal_BddId_t topId;
+  
+  
+  if (CalBddIsBddConst(f)){
+    if (CalBddIsBddZero(bddManager, f)){
+      return f;
+    }
+    else {
+      return g;
+    }
+  }
+  if (CalBddIsBddConst(g)){
+    if (CalBddIsBddZero(bddManager, g)){
+      return g;
+    }
+    else {
+      return f;
+    }
+  }
+  if (CalBddSameOrNegation(f, g)){
+    if (CalBddIsEqual(f, g)){
+      return f;
+    }
+    else
+      return bddManager->bddZero;
+  }
+  if (CAL_BDD_OUT_OF_ORDER(f, g)) CAL_BDD_SWAP(f, g);
+  CalBddGetMinId2(bddManager, f, g, topId);
+  CalBddGetCofactors(f, topId, f1, f2);
+  CalBddGetCofactors(g, topId, g1, g2);
+  temp = BddIntersectsStep(bddManager, f1, g1);
+  if (CalBddIsBddZero(bddManager, temp)){
+    temp = BddIntersectsStep(bddManager, f2, g2);
+    if (CalBddIsBddZero(bddManager, temp)){
+      return bddManager->bddZero;
+    }
+    else{
+      if(CalUniqueTableForIdFindOrAdd(bddManager,
+                                      bddManager->uniqueTable[topId],  
+                                      bddManager->bddZero, temp,
+                                      &result) == 0){
+        CalBddIcrRefCount(temp);
+      }
+    }
+  }
+  else {
+    if(CalUniqueTableForIdFindOrAdd(bddManager, bddManager->uniqueTable[topId],
+                          temp, bddManager->bddZero,&result) == 0){
+      CalBddIcrRefCount(temp);
+    }
+  }
+  return result;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/cal.h
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/cal.h	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/cal.h	(revision 6)
@@ -0,0 +1,251 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [cal.h]
+
+  PackageName [cal]
+
+  Synopsis    [Header CAL file for exported data structures and functions.]
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)] 
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: cal.h,v 1.8 2002/09/08 21:22:16 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _CAL
+#define _CAL
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+#endif
+#if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+#endif
+#if HAVE_SYS_RESOURCE_H
+#  include <sys/resource.h>
+#endif
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+#if HAVE_TIME_H
+#  include <time.h>
+#endif
+
+#include <assert.h>
+#include <math.h>
+
+#include "calMem.h"
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef EXTERN
+#  ifdef __cplusplus
+#    define EXTERN	extern "C"
+#  else
+#    define EXTERN	extern
+#  endif
+#endif
+
+#define CAL_BDD_TYPE_NONTERMINAL 0
+#define CAL_BDD_TYPE_ZERO 1
+#define CAL_BDD_TYPE_ONE 2
+#define CAL_BDD_TYPE_POSVAR 3
+#define CAL_BDD_TYPE_NEGVAR 4
+#define CAL_BDD_TYPE_OVERFLOW 5
+#define CAL_BDD_TYPE_CONSTANT 6
+
+#define CAL_BDD_UNDUMP_FORMAT 1
+#define CAL_BDD_UNDUMP_OVERFLOW 2
+#define CAL_BDD_UNDUMP_IOERROR 3
+#define CAL_BDD_UNDUMP_EOF 4
+
+#define CAL_REORDER_NONE 0
+#define CAL_REORDER_SIFT 1
+#define CAL_REORDER_WINDOW 2
+#define CAL_REORDER_METHOD_BF 0
+#define CAL_REORDER_METHOD_DF 1
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct Cal_BddManagerStruct *Cal_BddManager;
+typedef struct Cal_BddManagerStruct Cal_BddManager_t;
+typedef struct CalBddNodeStruct *Cal_Bdd;
+typedef unsigned short int Cal_BddId_t;
+typedef unsigned short int Cal_BddIndex_t;
+typedef char * (*Cal_VarNamingFn_t)(Cal_BddManager, Cal_Bdd, Cal_Pointer_t); 
+typedef char * (*Cal_TerminalIdFn_t)(Cal_BddManager, Cal_Address_t, Cal_Address_t, Cal_Pointer_t);      
+typedef struct Cal_BlockStruct *Cal_Block;
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+enum Cal_BddOpEnum {CAL_AND, CAL_OR, CAL_XOR};
+typedef enum Cal_BddOpEnum Cal_BddOp_t;
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#define Cal_BddNamingFnNone ((char *(*)(Cal_BddManager, Cal_Bdd, Cal_Pointer_t))0)
+#define Cal_BddTerminalIdFnNone ((char *(*)(Cal_BddManager, Cal_Address_t, Cal_Address_t, Cal_Pointer_t))0)
+#ifdef _CAL_DEBUG_
+#define Cal_Assert(valid) assert(valid)
+#else
+#define Cal_Assert(ignore) ((void)0)
+#endif
+
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+EXTERN int Cal_BddIsEqual(Cal_BddManager bddManager, Cal_Bdd userBdd1, Cal_Bdd userBdd2);
+EXTERN int Cal_BddIsBddOne(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN int Cal_BddIsBddZero(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN int Cal_BddIsBddNull(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN int Cal_BddIsBddConst(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddIdentity(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddOne(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_BddZero(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_BddNot(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_BddId_t Cal_BddGetIfIndex(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_BddId_t Cal_BddGetIfId(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddIf(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddThen(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddElse(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN void Cal_BddFree(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN void Cal_BddUnFree(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddGetRegular(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddIntersects(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddImplies(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN unsigned long Cal_BddTotalSize(Cal_BddManager bddManager);
+EXTERN void Cal_BddStats(Cal_BddManager bddManager, FILE * fp);
+EXTERN void Cal_BddDynamicReordering(Cal_BddManager bddManager, int technique);
+EXTERN void Cal_BddReorder(Cal_BddManager bddManager);
+EXTERN int Cal_BddType(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN long Cal_BddVars(Cal_BddManager bddManager);
+EXTERN long Cal_BddNodeLimit(Cal_BddManager bddManager, long newLimit);
+EXTERN int Cal_BddOverflow(Cal_BddManager bddManager);
+EXTERN int Cal_BddIsCube(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN void * Cal_BddManagerGetHooks(Cal_BddManager bddManager);
+EXTERN void Cal_BddManagerSetHooks(Cal_BddManager bddManager, void *hooks);
+EXTERN int Cal_AssociationInit(Cal_BddManager bddManager, Cal_Bdd *associationInfoUserBdds, int pairs);
+EXTERN void Cal_AssociationQuit(Cal_BddManager bddManager, int associationId);
+EXTERN int Cal_AssociationSetCurrent(Cal_BddManager bddManager, int associationId);
+EXTERN void Cal_TempAssociationAugment(Cal_BddManager bddManager, Cal_Bdd *associationInfoUserBdds, int pairs);
+EXTERN void Cal_TempAssociationInit(Cal_BddManager bddManager, Cal_Bdd *associationInfoUserBdds, int pairs);
+EXTERN void Cal_TempAssociationQuit(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_BddCompose(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd, Cal_Bdd hUserBdd);
+EXTERN Cal_Bdd Cal_BddITE(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd, Cal_Bdd hUserBdd);
+EXTERN Cal_BddManager Cal_BddManagerInit(void);
+EXTERN int Cal_BddManagerQuit(Cal_BddManager bddManager);
+EXTERN void Cal_BddManagerSetParameters(Cal_BddManager bddManager, long reorderingThreshold, long maxForwardedNodes, double repackAfterGCThreshold, double tableRepackThreshold);
+EXTERN unsigned long Cal_BddManagerGetNumNodes(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_BddManagerCreateNewVarFirst(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_BddManagerCreateNewVarLast(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_BddManagerCreateNewVarBefore(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddManagerCreateNewVarAfter(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd Cal_BddManagerGetVarWithIndex(Cal_BddManager bddManager, Cal_BddIndex_t index);
+EXTERN Cal_Bdd Cal_BddManagerGetVarWithId(Cal_BddManager bddManager, Cal_BddId_t id);
+EXTERN Cal_Bdd Cal_BddAnd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddNand(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddOr(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddNor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddXor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddXnor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd * Cal_BddPairwiseAnd(Cal_BddManager bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd * Cal_BddPairwiseOr(Cal_BddManager bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd * Cal_BddPairwiseXor(Cal_BddManager bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd Cal_BddMultiwayAnd(Cal_BddManager bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd Cal_BddMultiwayOr(Cal_BddManager bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd Cal_BddMultiwayXor(Cal_BddManager bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd Cal_BddSatisfy(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN Cal_Bdd Cal_BddSatisfySupport(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN double Cal_BddSatisfyingFraction(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN long Cal_BddSize(Cal_BddManager bddManager, Cal_Bdd fUserBdd, int negout);
+EXTERN long Cal_BddSizeMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray, int negout);
+EXTERN void Cal_BddProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd, long * levelCounts, int negout);
+EXTERN void Cal_BddProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray, long * levelCounts, int negout);
+EXTERN void Cal_BddFunctionProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd, long * funcCounts);
+EXTERN void Cal_BddFunctionProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray, long * funcCounts);
+EXTERN Cal_Bdd Cal_BddSubstitute(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN void Cal_BddSupport(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd *support);
+EXTERN int Cal_BddDependsOn(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd varUserBdd);
+EXTERN Cal_Bdd Cal_BddSwapVars(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd, Cal_Bdd hUserBdd);
+EXTERN Cal_Bdd Cal_BddVarSubstitute(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN Cal_Block Cal_BddNewVarBlock(Cal_BddManager bddManager, Cal_Bdd variable, long length);
+EXTERN void Cal_BddVarBlockReorderable(Cal_BddManager bddManager, Cal_Block block, int reorderable);
+EXTERN Cal_Bdd Cal_BddUndumpBdd(Cal_BddManager bddManager, Cal_Bdd * userVars, FILE * fp, int * error);
+EXTERN int Cal_BddDumpBdd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd * userVars, FILE * fp);
+EXTERN void Cal_BddSetGCMode(Cal_BddManager bddManager, int gcMode);
+EXTERN int Cal_BddManagerGC(Cal_BddManager bddManager);
+EXTERN void Cal_BddManagerSetGCLimit(Cal_BddManager manager);
+EXTERN void Cal_MemFatal(char *message);
+EXTERN Cal_Address_t Cal_MemAllocation(void);
+EXTERN Cal_Pointer_t Cal_MemGetBlock(Cal_Address_t size);
+EXTERN void Cal_MemFreeBlock(Cal_Pointer_t p);
+EXTERN Cal_Pointer_t Cal_MemResizeBlock(Cal_Pointer_t p, Cal_Address_t newSize);
+EXTERN Cal_Pointer_t Cal_MemNewRec(Cal_RecMgr mgr);
+EXTERN void Cal_MemFreeRec(Cal_RecMgr mgr, Cal_Pointer_t rec);
+EXTERN Cal_RecMgr Cal_MemNewRecMgr(int size);
+EXTERN void Cal_MemFreeRecMgr(Cal_RecMgr mgr);
+EXTERN int Cal_PerformanceTest(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions, int iteration, int seed, int andPerformanceFlag, int multiwayPerformanceFlag, int onewayPerformanceFlag, int quantifyPerformanceFlag, int composePerformanceFlag, int relprodPerformanceFlag, int swapPerformanceFlag, int substitutePerformanceFlag, int sanityCheckFlag, int computeMemoryOverheadFlag, int superscalarFlag);
+EXTERN void Cal_PipelineSetDepth(Cal_BddManager bddManager, int depth);
+EXTERN int Cal_PipelineInit(Cal_BddManager bddManager, Cal_BddOp_t bddOp);
+EXTERN Cal_Bdd Cal_PipelineCreateProvisionalBdd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN int Cal_PipelineExecute(Cal_BddManager bddManager);
+EXTERN Cal_Bdd Cal_PipelineUpdateProvisionalBdd(Cal_BddManager bddManager, Cal_Bdd provisionalBdd);
+EXTERN int Cal_BddIsProvisional(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN void Cal_PipelineQuit(Cal_BddManager bddManager);
+EXTERN void Cal_BddPrintBdd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_VarNamingFn_t VarNamingFn, Cal_TerminalIdFn_t TerminalIdFn, Cal_Pointer_t env, FILE *fp);
+EXTERN void Cal_BddPrintProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_VarNamingFn_t varNamingProc, char * env, int lineLength, FILE * fp);
+EXTERN void Cal_BddPrintProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *userBdds, Cal_VarNamingFn_t varNamingProc, char * env, int lineLength, FILE * fp);
+EXTERN void Cal_BddPrintFunctionProfile(Cal_BddManager bddManager, Cal_Bdd f, Cal_VarNamingFn_t varNamingProc, char * env, int lineLength, FILE * fp);
+EXTERN void Cal_BddPrintFunctionProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *userBdds, Cal_VarNamingFn_t varNamingProc, char * env, int lineLength, FILE * fp);
+EXTERN Cal_Bdd Cal_BddExists(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN Cal_Bdd Cal_BddRelProd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd);
+EXTERN Cal_Bdd Cal_BddForAll(Cal_BddManager bddManager, Cal_Bdd fUserBdd);
+EXTERN Cal_Bdd Cal_BddCofactor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd cUserBdd);
+EXTERN Cal_Bdd Cal_BddReduce(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd cUserBdd);
+EXTERN Cal_Bdd Cal_BddBetween(Cal_BddManager bddManager, Cal_Bdd fMinUserBdd, Cal_Bdd fMaxUserBdd);
+EXTERN void Cal_ImageDump(Cal_BddManager_t *bddManager, FILE *fp);
+EXTERN void Cal_BddFunctionPrint(Cal_BddManager bddManager, Cal_Bdd userBdd, char *name);
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _CAL */
Index: /vis_dev/glu-2.1/src/calBdd/calAllAbs.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calAllAbs.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calAllAbs.html	(revision 6)
@@ -0,0 +1,1293 @@
+<HTML>
+<HEAD><TITLE>cal package abstract</TITLE></HEAD>
+<BODY>
+
+
+<!-- Function Abstracts -->
+
+<dl>
+<DT> <A HREF="calAllDet.html#AddBlock" TARGET="MAIN"><CODE>AddBlock()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#AddToFreeList" TARGET="MAIN"><CODE>AddToFreeList()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#AssociationIsEqual" TARGET="MAIN"><CODE>AssociationIsEqual()</CODE></A>
+<DD> Checks for equality of two associations
+
+<DT> <A HREF="calAllDet.html#BddAddInternalReferences" TARGET="MAIN"><CODE>BddAddInternalReferences()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddArrayOpBF" TARGET="MAIN"><CODE>BddArrayOpBF()</CODE></A>
+<DD> Internal common routine for Cal_BddPairwiseAnd and Cal_BddPairwiseOr
+
+<DT> <A HREF="calAllDet.html#BddArrayToRequestNodeListArray" TARGET="MAIN"><CODE>BddArrayToRequestNodeListArray()</CODE></A>
+<DD> Converts an array of BDDs to a list of requests representing BDD
+  pairs
+
+<DT> <A HREF="calAllDet.html#BddCofactorBF" TARGET="MAIN"><CODE>BddCofactorBF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddConvertDataStructBack" TARGET="MAIN"><CODE>BddConvertDataStructBack()</CODE></A>
+<DD> Changes the data structure of the bdd nodes to
+  the original one.
+
+<DT> <A HREF="calAllDet.html#BddConvertDataStruct" TARGET="MAIN"><CODE>BddConvertDataStruct()</CODE></A>
+<DD> Changes the data structure of the bdd nodes.
+
+<DT> <A HREF="calAllDet.html#BddCountNoNodes" TARGET="MAIN"><CODE>BddCountNoNodes()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddCountNodes" TARGET="MAIN"><CODE>BddCountNodes()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddDFStep" TARGET="MAIN"><CODE>BddDFStep()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddDefaultTransformFn" TARGET="MAIN"><CODE>BddDefaultTransformFn()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddDominatedStep" TARGET="MAIN"><CODE>BddDominatedStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddDumpBddStep" TARGET="MAIN"><CODE>BddDumpBddStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddExchangeAux" TARGET="MAIN"><CODE>BddExchangeAux()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExchangeVarBlocks" TARGET="MAIN"><CODE>BddExchangeVarBlocks()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExchange" TARGET="MAIN"><CODE>BddExchange()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExistsApply" TARGET="MAIN"><CODE>BddExistsApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExistsBFAux" TARGET="MAIN"><CODE>BddExistsBFAux()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExistsBFPlusDF" TARGET="MAIN"><CODE>BddExistsBFPlusDF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExistsReduce" TARGET="MAIN"><CODE>BddExistsReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddExistsStep" TARGET="MAIN"><CODE>BddExistsStep()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddHighestRefStep" TARGET="MAIN"><CODE>BddHighestRefStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddIntersectsStep" TARGET="MAIN"><CODE>BddIntersectsStep()</CODE></A>
+<DD> Recursive routine to returns a BDD that implies conjunction of
+  argument BDDs
+
+<DT> <A HREF="calAllDet.html#BddMarkBdd" TARGET="MAIN"><CODE>BddMarkBdd()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddMultiwayOp" TARGET="MAIN"><CODE>BddMultiwayOp()</CODE></A>
+<DD> Internal routine for multiway operations
+
+<DT> <A HREF="calAllDet.html#BddNukeInternalReferences" TARGET="MAIN"><CODE>BddNukeInternalReferences()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddPrintBddStep" TARGET="MAIN"><CODE>BddPrintBddStep()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddPrintTopVar" TARGET="MAIN"><CODE>BddPrintTopVar()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddProfileStep" TARGET="MAIN"><CODE>BddProfileStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddReallocateNodesInPlace" TARGET="MAIN"><CODE>BddReallocateNodesInPlace()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReallocateNodes" TARGET="MAIN"><CODE>BddReallocateNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReduceBF" TARGET="MAIN"><CODE>BddReduceBF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddRelProdApply" TARGET="MAIN"><CODE>BddRelProdApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddRelProdBFAux" TARGET="MAIN"><CODE>BddRelProdBFAux()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddRelProdBFPlusDF" TARGET="MAIN"><CODE>BddRelProdBFPlusDF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddRelProdReduce" TARGET="MAIN"><CODE>BddRelProdReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddRelProdStep" TARGET="MAIN"><CODE>BddRelProdStep()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderFixAndFreeForwardingNodes" TARGET="MAIN"><CODE>BddReorderFixAndFreeForwardingNodes()</CODE></A>
+<DD> Traverses the forwarding node lists of index,
+  index+1 .. up to index+level. Frees the intermediate forwarding nodes.
+
+<DT> <A HREF="calAllDet.html#BddReorderFixForwardingNodes" TARGET="MAIN"><CODE>BddReorderFixForwardingNodes()</CODE></A>
+<DD> Fixes the forwarding nodes in a unique table.
+
+<DT> <A HREF="calAllDet.html#BddReorderFreeNodes" TARGET="MAIN"><CODE>BddReorderFreeNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderSiftAux" TARGET="MAIN"><CODE>BddReorderSiftAux()</CODE></A>
+<DD> Reorder variables using "sift" algorithm.
+
+<DT> <A HREF="calAllDet.html#BddReorderSiftToBestPos" TARGET="MAIN"><CODE>BddReorderSiftToBestPos()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderSift" TARGET="MAIN"><CODE>BddReorderSift()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderStableWindow3Aux" TARGET="MAIN"><CODE>BddReorderStableWindow3Aux()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderStableWindow3" TARGET="MAIN"><CODE>BddReorderStableWindow3()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderSwapVarIndex" TARGET="MAIN"><CODE>BddReorderSwapVarIndex()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderVarSift" TARGET="MAIN"><CODE>BddReorderVarSift()</CODE></A>
+<DD> Reorder variables using "sift" algorithm.
+
+<DT> <A HREF="calAllDet.html#BddReorderVarWindow" TARGET="MAIN"><CODE>BddReorderVarWindow()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderWindow2" TARGET="MAIN"><CODE>BddReorderWindow2()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderWindow2" TARGET="MAIN"><CODE>BddReorderWindow2()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderWindow3" TARGET="MAIN"><CODE>BddReorderWindow3()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddReorderWindow3" TARGET="MAIN"><CODE>BddReorderWindow3()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddSatisfyStep" TARGET="MAIN"><CODE>BddSatisfyStep()</CODE></A>
+<DD> Returns a BDD which implies f, is true for some valuation
+  on which f is true, and which has at most one node at each level
+
+<DT> <A HREF="calAllDet.html#BddSatisfySupportStep" TARGET="MAIN"><CODE>BddSatisfySupportStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddSatisfyingFractionStep" TARGET="MAIN"><CODE>BddSatisfyingFractionStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddSiftBlock" TARGET="MAIN"><CODE>BddSiftBlock()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddSiftPerfromPhaseIV" TARGET="MAIN"><CODE>BddSiftPerfromPhaseIV()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddSizeStep" TARGET="MAIN"><CODE>BddSizeStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BddTerminalId" TARGET="MAIN"><CODE>BddTerminalId()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddTerminalValueAux" TARGET="MAIN"><CODE>BddTerminalValueAux()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BddUndumpBddStep" TARGET="MAIN"><CODE>BddUndumpBddStep()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#BlockSizeIndex" TARGET="MAIN"><CODE>BlockSizeIndex()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#Buddy" TARGET="MAIN"><CODE>Buddy()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#BytesNeeded" TARGET="MAIN"><CODE>BytesNeeded()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#CacheTablePrint" TARGET="MAIN"><CODE>CacheTablePrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CacheTableTwoRehash" TARGET="MAIN"><CODE>CacheTableTwoRehash()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalAlignCollisionChains" TARGET="MAIN"><CODE>CalAlignCollisionChains()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalAssociationListFree" TARGET="MAIN"><CODE>CalAssociationListFree()</CODE></A>
+<DD> Frees the variable associations
+
+<DT> <A HREF="calAllDet.html#CalBddArrayPreProcessing" TARGET="MAIN"><CODE>CalBddArrayPreProcessing()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddBlockDelta" TARGET="MAIN"><CODE>CalBddBlockDelta()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddDependsOnStep" TARGET="MAIN"><CODE>CalBddDependsOnStep()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddFatalMessage" TARGET="MAIN"><CODE>CalBddFatalMessage()</CODE></A>
+<DD> Prints fatal message and exits.
+
+<DT> <A HREF="calAllDet.html#CalBddFindBlock" TARGET="MAIN"><CODE>CalBddFindBlock()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddFunctionPrint" TARGET="MAIN"><CODE>CalBddFunctionPrint()</CODE></A>
+<DD> Prints the function implemented by the argument BDD
+
+<DT> <A HREF="calAllDet.html#CalBddGetExternalBdd" TARGET="MAIN"><CODE>CalBddGetExternalBdd()</CODE></A>
+<DD> Prints fatal message and exits.
+
+<DT> <A HREF="calAllDet.html#CalBddGetInternalBdd" TARGET="MAIN"><CODE>CalBddGetInternalBdd()</CODE></A>
+<DD> Prints fatal message and exits.
+
+<DT> <A HREF="calAllDet.html#CalBddITE" TARGET="MAIN"><CODE>CalBddITE()</CODE></A>
+<DD> Returns the BDD for logical If-Then-Else
+ 
+   Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+   - f g + f' h
+
+<DT> <A HREF="calAllDet.html#CalBddIdentity" TARGET="MAIN"><CODE>CalBddIdentity()</CODE></A>
+<DD> Returns the duplicate BDD of the argument BDD.
+
+<DT> <A HREF="calAllDet.html#CalBddIf" TARGET="MAIN"><CODE>CalBddIf()</CODE></A>
+<DD> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+
+<DT> <A HREF="calAllDet.html#CalBddIsCubeStep" TARGET="MAIN"><CODE>CalBddIsCubeStep()</CODE></A>
+<DD> Returns 1 if the argument BDD is a cube, 0 otherwise
+
+<DT> <A HREF="calAllDet.html#CalBddManagerCreateNewVar" TARGET="MAIN"><CODE>CalBddManagerCreateNewVar()</CODE></A>
+<DD> This function creates and returns a new variable with given
+  index value.
+
+<DT> <A HREF="calAllDet.html#CalBddManagerGCCheck" TARGET="MAIN"><CODE>CalBddManagerGCCheck()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddManagerGetCacheTableData" TARGET="MAIN"><CODE>CalBddManagerGetCacheTableData()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddManagerPrint" TARGET="MAIN"><CODE>CalBddManagerPrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddMarkSharedNodes" TARGET="MAIN"><CODE>CalBddMarkSharedNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddNodePrint" TARGET="MAIN"><CODE>CalBddNodePrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddNumberSharedNodes" TARGET="MAIN"><CODE>CalBddNumberSharedNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddOpBF" TARGET="MAIN"><CODE>CalBddOpBF()</CODE></A>
+<DD> Internal routine to compute a logical operation on a pair of BDDs
+
+<DT> <A HREF="calAllDet.html#CalBddOpITEBF" TARGET="MAIN"><CODE>CalBddOpITEBF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddPackNodesAfterReorderForSingleId" TARGET="MAIN"><CODE>CalBddPackNodesAfterReorderForSingleId()</CODE></A>
+<DD> Packs the nodes if the variables which has just
+  been sifted.
+
+<DT> <A HREF="calAllDet.html#CalBddPackNodesForMultipleIds" TARGET="MAIN"><CODE>CalBddPackNodesForMultipleIds()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddPackNodesForSingleId" TARGET="MAIN"><CODE>CalBddPackNodesForSingleId()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddPostProcessing" TARGET="MAIN"><CODE>CalBddPostProcessing()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddPreProcessing" TARGET="MAIN"><CODE>CalBddPreProcessing()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddPrintProfileAux" TARGET="MAIN"><CODE>CalBddPrintProfileAux()</CODE></A>
+<DD> Prints a profile to the file given by fp.  The varNamingProc
+               is as in Cal_BddPrintBdd. lineLength gives the line width to scale
+               the profile to.
+
+<DT> <A HREF="calAllDet.html#CalBddPrint" TARGET="MAIN"><CODE>CalBddPrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddReorderAuxBF" TARGET="MAIN"><CODE>CalBddReorderAuxBF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddReorderAuxDF" TARGET="MAIN"><CODE>CalBddReorderAuxDF()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddReorderFixCofactors" TARGET="MAIN"><CODE>CalBddReorderFixCofactors()</CODE></A>
+<DD> Fixes the cofactors of the nodes belonging to
+  the given index.
+
+<DT> <A HREF="calAllDet.html#CalBddReorderFixProvisionalNodes" TARGET="MAIN"><CODE>CalBddReorderFixProvisionalNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddReorderFixUserBddPtrs" TARGET="MAIN"><CODE>CalBddReorderFixUserBddPtrs()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddReorderReclaimForwardedNodes" TARGET="MAIN"><CODE>CalBddReorderReclaimForwardedNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddShiftBlock" TARGET="MAIN"><CODE>CalBddShiftBlock()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddSupportStep" TARGET="MAIN"><CODE>CalBddSupportStep()</CODE></A>
+<DD> returns the support of f as a null-terminated array of variables
+
+<DT> <A HREF="calAllDet.html#CalBddTypeAux" TARGET="MAIN"><CODE>CalBddTypeAux()</CODE></A>
+<DD> Returns the BDD type by recursively traversing the argument BDD
+
+<DT> <A HREF="calAllDet.html#CalBddUniqueTableNumLockedNodes" TARGET="MAIN"><CODE>CalBddUniqueTableNumLockedNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddUnmarkNodes" TARGET="MAIN"><CODE>CalBddUnmarkNodes()</CODE></A>
+<DD> recursively unmarks the nodes
+
+<DT> <A HREF="calAllDet.html#CalBddVarName" TARGET="MAIN"><CODE>CalBddVarName()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalBddVarSubstitute" TARGET="MAIN"><CODE>CalBddVarSubstitute()</CODE></A>
+<DD> Substitute a set of variables by functions
+
+<DT> <A HREF="calAllDet.html#CalBddWarningMessage" TARGET="MAIN"><CODE>CalBddWarningMessage()</CODE></A>
+<DD> Prints warning message.
+
+<DT> <A HREF="calAllDet.html#CalBlockMemoryConsumption" TARGET="MAIN"><CODE>CalBlockMemoryConsumption()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTableMemoryConsumption" TARGET="MAIN"><CODE>CalCacheTableMemoryConsumption()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTablePrint" TARGET="MAIN"><CODE>CalCacheTablePrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTableRehash" TARGET="MAIN"><CODE>CalCacheTableRehash()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoFixResultPointers" TARGET="MAIN"><CODE>CalCacheTableTwoFixResultPointers()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoFlushAll" TARGET="MAIN"><CODE>CalCacheTableTwoFlushAll()</CODE></A>
+<DD> Free a Cache table along with the associated storage.
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoFlushAssociationId" TARGET="MAIN"><CODE>CalCacheTableTwoFlushAssociationId()</CODE></A>
+<DD> Flushes the entries from the cache which
+                      correspond to the given associationId.
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoFlush" TARGET="MAIN"><CODE>CalCacheTableTwoFlush()</CODE></A>
+<DD> Free a Cache table along with the associated storage.
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoGCFlush" TARGET="MAIN"><CODE>CalCacheTableTwoGCFlush()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoInit" TARGET="MAIN"><CODE>CalCacheTableTwoInit()</CODE></A>
+<DD> Initialize a Cache table using default parameters.
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoInsert" TARGET="MAIN"><CODE>CalCacheTableTwoInsert()</CODE></A>
+<DD> Directly insert a BDD node in the Cache table.
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoLookup" TARGET="MAIN"><CODE>CalCacheTableTwoLookup()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoQuit" TARGET="MAIN"><CODE>CalCacheTableTwoQuit()</CODE></A>
+<DD> Free a Cache table along with the associated storage.
+
+<DT> <A HREF="calAllDet.html#CalCacheTableTwoRepackUpdate" TARGET="MAIN"><CODE>CalCacheTableTwoRepackUpdate()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckAllValidity" TARGET="MAIN"><CODE>CalCheckAllValidity()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckAssociationValidity" TARGET="MAIN"><CODE>CalCheckAssociationValidity()</CODE></A>
+<DD> Checks the validity of association.
+
+<DT> <A HREF="calAllDet.html#CalCheckAssoc" TARGET="MAIN"><CODE>CalCheckAssoc()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckCacheTableValidity" TARGET="MAIN"><CODE>CalCheckCacheTableValidity()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckPipelineValidity" TARGET="MAIN"><CODE>CalCheckPipelineValidity()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckRefCountValidity" TARGET="MAIN"><CODE>CalCheckRefCountValidity()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckValidityOfANode" TARGET="MAIN"><CODE>CalCheckValidityOfANode()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckValidityOfNodesForId" TARGET="MAIN"><CODE>CalCheckValidityOfNodesForId()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalCheckValidityOfNodesForWindow" TARGET="MAIN"><CODE>CalCheckValidityOfNodesForWindow()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalComposeRequestCreate" TARGET="MAIN"><CODE>CalComposeRequestCreate()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalDecreasingOrderCompare" TARGET="MAIN"><CODE>CalDecreasingOrderCompare()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalFixupAssoc" TARGET="MAIN"><CODE>CalFixupAssoc()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalFreeBlockRecursively" TARGET="MAIN"><CODE>CalFreeBlockRecursively()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableAddDirectAux" TARGET="MAIN"><CODE>CalHashTableAddDirectAux()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableAddDirect" TARGET="MAIN"><CODE>CalHashTableAddDirect()</CODE></A>
+<DD> Directly insert a BDD node in the hash table.
+
+<DT> <A HREF="calAllDet.html#CalHashTableApply" TARGET="MAIN"><CODE>CalHashTableApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableCleanUp" TARGET="MAIN"><CODE>CalHashTableCleanUp()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableComposeApply" TARGET="MAIN"><CODE>CalHashTableComposeApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableDelete" TARGET="MAIN"><CODE>CalHashTableDelete()</CODE></A>
+<DD> Deletes a BDD node in the hash table.
+
+<DT> <A HREF="calAllDet.html#CalHashTableFindOrAdd" TARGET="MAIN"><CODE>CalHashTableFindOrAdd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableGC" TARGET="MAIN"><CODE>CalHashTableGC()</CODE></A>
+<DD> This function performs the garbage collection operation
+  for a particular index.
+
+<DT> <A HREF="calAllDet.html#CalHashTableITEApply" TARGET="MAIN"><CODE>CalHashTableITEApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableInit" TARGET="MAIN"><CODE>CalHashTableInit()</CODE></A>
+<DD> Initialize a hash table using default parameters.
+
+<DT> <A HREF="calAllDet.html#CalHashTableLookup" TARGET="MAIN"><CODE>CalHashTableLookup()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableOneInit" TARGET="MAIN"><CODE>CalHashTableOneInit()</CODE></A>
+<DD> Initialize a hash table using default parameters.
+
+<DT> <A HREF="calAllDet.html#CalHashTableOneInsert" TARGET="MAIN"><CODE>CalHashTableOneInsert()</CODE></A>
+<DD> Directly insert a BDD node in the hash table.
+
+<DT> <A HREF="calAllDet.html#CalHashTableOneLookup" TARGET="MAIN"><CODE>CalHashTableOneLookup()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableOnePrint" TARGET="MAIN"><CODE>CalHashTableOnePrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableOneQuit" TARGET="MAIN"><CODE>CalHashTableOneQuit()</CODE></A>
+<DD> Free a hash table along with the associated storage.
+
+<DT> <A HREF="calAllDet.html#CalHashTablePrint" TARGET="MAIN"><CODE>CalHashTablePrint()</CODE></A>
+<DD> Prints a hash table.
+
+<DT> <A HREF="calAllDet.html#CalHashTableQuit" TARGET="MAIN"><CODE>CalHashTableQuit()</CODE></A>
+<DD> Free a hash table along with the associated storage.
+
+<DT> <A HREF="calAllDet.html#CalHashTableReduce" TARGET="MAIN"><CODE>CalHashTableReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableRehash" TARGET="MAIN"><CODE>CalHashTableRehash()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSubstituteApply" TARGET="MAIN"><CODE>CalHashTableSubstituteApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSubstituteApply" TARGET="MAIN"><CODE>CalHashTableSubstituteApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSubstituteReduce" TARGET="MAIN"><CODE>CalHashTableSubstituteReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSubstituteReduce" TARGET="MAIN"><CODE>CalHashTableSubstituteReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSwapVarsApply" TARGET="MAIN"><CODE>CalHashTableSwapVarsApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSwapVarsMinusApply" TARGET="MAIN"><CODE>CalHashTableSwapVarsMinusApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableSwapVarsPlusApply" TARGET="MAIN"><CODE>CalHashTableSwapVarsPlusApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableThreeFindOrAdd" TARGET="MAIN"><CODE>CalHashTableThreeFindOrAdd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalHashTableThreeRehash" TARGET="MAIN"><CODE>CalHashTableThreeRehash()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalIncreasingOrderCompare" TARGET="MAIN"><CODE>CalIncreasingOrderCompare()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalInitInteract" TARGET="MAIN"><CODE>CalInitInteract()</CODE></A>
+<DD> Initializes the interaction matrix.
+
+<DT> <A HREF="calAllDet.html#CalNodeManagerInit" TARGET="MAIN"><CODE>CalNodeManagerInit()</CODE></A>
+<DD> Initializes a node manager.
+
+<DT> <A HREF="calAllDet.html#CalNodeManagerPrint" TARGET="MAIN"><CODE>CalNodeManagerPrint()</CODE></A>
+<DD> Prints address of each free node.
+
+<DT> <A HREF="calAllDet.html#CalNodeManagerQuit" TARGET="MAIN"><CODE>CalNodeManagerQuit()</CODE></A>
+<DD> Frees a node manager.
+
+<DT> <A HREF="calAllDet.html#CalOpAnd" TARGET="MAIN"><CODE>CalOpAnd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpBddVarSubstitute" TARGET="MAIN"><CODE>CalOpBddVarSubstitute()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpCofactor" TARGET="MAIN"><CODE>CalOpCofactor()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpExists" TARGET="MAIN"><CODE>CalOpExists()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpITE" TARGET="MAIN"><CODE>CalOpITE()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpNand" TARGET="MAIN"><CODE>CalOpNand()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpOr" TARGET="MAIN"><CODE>CalOpOr()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpRelProd" TARGET="MAIN"><CODE>CalOpRelProd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalOpXor" TARGET="MAIN"><CODE>CalOpXor()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalPackNodes" TARGET="MAIN"><CODE>CalPackNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalPageManagerAllocPage" TARGET="MAIN"><CODE>CalPageManagerAllocPage()</CODE></A>
+<DD> Allocs a new page.
+
+<DT> <A HREF="calAllDet.html#CalPageManagerFreePage" TARGET="MAIN"><CODE>CalPageManagerFreePage()</CODE></A>
+<DD> Free a page.
+
+<DT> <A HREF="calAllDet.html#CalPageManagerInit" TARGET="MAIN"><CODE>CalPageManagerInit()</CODE></A>
+<DD> Initializes a pageManager.
+
+<DT> <A HREF="calAllDet.html#CalPageManagerPrint" TARGET="MAIN"><CODE>CalPageManagerPrint()</CODE></A>
+<DD> Prints address of each memory segment and address of each page.
+
+<DT> <A HREF="calAllDet.html#CalPageManagerQuit" TARGET="MAIN"><CODE>CalPageManagerQuit()</CODE></A>
+<DD> Frees pageManager and associated pages.
+
+<DT> <A HREF="calAllDet.html#CalPerformaceTestSuperscalar" TARGET="MAIN"><CODE>CalPerformaceTestSuperscalar()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceMemoryOverhead" TARGET="MAIN"><CODE>CalPerformanceMemoryOverhead()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestAnd" TARGET="MAIN"><CODE>CalPerformanceTestAnd()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestCompose" TARGET="MAIN"><CODE>CalPerformanceTestCompose()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestMultiway" TARGET="MAIN"><CODE>CalPerformanceTestMultiway()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestNonSuperscalar" TARGET="MAIN"><CODE>CalPerformanceTestNonSuperscalar()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestOneway" TARGET="MAIN"><CODE>CalPerformanceTestOneway()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestQuantifyAllTogether" TARGET="MAIN"><CODE>CalPerformanceTestQuantifyAllTogether()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestRelProd" TARGET="MAIN"><CODE>CalPerformanceTestRelProd()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestSubstitute" TARGET="MAIN"><CODE>CalPerformanceTestSubstitute()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalPerformanceTestSwapVars" TARGET="MAIN"><CODE>CalPerformanceTestSwapVars()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalQuantifySanityCheck" TARGET="MAIN"><CODE>CalQuantifySanityCheck()</CODE></A>
+<DD> Performance test routine for quantify (all variables at the same
+  time).
+
+<DT> <A HREF="calAllDet.html#CalReorderAssociationFix" TARGET="MAIN"><CODE>CalReorderAssociationFix()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalRepackNodesAfterGC" TARGET="MAIN"><CODE>CalRepackNodesAfterGC()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalRequestNodeListArrayITE" TARGET="MAIN"><CODE>CalRequestNodeListArrayITE()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalRequestNodeListArrayOp" TARGET="MAIN"><CODE>CalRequestNodeListArrayOp()</CODE></A>
+<DD> Computes result BDDs for an array of lists, each entry of which 
+  is pair of pointers, each of which points to a operand BDD or an entry in
+  another list with a smaller array index
+
+<DT> <A HREF="calAllDet.html#CalRequestNodeListCompose" TARGET="MAIN"><CODE>CalRequestNodeListCompose()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalSetInteract" TARGET="MAIN"><CODE>CalSetInteract()</CODE></A>
+<DD> Set interaction matrix entries.
+
+<DT> <A HREF="calAllDet.html#CalTestInteract" TARGET="MAIN"><CODE>CalTestInteract()</CODE></A>
+<DD> Test interaction matrix entries.
+
+<DT> <A HREF="calAllDet.html#CalUniqueTableForIdFindOrAdd" TARGET="MAIN"><CODE>CalUniqueTableForIdFindOrAdd()</CODE></A>
+<DD> find or add in the unique table for id.
+
+<DT> <A HREF="calAllDet.html#CalUniqueTableForIdLookup" TARGET="MAIN"><CODE>CalUniqueTableForIdLookup()</CODE></A>
+<DD> Lookup unique table for id.
+
+<DT> <A HREF="calAllDet.html#CalUniqueTableForIdRehashNode" TARGET="MAIN"><CODE>CalUniqueTableForIdRehashNode()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalUniqueTablePrint" TARGET="MAIN"><CODE>CalUniqueTablePrint()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CalVarAssociationRepackUpdate" TARGET="MAIN"><CODE>CalVarAssociationRepackUpdate()</CODE></A>
+<DD> Need to be called after repacking.
+
+<DT> <A HREF="calAllDet.html#Cal_AssociationInit" TARGET="MAIN"><CODE>Cal_AssociationInit()</CODE></A>
+<DD> Creates or finds a variable association.
+
+<DT> <A HREF="calAllDet.html#Cal_AssociationQuit" TARGET="MAIN"><CODE>Cal_AssociationQuit()</CODE></A>
+<DD> Deletes the variable association given by id
+
+<DT> <A HREF="calAllDet.html#Cal_AssociationSetCurrent" TARGET="MAIN"><CODE>Cal_AssociationSetCurrent()</CODE></A>
+<DD> Sets the current variable association to the one given by id and
+  returns the ID of the old association.
+
+<DT> <A HREF="calAllDet.html#Cal_BddAnd" TARGET="MAIN"><CODE>Cal_BddAnd()</CODE></A>
+<DD> Returns the BDD for logical AND of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddBetween" TARGET="MAIN"><CODE>Cal_BddBetween()</CODE></A>
+<DD> Returns a minimal BDD whose function contains fMin and is
+  contained in fMax.
+
+<DT> <A HREF="calAllDet.html#Cal_BddCofactor" TARGET="MAIN"><CODE>Cal_BddCofactor()</CODE></A>
+<DD> Returns the generalized cofactor of BDD f with respect
+  to BDD c.
+
+<DT> <A HREF="calAllDet.html#Cal_BddCompose" TARGET="MAIN"><CODE>Cal_BddCompose()</CODE></A>
+<DD> composition - substitute a BDD variable by a function
+
+<DT> <A HREF="calAllDet.html#Cal_BddDependsOn" TARGET="MAIN"><CODE>Cal_BddDependsOn()</CODE></A>
+<DD> Returns 1 if f depends on var and returns 0 otherwise.
+
+<DT> <A HREF="calAllDet.html#Cal_BddDumpBdd" TARGET="MAIN"><CODE>Cal_BddDumpBdd()</CODE></A>
+<DD> Write a BDD to a file
+
+<DT> <A HREF="calAllDet.html#Cal_BddDynamicReordering" TARGET="MAIN"><CODE>Cal_BddDynamicReordering()</CODE></A>
+<DD> Specify dynamic reordering technique.
+
+<DT> <A HREF="calAllDet.html#Cal_BddElse" TARGET="MAIN"><CODE>Cal_BddElse()</CODE></A>
+<DD> Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddExists" TARGET="MAIN"><CODE>Cal_BddExists()</CODE></A>
+<DD> Returns the result of existentially quantifying some
+  variables from the given BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddForAll" TARGET="MAIN"><CODE>Cal_BddForAll()</CODE></A>
+<DD> Returns the result of universally quantifying some
+  variables from the given BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddFree" TARGET="MAIN"><CODE>Cal_BddFree()</CODE></A>
+<DD> Frees the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddFunctionPrint" TARGET="MAIN"><CODE>Cal_BddFunctionPrint()</CODE></A>
+<DD> Prints the function implemented by the argument BDD
+
+<DT> <A HREF="calAllDet.html#Cal_BddFunctionProfileMultiple" TARGET="MAIN"><CODE>Cal_BddFunctionProfileMultiple()</CODE></A>
+<DD> Returns a "function profile" for fArray.
+
+<DT> <A HREF="calAllDet.html#Cal_BddFunctionProfile" TARGET="MAIN"><CODE>Cal_BddFunctionProfile()</CODE></A>
+<DD> Returns a "function profile" for f.
+
+<DT> <A HREF="calAllDet.html#Cal_BddGetIfId" TARGET="MAIN"><CODE>Cal_BddGetIfId()</CODE></A>
+<DD> Returns the id of the top variable of the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddGetIfIndex" TARGET="MAIN"><CODE>Cal_BddGetIfIndex()</CODE></A>
+<DD> Returns the index of the top variable of the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddGetRegular" TARGET="MAIN"><CODE>Cal_BddGetRegular()</CODE></A>
+<DD> Returns a BDD with positive from a given BDD with arbitrary phase
+
+<DT> <A HREF="calAllDet.html#Cal_BddITE" TARGET="MAIN"><CODE>Cal_BddITE()</CODE></A>
+<DD> Returns the BDD for logical If-Then-Else
+
+  Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+  - f g + f' h
+
+<DT> <A HREF="calAllDet.html#Cal_BddIdentity" TARGET="MAIN"><CODE>Cal_BddIdentity()</CODE></A>
+<DD> Returns the duplicate BDD of the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIf" TARGET="MAIN"><CODE>Cal_BddIf()</CODE></A>
+<DD> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddImplies" TARGET="MAIN"><CODE>Cal_BddImplies()</CODE></A>
+<DD> Computes a BDD that implies conjunction of f and Cal_BddNot(g)
+
+<DT> <A HREF="calAllDet.html#Cal_BddIntersects" TARGET="MAIN"><CODE>Cal_BddIntersects()</CODE></A>
+<DD> Computes a BDD that implies conjunction of f and g.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsBddConst" TARGET="MAIN"><CODE>Cal_BddIsBddConst()</CODE></A>
+<DD> Returns 1 if the argument BDD is a constant, 0 otherwise.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsBddNull" TARGET="MAIN"><CODE>Cal_BddIsBddNull()</CODE></A>
+<DD> Returns 1 if the argument BDD is NULL, 0 otherwise.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsBddOne" TARGET="MAIN"><CODE>Cal_BddIsBddOne()</CODE></A>
+<DD> Returns 1 if the argument BDD is constant one, 0 otherwise.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsBddZero" TARGET="MAIN"><CODE>Cal_BddIsBddZero()</CODE></A>
+<DD> Returns 1 if the argument BDD is constant zero, 0 otherwise.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsCube" TARGET="MAIN"><CODE>Cal_BddIsCube()</CODE></A>
+<DD> Returns 1 if the argument BDD is a cube, 0 otherwise
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsEqual" TARGET="MAIN"><CODE>Cal_BddIsEqual()</CODE></A>
+<DD> Returns 1 if argument BDDs are equal, 0 otherwise.
+
+<DT> <A HREF="calAllDet.html#Cal_BddIsProvisional" TARGET="MAIN"><CODE>Cal_BddIsProvisional()</CODE></A>
+<DD> Returns 1, if the given user BDD contains
+  provisional BDD node.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarAfter" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarAfter()</CODE></A>
+<DD> Creates and returns a new variable after the specified one in
+  the variable  order.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarBefore" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarBefore()</CODE></A>
+<DD> Creates and returns a new variable before the specified one in
+  the variable order.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarFirst" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarFirst()</CODE></A>
+<DD> Creates and returns a new variable at the start of the variable
+  order.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarLast" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarLast()</CODE></A>
+<DD> Creates and returns a new variable at the end of the variable
+  order.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerGC" TARGET="MAIN"><CODE>Cal_BddManagerGC()</CODE></A>
+<DD> Invokes the garbage collection at the manager level.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerGetHooks" TARGET="MAIN"><CODE>Cal_BddManagerGetHooks()</CODE></A>
+<DD> Returns the hooks field of the manager.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerGetNumNodes" TARGET="MAIN"><CODE>Cal_BddManagerGetNumNodes()</CODE></A>
+<DD> Returns the number of BDD nodes
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerGetVarWithId" TARGET="MAIN"><CODE>Cal_BddManagerGetVarWithId()</CODE></A>
+<DD> Returns the variable with the specified id, null if no
+  such variable exists
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerGetVarWithIndex" TARGET="MAIN"><CODE>Cal_BddManagerGetVarWithIndex()</CODE></A>
+<DD> Returns the variable with the specified index, null if no
+  such variable exists
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerInit" TARGET="MAIN"><CODE>Cal_BddManagerInit()</CODE></A>
+<DD> Creates and initializes a new BDD manager.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerQuit" TARGET="MAIN"><CODE>Cal_BddManagerQuit()</CODE></A>
+<DD> Frees the BDD manager and all the associated allocations
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerSetGCLimit" TARGET="MAIN"><CODE>Cal_BddManagerSetGCLimit()</CODE></A>
+<DD> Sets the limit of the garbage collection.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerSetHooks" TARGET="MAIN"><CODE>Cal_BddManagerSetHooks()</CODE></A>
+<DD> Sets the hooks field of the manager.
+
+<DT> <A HREF="calAllDet.html#Cal_BddManagerSetParameters" TARGET="MAIN"><CODE>Cal_BddManagerSetParameters()</CODE></A>
+<DD> Sets appropriate fields of BDD Manager.
+
+<DT> <A HREF="calAllDet.html#Cal_BddMultiwayAnd" TARGET="MAIN"><CODE>Cal_BddMultiwayAnd()</CODE></A>
+<DD> Returns the BDD for logical AND of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddMultiwayOr" TARGET="MAIN"><CODE>Cal_BddMultiwayOr()</CODE></A>
+<DD> Returns the BDD for logical OR of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddMultiwayXor" TARGET="MAIN"><CODE>Cal_BddMultiwayXor()</CODE></A>
+<DD> Returns the BDD for logical XOR of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddNand" TARGET="MAIN"><CODE>Cal_BddNand()</CODE></A>
+<DD> Returns the BDD for logical NAND of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddNewVarBlock" TARGET="MAIN"><CODE>Cal_BddNewVarBlock()</CODE></A>
+<DD> Creates and returns a variable block used for
+  controlling dynamic reordering.
+
+<DT> <A HREF="calAllDet.html#Cal_BddNodeLimit" TARGET="MAIN"><CODE>Cal_BddNodeLimit()</CODE></A>
+<DD> Sets the node limit to new_limit and returns the old limit.
+
+<DT> <A HREF="calAllDet.html#Cal_BddNor" TARGET="MAIN"><CODE>Cal_BddNor()</CODE></A>
+<DD> Returns the BDD for logical NOR of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddNot" TARGET="MAIN"><CODE>Cal_BddNot()</CODE></A>
+<DD> Returns the complement of the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddOne" TARGET="MAIN"><CODE>Cal_BddOne()</CODE></A>
+<DD> Returns the BDD for the constant one
+
+<DT> <A HREF="calAllDet.html#Cal_BddOr" TARGET="MAIN"><CODE>Cal_BddOr()</CODE></A>
+<DD> Returns the BDD for logical OR of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddOverflow" TARGET="MAIN"><CODE>Cal_BddOverflow()</CODE></A>
+<DD> Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.
+
+<DT> <A HREF="calAllDet.html#Cal_BddPairwiseAnd" TARGET="MAIN"><CODE>Cal_BddPairwiseAnd()</CODE></A>
+<DD> Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+<DT> <A HREF="calAllDet.html#Cal_BddPairwiseOr" TARGET="MAIN"><CODE>Cal_BddPairwiseOr()</CODE></A>
+<DD> Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+<DT> <A HREF="calAllDet.html#Cal_BddPairwiseXor" TARGET="MAIN"><CODE>Cal_BddPairwiseXor()</CODE></A>
+<DD> Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+<DT> <A HREF="calAllDet.html#Cal_BddPrintBdd" TARGET="MAIN"><CODE>Cal_BddPrintBdd()</CODE></A>
+<DD> Prints a BDD in the human readable form.
+
+<DT> <A HREF="calAllDet.html#Cal_BddPrintFunctionProfileMultiple" TARGET="MAIN"><CODE>Cal_BddPrintFunctionProfileMultiple()</CODE></A>
+<DD> Cal_BddPrintFunctionProfileMultiple is like
+               Cal_BddPrintFunctionProfile except for multiple BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddPrintFunctionProfile" TARGET="MAIN"><CODE>Cal_BddPrintFunctionProfile()</CODE></A>
+<DD> Cal_BddPrintFunctionProfile is like Cal_BddPrintProfile except
+               it displays a function profile for f
+
+<DT> <A HREF="calAllDet.html#Cal_BddPrintProfileMultiple" TARGET="MAIN"><CODE>Cal_BddPrintProfileMultiple()</CODE></A>
+<DD> Cal_BddPrintProfileMultiple is like Cal_BddPrintProfile except
+               it displays the profile for a set of BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddPrintProfile" TARGET="MAIN"><CODE>Cal_BddPrintProfile()</CODE></A>
+<DD> Displays the node profile for f on fp. lineLength specifies 
+               the maximum line length.  varNamingFn is as in
+               Cal_BddPrintBdd.
+
+<DT> <A HREF="calAllDet.html#Cal_BddProfileMultiple" TARGET="MAIN"><CODE>Cal_BddProfileMultiple()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#Cal_BddProfile" TARGET="MAIN"><CODE>Cal_BddProfile()</CODE></A>
+<DD> Returns a "node profile" of f, i.e., the number of nodes at each
+  level in f.
+
+<DT> <A HREF="calAllDet.html#Cal_BddReduce" TARGET="MAIN"><CODE>Cal_BddReduce()</CODE></A>
+<DD> Returns a BDD which agrees with f for all valuations
+  which satisfy c.
+
+<DT> <A HREF="calAllDet.html#Cal_BddRelProd" TARGET="MAIN"><CODE>Cal_BddRelProd()</CODE></A>
+<DD> Returns the result of taking the logical AND of the
+  argument BDDs and existentially quantifying some variables from the
+  product.
+
+<DT> <A HREF="calAllDet.html#Cal_BddReorder" TARGET="MAIN"><CODE>Cal_BddReorder()</CODE></A>
+<DD> Invoke the current dynamic reodering method.
+
+<DT> <A HREF="calAllDet.html#Cal_BddSatisfySupport" TARGET="MAIN"><CODE>Cal_BddSatisfySupport()</CODE></A>
+<DD> Returns a special cube contained in f.
+
+<DT> <A HREF="calAllDet.html#Cal_BddSatisfyingFraction" TARGET="MAIN"><CODE>Cal_BddSatisfyingFraction()</CODE></A>
+<DD> Returns the fraction of valuations which make f true. (Note that
+  this fraction is independent of whatever set of variables f is supposed to be
+  a function of)
+
+<DT> <A HREF="calAllDet.html#Cal_BddSatisfy" TARGET="MAIN"><CODE>Cal_BddSatisfy()</CODE></A>
+<DD> Returns a BDD which implies f, true for
+               some valuation on which f is true, and which has at most
+               one node at each level
+
+<DT> <A HREF="calAllDet.html#Cal_BddSetGCMode" TARGET="MAIN"><CODE>Cal_BddSetGCMode()</CODE></A>
+<DD> Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.
+
+<DT> <A HREF="calAllDet.html#Cal_BddSizeMultiple" TARGET="MAIN"><CODE>Cal_BddSizeMultiple()</CODE></A>
+<DD> The routine is like Cal_BddSize, but takes a null-terminated
+               array of BDDs and accounts for sharing of nodes.
+
+<DT> <A HREF="calAllDet.html#Cal_BddSize" TARGET="MAIN"><CODE>Cal_BddSize()</CODE></A>
+<DD> Returns the number of nodes in f when negout is nonzero. If
+  negout is zero, we pretend that the BDDs don't have negative-output pointers.
+
+<DT> <A HREF="calAllDet.html#Cal_BddStats" TARGET="MAIN"><CODE>Cal_BddStats()</CODE></A>
+<DD> Prints miscellaneous BDD statistics
+
+<DT> <A HREF="calAllDet.html#Cal_BddSubstitute" TARGET="MAIN"><CODE>Cal_BddSubstitute()</CODE></A>
+<DD> Substitute a set of variables by functions
+
+<DT> <A HREF="calAllDet.html#Cal_BddSupport" TARGET="MAIN"><CODE>Cal_BddSupport()</CODE></A>
+<DD> returns the support of f as a null-terminated array of variables
+
+<DT> <A HREF="calAllDet.html#Cal_BddSwapVars" TARGET="MAIN"><CODE>Cal_BddSwapVars()</CODE></A>
+<DD> Return a function obtained by swapping two variables
+
+<DT> <A HREF="calAllDet.html#Cal_BddThen" TARGET="MAIN"><CODE>Cal_BddThen()</CODE></A>
+<DD> Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddTotalSize" TARGET="MAIN"><CODE>Cal_BddTotalSize()</CODE></A>
+<DD> Returns the number of nodes in the Unique table
+
+<DT> <A HREF="calAllDet.html#Cal_BddType" TARGET="MAIN"><CODE>Cal_BddType()</CODE></A>
+<DD> Returns type of a BDD ( 0, 1, +var, -var, ovrflow, nonterminal)
+
+<DT> <A HREF="calAllDet.html#Cal_BddUnFree" TARGET="MAIN"><CODE>Cal_BddUnFree()</CODE></A>
+<DD> Unfrees the argument BDD.
+
+<DT> <A HREF="calAllDet.html#Cal_BddUndumpBdd" TARGET="MAIN"><CODE>Cal_BddUndumpBdd()</CODE></A>
+<DD> Reads a BDD from a file
+
+<DT> <A HREF="calAllDet.html#Cal_BddVarBlockReorderable" TARGET="MAIN"><CODE>Cal_BddVarBlockReorderable()</CODE></A>
+<DD> Sets the reoderability of a particular block.
+
+<DT> <A HREF="calAllDet.html#Cal_BddVarSubstitute" TARGET="MAIN"><CODE>Cal_BddVarSubstitute()</CODE></A>
+<DD> Substitute a set of variables by set of another variables.
+
+<DT> <A HREF="calAllDet.html#Cal_BddVars" TARGET="MAIN"><CODE>Cal_BddVars()</CODE></A>
+<DD> Returns the number of BDD variables
+
+<DT> <A HREF="calAllDet.html#Cal_BddXnor" TARGET="MAIN"><CODE>Cal_BddXnor()</CODE></A>
+<DD> Returns the BDD for logical exclusive NOR of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddXor" TARGET="MAIN"><CODE>Cal_BddXor()</CODE></A>
+<DD> Returns the BDD for logical exclusive OR of argument BDDs
+
+<DT> <A HREF="calAllDet.html#Cal_BddZero" TARGET="MAIN"><CODE>Cal_BddZero()</CODE></A>
+<DD> Returns the BDD for the constant zero
+
+<DT> <A HREF="calAllDet.html#Cal_MemAllocation" TARGET="MAIN"><CODE>Cal_MemAllocation()</CODE></A>
+<DD> Returns the memory allocated.
+
+<DT> <A HREF="calAllDet.html#Cal_MemFatal" TARGET="MAIN"><CODE>Cal_MemFatal()</CODE></A>
+<DD> Prints an error message and exits.
+
+<DT> <A HREF="calAllDet.html#Cal_MemFreeBlock" TARGET="MAIN"><CODE>Cal_MemFreeBlock()</CODE></A>
+<DD> Frees the block.
+
+<DT> <A HREF="calAllDet.html#Cal_MemFreeRecMgr" TARGET="MAIN"><CODE>Cal_MemFreeRecMgr()</CODE></A>
+<DD> Frees all the storage associated with the specified record manager.
+
+<DT> <A HREF="calAllDet.html#Cal_MemFreeRec" TARGET="MAIN"><CODE>Cal_MemFreeRec()</CODE></A>
+<DD> Frees a record managed by the indicated record manager.
+
+<DT> <A HREF="calAllDet.html#Cal_MemGetBlock" TARGET="MAIN"><CODE>Cal_MemGetBlock()</CODE></A>
+<DD> Allocates a new block of the specified size.
+
+<DT> <A HREF="calAllDet.html#Cal_MemNewRecMgr" TARGET="MAIN"><CODE>Cal_MemNewRecMgr()</CODE></A>
+<DD> Creates a new record manager with the given  record size.
+
+<DT> <A HREF="calAllDet.html#Cal_MemNewRec" TARGET="MAIN"><CODE>Cal_MemNewRec()</CODE></A>
+<DD> Allocates a record from the specified record manager.
+
+<DT> <A HREF="calAllDet.html#Cal_MemResizeBlock" TARGET="MAIN"><CODE>Cal_MemResizeBlock()</CODE></A>
+<DD> Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible.
+
+<DT> <A HREF="calAllDet.html#Cal_PerformanceTest" TARGET="MAIN"><CODE>Cal_PerformanceTest()</CODE></A>
+<DD> Main routine for testing performances of various routines.
+
+<DT> <A HREF="calAllDet.html#Cal_PipelineCreateProvisionalBdd" TARGET="MAIN"><CODE>Cal_PipelineCreateProvisionalBdd()</CODE></A>
+<DD> Create a provisional BDD in the pipeline.
+
+<DT> <A HREF="calAllDet.html#Cal_PipelineExecute" TARGET="MAIN"><CODE>Cal_PipelineExecute()</CODE></A>
+<DD> Executes a pipeline.
+
+<DT> <A HREF="calAllDet.html#Cal_PipelineInit" TARGET="MAIN"><CODE>Cal_PipelineInit()</CODE></A>
+<DD> Initialize a BDD pipeline.
+
+<DT> <A HREF="calAllDet.html#Cal_PipelineQuit" TARGET="MAIN"><CODE>Cal_PipelineQuit()</CODE></A>
+<DD> Resets the pipeline freeing all resources.
+
+<DT> <A HREF="calAllDet.html#Cal_PipelineSetDepth" TARGET="MAIN"><CODE>Cal_PipelineSetDepth()</CODE></A>
+<DD> Set depth of a BDD pipeline.
+
+<DT> <A HREF="calAllDet.html#Cal_PipelineUpdateProvisionalBdd" TARGET="MAIN"><CODE>Cal_PipelineUpdateProvisionalBdd()</CODE></A>
+<DD> Update a provisional Bdd obtained during pipelining.
+
+<DT> <A HREF="calAllDet.html#Cal_TempAssociationAugment" TARGET="MAIN"><CODE>Cal_TempAssociationAugment()</CODE></A>
+<DD> Adds to the temporary variable association.
+
+<DT> <A HREF="calAllDet.html#Cal_TempAssociationInit" TARGET="MAIN"><CODE>Cal_TempAssociationInit()</CODE></A>
+<DD> Sets the temporary variable association.
+
+<DT> <A HREF="calAllDet.html#Cal_TempAssociationQuit" TARGET="MAIN"><CODE>Cal_TempAssociationQuit()</CODE></A>
+<DD> Cleans up temporary association
+
+<DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+<DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+<DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+<DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+<DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+<DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+<DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+<DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+<DT> <A HREF="calAllDet.html#CeilingLog2" TARGET="MAIN"><CODE>CeilingLog2()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#Chars" TARGET="MAIN"><CODE>Chars()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CheckAssoc" TARGET="MAIN"><CODE>CheckAssoc()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CheckValidityOfNodes" TARGET="MAIN"><CODE>CheckValidityOfNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#CofactorFixAndReclaimForwardedNodes" TARGET="MAIN"><CODE>CofactorFixAndReclaimForwardedNodes()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#Cofactor" TARGET="MAIN"><CODE>Cofactor()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#Decode" TARGET="MAIN"><CODE>Decode()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#Error" TARGET="MAIN"><CODE>Error()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#GetRandomNumbers" TARGET="MAIN"><CODE>GetRandomNumbers()</CODE></A>
+<DD> Generates "count" many random numbers ranging between
+  "lowerBound" and "upperBound".
+
+<DT> <A HREF="calAllDet.html#HashTableAddDirect" TARGET="MAIN"><CODE>HashTableAddDirect()</CODE></A>
+<DD> Directly insert a BDD node in the hash table.
+
+<DT> <A HREF="calAllDet.html#HashTableApply" TARGET="MAIN"><CODE>HashTableApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#HashTableCofactorApply" TARGET="MAIN"><CODE>HashTableCofactorApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#HashTableCofactorReduce" TARGET="MAIN"><CODE>HashTableCofactorReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#HashTableFindOrAdd" TARGET="MAIN"><CODE>HashTableFindOrAdd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#HashTableOneRehash" TARGET="MAIN"><CODE>HashTableOneRehash()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#HashTableReduceApply" TARGET="MAIN"><CODE>HashTableReduceApply()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#HashTableReduce" TARGET="MAIN"><CODE>HashTableReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#IndexCmp" TARGET="MAIN"><CODE>IndexCmp()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#MergeAndFree" TARGET="MAIN"><CODE>MergeAndFree()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#PageAlign" TARGET="MAIN"><CODE>PageAlign()</CODE></A>
+<DD> Return page aligned address greater than or equal to
+  the pointer.
+
+<DT> <A HREF="calAllDet.html#PageManagerExpandStorage" TARGET="MAIN"><CODE>PageManagerExpandStorage()</CODE></A>
+<DD> Allocates a segment of memory to expand the storage managed by
+              pageManager. The allocated segment is divided into free pages
+              which are linked as a freePageList.
+
+<DT> <A HREF="calAllDet.html#PrintBddProfileAfterReorder" TARGET="MAIN"><CODE>PrintBddProfileAfterReorder()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#PrintBdd" TARGET="MAIN"><CODE>PrintBdd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#RandomTests" TARGET="MAIN"><CODE>RandomTests()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#Read" TARGET="MAIN"><CODE>Read()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#RemoveFromFreeList" TARGET="MAIN"><CODE>RemoveFromFreeList()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#SegmentToPageList" TARGET="MAIN"><CODE>SegmentToPageList()</CODE></A>
+<DD> Converts a memory segment into a linked list of pages.
+              if p is a pointer to a page, *p contains address of the next page
+              if p is a pointer to the last page, *p contains lastPointer.
+
+<DT> <A HREF="calAllDet.html#SweepVarTable" TARGET="MAIN"><CODE>SweepVarTable()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestAnd" TARGET="MAIN"><CODE>TestAnd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestArrayOp" TARGET="MAIN"><CODE>TestArrayOp()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestAssoc" TARGET="MAIN"><CODE>TestAssoc()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestCompose" TARGET="MAIN"><CODE>TestCompose()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestDump" TARGET="MAIN"><CODE>TestDump()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestGenCof" TARGET="MAIN"><CODE>TestGenCof()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestITE" TARGET="MAIN"><CODE>TestITE()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestIdNot" TARGET="MAIN"><CODE>TestIdNot()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestInterImpl" TARGET="MAIN"><CODE>TestInterImpl()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestMultiwayAnd" TARGET="MAIN"><CODE>TestMultiwayAnd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestMultiwayLarge" TARGET="MAIN"><CODE>TestMultiwayLarge()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestMultiwayOr" TARGET="MAIN"><CODE>TestMultiwayOr()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestNand" TARGET="MAIN"><CODE>TestNand()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestOr" TARGET="MAIN"><CODE>TestOr()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestPipeline" TARGET="MAIN"><CODE>TestPipeline()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestQnt" TARGET="MAIN"><CODE>TestQnt()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestReduce" TARGET="MAIN"><CODE>TestReduce()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestRelProd" TARGET="MAIN"><CODE>TestRelProd()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestReorderBlock" TARGET="MAIN"><CODE>TestReorderBlock()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestReorder" TARGET="MAIN"><CODE>TestReorder()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestSatisfy" TARGET="MAIN"><CODE>TestSatisfy()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestSize" TARGET="MAIN"><CODE>TestSize()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestSubstitute" TARGET="MAIN"><CODE>TestSubstitute()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestSwapVars" TARGET="MAIN"><CODE>TestSwapVars()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestVarSubstitute" TARGET="MAIN"><CODE>TestVarSubstitute()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TestXor" TARGET="MAIN"><CODE>TestXor()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#TrimToSize" TARGET="MAIN"><CODE>TrimToSize()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#UniqueTableForIdFindOrAdd" TARGET="MAIN"><CODE>UniqueTableForIdFindOrAdd()</CODE></A>
+<DD> find or add in the unique table for id.
+
+<DT> <A HREF="calAllDet.html#Write" TARGET="MAIN"><CODE>Write()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#asAddress" TARGET="MAIN"><CODE>asAddress()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#asDouble" TARGET="MAIN"><CODE>asDouble()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#chars" TARGET="MAIN"><CODE>chars()</CODE></A>
+<DD> 
+
+<DT> <A HREF="calAllDet.html#cpuTime" TARGET="MAIN"><CODE>cpuTime()</CODE></A>
+<DD> Computes the number of page faults.
+
+<DT> <A HREF="calAllDet.html#cpuTime" TARGET="MAIN"><CODE>cpuTime()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#ddClearLocal" TARGET="MAIN"><CODE>ddClearLocal()</CODE></A>
+<DD> Performs a DFS from f, clearing the LSB of the then pointers.
+
+<DT> <A HREF="calAllDet.html#ddSuppInteract" TARGET="MAIN"><CODE>ddSuppInteract()</CODE></A>
+<DD> Find the support of f.
+
+<DT> <A HREF="calAllDet.html#ddUpdateInteract" TARGET="MAIN"><CODE>ddUpdateInteract()</CODE></A>
+<DD> Marks as interacting all pairs of variables that appear in
+  support.
+
+<DT> <A HREF="calAllDet.html#elapsedTime" TARGET="MAIN"><CODE>elapsedTime()</CODE></A>
+<DD> Computes the time.
+
+<DT> <A HREF="calAllDet.html#elapsedTime" TARGET="MAIN"><CODE>elapsedTime()</CODE></A>
+<DD> Computes the time.
+
+<DT> <A HREF="calAllDet.html#handler" TARGET="MAIN"><CODE>handler()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#main" TARGET="MAIN"><CODE>main()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#main" TARGET="MAIN"><CODE>main()</CODE></A>
+<DD> required
+
+<DT> <A HREF="calAllDet.html#pageFaults" TARGET="MAIN"><CODE>pageFaults()</CODE></A>
+<DD> Computes the number of page faults.
+
+<DT> <A HREF="calAllDet.html#terminalIdFn" TARGET="MAIN"><CODE>terminalIdFn()</CODE></A>
+<DD> required
+
+</DL>
+
+<HR>
+
+Last updated on 970711 20h11
+</BODY></HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calAllByFile.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calAllByFile.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calAllByFile.html	(revision 6)
@@ -0,0 +1,13 @@
+<HTML>
+<HEAD><TITLE>The cal package for maintainers</TITLE></HEAD>
+
+<FRAMESET ROWS="5%,90%,5%">
+  <FRAME SRC="calTitle.html">
+  <FRAMESET COLS="40%,60%">
+    <FRAME SRC="calAllFile.html" NAME="ABSTRACT">
+    <FRAME SRC="calAllDet.html" NAME="MAIN">
+  </FRAMESET>
+  <FRAME SRC="credit.html">
+</FRAMESET>
+
+</HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calAllByFunc.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calAllByFunc.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calAllByFunc.html	(revision 6)
@@ -0,0 +1,13 @@
+<HTML>
+<HEAD><TITLE>The cal package for maintainers</TITLE></HEAD>
+
+<FRAMESET ROWS="5%,90%,5%">
+  <FRAME SRC="calTitle.html">
+  <FRAMESET COLS="40%,60%">
+    <FRAME SRC="calAllAbs.html" NAME="ABSTRACT">
+    <FRAME SRC="calAllDet.html" NAME="MAIN">
+  </FRAMESET>
+  <FRAME SRC="credit.html">
+</FRAMESET>
+
+</HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calAllDet.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calAllDet.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calAllDet.html	(revision 6)
@@ -0,0 +1,7870 @@
+<html>
+<head><title>The cal package: all functions </title></head>
+<body>
+
+
+<HR>
+<DL>
+<dt><pre>
+<A NAME="AddBlock"></A>
+static void <I></I>
+<B>AddBlock</B>(
+  Cal_Block  <b>b1</b>, <i></i>
+  Cal_Block  <b>b2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="AddToFreeList"></A>
+static void <I></I>
+<B>AddToFreeList</B>(
+  Block  <b>b</b> <i></i>
+)
+</pre>
+<dd> AddToFreeList(b) adds b to the appropriate free list.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="AssociationIsEqual"></A>
+static int <I></I>
+<B>AssociationIsEqual</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t * <b>p</b>, <i></i>
+  Cal_Bdd_t * <b>q</b> <i></i>
+)
+</pre>
+<dd> Checks for equality of two associations
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddAddInternalReferences"></A>
+static void <I></I>
+<B>BddAddInternalReferences</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddArrayOpBF"></A>
+static Cal_Bdd_t * <I></I>
+<B>BddArrayOpBF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t* <b>bddArray</b>, <i></i>
+  int  <b>numFunction</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b> <i></i>
+)
+</pre>
+<dd> Internal common routine for Cal_BddPairwiseAnd and Cal_BddPairwiseOr
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddArrayToRequestNodeListArray"></A>
+static void <I></I>
+<B>BddArrayToRequestNodeListArray</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t * <b>calBddArray</b>, <i></i>
+  int  <b>numBdds</b> <i></i>
+)
+</pre>
+<dd> Converts an array of BDDs to a list of requests representing BDD
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddCofactorBF"></A>
+static Cal_Bdd_t <I></I>
+<B>BddCofactorBF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>c</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddConvertDataStructBack"></A>
+static void <I></I>
+<B>BddConvertDataStructBack</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Data structure conversion: thenBddId -> id 
+  elseBddId -> ref count
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddConvertDataStruct"></A>
+static void <I></I>
+<B>BddConvertDataStruct</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> New data structure: thenBddId -> id 
+                                          elseBddId -> ref count
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddCountNoNodes"></A>
+static int <I></I>
+<B>BddCountNoNodes</B>(
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddCountNodes"></A>
+static int <I></I>
+<B>BddCountNodes</B>(
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddDFStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddDFStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b>, <i></i>
+  unsigned short  <b>opCode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddDefaultTransformFn"></A>
+static void <I></I>
+<B>BddDefaultTransformFn</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalAddress_t  <b>value1</b>, <i></i>
+  CalAddress_t  <b>value2</b>, <i></i>
+  CalAddress_t * <b>result1</b>, <i></i>
+  CalAddress_t * <b>result2</b>, <i></i>
+  Cal_Pointer_t  <b>pointer</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddDominatedStep"></A>
+static void <I></I>
+<B>BddDominatedStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  long * <b>funcCounts</b>, <i></i>
+  CalHashTable_t * <b>h</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddDumpBddStep"></A>
+static void <I></I>
+<B>BddDumpBddStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  FILE * <b>fp</b>, <i></i>
+  CalHashTable_t * <b>h</b>, <i></i>
+  Cal_BddIndex_t * <b>normalizedIndexes</b>, <i></i>
+  int  <b>indexSize</b>, <i></i>
+  int  <b>nodeNumberSize</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExchangeAux"></A>
+static void <I></I>
+<B>BddExchangeAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalBddNode_t * <b>f</b>, <i></i>
+  int  <b>id</b>, <i></i>
+  int  <b>nextId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExchangeVarBlocks"></A>
+static void <I></I>
+<B>BddExchangeVarBlocks</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>parent</b>, <i></i>
+  long  <b>blockIndex</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExchange"></A>
+static void <I></I>
+<B>BddExchange</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  long  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExistsApply"></A>
+static void <I></I>
+<B>BddExistsApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>quantifying</b>, <i></i>
+  CalHashTable_t * <b>existHashTable</b>, <i></i>
+  CalHashTable_t ** <b>existHashTableArray</b>, <i></i>
+  CalOpProc1_t  <b>calOpProc</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExistsBFAux"></A>
+static void <I></I>
+<B>BddExistsBFAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>minIndex</b>, <i></i>
+  CalHashTable_t ** <b>existHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>orHashTableArray</b>, <i></i>
+  CalOpProc1_t  <b>calOpProc</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExistsBFPlusDF"></A>
+static Cal_Bdd_t <I></I>
+<B>BddExistsBFPlusDF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>association</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExistsReduce"></A>
+static void <I></I>
+<B>BddExistsReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>existHashTable</b>, <i></i>
+  CalHashTable_t ** <b>existHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>orHashTableArray</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>association</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddExistsStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddExistsStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>association</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddHighestRefStep"></A>
+static void <I></I>
+<B>BddHighestRefStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  CalHashTable_t * <b>h</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddIntersectsStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddIntersectsStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b> <i></i>
+)
+</pre>
+<dd> Recursive routine to returns a BDD that implies conjunction of
+  argument BDDs
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddMarkBdd"></A>
+static void <I></I>
+<B>BddMarkBdd</B>(
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddMultiwayOp"></A>
+static Cal_Bdd_t <I></I>
+<B>BddMultiwayOp</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t * <b>calBddArray</b>, <i></i>
+  int  <b>numBdds</b>, <i></i>
+  CalOpProc_t  <b>op</b> <i></i>
+)
+</pre>
+<dd> Internal routine for multiway operations
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddNukeInternalReferences"></A>
+static void <I></I>
+<B>BddNukeInternalReferences</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddPrintBddStep"></A>
+static void <I></I>
+<B>BddPrintBddStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_VarNamingFn_t  <b>VarNamingFn</b>, <i></i>
+  Cal_TerminalIdFn_t  <b>TerminalIdFn</b>, <i></i>
+  Cal_Pointer_t  <b>env</b>, <i></i>
+  FILE * <b>fp</b>, <i></i>
+  CalHashTable_t* <b>hashTable</b>, <i></i>
+  int  <b>indentation</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddPrintTopVar"></A>
+static void <I></I>
+<B>BddPrintTopVar</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_VarNamingFn_t  <b>VarNamingFn</b>, <i></i>
+  Cal_Pointer_t  <b>env</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddProfileStep"></A>
+static void <I></I>
+<B>BddProfileStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  long * <b>levelCounts</b>, <i></i>
+  CountFn_t  <b>countFn</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReallocateNodesInPlace"></A>
+static void <I></I>
+<B>BddReallocateNodesInPlace</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReallocateNodes"></A>
+static void <I></I>
+<B>BddReallocateNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReduceBF"></A>
+static Cal_Bdd_t <I></I>
+<B>BddReduceBF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>c</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddRelProdApply"></A>
+static void <I></I>
+<B>BddRelProdApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>quantifying</b>, <i></i>
+  CalHashTable_t * <b>relProdHashTable</b>, <i></i>
+  CalHashTable_t ** <b>relProdHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>andHashTableArray</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddRelProdBFAux"></A>
+static void <I></I>
+<B>BddRelProdBFAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>minIndex</b>, <i></i>
+  CalHashTable_t ** <b>relProdHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>andHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>orHashTableArray</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddRelProdBFPlusDF"></A>
+static Cal_Bdd_t <I></I>
+<B>BddRelProdBFPlusDF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>association</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddRelProdReduce"></A>
+static void <I></I>
+<B>BddRelProdReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>relProdHashTable</b>, <i></i>
+  CalHashTable_t ** <b>relProdHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>andHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>orHashTableArray</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddRelProdStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddRelProdStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderFixAndFreeForwardingNodes"></A>
+static void <I></I>
+<B>BddReorderFixAndFreeForwardingNodes</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b>, <i></i>
+  int  <b>numLevels</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderFixForwardingNodes"></A>
+static void <I></I>
+<B>BddReorderFixForwardingNodes</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b> <i></i>
+)
+</pre>
+<dd> As opposed to CalBddReorderFixCofactors, which fixes
+  the cofactors of the non-forwarding nodes, this routine traverses
+  the list of forwarding nodes and removes the intermediate level of
+  forwarding. Number of levels should be 1 or 2.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderFreeNodes"></A>
+static void <I></I>
+<B>BddReorderFreeNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>varId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderSiftAux"></A>
+static void <I></I>
+<B>BddReorderSiftAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  Cal_Block * <b>toSift</b>, <i></i>
+  double  <b>maxSizeFactor</b> <i></i>
+)
+</pre>
+<dd> Reorder variables using "sift" algorithm.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderSiftToBestPos"></A>
+static int <I></I>
+<B>BddReorderSiftToBestPos</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>varStartIndex</b>, <i></i>
+  double  <b>maxSizeFactor</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderSift"></A>
+static void <I></I>
+<B>BddReorderSift</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  double  <b>maxSizeFactor</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderStableWindow3Aux"></A>
+static void <I></I>
+<B>BddReorderStableWindow3Aux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  char * <b>levels</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderStableWindow3"></A>
+static void <I></I>
+<B>BddReorderStableWindow3</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderSwapVarIndex"></A>
+static void <I></I>
+<B>BddReorderSwapVarIndex</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>varIndex</b>, <i></i>
+  int  <b>forwardCheckFlag</b> <i></i>
+)
+</pre>
+<dd> Traversesoptional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderVarSift"></A>
+static void <I></I>
+<B>BddReorderVarSift</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  double  <b>maxSizeFactor</b> <i></i>
+)
+</pre>
+<dd> Reorder variables using "sift" algorithm.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderVarWindow"></A>
+static void <I></I>
+<B>BddReorderVarWindow</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  char * <b>levels</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderWindow2"></A>
+static int <I></I>
+<B>BddReorderWindow2</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  long  <b>index</b>, <i></i>
+  int  <b>directionFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderWindow2"></A>
+static int <I></I>
+<B>BddReorderWindow2</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  long  <b>i</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderWindow3"></A>
+static int <I></I>
+<B>BddReorderWindow3</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  long  <b>index</b>, <i></i>
+  int  <b>directionFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddReorderWindow3"></A>
+static int <I></I>
+<B>BddReorderWindow3</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  long  <b>i</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddSatisfyStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddSatisfyStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddSatisfySupportStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddSatisfySupportStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_BddId_t * <b>support</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddSatisfyingFractionStep"></A>
+static double <I></I>
+<B>BddSatisfyingFractionStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddSiftBlock"></A>
+static void <I></I>
+<B>BddSiftBlock</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  long  <b>startPosition</b>, <i></i>
+  double  <b>maxSizeFactor</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddSiftPerfromPhaseIV"></A>
+static void <I></I>
+<B>BddSiftPerfromPhaseIV</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>varStartIndex</b>, <i></i>
+  int  <b>bestIndex</b>, <i></i>
+  int  <b>bottomMostSwapIndex</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddSizeStep"></A>
+static long <I></I>
+<B>BddSizeStep</B>(
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  CountFn_t  <b>countFn</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddTerminalId"></A>
+static char * <I></I>
+<B>BddTerminalId</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_TerminalIdFn_t  <b>TerminalIdFn</b>, <i></i>
+  Cal_Pointer_t  <b>env</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddTerminalValueAux"></A>
+static void <I></I>
+<B>BddTerminalValueAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  CalAddress_t * <b>value1</b>, <i></i>
+  CalAddress_t * <b>value2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="BddUndumpBddStep"></A>
+static Cal_Bdd_t <I></I>
+<B>BddUndumpBddStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t * <b>vars</b>, <i></i>
+  FILE * <b>fp</b>, <i></i>
+  Cal_BddIndex_t  <b>numberVars</b>, <i></i>
+  Cal_Bdd_t * <b>shared</b>, <i></i>
+  long  <b>numberShared</b>, <i></i>
+  long * <b>sharedSoFar</b>, <i></i>
+  int  <b>indexSize</b>, <i></i>
+  int  <b>nodeNumberSize</b>, <i></i>
+  int * <b>error</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="BlockSizeIndex"></A>
+static int <I></I>
+<B>BlockSizeIndex</B>(
+  Cal_Address_t  <b>size</b> <i></i>
+)
+</pre>
+<dd> BlockSizeIndex(size) return the coded size for a block.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Buddy"></A>
+static Block <I></I>
+<B>Buddy</B>(
+  Block  <b>b</b> <i></i>
+)
+</pre>
+<dd> Buddy(b) returns the Buddy block of b, or null if there is no  Buddy.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="BytesNeeded"></A>
+static int <I></I>
+<B>BytesNeeded</B>(
+  long  <b>n</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="CacheTablePrint"></A>
+static void <I></I>
+<B>CacheTablePrint</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CacheTableTwoRehash"></A>
+static void <I></I>
+<B>CacheTableTwoRehash</B>(
+  CalCacheTable_t * <b>cacheTable</b>, <i></i>
+  int  <b>grow</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalAlignCollisionChains"></A>
+void <I></I>
+<B>CalAlignCollisionChains</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalAssociationListFree"></A>
+void <I></I>
+<B>CalAssociationListFree</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddArrayPreProcessing"></A>
+int <I></I>
+<B>CalBddArrayPreProcessing</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddBlockDelta"></A>
+void <I></I>
+<B>CalBddBlockDelta</B>(
+  Cal_Block  <b>b</b>, <i></i>
+  long  <b>delta</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddDependsOnStep"></A>
+static int <I></I>
+<B>CalBddDependsOnStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_BddIndex_t  <b>varIndex</b>, <i></i>
+  int  <b>mark</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSupport.c"TARGET="ABSTRACT"><CODE>calBddSupport.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddFatalMessage"></A>
+void <I></I>
+<B>CalBddFatalMessage</B>(
+  char * <b>string</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddFindBlock"></A>
+long <I></I>
+<B>CalBddFindBlock</B>(
+  Cal_Block  <b>block</b>, <i></i>
+  long  <b>index</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddFunctionPrint"></A>
+void <I></I>
+<B>CalBddFunctionPrint</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>calBdd</b>, <i></i>
+  char * <b>name</b> <i></i>
+)
+</pre>
+<dd> Prints the function implemented by the argument BDD
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddGetExternalBdd"></A>
+Cal_Bdd <I></I>
+<B>CalBddGetExternalBdd</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>internalBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddGetInternalBdd"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddGetInternalBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddITE"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddITE</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>F</b>, <i></i>
+  Cal_Bdd_t  <b>G</b>, <i></i>
+  Cal_Bdd_t  <b>H</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical If-Then-Else
+ 
+   Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+   - f g + f' h
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddAnd">Cal_BddAnd</a>
+<a href="#Cal_BddNand">Cal_BddNand</a>
+<a href="#Cal_BddOr">Cal_BddOr</a>
+<a href="#Cal_BddNor">Cal_BddNor</a>
+<a href="#Cal_BddXor">Cal_BddXor</a>
+<a href="#Cal_BddXnor">Cal_BddXnor</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddITE.c"TARGET="ABSTRACT"><CODE>calBddITE.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddIdentity"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddIdentity</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>calBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the duplicate BDD of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddNot">Cal_BddNot</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddIf"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddIf</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>F</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddIsCubeStep"></A>
+int <I></I>
+<B>CalBddIsCubeStep</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is a cube, 0 otherwise
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddManagerCreateNewVar"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddManagerCreateNewVar</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_BddIndex_t  <b>index</b> <i></i>
+)
+</pre>
+<dd> Right now this function does not handle the case when the
+  package is working in multiprocessor mode. We need to put in the necessary
+  code later.
+<p>
+
+<dd> <b>Side Effects</b> If the number of variables in the manager exceeds that of value
+  of numMaxVars, then we need to reallocate various fields of the manager. Also
+  depending upon the value of "index", idToIndex and indexToId tables would
+  change.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddManagerGCCheck"></A>
+void <I></I>
+<B>CalBddManagerGCCheck</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddManagerGetCacheTableData"></A>
+void <I></I>
+<B>CalBddManagerGetCacheTableData</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  unsigned long * <b>cacheSize</b>, <i></i>
+  unsigned long * <b>cacheEntries</b>, <i></i>
+  unsigned long * <b>cacheInsertions</b>, <i></i>
+  unsigned long * <b>cacheLookups</b>, <i></i>
+  unsigned long * <b>cacheHits</b>, <i></i>
+  unsigned long * <b>cacheCollisions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddManagerPrint"></A>
+static int <I></I>
+<B>CalBddManagerPrint</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddMarkSharedNodes"></A>
+void <I></I>
+<B>CalBddMarkSharedNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddNodePrint"></A>
+void <I></I>
+<B>CalBddNodePrint</B>(
+  CalBddNode_t * <b>bddNode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddNumberSharedNodes"></A>
+void <I></I>
+<B>CalBddNumberSharedNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  long * <b>next</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddOpBF"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddOpBF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b>, <i></i>
+  Cal_Bdd_t  <b>F</b>, <i></i>
+  Cal_Bdd_t  <b>G</b> <i></i>
+)
+</pre>
+<dd> Internal routine to compute a logical operation on a pair of BDDs
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddOpITEBF"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddOpITEBF</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  Cal_Bdd_t  <b>h</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddITE.c"TARGET="ABSTRACT"><CODE>calBddITE.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPackNodesAfterReorderForSingleId"></A>
+void <I></I>
+<B>CalBddPackNodesAfterReorderForSingleId</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>fixForwardedNodesFlag</b>, <i></i>
+  int  <b>bestIndex</b>, <i></i>
+  int  <b>bottomIndex</b> <i></i>
+)
+</pre>
+<dd> fixForwardedNodesFlag: Whether we need to fix
+  the forwarded nodes of variables corresponding to bestIndex through
+  bottomIndex. If this flag is set, then the forwarded nodes of these
+  variables are traversed and updated after the nodes of the bestIndex
+  have been copied. At the end the forwarded nodes are freed. If this
+  flag is not set, it is assumed that the cleanup pass has already
+  been performed.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPackNodesForMultipleIds"></A>
+void <I></I>
+<B>CalBddPackNodesForMultipleIds</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>beginId</b>, <i></i>
+  int  <b>numLevels</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPackNodesForSingleId"></A>
+void <I></I>
+<B>CalBddPackNodesForSingleId</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPostProcessing"></A>
+int <I></I>
+<B>CalBddPostProcessing</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPreProcessing"></A>
+int <I></I>
+<B>CalBddPreProcessing</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>count</b>, <i></i>
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPrintProfileAux"></A>
+static void <I></I>
+<B>CalBddPrintProfileAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  long * <b>levelCounts</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrintProfile.c"TARGET="ABSTRACT"><CODE>calPrintProfile.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddPrint"></A>
+void <I></I>
+<B>CalBddPrint</B>(
+  Cal_Bdd_t  <b>calBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddReorderAuxBF"></A>
+void <I></I>
+<B>CalBddReorderAuxBF</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddReorderAuxDF"></A>
+void <I></I>
+<B>CalBddReorderAuxDF</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddReorderFixCofactors"></A>
+void <I></I>
+<B>CalBddReorderFixCofactors</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b> <i></i>
+)
+</pre>
+<dd> This routine traverses the unique table and for
+  each node, looks at the then and else cofactors. If needed fixes the
+  cofactors.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddReorderFixProvisionalNodes"></A>
+void <I></I>
+<B>CalBddReorderFixProvisionalNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddReorderFixUserBddPtrs"></A>
+void <I></I>
+<B>CalBddReorderFixUserBddPtrs</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddReorderReclaimForwardedNodes"></A>
+void <I></I>
+<B>CalBddReorderReclaimForwardedNodes</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>startIndex</b>, <i></i>
+  int  <b>endIndex</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddShiftBlock"></A>
+Cal_Block <I></I>
+<B>CalBddShiftBlock</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Block  <b>b</b>, <i></i>
+  long  <b>index</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddSupportStep"></A>
+static Cal_Bdd_t * <I></I>
+<B>CalBddSupportStep</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t * <b>support</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSupport.c"TARGET="ABSTRACT"><CODE>calBddSupport.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddTypeAux"></A>
+int <I></I>
+<B>CalBddTypeAux</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD type by recursively traversing the argument BDD
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddUniqueTableNumLockedNodes"></A>
+unsigned long <I></I>
+<B>CalBddUniqueTableNumLockedNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>uniqueTableForId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddUnmarkNodes"></A>
+static void <I></I>
+<B>CalBddUnmarkNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSupport.c"TARGET="ABSTRACT"><CODE>calBddSupport.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddVarName"></A>
+char * <I></I>
+<B>CalBddVarName</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>v</b>, <i></i>
+  Cal_VarNamingFn_t  <b>VarNamingFn</b>, <i></i>
+  Cal_Pointer_t  <b>env</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddVarSubstitute"></A>
+Cal_Bdd_t <I></I>
+<B>CalBddVarSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  unsigned short  <b>opCode</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD for f using the substitution defined by current
+  variable association. Each variable is replaced by its associated BDDs. The 
+  substitution is effective simultaneously
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddCompose">Cal_BddCompose</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddVarSubstitute.c"TARGET="ABSTRACT"><CODE>calBddVarSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBddWarningMessage"></A>
+void <I></I>
+<B>CalBddWarningMessage</B>(
+  char * <b>string</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalBlockMemoryConsumption"></A>
+unsigned long <I></I>
+<B>CalBlockMemoryConsumption</B>(
+  Cal_Block  <b>block</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableMemoryConsumption"></A>
+unsigned long <I></I>
+<B>CalCacheTableMemoryConsumption</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTablePrint"></A>
+void <I></I>
+<B>CalCacheTablePrint</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableRehash"></A>
+void <I></I>
+<B>CalCacheTableRehash</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoFixResultPointers"></A>
+void <I></I>
+<B>CalCacheTableTwoFixResultPointers</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoFlushAll"></A>
+int <I></I>
+<B>CalCacheTableTwoFlushAll</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoFlushAssociationId"></A>
+void <I></I>
+<B>CalCacheTableTwoFlushAssociationId</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>associationId</b> <i></i>
+)
+</pre>
+<dd> Flushes the entries from the cache which
+                      correspond to the given associationId.
+<p>
+
+<dd> <b>Side Effects</b> Cache entries are affected.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoFlush"></A>
+void <I></I>
+<B>CalCacheTableTwoFlush</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoGCFlush"></A>
+void <I></I>
+<B>CalCacheTableTwoGCFlush</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoInit"></A>
+CalCacheTable_t * <I></I>
+<B>CalCacheTableTwoInit</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoInsert"></A>
+void <I></I>
+<B>CalCacheTableTwoInsert</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  Cal_Bdd_t  <b>result</b>, <i></i>
+  unsigned long  <b>opCode</b>, <i></i>
+  int  <b>cacheLevel</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoLookup"></A>
+int <I></I>
+<B>CalCacheTableTwoLookup</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  unsigned long  <b>opCode</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoQuit"></A>
+int <I></I>
+<B>CalCacheTableTwoQuit</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCacheTableTwoRepackUpdate"></A>
+void <I></I>
+<B>CalCacheTableTwoRepackUpdate</B>(
+  CalCacheTable_t * <b>cacheTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckAllValidity"></A>
+int <I></I>
+<B>CalCheckAllValidity</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckAssociationValidity"></A>
+void <I></I>
+<B>CalCheckAssociationValidity</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckAssoc"></A>
+int <I></I>
+<B>CalCheckAssoc</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckCacheTableValidity"></A>
+void <I></I>
+<B>CalCheckCacheTableValidity</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calCacheTableTwo.c"TARGET="ABSTRACT"><CODE>calCacheTableTwo.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckPipelineValidity"></A>
+void <I></I>
+<B>CalCheckPipelineValidity</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckRefCountValidity"></A>
+void <I></I>
+<B>CalCheckRefCountValidity</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckValidityOfANode"></A>
+int <I></I>
+<B>CalCheckValidityOfANode</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalBddNode_t * <b>bddNode</b>, <i></i>
+  int  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckValidityOfNodesForId"></A>
+int <I></I>
+<B>CalCheckValidityOfNodesForId</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalCheckValidityOfNodesForWindow"></A>
+int <I></I>
+<B>CalCheckValidityOfNodesForWindow</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddIndex_t  <b>index</b>, <i></i>
+  int  <b>numLevels</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalComposeRequestCreate"></A>
+void <I></I>
+<B>CalComposeRequestCreate</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>h</b>, <i></i>
+  Cal_BddIndex_t  <b>composeIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForCompose</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForITE</b>, <i></i>
+  Cal_Bdd_t * <b>resultPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddCompose.c"TARGET="ABSTRACT"><CODE>calBddCompose.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalDecreasingOrderCompare"></A>
+int <I></I>
+<B>CalDecreasingOrderCompare</B>(
+  const void * <b>a</b>, <i></i>
+  const void * <b>b</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalFixupAssoc"></A>
+void <I></I>
+<B>CalFixupAssoc</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  long  <b>id1</b>, <i></i>
+  long  <b>id2</b>, <i></i>
+  CalAssociation_t * <b>assoc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderUtil.c"TARGET="ABSTRACT"><CODE>calReorderUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalFreeBlockRecursively"></A>
+void <I></I>
+<B>CalFreeBlockRecursively</B>(
+  Cal_Block  <b>block</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableAddDirectAux"></A>
+int <I></I>
+<B>CalHashTableAddDirectAux</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>thenBdd</b>, <i></i>
+  Cal_Bdd_t  <b>elseBdd</b>, <i></i>
+  Cal_Bdd_t * <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableAddDirect"></A>
+void <I></I>
+<B>CalHashTableAddDirect</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalBddNode_t * <b>bddNode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableApply"></A>
+void <I></I>
+<B>CalHashTableApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>reqQueAtPipeDepth</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calApplyReduce.c"TARGET="ABSTRACT"><CODE>calApplyReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableCleanUp"></A>
+void <I></I>
+<B>CalHashTableCleanUp</B>(
+  CalHashTable_t * <b>hashTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableComposeApply"></A>
+void <I></I>
+<B>CalHashTableComposeApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_BddIndex_t  <b>gIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForCompose</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForITE</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddCompose.c"TARGET="ABSTRACT"><CODE>calBddCompose.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableDelete"></A>
+void <I></I>
+<B>CalHashTableDelete</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalBddNode_t * <b>bddNode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableFindOrAdd"></A>
+int <I></I>
+<B>CalHashTableFindOrAdd</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>thenBdd</b>, <i></i>
+  Cal_Bdd_t  <b>elseBdd</b>, <i></i>
+  Cal_Bdd_t * <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableGC"></A>
+int <I></I>
+<B>CalHashTableGC</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b> <i></i>
+)
+</pre>
+<dd> The input is the hash table containing the nodes
+  belonging to that level. Each bin of the hash table is traversed and
+  the Bdd nodes with 0 reference count are put at the appropriate
+  level in the processing que of the manager.
+<p>
+
+<dd> <b>Side Effects</b> The number of nodes in the hash table can possibly decrease.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableITEApply"></A>
+void <I></I>
+<B>CalHashTableITEApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>reqQueAtPipeDepth</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddITE.c"TARGET="ABSTRACT"><CODE>calBddITE.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableInit"></A>
+CalHashTable_t * <I></I>
+<B>CalHashTableInit</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>bddId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableLookup"></A>
+int <I></I>
+<B>CalHashTableLookup</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>thenBdd</b>, <i></i>
+  Cal_Bdd_t  <b>elseBdd</b>, <i></i>
+  Cal_Bdd_t * <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableOneInit"></A>
+CalHashTable_t * <I></I>
+<B>CalHashTableOneInit</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>itemSize</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableOne.c"TARGET="ABSTRACT"><CODE>calHashTableOne.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableOneInsert"></A>
+void <I></I>
+<B>CalHashTableOneInsert</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>keyBdd</b>, <i></i>
+  char * <b>valuePtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableOne.c"TARGET="ABSTRACT"><CODE>calHashTableOne.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableOneLookup"></A>
+int <I></I>
+<B>CalHashTableOneLookup</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>keyBdd</b>, <i></i>
+  char ** <b>valuePtrPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableOne.c"TARGET="ABSTRACT"><CODE>calHashTableOne.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableOnePrint"></A>
+void <I></I>
+<B>CalHashTableOnePrint</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  int  <b>flag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableOneQuit"></A>
+void <I></I>
+<B>CalHashTableOneQuit</B>(
+  CalHashTable_t * <b>hashTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableOne.c"TARGET="ABSTRACT"><CODE>calHashTableOne.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTablePrint"></A>
+void <I></I>
+<B>CalHashTablePrint</B>(
+  CalHashTable_t * <b>hashTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableQuit"></A>
+int <I></I>
+<B>CalHashTableQuit</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableReduce"></A>
+void <I></I>
+<B>CalHashTableReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t * <b>uniqueTableForId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calApplyReduce.c"TARGET="ABSTRACT"><CODE>calApplyReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableRehash"></A>
+void <I></I>
+<B>CalHashTableRehash</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  int  <b>grow</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSubstituteApply"></A>
+static void <I></I>
+<B>CalHashTableSubstituteApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  int  <b>lastIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSubstitute</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSubstitute.c"TARGET="ABSTRACT"><CODE>calBddSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSubstituteApply"></A>
+static void <I></I>
+<B>CalHashTableSubstituteApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  int  <b>lastIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSubstitute</b>, <i></i>
+  unsigned short  <b>opCode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddVarSubstitute.c"TARGET="ABSTRACT"><CODE>calBddVarSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSubstituteReduce"></A>
+static void <I></I>
+<B>CalHashTableSubstituteReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForITE</b>, <i></i>
+  CalHashTable_t * <b>uniqueTableForId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSubstitute.c"TARGET="ABSTRACT"><CODE>calBddSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSubstituteReduce"></A>
+static void <I></I>
+<B>CalHashTableSubstituteReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForITE</b>, <i></i>
+  CalHashTable_t * <b>uniqueTableForId</b>, <i></i>
+  unsigned short  <b>opCode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddVarSubstitute.c"TARGET="ABSTRACT"><CODE>calBddVarSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSwapVarsApply"></A>
+static void <I></I>
+<B>CalHashTableSwapVarsApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_BddIndex_t  <b>gIndex</b>, <i></i>
+  Cal_BddIndex_t  <b>hIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVars</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVarsPlus</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVarsMinus</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForCompose</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForITE</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSwapVars.c"TARGET="ABSTRACT"><CODE>calBddSwapVars.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSwapVarsMinusApply"></A>
+static void <I></I>
+<B>CalHashTableSwapVarsMinusApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_BddIndex_t  <b>hIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVars</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVarsPlus</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVarsMinus</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForCompose</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSwapVars.c"TARGET="ABSTRACT"><CODE>calBddSwapVars.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableSwapVarsPlusApply"></A>
+static void <I></I>
+<B>CalHashTableSwapVarsPlusApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_BddIndex_t  <b>hIndex</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVars</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVarsPlus</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForSwapVarsMinus</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForCompose</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSwapVars.c"TARGET="ABSTRACT"><CODE>calBddSwapVars.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableThreeFindOrAdd"></A>
+int <I></I>
+<B>CalHashTableThreeFindOrAdd</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  Cal_Bdd_t  <b>h</b>, <i></i>
+  Cal_Bdd_t * <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableThree.c"TARGET="ABSTRACT"><CODE>calHashTableThree.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalHashTableThreeRehash"></A>
+static void <I></I>
+<B>CalHashTableThreeRehash</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  int  <b>grow</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableThree.c"TARGET="ABSTRACT"><CODE>calHashTableThree.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalIncreasingOrderCompare"></A>
+int <I></I>
+<B>CalIncreasingOrderCompare</B>(
+  const void * <b>a</b>, <i></i>
+  const void * <b>b</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalInitInteract"></A>
+int <I></I>
+<B>CalInitInteract</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Initializes the interaction matrix. The interaction
+  matrix is implemented as a bit vector storing the upper triangle of
+  the symmetric interaction matrix. The bit vector is kept in an array
+  of long integers. The computation is based on a series of depth-first
+  searches, one for each root of the DAG. A local flag (the mark bits)
+  is used.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calInteract.c"TARGET="ABSTRACT"><CODE>calInteract.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalNodeManagerInit"></A>
+CalNodeManager_t * <I></I>
+<B>CalNodeManagerInit</B>(
+  CalPageManager_t * <b>pageManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalNodeManagerPrint"></A>
+void <I></I>
+<B>CalNodeManagerPrint</B>(
+  CalNodeManager_t * <b>nodeManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalNodeManagerQuit"></A>
+int <I></I>
+<B>CalNodeManagerQuit</B>(
+  CalNodeManager_t * <b>nodeManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> The associated nodes are lost.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpAnd"></A>
+int <I></I>
+<B>CalOpAnd</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>F</b>, <i></i>
+  Cal_Bdd_t  <b>G</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTerminal.c"TARGET="ABSTRACT"><CODE>calTerminal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpBddVarSubstitute"></A>
+int <I></I>
+<B>CalOpBddVarSubstitute</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddVarSubstitute.c"TARGET="ABSTRACT"><CODE>calBddVarSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpCofactor"></A>
+int <I></I>
+<B>CalOpCofactor</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>c</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpExists"></A>
+int <I></I>
+<B>CalOpExists</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpITE"></A>
+Cal_Bdd_t <I></I>
+<B>CalOpITE</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  Cal_Bdd_t  <b>h</b>, <i></i>
+  CalHashTable_t ** <b>reqQueForITE</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTerminal.c"TARGET="ABSTRACT"><CODE>calTerminal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpNand"></A>
+int <I></I>
+<B>CalOpNand</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>F</b>, <i></i>
+  Cal_Bdd_t  <b>G</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTerminal.c"TARGET="ABSTRACT"><CODE>calTerminal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpOr"></A>
+int <I></I>
+<B>CalOpOr</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>F</b>, <i></i>
+  Cal_Bdd_t  <b>G</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTerminal.c"TARGET="ABSTRACT"><CODE>calTerminal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpRelProd"></A>
+int <I></I>
+<B>CalOpRelProd</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  Cal_Bdd_t  <b>g</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalOpXor"></A>
+int <I></I>
+<B>CalOpXor</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>F</b>, <i></i>
+  Cal_Bdd_t  <b>G</b>, <i></i>
+  Cal_Bdd_t * <b>resultBddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTerminal.c"TARGET="ABSTRACT"><CODE>calTerminal.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPackNodes"></A>
+void <I></I>
+<B>CalPackNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPageManagerAllocPage"></A>
+CalAddress_t * <I></I>
+<B>CalPageManagerAllocPage</B>(
+  CalPageManager_t * <b>pageManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPageManagerFreePage"></A>
+void <I></I>
+<B>CalPageManagerFreePage</B>(
+  CalPageManager_t * <b>pageManager</b>, <i></i>
+  CalAddress_t * <b>page</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPageManagerInit"></A>
+CalPageManager_t * <I></I>
+<B>CalPageManagerInit</B>(
+  int  <b>numPagesPerSegment</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPageManagerPrint"></A>
+void <I></I>
+<B>CalPageManagerPrint</B>(
+  CalPageManager_t * <b>pageManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPageManagerQuit"></A>
+int <I></I>
+<B>CalPageManagerQuit</B>(
+  CalPageManager_t * <b>pageManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformaceTestSuperscalar"></A>
+static void <I></I>
+<B>CalPerformaceTestSuperscalar</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceMemoryOverhead"></A>
+static void <I></I>
+<B>CalPerformanceMemoryOverhead</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestAnd"></A>
+static void <I></I>
+<B>CalPerformanceTestAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestCompose"></A>
+static void <I></I>
+<B>CalPerformanceTestCompose</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestMultiway"></A>
+static void <I></I>
+<B>CalPerformanceTestMultiway</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestNonSuperscalar"></A>
+static void <I></I>
+<B>CalPerformanceTestNonSuperscalar</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestOneway"></A>
+static void <I></I>
+<B>CalPerformanceTestOneway</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestQuantifyAllTogether"></A>
+static void <I></I>
+<B>CalPerformanceTestQuantifyAllTogether</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b>, <i></i>
+  int  <b>bfZeroBFPlusDFOne</b>, <i></i>
+  int  <b>cacheExistsResultsFlag</b>, <i></i>
+  int  <b>cacheOrResultsFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestRelProd"></A>
+static void <I></I>
+<B>CalPerformanceTestRelProd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b>, <i></i>
+  int  <b>bfZeroBFPlusDFOne</b>, <i></i>
+  int  <b>cacheRelProdResultsFlag</b>, <i></i>
+  int  <b>cacheAndResultsFlag</b>, <i></i>
+  int  <b>cacheOrResultsFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestSubstitute"></A>
+static void <I></I>
+<B>CalPerformanceTestSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalPerformanceTestSwapVars"></A>
+static void <I></I>
+<B>CalPerformanceTestSwapVars</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalQuantifySanityCheck"></A>
+static void <I></I>
+<B>CalQuantifySanityCheck</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalReorderAssociationFix"></A>
+void <I></I>
+<B>CalReorderAssociationFix</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalRepackNodesAfterGC"></A>
+static void <I></I>
+<B>CalRepackNodesAfterGC</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalRequestNodeListArrayITE"></A>
+void <I></I>
+<B>CalRequestNodeListArrayITE</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalRequestNode_t ** <b>requestNodeListArray</b> <i></i>
+)
+</pre>
+<dd> This routine is to be used for pipelined and
+  superscalar ITE operations. Currently there is no user interface
+  provided to this routine.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddITE.c"TARGET="ABSTRACT"><CODE>calBddITE.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalRequestNodeListArrayOp"></A>
+void <I></I>
+<B>CalRequestNodeListArrayOp</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalRequestNode_t ** <b>requestNodeListArray</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b> <i></i>
+)
+</pre>
+<dd> Computes result BDDs for an array of lists, each entry of which
+  is pair of pointers, each of which points to a operand BDD or an entry in
+  another list with a smaller array index
+<p>
+
+<dd> <b>Side Effects</b> ThenBDD pointer of an entry is over written by the result BDD
+  and ElseBDD pointer is marked using FORWARD_FLAG
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalRequestNodeListCompose"></A>
+void <I></I>
+<B>CalRequestNodeListCompose</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalRequestNode_t * <b>requestNodeList</b>, <i></i>
+  Cal_BddIndex_t  <b>composeIndex</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddCompose.c"TARGET="ABSTRACT"><CODE>calBddCompose.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalSetInteract"></A>
+void <I></I>
+<B>CalSetInteract</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>x</b>, <i></i>
+  int  <b>y</b> <i></i>
+)
+</pre>
+<dd> Given a pair of variables 0 <= x < y < table->size,
+  sets the corresponding bit of the interaction matrix to 1.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calInteract.c"TARGET="ABSTRACT"><CODE>calInteract.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalTestInteract"></A>
+int <I></I>
+<B>CalTestInteract</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>x</b>, <i></i>
+  int  <b>y</b> <i></i>
+)
+</pre>
+<dd> Given a pair of variables 0 <= x < y < bddManager->numVars,
+  tests whether the corresponding bit of the interaction matrix is 1.
+  Returns the value of the bit.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calInteract.c"TARGET="ABSTRACT"><CODE>calInteract.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalUniqueTableForIdFindOrAdd"></A>
+int <I></I>
+<B>CalUniqueTableForIdFindOrAdd</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>thenBdd</b>, <i></i>
+  Cal_Bdd_t  <b>elseBdd</b>, <i></i>
+  Cal_Bdd_t * <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> If a new BDD node is created (found == false), then the
+  numNodes field of the manager needs to be incremented.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalUniqueTableForIdLookup"></A>
+int <I></I>
+<B>CalUniqueTableForIdLookup</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  Cal_Bdd_t  <b>thenBdd</b>, <i></i>
+  Cal_Bdd_t  <b>elseBdd</b>, <i></i>
+  Cal_Bdd_t * <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalUniqueTableForIdRehashNode"></A>
+void <I></I>
+<B>CalUniqueTableForIdRehashNode</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalBddNode_t * <b>bddNode</b>, <i></i>
+  CalBddNode_t * <b>thenBddNode</b>, <i></i>
+  CalBddNode_t * <b>elseBddNode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalUniqueTablePrint"></A>
+void <I></I>
+<B>CalUniqueTablePrint</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="CalVarAssociationRepackUpdate"></A>
+void <I></I>
+<B>CalVarAssociationRepackUpdate</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_AssociationInit"></A>
+int <I></I>
+<B>Cal_AssociationInit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>associationInfoUserBdds</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> Creates or finds a variable association. The association is
+  specified by associationInfo, which is a an array of BDD with 
+  Cal_BddNull(bddManager) as the end marker. If pairs is 0, the array is
+  assumed to be an array of variables. In this case, each variable is paired
+  with constant BDD one. Such an association may viewed as specifying a set
+  of variables for use with routines such as Cal_BddExists. If pair is not 0,
+  then the even numbered array elements should be variables and the odd numbered
+  elements should be the BDDs which they are mapped to. In both cases, the 
+  return value is an integer identifier for this association. If the given
+  association is equivalent to one which already exists, the same identifier
+  is used for both, and the reference count of the association is increased by
+  one.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_AssociationQuit">Cal_AssociationQuit</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_AssociationQuit"></A>
+void <I></I>
+<B>Cal_AssociationQuit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>associationId</b> <i></i>
+)
+</pre>
+<dd> Decrements the reference count of the variable association with
+  identifier id, and frees it if the reference count becomes zero.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_AssociationInit">Cal_AssociationInit</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_AssociationSetCurrent"></A>
+int <I></I>
+<B>Cal_AssociationSetCurrent</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>associationId</b> <i></i>
+)
+</pre>
+<dd> Sets the current variable association to the one given by id and
+  returns the ID of the old association.  An id of -1 indicates the temporary
+  association
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddAnd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical AND of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddBetween"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddBetween</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fMinUserBdd</b>, <i></i>
+  Cal_Bdd  <b>fMaxUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a minimal BDD f which is contains fMin and is
+  contained in fMax ( fMin <= f <= fMax).
+  This operation is typically used in state space searches to simplify
+  the representation for the set of states wich will be expanded at
+  each step (Rk Rk-1' <= f <= Rk).
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddReduce">Cal_BddReduce</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddCofactor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddCofactor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>cUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the generalized cofactor of BDD f with respect
+  to BDD c. The constrain operator given by Coudert et al (ICCAD90) is
+  used to find the generalized cofactor.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddReduce">Cal_BddReduce</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddCompose"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddCompose</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b>, <i></i>
+  Cal_Bdd  <b>hUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD obtained by substituting a variable by a function
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddCompose.c"TARGET="ABSTRACT"><CODE>calBddCompose.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddDependsOn"></A>
+int <I></I>
+<B>Cal_BddDependsOn</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>varUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if f depends on var and returns 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSupport.c"TARGET="ABSTRACT"><CODE>calBddSupport.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddDumpBdd"></A>
+int <I></I>
+<B>Cal_BddDumpBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd * <b>userVars</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> Writes an encoded description of the BDD to the file given by fp.
+  The argument vars should be a null-terminated array of variables that include
+  the support of f .  These variables need not be in order of increasing index.
+  The function returns a nonzero value if f was written to the file successfully.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddDynamicReordering"></A>
+void <I></I>
+<B>Cal_BddDynamicReordering</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>technique</b> <i></i>
+)
+</pre>
+<dd> Selects the method for dynamic reordering.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddReorder">Cal_BddReorder</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddElse"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddElse</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the returned BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddThen">Cal_BddThen</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddExists"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddExists</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for f with all the variables that are
+  paired with something in the current variable association
+  existentially quantified out.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddRelProd">Cal_BddRelProd</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddForAll"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddForAll</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for f with all the variables that are
+  paired with something in the current variable association
+  universally quantified out.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddFree"></A>
+void <I></I>
+<B>Cal_BddFree</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Frees the argument BDD. It is an error to free a BDD
+  more than once.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the argument BDD is decreased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddUnFree">Cal_BddUnFree</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddFunctionPrint"></A>
+void <I></I>
+<B>Cal_BddFunctionPrint</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b>, <i></i>
+  char * <b>name</b> <i></i>
+)
+</pre>
+<dd> Prints the function implemented by the argument BDD
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calUtil.c"TARGET="ABSTRACT"><CODE>calUtil.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddFunctionProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddFunctionProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>fUserBddArray</b>, <i></i>
+  long * <b>funcCounts</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddFunctionProfile"></A>
+void <I></I>
+<B>Cal_BddFunctionProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  long * <b>funcCounts</b> <i></i>
+)
+</pre>
+<dd> The nth entry of the function
+  profile array is the number of subfunctions of f which may be obtained by 
+  restricting the variables whose index is less than n.  An entry of zero 
+  indicates that f is independent of the variable with the corresponding index.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddGetIfId"></A>
+Cal_BddId_t <I></I>
+<B>Cal_BddGetIfId</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the id of the top variable of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddGetIfIndex">Cal_BddGetIfIndex</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddGetIfIndex"></A>
+Cal_BddId_t <I></I>
+<B>Cal_BddGetIfIndex</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the index of the top variable of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddGetIfId">Cal_BddGetIfId</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddGetRegular"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddGetRegular</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD with positive from a given BDD with arbitrary phase
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddITE"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddITE</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b>, <i></i>
+  Cal_Bdd  <b>hUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical If-Then-Else
+
+  Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+  - f g + f' h
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddAnd">Cal_BddAnd</a>
+<a href="#Cal_BddNand">Cal_BddNand</a>
+<a href="#Cal_BddOr">Cal_BddOr</a>
+<a href="#Cal_BddNor">Cal_BddNor</a>
+<a href="#Cal_BddXor">Cal_BddXor</a>
+<a href="#Cal_BddXnor">Cal_BddXnor</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddITE.c"TARGET="ABSTRACT"><CODE>calBddITE.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIdentity"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddIdentity</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the duplicate BDD of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddNot">Cal_BddNot</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIf"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddIf</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddImplies"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddImplies</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Computes a BDD that implies conjunction of f and Cal_BddNot(g)
+<p>
+
+<dd> <b>Side Effects</b> none
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIntersects">Cal_BddIntersects</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIntersects"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddIntersects</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Computes a BDD that implies conjunction of f and g.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddImplies">Cal_BddImplies</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddConst"></A>
+int <I></I>
+<B>Cal_BddIsBddConst</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is either constant one or
+  constant zero, otherwise returns 0.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIsBddOne">Cal_BddIsBddOne</a>
+<a href="#Cal_BddIsBddZero">Cal_BddIsBddZero</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddNull"></A>
+int <I></I>
+<B>Cal_BddIsBddNull</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is NULL, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddOne"></A>
+int <I></I>
+<B>Cal_BddIsBddOne</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is constant one, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIsBddZero">Cal_BddIsBddZero</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddZero"></A>
+int <I></I>
+<B>Cal_BddIsBddZero</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is constant zero, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIsBddOne">Cal_BddIsBddOne</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsCube"></A>
+int <I></I>
+<B>Cal_BddIsCube</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is a cube, 0 otherwise
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsEqual"></A>
+int <I></I>
+<B>Cal_BddIsEqual</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd1</b>, <i></i>
+  Cal_Bdd  <b>userBdd2</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if argument BDDs are equal, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddIsProvisional"></A>
+int <I></I>
+<B>Cal_BddIsProvisional</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1, if the given user BDD contains
+  provisional BDD node.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarAfter"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarAfter</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable after the specified one in
+  the variable  order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarBefore"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarBefore</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable before the specified one in
+  the variable order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarFirst"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarFirst</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable at the start of the
+  variable order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarLast"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarLast</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable at the end of the variable
+  order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGC"></A>
+int <I></I>
+<B>Cal_BddManagerGC</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> For each variable in the increasing id free nodes with reference
+  count equal to zero freeing a node results in decrementing reference count of
+  then and else nodes by one.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetHooks"></A>
+void * <I></I>
+<B>Cal_BddManagerGetHooks</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the hooks field of the manager.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetNumNodes"></A>
+unsigned long <I></I>
+<B>Cal_BddManagerGetNumNodes</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the number of BDD nodes
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddTotalSize">Cal_BddTotalSize</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetVarWithId"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerGetVarWithId</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b> <i></i>
+)
+</pre>
+<dd> Returns the variable with the specified id, null if no
+  such variable exists
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetVarWithIndex"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerGetVarWithIndex</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddIndex_t  <b>index</b> <i></i>
+)
+</pre>
+<dd> Returns the variable with the specified index, null if no
+  such variable exists
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerInit"></A>
+Cal_BddManager <I></I>
+<B>Cal_BddManagerInit</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> Initializes and allocates fields of the BDD manager. Some of the
+  fields are initialized for maxNumVars+1 or numVars+1, whereas some of them are
+  initialized for maxNumVars or numVars. The first kind of fields are associated
+  with the id of a variable and the second ones are with the index of the
+  variable.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerQuit">Cal_BddManagerQuit</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerQuit"></A>
+int <I></I>
+<B>Cal_BddManagerQuit</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Frees the BDD manager and all the associated allocations
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerInit">Cal_BddManagerInit</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerSetGCLimit"></A>
+void <I></I>
+<B>Cal_BddManagerSetGCLimit</B>(
+  Cal_BddManager  <b>manager</b> <i></i>
+)
+</pre>
+<dd> It tries to set the limit at twice the number of nodes
+  in the manager at the current point. However, the limit is not
+  allowed to fall below the MIN_GC_LIMIT or to exceed the value of
+  node limit (if one exists).
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerSetHooks"></A>
+void <I></I>
+<B>Cal_BddManagerSetHooks</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  void * <b>hooks</b> <i></i>
+)
+</pre>
+<dd> Sets the hooks field of the manager.
+<p>
+
+<dd> <b>Side Effects</b> Hooks field changes.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddManagerSetParameters"></A>
+void <I></I>
+<B>Cal_BddManagerSetParameters</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  long  <b>reorderingThreshold</b>, <i></i>
+  long  <b>maxForwardedNodes</b>, <i></i>
+  double  <b>repackAfterGCThreshold</b>, <i></i>
+  double  <b>tableRepackThreshold</b> <i></i>
+)
+</pre>
+<dd> This function is used to set the parameters which are
+  used to control the reordering process. "reorderingThreshold"
+  determines the number of nodes below which reordering will NOT be
+  invoked, "maxForwardedNodes" determines the maximum number of
+  forwarded nodes which are allowed (at that point the cleanup must be
+  done), and "repackingThreshold" determines the fraction of the page
+  utilized below which repacking has to be invoked. These parameters
+  have different affect on the computational and memory usage aspects
+  of reordeing. For instance, higher value of "maxForwardedNodes" will
+  result in process consuming more memory, and a lower value on the
+  other hand would invoke the cleanup process repeatedly resulting in
+  increased computation.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddManager.c"TARGET="ABSTRACT"><CODE>calBddManager.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddMultiwayAnd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddMultiwayAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical AND of set of BDDs in the bddArray
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddMultiwayOr"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddMultiwayOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical OR of set of BDDs in the bddArray
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddMultiwayXor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddMultiwayXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical XOR of set of BDDs in the bddArray
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddNand"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddNand</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical NAND of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddNewVarBlock"></A>
+Cal_Block <I></I>
+<B>Cal_BddNewVarBlock</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>variable</b>, <i></i>
+  long  <b>length</b> <i></i>
+)
+</pre>
+<dd> The block is specified by passing the first
+  variable and the length of the block. The "length" number of
+  consecutive variables starting from "variable" are put in the
+  block.
+<p>
+
+<dd> <b>Side Effects</b> A new block is created.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddNodeLimit"></A>
+long <I></I>
+<B>Cal_BddNodeLimit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  long  <b>newLimit</b> <i></i>
+)
+</pre>
+<dd> Sets the node limit to new_limit and returns the old limit.
+<p>
+
+<dd> <b>Side Effects</b> Threshold for garbage collection may change
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerGC">Cal_BddManagerGC</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddNor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddNor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical NOR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddNot"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddNot</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the complement of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the argument BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIdentity">Cal_BddIdentity</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddOne"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddOne</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for the constant one
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddZero">Cal_BddZero</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddOr"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical OR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddOverflow"></A>
+int <I></I>
+<B>Cal_BddOverflow</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddNodeLimit">Cal_BddNodeLimit</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPairwiseAnd"></A>
+Cal_Bdd * <I></I>
+<B>Cal_BddPairwiseAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddPairwiseOr">Cal_BddPairwiseOr</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPairwiseOr"></A>
+Cal_Bdd * <I></I>
+<B>Cal_BddPairwiseOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddPairwiseAnd">Cal_BddPairwiseAnd</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPairwiseXor"></A>
+Cal_Bdd * <I></I>
+<B>Cal_BddPairwiseXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddPairwiseAnd">Cal_BddPairwiseAnd</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPrintBdd"></A>
+void <I></I>
+<B>Cal_BddPrintBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_VarNamingFn_t  <b>VarNamingFn</b>, <i></i>
+  Cal_TerminalIdFn_t  <b>TerminalIdFn</b>, <i></i>
+  Cal_Pointer_t  <b>env</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> Prints a human-readable representation of the BDD f to
+  the file given by fp. The namingFn should be a pointer to a function
+  taking a bddManager, a BDD and the pointer given by env. This
+  function should return either a null pointer or a srting that is the
+  name of the supplied variable. If it returns a null pointer, a
+  default name is generated based on the index of the variable. It is
+  also legal for naminFN to e null; in this case, default names are
+  generated for all variables. The macro bddNamingFnNone is a null
+  pointer of suitable type. terminalIdFn should be apointer to a
+  function taking a bddManager and two longs. plus the pointer given
+  by the env. It should return either a null pointer. If it returns a
+  null pointer, or if terminalIdFn is null, then default names are
+  generated for the terminals. The macro bddTerminalIdFnNone is a null
+  pointer of suitable type.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPrintFunctionProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddPrintFunctionProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBdds</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrintProfile.c"TARGET="ABSTRACT"><CODE>calPrintProfile.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPrintFunctionProfile"></A>
+void <I></I>
+<B>Cal_BddPrintFunctionProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrintProfile.c"TARGET="ABSTRACT"><CODE>calPrintProfile.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPrintProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddPrintProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBdds</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrintProfile.c"TARGET="ABSTRACT"><CODE>calPrintProfile.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddPrintProfile"></A>
+void <I></I>
+<B>Cal_BddPrintProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrintProfile.c"TARGET="ABSTRACT"><CODE>calPrintProfile.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>fUserBddArray</b>, <i></i>
+  long * <b>levelCounts</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddProfile"></A>
+void <I></I>
+<B>Cal_BddProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  long * <b>levelCounts</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> negout is as in Cal_BddSize. levelCounts should be an array of
+  size Cal_BddVars(bddManager)+1 to hold the profile.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddReduce"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddReduce</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>cUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD which agrees with f for all valuations
+  which satisfy c. The result is usually smaller in terms of number of
+  BDD nodes than f. This operation is typically used in state space
+  searches to simplify the representation for the set of states wich
+  will be expanded at each step.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddCofactor">Cal_BddCofactor</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddRelProd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddRelProd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for the logical AND of f and g with all
+  the variables that are paired with something in the current variable
+  association existentially quantified out.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddReorder"></A>
+void <I></I>
+<B>Cal_BddReorder</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Invoke the current dynamic reodering method.
+<p>
+
+<dd> <b>Side Effects</b> Index of a variable may change due to reodering
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddDynamicReordering">Cal_BddDynamicReordering</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSatisfySupport"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSatisfySupport</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> The returned BDD which implies f, is true for some valuation on
+               which f is true, which has at most one node at each level,
+               and which has exactly one node corresponding to each variable
+               which is associated with something in the current variable
+               association.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSatisfyingFraction"></A>
+double <I></I>
+<B>Cal_BddSatisfyingFraction</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSatisfy"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSatisfy</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSetGCMode"></A>
+void <I></I>
+<B>Cal_BddSetGCMode</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>gcMode</b> <i></i>
+)
+</pre>
+<dd> Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSizeMultiple"></A>
+long <I></I>
+<B>Cal_BddSizeMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>fUserBddArray</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSize"></A>
+long <I></I>
+<B>Cal_BddSize</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSize.c"TARGET="ABSTRACT"><CODE>calBddSize.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddStats"></A>
+void <I></I>
+<B>Cal_BddStats</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> Prints miscellaneous BDD statistics
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSubstitute"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD for f using the substitution defined by current
+  variable association. Each variable is replaced by its associated BDDs. The 
+  substitution is effective simultaneously
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddCompose">Cal_BddCompose</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSubstitute.c"TARGET="ABSTRACT"><CODE>calBddSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSupport"></A>
+void <I></I>
+<B>Cal_BddSupport</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd * <b>support</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSupport.c"TARGET="ABSTRACT"><CODE>calBddSupport.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddSwapVars"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSwapVars</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b>, <i></i>
+  Cal_Bdd  <b>hUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD obtained by simultaneously substituting variable
+  g by variable h and variable h and variable g in the BDD f
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddSubstitute">Cal_BddSubstitute</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSwapVars.c"TARGET="ABSTRACT"><CODE>calBddSwapVars.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddThen"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddThen</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the returned BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddElse">Cal_BddElse</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddTotalSize"></A>
+unsigned long <I></I>
+<B>Cal_BddTotalSize</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the number of nodes in the Unique table
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerGetNumNodes">Cal_BddManagerGetNumNodes</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddType"></A>
+int <I></I>
+<B>Cal_BddType</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns BDD_TYPE_ZERO if f is false, BDD_TYPE_ONE 
+  if f is true, BDD_TYPE_POSVAR is f is an unnegated variable,
+  BDD_TYPE_NEGVAR if f is a negated variable, BDD_TYPE_OVERFLOW if f
+  is null, and BDD_TYPE_NONTERMINAL otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddUnFree"></A>
+void <I></I>
+<B>Cal_BddUnFree</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Unfrees the argument BDD. It is an error to pass a BDD
+  with reference count of zero to be unfreed.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the argument BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddFree">Cal_BddFree</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddUndumpBdd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddUndumpBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userVars</b>, <i></i>
+  FILE * <b>fp</b>, <i></i>
+  int * <b>error</b> <i></i>
+)
+</pre>
+<dd> Loads an encoded description of a BDD from the file given by
+  fp. The argument vars should be a null terminated array of variables that will
+  become the support of the BDD. As in Cal_BddDumpBdd, these need not be in
+  the order of increasing index. If the same array of variables in used in 
+  dumping and undumping, the BDD returned will be equal to the one that was 
+  dumped. More generally, if array v1 is used when dumping, and the array v2
+  is used when undumping, the BDD returned will be equal to the original BDD
+  with the ith variable in v2 substituted for the ith variable in v1 for all i.
+  Null BDD is returned in the operation fails for reason (node limit reached,
+  I/O error, invalid file format, etc.). In this case, an error code is stored
+  in error. the code will be one of the following. 
+  CAL_BDD_UNDUMP_FORMAT Invalid file format
+  CAL_BDD_UNDUMP_OVERFLOW Node limit exceeded
+  CAL_BDD_UNDUMP_IOERROR File I/O error
+  CAL_BDD_UNDUMP_EOF Unexpected EOF
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddVarBlockReorderable"></A>
+void <I></I>
+<B>Cal_BddVarBlockReorderable</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  int  <b>reorderable</b> <i></i>
+)
+</pre>
+<dd> If a block is reorderable, the child blocks are
+  recursively involved in swapping.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBlk.c"TARGET="ABSTRACT"><CODE>calBlk.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddVarSubstitute"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddVarSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD for f using the substitution defined by current
+  variable association. It is assumed that each variable is replaced
+  by another variable. For the substitution of a variable by a
+  function, use Cal_BddSubstitute instead.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddSubstitute">Cal_BddSubstitute</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddVarSubstitute.c"TARGET="ABSTRACT"><CODE>calBddVarSubstitute.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddVars"></A>
+long <I></I>
+<B>Cal_BddVars</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the number of BDD variables
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddXnor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddXnor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical exclusive NOR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddXor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical exclusive OR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_BddZero"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddZero</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for the constant zero
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddOne">Cal_BddOne</a>
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#cal.c"TARGET="ABSTRACT"><CODE>cal.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemAllocation"></A>
+Cal_Address_t <I></I>
+<B>Cal_MemAllocation</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> Returns the memory allocated.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemFatal"></A>
+void <I></I>
+<B>Cal_MemFatal</B>(
+  char * <b>message</b> <i></i>
+)
+</pre>
+<dd> Prints an error message and exits.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemFreeBlock"></A>
+void <I></I>
+<B>Cal_MemFreeBlock</B>(
+  Cal_Pointer_t  <b>p</b> <i></i>
+)
+</pre>
+<dd> Frees the block.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemFreeRecMgr"></A>
+void <I></I>
+<B>Cal_MemFreeRecMgr</B>(
+  Cal_RecMgr  <b>mgr</b> <i></i>
+)
+</pre>
+<dd> Frees all the storage associated with the specified record manager.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemFreeRec"></A>
+void <I></I>
+<B>Cal_MemFreeRec</B>(
+  Cal_RecMgr  <b>mgr</b>, <i></i>
+  Cal_Pointer_t  <b>rec</b> <i></i>
+)
+</pre>
+<dd> Frees a record managed by the indicated record manager.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemGetBlock"></A>
+Cal_Pointer_t <I></I>
+<B>Cal_MemGetBlock</B>(
+  Cal_Address_t  <b>size</b> <i></i>
+)
+</pre>
+<dd> Allocates a new block of the specified size.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemNewRecMgr"></A>
+Cal_RecMgr <I></I>
+<B>Cal_MemNewRecMgr</B>(
+  int  <b>size</b> <i></i>
+)
+</pre>
+<dd> Creates a new record manager with the given  record size.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemNewRec"></A>
+Cal_Pointer_t <I></I>
+<B>Cal_MemNewRec</B>(
+  Cal_RecMgr  <b>mgr</b> <i></i>
+)
+</pre>
+<dd> Allocates a record from the specified record manager.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_MemResizeBlock"></A>
+Cal_Pointer_t <I></I>
+<B>Cal_MemResizeBlock</B>(
+  Cal_Pointer_t  <b>p</b>, <i></i>
+  Cal_Address_t  <b>newSize</b> <i></i>
+)
+</pre>
+<dd> Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PerformanceTest"></A>
+int <I></I>
+<B>Cal_PerformanceTest</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b>, <i></i>
+  int  <b>iteration</b>, <i></i>
+  int  <b>seed</b>, <i></i>
+  int  <b>andPerformanceFlag</b>, <i></i>
+  int  <b>multiwayPerformanceFlag</b>, <i></i>
+  int  <b>onewayPerformanceFlag</b>, <i></i>
+  int  <b>quantifyPerformanceFlag</b>, <i></i>
+  int  <b>composePerformanceFlag</b>, <i></i>
+  int  <b>relprodPerformanceFlag</b>, <i></i>
+  int  <b>swapPerformanceFlag</b>, <i></i>
+  int  <b>substitutePerformanceFlag</b>, <i></i>
+  int  <b>sanityCheckFlag</b>, <i></i>
+  int  <b>computeMemoryOverheadFlag</b>, <i></i>
+  int  <b>superscalarFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PipelineCreateProvisionalBdd"></A>
+Cal_Bdd <I></I>
+<B>Cal_PipelineCreateProvisionalBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> The provisional BDD is automatically freed once the
+  pipeline is quitted.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PipelineExecute"></A>
+int <I></I>
+<B>Cal_PipelineExecute</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> All the results are computed. User should update the
+  BDDs of interest. Eventually this feature would become transparent.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PipelineInit"></A>
+int <I></I>
+<B>Cal_PipelineInit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddOp_t  <b>bddOp</b> <i></i>
+)
+</pre>
+<dd> All the operations for this pipeline must be of the
+  same kind.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PipelineQuit"></A>
+void <I></I>
+<B>Cal_PipelineQuit</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> The user must make sure to update all provisional BDDs
+  of interest before calling this routine.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PipelineSetDepth"></A>
+void <I></I>
+<B>Cal_PipelineSetDepth</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>depth</b> <i></i>
+)
+</pre>
+<dd> The "depth" determines the amount of dependency we
+  would allow in pipelined computation.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_PipelineUpdateProvisionalBdd"></A>
+Cal_Bdd <I></I>
+<B>Cal_PipelineUpdateProvisionalBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>provisionalBdd</b> <i></i>
+)
+</pre>
+<dd> The provisional BDD is automatically freed after
+  quitting pipeline.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPipeline.c"TARGET="ABSTRACT"><CODE>calPipeline.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_TempAssociationAugment"></A>
+void <I></I>
+<B>Cal_TempAssociationAugment</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>associationInfoUserBdds</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> Pairs is 0 if the information represents only a list of
+  variables rather than a full association.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_TempAssociationInit"></A>
+void <I></I>
+<B>Cal_TempAssociationInit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>associationInfoUserBdds</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> Pairs is 0 if the information represents only a list of
+  variables rather than a full association.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cal_TempAssociationQuit"></A>
+void <I></I>
+<B>Cal_TempAssociationQuit</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Cleans up temporary associationoptional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="CeilLog2"></A>
+static int <I></I>
+<B>CeilLog2</B>(
+  int  <b>number</b> <i></i>
+)
+</pre>
+<dd> Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddOp.c"TARGET="ABSTRACT"><CODE>calBddOp.c</CODE></A>
+
+<dt><pre>
+<A NAME="CeilLog2"></A>
+static int <I></I>
+<B>CeilLog2</B>(
+  int  <b>number</b> <i></i>
+)
+</pre>
+<dd> Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calGC.c"TARGET="ABSTRACT"><CODE>calGC.c</CODE></A>
+
+<dt><pre>
+<A NAME="CeilLog2"></A>
+static int <I></I>
+<B>CeilLog2</B>(
+  int  <b>number</b> <i></i>
+)
+</pre>
+<dd> Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTable.c"TARGET="ABSTRACT"><CODE>calHashTable.c</CODE></A>
+
+<dt><pre>
+<A NAME="CeilLog2"></A>
+static int <I></I>
+<B>CeilLog2</B>(
+  int  <b>number</b> <i></i>
+)
+</pre>
+<dd> Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="CeilingLog2"></A>
+static int <I></I>
+<B>CeilingLog2</B>(
+  Cal_Address_t  <b>i</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="Chars"></A>
+static void <I></I>
+<B>Chars</B>(
+  char  <b>c</b>, <i></i>
+  int  <b>n</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrint.c"TARGET="ABSTRACT"><CODE>calPrint.c</CODE></A>
+
+<dt><pre>
+<A NAME="CheckAssoc"></A>
+static int <I></I>
+<B>CheckAssoc</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>assocInfo</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calAssociation.c"TARGET="ABSTRACT"><CODE>calAssociation.c</CODE></A>
+
+<dt><pre>
+<A NAME="CheckValidityOfNodes"></A>
+static int <I></I>
+<B>CheckValidityOfNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  long  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="CofactorFixAndReclaimForwardedNodes"></A>
+static int <I></I>
+<B>CofactorFixAndReclaimForwardedNodes</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int  <b>cofactorCheckStartIndex</b>, <i></i>
+  int  <b>cofactorCheckEndIndex</b>, <i></i>
+  int  <b>reclaimStartIndex</b>, <i></i>
+  int  <b>reclaimEndIndex</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="Cofactor"></A>
+static TruthTable_t <I></I>
+<B>Cofactor</B>(
+  TruthTable_t  <b>table</b>, <i></i>
+  int  <b>var</b>, <i></i>
+  int  <b>value</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="Decode"></A>
+static Cal_Bdd <I></I>
+<B>Decode</B>(
+  int  <b>var</b>, <i></i>
+  TruthTable_t  <b>table</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="Error"></A>
+static void <I></I>
+<B>Error</B>(
+  char * <b>op</b>, <i></i>
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>result</b>, <i></i>
+  Cal_Bdd  <b>expected</b>, <i></i>
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="GetRandomNumbers"></A>
+static void <I></I>
+<B>GetRandomNumbers</B>(
+  int  <b>lowerBound</b>, <i></i>
+  int  <b>upperBound</b>, <i></i>
+  int  <b>count</b>, <i></i>
+  int * <b>resultVector</b> <i></i>
+)
+</pre>
+<dd> The restriction is that count <= upperBound-lowerBound+1. The
+  size of the resultVector should be >= count.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableAddDirect"></A>
+static void <I></I>
+<B>HashTableAddDirect</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalBddNode_t * <b>bddNode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableApply"></A>
+static void <I></I>
+<B>HashTableApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>reqQueAtPipeDepth</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b>, <i></i>
+  unsigned long  <b>opCode</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableCofactorApply"></A>
+static void <I></I>
+<B>HashTableCofactorApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>cofactorHashTableArray</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableCofactorReduce"></A>
+static void <I></I>
+<B>HashTableCofactorReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t * <b>uniqueTableForId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableFindOrAdd"></A>
+static int <I></I>
+<B>HashTableFindOrAdd</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalBddNode_t * <b>thenBdd</b>, <i></i>
+  CalBddNode_t * <b>elseBdd</b>, <i></i>
+  CalBddNode_t ** <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableOneRehash"></A>
+static void <I></I>
+<B>HashTableOneRehash</B>(
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  int  <b>grow</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calHashTableOne.c"TARGET="ABSTRACT"><CODE>calHashTableOne.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableReduceApply"></A>
+static void <I></I>
+<B>HashTableReduceApply</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t ** <b>reduceHashTableArray</b>, <i></i>
+  CalHashTable_t ** <b>orHashTableArray</b>, <i></i>
+  CalOpProc_t  <b>calOpProc</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReduce.c"TARGET="ABSTRACT"><CODE>calReduce.c</CODE></A>
+
+<dt><pre>
+<A NAME="HashTableReduce"></A>
+static void <I></I>
+<B>HashTableReduce</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalHashTable_t * <b>uniqueTableForId</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calQuant.c"TARGET="ABSTRACT"><CODE>calQuant.c</CODE></A>
+
+<dt><pre>
+<A NAME="IndexCmp"></A>
+static int <I></I>
+<B>IndexCmp</B>(
+  const void * <b>p1</b>, <i></i>
+  const void * <b>p2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddSatisfy.c"TARGET="ABSTRACT"><CODE>calBddSatisfy.c</CODE></A>
+
+<dt><pre>
+<A NAME="MergeAndFree"></A>
+static void <I></I>
+<B>MergeAndFree</B>(
+  Block  <b>b</b> <i></i>
+)
+</pre>
+<dd> MergeAndFree(b) repeatedly merges b its Buddy until b has no Buddy or the Buddy isn't free, then adds the result to the  appropriate free list.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="PageAlign"></A>
+static CalAddress_t * <I></I>
+<B>PageAlign</B>(
+  CalAddress_t * <b>p</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="PageManagerExpandStorage"></A>
+static int <I></I>
+<B>PageManagerExpandStorage</B>(
+  CalPageManager_t * <b>pageManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> The size of the segment is stored in one of the fields
+              of page manager - numPagesPerSegment. If a memory
+              segment of a specific size cannot be allocated, the
+              routine calls itself recursively by reducing
+              numPagesPerSegment by a factor of 2.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="PrintBddProfileAfterReorder"></A>
+static void <I></I>
+<B>PrintBddProfileAfterReorder</B>(
+  Cal_BddManager_t * <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderBF.c"TARGET="ABSTRACT"><CODE>calReorderBF.c</CODE></A>
+
+<dt><pre>
+<A NAME="PrintBdd"></A>
+static void <I></I>
+<B>PrintBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="RandomTests"></A>
+static void <I></I>
+<B>RandomTests</B>(
+  int  <b>numVars</b>, <i></i>
+  int  <b>iterations</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="Read"></A>
+static unsigned long <I></I>
+<B>Read</B>(
+  int * <b>error</b>, <i></i>
+  int  <b>bytes</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="RemoveFromFreeList"></A>
+static Block <I></I>
+<B>RemoveFromFreeList</B>(
+  Block  <b>b</b> <i></i>
+)
+</pre>
+<dd> RemoveFromFreeList(b) removes b from the free list which it is on.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="SegmentToPageList"></A>
+static int <I></I>
+<B>SegmentToPageList</B>(
+  CalAddress_t * <b>segment</b>, <i></i>
+  int  <b>numPages</b>, <i></i>
+  CalAddress_t * <b>lastPointer</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMemoryManagement.c"TARGET="ABSTRACT"><CODE>calMemoryManagement.c</CODE></A>
+
+<dt><pre>
+<A NAME="SweepVarTable"></A>
+static void <I></I>
+<B>SweepVarTable</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  long  <b>id</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestAnd"></A>
+static void <I></I>
+<B>TestAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestArrayOp"></A>
+static void <I></I>
+<B>TestArrayOp</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>numBdds</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestAssoc"></A>
+static void <I></I>
+<B>TestAssoc</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  TruthTable_t  <b>table</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestCompose"></A>
+static void <I></I>
+<B>TestCompose</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestDump"></A>
+static void <I></I>
+<B>TestDump</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestGenCof"></A>
+static void <I></I>
+<B>TestGenCof</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestITE"></A>
+static void <I></I>
+<B>TestITE</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  Cal_Bdd  <b>f3</b>, <i></i>
+  TruthTable_t  <b>table3</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestIdNot"></A>
+static void <I></I>
+<B>TestIdNot</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  TruthTable_t  <b>table</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestInterImpl"></A>
+static void <I></I>
+<B>TestInterImpl</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestMultiwayAnd"></A>
+static void <I></I>
+<B>TestMultiwayAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  Cal_Bdd  <b>f3</b>, <i></i>
+  TruthTable_t  <b>table3</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestMultiwayLarge"></A>
+static void <I></I>
+<B>TestMultiwayLarge</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>numBdds</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestMultiwayOr"></A>
+static void <I></I>
+<B>TestMultiwayOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  Cal_Bdd  <b>f3</b>, <i></i>
+  TruthTable_t  <b>table3</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestNand"></A>
+static void <I></I>
+<B>TestNand</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestOr"></A>
+static void <I></I>
+<B>TestOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestPipeline"></A>
+static void <I></I>
+<B>TestPipeline</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  Cal_Bdd  <b>f3</b>, <i></i>
+  TruthTable_t  <b>table3</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestQnt"></A>
+static void <I></I>
+<B>TestQnt</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  TruthTable_t  <b>table</b>, <i></i>
+  int  <b>bfZeroBFPlusDFOne</b>, <i></i>
+  int  <b>cacheExistsResultsFlag</b>, <i></i>
+  int  <b>cacheOrResultsFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestReduce"></A>
+static void <I></I>
+<B>TestReduce</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestRelProd"></A>
+static void <I></I>
+<B>TestRelProd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  int  <b>bfZeroBFPlusDFOne</b>, <i></i>
+  int  <b>cacheRelProdResultsFlag</b>, <i></i>
+  int  <b>cacheAndResultsFlag</b>, <i></i>
+  int  <b>cacheOrResultsFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestReorderBlock"></A>
+static void <I></I>
+<B>TestReorderBlock</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  TruthTable_t  <b>table</b>, <i></i>
+  Cal_Bdd  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestReorder"></A>
+static void <I></I>
+<B>TestReorder</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  TruthTable_t  <b>table</b>, <i></i>
+  Cal_Bdd  <b>f</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestSatisfy"></A>
+static void <I></I>
+<B>TestSatisfy</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  TruthTable_t  <b>table</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestSize"></A>
+static void <I></I>
+<B>TestSize</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestSubstitute"></A>
+static void <I></I>
+<B>TestSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  Cal_Bdd  <b>f3</b>, <i></i>
+  TruthTable_t  <b>table3</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestSwapVars"></A>
+static void <I></I>
+<B>TestSwapVars</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  TruthTable_t  <b>table</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestVarSubstitute"></A>
+static void <I></I>
+<B>TestVarSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b>, <i></i>
+  Cal_Bdd  <b>f3</b>, <i></i>
+  TruthTable_t  <b>table3</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TestXor"></A>
+static void <I></I>
+<B>TestXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f1</b>, <i></i>
+  TruthTable_t  <b>table1</b>, <i></i>
+  Cal_Bdd  <b>f2</b>, <i></i>
+  TruthTable_t  <b>table2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="TrimToSize"></A>
+static void <I></I>
+<B>TrimToSize</B>(
+  Block  <b>b</b>, <i></i>
+  int  <b>sizeIndex</b> <i></i>
+)
+</pre>
+<dd> TrimToSize(b, sizeIndex) repeatedly splits b until it has  the indicated size.  Blocks which are split off are added to the appropriate free list.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calMem.c"TARGET="ABSTRACT"><CODE>calMem.c</CODE></A>
+
+<dt><pre>
+<A NAME="UniqueTableForIdFindOrAdd"></A>
+static int <I></I>
+<B>UniqueTableForIdFindOrAdd</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  CalHashTable_t * <b>hashTable</b>, <i></i>
+  CalBddNode_t * <b>thenBdd</b>, <i></i>
+  CalBddNode_t * <b>elseBdd</b>, <i></i>
+  CalBddNode_t ** <b>bddPtr</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> If a new BDD node is created (found == false), then the
+  numNodes field of the manager needs to be incremented.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calReorderDF.c"TARGET="ABSTRACT"><CODE>calReorderDF.c</CODE></A>
+
+<dt><pre>
+<A NAME="Write"></A>
+static void <I></I>
+<B>Write</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  unsigned long  <b>n</b>, <i></i>
+  int  <b>bytes</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calDump.c"TARGET="ABSTRACT"><CODE>calDump.c</CODE></A>
+
+<dt><pre>
+<A NAME="asAddress"></A>
+static void <I></I>
+<B>asAddress</B>(
+  double  <b>n</b>, <i></i>
+  CalAddress_t * <b>r1</b>, <i></i>
+  CalAddress_t * <b>r2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="asDouble"></A>
+static double <I></I>
+<B>asDouble</B>(
+  CalAddress_t  <b>v1</b>, <i></i>
+  CalAddress_t  <b>v2</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="chars"></A>
+static void <I></I>
+<B>chars</B>(
+  char  <b>c</b>, <i></i>
+  int  <b>n</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPrintProfile.c"TARGET="ABSTRACT"><CODE>calPrintProfile.c</CODE></A>
+
+<dt><pre>
+<A NAME="cpuTime"></A>
+static double <I></I>
+<B>cpuTime</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="cpuTime"></A>
+static double <I></I>
+<B>cpuTime</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddReorderTest.c"TARGET="ABSTRACT"><CODE>calBddReorderTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="ddClearLocal"></A>
+static void <I></I>
+<B>ddClearLocal</B>(
+  Cal_Bdd_t  <b>f</b> <i></i>
+)
+</pre>
+<dd> Performs a DFS from f, clearing the LSB of the then pointers.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calInteract.c"TARGET="ABSTRACT"><CODE>calInteract.c</CODE></A>
+
+<dt><pre>
+<A NAME="ddSuppInteract"></A>
+static void <I></I>
+<B>ddSuppInteract</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  Cal_Bdd_t  <b>f</b>, <i></i>
+  int * <b>support</b> <i></i>
+)
+</pre>
+<dd> Performs a DFS from f. Uses the LSB of the then pointer
+  as visited flag.
+<p>
+
+<dd> <b>Side Effects</b> Accumulates in support the variables on which f depends.
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calInteract.c"TARGET="ABSTRACT"><CODE>calInteract.c</CODE></A>
+
+<dt><pre>
+<A NAME="ddUpdateInteract"></A>
+static void <I></I>
+<B>ddUpdateInteract</B>(
+  Cal_BddManager_t * <b>bddManager</b>, <i></i>
+  int * <b>support</b> <i></i>
+)
+</pre>
+<dd> If support[i
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calInteract.c"TARGET="ABSTRACT"><CODE>calInteract.c</CODE></A>
+
+<dt><pre>
+<A NAME="elapsedTime"></A>
+static long <I></I>
+<B>elapsedTime</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddReorderTest.c"TARGET="ABSTRACT"><CODE>calBddReorderTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="elapsedTime"></A>
+static long <I></I>
+<B>elapsedTime</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="handler"></A>
+static void <I></I>
+<B>handler</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="main"></A>
+int <I></I>
+<B>main</B>(
+  int  <b>argc</b>, <i></i>
+  char ** <b>argv</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calBddReorderTest.c"TARGET="ABSTRACT"><CODE>calBddReorderTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="main"></A>
+int <I></I>
+<B>main</B>(
+  int  <b>argc</b>, <i></i>
+  char ** <b>argv</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="pageFaults"></A>
+static long <I></I>
+<B>pageFaults</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calPerformanceTest.c"TARGET="ABSTRACT"><CODE>calPerformanceTest.c</CODE></A>
+
+<dt><pre>
+<A NAME="terminalIdFn"></A>
+static char * <I></I>
+<B>terminalIdFn</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  CalAddress_t  <b>v1</b>, <i></i>
+  CalAddress_t  <b>v2</b>, <i></i>
+  Cal_Pointer_t  <b>pointer</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<DD> <B>Defined in </B> <A HREF="calAllFile.html#calTest.c"TARGET="ABSTRACT"><CODE>calTest.c</CODE></A>
+
+
+</DL>
+<HR>
+Last updated on 970711 20h11
+</BODY></HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calAllFile.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calAllFile.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calAllFile.html	(revision 6)
@@ -0,0 +1,1756 @@
+<HTML>
+<HEAD><TITLE>The cal package: files</TITLE></HEAD>
+<BODY>
+
+<DL>
+ <DT> <A HREF="#cal.h"><CODE>cal.h</CODE></A>
+ <DD> External header file
+ <DT> <A HREF="#calInt.h"><CODE>calInt.h</CODE></A>
+ <DD> Internal header file
+ <DT> <A HREF="#cal.c"><CODE>cal.c</CODE></A>
+ <DD> Miscellaneous collection of exported BDD functions
+ <DT> <A HREF="#calApplyReduce.c"><CODE>calApplyReduce.c</CODE></A>
+ <DD> Generic routines for processing temporary nodes during
+  "apply" and "reduce" phases.
+ <DT> <A HREF="#calAssociation.c"><CODE>calAssociation.c</CODE></A>
+ <DD> Contains the routines related to the variable association.
+ <DT> <A HREF="#calBddCompose.c"><CODE>calBddCompose.c</CODE></A>
+ <DD> Routine for composing one BDD into another.
+ <DT> <A HREF="#calBddITE.c"><CODE>calBddITE.c</CODE></A>
+ <DD> Routine for computing ITE of 3 BDD operands.
+ <DT> <A HREF="#calBddManager.c"><CODE>calBddManager.c</CODE></A>
+ <DD> Routines for maintaing the manager and creating
+  variables etc.
+ <DT> <A HREF="#calBddOp.c"><CODE>calBddOp.c</CODE></A>
+ <DD> Routines for performing simple boolean operations on a
+  pair of BDDs or on an array of pair of BDDs or on an array of BDDs.
+ <DT> <A HREF="#calBddReorderTest.c"><CODE>calBddReorderTest.c</CODE></A>
+ <DD> A test routine for checking the functionality of
+  dynamic reordering.
+ <DT> <A HREF="#calBddSatisfy.c"><CODE>calBddSatisfy.c</CODE></A>
+ <DD> Routines for BDD satisfying valuation.
+ <DT> <A HREF="#calBddSize.c"><CODE>calBddSize.c</CODE></A>
+ <DD> BDD size and profile routines
+ <DT> <A HREF="#calBddSubstitute.c"><CODE>calBddSubstitute.c</CODE></A>
+ <DD> Routine for simultaneous substitution of an array of
+  variables with an array of functions.
+ <DT> <A HREF="#calBddSupport.c"><CODE>calBddSupport.c</CODE></A>
+ <DD> Routines related to the support of a BDD.
+ <DT> <A HREF="#calBddSwapVars.c"><CODE>calBddSwapVars.c</CODE></A>
+ <DD> Routine for swapping two variables.
+ <DT> <A HREF="#calBddVarSubstitute.c"><CODE>calBddVarSubstitute.c</CODE></A>
+ <DD> Routine for simultaneous substitution of an array of
+  variables with another array of variables.
+ <DT> <A HREF="#calBlk.c"><CODE>calBlk.c</CODE></A>
+ <DD> Routines for manipulating blocks of variables.
+ <DT> <A HREF="#calCacheTableTwo.c"><CODE>calCacheTableTwo.c</CODE></A>
+ <DD> Functions to manage the Cache tables.
+ <DT> <A HREF="#calDump.c"><CODE>calDump.c</CODE></A>
+ <DD> BDD library dump/undump routines
+ <DT> <A HREF="#calGC.c"><CODE>calGC.c</CODE></A>
+ <DD> Garbage collection routines
+ <DT> <A HREF="#calHashTable.c"><CODE>calHashTable.c</CODE></A>
+ <DD> Functions to manage the hash tables that are a part of
+                  1. unique table
+                  2. request queue
+ <DT> <A HREF="#calHashTableOne.c"><CODE>calHashTableOne.c</CODE></A>
+ <DD> Routines for managing hash table with Bdd is a key and
+               int, long, or double as a value
+ <DT> <A HREF="#calHashTableThree.c"><CODE>calHashTableThree.c</CODE></A>
+ <DD> Functions to manage the hash tables that are a part of
+                  ITE operation
+ <DT> <A HREF="#calInteract.c"><CODE>calInteract.c</CODE></A>
+ <DD> Functions to manipulate the variable interaction matrix.
+ <DT> <A HREF="#calMem.c"><CODE>calMem.c</CODE></A>
+ <DD> Routines for memory management.
+ <DT> <A HREF="#calMemoryManagement.c"><CODE>calMemoryManagement.c</CODE></A>
+ <DD> Special memory management routines specific to CAL.
+ <DT> <A HREF="#calPerformanceTest.c"><CODE>calPerformanceTest.c</CODE></A>
+ <DD> This file contains the performance test routines for
+  the CAL package.
+ <DT> <A HREF="#calPipeline.c"><CODE>calPipeline.c</CODE></A>
+ <DD> Routines for creating and managing the pipelined BDD
+  operations.
+ <DT> <A HREF="#calPrint.c"><CODE>calPrint.c</CODE></A>
+ <DD> Routine for printing a BDD.
+ <DT> <A HREF="#calPrintProfile.c"><CODE>calPrintProfile.c</CODE></A>
+ <DD> Routines for printing various profiles for a BDD.
+ <DT> <A HREF="#calQuant.c"><CODE>calQuant.c</CODE></A>
+ <DD> Routines for existential/universal quantification and
+  relational product.
+ <DT> <A HREF="#calReduce.c"><CODE>calReduce.c</CODE></A>
+ <DD> Routines for optimizing a BDD with respect to a don't
+  care set (cofactor and restrict).
+ <DT> <A HREF="#calReorderBF.c"><CODE>calReorderBF.c</CODE></A>
+ <DD> Routines for dynamic reordering of variables.
+ <DT> <A HREF="#calReorderDF.c"><CODE>calReorderDF.c</CODE></A>
+ <DD> Routines for dynamic reordering of variables.
+ <DT> <A HREF="#calReorderUtil.c"><CODE>calReorderUtil.c</CODE></A>
+ <DD> Some utility routines used by both breadth-first and
+  depth-first reordering techniques.
+ <DT> <A HREF="#calTerminal.c"><CODE>calTerminal.c</CODE></A>
+ <DD> Contains the terminal function for various BDD operations.
+ <DT> <A HREF="#calTest.c"><CODE>calTest.c</CODE></A>
+ <DD> This file contains the test routines for the CAL package.
+ <DT> <A HREF="#calUtil.c"><CODE>calUtil.c</CODE></A>
+ <DD> Utility functions for the Cal package.
+</DL><HR>
+<A NAME="cal.h"><H1>cal.h</H1></A>
+External header file <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+</DL>
+<HR>
+<A NAME="calInt.h"><H1>calInt.h</H1></A>
+Internal header file <P>
+<B>By: Rajeev K. Ranjan (rajeev@ic.eecs.berkeley.edu
+               Jagesh Sanghavi  (sanghavi@ic.eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#cal.h"><CODE>cal.h</CODE></A>
+<DL>
+</DL>
+<HR>
+<A NAME="cal.c"><H1>cal.c</H1></A>
+Miscellaneous collection of exported BDD functions <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu</B><P>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddIsEqual" TARGET="MAIN"><CODE>Cal_BddIsEqual()</CODE></A>
+ <DD> Returns 1 if argument BDDs are equal, 0 otherwise.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIsBddOne" TARGET="MAIN"><CODE>Cal_BddIsBddOne()</CODE></A>
+ <DD> Returns 1 if the argument BDD is constant one, 0 otherwise.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIsBddZero" TARGET="MAIN"><CODE>Cal_BddIsBddZero()</CODE></A>
+ <DD> Returns 1 if the argument BDD is constant zero, 0 otherwise.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIsBddNull" TARGET="MAIN"><CODE>Cal_BddIsBddNull()</CODE></A>
+ <DD> Returns 1 if the argument BDD is NULL, 0 otherwise.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIsBddConst" TARGET="MAIN"><CODE>Cal_BddIsBddConst()</CODE></A>
+ <DD> Returns 1 if the argument BDD is a constant, 0 otherwise.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIdentity" TARGET="MAIN"><CODE>Cal_BddIdentity()</CODE></A>
+ <DD> Returns the duplicate BDD of the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddOne" TARGET="MAIN"><CODE>Cal_BddOne()</CODE></A>
+ <DD> Returns the BDD for the constant one
+
+ <DT> <A HREF="calAllDet.html#Cal_BddZero" TARGET="MAIN"><CODE>Cal_BddZero()</CODE></A>
+ <DD> Returns the BDD for the constant zero
+
+ <DT> <A HREF="calAllDet.html#Cal_BddNot" TARGET="MAIN"><CODE>Cal_BddNot()</CODE></A>
+ <DD> Returns the complement of the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddGetIfIndex" TARGET="MAIN"><CODE>Cal_BddGetIfIndex()</CODE></A>
+ <DD> Returns the index of the top variable of the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddGetIfId" TARGET="MAIN"><CODE>Cal_BddGetIfId()</CODE></A>
+ <DD> Returns the id of the top variable of the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIf" TARGET="MAIN"><CODE>Cal_BddIf()</CODE></A>
+ <DD> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddThen" TARGET="MAIN"><CODE>Cal_BddThen()</CODE></A>
+ <DD> Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddElse" TARGET="MAIN"><CODE>Cal_BddElse()</CODE></A>
+ <DD> Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddFree" TARGET="MAIN"><CODE>Cal_BddFree()</CODE></A>
+ <DD> Frees the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddUnFree" TARGET="MAIN"><CODE>Cal_BddUnFree()</CODE></A>
+ <DD> Unfrees the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddGetRegular" TARGET="MAIN"><CODE>Cal_BddGetRegular()</CODE></A>
+ <DD> Returns a BDD with positive from a given BDD with arbitrary phase
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIntersects" TARGET="MAIN"><CODE>Cal_BddIntersects()</CODE></A>
+ <DD> Computes a BDD that implies conjunction of f and g.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddImplies" TARGET="MAIN"><CODE>Cal_BddImplies()</CODE></A>
+ <DD> Computes a BDD that implies conjunction of f and Cal_BddNot(g)
+
+ <DT> <A HREF="calAllDet.html#Cal_BddTotalSize" TARGET="MAIN"><CODE>Cal_BddTotalSize()</CODE></A>
+ <DD> Returns the number of nodes in the Unique table
+
+ <DT> <A HREF="calAllDet.html#Cal_BddStats" TARGET="MAIN"><CODE>Cal_BddStats()</CODE></A>
+ <DD> Prints miscellaneous BDD statistics
+
+ <DT> <A HREF="calAllDet.html#Cal_BddDynamicReordering" TARGET="MAIN"><CODE>Cal_BddDynamicReordering()</CODE></A>
+ <DD> Specify dynamic reordering technique.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddReorder" TARGET="MAIN"><CODE>Cal_BddReorder()</CODE></A>
+ <DD> Invoke the current dynamic reodering method.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddType" TARGET="MAIN"><CODE>Cal_BddType()</CODE></A>
+ <DD> Returns type of a BDD ( 0, 1, +var, -var, ovrflow, nonterminal)
+
+ <DT> <A HREF="calAllDet.html#Cal_BddVars" TARGET="MAIN"><CODE>Cal_BddVars()</CODE></A>
+ <DD> Returns the number of BDD variables
+
+ <DT> <A HREF="calAllDet.html#Cal_BddNodeLimit" TARGET="MAIN"><CODE>Cal_BddNodeLimit()</CODE></A>
+ <DD> Sets the node limit to new_limit and returns the old limit.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddOverflow" TARGET="MAIN"><CODE>Cal_BddOverflow()</CODE></A>
+ <DD> Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIsCube" TARGET="MAIN"><CODE>Cal_BddIsCube()</CODE></A>
+ <DD> Returns 1 if the argument BDD is a cube, 0 otherwise
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerGetHooks" TARGET="MAIN"><CODE>Cal_BddManagerGetHooks()</CODE></A>
+ <DD> Returns the hooks field of the manager.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerSetHooks" TARGET="MAIN"><CODE>Cal_BddManagerSetHooks()</CODE></A>
+ <DD> Sets the hooks field of the manager.
+
+ <DT> <A HREF="calAllDet.html#CalBddIf" TARGET="MAIN"><CODE>CalBddIf()</CODE></A>
+ <DD> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#CalBddIsCubeStep" TARGET="MAIN"><CODE>CalBddIsCubeStep()</CODE></A>
+ <DD> Returns 1 if the argument BDD is a cube, 0 otherwise
+
+ <DT> <A HREF="calAllDet.html#CalBddTypeAux" TARGET="MAIN"><CODE>CalBddTypeAux()</CODE></A>
+ <DD> Returns the BDD type by recursively traversing the argument BDD
+
+ <DT> <A HREF="calAllDet.html#CalBddIdentity" TARGET="MAIN"><CODE>CalBddIdentity()</CODE></A>
+ <DD> Returns the duplicate BDD of the argument BDD.
+
+ <DT> <A HREF="calAllDet.html#BddIntersectsStep" TARGET="MAIN"><CODE>BddIntersectsStep()</CODE></A>
+ <DD> Recursive routine to returns a BDD that implies conjunction of
+  argument BDDs
+
+</DL>
+<HR>
+<A NAME="calApplyReduce.c"><H1>calApplyReduce.c</H1></A>
+Generic routines for processing temporary nodes during
+  "apply" and "reduce" phases. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalHashTableApply" TARGET="MAIN"><CODE>CalHashTableApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableReduce" TARGET="MAIN"><CODE>CalHashTableReduce()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calAssociation.c"><H1>calAssociation.c</H1></A>
+Contains the routines related to the variable association. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi  (sanghavi@eecs.berkeley.edu)</B><P>
+optional <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_AssociationInit" TARGET="MAIN"><CODE>Cal_AssociationInit()</CODE></A>
+ <DD> Creates or finds a variable association.
+
+ <DT> <A HREF="calAllDet.html#Cal_AssociationQuit" TARGET="MAIN"><CODE>Cal_AssociationQuit()</CODE></A>
+ <DD> Deletes the variable association given by id
+
+ <DT> <A HREF="calAllDet.html#Cal_AssociationSetCurrent" TARGET="MAIN"><CODE>Cal_AssociationSetCurrent()</CODE></A>
+ <DD> Sets the current variable association to the one given by id and
+  returns the ID of the old association.
+
+ <DT> <A HREF="calAllDet.html#Cal_TempAssociationAugment" TARGET="MAIN"><CODE>Cal_TempAssociationAugment()</CODE></A>
+ <DD> Adds to the temporary variable association.
+
+ <DT> <A HREF="calAllDet.html#Cal_TempAssociationInit" TARGET="MAIN"><CODE>Cal_TempAssociationInit()</CODE></A>
+ <DD> Sets the temporary variable association.
+
+ <DT> <A HREF="calAllDet.html#Cal_TempAssociationQuit" TARGET="MAIN"><CODE>Cal_TempAssociationQuit()</CODE></A>
+ <DD> Cleans up temporary association
+
+ <DT> <A HREF="calAllDet.html#CalAssociationListFree" TARGET="MAIN"><CODE>CalAssociationListFree()</CODE></A>
+ <DD> Frees the variable associations
+
+ <DT> <A HREF="calAllDet.html#CalVarAssociationRepackUpdate" TARGET="MAIN"><CODE>CalVarAssociationRepackUpdate()</CODE></A>
+ <DD> Need to be called after repacking.
+
+ <DT> <A HREF="calAllDet.html#CalCheckAssociationValidity" TARGET="MAIN"><CODE>CalCheckAssociationValidity()</CODE></A>
+ <DD> Checks the validity of association.
+
+ <DT> <A HREF="calAllDet.html#CalReorderAssociationFix" TARGET="MAIN"><CODE>CalReorderAssociationFix()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#AssociationIsEqual" TARGET="MAIN"><CODE>AssociationIsEqual()</CODE></A>
+ <DD> Checks for equality of two associations
+
+ <DT> <A HREF="calAllDet.html#CheckAssoc" TARGET="MAIN"><CODE>CheckAssoc()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBddCompose.c"><H1>calBddCompose.c</H1></A>
+Routine for composing one BDD into another. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddCompose" TARGET="MAIN"><CODE>Cal_BddCompose()</CODE></A>
+ <DD> composition - substitute a BDD variable by a function
+
+ <DT> <A HREF="calAllDet.html#CalRequestNodeListCompose" TARGET="MAIN"><CODE>CalRequestNodeListCompose()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableComposeApply" TARGET="MAIN"><CODE>CalHashTableComposeApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalComposeRequestCreate" TARGET="MAIN"><CODE>CalComposeRequestCreate()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBddITE.c"><H1>calBddITE.c</H1></A>
+Routine for computing ITE of 3 BDD operands. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddITE" TARGET="MAIN"><CODE>Cal_BddITE()</CODE></A>
+ <DD> Returns the BDD for logical If-Then-Else
+
+  Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+  - f g + f' h
+
+ <DT> <A HREF="calAllDet.html#CalRequestNodeListArrayITE" TARGET="MAIN"><CODE>CalRequestNodeListArrayITE()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddOpITEBF" TARGET="MAIN"><CODE>CalBddOpITEBF()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableITEApply" TARGET="MAIN"><CODE>CalHashTableITEApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddITE" TARGET="MAIN"><CODE>CalBddITE()</CODE></A>
+ <DD> Returns the BDD for logical If-Then-Else
+ 
+   Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+   - f g + f' h
+
+</DL>
+<HR>
+<A NAME="calBddManager.c"><H1>calBddManager.c</H1></A>
+Routines for maintaing the manager and creating
+  variables etc. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerInit" TARGET="MAIN"><CODE>Cal_BddManagerInit()</CODE></A>
+ <DD> Creates and initializes a new BDD manager.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerQuit" TARGET="MAIN"><CODE>Cal_BddManagerQuit()</CODE></A>
+ <DD> Frees the BDD manager and all the associated allocations
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerSetParameters" TARGET="MAIN"><CODE>Cal_BddManagerSetParameters()</CODE></A>
+ <DD> Sets appropriate fields of BDD Manager.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerGetNumNodes" TARGET="MAIN"><CODE>Cal_BddManagerGetNumNodes()</CODE></A>
+ <DD> Returns the number of BDD nodes
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarFirst" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarFirst()</CODE></A>
+ <DD> Creates and returns a new variable at the start of the variable
+  order.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarLast" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarLast()</CODE></A>
+ <DD> Creates and returns a new variable at the end of the variable
+  order.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarBefore" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarBefore()</CODE></A>
+ <DD> Creates and returns a new variable before the specified one in
+  the variable order.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerCreateNewVarAfter" TARGET="MAIN"><CODE>Cal_BddManagerCreateNewVarAfter()</CODE></A>
+ <DD> Creates and returns a new variable after the specified one in
+  the variable  order.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerGetVarWithIndex" TARGET="MAIN"><CODE>Cal_BddManagerGetVarWithIndex()</CODE></A>
+ <DD> Returns the variable with the specified index, null if no
+  such variable exists
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerGetVarWithId" TARGET="MAIN"><CODE>Cal_BddManagerGetVarWithId()</CODE></A>
+ <DD> Returns the variable with the specified id, null if no
+  such variable exists
+
+ <DT> <A HREF="calAllDet.html#CalBddManagerCreateNewVar" TARGET="MAIN"><CODE>CalBddManagerCreateNewVar()</CODE></A>
+ <DD> This function creates and returns a new variable with given
+  index value.
+
+ <DT> <A HREF="calAllDet.html#BddDefaultTransformFn" TARGET="MAIN"><CODE>BddDefaultTransformFn()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddManagerPrint" TARGET="MAIN"><CODE>CalBddManagerPrint()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBddOp.c"><H1>calBddOp.c</H1></A>
+Routines for performing simple boolean operations on a
+  pair of BDDs or on an array of pair of BDDs or on an array of BDDs. <P>
+<B>By: Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+The "cal" specific routines are "Cal_BddPairwiseAnd/Or",
+  "Cal_BddMultiwayAnd/Or". <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddAnd" TARGET="MAIN"><CODE>Cal_BddAnd()</CODE></A>
+ <DD> Returns the BDD for logical AND of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddNand" TARGET="MAIN"><CODE>Cal_BddNand()</CODE></A>
+ <DD> Returns the BDD for logical NAND of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddOr" TARGET="MAIN"><CODE>Cal_BddOr()</CODE></A>
+ <DD> Returns the BDD for logical OR of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddNor" TARGET="MAIN"><CODE>Cal_BddNor()</CODE></A>
+ <DD> Returns the BDD for logical NOR of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddXor" TARGET="MAIN"><CODE>Cal_BddXor()</CODE></A>
+ <DD> Returns the BDD for logical exclusive OR of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddXnor" TARGET="MAIN"><CODE>Cal_BddXnor()</CODE></A>
+ <DD> Returns the BDD for logical exclusive NOR of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddPairwiseAnd" TARGET="MAIN"><CODE>Cal_BddPairwiseAnd()</CODE></A>
+ <DD> Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+ <DT> <A HREF="calAllDet.html#Cal_BddPairwiseOr" TARGET="MAIN"><CODE>Cal_BddPairwiseOr()</CODE></A>
+ <DD> Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+ <DT> <A HREF="calAllDet.html#Cal_BddPairwiseXor" TARGET="MAIN"><CODE>Cal_BddPairwiseXor()</CODE></A>
+ <DD> Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+ <DT> <A HREF="calAllDet.html#Cal_BddMultiwayAnd" TARGET="MAIN"><CODE>Cal_BddMultiwayAnd()</CODE></A>
+ <DD> Returns the BDD for logical AND of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddMultiwayOr" TARGET="MAIN"><CODE>Cal_BddMultiwayOr()</CODE></A>
+ <DD> Returns the BDD for logical OR of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddMultiwayXor" TARGET="MAIN"><CODE>Cal_BddMultiwayXor()</CODE></A>
+ <DD> Returns the BDD for logical XOR of argument BDDs
+
+ <DT> <A HREF="calAllDet.html#CalRequestNodeListArrayOp" TARGET="MAIN"><CODE>CalRequestNodeListArrayOp()</CODE></A>
+ <DD> Computes result BDDs for an array of lists, each entry of which 
+  is pair of pointers, each of which points to a operand BDD or an entry in
+  another list with a smaller array index
+
+ <DT> <A HREF="calAllDet.html#CalBddOpBF" TARGET="MAIN"><CODE>CalBddOpBF()</CODE></A>
+ <DD> Internal routine to compute a logical operation on a pair of BDDs
+
+ <DT> <A HREF="calAllDet.html#BddArrayOpBF" TARGET="MAIN"><CODE>BddArrayOpBF()</CODE></A>
+ <DD> Internal common routine for Cal_BddPairwiseAnd and Cal_BddPairwiseOr
+
+ <DT> <A HREF="calAllDet.html#BddMultiwayOp" TARGET="MAIN"><CODE>BddMultiwayOp()</CODE></A>
+ <DD> Internal routine for multiway operations
+
+ <DT> <A HREF="calAllDet.html#BddArrayToRequestNodeListArray" TARGET="MAIN"><CODE>BddArrayToRequestNodeListArray()</CODE></A>
+ <DD> Converts an array of BDDs to a list of requests representing BDD
+  pairs
+
+ <DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+ <DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+</DL>
+<HR>
+<A NAME="calBddReorderTest.c"><H1>calBddReorderTest.c</H1></A>
+A test routine for checking the functionality of
+  dynamic reordering. <P>
+<B>By: Wilsin Gosti    (wilsin@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#main" TARGET="MAIN"><CODE>main()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#cpuTime" TARGET="MAIN"><CODE>cpuTime()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#elapsedTime" TARGET="MAIN"><CODE>elapsedTime()</CODE></A>
+ <DD> Computes the time.
+
+</DL>
+<HR>
+<A NAME="calBddSatisfy.c"><H1>calBddSatisfy.c</H1></A>
+Routines for BDD satisfying valuation. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddSatisfy" TARGET="MAIN"><CODE>Cal_BddSatisfy()</CODE></A>
+ <DD> Returns a BDD which implies f, true for
+               some valuation on which f is true, and which has at most
+               one node at each level
+
+ <DT> <A HREF="calAllDet.html#Cal_BddSatisfySupport" TARGET="MAIN"><CODE>Cal_BddSatisfySupport()</CODE></A>
+ <DD> Returns a special cube contained in f.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddSatisfyingFraction" TARGET="MAIN"><CODE>Cal_BddSatisfyingFraction()</CODE></A>
+ <DD> Returns the fraction of valuations which make f true. (Note that
+  this fraction is independent of whatever set of variables f is supposed to be
+  a function of)
+
+ <DT> <A HREF="calAllDet.html#BddSatisfyStep" TARGET="MAIN"><CODE>BddSatisfyStep()</CODE></A>
+ <DD> Returns a BDD which implies f, is true for some valuation
+  on which f is true, and which has at most one node at each level
+
+ <DT> <A HREF="calAllDet.html#BddSatisfySupportStep" TARGET="MAIN"><CODE>BddSatisfySupportStep()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#IndexCmp" TARGET="MAIN"><CODE>IndexCmp()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddSatisfyingFractionStep" TARGET="MAIN"><CODE>BddSatisfyingFractionStep()</CODE></A>
+ <DD> 
+
+</DL>
+<HR>
+<A NAME="calBddSize.c"><H1>calBddSize.c</H1></A>
+BDD size and profile routines <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddSize" TARGET="MAIN"><CODE>Cal_BddSize()</CODE></A>
+ <DD> Returns the number of nodes in f when negout is nonzero. If
+  negout is zero, we pretend that the BDDs don't have negative-output pointers.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddSizeMultiple" TARGET="MAIN"><CODE>Cal_BddSizeMultiple()</CODE></A>
+ <DD> The routine is like Cal_BddSize, but takes a null-terminated
+               array of BDDs and accounts for sharing of nodes.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddProfile" TARGET="MAIN"><CODE>Cal_BddProfile()</CODE></A>
+ <DD> Returns a "node profile" of f, i.e., the number of nodes at each
+  level in f.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddProfileMultiple" TARGET="MAIN"><CODE>Cal_BddProfileMultiple()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#Cal_BddFunctionProfile" TARGET="MAIN"><CODE>Cal_BddFunctionProfile()</CODE></A>
+ <DD> Returns a "function profile" for f.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddFunctionProfileMultiple" TARGET="MAIN"><CODE>Cal_BddFunctionProfileMultiple()</CODE></A>
+ <DD> Returns a "function profile" for fArray.
+
+ <DT> <A HREF="calAllDet.html#BddMarkBdd" TARGET="MAIN"><CODE>BddMarkBdd()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddCountNoNodes" TARGET="MAIN"><CODE>BddCountNoNodes()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddCountNodes" TARGET="MAIN"><CODE>BddCountNodes()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddSizeStep" TARGET="MAIN"><CODE>BddSizeStep()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddProfileStep" TARGET="MAIN"><CODE>BddProfileStep()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddHighestRefStep" TARGET="MAIN"><CODE>BddHighestRefStep()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddDominatedStep" TARGET="MAIN"><CODE>BddDominatedStep()</CODE></A>
+ <DD> 
+
+</DL>
+<HR>
+<A NAME="calBddSubstitute.c"><H1>calBddSubstitute.c</H1></A>
+Routine for simultaneous substitution of an array of
+  variables with an array of functions. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+Routine for simultaneous substitution of an array of
+  variables with an array of functions. <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddSubstitute" TARGET="MAIN"><CODE>Cal_BddSubstitute()</CODE></A>
+ <DD> Substitute a set of variables by functions
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSubstituteApply" TARGET="MAIN"><CODE>CalHashTableSubstituteApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSubstituteReduce" TARGET="MAIN"><CODE>CalHashTableSubstituteReduce()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBddSupport.c"><H1>calBddSupport.c</H1></A>
+Routines related to the support of a BDD. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddSupport" TARGET="MAIN"><CODE>Cal_BddSupport()</CODE></A>
+ <DD> returns the support of f as a null-terminated array of variables
+
+ <DT> <A HREF="calAllDet.html#Cal_BddDependsOn" TARGET="MAIN"><CODE>Cal_BddDependsOn()</CODE></A>
+ <DD> Returns 1 if f depends on var and returns 0 otherwise.
+
+ <DT> <A HREF="calAllDet.html#CalBddSupportStep" TARGET="MAIN"><CODE>CalBddSupportStep()</CODE></A>
+ <DD> returns the support of f as a null-terminated array of variables
+
+ <DT> <A HREF="calAllDet.html#CalBddUnmarkNodes" TARGET="MAIN"><CODE>CalBddUnmarkNodes()</CODE></A>
+ <DD> recursively unmarks the nodes
+
+ <DT> <A HREF="calAllDet.html#CalBddDependsOnStep" TARGET="MAIN"><CODE>CalBddDependsOnStep()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBddSwapVars.c"><H1>calBddSwapVars.c</H1></A>
+Routine for swapping two variables. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+Routine for swapping two variables. <P>
+<P><B>See Also</B><A HREF="#None"><CODE>None</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddSwapVars" TARGET="MAIN"><CODE>Cal_BddSwapVars()</CODE></A>
+ <DD> Return a function obtained by swapping two variables
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSwapVarsApply" TARGET="MAIN"><CODE>CalHashTableSwapVarsApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSwapVarsPlusApply" TARGET="MAIN"><CODE>CalHashTableSwapVarsPlusApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSwapVarsMinusApply" TARGET="MAIN"><CODE>CalHashTableSwapVarsMinusApply()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBddVarSubstitute.c"><H1>calBddVarSubstitute.c</H1></A>
+Routine for simultaneous substitution of an array of
+  variables with another array of variables. <P>
+<B>By: Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddVarSubstitute" TARGET="MAIN"><CODE>Cal_BddVarSubstitute()</CODE></A>
+ <DD> Substitute a set of variables by set of another variables.
+
+ <DT> <A HREF="calAllDet.html#CalBddVarSubstitute" TARGET="MAIN"><CODE>CalBddVarSubstitute()</CODE></A>
+ <DD> Substitute a set of variables by functions
+
+ <DT> <A HREF="calAllDet.html#CalOpBddVarSubstitute" TARGET="MAIN"><CODE>CalOpBddVarSubstitute()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSubstituteApply" TARGET="MAIN"><CODE>CalHashTableSubstituteApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableSubstituteReduce" TARGET="MAIN"><CODE>CalHashTableSubstituteReduce()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calBlk.c"><H1>calBlk.c</H1></A>
+Routines for manipulating blocks of variables. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu). Modelled on the BDD package
+  developed by David Long.</B><P>
+Routines for manipulating blocks of variables. <P>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddNewVarBlock" TARGET="MAIN"><CODE>Cal_BddNewVarBlock()</CODE></A>
+ <DD> Creates and returns a variable block used for
+  controlling dynamic reordering.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddVarBlockReorderable" TARGET="MAIN"><CODE>Cal_BddVarBlockReorderable()</CODE></A>
+ <DD> Sets the reoderability of a particular block.
+
+ <DT> <A HREF="calAllDet.html#CalBddFindBlock" TARGET="MAIN"><CODE>CalBddFindBlock()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddBlockDelta" TARGET="MAIN"><CODE>CalBddBlockDelta()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddShiftBlock" TARGET="MAIN"><CODE>CalBddShiftBlock()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBlockMemoryConsumption" TARGET="MAIN"><CODE>CalBlockMemoryConsumption()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalFreeBlockRecursively" TARGET="MAIN"><CODE>CalFreeBlockRecursively()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#AddBlock" TARGET="MAIN"><CODE>AddBlock()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calCacheTableTwo.c"><H1>calCacheTableTwo.c</H1></A>
+Functions to manage the Cache tables. <P>
+<B>By: Rajeev K. Ranjan   (rajeev@eecs.berkeley.edu)
+                Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoInit" TARGET="MAIN"><CODE>CalCacheTableTwoInit()</CODE></A>
+ <DD> Initialize a Cache table using default parameters.
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoQuit" TARGET="MAIN"><CODE>CalCacheTableTwoQuit()</CODE></A>
+ <DD> Free a Cache table along with the associated storage.
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoInsert" TARGET="MAIN"><CODE>CalCacheTableTwoInsert()</CODE></A>
+ <DD> Directly insert a BDD node in the Cache table.
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoLookup" TARGET="MAIN"><CODE>CalCacheTableTwoLookup()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoFlush" TARGET="MAIN"><CODE>CalCacheTableTwoFlush()</CODE></A>
+ <DD> Free a Cache table along with the associated storage.
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoFlushAll" TARGET="MAIN"><CODE>CalCacheTableTwoFlushAll()</CODE></A>
+ <DD> Free a Cache table along with the associated storage.
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoGCFlush" TARGET="MAIN"><CODE>CalCacheTableTwoGCFlush()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoRepackUpdate" TARGET="MAIN"><CODE>CalCacheTableTwoRepackUpdate()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckCacheTableValidity" TARGET="MAIN"><CODE>CalCheckCacheTableValidity()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoFixResultPointers" TARGET="MAIN"><CODE>CalCacheTableTwoFixResultPointers()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCacheTablePrint" TARGET="MAIN"><CODE>CalCacheTablePrint()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddManagerGetCacheTableData" TARGET="MAIN"><CODE>CalBddManagerGetCacheTableData()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableRehash" TARGET="MAIN"><CODE>CalCacheTableRehash()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableTwoFlushAssociationId" TARGET="MAIN"><CODE>CalCacheTableTwoFlushAssociationId()</CODE></A>
+ <DD> Flushes the entries from the cache which
+                      correspond to the given associationId.
+
+ <DT> <A HREF="calAllDet.html#CalCacheTableMemoryConsumption" TARGET="MAIN"><CODE>CalCacheTableMemoryConsumption()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CacheTableTwoRehash" TARGET="MAIN"><CODE>CacheTableTwoRehash()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CacheTablePrint" TARGET="MAIN"><CODE>CacheTablePrint()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calDump.c"><H1>calDump.c</H1></A>
+BDD library dump/undump routines <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddUndumpBdd" TARGET="MAIN"><CODE>Cal_BddUndumpBdd()</CODE></A>
+ <DD> Reads a BDD from a file
+
+ <DT> <A HREF="calAllDet.html#Cal_BddDumpBdd" TARGET="MAIN"><CODE>Cal_BddDumpBdd()</CODE></A>
+ <DD> Write a BDD to a file
+
+ <DT> <A HREF="calAllDet.html#Write" TARGET="MAIN"><CODE>Write()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddDumpBddStep" TARGET="MAIN"><CODE>BddDumpBddStep()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#Read" TARGET="MAIN"><CODE>Read()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BddUndumpBddStep" TARGET="MAIN"><CODE>BddUndumpBddStep()</CODE></A>
+ <DD> 
+
+ <DT> <A HREF="calAllDet.html#BytesNeeded" TARGET="MAIN"><CODE>BytesNeeded()</CODE></A>
+ <DD> 
+
+</DL>
+<HR>
+<A NAME="calGC.c"><H1>calGC.c</H1></A>
+Garbage collection routines <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan (rajeev@eecs.berkeley.edu)</B><P>
+optional <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddSetGCMode" TARGET="MAIN"><CODE>Cal_BddSetGCMode()</CODE></A>
+ <DD> Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerGC" TARGET="MAIN"><CODE>Cal_BddManagerGC()</CODE></A>
+ <DD> Invokes the garbage collection at the manager level.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddManagerSetGCLimit" TARGET="MAIN"><CODE>Cal_BddManagerSetGCLimit()</CODE></A>
+ <DD> Sets the limit of the garbage collection.
+
+ <DT> <A HREF="calAllDet.html#CalBddManagerGCCheck" TARGET="MAIN"><CODE>CalBddManagerGCCheck()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableGC" TARGET="MAIN"><CODE>CalHashTableGC()</CODE></A>
+ <DD> This function performs the garbage collection operation
+  for a particular index.
+
+ <DT> <A HREF="calAllDet.html#CalRepackNodesAfterGC" TARGET="MAIN"><CODE>CalRepackNodesAfterGC()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+ <DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+</DL>
+<HR>
+<A NAME="calHashTable.c"><H1>calHashTable.c</H1></A>
+Functions to manage the hash tables that are a part of
+                  1. unique table
+                  2. request queue <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+                Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalHashTableInit" TARGET="MAIN"><CODE>CalHashTableInit()</CODE></A>
+ <DD> Initialize a hash table using default parameters.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableQuit" TARGET="MAIN"><CODE>CalHashTableQuit()</CODE></A>
+ <DD> Free a hash table along with the associated storage.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableAddDirect" TARGET="MAIN"><CODE>CalHashTableAddDirect()</CODE></A>
+ <DD> Directly insert a BDD node in the hash table.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableFindOrAdd" TARGET="MAIN"><CODE>CalHashTableFindOrAdd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableAddDirectAux" TARGET="MAIN"><CODE>CalHashTableAddDirectAux()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableCleanUp" TARGET="MAIN"><CODE>CalHashTableCleanUp()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableLookup" TARGET="MAIN"><CODE>CalHashTableLookup()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableDelete" TARGET="MAIN"><CODE>CalHashTableDelete()</CODE></A>
+ <DD> Deletes a BDD node in the hash table.
+
+ <DT> <A HREF="calAllDet.html#CalUniqueTableForIdLookup" TARGET="MAIN"><CODE>CalUniqueTableForIdLookup()</CODE></A>
+ <DD> Lookup unique table for id.
+
+ <DT> <A HREF="calAllDet.html#CalUniqueTableForIdFindOrAdd" TARGET="MAIN"><CODE>CalUniqueTableForIdFindOrAdd()</CODE></A>
+ <DD> find or add in the unique table for id.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableRehash" TARGET="MAIN"><CODE>CalHashTableRehash()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalUniqueTableForIdRehashNode" TARGET="MAIN"><CODE>CalUniqueTableForIdRehashNode()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddUniqueTableNumLockedNodes" TARGET="MAIN"><CODE>CalBddUniqueTableNumLockedNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalPackNodes" TARGET="MAIN"><CODE>CalPackNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddPackNodesForSingleId" TARGET="MAIN"><CODE>CalBddPackNodesForSingleId()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddPackNodesAfterReorderForSingleId" TARGET="MAIN"><CODE>CalBddPackNodesAfterReorderForSingleId()</CODE></A>
+ <DD> Packs the nodes if the variables which has just
+  been sifted.
+
+ <DT> <A HREF="calAllDet.html#CalBddPackNodesForMultipleIds" TARGET="MAIN"><CODE>CalBddPackNodesForMultipleIds()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+ <DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+</DL>
+<HR>
+<A NAME="calHashTableOne.c"><H1>calHashTableOne.c</H1></A>
+Routines for managing hash table with Bdd is a key and
+               int, long, or double as a value <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalHashTableOneInit" TARGET="MAIN"><CODE>CalHashTableOneInit()</CODE></A>
+ <DD> Initialize a hash table using default parameters.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableOneQuit" TARGET="MAIN"><CODE>CalHashTableOneQuit()</CODE></A>
+ <DD> Free a hash table along with the associated storage.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableOneInsert" TARGET="MAIN"><CODE>CalHashTableOneInsert()</CODE></A>
+ <DD> Directly insert a BDD node in the hash table.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableOneLookup" TARGET="MAIN"><CODE>CalHashTableOneLookup()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#HashTableOneRehash" TARGET="MAIN"><CODE>HashTableOneRehash()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calHashTableThree.c"><H1>calHashTableThree.c</H1></A>
+Functions to manage the hash tables that are a part of
+                  ITE operation <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+                Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+CalHashTableThreeFindOrAdd <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalHashTableThreeFindOrAdd" TARGET="MAIN"><CODE>CalHashTableThreeFindOrAdd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTableThreeRehash" TARGET="MAIN"><CODE>CalHashTableThreeRehash()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calInteract.c"><H1>calInteract.c</H1></A>
+Functions to manipulate the variable interaction matrix. <P>
+<B>By: Original author:Fabio Somenzi. Modified for CAL package
+  by Rajeev K. Ranjan</B><P>
+The interaction matrix tells whether two variables are
+  both in the support of some function of the DD. The main use of the
+  interaction matrix is in the in-place swapping. Indeed, if two
+  variables do not interact, there is no arc connecting the two layers;
+  therefore, the swap can be performed in constant time, without
+  scanning the subtables. Another use of the interaction matrix is in
+  the computation of the lower bounds for sifting. Finally, the
+  interaction matrix can be used to speed up aggregation checks in
+  symmetric and group sifting.<p>
+  The computation of the interaction matrix is done with a series of
+  depth-first searches. The searches start from those nodes that have
+  only external references. The matrix is stored as a packed array of bits;
+  since it is symmetric, only the upper triangle is kept in memory.
+  As a final remark, we note that there may be variables that do
+  intercat, but that for a given variable order have no arc connecting
+  their layers when they are adjacent. <P>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalSetInteract" TARGET="MAIN"><CODE>CalSetInteract()</CODE></A>
+ <DD> Set interaction matrix entries.
+
+ <DT> <A HREF="calAllDet.html#CalTestInteract" TARGET="MAIN"><CODE>CalTestInteract()</CODE></A>
+ <DD> Test interaction matrix entries.
+
+ <DT> <A HREF="calAllDet.html#CalInitInteract" TARGET="MAIN"><CODE>CalInitInteract()</CODE></A>
+ <DD> Initializes the interaction matrix.
+
+ <DT> <A HREF="calAllDet.html#ddSuppInteract" TARGET="MAIN"><CODE>ddSuppInteract()</CODE></A>
+ <DD> Find the support of f.
+
+ <DT> <A HREF="calAllDet.html#ddClearLocal" TARGET="MAIN"><CODE>ddClearLocal()</CODE></A>
+ <DD> Performs a DFS from f, clearing the LSB of the then pointers.
+
+ <DT> <A HREF="calAllDet.html#ddUpdateInteract" TARGET="MAIN"><CODE>ddUpdateInteract()</CODE></A>
+ <DD> Marks as interacting all pairs of variables that appear in
+  support.
+
+</DL>
+<HR>
+<A NAME="calMem.c"><H1>calMem.c</H1></A>
+Routines for memory management. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu). Originally
+  written by David Long.</B><P>
+Contains allocation, free, resize routines. Also has
+  routines for managing records of fixed size. <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_MemFatal" TARGET="MAIN"><CODE>Cal_MemFatal()</CODE></A>
+ <DD> Prints an error message and exits.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemAllocation" TARGET="MAIN"><CODE>Cal_MemAllocation()</CODE></A>
+ <DD> Returns the memory allocated.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemGetBlock" TARGET="MAIN"><CODE>Cal_MemGetBlock()</CODE></A>
+ <DD> Allocates a new block of the specified size.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemFreeBlock" TARGET="MAIN"><CODE>Cal_MemFreeBlock()</CODE></A>
+ <DD> Frees the block.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemResizeBlock" TARGET="MAIN"><CODE>Cal_MemResizeBlock()</CODE></A>
+ <DD> Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemNewRec" TARGET="MAIN"><CODE>Cal_MemNewRec()</CODE></A>
+ <DD> Allocates a record from the specified record manager.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemFreeRec" TARGET="MAIN"><CODE>Cal_MemFreeRec()</CODE></A>
+ <DD> Frees a record managed by the indicated record manager.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemNewRecMgr" TARGET="MAIN"><CODE>Cal_MemNewRecMgr()</CODE></A>
+ <DD> Creates a new record manager with the given  record size.
+
+ <DT> <A HREF="calAllDet.html#Cal_MemFreeRecMgr" TARGET="MAIN"><CODE>Cal_MemFreeRecMgr()</CODE></A>
+ <DD> Frees all the storage associated with the specified record manager.
+
+ <DT> <A HREF="calAllDet.html#CeilingLog2" TARGET="MAIN"><CODE>CeilingLog2()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BlockSizeIndex" TARGET="MAIN"><CODE>BlockSizeIndex()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#AddToFreeList" TARGET="MAIN"><CODE>AddToFreeList()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#RemoveFromFreeList" TARGET="MAIN"><CODE>RemoveFromFreeList()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#Buddy" TARGET="MAIN"><CODE>Buddy()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TrimToSize" TARGET="MAIN"><CODE>TrimToSize()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#MergeAndFree" TARGET="MAIN"><CODE>MergeAndFree()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calMemoryManagement.c"><H1>calMemoryManagement.c</H1></A>
+Special memory management routines specific to CAL. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+Functions for managing the system memory using a set of 
+              nodeManagers. Each nodeManager manages a set of fixed size
+              nodes obtained from a set of pages. When additional memory
+              is required, nodeManager obtains a new page from the pageManager.
+              The new page is divided into ( PAGE_SIZE/NODE_SIZE ) number of
+              nodes. <P>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalPageManagerInit" TARGET="MAIN"><CODE>CalPageManagerInit()</CODE></A>
+ <DD> Initializes a pageManager.
+
+ <DT> <A HREF="calAllDet.html#CalPageManagerQuit" TARGET="MAIN"><CODE>CalPageManagerQuit()</CODE></A>
+ <DD> Frees pageManager and associated pages.
+
+ <DT> <A HREF="calAllDet.html#CalPageManagerPrint" TARGET="MAIN"><CODE>CalPageManagerPrint()</CODE></A>
+ <DD> Prints address of each memory segment and address of each page.
+
+ <DT> <A HREF="calAllDet.html#CalNodeManagerInit" TARGET="MAIN"><CODE>CalNodeManagerInit()</CODE></A>
+ <DD> Initializes a node manager.
+
+ <DT> <A HREF="calAllDet.html#CalNodeManagerQuit" TARGET="MAIN"><CODE>CalNodeManagerQuit()</CODE></A>
+ <DD> Frees a node manager.
+
+ <DT> <A HREF="calAllDet.html#CalNodeManagerPrint" TARGET="MAIN"><CODE>CalNodeManagerPrint()</CODE></A>
+ <DD> Prints address of each free node.
+
+ <DT> <A HREF="calAllDet.html#CalPageManagerAllocPage" TARGET="MAIN"><CODE>CalPageManagerAllocPage()</CODE></A>
+ <DD> Allocs a new page.
+
+ <DT> <A HREF="calAllDet.html#CalPageManagerFreePage" TARGET="MAIN"><CODE>CalPageManagerFreePage()</CODE></A>
+ <DD> Free a page.
+
+ <DT> <A HREF="calAllDet.html#PageManagerExpandStorage" TARGET="MAIN"><CODE>PageManagerExpandStorage()</CODE></A>
+ <DD> Allocates a segment of memory to expand the storage managed by
+              pageManager. The allocated segment is divided into free pages
+              which are linked as a freePageList.
+
+ <DT> <A HREF="calAllDet.html#PageAlign" TARGET="MAIN"><CODE>PageAlign()</CODE></A>
+ <DD> Return page aligned address greater than or equal to
+  the pointer.
+
+ <DT> <A HREF="calAllDet.html#SegmentToPageList" TARGET="MAIN"><CODE>SegmentToPageList()</CODE></A>
+ <DD> Converts a memory segment into a linked list of pages.
+              if p is a pointer to a page, *p contains address of the next page
+              if p is a pointer to the last page, *p contains lastPointer.
+
+</DL>
+<HR>
+<A NAME="calPerformanceTest.c"><H1>calPerformanceTest.c</H1></A>
+This file contains the performance test routines for
+  the CAL package. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi  (sanghavi@eecs.berkeley.edu)</B><P>
+optional <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_PerformanceTest" TARGET="MAIN"><CODE>Cal_PerformanceTest()</CODE></A>
+ <DD> Main routine for testing performances of various routines.
+
+ <DT> <A HREF="calAllDet.html#CalIncreasingOrderCompare" TARGET="MAIN"><CODE>CalIncreasingOrderCompare()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalDecreasingOrderCompare" TARGET="MAIN"><CODE>CalDecreasingOrderCompare()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestAnd" TARGET="MAIN"><CODE>CalPerformanceTestAnd()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceMemoryOverhead" TARGET="MAIN"><CODE>CalPerformanceMemoryOverhead()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformaceTestSuperscalar" TARGET="MAIN"><CODE>CalPerformaceTestSuperscalar()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestNonSuperscalar" TARGET="MAIN"><CODE>CalPerformanceTestNonSuperscalar()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestMultiway" TARGET="MAIN"><CODE>CalPerformanceTestMultiway()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestOneway" TARGET="MAIN"><CODE>CalPerformanceTestOneway()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestCompose" TARGET="MAIN"><CODE>CalPerformanceTestCompose()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestQuantifyAllTogether" TARGET="MAIN"><CODE>CalPerformanceTestQuantifyAllTogether()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalQuantifySanityCheck" TARGET="MAIN"><CODE>CalQuantifySanityCheck()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestRelProd" TARGET="MAIN"><CODE>CalPerformanceTestRelProd()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestSubstitute" TARGET="MAIN"><CODE>CalPerformanceTestSubstitute()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#CalPerformanceTestSwapVars" TARGET="MAIN"><CODE>CalPerformanceTestSwapVars()</CODE></A>
+ <DD> Performance test routine for quantify (all variables at the same
+  time).
+
+ <DT> <A HREF="calAllDet.html#elapsedTime" TARGET="MAIN"><CODE>elapsedTime()</CODE></A>
+ <DD> Computes the time.
+
+ <DT> <A HREF="calAllDet.html#cpuTime" TARGET="MAIN"><CODE>cpuTime()</CODE></A>
+ <DD> Computes the number of page faults.
+
+ <DT> <A HREF="calAllDet.html#pageFaults" TARGET="MAIN"><CODE>pageFaults()</CODE></A>
+ <DD> Computes the number of page faults.
+
+ <DT> <A HREF="calAllDet.html#GetRandomNumbers" TARGET="MAIN"><CODE>GetRandomNumbers()</CODE></A>
+ <DD> Generates "count" many random numbers ranging between
+  "lowerBound" and "upperBound".
+
+</DL>
+<HR>
+<A NAME="calPipeline.c"><H1>calPipeline.c</H1></A>
+Routines for creating and managing the pipelined BDD
+  operations. <P>
+<B>By: Rajeev K. Ranjan   (rajeev@eecs.berkeley.edu)
+                Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+Eventually we would like to have this feature
+  transparent to the user. <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_PipelineSetDepth" TARGET="MAIN"><CODE>Cal_PipelineSetDepth()</CODE></A>
+ <DD> Set depth of a BDD pipeline.
+
+ <DT> <A HREF="calAllDet.html#Cal_PipelineInit" TARGET="MAIN"><CODE>Cal_PipelineInit()</CODE></A>
+ <DD> Initialize a BDD pipeline.
+
+ <DT> <A HREF="calAllDet.html#Cal_PipelineCreateProvisionalBdd" TARGET="MAIN"><CODE>Cal_PipelineCreateProvisionalBdd()</CODE></A>
+ <DD> Create a provisional BDD in the pipeline.
+
+ <DT> <A HREF="calAllDet.html#Cal_PipelineExecute" TARGET="MAIN"><CODE>Cal_PipelineExecute()</CODE></A>
+ <DD> Executes a pipeline.
+
+ <DT> <A HREF="calAllDet.html#Cal_PipelineUpdateProvisionalBdd" TARGET="MAIN"><CODE>Cal_PipelineUpdateProvisionalBdd()</CODE></A>
+ <DD> Update a provisional Bdd obtained during pipelining.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddIsProvisional" TARGET="MAIN"><CODE>Cal_BddIsProvisional()</CODE></A>
+ <DD> Returns 1, if the given user BDD contains
+  provisional BDD node.
+
+ <DT> <A HREF="calAllDet.html#Cal_PipelineQuit" TARGET="MAIN"><CODE>Cal_PipelineQuit()</CODE></A>
+ <DD> Resets the pipeline freeing all resources.
+
+ <DT> <A HREF="calAllDet.html#CalBddReorderFixProvisionalNodes" TARGET="MAIN"><CODE>CalBddReorderFixProvisionalNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckPipelineValidity" TARGET="MAIN"><CODE>CalCheckPipelineValidity()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calPrint.c"><H1>calPrint.c</H1></A>
+Routine for printing a BDD. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)
+               Originally written by David Long.</B><P>
+<P><B>See Also</B><A HREF="#None"><CODE>None</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddPrintBdd" TARGET="MAIN"><CODE>Cal_BddPrintBdd()</CODE></A>
+ <DD> Prints a BDD in the human readable form.
+
+ <DT> <A HREF="calAllDet.html#CalBddVarName" TARGET="MAIN"><CODE>CalBddVarName()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddNumberSharedNodes" TARGET="MAIN"><CODE>CalBddNumberSharedNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddMarkSharedNodes" TARGET="MAIN"><CODE>CalBddMarkSharedNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#Chars" TARGET="MAIN"><CODE>Chars()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddPrintTopVar" TARGET="MAIN"><CODE>BddPrintTopVar()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddPrintBddStep" TARGET="MAIN"><CODE>BddPrintBddStep()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddTerminalId" TARGET="MAIN"><CODE>BddTerminalId()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddTerminalValueAux" TARGET="MAIN"><CODE>BddTerminalValueAux()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calPrintProfile.c"><H1>calPrintProfile.c</H1></A>
+Routines for printing various profiles for a BDD. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddPrintProfile" TARGET="MAIN"><CODE>Cal_BddPrintProfile()</CODE></A>
+ <DD> Displays the node profile for f on fp. lineLength specifies 
+               the maximum line length.  varNamingFn is as in
+               Cal_BddPrintBdd.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddPrintProfileMultiple" TARGET="MAIN"><CODE>Cal_BddPrintProfileMultiple()</CODE></A>
+ <DD> Cal_BddPrintProfileMultiple is like Cal_BddPrintProfile except
+               it displays the profile for a set of BDDs
+
+ <DT> <A HREF="calAllDet.html#Cal_BddPrintFunctionProfile" TARGET="MAIN"><CODE>Cal_BddPrintFunctionProfile()</CODE></A>
+ <DD> Cal_BddPrintFunctionProfile is like Cal_BddPrintProfile except
+               it displays a function profile for f
+
+ <DT> <A HREF="calAllDet.html#Cal_BddPrintFunctionProfileMultiple" TARGET="MAIN"><CODE>Cal_BddPrintFunctionProfileMultiple()</CODE></A>
+ <DD> Cal_BddPrintFunctionProfileMultiple is like
+               Cal_BddPrintFunctionProfile except for multiple BDDs
+
+ <DT> <A HREF="calAllDet.html#CalBddPrintProfileAux" TARGET="MAIN"><CODE>CalBddPrintProfileAux()</CODE></A>
+ <DD> Prints a profile to the file given by fp.  The varNamingProc
+               is as in Cal_BddPrintBdd. lineLength gives the line width to scale
+               the profile to.
+
+ <DT> <A HREF="calAllDet.html#chars" TARGET="MAIN"><CODE>chars()</CODE></A>
+ <DD> 
+
+</DL>
+<HR>
+<A NAME="calQuant.c"><H1>calQuant.c</H1></A>
+Routines for existential/universal quantification and
+  relational product. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#None"><CODE>None</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddExists" TARGET="MAIN"><CODE>Cal_BddExists()</CODE></A>
+ <DD> Returns the result of existentially quantifying some
+  variables from the given BDD.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddRelProd" TARGET="MAIN"><CODE>Cal_BddRelProd()</CODE></A>
+ <DD> Returns the result of taking the logical AND of the
+  argument BDDs and existentially quantifying some variables from the
+  product.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddForAll" TARGET="MAIN"><CODE>Cal_BddForAll()</CODE></A>
+ <DD> Returns the result of universally quantifying some
+  variables from the given BDD.
+
+ <DT> <A HREF="calAllDet.html#CalOpExists" TARGET="MAIN"><CODE>CalOpExists()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalOpRelProd" TARGET="MAIN"><CODE>CalOpRelProd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExistsStep" TARGET="MAIN"><CODE>BddExistsStep()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddRelProdStep" TARGET="MAIN"><CODE>BddRelProdStep()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddDFStep" TARGET="MAIN"><CODE>BddDFStep()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#HashTableApply" TARGET="MAIN"><CODE>HashTableApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#HashTableReduce" TARGET="MAIN"><CODE>HashTableReduce()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExistsApply" TARGET="MAIN"><CODE>BddExistsApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExistsBFAux" TARGET="MAIN"><CODE>BddExistsBFAux()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExistsReduce" TARGET="MAIN"><CODE>BddExistsReduce()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExistsBFPlusDF" TARGET="MAIN"><CODE>BddExistsBFPlusDF()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddRelProdApply" TARGET="MAIN"><CODE>BddRelProdApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddRelProdReduce" TARGET="MAIN"><CODE>BddRelProdReduce()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddRelProdBFAux" TARGET="MAIN"><CODE>BddRelProdBFAux()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddRelProdBFPlusDF" TARGET="MAIN"><CODE>BddRelProdBFPlusDF()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calReduce.c"><H1>calReduce.c</H1></A>
+Routines for optimizing a BDD with respect to a don't
+  care set (cofactor and restrict). <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu</B><P>
+<P><B>See Also</B><A HREF="#None"><CODE>None</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddCofactor" TARGET="MAIN"><CODE>Cal_BddCofactor()</CODE></A>
+ <DD> Returns the generalized cofactor of BDD f with respect
+  to BDD c.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddReduce" TARGET="MAIN"><CODE>Cal_BddReduce()</CODE></A>
+ <DD> Returns a BDD which agrees with f for all valuations
+  which satisfy c.
+
+ <DT> <A HREF="calAllDet.html#Cal_BddBetween" TARGET="MAIN"><CODE>Cal_BddBetween()</CODE></A>
+ <DD> Returns a minimal BDD whose function contains fMin and is
+  contained in fMax.
+
+ <DT> <A HREF="calAllDet.html#CalOpCofactor" TARGET="MAIN"><CODE>CalOpCofactor()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReduceBF" TARGET="MAIN"><CODE>BddReduceBF()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddCofactorBF" TARGET="MAIN"><CODE>BddCofactorBF()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#HashTableReduceApply" TARGET="MAIN"><CODE>HashTableReduceApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#HashTableCofactorApply" TARGET="MAIN"><CODE>HashTableCofactorApply()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#HashTableCofactorReduce" TARGET="MAIN"><CODE>HashTableCofactorReduce()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calReorderBF.c"><H1>calReorderBF.c</H1></A>
+Routines for dynamic reordering of variables. <P>
+<B>By: Rajeev K. Ranjan   (rajeev@ic.eecs.berkeley.edu)
+               Wilsin Gosti (wilsin@ic.eecs.berkeley.edu)</B><P>
+This method dynamically reorders variables while
+  preserving their locality. This entails both memory and
+  computational overheads.  Conceptually and experimentally it has
+  been observed that these overheads lead to poorer performance
+  compared to the traditional reordering methods. For details, please
+  refer to the work by Rajeev K. Ranjan et al - "Dynamic variable
+  reordering in a breadth-first manipulation based package: Challenges
+  and Solutions"- Proceedings of ICCD'97. <P>
+<P><B>See Also</B><A HREF="#calReorderDF.c"><CODE>calReorderDF.c</CODE></A>
+<A HREF="#calReorderUtil.c"><CODE>calReorderUtil.c</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalBddReorderAuxBF" TARGET="MAIN"><CODE>CalBddReorderAuxBF()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderFixForwardingNodes" TARGET="MAIN"><CODE>BddReorderFixForwardingNodes()</CODE></A>
+ <DD> Fixes the forwarding nodes in a unique table.
+
+ <DT> <A HREF="calAllDet.html#BddReorderFixAndFreeForwardingNodes" TARGET="MAIN"><CODE>BddReorderFixAndFreeForwardingNodes()</CODE></A>
+ <DD> Traverses the forwarding node lists of index,
+  index+1 .. up to index+level. Frees the intermediate forwarding nodes.
+
+ <DT> <A HREF="calAllDet.html#BddReorderSwapVarIndex" TARGET="MAIN"><CODE>BddReorderSwapVarIndex()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CofactorFixAndReclaimForwardedNodes" TARGET="MAIN"><CODE>CofactorFixAndReclaimForwardedNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderFreeNodes" TARGET="MAIN"><CODE>BddReorderFreeNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#PrintBddProfileAfterReorder" TARGET="MAIN"><CODE>PrintBddProfileAfterReorder()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderVarSift" TARGET="MAIN"><CODE>BddReorderVarSift()</CODE></A>
+ <DD> Reorder variables using "sift" algorithm.
+
+ <DT> <A HREF="calAllDet.html#BddReorderSiftToBestPos" TARGET="MAIN"><CODE>BddReorderSiftToBestPos()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddSiftPerfromPhaseIV" TARGET="MAIN"><CODE>BddSiftPerfromPhaseIV()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderVarWindow" TARGET="MAIN"><CODE>BddReorderVarWindow()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderWindow2" TARGET="MAIN"><CODE>BddReorderWindow2()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderWindow3" TARGET="MAIN"><CODE>BddReorderWindow3()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calReorderDF.c"><H1>calReorderDF.c</H1></A>
+Routines for dynamic reordering of variables. <P>
+<B>By: Rajeev K. Ranjan   (rajeev@@ic. eecs.berkeley.edu)</B><P>
+This method is based on traditional dynamic reordering
+  technique found in depth-first based packages. The data structure is
+  first converted to conform to traditional one and then reordering is
+  performed. At the end the nodes are arranged back on the pages. The
+  computational overheads are in terms of converting the data
+  structure back and forth and the memory overhead due to the extra
+  space needed to arrange the nodes. This overhead can be eliminated
+  by proper implementation. For details, please refer to the work by
+  Rajeev K. Ranjan et al - "Dynamic variable reordering in a
+  breadth-first manipulation based package: Challenges and Solutions"-
+  Proceedings of ICCD'97. <P>
+<P><B>See Also</B><A HREF="#calReorderBF.c"><CODE>calReorderBF.c</CODE></A>
+<A HREF="#calReorderUtil.c"><CODE>calReorderUtil.c</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalBddReorderAuxDF" TARGET="MAIN"><CODE>CalBddReorderAuxDF()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#UniqueTableForIdFindOrAdd" TARGET="MAIN"><CODE>UniqueTableForIdFindOrAdd()</CODE></A>
+ <DD> find or add in the unique table for id.
+
+ <DT> <A HREF="calAllDet.html#HashTableAddDirect" TARGET="MAIN"><CODE>HashTableAddDirect()</CODE></A>
+ <DD> Directly insert a BDD node in the hash table.
+
+ <DT> <A HREF="calAllDet.html#HashTableFindOrAdd" TARGET="MAIN"><CODE>HashTableFindOrAdd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddConvertDataStruct" TARGET="MAIN"><CODE>BddConvertDataStruct()</CODE></A>
+ <DD> Changes the data structure of the bdd nodes.
+
+ <DT> <A HREF="calAllDet.html#BddConvertDataStructBack" TARGET="MAIN"><CODE>BddConvertDataStructBack()</CODE></A>
+ <DD> Changes the data structure of the bdd nodes to
+  the original one.
+
+ <DT> <A HREF="calAllDet.html#BddReallocateNodesInPlace" TARGET="MAIN"><CODE>BddReallocateNodesInPlace()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalAlignCollisionChains" TARGET="MAIN"><CODE>CalAlignCollisionChains()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReallocateNodes" TARGET="MAIN"><CODE>BddReallocateNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExchangeAux" TARGET="MAIN"><CODE>BddExchangeAux()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CheckValidityOfNodes" TARGET="MAIN"><CODE>CheckValidityOfNodes()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#SweepVarTable" TARGET="MAIN"><CODE>SweepVarTable()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExchange" TARGET="MAIN"><CODE>BddExchange()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddExchangeVarBlocks" TARGET="MAIN"><CODE>BddExchangeVarBlocks()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderWindow2" TARGET="MAIN"><CODE>BddReorderWindow2()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderWindow3" TARGET="MAIN"><CODE>BddReorderWindow3()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderStableWindow3Aux" TARGET="MAIN"><CODE>BddReorderStableWindow3Aux()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderStableWindow3" TARGET="MAIN"><CODE>BddReorderStableWindow3()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddSiftBlock" TARGET="MAIN"><CODE>BddSiftBlock()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddReorderSiftAux" TARGET="MAIN"><CODE>BddReorderSiftAux()</CODE></A>
+ <DD> Reorder variables using "sift" algorithm.
+
+ <DT> <A HREF="calAllDet.html#BddReorderSift" TARGET="MAIN"><CODE>BddReorderSift()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddAddInternalReferences" TARGET="MAIN"><CODE>BddAddInternalReferences()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#BddNukeInternalReferences" TARGET="MAIN"><CODE>BddNukeInternalReferences()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CeilLog2" TARGET="MAIN"><CODE>CeilLog2()</CODE></A>
+ <DD> Returns the smallest integer greater than or equal to log2 of a
+  number
+
+</DL>
+<HR>
+<A NAME="calReorderUtil.c"><H1>calReorderUtil.c</H1></A>
+Some utility routines used by both breadth-first and
+  depth-first reordering techniques. <P>
+<B>By: Rajeev K. Ranjan   (rajeev@ic.eecs.berkeley.edu)
+               Wilsin Gosti (wilsin@ic.eecs.berkeley.edu)</B><P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalBddReorderFixUserBddPtrs" TARGET="MAIN"><CODE>CalBddReorderFixUserBddPtrs()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckAllValidity" TARGET="MAIN"><CODE>CalCheckAllValidity()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckValidityOfNodesForId" TARGET="MAIN"><CODE>CalCheckValidityOfNodesForId()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckValidityOfNodesForWindow" TARGET="MAIN"><CODE>CalCheckValidityOfNodesForWindow()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckValidityOfANode" TARGET="MAIN"><CODE>CalCheckValidityOfANode()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckRefCountValidity" TARGET="MAIN"><CODE>CalCheckRefCountValidity()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalCheckAssoc" TARGET="MAIN"><CODE>CalCheckAssoc()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalFixupAssoc" TARGET="MAIN"><CODE>CalFixupAssoc()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddReorderFixCofactors" TARGET="MAIN"><CODE>CalBddReorderFixCofactors()</CODE></A>
+ <DD> Fixes the cofactors of the nodes belonging to
+  the given index.
+
+ <DT> <A HREF="calAllDet.html#CalBddReorderReclaimForwardedNodes" TARGET="MAIN"><CODE>CalBddReorderReclaimForwardedNodes()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calTerminal.c"><H1>calTerminal.c</H1></A>
+Contains the terminal function for various BDD operations. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu</B><P>
+<DL>
+ <DT> <A HREF="calAllDet.html#CalOpAnd" TARGET="MAIN"><CODE>CalOpAnd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalOpNand" TARGET="MAIN"><CODE>CalOpNand()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalOpOr" TARGET="MAIN"><CODE>CalOpOr()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalOpXor" TARGET="MAIN"><CODE>CalOpXor()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalOpITE" TARGET="MAIN"><CODE>CalOpITE()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calTest.c"><H1>calTest.c</H1></A>
+This file contains the test routines for the CAL package. <P>
+<B>By: Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi  (sanghavi@eecs.berkeley.edu)
+               Modified and extended from the original version written
+               by David Long.</B><P>
+optional <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#main" TARGET="MAIN"><CODE>main()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#asDouble" TARGET="MAIN"><CODE>asDouble()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#asAddress" TARGET="MAIN"><CODE>asAddress()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#terminalIdFn" TARGET="MAIN"><CODE>terminalIdFn()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#PrintBdd" TARGET="MAIN"><CODE>PrintBdd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#Error" TARGET="MAIN"><CODE>Error()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#Cofactor" TARGET="MAIN"><CODE>Cofactor()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#Decode" TARGET="MAIN"><CODE>Decode()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestAnd" TARGET="MAIN"><CODE>TestAnd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestNand" TARGET="MAIN"><CODE>TestNand()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestOr" TARGET="MAIN"><CODE>TestOr()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestITE" TARGET="MAIN"><CODE>TestITE()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestXor" TARGET="MAIN"><CODE>TestXor()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestIdNot" TARGET="MAIN"><CODE>TestIdNot()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestCompose" TARGET="MAIN"><CODE>TestCompose()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestSubstitute" TARGET="MAIN"><CODE>TestSubstitute()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestVarSubstitute" TARGET="MAIN"><CODE>TestVarSubstitute()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestSwapVars" TARGET="MAIN"><CODE>TestSwapVars()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestMultiwayAnd" TARGET="MAIN"><CODE>TestMultiwayAnd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestMultiwayOr" TARGET="MAIN"><CODE>TestMultiwayOr()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestMultiwayLarge" TARGET="MAIN"><CODE>TestMultiwayLarge()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestArrayOp" TARGET="MAIN"><CODE>TestArrayOp()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestInterImpl" TARGET="MAIN"><CODE>TestInterImpl()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestQnt" TARGET="MAIN"><CODE>TestQnt()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestAssoc" TARGET="MAIN"><CODE>TestAssoc()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestRelProd" TARGET="MAIN"><CODE>TestRelProd()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestReduce" TARGET="MAIN"><CODE>TestReduce()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestGenCof" TARGET="MAIN"><CODE>TestGenCof()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestSize" TARGET="MAIN"><CODE>TestSize()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestSatisfy" TARGET="MAIN"><CODE>TestSatisfy()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestPipeline" TARGET="MAIN"><CODE>TestPipeline()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestDump" TARGET="MAIN"><CODE>TestDump()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestReorderBlock" TARGET="MAIN"><CODE>TestReorderBlock()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#TestReorder" TARGET="MAIN"><CODE>TestReorder()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#handler" TARGET="MAIN"><CODE>handler()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#RandomTests" TARGET="MAIN"><CODE>RandomTests()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+<A NAME="calUtil.c"><H1>calUtil.c</H1></A>
+Utility functions for the Cal package. <P>
+<B>By: Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev K. Ranjan   (rajeev@eecs.berkeley.edu)</B><P>
+Utility functions used in the Cal package. <P>
+<P><B>See Also</B><A HREF="#optional"><CODE>optional</CODE></A>
+<DL>
+ <DT> <A HREF="calAllDet.html#Cal_BddFunctionPrint" TARGET="MAIN"><CODE>Cal_BddFunctionPrint()</CODE></A>
+ <DD> Prints the function implemented by the argument BDD
+
+ <DT> <A HREF="calAllDet.html#CalUniqueTablePrint" TARGET="MAIN"><CODE>CalUniqueTablePrint()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddFunctionPrint" TARGET="MAIN"><CODE>CalBddFunctionPrint()</CODE></A>
+ <DD> Prints the function implemented by the argument BDD
+
+ <DT> <A HREF="calAllDet.html#CalBddPreProcessing" TARGET="MAIN"><CODE>CalBddPreProcessing()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddPostProcessing" TARGET="MAIN"><CODE>CalBddPostProcessing()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddArrayPreProcessing" TARGET="MAIN"><CODE>CalBddArrayPreProcessing()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddGetInternalBdd" TARGET="MAIN"><CODE>CalBddGetInternalBdd()</CODE></A>
+ <DD> Prints fatal message and exits.
+
+ <DT> <A HREF="calAllDet.html#CalBddGetExternalBdd" TARGET="MAIN"><CODE>CalBddGetExternalBdd()</CODE></A>
+ <DD> Prints fatal message and exits.
+
+ <DT> <A HREF="calAllDet.html#CalBddFatalMessage" TARGET="MAIN"><CODE>CalBddFatalMessage()</CODE></A>
+ <DD> Prints fatal message and exits.
+
+ <DT> <A HREF="calAllDet.html#CalBddWarningMessage" TARGET="MAIN"><CODE>CalBddWarningMessage()</CODE></A>
+ <DD> Prints warning message.
+
+ <DT> <A HREF="calAllDet.html#CalBddNodePrint" TARGET="MAIN"><CODE>CalBddNodePrint()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalBddPrint" TARGET="MAIN"><CODE>CalBddPrint()</CODE></A>
+ <DD> required
+
+ <DT> <A HREF="calAllDet.html#CalHashTablePrint" TARGET="MAIN"><CODE>CalHashTablePrint()</CODE></A>
+ <DD> Prints a hash table.
+
+ <DT> <A HREF="calAllDet.html#CalHashTableOnePrint" TARGET="MAIN"><CODE>CalHashTableOnePrint()</CODE></A>
+ <DD> required
+
+</DL>
+<HR>
+Last updated on 970711 20h11
+</BODY></HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calApplyReduce.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calApplyReduce.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calApplyReduce.c	(revision 6)
@@ -0,0 +1,224 @@
+/**CFile***********************************************************************
+
+  FileName    [calApplyReduce.c]
+
+  PackageName [cal]
+
+  Synopsis    [Generic routines for processing temporary nodes during
+  "apply" and "reduce" phases.]
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calApplyReduce.c,v 1.1.1.3 1998/05/04 00:58:49 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableApply(Cal_BddManager_t * bddManager, CalHashTable_t *
+                  hashTable, CalHashTable_t ** reqQueAtPipeDepth, CalOpProc_t
+                  calOpProc) 
+{
+  int i, numBins;
+  CalBddNode_t **bins = 0;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t fx, gx, fxbar, gxbar, result;
+  Cal_BddId_t bddId;
+
+  numBins = hashTable->numBins;
+  bins = hashTable->bins;
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      /* Process the requestNode */
+      CalRequestNodeGetCofactors(bddManager, requestNode, fx, fxbar, gx, gxbar);
+      Cal_Assert(((CalAddress_t)(fx.bddNode)) & ~0xf);
+      Cal_Assert(((CalAddress_t)(gx.bddNode)) & ~0xf);
+      Cal_Assert(((CalAddress_t)(fxbar.bddNode)) & ~0xf);
+      Cal_Assert(((CalAddress_t)(gxbar.bddNode)) & ~0xf);
+      if((*calOpProc)(bddManager, fx, gx, &result) == 0){
+        CalBddNormalize(fx, gx);
+        CalBddGetMinId2(bddManager, fx, gx, bddId);
+        CalHashTableFindOrAdd(reqQueAtPipeDepth[bddId], fx, gx, &result);
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+      if((*calOpProc)(bddManager, fxbar, gxbar, &result) == 0){
+        CalBddNormalize(fxbar, gxbar);
+        CalBddGetMinId2(bddManager, fxbar, gxbar, bddId);
+        CalHashTableFindOrAdd(reqQueAtPipeDepth[bddId], fxbar, gxbar, &result);
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableReduce(Cal_BddManager_t * bddManager,
+                   CalHashTable_t * hashTable,
+                   CalHashTable_t * uniqueTableForId)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  Cal_BddId_t currentBddId = uniqueTableForId->bddId;
+  CalNodeManager_t *nodeManager = uniqueTableForId->nodeManager;
+  CalRequestNode_t *requestNode, *next;
+  CalBddNode_t *bddNode, *endNode;
+  Cal_Bdd_t thenBdd, elseBdd, result;
+  Cal_BddRefCount_t refCount;
+
+  endNode = hashTable->endNode;
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      /* Process the requestNode */
+      CalRequestNodeGetThenRequest(requestNode, thenBdd);
+      CalRequestNodeGetElseRequest(requestNode, elseBdd);
+      CalRequestIsForwardedTo(thenBdd);
+      CalRequestIsForwardedTo(elseBdd);
+      if(CalBddIsEqual(thenBdd, elseBdd)){
+        CalRequestNodeGetRefCount(requestNode, refCount);
+        CalRequestAddRefCount(thenBdd, refCount - 2);
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+      else
+        if(CalUniqueTableForIdLookup(bddManager, uniqueTableForId,
+          thenBdd, elseBdd, &result) == 1){
+        CalBddDcrRefCount(thenBdd);
+        CalBddDcrRefCount(elseBdd);
+        CalRequestNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(result, refCount);
+        CalRequestNodePutThenRequest(requestNode, result);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+      else if(CalBddIsOutPos(thenBdd)){
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequest(requestNode, elseBdd);
+        CalHashTableAddDirect(uniqueTableForId, requestNode);
+        bddManager->numNodes++;
+        bddManager->gcCheck--;
+      }
+      else{
+        CalNodeManagerAllocNode(nodeManager, bddNode);
+        CalBddNodePutThenBddId(bddNode, CalBddGetBddId(thenBdd));
+        CalBddNodePutThenBddNode(bddNode, CalBddGetBddNodeNot(thenBdd));
+        CalBddNodePutElseBddId(bddNode, CalBddGetBddId(elseBdd));
+        CalBddNodePutElseBddNode(bddNode, CalBddGetBddNodeNot(elseBdd));
+        CalRequestNodeGetRefCount(requestNode, refCount);
+        CalBddNodePutRefCount(bddNode, refCount);
+        CalHashTableAddDirect(uniqueTableForId, bddNode);
+        bddManager->numNodes++;
+        bddManager->gcCheck--;
+        CalRequestNodePutThenRequestId(requestNode, currentBddId);
+        CalRequestNodePutThenRequestNode(requestNode, CalBddNodeNot(bddNode));
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+    }
+  }
+  memset((char *)bins, 0, hashTable->numBins * sizeof(CalBddNode_t *));
+  hashTable->endNode = endNode;
+}
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+  
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calAssociation.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calAssociation.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calAssociation.c	(revision 6)
@@ -0,0 +1,601 @@
+/**CFile***********************************************************************
+
+  FileName    [calAssociation.c]
+
+  PackageName [cal]
+
+  Synopsis    [Contains the routines related to the variable association.]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi  (sanghavi@eecs.berkeley.edu)
+               ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calAssociation.c,v 1.1.1.3 1998/05/04 00:58:50 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int AssociationIsEqual(Cal_BddManager_t * bddManager, Cal_Bdd_t * p, Cal_Bdd_t * q);
+static int CheckAssoc(Cal_BddManager_t *bddManager, Cal_Bdd *assocInfo, int pairs);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Creates or finds a variable association.]
+
+  Description [Creates or finds a variable association. The association is
+  specified by associationInfo, which is a an array of BDD with 
+  Cal_BddNull(bddManager) as the end marker. If pairs is 0, the array is
+  assumed to be an array of variables. In this case, each variable is paired
+  with constant BDD one. Such an association may viewed as specifying a set
+  of variables for use with routines such as Cal_BddExists. If pair is not 0,
+  then the even numbered array elements should be variables and the odd numbered
+  elements should be the BDDs which they are mapped to. In both cases, the 
+  return value is an integer identifier for this association. If the given
+  association is equivalent to one which already exists, the same identifier
+  is used for both, and the reference count of the association is increased by
+  one.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_AssociationQuit]
+
+******************************************************************************/
+int
+Cal_AssociationInit(Cal_BddManager bddManager,
+                    Cal_Bdd *associationInfoUserBdds,
+                    int  pairs)
+{
+  int i, numAssociations;
+  CalAssociation_t *p, **q;
+  Cal_Bdd_t f;
+  Cal_Bdd_t *varAssociation;
+  Cal_BddId_t j;
+  long last;
+  Cal_Bdd_t *associationInfo;
+  
+  if (!CheckAssoc(bddManager, associationInfoUserBdds, pairs)){
+    return (-1);
+  }
+
+
+/* First count the number of elements */
+  for (i=0; associationInfoUserBdds[i]; i++);
+  if (pairs)  numAssociations = i/2;
+  else numAssociations = i;
+  associationInfo = Cal_MemAlloc(Cal_Bdd_t, i+1);
+  for (j=0; j < i; j++){
+    associationInfo[j] =
+        CalBddGetInternalBdd(bddManager,associationInfoUserBdds[j]);
+  }
+  associationInfo[j] = bddManager->bddNull;
+
+  
+  varAssociation = Cal_MemAlloc(Cal_Bdd_t, bddManager->maxNumVars+1);
+  for(i = 0; i <= bddManager->maxNumVars; i++){
+    varAssociation[i] = bddManager->bddNull;
+  }
+
+  
+  if(pairs){
+    for(i = 0; i < numAssociations; i++){
+      f = associationInfo[(i<<1)];
+      varAssociation[CalBddGetBddId(f)] = associationInfo[(i<<1)+1];
+    }
+  }
+  else{
+    for(i = 0; i < numAssociations; i++){
+      f=associationInfo[i];
+      varAssociation[CalBddGetBddId(f)] = CalBddOne(bddManager);
+    }
+  }
+  /* Check for existence. */
+  for(p = bddManager->associationList; p; p = p->next){
+    if(AssociationIsEqual(bddManager, p->varAssociation, varAssociation)){
+	Cal_MemFree(varAssociation);
+    Cal_MemFree(associationInfo);
+	p->refCount++;
+	return (p->id);
+    }
+  }
+  /* Find the first unused id. */
+  for(q = &bddManager->associationList, p = *q, i = 0;
+      p && p->id == i; q = &p->next, p = *q, ++i){
+  }
+  /*p = Cal_MemAlloc(CalAssociation_t, 1);*/
+  /*p = CAL_BDD_NEW_REC(bddManager, CalAssociation_t);*/
+  p = Cal_MemAlloc(CalAssociation_t, 1);
+  p->id = i;
+  p->next = *q;
+  *q = p;
+  p->varAssociation = varAssociation;
+  last = -1;
+  if(pairs){
+    for(i = 0; i < numAssociations; i++){
+      f = associationInfo[(i<<1)];
+      j = CalBddGetBddIndex(bddManager, f);
+      if((long)j > last){
+	  last = j;
+      }
+    }
+  }
+  else{
+    for(i = 0; i < numAssociations; i++){
+      f = associationInfo[i];
+      j = CalBddGetBddIndex(bddManager, f);
+      if((long)j > last){
+	  last = j;
+      }
+    }
+  }
+  p->lastBddIndex = last;
+  p->refCount = 1;
+  /* Protect BDDs in the association. */
+  if(pairs){
+    for(i = 0; i < numAssociations; i++){
+      f = associationInfo[(i<<1)+1];
+      CalBddIcrRefCount(f);
+    }
+  }
+  Cal_MemFree(associationInfo);
+  return p->id;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Deletes the variable association given by id]
+
+  Description [Decrements the reference count of the variable association with
+  identifier id, and frees it if the reference count becomes zero.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_AssociationInit]
+
+******************************************************************************/
+void
+Cal_AssociationQuit(Cal_BddManager bddManager, int  associationId)
+{
+  Cal_BddId_t i;
+  Cal_Bdd_t f;
+  CalAssociation_t *p, **q;
+
+  if(bddManager->currentAssociation->id == associationId){
+    bddManager->currentAssociation = bddManager->tempAssociation;
+  }
+  for(q = &bddManager->associationList, p = *q; p; q = &p->next, p = *q){
+    if(p->id == associationId){
+      p->refCount--;
+      if(!p->refCount){
+        /* Unprotect the BDDs in the association. */
+        for(i = 1; i <= bddManager->numVars; i++){
+          f = p->varAssociation[i];
+          if(!CalBddIsBddNull(bddManager, f)){
+            CalBddDcrRefCount(f);
+          }
+        }
+        *q = p->next;
+        Cal_MemFree(p->varAssociation);
+        /*CAL_BDD_FREE_REC(bddManager, p, CalAssociation_t);*/
+        Cal_MemFree(p);
+        CalCacheTableTwoFlushAssociationId(bddManager, associationId);
+      }
+      return;
+    }
+  }
+  CalBddWarningMessage("Cal_AssociationQuit: no association with specified ID");
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Sets the current variable association to the one given by id and
+  returns the ID of the old association.]
+
+  Description [Sets the current variable association to the one given by id and
+  returns the ID of the old association.  An id of -1 indicates the temporary
+  association]
+
+  SideEffects [None]
+
+******************************************************************************/
+int
+Cal_AssociationSetCurrent(Cal_BddManager bddManager, int  associationId)
+{
+  int oldAssociationId;
+  CalAssociation_t *p;
+
+  oldAssociationId = bddManager->currentAssociation->id;
+  if(associationId != -1){
+    for(p = bddManager->associationList; p; p = p->next){
+      if(p->id == associationId){
+        bddManager->currentAssociation = p;
+        return (oldAssociationId);
+      }
+    }
+    CalBddWarningMessage(
+        "Cal_AssociationSetCurrent: no variable association with specified ID.\n May have been discarded during dynamic reordering.");
+  }
+  bddManager->currentAssociation = bddManager->tempAssociation;
+  return oldAssociationId;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adds to the temporary variable association.]
+
+  Description [Pairs is 0 if the information represents only a list of
+  variables rather than a full association.]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+Cal_TempAssociationAugment(Cal_BddManager bddManager,
+                           Cal_Bdd *associationInfoUserBdds,
+                           int  pairs)
+{
+  int i, j, numAssociations;
+  Cal_Bdd_t f;
+  long last;
+  Cal_Bdd_t *associationInfo;
+  
+  if (CheckAssoc(bddManager, associationInfoUserBdds, pairs) == 0) {
+    return;
+  }
+
+  /*while (associationInfoUserBdds[i++]);*/
+  for (i=0; associationInfoUserBdds[i]; i++);
+  if (pairs) numAssociations = i/2;
+  else numAssociations = i;
+  associationInfo = Cal_MemAlloc(Cal_Bdd_t, i+1);
+  for (j=0; j < i; j++){
+    associationInfo[j] =
+        CalBddGetInternalBdd(bddManager,associationInfoUserBdds[j]);
+  }
+  associationInfo[j] = bddManager->bddNull;
+  
+  last = bddManager->tempAssociation->lastBddIndex;
+  if(pairs){
+    for(i = 0; i < numAssociations; i++){
+      f = associationInfo[(i<<1)];
+      j = CalBddGetBddId(f);
+      if(bddManager->idToIndex[j] > last){
+        last = bddManager->idToIndex[j];
+      }
+      f = bddManager->tempAssociation->varAssociation[j];
+      if(!CalBddIsBddNull(bddManager, f)){
+        CalBddDcrRefCount(f);
+      }
+      f = associationInfo[(i<<1)+1];
+      bddManager->tempAssociation->varAssociation[j] = f;
+      /* Protect BDDs in the association. */
+      CalBddIcrRefCount(f);
+    }
+  }
+  else{
+    for(i = 0; i < numAssociations; i++){
+      f = associationInfo[i];
+      j = CalBddGetBddId(f);
+      if(bddManager->idToIndex[j] > last){
+        last = bddManager->idToIndex[j];
+      }
+      f = bddManager->tempAssociation->varAssociation[j];
+      if(!CalBddIsBddNull(bddManager, f)){
+        CalBddDcrRefCount(f);
+      }
+      bddManager->tempAssociation->varAssociation[j] = CalBddOne(bddManager);
+    } 
+  }
+  bddManager->tempAssociation->lastBddIndex = last;
+  Cal_MemFree(associationInfo);
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets the temporary variable association.]
+  
+  Description [Pairs is 0 if the information represents only a list of
+  variables rather than a full association.]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+Cal_TempAssociationInit(Cal_BddManager bddManager,
+                        Cal_Bdd *associationInfoUserBdds,
+                        int  pairs)
+{
+  long i;
+  Cal_Bdd_t f;
+
+  /* Clean up old temporary association. */
+  for(i = 1; i <= bddManager->numVars; i++){
+    f = bddManager->tempAssociation->varAssociation[i];
+    if(!CalBddIsBddNull(bddManager, f)){
+      CalBddDcrRefCount(f);
+      bddManager->tempAssociation->varAssociation[i] = bddManager->bddNull;
+    }
+  }
+  bddManager->tempAssociation->lastBddIndex = -1;
+  Cal_TempAssociationAugment(bddManager, associationInfoUserBdds, pairs);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Cleans up temporary association]
+
+  Description [Cleans up temporary associationoptional]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+Cal_TempAssociationQuit(Cal_BddManager bddManager)
+{
+  int i;
+  Cal_Bdd_t f;
+
+  /* Clean up old temporary association. */
+  for(i = 1; i <= bddManager->numVars; i++){
+    f = bddManager->tempAssociation->varAssociation[i];
+    if(!CalBddIsBddNull(bddManager, f)){
+      CalBddDcrRefCount(f);
+      bddManager->tempAssociation->varAssociation[i] = bddManager->bddNull;
+    }
+  }
+  bddManager->tempAssociation->lastBddIndex = -1;
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Frees the variable associations]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalAssociationListFree(Cal_BddManager_t *  bddManager)
+{
+  CalAssociation_t *assoc, *nextAssoc;
+  
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    Cal_MemFree(assoc->varAssociation);
+    /*CAL_BDD_FREE_REC(bddManager, assoc, CalAssociation_t);*/
+    Cal_MemFree(assoc);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Need to be called after repacking.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalVarAssociationRepackUpdate(Cal_BddManager_t *  bddManager,
+                              Cal_BddId_t id)
+{
+  CalAssociation_t *assoc, *nextAssoc;
+  int i;
+  
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    for (i=1; i <= bddManager->numVars; i++){
+      if (CalBddGetBddId(assoc->varAssociation[i]) == id){
+        CalBddForward(assoc->varAssociation[i]);
+      }
+    }
+  }
+  /* fix temporary association */
+  assoc = bddManager->tempAssociation;
+  for (i=1; i <= bddManager->numVars; i++){
+    if (CalBddGetBddId(assoc->varAssociation[i]) == id){
+      CalBddForward(assoc->varAssociation[i]);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Checks the validity of association.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalCheckAssociationValidity(Cal_BddManager_t *  bddManager)
+{
+  CalAssociation_t *assoc, *nextAssoc;
+  int i;
+  
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    for (i=1; i <= bddManager->numVars; i++){
+      Cal_Assert(CalBddIsForwarded(assoc->varAssociation[i]) == 0);
+    }
+  }
+  /* temporary association */
+  assoc = bddManager->tempAssociation;
+  for (i=1; i <= bddManager->numVars; i++){
+    Cal_Assert(CalBddIsForwarded(assoc->varAssociation[i]) == 0);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalReorderAssociationFix(Cal_BddManager_t *bddManager)
+{
+  CalAssociation_t *assoc, *nextAssoc;
+  int i;
+  
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    for (i=1; i <= bddManager->numVars; i++){
+        if (CalBddGetBddId(assoc->varAssociation[i]) != CAL_BDD_NULL_ID){
+            CalBddIsForwardedTo(assoc->varAssociation[i]);
+        }
+    }
+  }
+  /* fix temporary association */
+  assoc = bddManager->tempAssociation;
+  for (i=1; i <= bddManager->numVars; i++){
+      if (CalBddGetBddId(assoc->varAssociation[i]) != CAL_BDD_NULL_ID){
+          CalBddIsForwardedTo(assoc->varAssociation[i]);
+      }
+  }
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Checks for equality of two associations]
+
+  Description [Checks for equality of two associations]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+AssociationIsEqual(Cal_BddManager_t * bddManager,
+                   Cal_Bdd_t * p,
+                   Cal_Bdd_t * q)
+{
+  int i;
+  for(i = 1; i <= bddManager->maxNumVars; i++){
+    if(CalBddIsEqual(p[i], q[i]) == 0){
+      return (0);
+    }
+  }
+  return (1);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+CheckAssoc(Cal_BddManager_t *bddManager, Cal_Bdd *assocInfo, int pairs)
+{
+  CalBddArrayPreProcessing(bddManager, assocInfo);
+  if (pairs){
+    while (assocInfo[0] && assocInfo[1]){
+      if (CalBddTypeAux(bddManager,
+                        CalBddGetInternalBdd(bddManager, assocInfo[0])) !=
+          CAL_BDD_TYPE_POSVAR){  
+	    CalBddWarningMessage("CheckAssoc: first element in pair is not a positive variable"); 
+	    return (0);
+	  }
+      assocInfo+=2;
+    }
+  }
+  return (1);
+}
+
Index: /vis_dev/glu-2.1/src/calBdd/calBdd.make
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBdd.make	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBdd.make	(revision 6)
@@ -0,0 +1,21 @@
+CSRC_cal += 	cal.c calBddOp.c calBddManager.c calMemoryManagement.c\
+		calHashTable.c calUtil.c calGC.c \
+            	calTerminal.c calAssociation.c \
+            	calBddSubstitute.c calReduce.c calQuant.c \
+                calBddSwapVars.c calBddSatisfy.c calBddSize.c \
+                calBddSupport.c calPrint.c calPrintProfile.c calDump.c\
+		calHashTableOne.c calPipeline.c calPerformanceTest.c \
+                calHashTableThree.c calBddITE.c calBddCompose.c\
+		calCacheTableTwo.c calApplyReduce.c calBlk.c \
+		calReorderBF.c calReorderDF.c calInteract.c\
+		calBddVarSubstitute.c calReorderUtil.c calMem.c
+
+HEADERS_cal += cal.h calInt.h calMem.h
+
+MISC += calBddReorderTest.c calPerformanceTest.c calTest.c\
+	calAllAbs.html  calAllByFile.html calAllByFunc.html\
+	calAllDet.html  calAllFile.html calDesc.html\
+ 	calExt.html calExtAbs.html calExtDet.html calTitle.html credit.html\
+ 	calDoc.txt
+
+DEPENDENCYFILES = $(CSRC_cal)
Index: /vis_dev/glu-2.1/src/calBdd/calBddCompose.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddCompose.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddCompose.c	(revision 6)
@@ -0,0 +1,334 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddCompose.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routine for composing one BDD into another.]
+
+  Description []
+
+  SeeAlso     []
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddCompose.c,v 1.1.1.3 1998/05/04 00:58:50 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [composition - substitute a BDD variable by a function]
+
+  Description [Returns the BDD obtained by substituting a variable by a function]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddCompose(Cal_BddManager bddManager, Cal_Bdd  fUserBdd,
+               Cal_Bdd  gUserBdd, Cal_Bdd hUserBdd)
+{
+  Cal_Bdd_t result;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t F, G, H;
+  
+  if (CalBddPreProcessing(bddManager, 3, fUserBdd, gUserBdd, hUserBdd) == 0){
+    result = bddManager->bddNull;
+  }
+  F = CalBddGetInternalBdd(bddManager, fUserBdd);
+  G = CalBddGetInternalBdd(bddManager, gUserBdd);
+  H = CalBddGetInternalBdd(bddManager, hUserBdd);
+
+  if(CalBddIsBddConst(G)){
+    CalBddNodeIcrRefCount(fUserBdd);
+    return fUserBdd;
+  }
+  CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], requestNode);
+  CalRequestNodePutF(requestNode, F);
+  CalRequestNodePutG(requestNode, H);
+  CalRequestNodePutNextRequestNode(requestNode, 0);
+  bddManager->requestNodeListArray[0] = requestNode;
+  /*
+  ** We can achieve a superscalar compose operation, provided G
+  ** is the same for all the compose operation 
+  */
+
+  CalRequestNodeListCompose(bddManager, bddManager->requestNodeListArray[0],
+      CalBddGetBddIndex(bddManager, G));
+
+  CalRequestNodeGetThenRequest(requestNode, result);
+  CalNodeManagerFreeNode(bddManager->nodeManagerArray[0], requestNode);
+  bddManager->requestNodeListArray[0] = Cal_Nil(CalRequestNode_t);
+
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+  note        [THERE IS A POSSIBILITY OF HAVING A PIPELINED VERSION
+               NEED TO THINK IT THROUGH]
+
+******************************************************************************/
+void
+CalRequestNodeListCompose(Cal_BddManager_t * bddManager,
+                          CalRequestNode_t * requestNodeList,
+                          Cal_BddIndex_t  composeIndex)
+{
+  CalRequestNode_t *requestNode;
+  CalRequest_t F, H, result;
+  int bddId, bddIndex;
+  CalHashTable_t *hashTable, *uniqueTableForId;
+  CalHashTable_t **reqQueForCompose = bddManager->reqQue[0];
+  CalHashTable_t **reqQueForITE = bddManager->reqQue[1]; 
+  
+  /* ReqQueForComposeInsertUsingReqList */
+  for(requestNode = requestNodeList;
+      requestNode != Cal_Nil(CalRequestNode_t);
+      requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+    CalRequestNodeGetF(requestNode, F);
+    CalRequestNodeGetG(requestNode, H);
+    CalComposeRequestCreate(bddManager, F, H, composeIndex, 
+        reqQueForCompose, reqQueForITE, &result);
+    CalRequestNodePutThenRequest(requestNode, result);
+    CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+  }
+
+  /* ReqQueApply */
+  for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = reqQueForCompose[bddId];
+    if(hashTable->numEntries){
+      CalHashTableComposeApply(bddManager, hashTable, composeIndex, 
+          reqQueForCompose, reqQueForITE);
+    }
+    hashTable = reqQueForITE[bddId];
+    if(hashTable->numEntries){
+      CalHashTableITEApply(bddManager, hashTable, reqQueForITE);
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= 0; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = reqQueForCompose[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+    hashTable = reqQueForITE[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+
+  /* ReqListArrayReqForward */
+  for(requestNode = requestNodeList; requestNode != Cal_Nil(CalRequestNode_t);
+      requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+    CalRequestNodeGetThenRequest(requestNode, result);
+    CalRequestIsForwardedTo(result);
+    CalRequestNodePutThenRequest(requestNode, result);
+  }
+
+  /* ReqQueCleanUp */
+  for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+    CalHashTableCleanUp(reqQueForCompose[bddId]);
+    CalHashTableCleanUp(reqQueForITE[bddId]);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableComposeApply(Cal_BddManager_t *bddManager,
+                         CalHashTable_t *hashTable,
+                         Cal_BddIndex_t  gIndex,
+                         CalHashTable_t **reqQueForCompose,
+                         CalHashTable_t **reqQueForITE)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t fx, fxbar;
+  Cal_Bdd_t hx, hxbar;
+  Cal_Bdd_t calBdd1, calBdd2, calBdd3;
+  Cal_Bdd_t result;
+  Cal_BddId_t bddId;
+  Cal_BddIndex_t index;
+  
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+
+      /* Process the requestNode */
+      CalRequestNodeGetCofactors(bddManager, requestNode, fx, fxbar, hx, hxbar);
+
+      /* Process left cofactor */
+      index = CalBddGetBddIndex(bddManager, fx);
+      if(index > gIndex){
+        CalBddIcrRefCount(fx);
+        CalRequestNodePutThenRequest(requestNode, fx);
+      }
+      else if(index < gIndex){
+        CalBddGetMinId2(bddManager, fx, hx, bddId);
+        CalHashTableFindOrAdd(reqQueForCompose[bddId], fx, hx, &result);
+        CalBddIcrRefCount(result);
+        CalRequestNodePutThenRequest(requestNode, result);
+      }
+      else{
+        /* fxIndex == gIndex */
+        /* RequestNodeThen = ITE(hx, fxThen, fxElse) */
+        calBdd1 = hx;
+        CalBddGetThenBdd(fx, calBdd2);
+        CalBddGetElseBdd(fx, calBdd3);
+	result = CalOpITE(bddManager, calBdd1, calBdd2, calBdd3, reqQueForITE);
+        CalBddIcrRefCount(result);
+        CalRequestNodePutThenRequest(requestNode, result);
+      }
+
+      /* Process right cofactor */
+      index = CalBddGetBddIndex(bddManager, fxbar);
+      if(index > gIndex){
+        CalBddIcrRefCount(fxbar);
+        CalRequestNodePutElseRequest(requestNode, fxbar);
+      }
+      else if(index < gIndex){
+        CalBddGetMinId2(bddManager, fxbar, hxbar, bddId);
+        CalHashTableFindOrAdd(reqQueForCompose[bddId], fxbar, hxbar, &result);
+        CalBddIcrRefCount(result);
+        CalRequestNodePutElseRequest(requestNode, result);
+      }
+      else{
+        /* fxbarIndex == gIndex */
+        /* RequestNodeElse = ITE(hxbar, fxbarThen, fxbarElse) */
+        calBdd1 = hxbar;
+        CalBddGetThenBdd(fxbar, calBdd2);
+        CalBddGetElseBdd(fxbar, calBdd3);
+        result = CalOpITE(bddManager, calBdd1, calBdd2, calBdd3, reqQueForITE);
+        CalBddIcrRefCount(result);
+        CalRequestNodePutElseRequest(requestNode, result);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalComposeRequestCreate(Cal_BddManager_t * bddManager,
+                        Cal_Bdd_t  f,
+                        Cal_Bdd_t  h,
+                        Cal_BddIndex_t  composeIndex,
+                        CalHashTable_t **reqQueForCompose,
+                        CalHashTable_t **reqQueForITE,
+                        Cal_Bdd_t *resultPtr)
+{
+  Cal_BddIndex_t index;
+  Cal_BddId_t bddId;
+
+  index = CalBddGetBddIndex(bddManager, f);
+  if(index > composeIndex){
+    *resultPtr = f;
+  }
+  else if(index < composeIndex){
+    CalBddGetMinId2(bddManager, f, h, bddId);
+    CalHashTableFindOrAdd(reqQueForCompose[bddId], f, h, resultPtr);
+  }
+  else{
+    Cal_Bdd_t calBdd1, calBdd2, calBdd3;
+    calBdd1 = h;
+    CalBddGetThenBdd(f, calBdd2);
+    CalBddGetElseBdd(f, calBdd3);
+    *resultPtr = CalOpITE(bddManager, calBdd1, calBdd2, calBdd3, reqQueForITE);
+  }
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
Index: /vis_dev/glu-2.1/src/calBdd/calBddITE.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddITE.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddITE.c	(revision 6)
@@ -0,0 +1,333 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddITE.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routine for computing ITE of 3 BDD operands.]
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddITE.c,v 1.1.1.3 1998/05/04 00:58:51 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical If-Then-Else
+
+  Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+  - f g + f' h]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddAnd, Cal_BddNand, Cal_BddOr, Cal_BddNor, Cal_BddXor,
+  Cal_BddXnor]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddITE(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd,
+           Cal_Bdd hUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  Cal_Bdd_t F, G, H;
+  if (CalBddPreProcessing(bddManager, 3, fUserBdd, gUserBdd, hUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd);
+    G = CalBddGetInternalBdd(bddManager, gUserBdd);
+    H = CalBddGetInternalBdd(bddManager, hUserBdd);
+    result = CalBddOpITEBF(bddManager, F, G, H);
+  }
+  else {
+    return (Cal_Bdd) 0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Name        [CalRequestNodeListArrayOp]
+
+  Synopsis    [required]
+
+  Description [This routine is to be used for pipelined and
+  superscalar ITE operations. Currently there is no user interface
+  provided to this routine.]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalRequestNodeListArrayITE(Cal_BddManager_t *bddManager,
+                          CalRequestNode_t **requestNodeListArray)
+{
+  CalRequestNode_t *requestNode, *ptrIndirect;
+  CalRequest_t F, G, H, result;
+  int pipeDepth, bddId, bddIndex;
+  CalHashTable_t **reqQueAtPipeDepth, *hashTable, *uniqueTableForId;
+  CalHashTable_t ***reqQue = bddManager->reqQue;
+  
+  /* ReqQueInsertUsingReqListArray */
+  for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+    reqQueAtPipeDepth = reqQue[pipeDepth];
+    for(requestNode = requestNodeListArray[pipeDepth];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetThenRequest(requestNode, F);
+      CalRequestIsForwardedTo(F);
+      ptrIndirect = CalRequestNodeGetElseRequestNode(requestNode);
+      CalRequestNodeGetThenRequest(ptrIndirect, G);
+      CalRequestIsForwardedTo(G);
+      CalRequestNodeGetElseRequest(ptrIndirect, H);
+      CalRequestIsForwardedTo(H);
+      CalNodeManagerFreeNode(bddManager->nodeManagerArray[0], ptrIndirect);
+      result = CalOpITE(bddManager, F, G, H, reqQueAtPipeDepth);
+      CalRequestNodePutThenRequest(requestNode, result);
+      CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+    }
+  }
+
+  /* ReqQueApply */
+  for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+      reqQueAtPipeDepth = reqQue[pipeDepth];
+      hashTable = reqQueAtPipeDepth[bddId];
+      if(hashTable->numEntries){
+        CalHashTableITEApply(bddManager, hashTable, reqQueAtPipeDepth);
+      }
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= 0; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+      hashTable = reqQue[pipeDepth][bddId];
+      if(hashTable->numEntries){
+        CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+      }
+    }
+  }
+
+  /* ReqListArrayReqForward */
+  for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+    for(requestNode = requestNodeListArray[pipeDepth];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetThenRequest(requestNode, result);
+      CalRequestIsForwardedTo(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+    }
+  }
+
+  /* ReqQueCleanUp */
+  for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+    reqQueAtPipeDepth = reqQue[pipeDepth];
+    for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+      CalHashTableCleanUp(reqQueAtPipeDepth[bddId]);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddOpITEBF(
+  Cal_BddManager_t *bddManager,
+  Cal_Bdd_t  f,
+  Cal_Bdd_t  g,
+  Cal_Bdd_t  h)
+{
+  Cal_Bdd_t result;
+  Cal_BddId_t bddId;
+  /*Cal_BddIndex_t minIndex;*/
+  int minIndex;
+  int bddIndex;
+  CalHashTable_t *hashTable;
+  CalHashTable_t *uniqueTableForId;
+  CalHashTable_t **reqQueForITE = bddManager->reqQue[0];
+  
+  result = CalOpITE(bddManager, f, g, h, reqQueForITE);
+  
+  CalBddGetMinIndex3(bddManager, f, g, h, minIndex);
+  /* ReqQueApply */
+  for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = reqQueForITE[bddId];
+    if(hashTable->numEntries){
+      CalHashTableITEApply(bddManager, hashTable, reqQueForITE);
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = reqQueForITE[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+
+  CalRequestIsForwardedTo(result);
+
+  /* Clean up */
+  for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(reqQueForITE[bddId]);
+  }
+
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableITEApply(
+  Cal_BddManager_t *bddManager,
+  CalHashTable_t *hashTable,
+  CalHashTable_t **reqQueAtPipeDepth)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t fx, gx, fxbar, gxbar, hx, hxbar, result;
+  CalNodeManager_t *nodeManager = hashTable->nodeManager;
+  
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      /* Process the requestNode */
+      CalITERequestNodeGetCofactors(bddManager, requestNode,
+          fx, fxbar, gx, gxbar, hx, hxbar);
+      result = CalOpITE(bddManager, fx, gx, hx, reqQueAtPipeDepth);
+      CalBddIcrRefCount(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+      result = CalOpITE(bddManager, fxbar, gxbar, hxbar, reqQueAtPipeDepth);
+      CalBddIcrRefCount(result);
+      CalNodeManagerFreeNode(nodeManager,
+          CalRequestNodeGetElseRequestNode(requestNode));
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+/**Function********************************************************************
+ 
+   Synopsis    [Returns the BDD for logical If-Then-Else
+ 
+   Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+   - f g + f' h]
+ 
+   SideEffects [None]
+ 
+   SeeAlso     [Cal_BddAnd, Cal_BddNand, Cal_BddOr, Cal_BddNor, Cal_BddXor,
+   Cal_BddXnor]
+ 
+******************************************************************************/
+Cal_Bdd_t
+CalBddITE(Cal_BddManager_t *bddManager, Cal_Bdd_t F, Cal_Bdd_t G,
+          Cal_Bdd_t H)
+{
+  Cal_Bdd_t result;
+  result = CalBddOpITEBF(bddManager, F, G, H);
+  CalBddIcrRefCount(result);
+  return result;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
Index: /vis_dev/glu-2.1/src/calBdd/calBddManager.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddManager.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddManager.c	(revision 6)
@@ -0,0 +1,832 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddManager.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for maintaing the manager and creating
+  variables etc.]
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddManager.c,v 1.9 2002/09/21 20:39:24 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+unsigned long calPrimes[] = 
+{
+  1,
+  2,
+  3,
+  7,
+  13,
+  23,
+  59,
+  113,
+  241,
+  503,
+  1019,
+  2039,
+  4091,
+  8179,
+  11587,
+  16369,
+  23143,
+  32749,
+  46349,
+  65521,
+  92683,
+  131063,
+  185363,
+  262139,
+  330287,
+  416147,
+  524269,
+  660557,
+  832253,
+  1048571,
+  1321109,
+  1664501,
+  2097143,
+  2642201,
+  3328979,
+  4194287,
+  5284393,
+  6657919,
+  8388593,
+  10568797,
+  13315831,
+  16777199,
+  33554393,
+  67108859,
+  134217689,
+  268435399,
+  536870879,
+  1073741789,
+  2147483629
+};
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#define CalBddManagerGetNodeManager(bddManager, id) \
+    bddManager->nodeManagerArray[id]
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void BddDefaultTransformFn(Cal_BddManager_t * bddManager, CalAddress_t value1, CalAddress_t value2, CalAddress_t * result1, CalAddress_t * result2, Cal_Pointer_t pointer);
+#ifdef CALBDDMANAGER
+static int CalBddManagerPrint(Cal_BddManager_t *bddManager);
+#endif /* CALBDDMANAGER */
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Creates and initializes a new BDD manager.]
+
+  Description [Initializes and allocates fields of the BDD manager. Some of the
+  fields are initialized for maxNumVars+1 or numVars+1, whereas some of them are
+  initialized for maxNumVars or numVars. The first kind of fields are associated
+  with the id of a variable and the second ones are with the index of the
+  variable.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddManagerQuit]
+
+******************************************************************************/
+Cal_BddManager
+Cal_BddManagerInit(void)
+{
+  Cal_BddManager_t *bddManager;
+  int i;
+  CalBddNode_t *bddNode;
+  Cal_Bdd_t resultBdd;
+  
+    
+  bddManager = Cal_MemAlloc(Cal_BddManager_t, 1);
+
+  bddManager->numVars = 0;
+
+  bddManager->maxNumVars = 30;
+  
+  bddManager->varBdds = Cal_MemAlloc(Cal_Bdd_t, bddManager->maxNumVars+1);
+  
+  bddManager->pageManager1 = CalPageManagerInit(4);
+  bddManager->pageManager2 = CalPageManagerInit(NUM_PAGES_PER_SEGMENT);
+
+  bddManager->nodeManagerArray = Cal_MemAlloc(CalNodeManager_t*, bddManager->maxNumVars+1);
+
+  bddManager->nodeManagerArray[0] = CalNodeManagerInit(bddManager->pageManager1);
+  bddManager->uniqueTable = Cal_MemAlloc(CalHashTable_t *,
+                                         bddManager->maxNumVars+1);
+  bddManager->uniqueTable[0] = CalHashTableInit(bddManager, 0);
+  
+  /* Constant One */
+  CalBddPutBddId(bddManager->bddOne, CAL_BDD_CONST_ID);
+  CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], bddNode);
+  CalBddPutBddNode(bddManager->bddOne, bddNode);
+  /* ~0x0 put so that the node is not mistaken for forwarded node */
+  CalBddPutThenBddNode(bddManager->bddOne, (CalBddNode_t *)~0x0);
+  CalBddPutElseBddNode(bddManager->bddOne, (CalBddNode_t *)~0x0);
+  CalBddPutRefCount(bddManager->bddOne, CAL_MAX_REF_COUNT);
+  CalBddNot(bddManager->bddOne, bddManager->bddZero);
+
+  /* Create a user BDD */
+  CalHashTableAddDirectAux(bddManager->uniqueTable[0], bddManager->bddOne,
+                           bddManager->bddOne, &resultBdd);
+  CalBddPutRefCount(resultBdd, CAL_MAX_REF_COUNT);
+  bddManager->userOneBdd =  CalBddGetBddNode(resultBdd);
+  bddManager->userZeroBdd = CalBddNodeNot(bddManager->userOneBdd);
+  
+  /* Null BDD */
+  CalBddPutBddId(bddManager->bddNull, CAL_BDD_NULL_ID);
+  CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], bddNode);
+  CalBddPutBddNode(bddManager->bddNull, bddNode);
+  /* ~0x10 put so that the node is not mistaken for forwarded node or
+     the constant nodes. */
+  CalBddPutThenBddNode(bddManager->bddNull, (CalBddNode_t *)~0x10);
+  CalBddPutElseBddNode(bddManager->bddNull, (CalBddNode_t *)~0x10);
+  CalBddPutRefCount(bddManager->bddNull, CAL_MAX_REF_COUNT);
+  /* Put in the unique table, so that it gets locked */
+  /*CalHashTableAddDirect(bddManager->uniqueTable[0], bddNode);*/
+
+  bddManager->indexToId = Cal_MemAlloc(Cal_BddId_t, bddManager->maxNumVars);
+  bddManager->idToIndex = Cal_MemAlloc(Cal_BddIndex_t, bddManager->maxNumVars+1);
+  bddManager->idToIndex[CAL_BDD_CONST_ID] = CAL_BDD_CONST_INDEX;
+
+  bddManager->depth = DEFAULT_DEPTH;
+  bddManager->maxDepth = DEFAULT_MAX_DEPTH;
+  bddManager->pipelineState = READY;
+  bddManager->pipelineDepth = PIPELINE_EXECUTION_DEPTH;
+  bddManager->currentPipelineDepth = 0;
+  bddManager->pipelineFn = CalOpAnd;
+
+
+  bddManager->reqQue = Cal_MemAlloc(CalHashTable_t **, bddManager->maxDepth);
+  bddManager->cacheTable = CalCacheTableTwoInit(bddManager);
+  
+  for (i=0; i < bddManager->maxDepth; i++){
+    bddManager->reqQue[i] = Cal_MemAlloc(CalHashTable_t *,
+                                         bddManager->maxNumVars+1);
+    bddManager->reqQue[i][0] = CalHashTableInit(bddManager, 0);
+  }
+
+  bddManager->requestNodeListArray = Cal_MemAlloc(CalRequestNode_t*,
+                                                  MAX_INSERT_DEPTH);
+  for(i = 0; i < MAX_INSERT_DEPTH; i++){
+    bddManager->requestNodeListArray[i] = Cal_Nil(CalRequestNode_t);
+  }
+  bddManager->userProvisionalNodeList = Cal_Nil(CalRequestNode_t);
+
+  /* Garbage collection related information */
+  bddManager->numNodes = bddManager->numPeakNodes = 1;
+  bddManager->numNodesFreed = 0;
+  bddManager->gcCheck = CAL_GC_CHECK;
+  bddManager->uniqueTableGCLimit =  CAL_MIN_GC_LIMIT;
+  bddManager->numGC = 0;
+  bddManager->gcMode = 1;
+  bddManager->nodeLimit = 0;
+  bddManager->overflow = 0;
+  bddManager->repackAfterGCThreshold = CAL_REPACK_AFTER_GC_THRESHOLD;
+  
+
+  /* Special functions */
+  bddManager->TransformFn = BddDefaultTransformFn;
+  bddManager->transformEnv = 0;
+
+
+  /* Association related information */
+  bddManager->associationList = Cal_Nil(CalAssociation_t);
+  /*bddManager->tempAssociation = CAL_BDD_NEW_REC(bddManager, CalAssociation_t);*/
+  bddManager->tempAssociation = Cal_MemAlloc(CalAssociation_t, 1);
+  bddManager->tempAssociation->id = -1;
+  bddManager->tempAssociation->lastBddIndex = -1;
+  bddManager->tempAssociation->varAssociation =
+      Cal_MemAlloc(Cal_Bdd_t, bddManager->maxNumVars+1);
+  for(i = 0; i < bddManager->maxNumVars+1; i++){
+     bddManager->tempAssociation->varAssociation[i] = bddManager->bddNull;
+  }
+  bddManager->tempOpCode = -1;
+  bddManager->currentAssociation = bddManager->tempAssociation;
+
+  /* BDD reordering related information */
+  bddManager->dynamicReorderingEnableFlag = 1;
+  bddManager->reorderMethod = CAL_REORDER_METHOD_DF;
+  bddManager->reorderTechnique = CAL_REORDER_NONE;
+  bddManager->numForwardedNodes = 0;
+  bddManager->numReorderings = 0;
+  bddManager->maxNumVarsSiftedPerReordering = 1000;
+  bddManager->maxNumSwapsPerReordering = 2000000;
+  bddManager->numSwaps = 0;
+  bddManager->numTrivialSwaps = 0;
+  bddManager->maxSiftingGrowth = 2.0;
+  bddManager->reorderingThreshold = CAL_BDD_REORDER_THRESHOLD;
+  bddManager->maxForwardedNodes = CAL_NUM_FORWARDED_NODES_LIMIT;
+  bddManager->tableRepackThreshold = CAL_TABLE_REPACK_THRESHOLD;
+  
+
+  /*bddManager->superBlock = CAL_BDD_NEW_REC(bddManager, Cal_Block_t);*/
+  bddManager->superBlock = Cal_MemAlloc(Cal_Block_t, 1);
+  bddManager->superBlock->numChildren=0;
+  bddManager->superBlock->children=0;
+  bddManager->superBlock->reorderable=1;
+  bddManager->superBlock->firstIndex= -1;
+  bddManager->superBlock->lastIndex=0;
+  
+  bddManager->hooks = Cal_Nil(void);
+  
+  return bddManager;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Frees the BDD manager and all the associated allocations]
+
+  Description [Frees the BDD manager and all the associated allocations]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddManagerInit]
+
+******************************************************************************/
+int
+Cal_BddManagerQuit(Cal_BddManager bddManager)
+{
+  int i, j;
+
+  if(bddManager == Cal_Nil(Cal_BddManager_t)) return 1;
+
+  for (i=0; i < bddManager->maxDepth; i++){
+    for (j=0; j <= bddManager->numVars; j++){
+      CalHashTableQuit(bddManager, bddManager->reqQue[i][j]);
+    }
+    Cal_MemFree(bddManager->reqQue[i]);
+  }
+  
+  for (i=0; i <= bddManager->numVars; i++){
+    CalHashTableQuit(bddManager, bddManager->uniqueTable[i]);
+    CalNodeManagerQuit(bddManager->nodeManagerArray[i]);
+  }
+
+  CalCacheTableTwoQuit(bddManager->cacheTable);
+  Cal_MemFree(bddManager->tempAssociation->varAssociation);
+  /*CAL_BDD_FREE_REC(bddManager, bddManager->tempAssociation, CalAssociation_t);*/
+  Cal_MemFree(bddManager->tempAssociation);
+  /*CAL_BDD_FREE_REC(bddManager, bddManager->superBlock, Cal_Block_t);*/
+  CalFreeBlockRecursively(bddManager->superBlock);
+  CalAssociationListFree(bddManager);
+  Cal_MemFree(bddManager->varBdds);
+  Cal_MemFree(bddManager->indexToId);
+  Cal_MemFree(bddManager->idToIndex);
+  Cal_MemFree(bddManager->uniqueTable);
+  Cal_MemFree(bddManager->reqQue);
+  Cal_MemFree(bddManager->requestNodeListArray);
+  Cal_MemFree(bddManager->nodeManagerArray);
+  CalPageManagerQuit(bddManager->pageManager1);
+  CalPageManagerQuit(bddManager->pageManager2);
+  Cal_MemFree(bddManager);
+
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Sets appropriate fields of BDD Manager.]
+
+  Description [This function is used to set the parameters which are
+  used to control the reordering process. "reorderingThreshold"
+  determines the number of nodes below which reordering will NOT be
+  invoked, "maxForwardedNodes" determines the maximum number of
+  forwarded nodes which are allowed (at that point the cleanup must be
+  done), and "repackingThreshold" determines the fraction of the page
+  utilized below which repacking has to be invoked. These parameters
+  have different effect on the computational and memory usage aspects
+  of reordeing. For instance, higher value of "maxForwardedNodes" will
+  result in process consuming more memory, and a lower value on the
+  other hand would invoke the cleanup process repeatedly resulting in
+  increased computation.]
+
+  SideEffects [Sets appropriate fields of BDD Manager]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cal_BddManagerSetParameters(Cal_BddManager bddManager,
+			    long reorderingThreshold,
+			    long maxForwardedNodes,
+                            double repackAfterGCThreshold,
+                            double tableRepackThreshold)
+{
+  if (reorderingThreshold >= 0){
+    bddManager->reorderingThreshold = reorderingThreshold;
+  }
+  if (maxForwardedNodes >= 0){
+    bddManager->maxForwardedNodes = maxForwardedNodes;
+  }
+  if (repackAfterGCThreshold >= 0.0){
+    bddManager->repackAfterGCThreshold = (float) repackAfterGCThreshold;
+  }
+  if (tableRepackThreshold >= 0.0){
+    bddManager->tableRepackThreshold = (float) tableRepackThreshold;
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of BDD nodes]
+
+  Description [Returns the number of BDD nodes]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddTotalSize]
+
+******************************************************************************/
+unsigned long
+Cal_BddManagerGetNumNodes(Cal_BddManager bddManager)
+{
+  return  bddManager->numNodes;
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates and returns a new variable at the start of the variable
+  order.]
+
+  Description [Creates and returns a new variable at the start of the
+  variable order.]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddManagerCreateNewVarFirst(Cal_BddManager bddManager)
+{
+  return CalBddGetExternalBdd(bddManager, CalBddManagerCreateNewVar(bddManager,
+                                                        (Cal_BddIndex_t)0));
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Creates and returns a new variable at the end of the variable
+  order.]
+
+  Description [Creates and returns a new variable at the end of the variable
+  order.]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddManagerCreateNewVarLast(Cal_BddManager bddManager)
+{
+  return CalBddGetExternalBdd(bddManager,
+                              CalBddManagerCreateNewVar(bddManager,
+                                                        (Cal_BddIndex_t)
+                                                        bddManager->numVars));
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates and returns a new variable before the specified one in
+  the variable order.]
+
+  Description [Creates and returns a new variable before the specified one in
+  the variable order.]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddManagerCreateNewVarBefore(Cal_BddManager bddManager,
+                                 Cal_Bdd userBdd)
+{
+  Cal_Bdd_t calBdd = CalBddGetInternalBdd(bddManager, userBdd);
+  if (CalBddIsBddConst(calBdd)){
+    return Cal_BddManagerCreateNewVarLast(bddManager);
+  }
+  else{
+    return CalBddGetExternalBdd(bddManager,
+                                CalBddManagerCreateNewVar(bddManager,
+                                                          CalBddGetBddIndex(bddManager, 
+                                                  calBdd)));
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Creates and returns a new variable after the specified one in
+  the variable  order.]
+
+  Description [Creates and returns a new variable after the specified one in
+  the variable  order.]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddManagerCreateNewVarAfter(Cal_BddManager bddManager,
+                                Cal_Bdd userBdd)
+{
+  Cal_Bdd_t calBdd = CalBddGetInternalBdd(bddManager, userBdd);
+  if (CalBddIsBddConst(calBdd)){
+    return Cal_BddManagerCreateNewVarLast(bddManager);
+  }
+  else{
+    return CalBddGetExternalBdd(bddManager,
+                                CalBddManagerCreateNewVar(bddManager,
+                                                          CalBddGetBddIndex(bddManager, calBdd)+1));
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the variable with the specified index, null if no
+  such variable exists]
+
+  Description [Returns the variable with the specified index, null if no
+  such variable exists]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddManagerGetVarWithIndex(Cal_BddManager bddManager, Cal_BddIndex_t  index)
+{
+  if (index >= bddManager->numVars){
+    CalBddWarningMessage("Index out of range");
+    return (Cal_Bdd) 0;
+  }
+  return CalBddGetExternalBdd(bddManager,
+                              bddManager->varBdds[bddManager->indexToId[index]]); 
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the variable with the specified id, null if no
+  such variable exists]
+
+  Description [Returns the variable with the specified id, null if no
+  such variable exists]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddManagerGetVarWithId(Cal_BddManager bddManager,  Cal_BddId_t  id)
+{
+  if (id <= 0 || id > bddManager->numVars){
+    CalBddWarningMessage("Id out of range");
+    return (Cal_Bdd) 0;
+  }
+  return CalBddGetExternalBdd(bddManager, bddManager->varBdds[id]);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [This function creates and returns a new variable with given
+  index value.]
+
+  Description [Right now this function does not handle the case when the
+  package is working in multiprocessor mode. We need to put in the necessary
+  code later.]
+
+  SideEffects [If the number of variables in the manager exceeds that of value
+  of numMaxVars, then we need to reallocate various fields of the manager. Also
+  depending upon the value of "index", idToIndex and indexToId tables would
+  change.]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddManagerCreateNewVar(Cal_BddManager_t * bddManager, Cal_BddIndex_t  index)
+{
+  Cal_Bdd_t calBdd;
+  Cal_BddId_t varId;
+  int totalNumVars, maxNumVars, i;
+  CalAssociation_t *association;
+  
+  if (bddManager->numVars == CAL_MAX_VAR_ID){
+    CalBddFatalMessage("Cannot create any new variable, no more Id left."); 
+  }
+
+  /*
+   * Get the total number of variables. If the index is more than the total
+   * number of variables, then report error.
+   */
+  totalNumVars = bddManager->numVars;
+  
+  if (index > totalNumVars){
+    CalBddFatalMessage("The variable index out of range");
+  }
+  
+
+  /*
+   * Create a new variable in the manager which contains this index.
+   * This might lead to change in the id->index, and index->id
+   * for other managers.
+   */
+
+  /*
+   * If the number of variables is equal to the maximum number of variables
+   * then reallocate memory.
+   */
+  if (bddManager->numVars == bddManager->maxNumVars){
+    int oldMaxNumVars;
+    CalAssociation_t *p;
+    
+    oldMaxNumVars = bddManager->maxNumVars;
+    if ((maxNumVars = 2*oldMaxNumVars) > CAL_MAX_VAR_ID){
+      maxNumVars = CAL_MAX_VAR_ID;
+    }
+    bddManager->maxNumVars = maxNumVars;
+    bddManager->varBdds = Cal_MemRealloc(Cal_Bdd_t,
+                                         bddManager->varBdds, maxNumVars+1); 
+    
+    bddManager->nodeManagerArray = Cal_MemRealloc(CalNodeManager_t *,
+                                                  bddManager->nodeManagerArray, 
+                                                  maxNumVars+1);
+
+    bddManager->idToIndex = Cal_MemRealloc(Cal_BddIndex_t, bddManager->idToIndex,
+                                        maxNumVars+1);
+
+    bddManager->indexToId = Cal_MemRealloc(Cal_BddIndex_t, bddManager->indexToId,
+                                        maxNumVars);
+
+    bddManager->uniqueTable = Cal_MemRealloc(CalHashTable_t *,
+                                          bddManager->uniqueTable, maxNumVars+1);
+    
+    for (i=0; i<bddManager->maxDepth; i++){
+      bddManager->reqQue[i] = Cal_MemRealloc(CalHashTable_t *, bddManager->reqQue[i],
+                                          maxNumVars+1);
+    }
+    bddManager->tempAssociation->varAssociation = 
+        Cal_MemRealloc(Cal_Bdd_t, bddManager->tempAssociation->varAssociation,
+        maxNumVars+1);
+    /* CHECK LOOP INDICES */
+    for(i = oldMaxNumVars+1; i < maxNumVars+1; i++){
+      bddManager->tempAssociation->varAssociation[i] = bddManager->bddNull;
+    }
+    for(p = bddManager->associationList; p; p = p->next){
+      p->varAssociation = 
+          Cal_MemRealloc(Cal_Bdd_t, p->varAssociation, maxNumVars+1);
+      /* CHECK LOOP INDICES */
+      for(i = oldMaxNumVars+1; i < maxNumVars+1; i++){
+        p->varAssociation[i] = bddManager->bddNull;
+      }
+    }
+  }
+
+  /* If the variable has been created in the middle, shift the indices. */
+  if (index != bddManager->numVars){
+    for (i=0; i<bddManager->numVars; i++){
+      if (bddManager->idToIndex[i+1] >= index){
+        bddManager->idToIndex[i+1]++;
+      }
+    }
+  }
+
+  /* Fix indexToId table */
+  for (i=bddManager->numVars; i>index; i--){
+    bddManager->indexToId[i] = bddManager->indexToId[i-1];
+  }
+
+  for(association = bddManager->associationList; association;
+                                              association =
+                                                  association->next){
+    if (association->lastBddIndex >= index){
+      association->lastBddIndex++;
+    }
+  }
+  if (bddManager->tempAssociation->lastBddIndex >= index){
+    bddManager->tempAssociation->lastBddIndex++;
+  }
+  
+  bddManager->numVars++;
+  varId = bddManager->numVars;
+
+  bddManager->idToIndex[varId] = index;
+  bddManager->indexToId[index] = varId;
+  
+  bddManager->nodeManagerArray[varId] =
+      CalNodeManagerInit(bddManager->pageManager2); 
+  bddManager->uniqueTable[varId] =
+      CalHashTableInit(bddManager, varId);
+    
+  /* insert node in the uniqueTableForId */
+  CalHashTableAddDirectAux(bddManager->uniqueTable[varId],
+                           bddManager->bddOne, bddManager->bddZero, &calBdd);
+  CalBddPutRefCount(calBdd, CAL_MAX_REF_COUNT);
+  bddManager->varBdds[varId] = calBdd;
+
+  bddManager->numNodes++;
+  
+#ifdef __OLD__
+  /* initialize req_que_for_id */
+  bddManager->reqQue[varId] = Cal_MemAlloc(CalHashTable_t*, bddManager->maxDepth);
+  for (i=0; i<manager->maxDepth; i++){
+    bddManager->reqQue[varId][i] = CalHashTableInit(bddManager, varId);
+  }
+#endif
+  
+  /* initialize req_que_for_id */
+  for (i=0; i<bddManager->maxDepth; i++){
+    bddManager->reqQue[i][varId] =
+        CalHashTableInit(bddManager, varId);
+  }
+  CalBddShiftBlock(bddManager, bddManager->superBlock, (long)index);
+  return calBdd;
+}
+
+  
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddDefaultTransformFn(
+  Cal_BddManager_t * bddManager,
+  CalAddress_t  value1,
+  CalAddress_t  value2,
+  CalAddress_t * result1,
+  CalAddress_t * result2,
+  Cal_Pointer_t  pointer)
+{
+  if (!value2)
+    /* Will be a carry when taking 2's complement of value2.  Thus, */
+    /* take 2's complement of high part. */
+    value1= -(long)value1;
+  else
+    {
+      value2= -(long)value2;
+      value1= ~value1;
+    }
+  *result1=value1;
+  *result2=value2;
+}
+
+#ifdef CALBDDMANAGER
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+CalBddManagerPrint(Cal_BddManager_t *bddManager)
+{
+  int i;
+  CalHashTable_t *uniqueTableForId;
+  printf("#####################   BDD MANAGER   #####################\n");
+  for(i = 1; i < bddManager->numVars; i++){
+    uniqueTableForId = bddManager->uniqueTable[i];
+    CalHashTablePrint(uniqueTableForId);
+  }
+  fflush(stdout);
+  return 0;
+}
+
+
+main(argc, argv)
+int argc;
+char **argv;
+{
+	Cal_Bdd_t n;
+	Cal_BddManager_t *manager;
+
+	manager = CalBddManagerInit(argc, argv);
+	n = CalBddManagerCreateVariable(bddManager);
+	CalBddFunctionPrint(n);
+	n = CalBddManagerGetVariable(bddManager, 0);
+	CalBddFunctionPrint(n);
+}
+#endif /* CALBDDMANAGER */
+
+#ifdef __GC__
+main(argc, argv)
+int argc;
+char **argv;
+{
+  Cal_BddManager_t *manager;
+  Cal_Bdd_t vars[256];
+  Cal_Bdd_t function, tempFunction;
+  int i;
+  int numVars;
+  
+  if (argc >= 2)
+        numVars = atoi(argv[1]);
+  else
+    numVars = 3;
+  
+  manager = Cal_BddManagerInit();
+  
+  for (i = 0; i < numVars; i++){
+    vars[i] = Cal_BddManagerCreateNewVarLast(bddManager);
+  }
+  
+  function = vars[0];
+  for (i = 1; i < numVars - 1; i++){
+    tempFunction = Cal_BddITE(bddManager, vars[i], vars[i+1], function);
+    Cal_BddFree(function);
+    function = tempFunction;
+            /*fprintf(stdout, "i = %d\n", i);
+              unique_table_write(stdout, CalBddManager->unique_table);
+              */
+  }
+  fprintf(stdout, "\n******************Before Free****************\n");
+  for (i = 1; i <= numVars; i++){
+    CalHashTablePrint(bddManager->uniqueTable[i]);
+  }
+  Cal_BddFree(function);
+  fprintf(stdout, "\n****************After Free****************\n");
+  for (i = 1; i <= numVars; i++){
+    CalHashTablePrint(bddManager->uniqueTable[i]);
+  }
+  Cal_BddManagerGC(bddManager);
+  fprintf(stdout, "\n****************After GC****************\n");
+  for (i = 1; i <= numVars; i++){
+    CalHashTablePrint(bddManager->uniqueTable[i]);
+  }
+}
+#endif
Index: /vis_dev/glu-2.1/src/calBdd/calBddOp.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddOp.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddOp.c	(revision 6)
@@ -0,0 +1,1015 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddOp.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for performing simple boolean operations on a
+  pair of BDDs or on an array of pair of BDDs or on an array of BDDs.]
+
+  Description [The "cal" specific routines are "Cal_BddPairwiseAnd/Or",
+  "Cal_BddMultiwayAnd/Or".] 
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddOp.c,v 1.1.1.3 1998/05/04 00:58:52 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static Cal_Bdd_t * BddArrayOpBF(Cal_BddManager_t * bddManager, Cal_Bdd_t* bddArray, int numFunction, CalOpProc_t calOpProc);
+static Cal_Bdd_t BddMultiwayOp(Cal_BddManager_t * bddManager, Cal_Bdd_t * calBddArray, int numBdds, CalOpProc_t op);
+static void BddArrayToRequestNodeListArray(Cal_BddManager_t * bddManager, Cal_Bdd_t * calBddArray, int numBdds);
+static int CeilLog2(int number);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical AND of argument BDDs]
+
+  Description [Returns the BDD for logical AND of f and g]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddAnd(
+  Cal_BddManager bddManager,
+  Cal_Bdd  fUserBdd,
+  Cal_Bdd  gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  Cal_Bdd_t F, G;
+
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd);
+    G = CalBddGetInternalBdd(bddManager, gUserBdd);
+    result = CalBddOpBF(bddManager, CalOpAnd, F, G);
+  }
+  else {
+    return (Cal_Bdd)0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical NAND of argument BDDs]
+
+  Description [Returns the BDD for logical NAND of f and g]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddNand(
+  Cal_BddManager bddManager,
+  Cal_Bdd fUserBdd,
+  Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd_t F, G;
+  Cal_Bdd userResult;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd); 
+    G = CalBddGetInternalBdd(bddManager, gUserBdd); 
+    result = CalBddOpBF(bddManager, CalOpNand, F, G);
+  }
+  else{
+    return (Cal_Bdd) 0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical OR of argument BDDs]
+
+  Description [Returns the BDD for logical OR of f and g]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddOr(Cal_BddManager bddManager,
+          Cal_Bdd fUserBdd,
+          Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd_t F, G;
+  Cal_Bdd userResult;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd); 
+    G = CalBddGetInternalBdd(bddManager, gUserBdd); 
+    result = CalBddOpBF(bddManager, CalOpOr, F, G);
+  }
+  else{
+    return (Cal_Bdd) 0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical NOR of argument BDDs]
+
+  Description [Returns the BDD for logical NOR of f and g]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddNor(Cal_BddManager bddManager,
+           Cal_Bdd fUserBdd,
+           Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  Cal_Bdd_t F, G;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd); 
+    G = CalBddGetInternalBdd(bddManager, gUserBdd); 
+    result = CalBddOpBF(bddManager, CalOpOr, F, G);
+    CalBddNot(result, result);
+  }
+  else{
+    return (Cal_Bdd) 0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical exclusive OR of argument BDDs]
+
+  Description [Returns the BDD for logical exclusive OR of f and g]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddXor(Cal_BddManager bddManager,
+           Cal_Bdd fUserBdd,
+           Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  Cal_Bdd_t F, G;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd); 
+    G = CalBddGetInternalBdd(bddManager, gUserBdd); 
+    result = CalBddOpBF(bddManager, CalOpXor, F, G);
+  }
+  else{
+    return (Cal_Bdd) 0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical exclusive NOR of argument BDDs]
+
+  Description [Returns the BDD for logical exclusive NOR of f and g]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddXnor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  Cal_Bdd_t F, G;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    F = CalBddGetInternalBdd(bddManager, fUserBdd); 
+    G = CalBddGetInternalBdd(bddManager, gUserBdd); 
+    result = CalBddOpBF(bddManager, CalOpXor, F, G);
+    CalBddNot(result, result);
+  }
+  else{
+    return (Cal_Bdd) 0;
+  }
+  userResult =  CalBddGetExternalBdd(bddManager, result);
+  if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+    Cal_BddFree(bddManager, userResult);
+    Cal_BddManagerGC(bddManager);
+    return (Cal_Bdd) 0;
+  }
+  return userResult;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array]
+
+  Description [Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddPairwiseOr]
+
+******************************************************************************/
+Cal_Bdd *
+Cal_BddPairwiseAnd(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
+{
+  int i, num;
+  Cal_Bdd_t *bddArray;
+  Cal_Bdd_t *resultArray;
+  Cal_Bdd userBdd;
+  Cal_Bdd *userResultArray;
+ 
+  for (num = 0; (userBdd = userBddArray[num]); num++){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return Cal_Nil(Cal_Bdd);
+    }
+  }
+  if ((num == 0) || (num%2 != 0)){
+    fprintf(stdout,"Odd number of arguments passed to array AND\n");
+    return Cal_Nil(Cal_Bdd);
+  }
+  bddArray = Cal_MemAlloc(Cal_Bdd_t, num);
+  for (i = 0; i < num; i++){
+    bddArray[i] = CalBddGetInternalBdd(bddManager, userBddArray[i]);
+  }
+  resultArray =  BddArrayOpBF(bddManager, bddArray, num, CalOpAnd);
+  userResultArray = Cal_MemAlloc(Cal_Bdd, num/2);
+  for (i=0; i<num/2; i++){
+    userResultArray[i] = CalBddGetExternalBdd(bddManager, resultArray[i]);
+  }
+  Cal_MemFree(bddArray);
+  Cal_MemFree(resultArray);
+  if (CalBddPostProcessing(bddManager)  == CAL_BDD_OVERFLOWED){
+    for (i=0; i<num/2; i++){
+      Cal_BddFree(bddManager, userResultArray[i]);
+      userResultArray[i] = (Cal_Bdd) 0;
+    }
+    Cal_BddManagerGC(bddManager);
+    return userResultArray;
+  }
+  return userResultArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array]
+
+  Description [Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddPairwiseAnd]
+
+******************************************************************************/
+Cal_Bdd *
+Cal_BddPairwiseOr(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
+{
+  int i, num=0;
+  Cal_Bdd_t *bddArray;
+  Cal_Bdd_t *resultArray;
+  Cal_Bdd userBdd;
+  Cal_Bdd *userResultArray;
+ 
+  for (num = 0; (userBdd = userBddArray[num]); num++){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return Cal_Nil(Cal_Bdd);
+    }
+  }
+  if ((num == 0) || (num%2 != 0)){
+    fprintf(stdout,"Odd number of arguments passed to array OR\n");
+    return Cal_Nil(Cal_Bdd);
+  }
+  bddArray = Cal_MemAlloc(Cal_Bdd_t, num);
+  for (i = 0; i < num; i++){
+    bddArray[i] = CalBddGetInternalBdd(bddManager, userBddArray[i]);
+  }
+  resultArray =  BddArrayOpBF(bddManager, bddArray, num, CalOpOr);
+  userResultArray = Cal_MemAlloc(Cal_Bdd, num/2);
+  for (i=0; i<num/2; i++){
+    userResultArray[i] = CalBddGetExternalBdd(bddManager, resultArray[i]);
+  }
+  Cal_MemFree(bddArray);
+  Cal_MemFree(resultArray);
+  return userResultArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array]
+
+  Description [Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddPairwiseAnd]
+
+******************************************************************************/
+Cal_Bdd *
+Cal_BddPairwiseXor(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
+{
+  int i, num=0;
+  Cal_Bdd_t *bddArray;
+  Cal_Bdd_t *resultArray;
+  Cal_Bdd userBdd;
+  Cal_Bdd *userResultArray;
+ 
+  for (num = 0; (userBdd = userBddArray[num]); num++){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return Cal_Nil(Cal_Bdd);
+    }
+  }
+  if ((num == 0) || (num%2 != 0)){
+    fprintf(stdout,"Odd number of arguments passed to array OR\n");
+    return Cal_Nil(Cal_Bdd);
+  }
+  bddArray = Cal_MemAlloc(Cal_Bdd_t, num);
+  for (i = 0; i < num; i++){
+    bddArray[i] = CalBddGetInternalBdd(bddManager, userBddArray[i]);
+  }
+  resultArray =  BddArrayOpBF(bddManager, bddArray, num, CalOpXor);
+  userResultArray = Cal_MemAlloc(Cal_Bdd, num/2);
+  for (i=0; i<num/2; i++){
+    userResultArray[i] = CalBddGetExternalBdd(bddManager, resultArray[i]);
+  }
+  Cal_MemFree(bddArray);
+  Cal_MemFree(resultArray);
+  return userResultArray;
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical AND of argument BDDs]
+
+  Description [Returns the BDD for logical AND of set of BDDs in the bddArray]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddMultiwayAnd(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
+{
+  int i, numBdds = 0;
+  Cal_Bdd_t result;
+  Cal_Bdd_t *calBddArray;
+  Cal_Bdd userBdd;
+
+  for (numBdds  = 0; (userBdd = userBddArray[numBdds]); numBdds++){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return (Cal_Bdd) 0;
+    }
+  }
+  
+  if (numBdds == 0){
+    CalBddWarningMessage("Multiway AND called with 0 length array");
+    return (Cal_Bdd) 0;
+  }
+  else if (numBdds == 1){
+    return Cal_BddIdentity(bddManager, userBddArray[0]);
+  }
+  else{
+    calBddArray = Cal_MemAlloc(Cal_Bdd_t, numBdds+1);
+    for (i = 0; i < numBdds; i++){
+      calBddArray[i] = CalBddGetInternalBdd(bddManager, userBddArray[i]);
+    }
+    result = BddMultiwayOp(bddManager, calBddArray, numBdds, CalOpAnd);
+    Cal_MemFree(calBddArray);
+  }
+  return CalBddGetExternalBdd(bddManager, result);
+}
+ 
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical OR of argument BDDs]
+
+  Description [Returns the BDD for logical OR of set of BDDs in the bddArray]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddMultiwayOr(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
+{
+  int i, numBdds = 0;
+  Cal_Bdd_t result;
+  Cal_Bdd_t *calBddArray;
+  Cal_Bdd userBdd;
+
+  for (numBdds = 0; (userBdd = userBddArray[numBdds]); numBdds++){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return (Cal_Bdd) 0;
+    }
+  }
+  
+  if (numBdds == 0){
+    CalBddWarningMessage("Multiway OR called with 0 length array");
+    return (Cal_Bdd) 0;
+  }
+  else if (numBdds == 1){
+    return Cal_BddIdentity(bddManager, userBddArray[0]);
+  }
+  else{
+    calBddArray = Cal_MemAlloc(Cal_Bdd_t, numBdds+1);
+    for (i = 0; i < numBdds; i++){
+      calBddArray[i] = CalBddGetInternalBdd(bddManager, userBddArray[i]);
+    }
+    result = BddMultiwayOp(bddManager, calBddArray, numBdds, CalOpOr);
+    Cal_MemFree(calBddArray);
+  }
+  return CalBddGetExternalBdd(bddManager, result);
+}
+ 
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD for logical XOR of argument BDDs]
+
+  Description [Returns the BDD for logical XOR of set of BDDs in the bddArray]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddMultiwayXor(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
+{
+  int i, numBdds = 0;
+  Cal_Bdd_t result;
+  Cal_Bdd_t *calBddArray;
+  Cal_Bdd userBdd;
+
+  for (numBdds = 0; (userBdd = userBddArray[numBdds]); numBdds++){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return (Cal_Bdd) 0;
+    }
+  }
+  
+  if (numBdds == 0){
+    CalBddWarningMessage("Multiway OR called with 0 length array");
+    return (Cal_Bdd) 0;
+  }
+  else if (numBdds == 1){
+    return Cal_BddIdentity(bddManager, userBddArray[0]);
+  }
+  else{
+    calBddArray = Cal_MemAlloc(Cal_Bdd_t, numBdds+1);
+    for (i = 0; i < numBdds; i++){
+      calBddArray[i] = CalBddGetInternalBdd(bddManager, userBddArray[i]);
+    }
+    result = BddMultiwayOp(bddManager, calBddArray, numBdds, CalOpXor);
+    Cal_MemFree(calBddArray);
+  }
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes result BDDs for an array of lists, each entry of which 
+  is pair of pointers, each of which points to a operand BDD or an entry in
+  another list with a smaller array index]
+
+  Description [Computes result BDDs for an array of lists, each entry of which
+  is pair of pointers, each of which points to a operand BDD or an entry in
+  another list with a smaller array index]
+
+  SideEffects [ThenBDD pointer of an entry is over written by the result BDD
+  and ElseBDD pointer is marked using FORWARD_FLAG]
+
+******************************************************************************/
+void
+CalRequestNodeListArrayOp(Cal_BddManager_t * bddManager,
+                          CalRequestNode_t ** requestNodeListArray,
+                          CalOpProc_t calOpProc)
+{
+  CalRequestNode_t *requestNode;
+  CalRequest_t F, G, result;
+  int pipeDepth, bddId, bddIndex;
+  CalHashTable_t **reqQueAtPipeDepth, *hashTable, *uniqueTableForId;
+  CalHashTable_t ***reqQue = bddManager->reqQue;
+  
+  /* ReqQueInsertUsingReqListArray */
+  for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+    reqQueAtPipeDepth = reqQue[pipeDepth];
+    for(requestNode = requestNodeListArray[pipeDepth];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetF(requestNode, F);
+      CalRequestIsForwardedTo(F);
+      CalRequestNodeGetG(requestNode, G);
+      CalRequestIsForwardedTo(G);
+      if((*calOpProc)(bddManager, F, G, &result) == 0){
+        CalBddNormalize(F, G);
+        CalBddGetMinId2(bddManager, F, G, bddId);
+        CalHashTableFindOrAdd(reqQueAtPipeDepth[bddId], F, G, &result);
+      }
+      CalRequestNodePutThenRequest(requestNode, result);
+      CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+    }
+  }
+
+  /* ReqQueApply */
+  for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+      reqQueAtPipeDepth = reqQue[pipeDepth];
+      hashTable = reqQueAtPipeDepth[bddId];
+      if(hashTable->numEntries){
+        CalHashTableApply(bddManager, hashTable, reqQueAtPipeDepth, calOpProc);
+      }
+    }
+  }
+
+#ifdef COMPUTE_MEMORY_OVERHEAD
+  {
+    calNumEntriesAfterApply = 0;
+    for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+      bddId = bddManager->indexToId[bddIndex];
+      for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+        reqQueAtPipeDepth = reqQue[pipeDepth];
+        hashTable = reqQueAtPipeDepth[bddId];
+        calNumEntriesAfterApply += hashTable->numEntries;
+      }
+    }
+  }
+#endif
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= 0; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+      hashTable = reqQue[pipeDepth][bddId];
+      if(hashTable->numEntries){
+        CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+      }
+    }
+  }
+
+#ifdef COMPUTE_MEMORY_OVERHEAD
+  {
+    CalRequestNode_t *requestNode;
+    calNumEntriesAfterReduce = 0;
+    for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+      CalRequestNode_t *next;
+      Cal_BddId_t bddId;
+      bddId = bddManager->indexToId[bddIndex];
+      for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+        hashTable = reqQue[pipeDepth][bddId];
+        for (requestNode = hashTable->requestNodeList;
+             requestNode != Cal_Nil(CalRequestNode_t); requestNode = next){
+          next = CalRequestNodeGetNextRequestNode(requestNode);
+          calNumEntriesAfterReduce++;
+        }
+      }
+    }
+    calAfterReduceToAfterApplyNodesRatio =
+        ((double)calNumEntriesAfterReduce)/((double)calNumEntriesAfterApply); 
+    calAfterReduceToUniqueTableNodesRatio = 
+        ((double)calNumEntriesAfterReduce)/((double)bddManager->numNodes);
+  }
+#endif
+
+  /* ReqListArrayReqForward */
+  for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+    for(requestNode = requestNodeListArray[pipeDepth];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetThenRequest(requestNode, result);
+      CalRequestIsForwardedTo(result);
+      Cal_Assert(CalBddIsForwarded(result) == 0);
+      CalRequestNodePutThenRequest(requestNode, result);
+    }
+  }
+
+  /* ReqQueCleanUp */
+  for(pipeDepth = 0; pipeDepth < bddManager->depth; pipeDepth++){
+    reqQueAtPipeDepth = reqQue[pipeDepth];
+    for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+      CalHashTableCleanUp(reqQueAtPipeDepth[bddId]);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Internal routine to compute a logical operation on a pair of BDDs]
+
+  Description [Internal routine to compute a logical operation on a pair of BDDs]
+
+  SideEffects [None]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddOpBF(
+  Cal_BddManager_t * bddManager,
+  CalOpProc_t calOpProc,
+  Cal_Bdd_t  F,
+  Cal_Bdd_t  G)
+{
+  Cal_Bdd_t result;
+  Cal_BddId_t minId, bddId;
+  /*Cal_BddIndex_t minIndex; Commented out because of the problem on alpha*/ 
+  int minIndex;
+  int bddIndex;
+  CalHashTable_t *hashTable, **hashTableArray, *uniqueTableForId;
+  
+  if (calOpProc(bddManager, F, G, &result)){
+    return result;
+  }
+  CalBddGetMinIdAndMinIndex(bddManager, F, G, minId, minIndex);
+  hashTableArray = bddManager->reqQue[0];
+  CalHashTableFindOrAdd(hashTableArray[minId], F, G, &result);
+  
+  /* ReqQueApply */
+  for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = hashTableArray[bddId];
+    if(hashTable->numEntries){
+      CalHashTableApply(bddManager, hashTable, hashTableArray, calOpProc);
+    }
+  }
+#ifdef COMPUTE_MEMORY_OVERHEAD
+  {
+    calNumEntriesAfterApply = 0;
+    for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+      bddId = bddManager->indexToId[bddIndex];
+      hashTable = hashTableArray[bddId];
+      calNumEntriesAfterApply += hashTable->numEntries;
+    }
+  }
+#endif
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = hashTableArray[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+  CalRequestIsForwardedTo(result);
+
+#ifdef COMPUTE_MEMORY_OVERHEAD
+  {
+    CalRequestNode_t *requestNode;
+    calNumEntriesAfterReduce = 0;
+    for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+      CalRequestNode_t *next;
+      Cal_BddId_t bddId;
+      
+      bddId = bddManager->indexToId[bddIndex];
+      hashTable = hashTableArray[bddId];
+      for (requestNode = hashTable->requestNodeList; requestNode !=
+                                                         Cal_Nil(CalRequestNode_t);
+                                                     requestNode = next){
+        next = CalRequestNodeGetNextRequestNode(requestNode);
+        calNumEntriesAfterReduce++;
+      }
+    }
+    calAfterReduceToAfterApplyNodesRatio =
+        ((double)calNumEntriesAfterReduce)/((double)calNumEntriesAfterApply); 
+    calAfterReduceToUniqueTableNodesRatio = 
+        ((double)calNumEntriesAfterReduce)/((double)bddManager->numNodes);
+  }
+#endif
+
+  /* Clean up */
+  for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(hashTableArray[bddId]);
+  }
+  return result;
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Internal common routine for Cal_BddPairwiseAnd and Cal_BddPairwiseOr]
+
+  SideEffects [None]
+
+******************************************************************************/
+static Cal_Bdd_t *
+BddArrayOpBF(Cal_BddManager_t * bddManager, Cal_Bdd_t*  bddArray,
+                int numFunction, CalOpProc_t calOpProc)
+{
+  Cal_BddId_t minId, bddId;
+  /*Cal_BddIndex_t minIndex = 0;*/
+  int minIndex = 0;
+  int bddIndex;
+  CalHashTable_t *hashTable, **hashTableArray, *uniqueTableForId;
+  Cal_Bdd_t F, G, result;
+  int numPairs = numFunction/2;
+  Cal_Bdd_t *resultArray = Cal_MemAlloc(Cal_Bdd_t, numPairs);
+  int i;
+  
+  hashTableArray = bddManager->reqQue[0];
+  for (i=0; i<numPairs; i++){
+    F = bddArray[i<<1];
+    G = bddArray[(i<<1)+1];
+    if ((*calOpProc)(bddManager, F, G, &result) == 0){
+      CalBddGetMinIdAndMinIndex(bddManager, F, G, minId, minIndex);
+      CalHashTableFindOrAdd(hashTableArray[minId], F, G, &result);
+    }
+    resultArray[i] = result;
+  }
+  
+  
+  /* ReqQueApply */
+  for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = hashTableArray[bddId];
+    if(hashTable->numEntries){
+      CalHashTableApply(bddManager, hashTable, hashTableArray, calOpProc);
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = hashTableArray[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+  for (i=0; i<numPairs; i++){
+    CalRequestIsForwardedTo(resultArray[i]);
+  }
+  /* Clean up */
+  for(bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(hashTableArray[bddId]);
+  }
+  return resultArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Internal routine for multiway operations]
+
+  Description [Internal routine for multiway operations]
+
+  SideEffects [None]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddMultiwayOp(Cal_BddManager_t * bddManager, Cal_Bdd_t * calBddArray,
+              int  numBdds, CalOpProc_t op)
+{
+  int pipeDepth;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t result;
+  
+  BddArrayToRequestNodeListArray(bddManager, calBddArray, numBdds);
+  CalRequestNodeListArrayOp(bddManager, bddManager->requestNodeListArray, op);
+  for(pipeDepth = 0; pipeDepth < bddManager->depth-1; pipeDepth++){
+    CalRequestNode_t *next;
+    for(requestNode = bddManager->requestNodeListArray[pipeDepth];
+        requestNode != Cal_Nil(CalRequestNode_t); requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      CalNodeManagerFreeNode(bddManager->nodeManagerArray[0],
+                             requestNode);
+    }
+    bddManager->requestNodeListArray[pipeDepth] =
+        Cal_Nil(CalRequestNode_t);
+  }
+  requestNode = bddManager->requestNodeListArray[bddManager->depth-1];
+  bddManager->requestNodeListArray[bddManager->depth-1] =
+      Cal_Nil(CalRequestNode_t); 
+  CalRequestNodeGetThenRequest(requestNode, result); 
+  CalNodeManagerFreeNode(bddManager->nodeManagerArray[0],
+                         requestNode);
+  return result;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an array of BDDs to a list of requests representing BDD
+  pairs]
+
+  Description [Converts an array of BDDs to a list of requests representing BDD]
+
+  SideEffects [None]
+
+******************************************************************************/
+static void
+BddArrayToRequestNodeListArray(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t * calBddArray,
+  int  numBdds)
+{
+  int i;
+  Cal_Bdd_t lastBdd;
+  CalRequestNode_t *even, *odd, *requestNode, *requestNodeList, *head;
+  
+  bddManager->depth = CeilLog2(numBdds);
+  if (bddManager->depth > 10){
+    CalBddFatalMessage("Don't be stooopid\n, Use lesser depth\n");
+  }
+    
+  if (bddManager->depth > bddManager->maxDepth){
+    /* Need to reallocate the memory for reqQue and
+       requestNodeListArray */
+    int oldMaxDepth = bddManager->maxDepth;
+    bddManager->maxDepth = bddManager->depth;
+    
+    for (i=0; i<bddManager->maxDepth; i++){
+      bddManager->requestNodeListArray[i] = Cal_Nil(CalRequestNode_t);
+    }
+
+    bddManager->reqQue = Cal_MemRealloc(CalHashTable_t **, bddManager->reqQue,
+                                 bddManager->maxDepth);
+    for (i=oldMaxDepth; i<bddManager->maxDepth; i++){
+      int j;
+      bddManager->reqQue[i] = Cal_MemAlloc(CalHashTable_t *, bddManager->maxNumVars+1);
+      for (j=0; j<bddManager->numVars+1; j++){
+        bddManager->reqQue[i][j] = CalHashTableInit(bddManager, j);
+      }
+    }
+  }
+  lastBdd = bddManager->bddNull;
+  if (numBdds%2 != 0){/* Odd number of Bdd's */
+    lastBdd = calBddArray[numBdds-1];
+  }
+  requestNodeList = bddManager->requestNodeListArray[0];
+  for (i=0; i<numBdds/2; i++){
+    CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], requestNode);
+    CalRequestNodePutF(requestNode, calBddArray[2*i]);
+    CalRequestNodePutG(requestNode, calBddArray[2*i+1]);
+    CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+    requestNodeList = requestNode;
+  }
+  bddManager->requestNodeListArray[0] = requestNodeList;
+
+  for (i=1; i<bddManager->depth; i++){
+    requestNodeList = bddManager->requestNodeListArray[i];
+    head = bddManager->requestNodeListArray[i-1];
+    while ((odd = head) && (even = head->nextBddNode)){
+      CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], requestNode);
+      /*
+       * We don't have to worry about the Id's attached with
+       * the requestNode or with the then and else part of it.
+       */
+      CalRequestNodePutThenRequestNode(requestNode, odd);
+      CalRequestNodePutElseRequestNode(requestNode, even);
+      CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+      requestNodeList = requestNode;
+      head = CalRequestNodeGetNextRequestNode(even);
+    }
+    if (odd != Cal_Nil(CalRequestNode_t)){/* There is an  odd node at this
+                                      level */
+      if (CalBddIsBddNull(bddManager,lastBdd)){ /* There are no odd nodes
+                                                 * from previous levels, so
+                                                 * make this an odd node.
+                                                 */
+        CalBddPutBddNode(lastBdd, odd);
+      }
+      else{ /* There exists an odd node, so make a pair now. */
+        CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], requestNode);
+        CalRequestNodePutThenRequestNode(requestNode, odd);
+        CalRequestNodePutElseRequest(requestNode, lastBdd);
+        CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        lastBdd = bddManager->bddNull;
+        requestNodeList = requestNode;
+      }
+    }
+    bddManager->requestNodeListArray[i] = requestNodeList;
+  }
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the smallest integer greater than or equal to log2 of a
+  number]
+
+  Description [Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+CeilLog2(
+  int  number)
+{
+  int num, count;
+  for (num=number, count=0; num > 1; num >>= 1, count++);
+  if ((1 << count) != number) count++;
+  return count;
+}
+
+
+  
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calBddReorderTest.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddReorderTest.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddReorderTest.c	(revision 6)
@@ -0,0 +1,253 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddReorderTest.c]
+
+  PackageName [cal]
+
+  Synopsis    [A test routine for checking the functionality of
+  dynamic reordering.] 
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Wilsin Gosti    (wilsin@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddReorderTest.c,v 1.1.1.4 1998/05/04 00:58:52 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static CalAddress_t asDoubleSpace[2];
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+#define CalBddReorderBddIsForwarded(bdd) \
+  (CAL_BDD_POINTER(CalBddGetElseBddNode(bdd)) == FORWARD_FLAG)
+
+#define CalBddReorderBddNodeIsForwarded(bddNode) \
+  (CAL_BDD_POINTER(CalBddNodeGetElseBddNode(bddNode)) == FORWARD_FLAG)
+
+#define CalBddReorderForward(bdd) \
+{ \
+  CalBddNode_t *_bddNode, *_bddNodeTagged; \
+  _bddNodeTagged = CalBddGetBddNode(bdd); \
+  _bddNode = CAL_BDD_POINTER(_bddNodeTagged); \
+  (bdd).bddId = _bddNode->thenBddId; \
+  (bdd).bddNode = (CalBddNode_t*) \
+                  (((CalAddress_t)(_bddNode->thenBddNode) & ~0xe) \
+                   ^(CAL_TAG0(_bddNodeTagged))); \
+}
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static double cpuTime();
+static long elapsedTime();
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+main(int argc, char **argv)
+{
+  Cal_Bdd expected;
+  Cal_Bdd a[100];
+  Cal_Bdd temp1;
+  Cal_Bdd temp2;
+  Cal_Bdd b, c, d, e, f, g, result;
+  Cal_BddManager_t *bddManager;
+  CalBddNode_t *bddNode;
+  int i;
+  int numVars;
+  int siftFlag = 0;
+  
+  if (argc == 1) {
+    numVars = 5;
+  } else if (argc >= 2) {
+    numVars = atoi(argv[1]);
+  }
+  if (argc == 3) {
+    siftFlag = 1;
+  }
+
+  bddManager = Cal_BddManagerInit();
+
+  for (i = 0; i < 2 * numVars; i++) {
+    a[i] = Cal_BddManagerCreateNewVarLast(bddManager);
+  }
+
+  result = Cal_BddZero(bddManager);
+  for (i = 0; i < numVars; i++) {
+    temp1 = Cal_BddAnd(bddManager, a[i], a[numVars + i]);
+    temp2 = Cal_BddOr(bddManager, result, temp1);
+    Cal_BddFree(bddManager, temp1);
+    Cal_BddFree(bddManager, result);
+    result = temp2;
+  }
+  Cal_BddManagerGC(bddManager);
+  Cal_BddStats(bddManager, stdout);
+  cpuTime();
+  elapsedTime();
+  printf("%%%%%%%%%%%% Reordering %%%%%%%%%%%%%%%%%%%\n");
+  if (siftFlag){
+    printf("Using Sift Technique\n");
+    Cal_BddDynamicReordering(bddManager, CAL_REORDER_SIFT);
+  }
+  else{
+    printf("Using Window Technique\n");
+    Cal_BddDynamicReordering(bddManager, CAL_REORDER_WINDOW);
+  }
+  Cal_BddReorder(bddManager);
+  printf("CPU time: %-8.2f\t Elapsed Time = %-10ld\n", cpuTime(), elapsedTime());
+  printf("%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%\n");
+  Cal_BddManagerGC(bddManager);
+  Cal_BddStats(bddManager, stdout);
+  /*Cal_BddFunctionPrint(bddManager, result, "Result");*/
+  temp1 = Cal_BddZero(bddManager);
+  for (i = 0; i < numVars; i++) {
+    temp2 = Cal_BddAnd(bddManager, a[i], a[numVars + i]);
+    expected = Cal_BddOr(bddManager, temp1, temp2);
+    Cal_BddFree(bddManager, temp1);
+    Cal_BddFree(bddManager, temp2);
+    temp1 = expected;
+  }
+
+  if (!Cal_BddIsEqual(bddManager, result, expected)) {
+    printf("ERROR: BDDs are not equal\n");
+    Cal_BddFunctionPrint(bddManager, result, "Result");
+    Cal_BddFunctionPrint(bddManager, expected, "Expected");
+  }
+  printf("\n%%%%%%BDDs are equal\n");
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+  Cal_BddManagerGC(bddManager);
+  Cal_BddStats(bddManager, stdout);
+  Cal_BddManagerQuit(bddManager);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static double
+cpuTime()
+{
+  static double timeNew, timeOld;
+  struct rusage rusage;
+  static flag = 0;
+
+  getrusage(RUSAGE_SELF, &rusage);
+  if (flag == 0){
+    timeOld = timeNew = rusage.ru_utime.tv_sec+
+        ((double)rusage.ru_utime.tv_usec)/1000000;
+    flag = 1;
+  }
+  else {
+    timeOld = timeNew;
+    timeNew = rusage.ru_utime.tv_sec+
+        ((float)rusage.ru_utime.tv_usec)/1000000;
+  }
+  return timeNew - timeOld;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the time.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static long
+elapsedTime()
+{
+  static long time_new, time_old;
+  struct timeval t;
+  struct timezone tz;
+  static flag = 0;
+  
+  gettimeofday(&t, &tz);
+  if (flag == 0){
+    time_old = time_new = t.tv_sec;
+    flag = 1;
+  }
+  else {
+    time_old = time_new;
+    time_new =  t.tv_sec;
+  }
+  return time_new-time_old;
+}
Index: /vis_dev/glu-2.1/src/calBdd/calBddSatisfy.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddSatisfy.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddSatisfy.c	(revision 6)
@@ -0,0 +1,373 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddSatisfy.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for BDD satisfying valuation.]
+              
+
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+              ] 
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddSatisfy.c,v 1.1.1.3 1998/05/04 00:58:53 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static Cal_Bdd_t BddSatisfyStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f);
+static Cal_Bdd_t BddSatisfySupportStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_BddId_t * support);
+static int IndexCmp(const void * p1, const void * p2);
+static double BddSatisfyingFractionStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, CalHashTable_t * hashTable);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Name        [Cal_BddSatisfy]
+
+  Synopsis    [Returns a BDD which implies f, true for
+               some valuation on which f is true, and which has at most
+               one node at each level]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddSatisfy(Cal_BddManager bddManager, Cal_Bdd  fUserBdd)
+{
+  Cal_Bdd_t f;
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    if(CalBddIsBddZero(bddManager, f)){
+      CalBddWarningMessage("Cal_BddSatisfy: argument is false");
+      return (fUserBdd);
+    }
+    f = BddSatisfyStep(bddManager, f);
+    return CalBddGetExternalBdd(bddManager, f);
+  }
+  return (Cal_Bdd) 0;
+}
+
+
+/**Function********************************************************************
+
+  Name        [Cal_BddSatisfySupport]
+
+  Synopsis    [Returns a special cube contained in f.] 
+
+  Description [The returned BDD which implies f, is true for some valuation on
+               which f is true, which has at most one node at each level,
+               and which has exactly one node corresponding to each variable
+               which is associated with something in the current variable
+               association.]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddSatisfySupport(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  Cal_BddId_t *support, *p;
+  long i;
+  Cal_Bdd_t result;
+  Cal_Bdd_t f;
+  
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    if(CalBddIsBddZero(bddManager, f)){
+      CalBddWarningMessage("Cal_BddSatisfySupport: argument is false");
+      return (fUserBdd);
+    }
+    support = Cal_MemAlloc(Cal_BddId_t, bddManager->numVars+1);
+    for(i = 1, p = support; i <= bddManager->numVars; i++){
+      if(!CalBddIsBddNull(bddManager,
+          bddManager->currentAssociation->varAssociation[i])){
+        *p = bddManager->idToIndex[i];
+        ++p;
+      }
+    }
+    *p = 0;
+    qsort(support, (unsigned)(p - support), sizeof(Cal_BddId_t), IndexCmp);
+    while(p != support){
+      --p;
+      *p = bddManager->indexToId[*p];
+    }
+    result = BddSatisfySupportStep(bddManager, f, support);
+    Cal_MemFree(support);
+    return CalBddGetExternalBdd(bddManager, result);
+  }
+  return (Cal_Bdd) 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the fraction of valuations which make f true. (Note that
+  this fraction is independent of whatever set of variables f is supposed to be
+  a function of)]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+double
+Cal_BddSatisfyingFraction(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  double fraction;
+  CalHashTable_t *hashTable;
+  Cal_Bdd_t f;
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    hashTable = CalHashTableOneInit(bddManager, sizeof(double));
+    fraction = BddSatisfyingFractionStep(bddManager, f, hashTable);
+    CalHashTableOneQuit(hashTable);
+    return fraction;
+  }
+  return 0.0;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Name        [BddSatisfyStep]
+
+  Synopsis    [Returns a BDD which implies f, is true for some valuation
+  on which f is true, and which has at most one node at each level]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddSatisfyStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f)
+{
+  Cal_Bdd_t tempBdd;
+  Cal_Bdd_t result;
+
+  if(CalBddIsBddConst(f)){
+    return (f);
+  }
+  CalBddGetThenBdd(f, tempBdd);
+  if(CalBddIsBddZero(bddManager, tempBdd)){
+    CalBddGetElseBdd(f, tempBdd);
+    tempBdd = BddSatisfyStep(bddManager, tempBdd);
+    if(!CalUniqueTableForIdFindOrAdd(bddManager,
+        bddManager->uniqueTable[CalBddGetBddId(f)],
+        CalBddZero(bddManager), tempBdd, &result)){
+      CalBddIcrRefCount(tempBdd);
+    }
+  }
+  else{
+    tempBdd = BddSatisfyStep(bddManager, tempBdd);
+    if(!CalUniqueTableForIdFindOrAdd(bddManager,
+        bddManager->uniqueTable[CalBddGetBddId(f)],
+        tempBdd, CalBddZero(bddManager), &result)){
+      CalBddIcrRefCount(tempBdd);
+    }
+  }
+  return (result);
+}
+
+
+/**Function********************************************************************
+
+  Name        [BddSatisfySupportStep]
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddSatisfySupportStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  Cal_BddId_t * support)
+{
+  Cal_Bdd_t tempBdd;
+  Cal_Bdd_t result;
+
+  if(!*support){
+    return BddSatisfyStep(bddManager, f);
+  }
+  if(CalBddGetBddIndex(bddManager, f) <= bddManager->idToIndex[*support]){
+    if(CalBddGetBddId(f) == *support){
+	++support;
+    }
+    CalBddGetThenBdd(f, tempBdd);
+    if(CalBddIsBddZero(bddManager, tempBdd)){
+      CalBddGetElseBdd(f, tempBdd);
+      tempBdd = BddSatisfySupportStep(bddManager, tempBdd, support);
+      if(!CalUniqueTableForIdFindOrAdd(bddManager,
+          bddManager->uniqueTable[CalBddGetBddId(f)],
+          CalBddZero(bddManager), tempBdd, &result)){
+        CalBddIcrRefCount(tempBdd);
+      }
+    }
+    else{
+      tempBdd = BddSatisfySupportStep(bddManager, tempBdd, support);
+      if(!CalUniqueTableForIdFindOrAdd(bddManager,
+          bddManager->uniqueTable[CalBddGetBddId(f)],
+          tempBdd, CalBddZero(bddManager), &result)){
+        CalBddIcrRefCount(tempBdd);
+      }
+    }
+  }
+  else{
+    tempBdd = BddSatisfySupportStep(bddManager, f, support+1);
+    if(!CalUniqueTableForIdFindOrAdd(bddManager,
+        bddManager->uniqueTable[*support],
+        CalBddZero(bddManager), tempBdd, &result)){
+      CalBddIcrRefCount(tempBdd);
+    }
+  }
+  return (result);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+IndexCmp(const void * p1, const void * p2)
+{
+  Cal_BddIndex_t i1, i2;
+
+  i1 = *(Cal_BddId_t *)p1;
+  i2 = *(Cal_BddId_t *)p2;
+  if(i1 < i2){
+    return (-1);
+  }
+  if(i1 > i2){
+    return (1);
+  }
+  return (0);
+}
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static double
+BddSatisfyingFractionStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  CalHashTable_t * hashTable)
+{
+  double *resultPtr, result;
+  Cal_Bdd_t thenBdd, elseBdd;
+
+  if(CalBddIsBddConst(f)){
+    if(CalBddIsBddZero(bddManager, f)){
+      return 0.0;
+    }
+    return 1.0;
+  }
+  if(CalHashTableOneLookup(hashTable, f, (char **)&resultPtr)){
+    return (*resultPtr);
+  }
+  CalBddGetThenBdd(f, thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  result = 
+      0.5 * BddSatisfyingFractionStep(bddManager, thenBdd, hashTable) +
+      0.5 * BddSatisfyingFractionStep(bddManager, elseBdd, hashTable);
+  CalHashTableOneInsert(hashTable, f, (char *)&result);
+  return (result);
+}
+
Index: /vis_dev/glu-2.1/src/calBdd/calBddSize.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddSize.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddSize.c	(revision 6)
@@ -0,0 +1,624 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddSize.c]
+
+  PackageName [cal]
+
+  Synopsis    [BDD size and profile routines]
+              
+
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.
+              ] 
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddSize.c,v 1.3 2002/09/21 20:39:24 fabio Exp $]
+
+******************************************************************************/
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef int (*CountFn_t)(Cal_Bdd_t);
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void BddMarkBdd(Cal_Bdd_t f);
+static int BddCountNoNodes(Cal_Bdd_t f);
+static int BddCountNodes(Cal_Bdd_t f);
+static long BddSizeStep(Cal_Bdd_t f, CountFn_t countFn);
+static void BddProfileStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, long * levelCounts, CountFn_t countFn);
+static void BddHighestRefStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, CalHashTable_t * h);
+static void BddDominatedStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, long * funcCounts, CalHashTable_t * h);
+
+/**AutomaticEnd***************************************************************/
+
+static
+int (*(countingFns[]))(Cal_Bdd_t) = 
+{
+  BddCountNoNodes,
+  BddCountNodes,
+};
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of nodes in f when negout is nonzero. If
+  negout is zero, we pretend that the BDDs don't have negative-output pointers.]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+long
+Cal_BddSize(Cal_BddManager bddManager, Cal_Bdd fUserBdd, int  negout)
+{
+  Cal_Bdd_t f, g;
+
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    g =  CalBddOne(bddManager);
+    CalBddPutMark(g, 0);
+    BddMarkBdd(f);
+    return BddSizeStep(f, countingFns[!negout]);
+  }
+  return (0l);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [The routine is like Cal_BddSize, but takes a null-terminated
+               array of BDDs and accounts for sharing of nodes.]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+long
+Cal_BddSizeMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray,
+                    int  negout)
+{
+  long size;
+  Cal_Bdd_t *f;
+  Cal_Bdd_t g;
+  Cal_Bdd_t *fArray;
+  int i, j;
+  
+  if (CalBddArrayPreProcessing(bddManager, fUserBddArray) == 0){
+    return -1;
+  }
+  
+  for(i = 0; fUserBddArray[i]; ++i);
+
+  fArray = Cal_MemAlloc(Cal_Bdd_t, i+1);
+  for (j=0; j < i; j++){
+    fArray[j] = CalBddGetInternalBdd(bddManager,fUserBddArray[j]);
+  }
+  fArray[j] = bddManager->bddNull;
+  
+  g  =  CalBddOne(bddManager);
+  CalBddPutMark(g, 0);
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    BddMarkBdd(*f);
+  }
+  size  =  0l;
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    size +=  BddSizeStep(*f, countingFns[!negout]);
+  }
+  Cal_MemFree(fArray);
+  return size;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a "node profile" of f, i.e., the number of nodes at each
+  level in f.]
+
+  Description [negout is as in Cal_BddSize. levelCounts should be an array of
+  size Cal_BddVars(bddManager)+1 to hold the profile.]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd,
+               long * levelCounts, int  negout)
+{
+  Cal_BddIndex_t i;
+  Cal_Bdd_t f, g;
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    for(i = 0; i <=  bddManager->numVars; i++){
+      levelCounts[i] = 0l;
+    }
+    g = CalBddOne(bddManager);
+    CalBddPutMark(g, 0);
+    BddMarkBdd(f);
+    BddProfileStep(bddManager, f, levelCounts, countingFns[!negout]);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray,
+                       long * levelCounts, int  negout)
+{
+  Cal_Bdd_t *f, *fArray;
+  Cal_Bdd_t g;
+  int i, j;
+  
+  CalBddArrayPreProcessing(bddManager, fUserBddArray);
+
+  for(i = 0; fUserBddArray[i]; ++i);
+
+  fArray = Cal_MemAlloc(Cal_Bdd_t, i+1);
+  for (j=0; j < i; j++){
+    fArray[j] = CalBddGetInternalBdd(bddManager,fUserBddArray[j]);
+  }
+  fArray[j] = bddManager->bddNull;
+    
+  for(i = 0; i <=  bddManager->numVars; i++){
+    levelCounts[i] = 0l;
+  }
+  g = CalBddOne(bddManager);
+  CalBddPutMark(g, 0);
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    BddMarkBdd(*f);
+  }
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    BddProfileStep(bddManager, *f, levelCounts, countingFns[!negout]);
+  }
+  Cal_MemFree(fArray);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a "function profile" for f.]
+
+  Description [The nth entry of the function
+  profile array is the number of subfunctions of f which may be obtained by 
+  restricting the variables whose index is less than n.  An entry of zero 
+  indicates that f is independent of the variable with the corresponding index.]
+
+  SideEffects []
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddFunctionProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd,
+                       long * funcCounts) 
+{
+  long i;
+  Cal_BddIndex_t j;
+  CalHashTable_t *h;
+  Cal_Bdd_t f;
+  
+  /* The number of subfunctions obtainable by restricting the */
+  /* variables of index < n is the number of subfunctions whose top */
+  /* variable has index n plus the number of subfunctions obtainable */
+  /* by restricting the variables of index < n+1 minus the number of */
+  /* these latter subfunctions whose highest reference is by a node at */
+  /* level n. */
+  /* The strategy will be to start with the number of subfunctions */
+  /* whose top variable has index n.  We compute the highest level at */
+  /* which each subfunction is referenced.  Then we work bottom up; at */
+  /* level n we add in the result from level n+1 and subtract the */
+  /* number of subfunctions whose highest reference is at level n. */
+
+  Cal_BddProfile(bddManager, fUserBdd, funcCounts, 0);
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    /* Encode the profile.  The low bit of a count will be zero for */
+    /* those levels where f actually has a node. */
+    for(j = 0; j < bddManager->numVars; ++j){
+      if(!funcCounts[j]){
+	funcCounts[j] = 1;
+      }
+      else{
+	funcCounts[j] <<= 1;
+      }
+    }
+    h = CalHashTableOneInit(bddManager, sizeof(int));
+    /* For each subfunction in f, compute the highest level where it is */
+    /* referenced.  f itself is conceptually referenced at the highest */
+    /* possible level, which we represent by -1. */
+    i =  -1;
+    CalHashTableOneInsert(h, f, (char *)&i);
+    BddHighestRefStep(bddManager, f, h);
+    /* Walk through these results.  For each subfunction, decrement the */
+    /* count at the highest level where it is referenced. */
+    BddDominatedStep(bddManager, f, funcCounts, h);
+    CalHashTableOneQuit(h);
+    /* Now add each level n+1 result to that of level n. */
+    for(i = bddManager->numVars-1, j = i+1; i>=  0; --i){
+      if(funcCounts[i] !=  1){
+	funcCounts[i] = (funcCounts[i] >> 1) + funcCounts[j];
+	j = i;
+      }
+      else{
+	  funcCounts[i] = 0;
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a "function profile" for fArray.]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddFunctionProfileMultiple(Cal_BddManager bddManager, Cal_Bdd
+                               *fUserBddArray, long * funcCounts)
+{
+  long i;
+  Cal_BddIndex_t j;
+  Cal_Bdd_t *f, *fArray;
+  CalHashTable_t *h;
+
+  CalBddArrayPreProcessing(bddManager, fUserBddArray);
+
+  for(i = 0; fUserBddArray[i]; ++i);
+
+  fArray = Cal_MemAlloc(Cal_Bdd_t, i+1);
+  for (j=0; j < i; j++){
+    fArray[j] = CalBddGetInternalBdd(bddManager,fUserBddArray[j]);
+  }
+  fArray[j] = bddManager->bddNull;
+
+  /* See cmu_bdd_function_profile for the strategy involved here. */
+  Cal_BddProfileMultiple(bddManager, fUserBddArray, funcCounts, 0);
+  for(j = 0; j < bddManager->numVars; ++j){
+    if(!funcCounts[j]){
+      funcCounts[j] = 1;
+    }
+    else{
+      funcCounts[j] <<= 1;
+    }
+  }
+  h = CalHashTableOneInit(bddManager, sizeof(int));
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    BddHighestRefStep(bddManager, *f, h);
+  }
+  i = -1;
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    CalHashTableOneInsert(h, *f, (char *)&i);
+  }
+  for(f = fArray; !CalBddIsBddNull(bddManager, *f); ++f){
+    BddDominatedStep(bddManager, *f, funcCounts, h);
+  }
+  CalHashTableOneQuit(h);
+  for(i = bddManager->numVars-1, j = i+1; i >=  0; --i){
+    if(funcCounts[i] !=  1){
+      funcCounts[i] = (funcCounts[i] >> 1) + funcCounts[j];
+      j = i;
+    }
+    else{
+      funcCounts[i] = 0;
+    }
+  }
+  Cal_MemFree(fArray);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddMarkBdd(Cal_Bdd_t  f)
+{
+  int currMarking, thisMarking;
+  Cal_Bdd_t thenBdd, elseBdd;
+
+  currMarking = CalBddGetMark(f);
+  thisMarking = (1 << CalBddIsComplement(f));
+  if(currMarking & thisMarking){
+    return;
+  }
+  CalBddPutMark(f, currMarking | thisMarking);
+  if(CalBddIsBddConst(f)){
+    return;
+  }
+  CalBddGetThenBdd(f, thenBdd);
+  BddMarkBdd(thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  BddMarkBdd(elseBdd);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+BddCountNoNodes(
+  Cal_Bdd_t  f)
+{
+  return (CalBddGetMark(f) > 0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+BddCountNodes(
+  Cal_Bdd_t  f)
+{
+  int mark;
+
+  mark = CalBddGetMark(f);
+  return (((mark & 0x1) !=  0) + ((mark & 0x2) !=  0));
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static long
+BddSizeStep(
+  Cal_Bdd_t  f,
+  CountFn_t countFn)
+{
+  long result;
+  Cal_Bdd_t thenBdd, elseBdd;
+
+  if(!CalBddGetMark(f)){
+    return (0l);
+  }
+  result = (*countFn)(f);
+  if(!CalBddIsBddConst(f)){
+    CalBddGetThenBdd(f, thenBdd);
+    CalBddGetElseBdd(f, elseBdd);
+    result +=
+        BddSizeStep(thenBdd, countFn) +
+        BddSizeStep(elseBdd, countFn);
+  }
+  CalBddPutMark(f, 0);
+  return result;
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddProfileStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  long * levelCounts,
+  CountFn_t countFn)
+{
+  Cal_Bdd_t thenBdd, elseBdd;
+  if(!CalBddGetMark(f)){
+    return;
+  }
+  if(CalBddIsBddConst(f)){
+    levelCounts[bddManager->numVars] += (*countFn)(f);
+  }
+  else{
+    levelCounts[CalBddGetBddIndex(bddManager, f)] += (*countFn)(f);
+    CalBddGetThenBdd(f, thenBdd);
+    BddProfileStep(bddManager, thenBdd, levelCounts, countFn);
+    CalBddGetElseBdd(f, elseBdd);
+    BddProfileStep(bddManager, elseBdd, levelCounts, countFn);
+  }
+  CalBddPutMark(f, 0);
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddHighestRefStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  CalHashTable_t * h)
+{
+  int fIndex;
+  Cal_Bdd_t keyBdd;
+  int *dataPtr;
+
+  if(CalBddIsBddConst(f)){
+    return;
+  }
+  fIndex = CalBddGetBddIndex(bddManager, f);
+  CalBddGetThenBdd(f, keyBdd);
+  if(CalHashTableOneLookup(h, keyBdd, (char **)&dataPtr)){
+    if(*dataPtr > fIndex){
+      *dataPtr = fIndex;
+    }
+  }
+  else{
+    CalHashTableOneInsert(h, keyBdd, (char *)&fIndex);
+    BddHighestRefStep(bddManager, keyBdd, h);
+  }
+  CalBddGetElseBdd(f, keyBdd);
+  if(CalHashTableOneLookup(h, keyBdd, (char **)&dataPtr)){
+    if(*dataPtr > fIndex){
+      *dataPtr = fIndex;
+    }
+  }
+  else{
+    CalHashTableOneInsert(h, keyBdd, (char *)&fIndex);
+    BddHighestRefStep(bddManager, keyBdd, h);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddDominatedStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  long * funcCounts,
+  CalHashTable_t * h)
+{
+  Cal_Bdd_t thenBdd, elseBdd;
+  int *dataPtr;
+
+  CalHashTableOneLookup(h, f, (char **)&dataPtr);
+  if(*dataPtr >=  0)
+    funcCounts[*dataPtr] -= 2;
+  if(*dataPtr > -2){
+    *dataPtr = -2;
+    if(!CalBddIsBddConst(f)){
+      CalBddGetThenBdd(f, thenBdd);
+      BddDominatedStep(bddManager, thenBdd, funcCounts, h);
+      CalBddGetElseBdd(f, elseBdd);
+      BddDominatedStep(bddManager, elseBdd, funcCounts, h);
+    }
+  }
+}
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calBddSubstitute.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddSubstitute.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddSubstitute.c	(revision 6)
@@ -0,0 +1,407 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddSubstitute.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routine for simultaneous substitution of an array of
+  variables with an array of functions.]
+
+  Description [Routine for simultaneous substitution of an array of
+  variables with an array of functions.]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddSubstitute.c,v 1.1.1.4 1998/05/04 00:58:54 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CalHashTableSubstituteApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, int lastIndex, CalHashTable_t ** reqQueForSubstitute);
+static void CalHashTableSubstituteReduce(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t ** reqQueForITE, CalHashTable_t * uniqueTableForId);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Substitute a set of variables by functions]
+
+  Description [Returns a BDD for f using the substitution defined by current
+  variable association. Each variable is replaced by its associated BDDs. The 
+  substitution is effective simultaneously]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddCompose]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddSubstitute(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  CalRequest_t result;
+  int bddId, bddIndex, lastIndex;
+  CalHashTable_t *hashTable;
+  CalHashTable_t *uniqueTableForId;
+  CalHashTable_t **reqQueForSubstitute = bddManager->reqQue[0];
+  CalHashTable_t **reqQueForITE = bddManager->reqQue[1]; 
+  Cal_Bdd_t f;
+  
+  if (CalBddPreProcessing(bddManager, 1, fUserBdd) == 0){
+    return (Cal_Bdd) 0;
+  }
+  f = CalBddGetInternalBdd(bddManager, fUserBdd);  
+  if(CalBddIsBddConst(f)){
+    return CalBddGetExternalBdd(bddManager, f);
+  }
+
+  CalHashTableFindOrAdd(reqQueForSubstitute[CalBddGetBddId(f)], f, 
+    bddManager->bddNull, &result);
+
+  /* ReqQueApply */
+  lastIndex = bddManager->currentAssociation->lastBddIndex;
+  for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = reqQueForSubstitute[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSubstituteApply(bddManager, hashTable, lastIndex, 
+                                  reqQueForSubstitute);
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= 0; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = reqQueForSubstitute[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSubstituteReduce(bddManager, hashTable,
+                                   reqQueForITE, uniqueTableForId);
+    }
+  }
+
+  CalRequestIsForwardedTo(result);
+
+  /* ReqQueCleanUp */
+  for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+    CalHashTableCleanUp(reqQueForSubstitute[bddId]);
+  }
+
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSubstituteApply(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  int  lastIndex,
+  CalHashTable_t ** reqQueForSubstitute)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_BddId_t bddId;
+  /*Cal_BddIndex_t bddIndex;*/
+  int bddIndex;
+  Cal_Bdd_t f, calBdd;
+  Cal_Bdd_t nullBdd = bddManager->bddNull;
+
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      /* Process the requestNode */
+      CalRequestNodeGetF(requestNode, f);
+      /* Process Left Cofactor */
+      CalBddGetThenBdd(f, calBdd);
+      bddId = CalBddGetBddId(calBdd);
+      bddIndex = bddManager->idToIndex[bddId];
+      if(bddIndex <= lastIndex){
+        CalHashTableFindOrAdd(reqQueForSubstitute[bddId], calBdd, nullBdd, 
+            &calBdd);
+      }
+      CalBddIcrRefCount(calBdd);
+      CalRequestNodePutThenRequest(requestNode, calBdd);
+      /* Process Right Cofactor */
+      CalBddGetElseBdd(f, calBdd);
+      bddId = CalBddGetBddId(calBdd);
+      bddIndex = bddManager->idToIndex[bddId];
+      if(bddIndex <= lastIndex){
+        CalHashTableFindOrAdd(reqQueForSubstitute[bddId], calBdd, nullBdd, 
+            &calBdd);
+      }
+      CalBddIcrRefCount(calBdd);
+      CalRequestNodePutElseRequest(requestNode, calBdd);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSubstituteReduce(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  CalHashTable_t ** reqQueForITE,
+  CalHashTable_t * uniqueTableForId)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  Cal_BddId_t varBddId = hashTable->bddId;
+  CalNodeManager_t *nodeManager = hashTable->nodeManager;
+  /*CalRequestNode_t *requestNodeList = hashTable->requestNodeList;*/
+  CalRequestNode_t *endNode = hashTable->endNode;
+  CalRequestNode_t *requestNodeListForITE = Cal_Nil(CalRequestNode_t);
+  CalRequestNode_t *requestNode, *next;
+  CalBddNode_t *bddNode;
+  Cal_Bdd_t varBdd;
+  Cal_Bdd_t thenBdd, elseBdd, result;
+  Cal_Bdd_t h;
+  Cal_BddIndex_t varBddIndex;
+  Cal_BddRefCount_t refCount;
+  int bddId, bddIndex;
+  CalHashTable_t *hashTableForITE;
+
+  varBddIndex = bddManager->idToIndex[varBddId];
+  varBdd = bddManager->varBdds[varBddId];
+  h = bddManager->currentAssociation->varAssociation[varBddId];
+  if(!CalBddIsBddNull(bddManager, h)){
+    for(i = 0; i < numBins; i++){
+      for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+          requestNode != Cal_Nil(CalRequestNode_t);
+          requestNode = next){
+        next = CalRequestNodeGetNextRequestNode(requestNode);
+        /* Process the requestNode */
+        CalRequestNodeGetThenRequest(requestNode, thenBdd);
+        CalRequestNodeGetElseRequest(requestNode, elseBdd);
+        CalRequestIsForwardedTo(thenBdd);
+        CalRequestIsForwardedTo(elseBdd);
+        if(CalBddIsEqual(thenBdd, elseBdd)){
+          CalBddNodeGetRefCount(requestNode, refCount);
+          CalBddAddRefCount(thenBdd, refCount - 2);
+          CalRequestNodePutThenRequest(requestNode, thenBdd);
+          CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+          endNode->nextBddNode = requestNode;
+          endNode = requestNode;
+        }
+        else{
+          CalBddDcrRefCount(thenBdd);
+          CalBddDcrRefCount(elseBdd);
+          result = CalOpITE(bddManager, h, thenBdd, elseBdd, reqQueForITE);
+          CalRequestNodePutThenRequest(requestNode, result);
+          CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+          CalRequestNodePutNextRequestNode(requestNode,
+              requestNodeListForITE);
+          requestNodeListForITE = requestNode;
+        }
+      }
+    }
+  }
+  else{
+    for(i = 0; i < numBins; i++){
+      for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+          requestNode != Cal_Nil(CalRequestNode_t);
+          requestNode = next){
+        next = CalRequestNodeGetNextRequestNode(requestNode);
+        /* Process the requestNode */
+        CalRequestNodeGetThenRequest(requestNode, thenBdd);
+        CalRequestNodeGetElseRequest(requestNode, elseBdd);
+        CalRequestIsForwardedTo(thenBdd);
+        CalRequestIsForwardedTo(elseBdd);
+        if(CalBddIsEqual(thenBdd, elseBdd)){
+          CalBddNodeGetRefCount(requestNode, refCount);
+          CalBddAddRefCount(thenBdd, refCount - 2);
+          CalRequestNodePutThenRequest(requestNode, thenBdd);
+          CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+          endNode->nextBddNode = requestNode;
+          endNode = requestNode;
+        }
+        else if(varBddIndex < CalBddGetBddIndex(bddManager, thenBdd) &&
+            varBddIndex < CalBddGetBddIndex(bddManager, elseBdd)){
+          if(CalUniqueTableForIdLookup(bddManager, uniqueTableForId,
+              thenBdd, elseBdd, &result) == 1){
+            CalBddDcrRefCount(thenBdd);
+            CalBddDcrRefCount(elseBdd);
+            CalBddNodeGetRefCount(requestNode, refCount);
+            CalBddAddRefCount(result, refCount);
+            CalRequestNodePutThenRequest(requestNode, result);
+            CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+            endNode->nextBddNode = requestNode;
+            endNode = requestNode;
+          }
+          else if(CalBddIsOutPos(thenBdd)){
+            CalRequestNodePutThenRequest(requestNode, thenBdd);
+            CalRequestNodePutElseRequest(requestNode, elseBdd);
+            CalHashTableAddDirect(uniqueTableForId, requestNode);
+            bddManager->numNodes++;
+            bddManager->gcCheck--;
+          }
+          else{
+            CalNodeManagerAllocNode(nodeManager, bddNode);
+            CalBddNodePutThenBddId(bddNode, CalBddGetBddId(thenBdd));
+            CalBddNodePutThenBddNode(bddNode,
+                CalBddGetBddNodeNot(thenBdd));
+            CalBddNodePutElseBddId(bddNode, CalBddGetBddId(elseBdd));
+            CalBddNodePutElseBddNode(bddNode,
+                CalBddGetBddNodeNot(elseBdd));
+            CalBddNodeGetRefCount(requestNode, refCount);
+            CalBddNodePutRefCount(bddNode, refCount);
+            CalHashTableAddDirect(uniqueTableForId, bddNode);
+            bddManager->numNodes++;
+            bddManager->gcCheck--;
+            CalRequestNodePutThenRequestId(requestNode, varBddId);
+            CalRequestNodePutThenRequestNode(requestNode,
+                CalBddNodeNot(bddNode));
+            CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+            endNode->nextBddNode = requestNode;
+            endNode = requestNode;
+          }
+        }
+        else{
+          CalBddDcrRefCount(thenBdd);
+          CalBddDcrRefCount(elseBdd);
+          result = CalOpITE(bddManager, varBdd, thenBdd, elseBdd, reqQueForITE);
+          CalRequestNodePutThenRequest(requestNode, result);
+          CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+          CalRequestNodePutNextRequestNode(requestNode,
+              requestNodeListForITE);
+          requestNodeListForITE = requestNode;
+        }
+      }
+    }
+  }
+
+  /* ITE Apply */
+  for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTableForITE = reqQueForITE[bddId];
+    if(hashTableForITE->numEntries){
+      CalHashTableITEApply(bddManager, hashTableForITE, reqQueForITE);
+    }
+  }
+  /* ITE Reduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= 0; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTableForITE = reqQueForITE[bddId];
+    if(hashTableForITE->numEntries){
+      CalHashTableReduce(bddManager, hashTableForITE,
+          bddManager->uniqueTable[bddId]);
+    }
+  }
+    
+
+  /*last = Cal_Nil(CalRequestNode_t);*/
+  for(requestNode = requestNodeListForITE; 
+      requestNode != Cal_Nil(CalRequestNode_t);
+      /*last = requestNode, */
+      requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+    CalRequestNodeGetThenRequest(requestNode, result);
+    CalBddNodeGetRefCount(requestNode, refCount);
+    CalRequestIsForwardedTo(result);
+    CalBddAddRefCount(result, refCount);
+    CalRequestNodePutThenRequest(requestNode, result);
+  }
+
+  /*CalBddNodePutNextBddNode(endNode, requestNodeListForITE);*/
+  endNode->nextBddNode = requestNodeListForITE;
+  hashTable->endNode = endNode;
+  
+  /* ITE Cleanup */
+  for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+    CalHashTableCleanUp(reqQueForITE[bddId]);
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calBddSupport.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddSupport.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddSupport.c	(revision 6)
@@ -0,0 +1,279 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddSupport.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines related to the support of a BDD.]
+              
+
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.
+              ] 
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddSupport.c,v 1.1.1.3 1998/05/04 00:58:54 hsv Exp $]
+
+******************************************************************************/
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static Cal_Bdd_t * CalBddSupportStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t * support);
+static void CalBddUnmarkNodes(Cal_BddManager_t * bddManager, Cal_Bdd_t f);
+static int CalBddDependsOnStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_BddIndex_t varIndex, int mark);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Name        [Cal_BddSupport]
+
+  Synopsis    [returns the support of f as a null-terminated array of variables]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddSupport(Cal_BddManager bddManager, Cal_Bdd fUserBdd,
+               Cal_Bdd *support)
+{
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    Cal_Bdd_t *internalSupport = Cal_MemAlloc(Cal_Bdd_t, bddManager->numVars+1);
+    Cal_Bdd_t *end;
+    int i = 0;
+    end = CalBddSupportStep(bddManager, f, internalSupport);
+    *end = CalBddNull(bddManager);
+    CalBddUnmarkNodes(bddManager, f);
+    while (CalBddIsBddNull(bddManager, internalSupport[i]) == 0){
+      *support = CalBddGetExternalBdd(bddManager, internalSupport[i]);
+      support++;
+      i++;
+    }
+    Cal_MemFree(internalSupport);
+  }
+  *support = (Cal_Bdd) 0;
+}
+
+/**Function********************************************************************
+
+  Name        [Cal_BddDependsOn]
+
+  Synopsis    [Returns 1 if f depends on var and returns 0 otherwise.]
+
+  Description [Returns 1 if f depends on var and returns 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+int
+Cal_BddDependsOn(Cal_BddManager bddManager, Cal_Bdd  fUserBdd,
+                 Cal_Bdd varUserBdd)
+{
+  Cal_BddIndex_t bddIndex;
+  Cal_Bdd_t f, var;
+  
+  if(CalBddPreProcessing(bddManager, 2, fUserBdd, varUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    var = CalBddGetInternalBdd(bddManager, varUserBdd);
+    if(CalBddIsBddConst(var)){
+      return 1;
+    }
+    bddIndex = CalBddGetBddIndex(bddManager, var);
+    CalBddDependsOnStep(bddManager, f, bddIndex, 1);
+    return CalBddDependsOnStep(bddManager, f, bddIndex, 0);
+  }
+  return (0);
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Name        [CalBddSupportStep]
+
+  Synopsis    [returns the support of f as a null-terminated array of variables]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t *
+CalBddSupportStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  Cal_Bdd_t * support)
+{
+  Cal_Bdd_t tempBdd;
+
+  if(CalBddIsMarked(f) || CalBddIsBddConst(f)){
+    return support;
+  }
+  tempBdd = bddManager->varBdds[CalBddGetBddId(f)];
+  if(!CalBddIsMarked(tempBdd)){
+    CalBddMark(tempBdd);
+    *support = tempBdd;
+    ++support;
+  }
+  CalBddMark(f);
+  CalBddGetThenBdd(f, tempBdd);
+  support = CalBddSupportStep(bddManager, tempBdd, support);
+  CalBddGetElseBdd(f, tempBdd);
+  return CalBddSupportStep(bddManager, tempBdd, support);
+}
+
+
+/**Function********************************************************************
+
+  Name        [CalBddUnmarkNodes]
+
+  Synopsis    [recursively unmarks the nodes]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalBddUnmarkNodes(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f)
+{
+  Cal_Bdd_t tempBdd;
+
+  if(!CalBddIsMarked(f) || CalBddIsBddConst(f)){
+    return;
+  }
+  CalBddUnmark(f);
+  tempBdd = bddManager->varBdds[CalBddGetBddId(f)];
+  CalBddUnmark(tempBdd);
+  CalBddGetThenBdd(f, tempBdd);
+  CalBddUnmarkNodes(bddManager, tempBdd);
+  CalBddGetElseBdd(f, tempBdd);
+  CalBddUnmarkNodes(bddManager, tempBdd);
+}
+
+
+/**Function********************************************************************
+
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+CalBddDependsOnStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  Cal_BddIndex_t  varIndex,
+  int  mark)
+{
+  Cal_BddIndex_t fIndex;
+  Cal_Bdd_t tempBdd;
+
+  fIndex=CalBddGetBddIndex(bddManager, f);
+  if(fIndex > varIndex){
+    return 0;
+  }
+  if(fIndex == varIndex){
+    return 1;
+  }
+  if((mark && CalBddIsMarked(f)) || (!mark && !CalBddIsMarked(f))){
+    return (0);
+  }
+  if(mark){
+    CalBddMark(f);
+  }
+  else{
+    CalBddUnmark(f);
+  }
+  CalBddGetThenBdd(f, tempBdd);
+  if(CalBddDependsOnStep(bddManager, tempBdd, varIndex, mark)){
+    return 1;
+  }
+  CalBddGetElseBdd(f, tempBdd);
+  return CalBddDependsOnStep(bddManager, tempBdd, varIndex, mark);
+}
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calBddSwapVars.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddSwapVars.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddSwapVars.c	(revision 6)
@@ -0,0 +1,581 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddSwapVars.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routine for swapping two variables.]
+
+  Description [Routine for swapping two variables.]
+
+  SeeAlso     [None]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddSwapVars.c,v 1.1.1.3 1998/05/04 00:58:55 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CalHashTableSwapVarsApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, Cal_BddIndex_t gIndex, Cal_BddIndex_t hIndex, CalHashTable_t ** reqQueForSwapVars, CalHashTable_t ** reqQueForSwapVarsPlus, CalHashTable_t ** reqQueForSwapVarsMinus, CalHashTable_t ** reqQueForCompose, CalHashTable_t ** reqQueForITE);
+static void CalHashTableSwapVarsPlusApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, Cal_BddIndex_t hIndex, CalHashTable_t ** reqQueForSwapVars, CalHashTable_t ** reqQueForSwapVarsPlus, CalHashTable_t ** reqQueForSwapVarsMinus, CalHashTable_t ** reqQueForCompose);
+static void CalHashTableSwapVarsMinusApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, Cal_BddIndex_t hIndex, CalHashTable_t ** reqQueForSwapVars, CalHashTable_t ** reqQueForSwapVarsPlus, CalHashTable_t ** reqQueForSwapVarsMinus, CalHashTable_t ** reqQueForCompose);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Return a function obtained by swapping two variables]
+
+  Description [Returns the BDD obtained by simultaneously substituting variable
+  g by variable h and variable h and variable g in the BDD f]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddSubstitute]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddSwapVars(Cal_BddManager  bddManager, Cal_Bdd  fUserBdd,
+                Cal_Bdd gUserBdd,
+                Cal_Bdd hUserBdd)
+{
+  Cal_Bdd_t f,g,h,tmpBdd;
+  Cal_BddIndex_t gIndex, hIndex;
+  CalRequest_t result;
+  int bddId, bddIndex;
+  CalHashTable_t *hashTable;
+  CalHashTable_t *uniqueTableForId;
+  CalHashTable_t **reqQueForSwapVars = bddManager->reqQue[0];
+  CalHashTable_t **reqQueForSwapVarsPlus = bddManager->reqQue[1];
+  CalHashTable_t **reqQueForSwapVarsMinus = bddManager->reqQue[2];
+  CalHashTable_t **reqQueForCompose = bddManager->reqQue[3];
+  CalHashTable_t **reqQueForITE = bddManager->reqQue[4]; 
+  
+  if (CalBddPreProcessing(bddManager, 3, fUserBdd, gUserBdd, hUserBdd) == 0){
+	return (Cal_Bdd) 0;
+  }
+  f = CalBddGetInternalBdd(bddManager, fUserBdd);
+  g = CalBddGetInternalBdd(bddManager, gUserBdd);
+  h = CalBddGetInternalBdd(bddManager, hUserBdd);
+
+  if(CalBddIsBddConst(g) || CalBddIsBddConst(h)){
+    CalBddWarningMessage("Unacceptable arguments for Cal_BddSwapVars");
+    return (Cal_Bdd) 0;
+  }
+  if(CalBddIsEqual(g, h)){
+    /*
+    CalBddIcrRefCount(f);
+    */
+    return CalBddGetExternalBdd(bddManager, f);
+  }
+  if(CalBddGetBddIndex(bddManager, g) > CalBddGetBddIndex(bddManager, h)){
+    tmpBdd = g;
+    g = h;
+    h = tmpBdd;
+  }
+
+  gIndex = CalBddGetBddIndex(bddManager, g);
+  hIndex = CalBddGetBddIndex(bddManager, h);
+
+  CalBddGetMinId2(bddManager, f, g, bddId);
+  CalHashTableFindOrAdd(reqQueForSwapVars[bddId], f, 
+      bddManager->bddNull, &result);
+
+  /* ReqQueApply */
+  for(bddIndex = 0; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = reqQueForSwapVars[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSwapVarsApply(bddManager, hashTable, gIndex, hIndex,
+          reqQueForSwapVars, reqQueForSwapVarsPlus, reqQueForSwapVarsMinus,
+          reqQueForCompose, reqQueForITE);
+    }
+    hashTable = reqQueForSwapVarsPlus[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSwapVarsPlusApply(bddManager, hashTable, hIndex,
+          reqQueForSwapVars, reqQueForSwapVarsPlus, reqQueForSwapVarsMinus,
+          reqQueForCompose);
+    }
+    hashTable = reqQueForSwapVarsMinus[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSwapVarsMinusApply(bddManager, hashTable, hIndex,
+          reqQueForSwapVars, reqQueForSwapVarsPlus, reqQueForSwapVarsMinus,
+          reqQueForCompose);
+    }
+    hashTable = reqQueForCompose[bddId];
+    if(hashTable->numEntries){
+      CalHashTableComposeApply(bddManager, hashTable, hIndex,
+          reqQueForCompose, reqQueForITE);
+    }
+    hashTable = reqQueForITE[bddId];
+    if(hashTable->numEntries){
+      CalHashTableITEApply(bddManager, hashTable, reqQueForITE);
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= 0; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = reqQueForSwapVars[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+    hashTable = reqQueForSwapVarsPlus[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+    hashTable = reqQueForSwapVarsMinus[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+    hashTable = reqQueForCompose[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+    hashTable = reqQueForITE[bddId];
+    if(hashTable->numEntries){
+      CalHashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+
+  CalRequestIsForwardedTo(result);
+
+  /* ReqQueCleanUp */
+  for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+    CalHashTableCleanUp(reqQueForSwapVars[bddId]);
+    CalHashTableCleanUp(reqQueForSwapVarsPlus[bddId]);
+    CalHashTableCleanUp(reqQueForSwapVarsMinus[bddId]);
+    CalHashTableCleanUp(reqQueForCompose[bddId]);
+    CalHashTableCleanUp(reqQueForITE[bddId]);
+  }
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSwapVarsApply(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  Cal_BddIndex_t  gIndex,
+  Cal_BddIndex_t  hIndex,
+  CalHashTable_t ** reqQueForSwapVars,
+  CalHashTable_t ** reqQueForSwapVarsPlus,
+  CalHashTable_t ** reqQueForSwapVarsMinus,
+  CalHashTable_t ** reqQueForCompose,
+  CalHashTable_t ** reqQueForITE)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_BddId_t bddId;
+  Cal_BddIndex_t fIndex, bddIndex;
+  Cal_Bdd_t f, calBdd;
+  Cal_Bdd_t thenBdd, elseBdd;
+  Cal_Bdd_t nullBdd = bddManager->bddNull;
+  Cal_Bdd_t result;
+
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetF(requestNode, f);
+      fIndex = CalBddGetBddIndex(bddManager, f);
+      if(fIndex < gIndex){
+        /* left cofactor */
+        CalBddGetThenBdd(f, calBdd);
+        bddId = CalBddGetBddId(calBdd);
+        bddIndex = bddManager->idToIndex[bddId];
+        if(bddIndex <= hIndex){
+          if(bddIndex > gIndex){
+            bddId = bddManager->indexToId[gIndex];
+          }
+          CalHashTableFindOrAdd(reqQueForSwapVars[bddId],
+              calBdd, nullBdd, &calBdd);
+        }
+        CalBddIcrRefCount(calBdd);
+        CalRequestNodePutThenRequest(requestNode, calBdd);
+        /* right cofactor */
+        CalBddGetElseBdd(f, calBdd);
+        bddId = CalBddGetBddId(calBdd);
+        bddIndex = bddManager->idToIndex[bddId];
+        if(bddIndex <= hIndex){
+          if(bddIndex > gIndex){
+            bddId = bddManager->indexToId[gIndex];
+          }
+          CalHashTableFindOrAdd(reqQueForSwapVars[bddId],
+              calBdd, nullBdd, &calBdd);
+        }
+        CalBddIcrRefCount(calBdd);
+        CalRequestNodePutElseRequest(requestNode, calBdd);
+      }
+      else if(fIndex == gIndex){
+        /* SwapVarsPlus */
+        CalBddGetThenBdd(f, thenBdd);
+        CalBddGetElseBdd(f, elseBdd);
+        if(CalBddGetBddIndex(bddManager, thenBdd) == hIndex){
+          CalBddGetThenBdd(thenBdd, thenBdd);
+        }
+        if(CalBddGetBddIndex(bddManager, elseBdd) == hIndex){
+          CalBddGetThenBdd(elseBdd, elseBdd);
+        }
+        if(CalBddIsEqual(thenBdd, elseBdd)){
+          if(hIndex > CalBddGetBddIndex(bddManager, thenBdd)){
+            CalHashTableFindOrAdd(reqQueForCompose[CalBddGetBddId(thenBdd)], 
+                thenBdd, CalBddOne(bddManager), &result);
+          }
+          else{
+            result = thenBdd;
+          }
+        }
+        else if(hIndex < CalBddGetBddIndex(bddManager, thenBdd) &&
+            hIndex < CalBddGetBddIndex(bddManager, elseBdd)){
+          bddId = bddManager->indexToId[hIndex];
+          if(!CalUniqueTableForIdFindOrAdd(bddManager, 
+              bddManager->uniqueTable[bddId], thenBdd, elseBdd, &result)){
+            CalBddIcrRefCount(thenBdd);
+            CalBddIcrRefCount(elseBdd);
+          }
+        }
+        else{
+          CalBddGetMinId2(bddManager, thenBdd, elseBdd, bddId);
+          CalHashTableFindOrAdd(reqQueForSwapVarsPlus[bddId],
+              thenBdd, elseBdd, &result);
+        }
+        CalBddIcrRefCount(result);
+        CalRequestNodePutThenRequest(requestNode, result);
+        /* SwapVarsMinus */
+        CalBddGetThenBdd(f, thenBdd);
+        CalBddGetElseBdd(f, elseBdd);
+        if(CalBddGetBddIndex(bddManager, thenBdd) == hIndex){
+          CalBddGetElseBdd(thenBdd, thenBdd);
+        }
+        if(CalBddGetBddIndex(bddManager, elseBdd) == hIndex){
+          CalBddGetElseBdd(elseBdd, elseBdd);
+        }
+        if(CalBddIsEqual(thenBdd, elseBdd)){
+          if(hIndex > CalBddGetBddIndex(bddManager, thenBdd)){
+            CalHashTableFindOrAdd(reqQueForCompose[CalBddGetBddId(thenBdd)], 
+                thenBdd, CalBddZero(bddManager), &result);
+          }
+          else{
+            result = thenBdd;
+          }
+        }
+        else if(hIndex < CalBddGetBddIndex(bddManager, thenBdd) &&
+            hIndex < CalBddGetBddIndex(bddManager, elseBdd)){
+          bddId = bddManager->indexToId[hIndex];
+          if(!CalUniqueTableForIdFindOrAdd(bddManager, 
+              bddManager->uniqueTable[bddId], thenBdd, elseBdd, &result)){
+            CalBddIcrRefCount(thenBdd);
+            CalBddIcrRefCount(elseBdd);
+          }
+        }
+        else{
+          CalBddGetMinId2(bddManager, thenBdd, elseBdd, bddId);
+          CalHashTableFindOrAdd(reqQueForSwapVarsMinus[bddId],
+              thenBdd, elseBdd, &result);
+        }
+        CalBddIcrRefCount(result);
+        CalRequestNodePutElseRequest(requestNode, result);
+      }
+      else{ /* fIndex > gIndex */
+        CalComposeRequestCreate(bddManager,
+            f, CalBddOne(bddManager), hIndex,
+            reqQueForCompose, reqQueForITE, &result);
+        CalBddIcrRefCount(result);
+        CalRequestNodePutThenRequest(requestNode, result);
+        CalComposeRequestCreate(bddManager,
+            f, CalBddZero(bddManager), hIndex,
+            reqQueForCompose, reqQueForITE, &result);
+        CalBddIcrRefCount(result);
+        CalRequestNodePutElseRequest(requestNode, result);
+      }
+    }
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSwapVarsPlusApply(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  Cal_BddIndex_t  hIndex,
+  CalHashTable_t ** reqQueForSwapVars,
+  CalHashTable_t ** reqQueForSwapVarsPlus,
+  CalHashTable_t ** reqQueForSwapVarsMinus,
+  CalHashTable_t ** reqQueForCompose)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_BddId_t bddId;
+  Cal_Bdd_t f1, f2, g1, g2;
+  Cal_Bdd_t result;
+
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetCofactors(bddManager, requestNode, f1, f2, g1, g2);
+      /* left cofactor */ 
+      if(CalBddGetBddIndex(bddManager, f1) == hIndex){
+        CalBddGetThenBdd(f1, f1);
+      }
+      if(CalBddGetBddIndex(bddManager, g1) == hIndex){
+        CalBddGetThenBdd(g1, g1);
+      }
+      if(CalBddIsEqual(f1, g1)){
+        if(hIndex > CalBddGetBddIndex(bddManager, f1)){
+          CalHashTableFindOrAdd(reqQueForCompose[CalBddGetBddId(f1)], 
+              f1, CalBddOne(bddManager), &result);
+        }
+        else{
+          result = f1;
+        }
+      }
+      else if(hIndex < CalBddGetBddIndex(bddManager, f1) &&
+          hIndex < CalBddGetBddIndex(bddManager, g1)){
+        bddId = bddManager->indexToId[hIndex];
+        if(!CalUniqueTableForIdFindOrAdd(bddManager, 
+            bddManager->uniqueTable[bddId], f1, g1, &result)){
+          CalBddIcrRefCount(f1);
+          CalBddIcrRefCount(g1);
+        }
+      }
+      else{
+        CalBddGetMinId2(bddManager, f1, g1, bddId);
+        CalHashTableFindOrAdd(reqQueForSwapVarsPlus[bddId], f1, g1, &result);
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+      /* right cofactor */
+      if(CalBddGetBddIndex(bddManager, f2) == hIndex){
+        CalBddGetThenBdd(f2, f2);
+      }
+      if(CalBddGetBddIndex(bddManager, g2) == hIndex){
+        CalBddGetThenBdd(g2, g2);
+      }
+      if(CalBddIsEqual(f2, g2)){
+        if(hIndex > CalBddGetBddIndex(bddManager, f2)){
+          CalHashTableFindOrAdd(reqQueForCompose[CalBddGetBddId(f2)], 
+              f2, CalBddOne(bddManager), &result);
+        }
+        else{
+          result = f2;
+        }
+      }
+      else if(hIndex < CalBddGetBddIndex(bddManager, f2) &&
+          hIndex < CalBddGetBddIndex(bddManager, g2)){
+        bddId = bddManager->indexToId[hIndex];
+        if(!CalUniqueTableForIdFindOrAdd(bddManager, 
+            bddManager->uniqueTable[bddId], f2, g2, &result)){
+          CalBddIcrRefCount(f2);
+          CalBddIcrRefCount(g2);
+        }
+      }
+      else{
+        CalBddGetMinId2(bddManager, f2, g2, bddId);
+        CalHashTableFindOrAdd(reqQueForSwapVarsPlus[bddId], f2, g2, &result);
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSwapVarsMinusApply(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  Cal_BddIndex_t  hIndex,
+  CalHashTable_t ** reqQueForSwapVars,
+  CalHashTable_t ** reqQueForSwapVarsPlus,
+  CalHashTable_t ** reqQueForSwapVarsMinus,
+  CalHashTable_t ** reqQueForCompose)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_BddId_t bddId;
+  Cal_Bdd_t f1, f2, g1, g2;
+  Cal_Bdd_t result;
+
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetCofactors(bddManager, requestNode, f1, f2, g1, g2);
+      /* left cofactor */ 
+      if(CalBddGetBddIndex(bddManager, f1) == hIndex){
+        CalBddGetElseBdd(f1, f1);
+      }
+      if(CalBddGetBddIndex(bddManager, g1) == hIndex){
+        CalBddGetElseBdd(g1, g1);
+      }
+      if(CalBddIsEqual(f1, g1)){
+        if(hIndex > CalBddGetBddIndex(bddManager, f1)){
+          CalHashTableFindOrAdd(reqQueForCompose[CalBddGetBddId(f1)], 
+              f1, CalBddZero(bddManager), &result);
+        }
+        else{
+          result = f1;
+        }
+      }
+      else if(hIndex < CalBddGetBddIndex(bddManager, f1) &&
+          hIndex < CalBddGetBddIndex(bddManager, g1)){
+        bddId = bddManager->indexToId[hIndex];
+        if(!CalUniqueTableForIdFindOrAdd(bddManager,
+            bddManager->uniqueTable[bddId], f1, g1, &result)){
+          CalBddIcrRefCount(f1);
+          CalBddIcrRefCount(g1);
+        }
+      }
+      else{
+        CalBddGetMinId2(bddManager, f1, g1, bddId);
+        CalHashTableFindOrAdd(reqQueForSwapVarsMinus[bddId], f1, g1, &result);
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+      /* right cofactor */
+      if(CalBddGetBddIndex(bddManager, f2) == hIndex){
+        CalBddGetElseBdd(f2, f2);
+      }
+      if(CalBddGetBddIndex(bddManager, g2) == hIndex){
+        CalBddGetElseBdd(g2, g2);
+      }
+      if(CalBddIsEqual(f2, g2)){
+        if(hIndex > CalBddGetBddIndex(bddManager, f2)){
+          CalHashTableFindOrAdd(reqQueForCompose[CalBddGetBddId(f2)], 
+              f2, CalBddZero(bddManager), &result);
+        }
+        else{
+          result = f2;
+        }
+      }
+      else if(hIndex < CalBddGetBddIndex(bddManager, f2) &&
+          hIndex < CalBddGetBddIndex(bddManager, g2)){
+        bddId = bddManager->indexToId[hIndex];
+        if(!CalUniqueTableForIdFindOrAdd(bddManager, 
+            bddManager->uniqueTable[bddId], f2, g2, &result)){
+          CalBddIcrRefCount(f2);
+          CalBddIcrRefCount(g2);
+        }
+      }
+      else{
+        CalBddGetMinId2(bddManager, f2, g2, bddId);
+        CalHashTableFindOrAdd(reqQueForSwapVarsMinus[bddId], f2, g2, &result);
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calBddVarSubstitute.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBddVarSubstitute.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBddVarSubstitute.c	(revision 6)
@@ -0,0 +1,544 @@
+/**CFile***********************************************************************
+
+  FileName    [calBddVarSubstitute.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routine for simultaneous substitution of an array of
+  variables with another array of variables.]
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBddVarSubstitute.c,v 1.2 2002/09/10 00:27:21 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CalHashTableSubstituteApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, int lastIndex, CalHashTable_t ** reqQueForSubstitute, unsigned short opCode);
+static void CalHashTableSubstituteReduce(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t ** reqQueForITE, CalHashTable_t * uniqueTableForId, unsigned short opCode);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Substitute a set of variables by set of another variables.]
+
+  Description [Returns a BDD for f using the substitution defined by current
+  variable association. It is assumed that each variable is replaced
+  by another variable. For the substitution of a variable by a
+  function, use Cal_BddSubstitute instead.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddSubstitute]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddVarSubstitute(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  CalRequest_t result;
+  Cal_Bdd userResult;
+  
+  if (CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    CalAssociation_t *assoc = bddManager->currentAssociation;
+    unsigned short opCode;
+    if (assoc->id == -1){
+      opCode = bddManager->tempOpCode--;
+    }
+    else {
+      opCode = CAL_OP_VAR_SUBSTITUTE + assoc->id;
+    }
+    result = CalBddVarSubstitute(bddManager, f, opCode, assoc);
+    userResult =  CalBddGetExternalBdd(bddManager, result);
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, userResult);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    return userResult;
+  }
+  return (Cal_Bdd) 0;
+}
+  
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Substitute a set of variables by functions]
+
+  Description [Returns a BDD for f using the substitution defined by current
+  variable association. Each variable is replaced by its associated BDDs. The 
+  substitution is effective simultaneously]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddCompose]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddVarSubstitute(Cal_BddManager bddManager, Cal_Bdd_t f, unsigned
+                    short opCode, CalAssociation_t *assoc)
+{
+  CalRequest_t result;
+  int bddId, bddIndex, lastIndex;
+  CalHashTable_t *hashTable;
+  CalHashTable_t *uniqueTableForId;
+  CalHashTable_t **reqQueForSubstitute = bddManager->reqQue[0];
+  CalHashTable_t **reqQueForITE = bddManager->reqQue[1]; 
+  Cal_BddId_t fId = CalBddGetBddId(f);
+  /*Cal_BddIndex_t fIndex = bddManager->idToIndex[fId];*/
+  int fIndex = bddManager->idToIndex[fId];
+  
+  if (CalOpBddVarSubstitute(bddManager, f, &result)){
+    return result;
+  }
+
+  if (CalCacheTableOneLookup(bddManager, f, opCode, &result)){
+    return result;
+  }
+  CalHashTableFindOrAdd(reqQueForSubstitute[fId], f, 
+    bddManager->bddNull, &result);
+
+  /* ReqQueApply */
+  lastIndex = assoc->lastBddIndex;
+  for(bddIndex = fIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = reqQueForSubstitute[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSubstituteApply(bddManager, hashTable, lastIndex, 
+                                  reqQueForSubstitute, opCode);
+    }
+  }
+
+  /* ReqQueReduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= fIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = reqQueForSubstitute[bddId];
+    if(hashTable->numEntries){
+      CalHashTableSubstituteReduce(bddManager, hashTable,
+                                   reqQueForITE, uniqueTableForId,
+                                   opCode); 
+    }
+  }
+
+  CalRequestIsForwardedTo(result);
+
+  /* ReqQueCleanUp */
+  for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+    CalHashTableCleanUp(reqQueForSubstitute[bddId]);
+  }
+  CalCacheTableTwoFixResultPointers(bddManager);
+  CalCacheTableOneInsert(bddManager, f, result, opCode, 0);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpBddVarSubstitute(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, Cal_Bdd_t *
+            resultBddPtr) 
+{
+  if (bddManager->idToIndex[CalBddGetBddId(f)] >
+      bddManager->currentAssociation->lastBddIndex){ 
+    *resultBddPtr = f;
+    return 1;
+  }
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSubstituteApply(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  int  lastIndex,
+  CalHashTable_t ** reqQueForSubstitute,
+  unsigned short opCode)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_BddId_t bddId;
+  /*Cal_BddIndex_t bddIndex;*/
+  int bddIndex;
+  Cal_Bdd_t f, fx, fxBar, result;
+  Cal_Bdd_t nullBdd = bddManager->bddNull;
+
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      /* Process the requestNode */
+      CalRequestNodeGetF(requestNode, f);
+      /* Process Left Cofactor */
+      CalBddGetThenBdd(f, fx);
+      bddId = CalBddGetBddId(fx);
+      bddIndex = bddManager->idToIndex[bddId];
+      if(bddIndex <= lastIndex){
+          if (CalCacheTableOneLookup(bddManager, fx, opCode, &result)){ 
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(reqQueForSubstitute[bddId], fx, nullBdd, 
+                              &result);
+            CalCacheTableOneInsert(bddManager, fx, result,
+                                   opCode, 1);
+          }
+      }
+      else{
+        result = fx;
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+      /* Process Right Cofactor */
+      CalBddGetElseBdd(f, fxBar);
+      bddId = CalBddGetBddId(fxBar);
+      bddIndex = bddManager->idToIndex[bddId];
+      if(bddIndex <= lastIndex){
+          if (CalCacheTableOneLookup(bddManager, fxBar, opCode, &result)){ 
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(reqQueForSubstitute[bddId], fxBar, nullBdd, 
+                              &result);
+            CalCacheTableOneInsert(bddManager, fxBar, result,
+                                   opCode, 1);
+          }
+      }
+      else{
+        result = fxBar;
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableSubstituteReduce(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  CalHashTable_t ** reqQueForITE,
+  CalHashTable_t * uniqueTableForId,
+  unsigned short opCode)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  Cal_BddId_t varBddId = hashTable->bddId;
+  CalNodeManager_t *nodeManager = hashTable->nodeManager;
+  /*CalRequestNode_t *requestNodeList = hashTable->requestNodeList;*/
+  CalRequestNode_t *endNode = hashTable->endNode;
+  CalRequestNode_t *requestNodeListForITE = Cal_Nil(CalRequestNode_t);
+  CalRequestNode_t *requestNode, *next;
+  CalBddNode_t *bddNode;
+  Cal_Bdd_t varBdd;
+  Cal_Bdd_t thenBdd, elseBdd, result;
+  Cal_Bdd_t h;
+  Cal_BddIndex_t resultIndex, varBddIndex;
+  int minITEindex = bddManager->numVars;
+  Cal_BddRefCount_t refCount;
+  int bddId, bddIndex;
+  CalHashTable_t *hashTableForITE;
+
+  varBddIndex = bddManager->idToIndex[varBddId];
+  varBdd = bddManager->varBdds[varBddId];
+  h = bddManager->currentAssociation->varAssociation[varBddId];
+  if(!CalBddIsBddNull(bddManager, h)){
+    Cal_BddId_t hId = CalBddGetBddId(h);
+    Cal_BddIndex_t hIndex = bddManager->idToIndex[hId];
+    for(i = 0; i < numBins; i++){
+      for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+          requestNode != Cal_Nil(CalRequestNode_t);
+          requestNode = next){
+        next = CalRequestNodeGetNextRequestNode(requestNode);
+        /* Process the requestNode */
+        CalRequestNodeGetThenRequest(requestNode, thenBdd);
+        CalRequestNodeGetElseRequest(requestNode, elseBdd);
+        CalRequestIsForwardedTo(thenBdd);
+        CalRequestIsForwardedTo(elseBdd);
+        if(CalBddIsEqual(thenBdd, elseBdd)){
+          CalBddNodeGetRefCount(requestNode, refCount);
+          CalBddAddRefCount(thenBdd, refCount - 2);
+          CalRequestNodePutThenRequest(requestNode, thenBdd);
+          CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+          endNode->nextBddNode = requestNode;
+          endNode = requestNode;
+        }
+        else{
+          if(hIndex < CalBddGetBddIndex(bddManager, thenBdd) &&
+             hIndex < CalBddGetBddIndex(bddManager, elseBdd)){
+            if(CalUniqueTableForIdLookup(bddManager, bddManager->uniqueTable[hId],
+                                         thenBdd, elseBdd, &result) == 1){
+              CalBddDcrRefCount(thenBdd);
+              CalBddDcrRefCount(elseBdd);
+              CalBddNodeGetRefCount(requestNode, refCount);
+              CalBddAddRefCount(result, refCount);
+              CalRequestNodePutThenRequest(requestNode, result);
+              CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+              endNode->nextBddNode = requestNode;
+              endNode = requestNode;
+            }
+            else if(CalBddIsOutPos(thenBdd)){
+              /* Get a node from the node manager of h */
+              CalNodeManager_t *hNodeManager =
+                  bddManager->nodeManagerArray[hId];
+              CalNodeManagerInitBddNode(hNodeManager, thenBdd, elseBdd,
+                                      Cal_Nil(CalBddNode_t), bddNode);
+              CalBddNodeGetRefCount(requestNode, refCount);
+              CalBddNodePutRefCount(bddNode, refCount);
+              CalHashTableAddDirect(bddManager->uniqueTable[hId], bddNode);
+              bddManager->numNodes++;
+              bddManager->gcCheck--;
+              CalRequestNodePutThenRequestId(requestNode, hId);
+              CalRequestNodePutThenRequestNode(requestNode, bddNode); 
+              CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+              endNode->nextBddNode = requestNode;
+              endNode = requestNode;
+            }
+            else{
+              /* Get a node from the node manager of h */
+              CalNodeManager_t *hNodeManager =
+                  bddManager->nodeManagerArray[hId];
+              CalBddNot(thenBdd, thenBdd);
+              CalBddNot(elseBdd, elseBdd);
+              CalNodeManagerInitBddNode(hNodeManager, thenBdd, elseBdd,
+                                      Cal_Nil(CalBddNode_t), bddNode);
+              CalBddNodeGetRefCount(requestNode, refCount);
+              CalBddNodePutRefCount(bddNode, refCount);
+              CalHashTableAddDirect(bddManager->uniqueTable[hId], bddNode);
+              bddManager->numNodes++;
+              bddManager->gcCheck--;
+              CalRequestNodePutThenRequestId(requestNode, hId);
+              CalRequestNodePutThenRequestNode(requestNode,
+                                               CalBddNodeNot(bddNode));
+              CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+              endNode->nextBddNode = requestNode;
+              endNode = requestNode;
+            }
+          }
+          else{
+            CalBddDcrRefCount(thenBdd);
+            CalBddDcrRefCount(elseBdd);
+            result = CalOpITE(bddManager, h, thenBdd, elseBdd, reqQueForITE);
+            if ((resultIndex = bddManager->idToIndex[CalBddGetBddId(result)]) < minITEindex){
+              minITEindex = resultIndex;
+            }
+            CalRequestNodePutThenRequest(requestNode, result);
+            CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+            CalRequestNodePutNextRequestNode(requestNode,
+                                             requestNodeListForITE);
+            requestNodeListForITE = requestNode;
+          }
+        }
+      }
+    }
+  }
+  else{
+    for(i = 0; i < numBins; i++){
+      for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+          requestNode != Cal_Nil(CalRequestNode_t);
+          requestNode = next){
+        next = CalRequestNodeGetNextRequestNode(requestNode);
+        /* Process the requestNode */
+        CalRequestNodeGetThenRequest(requestNode, thenBdd);
+        CalRequestNodeGetElseRequest(requestNode, elseBdd);
+        CalRequestIsForwardedTo(thenBdd);
+        CalRequestIsForwardedTo(elseBdd);
+        if(CalBddIsEqual(thenBdd, elseBdd)){
+          CalBddNodeGetRefCount(requestNode, refCount);
+          CalBddAddRefCount(thenBdd, refCount - 2);
+          CalRequestNodePutThenRequest(requestNode, thenBdd);
+          CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+          endNode->nextBddNode = requestNode;
+          endNode = requestNode;
+        }
+        else{
+          if(varBddIndex < CalBddGetBddIndex(bddManager, thenBdd) &&
+             varBddIndex < CalBddGetBddIndex(bddManager, elseBdd)){
+            if(CalUniqueTableForIdLookup(bddManager, uniqueTableForId,
+                                         thenBdd, elseBdd, &result) == 1){
+              CalBddDcrRefCount(thenBdd);
+              CalBddDcrRefCount(elseBdd);
+              CalBddNodeGetRefCount(requestNode, refCount);
+              CalBddAddRefCount(result, refCount);
+              CalRequestNodePutThenRequest(requestNode, result);
+              CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+              endNode->nextBddNode = requestNode;
+              endNode = requestNode;
+            }
+            else if(CalBddIsOutPos(thenBdd)){
+              CalRequestNodePutThenRequest(requestNode, thenBdd);
+              CalRequestNodePutElseRequest(requestNode, elseBdd);
+              CalHashTableAddDirect(uniqueTableForId, requestNode);
+              bddManager->numNodes++;
+              bddManager->gcCheck--;
+            }
+            else{
+              CalBddNot(thenBdd, thenBdd);
+              CalBddNot(elseBdd, elseBdd);
+              CalNodeManagerInitBddNode(nodeManager, thenBdd, elseBdd,
+                                      Cal_Nil(CalBddNode_t), bddNode);
+              CalBddNodeGetRefCount(requestNode, refCount);
+              CalBddNodePutRefCount(bddNode, refCount);
+              CalHashTableAddDirect(uniqueTableForId, bddNode);
+              bddManager->numNodes++;
+              bddManager->gcCheck--;
+              CalRequestNodePutThenRequestId(requestNode, varBddId);
+              CalRequestNodePutThenRequestNode(requestNode,
+                                               CalBddNodeNot(bddNode));
+              CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+              endNode->nextBddNode = requestNode;
+              endNode = requestNode;
+            }
+          }
+          else{
+            CalBddDcrRefCount(thenBdd);
+            CalBddDcrRefCount(elseBdd);
+            result = CalOpITE(bddManager, varBdd, thenBdd, elseBdd, reqQueForITE);
+            if ((resultIndex = bddManager->idToIndex[CalBddGetBddId(result)]) < minITEindex){
+              minITEindex = resultIndex;
+            }
+            CalRequestNodePutThenRequest(requestNode, result);
+            CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+            CalRequestNodePutNextRequestNode(requestNode,
+                                             requestNodeListForITE);
+            requestNodeListForITE = requestNode;
+          }
+        }
+      }
+    }
+  }
+
+  /* ITE Apply */
+  for(bddIndex = minITEindex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTableForITE = reqQueForITE[bddId];
+    if(hashTableForITE->numEntries){
+      CalHashTableITEApply(bddManager, hashTableForITE, reqQueForITE);
+    }
+  }
+  /* ITE Reduce */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minITEindex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTableForITE = reqQueForITE[bddId];
+    if(hashTableForITE->numEntries){
+      CalHashTableReduce(bddManager, hashTableForITE,
+          bddManager->uniqueTable[bddId]);
+    }
+  }
+    
+
+  for(requestNode = requestNodeListForITE; 
+      requestNode != Cal_Nil(CalRequestNode_t);
+      requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+    CalRequestNodeGetThenRequest(requestNode, result);
+    CalBddNodeGetRefCount(requestNode, refCount);
+    CalRequestIsForwardedTo(result);
+    CalBddAddRefCount(result, refCount);
+    CalRequestNodePutThenRequest(requestNode, result);
+  }
+
+  endNode->nextBddNode = requestNodeListForITE;
+  hashTable->endNode = endNode;
+  /* ITE Cleanup */
+  for(bddId = 1; bddId <= bddManager->numVars; bddId++){
+    CalHashTableCleanUp(reqQueForITE[bddId]);
+  }
+}
+
Index: /vis_dev/glu-2.1/src/calBdd/calBlk.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calBlk.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calBlk.c	(revision 6)
@@ -0,0 +1,348 @@
+/**CFile***********************************************************************
+
+  FileName    [calBlk.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for manipulating blocks of variables.]
+
+  Description [Routines for manipulating blocks of variables.]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu). Modelled on the BDD package
+  developed by David Long.]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calBlk.c,v 1.1.1.2 1998/05/04 00:59:05 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void AddBlock(Cal_Block b1, Cal_Block b2);
+
+/**AutomaticEnd***************************************************************/
+
+/* BDD variable block routines */
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis           [Creates and returns a variable block used for
+  controlling dynamic reordering.]
+
+  Description        [The block is specified by passing the first
+  variable and the length of the block. The "length" number of
+  consecutive variables starting from "variable" are put in the
+  block.]   
+
+  SideEffects        [A new block is created.]
+
+  SeeAlso            []
+
+******************************************************************************/
+Cal_Block
+Cal_BddNewVarBlock(Cal_BddManager bddManager, Cal_Bdd variable, long length)
+{
+  Cal_Block b;
+  Cal_Bdd_t calBdd = CalBddGetInternalBdd(bddManager, variable);
+  
+  if (CalBddTypeAux(bddManager, calBdd) != CAL_BDD_TYPE_POSVAR) {
+    CalBddWarningMessage("Cal_BddNewVarBlock: second argument is not a positive variable\n"); 
+    if (CalBddIsBddConst(calBdd)){
+      return (Cal_Block) 0;
+	}
+  }
+
+  /*b = CAL_BDD_NEW_REC(bddManager, Cal_Block_t);*/
+  b = Cal_MemAlloc(Cal_Block_t, 1);
+  b->reorderable = 0;
+  b->firstIndex = bddManager->idToIndex[calBdd.bddId];
+  if (length <= 0) {
+    CalBddWarningMessage("Cal_BddNewVarBlock: invalid final argument");
+    length = 1;
+  }
+  b->lastIndex = b->firstIndex + length - 1;
+  if (b->lastIndex >= bddManager->numVars) {
+    CalBddWarningMessage("Cal_BddNewVarBlock: range covers non-existent variables"); 
+    b->lastIndex = bddManager->numVars - 1;
+  }
+  AddBlock(bddManager->superBlock, b);
+  return (b);
+}
+/**Function********************************************************************
+
+  Synopsis           [Sets the reoderability of a particular block.]
+
+  Description        [If a block is reorderable, the child blocks are
+  recursively involved in swapping.]
+
+  SideEffects        [None.]
+
+  SeeAlso            []
+
+******************************************************************************/
+void
+Cal_BddVarBlockReorderable(Cal_BddManager bddManager, Cal_Block block,
+                           int reorderable)
+{
+  block->reorderable = reorderable;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+long
+CalBddFindBlock(Cal_Block block, long index)
+{
+  long i, j, k;
+
+  i = 0;
+  j = block->numChildren-1;
+  while (i <= j) {
+    k = (i+j)/2;
+    if (block->children[k]->firstIndex <= index &&
+        block->children[k]->lastIndex >= index){
+      return (k);
+    }
+    if (block->children[k]->firstIndex > index){
+      j = k-1;
+    }
+    else {
+      i = k+1;
+    }
+  }
+  return i;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddBlockDelta(Cal_Block b, long delta)
+{
+  long i;
+  b->firstIndex += delta;
+  b->lastIndex += delta;
+  for (i=0; i < b->numChildren; ++i)
+    CalBddBlockDelta(b->children[i], delta);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+Cal_Block
+CalBddShiftBlock(Cal_BddManager_t *bddManager, Cal_Block b, long index)
+{
+  long i, j;
+  Cal_Block p;
+
+  if (b->firstIndex >= index) {
+    CalBddBlockDelta(b, 1l);
+    return (b);
+  }
+  if (b->lastIndex < index) return (b);
+  b->lastIndex++;
+  i = CalBddFindBlock(b, index);
+  if (i == b->numChildren || b->children[i]->firstIndex == index) {
+    b->children = (Cal_Block *)
+        Cal_MemRealloc(Cal_Block, b->children, b->numChildren+1);
+    for (j = b->numChildren-1; j >= i; --j){
+      b->children[j+1] = CalBddShiftBlock(bddManager, b->children[j], index);
+    }
+    b->numChildren++;
+    /*p = CAL_BDD_NEW_REC(bddManager, Cal_Block_t);*/
+    p = Cal_MemAlloc(Cal_Block_t, 1);
+    p->reorderable = 0;
+    p->firstIndex = index;
+    p->lastIndex = index;
+    p->numChildren = 0;
+    p->children = 0;
+    b->children[i] = p;
+  }
+  else{
+    while (i < b->numChildren) {
+      CalBddShiftBlock(bddManager, b->children[i], index);
+      ++i;
+    }
+  }
+  return (b);
+}
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+unsigned long
+CalBlockMemoryConsumption(Cal_Block block)
+{
+  unsigned long totalBytes = 0;
+  int i;
+  
+  totalBytes += sizeof(Cal_Block);
+  for (i=0; i<block->numChildren; i++){
+    totalBytes += CalBlockMemoryConsumption(block->children[i]);
+  }
+  return totalBytes;
+}
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalFreeBlockRecursively(Cal_Block block)
+{
+  int i;
+  
+  for (i=0; i<block->numChildren; i++){
+    CalFreeBlockRecursively(block->children[i]);
+  }
+  Cal_MemFree(block->children);
+  Cal_MemFree(block);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+AddBlock(Cal_Block b1, Cal_Block b2)
+{
+  long i, j, k;
+  Cal_Block start, end;
+
+  if (b1->numChildren){
+    i = CalBddFindBlock(b1, b2->firstIndex);
+    start = b1->children[i];
+    j = CalBddFindBlock(b1, b2->lastIndex);
+    end = b1->children[j];
+    if (i == j) {
+      AddBlock(start, b2);
+    }
+    else {
+      if (start->firstIndex != b2->firstIndex ||
+          end->lastIndex != b2->lastIndex){
+        CalBddFatalMessage("AddBlock: illegal block overlap");
+      }
+      b2->numChildren = j-i+1;
+	  b2->children = Cal_MemAlloc(Cal_Block, b2->numChildren); 
+	  for (k=0; k < b2->numChildren; ++k){
+	    b2->children[k] = b1->children[i+k];
+      }
+	  b1->children[i] = b2;
+	  ++i;
+	  for (k=j+1; k < b1->numChildren; ++k, ++i){
+	    b1->children[i] = b1->children[k];
+      }
+	  b1->numChildren -= (b2->numChildren-1);
+	  b1->children = (Cal_Block *)
+          Cal_MemRealloc(Cal_Block, b1->children, b1->numChildren);
+	}
+  }
+  else {
+      /* b1 and b2 are blocks representing just single variables. */
+      b1->numChildren = 1;
+      b1->children = Cal_MemAlloc(Cal_Block, b1->numChildren); 
+      b1->children[0] = b2;
+      b2->numChildren = 0;
+      b2->children = 0;
+  }
+}
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calCacheTableTwo.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calCacheTableTwo.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calCacheTableTwo.c	(revision 6)
@@ -0,0 +1,751 @@
+/**CFile***********************************************************************
+
+  FileName    [calCacheTableTwo.c]
+
+  PackageName [cal]
+
+  Synopsis    [Functions to manage the Cache tables.]
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [ Rajeev K. Ranjan   (rajeev@eecs.berkeley.edu)
+                Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+              ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calCacheTableTwo.c,v 1.4 1998/09/15 19:02:52 ravi Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/* cache table management related constants */
+#define CACHE_TABLE_DEFAULT_SIZE_INDEX 16
+#define CACHE_TABLE_DEFAULT_CACHE_RATIO 4
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct CacheEntryStruct CacheEntry_t;
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+struct CalCacheTableStruct {
+  long numBins;
+  int sizeIndex;
+  CacheEntry_t *bins;
+  int cacheRatio;
+  long numInsertions;
+  long numEntries;
+  long numHits;
+  long numLookups;
+  long numCollisions;
+};
+
+struct CacheEntryStruct {
+  CalBddNode_t *operand1;
+  CalBddNode_t *operand2;
+  CalBddNode_t *resultBddNode;
+  Cal_BddId_t resultBddId;
+  unsigned short opCode;
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#ifdef USE_POWER_OF_2
+#  define CacheTableTwoDoHash(table, operand1, operand2, opCode) \
+   (((((((CalAddress_t)(operand1)) +	((CalAddress_t)(operand2))) / NODE_SIZE) << 2) + opCode + ((CalAddress_t)operand1 & 0x1)+ (((CalAddress_t)operand2 & 0x1)<<1)) &((table)->numBins - 1))
+#else
+#  define CacheTableTwoDoHash(table, operand1, operand2, opCode) \
+   ((((((CalAddress_t)(operand1)) +	((CalAddress_t)(operand2))) / NODE_SIZE) + opCode + ((CalAddress_t)operand1 & 0x1)+ ((CalAddress_t)operand2 & 0x1)) %((table)->numBins))
+/*(((((CalAddress_t)(operand1)) +	((CalAddress_t)(operand2))) + opCode) &((table)->numBins - 1))
+((opCode + (((CalAddress_t)(operand1)) << 1) + (((CalAddress_t)(operand2)) <<2)) &((table)->numBins - 1))
+((opCode + ((((CalAddress_t)(operand1)) + ((CalAddress_t)(operand2))) )+(((CalAddress_t)operand1 & 0x1) << (table->sizeIndex-1)) + (((CalAddress_t)operand2 & 0x1) << (table->sizeIndex-2))) &((table)->numBins - 1))
+((opCode + (((CalAddress_t)(operand1)) << 1) + (((CalAddress_t)(operand2)) << 2)) &((table)->numBins - 1))
+*/
+#endif
+
+#define CacheTableTwoCompareCacheEntry(entry, _operand1, _operand2, _opCode)  \
+((((CalBddNode_t *)(((CalAddress_t)((entry)->operand1)) & ~0x2)) == (_operand1))\
+ &&								\
+ ((entry)->operand2 == (_operand2))\
+ &&								\
+ ((entry)->opCode == _opCode))
+
+#define CacheResultNodeIsForwardedTo(resultBddNode, resultBddId) \
+{ \
+  CalBddNode_t *__resultBddNode;\
+  __resultBddNode = CAL_BDD_POINTER(resultBddNode); \
+  if(CalRequestNodeGetElseRequestNode(__resultBddNode) == FORWARD_FLAG){ \
+    resultBddId = __resultBddNode->thenBddId; \
+    resultBddNode = (CalBddNode_t*) \
+                    (((CalAddress_t)(__resultBddNode->thenBddNode) & ~0xe)        \
+                         ^(CAL_TAG0(resultBddNode))); \
+  } \
+}
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CacheTableTwoRehash(CalCacheTable_t *cacheTable, int grow);
+static void CacheTablePrint(CalCacheTable_t *cacheTable);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Initialize a Cache table using default parameters.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+CalCacheTable_t *
+CalCacheTableTwoInit(Cal_BddManager_t *bddManager)
+{
+  CalCacheTable_t  *cacheTable;
+  cacheTable = Cal_MemAlloc(CalCacheTable_t, 1);
+  if (cacheTable == Cal_Nil(CalCacheTable_t)){
+    CalBddFatalMessage("out of memory");
+  }
+  cacheTable->sizeIndex = CACHE_TABLE_DEFAULT_SIZE_INDEX;
+  cacheTable->numBins = TABLE_SIZE(cacheTable->sizeIndex);
+  cacheTable->cacheRatio = CACHE_TABLE_DEFAULT_CACHE_RATIO;
+  cacheTable->bins = Cal_MemAlloc(CacheEntry_t, cacheTable->numBins);
+  if(cacheTable->bins == Cal_Nil(CacheEntry_t)){
+    CalBddFatalMessage("out of memory");
+  }		
+  memset((char *)cacheTable->bins, 0,
+	 cacheTable->numBins*sizeof(CacheEntry_t));
+  cacheTable->numInsertions = 0;
+  cacheTable->numEntries = 0;
+  cacheTable->numHits = 0;
+  cacheTable->numLookups = 0;
+  cacheTable->numCollisions = 0;
+  return cacheTable;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Free a Cache table along with the associated storage.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalCacheTableTwoQuit(CalCacheTable_t *cacheTable)
+{
+  if(cacheTable == Cal_Nil(CalCacheTable_t))return 1;
+  Cal_MemFree(cacheTable->bins);
+  Cal_MemFree(cacheTable);
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Directly insert a BDD node in the Cache table.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalCacheTableTwoInsert(Cal_BddManager_t *bddManager, Cal_Bdd_t f,
+                       Cal_Bdd_t g, Cal_Bdd_t result, unsigned long
+                       opCode, int cacheLevel)
+{
+  int hashValue;
+  CalCacheTable_t *cacheTable;
+  CacheEntry_t *bin;
+  CalBddNode_t *operand1Node, *operand2Node;
+
+  cacheTable = bddManager->cacheTable;
+  cacheTable->numInsertions++;
+  hashValue = CacheTableTwoDoHash(cacheTable, CalBddGetBddNode(f),
+                                  CalBddGetBddNode(g), opCode); 
+
+  bin = cacheTable->bins + hashValue;
+  if (bin->opCode != CAL_OP_INVALID){
+    cacheTable->numCollisions++;
+  }
+  else{
+    cacheTable->numEntries++;
+  }
+  
+  bin->opCode = opCode;
+  if ((CalAddress_t)CalBddGetBddNode(f) >
+      (CalAddress_t)CalBddGetBddNode(g)){ 
+    operand1Node = CalBddGetBddNode(g);
+    operand2Node = CalBddGetBddNode(f);
+  }
+  else{
+    operand1Node = CalBddGetBddNode(f);
+    operand2Node = CalBddGetBddNode(g);
+  }
+  
+  if (cacheLevel){
+  /*
+   * Mark this result as temporary node to be forwarded at the end of
+   * operation. The reason we can use this tagging is because the
+   * size of the structure is 16 bytes and we are requiring 8 or 16 byte
+   * alignment (at least last 3 bits should be zero).
+   */
+    bin->operand1 = (CalBddNode_t *) (((CalAddress_t)operand1Node) | 0x2);
+  }
+  else {
+    bin->operand1 = operand1Node;
+  }
+  bin->operand2 = operand2Node;
+  bin->resultBddNode = CalBddGetBddNode(result);
+  bin->resultBddId = CalBddGetBddId(result);
+  return;
+}
+
+  
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalCacheTableTwoLookup(Cal_BddManager_t *bddManager, Cal_Bdd_t f,
+                       Cal_Bdd_t g, unsigned long opCode, Cal_Bdd_t
+                       *resultBddPtr)  
+{
+  int hashValue;
+  CalCacheTable_t *cacheTable;
+  CacheEntry_t *bin;
+  CalBddNode_t *operand1Node, *operand2Node;
+  
+  cacheTable = bddManager->cacheTable;
+  cacheTable->numLookups++;
+  hashValue = CacheTableTwoDoHash(cacheTable, CalBddGetBddNode(f),
+                                  CalBddGetBddNode(g), opCode); 
+
+  bin = cacheTable->bins+hashValue;
+  
+  if ((CalAddress_t)CalBddGetBddNode(f) > (CalAddress_t)CalBddGetBddNode(g)){
+    operand1Node = CalBddGetBddNode(g);
+    operand2Node = CalBddGetBddNode(f);
+  }
+  else{
+    operand1Node = CalBddGetBddNode(f);
+    operand2Node = CalBddGetBddNode(g);
+  }
+  if (CacheTableTwoCompareCacheEntry(bin, operand1Node, operand2Node,
+                                     opCode)){
+    CalBddPutBddId((*resultBddPtr), bin->resultBddId);
+    CalBddPutBddNode((*resultBddPtr), bin->resultBddNode);
+    cacheTable->numHits++;
+    return 1;
+  }
+  *resultBddPtr = bddManager->bddNull;
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Free a Cache table along with the associated storage.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalCacheTableTwoFlush(CalCacheTable_t *cacheTable)
+{
+  memset((char *)cacheTable->bins, 0,
+	 cacheTable->numBins*sizeof(CacheEntry_t));
+  cacheTable->numEntries = 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Free a Cache table along with the associated storage.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalCacheTableTwoFlushAll(CalCacheTable_t *cacheTable)
+{
+  CalCacheTableTwoFlush(cacheTable);
+  cacheTable->numInsertions = 0;
+  cacheTable->numCollisions = 0;
+  cacheTable->numLookups = 0;
+  cacheTable->numHits = 0;
+  return 0;
+}
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalCacheTableTwoGCFlush(CalCacheTable_t *cacheTable)
+{
+  int i;
+  CacheEntry_t *bin = cacheTable->bins;
+  int numBins = cacheTable->numBins;
+  if (cacheTable->numEntries == 0) return;
+  for (i=0; i<numBins; bin++,i++){
+    if (bin->opCode != CAL_OP_INVALID){
+      if (CalBddNodeIsMarked((CAL_BDD_POINTER(bin->operand1))) ||
+          CalBddNodeIsMarked((CAL_BDD_POINTER(bin->operand2))) ||
+          CalBddNodeIsMarked((CAL_BDD_POINTER(bin->resultBddNode)))){
+        /* This entry needs to be freed */
+        cacheTable->numEntries--;
+        memset((char *)bin, 0, sizeof(CacheEntry_t));
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalCacheTableTwoRepackUpdate(CalCacheTable_t *cacheTable)
+{
+  int i;
+  CacheEntry_t *bin = cacheTable->bins;
+  int numBins = cacheTable->numBins;
+  
+  for (i=0; i<numBins; bin++,i++){
+    if (bin->opCode != CAL_OP_INVALID){
+      if (CalBddNodeIsForwarded(CAL_BDD_POINTER(bin->operand1))){
+        CalBddNodeForward(bin->operand1);
+      }
+      if (CalBddNodeIsForwarded(CAL_BDD_POINTER(bin->operand2))){
+        CalBddNodeForward(bin->operand2);
+      }
+      if (CalBddNodeIsForwarded(CAL_BDD_POINTER(bin->resultBddNode))){
+        CalBddNodeForward(bin->resultBddNode);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalCheckCacheTableValidity(Cal_BddManager bddManager)
+{
+  CalCacheTable_t *cacheTable = bddManager->cacheTable;
+  int i;
+  CacheEntry_t *bin = cacheTable->bins;
+  int numBins = cacheTable->numBins;
+  
+  for (i=0; i<numBins; bin++,i++){
+    if (bin->opCode != CAL_OP_INVALID){
+      Cal_Assert(CalBddNodeIsForwarded(CAL_BDD_POINTER(bin->operand1))
+                 == 0);
+      Cal_Assert(CalBddNodeIsForwarded(CAL_BDD_POINTER(bin->operand2))
+                 == 0);
+      Cal_Assert(CalBddNodeIsForwarded(CAL_BDD_POINTER(bin->resultBddNode))
+                 == 0);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalCacheTableTwoFixResultPointers(Cal_BddManager_t *bddManager)
+{
+  CalCacheTable_t *cacheTable = bddManager->cacheTable;
+  int i;
+  CacheEntry_t *bin = cacheTable->bins;
+  int numBins = cacheTable->numBins;
+  
+  for (i=0; i<numBins; bin++,i++){
+    if ((CalAddress_t)bin->operand1 & 0x2){ /* If the result node is temporary
+                                   node */
+      CacheResultNodeIsForwardedTo(bin->resultBddNode, bin->resultBddId);
+      bin->operand1 = (CalBddNode_t *)((CalAddress_t)bin->operand1 &
+                                       ~0x2); /* It is no longer temporary */
+    }
+  }
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalCacheTablePrint(Cal_BddManager_t *bddManager)
+{
+  CacheTablePrint(bddManager->cacheTable);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddManagerGetCacheTableData(Cal_BddManager_t *bddManager,
+                               unsigned long *cacheSize,
+                               unsigned long *cacheEntries,
+                               unsigned long *cacheInsertions,
+                               unsigned long *cacheLookups,
+                               unsigned long *cacheHits,
+                               unsigned long *cacheCollisions)
+{
+  CalCacheTable_t *cacheTable = bddManager->cacheTable;
+  *cacheSize += cacheTable->numBins;
+  *cacheEntries += cacheTable->numEntries;
+  *cacheInsertions += cacheTable->numInsertions;
+  *cacheLookups += cacheTable->numLookups;
+  *cacheHits += cacheTable->numHits;
+  *cacheCollisions += cacheTable->numCollisions;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalCacheTableRehash(Cal_BddManager_t *bddManager)
+{
+  CalCacheTable_t *cacheTable = bddManager->cacheTable;
+  if((3*cacheTable->numBins < cacheTable->cacheRatio*cacheTable->numEntries) &&
+     (32*cacheTable->numBins <
+      8*(bddManager->numNodes))){
+    CacheTableTwoRehash(cacheTable, 1);
+  }
+}
+/**Function********************************************************************
+
+  Synopsis           [Flushes the entries from the cache which
+                      correspond to the given associationId.]
+
+  Description        []
+
+  SideEffects        [Cache entries are affected.]
+
+  SeeAlso            []
+
+******************************************************************************/
+void
+CalCacheTableTwoFlushAssociationId(Cal_BddManager_t *bddManager, int
+                                   associationId)
+{
+  CalCacheTable_t *cacheTable =   bddManager->cacheTable;
+  int i;
+  CacheEntry_t *bin;
+  
+  for (i=0; i < cacheTable->numBins; i++){
+    bin = cacheTable->bins+i;
+    if ((bin->opCode == (CAL_OP_QUANT+associationId)) ||
+        (bin->opCode == (CAL_OP_REL_PROD+associationId)) ||
+        (bin->opCode == (CAL_OP_VAR_SUBSTITUTE+associationId))){
+      /* This entry needs to be freed */
+      cacheTable->numEntries--;
+      memset((char *)bin, 0, sizeof(CacheEntry_t));
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+unsigned long
+CalCacheTableMemoryConsumption(CalCacheTable_t *cacheTable)
+{
+  return (unsigned long) (sizeof(cacheTable)+cacheTable->numBins*sizeof(CacheEntry_t));
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CacheTableTwoRehash(CalCacheTable_t *cacheTable,int grow)
+{
+  CacheEntry_t *oldBins = cacheTable->bins;
+  int i, hashValue;
+  int oldNumBins = cacheTable->numBins;
+  CacheEntry_t *bin, *newBin;
+  
+  
+  if(grow){
+    cacheTable->sizeIndex++;
+  }
+  else{
+    if (cacheTable->sizeIndex <= CACHE_TABLE_DEFAULT_SIZE_INDEX){/* No need to Rehash */
+      return;
+    }
+    cacheTable->sizeIndex--;
+  }
+
+  cacheTable->numBins = TABLE_SIZE(cacheTable->sizeIndex);
+  cacheTable->bins = Cal_MemAlloc(CacheEntry_t, cacheTable->numBins);
+  if(cacheTable->bins == Cal_Nil(CacheEntry_t)){
+    CalBddFatalMessage("out of memory");
+  }
+  
+  memset((char *)cacheTable->bins, 0, 
+	 cacheTable->numBins*sizeof(CacheEntry_t));
+
+  for(i = 0; i < oldNumBins; i++){
+      bin  = oldBins+i;
+      if (bin->opCode == CAL_OP_INVALID) continue;
+      hashValue = CacheTableTwoDoHash(cacheTable,
+                                      bin->operand1,
+                                      bin->operand2,
+                                      bin->opCode);
+      newBin = cacheTable->bins+hashValue;
+      if (newBin->opCode != CAL_OP_INVALID){
+        cacheTable->numEntries--;
+      }
+      newBin->opCode = bin->opCode;
+      newBin->operand1 = bin->operand1;
+      newBin->operand2 = bin->operand2;
+      newBin->resultBddId = bin->resultBddId;
+      newBin->resultBddNode = bin->resultBddNode;
+  }
+  Cal_MemFree(oldBins);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CacheTablePrint(CalCacheTable_t *cacheTable)
+{
+  int i;
+  unsigned long opCode;
+  CacheEntry_t *bin;
+  
+  printf("cacheTable entries(%ld) bins(%ld)\n",
+         cacheTable->numEntries, cacheTable->numBins);
+  for(i = 0; i < cacheTable->numBins; i++){
+    bin = cacheTable->bins+i;
+    opCode = bin->opCode;
+    if (opCode != CAL_OP_INVALID){
+      fprintf(stdout,"Op = %s O1 = %lx, O2 = %lx RId = %d, RNode = %lx\n",
+              ((opCode == CAL_OP_OR) ? "OR" : ((opCode == CAL_OP_AND) ? "AND" :
+                                               ((opCode ==
+                                                            CAL_OP_QUANT) ?
+                                                           "QUANT" :
+                                                           ((opCode ==
+                                                             CAL_OP_REL_PROD)   
+                                                            ?
+                                                            "RELPROD"
+                                                            :
+                                                            "Nothing")))), 
+              (CalAddress_t)bin->operand1,
+              (CalAddress_t)bin->operand2, bin->resultBddId, 
+              (CalAddress_t)bin->resultBddNode);
+    }
+  }
+}
+
+
+#ifdef CACHE_TABLE_TWO_TEST
+main(int argc, char **argv)
+{
+  Cal_Bdd_t f1, f2, f3, f4, f5, result;
+  Cal_BddManager_t *bddManager = Cal_BddManagerInit();
+  int i;
+  CalCacheTable_t *cacheTable;
+  
+  for (i=0; i<5; i++){
+    Cal_BddManagerCreateNewVarLast(bddManager);
+  }
+
+  CalCacheTablePrint(bddManager);
+  
+  f1 = bddManager->varBdds[1];
+  f2 = bddManager->varBdds[2];
+  f3 = bddManager->varBdds[3];
+  f4 = bddManager->varBdds[4];
+  f5 = bddManager->varBdds[5];
+  
+  CalCacheTableTwoInsert(bddManager, f1, f2, f3, CAL_OP_OR, 0);
+  CalCacheTableTwoInsert(bddManager, f3, f2, f4, CAL_OP_AND,0);
+  CalCacheTableTwoInsert(bddManager, f3, f4, f5, CAL_OP_REL_PROD,0);
+  /*CacheTableTwoRehash(bddManager->cacheTableArray[2], 1);*/
+  CalCacheTablePrint(bddManager);
+  
+  /* Look up */
+  CalCacheTableTwoLookup(bddManager, f3, f2, CAL_OP_AND, &result);
+  assert(CalBddIsEqual(result, f4));
+
+  CalCacheTableTwoLookup(bddManager, f3, f2, CAL_OP_OR, &result);
+  assert(CalBddIsEqual(result, bddManager->bddNull));
+  
+  CalCacheTableTwoLookup(bddManager, f3, f1, CAL_OP_OR, &result);
+  assert(CalBddIsEqual(result, bddManager->bddNull));
+
+  /* Another look up */
+  CalCacheTableTwoLookup(bddManager, f4, f3, CAL_OP_REL_PROD, &result);
+  assert(CalBddIsEqual(result, f5));
+
+  /* It will bump off the entry (f2, f2, AND, f4)*/
+  CalCacheTableTwoInsert(bddManager, f3, f2, f1, CAL_OP_AND,0);
+  /* Do lookup and see if that's what happened */
+  CalCacheTableTwoLookup(bddManager, f3, f2, CAL_OP_AND, &result);
+  assert(CalBddIsEqual(result, f1));
+
+  /*
+   * Rehashing will visit (f2, f3, AND, f4) first and then (f2, f3,
+   * AND, f1)
+   * Hence the we should have (f2, f3, AND, f1) in the first slot
+   */
+  CacheTableTwoRehash(bddManager->cacheTable, 1);
+  CalCacheTableTwoLookup(bddManager, f3, f2, CAL_OP_AND, &result);
+  assert(CalBddIsEqual(result, f1));
+  Cal_BddManagerQuit(bddManager);
+  
+}
+#endif
Index: /vis_dev/glu-2.1/src/calBdd/calDesc.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calDesc.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calDesc.html	(revision 6)
@@ -0,0 +1,28 @@
+<HTML>
+<HEAD><TITLE>The cal package: Overview</TITLE></HEAD>
+<BODY>
+
+<H1>The cal package</H1>
+<H2>Header CAL file for exported data structures and functions.</H2>
+<H3>By Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)</H3>
+
+<UL>
+ <LI> <A HREF="calExt.html" TARGET="_top">
+    Information for programmers</A>
+ <LI> <A HREF="calAllByFunc.html" TARGET="_top">
+    Information for developers sorted by function</A>
+ <LI> <A HREF="calAllByFile.html" TARGET="_top">
+    Information for developers sorted by file</A>
+</UL>
+
+<HR>
+
+
+
+<HR>
+
+Last updated on 970711 20h11
+
+</BODY>
+</HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calDoc.txt
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calDoc.txt	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calDoc.txt	(revision 6)
@@ -0,0 +1,1482 @@
+The cal package
+
+Header CAL file for exported data structures and functions.
+
+Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)                Jagesh V. Sanghavi
+(sanghavi@eecs.berkeley.edu)
+
+**********************************************************************
+
+Cal_AssociationInit()          Creates or finds a variable association.
+
+Cal_AssociationQuit()          Deletes the variable association given by id
+
+Cal_AssociationSetCurrent()    Sets the current variable association to the
+                               one given by id and   returns the ID of the old
+                               association.
+
+Cal_BddAnd()                   Returns the BDD for logical AND of argument
+                               BDDs
+
+Cal_BddBetween()               Returns a minimal BDD whose function contains
+                               fMin and is   contained in fMax.
+
+Cal_BddCofactor()              Returns the generalized cofactor of BDD f with
+                               respect   to BDD c.
+
+Cal_BddCompose()               composition - substitute a BDD variable by a
+                               function
+
+Cal_BddDependsOn()             Returns 1 if f depends on var and returns 0
+                               otherwise.
+
+Cal_BddDumpBdd()               Write a BDD to a file
+
+Cal_BddDynamicReordering()     Specify dynamic reordering technique.
+
+Cal_BddElse()                  Returns the negative cofactor of the argument
+                               BDD with   respect to the top variable of the
+                               BDD.
+
+Cal_BddExists()                Returns the result of existentially quantifying
+                               some   variables from the given BDD.
+
+Cal_BddForAll()                Returns the result of universally quantifying
+                               some   variables from the given BDD.
+
+Cal_BddFree()                  Frees the argument BDD.
+
+Cal_BddFunctionPrint()         Prints the function implemented by the argument
+                               BDD
+
+Cal_BddFunctionProfileMultiple()
+                               Returns a "function profile" for fArray.
+
+Cal_BddFunctionProfile()       Returns a "function profile" for f.
+
+Cal_BddGetIfId()               Returns the id of the top variable of the
+                               argument BDD.
+
+Cal_BddGetIfIndex()            Returns the index of the top variable of the
+                               argument BDD.
+
+Cal_BddGetRegular()            Returns a BDD with positive from a given BDD
+                               with arbitrary phase
+
+Cal_BddITE()                   Returns the BDD for logical If-Then-Else
+                               Description [Returns the BDD for the logical
+                               operation IF f THEN g ELSE h   - f g + f' h
+
+Cal_BddIdentity()              Returns the duplicate BDD of the argument BDD.
+
+Cal_BddIf()                    Returns the BDD corresponding to the top
+                               variable of   the argument BDD.
+
+Cal_BddImplies()               Computes a BDD that implies conjunction of f
+                               and Cal_BddNot(g)
+
+Cal_BddIntersects()            Computes a BDD that implies conjunction of f
+                               and g.
+
+Cal_BddIsBddConst()            Returns 1 if the argument BDD is a constant, 0
+                               otherwise.
+
+Cal_BddIsBddNull()             Returns 1 if the argument BDD is NULL, 0
+                               otherwise.
+
+Cal_BddIsBddOne()              Returns 1 if the argument BDD is constant one,
+                               0 otherwise.
+
+Cal_BddIsBddZero()             Returns 1 if the argument BDD is constant zero,
+                               0 otherwise.
+
+Cal_BddIsCube()                Returns 1 if the argument BDD is a cube, 0
+                               otherwise
+
+Cal_BddIsEqual()               Returns 1 if argument BDDs are equal, 0
+                               otherwise.
+
+Cal_BddIsProvisional()         Returns 1, if the given user BDD contains
+                               provisional BDD node.
+
+Cal_BddManagerCreateNewVarAfter()
+                               Creates and returns a new variable after the
+                               specified one in   the variable  order.
+
+Cal_BddManagerCreateNewVarBefore()
+                               Creates and returns a new variable before the
+                               specified one in   the variable order.
+
+Cal_BddManagerCreateNewVarFirst()
+                               Creates and returns a new variable at the start
+                               of the variable   order.
+
+Cal_BddManagerCreateNewVarLast()
+                               Creates and returns a new variable at the end
+                               of the variable   order.
+
+Cal_BddManagerGC()             Invokes the garbage collection at the manager
+                               level.
+
+Cal_BddManagerGetHooks()       Returns the hooks field of the manager.
+
+Cal_BddManagerGetNumNodes()    Returns the number of BDD nodes
+
+Cal_BddManagerGetVarWithId()   Returns the variable with the specified id,
+                               null if no   such variable exists
+
+Cal_BddManagerGetVarWithIndex()
+                               Returns the variable with the specified index,
+                               null if no   such variable exists
+
+Cal_BddManagerInit()           Creates and initializes a new BDD manager.
+
+Cal_BddManagerQuit()           Frees the BDD manager and all the associated
+                               allocations
+
+Cal_BddManagerSetGCLimit()     Sets the limit of the garbage collection.
+
+Cal_BddManagerSetHooks()       Sets the hooks field of the manager.
+
+Cal_BddManagerSetParameters()  Sets appropriate fields of BDD Manager.
+
+Cal_BddMultiwayAnd()           Returns the BDD for logical AND of argument
+                               BDDs
+
+Cal_BddMultiwayOr()            Returns the BDD for logical OR of argument BDDs
+
+Cal_BddMultiwayXor()           Returns the BDD for logical XOR of argument
+                               BDDs
+
+Cal_BddNand()                  Returns the BDD for logical NAND of argument
+                               BDDs
+
+Cal_BddNewVarBlock()           Creates and returns a variable block used for
+                               controlling dynamic reordering.
+
+Cal_BddNodeLimit()             Sets the node limit to new_limit and returns
+                               the old limit.
+
+Cal_BddNor()                   Returns the BDD for logical NOR of argument
+                               BDDs
+
+Cal_BddNot()                   Returns the complement of the argument BDD.
+
+Cal_BddOne()                   Returns the BDD for the constant one
+
+Cal_BddOr()                    Returns the BDD for logical OR of argument BDDs
+
+Cal_BddOverflow()              Returns 1 if the node limit has been exceeded,
+                               0 otherwise. The   overflow flag is cleared.
+
+Cal_BddPairwiseAnd()           Returns an array of BDDs obtained by logical
+                               AND of BDD pairs   specified by an BDD array in
+                               which a BDD at an even location is paired with
+                               a BDD at an odd location of the array
+
+Cal_BddPairwiseOr()            Returns an array of BDDs obtained by logical OR
+                               of BDD pairs   specified by an BDD array in
+                               which a BDD at an even location is paired with
+                               a BDD at an odd location of the array
+
+Cal_BddPairwiseXor()           Returns an array of BDDs obtained by logical
+                               XOR of BDD pairs   specified by an BDD array in
+                               which a BDD at an even location is paired with
+                               a BDD at an odd location of the array
+
+Cal_BddPrintBdd()              Prints a BDD in the human readable form.
+
+Cal_BddPrintFunctionProfileMultiple()
+                               Cal_BddPrintFunctionProfileMultiple is like
+                               Cal_BddPrintFunctionProfile except for multiple
+                               BDDs
+
+Cal_BddPrintFunctionProfile()  Cal_BddPrintFunctionProfile is like
+                               Cal_BddPrintProfile except                it
+                               displays a function profile for f
+
+Cal_BddPrintProfileMultiple()  Cal_BddPrintProfileMultiple is like
+                               Cal_BddPrintProfile except                it
+                               displays the profile for a set of BDDs
+
+Cal_BddPrintProfile()          Displays the node profile for f on fp.
+                               lineLength specifies                 the
+                               maximum line length.  varNamingFn is as in
+                               Cal_BddPrintBdd.
+
+Cal_BddProfileMultiple()
+
+Cal_BddProfile()               Returns a "node profile" of f, i.e., the number
+                               of nodes at each   level in f.
+
+Cal_BddReduce()                Returns a BDD which agrees with f for all
+                               valuations   which satisfy c.
+
+Cal_BddRelProd()               Returns the result of taking the logical AND of
+                               the   argument BDDs and existentially
+                               quantifying some variables from the   product.
+
+Cal_BddReorder()               Invoke the current dynamic reodering method.
+
+Cal_BddSatisfySupport()        Returns a special cube contained in f.
+
+Cal_BddSatisfyingFraction()    Returns the fraction of valuations which make f
+                               true. (Note that   this fraction is independent
+                               of whatever set of variables f is supposed to
+                               be   a function of)
+
+Cal_BddSatisfy()               Returns a BDD which implies f, true for
+                               some valuation on which f is true, and which
+                               has at most                one node at each
+                               level
+
+Cal_BddSetGCMode()             Sets the garbage collection mode, 0 means the
+                               garbage   collection should be turned off, 1
+                               means garbage collection should   be on.
+
+Cal_BddSizeMultiple()          The routine is like Cal_BddSize, but takes a
+                               null-terminated                array of BDDs
+                               and accounts for sharing of nodes.
+
+Cal_BddSize()                  Returns the number of nodes in f when negout is
+                               nonzero. If   negout is zero, we pretend that
+                               the BDDs don't have negative-output pointers.
+
+Cal_BddStats()                 Prints miscellaneous BDD statistics
+
+Cal_BddSubstitute()            Substitute a set of variables by functions
+
+Cal_BddSupport()               returns the support of f as a null-terminated
+                               array of variables
+
+Cal_BddSwapVars()              Return a function obtained by swapping two
+                               variables
+
+Cal_BddThen()                  Returns the positive cofactor of the argument
+                               BDD with   respect to the top variable of the
+                               BDD.
+
+Cal_BddTotalSize()             Returns the number of nodes in the Unique table
+
+Cal_BddType()                  Returns type of a BDD ( 0, 1, +var, -var,
+                               ovrflow, nonterminal)
+
+Cal_BddUnFree()                Unfrees the argument BDD.
+
+Cal_BddUndumpBdd()             Reads a BDD from a file
+
+Cal_BddVarBlockReorderable()   Sets the reoderability of a particular block.
+
+Cal_BddVarSubstitute()         Substitute a set of variables by set of another
+                               variables.
+
+Cal_BddVars()                  Returns the number of BDD variables
+
+Cal_BddXnor()                  Returns the BDD for logical exclusive NOR of
+                               argument BDDs
+
+Cal_BddXor()                   Returns the BDD for logical exclusive OR of
+                               argument BDDs
+
+Cal_BddZero()                  Returns the BDD for the constant zero
+
+Cal_MemAllocation()            Returns the memory allocated.
+
+Cal_MemFatal()                 Prints an error message and exits.
+
+Cal_MemFreeBlock()             Frees the block.
+
+Cal_MemFreeRecMgr()            Frees all the storage associated with the
+                               specified record manager.
+
+Cal_MemFreeRec()               Frees a record managed by the indicated record
+                               manager.
+
+Cal_MemGetBlock()              Allocates a new block of the specified size.
+
+Cal_MemNewRecMgr()             Creates a new record manager with the given
+                               record size.
+
+Cal_MemNewRec()                Allocates a record from the specified record
+                               manager.
+
+Cal_MemResizeBlock()           Expands or contracts the block to a new size.
+                               We try to avoid moving the block if possible.
+
+Cal_PerformanceTest()          Main routine for testing performances of
+                               various routines.
+
+Cal_PipelineCreateProvisionalBdd()
+                               Create a provisional BDD in the pipeline.
+
+Cal_PipelineExecute()          Executes a pipeline.
+
+Cal_PipelineInit()             Initialize a BDD pipeline.
+
+Cal_PipelineQuit()             Resets the pipeline freeing all resources.
+
+Cal_PipelineSetDepth()         Set depth of a BDD pipeline.
+
+Cal_PipelineUpdateProvisionalBdd()
+                               Update a provisional Bdd obtained during
+                               pipelining.
+
+Cal_TempAssociationAugment()   Adds to the temporary variable association.
+
+Cal_TempAssociationInit()      Sets the temporary variable association.
+
+Cal_TempAssociationQuit()      Cleans up temporary association
+
+**********************************************************************
+
+
+
+int
+Cal_AssociationInit(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         associationInfoU
+  int               pairs
+)
+  Creates or finds a variable association. The association is specified by
+  associationInfo, which is a an array of BDD with Cal_BddNull(bddManager) as
+  the end marker. If pairs is 0, the array is assumed to be an array of
+  variables. In this case, each variable is paired with constant BDD one. Such
+  an association may viewed as specifying a set of variables for use with
+  routines such as Cal_BddExists. If pair is not 0, then the even numbered
+  array elements should be variables and the odd numbered elements should be
+  the BDDs which they are mapped to. In both cases, the return value is an
+  integer identifier for this association. If the given association is
+  equivalent to one which already exists, the same identifier is used for
+  both, and the reference count of the association is increased by one.
+
+  Side Effects: None
+
+void
+Cal_AssociationQuit(
+  Cal_BddManager    bddManager,
+  int               associationId
+)
+  Decrements the reference count of the variable association with identifier
+  id, and frees it if the reference count becomes zero.
+
+  Side Effects: None
+
+int
+Cal_AssociationSetCurrent(
+  Cal_BddManager    bddManager,
+  int               associationId
+)
+  Sets the current variable association to the one given by id and returns the
+  ID of the old association. An id of -1 indicates the temporary association
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddAnd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for logical AND of f and g
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddBetween(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fMinUserBdd,
+  Cal_Bdd           fMaxUserBdd
+)
+  Returns a minimal BDD f which is contains fMin and is contained in fMax (
+  fMin <= f <= fMax). This operation is typically used in state space searches
+  to simplify the representation for the set of states wich will be expanded
+  at each step (Rk Rk-1' <= f <= Rk).
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddCofactor(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           cUserBdd
+)
+  Returns the generalized cofactor of BDD f with respect to BDD c. The
+  constrain operator given by Coudert et al (ICCAD90) is used to find the
+  generalized cofactor.
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_BddCompose(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd,
+  Cal_Bdd           hUserBdd
+)
+  Returns the BDD obtained by substituting a variable by a function
+
+  Side Effects: None
+
+int
+Cal_BddDependsOn(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           varUserBdd
+)
+  Returns 1 if f depends on var and returns 0 otherwise.
+
+  Side Effects: None
+
+int
+Cal_BddDumpBdd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd *         userVars,
+  FILE *            fp
+)
+  Writes an encoded description of the BDD to the file given by fp. The
+  argument vars should be a null-terminated array of variables that include
+  the support of f . These variables need not be in order of increasing index.
+  The function returns a nonzero value if f was written to the file
+  successfully.
+
+  Side Effects: required
+
+void
+Cal_BddDynamicReordering(
+  Cal_BddManager    bddManager,
+  int               technique
+)
+  Selects the method for dynamic reordering.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddElse(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the negative cofactor of the argument BDD with respect to the top
+  variable of the BDD.
+
+  Side Effects: The reference count of the returned BDD is increased by 1.
+
+Cal_Bdd
+Cal_BddExists(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  Returns the BDD for f with all the variables that are paired with something
+  in the current variable association existentially quantified out.
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_BddForAll(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  Returns the BDD for f with all the variables that are paired with something
+  in the current variable association universally quantified out.
+
+  Side Effects: None.
+
+void
+Cal_BddFree(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Frees the argument BDD. It is an error to free a BDD more than once.
+
+  Side Effects: The reference count of the argument BDD is decreased by 1.
+
+void
+Cal_BddFunctionPrint(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd,
+  char *            name
+)
+  Prints the function implemented by the argument BDD
+
+  Side Effects: None
+
+void
+Cal_BddFunctionProfileMultiple(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         fUserBddArray,
+  long *            funcCounts
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddFunctionProfile(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  long *            funcCounts
+)
+  The nth entry of the function profile array is the number of subfunctions of
+  f which may be obtained by restricting the variables whose index is less
+  than n. An entry of zero indicates that f is independent of the variable
+  with the corresponding index.
+
+
+Cal_BddId_t
+Cal_BddGetIfId(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the id of the top variable of the argument BDD.
+
+  Side Effects: None
+
+Cal_BddId_t
+Cal_BddGetIfIndex(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the index of the top variable of the argument BDD.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddGetRegular(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns a BDD with positive from a given BDD with arbitrary phase
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_BddITE(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd,
+  Cal_Bdd           hUserBdd
+)
+  Returns the BDD for logical If-Then-Else Description [Returns the BDD for
+  the logical operation IF f THEN g ELSE h - f g + f' h
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddIdentity(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the duplicate BDD of the argument BDD.
+
+  Side Effects: The reference count of the BDD is increased by 1.
+
+Cal_Bdd
+Cal_BddIf(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the BDD corresponding to the top variable of the argument BDD.
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_BddImplies(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Computes a BDD that implies conjunction of f and Cal_BddNot(g)
+
+  Side Effects: none
+
+Cal_Bdd
+Cal_BddIntersects(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Computes a BDD that implies conjunction of f and g.
+
+  Side Effects: None
+
+int
+Cal_BddIsBddConst(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns 1 if the argument BDD is either constant one or constant zero,
+  otherwise returns 0.
+
+  Side Effects: None.
+
+int
+Cal_BddIsBddNull(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns 1 if the argument BDD is NULL, 0 otherwise.
+
+  Side Effects: None.
+
+int
+Cal_BddIsBddOne(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns 1 if the argument BDD is constant one, 0 otherwise.
+
+  Side Effects: None.
+
+int
+Cal_BddIsBddZero(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns 1 if the argument BDD is constant zero, 0 otherwise.
+
+  Side Effects: None.
+
+int
+Cal_BddIsCube(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  Returns 1 if the argument BDD is a cube, 0 otherwise
+
+  Side Effects: None
+
+int
+Cal_BddIsEqual(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd1,
+  Cal_Bdd           userBdd2
+)
+  Returns 1 if argument BDDs are equal, 0 otherwise.
+
+  Side Effects: None.
+
+int
+Cal_BddIsProvisional(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns 1, if the given user BDD contains provisional BDD node.
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_BddManagerCreateNewVarAfter(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Creates and returns a new variable after the specified one in the variable
+  order.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddManagerCreateNewVarBefore(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Creates and returns a new variable before the specified one in the variable
+  order.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddManagerCreateNewVarFirst(
+  Cal_BddManager    bddManager
+)
+  Creates and returns a new variable at the start of the variable order.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddManagerCreateNewVarLast(
+  Cal_BddManager    bddManager
+)
+  Creates and returns a new variable at the end of the variable order.
+
+  Side Effects: None
+
+int
+Cal_BddManagerGC(
+  Cal_BddManager    bddManager
+)
+  For each variable in the increasing id free nodes with reference count equal
+  to zero freeing a node results in decrementing reference count of then and
+  else nodes by one.
+
+  Side Effects: None.
+
+void *
+Cal_BddManagerGetHooks(
+  Cal_BddManager    bddManager
+)
+  Returns the hooks field of the manager.
+
+  Side Effects: None
+
+unsigned long
+Cal_BddManagerGetNumNodes(
+  Cal_BddManager    bddManager
+)
+  Returns the number of BDD nodes
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddManagerGetVarWithId(
+  Cal_BddManager    bddManager,
+  Cal_BddId_t       id
+)
+  Returns the variable with the specified id, null if no such variable exists
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddManagerGetVarWithIndex(
+  Cal_BddManager    bddManager,
+  Cal_BddIndex_t    index
+)
+  Returns the variable with the specified index, null if no such variable
+  exists
+
+  Side Effects: None
+
+Cal_BddManager
+Cal_BddManagerInit(
+
+)
+  Initializes and allocates fields of the BDD manager. Some of the fields are
+  initialized for maxNumVars+1 or numVars+1, whereas some of them are
+  initialized for maxNumVars or numVars. The first kind of fields are
+  associated with the id of a variable and the second ones are with the index
+  of the variable.
+
+  Side Effects: None
+
+int
+Cal_BddManagerQuit(
+  Cal_BddManager    bddManager
+)
+  Frees the BDD manager and all the associated allocations
+
+  Side Effects: None
+
+void
+Cal_BddManagerSetGCLimit(
+  Cal_BddManager    manager
+)
+  It tries to set the limit at twice the number of nodes in the manager at the
+  current point. However, the limit is not allowed to fall below the
+  MIN_GC_LIMIT or to exceed the value of node limit (if one exists).
+
+  Side Effects: None.
+
+void
+Cal_BddManagerSetHooks(
+  Cal_BddManager    bddManager,
+  void *            hooks
+)
+  Sets the hooks field of the manager.
+
+  Side Effects: Hooks field changes.
+
+void
+Cal_BddManagerSetParameters(
+  Cal_BddManager    bddManager,
+  long              reorderingThresh
+  long              maxForwardedNode
+  double            repackAfterGCThr
+  double            tableRepackThres
+)
+  This function is used to set the parameters which are used to control the
+  reordering process. "reorderingThreshold" determines the number of nodes
+  below which reordering will NOT be invoked, "maxForwardedNodes" determines
+  the maximum number of forwarded nodes which are allowed (at that point the
+  cleanup must be done), and "repackingThreshold" determines the fraction of
+  the page utilized below which repacking has to be invoked. These parameters
+  have different affect on the computational and memory usage aspects of
+  reordeing. For instance, higher value of "maxForwardedNodes" will result in
+  process consuming more memory, and a lower value on the other hand would
+  invoke the cleanup process repeatedly resulting in increased computation.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddMultiwayAnd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBddArray
+)
+  Returns the BDD for logical AND of set of BDDs in the bddArray
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddMultiwayOr(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBddArray
+)
+  Returns the BDD for logical OR of set of BDDs in the bddArray
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddMultiwayXor(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBddArray
+)
+  Returns the BDD for logical XOR of set of BDDs in the bddArray
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddNand(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for logical NAND of f and g
+
+  Side Effects: None
+
+Cal_Block
+Cal_BddNewVarBlock(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           variable,
+  long              length
+)
+  The block is specified by passing the first variable and the length of the
+  block. The "length" number of consecutive variables starting from "variable"
+  are put in the block.
+
+  Side Effects: A new block is created.
+
+long
+Cal_BddNodeLimit(
+  Cal_BddManager    bddManager,
+  long              newLimit
+)
+  Sets the node limit to new_limit and returns the old limit.
+
+  Side Effects: Threshold for garbage collection may change
+
+Cal_Bdd
+Cal_BddNor(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for logical NOR of f and g
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddNot(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the complement of the argument BDD.
+
+  Side Effects: The reference count of the argument BDD is increased by 1.
+
+Cal_Bdd
+Cal_BddOne(
+  Cal_BddManager    bddManager
+)
+  Returns the BDD for the constant one
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddOr(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for logical OR of f and g
+
+  Side Effects: None
+
+int
+Cal_BddOverflow(
+  Cal_BddManager    bddManager
+)
+  Returns 1 if the node limit has been exceeded, 0 otherwise. The overflow
+  flag is cleared.
+
+  Side Effects: None
+
+Cal_Bdd *
+Cal_BddPairwiseAnd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBddArray
+)
+  Returns an array of BDDs obtained by logical AND of BDD pairs specified by
+  an BDD array in which a BDD at an even location is paired with a BDD at an
+  odd location of the array
+
+  Side Effects: None
+
+Cal_Bdd *
+Cal_BddPairwiseOr(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBddArray
+)
+  Returns an array of BDDs obtained by logical OR of BDD pairs specified by an
+  BDD array in which a BDD at an even location is paired with a BDD at an odd
+  location of the array
+
+  Side Effects: None
+
+Cal_Bdd *
+Cal_BddPairwiseXor(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBddArray
+)
+  Returns an array of BDDs obtained by logical XOR of BDD pairs specified by
+  an BDD array in which a BDD at an even location is paired with a BDD at an
+  odd location of the array
+
+  Side Effects: None
+
+void
+Cal_BddPrintBdd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_VarNamingFn_t VarNamingFn,
+  Cal_TerminalIdFn_ TerminalIdFn,
+  Cal_Pointer_t     env,
+  FILE *            fp
+)
+  Prints a human-readable representation of the BDD f to the file given by fp.
+  The namingFn should be a pointer to a function taking a bddManager, a BDD
+  and the pointer given by env. This function should return either a null
+  pointer or a srting that is the name of the supplied variable. If it returns
+  a null pointer, a default name is generated based on the index of the
+  variable. It is also legal for naminFN to e null; in this case, default
+  names are generated for all variables. The macro bddNamingFnNone is a null
+  pointer of suitable type. terminalIdFn should be apointer to a function
+  taking a bddManager and two longs. plus the pointer given by the env. It
+  should return either a null pointer. If it returns a null pointer, or if
+  terminalIdFn is null, then default names are generated for the terminals.
+  The macro bddTerminalIdFnNone is a null pointer of suitable type.
+
+  Side Effects: None.
+
+void
+Cal_BddPrintFunctionProfileMultiple(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBdds,
+  Cal_VarNamingFn_t varNamingProc,
+  char *            env,
+  int               lineLength,
+  FILE *            fp
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddPrintFunctionProfile(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           f,
+  Cal_VarNamingFn_t varNamingProc,
+  char *            env,
+  int               lineLength,
+  FILE *            fp
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddPrintProfileMultiple(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userBdds,
+  Cal_VarNamingFn_t varNamingProc,
+  char *            env,
+  int               lineLength,
+  FILE *            fp
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddPrintProfile(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_VarNamingFn_t varNamingProc,
+  char *            env,
+  int               lineLength,
+  FILE *            fp
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddProfileMultiple(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         fUserBddArray,
+  long *            levelCounts,
+  int               negout
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddProfile(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  long *            levelCounts,
+  int               negout
+)
+  negout is as in Cal_BddSize. levelCounts should be an array of size
+  Cal_BddVars(bddManager)+1 to hold the profile.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddReduce(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           cUserBdd
+)
+  Returns a BDD which agrees with f for all valuations which satisfy c. The
+  result is usually smaller in terms of number of BDD nodes than f. This
+  operation is typically used in state space searches to simplify the
+  representation for the set of states wich will be expanded at each step.
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddRelProd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for the logical AND of f and g with all the variables that
+  are paired with something in the current variable association existentially
+  quantified out.
+
+  Side Effects: None.
+
+void
+Cal_BddReorder(
+  Cal_BddManager    bddManager
+)
+  Invoke the current dynamic reodering method.
+
+  Side Effects: Index of a variable may change due to reodering
+
+Cal_Bdd
+Cal_BddSatisfySupport(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  The returned BDD which implies f, is true for some valuation on which f is
+  true, which has at most one node at each level, and which has exactly one
+  node corresponding to each variable which is associated with something in
+  the current variable association.
+
+  Side Effects: required
+
+double
+Cal_BddSatisfyingFraction(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  optional
+
+  Side Effects: required
+
+Cal_Bdd
+Cal_BddSatisfy(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  optional
+
+  Side Effects: required
+
+void
+Cal_BddSetGCMode(
+  Cal_BddManager    bddManager,
+  int               gcMode
+)
+  Sets the garbage collection mode, 0 means the garbage collection should be
+  turned off, 1 means garbage collection should be on.
+
+  Side Effects: None.
+
+long
+Cal_BddSizeMultiple(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         fUserBddArray,
+  int               negout
+)
+  optional
+
+  Side Effects: None
+
+long
+Cal_BddSize(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  int               negout
+)
+  optional
+
+  Side Effects: None
+
+void
+Cal_BddStats(
+  Cal_BddManager    bddManager,
+  FILE *            fp
+)
+  Prints miscellaneous BDD statistics
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddSubstitute(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  Returns a BDD for f using the substitution defined by current variable
+  association. Each variable is replaced by its associated BDDs. The
+  substitution is effective simultaneously
+
+  Side Effects: None
+
+void
+Cal_BddSupport(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd *         support
+)
+  optional
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddSwapVars(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd,
+  Cal_Bdd           hUserBdd
+)
+  Returns the BDD obtained by simultaneously substituting variable g by
+  variable h and variable h and variable g in the BDD f
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddThen(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Returns the positive cofactor of the argument BDD with respect to the top
+  variable of the BDD.
+
+  Side Effects: The reference count of the returned BDD is increased by 1.
+
+unsigned long
+Cal_BddTotalSize(
+  Cal_BddManager    bddManager
+)
+  Returns the number of nodes in the Unique table
+
+  Side Effects: None
+
+int
+Cal_BddType(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  Returns BDD_TYPE_ZERO if f is false, BDD_TYPE_ONE if f is true,
+  BDD_TYPE_POSVAR is f is an unnegated variable, BDD_TYPE_NEGVAR if f is a
+  negated variable, BDD_TYPE_OVERFLOW if f is null, and BDD_TYPE_NONTERMINAL
+  otherwise.
+
+  Side Effects: None
+
+void
+Cal_BddUnFree(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           userBdd
+)
+  Unfrees the argument BDD. It is an error to pass a BDD with reference count
+  of zero to be unfreed.
+
+  Side Effects: The reference count of the argument BDD is increased by 1.
+
+Cal_Bdd
+Cal_BddUndumpBdd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         userVars,
+  FILE *            fp,
+  int *             error
+)
+  Loads an encoded description of a BDD from the file given by fp. The
+  argument vars should be a null terminated array of variables that will
+  become the support of the BDD. As in Cal_BddDumpBdd, these need not be in
+  the order of increasing index. If the same array of variables in used in
+  dumping and undumping, the BDD returned will be equal to the one that was
+  dumped. More generally, if array v1 is used when dumping, and the array v2
+  is used when undumping, the BDD returned will be equal to the original BDD
+  with the ith variable in v2 substituted for the ith variable in v1 for all
+  i. Null BDD is returned in the operation fails for reason (node limit
+  reached, I/O error, invalid file format, etc.). In this case, an error code
+  is stored in error. the code will be one of the following.
+  CAL_BDD_UNDUMP_FORMAT Invalid file format CAL_BDD_UNDUMP_OVERFLOW Node limit
+  exceeded CAL_BDD_UNDUMP_IOERROR File I/O error CAL_BDD_UNDUMP_EOF Unexpected
+  EOF
+
+  Side Effects: required
+
+void
+Cal_BddVarBlockReorderable(
+  Cal_BddManager    bddManager,
+  Cal_Block         block,
+  int               reorderable
+)
+  If a block is reorderable, the child blocks are recursively involved in
+  swapping.
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_BddVarSubstitute(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd
+)
+  Returns a BDD for f using the substitution defined by current variable
+  association. It is assumed that each variable is replaced by another
+  variable. For the substitution of a variable by a function, use
+  Cal_BddSubstitute instead.
+
+  Side Effects: None
+
+long
+Cal_BddVars(
+  Cal_BddManager    bddManager
+)
+  Returns the number of BDD variables
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddXnor(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for logical exclusive NOR of f and g
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddXor(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  Returns the BDD for logical exclusive OR of f and g
+
+  Side Effects: None
+
+Cal_Bdd
+Cal_BddZero(
+  Cal_BddManager    bddManager
+)
+  Returns the BDD for the constant zero
+
+  Side Effects: None
+
+Cal_Address_t
+Cal_MemAllocation(
+
+)
+  Returns the memory allocated.
+
+  Side Effects: required
+
+void
+Cal_MemFatal(
+  char *            message
+)
+  Prints an error message and exits.
+
+  Side Effects: required
+
+void
+Cal_MemFreeBlock(
+  Cal_Pointer_t     p
+)
+  Frees the block.
+
+  Side Effects: required
+
+void
+Cal_MemFreeRecMgr(
+  Cal_RecMgr        mgr
+)
+  Frees all the storage associated with the specified record manager.
+
+  Side Effects: required
+
+void
+Cal_MemFreeRec(
+  Cal_RecMgr        mgr,
+  Cal_Pointer_t     rec
+)
+  Frees a record managed by the indicated record manager.
+
+  Side Effects: required
+
+Cal_Pointer_t
+Cal_MemGetBlock(
+  Cal_Address_t     size
+)
+  Allocates a new block of the specified size.
+
+  Side Effects: required
+
+Cal_RecMgr
+Cal_MemNewRecMgr(
+  int               size
+)
+  Creates a new record manager with the given record size.
+
+  Side Effects: required
+
+Cal_Pointer_t
+Cal_MemNewRec(
+  Cal_RecMgr        mgr
+)
+  Allocates a record from the specified record manager.
+
+  Side Effects: required
+
+Cal_Pointer_t
+Cal_MemResizeBlock(
+  Cal_Pointer_t     p,
+  Cal_Address_t     newSize
+)
+  Expands or contracts the block to a new size. We try to avoid moving the
+  block if possible.
+
+  Side Effects: required
+
+int
+Cal_PerformanceTest(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         outputBddArray,
+  int               numFunctions,
+  int               iteration,
+  int               seed,
+  int               andPerformanceFl
+  int               multiwayPerforma
+  int               onewayPerformanc
+  int               quantifyPerforma
+  int               composePerforman
+  int               relprodPerforman
+  int               swapPerformanceF
+  int               substitutePerfor
+  int               sanityCheckFlag,
+  int               computeMemoryOve
+  int               superscalarFlag
+)
+  optional
+
+  Side Effects: required
+
+Cal_Bdd
+Cal_PipelineCreateProvisionalBdd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           fUserBdd,
+  Cal_Bdd           gUserBdd
+)
+  The provisional BDD is automatically freed once the pipeline is quitted.
+
+
+int
+Cal_PipelineExecute(
+  Cal_BddManager    bddManager
+)
+  All the results are computed. User should update the BDDs of interest.
+  Eventually this feature would become transparent.
+
+  Side Effects: required
+
+int
+Cal_PipelineInit(
+  Cal_BddManager    bddManager,
+  Cal_BddOp_t       bddOp
+)
+  All the operations for this pipeline must be of the same kind.
+
+  Side Effects: None.
+
+void
+Cal_PipelineQuit(
+  Cal_BddManager    bddManager
+)
+  The user must make sure to update all provisional BDDs of interest before
+  calling this routine.
+
+
+void
+Cal_PipelineSetDepth(
+  Cal_BddManager    bddManager,
+  int               depth
+)
+  The "depth" determines the amount of dependency we would allow in pipelined
+  computation.
+
+  Side Effects: None.
+
+Cal_Bdd
+Cal_PipelineUpdateProvisionalBdd(
+  Cal_BddManager    bddManager,
+  Cal_Bdd           provisionalBdd
+)
+  The provisional BDD is automatically freed after quitting pipeline.
+
+
+void
+Cal_TempAssociationAugment(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         associationInfoU
+  int               pairs
+)
+  Pairs is 0 if the information represents only a list of variables rather
+  than a full association.
+
+  Side Effects: None
+
+void
+Cal_TempAssociationInit(
+  Cal_BddManager    bddManager,
+  Cal_Bdd *         associationInfoU
+  int               pairs
+)
+  Pairs is 0 if the information represents only a list of variables rather
+  than a full association.
+
+  Side Effects: None
+
+void
+Cal_TempAssociationQuit(
+  Cal_BddManager    bddManager
+)
+  Cleans up temporary associationoptional
+
+  Side Effects: None
+
Index: /vis_dev/glu-2.1/src/calBdd/calDump.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calDump.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calDump.c	(revision 6)
@@ -0,0 +1,628 @@
+/**CFile***********************************************************************
+
+  FileName    [calDump.c]
+
+  PackageName [cal]
+
+  Synopsis    [BDD library dump/undump routines]
+              
+
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.
+              ] 
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calDump.c,v 1.1.1.3 1998/05/04 00:58:56 hsv Exp $]
+
+******************************************************************************/
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+#define MAGIC_COOKIE 0x5e02f795l
+#define CAL_BDD_IOERROR 100
+
+#define TRUE_ENCODING 0xffffff00l
+#define FALSE_ENCODING 0xffffff01l
+#define POSVAR_ENCODING 0xffffff02l
+#define NEGVAR_ENCODING 0xffffff03l
+#define POSNODE_ENCODING 0xffffff04l
+#define NEGNODE_ENCODING 0xffffff05l
+#define NODELABEL_ENCODING 0xffffff06l
+#define CONSTANT_ENCODING 0xffffff07l
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+static long indexMask[] = {0xffl, 0xffffl, 0xffffffl};
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void Write(Cal_BddManager_t * bddManager, unsigned long n, int bytes, FILE * fp);
+static void BddDumpBddStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, FILE * fp, CalHashTable_t * h, Cal_BddIndex_t * normalizedIndexes, int indexSize, int nodeNumberSize);
+static unsigned long Read(int * error, int bytes, FILE * fp);
+static Cal_Bdd_t BddUndumpBddStep(Cal_BddManager_t * bddManager, Cal_Bdd_t * vars, FILE * fp, Cal_BddIndex_t numberVars, Cal_Bdd_t * shared, long numberShared, long * sharedSoFar, int indexSize, int nodeNumberSize, int * error);
+static int BytesNeeded(long n);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Reads a BDD from a file]
+
+  Description [Loads an encoded description of a BDD from the file given by
+  fp. The argument vars should be a null terminated array of variables that will
+  become the support of the BDD. As in Cal_BddDumpBdd, these need not be in
+  the order of increasing index. If the same array of variables in used in 
+  dumping and undumping, the BDD returned will be equal to the one that was 
+  dumped. More generally, if array v1 is used when dumping, and the array v2
+  is used when undumping, the BDD returned will be equal to the original BDD
+  with the ith variable in v2 substituted for the ith variable in v1 for all i.
+  Null BDD is returned in the operation fails for reason (node limit reached,
+  I/O error, invalid file format, etc.). In this case, an error code is stored
+  in error. the code will be one of the following. 
+  CAL_BDD_UNDUMP_FORMAT Invalid file format
+  CAL_BDD_UNDUMP_OVERFLOW Node limit exceeded
+  CAL_BDD_UNDUMP_IOERROR File I/O error
+  CAL_BDD_UNDUMP_EOF Unexpected EOF]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddUndumpBdd(
+  Cal_BddManager bddManager,
+  Cal_Bdd * userVars,
+  FILE * fp,
+  int * error)
+{
+  long i,j;
+  Cal_BddIndex_t numberVars;
+  long numberShared;
+  int indexSize;
+  int nodeNumberSize;
+  Cal_Bdd_t *shared;
+  long sharedSoFar;
+  Cal_Bdd_t v;
+  Cal_Bdd_t result;
+  Cal_Bdd_t *vars;
+
+  *error = 0;
+  for(i = 0; userVars[i]; ++i){
+    if(Cal_BddType(bddManager, userVars[i]) !=  CAL_BDD_TYPE_POSVAR){
+      CalBddWarningMessage("Cal_BddUndumpBdd: support is not all positive variables"); 
+      return (Cal_Bdd) 0;
+    }
+  }
+  vars = Cal_MemAlloc(Cal_Bdd_t, i);
+  for (j=0; j < i; j++){
+    vars[j] = CalBddGetInternalBdd(bddManager,userVars[j]);
+  }
+
+  if(Read(error, sizeof(long), fp) !=  MAGIC_COOKIE){
+    if(!*error){
+      *error = CAL_BDD_UNDUMP_FORMAT;
+    }
+    Cal_MemFree(vars);
+    return (Cal_Bdd) 0;
+  }
+  numberVars = Read(error, sizeof(Cal_BddIndex_t), fp);
+  if(*error){
+    Cal_MemFree(vars);
+    return (Cal_Bdd) 0;
+  }
+  if(numberVars !=  i){
+    *error = CAL_BDD_UNDUMP_FORMAT;
+    Cal_MemFree(vars);
+    return (Cal_Bdd) 0;
+  }
+  numberShared = Read(error, sizeof(long), fp);
+  if(*error){
+    Cal_MemFree(vars);
+    return (Cal_Bdd) 0;
+  }
+  indexSize = BytesNeeded(numberVars+1);
+  nodeNumberSize = BytesNeeded(numberShared);
+  if(numberShared < 0){
+    *error = CAL_BDD_UNDUMP_FORMAT;
+    Cal_MemFree(vars);
+    return (Cal_Bdd) 0;
+  }
+  shared = Cal_MemAlloc(Cal_Bdd_t, numberShared);
+  for(i = 0; i < numberShared; ++i){
+    shared[i] = CalBddNull(bddManager);
+  }
+  sharedSoFar = 0;
+  result = BddUndumpBddStep(bddManager, vars, fp, numberVars, shared,
+      numberShared, &sharedSoFar, indexSize, nodeNumberSize, error);
+  Cal_MemFree(vars);
+  
+  for(i = 0; i < numberShared; ++i){
+    v = shared[i];
+    if(!CalBddIsBddNull(bddManager, v)){
+      CalBddFree(v);
+    }
+  }
+  if(!*error && sharedSoFar !=  numberShared){
+    *error = CAL_BDD_UNDUMP_FORMAT;
+  }
+  Cal_MemFree(shared);
+  if(*error){
+    if(!CalBddIsBddNull(bddManager, result)){
+      CalBddFree(result);
+    }
+    return (Cal_Bdd) 0;
+  }
+  /*
+   * Decrement the reference count of result by 1. Since it has
+   * already been incremented in BddUndumpBddStep.
+   */
+  CalBddDcrRefCount(result);
+  return CalBddGetExternalBdd(bddManager, result);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Write a BDD to a file]
+
+  Description [Writes an encoded description of the BDD to the file given by fp.
+  The argument vars should be a null-terminated array of variables that include
+  the support of f .  These variables need not be in order of increasing index.
+  The function returns a nonzero value if f was written to the file successfully.
+  ]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+Cal_BddDumpBdd(
+  Cal_BddManager bddManager,
+  Cal_Bdd  fUserBdd,
+  Cal_Bdd * userVars,
+  FILE * fp)
+{
+  long i;
+  Cal_BddIndex_t *normalizedIndexes;
+  Cal_BddIndex_t vIndex;
+  Cal_Bdd_t f;
+  Cal_BddIndex_t numberVars;
+  Cal_Bdd *support;
+  int ok;
+  CalHashTable_t *h;
+  int indexSize;
+  long next;
+  int nodeNumberSize;
+
+  if(CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    for(i = 0; userVars[i]; ++i){
+      if(Cal_BddType(bddManager, userVars[i]) !=  CAL_BDD_TYPE_POSVAR){
+        CalBddWarningMessage("Cal_BddDumpBdd: support is not all positive variables");
+        return (0);
+      }
+    }
+    normalizedIndexes = Cal_MemAlloc(Cal_BddIndex_t, bddManager->numVars);
+    for(i = 0; i < bddManager->numVars; ++i){
+      normalizedIndexes[i] = CAL_BDD_CONST_INDEX;
+    }
+    for(i = 0; userVars[i]; ++i){
+      vIndex = Cal_BddGetIfIndex(bddManager, userVars[i]);
+      if(normalizedIndexes[vIndex] !=  CAL_BDD_CONST_INDEX){
+        CalBddWarningMessage("Cal_BddDumpBdd: variables duplicated in support");
+        Cal_MemFree(normalizedIndexes);
+        return 0;
+      }
+      normalizedIndexes[vIndex] = i;
+    }
+    numberVars = i;
+    support = Cal_MemAlloc(Cal_Bdd, bddManager->numVars+1);
+    Cal_BddSupport(bddManager, fUserBdd, support);
+    ok = 1;
+    for(i = 0; ok && support[i]; ++i){
+      if(normalizedIndexes[Cal_BddGetIfIndex(bddManager, support[i])] == CAL_BDD_CONST_INDEX){
+        CalBddWarningMessage("Cal_BddDumpBdd: incomplete support specified");
+        ok = 0;
+      }
+    }
+    if(!ok){
+      Cal_MemFree(normalizedIndexes);
+      Cal_MemFree(support);
+      return 0;
+    }
+    Cal_MemFree(support);
+    /* Everything checked now; barring I/O errors, we should be able to */
+    /* Write a valid output file. */
+    f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    h = CalHashTableOneInit(bddManager, sizeof(long));
+    indexSize = BytesNeeded(numberVars+1);
+    CalBddMarkSharedNodes(bddManager, f);
+    next = 0;
+    CalBddNumberSharedNodes(bddManager, f, h, &next);
+    nodeNumberSize = BytesNeeded(next);
+    Write(bddManager, MAGIC_COOKIE, sizeof(long), fp);
+    Write(bddManager, (unsigned long)numberVars, sizeof(Cal_BddIndex_t), fp);
+    Write(bddManager, (unsigned long)next, sizeof(long), fp);
+    BddDumpBddStep(bddManager, f, fp, h, normalizedIndexes, indexSize, nodeNumberSize);
+    CalHashTableOneQuit(h);
+    Cal_MemFree(normalizedIndexes);
+    return (1);
+  }
+  return (0);
+}
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+Write(
+  Cal_BddManager_t * bddManager,
+  unsigned long  n,
+  int  bytes,
+  FILE * fp)
+{
+  while(bytes){
+    if(fputc((char)(n >> (8*(bytes-1)) & 0xff), fp) == EOF){
+    }
+    --bytes;
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddDumpBddStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  FILE * fp,
+  CalHashTable_t * h,
+  Cal_BddIndex_t * normalizedIndexes,
+  int  indexSize,
+  int  nodeNumberSize)
+{
+  int negated;
+  long *number;
+  Cal_Bdd_t thenBdd, elseBdd;
+
+  switch(CalBddTypeAux(bddManager, f)){
+  case CAL_BDD_TYPE_ZERO:
+    Write(bddManager, FALSE_ENCODING, indexSize+1, fp);
+    break;
+  case CAL_BDD_TYPE_ONE:
+    Write(bddManager, TRUE_ENCODING, indexSize+1, fp);
+    break;
+  case CAL_BDD_TYPE_CONSTANT:
+    Write(bddManager, CONSTANT_ENCODING, indexSize+1, fp);
+#ifdef JAGESH
+    Write(bddManager, (unsigned long)BDD_DATA(f)[0], sizeof(long), fp);
+    Write(bddManager, (unsigned long)BDD_DATA(f)[1], sizeof(long), fp);
+#endif
+    break;
+  case CAL_BDD_TYPE_POSVAR:
+    Write(bddManager, POSVAR_ENCODING, indexSize+1, fp);
+    Write(bddManager,
+        (unsigned long)normalizedIndexes[CalBddGetBddIndex(bddManager, f)],
+        indexSize, fp);
+    break;
+  case CAL_BDD_TYPE_NEGVAR:
+    Write(bddManager, NEGVAR_ENCODING, indexSize+1, fp);
+    Write(bddManager, 
+        (unsigned long)normalizedIndexes[CalBddGetBddIndex(bddManager, f)],
+        indexSize, fp);
+    break;
+  case CAL_BDD_TYPE_NONTERMINAL:
+    CalBddNot(f, f);
+    if(CalHashTableOneLookup(h, f, (char **)0)){
+      negated  =  1;
+    }
+    else{
+      CalBddNot(f, f);
+      negated = 0;
+    }
+    CalHashTableOneLookup(h, f, (char **)&number);
+    if(number && *number < 0){
+	  if(negated)
+	    Write(bddManager, NEGNODE_ENCODING, indexSize+1, fp);
+	  else
+	    Write(bddManager, POSNODE_ENCODING, indexSize+1, fp);
+	  Write(bddManager, (unsigned long)(-*number-1), nodeNumberSize, fp);
+    }
+    else{
+      if(number){
+	      Write(bddManager, NODELABEL_ENCODING, indexSize+1, fp);
+	      *number =  -*number-1;
+      }
+      Write(bddManager,
+          (unsigned long)normalizedIndexes[CalBddGetBddIndex(bddManager, f)],
+          indexSize, fp);
+      CalBddGetThenBdd(f, thenBdd);
+      BddDumpBddStep(bddManager, thenBdd, fp, h, normalizedIndexes,
+          indexSize, nodeNumberSize);
+      CalBddGetElseBdd(f, elseBdd);
+      BddDumpBddStep(bddManager, elseBdd, fp, h, normalizedIndexes,
+          indexSize, nodeNumberSize);
+    }
+    break;
+  default:
+    CalBddFatalMessage("BddDumpBddStep: unknown type returned by CalBddType");
+  }
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static unsigned long
+Read(
+  int * error,
+  int  bytes,
+  FILE * fp)
+{
+  int c;
+  long result;
+
+  result = 0;
+  if(*error){
+    return (result);
+  }
+  while(bytes){
+    c = fgetc(fp);
+    if(c == EOF){
+      if(ferror(fp)){
+        *error = CAL_BDD_UNDUMP_IOERROR;
+      }
+      else{
+        *error = CAL_BDD_UNDUMP_EOF;
+      }
+      return (0l);
+    }
+    result = (result << 8)+c;
+    --bytes;
+  } 
+  return (result);
+}
+
+
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddUndumpBddStep(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t * vars,
+  FILE * fp,
+  Cal_BddIndex_t  numberVars,
+  Cal_Bdd_t * shared,
+  long  numberShared,
+  long * sharedSoFar,
+  int  indexSize,
+  int  nodeNumberSize,
+  int * error)
+{
+  long nodeNumber;
+  long encoding;
+  Cal_BddIndex_t i;
+  CalAddress_t value1, value2;
+  Cal_Bdd_t v;
+  Cal_Bdd_t temp1, temp2;
+  Cal_Bdd_t result;
+
+  i = Read(error, indexSize, fp);
+  if(*error){
+    return CalBddNull(bddManager);
+  }
+  if(i == indexMask[indexSize-1]){
+    encoding = 0xffffff00l+Read(error, 1, fp);
+    if(*error){
+      return CalBddNull(bddManager);
+    }
+    switch(encoding){
+    case TRUE_ENCODING:
+      return (CalBddOne(bddManager));
+    case FALSE_ENCODING:
+      return (CalBddZero(bddManager));
+    case CONSTANT_ENCODING:
+      value1 = Read(error, sizeof(long), fp);
+      value2 = Read(error, sizeof(long), fp);
+      if(*error){
+        return CalBddNull(bddManager);
+      }
+      *error = CAL_BDD_UNDUMP_OVERFLOW;
+      return CalBddNull(bddManager);
+    case POSVAR_ENCODING:
+    case NEGVAR_ENCODING:
+      i = Read(error, indexSize, fp);
+      if(!*error && i >=  numberVars){
+        *error = CAL_BDD_UNDUMP_FORMAT;
+      }
+      if(*error){
+        return CalBddNull(bddManager);
+      }
+      v = vars[i];
+      if(encoding == POSVAR_ENCODING){
+        return (v);
+      }
+      else{
+        CalBddNot(v, v);
+        return (v);
+      }
+    case POSNODE_ENCODING:
+    case NEGNODE_ENCODING:
+      nodeNumber = Read(error, nodeNumberSize, fp);
+      if(!*error && (nodeNumber >=  numberShared ||
+          CalBddIsBddNull(bddManager, shared[nodeNumber]))){
+        *error = CAL_BDD_UNDUMP_FORMAT;
+      }
+      if(*error){
+        return CalBddNull(bddManager);
+      }
+      v = shared[nodeNumber];
+      v = CalBddIdentity(bddManager, v);
+      if(encoding == POSNODE_ENCODING){
+        return (v);
+      }
+      else{
+        CalBddNot(v, v);
+        return (v);
+      }
+    case NODELABEL_ENCODING:
+      nodeNumber =  *sharedSoFar;
+      ++*sharedSoFar;
+      v = BddUndumpBddStep(bddManager, vars, fp, numberVars, shared,
+          numberShared, sharedSoFar, indexSize, nodeNumberSize, error);
+      shared[nodeNumber] = v;
+      v = CalBddIdentity(bddManager, v);
+      return (v);
+    default:
+      *error = CAL_BDD_UNDUMP_FORMAT;
+      return CalBddNull(bddManager);
+    }
+  }
+  if(i >= numberVars){
+    *error = CAL_BDD_UNDUMP_FORMAT;
+    return CalBddNull(bddManager);
+  }
+  temp1 = BddUndumpBddStep(bddManager, vars, fp, numberVars, shared,
+       numberShared, sharedSoFar, indexSize, nodeNumberSize, error);
+  temp2 = BddUndumpBddStep(bddManager, vars, fp, numberVars, shared,
+       numberShared, sharedSoFar, indexSize, nodeNumberSize, error);
+  if(*error){
+      CalBddFree(temp1);
+      return CalBddNull(bddManager);
+  }
+  result = CalBddITE(bddManager, vars[i], temp1, temp2);
+  CalBddFree(temp1);
+  CalBddFree(temp2);
+  if(CalBddIsBddNull(bddManager, result)){
+     *error = CAL_BDD_UNDUMP_OVERFLOW;
+  }
+  return (result);
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+BytesNeeded(
+  long  n)
+{
+  if(n <= 0x100l){
+    return (1);
+  }
+  if(n <= 0x10000l){
+    return (2);
+  }
+  if(n <= 0x1000000l){
+    return (3);
+  }
+  return (4);
+}
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calExt.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calExt.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calExt.html	(revision 6)
@@ -0,0 +1,13 @@
+<HTML>
+<HEAD><TITLE>The cal Package for Programmers</TITLE></HEAD>
+
+<FRAMESET ROWS="5%,90%,5%">
+  <FRAME SRC="calTitle.html">
+  <FRAMESET COLS="40%,60%">
+    <FRAME SRC="calExtAbs.html" NAME="ABSTRACT">
+    <FRAME SRC="calExtDet.html" NAME="MAIN">
+  </FRAMESET>
+  <FRAME SRC="credit.html">
+</FRAMESET>
+
+</HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calExtAbs.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calExtAbs.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calExtAbs.html	(revision 6)
@@ -0,0 +1,388 @@
+<html>
+<head><title>cal package abstract</title></head>
+<body>
+
+
+<!-- Function Abstracts -->
+
+<dl>
+<dt> <a href="calAllDet.html#Cal_AssociationInit" TARGET="MAIN"><code>Cal_AssociationInit()</code></a>
+<dd> Creates or finds a variable association.
+
+<dt> <a href="calAllDet.html#Cal_AssociationQuit" TARGET="MAIN"><code>Cal_AssociationQuit()</code></a>
+<dd> Deletes the variable association given by id
+
+<dt> <a href="calAllDet.html#Cal_AssociationSetCurrent" TARGET="MAIN"><code>Cal_AssociationSetCurrent()</code></a>
+<dd> Sets the current variable association to the one given by id and
+  returns the ID of the old association.
+
+<dt> <a href="calAllDet.html#Cal_BddAnd" TARGET="MAIN"><code>Cal_BddAnd()</code></a>
+<dd> Returns the BDD for logical AND of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddBetween" TARGET="MAIN"><code>Cal_BddBetween()</code></a>
+<dd> Returns a minimal BDD whose function contains fMin and is
+  contained in fMax.
+
+<dt> <a href="calAllDet.html#Cal_BddCofactor" TARGET="MAIN"><code>Cal_BddCofactor()</code></a>
+<dd> Returns the generalized cofactor of BDD f with respect
+  to BDD c.
+
+<dt> <a href="calAllDet.html#Cal_BddCompose" TARGET="MAIN"><code>Cal_BddCompose()</code></a>
+<dd> composition - substitute a BDD variable by a function
+
+<dt> <a href="calAllDet.html#Cal_BddDependsOn" TARGET="MAIN"><code>Cal_BddDependsOn()</code></a>
+<dd> Returns 1 if f depends on var and returns 0 otherwise.
+
+<dt> <a href="calAllDet.html#Cal_BddDumpBdd" TARGET="MAIN"><code>Cal_BddDumpBdd()</code></a>
+<dd> Write a BDD to a file
+
+<dt> <a href="calAllDet.html#Cal_BddDynamicReordering" TARGET="MAIN"><code>Cal_BddDynamicReordering()</code></a>
+<dd> Specify dynamic reordering technique.
+
+<dt> <a href="calAllDet.html#Cal_BddElse" TARGET="MAIN"><code>Cal_BddElse()</code></a>
+<dd> Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddExists" TARGET="MAIN"><code>Cal_BddExists()</code></a>
+<dd> Returns the result of existentially quantifying some
+  variables from the given BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddForAll" TARGET="MAIN"><code>Cal_BddForAll()</code></a>
+<dd> Returns the result of universally quantifying some
+  variables from the given BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddFree" TARGET="MAIN"><code>Cal_BddFree()</code></a>
+<dd> Frees the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddFunctionPrint" TARGET="MAIN"><code>Cal_BddFunctionPrint()</code></a>
+<dd> Prints the function implemented by the argument BDD
+
+<dt> <a href="calAllDet.html#Cal_BddFunctionProfileMultiple" TARGET="MAIN"><code>Cal_BddFunctionProfileMultiple()</code></a>
+<dd> Returns a "function profile" for fArray.
+
+<dt> <a href="calAllDet.html#Cal_BddFunctionProfile" TARGET="MAIN"><code>Cal_BddFunctionProfile()</code></a>
+<dd> Returns a "function profile" for f.
+
+<dt> <a href="calAllDet.html#Cal_BddGetIfId" TARGET="MAIN"><code>Cal_BddGetIfId()</code></a>
+<dd> Returns the id of the top variable of the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddGetIfIndex" TARGET="MAIN"><code>Cal_BddGetIfIndex()</code></a>
+<dd> Returns the index of the top variable of the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddGetRegular" TARGET="MAIN"><code>Cal_BddGetRegular()</code></a>
+<dd> Returns a BDD with positive from a given BDD with arbitrary phase
+
+<dt> <a href="calAllDet.html#Cal_BddITE" TARGET="MAIN"><code>Cal_BddITE()</code></a>
+<dd> Returns the BDD for logical If-Then-Else
+
+  Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+  - f g + f' h
+
+<dt> <a href="calAllDet.html#Cal_BddIdentity" TARGET="MAIN"><code>Cal_BddIdentity()</code></a>
+<dd> Returns the duplicate BDD of the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddIf" TARGET="MAIN"><code>Cal_BddIf()</code></a>
+<dd> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddImplies" TARGET="MAIN"><code>Cal_BddImplies()</code></a>
+<dd> Computes a BDD that implies conjunction of f and Cal_BddNot(g)
+
+<dt> <a href="calAllDet.html#Cal_BddIntersects" TARGET="MAIN"><code>Cal_BddIntersects()</code></a>
+<dd> Computes a BDD that implies conjunction of f and g.
+
+<dt> <a href="calAllDet.html#Cal_BddIsBddConst" TARGET="MAIN"><code>Cal_BddIsBddConst()</code></a>
+<dd> Returns 1 if the argument BDD is a constant, 0 otherwise.
+
+<dt> <a href="calAllDet.html#Cal_BddIsBddNull" TARGET="MAIN"><code>Cal_BddIsBddNull()</code></a>
+<dd> Returns 1 if the argument BDD is NULL, 0 otherwise.
+
+<dt> <a href="calAllDet.html#Cal_BddIsBddOne" TARGET="MAIN"><code>Cal_BddIsBddOne()</code></a>
+<dd> Returns 1 if the argument BDD is constant one, 0 otherwise.
+
+<dt> <a href="calAllDet.html#Cal_BddIsBddZero" TARGET="MAIN"><code>Cal_BddIsBddZero()</code></a>
+<dd> Returns 1 if the argument BDD is constant zero, 0 otherwise.
+
+<dt> <a href="calAllDet.html#Cal_BddIsCube" TARGET="MAIN"><code>Cal_BddIsCube()</code></a>
+<dd> Returns 1 if the argument BDD is a cube, 0 otherwise
+
+<dt> <a href="calAllDet.html#Cal_BddIsEqual" TARGET="MAIN"><code>Cal_BddIsEqual()</code></a>
+<dd> Returns 1 if argument BDDs are equal, 0 otherwise.
+
+<dt> <a href="calAllDet.html#Cal_BddIsProvisional" TARGET="MAIN"><code>Cal_BddIsProvisional()</code></a>
+<dd> Returns 1, if the given user BDD contains
+  provisional BDD node.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerCreateNewVarAfter" TARGET="MAIN"><code>Cal_BddManagerCreateNewVarAfter()</code></a>
+<dd> Creates and returns a new variable after the specified one in
+  the variable  order.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerCreateNewVarBefore" TARGET="MAIN"><code>Cal_BddManagerCreateNewVarBefore()</code></a>
+<dd> Creates and returns a new variable before the specified one in
+  the variable order.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerCreateNewVarFirst" TARGET="MAIN"><code>Cal_BddManagerCreateNewVarFirst()</code></a>
+<dd> Creates and returns a new variable at the start of the variable
+  order.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerCreateNewVarLast" TARGET="MAIN"><code>Cal_BddManagerCreateNewVarLast()</code></a>
+<dd> Creates and returns a new variable at the end of the variable
+  order.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerGC" TARGET="MAIN"><code>Cal_BddManagerGC()</code></a>
+<dd> Invokes the garbage collection at the manager level.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerGetHooks" TARGET="MAIN"><code>Cal_BddManagerGetHooks()</code></a>
+<dd> Returns the hooks field of the manager.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerGetNumNodes" TARGET="MAIN"><code>Cal_BddManagerGetNumNodes()</code></a>
+<dd> Returns the number of BDD nodes
+
+<dt> <a href="calAllDet.html#Cal_BddManagerGetVarWithId" TARGET="MAIN"><code>Cal_BddManagerGetVarWithId()</code></a>
+<dd> Returns the variable with the specified id, null if no
+  such variable exists
+
+<dt> <a href="calAllDet.html#Cal_BddManagerGetVarWithIndex" TARGET="MAIN"><code>Cal_BddManagerGetVarWithIndex()</code></a>
+<dd> Returns the variable with the specified index, null if no
+  such variable exists
+
+<dt> <a href="calAllDet.html#Cal_BddManagerInit" TARGET="MAIN"><code>Cal_BddManagerInit()</code></a>
+<dd> Creates and initializes a new BDD manager.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerQuit" TARGET="MAIN"><code>Cal_BddManagerQuit()</code></a>
+<dd> Frees the BDD manager and all the associated allocations
+
+<dt> <a href="calAllDet.html#Cal_BddManagerSetGCLimit" TARGET="MAIN"><code>Cal_BddManagerSetGCLimit()</code></a>
+<dd> Sets the limit of the garbage collection.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerSetHooks" TARGET="MAIN"><code>Cal_BddManagerSetHooks()</code></a>
+<dd> Sets the hooks field of the manager.
+
+<dt> <a href="calAllDet.html#Cal_BddManagerSetParameters" TARGET="MAIN"><code>Cal_BddManagerSetParameters()</code></a>
+<dd> Sets appropriate fields of BDD Manager.
+
+<dt> <a href="calAllDet.html#Cal_BddMultiwayAnd" TARGET="MAIN"><code>Cal_BddMultiwayAnd()</code></a>
+<dd> Returns the BDD for logical AND of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddMultiwayOr" TARGET="MAIN"><code>Cal_BddMultiwayOr()</code></a>
+<dd> Returns the BDD for logical OR of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddMultiwayXor" TARGET="MAIN"><code>Cal_BddMultiwayXor()</code></a>
+<dd> Returns the BDD for logical XOR of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddNand" TARGET="MAIN"><code>Cal_BddNand()</code></a>
+<dd> Returns the BDD for logical NAND of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddNewVarBlock" TARGET="MAIN"><code>Cal_BddNewVarBlock()</code></a>
+<dd> Creates and returns a variable block used for
+  controlling dynamic reordering.
+
+<dt> <a href="calAllDet.html#Cal_BddNodeLimit" TARGET="MAIN"><code>Cal_BddNodeLimit()</code></a>
+<dd> Sets the node limit to new_limit and returns the old limit.
+
+<dt> <a href="calAllDet.html#Cal_BddNor" TARGET="MAIN"><code>Cal_BddNor()</code></a>
+<dd> Returns the BDD for logical NOR of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddNot" TARGET="MAIN"><code>Cal_BddNot()</code></a>
+<dd> Returns the complement of the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddOne" TARGET="MAIN"><code>Cal_BddOne()</code></a>
+<dd> Returns the BDD for the constant one
+
+<dt> <a href="calAllDet.html#Cal_BddOr" TARGET="MAIN"><code>Cal_BddOr()</code></a>
+<dd> Returns the BDD for logical OR of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddOverflow" TARGET="MAIN"><code>Cal_BddOverflow()</code></a>
+<dd> Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.
+
+<dt> <a href="calAllDet.html#Cal_BddPairwiseAnd" TARGET="MAIN"><code>Cal_BddPairwiseAnd()</code></a>
+<dd> Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+<dt> <a href="calAllDet.html#Cal_BddPairwiseOr" TARGET="MAIN"><code>Cal_BddPairwiseOr()</code></a>
+<dd> Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+<dt> <a href="calAllDet.html#Cal_BddPairwiseXor" TARGET="MAIN"><code>Cal_BddPairwiseXor()</code></a>
+<dd> Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+
+<dt> <a href="calAllDet.html#Cal_BddPrintBdd" TARGET="MAIN"><code>Cal_BddPrintBdd()</code></a>
+<dd> Prints a BDD in the human readable form.
+
+<dt> <a href="calAllDet.html#Cal_BddPrintFunctionProfileMultiple" TARGET="MAIN"><code>Cal_BddPrintFunctionProfileMultiple()</code></a>
+<dd> Cal_BddPrintFunctionProfileMultiple is like
+               Cal_BddPrintFunctionProfile except for multiple BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddPrintFunctionProfile" TARGET="MAIN"><code>Cal_BddPrintFunctionProfile()</code></a>
+<dd> Cal_BddPrintFunctionProfile is like Cal_BddPrintProfile except
+               it displays a function profile for f
+
+<dt> <a href="calAllDet.html#Cal_BddPrintProfileMultiple" TARGET="MAIN"><code>Cal_BddPrintProfileMultiple()</code></a>
+<dd> Cal_BddPrintProfileMultiple is like Cal_BddPrintProfile except
+               it displays the profile for a set of BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddPrintProfile" TARGET="MAIN"><code>Cal_BddPrintProfile()</code></a>
+<dd> Displays the node profile for f on fp. lineLength specifies 
+               the maximum line length.  varNamingFn is as in
+               Cal_BddPrintBdd.
+
+<dt> <a href="calAllDet.html#Cal_BddProfileMultiple" TARGET="MAIN"><code>Cal_BddProfileMultiple()</code></a>
+<dd> 
+
+<dt> <a href="calAllDet.html#Cal_BddProfile" TARGET="MAIN"><code>Cal_BddProfile()</code></a>
+<dd> Returns a "node profile" of f, i.e., the number of nodes at each
+  level in f.
+
+<dt> <a href="calAllDet.html#Cal_BddReduce" TARGET="MAIN"><code>Cal_BddReduce()</code></a>
+<dd> Returns a BDD which agrees with f for all valuations
+  which satisfy c.
+
+<dt> <a href="calAllDet.html#Cal_BddRelProd" TARGET="MAIN"><code>Cal_BddRelProd()</code></a>
+<dd> Returns the result of taking the logical AND of the
+  argument BDDs and existentially quantifying some variables from the
+  product.
+
+<dt> <a href="calAllDet.html#Cal_BddReorder" TARGET="MAIN"><code>Cal_BddReorder()</code></a>
+<dd> Invoke the current dynamic reodering method.
+
+<dt> <a href="calAllDet.html#Cal_BddSatisfySupport" TARGET="MAIN"><code>Cal_BddSatisfySupport()</code></a>
+<dd> Returns a special cube contained in f.
+
+<dt> <a href="calAllDet.html#Cal_BddSatisfyingFraction" TARGET="MAIN"><code>Cal_BddSatisfyingFraction()</code></a>
+<dd> Returns the fraction of valuations which make f true. (Note that
+  this fraction is independent of whatever set of variables f is supposed to be
+  a function of)
+
+<dt> <a href="calAllDet.html#Cal_BddSatisfy" TARGET="MAIN"><code>Cal_BddSatisfy()</code></a>
+<dd> Returns a BDD which implies f, true for
+               some valuation on which f is true, and which has at most
+               one node at each level
+
+<dt> <a href="calAllDet.html#Cal_BddSetGCMode" TARGET="MAIN"><code>Cal_BddSetGCMode()</code></a>
+<dd> Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.
+
+<dt> <a href="calAllDet.html#Cal_BddSizeMultiple" TARGET="MAIN"><code>Cal_BddSizeMultiple()</code></a>
+<dd> The routine is like Cal_BddSize, but takes a null-terminated
+               array of BDDs and accounts for sharing of nodes.
+
+<dt> <a href="calAllDet.html#Cal_BddSize" TARGET="MAIN"><code>Cal_BddSize()</code></a>
+<dd> Returns the number of nodes in f when negout is nonzero. If
+  negout is zero, we pretend that the BDDs don't have negative-output pointers.
+
+<dt> <a href="calAllDet.html#Cal_BddStats" TARGET="MAIN"><code>Cal_BddStats()</code></a>
+<dd> Prints miscellaneous BDD statistics
+
+<dt> <a href="calAllDet.html#Cal_BddSubstitute" TARGET="MAIN"><code>Cal_BddSubstitute()</code></a>
+<dd> Substitute a set of variables by functions
+
+<dt> <a href="calAllDet.html#Cal_BddSupport" TARGET="MAIN"><code>Cal_BddSupport()</code></a>
+<dd> returns the support of f as a null-terminated array of variables
+
+<dt> <a href="calAllDet.html#Cal_BddSwapVars" TARGET="MAIN"><code>Cal_BddSwapVars()</code></a>
+<dd> Return a function obtained by swapping two variables
+
+<dt> <a href="calAllDet.html#Cal_BddThen" TARGET="MAIN"><code>Cal_BddThen()</code></a>
+<dd> Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddTotalSize" TARGET="MAIN"><code>Cal_BddTotalSize()</code></a>
+<dd> Returns the number of nodes in the Unique table
+
+<dt> <a href="calAllDet.html#Cal_BddType" TARGET="MAIN"><code>Cal_BddType()</code></a>
+<dd> Returns type of a BDD ( 0, 1, +var, -var, ovrflow, nonterminal)
+
+<dt> <a href="calAllDet.html#Cal_BddUnFree" TARGET="MAIN"><code>Cal_BddUnFree()</code></a>
+<dd> Unfrees the argument BDD.
+
+<dt> <a href="calAllDet.html#Cal_BddUndumpBdd" TARGET="MAIN"><code>Cal_BddUndumpBdd()</code></a>
+<dd> Reads a BDD from a file
+
+<dt> <a href="calAllDet.html#Cal_BddVarBlockReorderable" TARGET="MAIN"><code>Cal_BddVarBlockReorderable()</code></a>
+<dd> Sets the reoderability of a particular block.
+
+<dt> <a href="calAllDet.html#Cal_BddVarSubstitute" TARGET="MAIN"><code>Cal_BddVarSubstitute()</code></a>
+<dd> Substitute a set of variables by set of another variables.
+
+<dt> <a href="calAllDet.html#Cal_BddVars" TARGET="MAIN"><code>Cal_BddVars()</code></a>
+<dd> Returns the number of BDD variables
+
+<dt> <a href="calAllDet.html#Cal_BddXnor" TARGET="MAIN"><code>Cal_BddXnor()</code></a>
+<dd> Returns the BDD for logical exclusive NOR of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddXor" TARGET="MAIN"><code>Cal_BddXor()</code></a>
+<dd> Returns the BDD for logical exclusive OR of argument BDDs
+
+<dt> <a href="calAllDet.html#Cal_BddZero" TARGET="MAIN"><code>Cal_BddZero()</code></a>
+<dd> Returns the BDD for the constant zero
+
+<dt> <a href="calAllDet.html#Cal_MemAllocation" TARGET="MAIN"><code>Cal_MemAllocation()</code></a>
+<dd> Returns the memory allocated.
+
+<dt> <a href="calAllDet.html#Cal_MemFatal" TARGET="MAIN"><code>Cal_MemFatal()</code></a>
+<dd> Prints an error message and exits.
+
+<dt> <a href="calAllDet.html#Cal_MemFreeBlock" TARGET="MAIN"><code>Cal_MemFreeBlock()</code></a>
+<dd> Frees the block.
+
+<dt> <a href="calAllDet.html#Cal_MemFreeRecMgr" TARGET="MAIN"><code>Cal_MemFreeRecMgr()</code></a>
+<dd> Frees all the storage associated with the specified record manager.
+
+<dt> <a href="calAllDet.html#Cal_MemFreeRec" TARGET="MAIN"><code>Cal_MemFreeRec()</code></a>
+<dd> Frees a record managed by the indicated record manager.
+
+<dt> <a href="calAllDet.html#Cal_MemGetBlock" TARGET="MAIN"><code>Cal_MemGetBlock()</code></a>
+<dd> Allocates a new block of the specified size.
+
+<dt> <a href="calAllDet.html#Cal_MemNewRecMgr" TARGET="MAIN"><code>Cal_MemNewRecMgr()</code></a>
+<dd> Creates a new record manager with the given  record size.
+
+<dt> <a href="calAllDet.html#Cal_MemNewRec" TARGET="MAIN"><code>Cal_MemNewRec()</code></a>
+<dd> Allocates a record from the specified record manager.
+
+<dt> <a href="calAllDet.html#Cal_MemResizeBlock" TARGET="MAIN"><code>Cal_MemResizeBlock()</code></a>
+<dd> Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible.
+
+<dt> <a href="calAllDet.html#Cal_PerformanceTest" TARGET="MAIN"><code>Cal_PerformanceTest()</code></a>
+<dd> Main routine for testing performances of various routines.
+
+<dt> <a href="calAllDet.html#Cal_PipelineCreateProvisionalBdd" TARGET="MAIN"><code>Cal_PipelineCreateProvisionalBdd()</code></a>
+<dd> Create a provisional BDD in the pipeline.
+
+<dt> <a href="calAllDet.html#Cal_PipelineExecute" TARGET="MAIN"><code>Cal_PipelineExecute()</code></a>
+<dd> Executes a pipeline.
+
+<dt> <a href="calAllDet.html#Cal_PipelineInit" TARGET="MAIN"><code>Cal_PipelineInit()</code></a>
+<dd> Initialize a BDD pipeline.
+
+<dt> <a href="calAllDet.html#Cal_PipelineQuit" TARGET="MAIN"><code>Cal_PipelineQuit()</code></a>
+<dd> Resets the pipeline freeing all resources.
+
+<dt> <a href="calAllDet.html#Cal_PipelineSetDepth" TARGET="MAIN"><code>Cal_PipelineSetDepth()</code></a>
+<dd> Set depth of a BDD pipeline.
+
+<dt> <a href="calAllDet.html#Cal_PipelineUpdateProvisionalBdd" TARGET="MAIN"><code>Cal_PipelineUpdateProvisionalBdd()</code></a>
+<dd> Update a provisional Bdd obtained during pipelining.
+
+<dt> <a href="calAllDet.html#Cal_TempAssociationAugment" TARGET="MAIN"><code>Cal_TempAssociationAugment()</code></a>
+<dd> Adds to the temporary variable association.
+
+<dt> <a href="calAllDet.html#Cal_TempAssociationInit" TARGET="MAIN"><code>Cal_TempAssociationInit()</code></a>
+<dd> Sets the temporary variable association.
+
+<dt> <a href="calAllDet.html#Cal_TempAssociationQuit" TARGET="MAIN"><code>Cal_TempAssociationQuit()</code></a>
+<dd> Cleans up temporary association
+
+</dl>
+
+<hr>
+
+Last updated on 970711 20h11
+</body></html>
Index: /vis_dev/glu-2.1/src/calBdd/calExtDet.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calExtDet.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calExtDet.html	(revision 6)
@@ -0,0 +1,1924 @@
+<HTML>
+<HEAD><TITLE>The cal package</TITLE></HEAD>
+<BODY>
+
+<DL>
+<dt><pre>
+<A NAME="Cal_AssociationInit"></A>
+int <I></I>
+<B>Cal_AssociationInit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>associationInfoUserBdds</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> Creates or finds a variable association. The association is
+  specified by associationInfo, which is a an array of BDD with 
+  Cal_BddNull(bddManager) as the end marker. If pairs is 0, the array is
+  assumed to be an array of variables. In this case, each variable is paired
+  with constant BDD one. Such an association may viewed as specifying a set
+  of variables for use with routines such as Cal_BddExists. If pair is not 0,
+  then the even numbered array elements should be variables and the odd numbered
+  elements should be the BDDs which they are mapped to. In both cases, the 
+  return value is an integer identifier for this association. If the given
+  association is equivalent to one which already exists, the same identifier
+  is used for both, and the reference count of the association is increased by
+  one.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_AssociationQuit">Cal_AssociationQuit</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_AssociationQuit"></A>
+void <I></I>
+<B>Cal_AssociationQuit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>associationId</b> <i></i>
+)
+</pre>
+<dd> Decrements the reference count of the variable association with
+  identifier id, and frees it if the reference count becomes zero.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_AssociationInit">Cal_AssociationInit</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_AssociationSetCurrent"></A>
+int <I></I>
+<B>Cal_AssociationSetCurrent</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>associationId</b> <i></i>
+)
+</pre>
+<dd> Sets the current variable association to the one given by id and
+  returns the ID of the old association.  An id of -1 indicates the temporary
+  association
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddAnd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical AND of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddBetween"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddBetween</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fMinUserBdd</b>, <i></i>
+  Cal_Bdd  <b>fMaxUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a minimal BDD f which is contains fMin and is
+  contained in fMax ( fMin <= f <= fMax).
+  This operation is typically used in state space searches to simplify
+  the representation for the set of states wich will be expanded at
+  each step (Rk Rk-1' <= f <= Rk).
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddReduce">Cal_BddReduce</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddCofactor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddCofactor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>cUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the generalized cofactor of BDD f with respect
+  to BDD c. The constrain operator given by Coudert et al (ICCAD90) is
+  used to find the generalized cofactor.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddReduce">Cal_BddReduce</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddCompose"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddCompose</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b>, <i></i>
+  Cal_Bdd  <b>hUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD obtained by substituting a variable by a function
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddDependsOn"></A>
+int <I></I>
+<B>Cal_BddDependsOn</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>varUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if f depends on var and returns 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddDumpBdd"></A>
+int <I></I>
+<B>Cal_BddDumpBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd * <b>userVars</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> Writes an encoded description of the BDD to the file given by fp.
+  The argument vars should be a null-terminated array of variables that include
+  the support of f .  These variables need not be in order of increasing index.
+  The function returns a nonzero value if f was written to the file successfully.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddDynamicReordering"></A>
+void <I></I>
+<B>Cal_BddDynamicReordering</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>technique</b> <i></i>
+)
+</pre>
+<dd> Selects the method for dynamic reordering.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddReorder">Cal_BddReorder</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddElse"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddElse</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the negative cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the returned BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddThen">Cal_BddThen</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddExists"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddExists</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for f with all the variables that are
+  paired with something in the current variable association
+  existentially quantified out.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddRelProd">Cal_BddRelProd</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddForAll"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddForAll</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for f with all the variables that are
+  paired with something in the current variable association
+  universally quantified out.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddFree"></A>
+void <I></I>
+<B>Cal_BddFree</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Frees the argument BDD. It is an error to free a BDD
+  more than once.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the argument BDD is decreased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddUnFree">Cal_BddUnFree</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddFunctionPrint"></A>
+void <I></I>
+<B>Cal_BddFunctionPrint</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b>, <i></i>
+  char * <b>name</b> <i></i>
+)
+</pre>
+<dd> Prints the function implemented by the argument BDD
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddFunctionProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddFunctionProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>fUserBddArray</b>, <i></i>
+  long * <b>funcCounts</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddFunctionProfile"></A>
+void <I></I>
+<B>Cal_BddFunctionProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  long * <b>funcCounts</b> <i></i>
+)
+</pre>
+<dd> The nth entry of the function
+  profile array is the number of subfunctions of f which may be obtained by 
+  restricting the variables whose index is less than n.  An entry of zero 
+  indicates that f is independent of the variable with the corresponding index.
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddGetIfId"></A>
+Cal_BddId_t <I></I>
+<B>Cal_BddGetIfId</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the id of the top variable of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddGetIfIndex">Cal_BddGetIfIndex</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddGetIfIndex"></A>
+Cal_BddId_t <I></I>
+<B>Cal_BddGetIfIndex</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the index of the top variable of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddGetIfId">Cal_BddGetIfId</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddGetRegular"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddGetRegular</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD with positive from a given BDD with arbitrary phase
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddITE"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddITE</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b>, <i></i>
+  Cal_Bdd  <b>hUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical If-Then-Else
+
+  Description [Returns the BDD for the logical operation IF f THEN g ELSE h
+  - f g + f' h
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddAnd">Cal_BddAnd</a>
+<a href="#Cal_BddNand">Cal_BddNand</a>
+<a href="#Cal_BddOr">Cal_BddOr</a>
+<a href="#Cal_BddNor">Cal_BddNor</a>
+<a href="#Cal_BddXor">Cal_BddXor</a>
+<a href="#Cal_BddXnor">Cal_BddXnor</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIdentity"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddIdentity</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the duplicate BDD of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddNot">Cal_BddNot</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIf"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddIf</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD corresponding to the top variable of
+  the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddImplies"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddImplies</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Computes a BDD that implies conjunction of f and Cal_BddNot(g)
+<p>
+
+<dd> <b>Side Effects</b> none
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIntersects">Cal_BddIntersects</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIntersects"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddIntersects</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Computes a BDD that implies conjunction of f and g.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddImplies">Cal_BddImplies</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddConst"></A>
+int <I></I>
+<B>Cal_BddIsBddConst</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is either constant one or
+  constant zero, otherwise returns 0.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIsBddOne">Cal_BddIsBddOne</a>
+<a href="#Cal_BddIsBddZero">Cal_BddIsBddZero</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddNull"></A>
+int <I></I>
+<B>Cal_BddIsBddNull</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is NULL, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddOne"></A>
+int <I></I>
+<B>Cal_BddIsBddOne</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is constant one, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIsBddZero">Cal_BddIsBddZero</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIsBddZero"></A>
+int <I></I>
+<B>Cal_BddIsBddZero</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is constant zero, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIsBddOne">Cal_BddIsBddOne</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddIsCube"></A>
+int <I></I>
+<B>Cal_BddIsCube</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the argument BDD is a cube, 0 otherwise
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddIsEqual"></A>
+int <I></I>
+<B>Cal_BddIsEqual</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd1</b>, <i></i>
+  Cal_Bdd  <b>userBdd2</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if argument BDDs are equal, 0 otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddIsProvisional"></A>
+int <I></I>
+<B>Cal_BddIsProvisional</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns 1, if the given user BDD contains
+  provisional BDD node.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarAfter"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarAfter</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable after the specified one in
+  the variable  order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarBefore"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarBefore</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable before the specified one in
+  the variable order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarFirst"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarFirst</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable at the start of the
+  variable order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerCreateNewVarLast"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerCreateNewVarLast</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Creates and returns a new variable at the end of the variable
+  order.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGC"></A>
+int <I></I>
+<B>Cal_BddManagerGC</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> For each variable in the increasing id free nodes with reference
+  count equal to zero freeing a node results in decrementing reference count of
+  then and else nodes by one.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetHooks"></A>
+void * <I></I>
+<B>Cal_BddManagerGetHooks</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the hooks field of the manager.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetNumNodes"></A>
+unsigned long <I></I>
+<B>Cal_BddManagerGetNumNodes</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the number of BDD nodes
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddTotalSize">Cal_BddTotalSize</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetVarWithId"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerGetVarWithId</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddId_t  <b>id</b> <i></i>
+)
+</pre>
+<dd> Returns the variable with the specified id, null if no
+  such variable exists
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddManagerGetVarWithIndex"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddManagerGetVarWithIndex</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddIndex_t  <b>index</b> <i></i>
+)
+</pre>
+<dd> Returns the variable with the specified index, null if no
+  such variable exists
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerInit"></A>
+Cal_BddManager <I></I>
+<B>Cal_BddManagerInit</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> Initializes and allocates fields of the BDD manager. Some of the
+  fields are initialized for maxNumVars+1 or numVars+1, whereas some of them are
+  initialized for maxNumVars or numVars. The first kind of fields are associated
+  with the id of a variable and the second ones are with the index of the
+  variable.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerQuit">Cal_BddManagerQuit</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddManagerQuit"></A>
+int <I></I>
+<B>Cal_BddManagerQuit</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Frees the BDD manager and all the associated allocations
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerInit">Cal_BddManagerInit</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddManagerSetGCLimit"></A>
+void <I></I>
+<B>Cal_BddManagerSetGCLimit</B>(
+  Cal_BddManager  <b>manager</b> <i></i>
+)
+</pre>
+<dd> It tries to set the limit at twice the number of nodes
+  in the manager at the current point. However, the limit is not
+  allowed to fall below the MIN_GC_LIMIT or to exceed the value of
+  node limit (if one exists).
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerSetHooks"></A>
+void <I></I>
+<B>Cal_BddManagerSetHooks</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  void * <b>hooks</b> <i></i>
+)
+</pre>
+<dd> Sets the hooks field of the manager.
+<p>
+
+<dd> <b>Side Effects</b> Hooks field changes.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddManagerSetParameters"></A>
+void <I></I>
+<B>Cal_BddManagerSetParameters</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  long  <b>reorderingThreshold</b>, <i></i>
+  long  <b>maxForwardedNodes</b>, <i></i>
+  double  <b>repackAfterGCThreshold</b>, <i></i>
+  double  <b>tableRepackThreshold</b> <i></i>
+)
+</pre>
+<dd> This function is used to set the parameters which are
+  used to control the reordering process. "reorderingThreshold"
+  determines the number of nodes below which reordering will NOT be
+  invoked, "maxForwardedNodes" determines the maximum number of
+  forwarded nodes which are allowed (at that point the cleanup must be
+  done), and "repackingThreshold" determines the fraction of the page
+  utilized below which repacking has to be invoked. These parameters
+  have different affect on the computational and memory usage aspects
+  of reordeing. For instance, higher value of "maxForwardedNodes" will
+  result in process consuming more memory, and a lower value on the
+  other hand would invoke the cleanup process repeatedly resulting in
+  increased computation.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddMultiwayAnd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddMultiwayAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical AND of set of BDDs in the bddArray
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddMultiwayOr"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddMultiwayOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical OR of set of BDDs in the bddArray
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddMultiwayXor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddMultiwayXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical XOR of set of BDDs in the bddArray
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddNand"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddNand</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical NAND of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddNewVarBlock"></A>
+Cal_Block <I></I>
+<B>Cal_BddNewVarBlock</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>variable</b>, <i></i>
+  long  <b>length</b> <i></i>
+)
+</pre>
+<dd> The block is specified by passing the first
+  variable and the length of the block. The "length" number of
+  consecutive variables starting from "variable" are put in the
+  block.
+<p>
+
+<dd> <b>Side Effects</b> A new block is created.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddNodeLimit"></A>
+long <I></I>
+<B>Cal_BddNodeLimit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  long  <b>newLimit</b> <i></i>
+)
+</pre>
+<dd> Sets the node limit to new_limit and returns the old limit.
+<p>
+
+<dd> <b>Side Effects</b> Threshold for garbage collection may change
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerGC">Cal_BddManagerGC</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddNor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddNor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical NOR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddNot"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddNot</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the complement of the argument BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the argument BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddIdentity">Cal_BddIdentity</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddOne"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddOne</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for the constant one
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddZero">Cal_BddZero</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddOr"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical OR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddOverflow"></A>
+int <I></I>
+<B>Cal_BddOverflow</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns 1 if the node limit has been exceeded, 0 otherwise. The
+  overflow flag is cleared.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddNodeLimit">Cal_BddNodeLimit</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPairwiseAnd"></A>
+Cal_Bdd * <I></I>
+<B>Cal_BddPairwiseAnd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns an array of BDDs obtained by logical AND of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddPairwiseOr">Cal_BddPairwiseOr</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPairwiseOr"></A>
+Cal_Bdd * <I></I>
+<B>Cal_BddPairwiseOr</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns an array of BDDs obtained by logical OR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddPairwiseAnd">Cal_BddPairwiseAnd</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPairwiseXor"></A>
+Cal_Bdd * <I></I>
+<B>Cal_BddPairwiseXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBddArray</b> <i></i>
+)
+</pre>
+<dd> Returns an array of BDDs obtained by logical XOR of BDD pairs
+  specified by an BDD array in which a BDD at an even location is paired with
+  a BDD at an odd location of the array
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddPairwiseAnd">Cal_BddPairwiseAnd</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPrintBdd"></A>
+void <I></I>
+<B>Cal_BddPrintBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_VarNamingFn_t  <b>VarNamingFn</b>, <i></i>
+  Cal_TerminalIdFn_t  <b>TerminalIdFn</b>, <i></i>
+  Cal_Pointer_t  <b>env</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> Prints a human-readable representation of the BDD f to
+  the file given by fp. The namingFn should be a pointer to a function
+  taking a bddManager, a BDD and the pointer given by env. This
+  function should return either a null pointer or a srting that is the
+  name of the supplied variable. If it returns a null pointer, a
+  default name is generated based on the index of the variable. It is
+  also legal for naminFN to e null; in this case, default names are
+  generated for all variables. The macro bddNamingFnNone is a null
+  pointer of suitable type. terminalIdFn should be apointer to a
+  function taking a bddManager and two longs. plus the pointer given
+  by the env. It should return either a null pointer. If it returns a
+  null pointer, or if terminalIdFn is null, then default names are
+  generated for the terminals. The macro bddTerminalIdFnNone is a null
+  pointer of suitable type.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddPrintFunctionProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddPrintFunctionProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBdds</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPrintFunctionProfile"></A>
+void <I></I>
+<B>Cal_BddPrintFunctionProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>f</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPrintProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddPrintProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userBdds</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddPrintProfile"></A>
+void <I></I>
+<B>Cal_BddPrintProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_VarNamingFn_t  <b>varNamingProc</b>, <i></i>
+  char * <b>env</b>, <i></i>
+  int  <b>lineLength</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddProfileMultiple"></A>
+void <I></I>
+<B>Cal_BddProfileMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>fUserBddArray</b>, <i></i>
+  long * <b>levelCounts</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddProfile"></A>
+void <I></I>
+<B>Cal_BddProfile</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  long * <b>levelCounts</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> negout is as in Cal_BddSize. levelCounts should be an array of
+  size Cal_BddVars(bddManager)+1 to hold the profile.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddReduce"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddReduce</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>cUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD which agrees with f for all valuations
+  which satisfy c. The result is usually smaller in terms of number of
+  BDD nodes than f. This operation is typically used in state space
+  searches to simplify the representation for the set of states wich
+  will be expanded at each step.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddCofactor">Cal_BddCofactor</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddRelProd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddRelProd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for the logical AND of f and g with all
+  the variables that are paired with something in the current variable
+  association existentially quantified out.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddReorder"></A>
+void <I></I>
+<B>Cal_BddReorder</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Invoke the current dynamic reodering method.
+<p>
+
+<dd> <b>Side Effects</b> Index of a variable may change due to reodering
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddDynamicReordering">Cal_BddDynamicReordering</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSatisfySupport"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSatisfySupport</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> The returned BDD which implies f, is true for some valuation on
+               which f is true, which has at most one node at each level,
+               and which has exactly one node corresponding to each variable
+               which is associated with something in the current variable
+               association.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSatisfyingFraction"></A>
+double <I></I>
+<B>Cal_BddSatisfyingFraction</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSatisfy"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSatisfy</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSetGCMode"></A>
+void <I></I>
+<B>Cal_BddSetGCMode</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>gcMode</b> <i></i>
+)
+</pre>
+<dd> Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddSizeMultiple"></A>
+long <I></I>
+<B>Cal_BddSizeMultiple</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>fUserBddArray</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSize"></A>
+long <I></I>
+<B>Cal_BddSize</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  int  <b>negout</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddStats"></A>
+void <I></I>
+<B>Cal_BddStats</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  FILE * <b>fp</b> <i></i>
+)
+</pre>
+<dd> Prints miscellaneous BDD statistics
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddSubstitute"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD for f using the substitution defined by current
+  variable association. Each variable is replaced by its associated BDDs. The 
+  substitution is effective simultaneously
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddCompose">Cal_BddCompose</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSupport"></A>
+void <I></I>
+<B>Cal_BddSupport</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd * <b>support</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddSwapVars"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddSwapVars</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b>, <i></i>
+  Cal_Bdd  <b>hUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD obtained by simultaneously substituting variable
+  g by variable h and variable h and variable g in the BDD f
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddSubstitute">Cal_BddSubstitute</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddThen"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddThen</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the positive cofactor of the argument BDD with
+  respect to the top variable of the BDD.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the returned BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddElse">Cal_BddElse</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddTotalSize"></A>
+unsigned long <I></I>
+<B>Cal_BddTotalSize</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the number of nodes in the Unique table
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddManagerGetNumNodes">Cal_BddManagerGetNumNodes</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddType"></A>
+int <I></I>
+<B>Cal_BddType</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns BDD_TYPE_ZERO if f is false, BDD_TYPE_ONE 
+  if f is true, BDD_TYPE_POSVAR is f is an unnegated variable,
+  BDD_TYPE_NEGVAR if f is a negated variable, BDD_TYPE_OVERFLOW if f
+  is null, and BDD_TYPE_NONTERMINAL otherwise.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddUnFree"></A>
+void <I></I>
+<B>Cal_BddUnFree</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>userBdd</b> <i></i>
+)
+</pre>
+<dd> Unfrees the argument BDD. It is an error to pass a BDD
+  with reference count of zero to be unfreed.
+<p>
+
+<dd> <b>Side Effects</b> The reference count of the argument BDD is increased by 1.
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddFree">Cal_BddFree</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddUndumpBdd"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddUndumpBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>userVars</b>, <i></i>
+  FILE * <b>fp</b>, <i></i>
+  int * <b>error</b> <i></i>
+)
+</pre>
+<dd> Loads an encoded description of a BDD from the file given by
+  fp. The argument vars should be a null terminated array of variables that will
+  become the support of the BDD. As in Cal_BddDumpBdd, these need not be in
+  the order of increasing index. If the same array of variables in used in 
+  dumping and undumping, the BDD returned will be equal to the one that was 
+  dumped. More generally, if array v1 is used when dumping, and the array v2
+  is used when undumping, the BDD returned will be equal to the original BDD
+  with the ith variable in v2 substituted for the ith variable in v1 for all i.
+  Null BDD is returned in the operation fails for reason (node limit reached,
+  I/O error, invalid file format, etc.). In this case, an error code is stored
+  in error. the code will be one of the following. 
+  CAL_BDD_UNDUMP_FORMAT Invalid file format
+  CAL_BDD_UNDUMP_OVERFLOW Node limit exceeded
+  CAL_BDD_UNDUMP_IOERROR File I/O error
+  CAL_BDD_UNDUMP_EOF Unexpected EOF
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddVarBlockReorderable"></A>
+void <I></I>
+<B>Cal_BddVarBlockReorderable</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Block  <b>block</b>, <i></i>
+  int  <b>reorderable</b> <i></i>
+)
+</pre>
+<dd> If a block is reorderable, the child blocks are
+  recursively involved in swapping.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddVarSubstitute"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddVarSubstitute</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns a BDD for f using the substitution defined by current
+  variable association. It is assumed that each variable is replaced
+  by another variable. For the substitution of a variable by a
+  function, use Cal_BddSubstitute instead.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddSubstitute">Cal_BddSubstitute</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_BddVars"></A>
+long <I></I>
+<B>Cal_BddVars</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the number of BDD variables
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddXnor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddXnor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical exclusive NOR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddXor"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddXor</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for logical exclusive OR of f and g
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_BddZero"></A>
+Cal_Bdd <I></I>
+<B>Cal_BddZero</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Returns the BDD for the constant zero
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dd> <b>See Also</b> <code><a href="#Cal_BddOne">Cal_BddOne</a>
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemAllocation"></A>
+Cal_Address_t <I></I>
+<B>Cal_MemAllocation</B>(
+   <b></b> <i></i>
+)
+</pre>
+<dd> Returns the memory allocated.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemFatal"></A>
+void <I></I>
+<B>Cal_MemFatal</B>(
+  char * <b>message</b> <i></i>
+)
+</pre>
+<dd> Prints an error message and exits.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemFreeBlock"></A>
+void <I></I>
+<B>Cal_MemFreeBlock</B>(
+  Cal_Pointer_t  <b>p</b> <i></i>
+)
+</pre>
+<dd> Frees the block.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemFreeRecMgr"></A>
+void <I></I>
+<B>Cal_MemFreeRecMgr</B>(
+  Cal_RecMgr  <b>mgr</b> <i></i>
+)
+</pre>
+<dd> Frees all the storage associated with the specified record manager.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemFreeRec"></A>
+void <I></I>
+<B>Cal_MemFreeRec</B>(
+  Cal_RecMgr  <b>mgr</b>, <i></i>
+  Cal_Pointer_t  <b>rec</b> <i></i>
+)
+</pre>
+<dd> Frees a record managed by the indicated record manager.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemGetBlock"></A>
+Cal_Pointer_t <I></I>
+<B>Cal_MemGetBlock</B>(
+  Cal_Address_t  <b>size</b> <i></i>
+)
+</pre>
+<dd> Allocates a new block of the specified size.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemNewRecMgr"></A>
+Cal_RecMgr <I></I>
+<B>Cal_MemNewRecMgr</B>(
+  int  <b>size</b> <i></i>
+)
+</pre>
+<dd> Creates a new record manager with the given  record size.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemNewRec"></A>
+Cal_Pointer_t <I></I>
+<B>Cal_MemNewRec</B>(
+  Cal_RecMgr  <b>mgr</b> <i></i>
+)
+</pre>
+<dd> Allocates a record from the specified record manager.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_MemResizeBlock"></A>
+Cal_Pointer_t <I></I>
+<B>Cal_MemResizeBlock</B>(
+  Cal_Pointer_t  <b>p</b>, <i></i>
+  Cal_Address_t  <b>newSize</b> <i></i>
+)
+</pre>
+<dd> Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_PerformanceTest"></A>
+int <I></I>
+<B>Cal_PerformanceTest</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>outputBddArray</b>, <i></i>
+  int  <b>numFunctions</b>, <i></i>
+  int  <b>iteration</b>, <i></i>
+  int  <b>seed</b>, <i></i>
+  int  <b>andPerformanceFlag</b>, <i></i>
+  int  <b>multiwayPerformanceFlag</b>, <i></i>
+  int  <b>onewayPerformanceFlag</b>, <i></i>
+  int  <b>quantifyPerformanceFlag</b>, <i></i>
+  int  <b>composePerformanceFlag</b>, <i></i>
+  int  <b>relprodPerformanceFlag</b>, <i></i>
+  int  <b>swapPerformanceFlag</b>, <i></i>
+  int  <b>substitutePerformanceFlag</b>, <i></i>
+  int  <b>sanityCheckFlag</b>, <i></i>
+  int  <b>computeMemoryOverheadFlag</b>, <i></i>
+  int  <b>superscalarFlag</b> <i></i>
+)
+</pre>
+<dd> optional
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_PipelineCreateProvisionalBdd"></A>
+Cal_Bdd <I></I>
+<B>Cal_PipelineCreateProvisionalBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>fUserBdd</b>, <i></i>
+  Cal_Bdd  <b>gUserBdd</b> <i></i>
+)
+</pre>
+<dd> The provisional BDD is automatically freed once the
+  pipeline is quitted.
+<p>
+
+<dt><pre>
+<A NAME="Cal_PipelineExecute"></A>
+int <I></I>
+<B>Cal_PipelineExecute</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> All the results are computed. User should update the
+  BDDs of interest. Eventually this feature would become transparent.
+<p>
+
+<dd> <b>Side Effects</b> required
+<p>
+
+<dd> <b>See Also</b> <code>optional
+</code>
+
+<dt><pre>
+<A NAME="Cal_PipelineInit"></A>
+int <I></I>
+<B>Cal_PipelineInit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_BddOp_t  <b>bddOp</b> <i></i>
+)
+</pre>
+<dd> All the operations for this pipeline must be of the
+  same kind.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_PipelineQuit"></A>
+void <I></I>
+<B>Cal_PipelineQuit</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> The user must make sure to update all provisional BDDs
+  of interest before calling this routine.
+<p>
+
+<dt><pre>
+<A NAME="Cal_PipelineSetDepth"></A>
+void <I></I>
+<B>Cal_PipelineSetDepth</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  int  <b>depth</b> <i></i>
+)
+</pre>
+<dd> The "depth" determines the amount of dependency we
+  would allow in pipelined computation.
+<p>
+
+<dd> <b>Side Effects</b> None.
+<p>
+
+<dt><pre>
+<A NAME="Cal_PipelineUpdateProvisionalBdd"></A>
+Cal_Bdd <I></I>
+<B>Cal_PipelineUpdateProvisionalBdd</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd  <b>provisionalBdd</b> <i></i>
+)
+</pre>
+<dd> The provisional BDD is automatically freed after
+  quitting pipeline.
+<p>
+
+<dt><pre>
+<A NAME="Cal_TempAssociationAugment"></A>
+void <I></I>
+<B>Cal_TempAssociationAugment</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>associationInfoUserBdds</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> Pairs is 0 if the information represents only a list of
+  variables rather than a full association.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_TempAssociationInit"></A>
+void <I></I>
+<B>Cal_TempAssociationInit</B>(
+  Cal_BddManager  <b>bddManager</b>, <i></i>
+  Cal_Bdd * <b>associationInfoUserBdds</b>, <i></i>
+  int  <b>pairs</b> <i></i>
+)
+</pre>
+<dd> Pairs is 0 if the information represents only a list of
+  variables rather than a full association.
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+<dt><pre>
+<A NAME="Cal_TempAssociationQuit"></A>
+void <I></I>
+<B>Cal_TempAssociationQuit</B>(
+  Cal_BddManager  <b>bddManager</b> <i></i>
+)
+</pre>
+<dd> Cleans up temporary associationoptional
+<p>
+
+<dd> <b>Side Effects</b> None
+<p>
+
+
+</DL>
+<HR>
+Last updated on 970711 20h11
+</BODY></HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calGC.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calGC.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calGC.c	(revision 6)
@@ -0,0 +1,448 @@
+/**CFile***********************************************************************
+
+  FileName    [calGC.c]
+
+  PackageName [cal]
+
+  Synopsis    [Garbage collection routines]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan (rajeev@eecs.berkeley.edu)]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calGC.c,v 1.2 1998/09/16 16:08:40 ravi Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int CeilLog2(int number);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.]
+
+  Description [Sets the garbage collection mode, 0 means the garbage
+  collection should be turned off, 1 means garbage collection should
+  be on.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+void
+Cal_BddSetGCMode(
+  Cal_BddManager bddManager,
+  int  gcMode)
+{
+  bddManager->gcMode = gcMode;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Invokes the garbage collection at the manager level.]
+
+  Description [For each variable in the increasing id free nodes with reference
+  count equal to zero freeing a node results in decrementing reference count of
+  then and else nodes by one.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+int
+Cal_BddManagerGC(Cal_BddManager bddManager)
+{
+  Cal_BddIndex_t index;
+  Cal_BddId_t id;
+  int numNodesFreed;
+  /* unsigned long origNodes = bddManager->numNodes; */
+  
+  if (bddManager->numPeakNodes < (bddManager->numNodes +
+                                  bddManager->numForwardedNodes)){
+    bddManager->numPeakNodes = bddManager->numNodes +
+        bddManager->numForwardedNodes ;
+  }
+  
+  CalHashTableGC(bddManager, bddManager->uniqueTable[0]);
+  for(index = 0; index < bddManager->numVars; index++){
+    id = bddManager->indexToId[index];
+    numNodesFreed = CalHashTableGC(bddManager, bddManager->uniqueTable[id]);
+    bddManager->numNodes -= numNodesFreed;
+    bddManager->numNodesFreed += numNodesFreed;
+  }
+  /* Free the cache entries related to unused BDD nodes */
+  /* The assumption is that during CalHashTableGC, the freed BDD nodes
+     are marked. However, since they are not touched after being put
+     on the free list, the mark should be unaffected and can be used
+     for cleaning up the cache table.
+     */
+  CalCacheTableTwoGCFlush(bddManager->cacheTable);
+  bddManager->numGC++;
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Sets the limit of the garbage collection.]
+
+  Description [It tries to set the limit at twice the number of nodes
+  in the manager at the current point. However, the limit is not
+  allowed to fall below the MIN_GC_LIMIT or to exceed the value of
+  node limit (if one exists).]
+
+  SideEffects [None.]
+
+******************************************************************************/
+void
+Cal_BddManagerSetGCLimit(Cal_BddManager manager)
+{
+  manager->uniqueTableGCLimit = ((manager->numNodes) << 1);
+  if(manager->uniqueTableGCLimit < CAL_MIN_GC_LIMIT){
+    manager->uniqueTableGCLimit = CAL_MIN_GC_LIMIT;
+  }
+  if (manager->nodeLimit && (manager->uniqueTableGCLimit >
+                             manager->nodeLimit)){
+    manager->uniqueTableGCLimit = manager->nodeLimit;
+  }
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddManagerGCCheck(Cal_BddManager_t * bddManager)
+{
+  if (bddManager->gcMode == 0) return;
+  if (bddManager->gcCheck > 0) return;
+  bddManager->gcCheck = CAL_GC_CHECK;
+  if(bddManager->numNodes > bddManager->uniqueTableGCLimit){
+    Cal_BddManagerGC(bddManager);
+    Cal_BddManagerSetGCLimit(bddManager);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [This function performs the garbage collection operation
+  for a particular index.]
+
+  Description [The input is the hash table containing the nodes
+  belonging to that level. Each bin of the hash table is traversed and
+  the Bdd nodes with 0 reference count are put at the appropriate
+  level in the processing que of the manager.]
+
+  SideEffects [The number of nodes in the hash table can possibly decrease.]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableGC(Cal_BddManager_t *bddManager, CalHashTable_t *hashTable)
+{
+  CalBddNode_t *last, *next, *ptr, *thenBddNode, *elseBddNode;
+  int i;
+  int oldNumEntries;
+  
+  oldNumEntries = hashTable->numEntries;
+  for(i = 0; i < hashTable->numBins; i++){
+    last = NULL;
+    ptr = hashTable->bins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(ptr);
+      if(CalBddNodeIsRefCountZero(ptr)){
+        if (last == NULL){
+          hashTable->bins[i] = next;
+        }
+        else{
+          CalBddNodePutNextBddNode(last,next);
+        }
+        thenBddNode = CAL_BDD_POINTER(CalBddNodeGetThenBddNode(ptr));
+        elseBddNode = CAL_BDD_POINTER(CalBddNodeGetElseBddNode(ptr));
+        CalBddNodeDcrRefCount(thenBddNode);
+        CalBddNodeDcrRefCount(elseBddNode);
+        CalNodeManagerFreeNode(hashTable->nodeManager, ptr);
+        /* Mark the freed node for cache table clean up */
+        /* We have to make sure that the clean up routine is called */
+        /* right after this function (so that the marking remains */
+        /* valid) */
+        CalBddNodeMark(ptr);
+        hashTable->numEntries--;
+      }
+      else {
+        last = ptr;
+      }
+      ptr = next;
+    }
+  }
+  return oldNumEntries - hashTable->numEntries;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalRepackNodesAfterGC(Cal_BddManager_t *bddManager)
+{
+  int index, id, numPagesRequired, packingFlag, pageNum, nodeNum;
+  int rehashFlag = 0;
+  int newSizeIndex, hashValue;
+  CalNodeManager_t *nodeManager;
+  CalHashTable_t *uniqueTableForId;
+  CalBddNode_t *bddNode, *thenBddNode, *elseBddNode, *freeNodeList;
+  CalBddNode_t *newNode;
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  packingFlag = 0;
+  
+  for (index = bddManager->numVars-1; index >= 0; index--){
+    id = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[id];
+    nodeManager = uniqueTableForId->nodeManager;
+    if (CalBddIdNeedsRepacking(bddManager, id) == 0){
+      if (packingFlag == 0) continue; /* nothing needs to be done */
+      /* We just need to update the cofactors and continue; */
+      for (pageNum=0; pageNum < nodeManager->numPages; pageNum++){
+        for(nodeNum = 0,
+                bddNode = (CalBddNode_t *)nodeManager->pageList[pageNum]; 
+            nodeNum < NUM_NODES_PER_PAGE; nodeNum++, bddNode += 1){
+          if (CalBddNodeIsRefCountZero(bddNode) ||
+              CalBddNodeIsForwarded(bddNode)) continue;
+          thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+          elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+          CalBddNodeGetThenBdd(bddNode, thenBdd);
+          CalBddNodeGetElseBdd(bddNode, elseBdd);
+          if (CalBddIsForwarded(thenBdd)){
+            CalBddForward(thenBdd);
+            CalBddNodePutThenBdd(bddNode, thenBdd);
+            rehashFlag = 1;
+          }
+          if (CalBddIsForwarded(elseBdd)){
+            CalBddForward(elseBdd);
+            CalBddNodePutElseBdd(bddNode, elseBdd);
+            rehashFlag = 1;
+          }
+          Cal_Assert(!CalBddIsRefCountZero(thenBdd));
+          Cal_Assert(!CalBddIsRefCountZero(elseBdd));
+          Cal_Assert(bddManager->idToIndex[id] <
+                     bddManager->idToIndex[bddNode->thenBddId]);   
+          Cal_Assert(bddManager->idToIndex[id] < 
+                     bddManager->idToIndex[bddNode->elseBddId]);
+          if (rehashFlag){
+            CalUniqueTableForIdRehashNode(uniqueTableForId, bddNode,
+                                          thenBddNode, elseBddNode);
+          }
+        }
+      }
+      continue; /* move to next higher index */
+    }
+    packingFlag = 1;
+    if ((uniqueTableForId->numBins > uniqueTableForId->numEntries) &&
+        (uniqueTableForId->sizeIndex > HASH_TABLE_DEFAULT_SIZE_INDEX)){
+      /* Free the old bins */
+      Cal_MemFree(uniqueTableForId->bins);
+      /* Create the new set of bins */
+      newSizeIndex =
+          CeilLog2(uniqueTableForId->numEntries/HASH_TABLE_DEFAULT_MAX_DENSITY); 
+      if (newSizeIndex < HASH_TABLE_DEFAULT_SIZE_INDEX){
+        newSizeIndex = HASH_TABLE_DEFAULT_SIZE_INDEX;
+      }
+      uniqueTableForId->sizeIndex = newSizeIndex;
+      uniqueTableForId->numBins =  TABLE_SIZE(uniqueTableForId->sizeIndex);
+      uniqueTableForId->maxCapacity =
+          uniqueTableForId->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY; 
+      uniqueTableForId->bins = Cal_MemAlloc(CalBddNode_t *,
+                                            uniqueTableForId->numBins); 
+      if(uniqueTableForId->bins == Cal_Nil(CalBddNode_t *)){
+        CalBddFatalMessage("out of memory");
+      }
+    }
+    /* Clear the unique table bins */
+    memset((char *)uniqueTableForId->bins, 0,
+           uniqueTableForId->numBins*sizeof(CalBddNode_t *));
+    numPagesRequired =
+        uniqueTableForId->numEntries/NUM_NODES_PER_PAGE+1;
+    /* Traverse the first numPagesRequired pages of this nodeManager */
+    /* Create the new free list */
+    nodeManager->freeNodeList = freeNodeList = Cal_Nil(CalBddNode_t);
+    for (pageNum = 0; pageNum < nodeManager->numPages; pageNum++){
+      for(nodeNum = 0,
+              bddNode = (CalBddNode_t *)nodeManager->pageList[pageNum]; 
+          nodeNum < NUM_NODES_PER_PAGE; nodeNum++, bddNode += 1){
+        if(CalBddNodeIsRefCountZero(bddNode) ||
+           CalBddNodeIsForwarded(bddNode)){
+          if (pageNum < numPagesRequired){
+            bddNode->nextBddNode = freeNodeList;
+            freeNodeList = bddNode;
+          }
+          continue;
+        }
+        CalBddNodeGetThenBdd(bddNode, thenBdd);
+        CalBddNodeGetElseBdd(bddNode, elseBdd);
+        if (CalBddIsForwarded(thenBdd)){
+          CalBddForward(thenBdd);
+          CalBddNodePutThenBdd(bddNode, thenBdd);
+        }
+        if (CalBddIsForwarded(elseBdd)){
+          CalBddForward(elseBdd);
+          CalBddNodePutElseBdd(bddNode, elseBdd); 
+        }
+        if (pageNum < numPagesRequired){
+          /* Simply insert the node in the unique table */
+          hashValue = CalDoHash2(thenBdd.bddNode, elseBdd.bddNode,
+                                 uniqueTableForId); 
+          CalBddNodePutNextBddNode(bddNode, uniqueTableForId->bins[hashValue]);
+          uniqueTableForId->bins[hashValue] = bddNode;
+        }
+        else {
+          /* Create a new node */
+          newNode = freeNodeList;
+          freeNodeList = newNode->nextBddNode;
+          newNode->thenBddNode = bddNode->thenBddNode;
+          newNode->elseBddNode = bddNode->elseBddNode;
+          newNode->thenBddId = bddNode->thenBddId;
+          newNode->elseBddId = bddNode->elseBddId;
+          newNode->nextBddNode = bddNode->nextBddNode;
+          bddNode->elseBddNode = FORWARD_FLAG;
+          bddNode->thenBddId = id;
+          bddNode->thenBddNode = newNode;
+          hashValue = CalDoHash2(thenBdd.bddNode, elseBdd.bddNode,
+                                 uniqueTableForId); 
+          CalBddNodePutNextBddNode(newNode, uniqueTableForId->bins[hashValue]);
+          uniqueTableForId->bins[hashValue] = newNode;
+        }
+      }
+      if (pageNum >= numPagesRequired){
+        /* Free this page. I am assuming that there would not be any
+           call to PageManagerAllocPage, until this function finishes */
+        /* Also, CalPageManagerFreePage overwrites only the first field of
+           the bdd node (the nextBddNode field), hence no relevant
+           information is lost */
+        CalPageManagerFreePage(nodeManager->pageManager,
+                               nodeManager->pageList[pageNum]);
+        nodeManager->pageList[pageNum] = 0;
+      }
+    }
+#ifdef _CAL_VERBOSE    
+    printf("Recycled %4d pages for %3d id\n",
+           nodeManager->numPages-numPagesRequired, id);
+#endif
+    nodeManager->numPages = numPagesRequired;
+    nodeManager->freeNodeList = freeNodeList;
+  }
+  /* Need to update the handles to the nodes being moved */
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodes(bddManager);
+  }
+  
+  CalCacheTableTwoRepackUpdate(bddManager->cacheTable);
+
+  /* Fix the user BDDs */
+  CalBddReorderFixUserBddPtrs(bddManager);
+
+  /* Fix the association */
+  CalReorderAssociationFix(bddManager);
+
+  Cal_Assert(CalCheckAssoc(bddManager));
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the smallest integer greater than or equal to log2 of a
+  number]
+
+  Description [Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+CeilLog2(int  number)
+{
+  int num, count;
+  for (num=number, count=0; num > 1; num >>= 1, count++);
+  if ((1 << count) != number) count++;
+  return count;
+}
Index: /vis_dev/glu-2.1/src/calBdd/calHashTable.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calHashTable.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calHashTable.c	(revision 6)
@@ -0,0 +1,1048 @@
+/**CFile***********************************************************************
+
+  FileName    [calHashTable.c]
+
+  PackageName [cal]
+
+  Synopsis    [Functions to manage the hash tables that are a part of
+                  1. unique table
+                  2. request queue
+               ]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+                Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+              ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calHashTable.c,v 1.9 2002/09/21 20:39:25 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int CeilLog2(int number);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Initialize a hash table using default parameters.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+CalHashTable_t *
+CalHashTableInit(Cal_BddManager_t *bddManager, Cal_BddId_t  bddId)
+{
+  CalHashTable_t *hashTable;
+
+  hashTable = Cal_MemAlloc(CalHashTable_t, 1);
+  /*hashTable = CAL_BDD_NEW_REC(bddManager, CalHashTable_t);*/
+  if(hashTable == Cal_Nil(CalHashTable_t)){
+    CalBddFatalMessage("out of memory");
+  }
+  hashTable->sizeIndex = HASH_TABLE_DEFAULT_SIZE_INDEX;
+  hashTable->numBins = TABLE_SIZE(hashTable->sizeIndex);
+  hashTable->maxCapacity = hashTable->numBins*HASH_TABLE_DEFAULT_MAX_DENSITY;
+  hashTable->bins = Cal_MemAlloc(CalBddNode_t *, hashTable->numBins);
+  if(hashTable->bins == Cal_Nil(CalBddNode_t *)){
+    CalBddFatalMessage("out of memory");
+  }
+  memset((char *)hashTable->bins, 0,
+         hashTable->numBins*sizeof(CalBddNode_t *)); 
+  hashTable->bddId = bddId;
+  hashTable->nodeManager = bddManager->nodeManagerArray[bddId];
+  hashTable->requestNodeList = Cal_Nil(CalRequestNode_t);
+  memset((char *)(&(hashTable->startNode)), 0, sizeof(CalBddNode_t));
+  hashTable->endNode = &(hashTable->startNode);
+  hashTable->numEntries = 0;
+  return hashTable;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Free a hash table along with the associated storage.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableQuit(Cal_BddManager_t *bddManager, CalHashTable_t * hashTable)
+{
+  if(hashTable == Cal_Nil(CalHashTable_t))return 1;
+  /*
+  for(i = 0; i < hashTable->numBins; i++){
+    ptr = hashTable->bins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(ptr);
+      CalNodeManagerFreeNode(hashTable->nodeManager, ptr);
+      ptr = next;
+    }
+  }
+  There is no need to free the nodes individually. They will be taken
+  care of by the PageManagerQuit.
+  We need to make sure that this function is called only during the global quitting.
+  If it need be called at some intermediate point, we need to free the BDD nodes 
+  appropriately.
+  */
+  
+  Cal_MemFree(hashTable->bins);
+  Cal_MemFree(hashTable);
+  /*CAL_BDD_FREE_REC(bddManager, hashTable, CalHashTable_t);*/
+  return 0;
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Directly insert a BDD node in the hash table.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableAddDirect(CalHashTable_t * hashTable, CalBddNode_t * bddNode)
+{
+  int hashValue;
+  CalBddNode_t *thenBddNode, *elseBddNode;
+
+  hashTable->numEntries++;
+  if(hashTable->numEntries >= hashTable->maxCapacity){
+    CalHashTableRehash(hashTable, 1);
+  }
+  thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+  elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+  hashValue = CalDoHash2(thenBddNode, elseBddNode, hashTable);
+  CalBddNodePutNextBddNode(bddNode, hashTable->bins[hashValue]);
+  hashTable->bins[hashValue] = bddNode;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableFindOrAdd(CalHashTable_t * hashTable,
+                      Cal_Bdd_t  thenBdd,
+                      Cal_Bdd_t  elseBdd,
+                      Cal_Bdd_t * bddPtr)
+{
+  CalBddNode_t *ptr;
+  Cal_Bdd_t tmpBdd;
+  int hashValue;
+  
+  hashValue = CalDoHash2(CalBddGetBddNode(thenBdd), 
+      CalBddGetBddNode(elseBdd), hashTable);
+  ptr = hashTable->bins[hashValue];
+  while(ptr != Cal_Nil(CalBddNode_t)){
+    CalBddNodeGetThenBdd(ptr, tmpBdd);
+    if(CalBddIsEqual(thenBdd, tmpBdd)){
+      CalBddNodeGetElseBdd(ptr, tmpBdd);
+      if(CalBddIsEqual(elseBdd, tmpBdd)){
+        CalBddPutBddId(*bddPtr, hashTable->bddId);
+        CalBddPutBddNode(*bddPtr, ptr);
+        return 1;
+      }
+    }
+    ptr = CalBddNodeGetNextBddNode(ptr);
+  }
+  hashTable->numEntries++;
+  if(hashTable->numEntries > hashTable->maxCapacity){
+    CalHashTableRehash(hashTable,1);
+    hashValue = CalDoHash2(CalBddGetBddNode(thenBdd),
+        CalBddGetBddNode(elseBdd), hashTable);
+  }
+  CalNodeManagerInitBddNode(hashTable->nodeManager, thenBdd, elseBdd, 
+      hashTable->bins[hashValue], ptr);
+  hashTable->bins[hashValue] = ptr;
+  CalBddPutBddId(*bddPtr, hashTable->bddId);
+  CalBddPutBddNode(*bddPtr, ptr);
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableAddDirectAux(CalHashTable_t * hashTable, Cal_Bdd_t
+                         thenBdd, Cal_Bdd_t  elseBdd, Cal_Bdd_t *
+                         bddPtr) 
+{
+  CalBddNode_t *ptr;
+  int hashValue;
+  
+  hashTable->numEntries++;
+  if(hashTable->numEntries >= hashTable->maxCapacity){
+    CalHashTableRehash(hashTable, 1);
+  }
+  hashValue = CalDoHash2(CalBddGetBddNode(thenBdd), CalBddGetBddNode(elseBdd),
+                         hashTable); 
+  CalNodeManagerInitBddNode(hashTable->nodeManager, thenBdd, elseBdd, 
+      hashTable->bins[hashValue], ptr);
+  hashTable->bins[hashValue] = ptr;
+  CalBddPutBddId(*bddPtr, hashTable->bddId);
+  CalBddPutBddNode(*bddPtr, ptr);
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableCleanUp(CalHashTable_t * hashTable)
+{
+  CalNodeManager_t *nodeManager;
+
+  nodeManager = hashTable->nodeManager;
+  hashTable->endNode->nextBddNode = nodeManager->freeNodeList;
+  nodeManager->freeNodeList = hashTable->startNode.nextBddNode;
+  hashTable->endNode = &(hashTable->startNode);
+  hashTable->numEntries = 0;
+  hashTable->startNode.nextBddNode = NULL;
+  Cal_Assert(!(hashTable->requestNodeList));
+  hashTable->requestNodeList = Cal_Nil(CalRequestNode_t);
+  return;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableLookup(
+  CalHashTable_t * hashTable,
+  Cal_Bdd_t  thenBdd,
+  Cal_Bdd_t  elseBdd,
+  Cal_Bdd_t * bddPtr)
+{
+  CalBddNode_t *ptr;
+  Cal_Bdd_t tmpBdd;
+  int hashValue;
+  
+  hashValue = CalDoHash2(CalBddGetBddNode(thenBdd),
+      CalBddGetBddNode(elseBdd), hashTable);
+  ptr = hashTable->bins[hashValue];
+  while(ptr != Cal_Nil(CalBddNode_t)){
+    CalBddNodeGetThenBdd(ptr, tmpBdd);
+    if(CalBddIsEqual(thenBdd, tmpBdd)){
+      CalBddNodeGetElseBdd(ptr, tmpBdd);
+      if(CalBddIsEqual(elseBdd, tmpBdd)){
+        CalBddPutBddId(*bddPtr, hashTable->bddId);
+        CalBddPutBddNode(*bddPtr, ptr);
+        return 1;
+      }
+    }
+    ptr = CalBddNodeGetNextBddNode(ptr);
+  }
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Deletes a BDD node in the hash table.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableDelete(CalHashTable_t * hashTable, CalBddNode_t * bddNode)
+{
+  int hashValue;
+  Cal_Bdd_t thenBdd, elseBdd;
+  CalBddNode_t  *ptr, *last;
+
+  CalBddNodeGetThenBdd(bddNode, thenBdd);
+  CalBddNodeGetElseBdd(bddNode, elseBdd);
+  hashValue =
+      CalDoHash2(CalBddGetBddNode(thenBdd), CalBddGetBddNode(elseBdd), hashTable);
+
+  last = Cal_Nil(CalBddNode_t);
+  ptr = hashTable->bins[hashValue];
+  while(ptr != Cal_Nil(CalBddNode_t)){
+    if(ptr == bddNode){
+      if(last == Cal_Nil(CalBddNode_t)){
+        hashTable->bins[hashValue] = CalBddNodeGetNextBddNode(ptr);
+      }
+      else{
+        CalBddNodePutNextBddNode(last, CalBddNodeGetNextBddNode(ptr));
+      }
+      hashTable->numEntries--;
+      CalNodeManagerFreeNode(hashTable->nodeManager, ptr);
+      return;
+    }
+    last = ptr;
+    ptr = CalBddNodeGetNextBddNode(ptr);
+  }
+  CalBddWarningMessage("Trying to delete a non-existent node\n");
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Lookup unique table for id.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalUniqueTableForIdLookup(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  Cal_Bdd_t  thenBdd,
+  Cal_Bdd_t  elseBdd,
+  Cal_Bdd_t * bddPtr)
+{
+  CalBddNode_t *ptr;
+  Cal_Bdd_t tmpBdd;
+  int hashValue;
+  
+  hashValue = CalDoHash2(CalBddGetBddNode(thenBdd),
+      CalBddGetBddNode(elseBdd), hashTable);
+  ptr = hashTable->bins[hashValue];
+  if(CalBddIsOutPos(thenBdd)){
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      CalBddNodeGetThenBdd(ptr, tmpBdd);
+      if(CalBddIsEqual(thenBdd, tmpBdd)){
+        CalBddNodeGetElseBdd(ptr, tmpBdd);
+        if(CalBddIsEqual(elseBdd, tmpBdd)){
+          CalBddPutBddId(*bddPtr, hashTable->bddId);
+          CalBddPutBddNode(*bddPtr, ptr);
+          return 1;
+        }
+      }
+      ptr = CalBddNodeGetNextBddNode(ptr);
+    }
+  }
+  else{
+    CalBddNot(thenBdd, thenBdd);
+    CalBddNot(elseBdd, elseBdd);
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      CalBddNodeGetThenBdd(ptr, tmpBdd);
+      if(CalBddIsEqual(thenBdd, tmpBdd)){
+        CalBddNodeGetElseBdd(ptr, tmpBdd);
+        if(CalBddIsEqual(elseBdd, tmpBdd)){
+          CalBddPutBddId(*bddPtr, hashTable->bddId);
+          CalBddPutBddNode(*bddPtr, CalBddNodeNot(ptr));
+          return 1;
+        }
+      }
+      ptr = CalBddNodeGetNextBddNode(ptr);
+    }
+  }
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [find or add in the unique table for id.]
+
+  Description [optional]
+
+  SideEffects [If a new BDD node is created (found == false), then the
+  numNodes field of the manager needs to be incremented.]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalUniqueTableForIdFindOrAdd(
+  Cal_BddManager_t * bddManager,
+  CalHashTable_t * hashTable,
+  Cal_Bdd_t  thenBdd,
+  Cal_Bdd_t  elseBdd,
+  Cal_Bdd_t * bddPtr)
+{
+  int found = 0; 
+  if (CalBddIsEqual(thenBdd, elseBdd)){
+    *bddPtr = thenBdd;
+    found = 1;
+  }
+  else if(CalBddIsOutPos(thenBdd)){
+    found = CalHashTableFindOrAdd(hashTable, thenBdd, elseBdd, bddPtr);
+  }
+  else{
+    CalBddNot(thenBdd, thenBdd);
+    CalBddNot(elseBdd, elseBdd);
+    found = CalHashTableFindOrAdd(hashTable, thenBdd, elseBdd, bddPtr);
+    CalBddNot(*bddPtr, *bddPtr);
+  }
+  if (!found) bddManager->numNodes++;
+  return found;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+
+void
+CalHashTableRehash(CalHashTable_t *hashTable,int grow)
+{
+  CalBddNode_t *ptr, *next;
+  CalBddNode_t **oldBins = hashTable->bins;
+  int i, hashValue;
+  int oldNumBins = hashTable->numBins;
+
+  if(grow){
+    hashTable->sizeIndex++;
+  }
+  else{
+    if (hashTable->sizeIndex <= HASH_TABLE_DEFAULT_SIZE_INDEX){/* No need to rehash */
+      return;
+    }
+    hashTable->sizeIndex--;
+  }
+
+  hashTable->numBins = TABLE_SIZE(hashTable->sizeIndex);
+  hashTable->maxCapacity = hashTable->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY;
+  hashTable->bins = Cal_MemAlloc(CalBddNode_t *, hashTable->numBins);
+  if(hashTable->bins == Cal_Nil(CalBddNode_t *)){
+    CalBddFatalMessage("out of memory");
+  }
+  /*
+  for(i = 0; i < hashTable->numBins; i++){
+    hashTable->bins[i] = Cal_Nil(CalBddNode_t);
+  }
+  */
+  memset((char *)hashTable->bins, 0,
+         hashTable->numBins*sizeof(CalBddNode_t *));
+
+  for(i = 0; i < oldNumBins; i++){
+    ptr = oldBins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(ptr);
+      hashValue = CalDoHash2(CalBddNodeGetThenBddNode(ptr),
+          CalBddNodeGetElseBddNode(ptr), hashTable);
+      CalBddNodePutNextBddNode(ptr, hashTable->bins[hashValue]);
+      hashTable->bins[hashValue] = ptr;
+      ptr = next;
+    }
+  }
+  Cal_MemFree(oldBins);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalUniqueTableForIdRehashNode(CalHashTable_t *hashTable, CalBddNode_t *bddNode,
+                              CalBddNode_t *thenBddNode,
+                              CalBddNode_t *elseBddNode)
+
+{
+  CalBddNode_t *nextBddNode;
+  CalBddNode_t *ptr;
+  int found;
+  int hashValue;
+  int oldHashValue;
+  Cal_Bdd_t thenBdd;
+
+  oldHashValue = CalDoHash2(thenBddNode, elseBddNode, hashTable);
+  hashValue = CalDoHash2(CalBddNodeGetThenBddNode(bddNode),
+                         CalBddNodeGetElseBddNode(bddNode),
+                         hashTable);
+  CalBddNodeGetThenBdd(bddNode, thenBdd);
+  if (CalBddIsComplement(thenBdd)) {
+    CalBddFatalMessage("Complement edge on then pointer");
+  }
+  if (oldHashValue == hashValue) {
+    return;
+  }
+
+  found = 0;
+  ptr = hashTable->bins[oldHashValue];
+  if ((ptr != Cal_Nil(CalBddNode_t)) && (ptr == bddNode)) {
+    hashTable->bins[oldHashValue] = CalBddNodeGetNextBddNode(bddNode);
+    found = 1;
+  } else {
+    while (ptr != Cal_Nil(CalBddNode_t)) {
+      nextBddNode = CalBddNodeGetNextBddNode(ptr);
+      if (nextBddNode == bddNode) {
+        CalBddNodePutNextBddNode(ptr, CalBddNodeGetNextBddNode(bddNode));
+        found = 1;
+        break;
+      }
+      ptr = nextBddNode;
+    }
+  }
+
+  if (!found) {
+    CalBddFatalMessage("Node not found in the unique table");
+  } else {
+    CalBddNodePutNextBddNode(bddNode, hashTable->bins[hashValue]);
+    hashTable->bins[hashValue] = bddNode;
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+  
+unsigned long
+CalBddUniqueTableNumLockedNodes(Cal_BddManager_t *bddManager,
+                                CalHashTable_t *uniqueTableForId)
+{
+  CalBddNode_t *bddNode;
+  long i;
+  unsigned long numLockedNodes = 0;
+  
+  for(i=0; i<uniqueTableForId->numBins; i++){
+    bddNode = uniqueTableForId->bins[i];
+    while (bddNode){
+      numLockedNodes += CalBddNodeIsRefCountMax(bddNode);
+      bddNode = CalBddNodeGetNextBddNode(bddNode);
+    }
+  }
+  return numLockedNodes;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalPackNodes(Cal_BddManager_t *bddManager)
+{
+  int index, id;
+  
+  for (index = bddManager->numVars-1; index >= 0; index--){
+    id = bddManager->indexToId[index];
+    CalBddPackNodesForSingleId(bddManager, id);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddPackNodesForSingleId(Cal_BddManager_t *bddManager,
+                           Cal_BddId_t id)
+{
+  /* Need to copy the one for "AfterReorder" and suitably modify. */
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Packs the nodes if the variables which has just
+  been sifted.]
+  
+  Description        [fixForwardedNodesFlag: Whether we need to fix
+  the forwarded nodes of variables corresponding to bestIndex through
+  bottomIndex. If this flag is set, then the forwarded nodes of these
+  variables are traversed and updated after the nodes of the bestIndex
+  have been copied. At the end the forwarded nodes are freed. If this
+  flag is not set, it is assumed that the cleanup pass has already
+  been performed.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddPackNodesAfterReorderForSingleId(Cal_BddManager_t *bddManager,
+                                       int fixForwardedNodesFlag,
+                                       int bestIndex, 
+                                       int bottomIndex) 
+{
+  /* We need to pack the nodes for this id and fix the cofactors of
+     the upper indices.
+     */
+  CalBddNode_t *node, *nextBddNode, *dupNode, **oldBins;
+  CalBddNode_t *thenBddNode, *elseBddNode, *bddNode;
+  Cal_Bdd_t thenBdd;
+  CalAddress_t *page;
+  int id = bddManager->indexToId[bestIndex];
+  CalNodeManager_t *nodeManager = bddManager->nodeManagerArray[id];
+  CalAddress_t **oldPageList = nodeManager->pageList;
+  int oldNumPages = nodeManager->numPages;
+  CalHashTable_t *uniqueTableForId = bddManager->uniqueTable[id];
+  int numPagesRequired, newSizeIndex, index, i;
+  long oldNumBins, hashValue;
+  
+  
+#ifdef _CAL_VERBOSE
+  fprintf(stdout,"Repacking id %3d\n", id);
+#endif
+  
+
+  nodeManager->freeNodeList = Cal_Nil(CalBddNode_t);
+  nodeManager->numPages = 0;
+  numPagesRequired = uniqueTableForId->numEntries/NUM_NODES_PER_PAGE;
+  nodeManager->maxNumPages =
+      2*(numPagesRequired ? numPagesRequired : 1);
+
+  nodeManager->pageList = Cal_MemAlloc(CalAddress_t *,
+                                       nodeManager->maxNumPages); 
+  
+  oldBins = uniqueTableForId->bins;
+  oldNumBins = uniqueTableForId->numBins;
+  /* Create the new set of bins */
+  newSizeIndex =
+      CeilLog2(uniqueTableForId->numEntries/HASH_TABLE_DEFAULT_MAX_DENSITY);
+
+  if (newSizeIndex < HASH_TABLE_DEFAULT_SIZE_INDEX){
+    newSizeIndex = HASH_TABLE_DEFAULT_SIZE_INDEX;
+  }
+
+  uniqueTableForId->sizeIndex = newSizeIndex;
+  uniqueTableForId->numBins =  TABLE_SIZE(uniqueTableForId->sizeIndex);
+  uniqueTableForId->maxCapacity =
+      uniqueTableForId->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY; 
+
+  uniqueTableForId->bins = Cal_MemAlloc(CalBddNode_t *,
+                                        uniqueTableForId->numBins); 
+  if(uniqueTableForId->bins == Cal_Nil(CalBddNode_t *)){
+    CalBddFatalMessage("out of memory");
+  }
+
+  memset((char *)uniqueTableForId->bins, 0, 
+        uniqueTableForId->numBins*sizeof(CalBddNode_t *)); 
+
+  for (i = 0; i < oldNumBins; i++){
+    node = oldBins[i];
+    while (node){
+      nextBddNode = CalBddNodeGetNextBddNode(node);
+      CalNodeManagerCreateAndDupBddNode(nodeManager, node, dupNode);
+      thenBddNode = CalBddNodeGetThenBddNode(dupNode);
+      elseBddNode = CalBddNodeGetElseBddNode(dupNode);
+      hashValue = CalDoHash2(thenBddNode, elseBddNode, uniqueTableForId);
+      CalBddNodePutNextBddNode(dupNode, uniqueTableForId->bins[hashValue]);
+      uniqueTableForId->bins[hashValue] = dupNode;
+      CalBddNodePutThenBddNode(node, dupNode);
+      CalBddNodePutThenBddId(node, id);
+      CalBddNodePutElseBddNode(node, FORWARD_FLAG);
+      node = nextBddNode;
+      Cal_Assert(!(CalBddNodeIsRefCountZero(dupNode)));
+    }
+  }
+  
+  if (fixForwardedNodesFlag){
+      CalBddNode_t *requestNodeList =
+          bddManager->uniqueTable[id]->startNode.nextBddNode;  
+      for (bddNode = requestNodeList; bddNode; bddNode = nextBddNode){
+        Cal_Assert(CalBddNodeIsForwarded(bddNode));
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        CalBddNodeGetThenBdd(bddNode, thenBdd);
+        if (CalBddGetBddId(thenBdd) == id){
+          if (CalBddIsForwarded(thenBdd)) {
+            CalBddForward(thenBdd);
+            Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+            CalBddNodePutThenBdd(bddNode, thenBdd);
+          }
+        }
+        Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+      }
+      for (index = bestIndex+1; index <= bottomIndex; index++){   
+      int varId = bddManager->indexToId[index];
+      requestNodeList =
+          bddManager->uniqueTable[varId]->startNode.nextBddNode;   
+      for (bddNode = requestNodeList; bddNode; bddNode = nextBddNode){
+        Cal_Assert(CalBddNodeIsForwarded(bddNode));
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        CalBddNodeGetThenBdd(bddNode, thenBdd);
+        if (CalBddIsForwarded(thenBdd)) {
+          CalBddForward(thenBdd);
+          Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+          CalBddNodePutThenBdd(bddNode, thenBdd);
+        }
+        Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+      }
+    }
+  }
+  
+/* Traverse the upper indices fixing the cofactors */
+  for (index = bestIndex-1; index >= 0; index--){
+    CalBddReorderFixCofactors(bddManager,
+                           bddManager->indexToId[index]); 
+  }
+
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodes(bddManager);
+  }
+  
+  /* Fix the user BDDs */
+  CalBddReorderFixUserBddPtrs(bddManager);
+
+  CalBddIsForwardedTo(bddManager->varBdds[id]);
+
+  /* Fix the association */
+  CalReorderAssociationFix(bddManager);
+  
+  /* Free the old bins */
+  Cal_MemFree(oldBins);
+
+  uniqueTableForId->endNode = &(uniqueTableForId->startNode);
+  uniqueTableForId->startNode.nextBddNode = NULL;
+  if (fixForwardedNodesFlag){
+    CalBddReorderReclaimForwardedNodes(bddManager, bestIndex+1,
+                                    bottomIndex);
+  }
+  /* Free the old pages */
+  for (i = 0; i < oldNumPages; i++){
+    page = oldPageList[i]; 
+    CalPageManagerFreePage(nodeManager->pageManager, page);
+  }
+  Cal_MemFree(oldPageList);
+  Cal_Assert(CalCheckAllValidity(bddManager));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddPackNodesForMultipleIds(Cal_BddManager_t *bddManager,
+                              Cal_BddId_t beginId, int numLevels)
+{
+  /* We need to pack the nodes for this id and fix the cofactors of
+     the upper indices.
+     */
+  int index = bddManager->idToIndex[beginId];
+  int level, id;
+  long i, j;
+  CalBddNode_t *node, *nextBddNode, *dupNode, *thenBddNode;
+  CalBddNode_t *elseBddNode, **oldBins;
+  Cal_Bdd_t thenBdd, elseBdd;
+  CalNodeManager_t *nodeManager;
+  CalHashTable_t *uniqueTableForId;
+  int someRepackingDone = 0;
+  long oldNumBins, hashValue;
+  int newSizeIndex;
+
+
+  CalAddress_t *page, ***oldPageListArray, **oldPageList;
+  int *oldNumPagesArray;
+  int numPagesRequired;
+  
+  oldPageListArray = Cal_MemAlloc(CalAddress_t **, numLevels);
+
+  oldNumPagesArray = Cal_MemAlloc(int, numLevels);
+  
+  for (level = numLevels-1; level >= 0; level--){
+    id = bddManager->indexToId[index+level];
+    oldNumPagesArray[level] = 0;
+    oldPageListArray[level] = Cal_Nil(CalAddress_t *);
+    if (CalBddIdNeedsRepacking(bddManager, id)){
+      nodeManager = bddManager->nodeManagerArray[id];
+      uniqueTableForId = bddManager->uniqueTable[id];
+      oldPageListArray[level] = nodeManager->pageList;
+      oldNumPagesArray[level] = nodeManager->numPages;
+      nodeManager->freeNodeList = Cal_Nil(CalBddNode_t);
+      nodeManager->numPages = 0;
+      numPagesRequired = uniqueTableForId->numEntries/NUM_NODES_PER_PAGE;
+      nodeManager->maxNumPages =
+          2*(numPagesRequired ? numPagesRequired : 1);
+      nodeManager->pageList = Cal_MemAlloc(CalAddress_t *,
+                                           nodeManager->maxNumPages); 
+      oldBins = uniqueTableForId->bins;
+      oldNumBins = uniqueTableForId->numBins;
+      /* Create the new set of bins */
+      newSizeIndex =
+          CeilLog2(uniqueTableForId->numEntries /
+                   HASH_TABLE_DEFAULT_MAX_DENSITY);  
+      if (newSizeIndex < HASH_TABLE_DEFAULT_SIZE_INDEX){
+        newSizeIndex = HASH_TABLE_DEFAULT_SIZE_INDEX;
+      }
+      uniqueTableForId->sizeIndex = newSizeIndex;
+      uniqueTableForId->numBins =  TABLE_SIZE(uniqueTableForId->sizeIndex);
+      uniqueTableForId->maxCapacity =
+          uniqueTableForId->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY; 
+      
+      uniqueTableForId->bins = Cal_MemAlloc(CalBddNode_t *,
+                                            uniqueTableForId->numBins); 
+      if(uniqueTableForId->bins == Cal_Nil(CalBddNode_t *)){
+        CalBddFatalMessage("out of memory");
+      }
+      memset((char *)uniqueTableForId->bins, 0, 
+            uniqueTableForId->numBins*sizeof(CalBddNode_t *)); 
+      
+      for (i = 0; i < oldNumBins; i++){
+        node = oldBins[i];
+        while (node){
+          nextBddNode = CalBddNodeGetNextBddNode(node);
+          CalBddNodeGetThenBdd(node, thenBdd);
+          CalBddNodeGetElseBdd(node, elseBdd);
+          if (CalBddIsForwarded(thenBdd)){
+            CalBddForward(thenBdd);
+            CalBddNodePutThenBdd(node, thenBdd);
+          }
+          if (CalBddIsForwarded(elseBdd)){
+            CalBddForward(elseBdd);
+            CalBddNodePutElseBdd(node, elseBdd);
+          }
+          CalNodeManagerCreateAndDupBddNode(nodeManager, node, dupNode);
+          thenBddNode = CalBddNodeGetThenBddNode(dupNode);
+          elseBddNode = CalBddNodeGetElseBddNode(dupNode);
+          hashValue = CalDoHash2(thenBddNode, elseBddNode, uniqueTableForId);
+          CalBddNodePutNextBddNode(dupNode, uniqueTableForId->bins[hashValue]);
+          uniqueTableForId->bins[hashValue] = dupNode;
+          CalBddNodePutThenBddNode(node, dupNode);
+          CalBddNodePutThenBddId(node, id);
+          CalBddNodePutElseBddNode(node, FORWARD_FLAG);
+          node = nextBddNode;
+          Cal_Assert(!(CalBddNodeIsRefCountZero(dupNode)));
+        }
+      }
+
+#ifdef __FOO__
+      /*fprintf(stdout,"Repacking id = %d, index = %d\n", id, index+level);*/
+      /* First put all the nodes in that list */
+      nodeList = Cal_Nil(CalBddNode_t);
+      for (i = 0; i < uniqueTableForId->numBins; i++){
+        node = uniqueTableForId->bins[i];
+        while (node){
+          nextBddNode = CalBddNodeGetNextBddNode(node);
+          /* The "then" and "else" pointers could be forwarded */
+          CalBddNodeGetThenBdd(node, thenBdd);
+          CalBddNodeGetElseBdd(node, elseBdd);
+          if (CalBddIsForwarded(thenBdd)){
+            CalBddForward(thenBdd);
+            CalBddNodePutThenBdd(node, thenBdd);
+          }
+          if (CalBddIsForwarded(elseBdd)){
+            CalBddForward(elseBdd);
+            CalBddNodePutElseBdd(node, elseBdd);
+          }
+          CalBddNodePutNextBddNode(node, nodeList);
+          nodeList = node;
+          node = nextBddNode;
+        }
+        uniqueTableForId->bins[i] = Cal_Nil(CalBddNode_t);
+      }
+      uniqueTableForId->numEntries = 0;
+      
+      for (node = nodeList; node; node = nextBddNode){
+        nextBddNode = CalBddNodeGetNextBddNode(node);
+        CalNodeManagerCreateAndDupBddNode(nodeManager, node, dupNode);
+        /* Hash the dupNode */
+        CalHashTableAddDirect(uniqueTableForId, dupNode);
+        /* Make the original node a forwarding node */
+        CalBddNodePutThenBddNode(node, dupNode);
+        CalBddNodePutThenBddId(node, id);
+        CalBddNodePutElseBddNode(node, FORWARD_FLAG);
+      }
+#endif
+      someRepackingDone = 1;
+    }
+    else if (someRepackingDone){ /* Still need to fix the cofactors */
+      CalBddReorderFixCofactors(bddManager, id);
+    }
+  }
+  
+
+  /* Traverse the upper indices fixing the cofactors */
+  for (i = index-1; i >= 0; i--){
+    CalBddReorderFixCofactors(bddManager,
+                              bddManager->indexToId[i]);
+  }
+
+  /* Fix the user BDDs */
+  CalBddReorderFixUserBddPtrs(bddManager);
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodes(bddManager);
+  }
+  /* Fix Cache Tables */
+  (void)CalCacheTableTwoRepackUpdate(bddManager->cacheTable);
+  
+  for (level = numLevels - 1 ; level >= 0; level--){
+    id = bddManager->indexToId[index+level];
+    /* Update varBdd field of bdd manager */
+    CalBddIsForwardedTo(bddManager->varBdds[id]);
+    /* Fix associations */
+    CalVarAssociationRepackUpdate(bddManager, id);
+    /* Free the old pages */
+    nodeManager = bddManager->nodeManagerArray[id];
+    oldPageList = oldPageListArray[level];
+    for (j = 0; j < oldNumPagesArray[level]; j++){
+      page = oldPageList[j]; 
+      CalPageManagerFreePage(nodeManager->pageManager, page);
+    }
+    if ((unsigned long)oldPageList) Cal_MemFree(oldPageList);
+  }
+  Cal_MemFree(oldPageListArray);
+  Cal_MemFree(oldNumPagesArray);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns the smallest integer greater than or equal to log2 of a
+  number]
+
+  Description [Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+CeilLog2(
+  int  number)
+{
+  int num, count;
+  for (num=number, count=0; num > 1; num >>= 1, count++);
+  if ((1 << count) != number) count++;
+  return count;
+}
Index: /vis_dev/glu-2.1/src/calBdd/calHashTableOne.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calHashTableOne.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calHashTableOne.c	(revision 6)
@@ -0,0 +1,298 @@
+/**CFile***********************************************************************
+
+  FileName    [calHashTableOne.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for managing hash table with Bdd is a key and
+               int, long, or double as a value]
+
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+              ] 
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calHashTableOne.c,v 1.1.1.3 1998/05/04 00:58:57 hsv Exp $]
+
+******************************************************************************/
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#ifdef USE_POWER_OF_2
+#  define HashTableOneDoHash(hashTable, keyBdd) \
+     (((CalAddress_t)(CalBddGetBddNode(keyBdd)) / NODE_SIZE) & ((hashTable)->numBins - 1))
+#else
+#  define HashTableOneDoHash(hashTable, keyBdd) \
+     (((CalAddress_t)(CalBddGetBddNode(keyBdd)) / NODE_SIZE) % hashTable->numBins)
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void HashTableOneRehash(CalHashTable_t * hashTable, int grow);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Initialize a hash table using default parameters.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+CalHashTable_t *
+CalHashTableOneInit(Cal_BddManager_t * bddManager, int  itemSize)
+{
+  int i;
+  CalHashTable_t *hashTable;
+
+  hashTable = Cal_MemAlloc(CalHashTable_t, 1);
+  if(hashTable == Cal_Nil(CalHashTable_t)){
+    CalBddFatalMessage("out of memory");
+  }
+  hashTable->sizeIndex = HASH_TABLE_DEFAULT_SIZE_INDEX;
+  hashTable->numBins = TABLE_SIZE(hashTable->sizeIndex);
+  hashTable->maxCapacity = hashTable->numBins*HASH_TABLE_DEFAULT_MAX_DENSITY;
+  hashTable->bins = Cal_MemAlloc(CalBddNode_t *, hashTable->numBins);
+  if(hashTable->bins == Cal_Nil(CalBddNode_t *)){
+    CalBddFatalMessage("out of memory");
+  }
+  for(i = 0; i < hashTable->numBins; i++){
+    hashTable->bins[i] = Cal_Nil(CalBddNode_t);
+  }
+  hashTable->numEntries = 0;
+  hashTable->bddId = (Cal_BddId_t)itemSize;
+  if(itemSize > NODE_SIZE){
+    CalBddFatalMessage("CalHashTableOneInit: itemSize exceeds NODE_SIZE");
+  }
+  hashTable->nodeManager = bddManager->nodeManagerArray[0];
+  hashTable->requestNodeList = Cal_Nil(CalRequestNode_t);
+  return hashTable;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Free a hash table along with the associated storage.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableOneQuit(
+  CalHashTable_t * hashTable)
+{
+  CalBddNode_t *ptr, *next, *node;
+  int i;
+  if(hashTable == Cal_Nil(CalHashTable_t))return;
+  for(i = 0; i < hashTable->numBins; i++){
+    ptr = hashTable->bins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(ptr);
+      node = CalBddNodeGetElseBddNode(ptr);
+      CalNodeManagerFreeNode(hashTable->nodeManager, node);
+      CalNodeManagerFreeNode(hashTable->nodeManager, ptr);
+      ptr = next;
+    }
+  }
+  Cal_MemFree(hashTable->bins);
+  Cal_MemFree(hashTable);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Directly insert a BDD node in the hash table.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableOneInsert(CalHashTable_t * hashTable, Cal_Bdd_t  keyBdd,
+                      char * valuePtr)
+{
+  int hashValue;
+  CalBddNode_t *bddNode, *dataPtr;
+
+  hashValue = HashTableOneDoHash(hashTable, keyBdd);
+  hashTable->numEntries++;
+  if(hashTable->numEntries >= hashTable->maxCapacity){
+    HashTableOneRehash(hashTable, 1);
+    hashValue = HashTableOneDoHash(hashTable, keyBdd);
+  }
+  CalNodeManagerAllocNode(hashTable->nodeManager, dataPtr);
+  memcpy(dataPtr, valuePtr, (size_t)hashTable->bddId);
+  CalNodeManagerAllocNode(hashTable->nodeManager, bddNode);
+  CalBddNodePutThenBdd(bddNode, keyBdd);
+  CalBddNodePutElseBddNode(bddNode, dataPtr);
+  CalBddNodePutNextBddNode(bddNode, hashTable->bins[hashValue]);
+  hashTable->bins[hashValue] = bddNode;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableOneLookup(CalHashTable_t * hashTable, Cal_Bdd_t  keyBdd,
+                      char ** valuePtrPtr)
+{
+  CalBddNode_t *ptr;
+  Cal_Bdd_t tmpBdd;
+  int hashValue;
+  
+  hashValue = HashTableOneDoHash(hashTable, keyBdd);
+  ptr = hashTable->bins[hashValue];
+  while(ptr != Cal_Nil(CalBddNode_t)){
+    CalBddNodeGetThenBdd(ptr, tmpBdd);
+    if(CalBddIsEqual(keyBdd, tmpBdd)){
+      if(valuePtrPtr){
+        *valuePtrPtr = (char *)CalBddNodeGetElseBddNode(ptr);
+      }
+      return 1;
+    }
+    ptr = CalBddNodeGetNextBddNode(ptr);
+  }
+  if(valuePtrPtr){
+    *valuePtrPtr = Cal_Nil(char);
+  }
+  return 0;
+}
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableOneRehash(
+  CalHashTable_t * hashTable,
+  int  grow)
+{
+  CalBddNode_t *ptr, *next;
+  CalBddNode_t **oldBins = hashTable->bins;
+  int i, hashValue;
+  int oldNumBins = hashTable->numBins;
+  Cal_Bdd_t keyBdd;
+
+  if(grow){
+    hashTable->sizeIndex++;
+  }
+  else{
+    if (hashTable->sizeIndex <= HASH_TABLE_DEFAULT_SIZE_INDEX){/* No need to rehash */
+      return;
+    }
+    hashTable->sizeIndex--;
+  }
+
+  hashTable->numBins = TABLE_SIZE(hashTable->sizeIndex);
+  hashTable->maxCapacity = hashTable->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY;
+  hashTable->bins = Cal_MemAlloc(CalBddNode_t *, hashTable->numBins);
+  if(hashTable->bins == Cal_Nil(CalBddNode_t *)){
+    CalBddFatalMessage("out of memory");
+  }
+  for(i = 0; i < hashTable->numBins; i++){
+    hashTable->bins[i] = Cal_Nil(CalBddNode_t);
+  }
+
+  for(i = 0; i < oldNumBins; i++){
+    ptr = oldBins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(ptr);
+      CalBddNodeGetThenBdd(ptr, keyBdd);
+      hashValue = HashTableOneDoHash(hashTable, keyBdd);
+      CalBddNodePutNextBddNode(ptr, hashTable->bins[hashValue]);
+      hashTable->bins[hashValue] = ptr;
+      ptr = next;
+    }
+  }
+  Cal_MemFree(oldBins);
+}
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calHashTableThree.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calHashTableThree.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calHashTableThree.c	(revision 6)
@@ -0,0 +1,221 @@
+/**CFile***********************************************************************
+
+  FileName    [calHashTableThree.c]
+
+  PackageName [cal]
+
+  Synopsis    [Functions to manage the hash tables that are a part of
+                  ITE operation]
+
+  Description [CalHashTableThreeFindOrAdd]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+                Rajeev Ranjan   (rajeev@eecs.berkeley.edu)]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calHashTableThree.c,v 1.1.1.3 1998/05/04 00:58:58 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#ifdef USE_POWER_OF_2
+#define CalDoHash3(fBddNode, gBddNode, hBddNode,table) \
+((((CalAddress_t)fBddNode + \
+   (CalAddress_t)gBddNode + \
+   (CalAddress_t) hBddNode) \
+  / NODE_SIZE) & ((table)->numBins-1))
+#else
+#define CalDoHash3(fBddNode, gBddNode, hBddNode,table) \
+  ((((CalAddress_t)fBddNode + \
+  (CalAddress_t)gBddNode + \
+  (CalAddress_t) hBddNode) \
+  / NODE_SIZE)% table->numBins)
+#endif
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CalHashTableThreeRehash(CalHashTable_t *hashTable, int grow);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalHashTableThreeFindOrAdd(CalHashTable_t * hashTable,
+                           Cal_Bdd_t  f,
+                           Cal_Bdd_t  g,
+                           Cal_Bdd_t  h,
+                           Cal_Bdd_t * bddPtr)
+{
+  CalBddNode_t *ptr, *ptrIndirect;
+  Cal_Bdd_t tmpBdd;
+  int hashValue;
+  
+  hashValue = CalDoHash3(CalBddGetBddNode(f), 
+      CalBddGetBddNode(g), CalBddGetBddNode(h), hashTable);
+  ptr = hashTable->bins[hashValue];
+  while(ptr != Cal_Nil(CalBddNode_t)){
+    CalBddNodeGetThenBdd(ptr, tmpBdd);
+    if(CalBddIsEqual(f, tmpBdd)){
+      ptrIndirect = CalBddNodeGetElseBddNode(ptr);
+      CalBddNodeGetThenBdd(ptrIndirect, tmpBdd);
+      if(CalBddIsEqual(g, tmpBdd)){
+        CalBddNodeGetElseBdd(ptrIndirect, tmpBdd);
+        if(CalBddIsEqual(h, tmpBdd)){
+          CalBddPutBddId(*bddPtr, hashTable->bddId);
+          CalBddPutBddNode(*bddPtr, ptr);
+          return 1;
+        }
+      }
+    }
+    ptr = CalBddNodeGetNextBddNode(ptr);
+  }
+  hashTable->numEntries++;
+  if(hashTable->numEntries > hashTable->maxCapacity){
+    CalHashTableThreeRehash(hashTable,1);
+    hashValue = CalDoHash3(CalBddGetBddNode(f),
+        CalBddGetBddNode(g), CalBddGetBddNode(h), hashTable);
+  }
+  CalNodeManagerAllocNode(hashTable->nodeManager, ptr);
+  CalNodeManagerAllocNode(hashTable->nodeManager, ptrIndirect);
+  CalBddNodePutThenBdd(ptr, f);
+  CalBddNodePutThenBdd(ptrIndirect, g);
+  CalBddNodePutElseBdd(ptrIndirect, h);
+  CalBddNodePutElseBddNode(ptr, ptrIndirect);
+  CalBddNodePutNextBddNode(ptr, hashTable->bins[hashValue]);
+  hashTable->bins[hashValue] = ptr;
+  CalBddPutBddId(*bddPtr, hashTable->bddId);
+  CalBddPutBddNode(*bddPtr, ptr);
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalHashTableThreeRehash(CalHashTable_t *hashTable, int grow)
+{
+  CalBddNode_t *ptr, *ptrIndirect, *next;
+  CalBddNode_t **oldBins = hashTable->bins;
+  int i, hashValue;
+  int oldNumBins = hashTable->numBins;
+
+  if(grow){
+    hashTable->sizeIndex++;
+  }
+  else{
+    if (hashTable->sizeIndex <= HASH_TABLE_DEFAULT_SIZE_INDEX){/* No need to rehash */
+      return;
+    }
+    hashTable->sizeIndex--;
+  }
+
+  hashTable->numBins = TABLE_SIZE(hashTable->sizeIndex);
+  hashTable->numBins = hashTable->numBins;
+  hashTable->maxCapacity = hashTable->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY;
+  hashTable->bins = Cal_MemAlloc(CalBddNode_t *, hashTable->numBins);
+  if(hashTable->bins == Cal_Nil(CalBddNode_t *)){
+    CalBddFatalMessage("out of memory");
+  }
+  for(i = 0; i < hashTable->numBins; i++){
+    hashTable->bins[i] = Cal_Nil(CalBddNode_t);
+  }
+
+  for(i = 0; i < oldNumBins; i++){
+    ptr = oldBins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(ptr);
+      ptrIndirect = CalBddNodeGetElseBddNode(ptr);
+      hashValue = CalDoHash3(CalBddNodeGetThenBddNode(ptr),
+          CalBddNodeGetThenBddNode(ptrIndirect),
+          CalBddNodeGetElseBddNode(ptrIndirect), hashTable);
+      CalBddNodePutNextBddNode(ptr, hashTable->bins[hashValue]);
+      hashTable->bins[hashValue] = ptr;
+      ptr = next;
+    }
+  }
+  Cal_MemFree(oldBins);
+}
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calInt.h
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calInt.h	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calInt.h	(revision 6)
@@ -0,0 +1,1578 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [calInt.h]
+
+  PackageName [cal]
+
+  Synopsis    [The internal data structures, macros and function declarations]
+
+  Description []
+
+  SeeAlso     [cal.h]
+
+  Author      [Rajeev K. Ranjan (rajeev@ic.eecs.berkeley.edu
+               Jagesh Sanghavi  (sanghavi@ic.eecs.berkeley.edu)]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calInt.h,v 1.11 2002/09/14 20:19:58 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _CALINT
+#define _CALINT
+
+#include "cal.h"
+
+/* Make sure variable argument lists work */
+#if HAVE_STDARG_H
+#  include <stdarg.h>
+#else
+#  if HAVE_VARARGS_H
+#    include <varargs.h>
+#  else
+#    error "Need to have HAVE_STDARG_H or HAVE_VARARGS_H defined for variable arguments"
+#  endif
+#endif
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/* Begin Performance Related Constants */
+
+/* Garbage collection and reordering related constants */
+/* The following constants could significantly affect the
+   performance of the package */ 
+
+
+#define CAL_MIN_GC_LIMIT 10000 /* minimum number of nodes in the unique table
+                                  before performing garbage collection. It can
+                                  be overridden by user define node limit */
+
+
+
+
+#define CAL_REPACK_AFTER_GC_THRESHOLD 0.75 /* If the number of nodes fall below
+                                           this factor after garbage
+                                           collection, repacking should be
+                                           done */ 
+/* A note about repacking after garbage collection: Since repacking
+** moves the node pointers, it is important that "user" does not have
+** access to internal node pointers during such times. If for some
+** purposes the node handle is needed and also there is a possibility of
+** garbage collection being invoked, this field (repackAfterGCThreshold) of
+** the bdd manager should be set to 0.
+*/
+
+#define CAL_TABLE_REPACK_THRESHOLD 0.9 /* If the page utility of a unique
+                                            table (for some id) goes below this, repacking
+                                            would be done */ 
+
+#define CAL_BDD_REORDER_THRESHOLD 10000 /* Don't perform reordering below these
+                                           many nodes */
+
+#define CAL_NUM_PAGES_THRESHOLD 3
+
+#define CAL_NUM_FORWARDED_NODES_LIMIT 50000 /* maximum number of forwarded nodes 
+                                               allowed during BF reordering */
+
+#define CAL_GC_CHECK 100       /* garbage collection check performed after
+                                  addition of every GC_CHECK number of nodes to
+                                  the unique table */
+
+/* End Performance Related Constants */
+
+/* Memory Management related constants */
+#define NODE_SIZE sizeof(CalBddNode_t)		/* sizeof(CalBddNode_t) */
+
+#ifndef PAGE_SIZE
+#  define PAGE_SIZE 4096	/* size of a virtual memory page */
+#endif
+#ifndef LG_PAGE_SIZE
+#  define LG_PAGE_SIZE 12	/* log2 of the page size */
+#endif
+
+#define NUM_NODES_PER_PAGE (PAGE_SIZE/NODE_SIZE)
+
+#define MAX_NUM_SEGMENTS 32 
+#define NUM_PAGES_PER_SEGMENT 64 /* We start with grabbing 64 pages at a time */
+#define MIN_NUM_PAGES_PER_SEGMENT 4
+#define MAX_NUM_PAGES 10
+
+#define MIN_REC_SIZE CAL_ALLOC_ALIGNMENT
+#define MAX_REC_SIZE (sizeof(CalHashTable_t)) /* size of hash table */
+#define NUM_REC_MGRS (((MAX_REC_SIZE-MIN_REC_SIZE)/CAL_ALLOC_ALIGNMENT)+1)
+
+
+
+
+/* true / false */
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+
+
+/* Error Codes */
+#define CAL_BDD_OK 0
+#define CAL_BDD_OVERFLOWED 1
+
+/* bdd variable id and index related constants */
+#define CAL_BDD_NULL_ID ((unsigned short) ((1 << 8*sizeof(unsigned short)) - 1))
+#define CAL_BDD_CONST_ID 0
+#define CAL_MAX_VAR_ID ((unsigned short) (CAL_BDD_NULL_ID - 1))
+#define CAL_BDD_NULL_INDEX (unsigned short) ((1 << 8*sizeof(unsigned short)) - 1)
+#define CAL_BDD_CONST_INDEX CAL_BDD_NULL_INDEX
+#define CAL_MAX_VAR_INDEX (CAL_BDD_NULL_INDEX - 1)
+#define CAL_MAX_REF_COUNT (unsigned short)((1 << 8*sizeof(char)) - 1)
+#define CAL_INFINITY (1 << 20)
+
+/* Pipeline related constants */
+#define MAX_INSERT_DEPTH 256
+#define PIPELINE_EXECUTION_DEPTH 1
+#define DEFAULT_DEPTH 4
+#define DEFAULT_MAX_DEPTH 6
+
+
+#define FORWARD_FLAG 0     /* Flag used to identify redundant nodes */
+
+
+/* Hash table management related constants. */
+#define HASH_TABLE_DEFAULT_MAX_DENSITY 5
+#define HASH_TABLE_DEFAULT_SIZE_INDEX 8
+#define HASH_TABLE_DEFAULT_NUM_BINS TABLE_SIZE(HASH_TABLE_DEFAULT_SIZE_INDEX)
+#define HASH_TABLE_DEFAULT_MAX_CAPACITY HASH_TABLE_DEFAULT_NUM_BINS*HASH_TABLE_DEFAULT_MAX_DENSITY
+extern unsigned long calPrimes[];
+
+#define USE_POWER_OF_2
+#ifdef  USE_POWER_OF_2
+#define TABLE_SIZE(sizeIndex) (1<<sizeIndex)
+#else
+#define TABLE_SIZE(sizeIndex) (calPrimes[sizeIndex])
+#endif
+
+
+/* Codes to be used in cache table */
+#define  CAL_OP_INVALID 0x0000
+#define  CAL_OP_OR 0x1000
+#define  CAL_OP_AND 0x2000
+#define  CAL_OP_NAND 0x3000
+#define  CAL_OP_QUANT 0x4000
+#define  CAL_OP_REL_PROD 0x5000
+#define  CAL_OP_COMPOSE 0x6000
+#define  CAL_OP_SUBST 0x7000
+#define  CAL_OP_VAR_SUBSTITUTE 0x8000
+
+#define  CAL_LARGE_BDD (1<<19) /* For smaller BDDs, we would
+                                  use depth-first exist and forall routines */
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct Cal_BddStruct Cal_Bdd_t;
+typedef struct CalBddNodeStruct CalBddNode_t;
+typedef unsigned short Cal_BddRefCount_t;
+typedef struct CalPageManagerStruct CalPageManager_t;
+typedef struct CalNodeManagerStruct CalNodeManager_t;
+typedef struct CalListStruct CalList_t;
+typedef struct CalHashTableStruct CalHashTable_t;
+typedef struct CalHashTableStruct *CalReqQueForId_t;
+typedef struct CalHashTableStruct CalReqQueForIdAtDepth_t;
+typedef struct CalAssociationStruct CalAssociation_t;
+typedef struct CalBddNodeStruct CalRequestNode_t;
+typedef struct Cal_BddStruct CalRequest_t;
+typedef struct CalCacheTableStruct CalCacheTable_t;
+typedef int (*CalBddNodeToIndexFn_t)(CalBddNode_t*, Cal_BddId_t);
+typedef unsigned long CalAddress_t;
+typedef struct Cal_BlockStruct Cal_Block_t;
+
+struct Cal_BddStruct {
+  Cal_BddId_t bddId;      /* variable id */
+  CalBddNode_t *bddNode;  /* pointer to the bdd node */
+};
+
+typedef int (*CalOpProc_t) (Cal_BddManager, Cal_Bdd_t, Cal_Bdd_t, Cal_Bdd_t *); 
+typedef int (*CalOpProc1_t) (Cal_BddManager, Cal_Bdd_t, Cal_Bdd_t *); 
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+enum CalPipeStateEnum { READY, CREATE, UPDATE };
+typedef enum CalPipeStateEnum CalPipeState_t;
+
+struct CalNodeManagerStruct{
+  CalPageManager_t *pageManager;
+  CalBddNode_t *freeNodeList;
+  int numPages;
+  int maxNumPages;
+  CalAddress_t **pageList;
+};
+
+struct CalPageManagerStruct {
+  CalAddress_t *freePageList;
+  CalAddress_t **pageSegmentArray; /* Array of pointers to segments */
+  int *numPagesArray; /* Number of pages in each segment */
+  int numSegments;
+  int totalNumPages; /* Total number of pages = sum of elements of numPagesArray */
+  int numPagesPerSegment;
+  int maxNumSegments;
+};
+
+struct CalBddNodeStruct {
+  CalBddNode_t *nextBddNode; /* Attn: CalPageManagerFreePage overwrites this field of the node. Hence need to be aware of the consequences if the order of the fields is changed */
+
+  CalBddNode_t *thenBddNode;
+  CalBddNode_t *elseBddNode;
+  Cal_BddId_t thenBddId;
+  Cal_BddId_t elseBddId;
+};
+
+struct CalHashTableStruct {
+  int sizeIndex;
+  long numBins;
+  long maxCapacity;
+  CalBddNode_t **bins;
+  Cal_BddId_t bddId;
+  CalNodeManager_t *nodeManager;
+  CalBddNode_t *requestNodeList;
+ /* The following two fields are added to improve the performance of hash table clean up.*/
+  CalBddNode_t startNode;
+  CalBddNode_t *endNode;
+  long numEntries;
+};
+
+struct CalAssociationStruct {
+  Cal_Bdd_t *varAssociation;
+  int lastBddIndex;
+  int id;
+  int refCount;
+  CalAssociation_t *next;
+};
+
+struct Cal_BlockStruct
+{
+  long numChildren;
+  Cal_Block_t **children;
+  int reorderable;
+  long firstIndex;
+  long lastIndex;
+};
+
+/* Cal_BddManager_t - manages the BDD nodes */
+struct Cal_BddManagerStruct {
+
+  int numVars; /*
+                * Number of BDD variables present in the manager. This does
+                * not include the constant. The maximum number of variables 
+                * manager can have is CAL_MAX_VAR_ID (as opposed to
+                CAL_MAX_VAR_ID+1, id "0" being used for constant).
+                * CAL_MAX_VAR_ID = (((1 << 16) - 1) -1 )
+                */
+  int maxNumVars; /* Maximum number of variables which can be created without
+                     reallocating memory */
+
+  Cal_Bdd_t *varBdds; /* Array of Cal_Bdd_t's. Cal_Bdd_t[i] is the BDD
+                         corresponding to variable with id "i". */
+  
+  /* memory management */
+  CalPageManager_t *pageManager1;  /* manages memory pages */
+  CalPageManager_t *pageManager2;  /* manages memory pages */
+  CalNodeManager_t **nodeManagerArray; /*
+                                        * nodeManagerArray[i] is the node
+                                        * manager for the variable with id = i.
+                                        */     
+  /* special nodes */
+  Cal_Bdd_t bddOne; /* Constant: Id = 0; Index = CAL_MAX_INDEX */
+  Cal_Bdd_t bddZero;
+  Cal_Bdd_t bddNull;
+  CalBddNode_t *userOneBdd;
+  CalBddNode_t *userZeroBdd;
+
+  Cal_BddId_t *indexToId; /*
+                           * Table mapping index to id. If there are n
+                           * variables, then this table has n entries from
+                           * 0 to n-1 (indexToId[0] through indexToId[n-1]).
+                           */
+  Cal_BddIndex_t *idToIndex; /*
+                              * Table mapping id to index:
+                              * idToIndex[0] = CAL_MAX_INDEX
+                              * If there are n variables in the manager, then
+                              * corresponding to these variables this table
+                              * has entries from 1 to n (idToIndex[1] through
+                              * idToIndex[n]).
+                              */
+  
+  CalHashTable_t **uniqueTable; /* uniqueTable[i] is the unique table for the
+                                 * variable id " i". Unique table for an id is
+                                 * a hash table of the nodes with that
+                                 * variable id.
+                                 */
+  CalCacheTable_t *cacheTable; /* Computed table */
+
+  /* Special functions */
+  void (*TransformFn) (Cal_BddManager_t*, CalAddress_t, CalAddress_t,
+       CalAddress_t*, CalAddress_t*, Cal_Pointer_t);
+  Cal_Pointer_t transformEnv;
+
+  /* logic operation management */
+  CalHashTable_t ***reqQue;     /* reqQue[depth][id] is the hash table of
+                                 * requests corresponding to variable id "id"
+                                 * and the request depth "depth".
+                                 */
+                               
+  /* Pipeline related information */
+  int depth;
+  int maxDepth;
+  CalPipeState_t pipelineState;
+  CalOpProc_t pipelineFn;
+  int pipelineDepth;
+  int currentPipelineDepth;
+  CalRequestNode_t **requestNodeArray;/* Used for pipelined operations. */
+  CalRequestNode_t *userProvisionalNodeList;   /* List of user BDD nodes
+                                                  pointing to provisional
+                                                  BDDs */
+  CalRequestNode_t **requestNodeListArray;
+  
+
+  /* garbage collection related information */
+  unsigned long numNodes;
+  unsigned long numPeakNodes;
+  unsigned long numNodesFreed;
+  int gcCheck;
+  unsigned long uniqueTableGCLimit;
+  int  numGC;
+  int gcMode;
+  unsigned long nodeLimit;
+  int overflow;
+  float repackAfterGCThreshold;
+  
+
+  /* Association related stuff */
+  CalAssociation_t *currentAssociation;
+  CalAssociation_t *associationList;
+  CalAssociation_t *tempAssociation;
+  unsigned short tempOpCode; /* To store the id of temporary associations. */
+  
+  /* Variable reordering related stuff */
+  long *interact; /* Interaction matrix */
+  int dynamicReorderingEnableFlag;
+  int reorderMethod;
+  int reorderTechnique;
+  long numForwardedNodes;
+  int numReorderings;
+  long maxNumVarsSiftedPerReordering;
+  long numSwaps;
+  long numTrivialSwaps;
+  long maxNumSwapsPerReordering;
+  double maxSiftingGrowth;
+  long reorderingThreshold;
+  long maxForwardedNodes;
+  float tableRepackThreshold;
+  Cal_Block superBlock; /* Variable blocks */
+
+
+  void *hooks;
+  int debugFlag;
+
+  
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+#ifdef COMPUTE_MEMORY_OVERHEAD
+long calNumEntriesAfterReduce, calNumEntriesAfterApply;
+double calAfterReduceToAfterApplyNodesRatio, calAfterReduceToUniqueTableNodesRatio;
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/ 
+
+
+#define CalNodeManagerAllocNode(nodeManager, node)                          \
+{                                                                           \
+  if((nodeManager)->freeNodeList != Cal_Nil(CalBddNode_t)){                 \
+    node = nodeManager->freeNodeList;                                       \
+    nodeManager->freeNodeList = ((CalBddNode_t *)(node))->nextBddNode;      \
+    Cal_Assert(!((CalAddress_t)nodeManager->freeNodeList & 0xf));\
+  }                                                                         \
+  else{                                                                     \
+    CalBddNode_t *_freeNodeList, *_nextNode, *_node;                        \
+    _freeNodeList =                                                         \
+        (CalBddNode_t *)CalPageManagerAllocPage(nodeManager->pageManager);  \
+    for(_node = _freeNodeList + NUM_NODES_PER_PAGE - 1, _nextNode =0;       \
+        _node != _freeNodeList; _nextNode = _node--){                       \
+      _node->nextBddNode = _nextNode;                                       \
+    }                                                                       \
+    nodeManager->freeNodeList = _freeNodeList + 1;                          \
+    node = _node;                                                           \
+    if ((nodeManager)->numPages == (nodeManager)->maxNumPages){             \
+      (nodeManager)->maxNumPages *= 2;                                      \
+      (nodeManager)->pageList =                                            \
+          Cal_MemRealloc(CalAddress_t *, (nodeManager)->pageList,          \
+                         (nodeManager)->maxNumPages);                       \
+    }                                                                       \
+    (nodeManager)->pageList[(nodeManager)->numPages++] = (CalAddress_t *)_freeNodeList;    \
+  }                                                                         \
+  ((CalBddNode_t *)(node))->nextBddNode = 0;                                \
+  ((CalBddNode_t *)(node))->thenBddId = 0;                                  \
+  ((CalBddNode_t *)(node))->elseBddId = 0;                                  \
+  ((CalBddNode_t *)(node))->thenBddNode = 0;                                \
+  ((CalBddNode_t *)(node))->elseBddNode = 0;                                \
+}
+
+#define CalNodeManagerFreeNode(nodeManager, node) \
+{ \
+  (node)->nextBddNode = (nodeManager)->freeNodeList; \
+  (nodeManager)->freeNodeList = node; \
+}
+#define CalNodeManagerInitBddNode(nodeManager, thenBdd, elseBdd, next, node) \
+{ \
+  if((nodeManager)->freeNodeList != Cal_Nil(CalBddNode_t)){ \
+    node = nodeManager->freeNodeList; \
+    nodeManager->freeNodeList = ((CalBddNode_t *)(node))->nextBddNode; \
+    Cal_Assert(!((CalAddress_t)nodeManager->freeNodeList & 0xf));\
+  } \
+  else{ \
+    CalBddNode_t *_freeNodeList, *_nextNode, *_node; \
+    _freeNodeList = \
+        (CalBddNode_t *)CalPageManagerAllocPage(nodeManager->pageManager); \
+    for(_node = _freeNodeList + NUM_NODES_PER_PAGE - 1, _nextNode =0; \
+        _node != _freeNodeList; _nextNode = _node--){ \
+      _node->nextBddNode = _nextNode; \
+    } \
+    nodeManager->freeNodeList = _freeNodeList + 1; \
+    node = _node; \
+    if ((nodeManager)->numPages == (nodeManager)->maxNumPages){             \
+      (nodeManager)->maxNumPages *= 2;                                      \
+      (nodeManager)->pageList =                                            \
+          Cal_MemRealloc(CalAddress_t *, (nodeManager)->pageList,          \
+                         (nodeManager)->maxNumPages);                       \
+    }                                                                       \
+    (nodeManager)->pageList[(nodeManager)->numPages++] = (CalAddress_t *)_freeNodeList;    \
+  } \
+  ((CalBddNode_t *)(node))->nextBddNode = next; \
+  ((CalBddNode_t *)(node))->thenBddId = CalBddGetBddId(thenBdd); \
+  ((CalBddNode_t *)(node))->elseBddId = CalBddGetBddId(elseBdd); \
+  ((CalBddNode_t *)(node))->thenBddNode = CalBddGetBddNode(thenBdd); \
+  ((CalBddNode_t *)(node))->elseBddNode = CalBddGetBddNode(elseBdd); \
+}
+
+#define CalNodeManagerCreateAndDupBddNode(nodeManager, node, dupNode)\
+{ \
+  if((nodeManager)->freeNodeList != Cal_Nil(CalBddNode_t)){ \
+    dupNode = nodeManager->freeNodeList; \
+    nodeManager->freeNodeList = ((CalBddNode_t *)(dupNode))->nextBddNode; \
+  } \
+  else{ \
+    CalBddNode_t *_freeNodeList, *_nextNode, *_node; \
+    _freeNodeList = \
+        (CalBddNode_t *)CalPageManagerAllocPage(nodeManager->pageManager); \
+    for(_node = _freeNodeList + NUM_NODES_PER_PAGE - 1, _nextNode =0; \
+        _node != _freeNodeList; _nextNode = _node--){ \
+      _node->nextBddNode = _nextNode; \
+    } \
+    nodeManager->freeNodeList = _freeNodeList + 1; \
+    dupNode = _node; \
+    if ((nodeManager)->numPages == (nodeManager)->maxNumPages){             \
+      (nodeManager)->maxNumPages *= 2;                                      \
+      (nodeManager)->pageList =                                            \
+          Cal_MemRealloc(CalAddress_t *, (nodeManager)->pageList,          \
+                         (nodeManager)->maxNumPages);                       \
+    }                                                                       \
+    (nodeManager)->pageList[(nodeManager)->numPages++] = (CalAddress_t *)_freeNodeList;    \
+  } \
+  ((CalBddNode_t *)(dupNode))->nextBddNode = (node)->nextBddNode; \
+  ((CalBddNode_t *)(dupNode))->thenBddId = (node)->thenBddId;\
+  ((CalBddNode_t *)(dupNode))->elseBddId = (node)->elseBddId;\
+  ((CalBddNode_t *)(dupNode))->thenBddNode = (node)->thenBddNode;\
+  ((CalBddNode_t *)(dupNode))->elseBddNode = (node)->elseBddNode; \
+}
+
+/* Record manager size range stuff */
+
+#define CAL_BDD_NEW_REC(bddManager, type) ((type *)Cal_MemNewRec((bddManager)->recordMgrArray[(CAL_ROUNDUP(sizeof(type))-MIN_REC_SIZE)/CAL_ALLOC_ALIGNMENT]))
+#define CAL_BDD_FREE_REC(bddManager, rec, type) Cal_MemFreeRec((bddManager)->recordMgrArray[(CAL_ROUNDUP(sizeof(type))-MIN_REC_SIZE)/CAL_ALLOC_ALIGNMENT], (rec))
+
+/*
+** We would like to do repacking if :
+** i) The id has more than minimum number of pages.
+** ii) The ratio between the actual number of entries and the capacity is
+**     less than a threshold.
+*/
+#define CalBddIdNeedsRepacking(bddManager, id)                              \
+((bddManager->nodeManagerArray[id]->numPages > CAL_NUM_PAGES_THRESHOLD) && (bddManager->uniqueTable[id]->numEntries < bddManager->tableRepackThreshold *  \
+  bddManager->nodeManagerArray[id]->numPages * NUM_NODES_PER_PAGE))
+
+
+/*
+ * Macros for managing Cal_Bdd_t and CalBddNode_t.
+ * INTERNAL FUNCTIONS SHOULD NOT TOUCH THE INTERNAL FIELDS
+ * FUNCTIONS IN calTerminal.c ARE EXCEPTION TO THIS GENERAL RULE
+ *
+ * {CalBdd} X {Get, Put} X {ThenBddId, ElseBddId, ThenBddNode, ElseBddNode,
+ *     ThenBdd, ElseBdd, BddId, BddNode, NextBddNode}
+ * {CalBdd} X {Get, Put, Icr, Dcr, Add} X {RefCount}
+ * {CalBdd,CalBddNode} X {Get} X {BddIndex}
+ * {CalBdd} X {Is} X {RefCountZero, OutPos, BddOne, BddZero, BddNull, BddConst} 
+ * {CalBddManager} X {Get} X {BddZero, BddOne, BddNull}
+ * {CalBddNode} X {Get, Put} X {ThenBddId, ElseBddId, ThenBddNode, ElseBddNode,
+ *     ThenBdd, ElseBdd, NextBddNode}
+ * {CalBddNode} X {Get, Put, Icr, Dcr, Add} X {RefCount}
+ * {CalBddNode} X {Is} X {RefCountZero, OutPos}
+ * {CalBddEqual, CalBddNodeEqual}
+ *
+ * {CalRequest} X {Get, Put} X {ThenRequestId, ElseRequestId, ThenRequestNode,
+ *     ElseRequestNode, ThenRequest, ElseRequest, RequestId, RequestNode,
+ *     F, G, Next}
+ * {CalRequest} X {Is} X {Null}
+ * {CalRequestNode} X {Get, Put} X {ThenRequestId, ElseRequestId,
+ *     ThenRequestNode, ElseRequestNode, ThenRequest, ElseRequest, F, G, Next}
+ */
+
+#define CAL_BDD_POINTER(f) ((CalBddNode_t *)(((CalAddress_t)f) & \
+    ~(CalAddress_t)0xf))
+#define CAL_TAG0(pointer) ((CalAddress_t)((CalAddress_t)(pointer) & 0x1))
+#define CalBddIsComplement(calBdd) ((int)CAL_TAG0((calBdd).bddNode))
+#define CalBddUpdatePhase(calBdd, complement) \
+    ((calBdd).bddNode = \
+    (CalBddNode_t *)((CalAddress_t)((calBdd).bddNode) ^ complement))
+
+#define CalBddZero(bddManager) ((bddManager)->bddZero)
+#define CalBddOne(bddManager) ((bddManager)->bddOne)
+#define CalBddNull(bddManager) ((bddManager)->bddNull)
+#define CalBddIsBddConst(calBdd) ((calBdd).bddId == 0)
+/* We are cheating here. Ideally we should compare both the id as well as the bdd node */
+#define CalBddIsEqual(calBdd1, calBdd2)\
+    (((calBdd1).bddNode == (calBdd2).bddNode))
+#define CalBddIsComplementEqual(calBdd1, calBdd2) \
+    (((calBdd1).bddNode == \
+    (CalBddNode_t *)(((CalAddress_t)(calBdd2).bddNode) ^ 0x1)))
+#define CalBddSameOrNegation(calBdd1, calBdd2)	\
+    (CAL_BDD_POINTER((calBdd1).bddNode) == CAL_BDD_POINTER((calBdd2).bddNode))
+
+/* CAUTION: MACRO ASSUMES THAT THE INDEX CORRESPONDING TO varId IS LESS THAN OR
+ * EQUAL TO THE INDEX OF calBdd */
+#define CalBddGetCofactors(calBdd, varId, fx, fxbar) \
+{ \
+    if(varId == (calBdd).bddId){ \
+      CalBddGetThenBdd(calBdd, fx); \
+      CalBddGetElseBdd(calBdd, fxbar); \
+    } \
+    else{ \
+      fx = calBdd; \
+      fxbar = calBdd; \
+    } \
+}
+
+#define CalBddGetThenBddId(calBdd) CAL_BDD_POINTER((calBdd).bddNode)->thenBddId
+#define CalBddGetElseBddId(calBdd) CAL_BDD_POINTER((calBdd).bddNode)->elseBddId
+#define CalBddGetThenBddIndex(bddManager, calBdd) \
+    (bddManager->idToIndex[CAL_BDD_POINTER((calBdd).bddNode)->thenBddId])
+#define CalBddGetElseBddIndex(bddManager, calBdd) \
+    (bddManager->idToIndex[CAL_BDD_POINTER((calBdd).bddNode)->elseBddId])
+
+#define CalBddGetThenBddNode(calBdd) \
+    ((CalBddNode_t*) \
+    (((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->thenBddNode) \
+    & ~0xe) ^ (CAL_TAG0((calBdd).bddNode))))
+
+#define CalBddGetElseBddNode(calBdd) \
+    ((CalBddNode_t*) \
+    (((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->elseBddNode) \
+    & ~0xe) ^ (CAL_TAG0((calBdd).bddNode))))
+ 
+#define CalBddGetThenBdd(calBdd, _thenBdd) \
+{ \
+  CalBddNode_t *_bddNode, *_bddNodeTagged; \
+  _bddNodeTagged = (calBdd).bddNode; \
+  _bddNode = CAL_BDD_POINTER(_bddNodeTagged); \
+  (_thenBdd).bddId = _bddNode->thenBddId; \
+  (_thenBdd).bddNode = (CalBddNode_t*) (((CalAddress_t) (_bddNode->thenBddNode) \
+      & ~0xe)^(CAL_TAG0(_bddNodeTagged))); \
+}
+
+#define CalBddGetElseBdd(calBdd, _elseBdd) \
+{ \
+  CalBddNode_t *_bddNode, *_bddNodeTagged; \
+  _bddNodeTagged = (calBdd).bddNode; \
+  _bddNode = CAL_BDD_POINTER(_bddNodeTagged); \
+  (_elseBdd).bddId = _bddNode->elseBddId; \
+  (_elseBdd).bddNode = (CalBddNode_t*) (((CalAddress_t) (_bddNode->elseBddNode) \
+        & ~0xe)^(CAL_TAG0(_bddNodeTagged)));\
+}
+
+
+#define CalBddGetBddId(calBdd) ((calBdd).bddId)
+#define CalBddGetBddIndex(bddManager, calBdd) \
+    (bddManager->idToIndex[(calBdd).bddId])
+#define CalBddGetBddNode(calBdd) ((calBdd).bddNode)
+#define CalBddGetBddNodeNot(calBdd) \
+    ((CalBddNode_t*)(((CalAddress_t)((calBdd).bddNode))^0x1))
+
+#define CalBddGetNextBddNode(calBdd) \
+    ((CalBddNode_t *)(((CalAddress_t) \
+    (CAL_BDD_POINTER((calBdd).bddNode)->nextBddNode)) & ~0xf))
+
+#define CalBddPutThenBddId(calBdd, _thenBddId) \
+    (CAL_BDD_POINTER((calBdd).bddNode)->thenBddId = _thenBddId)
+#define CalBddPutElseBddId(calBdd, _elseBddId) \
+    (CAL_BDD_POINTER((calBdd).bddNode)->elseBddId = _elseBddId)
+
+#define CalBddPutThenBddNode(calBdd, _thenBddNode) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  _bddNode->thenBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)(_bddNode->thenBddNode) & 0xe)| \
+      (((CalAddress_t) _thenBddNode) & ~0xe)); \
+}
+
+#define CalBddPutElseBddNode(calBdd, _elseBddNode) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  _bddNode->elseBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)(_bddNode->elseBddNode) & 0xe)| \
+      (((CalAddress_t) _elseBddNode) & ~0xe));	\
+}
+ 
+#define CalBddPutThenBdd(calBdd, thenBdd) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  _bddNode->thenBddId = (thenBdd).bddId; \
+  _bddNode->thenBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)(_bddNode->thenBddNode) & 0xe)| \
+      (((CalAddress_t)(thenBdd).bddNode) & ~0xe)); \
+}
+
+#define CalBddPutElseBdd(calBdd, elseBdd) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  _bddNode->elseBddId = (elseBdd).bddId; \
+  _bddNode->elseBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)(_bddNode->elseBddNode) & 0xe)| \
+      (((CalAddress_t)(elseBdd).bddNode) & ~0xe)); \
+}
+
+#define CalBddPutBddId(calBdd, _bddId) ((calBdd).bddId = _bddId)
+#define CalBddPutBddNode(calBdd, _bddNode) ((calBdd).bddNode = _bddNode)
+#define CalBddPutNextBddNode(calBdd, _nextBddNode) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  _bddNode->nextBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)(_bddNode->nextBddNode) & 0xf)|  \
+      (((CalAddress_t) _nextBddNode) & ~0xf));	 \
+}
+
+#define CalBddGetRefCount(calBdd, refCount) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  refCount = ((CalAddress_t)(_bddNode->thenBddNode) & 0x2); \
+  refCount <<= 3; \
+  refCount |= ((CalAddress_t)(_bddNode->elseBddNode) & 0xe); \
+  refCount <<= 3; \
+  refCount |= ((CalAddress_t)(_bddNode->nextBddNode) & 0xf); \
+}
+                                        
+#define CalBddPutRefCount(calBdd, count) \
+{ \
+  Cal_BddRefCount_t _nextTag, _thenTag, _elseTag; \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  _nextTag = (count & 0xf); \
+  _thenTag = ((count >> 6) & 0x2); \
+  _elseTag = ((count >> 3) & 0xe); \
+  _bddNode->nextBddNode = (CalBddNode_t*) \
+      ((((CalAddress_t)(_bddNode->nextBddNode)) & ~0xf) | _nextTag); \
+  _bddNode->thenBddNode = (CalBddNode_t*) \
+      ((((CalAddress_t)(_bddNode->thenBddNode)) & ~0x2) | _thenTag); \
+  _bddNode->elseBddNode = (CalBddNode_t*) \
+      ((((CalAddress_t)(_bddNode->elseBddNode)) & ~0xe) | _elseTag); \
+}
+
+#define CalBddIcrRefCount(calBdd) \
+{ CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  if(((CalAddress_t)(_bddNode->nextBddNode) & 0xf) != 0xf){ \
+    _bddNode->nextBddNode = \
+        (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) + 1); \
+  } \
+  else{ \
+    if(((CalAddress_t)(_bddNode->elseBddNode) & 0xe) != 0xe){ \
+      _bddNode->nextBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) & ~0xf); \
+      _bddNode->elseBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) + 0x2); \
+    } \
+    else{ \
+      if(((CalAddress_t)(_bddNode->thenBddNode) & 0x2) == 0){ \
+        _bddNode->nextBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) & ~0xf); \
+        _bddNode->elseBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) & ~0xe); \
+        _bddNode->thenBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->thenBddNode) | 0x2); \
+      } \
+    } \
+  } \
+}
+
+#define CalBddDcrRefCount(calBdd) \
+{ CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER((calBdd).bddNode);	\
+  if(((CalAddress_t)(_bddNode->nextBddNode) & 0xf) == 0x0){ \
+    if(((CalAddress_t)(_bddNode->elseBddNode) & 0xe) == 0x0){ \
+      if(((CalAddress_t)(_bddNode->thenBddNode) & 0x2) == 0x0){ \
+        CalBddWarningMessage("Trying to decrement reference count below zero"); \
+      } \
+      else{ \
+        _bddNode->thenBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->thenBddNode) & ~0x2); \
+        _bddNode->elseBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) | 0xe); \
+        _bddNode->nextBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) | 0xf); \
+      } \
+    } \
+    else{ \
+      _bddNode->elseBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) - 0x2); \
+      _bddNode->nextBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) | 0xf); \
+    } \
+  } \
+  else if(((CalAddress_t)(_bddNode->nextBddNode) & 0xf) != 0xf \
+      ||  ((CalAddress_t)(_bddNode->elseBddNode) & 0xe) != 0xe  \
+      ||  ((CalAddress_t)(_bddNode->thenBddNode) & 0x2) != 0x2){ \
+    _bddNode->nextBddNode = \
+        (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) - 1); \
+  } \
+}
+
+#define CalBddAddRefCount(calBdd, num) \
+{ \
+  Cal_BddRefCount_t _count; \
+  CalBddGetRefCount(calBdd, _count); \
+  if(_count < CAL_MAX_REF_COUNT){ \
+    _count += num; \
+    if(_count > CAL_MAX_REF_COUNT){ \
+      _count = CAL_MAX_REF_COUNT; \
+    } \
+    CalBddPutRefCount(calBdd, _count); \
+  } \
+}
+
+#define CalBddIsRefCountZero(calBdd) \
+    (((((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->thenBddNode)) & 0x2) \
+    || (((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->elseBddNode)) & 0xe)\
+    || (((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->nextBddNode)) & 0xf))\
+    ? 0 : 1)
+
+#define CalBddIsRefCountMax(calBdd) \
+    ((((((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->thenBddNode)) & 0x2) == 0x2) \
+    && ((((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->elseBddNode)) & 0xe) == 0xe)\
+    && ((((CalAddress_t)(CAL_BDD_POINTER((calBdd).bddNode)->nextBddNode)) & 0xf) == 0xf))\
+    ? 1 : 0)
+
+#define CalBddFree(calBdd) CalBddDcrRefCount(calBdd)
+
+#define CalBddIsOutPos(calBdd)  (!(((CalAddress_t)(calBdd).bddNode) & 0x1))
+
+#define CalBddIsBddOne(manager, calBdd) CalBddIsEqual(calBdd, (manager)->bddOne)
+#define CalBddIsBddZero(manager, calBdd) CalBddIsEqual(calBdd, (manager)->bddZero)
+#define CalBddIsBddNull(manager, calBdd) CalBddIsEqual(calBdd,(manager)->bddNull)
+#define CalBddManagerGetBddOne(manager) ((manager)->bddOne)
+#define CalBddManagerGetBddZero(manager) ((manager)->bddZero)
+#define CalBddManagerGetBddNull(manager) (manager)->bddNull
+
+
+
+#define CalBddGetMinId2(bddManager, calBdd1, calBdd2, topId) \
+{ \
+  Cal_BddId_t _id1, _id2; \
+  Cal_BddIndex_t _index1, _index2; \
+  _id1 = CalBddGetBddId((calBdd1)); \
+  _id2 = CalBddGetBddId((calBdd2)); \
+  _index1 = (bddManager)->idToIndex[_id1]; \
+  _index2 = (bddManager)->idToIndex[_id2]; \
+  if (_index1 < _index2) topId = _id1; \
+  else topId = _id2; \
+}
+
+#define CalBddGetMinId3(bddManager, calBdd1, calBdd2, calBdd3, topId) \
+{ \
+  Cal_BddId_t _id1, _id2, _id3; \
+  Cal_BddIndex_t _index1, _index2, _index3; \
+  _id1 = CalBddGetBddId((calBdd1)); \
+  _id2 = CalBddGetBddId((calBdd2)); \
+  _id3 = CalBddGetBddId((calBdd3)); \
+  _index1 = (bddManager)->idToIndex[_id1]; \
+  _index2 = (bddManager)->idToIndex[_id2]; \
+  _index3 = (bddManager)->idToIndex[_id3]; \
+  if(_index1 <= _index2){ \
+    if(_index1 <= _index3){ \
+      topId = _id1; \
+    } \
+    else{ \
+      topId = _id3; \
+    } \
+  } \
+  else{ \
+    if(_index2 <= _index3){ \
+      topId = _id2; \
+    } \
+    else{ \
+      topId = _id3; \
+    } \
+  } \
+}
+
+#define CalBddGetMinIndex2(bddManager, calBdd1, calBdd2, topIndex) \
+{ \
+  Cal_BddIndex_t _index1, _index2; \
+  _index1 = bddManager->idToIndex[CalBddGetBddId(calBdd1)]; \
+  _index2 = bddManager->idToIndex[CalBddGetBddId(calBdd2)]; \
+  if (_index1 < _index2) topIndex = _index1; \
+  else topIndex = _index2; \
+}
+
+#define CalBddGetMinIndex3(bddManager, calBdd1, calBdd2, calBdd3, topIndex) \
+{ \
+  Cal_BddId_t _id1, _id2, _id3; \
+  Cal_BddIndex_t _index1, _index2, _index3; \
+  _id1 = CalBddGetBddId((calBdd1)); \
+  _id2 = CalBddGetBddId((calBdd2)); \
+  _id3 = CalBddGetBddId((calBdd3)); \
+  _index1 = (bddManager)->idToIndex[_id1]; \
+  _index2 = (bddManager)->idToIndex[_id2]; \
+  _index3 = (bddManager)->idToIndex[_id3]; \
+  if(_index1 <= _index2){ \
+    if(_index1 <= _index3){ \
+      topIndex = _index1; \
+    } \
+    else{ \
+      topIndex = _index3; \
+    } \
+  } \
+  else{ \
+    if(_index2 <= _index3){ \
+      topIndex = _index2; \
+    } \
+    else{ \
+      topIndex = _index3; \
+    } \
+  } \
+}
+
+#define CalBddGetMinIdAndMinIndex(bddManager, calBdd1, calBdd2, topId, topIndex)\
+{ \
+  Cal_BddId_t _id1, _id2; \
+  Cal_BddIndex_t _index1, _index2; \
+  _id1 = CalBddGetBddId((calBdd1)); \
+  _id2 = CalBddGetBddId((calBdd2)); \
+  _index1 = (bddManager)->idToIndex[_id1]; \
+  _index2 = (bddManager)->idToIndex[_id2]; \
+  if (_index1 < _index2){ \
+    topId = _id1; \
+    topIndex = _index1; \
+  } \
+  else { \
+    topId = _id2; \
+    topIndex = _index2; \
+  } \
+}
+
+#define CalBddNot(calBdd1, calBdd2) \
+{ \
+  (calBdd2).bddId = (calBdd1).bddId; \
+  (calBdd2).bddNode = (CalBddNode_t *)((CalAddress_t)(calBdd1).bddNode ^ 0x1); \
+}
+
+#define CAL_BDD_OUT_OF_ORDER(f, g) \
+    ((CalAddress_t)CalBddGetBddNode(f) > (CalAddress_t)CalBddGetBddNode(g))
+
+#define CAL_BDD_SWAP(f, g) \
+{ \
+  Cal_Bdd_t _tmp; \
+  _tmp = f; \
+  f = g; \
+  g = _tmp; \
+}
+
+
+/* BddNode related Macros */
+#define CalBddNodeGetThenBddId(_bddNode) ((_bddNode)->thenBddId)
+#define CalBddNodeGetElseBddId(_bddNode) ((_bddNode)->elseBddId)
+#define CalBddNodeGetThenBddIndex(bddManager, _bddNode) \
+    bddManager->idToIndex[((_bddNode)->thenBddId)]
+#define CalBddNodeGetElseBddIndex(bddManager, _bddNode) \
+    bddManager->idToIndex[((_bddNode)->elseBddId)]
+#define CalBddNodeGetThenBddNode(_bddNode) \
+    ((CalBddNode_t *)((CalAddress_t)((_bddNode)->thenBddNode) & ~0xe))
+#define CalBddNodeGetElseBddNode(_bddNode) \
+    ((CalBddNode_t *)((CalAddress_t)((_bddNode)->elseBddNode) & ~0xe))
+ 
+#define CalBddNodeGetThenBdd(_bddNode, _thenBdd) \
+{ \
+  (_thenBdd).bddId = (_bddNode)->thenBddId; \
+  (_thenBdd).bddNode =  \
+      (CalBddNode_t*) (((CalAddress_t) ((_bddNode)->thenBddNode) & ~0xe)); \
+}
+
+#define CalBddNodeGetElseBdd(_bddNode, _elseBdd) \
+{ \
+  (_elseBdd).bddId = (_bddNode)->elseBddId; \
+  (_elseBdd).bddNode = \
+      (CalBddNode_t*) (((CalAddress_t) ((_bddNode)->elseBddNode) & ~0xe)); \
+}
+
+#define CalBddNodeGetNextBddNode(_bddNode) \
+    ((CalBddNode_t *)(((CalAddress_t) ((_bddNode)->nextBddNode)) & ~0xf))
+
+#define CalBddNodePutThenBddId(_bddNode, _thenBddId) \
+    ((_bddNode)->thenBddId = _thenBddId)
+
+#define CalBddNodePutElseBddId(_bddNode, _elseBddId) \
+    ((_bddNode)->elseBddId = _elseBddId)
+
+#define CalBddNodePutThenBddNode(_bddNode, _thenBddNode) \
+{ \
+  (_bddNode)->thenBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)((_bddNode)->thenBddNode) & 0xe)| \
+       (((CalAddress_t) _thenBddNode) & ~0xe));	\
+}
+
+#define CalBddNodePutElseBddNode(_bddNode, _elseBddNode) \
+{ \
+  (_bddNode)->elseBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)((_bddNode)->elseBddNode) & 0xe)| \
+      (((CalAddress_t) _elseBddNode) & ~0xe));	\
+}
+ 
+#define CalBddNodePutThenBdd(_bddNode, _thenBdd) \
+{ \
+  (_bddNode)->thenBddId = (_thenBdd).bddId; \
+  (_bddNode)->thenBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)((_bddNode)->thenBddNode) & 0xe)| \
+       (((CalAddress_t)(_thenBdd).bddNode) & ~0xe)); \
+}
+
+#define CalBddNodePutElseBdd(_bddNode, _elseBdd) \
+{ \
+  (_bddNode)->elseBddId = (_elseBdd).bddId; \
+  (_bddNode)->elseBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)((_bddNode)->elseBddNode) & 0xe)| \
+       (((CalAddress_t) (_elseBdd).bddNode) & ~0xe)); \
+}
+
+#define CalBddNodePutNextBddNode(_bddNode, _nextBddNode) \
+{ \
+  (_bddNode)->nextBddNode = (CalBddNode_t*) \
+      (((CalAddress_t)((_bddNode)->nextBddNode) & 0xf)|  \
+       (((CalAddress_t) _nextBddNode) & ~0xf));	 \
+}
+
+
+#define CalBddNodeGetRefCount(_bddNode, refCount) \
+{ \
+  refCount = ((CalAddress_t)(_bddNode->thenBddNode) & 0x2); \
+  refCount <<= 3; \
+  refCount |= ((CalAddress_t)(_bddNode->elseBddNode) & 0xe); \
+  refCount <<= 3; \
+  refCount |= ((CalAddress_t)(_bddNode->nextBddNode) & 0xf); \
+}
+                                        
+#define CalBddNodePutRefCount(_bddNode, count) \
+{ \
+  Cal_BddRefCount_t _nextTag, _thenTag, _elseTag; \
+  _nextTag = (count & 0xf); \
+  _thenTag = ((count >> 6) & 0x2); \
+  _elseTag = ((count >> 3) & 0xe); \
+  _bddNode->nextBddNode = (CalBddNode_t*) \
+      ((((CalAddress_t)(_bddNode->nextBddNode)) & ~0xf) | _nextTag); \
+  _bddNode->thenBddNode = (CalBddNode_t*) \
+      ((((CalAddress_t)(_bddNode->thenBddNode)) & ~0x2) | _thenTag); \
+  _bddNode->elseBddNode = (CalBddNode_t*) \
+      ((((CalAddress_t)(_bddNode->elseBddNode)) & ~0xe) | _elseTag); \
+}
+
+#define CalBddNodeDcrRefCount(_bddNode) \
+{ \
+  if(((CalAddress_t)(_bddNode->nextBddNode) & 0xf) == 0x0){ \
+    if(((CalAddress_t)(_bddNode->elseBddNode) & 0xe) == 0x0){ \
+      if(((CalAddress_t)(_bddNode->thenBddNode) & 0x2) == 0x0){ \
+        CalBddWarningMessage("Trying to decrement reference count below zero"); \
+      } \
+      else{ \
+        _bddNode->thenBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->thenBddNode) & ~0x2); \
+        _bddNode->elseBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) | 0xe); \
+        _bddNode->nextBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) | 0xf); \
+      } \
+    } \
+    else{ \
+      _bddNode->elseBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) - 0x2); \
+      _bddNode->nextBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) | 0xf); \
+    } \
+  } \
+  else if(((CalAddress_t)(_bddNode->nextBddNode) & 0xf) != 0xf \
+      ||  ((CalAddress_t)(_bddNode->elseBddNode) & 0xe) != 0xe  \
+      ||  ((CalAddress_t)(_bddNode->thenBddNode) & 0x2) != 0x2){ \
+    _bddNode->nextBddNode = \
+        (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) - 1); \
+  } \
+}
+
+#define CalBddNodeIcrRefCount(_bddNode) \
+{ \
+  if(((CalAddress_t)(_bddNode->nextBddNode) & 0xf) != 0xf){ \
+    _bddNode->nextBddNode = \
+        (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) + 1); \
+  } \
+  else{ \
+    if(((CalAddress_t)(_bddNode->elseBddNode) & 0xe) != 0xe){ \
+      _bddNode->nextBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) & ~0xf); \
+      _bddNode->elseBddNode = \
+          (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) + 0x2); \
+    } \
+    else{ \
+      if(((CalAddress_t)(_bddNode->thenBddNode) & 0x2) == 0){ \
+        _bddNode->nextBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->nextBddNode) & ~0xf); \
+        _bddNode->elseBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->elseBddNode) & ~0xe); \
+        _bddNode->thenBddNode = \
+            (CalBddNode_t *)((CalAddress_t)(_bddNode->thenBddNode) | 0x2); \
+      } \
+    } \
+  } \
+}
+
+#define CalBddNodeAddRefCount(__bddNode, num)				\
+{ \
+  Cal_BddRefCount_t _count; \
+  CalBddNodeGetRefCount(__bddNode, _count); \
+  _count += num; \
+  if(_count > CAL_MAX_REF_COUNT){ \
+    _count = CAL_MAX_REF_COUNT; \
+  } \
+  CalBddNodePutRefCount(__bddNode, _count); \
+}
+
+#define CalBddNodeIsRefCountZero(_bddNode) \
+    (((((CalAddress_t) ((_bddNode)->thenBddNode)) & 0x2) || \
+    (((CalAddress_t) ((_bddNode)->elseBddNode)) & 0xe) || \
+    (((CalAddress_t) ((_bddNode)->nextBddNode)) & 0xf)) \
+    ? 0 : 1)
+
+#define CalBddNodeIsRefCountMax(_bddNode) \
+    ((((((CalAddress_t) ((_bddNode)->thenBddNode)) & 0x2) == 0x2)&& \
+    ((((CalAddress_t) ((_bddNode)->elseBddNode)) & 0xe) == 0xe)&& \
+    ((((CalAddress_t) ((_bddNode)->nextBddNode)) & 0xf) == 0xf)) \
+    ? 1 : 0)
+
+#define CalBddNodeIsOutPos(bddNode)  (!(((CalAddress_t)bddNode) & 0x1))
+#define CalBddNodeRegular(bddNode) ((CalBddNode_t *)(((unsigned long)(bddNode)) & ~01))
+#define CalBddRegular(calBdd1, calBdd2)                 \
+{                                                       \
+  calBdd2.bddId = calBdd1.bddId;                        \
+  calBdd2.bddNode = CalBddNodeRegular(calBdd1.bddNode); \
+}
+
+#define CalBddNodeEqual(calBddNode1, calBddNode2)\
+  ((CalAddress_t)calBddNode1 == (CalAddress_t)calBddNode2)
+
+#define CalBddNodeNot(bddNode) ((CalBddNode_t*)(((CalAddress_t)(bddNode))^0x1))
+
+/* Mark / Unmark */
+#define CalBddIsMarked(calBdd) \
+    CalBddNodeIsMarked(CAL_BDD_POINTER((calBdd).bddNode))
+
+#define CalBddMark(calBdd) \
+    CalBddNodeMark(CAL_BDD_POINTER((calBdd).bddNode))
+
+#define CalBddUnmark(calBdd) \
+    CalBddNodeUnmark(CAL_BDD_POINTER((calBdd).bddNode))
+
+#define CalBddGetMark(calBdd) \
+    CalBddNodeGetMark(CAL_BDD_POINTER((calBdd).bddNode))
+
+#define CalBddPutMark(calBdd, mark) \
+    CalBddNodePutMark(CAL_BDD_POINTER((calBdd).bddNode), (mark))
+
+#define CalBddNodeIsMarked(bddNode) \
+  ((((CalAddress_t)((bddNode)->thenBddNode)) & 0x4) >> 2)
+
+#define CalBddNodeMark(bddNode) \
+  ((bddNode)->thenBddNode = \
+     (CalBddNode_t *)(((CalAddress_t)(bddNode)->thenBddNode) | 0x4))
+
+#define CalBddNodeUnmark(bddNode) \
+  ((bddNode)->thenBddNode = \
+     (CalBddNode_t *)(((CalAddress_t)(bddNode)->thenBddNode) & ~0x4))
+
+#define CalBddNodeGetMark(bddNode) \
+  ((((CalAddress_t)((bddNode)->thenBddNode)) & 0xc) >> 2)
+
+#define CalBddNodePutMark(bddNode, mark) \
+  ((bddNode)->thenBddNode = (CalBddNode_t *) \
+      ((((CalAddress_t)(bddNode)->thenBddNode) & ~0xc) | ((mark) << 2)))
+
+
+/* THIS SHOULD BE CHANGED TO MACROS WITH ARGUMENTS */
+#define CalRequestGetThenRequestId  CalBddGetThenBddId
+#define CalRequestGetElseRequestId CalBddGetElseBddId
+#define CalRequestGetThenRequestNode   CalBddGetThenBddNode
+#define CalRequestGetElseRequestNode  CalBddGetElseBddNode
+#define CalRequestGetThenRequest  CalBddGetThenBdd
+#define CalRequestGetElseRequest  CalBddGetElseBdd
+#define CalRequestGetRequestId  CalBddGetBddId
+#define CalRequestGetRequestNode CalBddGetBddNode
+#define CalRequestGetF CalBddGetThenBdd
+#define CalRequestGetG CalBddGetElseBdd
+#define CalRequestGetNextNode CalBddGetNextBddNode
+
+#define CalRequestPutThenRequestId  CalBddPutThenBddId
+#define CalRequestPutElseRequestId CalBddPutElseBddId
+#define CalRequestPutThenRequestNode   CalBddPutThenBddNode
+#define CalRequestPutElseRequestNode  CalBddPutElseBddNode
+#define CalRequestPutThenRequest  CalBddPutThenBdd
+#define CalRequestPutElseRequest  CalBddPutElseBdd
+#define CalRequestPutRequestId  CalBddPutBddId
+#define CalRequestPutRequestNode CalBddPutBddNode
+#define CalRequestPutF CalBddPutThenBdd
+#define CalRequestPutG CalBddPutElseBdd
+#define CalRequestPutNextNode CalBddPutNextBddNode
+
+/* Macros related to the CalRequestNode */
+
+#define CalRequestNodeGetThenRequestId  CalBddNodeGetThenBddId
+#define CalRequestNodeGetElseRequestId CalBddNodeGetElseBddId
+#define CalRequestNodeGetThenRequestNode   CalBddNodeGetThenBddNode
+#define CalRequestNodeGetElseRequestNode  CalBddNodeGetElseBddNode
+#define CalRequestNodeGetThenRequest  CalBddNodeGetThenBdd
+#define CalRequestNodeGetElseRequest  CalBddNodeGetElseBdd
+#define CalRequestNodeGetF CalBddNodeGetThenBdd
+#define CalRequestNodeGetG CalBddNodeGetElseBdd
+#define CalRequestNodeGetNextRequestNode CalBddNodeGetNextBddNode
+
+#define CalRequestNodePutThenRequestId  CalBddNodePutThenBddId
+#define CalRequestNodePutElseRequestId CalBddNodePutElseBddId
+#define CalRequestNodePutThenRequestNode   CalBddNodePutThenBddNode
+#define CalRequestNodePutElseRequestNode  CalBddNodePutElseBddNode
+#define CalRequestNodePutThenRequest  CalBddNodePutThenBdd
+#define CalRequestNodePutElseRequest  CalBddNodePutElseBdd
+#define CalRequestNodePutF CalBddNodePutThenBdd
+#define CalRequestNodePutG CalBddNodePutElseBdd
+#define CalRequestNodePutNextRequestNode CalBddNodePutNextBddNode
+#define CalRequestIsNull(calRequest) \
+    ((CalRequestGetRequestId(calRequest) == 0) \
+    && (CalRequestGetRequestNode(calRequest) == 0))
+                                      
+#define CalRequestIsMarked CalBddIsMarked
+#define CalRequestMark CalBddMark
+#define CalRequestUnmark CalBddUnmark
+#define CalRequestGetMark CalBddGetMark
+#define CalRequestPutMark CalBddPutMark
+#define CalRequestNodeIsMarked CalBddNodeIsMarked
+#define CalRequestNodeMark CalBddNodeMark
+#define CalRequestNodeUnmark CalBddNodeUnmark
+#define CalRequestNodeGetMark CalBddNodeGetMark
+#define CalRequestNodePutMark CalBddNodePutMark
+
+#define CalRequestNodeGetCofactors(bddManager,requestNode,fx,fxbar,gx,gxbar) \
+{ \
+  Cal_Bdd_t __f, __g; \
+  Cal_BddIndex_t __index1, __index2; \
+  CalRequestNodeGetF(requestNode, __f); \
+  CalRequestNodeGetG(requestNode, __g); \
+  __index1 = (bddManager)->idToIndex[CalBddGetBddId(__f)]; \
+  __index2 = (bddManager)->idToIndex[CalBddGetBddId(__g)]; \
+  if(__index1 == __index2){ \
+    CalBddGetThenBdd(__f, fx); \
+    CalBddGetElseBdd(__f, fxbar); \
+    CalBddGetThenBdd(__g, gx); \
+    CalBddGetElseBdd(__g, gxbar); \
+  } \
+  else if(__index1 < __index2){ \
+    CalBddGetThenBdd(__f, fx); \
+    CalBddGetElseBdd(__f, fxbar); \
+    gx = gxbar = __g; \
+  } \
+  else{ \
+    fx = fxbar = __f; \
+    CalBddGetThenBdd(__g, gx); \
+    CalBddGetElseBdd(__g, gxbar); \
+  } \
+}
+
+#define CalBddPairGetCofactors(bddManager,f,g,fx,fxbar,gx,gxbar) \
+{ \
+  Cal_BddIndex_t __index1, __index2; \
+  __index1 = (bddManager)->idToIndex[CalBddGetBddId(f)]; \
+  __index2 = (bddManager)->idToIndex[CalBddGetBddId(g)]; \
+  if(__index1 == __index2){ \
+    CalBddGetThenBdd(f, fx); \
+    CalBddGetElseBdd(f, fxbar); \
+    CalBddGetThenBdd(g, gx); \
+    CalBddGetElseBdd(g, gxbar); \
+  } \
+  else if(__index1 < __index2){ \
+    CalBddGetThenBdd(f, fx); \
+    CalBddGetElseBdd(f, fxbar); \
+    gx = gxbar = g; \
+  } \
+  else{ \
+    fx = fxbar = f; \
+    CalBddGetThenBdd(g, gx); \
+    CalBddGetElseBdd(g, gxbar); \
+  } \
+}
+
+#define CalBddIsForwarded(bdd) \
+  (CAL_BDD_POINTER(CalBddGetElseBddNode(bdd)) == FORWARD_FLAG)
+
+#define CalBddNodeIsForwarded(bddNode) \
+  (((CalAddress_t)(CAL_BDD_POINTER(CalBddNodeGetElseBddNode(bddNode)))) == FORWARD_FLAG)
+
+#define CalBddForward(bdd) \
+{ \
+  CalBddNode_t *_bddNode, *_bddNodeTagged; \
+  _bddNodeTagged = CalBddGetBddNode(bdd); \
+  _bddNode = CAL_BDD_POINTER(_bddNodeTagged); \
+  (bdd).bddId = _bddNode->thenBddId; \
+  (bdd).bddNode = (CalBddNode_t*) \
+                  (((CalAddress_t)(_bddNode->thenBddNode) & ~0xe) \
+                   ^(CAL_TAG0(_bddNodeTagged))); \
+}
+
+#define CalBddNodeForward(_bddNodeTagged) \
+{ \
+  CalBddNode_t *_bddNode; \
+  _bddNode = CAL_BDD_POINTER(_bddNodeTagged); \
+  _bddNodeTagged = (CalBddNode_t*) \
+                  (((CalAddress_t)(_bddNode->thenBddNode) & ~0xe) \
+                   ^(CAL_TAG0(_bddNodeTagged))); \
+}
+
+#define CalBddNodeIsForwardedTo(_bddNodeTagged) \
+{ \
+  CalBddNode_t *__bddNode;\
+  __bddNode = CAL_BDD_POINTER(_bddNodeTagged); \
+  if(CalBddNodeGetElseBddNode(__bddNode) == FORWARD_FLAG){ \
+    _bddNodeTagged = (CalBddNode_t*) \
+                     (((CalAddress_t)(__bddNode->thenBddNode) & ~0xe)        \
+                      ^(CAL_TAG0(_bddNodeTagged))); \
+  } \
+}
+
+#define CalRequestIsForwardedTo(request) \
+{ \
+  CalBddNode_t *__bddNode, *__bddNodeTagged; \
+  __bddNodeTagged = (request).bddNode; \
+  __bddNode = CAL_BDD_POINTER(__bddNodeTagged); \
+  if(CalRequestNodeGetElseRequestNode(__bddNode) == FORWARD_FLAG){ \
+    (request).bddId = __bddNode->thenBddId; \
+    (request).bddNode = (CalBddNode_t*) \
+                        (((CalAddress_t)(__bddNode->thenBddNode) & ~0xe)        \
+                         ^(CAL_TAG0(__bddNodeTagged))); \
+  } \
+}
+
+#define CalBddIsForwardedTo CalRequestIsForwardedTo
+
+#define CalBddNormalize(fBdd, gBdd) \
+{ \
+  Cal_Bdd_t _tmpBdd; \
+  if((unsigned long)CAL_BDD_POINTER(CalBddGetBddNode(gBdd)) < \
+      (unsigned long)CAL_BDD_POINTER(CalBddGetBddNode(fBdd))){ \
+    _tmpBdd = fBdd; \
+    fBdd = gBdd; \
+    gBdd = _tmpBdd; \
+  } \
+}
+
+/* Depth aliased as RefCount */
+#define CalBddGetDepth CalBddGetRefCount
+#define CalBddPutDepth CalBddPutRefCount
+#define CalRequestNodeGetDepth CalBddNodeGetRefCount
+#define CalRequestNodeGetRefCount CalBddNodeGetRefCount
+#define CalRequestNodeAddRefCount CalBddNodeAddRefCount
+#define CalRequestAddRefCount CalBddAddRefCount
+#define CalRequestNodePutDepth CalBddNodePutRefCount
+
+#define CalITERequestNodeGetCofactors(bddManager, requestNode, fx, fxbar, gx, gxbar, hx, hxbar) \
+{ \
+  Cal_Bdd_t __f, __g, __h; \
+  Cal_BddIndex_t __index1, __index2, __index3; \
+  CalBddNode_t *__ptrIndirect; \
+  CalRequestNodeGetThenRequest(requestNode, __f); \
+  __ptrIndirect = CalRequestNodeGetElseRequestNode(requestNode); \
+  CalRequestNodeGetThenRequest(__ptrIndirect, __g); \
+  CalRequestNodeGetElseRequest(__ptrIndirect, __h); \
+  __index1 = (bddManager)->idToIndex[CalBddGetBddId(__f)]; \
+  __index2 = (bddManager)->idToIndex[CalBddGetBddId(__g)]; \
+  __index3 = (bddManager)->idToIndex[CalBddGetBddId(__h)]; \
+  if(__index1 == __index2){ \
+    if(__index3 == __index1){ \
+      CalBddGetThenBdd(__f, fx); \
+      CalBddGetElseBdd(__f, fxbar); \
+      CalBddGetThenBdd(__g, gx); \
+      CalBddGetElseBdd(__g, gxbar); \
+      CalBddGetThenBdd(__h, hx); \
+      CalBddGetElseBdd(__h, hxbar); \
+    } \
+    else if(__index3 < __index1){ \
+      fx = fxbar = __f; \
+      gx = gxbar = __g; \
+      CalBddGetThenBdd(__h, hx); \
+      CalBddGetElseBdd(__h, hxbar); \
+    } \
+    else{ \
+      CalBddGetThenBdd(__f, fx); \
+      CalBddGetElseBdd(__f, fxbar); \
+      CalBddGetThenBdd(__g, gx); \
+      CalBddGetElseBdd(__g, gxbar); \
+      hx = hxbar = __h; \
+    } \
+  } \
+  else if(__index1 < __index2){ \
+    if(__index3 == __index1){ \
+      CalBddGetThenBdd(__f, fx); \
+      CalBddGetElseBdd(__f, fxbar); \
+      gx = gxbar = __g; \
+      CalBddGetThenBdd(__h, hx); \
+      CalBddGetElseBdd(__h, hxbar); \
+    } \
+    else if(__index3 < __index1){ \
+      fx = fxbar = __f; \
+      gx = gxbar = __g; \
+      CalBddGetThenBdd(__h, hx); \
+      CalBddGetElseBdd(__h, hxbar); \
+    } \
+    else{ \
+      CalBddGetThenBdd(__f, fx); \
+      CalBddGetElseBdd(__f, fxbar); \
+      gx = gxbar = __g; \
+      hx = hxbar = __h; \
+    } \
+  } \
+  else{ \
+    if(__index3 == __index2){ \
+      fx = fxbar = __f; \
+      CalBddGetThenBdd(__g, gx); \
+      CalBddGetElseBdd(__g, gxbar); \
+      CalBddGetThenBdd(__h, hx); \
+      CalBddGetElseBdd(__h, hxbar); \
+    } \
+    else if(__index3 < __index2){ \
+      fx = fxbar = __f; \
+      gx = gxbar = __g; \
+      CalBddGetThenBdd(__h, hx); \
+      CalBddGetElseBdd(__h, hxbar); \
+    } \
+    else{ \
+      fx = fxbar = __f; \
+      CalBddGetThenBdd(__g, gx); \
+      CalBddGetElseBdd(__g, gxbar); \
+      hx = hxbar = __h; \
+    } \
+  } \
+}
+
+
+#define CalCacheTableOneInsert(bddManager, f, result, opCode, cacheLevel) CalCacheTableTwoInsert(bddManager, f, (bddManager)->bddOne, result, opCode, cacheLevel)
+
+#define CalCacheTableOneLookup(bddManager, f, opCode, resultPtr) CalCacheTableTwoLookup(bddManager, f, (bddManager)->bddOne, opCode, resultPtr)
+
+#ifdef USE_POWER_OF_2
+#define CalDoHash2(thenBddNode, elseBddNode, table) \
+   (((((CalAddress_t)thenBddNode) + ((CalAddress_t)elseBddNode)) / NODE_SIZE) & ((table)->numBins - 1))
+#else
+#define CalDoHash2(thenBddNode, elseBddNode, table) \
+                              (((((CalAddress_t)thenBddNode) + \
+                                 ((CalAddress_t)elseBddNode)) / NODE_SIZE)% \
+                               (table)->numBins)
+#endif
+
+#if HAVE_STDARG_H
+EXTERN int CalBddPreProcessing(Cal_BddManager_t *bddManager, int count, ...);
+#else
+EXTERN int CalBddPreProcessing();
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+EXTERN Cal_Bdd_t CalBddIf(Cal_BddManager bddManager, Cal_Bdd_t F);
+EXTERN int CalBddIsCubeStep(Cal_BddManager bddManager, Cal_Bdd_t f);
+EXTERN int CalBddTypeAux(Cal_BddManager_t * bddManager, Cal_Bdd_t f);
+EXTERN Cal_Bdd_t CalBddIdentity(Cal_BddManager_t *bddManager, Cal_Bdd_t calBdd);
+EXTERN void CalHashTableApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t ** reqQueAtPipeDepth, CalOpProc_t calOpProc);
+EXTERN void CalHashTableReduce(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t * uniqueTableForId);
+EXTERN void CalAssociationListFree(Cal_BddManager_t * bddManager);
+EXTERN void CalVarAssociationRepackUpdate(Cal_BddManager_t * bddManager, Cal_BddId_t id);
+EXTERN void CalCheckAssociationValidity(Cal_BddManager_t * bddManager);
+EXTERN void CalReorderAssociationFix(Cal_BddManager_t *bddManager);
+EXTERN void CalRequestNodeListCompose(Cal_BddManager_t * bddManager, CalRequestNode_t * requestNodeList, Cal_BddIndex_t composeIndex);
+EXTERN void CalHashTableComposeApply(Cal_BddManager_t *bddManager, CalHashTable_t *hashTable, Cal_BddIndex_t gIndex, CalHashTable_t **reqQueForCompose, CalHashTable_t **reqQueForITE);
+EXTERN void CalComposeRequestCreate(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t h, Cal_BddIndex_t composeIndex, CalHashTable_t **reqQueForCompose, CalHashTable_t **reqQueForITE, Cal_Bdd_t *resultPtr);
+EXTERN void CalRequestNodeListArrayITE(Cal_BddManager_t *bddManager, CalRequestNode_t **requestNodeListArray);
+EXTERN Cal_Bdd_t CalBddOpITEBF(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_Bdd_t g, Cal_Bdd_t h);
+EXTERN void CalHashTableITEApply(Cal_BddManager_t *bddManager, CalHashTable_t *hashTable, CalHashTable_t **reqQueAtPipeDepth);
+EXTERN Cal_Bdd_t CalBddITE(Cal_BddManager_t *bddManager, Cal_Bdd_t F, Cal_Bdd_t G, Cal_Bdd_t H);
+EXTERN Cal_Bdd_t CalBddManagerCreateNewVar(Cal_BddManager_t * bddManager, Cal_BddIndex_t index);
+EXTERN void CalRequestNodeListArrayOp(Cal_BddManager_t * bddManager, CalRequestNode_t ** requestNodeListArray, CalOpProc_t calOpProc);
+EXTERN Cal_Bdd_t CalBddOpBF(Cal_BddManager_t * bddManager, CalOpProc_t calOpProc, Cal_Bdd_t F, Cal_Bdd_t G);
+EXTERN int main(int argc, char **argv);
+EXTERN Cal_Bdd_t CalBddVarSubstitute(Cal_BddManager bddManager, Cal_Bdd_t f, unsigned short opCode, CalAssociation_t *assoc);
+EXTERN int CalOpBddVarSubstitute(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t * resultBddPtr);
+EXTERN long CalBddFindBlock(Cal_Block block, long index);
+EXTERN void CalBddBlockDelta(Cal_Block b, long delta);
+EXTERN Cal_Block CalBddShiftBlock(Cal_BddManager_t *bddManager, Cal_Block b, long index);
+EXTERN unsigned long CalBlockMemoryConsumption(Cal_Block block);
+EXTERN void CalFreeBlockRecursively(Cal_Block block);
+EXTERN CalCacheTable_t * CalCacheTableTwoInit(Cal_BddManager_t *bddManager);
+EXTERN int CalCacheTableTwoQuit(CalCacheTable_t *cacheTable);
+EXTERN void CalCacheTableTwoInsert(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_Bdd_t g, Cal_Bdd_t result, unsigned long opCode, int cacheLevel);
+EXTERN int CalCacheTableTwoLookup(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_Bdd_t g, unsigned long opCode, Cal_Bdd_t *resultBddPtr);
+EXTERN void CalCacheTableTwoFlush(CalCacheTable_t *cacheTable);
+EXTERN int CalCacheTableTwoFlushAll(CalCacheTable_t *cacheTable);
+EXTERN void CalCacheTableTwoGCFlush(CalCacheTable_t *cacheTable);
+EXTERN void CalCacheTableTwoRepackUpdate(CalCacheTable_t *cacheTable);
+EXTERN void CalCheckCacheTableValidity(Cal_BddManager bddManager);
+EXTERN void CalCacheTableTwoFixResultPointers(Cal_BddManager_t *bddManager);
+EXTERN void CalCacheTablePrint(Cal_BddManager_t *bddManager);
+EXTERN void CalBddManagerGetCacheTableData(Cal_BddManager_t *bddManager, unsigned long *cacheSize, unsigned long *cacheEntries, unsigned long *cacheInsertions, unsigned long *cacheLookups, unsigned long *cacheHits, unsigned long *cacheCollisions);
+EXTERN void CalCacheTableRehash(Cal_BddManager_t *bddManager);
+EXTERN void CalCacheTableTwoFlushAssociationId(Cal_BddManager_t *bddManager, int associationId);
+EXTERN unsigned long CalCacheTableMemoryConsumption(CalCacheTable_t *cacheTable);
+EXTERN void CalBddManagerGCCheck(Cal_BddManager_t * bddManager);
+EXTERN int CalHashTableGC(Cal_BddManager_t *bddManager, CalHashTable_t *hashTable);
+EXTERN void CalRepackNodesAfterGC(Cal_BddManager_t *bddManager);
+EXTERN CalHashTable_t * CalHashTableInit(Cal_BddManager_t *bddManager, Cal_BddId_t bddId);
+EXTERN int CalHashTableQuit(Cal_BddManager_t *bddManager, CalHashTable_t * hashTable);
+EXTERN void CalHashTableAddDirect(CalHashTable_t * hashTable, CalBddNode_t * bddNode);
+EXTERN int CalHashTableFindOrAdd(CalHashTable_t * hashTable, Cal_Bdd_t thenBdd, Cal_Bdd_t elseBdd, Cal_Bdd_t * bddPtr);
+EXTERN int CalHashTableAddDirectAux(CalHashTable_t * hashTable, Cal_Bdd_t thenBdd, Cal_Bdd_t elseBdd, Cal_Bdd_t * bddPtr);
+EXTERN void CalHashTableCleanUp(CalHashTable_t * hashTable);
+EXTERN int CalHashTableLookup(CalHashTable_t * hashTable, Cal_Bdd_t thenBdd, Cal_Bdd_t elseBdd, Cal_Bdd_t * bddPtr);
+EXTERN void CalHashTableDelete(CalHashTable_t * hashTable, CalBddNode_t * bddNode);
+EXTERN int CalUniqueTableForIdLookup(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, Cal_Bdd_t thenBdd, Cal_Bdd_t elseBdd, Cal_Bdd_t * bddPtr);
+EXTERN int CalUniqueTableForIdFindOrAdd(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, Cal_Bdd_t thenBdd, Cal_Bdd_t elseBdd, Cal_Bdd_t * bddPtr);
+EXTERN void CalHashTableRehash(CalHashTable_t *hashTable, int grow);
+EXTERN void CalUniqueTableForIdRehashNode(CalHashTable_t *hashTable, CalBddNode_t *bddNode, CalBddNode_t *thenBddNode, CalBddNode_t *elseBddNode);
+EXTERN unsigned long CalBddUniqueTableNumLockedNodes(Cal_BddManager_t *bddManager, CalHashTable_t *uniqueTableForId);
+EXTERN void CalPackNodes(Cal_BddManager_t *bddManager);
+EXTERN void CalBddPackNodesForSingleId(Cal_BddManager_t *bddManager, Cal_BddId_t id);
+EXTERN void CalBddPackNodesAfterReorderForSingleId(Cal_BddManager_t *bddManager, int fixForwardedNodesFlag, int bestIndex, int bottomIndex);
+EXTERN void CalBddPackNodesForMultipleIds(Cal_BddManager_t *bddManager, Cal_BddId_t beginId, int numLevels);
+EXTERN CalHashTable_t * CalHashTableOneInit(Cal_BddManager_t * bddManager, int itemSize);
+EXTERN void CalHashTableOneQuit(CalHashTable_t * hashTable);
+EXTERN void CalHashTableOneInsert(CalHashTable_t * hashTable, Cal_Bdd_t keyBdd, char * valuePtr);
+EXTERN int CalHashTableOneLookup(CalHashTable_t * hashTable, Cal_Bdd_t keyBdd, char ** valuePtrPtr);
+EXTERN int CalHashTableThreeFindOrAdd(CalHashTable_t * hashTable, Cal_Bdd_t f, Cal_Bdd_t g, Cal_Bdd_t h, Cal_Bdd_t * bddPtr);
+EXTERN void CalSetInteract(Cal_BddManager_t *bddManager, int x, int y);
+EXTERN int CalTestInteract(Cal_BddManager_t *bddManager, int x, int y);
+EXTERN int CalInitInteract(Cal_BddManager_t *bddManager);
+EXTERN CalPageManager_t * CalPageManagerInit(int numPagesPerSegment);
+EXTERN int CalPageManagerQuit(CalPageManager_t * pageManager);
+EXTERN void CalPageManagerPrint(CalPageManager_t * pageManager);
+EXTERN CalNodeManager_t * CalNodeManagerInit(CalPageManager_t * pageManager);
+EXTERN int CalNodeManagerQuit(CalNodeManager_t * nodeManager);
+EXTERN void CalNodeManagerPrint(CalNodeManager_t * nodeManager);
+EXTERN CalAddress_t * CalPageManagerAllocPage(CalPageManager_t * pageManager);
+EXTERN void CalPageManagerFreePage(CalPageManager_t * pageManager, CalAddress_t * page);
+EXTERN int CalIncreasingOrderCompare(const void *a, const void *b);
+EXTERN int CalDecreasingOrderCompare(const void *a, const void *b);
+EXTERN void CalBddReorderFixProvisionalNodes(Cal_BddManager_t *bddManager);
+EXTERN void CalCheckPipelineValidity(Cal_BddManager_t *bddManager);
+EXTERN char * CalBddVarName(Cal_BddManager_t *bddManager, Cal_Bdd_t v, Cal_VarNamingFn_t VarNamingFn, Cal_Pointer_t env);
+EXTERN void CalBddNumberSharedNodes(Cal_BddManager_t *bddManager, Cal_Bdd_t f, CalHashTable_t *hashTable, long *next);
+EXTERN void CalBddMarkSharedNodes(Cal_BddManager_t *bddManager, Cal_Bdd_t f);
+EXTERN int CalOpExists(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t * resultBddPtr);
+EXTERN int CalOpRelProd(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t g, Cal_Bdd_t * resultBddPtr);
+EXTERN int CalOpCofactor(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t c, Cal_Bdd_t * resultBddPtr);
+EXTERN void CalBddReorderAuxBF(Cal_BddManager_t * bddManager);
+EXTERN void CalBddReorderFixCofactors(Cal_BddManager bddManager, Cal_BddId_t id);
+EXTERN void CalFixupAssoc(Cal_BddManager_t *bddManager, long id1, long id2, CalAssociation_t *assoc);
+EXTERN void CalBddReorderReclaimForwardedNodes(Cal_BddManager bddManager, int startIndex, int endIndex);
+EXTERN void CalBddReorderBlockSift(Cal_BddManager_t *bddManager, double maxSizeFactor);
+EXTERN void CalBddReorderBlockWindow(Cal_BddManager bddManager, Cal_Block block, char *levels);
+EXTERN void CalBddReorderAuxDF(Cal_BddManager_t *bddManager);
+EXTERN void CalAlignCollisionChains(Cal_BddManager_t *bddManager);
+EXTERN void CalBddReorderFixUserBddPtrs(Cal_BddManager bddManager);
+EXTERN int CalCheckAllValidity(Cal_BddManager bddManager);
+EXTERN int CalCheckValidityOfNodesForId(Cal_BddManager bddManager, int id);
+EXTERN int CalCheckValidityOfNodesForWindow(Cal_BddManager bddManager, Cal_BddIndex_t index, int numLevels);
+EXTERN int CalCheckValidityOfANode(Cal_BddManager_t *bddManager, CalBddNode_t *bddNode, int id);
+EXTERN void CalCheckRefCountValidity(Cal_BddManager_t *bddManager);
+EXTERN int CalCheckAssoc(Cal_BddManager_t *bddManager);
+EXTERN void CalBddReorderVarSift(Cal_BddManager bddManager, double maxSizeFactor);
+EXTERN void CalBddReorderVarWindow(Cal_BddManager bddManager, char *levels);
+EXTERN int CalOpAnd(Cal_BddManager_t * bddManager, Cal_Bdd_t F, Cal_Bdd_t G, Cal_Bdd_t * resultBddPtr);
+EXTERN int CalOpNand(Cal_BddManager_t * bddManager, Cal_Bdd_t F, Cal_Bdd_t G, Cal_Bdd_t * resultBddPtr);
+EXTERN int CalOpOr(Cal_BddManager_t * bddManager, Cal_Bdd_t F, Cal_Bdd_t G, Cal_Bdd_t * resultBddPtr);
+EXTERN int CalOpXor(Cal_BddManager_t * bddManager, Cal_Bdd_t F, Cal_Bdd_t G, Cal_Bdd_t * resultBddPtr);
+EXTERN Cal_Bdd_t CalOpITE(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_Bdd_t g, Cal_Bdd_t h, CalHashTable_t **reqQueForITE);
+EXTERN int main(int argc, char ** argv);
+EXTERN void CalUniqueTablePrint(Cal_BddManager_t *bddManager);
+EXTERN void CalBddFunctionPrint(Cal_BddManager_t * bddManager, Cal_Bdd_t calBdd, char * name);
+EXTERN int CalBddPreProcessing(Cal_BddManager_t *bddManager, int count, ...);
+EXTERN int CalBddPostProcessing(Cal_BddManager_t *bddManager);
+EXTERN int CalBddArrayPreProcessing(Cal_BddManager_t *bddManager, Cal_Bdd *userBddArray);
+EXTERN Cal_Bdd_t CalBddGetInternalBdd(Cal_BddManager bddManager, Cal_Bdd userBdd);
+EXTERN Cal_Bdd CalBddGetExternalBdd(Cal_BddManager_t *bddManager, Cal_Bdd_t internalBdd);
+EXTERN void CalBddFatalMessage(char *string);
+EXTERN void CalBddWarningMessage(char *string);
+EXTERN void CalBddNodePrint(CalBddNode_t *bddNode);
+EXTERN void CalBddPrint(Cal_Bdd_t calBdd);
+EXTERN void CalHashTablePrint(CalHashTable_t *hashTable);
+EXTERN void CalHashTableOnePrint(CalHashTable_t *hashTable, int flag);
+EXTERN void CalUtilSRandom(long seed);
+EXTERN long CalUtilRandom(void);
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _INT */
Index: /vis_dev/glu-2.1/src/calBdd/calInteract.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calInteract.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calInteract.c	(revision 6)
@@ -0,0 +1,348 @@
+/**CFile***********************************************************************
+
+  FileName    [calInteract.c]
+
+  PackageName [cal]
+
+  Synopsis    [Functions to manipulate the variable interaction matrix.]
+
+  Description [
+  The interaction matrix tells whether two variables are
+  both in the support of some function of the DD. The main use of the
+  interaction matrix is in the in-place swapping. Indeed, if two
+  variables do not interact, there is no arc connecting the two layers;
+  therefore, the swap can be performed in constant time, without
+  scanning the subtables. Another use of the interaction matrix is in
+  the computation of the lower bounds for sifting. Finally, the
+  interaction matrix can be used to speed up aggregation checks in
+  symmetric and group sifting.<p>
+  The computation of the interaction matrix is done with a series of
+  depth-first searches. The searches start from those nodes that have
+  only external references. The matrix is stored as a packed array of bits;
+  since it is symmetric, only the upper triangle is kept in memory.
+  As a final remark, we note that there may be variables that do
+  intercat, but that for a given variable order have no arc connecting
+  their layers when they are adjacent.]
+
+  SeeAlso     []
+
+  Author      [Original author:Fabio Somenzi. Modified for CAL package
+  by Rajeev K. Ranjan]
+
+  Copyright [ This file was created at the University of Colorado at
+  Boulder.  The University of Colorado at Boulder makes no warranty
+  about the suitability of this software for any purpose.  It is
+  presented on an AS IS basis.]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#if SIZEOF_LONG == 8
+#define BPL 64
+#define LOGBPL 6
+#else
+#define BPL 32
+#define LOGBPL 5
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void ddSuppInteract(Cal_BddManager_t *bddManager, Cal_Bdd_t f, int *support);
+static void ddClearLocal(Cal_Bdd_t f);
+static void ddUpdateInteract(Cal_BddManager_t *bddManager, int *support);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Set interaction matrix entries.]
+
+  Description [Given a pair of variables 0 <= x < y < table->size,
+  sets the corresponding bit of the interaction matrix to 1.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+CalSetInteract(Cal_BddManager_t *bddManager, int x, int y)
+{
+    int posn, word, bit;
+
+    Cal_Assert(x < y);
+    Cal_Assert(y < bddManager->numVars);
+    Cal_Assert(x >= 0);
+
+    posn = ((((bddManager->numVars << 1) - x - 3) * x) >> 1) + y - 1;
+    word = posn >> LOGBPL;
+    bit = posn & (BPL-1);
+    bddManager->interact[word] |= 1 << bit;
+
+} /* end of CalSetInteract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Test interaction matrix entries.]
+
+  Description [Given a pair of variables 0 <= x < y < bddManager->numVars,
+  tests whether the corresponding bit of the interaction matrix is 1.
+  Returns the value of the bit.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+CalTestInteract(Cal_BddManager_t *bddManager, int x, int y)
+{
+    int posn, word, bit, result;
+
+    x -= 1; 
+    y -= 1;
+    
+    if (x > y) {
+	int tmp = x;
+	x = y;
+	y = tmp;
+    }
+    Cal_Assert(x < y);
+    Cal_Assert(y < bddManager->numVars);
+    Cal_Assert(x >= 0);
+
+    posn = ((((bddManager->numVars << 1) - x - 3) * x) >> 1) + y - 1;
+    word = posn >> LOGBPL;
+    bit = posn & (BPL-1);
+    result = (bddManager->interact[word] >> bit) & 1;
+    return(result);
+
+} /* end of CalTestInteract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes the interaction matrix.]
+
+  Description [Initializes the interaction matrix. The interaction
+  matrix is implemented as a bit vector storing the upper triangle of
+  the symmetric interaction matrix. The bit vector is kept in an array
+  of long integers. The computation is based on a series of depth-first
+  searches, one for each root of the DAG. A local flag (the mark bits)
+  is used.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+CalInitInteract(Cal_BddManager_t *bddManager)
+{
+  int i,k;
+  int words;
+  long *interact;
+  int *support;
+  long numBins;
+  CalBddNode_t **bins, *bddNode, *nextBddNode;
+  
+  int n = bddManager->numVars;
+  
+  words = ((n * (n-1)) >> (1 + LOGBPL)) + 1;
+  bddManager->interact = interact = Cal_MemAlloc(long, words);
+  if (interact == NULL) return(0);
+  for (i = 0; i < words; i++) {
+      interact[i] = 0;
+  }
+  
+  support = Cal_MemAlloc(int, n);
+  if (support == Cal_Nil(int)) {
+    Cal_MemFree(interact);
+    return(0);
+  }
+  bins = bddManager->uniqueTable[0]->bins;
+  numBins = bddManager->uniqueTable[0]->numBins;
+  for (i=0; i<numBins; i++){
+    for (bddNode = bins[i]; bddNode; bddNode = nextBddNode) {
+      Cal_Bdd_t internalBdd;
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, internalBdd);
+      for (k = 0; k < n; k++) {
+        support[k] = 0;
+      }
+      ddSuppInteract(bddManager, internalBdd, support);
+      ddClearLocal(internalBdd);
+      ddUpdateInteract(bddManager, support);
+    }
+  }
+  /* If there are some results pending in the pipeline, we need to
+     take those into account as well */
+
+  if (bddManager->pipelineState == CREATE){
+    CalRequestNode_t **requestNodeListArray =
+        bddManager->requestNodeListArray; 
+    Cal_Bdd_t resultBdd;
+    for (i=0;
+         i<bddManager->pipelineDepth-bddManager->currentPipelineDepth;
+         i++){
+      for (bddNode = *requestNodeListArray; bddNode;
+           bddNode = nextBddNode){ 
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        Cal_Assert(CalBddNodeIsForwarded(bddNode));
+        CalBddNodeGetThenBdd(bddNode, resultBdd);
+        Cal_Assert(CalBddIsForwarded(resultBdd) == 0);
+        for (k = 0; k < n; k++) {
+          support[k] = 0;
+        }
+        ddSuppInteract(bddManager, resultBdd, support);
+        ddClearLocal(resultBdd);
+        ddUpdateInteract(bddManager, support);
+      }
+      requestNodeListArray++;
+    }
+  }
+  
+  
+  Cal_MemFree(support);
+  return(1);
+  
+} /* end of CalInitInteract */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Find the support of f.]
+
+  Description [Performs a DFS from f. Uses the LSB of the then pointer
+  as visited flag.]
+
+  SideEffects [Accumulates in support the variables on which f depends.]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+ddSuppInteract(Cal_BddManager_t *bddManager, Cal_Bdd_t f, int *support)
+{
+  Cal_Bdd_t thenBdd, elseBdd;
+
+  if (CalBddIsBddConst(f) || CalBddIsMarked(f)){
+    return;
+  }
+  support[f.bddId-1] = 1;
+  CalBddGetThenBdd(f, thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  ddSuppInteract(bddManager, thenBdd, support);
+  ddSuppInteract(bddManager, elseBdd, support);
+  CalBddMark(f);
+  return;
+} /* end of ddSuppInteract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs a DFS from f, clearing the LSB of the then pointers.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+ddClearLocal(Cal_Bdd_t f)
+{
+  Cal_Bdd_t thenBdd;
+  Cal_Bdd_t elseBdd;
+  CalBddGetElseBdd(f, elseBdd);  
+  if (CalBddIsBddConst(f) || !CalBddIsMarked(f)){
+    return;
+  }
+  /* clear visited flag */
+  CalBddUnmark(f);
+  CalBddGetThenBdd(f, thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  ddClearLocal(thenBdd);
+  ddClearLocal(elseBdd);
+  return;
+} /* end of ddClearLocal */
+
+
+/**Function********************************************************************
+
+  Synopsis [Marks as interacting all pairs of variables that appear in
+  support.]
+
+  Description [If support[i] == support[j] == 1, sets the (i,j) entry
+  of the interaction matrix to 1.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+ddUpdateInteract(Cal_BddManager_t *bddManager, int *support)
+{
+  int i,j;
+  int n = bddManager->numVars;
+  
+  for (i = 0; i < n-1; i++) {
+	if (support[i] == 1) {
+      for (j = i+1; j < n; j++) {
+		if (support[j] == 1) {
+          CalSetInteract(bddManager, i, j);
+		}
+      }
+	}
+  }
+} /* end of ddUpdateInteract */
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calMem.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calMem.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calMem.c	(revision 6)
@@ -0,0 +1,723 @@
+/**CFile*****************************************************************
+
+  FileName    [calMem.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for memory management.]
+
+  Description [Contains allocation, free, resize routines. Also has
+  routines for managing records of fixed size.]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu). Originally
+  written by David Long.]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision   [$Id: calMem.c,v 1.4 2002/08/25 05:29:59 fabio Exp $]
+
+******************************************************************************/
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <string.h>
+#endif
+#include "calMem.h"
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct BlockStruct *Block;
+typedef struct BlockStruct Block_t;
+typedef struct SegmentStruct *Segment;
+typedef struct SegmentStruct Segment_t;
+typedef struct ListStruct *List;
+typedef struct ListStruct List_t;
+typedef struct Cal_RecMgrStruct Cal_RecMgr_t;
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/* #define DEBUG_MEM */
+#define MAGIC_COOKIE 0x34f21ab3l
+#define MAGIC_COOKIE1 0x432fa13bl
+struct SegmentStruct
+{
+  Cal_Pointer_t baseAddress;
+  Cal_Address_t limit;
+};
+
+struct BlockStruct
+{
+  int used;
+  int sizeIndex;
+  unsigned long dummy;
+  Block_t *next;
+  Block_t *prev;
+  Segment seg;
+};
+#define HEADER_SIZE ((Cal_Address_t)CAL_ROUNDUP(sizeof(Block_t)))
+#define MAX_SIZEINDEX (8*sizeof(Cal_Address_t)-2)
+#define MAX_SEG_SIZE ((Cal_Address_t)1 << MAX_SIZEINDEX)
+#define MAX_SIZE ((Cal_Address_t)(MAX_SEG_SIZE-HEADER_SIZE))
+#define NICE_BLOCK_SIZE ((Cal_Address_t)PAGE_SIZE-CAL_ROUNDUP(sizeof(Block_t)))
+#define ALLOC_SIZE NICE_BLOCK_SIZE
+#define MIN_ALLOC_SIZEINDEX 15
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+struct ListStruct
+{
+  List_t *next;
+};
+
+struct Cal_RecMgrStruct
+{
+  int size;
+  int recsPerBlock;
+  List free;
+  List blocks;
+  int numBlocks;
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static Cal_Address_t blockAllocation;
+static Block avail[MAX_SIZEINDEX+1];
+
+
+/* Bogus segment for initialization */
+
+static Segment_t dummySeg={(Cal_Pointer_t)0, (Cal_Address_t)0};
+
+
+/* Current segment */
+
+static Segment currSeg= &dummySeg;
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#define SBRK(size) ((Cal_Pointer_t)sbrk((long)(size)))
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int CeilingLog2(Cal_Address_t i);
+static int BlockSizeIndex(Cal_Address_t size);
+static void AddToFreeList(Block b);
+static Block RemoveFromFreeList(Block b);
+static Block Buddy(Block b);
+static void TrimToSize(Block b, int sizeIndex);
+static void MergeAndFree(Block b);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+
+/**Function********************************************************************
+
+  Synopsis           [Prints an error message and exits.]
+
+  Description        [Prints an error message and exits.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+Cal_MemFatal(char *message)
+{
+  fprintf(stderr, "Memory management library: error: %s\n", message);
+  exit(1);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Returns the memory allocated.]
+
+  Description        [Returns the memory allocated.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+Cal_Address_t
+Cal_MemAllocation(void)
+{
+  return (blockAllocation);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Allocates a new block of the specified size.]
+
+  Description        [Allocates a new block of the specified size.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+Cal_Pointer_t
+Cal_MemGetBlock(Cal_Address_t size)
+{
+  int i;
+  int sizeIndex;
+  int allocSizeIndex;
+  int newSeg;
+  Cal_Address_t allocSize;
+  Cal_Pointer_t sbrkRet;
+  Block b;
+
+  if ((sizeIndex = BlockSizeIndex(size)) < 0) return ((Cal_Pointer_t)0);
+  
+  /* Find smallest free block which is large enough. */
+  for (i = sizeIndex; i <= MAX_SIZEINDEX && !avail[i]; ++i);
+  if (i > MAX_SIZEINDEX) {
+    /* We must get more storage; don't allocate less than */
+    /* 2^MIN_ALLOC_SIZE_INDEX */
+    if (sizeIndex < MIN_ALLOC_SIZEINDEX) allocSizeIndex=MIN_ALLOC_SIZEINDEX;
+    else allocSizeIndex=sizeIndex;
+    allocSize=((Cal_Address_t)1 << allocSizeIndex);
+    
+    /* Pad current segment to be a multiple of 2^allocSizeIndex in */
+    /* length. */
+    allocSize += ((currSeg->limit + allocSize - 1) &
+                  ~(allocSize - 1)) - currSeg->limit;
+    if ((sbrkRet=(Cal_Pointer_t)SBRK(0)) !=
+        (Cal_Pointer_t)((Cal_Address_t)currSeg->baseAddress+currSeg->limit) || 
+        allocSize+currSeg->limit > MAX_SEG_SIZE) {
+      
+      /* Segment is too large or someone else has moved the break. */
+      /* Pad to get to appropriate boundary. */
+      allocSize=CAL_ROUNDUP((Cal_Address_t)sbrkRet)-(Cal_Address_t)sbrkRet;
+      
+      /* Pad allocation request with storage for new segment */
+      /* information and indicate that a new segment must be */
+        /* created. */
+      allocSize+=((Cal_Address_t)1 << allocSizeIndex)+CAL_ROUNDUP(sizeof(Segment_t));
+      newSeg=1;
+    }
+    else newSeg=0;
+    sbrkRet=(Cal_Pointer_t)SBRK(allocSize);
+    if (sbrkRet == (Cal_Pointer_t) -1) Cal_MemFatal("Cal_MemGetBlock: allocation failed");
+    blockAllocation += allocSize;
+    if (newSeg){
+      currSeg = (Segment) CAL_ROUNDUP((Cal_Address_t)sbrkRet);
+      currSeg->baseAddress=(Cal_Pointer_t)((Cal_Address_t)currSeg+CAL_ROUNDUP(sizeof(Segment_t)));
+      currSeg->limit=0;
+      /* Readjust allocation size. */
+      allocSize=(1l << allocSizeIndex);
+      }
+    /* Carve allocated space up into blocks and add to free lists. */
+    while (allocSize){
+      size = allocSize - (allocSize & (allocSize-1));
+      b = (Block) ((Cal_Address_t)currSeg->baseAddress+currSeg->limit);
+      b->sizeIndex = CeilingLog2(size);
+      b->seg = currSeg;
+      AddToFreeList(b);
+        currSeg->limit += size;
+        allocSize -= size;
+    }
+    /* Find free block of appropriate size. */
+    for (i=sizeIndex; i <= MAX_SIZEINDEX && !avail[i]; ++i);
+  }
+  b = RemoveFromFreeList(avail[i]);
+  TrimToSize(b, sizeIndex);
+  return ((Cal_Pointer_t)((Cal_Address_t)b + HEADER_SIZE));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [Frees the block.]
+
+  Description        [Frees the block.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/void
+Cal_MemFreeBlock(Cal_Pointer_t p)
+{
+  Block b;
+
+  if (!p) return;
+  b = (Block) ((Cal_Address_t)p-HEADER_SIZE);
+  if (!b->used) Cal_MemFatal("Cal_MemFreeBlock: block not in use");
+  if (b->sizeIndex < 0 || b->sizeIndex > MAX_SIZEINDEX) Cal_MemFatal("Cal_MemFreeBlock: invalid block header");
+  MergeAndFree(b);
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis           [Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible. ]
+
+  Description        [Expands or contracts the block to a new size.
+  We try to avoid moving the block if possible. ]  
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+Cal_Pointer_t
+Cal_MemResizeBlock(Cal_Pointer_t p, Cal_Address_t newSize)
+{
+  int newSizeIndex;
+  Block b;
+  Block bb;
+  Cal_Pointer_t q;
+  Cal_Address_t oldSize;
+
+  if (!p) return (Cal_MemGetBlock(newSize));
+  b = (Block) ((Cal_Address_t)p - HEADER_SIZE);
+  if (!b->used) Cal_MemFatal("Cal_MemResizeBlock: block not in use");
+  if (b->sizeIndex < 0 || b->sizeIndex > MAX_SIZEINDEX){
+    Cal_MemFatal("Cal_MemResizeBlock: invalid block header");
+  }
+  if ((newSizeIndex = BlockSizeIndex(newSize)) < 0){
+    Cal_MemFreeBlock(p);
+    return ((Cal_Pointer_t)0);
+  }
+  if (b->sizeIndex >= newSizeIndex){
+    /* Shrink block. */
+    TrimToSize(b, newSizeIndex);
+    return (p);
+  }
+  oldSize=(1l << b->sizeIndex) - HEADER_SIZE;
+  /* Try to expand by adding buddies at higher addresses. */
+  for (bb=Buddy(b);
+       bb && (Cal_Address_t)b < (Cal_Address_t)bb && !bb->used && bb->sizeIndex == b->sizeIndex;
+       bb=Buddy(b)) {
+    RemoveFromFreeList(bb);
+    if (++(b->sizeIndex) == newSizeIndex) return (p);
+  }
+  /* Couldn't expand all the way to needed size; allocate a new block */
+  /* and move the contents of the old one. */
+  q = (Cal_Pointer_t) Cal_MemGetBlock(newSize);
+  Cal_MemCopy(q, p, oldSize);
+  MergeAndFree(b);
+  return (q);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Allocates a record from the specified record manager. ]
+
+  Description        [Allocates a record from the specified record manager. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+Cal_Pointer_t
+Cal_MemNewRec(Cal_RecMgr mgr)
+{
+  int i;
+  Cal_Pointer_t p;
+  List new_;
+  
+  if (!mgr->free) {
+    /* Allocate a new block. */
+    new_ = (List) Cal_MemGetBlock(ALLOC_SIZE);
+    mgr->numBlocks++;
+    new_->next=mgr->blocks;
+    mgr->blocks=new_;
+    mgr->free=(List)((Cal_Address_t)new_+CAL_ROUNDUP(sizeof(List_t)));
+    p=(Cal_Pointer_t)(mgr->free);
+    /* Carve the block into pieces. */
+    for (i=1; i < mgr->recsPerBlock; ++i) {
+      ((List)p)->next=(List)((Cal_Address_t)p+mgr->size);
+#if defined(DEBUG_MEM)
+      if (mgr->size >= sizeof(long)+sizeof(List_t))
+        *(long *)(sizeof(List_t)+(Cal_Address_t)p)=MAGIC_COOKIE;
+#endif
+      p=(Cal_Pointer_t)((Cal_Address_t)p+mgr->size);
+    }
+    ((List)p)->next=0;
+#if defined(DEBUG_MEM)
+    if (mgr->size >= sizeof(long)+sizeof(List_t)){
+      *(long *)(sizeof(List_t)+(Cal_Address_t)p)=MAGIC_COOKIE;
+    }
+#endif
+  }
+  new_ = mgr->free;
+#if defined(DEBUG_MEM)
+  if (mgr->size >= sizeof(long)+sizeof(List_t)){
+    if (*(long *)(sizeof(List_t)+(Cal_Address_t)new_) != MAGIC_COOKIE)
+      fprintf(stderr, "record at 0x%lx may be in use\n", (Cal_Address_t)new_);
+    else
+      *(long *)(sizeof(struct
+                       list_)+(Cal_Address_t)new)=MAGIC_COOKIE1;
+  }
+#endif
+  mgr->free = mgr->free->next;
+  return ((Cal_Pointer_t)new_);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [Frees a record managed by the indicated record manager. ]
+
+  Description        [Frees a record managed by the indicated record manager. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+Cal_MemFreeRec(Cal_RecMgr mgr, Cal_Pointer_t rec)
+{
+#if defined(DEBUG_MEM)
+  if (mgr->size >= sizeof(long)+sizeof(List_t))
+    if (*(long *)(sizeof(List_t)+(Cal_Address_t)rec) == MAGIC_COOKIE)
+      fprintf(stderr, "record at 0x%lx may already be freed\n", (Cal_Address_t)rec);
+#endif
+  ((List)rec)->next=mgr->free;
+#if defined(DEBUG_MEM)
+  if (mgr->size >= sizeof(long)+sizeof(List_t))
+    *(long *)(sizeof(List_t)+(Cal_Address_t)rec)=MAGIC_COOKIE;
+#endif
+  mgr->free=(List)rec;
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis           [Creates a new record manager with the given  record size.]
+
+  Description        [Creates a new record manager with the given  record size.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+Cal_RecMgr
+Cal_MemNewRecMgr(int size)
+{
+  Cal_RecMgr mgr;
+
+  if (size < sizeof(List_t)) size=sizeof(List_t);
+  size=CAL_ROUNDUP(size);
+  if (size > ALLOC_SIZE-CAL_ROUNDUP(sizeof(List_t)))
+    Cal_MemFatal("Cal_MemNewRecMgr: record size too large");
+  mgr = (Cal_RecMgr)Cal_MemGetBlock((Cal_Address_t)sizeof(Cal_RecMgr_t));
+  mgr->size=size;
+  mgr->recsPerBlock=(ALLOC_SIZE-CAL_ROUNDUP(sizeof(List_t)))/size;
+  mgr->free=0;
+  mgr->blocks=0;
+  mgr->numBlocks = 0;
+  return (mgr);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Frees all the storage associated with the specified record manager.]
+
+  Description        [Frees all the storage associated with the specified record manager.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+Cal_MemFreeRecMgr(Cal_RecMgr mgr)
+{
+  List p, q;
+  for (p=mgr->blocks; p; p=q){
+    q=p->next;
+    Cal_MemFreeBlock((Cal_Pointer_t)p);
+  }
+  Cal_MemFreeBlock((Cal_Pointer_t)mgr);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+static int
+CeilingLog2(Cal_Address_t i)
+{
+  Cal_Address_t j;
+  int result;
+
+  for (result=0, j=1; j < i; ++result, j*=2);
+  return (result);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [BlockSizeIndex(size) return the coded size for a block. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+static int
+BlockSizeIndex(Cal_Address_t size)
+{
+  if (size < 1)
+    return (-1);
+  if (size > MAX_SIZE)
+    Cal_MemFatal("BlockSizeIndex: block size too large");
+  else
+    size+=HEADER_SIZE;
+  return (CeilingLog2(size));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [AddToFreeList(b) adds b to the appropriate free list. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+static void
+AddToFreeList(Block b)
+{
+  int i;
+
+  i=b->sizeIndex;
+  if (!avail[i]){
+      b->next=b;
+      b->prev=b;
+      avail[i]=b;
+  }
+  else {
+    b->next=avail[i]->next;
+    avail[i]->next->prev=b;
+    avail[i]->next=b;
+    b->prev=avail[i];
+  }
+  b->used=0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [RemoveFromFreeList(b) removes b from the free list which it is on. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+static Block
+RemoveFromFreeList(Block b)
+{
+  int i;
+
+  i=b->sizeIndex;
+  if (b->next == b)
+    avail[i]=0;
+  else {
+    b->next->prev=b->prev;
+    b->prev->next=b->next;
+    if (avail[i] == b) avail[i]=b->next;
+  }
+  b->used=1;
+  return (b);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [Buddy(b) returns the Buddy block of b, or null if there is no  Buddy. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+
+static Block
+Buddy(Block b)
+{
+  Cal_Address_t Buddy_offset;
+
+  Buddy_offset=(Cal_Address_t)(((Cal_Address_t)b-(Cal_Address_t)b->seg->baseAddress) ^
+                               ((Cal_Address_t)1 << b->sizeIndex));
+  if (Buddy_offset < b->seg->limit)
+    return ((Block)((Cal_Address_t)b->seg->baseAddress+Buddy_offset));
+  else
+    return ((Block)0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [TrimToSize(b, sizeIndex) repeatedly splits b until it has  the indicated size.  Blocks which are split off are added to the appropriate free list. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+static void
+TrimToSize(Block b, int sizeIndex)
+{
+  Block bb;
+
+  while (b->sizeIndex > sizeIndex) {
+    b->sizeIndex--;
+    bb=Buddy(b);
+    bb->sizeIndex=b->sizeIndex;
+    bb->seg=b->seg;
+    AddToFreeList(bb);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [MergeAndFree(b) repeatedly merges b its Buddy until b has no Buddy or the Buddy isn't free, then adds the result to the  appropriate free list. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+  CommandName        [optional] 	   
+
+  CommandSynopsis    [optional]  
+
+  CommandArguments   [optional]  
+
+  CommandDescription [optional]  
+
+******************************************************************************/
+static void
+MergeAndFree(Block b)
+{
+  Block bb;
+  
+  for (bb=Buddy(b); bb && !bb->used && bb->sizeIndex == b->sizeIndex;
+       bb=Buddy(b)) { 
+    RemoveFromFreeList(bb);
+    if ((Cal_Address_t)bb < (Cal_Address_t)b) b=bb;
+    b->sizeIndex++;
+  }
+  AddToFreeList(b);
+}
Index: /vis_dev/glu-2.1/src/calBdd/calMem.h
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calMem.h	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calMem.h	(revision 6)
@@ -0,0 +1,116 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [calMem.h]
+
+  PackageName [cal]
+
+  Synopsis    [Header file for memory management]
+
+  Description [ ]
+
+  SeeAlso     []
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu). Originally written by David Long. ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calMem.h,v 1.3 2002/08/28 16:01:01 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _CAL_MEM
+#define _CAL_MEM
+
+#include <stdio.h>
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/* CAL_ALLOC_ALIGNMENT is the alignment for all storage returned by the */
+/* storage allocation routines. */
+/* was 16 for __osf__ systems, 8 otherwise */
+
+#define CAL_ALLOC_ALIGNMENT sizeof(void *)
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct Cal_RecMgrStruct * Cal_RecMgr;
+typedef void *Cal_Pointer_t;
+typedef size_t Cal_Address_t;
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#ifndef EXTERN
+#  ifdef __cplusplus
+#    define EXTERN	extern "C"
+#  else
+#    define EXTERN	extern
+#  endif
+#endif
+#define Cal_Nil(obj) ((obj *)0)
+#define USE_OS_MEMORY_MANAGEMENT
+#ifdef USE_OS_MEMORY_MANAGEMENT
+#define Cal_MemAlloc(type, num) ((type *) malloc(sizeof(type) * (num)))
+#define Cal_MemRealloc(type, obj, num)	\
+    (obj) ? ((type *) realloc((char *) obj, sizeof(type) * (num))) : \
+    ((type *) malloc(sizeof(type) * (num)))
+#define Cal_MemFree(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
+#else
+#define Cal_MemAlloc(type, num) ((type *) Cal_MemGetBlock(sizeof(type) * (num)))
+#define Cal_MemRealloc(type, obj, num)	\
+    (obj) ? ((type *) Cal_MemResizeBlock((Cal_Pointer_t) obj, sizeof(type) * (num))) : \
+    ((type *) Cal_MemGetBlock(sizeof(type) * (num)))
+#define Cal_MemFree(obj) ((obj) ? (Cal_MemFreeBlock((Cal_Pointer_t) (obj)), (obj) = 0) : 0)
+#endif
+#define Cal_MemCopy(dest, src, size)  ((void *) memcpy((void *)dest, (const void *)src, (size_t)size));
+#define Cal_MemZero(ptr, size) ((void)memset((void *)(ptr), 0, (Cal_Address_t)(size)))
+
+/* Round a size up for alignment */
+
+#define CAL_ROUNDUP(size) ((((size)+CAL_ALLOC_ALIGNMENT-1)/CAL_ALLOC_ALIGNMENT)*CAL_ALLOC_ALIGNMENT)
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+EXTERN void Cal_MemFatal(char *message);
+EXTERN Cal_Address_t Cal_MemAllocation(void);
+EXTERN Cal_Pointer_t Cal_MemGetBlock(Cal_Address_t size);
+EXTERN void Cal_MemFreeBlock(Cal_Pointer_t p);
+EXTERN Cal_Pointer_t Cal_MemResizeBlock(Cal_Pointer_t p, Cal_Address_t newSize);
+EXTERN Cal_Pointer_t Cal_MemNewRec(Cal_RecMgr mgr);
+EXTERN void Cal_MemFreeRec(Cal_RecMgr mgr, Cal_Pointer_t rec);
+EXTERN Cal_RecMgr Cal_MemNewRecMgr(int size);
+EXTERN void Cal_MemFreeRecMgr(Cal_RecMgr mgr);
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _CAL */
Index: /vis_dev/glu-2.1/src/calBdd/calMemoryManagement.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calMemoryManagement.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calMemoryManagement.c	(revision 6)
@@ -0,0 +1,593 @@
+/**CFile***********************************************************************
+
+  FileName    [calMemoryManagement.c]
+
+  PackageName [cal]
+
+  Synopsis    [Special memory management routines specific to CAL.]
+
+  Description [Functions for managing the system memory using a set of 
+              nodeManagers. Each nodeManager manages a set of fixed size
+              nodes obtained from a set of pages. When additional memory
+              is required, nodeManager obtains a new page from the pageManager.
+              The new page is divided into ( PAGE_SIZE/NODE_SIZE ) number of
+              nodes.]
+
+  SeeAlso     []
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+              ] 
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calMemoryManagement.c,v 1.6 2005/04/30 01:50:53 fabio Exp $]
+
+******************************************************************************/
+#include "malloc.h"
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#ifndef HAVE_VALLOC
+#define __NOVALLOC__
+#else
+#if HAVE_VALLOC != 1
+#define __NOVALLOC__
+#endif
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int PageManagerExpandStorage(CalPageManager_t * pageManager);
+static CalAddress_t * PageAlign(CalAddress_t * p);
+static int SegmentToPageList(CalAddress_t * segment, int numPages, CalAddress_t * lastPointer);
+
+/**AutomaticEnd***************************************************************/
+
+/*
+ * object: pageManager
+ * operations: Init, Quit, AllocPage, FreePage, Print
+ */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Name        [CalPageMangerInit]
+
+  Synopsis    [Initializes a pageManager.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+CalPageManager_t *
+CalPageManagerInit(int numPagesPerSegment)
+{
+  CalPageManager_t *pageManager;
+  pageManager = Cal_MemAlloc(CalPageManager_t, 1);
+  pageManager->totalNumPages = 0;
+  pageManager->numSegments = 0;
+  pageManager->numPagesPerSegment = numPagesPerSegment;
+  pageManager->maxNumSegments = MAX_NUM_SEGMENTS;
+  pageManager->pageSegmentArray 
+      = Cal_MemAlloc(CalAddress_t *, pageManager->maxNumSegments);
+  pageManager->numPagesArray 
+      = Cal_MemAlloc(int, pageManager->maxNumSegments);
+  pageManager->freePageList = Cal_Nil(CalAddress_t);
+  if(PageManagerExpandStorage(pageManager) == FALSE){
+    Cal_MemFree(pageManager->pageSegmentArray);
+    Cal_MemFree(pageManager);
+    return Cal_Nil(CalPageManager_t);
+  }
+  return pageManager;
+}
+
+
+/**Function********************************************************************
+
+  Name        [CalPageMangerQuit]
+
+  Synopsis    [Frees pageManager and associated pages.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalPageManagerQuit(
+  CalPageManager_t * pageManager)
+{
+  int i;
+  if(pageManager == Cal_Nil(CalPageManager_t)){
+    return 1;
+  }
+  for(i = 0; i < pageManager->numSegments; i++){
+    free(pageManager->pageSegmentArray[i]);
+  }
+  Cal_MemFree(pageManager->pageSegmentArray);
+  Cal_MemFree(pageManager->numPagesArray);
+  Cal_MemFree(pageManager);
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Name        [CalPageMangerPrint]
+
+  Synopsis    [Prints address of each memory segment and address of each page.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalPageManagerPrint(
+  CalPageManager_t * pageManager)
+{
+  int i;
+  CalAddress_t *page;
+  printf("****************** pageManager ********************\n");
+  printf("allocationList:\n");
+  for(i = 0; i < pageManager->numSegments; i++){
+    page = pageManager->pageSegmentArray[i];
+    printf("%lx%c", (CalAddress_t)page, (i+1)%5?' ':'\n');
+  }
+  printf("\n");
+  printf("freePageList:\n");
+  i = 0;
+  page = pageManager->freePageList;
+  while(page){
+    printf("%lx%c", (CalAddress_t)page, (i+1)%5?' ':'\n');
+    i++;
+    page = (CalAddress_t *)*page;
+  }
+  printf("\n");
+}
+
+
+/**Function********************************************************************
+
+  Name        [CalNodeManagerInit]
+
+  Synopsis    [Initializes a node manager.]
+
+  Description [optional]
+
+  SideEffects []
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+CalNodeManager_t *
+CalNodeManagerInit(CalPageManager_t * pageManager)
+{
+  CalNodeManager_t *nodeManager;
+  nodeManager = Cal_MemAlloc(CalNodeManager_t, 1);
+  nodeManager->freeNodeList = Cal_Nil(CalBddNode_t);
+  nodeManager->pageManager = pageManager;
+  nodeManager->numPages = 0;
+  nodeManager->maxNumPages = 10;
+  nodeManager->pageList = Cal_MemAlloc(CalAddress_t *,
+                                        nodeManager->maxNumPages);
+  return nodeManager;
+}
+
+
+/**Function********************************************************************
+
+  Name        [CalNodeManagerQuit]
+
+  Synopsis    [Frees a node manager.]
+
+  Description [optional]
+
+  SideEffects [The associated nodes are lost.]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalNodeManagerQuit(CalNodeManager_t * nodeManager)
+{
+  if(nodeManager == Cal_Nil(CalNodeManager_t)){
+    return 1;
+  }
+  else{
+    int i;
+    for (i = 0; i < nodeManager->numPages; i++){
+      CalPageManagerFreePage(nodeManager->pageManager,
+                             nodeManager->pageList[i]);
+    }
+    Cal_MemFree(nodeManager->pageList);
+    Cal_MemFree(nodeManager);
+    return 0;
+  }
+}
+
+
+
+/**Function********************************************************************
+
+  Name        [CalNodeManagerPrint]
+
+  Synopsis    [Prints address of each free node.]
+
+  Description [optional]
+
+  SideEffects []
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalNodeManagerPrint(
+  CalNodeManager_t * nodeManager)
+{
+  int i;
+  CalBddNode_t *node;
+  printf("****************** nodeManager ********************\n");
+  printf("freeNodeList:\n");
+  i = 0;
+  node = nodeManager->freeNodeList;
+  while(node){
+    printf("%lx%c", (CalAddress_t)node, (i+1)%5?' ':'\n');
+    i++;
+    node = node->nextBddNode;
+  }
+  printf("\n");
+}
+
+
+/**Function********************************************************************
+
+  Name        [PageMangerAllocPage]
+
+  Synopsis    [Allocs a new page.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+CalAddress_t *
+CalPageManagerAllocPage(CalPageManager_t * pageManager)
+{
+  CalAddress_t *page;
+  char buffer[512];
+  if(pageManager->freePageList == Cal_Nil(CalAddress_t)){
+    if(PageManagerExpandStorage(pageManager) == FALSE){
+      sprintf(buffer,
+              "out of memory : Number of pages allocated = %d\n", 
+              pageManager->totalNumPages);
+      CalBddFatalMessage(buffer);
+    }
+  }
+  page = pageManager->freePageList;
+  pageManager->freePageList = (CalAddress_t *)*page;
+  return page;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Name        [PageMangerFreePage]
+
+  Synopsis    [Free a page.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalPageManagerFreePage(CalPageManager_t * pageManager, CalAddress_t * page)
+{
+  *page = (CalAddress_t)(pageManager->freePageList);
+  pageManager->freePageList = page;
+}
+
+
+/**Function********************************************************************
+
+  Name        [PageManagerExpandStorage]
+
+  Synopsis    [Allocates a segment of memory to expand the storage managed by
+              pageManager. The allocated segment is divided into free pages
+              which are linked as a freePageList.]
+
+  Description [optional]
+
+  SideEffects [The size of the segment is stored in one of the fields
+              of page manager - numPagesPerSegment. If a memory
+              segment of a specific size cannot be allocated, the
+              routine calls itself recursively by reducing
+              numPagesPerSegment by a factor of 2.]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+PageManagerExpandStorage(CalPageManager_t * pageManager)
+{
+  CalAddress_t *p;
+  CalAddress_t *segment;
+  int numUsefulPages;
+
+  int numPagesPerSegment = pageManager->numPagesPerSegment;
+
+#ifdef __NOVALLOC__
+  p = (CalAddress_t *) malloc(numPagesPerSegment*PAGE_SIZE);
+#else
+  p = (CalAddress_t *) valloc(numPagesPerSegment*PAGE_SIZE);
+#endif
+  /* Just check the page boundary correctness */
+  Cal_Assert(((CalAddress_t)p & ((1 << LG_PAGE_SIZE)-1)) == 0);
+  if(p == Cal_Nil(CalAddress_t)){
+    numPagesPerSegment = numPagesPerSegment / 2;
+    if(numPagesPerSegment < MIN_NUM_PAGES_PER_SEGMENT){
+      return FALSE;
+    }
+    pageManager->numPagesPerSegment = numPagesPerSegment;
+    return PageManagerExpandStorage(pageManager);  
+  }
+
+#ifdef __NOVALLOC__
+  /* No need to do it anymore, since I am using valloc */
+  /* align the memory segment to a page boundary */
+  segment = PageAlign(p);  
+
+  /* if memory segment is already page aligned, all pages in the memory
+   * segment are useful, otherwise, one page is wasted
+   */
+  if(segment == p){
+    numUsefulPages = numPagesPerSegment;
+  }
+  else{
+    numUsefulPages = numPagesPerSegment - 1;
+  }
+#else
+  segment = p;
+  numUsefulPages = numPagesPerSegment;
+#endif
+  
+  /* Initialize the pages  */
+  memset((char *)segment, 0, numUsefulPages*PAGE_SIZE);
+
+  /* Keep track of the number of pages allocated */
+  pageManager->totalNumPages += numUsefulPages;
+  
+  /* increase the size of the allocation list if neccessary */
+  if(pageManager->numSegments == pageManager->maxNumSegments){
+    pageManager->maxNumSegments = pageManager->maxNumSegments * 2;
+    pageManager->pageSegmentArray = Cal_MemRealloc(CalAddress_t *,
+                                                   pageManager->pageSegmentArray, 
+                                                   pageManager->maxNumSegments);
+    pageManager->numPagesArray = Cal_MemRealloc(int,
+                                                pageManager->numPagesArray, 
+                                                pageManager->maxNumSegments);
+    
+  }
+
+  pageManager->pageSegmentArray[pageManager->numSegments] = p;
+  pageManager->numPagesArray[pageManager->numSegments++] =
+      numUsefulPages;
+  
+  SegmentToPageList(segment, numUsefulPages, pageManager->freePageList);
+  pageManager->freePageList = segment;
+  return TRUE;
+}
+
+
+/**Function********************************************************************
+
+  Name        [PageAlign]
+
+  Synopsis    [Return page aligned address greater than or equal to
+  the pointer.]
+
+  Description [optional]
+
+  SideEffects []
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static CalAddress_t *
+PageAlign(
+  CalAddress_t * p)
+{
+  if((CalAddress_t)p & (PAGE_SIZE - 1)){
+    p = (CalAddress_t *)( (CalAddress_t)p >> LG_PAGE_SIZE );
+    p = (CalAddress_t *)( ((CalAddress_t)p << LG_PAGE_SIZE) + PAGE_SIZE );
+  }
+  return p;
+}
+
+
+/**Function********************************************************************
+
+  Name        [SegmentToPageList]
+
+  Synopsis    [Converts a memory segment into a linked list of pages.
+              if p is a pointer to a page, *p contains address of the next page
+              if p is a pointer to the last page, *p contains lastPointer.]
+
+  Description [optional]
+
+  SideEffects []
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+SegmentToPageList(CalAddress_t * segment,
+                  int  numPages,
+                  CalAddress_t * lastPointer)
+{
+  int i;
+  unsigned long thisPageOffset, nextPageOffset;
+
+  if(numPages > 0){
+    for(i = 0; i < numPages - 1; i++){
+      thisPageOffset = (i<<LG_PAGE_SIZE)/sizeof(CalAddress_t);
+      nextPageOffset = ((i+1)<<LG_PAGE_SIZE)/sizeof(CalAddress_t);
+      *(segment + thisPageOffset) =
+          (CalAddress_t)(segment + nextPageOffset);
+    }
+    thisPageOffset = ((numPages - 1)<<LG_PAGE_SIZE)/sizeof(CalAddress_t);
+    *(segment + thisPageOffset) = (CalAddress_t)lastPointer;
+  }
+  else{
+    CalBddFatalMessage("out of memory");
+  }
+  return 0;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Module Testing                                                            */
+/*---------------------------------------------------------------------------*/
+#ifdef PAGE_MANAGER
+main(argc, argv)
+int argc;
+char **argv;
+{
+  CalPageManager_t *pageManager;
+  CalAddress_t *page, *pageArray[10];
+  int i;
+
+  pageManager = CalPageManagerInit();
+  CalPageManagerPrint(pageManager);
+
+  page = CalPageManagerAllocPage(pageManager);
+  printf("PAGE - %x\n", (CalAddress_t)page);
+  CalPageManagerPrint(pageManager);
+
+  PageManagerFreePage(pageManager, page);
+  CalPageManagerPrint(pageManager);
+
+  printf("Cal_MemAllocATING PAGES\n");
+  for(i = 0; i < 10; i++){
+    pageArray[i] = CalPageManagerAllocPage(pageManager);
+    CalPageManagerPrint(pageManager);
+    printf("\n");
+  }
+  printf("\n");
+
+  printf("FREEING PAGES\n");
+  for(i = 0; i < 10; i++){
+    PageManagerFreePage(pageManager, pageArray[i] );
+    CalPageManagerPrint(pageManager);
+    printf("\n");
+  }    
+  printf("\n");
+  CalPageManagerQuit(pageManager);
+}
+#endif
+
+#ifdef NODE_MANAGER
+main(argc, argv)
+int argc;
+char **argv;
+{
+  CalPageManager_t *pageManager;
+  CalNodeManager_t *nodeManagerArray[5], *nodeManager;
+  CalBddNode_t *node, *nodeArray[5][10];
+  int numNodeManagers = 5;
+  int numNodes = 10;
+  int i,j;
+  
+
+  pageManager = CalPageManagerInit();
+  /*CalNodeManagerPrint(nodeManager);*/
+
+  printf("Allocating Nodes\n");
+  for(i = 0; i < numNodeManagers; i++){
+    nodeManagerArray[i] = CalNodeManagerInit(pageManager);
+    for (j=0; j < numNodes; j++){
+      CalNodeManagerAllocNode(nodeManagerArray[i], nodeArray[i][j]);
+      CalBddNodePutRefCount(nodeArray[i][j], i+j);
+    }
+  }
+  for(i = 0; i < numNodeManagers; i++){
+    printf("i = %3d\n", i);
+    for (j=0; j < numNodes; j++){
+      CalBddNodePrint(nodeArray[i][j]);
+    }
+    printf("\n");
+  }
+
+  printf("FREEING NODES\n");
+  for(i = 0; i < numNodeManagers; i++){
+    for(j = 0; j < numNodes; j++){
+      CalNodeManagerFreeNode(nodeManagerArray[i], nodeArray[i][j] );
+    }    
+    CalNodeManagerQuit(nodeManagerArray[i]);
+  }
+  CalPageManagerQuit(pageManager);
+}
+#endif
Index: /vis_dev/glu-2.1/src/calBdd/calPerformanceTest.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calPerformanceTest.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calPerformanceTest.c	(revision 6)
@@ -0,0 +1,999 @@
+/**CFile***********************************************************************
+
+  FileName    [calPerformanceTest.c]
+
+  PackageName [cal]
+
+  Synopsis    [This file contains the performance test routines for
+  the CAL package.] 
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi  (sanghavi@eecs.berkeley.edu)
+              ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calPerformanceTest.c,v 1.10 2005/04/30 22:57:39 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+#include <unistd.h>
+#include <sys/types.h>
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static int ITERATION;
+
+                        
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CalPerformanceTestAnd(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+#ifdef COMPUTE_MEMORY_OVERHEAD
+static void CalPerformanceMemoryOverhead(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+#endif
+static void CalPerformaceTestSuperscalar(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestNonSuperscalar(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestMultiway(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestOneway(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestCompose(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestQuantifyAllTogether(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions, int bfZeroBFPlusDFOne, int cacheExistsResultsFlag, int cacheOrResultsFlag);
+static void CalQuantifySanityCheck(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestRelProd(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions, int bfZeroBFPlusDFOne, int cacheRelProdResultsFlag, int cacheAndResultsFlag, int cacheOrResultsFlag);
+static void CalPerformanceTestSubstitute(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static void CalPerformanceTestSwapVars(Cal_BddManager bddManager, Cal_Bdd *outputBddArray, int numFunctions);
+static long elapsedTime(void);
+static double cpuTime(void);
+static long pageFaults(void);
+static void GetRandomNumbers(int lowerBound, int upperBound, int count, int *resultVector);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Main routine for testing performances of various routines.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+Cal_PerformanceTest(Cal_BddManager bddManager, Cal_Bdd
+                   *outputBddArray, int numFunctions, int iteration, int seed,
+                    int andPerformanceFlag, int
+                    multiwayPerformanceFlag, int
+                    onewayPerformanceFlag,  int
+                    quantifyPerformanceFlag, 
+                    int composePerformanceFlag, int relprodPerformanceFlag,
+                    int swapPerformanceFlag,
+                    int substitutePerformanceFlag, int
+                    sanityCheckFlag, int computeMemoryOverheadFlag,
+                    int superscalarFlag) 
+{
+  
+  CalUtilSRandom((long)seed);
+  
+  ITERATION = iteration;
+  fprintf(stdout,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
+  fprintf(stdout, "Performing %d iterations for each function\n", iteration);
+  Cal_BddSetGCMode(bddManager, 0);
+#ifdef QUANTIFY
+  quantify_start_recording_data();
+#endif
+
+#ifdef PURECOV
+	purecov_clear_data();
+#endif
+
+  if (relprodPerformanceFlag){
+    CalPerformanceTestRelProd(bddManager, outputBddArray, numFunctions, 1, 1,
+                              1, 1);
+    CalUtilSRandom((long)seed);
+
+  }
+  if (sanityCheckFlag == 1){
+    CalQuantifySanityCheck(bddManager, outputBddArray,
+                           numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+  if (quantifyPerformanceFlag){
+    CalPerformanceTestQuantifyAllTogether(bddManager, outputBddArray,
+                                          numFunctions, 1, 1, 1);
+    CalUtilSRandom((long)seed);
+	/*
+    CalPerformanceTestNonSuperscalarQuant(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+	*/
+  }
+
+  if (multiwayPerformanceFlag){
+    CalPerformanceTestMultiway(bddManager, outputBddArray, numFunctions); 
+    CalUtilSRandom((long)seed);
+  }
+  if (onewayPerformanceFlag){
+    CalPerformanceTestOneway(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+  if (andPerformanceFlag){
+    CalPerformanceTestAnd(bddManager, outputBddArray, numFunctions); 
+    CalUtilSRandom((long)seed);
+  }
+  if (composePerformanceFlag){
+    CalPerformanceTestCompose(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+  if (swapPerformanceFlag){
+    CalPerformanceTestSwapVars(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+  if (substitutePerformanceFlag){
+    CalPerformanceTestSubstitute(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+#ifdef COMPUTE_MEMORY_OVERHEAD
+  if (computeMemoryOverheadFlag){
+    CalPerformaceMemoryOverhead(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+#endif
+  if (superscalarFlag){
+    CalPerformaceTestSuperscalar(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+    CalPerformanceTestNonSuperscalar(bddManager, outputBddArray, numFunctions);
+    CalUtilSRandom((long)seed);
+  }
+#ifdef QUANTIFY
+  quantify_stop_recording_data();
+#endif
+#ifdef PURECOV
+	purecov_save_data();
+	purecov_disable_save();
+#endif
+  fprintf(stdout,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
+  Cal_BddSetGCMode(bddManager, 1);
+  return 0;
+}
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalIncreasingOrderCompare(const void *a, const void *b)
+{
+  return (*(int *)b-*(int *)a);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalDecreasingOrderCompare(const void *a, const void *b)
+{
+  return (*(int *)a-*(int *)b);
+}
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestAnd(Cal_BddManager bddManager, Cal_Bdd
+                      *outputBddArray, int numFunctions)
+{
+  int i;
+  Cal_Bdd function1, function2;
+  Cal_Bdd result;
+  
+  
+  (void) elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    function1 = outputBddArray[CalUtilRandom()%numFunctions];
+    function2 = outputBddArray[CalUtilRandom()%numFunctions];
+    result = Cal_BddAnd(bddManager, function1, function2);
+    Cal_BddFree(bddManager, result);
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "AND", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_BddManagerGC(bddManager);
+}
+
+
+
+#ifdef COMPUTE_MEMORY_OVERHEAD
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceMemoryOverhead(Cal_BddManager bddManager, Cal_Bdd
+                            *outputBddArray, int numFunctions)
+{
+  int i, j, *varIdArray;
+  Cal_Bdd function1, function2;
+  Cal_Bdd result, *bddArray;
+  double maxReduceToApplyRatio = 0;
+  double maxReduceToUniqueTableRatio = 0;
+  int num, power;
+
+  if (numFunctions <= 1) return;
+
+  for (i=0; i<ITERATION; i++){
+    function1 = outputBddArray[CalUtilRandom()%numFunctions];
+    function2 = outputBddArray[CalUtilRandom()%numFunctions];
+    result = Cal_BddAnd(bddManager, function1, function2);
+    Cal_BddFree(bddManager, result);
+    if (maxReduceToApplyRatio < calAfterReduceToAfterApplyNodesRatio){
+      maxReduceToApplyRatio = calAfterReduceToAfterApplyNodesRatio;
+    }
+    if (maxReduceToUniqueTableRatio < calAfterReduceToUniqueTableNodesRatio){
+      maxReduceToUniqueTableRatio = calAfterReduceToUniqueTableNodesRatio;
+    }
+  }
+
+  fprintf(stdout, "%-20s Max R/A: %-8.6f Max R/U: %-8.6f\n", "MEMORYOVERHEAD-AND",
+          calAfterReduceToAfterApplyNodesRatio,
+          calAfterReduceToUniqueTableNodesRatio);
+  Cal_BddManagerGC(bddManager);
+
+  for (power = 1; power <= 5; power++){
+    num = (1<<power);
+    if (num > numFunctions) return;
+    varIdArray = Cal_MemAlloc(int, num);
+    bddArray = Cal_MemAlloc(Cal_Bdd, num+1);
+    bddArray[num] = Cal_BddGetNullBdd(bddManager);
+    
+    maxReduceToApplyRatio = 0;
+    maxReduceToUniqueTableRatio = 0;
+    
+    for (i=0; i<ITERATION; i++){
+      GetRandomNumbers(0, numFunctions-1, num, varIdArray);
+      for (j=0; j<num; j++){
+        bddArray[j] = outputBddArray[varIdArray[j]];
+      }
+      result = Cal_BddMultiwayAnd(bddManager, bddArray);
+      Cal_BddFree(bddManager, result);
+      if (maxReduceToApplyRatio < calAfterReduceToAfterApplyNodesRatio){
+        maxReduceToApplyRatio = calAfterReduceToAfterApplyNodesRatio;
+      }
+      if (maxReduceToUniqueTableRatio <
+          calAfterReduceToUniqueTableNodesRatio){ 
+        maxReduceToUniqueTableRatio = calAfterReduceToUniqueTableNodesRatio;
+      }
+    }
+    
+    fprintf(stdout, "%-16s%4d Max R/A: %-8.6f Max R/U: %-8.6f\n",
+            "MH-MULTIWAY-AND", num,
+            calAfterReduceToAfterApplyNodesRatio, 
+            calAfterReduceToUniqueTableNodesRatio);
+    Cal_MemFree(varIdArray);
+    Cal_MemFree(bddArray);
+    Cal_BddManagerGC(bddManager);
+  }
+}
+#endif
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformaceTestSuperscalar(Cal_BddManager bddManager, Cal_Bdd
+                         *outputBddArray, int numFunctions)
+{
+  int i,j;
+  Cal_Bdd *bddArray, *resultArray;
+  int *varIdArray;
+  int num = (((numFunctions%2) == 0)? numFunctions : (numFunctions-1));
+  if (num == 0) return;
+  if (num > 100) num = 100;
+  varIdArray = Cal_MemAlloc(int, num);
+  bddArray = Cal_MemAlloc(Cal_Bdd, num+1);
+  bddArray[num] = (Cal_Bdd) 0;
+  
+  
+  (void) elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    GetRandomNumbers(0, numFunctions-1, num, varIdArray);
+    for (j=0; j<num; j++){
+      bddArray[j] = outputBddArray[varIdArray[j]];
+    }
+    resultArray = Cal_BddPairwiseAnd(bddManager, bddArray);
+    for (j=0; j<num/2; j++){
+      Cal_BddFree(bddManager, resultArray[j]);
+    }
+    Cal_MemFree(resultArray);
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "SUPERSCALARAND", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_MemFree(varIdArray);
+  Cal_MemFree(bddArray);
+  Cal_BddManagerGC(bddManager);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestNonSuperscalar(Cal_BddManager bddManager, Cal_Bdd
+                                 *outputBddArray, int numFunctions)
+{
+  int i, j;
+  Cal_Bdd *bddArray, *resultArray;
+  int *varIdArray;
+
+  int num = (((numFunctions%2) == 0)? numFunctions : (numFunctions-1));
+
+  if (num == 0) return;
+  if (num > 100) num = 100;
+
+  varIdArray = Cal_MemAlloc(int, num);
+  bddArray = Cal_MemAlloc(Cal_Bdd, num+1);
+  bddArray[num] = (Cal_Bdd) 0;
+  resultArray = Cal_MemAlloc(Cal_Bdd, num/2);
+  
+  (void) elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    GetRandomNumbers(0, numFunctions-1, num, varIdArray);
+    for (j=0; j<num/2; j++){
+      resultArray[j] = Cal_BddAnd(bddManager,
+                          outputBddArray[varIdArray[j<<1]],
+                          outputBddArray[varIdArray[(j<<1)+1]]);  
+    }
+    for (j=0; j<num/2; j++){
+      Cal_BddFree(bddManager, resultArray[j]);
+    }
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "NONSUPERSCALARAND", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_MemFree(resultArray);
+  Cal_MemFree(bddArray);
+  Cal_MemFree(varIdArray);
+  Cal_BddManagerGC(bddManager);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestMultiway(Cal_BddManager bddManager, Cal_Bdd
+                           *outputBddArray, int numFunctions)
+{
+  int i,j;
+  Cal_Bdd result, *bddArray;
+  int *varIdArray;
+  int power;
+  int num;
+  
+  if (numFunctions <= 1) return;
+  for (power = 1; power <= 5; power++){
+    num = (1<<power);
+    if (num > numFunctions) return;
+    varIdArray = Cal_MemAlloc(int, num);
+    bddArray = Cal_MemAlloc(Cal_Bdd, num+1);
+    bddArray[num] = (Cal_Bdd) 0;
+    (void) elapsedTime();
+    cpuTime();
+    pageFaults();
+    for (i=0; i<ITERATION; i++){
+      GetRandomNumbers(0, numFunctions-1, num, varIdArray);
+      for (j=0; j<num; j++){
+        bddArray[j] = outputBddArray[varIdArray[j]];
+      }
+      result = Cal_BddMultiwayAnd(bddManager, bddArray);
+      Cal_BddFree(bddManager, result);
+    }
+    fprintf(stdout, "%-20s%-4d%-10ld%-8.2f%-10ld\n", "MULTIWAYAND", num,
+            elapsedTime(), cpuTime(), pageFaults());
+    Cal_MemFree(varIdArray);
+    Cal_MemFree(bddArray);
+    Cal_BddManagerGC(bddManager);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestOneway(Cal_BddManager bddManager, Cal_Bdd
+                         *outputBddArray, int numFunctions)
+{
+  int i, j;
+  Cal_Bdd result, tempResult;
+  int *varIdArray;
+  int power, num;
+  
+  if (numFunctions <= 1) return;
+  
+  for (power = 1; power <= 5; power++){
+    num = (1<<power);
+    if (num > numFunctions) return;
+    varIdArray = Cal_MemAlloc(int, num);
+    (void) elapsedTime();
+    cpuTime();
+    pageFaults();
+    for (i=0; i<ITERATION; i++){
+      GetRandomNumbers(0, numFunctions-1, num, varIdArray);
+      result = Cal_BddOne(bddManager);
+      for (j=0; j<num; j++){
+        tempResult = Cal_BddAnd(bddManager, result,
+                                outputBddArray[varIdArray[j]]); 
+        Cal_BddFree(bddManager, result);
+        result = tempResult;
+      }
+      Cal_BddFree(bddManager, result);
+    }
+    fprintf(stdout, "%-20s%-4d%-10ld%-8.2f%-10ld\n", "ONEWAYAND", num,
+            elapsedTime(), cpuTime(), pageFaults());
+    Cal_MemFree(varIdArray);
+    Cal_BddManagerGC(bddManager);
+  }
+}
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestCompose(Cal_BddManager bddManager, Cal_Bdd
+                                   *outputBddArray, int numFunctions)
+{
+  int i;
+  int numVars = Cal_BddVars(bddManager);
+  Cal_Bdd function;
+  Cal_Bdd variable;
+  Cal_Bdd substituteFunction;
+  Cal_Bdd result;
+  
+  
+  (void) elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    function = outputBddArray[CalUtilRandom()%numFunctions];
+    variable = Cal_BddManagerGetVarWithId(bddManager,(Cal_BddId_t)CalUtilRandom()%numVars+1);
+    substituteFunction = outputBddArray[CalUtilRandom()%numFunctions];
+    result = Cal_BddCompose(bddManager, function, variable,
+                                    substituteFunction);
+    Cal_BddFree(bddManager, result);
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "COMPOSE", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_BddManagerGC(bddManager);
+}
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestQuantifyAllTogether(Cal_BddManager bddManager, Cal_Bdd
+                                      *outputBddArray, int numFunctions,
+                                      int bfZeroBFPlusDFOne, int
+                                      cacheExistsResultsFlag, int
+                                      cacheOrResultsFlag)
+{
+  int i, j;
+  int numVars = Cal_BddVars(bddManager);
+  int numQuantifyVars = numVars/2;
+  int *varIdArray = Cal_MemAlloc(int, numQuantifyVars);
+  Cal_Bdd *assoc = Cal_MemAlloc(Cal_Bdd, numQuantifyVars+1);
+  Cal_Bdd function, result;
+  int assocId;
+  
+  for (i=0; i <= numQuantifyVars; i++){
+    assoc[i] = (Cal_Bdd) 0;
+  }
+  
+  (void) elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    function = outputBddArray[CalUtilRandom()%numFunctions];
+    GetRandomNumbers(1, numVars, numQuantifyVars, varIdArray);
+    for (j=0; j<numQuantifyVars; j++){
+      assoc[j] = Cal_BddManagerGetVarWithId(bddManager, varIdArray[j]);
+    }
+    assocId = Cal_AssociationInit(bddManager, assoc, 0);
+    Cal_AssociationSetCurrent(bddManager, assocId);
+    result = Cal_BddExists(bddManager, function);
+    Cal_BddFree(bddManager, result); 
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "QUANTIFY", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_MemFree(assoc);
+  Cal_MemFree(varIdArray);
+  Cal_BddManagerGC(bddManager);
+}
+
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalQuantifySanityCheck(Cal_BddManager bddManager, Cal_Bdd
+                       *outputBddArray, int numFunctions) 
+{
+  int i, j;
+  int numVars = Cal_BddVars(bddManager);
+  int numQuantifyVars = numVars/2;
+  int *varIdArray = Cal_MemAlloc(int, numQuantifyVars);
+  Cal_Bdd *assoc = Cal_MemAlloc(Cal_Bdd, numQuantifyVars+1);
+  Cal_Bdd function, oneAtATimeResult, allTogetherResult, tempResult, nonSuperscalarResult;
+  
+  
+  for (i=0; i <= numQuantifyVars; i++){
+    assoc[i] = (Cal_Bdd) 0;
+  }
+  
+  (void) elapsedTime();
+  for (i=0; i<ITERATION; i++){
+    function = outputBddArray[CalUtilRandom()%numFunctions];
+    GetRandomNumbers(1, numVars, numQuantifyVars, varIdArray);
+    for (j=0; j<numQuantifyVars; j++){
+      assoc[j] = Cal_BddManagerGetVarWithId(bddManager, varIdArray[j]);
+    }
+    Cal_TempAssociationInit(bddManager, assoc, 0);
+    Cal_AssociationSetCurrent(bddManager, -1);
+    allTogetherResult = Cal_BddExists(bddManager, function);
+
+    oneAtATimeResult = Cal_BddIdentity(bddManager, function);
+    qsort((void *) varIdArray, (size_t)numQuantifyVars, (size_t)sizeof(int),
+          CalDecreasingOrderCompare);
+    for (j=0; j<numQuantifyVars; j++){
+      assoc[0] =
+          Cal_BddManagerGetVarWithId(bddManager,varIdArray[j]); 
+      assoc[1] = (Cal_Bdd) 0;
+      Cal_TempAssociationAugment(bddManager, assoc, 0);
+      tempResult = Cal_BddExists(bddManager, oneAtATimeResult);
+      Cal_BddFree(bddManager, oneAtATimeResult);
+      oneAtATimeResult = tempResult;
+    }
+    
+    nonSuperscalarResult = Cal_BddExists(bddManager, function);
+    
+    assert(Cal_BddIsEqual(bddManager, allTogetherResult, oneAtATimeResult));
+    assert(Cal_BddIsEqual(bddManager, allTogetherResult, nonSuperscalarResult));
+    Cal_BddFree(bddManager, oneAtATimeResult); 
+    Cal_BddFree(bddManager, allTogetherResult); 
+    Cal_BddFree(bddManager, nonSuperscalarResult);
+  }
+  fprintf(stdout, "Quantify Sanity Check Passed\n");
+  Cal_MemFree(assoc);
+  Cal_MemFree(varIdArray);
+  Cal_TempAssociationQuit(bddManager);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestRelProd(Cal_BddManager bddManager, Cal_Bdd
+                          *outputBddArray, int numFunctions, int
+                          bfZeroBFPlusDFOne, int cacheRelProdResultsFlag, int 
+                          cacheAndResultsFlag, int cacheOrResultsFlag)
+{
+  int i, j;
+  int numVars = Cal_BddVars(bddManager);
+  int numQuantifyVars = numVars/2;
+  int *varIdArray = Cal_MemAlloc(int, numQuantifyVars);
+  Cal_Bdd *assoc = Cal_MemAlloc(Cal_Bdd, numQuantifyVars+1);
+  Cal_Bdd function1, function2, result;
+  int assocId;
+  
+  for (i=0; i <= numQuantifyVars; i++){
+    assoc[i] = (Cal_Bdd) 0;
+  }
+  
+  elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    function1 = outputBddArray[CalUtilRandom()%numFunctions];
+    function2 = outputBddArray[CalUtilRandom()%numFunctions]; 
+   GetRandomNumbers(1, numVars, numQuantifyVars,varIdArray);
+    for (j=0; j<numQuantifyVars; j++){
+      assoc[j] = Cal_BddManagerGetVarWithId(bddManager, varIdArray[j]);
+    }
+    assocId = Cal_AssociationInit(bddManager, assoc, 0);
+    Cal_AssociationSetCurrent(bddManager, assocId);
+    result = Cal_BddRelProd(bddManager, function1, function2);
+    Cal_BddFree(bddManager, result);
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "RELPROD", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_MemFree(assoc);
+  Cal_MemFree(varIdArray);
+  Cal_BddManagerGC(bddManager);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestSubstitute(Cal_BddManager bddManager, Cal_Bdd
+                             *outputBddArray, int numFunctions)
+{
+  int i, j;
+  int numVars = Cal_BddVars(bddManager);
+  int numQuantifyVars = ((numVars/2 > numFunctions/2) ? numFunctions/2
+                         : numVars/2);
+  int *varIdArray = Cal_MemAlloc(int, numQuantifyVars);
+  Cal_Bdd *assoc = Cal_MemAlloc(Cal_Bdd, 2*numQuantifyVars+1);
+  Cal_Bdd function, result;
+  
+  for (i=0; i <= 2*numQuantifyVars; i++){
+    assoc[i] = (Cal_Bdd) 0;
+  }
+  (void) elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION/5; i++){
+    function = outputBddArray[CalUtilRandom()%numFunctions];
+    GetRandomNumbers(1, numVars, numQuantifyVars,varIdArray);
+    for (j=0; j<numQuantifyVars; j++){
+      assoc[(j<<1)] = Cal_BddManagerGetVarWithId(bddManager,varIdArray[j]);
+    }
+    GetRandomNumbers(0, numFunctions-1, numQuantifyVars, varIdArray);
+    for (j=0; j<numQuantifyVars; j++){
+      assoc[(j<<1)+1] = outputBddArray[varIdArray[j]];
+    }
+    Cal_TempAssociationInit(bddManager, assoc, 1);
+    Cal_AssociationSetCurrent(bddManager, -1);
+    result = Cal_BddSubstitute(bddManager, function);
+    Cal_BddFree(bddManager, result);
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "SUBSTITUTE", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_MemFree(assoc);
+  Cal_MemFree(varIdArray);
+  Cal_TempAssociationQuit(bddManager);
+  Cal_BddManagerGC(bddManager);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Performance test routine for quantify (all variables at the same
+  time).]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalPerformanceTestSwapVars(Cal_BddManager bddManager, Cal_Bdd
+                           *outputBddArray, int numFunctions) 
+{
+  int i;
+  int numVars = Cal_BddVars(bddManager);
+  Cal_Bdd function, result;
+  Cal_Bdd var1, var2;
+  
+  elapsedTime();
+  cpuTime();
+  pageFaults();
+  for (i=0; i<ITERATION; i++){
+    function = outputBddArray[CalUtilRandom()%numFunctions];
+    var1 = Cal_BddManagerGetVarWithId(bddManager,(Cal_BddId_t)(CalUtilRandom()%numVars)+1);
+    var2 = Cal_BddManagerGetVarWithId(bddManager,(Cal_BddId_t)(CalUtilRandom()%numVars)+1);
+    result = Cal_BddSwapVars(bddManager, function, var1,var2);
+    Cal_BddFree(bddManager, result);
+  }
+  fprintf(stdout, "%-20s%-10ld%-8.2f%-10ld\n", "SWAPVARS", elapsedTime(),
+          cpuTime(), pageFaults());
+  Cal_BddManagerGC(bddManager);
+}
+/**Function********************************************************************
+
+  Synopsis    [Computes the time.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static long
+elapsedTime(void)
+{
+  static long time_new, time_old;
+  struct timeval t;
+  static int flag = 0;
+  
+  gettimeofday(&t, NULL);
+  if (flag == 0){
+    time_old = time_new = t.tv_sec;
+    flag = 1;
+  }
+  else {
+    time_old = time_new;
+    time_new =  t.tv_sec;
+  }
+  return time_new-time_old;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the number of page faults.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static double
+cpuTime(void)
+{
+#if HAVE_SYS_RESOURCE_H
+  static double timeNew, timeOld;
+  struct rusage rusage;
+  static int flag = 0;
+  
+  getrusage(RUSAGE_SELF, &rusage);
+  if (flag == 0){
+    timeOld = timeNew = rusage.ru_utime.tv_sec+
+        ((double)rusage.ru_utime.tv_usec)/1000000;
+    flag = 1;
+  }
+  else {
+    timeOld = timeNew;
+    timeNew = rusage.ru_utime.tv_sec+
+        ((float)rusage.ru_utime.tv_usec)/1000000;
+  }
+  return timeNew - timeOld;
+#else /* No sys/resource.h */
+  return 0;
+#endif
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the number of page faults.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static long
+pageFaults(void)
+{
+#if HAVE_SYS_RESOURCE_H
+  static long faultNew, faultOld;
+  struct rusage rusage;
+  static int flag = 0;
+  
+  getrusage(RUSAGE_SELF, &rusage);
+  if (flag == 0){
+    faultOld = faultNew = rusage.ru_majflt;
+    flag = 1;
+  }
+  else {
+    faultOld = faultNew;
+    faultNew = rusage.ru_majflt;
+  }
+  return faultNew - faultOld;
+#else /* Don't have sys/resource.h */
+  return 0;
+#endif
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Generates "count" many random numbers ranging between
+  "lowerBound" and "upperBound".]
+
+  Description [The restriction is that count <= upperBound-lowerBound+1. The
+  size of the resultVector should be >= count.]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+GetRandomNumbers(int lowerBound, int upperBound, int count, int *resultVector)
+{
+  int i,j, tempVector[2048], number;
+  int range = (upperBound - lowerBound + 1);
+
+  for (i=0; i<range; i++)  tempVector[i] = lowerBound+i;
+  for (i=0; i<count; i++){
+    number = (int)CalUtilRandom()% (range-i);
+    resultVector[i] = tempVector[number];
+    for (j=number; j < range-i; j++){
+      tempVector[j] = tempVector[j+1];
+    }
+  }
+  /*
+  fprintf(stdout,"%d\t%d\t%d\n", lowerBound, upperBound, count);
+  for (i=0; i<count; i++)  fprintf(stdout,"%d ", resultVector[i]);
+  fprintf(stdout, "\n");
+  */
+}
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calPipeline.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calPipeline.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calPipeline.c	(revision 6)
@@ -0,0 +1,497 @@
+/**CFile***********************************************************************
+
+  FileName    [calPipeline.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for creating and managing the pipelined BDD
+  operations.] 
+
+  Description [Eventually we would like to have this feature
+  transparent to the user.]
+
+  SeeAlso     [optional]
+
+  Author      [ Rajeev K. Ranjan   (rajeev@eecs.berkeley.edu)
+                Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+              ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calPipeline.c,v 1.1.1.3 1998/05/04 00:59:01 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Set depth of a BDD pipeline.]
+
+  Description [The "depth" determines the amount of dependency we
+  would allow in pipelined computation.]
+
+  SideEffects [None.]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cal_PipelineSetDepth(Cal_BddManager bddManager, int depth)
+{
+  int i, j;
+  if(depth > 6){
+    CalBddWarningMessage("PipelineDepth can not exceed 6\n");
+    CalBddWarningMessage("setting PipelineDepth to 6\n");
+    depth = 6;
+  }
+  if(bddManager->maxDepth < depth){
+    int oldMaxDepth = bddManager->maxDepth;
+    bddManager->depth = bddManager->maxDepth = depth;
+    bddManager->reqQue = Cal_MemRealloc(CalHashTable_t **, bddManager->reqQue,
+                                 bddManager->maxDepth);
+    for(i = oldMaxDepth; i < bddManager->maxDepth; i++){
+      bddManager->reqQue[i] = Cal_MemAlloc(CalHashTable_t *, bddManager->maxNumVars+1);
+      for(j = 0; j < bddManager->numVars+1; j++){
+        bddManager->reqQue[i][j] =
+            CalHashTableInit(bddManager, j);
+      }
+    }
+  }
+  else{
+    bddManager->depth = depth;
+  }  
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Initialize a BDD pipeline.]
+
+  Description [All the operations for this pipeline must be of the
+  same kind.]
+
+  SideEffects [None.]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Cal_PipelineInit(Cal_BddManager bddManager, Cal_BddOp_t bddOp)
+{
+  CalBddPostProcessing(bddManager);
+  if(bddManager->pipelineState != READY){
+    CalBddWarningMessage("Pipeline cannot be initialized");
+    return 0;
+  }
+  else{
+    bddManager->pipelineState = CREATE;
+    switch(bddOp){
+    case CAL_AND :
+      bddManager->pipelineFn = CalOpAnd;
+      break;
+    case CAL_OR  :
+      bddManager->pipelineFn = CalOpOr;
+      break;
+    case CAL_XOR :
+      bddManager->pipelineFn = CalOpXor;
+      break;
+    default  :
+      CalBddWarningMessage("Unknown Bdd Operation type");
+      return 0;
+    }
+    return 1;
+  }  
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Create a provisional BDD in the pipeline.]
+
+  Description [The provisional BDD is automatically freed once the
+  pipeline is quitted.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+Cal_Bdd
+Cal_PipelineCreateProvisionalBdd(Cal_BddManager bddManager, Cal_Bdd fUserBdd,
+                                 Cal_Bdd gUserBdd)
+{
+  int insertDepth, operandDepth;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t provisionalBdd, f, g;
+  Cal_BddId_t bddId;
+  Cal_Bdd userNode;
+  
+  insertDepth = 0;
+  
+  f = CalBddGetInternalBdd(bddManager, fUserBdd);
+  g = CalBddGetInternalBdd(bddManager, gUserBdd);
+  if(bddManager->pipelineState != CREATE){
+    CalBddWarningMessage("Provisional Bdd not created: Pipeline is not initialized");
+    return (Cal_Bdd) 0;
+  }
+  if(CalBddIsMarked(f)){
+    CalBddGetDepth(f, operandDepth);
+    if(insertDepth <= operandDepth){
+      insertDepth = operandDepth + 1;
+    }
+  }
+  if(CalBddIsMarked(g)){
+    CalBddGetDepth(g, operandDepth);
+    if(insertDepth <= operandDepth){
+      insertDepth = operandDepth + 1;
+    }
+  }
+  if (bddManager->pipelineDepth <= insertDepth){
+    bddManager->pipelineDepth = insertDepth + 1;
+  }
+  if (insertDepth >= MAX_INSERT_DEPTH){
+    CalBddWarningMessage("Provisional Bdd not created");
+    CalBddWarningMessage("Maximum pipeline depth is reached");
+    return (Cal_Bdd) 0;
+  }
+
+  CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], requestNode);
+  CalRequestNodePutF(requestNode, f);
+  CalRequestNodePutG(requestNode, g);
+  CalRequestNodeMark(requestNode);
+  CalRequestNodePutDepth(requestNode, insertDepth);
+  CalRequestNodePutNextRequestNode(requestNode,
+      bddManager->requestNodeListArray[insertDepth]);
+  bddManager->requestNodeListArray[insertDepth] = requestNode;
+
+  CalBddGetMinId2(bddManager, f, g, bddId);
+  CalBddPutBddId(provisionalBdd, bddId);
+  CalBddPutBddNode(provisionalBdd, (CalBddNode_t *)requestNode);
+
+  CalNodeManagerAllocNode(bddManager->nodeManagerArray[0], userNode);
+  CalBddNodePutThenBdd(userNode, provisionalBdd);
+  CalBddNodePutElseBdd(userNode, bddManager->bddOne);
+  CalBddNodePutNextBddNode(userNode,
+                           bddManager->userProvisionalNodeList);
+  bddManager->userProvisionalNodeList = userNode;
+  CalBddNodeIcrRefCount(userNode);
+  return userNode;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Executes a pipeline.]
+
+  Description [All the results are computed. User should update the
+  BDDs of interest. Eventually this feature would become transparent.]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+Cal_PipelineExecute(Cal_BddManager bddManager)
+{
+  CalRequestNode_t **requestNodeListArray, *node, *nextNode;
+  int  i;
+  Cal_Bdd_t thenBdd;
+  int automaticDepthControlFlag = 0;
+  int pipelineDepth;
+  
+  if(bddManager->pipelineState != CREATE){
+    CalBddWarningMessage("Pipeline cannot be executed");
+    return 0;
+  }
+
+  /* Check if we need to control the depth value using some heuristic */
+  if (bddManager->depth == 0) automaticDepthControlFlag = 1;
+  
+  requestNodeListArray = bddManager->requestNodeListArray;
+  pipelineDepth = bddManager->pipelineDepth;
+  while(pipelineDepth){
+    if (automaticDepthControlFlag){
+      if (bddManager->numNodes < 10000) bddManager->depth = 4;
+      else if (bddManager->numNodes < 100000) bddManager->depth = 2;
+      else bddManager->depth = 1;
+    }
+    if(bddManager->depth > pipelineDepth){
+      bddManager->depth = pipelineDepth;
+    }
+    CalRequestNodeListArrayOp(bddManager, requestNodeListArray,
+                              bddManager->pipelineFn);
+    pipelineDepth -= bddManager->depth;
+
+    /* Lock the results, in case garbage collection needs to be
+       invoked */
+    for (i=0; i<bddManager->depth; i++){
+      for (node = requestNodeListArray[i]; node; node = nextNode){
+        nextNode = CalBddNodeGetNextBddNode(node);
+        CalBddNodeGetThenBdd(node, thenBdd);
+        CalBddIcrRefCount(thenBdd);
+      }
+    }
+    /* Save the current pipelineDepth */
+    bddManager->currentPipelineDepth = pipelineDepth;
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      /* Abort, may be we should clean up a little bit */
+      fprintf(stderr,"Bdd Overflow: Aborting\n");
+      return 0;
+    }
+    requestNodeListArray += bddManager->depth;
+  }
+  /* Need to decrement the reference counts */
+  for (i=0; i<bddManager->pipelineDepth; i++){
+    for (node=bddManager->requestNodeListArray[i]; node; node = nextNode){
+      nextNode = CalBddNodeGetNextBddNode(node);
+      CalBddNodeGetThenBdd(node, thenBdd);
+      CalBddDcrRefCount(thenBdd);
+    }
+  }
+  bddManager->pipelineState = UPDATE;
+  return 1;
+}
+  
+/**Function********************************************************************
+
+  Synopsis    [Update a provisional Bdd obtained during pipelining.]
+
+  Description [The provisional BDD is automatically freed after
+  quitting pipeline.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+Cal_Bdd
+Cal_PipelineUpdateProvisionalBdd(Cal_BddManager bddManager,
+                                 Cal_Bdd provisionalBdd) 
+{
+  Cal_Bdd_t calBdd = CalBddGetInternalBdd(bddManager, provisionalBdd);
+  if(bddManager->pipelineState != UPDATE){
+    CalBddWarningMessage("Provisional Bdd cannot be updated");
+    return (Cal_Bdd) 0;
+  }
+  CalBddGetThenBdd(calBdd, calBdd);
+  return CalBddGetExternalBdd(bddManager, calBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Returns 1, if the given user BDD contains
+  provisional BDD node.]
+
+  Description        [Returns 1, if the given user BDD contains
+  provisional BDD node.]
+
+  SideEffects        [None.]
+
+  SeeAlso            []
+
+******************************************************************************/
+int
+Cal_BddIsProvisional(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t internalBdd = CalBddGetInternalBdd(bddManager, userBdd);
+  return CalBddIsMarked(internalBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Resets the pipeline freeing all resources.]
+
+  Description [The user must make sure to update all provisional BDDs
+  of interest before calling this routine.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cal_PipelineQuit(Cal_BddManager bddManager)
+{
+  CalRequestNode_t *requestNode, *next;
+  int i;
+
+  bddManager->pipelineState = READY;
+  for(i = 0; i < bddManager->pipelineDepth; i++){
+    for(requestNode = bddManager->requestNodeListArray[i], 
+        bddManager->requestNodeListArray[i] = Cal_Nil(CalRequestNode_t);
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      CalNodeManagerFreeNode(bddManager->nodeManagerArray[0], requestNode);
+    }
+    bddManager->requestNodeListArray[i] = Cal_Nil(CalRequestNode_t);
+  }
+  bddManager->pipelineDepth = 0;
+  for (requestNode = bddManager->userProvisionalNodeList; requestNode;
+       requestNode = next){
+    next = CalRequestNodeGetNextRequestNode(requestNode);
+    CalNodeManagerFreeNode(bddManager->nodeManagerArray[0],
+                           requestNode);
+  }
+  bddManager->userProvisionalNodeList = Cal_Nil(CalRequestNode_t);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddReorderFixProvisionalNodes(Cal_BddManager_t *bddManager)
+{
+  CalRequestNode_t **requestNodeListArray =
+      bddManager->requestNodeListArray;
+  CalRequestNode_t *node, *nextNode;
+  int i;
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  for (i=0;
+       i<bddManager->pipelineDepth-bddManager->currentPipelineDepth;
+       i++){ 
+    for (node = *requestNodeListArray; node; node = nextNode){
+      nextNode = CalBddNodeGetNextBddNode(node);
+      Cal_Assert(CalBddNodeIsForwarded(node));
+      CalBddNodeGetThenBdd(node, thenBdd);
+      if (CalBddIsForwarded(thenBdd)) {
+        CalBddForward(thenBdd);
+      }
+      CalBddNodePutThenBdd(node, thenBdd);
+      Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+    }
+    requestNodeListArray++;
+  }
+  for (; i<bddManager->pipelineDepth; i++){
+    for (node = *requestNodeListArray; node; node = nextNode){
+      nextNode = CalBddNodeGetNextBddNode(node);
+      Cal_Assert(CalBddNodeIsForwarded(node) == 0);
+      CalBddNodeGetThenBdd(node, thenBdd);
+      if (CalBddIsForwarded(thenBdd)) {
+        CalBddForward(thenBdd);
+      }
+      CalBddNodePutThenBdd(node, thenBdd);
+      Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+      CalBddNodeGetElseBdd(node, elseBdd);
+      if (CalBddIsForwarded(elseBdd)) {
+        CalBddForward(elseBdd);
+      }
+      CalBddNodePutElseBdd(node, elseBdd);
+      Cal_Assert(CalBddIsForwarded(elseBdd) == 0);
+    }
+    requestNodeListArray++;
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalCheckPipelineValidity(Cal_BddManager_t *bddManager)
+{
+  CalRequestNode_t **requestNodeListArray =
+      bddManager->requestNodeListArray;
+  CalRequestNode_t *node, *nextNode;
+  int i;
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  for (i=0;
+       i<bddManager->pipelineDepth-bddManager->currentPipelineDepth;
+       i++){ 
+    for (node = *requestNodeListArray; node; node = nextNode){
+      nextNode = CalBddNodeGetNextBddNode(node);
+      Cal_Assert(CalBddNodeIsForwarded(node));
+      CalBddNodeGetThenBdd(node, thenBdd);
+      Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+    }
+    requestNodeListArray++;
+  }
+  for (; i<bddManager->pipelineDepth; i++){
+    for (node = *requestNodeListArray; node; node = nextNode){
+      nextNode = CalBddNodeGetNextBddNode(node);
+      Cal_Assert(CalBddNodeIsForwarded(node) == 0); 
+      CalBddNodeGetThenBdd(node, thenBdd);
+      /*Cal_Assert(CalBddIsForwarded(thenBdd) == 0);*/
+      /* This is possible since the actual BDD of thenBdd could have been
+         computed and it is forwarded, however this node is not yet
+         updated with the result */
+      CalBddNodeGetElseBdd(node, elseBdd);
+      /*Cal_Assert(CalBddIsForwarded(elseBdd) == 0);*/
+    }
+    requestNodeListArray++;
+  }
+}
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/calBdd/calPrint.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calPrint.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calPrint.c	(revision 6)
@@ -0,0 +1,418 @@
+/**CFile***********************************************************************
+
+  FileName    [calPrint.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routine for printing a BDD.]
+
+  Description []
+
+  SeeAlso     [None]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)
+               Originally written by David Long.
+               ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calPrint.c,v 1.2 1998/09/16 16:40:41 ravi Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static char defaultTerminalId[]="terminal XXXXXXXXXX XXXXXXXXXX";
+static char defaultVarName[]="var.XXXXXXXXXX";
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void Chars(char c, int n, FILE *fp);
+static void BddPrintTopVar(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_VarNamingFn_t VarNamingFn, Cal_Pointer_t env, FILE *fp);
+static void BddPrintBddStep(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_VarNamingFn_t VarNamingFn, Cal_TerminalIdFn_t TerminalIdFn, Cal_Pointer_t env, FILE *fp, CalHashTable_t* hashTable, int indentation);
+static char * BddTerminalId(Cal_BddManager_t *bddManager, Cal_Bdd_t f, Cal_TerminalIdFn_t TerminalIdFn, Cal_Pointer_t env);
+static void BddTerminalValueAux(Cal_BddManager_t *bddManager, Cal_Bdd_t f, CalAddress_t *value1, CalAddress_t *value2);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Prints a BDD in the human readable form.]
+
+  Description [Prints a human-readable representation of the BDD f to
+  the file given by fp. The namingFn should be a pointer to a function
+  taking a bddManager, a BDD and the pointer given by env. This
+  function should return either a null pointer or a srting that is the
+  name of the supplied variable. If it returns a null pointer, a
+  default name is generated based on the index of the variable. It is
+  also legal for naminFN to e null; in this case, default names are
+  generated for all variables. The macro bddNamingFnNone is a null
+  pointer of suitable type. terminalIdFn should be apointer to a
+  function taking a bddManager and two longs. plus the pointer given
+  by the env. It should return either a null pointer. If it returns a
+  null pointer, or if terminalIdFn is null, then default names are
+  generated for the terminals. The macro bddTerminalIdFnNone is a null
+  pointer of suitable type.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+void
+Cal_BddPrintBdd(Cal_BddManager bddManager,
+                Cal_Bdd fUserBdd, Cal_VarNamingFn_t VarNamingFn,
+                Cal_TerminalIdFn_t TerminalIdFn,
+                Cal_Pointer_t env, FILE *fp)
+{
+  long next;
+  CalHashTable_t *hashTable;
+
+  Cal_Bdd_t f = CalBddGetInternalBdd(bddManager,fUserBdd);
+  CalBddMarkSharedNodes(bddManager, f);
+  hashTable = CalHashTableOneInit(bddManager, sizeof(long));
+  next = 0;
+  CalBddNumberSharedNodes(bddManager, f, hashTable, &next);
+  BddPrintBddStep(bddManager, f, VarNamingFn, TerminalIdFn, env, fp,
+                  hashTable, 0);
+  CalHashTableOneQuit(hashTable);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+char *
+CalBddVarName(Cal_BddManager_t *bddManager, Cal_Bdd_t v,
+           Cal_VarNamingFn_t VarNamingFn,  Cal_Pointer_t env)
+{
+  char *name;
+  if (VarNamingFn){
+    Cal_Bdd userV = CalBddGetExternalBdd(bddManager, v);
+    name = (*VarNamingFn)(bddManager, userV, env);
+    Cal_BddFree(bddManager, userV);
+  }
+ else
+   name=0;
+  if (!name){
+    sprintf(defaultVarName, "var.%d", CalBddGetBddIndex(bddManager, v));
+    name = defaultVarName;
+  }
+  return (name);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddNumberSharedNodes(Cal_BddManager_t *bddManager, Cal_Bdd_t f,
+                     CalHashTable_t *hashTable, long *next)
+{
+  Cal_Bdd_t thenBdd, elseBdd;
+  int mark;
+  
+  if (CalBddIsBddConst(f) || ((1 << CalBddTypeAux(bddManager, f)) &
+                           ((1 << CAL_BDD_TYPE_POSVAR) |
+                            (1 << CAL_BDD_TYPE_NEGVAR))))
+    return;
+  mark = CalBddGetMark(f);
+  if (mark == 0) return;
+  if (mark  == 2) {
+    CalHashTableOneInsert(hashTable, f, (char *)next);
+    ++*next;
+  }
+  CalBddPutMark(f, 0);
+  CalBddGetThenBdd(f, thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  CalBddNumberSharedNodes(bddManager, thenBdd, hashTable, next);
+  CalBddNumberSharedNodes(bddManager, elseBdd, hashTable, next);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddMarkSharedNodes(Cal_BddManager_t *bddManager, Cal_Bdd_t f)
+{
+  int mark;
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  if (CalBddIsOutPos(f) == 0){
+    CalBddNot(f,f);
+  }
+  if (CalBddIsBddConst(f) || CalBddTypeAux(bddManager, f) ==
+      CAL_BDD_TYPE_POSVAR)
+    return; 
+  if ((mark = CalBddGetMark(f))){
+    if (mark == 1){
+      CalBddPutMark(f, 2);
+      return;
+    }
+  }
+  CalBddPutMark(f, 1);
+  CalBddGetThenBdd(f, thenBdd);
+  CalBddGetElseBdd(f, elseBdd);
+  CalBddMarkSharedNodes(bddManager, thenBdd);
+  CalBddMarkSharedNodes(bddManager, elseBdd);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+Chars(char c, int n,FILE *fp)
+{
+  int i;
+  for (i=0; i < n; ++i){
+    fputc(c, fp);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddPrintTopVar(Cal_BddManager_t *bddManager, Cal_Bdd_t f,
+               Cal_VarNamingFn_t VarNamingFn, Cal_Pointer_t env, FILE *fp)
+{
+  Cal_Bdd_t ifVar;
+  ifVar = CalBddIf(bddManager, f);
+  fputs(CalBddVarName(bddManager, ifVar, VarNamingFn, env), fp);  
+  fputc('\n', fp);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/static void
+BddPrintBddStep(Cal_BddManager_t *bddManager,
+                Cal_Bdd_t f, Cal_VarNamingFn_t VarNamingFn,
+                Cal_TerminalIdFn_t TerminalIdFn,
+                Cal_Pointer_t env, FILE *fp, CalHashTable_t* hashTable,
+                int indentation)
+{
+  int negated;
+  long *number;
+  Cal_Bdd_t fNot, thenBdd, elseBdd;
+  
+  Chars(' ', indentation, fp);
+  switch (CalBddTypeAux(bddManager, f)){
+      case CAL_BDD_TYPE_ZERO:
+      case CAL_BDD_TYPE_ONE:
+        fputs(BddTerminalId(bddManager, f, TerminalIdFn, env), fp);
+        fputc('\n', fp);
+        break;
+      case CAL_BDD_TYPE_NEGVAR:
+        fputc('!', fp);
+        /* fall through */
+      case CAL_BDD_TYPE_POSVAR:
+        BddPrintTopVar(bddManager, f, VarNamingFn, env, fp);
+        break;
+      case CAL_BDD_TYPE_NONTERMINAL:
+        CalBddNot(f, fNot);
+        if (CalHashTableOneLookup(hashTable, fNot, Cal_Nil(char *))){
+          f = fNot;
+          negated = 1;
+        }
+        else {
+          negated=0;
+        }
+        CalHashTableOneLookup(hashTable, f, (char **)&number);
+        if (number && *number < 0){
+          if (negated)
+            fputc('!', fp);
+          fprintf(fp, "subformula %d\n", (int)-*number-1);
+        }
+      else {
+        if (number){
+	      fprintf(fp, "%d: ", (int) *number);
+	      *number= -*number-1;
+	    }
+        fputs("if ", fp);
+        BddPrintTopVar(bddManager, f, VarNamingFn, env, fp);
+        CalBddGetThenBdd(f, thenBdd);
+        BddPrintBddStep(bddManager, thenBdd, VarNamingFn,
+                        TerminalIdFn, env, fp, hashTable, indentation+2);
+        Chars(' ', indentation, fp);
+        fputs("else if !", fp);
+        BddPrintTopVar(bddManager, f, VarNamingFn, env, fp);
+        CalBddGetElseBdd(f, elseBdd);
+        BddPrintBddStep(bddManager, elseBdd, VarNamingFn,
+                        TerminalIdFn, env, fp, hashTable, indentation+2); 
+        Chars(' ', indentation, fp);
+        fputs("endif ", fp);
+        BddPrintTopVar(bddManager, f, VarNamingFn, env, fp);
+      }
+        break;
+      default:
+        CalBddFatalMessage("BddPrintBddStep: unknown type returned by Cal_BddType"); 
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static char *
+BddTerminalId(Cal_BddManager_t *bddManager, Cal_Bdd_t f,
+              Cal_TerminalIdFn_t TerminalIdFn, Cal_Pointer_t env)
+{
+  char *id;
+  CalAddress_t  v1, v2;
+  BddTerminalValueAux(bddManager, f, &v1, &v2);
+  if (TerminalIdFn) id = (*TerminalIdFn)(bddManager, v1, v2, env);
+  else id=0;
+  if (!id){
+    if (CalBddIsBddOne(bddManager, f)) return ("1");
+    if (CalBddIsBddZero(bddManager, f)) return ("0");
+    sprintf(defaultTerminalId, "terminal %ld %ld", (long)v1, (long)v2);
+    id = defaultTerminalId;
+  }
+  return (id);
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddTerminalValueAux(Cal_BddManager_t *bddManager, Cal_Bdd_t f,
+                    CalAddress_t *value1, CalAddress_t *value2)
+{
+  if (CalBddIsOutPos(f)){
+    *value1 = (CalAddress_t)CalBddGetThenBddNode(f);
+    *value2 = (CalAddress_t)CalBddGetElseBddNode(f);
+  }
+  else
+    (*bddManager->TransformFn)(bddManager,
+                               (CalAddress_t)CalBddGetThenBddNode(f),
+                               (CalAddress_t)CalBddGetElseBddNode(f),
+                                value1, value2, bddManager->transformEnv);  
+}
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calPrintProfile.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calPrintProfile.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calPrintProfile.c	(revision 6)
@@ -0,0 +1,334 @@
+/**CFile***********************************************************************
+
+  FileName    [calPrintProfile.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for printing various profiles for a BDD.]
+
+  Description [ ]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev Ranjan   (rajeev@eecs.berkeley.edu)
+               Originally written by David Long.
+              ] 
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calPrintProfile.c,v 1.1.1.3 1998/05/04 00:59:01 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+static char profileWidth[] = "XXXXXXXXX";
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void CalBddPrintProfileAux(Cal_BddManager_t * bddManager, long * levelCounts, Cal_VarNamingFn_t varNamingProc, char * env, int lineLength, FILE * fp);
+static void chars(char c, int n, FILE * fp);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Displays the node profile for f on fp. lineLength specifies 
+               the maximum line length.  varNamingFn is as in
+               Cal_BddPrintBdd.]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddPrintProfile(Cal_BddManager  bddManager,
+                    Cal_Bdd  fUserBdd,
+                    Cal_VarNamingFn_t varNamingProc,
+                    char * env,
+                    int  lineLength,
+                    FILE * fp)
+{
+  long *levelCounts;
+
+  if (CalBddPreProcessing(bddManager, 1, fUserBdd) == 0){
+	return;
+  }
+  levelCounts = Cal_MemAlloc(long, bddManager->numVars+1);
+  Cal_BddProfile(bddManager, fUserBdd, levelCounts, 1);
+  CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env,
+                        lineLength, fp); 
+  Cal_MemFree(levelCounts);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Cal_BddPrintProfileMultiple is like Cal_BddPrintProfile except
+               it displays the profile for a set of BDDs]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddPrintProfileMultiple(
+  Cal_BddManager bddManager,
+  Cal_Bdd *userBdds,
+  Cal_VarNamingFn_t varNamingProc,
+  char * env,
+  int  lineLength,
+  FILE * fp)
+{
+  long *levelCounts;
+
+  if (CalBddArrayPreProcessing(bddManager, userBdds) == 0){
+	return;
+  }
+  levelCounts = Cal_MemAlloc(long, bddManager->numVars+1);
+  Cal_BddProfileMultiple(bddManager, userBdds, levelCounts, 1);
+  CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env, lineLength, fp);
+  Cal_MemFree(levelCounts);
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Cal_BddPrintFunctionProfile is like Cal_BddPrintProfile except
+               it displays a function profile for f]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddPrintFunctionProfile(Cal_BddManager bddManager,
+                            Cal_Bdd  f,
+                            Cal_VarNamingFn_t varNamingProc,
+                            char * env,
+                            int  lineLength,
+                            FILE * fp)
+{
+  long *levelCounts;
+  if (CalBddPreProcessing(bddManager, 1, f)){
+	return;
+  }
+  levelCounts = Cal_MemAlloc(long, bddManager->numVars+1);
+  Cal_BddFunctionProfile(bddManager, f, levelCounts);
+  CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env,
+                        lineLength, fp); 
+  Cal_MemFree(levelCounts);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Cal_BddPrintFunctionProfileMultiple is like
+               Cal_BddPrintFunctionProfile except for multiple BDDs]
+
+  Description [optional]
+
+  SideEffects [None]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+Cal_BddPrintFunctionProfileMultiple(Cal_BddManager bddManager,
+                                    Cal_Bdd *userBdds,
+                                    Cal_VarNamingFn_t varNamingProc,
+                                    char * env,
+                                    int  lineLength,
+                                    FILE * fp)
+{
+  long *levelCounts;
+  if (CalBddArrayPreProcessing(bddManager, userBdds) == 0){
+	return;
+  }
+  levelCounts = Cal_MemAlloc(long, bddManager->numVars+1);
+  Cal_BddFunctionProfileMultiple(bddManager, userBdds, levelCounts);
+  CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env, lineLength, fp);
+  Cal_MemFree(levelCounts);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Prints a profile to the file given by fp.  The varNamingProc
+               is as in Cal_BddPrintBdd. lineLength gives the line width to scale
+               the profile to.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+CalBddPrintProfileAux(
+  Cal_BddManager_t * bddManager,
+  long * levelCounts,
+  Cal_VarNamingFn_t varNamingProc,
+  char * env,
+  int  lineLength,
+  FILE * fp)
+{
+  long i, n;
+  int l;
+  char *name;
+  int maxPrefixLen;
+  int maxProfileWidth;
+  int histogramColumn;
+  int histogramWidth;
+  int profileScale;
+  long total;
+
+  n = bddManager->numVars;
+  /* max_... initialized with values for leaf nodes */
+  maxPrefixLen = 5;
+  maxProfileWidth = levelCounts[n];
+  total = levelCounts[n];
+  for(i = 0; i < n; i++){
+    if(levelCounts[i]){
+      sprintf(profileWidth, "%ld", levelCounts[i]);
+      l = strlen(CalBddVarName(bddManager, 
+          bddManager->varBdds[bddManager->indexToId[i]],
+          varNamingProc, env)) + strlen((char *)profileWidth);
+      if(l > maxPrefixLen){
+        maxPrefixLen = l;
+      }
+      if(levelCounts[i] > maxProfileWidth){
+        maxProfileWidth = levelCounts[i];
+      }
+      total += levelCounts[i];
+    }
+  }
+  histogramColumn = maxPrefixLen+3;
+  histogramWidth = lineLength-histogramColumn-1;
+  if(histogramWidth < 20)
+    histogramWidth = 20;		/* Random minimum width */
+  if(histogramWidth >= maxProfileWidth){
+    profileScale = 1;
+  }
+  else{
+    profileScale = (maxProfileWidth+histogramWidth-1)/histogramWidth;
+  }
+  for(i = 0; i < n; ++i){
+    if(levelCounts[i]){
+      name = CalBddVarName(bddManager,
+          bddManager->varBdds[bddManager->indexToId[i]],
+          varNamingProc, env);
+      fputs(name, fp);
+      fputc(':', fp);
+      sprintf(profileWidth, "%ld", levelCounts[i]);
+      chars(' ', (int)(maxPrefixLen-strlen(name)-strlen(profileWidth)+1), fp);
+      fputs(profileWidth, fp);
+      fputc(' ', fp);
+      chars('#', levelCounts[i]/profileScale, fp);
+      fputc('\n', fp);
+    }
+  }
+  fputs("leaf:", fp);
+  sprintf(profileWidth, "%ld", levelCounts[n]);
+  chars(' ', (int)(maxPrefixLen-4-strlen(profileWidth)+1), fp);
+  fputs(profileWidth, fp);
+  fputc(' ', fp);
+  chars('#', levelCounts[n]/profileScale, fp);
+  fputc('\n', fp);
+  fprintf(fp, "Total: %ld\n", total);
+}
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+chars(
+  char  c,
+  int  n,
+  FILE * fp)
+{
+  int i;
+
+  for(i = 0; i < n; ++i){
+    fputc(c, fp);
+  }
+}
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calQuant.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calQuant.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calQuant.c	(revision 6)
@@ -0,0 +1,1492 @@
+/**CFile***********************************************************************
+
+  FileName    [calQuant.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for existential/universal quantification and
+  relational product.]
+
+  Description []
+
+  SeeAlso     [None]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu)]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calQuant.c,v 1.1.1.4 1998/05/04 00:59:02 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#define DEFAULT_EXIST_HASH_TABLE_SIZE_INDEX 4
+#define DEFAULT_EXIST_HASH_TABLE_SIZE 16
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static Cal_Bdd_t BddExistsStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, unsigned short opCode, CalAssociation_t *association);
+static Cal_Bdd_t BddRelProdStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t g, unsigned short opCode, CalAssociation_t *assoc);
+static Cal_Bdd_t BddDFStep(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t g, CalOpProc_t calOpProc, unsigned short opCode);
+static void HashTableApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t ** reqQueAtPipeDepth, CalOpProc_t calOpProc, unsigned long opCode);
+static void HashTableReduce(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t * uniqueTableForId);
+static void BddExistsApply(Cal_BddManager_t *bddManager, int quantifying, CalHashTable_t *existHashTable, CalHashTable_t **existHashTableArray, CalOpProc1_t calOpProc, unsigned short opCode, CalAssociation_t *assoc);
+static void BddExistsBFAux(Cal_BddManager_t *bddManager, int minIndex, CalHashTable_t **existHashTableArray, CalHashTable_t **orHashTableArray, CalOpProc1_t calOpProc, unsigned short opCode, CalAssociation_t *assoc);
+static void BddExistsReduce(Cal_BddManager_t *bddManager, CalHashTable_t *existHashTable, CalHashTable_t **existHashTableArray, CalHashTable_t **orHashTableArray, unsigned short opCode, CalAssociation_t *association);
+static Cal_Bdd_t BddExistsBFPlusDF(Cal_BddManager_t *bddManager, Cal_Bdd_t f, unsigned short opCode, CalAssociation_t *association);
+static void BddRelProdApply(Cal_BddManager_t *bddManager, int quantifying, CalHashTable_t *relProdHashTable, CalHashTable_t **relProdHashTableArray, CalHashTable_t **andHashTableArray, CalOpProc_t calOpProc, unsigned short opCode, CalAssociation_t *assoc);
+static void BddRelProdReduce(Cal_BddManager_t *bddManager, CalHashTable_t *relProdHashTable, CalHashTable_t **relProdHashTableArray, CalHashTable_t **andHashTableArray, CalHashTable_t **orHashTableArray, unsigned short opCode, CalAssociation_t *assoc);
+static void BddRelProdBFAux(Cal_BddManager_t *bddManager, int minIndex, CalHashTable_t **relProdHashTableArray, CalHashTable_t **andHashTableArray, CalHashTable_t **orHashTableArray, unsigned short opCode, CalAssociation_t *assoc);
+static Cal_Bdd_t BddRelProdBFPlusDF(Cal_BddManager_t * bddManager, Cal_Bdd_t f, Cal_Bdd_t g, unsigned short opCode, CalAssociation_t *association);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns the result of existentially quantifying some
+  variables from the given BDD.]
+
+  Description [Returns the BDD for f with all the variables that are
+  paired with something in the current variable association
+  existentially quantified out.]
+
+  SideEffects [None.]
+
+  SeeAlso     [Cal_BddRelProd]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddExists(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+
+  if (CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    CalAssociation_t *assoc = bddManager->currentAssociation;
+    unsigned short opCode;
+    
+    if (assoc->id == -1){
+      opCode = bddManager->tempOpCode--;
+    }
+    else {
+      opCode = CAL_OP_QUANT + assoc->id;
+    }
+    if (bddManager->numNodes <= CAL_LARGE_BDD){
+      /* If number of nodes is small, call depth first routine. */
+      result = BddExistsStep(bddManager, f, opCode, assoc);
+    }
+    else {
+      result = BddExistsBFPlusDF(bddManager, f, opCode, assoc);
+    }
+    userResult =  CalBddGetExternalBdd(bddManager, result);
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, userResult);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    return userResult;
+  }
+  return (Cal_Bdd) 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the result of taking the logical AND of the
+  argument BDDs and existentially quantifying some variables from the
+  product.] 
+
+  Description [Returns the BDD for the logical AND of f and g with all
+  the variables that are paired with something in the current variable
+  association existentially quantified out.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddRelProd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, gUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    Cal_Bdd_t g = CalBddGetInternalBdd(bddManager, gUserBdd);
+    CalAssociation_t *assoc = bddManager->currentAssociation;
+    unsigned short opCode;
+    
+    if (bddManager->currentAssociation->id == -1){
+      opCode = bddManager->tempOpCode--;
+      bddManager->tempOpCode--;
+    }
+    else {
+      opCode = CAL_OP_REL_PROD + assoc->id;
+    }
+    if (bddManager->numNodes <= CAL_LARGE_BDD){
+      /* If number of nodes is small, call depth first routine. */
+      result = BddRelProdStep(bddManager, f, g, opCode, assoc);
+    }
+    else {
+      result = BddRelProdBFPlusDF(bddManager, f, g, opCode, assoc);
+    }
+    userResult =  CalBddGetExternalBdd(bddManager, result);
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, userResult);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    return userResult;
+  }
+  return (Cal_Bdd) 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the result of universally quantifying some
+  variables from the given BDD.]
+
+  Description [Returns the BDD for f with all the variables that are
+  paired with something in the current variable association
+  universally quantified out.]
+
+  SideEffects [None.]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddForAll(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+
+  if (CalBddPreProcessing(bddManager, 1, fUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    CalAssociation_t *assoc = bddManager->currentAssociation;
+    unsigned short opCode;
+
+    CalBddNot(f, f);
+    if (assoc->id == -1){
+      opCode = bddManager->tempOpCode--;
+    }
+    else {
+      opCode = CAL_OP_QUANT + assoc->id;
+    }
+    if (bddManager->numNodes <= CAL_LARGE_BDD){
+      /* If number of nodes is small, call depth first routine. */
+      result = BddExistsStep(bddManager, f, opCode, assoc);
+    }
+    else {
+      result = BddExistsBFPlusDF(bddManager, f, opCode, assoc);
+    }
+    CalBddNot(result, result);
+    userResult =  CalBddGetExternalBdd(bddManager, result);
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, userResult);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    return userResult;
+  }
+  return (Cal_Bdd) 0;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+  
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpExists(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, Cal_Bdd_t *
+            resultBddPtr) 
+{
+  if (((int)bddManager->idToIndex[CalBddGetBddId(f)]) >
+      bddManager->currentAssociation->lastBddIndex){ 
+    *resultBddPtr = f;
+    return 1;
+  }
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpRelProd(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, Cal_Bdd_t  g,
+             Cal_Bdd_t * resultBddPtr) 
+{
+  if (CalBddIsBddZero(bddManager, f) || CalBddIsBddZero(bddManager, g) ||
+      CalBddIsComplementEqual(f, g)){
+    *resultBddPtr = bddManager->bddZero;
+    return 1;
+  }
+  else if (CalBddIsBddOne(bddManager, f) && CalBddIsBddOne(bddManager, g)){
+    *resultBddPtr = bddManager->bddOne;
+    return 1;
+  }
+  return 0;
+}
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddExistsStep(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, unsigned
+              short opCode, CalAssociation_t *association)
+{
+  Cal_Bdd_t temp1, temp2;
+  Cal_Bdd_t f1, f2;
+  Cal_Bdd_t result;
+  Cal_BddId_t topId;
+  int quantifying;
+  
+  if (((int)CalBddGetBddIndex(bddManager, f)) > association->lastBddIndex){
+    return f;
+  }
+  if (CalCacheTableOneLookup(bddManager, f, opCode, &result)){
+    return result;
+  }
+
+  topId = CalBddGetBddId(f);
+  quantifying = (CalBddIsBddNull(bddManager,
+                                 association->varAssociation[topId]) ? 0 : 1);
+  CalBddGetCofactors(f, topId, f1, f2);
+  temp1 = BddExistsStep(bddManager, f1, opCode, association);
+  if (quantifying && CalBddIsEqual(temp1, bddManager->bddOne)){
+    result=temp1;
+  }
+  else {
+    temp2 = BddExistsStep(bddManager, f2, opCode, association);
+    if (quantifying){
+      CalBddNot(temp1, temp1);
+      CalBddNot(temp2, temp2);
+	  result = BddDFStep(bddManager, temp1, temp2, CalOpNand, CAL_OP_NAND);
+	}
+    else {
+      Cal_BddId_t id = CalBddGetBddId(f);
+      if (CalUniqueTableForIdFindOrAdd(bddManager, bddManager->uniqueTable[id],
+                                       temp1, temp2, &result) == 0){
+        CalBddIcrRefCount(temp1);
+        CalBddIcrRefCount(temp2);
+      }
+    }
+  } 
+  CalCacheTableOneInsert(bddManager, f, result, opCode, 0);
+  return (result);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddRelProdStep(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, Cal_Bdd_t
+               g, unsigned short opCode, CalAssociation_t *assoc)
+{
+  Cal_BddId_t topId;
+  Cal_Bdd_t f1, f2, g1, g2;
+  Cal_Bdd_t temp1, temp2;
+  Cal_Bdd_t  result;
+  int quantifying;
+
+  if (CalBddIsBddConst(f) || CalBddIsBddConst(g)){
+    if (CalBddIsBddZero(bddManager, f) || CalBddIsBddZero(bddManager, g)){
+      return bddManager->bddZero;
+    }
+    if (assoc->id != -1){
+      opCode = CAL_OP_QUANT+assoc->id;
+    }
+    else{
+      opCode--;
+    }
+    if (CalBddIsBddOne(bddManager, f)){
+      return (BddExistsStep(bddManager, g, opCode, assoc));
+    }
+    return (BddExistsStep(bddManager, f, opCode, assoc));
+  }
+  if ((((int)CalBddGetBddIndex(bddManager, f)) > assoc->lastBddIndex) &&
+      (((int)CalBddGetBddIndex(bddManager, g)) > assoc->lastBddIndex)){
+    result = BddDFStep(bddManager, f, g, CalOpNand, CAL_OP_NAND);
+    CalBddNot(result, result);
+    return result;
+  }
+  if(CalOpRelProd(bddManager, f, g, &result) == 1){
+    return result;
+  }
+  CalBddNormalize(f, g);
+  if(CalCacheTableTwoLookup(bddManager, f, g, opCode, &result)){
+    return result;
+  }
+  CalBddGetMinId2(bddManager, f, g, topId);
+  
+  quantifying = (CalBddIsBddNull(bddManager, assoc->varAssociation[topId]) ? 0
+                 : 1);
+  CalBddGetCofactors(f, topId, f1, f2);
+  CalBddGetCofactors(g, topId, g1, g2);
+
+  temp1 = BddRelProdStep(bddManager, f1, g1, opCode, assoc);
+  if (quantifying && CalBddIsBddOne(bddManager, temp1)){
+    result=temp1;
+  }
+  else {
+    temp2 = BddRelProdStep(bddManager, f2, g2, opCode, assoc);
+    if (quantifying) {
+      CalBddNot(temp1, temp1);
+      CalBddNot(temp2, temp2);
+	  result = BddDFStep(bddManager, temp1, temp2, CalOpNand, CAL_OP_NAND);
+	  /*result = BddDFStep(bddManager, temp1, temp2, CalOpOr, CAL_OP_OR);*/
+	}
+    else {
+      if (CalUniqueTableForIdFindOrAdd(bddManager,
+                                       bddManager->uniqueTable[topId],
+                                       temp1, temp2, &result) == 0){
+        CalBddIcrRefCount(temp1);
+        CalBddIcrRefCount(temp2);
+      }
+    }
+  }
+  CalCacheTableTwoInsert(bddManager, f, g, result, opCode, 0);
+  return (result);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddDFStep(Cal_BddManager_t * bddManager, Cal_Bdd_t  f, Cal_Bdd_t g,
+          CalOpProc_t calOpProc, unsigned short opCode)
+{
+  Cal_BddId_t topId;
+  Cal_Bdd_t temp1, temp2, fx, fxbar, gx, gxbar;
+  Cal_Bdd_t  result;
+
+  if((*calOpProc)(bddManager, f, g, &result) == 1){
+    return result;
+  }
+  CalBddNormalize(f, g);
+  if(CalCacheTableTwoLookup(bddManager, f, g, opCode, &result)){
+    return result;
+  }
+  CalBddGetMinId2(bddManager, f, g, topId);
+  CalBddGetCofactors(f, topId, fx, fxbar);
+  CalBddGetCofactors(g, topId, gx, gxbar);
+  temp1 = BddDFStep(bddManager, fx, gx, calOpProc, opCode);
+  temp2 = BddDFStep(bddManager, fxbar, gxbar, calOpProc, opCode);
+
+  if (CalUniqueTableForIdFindOrAdd(bddManager,
+                                   bddManager->uniqueTable[topId],
+                                   temp1, temp2, &result) == 0){
+    CalBddIcrRefCount(temp1);
+    CalBddIcrRefCount(temp2);
+  }
+  CalCacheTableTwoInsert(bddManager, f, g, result, opCode, 0);
+  return (result);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable,
+               CalHashTable_t ** reqQueAtPipeDepth, CalOpProc_t calOpProc,
+               unsigned long opCode)  
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t fx, gx, fxbar, gxbar, result;
+  Cal_BddId_t bddId;
+  
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetCofactors(bddManager, requestNode, fx, fxbar, gx, gxbar);
+      CalBddNormalize(fx, gx);
+      if((*calOpProc)(bddManager, fx, gx, &result) == 0){
+        if (CalCacheTableTwoLookup(bddManager, fx, gx, opCode, &result) == 0){
+          CalBddGetMinId2(bddManager, fx, gx, bddId);
+          CalHashTableFindOrAdd(reqQueAtPipeDepth[bddId], fx, gx, &result);
+          CalCacheTableTwoInsert(bddManager, fx, gx, result, opCode, 1);
+        }
+        else {
+          CalRequestIsForwardedTo(result);
+        }
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutThenRequest(requestNode, result);
+      CalBddNormalize(fxbar, gxbar);
+      if((*calOpProc)(bddManager, fxbar, gxbar, &result) == 0){
+        if (CalCacheTableTwoLookup(bddManager, fxbar, gxbar, opCode, &result)
+            == 0){ 
+          CalBddGetMinId2(bddManager, fxbar, gxbar, bddId);
+          CalHashTableFindOrAdd(reqQueAtPipeDepth[bddId], fxbar, gxbar,
+                                &result); 
+          CalCacheTableTwoInsert(bddManager, fxbar, gxbar, result,
+                                 opCode, 1);
+        }
+        else {
+          CalRequestIsForwardedTo(result);
+        }
+      }
+      CalBddIcrRefCount(result);
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableReduce(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable,
+                CalHashTable_t * uniqueTableForId)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  Cal_BddId_t currentBddId = uniqueTableForId->bddId;
+  CalNodeManager_t *nodeManager = uniqueTableForId->nodeManager;
+  CalRequestNode_t *requestNode, *next;
+  CalBddNode_t *bddNode, *endNode;
+  Cal_Bdd_t thenBdd, elseBdd, result;
+  Cal_BddRefCount_t refCount;
+
+  /*requestNodeList = hashTable->requestNodeList;*/
+  endNode = hashTable->endNode;
+  hashTable->numEntries = 0;
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      /* Process the requestNode */
+      CalRequestNodeGetThenRequest(requestNode, thenBdd);
+      CalRequestNodeGetElseRequest(requestNode, elseBdd);
+      CalRequestIsForwardedTo(thenBdd);
+      CalRequestIsForwardedTo(elseBdd);
+      if(CalBddIsEqual(thenBdd, elseBdd)){
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(thenBdd, refCount - 2);
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        /*
+        ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        ** requestNodeList = requestNode;
+        */
+        /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+      else if(CalUniqueTableForIdLookup(bddManager, uniqueTableForId,
+          thenBdd, elseBdd, &result) == 1){
+        CalBddDcrRefCount(thenBdd);
+        CalBddDcrRefCount(elseBdd);
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(result, refCount);
+        CalRequestNodePutThenRequest(requestNode, result);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        /*
+        ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        ** requestNodeList = requestNode;
+        */
+        /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+      else if(CalBddIsOutPos(thenBdd)){
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequest(requestNode, elseBdd);
+        CalHashTableAddDirect(uniqueTableForId, requestNode);
+        bddManager->numNodes++;
+        bddManager->gcCheck--;
+      }
+      else{
+        CalNodeManagerAllocNode(nodeManager, bddNode);
+        CalBddNodePutThenBddId(bddNode, CalBddGetBddId(thenBdd));
+        CalBddNodePutThenBddNode(bddNode, CalBddGetBddNodeNot(thenBdd));
+        CalBddNodePutElseBddId(bddNode, CalBddGetBddId(elseBdd));
+        CalBddNodePutElseBddNode(bddNode, CalBddGetBddNodeNot(elseBdd));
+        /*
+        CalNodeManagerInitBddNode(nodeManager, thenBdd, elseBdd,
+                               Cal_Nil(CalBddNode_t), bddNode); 
+                               */
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddNodePutRefCount(bddNode, refCount);
+        CalHashTableAddDirect(uniqueTableForId, bddNode);
+        bddManager->numNodes++;
+        bddManager->gcCheck--;
+        CalRequestNodePutThenRequestId(requestNode, currentBddId);
+        CalRequestNodePutThenRequestNode(requestNode, CalBddNodeNot(bddNode));
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        /*
+        ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        ** requestNodeList = requestNode;
+        */
+        /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+    }
+  }
+  /* hashTable->requestNodeList = requestNodeList; */
+  hashTable->endNode = endNode;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddExistsApply(Cal_BddManager_t *bddManager, int quantifying,
+               CalHashTable_t *existHashTable, CalHashTable_t
+               **existHashTableArray,  CalOpProc1_t calOpProc, 
+               unsigned short opCode, CalAssociation_t *assoc)  
+{
+  int i, numBins = existHashTable->numBins;
+  CalBddNode_t **bins = existHashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t f, fx, fxbar, result, resultBar;
+  int lastBddIndex = assoc->lastBddIndex; 
+  
+  if (quantifying){
+    for(i = 0; i < numBins; i++){
+      for(requestNode = bins[i];
+          requestNode != Cal_Nil(CalRequestNode_t);
+          requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+        CalRequestNodeGetF(requestNode, f);
+        CalBddGetThenBdd(f, fx);
+        CalBddGetElseBdd(f, fxbar);
+      
+        /*if(calOpProc(bddManager, fx, &result) == 0){*/
+        if (((int)bddManager->idToIndex[CalBddGetBddId(fx)]) <= lastBddIndex){
+          if (CalCacheTableOneLookup(bddManager, fx, opCode, &result)){ 
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(existHashTableArray[CalBddGetBddId(fx)], fx,
+                                  bddManager->bddOne, &result);
+            CalCacheTableOneInsert(bddManager, fx, result,
+                                   opCode, 1);
+          }
+        }
+        else {
+          result = fx;
+        }
+        CalRequestNodePutThenRequest(requestNode, result);
+        CalRequestNodePutElseRequest(requestNode, fxbar);
+      }
+    }
+  }
+  else {
+    for(i = 0; i < numBins; i++){
+      for(requestNode = bins[i];
+          requestNode != Cal_Nil(CalRequestNode_t);
+          requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+        CalRequestNodeGetF(requestNode, f);
+        CalBddGetThenBdd(f, fx);
+        CalBddGetElseBdd(f, fxbar);
+      
+        if (((int)bddManager->idToIndex[CalBddGetBddId(fx)]) <= lastBddIndex){
+          if (CalCacheTableOneLookup(bddManager, fx, opCode, &result)){ 
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(existHashTableArray[CalBddGetBddId(fx)], fx,
+                                  bddManager->bddOne, &result);
+            CalCacheTableOneInsert(bddManager, fx, result,
+                                   opCode, 1);
+          }
+        }
+        else {
+          result = fx;
+        }
+        CalRequestNodePutThenRequest(requestNode, result);
+        CalBddIcrRefCount(result);
+        /*if(calOpProc(bddManager, fxbar, &resultBar) == 0){*/
+        if (((int)bddManager->idToIndex[CalBddGetBddId(fxbar)]) <= lastBddIndex){
+          if (CalCacheTableOneLookup(bddManager, fxbar, opCode,
+                                       &resultBar)){
+            CalRequestIsForwardedTo(resultBar);
+          }
+          else {
+            CalHashTableFindOrAdd(existHashTableArray[CalBddGetBddId(fxbar)], fxbar,
+                                  bddManager->bddOne, &resultBar);
+            CalCacheTableOneInsert(bddManager, fxbar, resultBar,
+                                   opCode, 1); 
+          }
+        }
+        else{
+          resultBar = fxbar;
+        }
+        CalBddIcrRefCount(resultBar);
+        CalRequestNodePutElseRequest(requestNode, resultBar);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void  
+BddExistsBFAux(Cal_BddManager_t *bddManager, int minIndex,
+               CalHashTable_t **existHashTableArray, CalHashTable_t
+               **orHashTableArray,  CalOpProc1_t calOpProc, unsigned
+               short opCode, CalAssociation_t *assoc)   
+{
+  int index;
+  Cal_BddId_t bddId;
+  int quantifying;
+  
+  /* Apply phase */
+  for (index = minIndex; index < bddManager->numVars; index++){
+    bddId = bddManager->indexToId[index];
+    if (existHashTableArray[bddId]->numEntries){
+      quantifying = (CalBddIsBddNull(bddManager,
+                                     assoc->varAssociation[bddId]) ? 0 : 1); 
+      BddExistsApply(bddManager, quantifying,
+                     existHashTableArray[bddId], existHashTableArray,
+                     calOpProc, opCode, assoc);    
+    }
+  }
+  
+  /* Reduce phase */
+  for (index = bddManager->numVars-1; index >= minIndex; index--){
+    bddId = bddManager->indexToId[index];
+    if (existHashTableArray[bddId]->numEntries){
+      quantifying = (CalBddIsBddNull(bddManager,
+                                     assoc->varAssociation[bddId]) ? 0 : 1); 
+      if (quantifying){
+        BddExistsReduce(bddManager, existHashTableArray[bddId],
+                        existHashTableArray, orHashTableArray,
+                        opCode, assoc);
+      } 
+      else {
+        HashTableReduce(bddManager, existHashTableArray[bddId],
+                        bddManager->uniqueTable[bddId]);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddExistsReduce(Cal_BddManager_t *bddManager, CalHashTable_t
+                *existHashTable, CalHashTable_t **existHashTableArray,
+                CalHashTable_t **orHashTableArray, unsigned short
+                opCode, CalAssociation_t *association) 
+{
+  int i, numBins = existHashTable->numBins;
+  CalBddNode_t **bins = existHashTable->bins;
+  CalRequestNode_t *requestNode, *next, *requestNodeListAux;
+  CalBddNode_t *endNode;
+  
+  int bddIndex;
+  /*Cal_BddIndex_t minIndex, elseIndex;*/
+  int minIndex, elseIndex;
+  Cal_BddId_t bddId, minId;
+  Cal_Bdd_t thenBdd, elseBdd, result, orResult;
+  Cal_BddRefCount_t refCount;
+  int lastBddIndex = association->lastBddIndex; 
+  
+
+  /* For those nodes which get processed in the first pass */
+  /* requestNodeList = existHashTable->requestNodeList; */
+  endNode = existHashTable->endNode;
+
+  /* For the other ones. This list is merged with the requestNodeList
+   * after processing is complete.
+   */
+  requestNodeListAux = Cal_Nil(CalRequestNode_t);
+  existHashTable->numEntries = 0;
+  
+  minIndex = bddManager->numVars;
+  
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      /* Process the requestNode */
+      CalRequestNodeGetThenRequest(requestNode, thenBdd);
+      CalRequestNodeGetElseRequest(requestNode, elseBdd);
+      CalRequestIsForwardedTo(thenBdd);
+      CalRequestNodePutThenRequest(requestNode, thenBdd);
+      if (CalBddIsBddOne(bddManager, thenBdd)){
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        /*
+        ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        ** requestNodeList = requestNode;
+        */
+        /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+        continue;
+      }
+      
+      CalRequestNodePutNextRequestNode(requestNode, requestNodeListAux);
+      requestNodeListAux = requestNode;
+
+      /*if(CalOpExists(bddManager, elseBdd, &result) == 0){*/
+      if (((int)bddManager->idToIndex[CalBddGetBddId(elseBdd)]) <= lastBddIndex){
+        if (CalCacheTableOneLookup(bddManager, elseBdd, opCode,
+                                   &result)){  
+          CalRequestIsForwardedTo(result);
+        }
+        else{
+          CalHashTableFindOrAdd(existHashTableArray[CalBddGetBddId(elseBdd)], elseBdd,
+                                bddManager->bddOne, &result);
+          CalCacheTableOneInsert(bddManager, elseBdd, result,
+                                 opCode, 1);
+          if (minIndex > (elseIndex = CalBddGetBddIndex(bddManager,
+                                                        elseBdd))){ 
+            minIndex = elseIndex;
+          }
+        }
+      }
+      else{
+        result = elseBdd;
+      }
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+  
+  if (!requestNodeListAux){
+    /* requestNodeList = requestNodeList; */
+    existHashTable->endNode = endNode;
+    return;
+  }
+  
+  BddExistsBFAux(bddManager, minIndex, existHashTableArray,
+                 orHashTableArray,  CalOpExists, opCode, association); 
+  minIndex = bddManager->numVars;
+  for (requestNode = requestNodeListAux; requestNode; requestNode = next){
+    Cal_Bdd_t thenResult, elseResult;
+    Cal_BddIndex_t orResultIndex;
+    
+    next = CalRequestNodeGetNextRequestNode(requestNode);
+    CalRequestNodeGetThenRequest(requestNode, thenResult);
+    CalRequestNodeGetElseRequest(requestNode, elseResult);
+    CalRequestIsForwardedTo(elseResult);
+    if (CalOpOr(bddManager, thenResult, elseResult, &orResult) == 0){
+      CalBddNormalize(thenResult, elseResult);
+      CalBddNot(thenResult, thenResult);
+      CalBddNot(elseResult, elseResult);
+      if (CalCacheTableTwoLookup(bddManager, thenResult,elseResult,
+                                 CAL_OP_NAND, &orResult)){
+        CalRequestIsForwardedTo(orResult);
+      }
+      else {
+        CalBddGetMinIdAndMinIndex(bddManager, thenResult, elseResult,
+                                  minId, orResultIndex);
+        CalHashTableFindOrAdd(orHashTableArray[minId], thenResult, elseResult,
+                              &orResult);
+        CalCacheTableTwoInsert(bddManager, thenResult, elseResult, orResult,
+                               CAL_OP_NAND, 1);
+        if (minIndex > orResultIndex) minIndex = orResultIndex;
+      }
+    }
+    CalRequestNodePutThenRequest(requestNode, orResult);
+  }
+  
+
+  /* Call "OR" apply and reduce */
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    if(orHashTableArray[bddId]->numEntries){
+      HashTableApply(bddManager, orHashTableArray[bddId], orHashTableArray,
+                     CalOpNand, CAL_OP_NAND);
+    }
+  }
+  
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    CalHashTable_t *uniqueTableForId;
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    if(orHashTableArray[bddId]->numEntries){
+      HashTableReduce(bddManager, orHashTableArray[bddId], uniqueTableForId);
+    }
+  }
+  
+  for (requestNode = requestNodeListAux; requestNode; requestNode = next){
+    next = CalRequestNodeGetNextRequestNode(requestNode);
+    CalRequestNodeGetThenRequest(requestNode, result);
+    CalRequestIsForwardedTo(result);
+    CalBddNodeGetRefCount(requestNode, refCount);
+    CalBddAddRefCount(result, refCount);
+    CalRequestNodePutThenRequest(requestNode, result);
+    CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+    /*
+    ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+    ** requestNodeList = requestNode;
+    */
+    /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+    endNode->nextBddNode = requestNode;
+    endNode = requestNode;
+  }
+  /*existHashTable->requestNodeList = requestNodeList;*/
+  existHashTable->endNode = endNode;
+  
+}
+  
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddExistsBFPlusDF(Cal_BddManager_t *bddManager, Cal_Bdd_t f, unsigned
+                  short opCode, CalAssociation_t *association)
+{
+  Cal_BddId_t fId = CalBddGetBddId(f);
+  Cal_BddIndex_t bddIndex;
+  Cal_BddId_t bddId;
+  
+  Cal_BddIndex_t fIndex = bddManager->idToIndex[fId];
+  CalHashTable_t **orHashTableArray = bddManager->reqQue[4];
+  CalHashTable_t **existHashTableArray = bddManager->reqQue[5];
+  Cal_Bdd_t result;
+  
+  if (CalOpExists(bddManager, f, &result) == 1){
+    return result;
+  }
+
+  if (CalCacheTableOneLookup(bddManager, f, opCode, &result)){
+    return result;
+  }
+  
+  /*
+   * Change the size of the exist hash table to min. size 
+   */
+  for (bddIndex = fIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    existHashTableArray[bddId]->sizeIndex =
+        DEFAULT_EXIST_HASH_TABLE_SIZE_INDEX;  
+    existHashTableArray[bddId]->numBins = DEFAULT_EXIST_HASH_TABLE_SIZE;
+    Cal_MemFree(existHashTableArray[bddId]->bins);
+    existHashTableArray[bddId]->bins = Cal_MemAlloc(CalBddNode_t*,
+                                             DEFAULT_EXIST_HASH_TABLE_SIZE);
+    memset((char *)existHashTableArray[bddId]->bins, 0,
+           existHashTableArray[bddId]->numBins*sizeof(CalBddNode_t*));
+  }
+  
+  CalHashTableFindOrAdd(existHashTableArray[fId], f, bddManager->bddOne,
+                        &result);  
+
+
+  BddExistsBFAux(bddManager, fIndex, existHashTableArray, orHashTableArray,
+                 CalOpExists, opCode, association);  
+
+  CalRequestIsForwardedTo(result);
+  
+  CalCacheTableTwoFixResultPointers(bddManager);
+  CalCacheTableOneInsert(bddManager, f, result, opCode, 0);
+  for (bddIndex = fIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(existHashTableArray[bddId]);
+    CalHashTableCleanUp(orHashTableArray[bddId]);
+  }
+  return result;
+}
+
+  
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddRelProdApply(Cal_BddManager_t *bddManager, int quantifying, CalHashTable_t
+                *relProdHashTable, CalHashTable_t **relProdHashTableArray,
+                CalHashTable_t **andHashTableArray, CalOpProc_t
+                calOpProc, unsigned short opCode, CalAssociation_t *assoc)
+{
+  int i, numBins = relProdHashTable->numBins;
+  CalBddNode_t **bins = relProdHashTable->bins;
+  Cal_BddId_t minId;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t fx, fxbar, gx, gxbar, result, resultBar;
+  /*Cal_BddIndex_t minIndex;*/
+  int minIndex;
+  
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetCofactors(bddManager, requestNode, fx, fxbar, gx, gxbar);
+      CalBddNormalize(fx, gx);
+      CalBddGetMinIdAndMinIndex(bddManager, fx, gx, minId, minIndex);
+      if (minIndex > assoc->lastBddIndex){
+        if (CalOpAnd(bddManager, fx, gx, &result) == 0){
+          if (CalCacheTableTwoLookup(bddManager, fx, gx, CAL_OP_NAND,
+                                     &result)){  
+            CalRequestIsForwardedTo(result);
+          }
+          else{
+            CalHashTableFindOrAdd(andHashTableArray[minId], fx, gx, &result);
+            CalCacheTableTwoInsert(bddManager, fx, gx, result,
+                                   CAL_OP_NAND, 1);
+          }
+          CalBddNot(result, result);
+        }
+      }
+      else {
+        if(calOpProc(bddManager, fx, gx, &result) == 0){
+          if (CalCacheTableTwoLookup(bddManager, fx, gx, opCode,
+                                     &result)){      
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(relProdHashTableArray[minId], fx, gx,
+                                  &result);   
+            CalCacheTableTwoInsert(bddManager, fx, gx, result, opCode, 1); 
+          }
+        }
+      }
+      CalRequestNodePutThenRequest(requestNode, result);
+      if (quantifying){
+        Cal_Bdd_t elseRequest;
+        Cal_BddId_t elseRequestId;
+        CalBddNode_t *elseRequestNode;
+        
+        CalBddGetMinId2(bddManager, fxbar, gxbar, elseRequestId);
+        CalNodeManagerInitBddNode(bddManager->nodeManagerArray[elseRequestId],
+                                  fxbar, gxbar, Cal_Nil(CalBddNode_t),
+                                  elseRequestNode);
+        /*
+          CalNodeManagerAllocNode(bddManager->nodeManagerArray[elseRequestId],
+          elseRequestNode);  
+          CalRequestNodePutF(elseRequestNode, fxbar);
+          CalRequestNodePutG(elseRequestNode, gxbar);
+        */
+        CalRequestPutRequestId(elseRequest, elseRequestId);
+        CalRequestPutRequestNode(elseRequest, elseRequestNode);
+        CalRequestNodePutElseRequest(requestNode, elseRequest);
+      }
+      else {
+        CalBddIcrRefCount(result);
+        CalBddNormalize(fxbar, gxbar);
+        CalBddGetMinIdAndMinIndex(bddManager, fxbar, gxbar, minId, minIndex);
+        if (minIndex > assoc->lastBddIndex){
+          if (CalOpAnd(bddManager, fxbar, gxbar, &resultBar) == 0){
+            if( CalCacheTableTwoLookup(bddManager, fxbar, gxbar,
+                                       CAL_OP_NAND, &resultBar)){  
+              CalRequestIsForwardedTo(resultBar);
+            }
+            else{
+              CalHashTableFindOrAdd(andHashTableArray[minId], fxbar, gxbar,
+                                    &resultBar); 
+              CalCacheTableTwoInsert(bddManager, fxbar, gxbar, resultBar,
+                                     CAL_OP_NAND, 1); 
+            }
+            CalBddNot(resultBar, resultBar);
+          }
+        }
+        else {
+          if(calOpProc(bddManager, fxbar, gxbar, &resultBar) == 0){
+            if (CalCacheTableTwoLookup(bddManager, fxbar, gxbar, opCode,
+                                       &resultBar)){   
+              CalRequestIsForwardedTo(resultBar);
+            }
+            else { 
+              CalHashTableFindOrAdd(relProdHashTableArray[minId],
+                                    fxbar, gxbar, &resultBar);
+              CalCacheTableTwoInsert(bddManager, fxbar, gxbar,
+                                     resultBar, opCode, 1); 
+            }
+          }
+        }
+        CalBddIcrRefCount(resultBar);
+        CalRequestNodePutElseRequest(requestNode, resultBar);
+      }
+    }
+  }
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddRelProdReduce(Cal_BddManager_t *bddManager, CalHashTable_t
+                 *relProdHashTable, CalHashTable_t
+                 **relProdHashTableArray, CalHashTable_t
+                 **andHashTableArray, CalHashTable_t
+                 **orHashTableArray, unsigned short opCode,
+                 CalAssociation_t *assoc)  
+{
+  int i, numBins = relProdHashTable->numBins;
+  CalBddNode_t **bins = relProdHashTable->bins;
+  CalRequestNode_t *requestNode, *next, *requestNodeListAux;
+  CalBddNode_t  *elseRequestNode;
+  int bddIndex;
+  /*Cal_BddIndex_t minIndex;*/
+  int minIndex;
+  Cal_BddId_t bddId, minId, elseRequestId;
+  Cal_Bdd_t thenBdd, elseBdd, result, orResult;
+  Cal_BddRefCount_t refCount;
+  Cal_Bdd_t fxbar, gxbar;
+  CalBddNode_t *endNode;
+  
+
+  /* For those nodes which get processed in the first pass */
+  /*requestNodeList = relProdHashTable->requestNodeList;*/
+  endNode = relProdHashTable->endNode;
+  
+  /* For the other ones. This list is merged with the requestNodeList
+   * after processing is complete.
+   */
+  requestNodeListAux = Cal_Nil(CalRequestNode_t);
+  
+  minIndex = bddManager->numVars;
+  
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      /* Process the requestNode */
+      CalRequestNodeGetThenRequest(requestNode, thenBdd);
+      CalRequestIsForwardedTo(thenBdd);
+      /*CalRequestNodePutThenRequest(requestNode, thenBdd);*/
+      CalRequestNodeGetElseRequest(requestNode, elseBdd);
+      CalRequestIsForwardedTo(elseBdd);
+      CalRequestGetF(elseBdd, fxbar);
+      CalRequestGetG(elseBdd, gxbar);
+      
+      /* Free the else request node because it is not needed */
+      elseRequestNode = CalRequestNodeGetElseRequestNode(requestNode);
+      elseRequestId = CalRequestNodeGetElseRequestId(requestNode);
+      CalNodeManagerFreeNode(bddManager->nodeManagerArray[elseRequestId],
+                             elseRequestNode);
+      if (CalBddIsBddOne(bddManager, thenBdd)){
+        CalRequestNodePutThenRequest(requestNode, bddManager->bddOne);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        /*
+        ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        ** requestNodeList = requestNode;
+        */
+        /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+        continue;
+      }
+      
+      CalRequestNodePutNextRequestNode(requestNode, requestNodeListAux);
+      requestNodeListAux = requestNode;
+
+      CalBddGetMinIdAndMinIndex(bddManager, fxbar, gxbar, bddId, bddIndex);
+      CalBddNormalize(fxbar, gxbar);
+      if (bddIndex > assoc->lastBddIndex){
+        if (CalOpAnd(bddManager, fxbar, gxbar, &result) == 0){
+          if (CalCacheTableTwoLookup(bddManager, fxbar, gxbar,
+                                     CAL_OP_NAND, &result)){
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(andHashTableArray[bddId], fxbar,
+                                  gxbar, &result);
+            CalCacheTableTwoInsert(bddManager, fxbar, gxbar, result,
+                                   CAL_OP_NAND, 1);
+            if (minIndex > bddIndex) minIndex = bddIndex;
+          }
+          CalBddNot(result, result);
+        }
+      }
+      else {
+        if(CalOpRelProd(bddManager, fxbar, gxbar, &result) == 0){
+          if (CalCacheTableTwoLookup(bddManager, fxbar, gxbar, opCode,
+                                     &result)){  
+            CalRequestIsForwardedTo(result);
+          }
+          else {
+            CalHashTableFindOrAdd(relProdHashTableArray[bddId], fxbar, gxbar, 
+                                  &result);
+            CalCacheTableTwoInsert(bddManager, fxbar, gxbar, result,
+                                   opCode, 1); 
+            if (minIndex > bddIndex) minIndex = bddIndex;
+          }
+        }
+      }
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+
+  if (!requestNodeListAux){
+    /*relProdHashTable->requestNodeList = requestNodeList;*/
+    relProdHashTable->endNode = endNode;
+    return;
+  }
+  
+  BddRelProdBFAux(bddManager, minIndex, relProdHashTableArray,
+                  andHashTableArray, orHashTableArray, opCode, assoc);
+  
+  minIndex = bddManager->numVars;
+  for (requestNode = requestNodeListAux; requestNode; requestNode = next){
+    Cal_Bdd_t thenResult, elseResult;
+    Cal_BddIndex_t orResultIndex;
+    
+    next = CalRequestNodeGetNextRequestNode(requestNode);
+    CalRequestNodeGetThenRequest(requestNode, thenResult);
+    CalRequestNodeGetElseRequest(requestNode, elseResult);
+    CalRequestIsForwardedTo(elseResult);
+    CalRequestIsForwardedTo(thenResult);
+    CalBddNormalize(thenResult, elseResult);
+    if (CalOpOr(bddManager, thenResult, elseResult, &orResult) == 0){
+      CalBddNot(thenResult, thenResult);
+      CalBddNot(elseResult, elseResult);
+      if (CalCacheTableTwoLookup(bddManager, thenResult, elseResult,
+                                 CAL_OP_NAND, &orResult)){ 
+        CalRequestIsForwardedTo(orResult);
+      }
+      else {
+        CalBddGetMinIdAndMinIndex(bddManager, thenResult, elseResult,
+                                  minId, orResultIndex);
+        CalHashTableFindOrAdd(orHashTableArray[minId], thenResult, elseResult,
+                              &orResult);
+        CalCacheTableTwoInsert(bddManager, thenResult, elseResult, orResult,
+                                 CAL_OP_NAND, 1); 
+        if (minIndex > orResultIndex) minIndex = orResultIndex;
+      }
+    }
+    CalRequestNodePutThenRequest(requestNode, orResult);
+  }
+
+  /* Call "OR" apply and reduce */
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    if(orHashTableArray[bddId]->numEntries){
+        HashTableApply(bddManager, orHashTableArray[bddId], orHashTableArray,
+                       CalOpNand, CAL_OP_NAND); 
+    }
+  }
+  
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    CalHashTable_t *uniqueTableForId;
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    if(orHashTableArray[bddId]->numEntries){
+      HashTableReduce(bddManager, orHashTableArray[bddId], uniqueTableForId);
+    }
+  }
+  for (requestNode = requestNodeListAux; requestNode; requestNode = next){
+    next = CalRequestNodeGetNextRequestNode(requestNode);
+    CalRequestNodeGetThenRequest(requestNode, result);
+    CalRequestIsForwardedTo(result);
+    CalBddNodeGetRefCount(requestNode, refCount);
+    CalBddAddRefCount(result, refCount);
+    CalRequestNodePutThenRequest(requestNode, result);
+    CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+    /*
+    ** CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+    ** requestNodeList = requestNode;
+    */
+    /*CalRequestNodePutNextRequestNode(endNode, requestNode);*/
+    endNode->nextBddNode = requestNode;
+    endNode = requestNode;
+  }
+
+  /*relProdHashTable->requestNodeList = requestNodeList;*/
+  relProdHashTable->endNode = endNode;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddRelProdBFAux(Cal_BddManager_t *bddManager, int minIndex,
+                CalHashTable_t **relProdHashTableArray, CalHashTable_t
+                **andHashTableArray, CalHashTable_t
+                **orHashTableArray, unsigned short opCode,
+                CalAssociation_t *assoc)
+{
+  Cal_BddIndex_t bddIndex;
+  int quantifying;
+  int index;
+  Cal_BddId_t bddId;
+  CalHashTable_t *hashTable;
+  
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = andHashTableArray[bddId];
+    if(hashTable->numEntries){
+      HashTableApply(bddManager, hashTable, andHashTableArray, CalOpNand,
+                     CAL_OP_NAND); 
+    }
+    hashTable = relProdHashTableArray[bddId];
+    if(hashTable->numEntries){
+      quantifying = (CalBddIsBddNull(bddManager,
+                                     assoc->varAssociation[bddId]) ? 0 : 1); 
+      BddRelProdApply(bddManager, quantifying, hashTable,
+                      relProdHashTableArray, andHashTableArray,
+                      CalOpRelProd, opCode, assoc); 
+    }
+  }
+
+  /* Reduce phase */
+  for (index = bddManager->numVars-1; index >= minIndex; index--){
+    CalHashTable_t *uniqueTableForId;
+    bddId = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = andHashTableArray[bddId];
+    if(hashTable->numEntries){
+      HashTableReduce(bddManager, hashTable, uniqueTableForId);
+    }
+    if (relProdHashTableArray[bddId]->numEntries){
+      quantifying = (CalBddIsBddNull(bddManager,
+                                     assoc->varAssociation[bddId]) ? 0 : 1); 
+      if (quantifying){
+        BddRelProdReduce(bddManager, relProdHashTableArray[bddId],
+                         relProdHashTableArray, andHashTableArray,
+                         orHashTableArray, opCode, assoc); 
+      }
+      else {
+        HashTableReduce(bddManager, relProdHashTableArray[bddId],
+                        bddManager->uniqueTable[bddId]);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddRelProdBFPlusDF(Cal_BddManager_t * bddManager, Cal_Bdd_t  f,
+                   Cal_Bdd_t  g, unsigned short opCode,
+                   CalAssociation_t *association)
+{
+  Cal_Bdd_t result;
+  /*Cal_BddIndex_t minIndex;*/
+  int  minIndex;
+  int bddIndex;
+  CalHashTable_t **andHashTableArray = bddManager->reqQue[3];
+  CalHashTable_t **relProdHashTableArray = bddManager->reqQue[4];
+  CalHashTable_t **orHashTableArray = bddManager->reqQue[5];
+  Cal_BddId_t bddId, minId;
+
+  if(CalOpRelProd(bddManager, f, g, &result) == 1){
+    return result;
+  }
+  CalBddNormalize(f, g);
+  if(CalCacheTableTwoLookup(bddManager, f, g, opCode, &result)){
+    return result;
+  }
+
+  CalBddGetMinIdAndMinIndex(bddManager, f, g, minId, minIndex);
+
+  /*
+   * Change the size of the exist hash table to min. size 
+   */
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    relProdHashTableArray[bddId]->sizeIndex =
+        DEFAULT_EXIST_HASH_TABLE_SIZE_INDEX;  
+    relProdHashTableArray[bddId]->numBins = DEFAULT_EXIST_HASH_TABLE_SIZE;
+    Cal_MemFree(relProdHashTableArray[bddId]->bins);
+    relProdHashTableArray[bddId]->bins = Cal_MemAlloc(CalBddNode_t*,
+                                             DEFAULT_EXIST_HASH_TABLE_SIZE);
+    memset((char *)relProdHashTableArray[bddId]->bins, 0,
+           relProdHashTableArray[bddId]->numBins*sizeof(CalBddNode_t*));
+  }
+
+  if (minIndex > association->lastBddIndex) {
+    if (CalOpAnd(bddManager, f, g, &result) == 0){
+      if (CalCacheTableTwoLookup(bddManager, f, g, CAL_OP_NAND, &result)
+          == 0){
+        CalHashTableFindOrAdd(andHashTableArray[minId], f, g, &result);
+      }
+      else{
+        CalCacheTableTwoInsert(bddManager, f, g, result, CAL_OP_NAND,
+                               1);
+      }
+      CalBddNot(result, result);
+    }
+  }
+  else {
+    CalHashTableFindOrAdd(relProdHashTableArray[minId], f, g, &result); 
+  }
+
+  BddRelProdBFAux(bddManager, minIndex, relProdHashTableArray,
+                  andHashTableArray, orHashTableArray, opCode, association); 
+  CalRequestIsForwardedTo(result);
+  CalCacheTableTwoFixResultPointers(bddManager);
+  CalCacheTableTwoInsert(bddManager, f, g, result, opCode, 0);
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(relProdHashTableArray[bddId]);
+    CalHashTableCleanUp(andHashTableArray[bddId]);
+    CalHashTableCleanUp(orHashTableArray[bddId]);
+  }
+  return result;
+}
+
Index: /vis_dev/glu-2.1/src/calBdd/calReduce.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calReduce.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calReduce.c	(revision 6)
@@ -0,0 +1,684 @@
+/**CFile***********************************************************************
+
+  FileName    [calReduce.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for optimizing a BDD with respect to a don't
+  care set (cofactor and restrict).]
+
+  Description []
+
+  SeeAlso     [None]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calReduce.c,v 1.3 2002/09/21 20:39:25 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static Cal_Bdd_t BddReduceBF(Cal_BddManager_t * bddManager, CalOpProc_t calOpProc, Cal_Bdd_t f, Cal_Bdd_t c);
+static Cal_Bdd_t BddCofactorBF(Cal_BddManager_t * bddManager, CalOpProc_t calOpProc, Cal_Bdd_t f, Cal_Bdd_t c);
+static void HashTableReduceApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t ** reduceHashTableArray, CalHashTable_t ** orHashTableArray, CalOpProc_t calOpProc);
+static void HashTableCofactorApply(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t ** cofactorHashTableArray, CalOpProc_t calOpProc);
+static void HashTableCofactorReduce(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalHashTable_t * uniqueTableForId);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [Returns the generalized cofactor of BDD f with respect
+  to BDD c.]
+
+  Description [Returns the generalized cofactor of BDD f with respect
+  to BDD c. The constrain operator given by Coudert et al (ICCAD90) is
+  used to find the generalized cofactor.]
+
+  SideEffects [None.]
+
+  SeeAlso     [Cal_BddReduce]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddCofactor(Cal_BddManager  bddManager, Cal_Bdd fUserBdd,
+                Cal_Bdd cUserBdd)
+{
+  Cal_Bdd_t result;
+  Cal_Bdd userResult;
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, cUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    Cal_Bdd_t c = CalBddGetInternalBdd(bddManager, cUserBdd);
+    result = BddCofactorBF(bddManager, CalOpCofactor, f, c);
+    userResult =  CalBddGetExternalBdd(bddManager, result);
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, userResult);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    return userResult;
+  }
+  return (Cal_Bdd) 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a BDD which agrees with f for all valuations
+  which satisfy c.]
+
+  Description [Returns a BDD which agrees with f for all valuations
+  which satisfy c. The result is usually smaller in terms of number of
+  BDD nodes than f. This operation is typically used in state space
+  searches to simplify the representation for the set of states wich
+  will be expanded at each step.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddCofactor]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddReduce(Cal_BddManager  bddManager, Cal_Bdd fUserBdd,
+              Cal_Bdd cUserBdd)
+{
+  if (CalBddPreProcessing(bddManager, 2, fUserBdd, cUserBdd)){
+    Cal_Bdd_t f = CalBddGetInternalBdd(bddManager, fUserBdd);
+    Cal_Bdd_t c = CalBddGetInternalBdd(bddManager, cUserBdd);
+    Cal_Bdd_t result;
+    Cal_Bdd userResult;
+
+    result = BddReduceBF(bddManager, CalOpCofactor, f, c);
+    userResult =  CalBddGetExternalBdd(bddManager, result);
+
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, userResult);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    if (Cal_BddSize(bddManager, userResult, 1) <
+        Cal_BddSize(bddManager, fUserBdd, 1)){
+      return userResult;
+    }
+    else{
+      Cal_BddFree(bddManager, userResult);
+      return Cal_BddIdentity(bddManager, fUserBdd);
+    }
+  }
+  return (Cal_Bdd) 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a minimal BDD whose function contains fMin and is
+  contained in fMax.]
+
+  Description [Returns a minimal BDD f which is contains fMin and is
+  contained in fMax ( fMin <= f <= fMax).
+  This operation is typically used in state space searches to simplify
+  the representation for the set of states wich will be expanded at
+  each step (Rk Rk-1' <= f <= Rk).] 
+
+  SideEffects [None]
+
+  SeeAlso     [Cal_BddReduce]
+
+******************************************************************************/
+Cal_Bdd
+Cal_BddBetween(Cal_BddManager  bddManager, Cal_Bdd fMinUserBdd,
+               Cal_Bdd fMaxUserBdd)
+{
+  if (CalBddPreProcessing(bddManager, 2, fMinUserBdd, fMaxUserBdd)){
+    Cal_Bdd_t fMin = CalBddGetInternalBdd(bddManager, fMinUserBdd);
+    Cal_Bdd_t fMax = CalBddGetInternalBdd(bddManager, fMaxUserBdd);
+    Cal_Bdd_t fMaxNot, careSet, result;
+    Cal_Bdd resultUserBdd;
+    long fMinSize, fMaxSize, resultSize;
+
+    CalBddNot(fMax, fMaxNot);
+    careSet = CalBddOpBF(bddManager, CalOpOr, fMin, fMaxNot);
+    result = BddReduceBF(bddManager, CalOpCofactor, fMin, careSet);
+    resultUserBdd =  CalBddGetExternalBdd(bddManager, result);
+    if (CalBddPostProcessing(bddManager) == CAL_BDD_OVERFLOWED){
+      Cal_BddFree(bddManager, resultUserBdd);
+      Cal_BddManagerGC(bddManager);
+      return (Cal_Bdd) 0;
+    }
+    fMinSize = Cal_BddSize(bddManager, fMinUserBdd, 1);
+    fMaxSize = Cal_BddSize(bddManager, fMaxUserBdd, 1);
+    resultSize = Cal_BddSize(bddManager, resultUserBdd, 1);
+    if (resultSize < fMinSize){
+      if (resultSize < fMaxSize){
+        return resultUserBdd;
+      }
+      else {
+        Cal_BddFree(bddManager, resultUserBdd);
+        return Cal_BddIdentity(bddManager, fMaxUserBdd);
+      }
+    }
+    Cal_BddFree(bddManager, resultUserBdd);
+    if (fMinSize < fMaxSize){
+      return Cal_BddIdentity(bddManager, fMinUserBdd);
+    }
+    else{
+      return Cal_BddIdentity(bddManager, fMaxUserBdd);
+    }
+  }
+  return (Cal_Bdd) 0;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpCofactor(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  f,
+  Cal_Bdd_t  c,
+  Cal_Bdd_t * resultBddPtr)
+{
+  if (CalBddIsBddConst(c)){
+    if (CalBddIsBddZero(bddManager, c)){
+      *resultBddPtr = bddManager->bddNull;
+    }
+    else {
+      *resultBddPtr = f;
+    }
+    return 1;
+  }
+  if (CalBddIsBddConst(f)){
+    *resultBddPtr = f;
+    return 1;
+  }
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddReduceBF(
+  Cal_BddManager_t * bddManager,
+  CalOpProc_t calOpProc,
+  Cal_Bdd_t  f,
+  Cal_Bdd_t  c)
+{
+  Cal_Bdd_t result;
+  CalHashTable_t  *hashTable;
+  CalHashTable_t **orHashTableArray = bddManager->reqQue[0];
+  CalHashTable_t **reduceHashTableArray = bddManager->reqQue[1];
+  CalHashTable_t *uniqueTableForId;
+  
+  /*Cal_BddIndex_t minIndex;*/
+  int minIndex;
+  int bddIndex;
+  Cal_BddId_t bddId, minId;
+  
+  
+  if ((*calOpProc)(bddManager, f, c, &result) == 1){
+    return result;
+  }
+
+  CalBddGetMinIdAndMinIndex(bddManager, f, c, minId, minIndex);
+  CalHashTableFindOrAdd(reduceHashTableArray[minId], f, c, &result); 
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = reduceHashTableArray[bddId];
+    if(hashTable->numEntries){
+      HashTableReduceApply(bddManager, hashTable, reduceHashTableArray,
+                           orHashTableArray, CalOpCofactor);
+    }
+  }
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = reduceHashTableArray[bddId];
+    if(hashTable->numEntries){
+        HashTableCofactorReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+  CalRequestIsForwardedTo(result);
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(reduceHashTableArray[bddId]);
+  }
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd_t
+BddCofactorBF(Cal_BddManager_t * bddManager,
+              CalOpProc_t calOpProc,
+              Cal_Bdd_t  f,
+              Cal_Bdd_t  c)
+{
+  Cal_Bdd_t result;
+  CalHashTable_t  *hashTable;
+  CalHashTable_t **cofactorHashTableArray = bddManager->reqQue[0];
+  CalHashTable_t *uniqueTableForId;
+  
+/*Cal_BddIndex_t minIndex;*/
+  int minIndex;
+  int bddIndex;
+  Cal_BddId_t bddId, minId;
+  
+  if (CalBddIsBddZero(bddManager, c)){
+    CalBddWarningMessage("Bdd Cofactor Called with zero care set");
+    return bddManager->bddOne;
+  }
+  
+  if (calOpProc(bddManager, f, c, &result) == 1){
+    return result;
+  }
+
+  CalBddGetMinIdAndMinIndex(bddManager, f, c, minId, minIndex);
+  CalHashTableFindOrAdd(cofactorHashTableArray[minId], f, c, &result); 
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    hashTable = cofactorHashTableArray[bddId];
+    if(hashTable->numEntries){
+      HashTableCofactorApply(bddManager, hashTable, cofactorHashTableArray,
+                             calOpProc); 
+    }
+  }
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    hashTable = cofactorHashTableArray[bddId];
+    if(hashTable->numEntries){
+        HashTableCofactorReduce(bddManager, hashTable, uniqueTableForId);
+    }
+  }
+  CalRequestIsForwardedTo(result);
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(cofactorHashTableArray[bddId]);
+  }
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableReduceApply(Cal_BddManager_t * bddManager,
+                     CalHashTable_t * hashTable,
+                     CalHashTable_t ** reduceHashTableArray,
+                     CalHashTable_t ** orHashTableArray,
+                     CalOpProc_t calOpProc)
+{
+  int i, numBins = hashTable->numBins;
+  CalRequestNode_t *requestNode, *last, *nextRequestNode, *requestNodeList;
+  Cal_Bdd_t f, c, fx, cx, fxbar, cxbar, result, orResult;
+  Cal_BddId_t bddId, minId;
+  /*Cal_BddIndex_t minIndex;*/
+  int minIndex;
+  int bddIndex;
+  CalHashTable_t *orHashTable;
+  
+  requestNodeList = Cal_Nil(CalRequestNode_t);
+  for(i = 0; i < numBins; i++){
+    last = Cal_Nil(CalRequestNode_t);
+    for (requestNode =  hashTable->bins[i]; requestNode !=
+                                                Cal_Nil(CalRequestNode_t);
+         requestNode = nextRequestNode){
+      nextRequestNode = CalRequestNodeGetNextRequestNode(requestNode);  
+      CalRequestNodeGetF(requestNode, f);
+      CalRequestNodeGetG(requestNode, c);
+      CalBddGetMinId2(bddManager, f, c, minId);
+      CalBddGetCofactors(c, minId, cx, cxbar);
+      if (CalBddGetBddId(f) != minId){
+        if (CalOpOr(bddManager, cx, cxbar, &orResult) == 0){
+          CalBddNormalize(cx, cxbar);
+          CalBddGetMinId2(bddManager, cx, cxbar, minId);
+          CalHashTableFindOrAdd(orHashTableArray[minId], cx, cxbar, &orResult);
+        }
+        CalRequestNodePutElseRequest(requestNode, orResult);
+        if (last == Cal_Nil(CalRequestNode_t)){
+          hashTable->bins[i] = nextRequestNode;
+        }
+        else {
+          CalRequestNodePutNextRequestNode(last, nextRequestNode);
+        }
+        CalRequestNodePutNextRequestNode(requestNode, requestNodeList);
+        requestNodeList = requestNode;
+      }
+      else{
+        last = requestNode;
+        CalBddGetCofactors(f, minId, fx, fxbar);
+        if((*calOpProc)(bddManager, fx, cx, &result) == 0){
+          CalBddGetMinId2(bddManager, fx, cx, bddId);
+          CalHashTableFindOrAdd(reduceHashTableArray[bddId], fx, cx, &result);
+        }
+        if (CalBddIsBddNull(bddManager, result) == 0){
+          CalBddIcrRefCount(result);
+        }
+        CalRequestNodePutThenRequest(requestNode, result);
+        if((*calOpProc)(bddManager, fxbar, cxbar, &result) == 0){
+          CalBddGetMinId2(bddManager, fxbar, cxbar, bddId);
+          CalHashTableFindOrAdd(reduceHashTableArray[bddId], fxbar, cxbar,
+                                &result);
+        }
+        if (CalBddIsBddNull(bddManager, result) == 0){
+          CalBddIcrRefCount(result);
+        }
+        CalRequestNodePutElseRequest(requestNode, result);
+      }
+    }
+  }
+  minIndex = bddManager->idToIndex[hashTable->bddId];
+  for (bddIndex = minIndex; bddIndex < bddManager->numVars; bddIndex++){
+    bddId = bddManager->indexToId[bddIndex];
+    orHashTable = orHashTableArray[bddId];
+    if(orHashTable->numEntries){
+      CalHashTableApply(bddManager, orHashTable, orHashTableArray, CalOpOr);
+    }
+  }
+  
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    CalHashTable_t *uniqueTableForId;
+    bddId = bddManager->indexToId[bddIndex];
+    uniqueTableForId = bddManager->uniqueTable[bddId];
+    orHashTable = orHashTableArray[bddId];
+    if(orHashTable->numEntries){
+      CalHashTableReduce(bddManager, orHashTable, uniqueTableForId);
+    }
+  }
+  for (requestNode = requestNodeList; requestNode; requestNode =
+                                                       nextRequestNode){
+    nextRequestNode = CalRequestNodeGetNextRequestNode(requestNode);
+    CalRequestNodeGetElseRequest(requestNode, orResult);
+    CalRequestIsForwardedTo(orResult);
+    CalRequestNodeGetThenRequest(requestNode, f);
+    CalBddGetMinId2(bddManager, f, orResult, minId);
+    CalHashTableFindOrAdd(reduceHashTableArray[minId], f, orResult,
+                          &result);
+    CalRequestNodePutThenRequest(requestNode, result);
+    CalRequestNodePutElseRequest(requestNode, result);
+    CalBddAddRefCount(result, 2);
+    CalHashTableAddDirect(hashTable, requestNode);
+  }
+  
+  /* Clean up the orHashTableArray */
+  for(bddIndex = bddManager->numVars - 1; bddIndex >= minIndex; bddIndex--){
+    bddId = bddManager->indexToId[bddIndex];
+    CalHashTableCleanUp(orHashTableArray[bddId]);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableCofactorApply(Cal_BddManager_t * bddManager,
+                       CalHashTable_t * hashTable,
+                       CalHashTable_t ** cofactorHashTableArray,
+                       CalOpProc_t calOpProc)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  CalRequestNode_t *requestNode;
+  Cal_Bdd_t f, c, fx, cx, fxbar, cxbar, result;
+  Cal_BddId_t bddId, minId;
+
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i];
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = CalRequestNodeGetNextRequestNode(requestNode)){
+      CalRequestNodeGetF(requestNode, f);
+      CalRequestNodeGetG(requestNode, c);
+      CalBddGetMinId2(bddManager, f, c, minId);
+      CalBddGetCofactors(f, minId, fx, fxbar);
+      CalBddGetCofactors(c, minId, cx, cxbar);
+      if((*calOpProc)(bddManager, fx, cx, &result) == 0){
+        CalBddGetMinId2(bddManager, fx, cx, bddId);
+        CalHashTableFindOrAdd(cofactorHashTableArray[bddId], fx, cx, &result);
+      }
+      if (CalBddIsBddNull(bddManager, result) == 0){
+        CalBddIcrRefCount(result);
+      }
+      CalRequestNodePutThenRequest(requestNode, result);
+      if((*calOpProc)(bddManager, fxbar, cxbar, &result) == 0){
+        CalBddGetMinId2(bddManager, fxbar, cxbar, bddId);
+        CalHashTableFindOrAdd(cofactorHashTableArray[bddId], fxbar, cxbar,
+                              &result);
+      }
+      if (CalBddIsBddNull(bddManager, result) == 0){
+          CalBddIcrRefCount(result);
+      }
+      CalRequestNodePutElseRequest(requestNode, result);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableCofactorReduce(Cal_BddManager_t * bddManager,
+                        CalHashTable_t * hashTable,
+                        CalHashTable_t * uniqueTableForId)
+{
+  int i, numBins = hashTable->numBins;
+  CalBddNode_t **bins = hashTable->bins;
+  Cal_BddId_t currentBddId = uniqueTableForId->bddId;
+  CalNodeManager_t *nodeManager = uniqueTableForId->nodeManager;
+  CalRequestNode_t  *requestNode, *next, *endNode;
+  CalBddNode_t *bddNode;
+  Cal_Bdd_t thenBdd, elseBdd, result;
+  Cal_BddRefCount_t refCount;
+
+  endNode = hashTable->endNode;
+  for(i = 0; i < numBins; i++){
+    for(requestNode = bins[i], bins[i] = Cal_Nil(CalRequestNode_t);
+        requestNode != Cal_Nil(CalRequestNode_t);
+        requestNode = next){
+      next = CalRequestNodeGetNextRequestNode(requestNode);
+      /* Process the requestNode */
+      CalRequestNodeGetThenRequest(requestNode, thenBdd);
+      CalRequestNodeGetElseRequest(requestNode, elseBdd);
+      if (CalBddIsBddNull(bddManager, thenBdd)){
+        CalRequestIsForwardedTo(elseBdd);
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(elseBdd, refCount - 1);
+        CalRequestNodePutThenRequest(requestNode, elseBdd);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+        continue;
+      }
+      else if (CalBddIsBddNull(bddManager, elseBdd)){
+        CalRequestIsForwardedTo(thenBdd);
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(thenBdd, refCount - 1);
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+        continue;
+      }
+      CalRequestIsForwardedTo(thenBdd);
+      CalRequestIsForwardedTo(elseBdd);
+      if(CalBddIsEqual(thenBdd, elseBdd)){
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(thenBdd, refCount - 2);
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+      else if(CalUniqueTableForIdLookup(bddManager, uniqueTableForId,
+          thenBdd, elseBdd, &result) == 1){
+        CalBddDcrRefCount(thenBdd);
+        CalBddDcrRefCount(elseBdd);
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddAddRefCount(result, refCount);
+        CalRequestNodePutThenRequest(requestNode, result);
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+      else if(CalBddIsOutPos(thenBdd)){
+        CalRequestNodePutThenRequest(requestNode, thenBdd);
+        CalRequestNodePutElseRequest(requestNode, elseBdd);
+        CalHashTableAddDirect(uniqueTableForId, requestNode);
+        bddManager->numNodes++;
+        bddManager->gcCheck--;
+      }
+      else{
+        CalNodeManagerAllocNode(nodeManager, bddNode);
+        CalBddNodePutThenBddId(bddNode, CalBddGetBddId(thenBdd));
+        CalBddNodePutThenBddNode(bddNode, CalBddGetBddNodeNot(thenBdd));
+        CalBddNodePutElseBddId(bddNode, CalBddGetBddId(elseBdd));
+        CalBddNodePutElseBddNode(bddNode, CalBddGetBddNodeNot(elseBdd));
+        CalBddNodeGetRefCount(requestNode, refCount);
+        CalBddNodePutRefCount(bddNode, refCount);
+        CalHashTableAddDirect(uniqueTableForId, bddNode);
+        bddManager->numNodes++;
+        bddManager->gcCheck--;
+        CalRequestNodePutThenRequestId(requestNode, currentBddId);
+        CalRequestNodePutThenRequestNode(requestNode, CalBddNodeNot(bddNode));
+        CalRequestNodePutElseRequestNode(requestNode, FORWARD_FLAG);
+        endNode->nextBddNode = requestNode;
+        endNode = requestNode;
+      }
+    }
+  }
+  hashTable->endNode = endNode;
+}
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calReorderBF.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calReorderBF.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calReorderBF.c	(revision 6)
@@ -0,0 +1,1486 @@
+/**CFile***********************************************************************
+
+  FileName    [calReorderBF.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for dynamic reordering of variables.]
+
+  Description [This method dynamically reorders variables while
+  preserving their locality. This entails both memory and
+  computational overheads.  Conceptually and experimentally it has
+  been observed that these overheads lead to poorer performance
+  compared to the traditional reordering methods. For details, please
+  refer to the work by Rajeev K. Ranjan et al - "Dynamic variable
+  reordering in a breadth-first manipulation based package: Challenges
+  and Solutions"- Proceedings of ICCD'97.]
+
+  SeeAlso     [calReorderDF.c calReorderUtil.c]
+
+  Author      [Rajeev K. Ranjan   (rajeev@ic.eecs.berkeley.edu)
+               Wilsin Gosti (wilsin@ic.eecs.berkeley.edu)]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calReorderBF.c,v 1.3 2002/09/10 00:21:02 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void BddReorderFixForwardingNodes(Cal_BddManager bddManager, Cal_BddId_t id);
+static void BddReorderFixAndFreeForwardingNodes(Cal_BddManager bddManager, Cal_BddId_t id, int numLevels);
+static void BddReorderSwapVarIndex(Cal_BddManager_t * bddManager, int varIndex, int forwardCheckFlag);
+static int CofactorFixAndReclaimForwardedNodes(Cal_BddManager_t *bddManager, int cofactorCheckStartIndex, int cofactorCheckEndIndex, int reclaimStartIndex, int reclaimEndIndex);
+static void BddReorderFreeNodes(Cal_BddManager_t * bddManager, int varId);
+#ifdef _CAL_VERBOSE
+static void PrintBddProfileAfterReorder(Cal_BddManager_t *bddManager);
+#endif
+static void BddReorderVarSift(Cal_BddManager bddManager, double maxSizeFactor);
+static int BddReorderSiftToBestPos(Cal_BddManager_t * bddManager, int varStartIndex, double maxSizeFactor);
+static void BddSiftPerfromPhaseIV(Cal_BddManager_t *bddManager, int varStartIndex, int bestIndex, int bottomMostSwapIndex);
+static void BddReorderVarWindow(Cal_BddManager bddManager, char *levels);
+static int BddReorderWindow2(Cal_BddManager bddManager, long index, int directionFlag);
+static int BddReorderWindow3(Cal_BddManager bddManager, long index, int directionFlag);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddReorderAuxBF(Cal_BddManager_t * bddManager)
+{
+  Cal_Assert(CalCheckAllValidity(bddManager));
+  CalInitInteract(bddManager);
+#ifdef _CAL_QUANTIFY_
+  quantify_start_recording_data();
+#endif
+  if (bddManager->reorderTechnique == CAL_REORDER_WINDOW){
+    char *levels = Cal_MemAlloc(char, bddManager->numVars);
+    BddReorderVarWindow(bddManager, levels);
+    Cal_MemFree(levels);
+  }
+  else {
+    BddReorderVarSift(bddManager, bddManager->maxSiftingGrowth);
+  }
+#ifdef _CAL_QUANTIFY_
+  quantify_stop_recording_data();
+#endif
+  Cal_Assert(CalCheckAllValidity(bddManager));
+  Cal_MemFree(bddManager->interact);
+  bddManager->numReorderings++;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis           [Fixes the forwarding nodes in a unique table.]
+
+  Description        [As opposed to CalBddReorderFixCofactors, which fixes
+  the cofactors of the non-forwarding nodes, this routine traverses
+  the list of forwarding nodes and removes the intermediate level of
+  forwarding. Number of levels should be 1 or 2.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReorderFixForwardingNodes(Cal_BddManager bddManager,
+                             Cal_BddId_t id) 
+{
+  CalHashTable_t *uniqueTableForId =
+      bddManager->uniqueTable[id];
+  CalBddNode_t *bddNode, *nextBddNode;
+  Cal_Bdd_t thenBdd;
+  
+  /* These are the forwarding nodes. */
+  CalBddNode_t *requestNodeList =
+      uniqueTableForId->startNode.nextBddNode;
+  for (bddNode = requestNodeList; bddNode; bddNode = nextBddNode){
+    nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+    CalBddNodeGetThenBdd(bddNode, thenBdd);
+    if (CalBddIsForwarded(thenBdd)) {
+      CalBddForward(thenBdd);
+      CalBddNodePutThenBdd(bddNode, thenBdd);
+    }
+    else {
+      /* there should not be anymore double forwarding */
+      break;
+    }
+    Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+  }
+  /* Adjust the list */
+  uniqueTableForId->endNode->nextBddNode =
+      uniqueTableForId->startNode.nextBddNode;
+  uniqueTableForId->startNode.nextBddNode = bddNode;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Traverses the forwarding node lists of index,
+  index+1 .. up to index+level. Frees the intermediate forwarding nodes.]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReorderFixAndFreeForwardingNodes(Cal_BddManager bddManager,
+                                    Cal_BddId_t id, int numLevels)
+{
+  CalHashTable_t *uniqueTableForId;
+  Cal_BddIndex_t index = bddManager->idToIndex[id];
+  CalBddNode_t *nextBddNode, *bddNode, *endNode;
+  Cal_Bdd_t thenBdd;
+  CalNodeManager_t *nodeManager;
+  int i;
+  
+  /* Fixing */
+  for (i=numLevels-1; i >= 0; i--){
+    uniqueTableForId =
+        bddManager->uniqueTable[bddManager->indexToId[index+i]];
+    for (bddNode = uniqueTableForId->startNode.nextBddNode; bddNode;
+         bddNode = nextBddNode){ 
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, thenBdd);
+      if (CalBddIsForwarded(thenBdd)){
+        do{
+          CalBddMark(thenBdd);
+          CalBddForward(thenBdd);
+        } while (CalBddIsForwarded(thenBdd));
+        CalBddNodePutThenBdd(bddNode, thenBdd); 
+      }
+      Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+    }
+  }
+  /* Freeing */
+  for (i=numLevels-1; i >= 0; i--){
+    uniqueTableForId =
+        bddManager->uniqueTable[bddManager->indexToId[index+i]];
+    endNode = &(uniqueTableForId->startNode);
+    for (bddNode = uniqueTableForId->startNode.nextBddNode; bddNode;
+         bddNode = nextBddNode){ 
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, thenBdd);
+      if (CalBddIsMarked(thenBdd)){
+        do{
+          /* Free the node */
+          nodeManager = bddManager->nodeManagerArray[CalBddGetBddId(thenBdd)];
+          CalNodeManagerFreeNode(nodeManager, CalBddGetBddNode(thenBdd));
+          bddManager->numForwardedNodes--;
+        } while (CalBddIsMarked(thenBdd));
+      }
+      else{
+        endNode->nextBddNode = bddNode;
+        endNode = bddNode;
+      }
+    }
+    uniqueTableForId->endNode = endNode;
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [Traversesoptional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddReorderSwapVarIndex(Cal_BddManager_t * bddManager, int varIndex,
+                       int forwardCheckFlag)
+{
+  int thenVarIndex;
+  int elseVarIndex;
+  int varId;
+  int nextVarId;
+  int i;
+  int numBins;
+  int refCount;
+  int f0Found;
+  int f1Found;
+  CalHashTable_t *uniqueTableForId;
+  CalHashTable_t *nextUniqueTableForId;
+  CalBddNode_t **bins;
+  CalBddNode_t *bddNode, *startNode;
+  CalBddNode_t *nextBddNode, *processingNodeList;
+  CalBddNode_t *prevBddNode = Cal_Nil(CalBddNode_t);
+  Cal_Bdd_t newF;
+  Cal_Bdd_t f0;
+  Cal_Bdd_t f1;
+  Cal_Bdd_t newF0;
+  Cal_Bdd_t newF1;
+  Cal_Bdd_t f00;
+  Cal_Bdd_t f01;
+  Cal_Bdd_t f10;
+  Cal_Bdd_t f11;
+  CalAssociation_t *assoc;
+  
+  varId = bddManager->indexToId[varIndex];
+  nextVarId = bddManager->indexToId[varIndex + 1];
+  
+  if (CalTestInteract(bddManager, varId, nextVarId)){
+  bddManager->numSwaps++;
+#ifdef _CAL_VERBOSE
+  /*fprintf(stdout," %3d(%3d) going down,  %3d(%3d) going up\n",
+          varId, varIndex, nextVarId, varIndex+1);*/
+#endif
+  uniqueTableForId = bddManager->uniqueTable[varId];
+  nextUniqueTableForId = bddManager->uniqueTable[nextVarId];
+  
+  /*uniqueTableForId->requestNodeList = Cal_Nil(CalBddNode_t);*/
+  processingNodeList = Cal_Nil(CalBddNode_t);
+  numBins = uniqueTableForId->numBins;
+  bins = uniqueTableForId->bins;
+  if (forwardCheckFlag){
+    for(i = 0; i < numBins; ++i) {
+      prevBddNode = Cal_Nil(CalBddNode_t);
+      for(bddNode = bins[i];
+          bddNode != Cal_Nil(CalBddNode_t);
+          bddNode = nextBddNode) {
+        /*
+         * Process one bddNode at a time
+         */
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        /* The node should not be forwarded */
+        Cal_Assert(CalBddNodeIsForwarded(bddNode) == 0);
+        /*
+        ** We don't know for sure if the reference count of the node
+        ** could be 0. Let us use the assertion at this point.
+        */
+        Cal_Assert(CalBddNodeIsRefCountZero(bddNode) == 0);
+        /*
+        ** If ever the above assetion fails, or if we can convince
+        ** ourselves that the reference count could be zero, we need
+        ** to uncomment the following code.
+        */
+        /*
+        if (CalBddNodeIsRefCountZero(bddNode)){
+          thenBddNode = CAL_BDD_POINTER(CalBddNodeGetThenBddNode(bddNode));
+          elseBddNode = CAL_BDD_POINTER(CalBddNodeGetElseBddNode(bddNode));
+          CalBddNodeDcrRefCount(thenBddNode);
+          CalBddNodeDcrRefCount(elseBddNode);
+          if (prevBddNode){
+            CalBddNodePutNextBddNode(prevBddNode, nextBddNode);
+          }
+          else{
+            bins[i] = nextBddNode;
+          }
+          uniqueTableForId->numEntries--;
+          bddManager->numNodes--;
+          bddManager->numNodesFreed++;
+          CalNodeManagerFreeNode(uniqueTableForId->nodeManager, bddNode);
+          continue;
+        }
+        */
+        CalBddNodeGetElseBdd(bddNode, f0);
+        CalBddNodeGetThenBdd(bddNode, f1);
+        
+        if (CalBddIsForwarded(f1)) {
+          CalBddForward(f1);
+          CalBddNodePutThenBdd(bddNode, f1);
+        }
+        Cal_Assert(CalBddIsForwarded(f1) == 0);
+        
+        if (CalBddIsForwarded(f0)) {
+          CalBddForward(f0);
+          CalBddNodePutElseBdd(bddNode, f0); 
+        }
+        Cal_Assert(CalBddIsForwarded(f0) == 0);
+        /*
+        ** Get the index of f0 and f1 and create newF0 and newF1 if necessary
+        */
+        elseVarIndex = CalBddNodeGetElseBddIndex(bddManager, bddNode);
+        thenVarIndex = CalBddNodeGetThenBddIndex(bddManager, bddNode);
+        
+        if ((elseVarIndex > (varIndex + 1))
+            && (thenVarIndex > (varIndex + 1))) { 
+          prevBddNode = bddNode;
+          Cal_Assert(CalDoHash2(CalBddGetBddNode(f1),
+                                CalBddGetBddNode(f0), 
+                                uniqueTableForId) == i);
+          continue;
+        }
+  
+        /* This node is going to be forwared */
+        CalBddNodePutNextBddNode(bddNode, processingNodeList);
+        processingNodeList = bddNode;
+        
+        /* Update the unique table appropriately */
+        if (prevBddNode){
+          CalBddNodePutNextBddNode(prevBddNode, nextBddNode);
+        }
+        else{
+          bins[i] = nextBddNode;
+        } 
+        uniqueTableForId->numEntries--;
+        bddManager->numNodes--;
+      }
+    }
+  }
+  else{
+    for(i = 0; i < numBins; i++) {
+      prevBddNode = Cal_Nil(CalBddNode_t);
+      for(bddNode = bins[i];
+          bddNode != Cal_Nil(CalBddNode_t);
+          bddNode = nextBddNode) {
+        /*
+         * Process one bddNode at a time
+         */
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        /* The node should not be forwarded */
+        Cal_Assert(CalBddNodeIsForwarded(bddNode) == 0);
+
+        /*
+        ** We don't know for sure if the reference count of the node
+        ** could be 0. Let us use the assertion at this point.
+        */
+        Cal_Assert(CalBddNodeIsRefCountZero(bddNode) == 0);
+        /*
+        ** If ever the above assetion fails, or if we can convince
+        ** ourselves that the reference count could be zero, we need
+        ** to uncomment the following code.
+        */
+        /*
+        if (CalBddNodeIsRefCountZero(bddNode)){
+          thenBddNode = CAL_BDD_POINTER(CalBddNodeGetThenBddNode(bddNode));
+          elseBddNode = CAL_BDD_POINTER(CalBddNodeGetElseBddNode(bddNode));
+          CalBddNodeDcrRefCount(thenBddNode);
+          CalBddNodeDcrRefCount(elseBddNode);
+          if (prevBddNode){
+            CalBddNodePutNextBddNode(prevBddNode, nextBddNode);
+          }
+          else{
+            bins[i] = nextBddNode;
+          }
+          uniqueTableForId->numEntries--;
+          bddManager->numNodes--;
+          bddManager->numNodesFreed++;
+          CalNodeManagerFreeNode(uniqueTableForId->nodeManager, bddNode);
+          continue;
+        }
+        */
+        CalBddNodeGetThenBdd(bddNode, f1);
+        Cal_Assert(CalBddIsForwarded(f1) == 0);
+        CalBddNodeGetElseBdd(bddNode, f0);
+        Cal_Assert(CalBddIsForwarded(f0) == 0);
+        /*
+        ** Get the index of f0 and f1 and create newF0 and newF1 if necessary
+        */
+
+        elseVarIndex = CalBddNodeGetElseBddIndex(bddManager, bddNode);
+        thenVarIndex = CalBddNodeGetThenBddIndex(bddManager, bddNode);
+        
+        if ((elseVarIndex > (varIndex + 1))
+            && (thenVarIndex > (varIndex + 1))) { 
+          prevBddNode = bddNode;
+          continue;
+        }
+  
+        /* This node is going to be forwared */
+        CalBddNodePutNextBddNode(bddNode, processingNodeList);
+        processingNodeList = bddNode;
+        
+        /* Update the unique table appropriately */
+        if (prevBddNode){
+          CalBddNodePutNextBddNode(prevBddNode, nextBddNode);
+        }
+        else{
+          bins[i] = nextBddNode;
+        } 
+        uniqueTableForId->numEntries--;
+        bddManager->numNodes--;
+      }
+    }
+  }
+  bddNode = processingNodeList;
+  /*endNode = uniqueTableForId->endNode;*/
+  startNode = uniqueTableForId->startNode.nextBddNode;
+  while (bddNode != Cal_Nil(CalBddNode_t)) {
+    nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+
+    /*
+     * Get the index of f0 and f1 and create newF0 and newF1 if necessary
+     */
+
+    CalBddNodeGetElseBdd(bddNode, f0);
+    CalBddNodeGetThenBdd(bddNode, f1);
+    elseVarIndex = CalBddNodeGetElseBddIndex(bddManager, bddNode);
+    thenVarIndex = CalBddNodeGetThenBddIndex(bddManager, bddNode);
+
+    if (elseVarIndex > (varIndex + 1)) {
+      f00 = f0;
+      f01 = f0;
+      CalBddGetElseBdd(f1, f10);
+      CalBddGetThenBdd(f1, f11);
+    } else if (thenVarIndex > (varIndex + 1)) {
+      f10 = f1;
+      f11 = f1;
+      CalBddGetElseBdd(f0, f00);
+      CalBddGetThenBdd(f0, f01);
+    }else{
+      CalBddGetElseBdd(f1, f10);
+      CalBddGetThenBdd(f1, f11);
+      CalBddGetElseBdd(f0, f00);
+      CalBddGetThenBdd(f0, f01);
+    }
+    Cal_Assert(CalBddIsForwarded(f10) == 0);
+    Cal_Assert(CalBddIsForwarded(f11) == 0);
+    Cal_Assert(CalBddIsForwarded(f00) == 0);
+    Cal_Assert(CalBddIsForwarded(f01) == 0);
+
+    if (CalBddIsEqual(f10,f00)) {
+      newF0 = f00;
+      f0Found = 1;
+    }
+    else {
+      f0Found = CalUniqueTableForIdFindOrAdd(bddManager, uniqueTableForId, f10,
+                                             f00, &newF0);
+    }
+    CalBddIcrRefCount(newF0);
+    if (CalBddIsEqual(f11, f01)) {
+      newF1 = f01;
+      f1Found = 1;
+    }
+    else {
+      f1Found = CalUniqueTableForIdFindOrAdd(bddManager, uniqueTableForId, f11,
+                                             f01, &newF1);
+    }
+    CalBddIcrRefCount(newF1);
+
+    if (!f0Found){
+      CalBddIcrRefCount(f10);
+      CalBddIcrRefCount(f00);
+    }
+
+    if (!f1Found){
+      CalBddIcrRefCount(f11);
+      CalBddIcrRefCount(f01);
+    }
+
+    CalBddDcrRefCount(f0);
+    CalBddDcrRefCount(f1);
+    /*
+     * Create the new node for f. It cannot exist before, since at
+     * least one of newF0 and newF1 must be dependent on currentIndex.
+     * Otherwise, f00 == f10 and f01 == f11 (redundant nodes).
+     */
+    CalHashTableAddDirectAux(nextUniqueTableForId, newF1, newF0, &newF);
+    bddManager->numNodes++;
+    CalBddNodePutThenBdd(bddNode, newF);
+    CalBddNodePutElseBddNode(bddNode, FORWARD_FLAG);
+    bddManager->numForwardedNodes++;
+    CalBddNodeGetRefCount(bddNode, refCount);
+    CalBddAddRefCount(newF, refCount);
+    Cal_Assert(!CalBddIsRefCountZero(newF));
+    /* Put it in the forwarded list of the unique table */
+    /*
+    endNode->nextBddNode = bddNode;
+    endNode = bddNode;
+    */
+    bddNode->nextBddNode = startNode;
+    startNode = bddNode;
+    
+    bddNode = nextBddNode;
+  }
+  /*uniqueTableForId->endNode = endNode;*/
+  uniqueTableForId->startNode.nextBddNode = startNode;
+
+  BddReorderFreeNodes(bddManager, nextVarId);
+  
+  }
+  else{
+    bddManager->numTrivialSwaps++;
+  }
+  
+  CalFixupAssoc(bddManager, varId, nextVarId, bddManager->tempAssociation);
+  for(assoc = bddManager->associationList; assoc; assoc = assoc->next){
+    CalFixupAssoc(bddManager, varId, nextVarId, assoc);
+  }
+
+  bddManager->idToIndex[varId] = varIndex + 1;
+  bddManager->idToIndex[nextVarId] = varIndex;
+  bddManager->indexToId[varIndex] = nextVarId;
+  bddManager->indexToId[varIndex + 1] = varId;
+
+  Cal_Assert(CalCheckAssoc(bddManager));
+
+#ifdef _CAL_VERBOSE
+  /*fprintf(stdout,"Variable order after swap:\n");*/
+  for (i=0; i<bddManager->numVars; i++){
+    fprintf(stdout, "%3d ", bddManager->indexToId[i]);
+  }
+  fprintf(stdout, "%8d\n", bddManager->numNodes);
+#endif
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+CofactorFixAndReclaimForwardedNodes(Cal_BddManager_t *bddManager, int
+                                       cofactorCheckStartIndex, int
+                                       cofactorCheckEndIndex, int
+                                       reclaimStartIndex, int reclaimEndIndex)
+{
+  int index, varId;
+  /* Clean up : Need to fix the cofactors of userBDDs and the
+     indices above the varStartIndex only. */
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodes(bddManager);
+  }
+  CalBddReorderFixUserBddPtrs(bddManager);
+  CalReorderAssociationFix(bddManager);
+  for (index = cofactorCheckStartIndex;
+       index <= cofactorCheckEndIndex; index++){ 
+    varId = bddManager->indexToId[index];
+    CalBddReorderFixCofactors(bddManager, varId);
+  }
+  CalBddReorderReclaimForwardedNodes(bddManager, reclaimStartIndex,
+                                     reclaimEndIndex);
+  Cal_Assert(CalCheckAllValidity(bddManager));
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddReorderFreeNodes(Cal_BddManager_t * bddManager, int varId)
+{
+  CalBddNode_t *prevNode, *bddNode, *nextBddNode;
+  CalBddNode_t *elseBddNode;
+  CalBddNode_t *thenBddNode;
+  CalHashTable_t *uniqueTableForId;
+  CalBddNode_t **bins;
+  int numBins;
+  int i;
+  long oldNumEntries, numNodesFreed;
+
+  uniqueTableForId = bddManager->uniqueTable[varId];
+  bins = uniqueTableForId->bins;
+  numBins = uniqueTableForId->numBins;
+  oldNumEntries = uniqueTableForId->numEntries;
+
+  if (bddManager->numPeakNodes < (bddManager->numNodes +
+                                  bddManager->numForwardedNodes)){
+    bddManager->numPeakNodes = bddManager->numNodes +
+        bddManager->numForwardedNodes ;
+  }
+  
+  for(i = 0; i < numBins; i++){
+    prevNode = NULL;
+    bddNode = bins[i];
+    while(bddNode != Cal_Nil(CalBddNode_t)){
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      Cal_Assert(CalBddNodeIsForwarded(bddNode) == 0);
+      if(CalBddNodeIsRefCountZero(bddNode)){
+        thenBddNode = CAL_BDD_POINTER(CalBddNodeGetThenBddNode(bddNode));
+        elseBddNode = CAL_BDD_POINTER(CalBddNodeGetElseBddNode(bddNode));
+        Cal_Assert(CalBddNodeIsForwarded(thenBddNode) == 0);
+        Cal_Assert(CalBddNodeIsForwarded(elseBddNode) == 0);
+        CalBddNodeDcrRefCount(thenBddNode);
+        CalBddNodeDcrRefCount(elseBddNode);
+        if (prevNode == NULL) {
+          bins[i] = nextBddNode;
+        } else {
+          CalBddNodePutNextBddNode(prevNode, nextBddNode);
+        }
+        CalNodeManagerFreeNode(uniqueTableForId->nodeManager, bddNode);
+        uniqueTableForId->numEntries--;
+      } else {
+        prevNode = bddNode;
+      }
+      bddNode = nextBddNode;
+    }
+  }
+  numNodesFreed = oldNumEntries - uniqueTableForId->numEntries;
+  bddManager->numNodes -= numNodesFreed;
+  bddManager->numNodesFreed += numNodesFreed;
+}
+
+#ifdef _CAL_VERBOSE
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+PrintBddProfileAfterReorder(Cal_BddManager_t *bddManager)
+{
+    int i, index, numBins, j;
+    CalHashTable_t *uniqueTableForId;
+    CalBddNode_t *bddNode, *nextBddNode;
+    char *levels = Cal_MemAlloc(char, bddManager->numVars+1);
+    CalBddNode_t *requestNodeList;
+    Cal_Bdd_t thenBdd, elseBdd;
+    
+  /* Now traverse all the nodes in order */
+    for (index = 0; index < bddManager->numVars; index++){
+      fprintf(stdout,"**** %3d ****\n", bddManager->indexToId[index]);  
+      uniqueTableForId = bddManager->uniqueTable[bddManager->indexToId[index]];
+      numBins = uniqueTableForId->numBins;
+      for (i=1; i<=bddManager->numVars; i++) {
+          levels[i] = 0;
+      }
+      j = 0;
+      for (i = 0; i < numBins; i++){
+          for (bddNode = uniqueTableForId->bins[i]; bddNode;
+               bddNode = nextBddNode){
+              nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+              CalBddNodeGetThenBdd(bddNode, thenBdd);
+              CalBddNodeGetElseBdd(bddNode, elseBdd);
+              if (CalBddIsForwarded(thenBdd) ||
+                  CalBddIsForwarded(elseBdd)){                       
+                j++;
+              }
+              if (CalBddIsForwarded(thenBdd)) {                      
+                  levels[CalBddGetThenBddId(thenBdd)]++;
+              }
+              if (CalBddIsForwarded(elseBdd)) {                      
+                  levels[CalBddGetThenBddId(elseBdd)]++;
+              }
+          }
+      }
+      fprintf(stdout,"\tCofactors (%3d): ", j);
+      for (i=1; i<=bddManager->numVars; i++){
+          if (levels[i]) {
+              fprintf(stdout,"%3d->%3d ", i, levels[i]);
+          }
+      }
+      fprintf(stdout,"\n");
+      for (i=1; i<=bddManager->numVars; i++) {
+          levels[i] = 0;
+      }
+      j = 0;
+      requestNodeList = uniqueTableForId->startNode.nextBddNode;
+      for (bddNode = requestNodeList; bddNode; bddNode = nextBddNode){
+          Cal_Assert(CalBddNodeIsForwarded(bddNode));
+          nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+          CalBddNodeGetThenBdd(bddNode, thenBdd);
+          Cal_Assert(!CalBddIsForwarded(thenBdd));
+          levels[CalBddGetBddId(thenBdd)]++;
+          j++;
+      }
+      fprintf(stdout,"\tForwarded nodes (%3d): ", j);
+      for (i=1; i<=bddManager->numVars; i++){
+          if (levels[i]) {
+              fprintf(stdout,"%3d->%3d ", i, levels[i]);
+          }
+      }
+      fprintf(stdout,"\n");
+    }
+    Cal_MemFree(levels);
+}
+#endif
+
+/**Function********************************************************************
+
+  Synopsis    [Reorder variables using "sift" algorithm.]
+
+  Description [Reorder variables using "sift" algorithm.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static void
+BddReorderVarSift(Cal_BddManager bddManager, double maxSizeFactor)
+{
+  int i,j;
+  int mostNodesId = -1;
+  long mostNodes, varNodes;
+  int *idArray;
+  long numVarsShifted = 0;
+  bddManager->numSwaps = 0;
+  
+  idArray = Cal_MemAlloc(int, bddManager->numVars);
+  for (i = 0; i < bddManager->numVars; i++) {
+    idArray[i] = bddManager->indexToId[i];
+  }
+
+  while (i &&
+         (numVarsShifted <=
+          bddManager->maxNumVarsSiftedPerReordering) &&
+         (bddManager->numSwaps <=
+          bddManager->maxNumSwapsPerReordering)){ 
+    i--;
+    numVarsShifted++;
+/*
+ * Find var with the most number of nodes and do sifting on it.
+ * idArray is used to make sure that a var is not sifted more than
+ * once.
+ */
+    mostNodes = 0;
+    for (j = 0; j <= i; j++){
+      varNodes = bddManager->uniqueTable[idArray[j]]->numEntries;
+      if (varNodes > mostNodes) {
+        mostNodes = varNodes;
+        mostNodesId = j;
+      }
+    }
+ 
+    if (mostNodes <= 1) { /* I can put a different stopping criterion */
+      /*
+       * Most number of nodes among the vars not sifted yet is 0. Stop.
+       */
+      break;
+    }
+
+    BddReorderSiftToBestPos(bddManager,
+                            bddManager->idToIndex[idArray[mostNodesId]],
+                            maxSizeFactor); 
+    Cal_Assert(CalCheckAllValidity(bddManager));
+    idArray[mostNodesId] = idArray[i];
+  }
+
+  Cal_MemFree(idArray);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+BddReorderSiftToBestPos(Cal_BddManager_t * bddManager, int
+                        varStartIndex, double maxSizeFactor)
+{
+  long curSize;
+  long bestSize;
+  int bestIndex;
+  int varCurIndex;
+  int varId, i;
+  int lastIndex = bddManager->numVars - 1;
+  int numVars = bddManager->numVars;
+  long startSize = bddManager->numNodes;
+  long maxSize =  startSize * maxSizeFactor;
+  int origId = bddManager->indexToId[varStartIndex];
+
+  int topMostSwapIndex = 0; /* the variable has been swapped upto this
+                               index */
+  int bottomMostSwapIndex = lastIndex; /* the variable has been
+                                          swapped upto this index */
+
+  int swapFlag = 0; /* If a swap has taken place after last cleaning
+                       up */
+                       
+  
+  curSize = bestSize = bddManager->numNodes;
+  bestIndex = varStartIndex;
+
+#ifdef _CAL_VERBOSE
+  for (i=0; i<bddManager->numVars; i++){
+    fprintf(stdout, "%3d ", bddManager->indexToId[i]);
+  }
+  fprintf(stdout, "%8d\n", bddManager->numNodes);
+#endif
+  
+  /*
+  ** If varStartIndex > numVars/2, do: Down, Up, Down.
+  ** If varStartIndex < numVars/2, do: Up, Down, Up
+  ** Followed by a cleanup phase in either case.
+  */
+  
+  if (varStartIndex >= (numVars >> 1)){
+    /* Phase I: Downward swap, no forwarding check. */
+    varCurIndex = varStartIndex;
+    while (varCurIndex < lastIndex) {
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 0);
+      swapFlag = 1;
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex+1,
+                                               varCurIndex+1); 
+        swapFlag = 0;
+      }
+      varCurIndex++;
+      curSize = bddManager->numNodes;
+      /*if (curSize > maxSize){*/
+      if (curSize >= (bestSize << 1)){
+        bottomMostSwapIndex = varCurIndex;
+        break;
+      }
+      if (curSize < bestSize) {
+        bestSize = curSize;
+        bestIndex = varCurIndex;
+      }
+    }
+    
+    /* Phase II : Two parts */
+    /*
+    ** Part One: Upward swap until varStartIndex. Fix cofactors and
+    ** fix double pointers. 
+    */
+    
+    while (varCurIndex > varStartIndex) {
+      varCurIndex--;
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 1);
+      swapFlag = 1;
+      varId = bddManager->indexToId[varCurIndex];
+      BddReorderFixForwardingNodes(bddManager, varId);
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex,
+                                               bottomMostSwapIndex); 
+        swapFlag = 0;
+      }
+    }
+    curSize = startSize;
+    
+    /*
+    ** Part two: Upward swap all the way to the top. Fix cofactors.
+    */
+    while (varCurIndex > 0) {
+      varCurIndex--;
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 1);
+      swapFlag = 1;
+      curSize = bddManager->numNodes;
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex,
+                                               bottomMostSwapIndex); 
+        swapFlag = 0;
+      }
+      if (curSize > maxSize){
+        topMostSwapIndex = varCurIndex;
+        break;
+      }
+      if (curSize <= bestSize) {
+        bestSize = curSize;
+        bestIndex = varCurIndex;
+      }
+    }
+
+    if (swapFlag){
+      /* Fix user BDD pointers and reclaim forwarding nodes */
+      if (bddManager->pipelineState == CREATE){
+        /* There are some results computed in pipeline */
+        CalBddReorderFixProvisionalNodes(bddManager);
+      }
+      CalBddReorderFixUserBddPtrs(bddManager);
+      CalReorderAssociationFix(bddManager);
+      
+      /* The upward swapping might have stopped short */
+      for (i = 0; i < topMostSwapIndex; i++){
+        varId = bddManager->indexToId[i];
+        CalBddReorderFixCofactors(bddManager, varId);
+      }
+      
+      CalBddReorderReclaimForwardedNodes(bddManager, topMostSwapIndex,
+                                         bottomMostSwapIndex);
+      swapFlag = 0;
+    }
+    
+    Cal_Assert(CalCheckAllValidity(bddManager));
+    
+    /* Phase III : Swap to the min position */
+
+    while (varCurIndex < bestIndex) {
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 0); 
+      swapFlag = 1;
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex+1,
+                                               varCurIndex+1); 
+        swapFlag = 0;
+      }
+      varCurIndex++;
+    }
+  }
+  else{
+    /* Phase I: Upward swap, fix cofactors. */
+    varCurIndex = varStartIndex;
+    while (varCurIndex > 0) {
+      varCurIndex--;
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 1);
+      swapFlag = 1;
+      curSize = bddManager->numNodes;
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex+1,
+                                               varStartIndex); 
+        swapFlag = 0;
+      }
+      if (curSize > maxSize){
+        topMostSwapIndex = varCurIndex;
+        break;
+      }
+      if (curSize < bestSize) {
+        bestSize = curSize;
+        bestIndex = varCurIndex;
+      }
+    }
+    
+    if (swapFlag){
+      /* Fix user BDD pointers and reclaim forwarding nodes */
+      if (bddManager->pipelineState == CREATE){
+        /* There are some results computed in pipeline */
+        CalBddReorderFixProvisionalNodes(bddManager);
+      }
+      CalBddReorderFixUserBddPtrs(bddManager);
+      CalReorderAssociationFix(bddManager);
+      /* The upward swapping might have stopped short */
+      for (i = 0; i < topMostSwapIndex; i++){
+        varId = bddManager->indexToId[i];
+        CalBddReorderFixCofactors(bddManager, varId);
+      }
+      CalBddReorderReclaimForwardedNodes(bddManager, topMostSwapIndex,
+                                         varStartIndex);
+      swapFlag = 0;
+    }
+    
+    Cal_Assert(CalCheckAllValidity(bddManager));
+
+    /* Phase II : Move all the way down : two parts */
+
+    /* Swap it to the original position, no cofactor fixing, fix
+       double pointers of the variable moving up.*/
+    while (varCurIndex < varStartIndex){
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 0);
+      swapFlag = 1;
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex+1,
+                                               varCurIndex+1); 
+        swapFlag = 0;
+      }
+      varCurIndex++;
+    }
+    /* Swap to the bottom */
+    while (varCurIndex < lastIndex){
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 0);
+      swapFlag = 1;
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                               varCurIndex-1,
+                                               varCurIndex+1,
+                                               varCurIndex+1); 
+        swapFlag = 0;
+      }
+      varCurIndex++;
+      curSize = bddManager->numNodes;
+      /* if (curSize > maxSize){ */
+      if (curSize >= (bestSize << 1)){
+        bottomMostSwapIndex = varCurIndex;
+        break;
+      }
+      if (curSize <= bestSize) {
+        bestSize = curSize;
+        bestIndex = varCurIndex;
+      }
+    }
+
+    /* Phase III : Move up to the best position */
+    while (varCurIndex > bestIndex){
+      varCurIndex--;
+      BddReorderSwapVarIndex(bddManager, varCurIndex, 1);
+      swapFlag = 1;
+      varId = bddManager->indexToId[varCurIndex];
+      BddReorderFixForwardingNodes(bddManager, varId);
+      if (bddManager->numForwardedNodes > bddManager->maxForwardedNodes){
+        CofactorFixAndReclaimForwardedNodes(bddManager, 0, varCurIndex-1,
+                                               varCurIndex,
+                                               bottomMostSwapIndex); 
+        swapFlag = 0;
+      }
+    }
+  } /* End of else clause (varStartIndex < numVars/2) */
+
+#ifdef _CAL_VERBOSE
+  PrintBddProfileAfterReorder(bddManager);
+#endif
+  
+  if (CalBddIdNeedsRepacking(bddManager, origId)){
+    if (swapFlag){
+      if (varStartIndex >= (numVars >> 1)){
+        CalBddPackNodesAfterReorderForSingleId(bddManager, 0,
+                                               bestIndex, bestIndex); 
+      }
+      /*
+      else if (bestIndex >= (numVars >> 1)){
+        int i;
+        int nodeCounter = 0;
+        for (i=bestIndex; i<numVars; i++){
+          nodeCounter +=
+              bddManager->uniqueTable[bddManager->indexToId[i]]->numEntries;
+        }
+        if ((bddManager->numNodes - nodeCounter) >
+            bddManager->numForwardedNodes){
+            BddPackNodesAfterReorderForSingleId(bddManager, 1, bestIndex,
+                                                 bottomMostSwapIndex);
+        }
+        else {
+          BddSiftPerfromPhaseIV(bddManager, varStartIndex, bestIndex,
+                                bottomMostSwapIndex);
+          BddPackNodesAfterReorderForSingleId(bddManager, 0,
+                                                 bestIndex, bestIndex); 
+        }
+      }
+      */
+      else {
+        /* Clean up - phase IV */
+        BddSiftPerfromPhaseIV(bddManager, varStartIndex, bestIndex,
+                              bottomMostSwapIndex);
+        CalBddPackNodesAfterReorderForSingleId(bddManager, 0,
+                                               bestIndex, bestIndex); 
+      }
+    }
+    else {
+      CalBddPackNodesAfterReorderForSingleId(bddManager, 0, bestIndex,
+                                             bestIndex); 
+    }
+  }
+  else if (swapFlag) {
+    /* clean up - phase IV */
+    BddSiftPerfromPhaseIV(bddManager, varStartIndex, bestIndex,
+                          bottomMostSwapIndex);
+  }
+  Cal_Assert(CalCheckAllValidity(bddManager));
+  
+#ifdef _CAL_VERBOSE
+  printf("ID = %3d SI = %3d EI = %3d Nodes = %7d\n", origId,
+         varStartIndex, bestIndex, bddManager->numNodes);
+#endif
+  return bestIndex;
+}
+
+  
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+BddSiftPerfromPhaseIV(Cal_BddManager_t *bddManager, int varStartIndex,
+                      int bestIndex, int bottomMostSwapIndex)
+{
+  int varCurIndex, varId;
+  
+
+/* We need to perform phase IV */
+  varCurIndex = bestIndex-1;
+  while (varCurIndex >= 0) {
+    varId = bddManager->indexToId[varCurIndex];
+    CalBddReorderFixCofactors(bddManager, varId);
+    varCurIndex--;
+  }
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodes(bddManager);
+  }
+  CalBddReorderFixUserBddPtrs(bddManager);
+  CalReorderAssociationFix(bddManager);
+  if (varStartIndex >= (bddManager->numVars >> 1)){
+    CalBddReorderReclaimForwardedNodes(bddManager, bestIndex, bestIndex);
+  }
+  else {
+    CalBddReorderReclaimForwardedNodes(bddManager, bestIndex,
+                                       bottomMostSwapIndex); 
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReorderVarWindow(Cal_BddManager bddManager, char *levels)
+{
+  long i;
+  int moved;
+  int anySwapped;
+  int even;
+  int lastIndex = bddManager->numVars-1;
+  
+#ifdef _CAL_VERBOSE
+  for (i=0; i<bddManager->numVars; i++){
+    fprintf(stdout, "%3d ", bddManager->indexToId[i]);
+  }
+  fprintf(stdout, "%8d\n", bddManager->numNodes);
+#endif
+  for (i=0; i < bddManager->numVars-1; i++) levels[i]=1;
+  even = 1;
+  do {
+    anySwapped=0;
+    if (even){
+      /*fprintf(stdout, "Downward Swap\n");*/
+      for (i=0; i < bddManager->numVars-1; i++){
+        if (levels[i]) {
+          if (i < bddManager->numVars-2) {
+            moved = BddReorderWindow3(bddManager, i, 0);
+            if (bddManager->numForwardedNodes >
+                bddManager->maxForwardedNodes){   
+              CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                                     i-1, 0, i+2);
+              CalBddPackNodesForMultipleIds(bddManager,
+                                         bddManager->indexToId[i], 3);
+            }
+          }
+          else {
+            moved = BddReorderWindow2(bddManager, i, 0);
+          }
+          if (moved){
+            if (i > 0) {
+              levels[i-1]=1;
+              if (i > 1) levels[i-2]=1;
+            }
+            levels[i]=1;
+            levels[i+1]=1;
+            if (i < bddManager->numVars-2) {
+              levels[i+2]=1;
+              if (i < bddManager->numVars-3) {
+                levels[i+3]=1;
+                if (i < bddManager->numVars-4) levels[i+4]=1;
+              }
+            }
+            anySwapped=1;
+          }
+          else {
+            levels[i]=0;
+          }
+        }
+      }
+      /* new code added */
+      for (i = bddManager->numVars-1; i >= 0; i--){
+        CalBddReorderFixCofactors(bddManager, bddManager->indexToId[i]);
+      }
+      CalBddReorderFixUserBddPtrs(bddManager);
+      if (bddManager->pipelineState == CREATE){
+        /* There are some results computed in pipeline */
+        CalBddReorderFixProvisionalNodes(bddManager);
+      }
+      CalReorderAssociationFix(bddManager);
+      CalBddReorderReclaimForwardedNodes(bddManager, 0, lastIndex);
+      /*even = 0;*/
+    }
+    else{
+      /*fprintf(stdout, "Upward Swap\n");*/
+      for (i=bddManager->numVars-1; i > 0; i--){
+          /*
+           * Fix the then and else cofactors. We need to fix it, even
+           * if this level is not supposed to be moved.
+           */
+        if (i > 1) {
+          CalBddReorderFixCofactors(bddManager,
+                                 bddManager->indexToId[i-2]); 
+        }
+        else {
+          CalBddReorderFixCofactors(bddManager,
+                                 bddManager->indexToId[i-1]); 
+        }
+        if (levels[i]) {
+          if (i > 1) {
+            moved = BddReorderWindow3(bddManager, i-2, 1);
+            if (bddManager->numForwardedNodes >
+                bddManager->maxForwardedNodes){ 
+              CofactorFixAndReclaimForwardedNodes(bddManager, 0,
+                                                  i-3, 0,
+                                                  lastIndex); 
+              CalBddPackNodesForMultipleIds(bddManager,
+                                            bddManager->indexToId[i-2], 3);
+            }
+          }
+          else {
+            moved = BddReorderWindow2(bddManager, i-1, 1);
+          }
+          if (moved){
+            if (i < bddManager->numVars-1) {
+              levels[i+1]=1;
+              if (i < bddManager->numVars-2) {
+                levels[i+2]=1;
+                if (i < bddManager->numVars-3) {
+                  levels[i+3]=1;
+                  if (i < bddManager->numVars-4) {
+                    levels[i+4]=1;
+                  }
+                }
+              }
+            }
+            levels[i]=1;
+            levels[i-1]=1;
+            if (i > 1) {
+              levels[i-2]=1;
+            }
+            anySwapped=1;
+          }
+          else {
+            levels[i]=0;
+          }
+        }
+      }
+      even = 1;
+      CalBddReorderFixUserBddPtrs(bddManager);
+      if (bddManager->pipelineState == CREATE){
+        /* There are some results computed in pipeline */
+        CalBddReorderFixProvisionalNodes(bddManager);
+      }
+      CalReorderAssociationFix(bddManager);
+      CalBddReorderReclaimForwardedNodes(bddManager, 0, lastIndex);
+    }
+  }
+  while (anySwapped);
+  if (!even){ /* Need to do pointer fixing */
+    for (i = bddManager->numVars-1; i >= 0; i--){
+      CalBddReorderFixCofactors(bddManager, bddManager->indexToId[i]);
+    }
+    CalBddReorderFixUserBddPtrs(bddManager);
+    if (bddManager->pipelineState == CREATE){
+      /* There are some results computed in pipeline */
+      CalBddReorderFixProvisionalNodes(bddManager);
+    }
+    CalReorderAssociationFix(bddManager);
+    CalBddReorderReclaimForwardedNodes(bddManager, 0, lastIndex);
+  }
+  Cal_Assert(CalCheckAllValidity(bddManager));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+BddReorderWindow2(Cal_BddManager bddManager, long index, int directionFlag)
+{
+  long curSize, startSize;
+
+  startSize = bddManager->numNodes;
+  BddReorderSwapVarIndex(bddManager, index, 0);
+  curSize = bddManager->numNodes;
+  if (curSize > startSize){
+    BddReorderSwapVarIndex(bddManager, index, 0);
+  }
+  if (directionFlag){/* Upward window swap */
+    BddReorderFixAndFreeForwardingNodes(bddManager,
+                                        bddManager->indexToId[index],
+                                        bddManager->numVars-index); 
+  }
+  else{
+    BddReorderFixAndFreeForwardingNodes(bddManager,
+                                        bddManager->indexToId[index], 2);
+  }
+  Cal_Assert(CalCheckValidityOfNodesForWindow(bddManager, index, 2));
+  return (curSize < startSize);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+BddReorderWindow3(Cal_BddManager bddManager, long index, int directionFlag)
+{
+  int best;
+  long curSize, bestSize;
+  long origSize = bddManager->numNodes;
+  
+  /* 1 2 3 */
+  best = 0;
+  bestSize = bddManager->numNodes;
+  BddReorderSwapVarIndex(bddManager, index, 0); 
+  /* 2 1 3 */
+  curSize = bddManager->numNodes;
+  if (curSize < bestSize){
+    best = 1;
+    bestSize = curSize;
+  }
+  BddReorderSwapVarIndex(bddManager, index+1, 0);
+  /* 2 3 1 */
+  curSize = bddManager->numNodes;
+  if (curSize < bestSize){
+    best = 2;
+    bestSize = curSize;
+  }
+  BddReorderSwapVarIndex(bddManager, index, 1);
+  /* 3 2 1 */
+  curSize = bddManager->numNodes;
+  if (curSize <= bestSize){
+    best = 3;
+    bestSize = curSize;
+  }
+  BddReorderSwapVarIndex(bddManager, index+1, 0);
+  /* 3 1 2 */
+  curSize = bddManager->numNodes;
+  if (curSize <= bestSize){
+    best = 4;
+    bestSize = curSize;
+  }
+  BddReorderSwapVarIndex(bddManager, index, 1);
+  /* 1 3 2 */
+  curSize = bddManager->numNodes;
+  if (curSize <= bestSize){
+    best = 5;
+    bestSize = curSize;
+  }
+  switch (best) {
+    case 0:
+      BddReorderSwapVarIndex(bddManager, index+1, 0);
+      break;
+    case 1:
+      BddReorderSwapVarIndex(bddManager, index+1, 0);
+      BddReorderSwapVarIndex(bddManager, index, 1);
+      break;
+    case 2:
+      BddReorderSwapVarIndex(bddManager, index, 0);
+      BddReorderSwapVarIndex(bddManager, index+1, 0);
+      BddReorderSwapVarIndex(bddManager, index, 1);
+      break;
+    case 3:
+      BddReorderSwapVarIndex(bddManager, index, 0);
+      BddReorderSwapVarIndex(bddManager, index+1, 0);
+      break;
+    case 4:
+      BddReorderSwapVarIndex(bddManager, index, 0);
+      break;
+    case 5:
+      break;
+  }
+  if ((best == 0) || (best == 3)){
+    CalBddReorderFixCofactors(bddManager, bddManager->indexToId[index]);
+  }
+  if (directionFlag){/* Upward window swap */
+    BddReorderFixAndFreeForwardingNodes(bddManager,
+                                        bddManager->indexToId[index],
+                                        bddManager->numVars-index); 
+  }
+  else{
+    BddReorderFixAndFreeForwardingNodes(bddManager,
+                                        bddManager->indexToId[index], 3);
+  }
+  Cal_Assert(CalCheckValidityOfNodesForWindow(bddManager, index, 3));
+  return ((best > 0) && (origSize > bestSize));
+}
+
Index: /vis_dev/glu-2.1/src/calBdd/calReorderDF.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calReorderDF.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calReorderDF.c	(revision 6)
@@ -0,0 +1,1584 @@
+/**CFile***********************************************************************
+
+  FileName    [calReorderDF.c]
+
+  PackageName [cal]
+
+  Synopsis    [Routines for dynamic reordering of variables.]
+
+  Description [This method is based on traditional dynamic reordering
+  technique found in depth-first based packages. The data structure is
+  first converted to conform to traditional one and then reordering is
+  performed. At the end the nodes are arranged back on the pages. The
+  computational overheads are in terms of converting the data
+  structure back and forth and the memory overhead due to the extra
+  space needed to arrange the nodes. This overhead can be eliminated
+  by proper implementation. For details, please refer to the work by
+  Rajeev K. Ranjan et al - "Dynamic variable reordering in a
+  breadth-first manipulation based package: Challenges and Solutions"-
+  Proceedings of ICCD'97.]
+
+  SeeAlso     [calReorderBF.c calReorderUtil.c]
+
+  Author      [Rajeev K. Ranjan   (rajeev@@ic. eecs.berkeley.edu)]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static   CalNodeManager_t *nodeManager; 
+static   int freeListId;
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+/* These macros are needed because we are dealing with a new data
+   structures of the BDD nodes */
+
+#define BddNodeIcrRefCount(f)                   \
+{                                               \
+  CalBddNode_t *_bddNode = CAL_BDD_POINTER(f);  \
+  if (_bddNode->elseBddId < CAL_MAX_REF_COUNT){ \
+    _bddNode->elseBddId++;                      \
+  }                                             \
+}
+
+#define BddNodeDcrRefCount(f) \
+{ \
+  CalBddNode_t *_bddNode = CAL_BDD_POINTER(f); \
+  if ((_bddNode->elseBddId < CAL_MAX_REF_COUNT) && (_bddNode->elseBddId)){ \
+    _bddNode->elseBddId--; \
+  } \
+  else if (_bddNode->elseBddId == 0){ \
+    CalBddWarningMessage("Trying to decrement reference count below zero"); \
+  } \
+}
+
+#define BddGetCofactors(bddManager, f, id, fThen, fElse)                \
+{                                                                       \
+  CalBddNode_t *_bddNode = CAL_BDD_POINTER(f);                          \
+  Cal_Assert(bddManager->idToIndex[_bddNode->thenBddId] <=              \
+             bddManager->idToIndex[id]);                                \
+  if (bddManager->idToIndex[_bddNode->thenBddId] ==                     \
+      bddManager->idToIndex[id]){                                       \
+    fThen = _bddNode->thenBddNode;                                      \
+    fElse = _bddNode->elseBddNode;                                      \
+  }                                                                     \
+  else{                                                                 \
+    fThen = fElse = f;                                                  \
+  }                                                                     \
+}
+
+#define BddNodeGetThenBddNode(bddNode)                    \
+((CalBddNode_t*) ((CalAddress_t)                          \
+                  (CAL_BDD_POINTER(bddNode)->thenBddNode) \
+                  ^ (CAL_TAG0(bddNode))))
+
+#define BddNodeGetElseBddNode(bddNode)                    \
+((CalBddNode_t*) ((CalAddress_t)                          \
+                  (CAL_BDD_POINTER(bddNode)->elseBddNode) \
+                  ^ (CAL_TAG0(bddNode))))
+  
+    
+    
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int UniqueTableForIdFindOrAdd(Cal_BddManager_t * bddManager, CalHashTable_t * hashTable, CalBddNode_t *thenBdd, CalBddNode_t *elseBdd, CalBddNode_t **bddPtr);
+static void HashTableAddDirect(CalHashTable_t * hashTable, CalBddNode_t *bddNode);
+static int HashTableFindOrAdd(Cal_BddManager_t *bddManager, CalHashTable_t *hashTable, CalBddNode_t *thenBdd, CalBddNode_t *elseBdd, CalBddNode_t **bddPtr);
+static void BddConvertDataStruct(Cal_BddManager_t *bddManager);
+static void BddConvertDataStructBack(Cal_BddManager_t *bddManager);
+static void BddReallocateNodes(Cal_BddManager_t *bddManager);
+static void BddExchangeAux(Cal_BddManager_t *bddManager, CalBddNode_t *f, int id, int nextId);
+static int CheckValidityOfNodes(Cal_BddManager_t *bddManager, long id);
+static void SweepVarTable(Cal_BddManager_t *bddManager, long id);
+static void BddExchange(Cal_BddManager_t *bddManager, long id);
+static void BddExchangeVarBlocks(Cal_BddManager_t *bddManager, Cal_Block parent, long blockIndex);
+static int BddReorderWindow2(Cal_BddManager_t *bddManager, Cal_Block block, long i);
+static int BddReorderWindow3(Cal_BddManager_t *bddManager, Cal_Block block, long i);
+static void BddReorderStableWindow3Aux(Cal_BddManager_t *bddManager, Cal_Block block, char *levels);
+static void BddReorderStableWindow3(Cal_BddManager_t *bddManager);
+static void BddSiftBlock(Cal_BddManager_t *bddManager, Cal_Block block, long startPosition, double maxSizeFactor);
+static void BddReorderSiftAux(Cal_BddManager_t *bddManager, Cal_Block block, Cal_Block *toSift, double maxSizeFactor);
+static void BddReorderSift(Cal_BddManager_t *bddManager, double maxSizeFactor);
+static int CeilLog2(int number);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddReorderAuxDF(Cal_BddManager_t *bddManager)
+{
+  CalHashTableGC(bddManager, bddManager->uniqueTable[0]);
+  /*Cal_BddManagerGC(bddManager);Cal_Assert(CalCheckAllValidity(bddManager));*/
+  /* If we want to check the validity, we need to garbage collect */
+  CalInitInteract(bddManager); /* Initialize the interaction matrix
+                                  before changing the data structure */
+  nodeManager = CalNodeManagerInit(bddManager->pageManager2);
+  freeListId = 1;
+#ifdef _CAL_QUANTIFY_
+  quantify_start_recording_data();
+#endif
+  BddConvertDataStruct(bddManager);
+  if (bddManager->reorderTechnique == CAL_REORDER_WINDOW){
+    BddReorderStableWindow3(bddManager);
+  }
+  else {
+    BddReorderSift(bddManager, bddManager->maxSiftingGrowth);
+  }
+  BddReallocateNodes(bddManager);
+  BddConvertDataStructBack(bddManager);
+#ifdef _CAL_QUANTIFY_
+  quantify_stop_recording_data();
+#endif
+  nodeManager->numPages = 0; /* Since these pages have already been
+                                freed */
+  CalNodeManagerQuit(nodeManager);
+  Cal_Assert(CalCheckAllValidity(bddManager));
+  Cal_MemFree(bddManager->interact);
+  bddManager->numReorderings++;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                          */
+/*---------------------------------------------------------------------------*/
+static void
+NodeManagerAllocNode(Cal_BddManager_t *bddManager, CalBddNode_t **nodePtr) 
+{
+  /* First check the free list of bddManager */
+  if (nodeManager->freeNodeList){
+    *nodePtr = nodeManager->freeNodeList;
+    nodeManager->freeNodeList =
+        ((CalBddNode_t *)(*nodePtr))->nextBddNode;
+  }
+  else{
+    if (freeListId < bddManager->numVars){
+      /* Find the next id with free list */
+      for (; freeListId <= bddManager->numVars; freeListId++){
+        CalNodeManager_t *nodeManagerForId =
+            bddManager->nodeManagerArray[freeListId]; 
+        if (nodeManagerForId->freeNodeList){
+          *nodePtr = nodeManagerForId->freeNodeList;
+          nodeManagerForId->freeNodeList = (CalBddNode_t *)0;
+          nodeManager->freeNodeList =
+              ((CalBddNode_t *)(*nodePtr))->nextBddNode;
+          break;
+        }
+      }
+    }
+  }
+  if (!(*nodePtr)){
+    /* Create a new page */
+    CalBddNode_t *_freeNodeList, *_nextNode, *_node;                        
+    _freeNodeList =                                                         
+        (CalBddNode_t *)CalPageManagerAllocPage(nodeManager->pageManager);  
+    for(_node = _freeNodeList + NUM_NODES_PER_PAGE - 1, _nextNode =0;       
+        _node != _freeNodeList; _nextNode = _node--){                       
+      _node->nextBddNode = _nextNode;                                       
+    }                                                                       
+    nodeManager->freeNodeList = _freeNodeList + 1;                          
+    *nodePtr = _node;
+    if (nodeManager->numPages == nodeManager->maxNumPages){             
+      nodeManager->maxNumPages *= 2;                                      
+      nodeManager->pageList =                                            
+          Cal_MemRealloc(CalAddress_t *, nodeManager->pageList, 
+                         nodeManager->maxNumPages);                       
+    }                                                                       
+    nodeManager->pageList[nodeManager->numPages++] =
+        (CalAddress_t *)_freeNodeList;     
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [find or add in the unique table for id.]
+
+  Description [optional]
+
+  SideEffects [If a new BDD node is created (found == false), then the
+  numNodes field of the manager needs to be incremented.]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+UniqueTableForIdFindOrAdd(Cal_BddManager_t * bddManager,
+                          CalHashTable_t * hashTable,
+                          CalBddNode_t *thenBdd,
+                          CalBddNode_t *elseBdd,
+                          CalBddNode_t **bddPtr)
+{
+  int found = 0; 
+  if (thenBdd == elseBdd){
+    *bddPtr = thenBdd;
+    found = 1;
+  }
+  else if(CalBddNodeIsOutPos(thenBdd)){
+    found = HashTableFindOrAdd(bddManager, hashTable, thenBdd, elseBdd, bddPtr);
+  }
+  else{
+    found = HashTableFindOrAdd(bddManager, hashTable,
+                               CalBddNodeNot(thenBdd),
+                               CalBddNodeNot(elseBdd), bddPtr); 
+    *bddPtr = CalBddNodeNot(*bddPtr);
+  }
+  if (!found) bddManager->numNodes++;
+  return found;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Directly insert a BDD node in the hash table.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+HashTableAddDirect(CalHashTable_t * hashTable, CalBddNode_t *bddNode)
+{
+  int hashValue;
+  CalBddNode_t *thenBddNode, *elseBddNode;
+
+  hashTable->numEntries++;
+  if(hashTable->numEntries >= hashTable->maxCapacity){
+    CalHashTableRehash(hashTable, 1);
+  }
+  thenBddNode = bddNode->thenBddNode;
+  Cal_Assert(CalBddNodeIsOutPos(thenBddNode));
+  elseBddNode = bddNode->elseBddNode;
+  hashValue = CalDoHash2(thenBddNode, elseBddNode, hashTable);
+  bddNode->nextBddNode = hashTable->bins[hashValue];
+  hashTable->bins[hashValue] = bddNode;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static int
+HashTableFindOrAdd(Cal_BddManager_t *bddManager, CalHashTable_t
+                   *hashTable,  CalBddNode_t *thenBdd,
+                   CalBddNode_t *elseBdd, CalBddNode_t **bddPtr) 
+{
+  CalBddNode_t *ptr;
+  int hashValue;
+  
+  Cal_Assert(CalBddNodeIsOutPos(thenBdd));
+  hashValue = CalDoHash2(thenBdd, elseBdd, hashTable);
+  for (ptr = hashTable->bins[hashValue]; ptr; ptr = ptr->nextBddNode){
+    if ((ptr->thenBddNode == thenBdd) &&
+        (ptr->elseBddNode == elseBdd)){
+      *bddPtr = ptr;
+      return 1;
+    }
+  }
+  hashTable->numEntries++;
+  if(hashTable->numEntries > hashTable->maxCapacity){
+    CalHashTableRehash(hashTable,1);
+    hashValue = CalDoHash2(thenBdd, elseBdd, hashTable);
+  }
+
+  NodeManagerAllocNode(bddManager, &ptr);
+
+  ptr->thenBddNode = thenBdd;
+  ptr->elseBddNode = elseBdd;
+  ptr->nextBddNode = hashTable->bins[hashValue];
+  ptr->thenBddId = hashTable->bddId;
+  ptr->elseBddId = 0;
+  hashTable->bins[hashValue] = ptr;
+  *bddPtr = ptr;
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [Changes the data structure of the bdd nodes.]
+
+  Description        [New data structure: thenBddId -> id 
+                                          elseBddId -> ref count]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddConvertDataStruct(Cal_BddManager_t *bddManager)
+{
+  CalBddNode_t *bddNode, *thenBddNode, *elseBddNode,
+      *next = Cal_Nil(CalBddNode_t); 
+  CalBddNode_t *last;
+  long numBins;
+  int i, refCount, id, index;
+  long oldNumEntries;
+  CalHashTable_t *uniqueTableForId;
+
+  if (bddManager->numPeakNodes < bddManager->numNodes){
+    bddManager->numPeakNodes = bddManager->numNodes;
+  }
+
+  for(index = 0; index < bddManager->numVars; index++){
+    id = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[id];
+    oldNumEntries = uniqueTableForId->numEntries;
+    numBins = uniqueTableForId->numBins;
+    for(i = 0; i < numBins; i++){
+      last = NULL;
+      bddNode = uniqueTableForId->bins[i];
+      while(bddNode != Cal_Nil(CalBddNode_t)){
+        next = CalBddNodeGetNextBddNode(bddNode);
+        CalBddNodeGetRefCount(bddNode, refCount);
+        thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+        elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+        if(refCount == 0){
+          if (last == NULL){
+            uniqueTableForId->bins[i] = next;
+          }
+          else{
+            last->nextBddNode = next;
+          }
+          CalBddNodeDcrRefCount(CAL_BDD_POINTER(thenBddNode));
+          CalBddNodeDcrRefCount(CAL_BDD_POINTER(elseBddNode));
+          CalNodeManagerFreeNode(nodeManager, bddNode);
+          uniqueTableForId->numEntries--;
+        }
+        else {
+          bddNode->thenBddId = id;
+          bddNode->elseBddId = refCount;
+          bddNode->nextBddNode = next;
+          bddNode->thenBddNode = thenBddNode;
+          bddNode->elseBddNode = elseBddNode;
+          last = bddNode; 
+        }
+        bddNode = next;
+      }
+    }
+    if ((uniqueTableForId->numBins > uniqueTableForId->numEntries) &&
+        (uniqueTableForId->sizeIndex > HASH_TABLE_DEFAULT_SIZE_INDEX)){
+      CalHashTableRehash(uniqueTableForId, 0);
+    }
+    bddManager->numNodes -= oldNumEntries - uniqueTableForId->numEntries;
+    bddManager->numNodesFreed += oldNumEntries - uniqueTableForId->numEntries;
+  }
+  id = 0;
+  uniqueTableForId = bddManager->uniqueTable[id];
+  numBins = uniqueTableForId->numBins;
+  for(i = 0; i < numBins; i++){
+    bddNode = uniqueTableForId->bins[i];
+    while(bddNode != Cal_Nil(CalBddNode_t)){
+      next = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetRefCount(bddNode, refCount);
+      Cal_Assert(refCount);
+      thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+      elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+      bddNode->thenBddId = id;
+      bddNode->elseBddId = refCount;
+      bddNode->nextBddNode = next;
+      bddNode->thenBddNode = thenBddNode;
+      bddNode->elseBddNode = elseBddNode;
+      bddNode = next;
+    }
+  }
+  bddNode = bddManager->bddOne.bddNode;
+  CalBddNodeGetRefCount(bddNode, refCount);
+  Cal_Assert(refCount);
+  thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+  elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+  bddNode->thenBddId = id;
+  bddNode->elseBddId = refCount;
+  bddNode->nextBddNode = next;
+  bddNode->thenBddNode = thenBddNode;
+  bddNode->elseBddNode = elseBddNode;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [Changes the data structure of the bdd nodes to
+  the original one.]
+
+  Description        [Data structure conversion: thenBddId -> id 
+  elseBddId -> ref count]
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddConvertDataStructBack(Cal_BddManager_t *bddManager)
+{
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  CalBddNode_t *bddNode, *nextBddNode, **bins;
+  long numBins;
+  int i, id, index;
+  CalHashTable_t *uniqueTableForId;
+  uniqueTableForId = bddManager->uniqueTable[0];
+  numBins = uniqueTableForId->numBins;
+  bins = uniqueTableForId->bins;
+  for(i = 0; i < numBins; i++) {
+    for(bddNode = bins[i];
+        bddNode != Cal_Nil(CalBddNode_t);
+        bddNode = nextBddNode) {
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodePutRefCount(bddNode, bddNode->elseBddId);
+      bddNode->thenBddId = CAL_BDD_POINTER(bddNode->thenBddNode)->thenBddId;
+      bddNode->elseBddId = CAL_BDD_POINTER(bddNode->elseBddNode)->thenBddId;
+    }
+  }
+  for(index = 0; index < bddManager->numVars; index++){
+    id = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[id];
+    numBins = uniqueTableForId->numBins;
+    bins = uniqueTableForId->bins;
+    for(i = 0; i < numBins; i++) {
+      for(bddNode = bins[i];
+          bddNode != Cal_Nil(CalBddNode_t);
+          bddNode = nextBddNode) {
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        CalBddNodePutRefCount(bddNode, bddNode->elseBddId);
+        bddNode->thenBddId = CAL_BDD_POINTER(bddNode->thenBddNode)->thenBddId;
+        bddNode->elseBddId = CAL_BDD_POINTER(bddNode->elseBddNode)->thenBddId;
+      Cal_Assert(!CalBddNodeIsForwarded(bddNode));
+      Cal_Assert(!CalBddNodeIsRefCountZero(bddNode));
+      CalBddNodeGetThenBdd(bddNode, thenBdd);
+      CalBddNodeGetElseBdd(bddNode, elseBdd);
+      Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+      Cal_Assert(CalBddIsForwarded(elseBdd) == 0);
+      }
+    }
+  }
+  bddNode = bddManager->bddOne.bddNode;
+  CalBddNodePutRefCount(bddNode, bddNode->elseBddId);
+  bddNode->thenBddId = 0;
+  bddNode->elseBddId = 0;
+}
+
+#ifdef _FOO_
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReallocateNodesInPlace(Cal_BddManager_t *bddManager)
+{
+  Cal_Address_t  *pageSegment;
+  CalPageManager_t *pageManager;
+  CalHashTable_t *uniqueTable;
+  CalNodeManager_t *nodeManager;
+  int index, id, i, pageCounter, numUsefulSegments, segmentCounter;
+  
+  /* Initialize and set up few things */
+  pageManager = bddManager->pageManager;
+  uniqueTable = bddManager->uniqueTable;
+  for (id = 1; id <= bddManager->numVars; id++){
+    numPagesRequired =
+        uniqueTable[id]->numEntries/NUM_NODES_PER_PAGE+1;
+    nodeManager = uniqueTable[id]->nodeManager;
+    /* Clear out the page list of the node manager */
+    for (i=0; i<nodeManager->maxNumPages; i++){
+      nodeManager->pageList[i] = 0;
+    }
+    nodeManager->freeNodeList = (CalBddNode_t *)0;
+    nodeManager->numPages = numPagesRequired;
+    Cal_Assert(nodeManager->maxNumPages >= numPagesRequired);
+    for (i = 0; i<numPagesRequired; i++){
+      if (++pageCounter ==
+              pageManager->numPagesArray[segmentCounter]){
+        pageCounter = 0;
+        segmentCounter++;
+        pageSegment = pageManager->pageSegmentArray[segmentCounter];
+      }
+      nodeManager->pageList[i] = pageSegment[pageCounter];
+    }
+  }
+  numUsefulSegments = segmentCounter+1;
+  numUsefulPagesInLastSegment = pageCounter+1;
+  
+  /* Traverse all the nodes belonging in each page */
+  /* Put the destination addresses in the next pointer */
+  for (numSegment=0; numSegment < pageManager->numSegments; 
+       numSegment++){
+    for (numPage = 0, page = pageManager->pageSegmentArray[numSegment]; 
+         numPage < pageManager->numPagesArray[numSegment];
+         page += PAGE_SIZE, numPage++){
+      for (bddNode = (CalBddNode_t*) page, numNode = 0;
+           numNode < NUM_NODES_PER_PAGE; numNode++, bddNode += 1){
+        /* If the node is not useful, continue */
+        if (bddNode->elseBddId == 0) continue; 
+        /* Find out the destination address */
+        bddId = bddNode->thenBddId;
+        nodeCounter[bddId]++;
+        if (nodeCounter[bddId] == NUM_NODES_PER_PAGE){
+          pageCounter[bddId]++;
+          nodePointerArray[bddId] =
+              pageListArray[bddId][pageCounter[bddId]];
+          nodeCounter[bddId] = 0;
+        }
+        bddNode->nextBddNode = nodePointerArray[bddId];
+        nodePointerArray[bddId] += 1;
+      }
+    }
+  }
+  /* Traverse all the nodes belonging in each page */
+  /* Update the contents */
+  for (numSegment=0; numSegment < pageManager->totalNumSegments; 
+       numSegment++){
+    for (numPage = 0, page = pageManager->pageSegmentArray[numSegment]; 
+         numPage < pageManager->numPagesArray[numSegment];
+         page += PAGE_SIZE, numPage++){
+      for (bddNode = (CalBddNode_t*) page, numNode = 0;
+           numNode < NUM_NODES_PER_PAGE; numNode++, bddNode += 1){
+        /* If the node is not useful, continue */
+        if (bddNode->elseBddId == 0) continue; 
+        /* If the node has been visited, continue */
+        if ((CalAddress_t)bddNode->nextBddNode & 01) continue;
+        /* If the nodes is supposed to remain at the same place,
+           update the then and else pointers and continue */
+        if (((CalAddress_t) bddNode->nextBddNode &~01) ==
+            ((CalAddress_t) bddNode & ~01)){
+          CalBddNodeUpdatebddNode(bddNode);
+          continue;
+        }
+        origNode = bddNode; /* Remember the address */
+        /* Update the contents */
+        thenBddNode = bddNode->thenBddNode;
+        elseBddNode = bddNode->elseBddNode;
+        thenBddId = bddNode->thenBddId;
+        elseBddId = bddNode->elseBddId;
+        do{
+          thenBddNode = UpdateThenBddNode(thenBddNode);
+          elseBddNode = UpdateElseBddNode(elseBddNode);
+          destinationNode = bddNode->nextBddNode;
+          /* Mark the node visited */
+          bddNode->nextBddNode = (CalBddNode_t *)
+              ((CalAddress_t)bddNode->nextBddNode | 01);
+          thenBddNode2 = destinationNode->thenBddNode;
+          elseBddNode2 = destinationNode->elseBddNode;
+          thenBddId2 = destinationNode->thenBddId;
+          elseBddId2 = destinationNode->elseBddId;
+          destinationNode->thenBddNode = thenBddNode;
+          destinationNode->elseBddNode = elseBddNode;
+          destinationNode->thenBddId = thenBddId;
+          destinationNode->elseBddId = elseBddId;
+          bddNode = destinationNode;
+          thenBddNode = thenBddNode2;
+          elseBddNode = elseBddNode2;
+          thenBddId = thenBddId2;
+          elseBddId = elseBddId2;
+        } while ((elseBddId != 0) && (bddNode != origNode) &&
+                 !((CalAddress_t)(bddNode->nextBddNode) & 01));
+      }
+    }
+  }
+  /* Fix the handles to the nodes being moved */
+  for (id = 1; id <= bddManager->numVars; id++){
+    /* Fix the varBdd array */
+  }
+/* Need to update the handles to the nodes being moved */
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodesAfterReallocation(bddManager);
+  }
+  
+  /* Fix the user BDDs */
+  CalBddReorderFixUserBddPtrsAfterReallocation(bddManager);
+
+  /* Fix the association */
+  CalReorderAssociationFixAfterReallocation(bddManager);
+
+  Cal_Assert(CalCheckAssoc(bddManager));
+  
+
+  /* Update the next pointers */
+  /* Since the pages for the ids are distributed in the uniform
+     manner, we can scan the pages on id by id basis without any
+     disadvantage */
+  for (id = 1; id <= bddManager->numVars; id++){
+    nodeManager = uniqueTable[id]->nodeManager;
+    freeNodeList = Cal_Nil(CalBddNode_t);
+    for (i=0; i<nodeManager->numPages; i++){
+      page = nodeManager->pageList[i];
+      for (bddNode = (CalBddNode_t*) page, numNode = 0;
+           numNode < NUM_NODES_PER_PAGE; numNode++, bddNode += 1){
+        /* If the node is not useful, put it in the free list */
+        if ((bddNode->elseBddId == 0) || (bddNode->elseBddNode == 0)){
+          bddNode->nextBddNode = freeNodeList;
+          freeNodeList = bddNode;
+        }
+      }
+    }
+    nodeManager->freeNodeList = freeNodeList;
+  }
+  /* We should put the unused pages in the free page list */
+  pageSegment = pageManager->pageSegmentArray[numUsefulSegments-1];
+  for (pageCounter = numUsefulPagesInLastSegment;
+       pageCounter < pageSegment->numPages ; pageCounter++){
+    CalPageManagerFreePage(pageManager, pageSegment[pageCounter]);
+  }
+  /* We have to free up the unnecessary page segments;*/
+  for (i = numUsefulSegments; i < pageManager->numSegments; i++){
+    free(pageManager->pageSegmentArray[i]);
+    pageManager->pageSegmentArray[i] = 0;
+  }
+  pageManager->numSegments = numUsefulSegments;
+}
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalAlignCollisionChains(Cal_BddManager_t *bddManager)
+{
+  /* First find out the pages corresponding to each variable */
+  Cal_Address_t ***pageListArray = Cal_MemAlloc(Cal_Address_t **,
+                                                bddManager->numVars+1);
+  for (id = 1; id <= bddManager->numVars; id++){
+    nodeManager = bddManager->nodeManagerArray[id];
+    numPages = nodeManager->numPages;
+    pageListArray[id] = Cal_MemAlloc(Cal_Address_t *, numPages);
+    for (i=0; i<numPages; i++){
+      pageListArray[id][i] = nodeManager->pageList[i];
+    }
+  }
+    
+  /* Bottom up traversal */
+  for (index = bddManager->numVars-1; index >= 0; index--){
+    id = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[id];
+    nodeManager = uniqueTableForId->nodeManager;
+    /* Calculate the collision lengths */
+    collisionLengthArray = CalculateCollisionLength(uniqueTableForId);
+    /* Initialize the bins */
+    bins = uniqueTableForId->bins;
+    numBins = uniqueTableForId->numBins;
+    numNodes = 0;
+    pageNum = 0;
+    for (i=0; i<numBins; i++){
+      numNodes += collisionLengthArray[i];
+      if (numNodes < NUM_NODES_PER_PAGE){
+        nodePointer[i] += collisionLengthArray[i];
+      }
+      else if (numNodes == NUM_NODES_PER_PAGE){
+        nodePointer[i] = pageListArray[id][++pageNum];
+        numNodes = 0;
+      }
+      else {
+        /* put the rest of the nodes from this page in a free list */
+        nodePointer[i]->nextBddNode = nodeManager->freeNodeList;
+        nodeManager->freeNodeList = nodePointer;
+        nodePointer[i] = pageListArray[id][++pageNum]+collisionLengthArray[i];
+        numNodes = collisionLengthArray[i];
+      }
+    }
+  }
+}
+#endif
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReallocateNodes(Cal_BddManager_t *bddManager)
+{
+  int i;
+  int index;
+  CalNodeManager_t *nodeManager;
+  CalPageManager_t *pageManager;
+  int numSegments;
+  CalAddress_t **pageSegmentArray;
+  
+  pageManager = bddManager->pageManager2;
+  numSegments = pageManager->numSegments;
+  pageSegmentArray = pageManager->pageSegmentArray;
+  
+  /* Reinitialize the page manager */
+  pageManager->totalNumPages = 0;
+  pageManager->numSegments = 0;
+  pageManager->maxNumSegments = MAX_NUM_SEGMENTS;
+  pageManager->pageSegmentArray 
+      = Cal_MemAlloc(CalAddress_t *, pageManager->maxNumSegments);
+  pageManager->freePageList = Cal_Nil(CalAddress_t);
+  
+  /* Do a bottom up traversal */
+
+  for (index = bddManager->numVars-1; index >= 0; index--){
+    int id;
+    CalHashTable_t *uniqueTableForId;
+    int numPagesRequired, newSizeIndex;
+    CalBddNode_t *bddNode, *dupNode, *thenNode, *elseNode, **oldBins;
+    long hashValue, oldNumBins;
+    
+    id = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[id];
+    nodeManager = bddManager->nodeManagerArray[id];
+    oldBins = uniqueTableForId->bins;
+    oldNumBins = uniqueTableForId->numBins;
+    nodeManager->freeNodeList = Cal_Nil(CalBddNode_t);
+    nodeManager->numPages = 0;
+    numPagesRequired =
+        uniqueTableForId->numEntries/NUM_NODES_PER_PAGE;
+    nodeManager->maxNumPages =
+        2*(numPagesRequired ? numPagesRequired : 1);
+    Cal_MemFree(nodeManager->pageList);
+    nodeManager->pageList = Cal_MemAlloc(CalAddress_t *,
+                                         nodeManager->maxNumPages); 
+    /* Create the new set of bins */
+    newSizeIndex =
+        CeilLog2(uniqueTableForId->numEntries/HASH_TABLE_DEFAULT_MAX_DENSITY);
+    if (newSizeIndex < HASH_TABLE_DEFAULT_SIZE_INDEX){
+      newSizeIndex = HASH_TABLE_DEFAULT_SIZE_INDEX;
+    }
+    uniqueTableForId->sizeIndex = newSizeIndex;
+    uniqueTableForId->numBins =  TABLE_SIZE(uniqueTableForId->sizeIndex);
+    uniqueTableForId->maxCapacity =
+        uniqueTableForId->numBins * HASH_TABLE_DEFAULT_MAX_DENSITY; 
+    
+    uniqueTableForId->bins = Cal_MemAlloc(CalBddNode_t *,
+                                          uniqueTableForId->numBins); 
+    memset((char *)uniqueTableForId->bins, 0, 
+           uniqueTableForId->numBins*sizeof(CalBddNode_t *)); 
+    for (i=0; i<oldNumBins; i++){
+      for (bddNode = oldBins[i]; bddNode; bddNode = bddNode->nextBddNode){ 
+        CalNodeManagerAllocNode(nodeManager, dupNode);
+        thenNode = bddNode->thenBddNode;
+        CalBddNodeIsForwardedTo(thenNode);
+        Cal_Assert(thenNode);
+        Cal_Assert(!CalBddNodeIsForwarded(thenNode));
+        elseNode = bddNode->elseBddNode;
+        CalBddNodeIsForwardedTo(elseNode);
+        Cal_Assert(elseNode);
+        Cal_Assert(!CalBddNodeIsForwarded(CAL_BDD_POINTER(elseNode)));
+        Cal_Assert(bddManager->idToIndex[bddNode->thenBddId] <
+                   bddManager->idToIndex[thenNode->thenBddId]); 
+        Cal_Assert(bddManager->idToIndex[bddNode->thenBddId] <
+                   bddManager->idToIndex[CAL_BDD_POINTER(elseNode)->thenBddId]);
+        dupNode->thenBddNode = thenNode;
+        dupNode->elseBddNode = elseNode;
+        dupNode->thenBddId = bddNode->thenBddId;
+        dupNode->elseBddId = bddNode->elseBddId;
+        hashValue = CalDoHash2(thenNode, elseNode, uniqueTableForId);
+        dupNode->nextBddNode = uniqueTableForId->bins[hashValue];
+        uniqueTableForId->bins[hashValue] = dupNode;
+        bddNode->thenBddNode = dupNode;
+        bddNode->elseBddNode = (CalBddNode_t *)0;
+        bddNode->thenBddId = id;
+        Cal_Assert(bddManager->idToIndex[dupNode->thenBddId] <
+                   bddManager->idToIndex[thenNode->thenBddId]); 
+        Cal_Assert(bddManager->idToIndex[dupNode->thenBddId] <
+                   bddManager->idToIndex[CAL_BDD_POINTER(elseNode)->thenBddId]);
+      }
+    }
+    Cal_MemFree(oldBins);
+    CalBddIsForwardedTo(bddManager->varBdds[id]);
+  }
+
+  if (bddManager->pipelineState == CREATE){
+    /* There are some results computed in pipeline */
+    CalBddReorderFixProvisionalNodes(bddManager);
+  }
+  
+  /* Fix the user BDDs */
+  CalBddReorderFixUserBddPtrs(bddManager);
+
+  /* Fix the association */
+  CalReorderAssociationFix(bddManager);
+
+  Cal_Assert(CalCheckAssoc(bddManager));
+  
+  /* Free the page manager related stuff*/
+  for(i = 0; i < numSegments; i++){
+    free(pageSegmentArray[i]);
+  }
+  Cal_MemFree(pageSegmentArray);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddExchangeAux(Cal_BddManager_t *bddManager, CalBddNode_t *f,
+               int id, int nextId)
+{
+  CalBddNode_t *f0, *f1;
+  CalBddNode_t *f00, *f01, *f10, *f11;
+  CalBddNode_t *newF0, *newF1;
+  int f0Found, f1Found;
+  int fIndex;
+  
+  f0 = f->elseBddNode;
+  f1 = f->thenBddNode;
+
+  if (CAL_BDD_POINTER(f0)->thenBddId == nextId){
+    f00 = BddNodeGetElseBddNode(f0);
+    f01 = BddNodeGetThenBddNode(f0);
+  }
+  else {
+    f00 = f01 = f0;
+  }
+  if (CAL_BDD_POINTER(f1)->thenBddId == nextId){
+    f10 = BddNodeGetElseBddNode(f1);
+    f11 = BddNodeGetThenBddNode(f1);
+  }
+  else {
+    f10 = f11 = f1;
+  }
+  
+  if (f00 == f10){
+    newF0 = f00;
+    f0Found = 1;
+  }
+  else{
+    f0Found = UniqueTableForIdFindOrAdd(bddManager,
+                                        bddManager->uniqueTable[id], f10,
+                                        f00, &newF0);
+  }
+  BddNodeIcrRefCount(newF0);
+  if (f01 == f11){
+    newF1 = f11;
+    f1Found = 1;
+  }
+  else{
+    f1Found = UniqueTableForIdFindOrAdd(bddManager,
+                                        bddManager->uniqueTable[id], f11,
+                                        f01, &newF1);
+  }
+  BddNodeIcrRefCount(newF1);
+
+  f->thenBddId = nextId;
+  f->elseBddNode = newF0;
+  f->thenBddNode = newF1;
+
+  fIndex = bddManager->idToIndex[id];
+  Cal_Assert(fIndex <
+             bddManager->idToIndex[CAL_BDD_POINTER(f00)->thenBddId]);
+  Cal_Assert(fIndex <
+             bddManager->idToIndex[CAL_BDD_POINTER(f10)->thenBddId]);
+  Cal_Assert(fIndex <
+             bddManager->idToIndex[CAL_BDD_POINTER(f01)->thenBddId]);
+  Cal_Assert(fIndex <
+             bddManager->idToIndex[CAL_BDD_POINTER(f11)->thenBddId]);
+  Cal_Assert(CAL_BDD_POINTER(f00)->thenBddId != nextId);
+  Cal_Assert(CAL_BDD_POINTER(f01)->thenBddId != nextId);
+  Cal_Assert(CAL_BDD_POINTER(f10)->thenBddId != nextId);
+  Cal_Assert(CAL_BDD_POINTER(f11)->thenBddId != nextId);
+  
+  if (!f0Found){
+    BddNodeIcrRefCount(f00);
+    BddNodeIcrRefCount(f10);
+  }
+
+  if (!f1Found){
+    BddNodeIcrRefCount(f01);
+    BddNodeIcrRefCount(f11);
+  }
+
+  BddNodeDcrRefCount(f0);
+  BddNodeDcrRefCount(f1);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+CheckValidityOfNodes(Cal_BddManager_t *bddManager, long id)
+{
+#ifndef NDEBUG
+  CalHashTable_t *table = bddManager->uniqueTable[id];
+  int i;
+  CalBddNode_t *bddNode;
+  int index = bddManager->idToIndex[id];
+  for(i = 0; i < table->numBins; ++i){
+    for (bddNode = table->bins[i]; bddNode; bddNode = bddNode->nextBddNode){
+      int thenIndex = bddManager->idToIndex[bddNode->thenBddNode->thenBddId];
+      int elseIndex =
+	bddManager->idToIndex[CAL_BDD_POINTER(bddNode->elseBddNode)->thenBddId]; 
+      assert((thenIndex > index) && (elseIndex > index));
+    }
+  }
+#endif
+  return 1;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+SweepVarTable(Cal_BddManager_t *bddManager, long id)
+{
+  CalHashTable_t *table = bddManager->uniqueTable[id];
+  long numNodesFreed, oldNumEntries;
+  CalBddNode_t **ptr, *bddNode;
+  int i;
+  
+  oldNumEntries = table->numEntries;
+  for(i = 0; i < table->numBins; ++i){
+    for (ptr = &table->bins[i], bddNode = *ptr; bddNode;
+         bddNode = *ptr){
+      if (bddNode->elseBddId == 0){
+        *ptr = bddNode->nextBddNode;
+        CalNodeManagerFreeNode(nodeManager, bddNode);
+        BddNodeDcrRefCount(bddNode->thenBddNode);
+        BddNodeDcrRefCount(bddNode->elseBddNode);
+        table->numEntries--;
+      }
+      else{
+        ptr = &bddNode->nextBddNode;
+      }
+    }
+  }
+  numNodesFreed = oldNumEntries - table->numEntries;
+  bddManager->numNodes -= numNodesFreed;
+  bddManager->numNodesFreed += numNodesFreed;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddExchange(Cal_BddManager_t *bddManager, long id)
+{
+  Cal_BddId_t  nextId;
+  CalBddNode_t **ptr, *bddNode, *nodeList;
+  CalHashTable_t *table, *nextTable;
+  Cal_BddIndex_t index, nextIndex;
+  int i;
+  CalBddNode_t  *f1, *f2;
+  CalAssociation_t *p;
+  CalNodeManager_t *nodeManager;
+  
+  index = bddManager->idToIndex[id];
+  nextIndex = index+1;
+  nextId = bddManager->indexToId[nextIndex];
+
+  if (CalTestInteract(bddManager, id, nextId)){
+    bddManager->numSwaps++;
+    nodeManager = bddManager->nodeManagerArray[id];
+    table = bddManager->uniqueTable[id];
+    nextTable = bddManager->uniqueTable[nextId];
+    nodeList = (CalBddNode_t*)0;
+    for(i = 0; i < table->numBins; i++){
+      for (ptr = &table->bins[i], bddNode = *ptr; bddNode;
+           bddNode = *ptr){
+        Cal_Assert(bddNode->elseBddId != 0);
+        f1 = bddNode->elseBddNode;
+        f2 = bddNode->thenBddNode;
+        if ((CAL_BDD_POINTER(f1)->thenBddId != nextId) &&
+            (CAL_BDD_POINTER(f2)->thenBddId != nextId)){ 
+          ptr = &bddNode->nextBddNode;
+        }
+        else{
+          *ptr = bddNode->nextBddNode;
+          bddNode->nextBddNode = nodeList;
+          nodeList = bddNode;
+        }
+      }
+    }
+    for (bddNode = nodeList; bddNode ; bddNode = nodeList){
+      BddExchangeAux(bddManager, bddNode, id, nextId);
+      nodeList = bddNode->nextBddNode;
+      HashTableAddDirect(nextTable, bddNode);
+      table->numEntries--;
+    }
+    SweepVarTable(bddManager, nextId);
+  }
+  else {
+    bddManager->numTrivialSwaps++;
+  }
+  
+  CalFixupAssoc(bddManager, id, nextId, bddManager->tempAssociation);
+  for(p = bddManager->associationList; p; p = p->next){
+    CalFixupAssoc(bddManager, id, nextId, p);
+  }
+
+  bddManager->idToIndex[id] = nextIndex;
+  bddManager->idToIndex[nextId] = index;
+  bddManager->indexToId[index] = nextId;
+  bddManager->indexToId[nextIndex] = id;
+
+  Cal_Assert(CheckValidityOfNodes(bddManager, id));
+  Cal_Assert(CheckValidityOfNodes(bddManager, nextId));
+  Cal_Assert(CalCheckAssoc(bddManager));
+#ifdef _CAL_VERBOSE
+  /*fprintf(stdout,"Variable order after swap:\n");*/
+  for (i=0; i<bddManager->numVars; i++){
+    fprintf(stdout, "%3d ", bddManager->indexToId[i]);
+  }
+  fprintf(stdout, "%8d\n", bddManager->numNodes);
+#endif
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddExchangeVarBlocks(Cal_BddManager_t *bddManager, Cal_Block parent,
+                     long blockIndex)
+{
+  Cal_Block b1, b2, temp;
+  long i, j, k, l, firstBlockWidth, secondBlockWidth;
+
+  b1 = parent->children[blockIndex];
+  b2 = parent->children[blockIndex+1];
+  /* This slides the blocks past each other in a kind of interleaving */
+  /* fashion. */
+  firstBlockWidth = b1->lastIndex - b1->firstIndex;
+  secondBlockWidth = b2->lastIndex - b2->firstIndex;
+  
+  for (i=0; i <= firstBlockWidth + secondBlockWidth; i++){
+    j = i - firstBlockWidth;
+    if (j < 0) j=0;
+    k = ((i > secondBlockWidth) ? secondBlockWidth : i);
+    while (j <= k) {
+	  l = b2->firstIndex + j - i + j;
+	  BddExchange(bddManager, bddManager->indexToId[l-1]);
+	  ++j;
+	}
+  }
+  CalBddBlockDelta(b1, secondBlockWidth+1);
+  CalBddBlockDelta(b2, -(firstBlockWidth+1));
+  temp = parent->children[blockIndex];
+  parent->children[blockIndex] = parent->children[blockIndex+1];
+  parent->children[blockIndex+1] = temp;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+BddReorderWindow2(Cal_BddManager_t *bddManager, Cal_Block block, long i)
+{
+  long size, bestSize;
+
+  /* 1 2 */
+  bestSize = bddManager->numNodes;
+  BddExchangeVarBlocks(bddManager, block, i);
+  /* 2 1 */
+  size = bddManager->numNodes;
+  if (size < bestSize) return (1);
+  BddExchangeVarBlocks(bddManager, block, i);
+  return (0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static int
+BddReorderWindow3(Cal_BddManager_t *bddManager, Cal_Block block, long i)
+{
+  int best;
+  long size, bestSize;
+  long origSize;
+  
+  origSize = bddManager->numNodes;
+  best = 0;
+  /* 1 2 3 */
+  bestSize = bddManager->numNodes;
+  BddExchangeVarBlocks(bddManager, block, i);
+  /* 2 1 3 */
+  size=bddManager->numNodes;
+  if (size < bestSize) {
+    best=1;
+    bestSize=size;
+  }
+  BddExchangeVarBlocks(bddManager, block, i+1);
+  /* 2 3 1 */
+  size=bddManager->numNodes;
+  if (size < bestSize) {
+    best=2;
+    bestSize=size;
+  }
+  BddExchangeVarBlocks(bddManager, block, i);
+  /* 3 2 1 */
+  size=bddManager->numNodes;
+  if (size <= bestSize) {
+    best=3;
+    bestSize=size;
+  }
+  BddExchangeVarBlocks(bddManager, block, i+1);
+  /* 3 1 2 */
+  size=bddManager->numNodes;
+  if (size <= bestSize) {
+    best=4;
+    bestSize=size;
+  }
+  BddExchangeVarBlocks(bddManager, block, i);
+  /* 1 3 2 */
+  size=bddManager->numNodes;
+  if (size <= bestSize) {
+    best=5;
+    bestSize=size;
+  }
+  switch (best){
+      case 0:
+        BddExchangeVarBlocks(bddManager, block, i+1);
+        break;
+      case 1:
+        BddExchangeVarBlocks(bddManager, block, i+1);
+        BddExchangeVarBlocks(bddManager, block, i);
+        break;
+      case 2:
+        BddExchangeVarBlocks(bddManager, block, i+1);
+        BddExchangeVarBlocks(bddManager, block, i);
+        BddExchangeVarBlocks(bddManager, block, i+1);
+        break;
+      case 3:
+        BddExchangeVarBlocks(bddManager, block, i);
+        BddExchangeVarBlocks(bddManager, block, i+1);
+        break;
+      case 4:
+        BddExchangeVarBlocks(bddManager, block, i);
+        break;
+      case 5:
+        break;
+  }
+  return ((best > 0) && (origSize > bestSize));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReorderStableWindow3Aux(Cal_BddManager_t *bddManager, Cal_Block block,
+                           char *levels) 
+{
+  long i;
+  int moved;
+  int anySwapped;
+
+  if (block->reorderable) {
+    for (i=0; i < block->numChildren-1; ++i) levels[i]=1;
+    do {
+	  anySwapped=0;
+	  for (i=0; i < block->numChildren-1; i++){
+	    if (levels[i]){
+#ifdef _CAL_VERBOSE
+          fprintf(stdout,"Moving block %3d -- %3d\n",
+                  bddManager->indexToId[block->children[i]-> firstIndex],
+                  bddManager->indexToId[block->children[i]->lastIndex]);
+          fflush(stdout);
+          for (j=0; j<bddManager->numVars; j++){
+            fprintf(stdout, "%3d ", bddManager->indexToId[j]);
+          }
+          fprintf(stdout, "%8d\n", bddManager->numNodes);
+#endif
+          if (i < block->numChildren-2){
+            moved = BddReorderWindow3(bddManager, block, i);
+          }
+          else{
+            moved = BddReorderWindow2(bddManager, block, i);
+          }
+          if (moved){
+		    if (i > 0) {
+              levels[i-1]=1;
+              if (i > 1)
+                levels[i-2]=1;
+            }
+		    levels[i]=1;
+		    levels[i+1]=1;
+		    if (i < block->numChildren-2){
+              levels[i+2]=1;
+              if (i < block->numChildren-3) {
+			    levels[i+3]=1;
+			    if (i < block->numChildren-4) levels[i+4]=1;
+			  }
+            }
+		    anySwapped=1;
+          }
+          else levels[i]=0;
+        }
+      }
+    } while (anySwapped);
+  }
+  for (i=0; i < block->numChildren; ++i){
+    BddReorderStableWindow3Aux(bddManager, block->children[i], levels);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReorderStableWindow3(Cal_BddManager_t *bddManager)
+{
+  char *levels;
+  levels =  Cal_MemAlloc(char, bddManager->numVars);
+  bddManager->numSwaps = 0;
+  BddReorderStableWindow3Aux(bddManager, bddManager->superBlock, levels);
+  Cal_MemFree(levels);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddSiftBlock(Cal_BddManager_t *bddManager, Cal_Block block, long
+             startPosition, double maxSizeFactor)
+{
+  long startSize;
+  long bestSize;
+  long bestPosition;
+  long currentSize;
+  long currentPosition;
+  long maxSize;
+  
+  startSize = bddManager->numNodes;
+  bestSize = startSize;
+  bestPosition = startPosition;
+  currentSize = startSize;
+  currentPosition = startPosition;
+  maxSize = maxSizeFactor*startSize;
+  if (bddManager->nodeLimit && maxSize > bddManager->nodeLimit)
+    maxSize = bddManager->nodeLimit;
+
+  /* Need to do optimization here */
+  if (startPosition > (block->numChildren >> 1)){
+    while (currentPosition < block->numChildren-1 && currentSize <= maxSize){
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+      ++currentPosition;
+      currentSize = bddManager->numNodes;
+      if (currentSize < bestSize){
+        bestSize = currentSize;
+        bestPosition=currentPosition;
+      }
+    }
+    while (currentPosition != startPosition){
+      --currentPosition;
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+    }
+    currentSize = startSize;
+    while (currentPosition && currentSize <= maxSize){
+      --currentPosition;
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+      currentSize = bddManager->numNodes;
+      if (currentSize <= bestSize){
+        bestSize = currentSize;
+        bestPosition = currentPosition;
+      }
+    }
+    while (currentPosition != bestPosition){
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+      ++currentPosition;
+    }
+  }
+  else{
+    while (currentPosition && currentSize <= maxSize){
+      --currentPosition;
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+      currentSize = bddManager->numNodes;
+      if (currentSize < bestSize){
+        bestSize = currentSize;
+        bestPosition = currentPosition;
+      }
+    }
+    while (currentPosition != startPosition){
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+      ++currentPosition;
+    }
+    currentSize = startSize;
+    while (currentPosition < block->numChildren-1 && currentSize <= maxSize){
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+      currentSize = bddManager->numNodes;
+      ++currentPosition;
+      if (currentSize <= bestSize){
+        bestSize = currentSize;
+        bestPosition = currentPosition;
+      }
+    }
+    while (currentPosition != bestPosition){
+      --currentPosition;
+      BddExchangeVarBlocks(bddManager, block, currentPosition);
+    }
+  }
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reorder variables using "sift" algorithm.]
+
+  Description [Reorder variables using "sift" algorithm.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static void
+BddReorderSiftAux(Cal_BddManager_t *bddManager, Cal_Block block,
+                     Cal_Block *toSift, double maxSizeFactor) 
+{
+  long i, j, k;
+  long width;
+  long maxWidth;
+  long widest;
+  long numVarsShifted = 0;
+  bddManager->numSwaps = 0;
+  if (block->reorderable) {
+    for (i=0; i < block->numChildren; ++i){
+      toSift[i] = block->children[i];
+    }
+    while (i &&
+           (numVarsShifted <=
+            bddManager->maxNumVarsSiftedPerReordering) &&
+           (bddManager->numSwaps <=
+            bddManager->maxNumSwapsPerReordering)){ 
+	  i--;
+      numVarsShifted++;
+	  maxWidth = 0;
+	  widest = 0;
+	  for (j=0; j <= i; ++j) {
+        for (width=0, k=toSift[j]->firstIndex; k <= toSift[j]->lastIndex; ++k){
+          width +=
+              bddManager->uniqueTable[bddManager->indexToId[k]]->numEntries; 
+        }
+        width /= toSift[j]->lastIndex - toSift[j]->firstIndex+1;
+        if (width > maxWidth) {
+		  maxWidth = width;
+		  widest = j;
+		}
+      }
+	  if (maxWidth > 1) {
+        for (j=0; block->children[j] != toSift[widest]; ++j);
+#ifdef _CAL_VERBOSE
+        fprintf(stdout,"Moving block %3d -- %3d\n",
+                bddManager->indexToId[block->children[j]-> firstIndex],
+                bddManager->indexToId[block->children[j]->lastIndex]);
+        fflush(stdout);
+        for (l=0; l<bddManager->numVars; l++){
+          fprintf(stdout, "%3d ", bddManager->indexToId[l]);
+        }
+        fprintf(stdout, "%8d\n", bddManager->numNodes);
+#endif
+        BddSiftBlock(bddManager, block, j, maxSizeFactor);
+        toSift[widest] = toSift[i];
+      }
+	  else {
+        break;
+      }
+	}
+  }
+  for (i=0; i < block->numChildren; ++i)
+    BddReorderSiftAux(bddManager, block->children[i], toSift,
+                      maxSizeFactor);  
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+BddReorderSift(Cal_BddManager_t *bddManager, double maxSizeFactor)
+{
+  Cal_Block *toSift;
+
+  toSift = Cal_MemAlloc(Cal_Block, bddManager->numVars);
+  BddReorderSiftAux(bddManager, bddManager->superBlock, toSift,
+                       maxSizeFactor); 
+  Cal_MemFree(toSift);
+}
+
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the smallest integer greater than or equal to log2 of a
+  number]
+
+  Description [Returns the smallest integer greater than or equal to log2 of a
+  number (The assumption is that the number is >= 1)]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+CeilLog2(int  number)
+{
+  int num, count;
+  for (num=number, count=0; num > 1; num >>= 1, count++);
+  if ((1 << count) != number) count++;
+  return count;
+}
Index: /vis_dev/glu-2.1/src/calBdd/calReorderUtil.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calReorderUtil.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calReorderUtil.c	(revision 6)
@@ -0,0 +1,617 @@
+/**CFile***********************************************************************
+
+  FileName    [calReorderUtil.c]
+
+  PackageName [cal]
+
+  Synopsis    [Some utility routines used by both breadth-first and
+  depth-first reordering techniques.]
+
+  Description []
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan   (rajeev@ic.eecs.berkeley.edu)
+               Wilsin Gosti (wilsin@ic.eecs.berkeley.edu)]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calReorderUtil.c,v 1.3 2002/09/22 00:37:04 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddReorderFixUserBddPtrs(Cal_BddManager bddManager)
+{
+  CalHashTable_t *userBddUniqueTable = bddManager->uniqueTable[0];
+  int i;
+  int numBins;
+  int rehashFlag;
+  CalBddNode_t **bins;
+  CalBddNode_t *bddNode;
+  CalBddNode_t *nextBddNode;
+  CalBddNode_t *thenBddNode;
+  CalBddNode_t *elseBddNode;
+  Cal_Bdd_t internalBdd;
+
+  numBins = userBddUniqueTable->numBins;
+  bins = userBddUniqueTable->bins;
+
+  for(i = 0; i < numBins; i++) {
+    for(bddNode = bins[i];
+        bddNode != Cal_Nil(CalBddNode_t);
+        bddNode = nextBddNode) {
+      /*
+       * Process one bddNode at a time
+       */
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      rehashFlag = 0;
+
+      thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+      elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, internalBdd);
+      if (CalBddIsForwarded(internalBdd)) {
+        CalBddForward(internalBdd);
+        CalBddNodePutThenBdd(bddNode, internalBdd);
+        rehashFlag = 1;
+      }
+      Cal_Assert(CalBddIsForwarded(internalBdd) == 0);
+      /*Cal_Assert(!CalBddIsRefCountZero(internalBdd));*/
+      /*
+       * Rehash if necessary
+       */
+      if (rehashFlag) {
+        CalUniqueTableForIdRehashNode(userBddUniqueTable, bddNode,
+                                      thenBddNode, elseBddNode);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+int
+CalCheckAllValidity(Cal_BddManager bddManager)
+{
+  int id;
+  for(id = 0; id <= bddManager->numVars; id++){
+    CalCheckValidityOfNodesForId(bddManager, id);
+  }
+  CalCheckAssociationValidity(bddManager);
+  if (bddManager->pipelineState == CREATE){
+    CalCheckPipelineValidity(bddManager);
+  }
+  CalCheckRefCountValidity(bddManager);
+  CalCheckCacheTableValidity(bddManager);
+  return 1;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+int
+CalCheckValidityOfNodesForId(Cal_BddManager bddManager, int id)
+{
+  int i, numBins;
+  CalHashTable_t *uniqueTableForId;
+  CalBddNode_t *bddNode, *nextBddNode;
+  Cal_Bdd_t thenBdd, elseBdd;
+  
+  uniqueTableForId = bddManager->uniqueTable[id];
+  Cal_Assert(uniqueTableForId->startNode.nextBddNode == NULL);
+  numBins = uniqueTableForId->numBins;
+  for (i = 0; i < numBins; i++){
+    for (bddNode = uniqueTableForId->bins[i]; bddNode;
+         bddNode = nextBddNode){
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalCheckValidityOfANode(bddManager, bddNode, id);
+      CalBddNodeGetThenBdd(bddNode, thenBdd);
+      CalBddNodeGetElseBdd(bddNode, elseBdd);
+      Cal_Assert(CalDoHash2(CalBddGetBddNode(thenBdd),
+                            CalBddGetBddNode(elseBdd), 
+                            uniqueTableForId) == i);
+    }
+  }
+  return 1;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+int
+CalCheckValidityOfNodesForWindow(Cal_BddManager bddManager,
+                                 Cal_BddIndex_t index, int numLevels)
+{
+  int i, numBins, j;
+  CalHashTable_t *uniqueTableForId;
+  CalBddNode_t *bddNode, *nextBddNode;
+  Cal_Bdd_t thenBdd, elseBdd;
+
+  for (i = 0; i < numLevels; i++){
+    uniqueTableForId =
+        bddManager->uniqueTable[bddManager->indexToId[index+i]]; 
+    numBins = uniqueTableForId->numBins;
+    for (j = 0; j < numBins; j++){
+      for (bddNode = uniqueTableForId->bins[j]; bddNode;
+           bddNode = nextBddNode){
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        Cal_Assert(CalBddNodeIsForwarded(bddNode) == 0);
+        CalBddNodeGetThenBdd(bddNode, thenBdd);
+        CalBddNodeGetElseBdd(bddNode, elseBdd);
+        Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+        Cal_Assert(CalBddIsForwarded(elseBdd) == 0);
+        Cal_Assert(CalDoHash2(CalBddGetBddNode(thenBdd),
+                              CalBddGetBddNode(elseBdd), 
+                             uniqueTableForId) == j);
+      }
+    }
+    for (bddNode = uniqueTableForId->startNode.nextBddNode; bddNode;
+         bddNode = nextBddNode){ 
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, thenBdd);
+      Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+    }
+  }
+  return 1;
+}
+
+
+  
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+int
+CalCheckValidityOfANode(Cal_BddManager_t *bddManager, CalBddNode_t
+                     *bddNode, int id) 
+{
+  Cal_Bdd_t thenBdd, elseBdd, thenBdd_, elseBdd_, bdd;
+  if (id != 0){
+    /* id = 0 corresponds to the constants and the user BDDs */
+    Cal_Assert(bddManager->idToIndex[id] <
+               bddManager->idToIndex[bddNode->thenBddId]);   
+    Cal_Assert(bddManager->idToIndex[id] < 
+               bddManager->idToIndex[bddNode->elseBddId]);
+  }
+  Cal_Assert(!CalBddNodeIsForwarded(bddNode));
+  Cal_Assert(!CalBddNodeIsRefCountZero(bddNode));
+  CalBddNodeGetThenBdd(bddNode, thenBdd);
+  CalBddNodeGetElseBdd(bddNode, elseBdd);
+  Cal_Assert(CalBddIsForwarded(thenBdd) == 0);
+  Cal_Assert(CalBddIsForwarded(elseBdd) == 0);
+  Cal_Assert(!CalBddIsRefCountZero(thenBdd));
+  Cal_Assert(!CalBddIsRefCountZero(elseBdd));
+  /* Make sure that the then and else bdd nodes are part of the
+     respective unique tables */
+  if (bddNode->thenBddId != 0){
+    CalBddGetThenBdd(thenBdd, thenBdd_);
+    CalBddGetElseBdd(thenBdd, elseBdd_);
+    Cal_Assert(
+      CalUniqueTableForIdLookup(bddManager,
+                                bddManager->uniqueTable[bddNode->thenBddId],  
+                                thenBdd_, elseBdd_, &bdd));
+  }
+  if (bddNode->elseBddId != 0){
+    CalBddGetThenBdd(elseBdd, thenBdd_);
+    CalBddGetElseBdd(elseBdd, elseBdd_);
+    Cal_Assert(
+      CalUniqueTableForIdLookup(bddManager,
+                                bddManager->uniqueTable[bddNode->elseBddId],
+                                thenBdd_, elseBdd_, &bdd));
+  }
+  return 1;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalCheckRefCountValidity(Cal_BddManager_t *bddManager)
+{
+  int i, numBins, index;
+  CalHashTable_t *uniqueTableForId;
+  CalBddNode_t *bddNode, *nextBddNode;
+  Cal_Bdd_t thenBdd, elseBdd, internalBdd;
+  CalAssociation_t *assoc, *nextAssoc;
+  
+  /* First traverse the user BDDs */
+  uniqueTableForId = bddManager->uniqueTable[0];
+  numBins = uniqueTableForId->numBins;
+  for (i = 0; i < numBins; i++){
+    for (bddNode = uniqueTableForId->bins[i]; bddNode;
+         bddNode = nextBddNode){
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, internalBdd);
+      CalBddDcrRefCount(internalBdd);
+    }
+  }
+      /* Traverse the associations */
+  
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    for (i=1; i <= bddManager->numVars; i++){
+        if (CalBddGetBddId(assoc->varAssociation[i]) != CAL_BDD_NULL_ID){
+            CalBddDcrRefCount(assoc->varAssociation[i]);
+        }
+    }
+  }
+  /* temporary association */
+  assoc = bddManager->tempAssociation;
+  for (i=1; i <= bddManager->numVars; i++){
+      if (CalBddGetBddId(assoc->varAssociation[i]) != CAL_BDD_NULL_ID){
+          CalBddDcrRefCount(assoc->varAssociation[i]);
+      }
+  }
+
+  
+  /* Now traverse all the nodes in order */
+  for (index = 0; index < bddManager->numVars; index++){
+    uniqueTableForId = bddManager->uniqueTable[bddManager->indexToId[index]];
+    numBins = uniqueTableForId->numBins;
+    for (i = 0; i < numBins; i++){
+      for (bddNode = uniqueTableForId->bins[i]; bddNode;
+           bddNode = nextBddNode){
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        CalBddNodeGetThenBdd(bddNode, thenBdd);
+        CalBddNodeGetElseBdd(bddNode, elseBdd);
+        CalBddDcrRefCount(thenBdd);
+        CalBddDcrRefCount(elseBdd);
+      }
+    }
+  }
+
+  /* All the reference count must be zero  or max */
+  for (index = 0; index < bddManager->numVars; index++){
+    uniqueTableForId = bddManager->uniqueTable[bddManager->indexToId[index]];
+    numBins = uniqueTableForId->numBins;
+    for (i = 0; i < numBins; i++){
+      for (bddNode = uniqueTableForId->bins[i]; bddNode;
+           bddNode = nextBddNode){
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        /* If the pipeline execution is going on, the following
+           assertion will not hold */
+        if (bddManager->pipelineState != CREATE){
+          Cal_Assert(CalBddNodeIsRefCountZero(bddNode) ||
+                     CalBddNodeIsRefCountMax(bddNode));
+        }
+      }
+    }
+  }
+
+  /* Put back the ref count */
+  /* traverse all the nodes in order */
+  for (index = 0; index < bddManager->numVars; index++){
+    uniqueTableForId = bddManager->uniqueTable[bddManager->indexToId[index]];
+    numBins = uniqueTableForId->numBins;
+    for (i = 0; i < numBins; i++){
+      for (bddNode = uniqueTableForId->bins[i]; bddNode;
+           bddNode = nextBddNode){
+        nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+        CalBddNodeGetThenBdd(bddNode, thenBdd);
+        CalBddNodeGetElseBdd(bddNode, elseBdd);
+        CalBddIcrRefCount(thenBdd);
+        CalBddIcrRefCount(elseBdd);
+      }
+    }
+  }
+      /* Traverse the associations */
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    for (i=1; i <= bddManager->numVars; i++){
+        if (CalBddGetBddId(assoc->varAssociation[i]) != CAL_BDD_NULL_ID){
+            CalBddIcrRefCount(assoc->varAssociation[i]);
+        }
+    }
+  }
+  /* temporary association */
+  assoc = bddManager->tempAssociation;
+  for (i=1; i <= bddManager->numVars; i++){
+      if (CalBddGetBddId(assoc->varAssociation[i]) != CAL_BDD_NULL_ID){
+          CalBddIcrRefCount(assoc->varAssociation[i]);
+      }
+  }
+
+  /* Traverse the user BDDs */
+  uniqueTableForId = bddManager->uniqueTable[0];
+  numBins = uniqueTableForId->numBins;
+  for (i = 0; i < numBins; i++){
+    for (bddNode = uniqueTableForId->bins[i]; bddNode;
+         bddNode = nextBddNode){
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      CalBddNodeGetThenBdd(bddNode, internalBdd);
+      CalBddIcrRefCount(internalBdd);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+int
+CalCheckAssoc(Cal_BddManager_t *bddManager)
+{
+  CalAssociation_t *assoc, *nextAssoc;
+  int i;
+  int expectedLastBddIndex, bddIndex;
+
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    expectedLastBddIndex = -1;
+    for (i=1; i <= bddManager->numVars; i++){
+      if (CalBddIsBddNull(bddManager, assoc->varAssociation[i]) == 0){
+        bddIndex = bddManager->idToIndex[i];
+        if (expectedLastBddIndex < bddIndex){
+          expectedLastBddIndex = bddIndex;
+        }
+      }
+    }
+    Cal_Assert(expectedLastBddIndex == assoc->lastBddIndex);
+  }
+  /* fix temporary association */
+  assoc = bddManager->tempAssociation;
+  expectedLastBddIndex = -1;
+  for (i=1; i <= bddManager->numVars; i++){
+    if (CalBddIsBddNull(bddManager, assoc->varAssociation[i]) == 0){
+      bddIndex = bddManager->idToIndex[i];
+      if (expectedLastBddIndex < bddIndex){
+        expectedLastBddIndex = bddIndex;
+      }
+    }
+  }
+  Cal_Assert(expectedLastBddIndex == assoc->lastBddIndex);
+  return 1;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalFixupAssoc(Cal_BddManager_t *bddManager, long id1, long id2,
+           CalAssociation_t *assoc)
+{
+  if (assoc->lastBddIndex == -1) return;
+  /* Variable with id1 is moving down a spot. */
+  if ((CalBddIsBddNull(bddManager, assoc->varAssociation[id1]) == 0)
+      && (assoc->lastBddIndex == bddManager->idToIndex[id1])){
+    assoc->lastBddIndex++;
+  }
+  else if ((CalBddIsBddNull(bddManager, assoc->varAssociation[id1])) &&
+           (CalBddIsBddNull(bddManager, assoc->varAssociation[id2]) ==
+            0) && 
+  (assoc->lastBddIndex == bddManager->idToIndex[id2])){
+    assoc->lastBddIndex--;
+  }
+  Cal_Assert((assoc->lastBddIndex >= 0) && (assoc->lastBddIndex <=
+                                           CAL_BDD_CONST_INDEX));
+   
+}
+/**Function********************************************************************
+
+  Synopsis           [Fixes the cofactors of the nodes belonging to
+  the given index.]
+
+  Description        [This routine traverses the unique table and for
+  each node, looks at the then and else cofactors. If needed fixes the
+  cofactors.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddReorderFixCofactors(Cal_BddManager bddManager, Cal_BddId_t id)
+{
+  CalHashTable_t *uniqueTableForId =
+      bddManager->uniqueTable[id];
+  CalBddNode_t *bddNode, *nextBddNode, **bins, *thenBddNode, *elseBddNode;
+  Cal_Bdd_t f0, f1;
+  long numBins;
+  int i, rehashFlag;
+  
+  numBins = uniqueTableForId->numBins;
+  bins = uniqueTableForId->bins;
+
+  for(i = 0; i < numBins; i++) {
+    for(bddNode = bins[i];
+        bddNode != Cal_Nil(CalBddNode_t);
+        bddNode = nextBddNode) {
+      nextBddNode = CalBddNodeGetNextBddNode(bddNode);
+      /*
+       * Process one bddNode at a time
+       */
+      /*
+      ** Because we have kept all the forwarding nodes in the list,
+      ** this should not be a forwarding node.
+      */
+      Cal_Assert(CalBddNodeIsForwarded(bddNode) == 0);
+      Cal_Assert(CalBddNodeIsRefCountZero(bddNode) == 0);
+      thenBddNode = CalBddNodeGetThenBddNode(bddNode);
+      elseBddNode = CalBddNodeGetElseBddNode(bddNode);
+      rehashFlag = 0;
+      CalBddNodeGetThenBdd(bddNode, f1);
+      CalBddNodeGetElseBdd(bddNode, f0);
+      if (CalBddIsForwarded(f1)) {
+        CalBddForward(f1);
+        CalBddNodePutThenBdd(bddNode, f1);
+        rehashFlag = 1;
+      }
+      Cal_Assert(CalBddIsForwarded(f1) == 0);
+      if (CalBddIsForwarded(f0)) {
+        CalBddForward(f0);
+        CalBddNodePutElseBdd(bddNode, f0); 
+        rehashFlag = 1;
+      }
+      Cal_Assert(CalBddIsForwarded(f0) == 0);
+      /* Rehash if necessary */
+      if (rehashFlag) {
+        CalUniqueTableForIdRehashNode(uniqueTableForId, bddNode, thenBddNode,
+                                      elseBddNode);
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+void
+CalBddReorderReclaimForwardedNodes(Cal_BddManager bddManager, int
+                                startIndex, int endIndex)
+{
+  Cal_BddIndex_t index;
+  Cal_BddId_t id;
+  CalHashTable_t *uniqueTableForId;
+  CalNodeManager_t *nodeManager;
+  
+  for(index = startIndex; index <= endIndex; index++){
+    id = bddManager->indexToId[index];
+    uniqueTableForId = bddManager->uniqueTable[id];
+    nodeManager = uniqueTableForId->nodeManager;
+    uniqueTableForId->endNode->nextBddNode = nodeManager->freeNodeList;
+    nodeManager->freeNodeList = uniqueTableForId->startNode.nextBddNode;
+    uniqueTableForId->endNode = &(uniqueTableForId->startNode);
+    uniqueTableForId->startNode.nextBddNode = NULL;
+  }
+  bddManager->numForwardedNodes = 0;
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                          */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/calBdd/calTerminal.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calTerminal.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calTerminal.c	(revision 6)
@@ -0,0 +1,421 @@
+/**CFile***********************************************************************
+
+  FileName    [calTerminal.c]
+
+  PackageName [cal]
+
+  Synopsis    [Contains the terminal function for various BDD operations.]
+
+  Description []
+
+  SeeAlso     []
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu) and
+               Jagesh V. Sanghavi (sanghavi@eecs.berkeley.edu]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calTerminal.c,v 1.1.1.2 1997/02/12 21:11:30 hsv Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpAnd(Cal_BddManager_t * bddManager,
+         Cal_Bdd_t  F,
+         Cal_Bdd_t  G,
+         Cal_Bdd_t * resultBddPtr)
+{
+  if(CalBddIsBddConst(F)){
+    if(CalBddIsBddOne(bddManager, F)){
+      *resultBddPtr = G;
+    }
+    else{
+      *resultBddPtr = F;
+    }
+    return 1;
+  }
+  else if(CalBddIsBddConst(G)){
+    if(CalBddIsBddOne(bddManager, G)){
+      *resultBddPtr = F;
+    }
+    else{
+      *resultBddPtr = G;
+    }
+    return 1;
+  }
+  else{
+    CalBddNode_t *bddNodeF, *bddNodeG;
+    bddNodeF = CalBddGetBddNode(F);
+    bddNodeG = CalBddGetBddNode(G);
+    if((CAL_BDD_POINTER(bddNodeF) == CAL_BDD_POINTER(bddNodeG))){
+      if((CalAddress_t)bddNodeF ^ (CalAddress_t)bddNodeG){
+        *resultBddPtr = CalBddZero(bddManager);
+      }
+      else{
+        *resultBddPtr = F;
+      }
+      return 1;
+    }
+    else{
+      return 0;
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpNand(Cal_BddManager_t * bddManager,
+          Cal_Bdd_t  F,
+          Cal_Bdd_t  G,
+          Cal_Bdd_t * resultBddPtr)
+{
+  if(CalBddIsBddConst(F)){
+    if(CalBddIsBddOne(bddManager, F)){
+      CalBddNot(G, *resultBddPtr);
+    }
+    else{
+      CalBddNot(F, *resultBddPtr);
+    }
+    return 1;
+  }
+  else if(CalBddIsBddConst(G)){
+    if(CalBddIsBddOne(bddManager, G)){
+      CalBddNot(F, *resultBddPtr);
+    }
+    else{
+      CalBddNot(G, *resultBddPtr);
+    }
+    return 1;
+  }
+  else{
+    CalBddNode_t *bddNodeF, *bddNodeG;
+    bddNodeF = CalBddGetBddNode(F);
+    bddNodeG = CalBddGetBddNode(G);
+    if((CAL_BDD_POINTER(bddNodeF) == CAL_BDD_POINTER(bddNodeG))){
+      if((CalAddress_t)bddNodeF ^ (CalAddress_t)bddNodeG){
+        *resultBddPtr = CalBddOne(bddManager);
+      }
+      else{
+        CalBddNot(F, *resultBddPtr);
+      }
+      return 1;
+    }
+    else{
+      return 0;
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpOr(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  F,
+  Cal_Bdd_t  G,
+  Cal_Bdd_t * resultBddPtr)
+{
+  if(CalBddIsBddConst(F)){
+    if(CalBddIsBddOne(bddManager, F)){
+      *resultBddPtr = F;
+    }
+    else{
+      *resultBddPtr = G;
+    }
+    return 1;
+  }
+  else if(CalBddIsBddConst(G)){
+    if(CalBddIsBddOne(bddManager, G)){
+      *resultBddPtr = G;
+    }
+    else{
+      *resultBddPtr = F;
+    }
+    return 1;
+  }
+  else{
+    CalBddNode_t *bddNodeF, *bddNodeG;
+    bddNodeF = CalBddGetBddNode(F);
+    bddNodeG = CalBddGetBddNode(G);
+    if((CAL_BDD_POINTER(bddNodeF) == CAL_BDD_POINTER(bddNodeG))){
+      if((CalAddress_t)bddNodeF ^ (CalAddress_t)bddNodeG){
+        *resultBddPtr = CalBddOne(bddManager);
+      }
+      else{
+        *resultBddPtr = F;
+      }
+      return 1;
+    }
+    else{
+      return 0;
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalOpXor(
+  Cal_BddManager_t * bddManager,
+  Cal_Bdd_t  F,
+  Cal_Bdd_t  G,
+  Cal_Bdd_t * resultBddPtr)
+{
+  if(CalBddIsBddConst(F)){
+    if(CalBddIsBddOne(bddManager, F)){
+      CalBddNot(G, *resultBddPtr);
+    }
+    else{
+      *resultBddPtr = G;
+    }
+    return 1;
+  }
+  else if(CalBddIsBddConst(G)){
+    if(CalBddIsBddOne(bddManager, G)){
+      CalBddNot(F, *resultBddPtr);
+    }
+    else{
+      *resultBddPtr = F;
+    }
+    return 1;
+  }
+  else{
+    CalBddNode_t *bddNodeF, *bddNodeG;
+    bddNodeF = CalBddGetBddNode(F);
+    bddNodeG = CalBddGetBddNode(G);
+    if((CAL_BDD_POINTER(bddNodeF) == CAL_BDD_POINTER(bddNodeG))){
+      if((CalAddress_t)bddNodeF ^ (CalAddress_t)bddNodeG){
+        *resultBddPtr = CalBddOne(bddManager);
+      }
+      else{
+        *resultBddPtr = CalBddZero(bddManager);
+      }
+      return 1;
+    }
+    else{
+      return 0;
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd_t
+CalOpITE(
+  Cal_BddManager_t *bddManager,
+  Cal_Bdd_t f,
+  Cal_Bdd_t g,
+  Cal_Bdd_t h,
+  CalHashTable_t **reqQueForITE)
+{
+  CalBddNode_t *bddNode1, *bddNode2;
+  int complementFlag = 0;
+
+  /*
+   * First phase: Make substitutions 
+   * ITE(F,F,H) = ITE(F,1,H)
+   * ITE(F,F',H) = ITE(F,0,H)
+   * ITE(F,G,F) = ITE(F,G,0)
+   * ITE(F,G,F') = ITE(F,G,1)
+   */
+  bddNode1 = CalBddGetBddNode(f);
+  bddNode2 = CalBddGetBddNode(g);
+  if((CAL_BDD_POINTER(bddNode1) == CAL_BDD_POINTER(bddNode2))){
+    if((CalAddress_t)bddNode1 ^ (CalAddress_t)bddNode2){
+      g = CalBddZero(bddManager);
+    }
+    else{
+      g = CalBddOne(bddManager);
+    }
+  }
+  bddNode2 = CalBddGetBddNode(h);
+  if((CAL_BDD_POINTER(bddNode1) == CAL_BDD_POINTER(bddNode2))){
+    if((CalAddress_t)bddNode1 ^ (CalAddress_t)bddNode2){
+      h = CalBddOne(bddManager);
+    }
+    else{
+      h = CalBddZero(bddManager);
+    }
+  }
+
+  /*
+   * Second phase: Fix the complement pointers.
+   * There are 3 possible cases:
+   * F +ve G -ve: ITE(F ,G',H ) = ITE(F ,G ,H')'
+   * F -ve H +ve: ITE(F',G ,H ) = ITE(F ,H ,G)
+   * F -ve H -ve: ITE(F',G ,H') = ITE(F ,H ,G')'
+   */
+  if(CalBddIsOutPos(f)){
+    if(!CalBddIsOutPos(g)){
+      CalBddNot(g, g);
+      CalBddNot(h, h);
+      complementFlag = 1;
+    }
+  }
+  else{
+    Cal_Bdd_t tmpBdd;
+    CalBddNot(f, f);
+    if(CalBddIsOutPos(h)){
+      tmpBdd = g;
+      g = h;
+      h = tmpBdd;
+    }
+    else{
+      tmpBdd = g;
+      CalBddNot(h, g);
+      CalBddNot(tmpBdd, h);
+      complementFlag = 1;
+    }
+  }
+
+  /*
+   * Third phase: Check for the terminal cases; create new request if needed
+   * ite(1,G,H) = G
+   * ite(0,G,H) = H (impossible by construction in second phase)
+   * ite(F,G,G) = G
+   * ite(F,1,0) = F
+   * ite(F,0,1) = F'(impossible by construction in second phase)
+   */
+  if(CalBddIsBddConst(f) || CalBddIsEqual(g, h)){
+    CalBddUpdatePhase(g, complementFlag);
+    return g;
+  }
+  else if(CalBddIsBddConst(g) && CalBddIsBddConst(h)){
+    CalBddUpdatePhase(f, complementFlag);
+    return f;
+  }
+  else{
+    Cal_BddId_t bddId;
+    Cal_Bdd_t result;
+    CalBddGetMinId3(bddManager, f, g, h, bddId);
+    CalHashTableThreeFindOrAdd(reqQueForITE[bddId], f, g, h, &result);
+    CalBddUpdatePhase(result, complementFlag);
+    return result;
+  }
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/calBdd/calTest.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calTest.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calTest.c	(revision 6)
@@ -0,0 +1,1804 @@
+/**CFile***********************************************************************
+
+  FileName    [calTest.c]
+
+  PackageName [cal]
+
+  Synopsis    [This file contains the test routines for the CAL package.]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan (rajeev@eecs.berkeley.edu)
+               Jagesh Sanghavi  (sanghavi@eecs.berkeley.edu)
+               Modified and extended from the original version written
+               by David Long. 
+              ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calTest.c,v 1.6 2002/08/28 19:26:39 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+#include "time.h"
+#include <signal.h>
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+#define VARS 50
+#define TT_BITS 32              /* Size of tt in bits */
+#define MAX_TT_VARS 20
+#define ITERATIONS 50         /* Number of trials to run */
+#define BITS_PER_INT 32
+#define LG_BITS_PER_INT 5
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef unsigned long TruthTable_t;       /* "Truth table" */
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static Cal_BddManager bddManager;
+static Cal_Bdd vars[VARS];
+static TruthTable_t cofactorMasks[]=
+{
+  0xffff0000,
+  0xff00ff00,
+  0xf0f0f0f0,
+  0xcccccccc,
+  0xaaaaaaaa,
+};
+static int TT_VARS;
+static CalAddress_t asDoubleSpace[2];
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+#define EncodingToBdd(table) (Decode(0, (table)))
+
+#if HAVE_STDARG_H
+static void Error(char *op, Cal_BddManager bddManager, Cal_Bdd result, Cal_Bdd expected, ...);
+#else
+static void Error();
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static double asDouble(CalAddress_t v1, CalAddress_t v2);
+static void asAddress(double n, CalAddress_t * r1, CalAddress_t * r2);
+static char * terminalIdFn(Cal_BddManager bddManager, CalAddress_t v1, CalAddress_t v2, Cal_Pointer_t pointer);
+static void PrintBdd(Cal_BddManager bddManager, Cal_Bdd f);
+static void Error(char *op, Cal_BddManager bddManager, Cal_Bdd result, Cal_Bdd expected, ...);
+static TruthTable_t Cofactor(TruthTable_t table, int var, int value);
+static Cal_Bdd Decode(int var, TruthTable_t table);
+static void TestAnd(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestNand(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestOr(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestITE(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, Cal_Bdd f3, TruthTable_t table3);
+static void TestXor(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestIdNot(Cal_BddManager bddManager, Cal_Bdd f, TruthTable_t table);
+static void TestCompose(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestSubstitute(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, Cal_Bdd f3, TruthTable_t table3);
+static void TestVarSubstitute(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, Cal_Bdd f3, TruthTable_t table3);
+static void TestSwapVars(Cal_BddManager bddManager, Cal_Bdd f, TruthTable_t table);
+static void TestMultiwayAnd(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, Cal_Bdd f3, TruthTable_t table3);
+static void TestMultiwayOr(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, Cal_Bdd f3, TruthTable_t table3);
+static void TestMultiwayLarge(Cal_BddManager bddManager, int numBdds);
+static void TestArrayOp(Cal_BddManager bddManager, int numBdds);
+static void TestInterImpl(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestQnt(Cal_BddManager bddManager, Cal_Bdd f, TruthTable_t table, int bfZeroBFPlusDFOne, int cacheExistsResultsFlag, int cacheOrResultsFlag);
+static void TestAssoc(Cal_BddManager bddManager, Cal_Bdd f, TruthTable_t table);
+static void TestRelProd(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, int bfZeroBFPlusDFOne, int cacheRelProdResultsFlag, int cacheAndResultsFlag, int cacheOrResultsFlag);
+static void TestReduce(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestGenCof(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestSize(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2);
+static void TestSatisfy(Cal_BddManager bddManager, Cal_Bdd f, TruthTable_t table);
+static void TestPipeline(Cal_BddManager bddManager, Cal_Bdd f1, TruthTable_t table1, Cal_Bdd f2, TruthTable_t table2, Cal_Bdd f3, TruthTable_t table3);
+static void TestDump(Cal_BddManager bddManager, Cal_Bdd f);
+static void TestReorderBlock(Cal_BddManager bddManager, TruthTable_t table, Cal_Bdd f);
+static void TestReorder(Cal_BddManager bddManager, TruthTable_t table, Cal_Bdd f);
+static void handler(int ignored);
+static void RandomTests(int numVars, int iterations);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+#ifdef TEST
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+main(int  argc, char ** argv)
+{
+  int numVars, iterations;
+  if(argc < 2){
+    iterations = ITERATIONS;
+  }
+  else{
+    iterations = atoi(argv[1]);
+  }
+  if(argc < 3){
+    TT_VARS = 5;
+  }
+  else {
+    TT_VARS = atoi(argv[2]);
+  }
+  
+  CalUtilSRandom((long)1);
+  numVars = TT_VARS;
+  RandomTests(numVars, iterations);
+  return 0;
+}
+#endif
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static double
+asDouble(
+  CalAddress_t  v1,
+  CalAddress_t  v2)
+{
+  asDoubleSpace[0] = v1;
+  asDoubleSpace[1] = v2;
+  return (*(double *)asDoubleSpace);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+asAddress(
+  double  n,
+  CalAddress_t * r1,
+  CalAddress_t * r2)
+{
+  (*(double *)asDoubleSpace)=n;
+  *r1 = asDoubleSpace[0];
+  *r2 = asDoubleSpace[1];
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static char *
+terminalIdFn(
+  Cal_BddManager bddManager,
+  CalAddress_t  v1,
+  CalAddress_t  v2,
+  Cal_Pointer_t  pointer)
+{
+  static char result[100];
+  sprintf(result, "%g", asDouble(v1, v2));
+  return (result);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+PrintBdd(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f)
+{
+  Cal_BddPrintBdd(bddManager, f, Cal_BddNamingFnNone, 
+		  (Cal_TerminalIdFn_t) terminalIdFn,
+                  (Cal_Pointer_t)0, stderr); 
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+#if HAVE_STDARG_H
+static void
+Error(char *op, Cal_BddManager bddManager, Cal_Bdd result,
+      Cal_Bdd expected, ...)
+{
+  va_list ap;
+  Cal_Bdd userBdd;
+  int i;
+
+  va_start(ap, expected);
+#else
+static void
+Error(va_alist)
+va_dcl
+{
+  va_list ap;
+  char *op;
+  Cal_BddManager_t *bddManager;
+  Cal_Bdd result, expected;
+  Cal_Bdd userBdd;
+  int i;
+  
+  va_start(ap);
+  op   = va_arg(ap, char *);
+  bddManager = va_arg(ap, Cal_BddManager_t *);
+  result = va_arg(ap, Cal_Bdd);
+  expected = va_arg(ap, Cal_Bdd);
+#endif
+
+  fprintf(stderr, "\nError: operation %s:\n", op);
+  i=0;
+  while (1) {
+    if ((userBdd = va_arg(ap, Cal_Bdd))){
+	  ++i;
+	  fprintf(stderr, "Argument %d:\n", i);
+	  Cal_BddFunctionPrint(bddManager, userBdd, "a");
+	}
+    else
+      break;
+  }
+  fprintf(stderr, "Expected result:\n");
+  Cal_BddFunctionPrint(bddManager, expected, "a");
+  fprintf(stderr, "Result:\n");
+  Cal_BddFunctionPrint(bddManager, result, "a");
+  va_end(ap);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static TruthTable_t
+Cofactor(TruthTable_t  table, int  var, int  value)
+{
+  int shift;
+  
+  shift = 1 << (TT_VARS-var-1);
+  if(value) {
+    table &= cofactorMasks[var];
+    table |= table >> shift;
+  }
+  else {
+    table &= ~cofactorMasks[var];
+    table |= table << shift;
+  }
+  return (table);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static Cal_Bdd
+Decode(int  var, TruthTable_t  table)
+{
+  Cal_Bdd temp1, temp2;
+  Cal_Bdd result;
+  Cal_Bdd left, right;
+  Cal_Bdd varBdd;
+
+  if(var == TT_VARS){
+    if(table & 0x1){
+      result = Cal_BddOne(bddManager);
+    }
+    else{
+      result = Cal_BddZero(bddManager);
+    }
+  }
+  else{
+    temp1 = Decode(var+1, table >> (1 << (TT_VARS-var-1)));
+    temp2 = Decode(var+1, table);
+    left = Cal_BddAnd(bddManager, vars[var], temp1);
+    varBdd = Cal_BddNot(bddManager, vars[var]);
+    right = Cal_BddAnd(bddManager, varBdd, temp2);
+    result = Cal_BddOr(bddManager, left, right);
+    /*
+    result = Cal_BddITE(bddManager, vars[var], temp1, temp2);
+    */
+    Cal_BddFree(bddManager, left);
+    Cal_BddFree(bddManager, right);
+    Cal_BddFree(bddManager, temp1);
+    Cal_BddFree(bddManager, temp2);
+    Cal_BddFree(bddManager, varBdd);
+  }
+  return (result);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestAnd(Cal_BddManager bddManager, Cal_Bdd  f1, TruthTable_t  table1,
+        Cal_Bdd  f2, TruthTable_t  table2)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+
+  result = Cal_BddAnd(bddManager, f1, f2);
+  resulttable = table1 & table2;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("AND", bddManager, result, expected, f1, f2, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestNand(Cal_BddManager bddManager, Cal_Bdd  f1, TruthTable_t  table1,
+        Cal_Bdd  f2, TruthTable_t  table2)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+
+  result = Cal_BddNand(bddManager, f1, f2);
+  resulttable = ~(table1 & table2);
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("NAND", bddManager, result, expected, f1, f2, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestOr(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+
+  result = Cal_BddOr(bddManager, f1, f2);
+  resulttable = table1 | table2;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("OR", bddManager,result, expected, f1, f2, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestITE(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2,
+  Cal_Bdd  f3,
+  TruthTable_t  table3)
+{
+  Cal_Bdd result;
+  TruthTable_t resultTable;
+  Cal_Bdd expected;
+
+  result = Cal_BddITE(bddManager, f1, f2, f3);
+  resultTable = (table1 & table2) | (~table1 & table3);
+  expected = EncodingToBdd(resultTable);
+  if(Cal_BddIsEqual(bddManager, result, expected) == 0){
+    Error("ITE", bddManager, result, expected, f1, f2, f3,
+          (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestXor(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+
+  result = Cal_BddXor(bddManager, f1, f2);
+  resulttable = table1 ^ table2;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("XOR", bddManager, result, expected, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestIdNot(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f,
+  TruthTable_t  table)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+
+  result = Cal_BddNot(bddManager, f);
+  resulttable = ~table;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("Not", bddManager, result, expected, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+  result = Cal_BddIdentity(bddManager, f);
+  resulttable = table;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("Identity", bddManager, result, expected, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+  
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestCompose(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  int var;
+  Cal_Bdd result, expected;
+  TruthTable_t resulttable;
+  
+
+  var = (int)(((long)CalUtilRandom())%TT_VARS);
+
+  result = Cal_BddCompose(bddManager, vars[var], vars[var], Cal_BddOne(bddManager));
+  if(!Cal_BddIsEqual(bddManager, result, Cal_BddOne(bddManager))){
+    Cal_BddFunctionPrint(bddManager, result, "Compose"); 
+  }
+
+  result = Cal_BddCompose(bddManager, vars[var], vars[var], Cal_BddZero(bddManager));
+  if(!Cal_BddIsEqual(bddManager, result, Cal_BddZero(bddManager))){
+    Cal_BddFunctionPrint(bddManager, result, "Compose"); 
+  }
+
+  result = Cal_BddCompose(bddManager, f1, vars[var], Cal_BddOne(bddManager));
+  resulttable = Cofactor(table1, var, 1);
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result,expected)){
+    Error("Restrict 1", bddManager, result, expected, f1, vars[var],
+          (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+
+  result = Cal_BddCompose(bddManager, f1, vars[var], Cal_BddZero(bddManager));
+  resulttable = Cofactor(table1, var, 0);
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("Restrict 0", bddManager, result, expected, f1, vars[var],
+          (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+
+  result = Cal_BddCompose(bddManager, f1, vars[var], f2);
+  resulttable = (table2 & Cofactor(table1, var, 1)) |
+      (~table2 & Cofactor(table1, var, 0));
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("Compose", bddManager, result, expected, f1, vars[var],
+          f2, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestSubstitute(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2,
+  Cal_Bdd  f3,
+  TruthTable_t  table3)
+{
+  int var1, var2;
+  Cal_Bdd associationInfo[6];
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  TruthTable_t temp1, temp2, temp3, temp4;
+  Cal_Bdd expected;
+  int assocId;
+  
+  var1 = (int)(((long)CalUtilRandom())%TT_VARS);
+  do{
+    var2 = (int)(((long)CalUtilRandom())%TT_VARS);
+  }while (var1 == var2);
+
+  associationInfo[0] = vars[var1];
+  associationInfo[1] = f2;
+  associationInfo[2] = vars[var2];
+  associationInfo[3] = f3;
+  associationInfo[4] = (Cal_Bdd) 0;
+  associationInfo[5] = (Cal_Bdd) 0;
+
+  assocId = Cal_AssociationInit(bddManager, associationInfo, 1);
+  Cal_AssociationSetCurrent(bddManager, assocId);
+
+  result = Cal_BddSubstitute(bddManager, f1);
+  temp1 = Cofactor(Cofactor(table1, var1, 1), var2, 1);
+  temp2 = Cofactor(Cofactor(table1, var1, 1), var2, 0);
+  temp3 = Cofactor(Cofactor(table1, var1, 0), var2, 1);
+  temp4 = Cofactor(Cofactor(table1, var1, 0), var2, 0);
+  resulttable = table2 & table3 & temp1;
+  resulttable |= table2 & ~table3 & temp2;
+  resulttable |= ~table2 & table3 & temp3;
+  resulttable |= ~table2 & ~table3 & temp4;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("substitute", bddManager, result, expected,
+        f1, vars[var1], f2, vars[var2], f3, (Cal_Bdd) 0);
+  }
+  /*Cal_AssociationQuit(bddManager, assocId);*/
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestVarSubstitute(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2,
+  Cal_Bdd  f3,
+  TruthTable_t  table3)
+{
+  int var1, var2, var3, var4;
+  Cal_Bdd associationInfo[6];
+  Cal_Bdd result1, result2;
+  TruthTable_t resulttable;
+  TruthTable_t temp1, temp2, temp3, temp4;
+  Cal_Bdd expected;
+  int assocId;
+  
+  var1 = (int)(((long)CalUtilRandom())%TT_VARS);
+  do{
+    var3 = (int)(((long)CalUtilRandom())%TT_VARS);
+  }while (var1 == var3);
+
+  var2 = (int)(((long)CalUtilRandom())%TT_VARS);
+  do{
+    var4 = (int)(((long)CalUtilRandom())%TT_VARS);
+  }while (var2 == var4);
+
+  /*
+  f1 = vars[0];
+  table1 = cofactorMasks[0];
+  */
+  associationInfo[0] = vars[var1];
+  associationInfo[1] = vars[var3];
+  associationInfo[2] = vars[var2];
+  associationInfo[3] = vars[var4];
+  associationInfo[4] = (Cal_Bdd) 0;
+  associationInfo[5] = (Cal_Bdd) 0;
+
+  assocId = Cal_AssociationInit(bddManager, associationInfo, 1);
+  Cal_AssociationSetCurrent(bddManager, assocId);
+
+  result1 = Cal_BddVarSubstitute(bddManager, f1);
+  result2 = Cal_BddSubstitute(bddManager, f1);
+  temp1 = Cofactor(Cofactor(table1, var2, 1), var1, 1);
+  temp2 = Cofactor(Cofactor(table1, var2, 1), var1, 0);
+  temp3 = Cofactor(Cofactor(table1, var2, 0), var1, 1);
+  temp4 = Cofactor(Cofactor(table1, var2, 0), var1, 0);
+  resulttable = cofactorMasks[var3] & cofactorMasks[var4] & temp1;
+  resulttable |= ~cofactorMasks[var3] & cofactorMasks[var4] & temp2;
+  resulttable |= cofactorMasks[var3] & ~cofactorMasks[var4] & temp3;
+  resulttable |= ~cofactorMasks[var3] & ~cofactorMasks[var4] & temp4;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result1, result2)){
+    Error("var substitute and substitute differ", bddManager, result1, result2,
+        f1, vars[var1], vars[var3], vars[var2], vars[var4],
+          (Cal_Bdd) 0); 
+  }
+  if(!Cal_BddIsEqual(bddManager, result1, expected)){
+    Error("var substitute", bddManager, result1, expected,
+        f1, vars[var1], vars[var3], vars[var2], vars[var4],
+          (Cal_Bdd) 0); 
+  }
+  /*Cal_AssociationQuit(bddManager, assocId);*/
+  Cal_BddFree(bddManager, result1);
+  Cal_BddFree(bddManager, result2);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestSwapVars(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f,
+  TruthTable_t  table)
+{
+  int var1, var2;
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  TruthTable_t temp1, temp2, temp3, temp4;
+  Cal_Bdd expected;
+
+  var1 = (int)(((long)CalUtilRandom())%TT_VARS);
+  var2 = (int)(((long)CalUtilRandom())%TT_VARS);
+  result = Cal_BddSwapVars(bddManager, f, vars[var1], vars[var2]);
+  temp1 = Cofactor(Cofactor(table, var1, 1), var2, 1);
+  temp2 = Cofactor(Cofactor(table, var1, 1), var2, 0);
+  temp3 = Cofactor(Cofactor(table, var1, 0), var2, 1);
+  temp4 = Cofactor(Cofactor(table, var1, 0), var2, 0);
+  resulttable = cofactorMasks[var2] & cofactorMasks[var1] & temp1;
+  resulttable |= cofactorMasks[var2] & ~cofactorMasks[var1] & temp2;
+  resulttable |= ~cofactorMasks[var2] & cofactorMasks[var1] & temp3;
+  resulttable |= ~cofactorMasks[var2] & ~cofactorMasks[var1] & temp4;
+  expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("swap variables", bddManager, result, expected, 
+        f, vars[var1], vars[var2], (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestMultiwayAnd(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2,
+  Cal_Bdd  f3,
+  TruthTable_t  table3)
+{
+	Cal_Bdd result;
+	TruthTable_t resulttable;
+	Cal_Bdd expected;
+	Cal_Bdd *calBddArray;
+
+    calBddArray = Cal_MemAlloc(Cal_Bdd, 4);
+    calBddArray[0] = f1;
+    calBddArray[1] = f2;
+    calBddArray[2] = f3;
+    calBddArray[3] = (Cal_Bdd) 0;
+	result = Cal_BddMultiwayAnd(bddManager, calBddArray);
+	resulttable = table1 & table2 & table3;
+	expected = EncodingToBdd(resulttable);
+    if(!Cal_BddIsEqual(bddManager, result, expected)){
+      Error("Multiway And", bddManager, result, expected,
+            (Cal_Bdd) 0);
+    }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+  Cal_MemFree(calBddArray);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestMultiwayOr(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2,
+  Cal_Bdd  f3,
+  TruthTable_t  table3)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+  Cal_Bdd *calBddArray;
+  
+  calBddArray = Cal_MemAlloc(Cal_Bdd, 4);
+  calBddArray[0] = f1;
+  calBddArray[1] = f2;
+  calBddArray[2] = f3;
+  calBddArray[3] = (Cal_Bdd) 0;
+  result = Cal_BddMultiwayOr(bddManager, calBddArray);
+  resulttable = table1 | table2 | table3;
+	expected = EncodingToBdd(resulttable);
+  if(!Cal_BddIsEqual(bddManager, result, expected)){
+    Error("Multiway Or", bddManager, result, expected, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+  Cal_MemFree(calBddArray);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestMultiwayLarge(
+  Cal_BddManager bddManager,
+  int  numBdds)
+{
+  TruthTable_t table, andResulttable, orResulttable;
+  Cal_Bdd f, andResult, orResult, andExpected, orExpected;
+  int i;
+  Cal_Bdd *calBddArray;
+  
+  andResulttable = ~0x0;
+  orResulttable = 0x0;
+  calBddArray = Cal_MemAlloc(Cal_Bdd, numBdds+1);
+  for (i=0; i<numBdds; i++){
+    table = (TruthTable_t)CalUtilRandom();
+    f = EncodingToBdd(table);
+    calBddArray[i] = f;
+    andResulttable &= table;
+    orResulttable |= table;
+  }
+  calBddArray[numBdds] = (Cal_Bdd) 0;
+  andResult = Cal_BddMultiwayAnd(bddManager, calBddArray);
+  orResult = Cal_BddMultiwayOr(bddManager, calBddArray);
+  andExpected = EncodingToBdd(andResulttable);
+  orExpected = EncodingToBdd(orResulttable);
+  if(!Cal_BddIsEqual(bddManager, andResult, andExpected)){
+    Error("Multiway And", bddManager, andResult, andExpected,
+          (Cal_Bdd) 0);
+  }
+  if(!Cal_BddIsEqual(bddManager, orResult, orExpected)){
+    Error("Multiway Or", bddManager, andResult, andExpected,
+          (Cal_Bdd) 0);
+  }
+  for (i=0; i<numBdds; i++) Cal_BddFree(bddManager, calBddArray[i]);
+  Cal_MemFree(calBddArray);
+  Cal_BddFree(bddManager, andResult);
+  Cal_BddFree(bddManager, andExpected);
+  Cal_BddFree(bddManager, orResult);
+  Cal_BddFree(bddManager, orExpected);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestArrayOp(Cal_BddManager bddManager,  int  numBdds)
+{
+  TruthTable_t fTable, gTable;
+  Cal_Bdd f, g, *andExpectedArray, *orExpectedArray, *calBddArray;
+  Cal_Bdd *andResultArray, *orResultArray;
+  int i;
+  
+  calBddArray = Cal_MemAlloc(Cal_Bdd, 2*numBdds+1);
+  andExpectedArray = Cal_MemAlloc(Cal_Bdd, numBdds);
+  orExpectedArray = Cal_MemAlloc(Cal_Bdd, numBdds);
+  calBddArray[numBdds<<1] = (Cal_Bdd) 0;
+
+  for (i=0; i<numBdds; i++){
+    fTable = (TruthTable_t)CalUtilRandom();
+    gTable = (TruthTable_t)CalUtilRandom();
+    f = EncodingToBdd(fTable);
+    g = EncodingToBdd(gTable);
+    calBddArray[i<<1] = f;
+    calBddArray[(i<<1)+1] = g;
+    andExpectedArray[i] = EncodingToBdd(fTable & gTable);
+    orExpectedArray[i] = EncodingToBdd(fTable | gTable);
+  }
+  
+  andResultArray = Cal_BddPairwiseAnd(bddManager, calBddArray);
+  orResultArray = Cal_BddPairwiseOr(bddManager, calBddArray);
+
+  for (i=0; i<numBdds; i++){
+    if(!Cal_BddIsEqual(bddManager, andResultArray[i], andExpectedArray[i])){
+      Error("Array OR", bddManager, andResultArray[i], andExpectedArray[i],
+            (Cal_Bdd) 0);
+      break;
+    }
+  }
+
+  for (i=0; i<numBdds; i++){
+    if(!Cal_BddIsEqual(bddManager, orResultArray[i], orExpectedArray[i])){
+      Error("Array OR", bddManager, orResultArray[i], orExpectedArray[i],
+            (Cal_Bdd) 0);
+      break;
+    }
+  }
+  for (i=0; i<numBdds; i++){
+    Cal_BddFree(bddManager, calBddArray[i<<1]);
+    Cal_BddFree(bddManager, calBddArray[(i<<1)+1]);
+    Cal_BddFree(bddManager, andExpectedArray[i]);
+    Cal_BddFree(bddManager, orExpectedArray[i]);
+    Cal_BddFree(bddManager, andResultArray[i]);
+    Cal_BddFree(bddManager, orResultArray[i]);
+  }
+  Cal_MemFree(calBddArray);
+  Cal_MemFree(andExpectedArray);
+  Cal_MemFree(orExpectedArray);
+  Cal_MemFree(andResultArray);
+  Cal_MemFree(orResultArray);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestInterImpl(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  Cal_Bdd result;
+  TruthTable_t resulttable;
+  Cal_Bdd expected;
+  Cal_Bdd impliesResult;
+
+  result = Cal_BddIntersects(bddManager, f1, f2);
+  resulttable = table1 & table2;
+  expected = EncodingToBdd(resulttable);
+  impliesResult = Cal_BddImplies(bddManager, result, expected);
+  if(Cal_BddIsBddZero(bddManager, impliesResult) == 0){
+    Error("intersection test", bddManager, result, expected, f1, f2,
+          (Cal_Bdd) 0); 
+  }
+  Cal_BddFree(bddManager, impliesResult);
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestQnt(Cal_BddManager bddManager, Cal_Bdd  f, TruthTable_t  table, int
+        bfZeroBFPlusDFOne, int cacheExistsResultsFlag, int cacheOrResultsFlag)
+{
+  int var1, var2;
+  Cal_Bdd assoc[3];
+  Cal_Bdd result, expected;
+  TruthTable_t  resultTable;
+  int associationId;
+  
+  var1= (int)(((long)CalUtilRandom())%TT_VARS);
+  do
+    var2= (int)(((long)CalUtilRandom())%TT_VARS);
+  while (var1 == var2);
+  assoc[0] = vars[var1];
+  assoc[1] = vars[var2];
+  assoc[2] = (Cal_Bdd) 0;
+  associationId = Cal_AssociationInit(bddManager, assoc, 0);
+  Cal_AssociationSetCurrent(bddManager, associationId);
+  result = Cal_BddExists(bddManager, f);
+  resultTable = Cofactor(table, var1, 1) | Cofactor(table, var1, 0);
+  resultTable = Cofactor(resultTable, var2, 1) | Cofactor(resultTable,
+                                                          var2, 0); 
+  expected = EncodingToBdd(resultTable);
+  if(Cal_BddIsEqual(bddManager, result, expected) == 0){
+    Error("quantification", bddManager, result, expected, f, vars[var1],
+          vars[var2], (Cal_Bdd) 0);
+  }
+  /*Cal_AssociationQuit(bddManager, associationId);*/
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestAssoc(Cal_BddManager bddManager, Cal_Bdd  f, TruthTable_t  table)
+{
+  Cal_Bdd assoc[3];
+  Cal_Bdd result, expected;
+  int associationId;
+  
+  assoc[0] = (Cal_Bdd) 0;
+  associationId = Cal_AssociationInit(bddManager, assoc, 0);
+  Cal_AssociationSetCurrent(bddManager, associationId);
+  result = Cal_BddExists(bddManager, f);
+  expected = Cal_BddIdentity(bddManager, f);
+  if(Cal_BddIsEqual(bddManager, result, expected) == 0){
+    Error("quantification", bddManager, result, expected, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestRelProd(Cal_BddManager bddManager, Cal_Bdd  f1, TruthTable_t
+            table1, Cal_Bdd  f2, TruthTable_t  table2, int bfZeroBFPlusDFOne,
+            int cacheRelProdResultsFlag, int cacheAndResultsFlag, int
+            cacheOrResultsFlag) 
+{
+  int var1, var2;
+  Cal_Bdd assoc[3];
+  Cal_Bdd result;
+  TruthTable_t resultTable;
+  Cal_Bdd expected;
+  int assocId;
+  
+  var1=(int)(((long)CalUtilRandom())%TT_VARS);
+  do
+    var2=(int)(((long)CalUtilRandom())%TT_VARS);
+  while (var1 == var2);
+  assoc[0] = vars[var1];
+  assoc[1] = vars[var2];
+  assoc[2] = (Cal_Bdd) 0;
+  assocId = Cal_AssociationInit(bddManager, assoc, 0);
+  Cal_AssociationSetCurrent(bddManager, assocId);
+  result = Cal_BddRelProd(bddManager, f1, f2);
+  table1 &= table2;
+  resultTable = Cofactor(table1, var1, 1) | Cofactor(table1, var1, 0);
+  resultTable = Cofactor(resultTable, var2, 1) | Cofactor(resultTable, var2, 0);
+  expected = EncodingToBdd(resultTable);
+  if(Cal_BddIsEqual(bddManager, result, expected) == 0){
+    Error("relational product", bddManager, result, expected, f1, f2,
+          vars[var1], vars[var2], (Cal_Bdd) 0);
+  }
+  /*Cal_AssociationQuit(bddManager, assocId);*/
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestReduce(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  Cal_Bdd result;
+  Cal_Bdd temp1, temp2, temp3;
+
+  result = Cal_BddReduce(bddManager, f1, f2);
+  temp1 = Cal_BddXnor(bddManager, result, f1);
+  temp2 = Cal_BddNot(bddManager, f2);
+  temp3 = Cal_BddOr(bddManager, temp1, temp2);
+  if(Cal_BddIsBddOne(bddManager, temp3) == 0){
+    Error("d.c. comparison of reduce", bddManager, temp3,
+          Cal_BddOne(bddManager), f1, f2, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, temp1);
+  Cal_BddFree(bddManager, temp2);
+  Cal_BddFree(bddManager, temp3);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestGenCof(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  int var1, var2;
+  Cal_Bdd result, temp1, temp2, temp3, expected;
+  TruthTable_t resultTable;
+
+  result = Cal_BddCofactor(bddManager, f1, f2);
+  temp1 = Cal_BddXnor(bddManager, result, f1);
+  temp2 = Cal_BddNot(bddManager, f2);
+  temp3 = Cal_BddOr(bddManager, temp1, temp2);
+  if (Cal_BddIsBddOne(bddManager, temp3) == 0){
+    Error("d.c. comparison of generalized cofactor", bddManager,
+          temp3, Cal_BddOne(bddManager), f1, f2, (Cal_Bdd) 0);
+  }
+
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, temp1);
+  Cal_BddFree(bddManager, temp2);
+  Cal_BddFree(bddManager, temp3);
+  var1=(int)(((long)CalUtilRandom())%TT_VARS);
+  do
+    var2=(int)(((long)CalUtilRandom())%TT_VARS);
+  while (var1 == var2);
+  temp1 = Cal_BddNot(bddManager, vars[var2]);
+  temp2 = Cal_BddAnd(bddManager, vars[var1], temp1);
+  Cal_BddFree(bddManager, temp1);
+  result = Cal_BddCofactor(bddManager, f1, temp2);
+  resultTable = Cofactor(Cofactor(table1, var1, 1), var2, 0);
+  expected = EncodingToBdd(resultTable);
+  if (Cal_BddIsEqual(bddManager, result, expected) == 0){
+    Error("generalized cofactor", bddManager, result, expected, f1,
+          temp2, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+  Cal_BddFree(bddManager, temp2);
+}
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestSize(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f1,
+  TruthTable_t  table1,
+  Cal_Bdd  f2,
+  TruthTable_t  table2)
+{
+  int i;
+  long size;
+  long profile[MAX_TT_VARS+1];
+  Cal_Bdd fs[3];
+
+  size = Cal_BddSize(bddManager, f1, 1);
+  Cal_BddProfile(bddManager, f1, profile, 1);
+  for(i = 0; i < TT_VARS+1; i++){
+    size -= profile[i];
+  }
+  if(size){
+    fprintf(stderr, "\nError: size count vs. profile sum:\n");
+    fprintf(stderr, "Argument:\n");
+    Cal_BddFunctionPrint(bddManager, f1, "f1");
+  }
+
+  size = Cal_BddSize(bddManager, f1, 0);
+  Cal_BddProfile(bddManager, f1, profile, 0);
+  for(i = 0; i < TT_VARS+1; i++){
+    size -= profile[i];
+  }
+  if(size){
+    fprintf(stderr, "\nError: no negout size count vs. profile sum:\n");
+    fprintf(stderr, "Argument:\n");
+    Cal_BddFunctionPrint(bddManager, f1, "f1");
+  }
+
+
+  fs[0] = f1;
+  fs[1] = f2;
+  fs[2] = (Cal_Bdd) 0;
+
+  size = Cal_BddSizeMultiple(bddManager, fs, 1);
+  Cal_BddProfileMultiple(bddManager, fs, profile, 1);
+  for(i = 0; i < TT_VARS+1; i++){
+    size -= profile[i];
+  }
+  if(size){
+    fprintf(stderr,"\nError: multiple size count vs. multiple profile sum:\n");
+    fprintf(stderr, "Argument 1:\n");
+    Cal_BddFunctionPrint(bddManager, f1, "f1");
+    fprintf(stderr, "Argument 2:\n");
+    Cal_BddFunctionPrint(bddManager, f2, "f2");
+  }
+
+  size = Cal_BddSizeMultiple(bddManager, fs, 0);
+  Cal_BddProfileMultiple(bddManager, fs, profile, 0);
+  for(i = 0; i < TT_VARS+1; i++){
+    size -= profile[i];
+  }
+  if(size){
+    fprintf(stderr,"\nError: multiple no negout size count vs. multiple profile sum:\n");
+    fprintf(stderr, "Argument 1:\n");
+    Cal_BddFunctionPrint(bddManager, f1, "f1");
+    fprintf(stderr, "Argument 2:\n");
+    Cal_BddFunctionPrint(bddManager, f2, "f2");
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestSatisfy(
+  Cal_BddManager bddManager,
+  Cal_Bdd  f,
+  TruthTable_t  table)
+{
+  int var1, var2;
+  Cal_Bdd assoc[MAX_TT_VARS+1];
+  Cal_Bdd result;
+  Cal_Bdd temp1, temp2, temp3;
+  int assocId;
+  
+  if(Cal_BddIsBddZero(bddManager, f)){
+    return;
+  }
+  result = Cal_BddSatisfy(bddManager, f);
+  temp1 = Cal_BddNot(bddManager, f);
+  temp2 = Cal_BddIntersects(bddManager, temp1, result);
+  if(!Cal_BddIsBddZero(bddManager, temp2)){
+    Error("intersection of satisfy result with negated argument",
+        bddManager, temp2, Cal_BddZero(bddManager), f, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, temp1);
+  Cal_BddFree(bddManager, temp2);
+
+  var1 = (int)(((long)CalUtilRandom())%TT_VARS);
+  do{
+    var2 = (int)(((long)CalUtilRandom())%TT_VARS);
+  }while (var1 == var2);
+  assoc[0] = vars[var1];
+  assoc[1] = vars[var2];
+  assoc[2] = (Cal_Bdd) 0;
+  assocId = Cal_AssociationInit(bddManager, assoc, 0);
+  Cal_AssociationSetCurrent(bddManager, assocId);
+  temp1 = Cal_BddSatisfySupport(bddManager, result);
+  temp2 = Cal_BddNot(bddManager, result);
+  temp3 = Cal_BddIntersects(bddManager, temp2, temp1);
+  if(!Cal_BddIsBddZero(bddManager, temp3)){
+    Error("intersection of satisfy support result with negated argument",
+        bddManager, temp3, Cal_BddZero(bddManager), result,
+        (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, temp1);
+  Cal_BddFree(bddManager, temp2);
+  Cal_BddFree(bddManager, temp3);
+  temp1 = Cal_BddCompose(bddManager, f, vars[var1], Cal_BddZero(bddManager));
+  temp2 = Cal_BddCompose(bddManager, f, vars[var1], Cal_BddOne(bddManager));
+  if(Cal_BddSatisfyingFraction(bddManager, temp1) + 
+      Cal_BddSatisfyingFraction(bddManager, temp2) !=
+      2.0 * Cal_BddSatisfyingFraction(bddManager, f)){
+    fprintf(stderr, "\nError: operation satisfying fraction:\n");
+    fprintf(stderr, "Argument:\n");
+    Cal_BddFunctionPrint(bddManager, f, "f");
+    fprintf(stderr, "Cofactor on:\n");
+    Cal_BddFunctionPrint(bddManager, vars[var1], "var");
+  }
+  /*Cal_AssociationQuit(bddManager, assocId);*/
+  Cal_BddFree(bddManager, temp1);
+  Cal_BddFree(bddManager, temp2);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestPipeline(Cal_BddManager bddManager,
+             Cal_Bdd  f1,
+             TruthTable_t  table1,
+             Cal_Bdd  f2,
+             TruthTable_t  table2,
+             Cal_Bdd  f3,
+             TruthTable_t  table3)
+{
+  Cal_Bdd temp1, temp2, temp3, temp4, temp5, result, expected;
+  TruthTable_t table;
+
+  Cal_PipelineInit(bddManager, CAL_AND);
+  Cal_PipelineSetDepth(bddManager, 0);
+  temp1 = Cal_PipelineCreateProvisionalBdd(bddManager, f1, f2);
+  temp2 = Cal_PipelineCreateProvisionalBdd(bddManager, f1, f3);
+  temp3 = Cal_PipelineCreateProvisionalBdd(bddManager, f1, temp1);
+  temp4 = Cal_PipelineCreateProvisionalBdd(bddManager, f2, temp2);
+  temp5 = Cal_PipelineCreateProvisionalBdd(bddManager, temp3, temp4);
+  result = Cal_PipelineCreateProvisionalBdd(bddManager, temp4, temp5);
+  Cal_PipelineExecute(bddManager);
+  result = Cal_PipelineUpdateProvisionalBdd(bddManager, result);
+  Cal_PipelineQuit(bddManager);
+
+  table = table1 & table2 & table3;
+  expected = EncodingToBdd(table);
+
+  if (Cal_BddIsEqual(bddManager, result, expected) == 0){
+    Error("pipeline", bddManager, result, expected, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, result);
+  Cal_BddFree(bddManager, expected);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestDump(Cal_BddManager bddManager, Cal_Bdd f)
+{
+  FILE *fp;
+  int i, j;
+  Cal_Bdd dumpVars[MAX_TT_VARS];
+  Cal_Bdd temp, result;
+  int err;
+
+  if (!(fp=tmpfile()))
+    {
+      fprintf(stderr, "could not open temporary file\n");
+      exit(1);
+    }
+  for (i=0; i < TT_VARS; ++i)
+    dumpVars[i]=vars[i];
+  dumpVars[i]= (Cal_Bdd) 0;
+  for (i=0; i < TT_VARS-1; ++i)
+    {
+      j=i+(int)(((long)CalUtilRandom())%(TT_VARS-i));
+      temp=dumpVars[i];
+      dumpVars[i]=dumpVars[j];
+      dumpVars[j]=temp;
+    }
+  if (!Cal_BddDumpBdd(bddManager, f, dumpVars, fp))
+    {
+      fprintf(stderr, "Error: dump failure:\n");
+      fprintf(stderr, "Argument:\n");
+      PrintBdd(bddManager, f);
+      fclose(fp);
+      return;
+    }
+  rewind(fp);
+  if (!(result=Cal_BddUndumpBdd(bddManager, dumpVars, fp, &err)) || err)
+    {
+      fprintf(stderr, "Error: undump failure: code %d:\n", err);
+      fprintf(stderr, "Argument:\n");
+      PrintBdd(bddManager, f);
+      fclose(fp);
+      return;
+    }
+  fclose(fp);
+  if (result != f)
+    Error("dump/undump", bddManager, result, f, f, (Cal_Bdd) 0);
+  Cal_BddFree(bddManager, result);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestReorderBlock(Cal_BddManager bddManager, TruthTable_t table, Cal_Bdd f)
+{
+  Cal_Bdd newFunction;
+  Cal_Block block1, block2, block3;
+  
+  /*if (CalUtilRandom()&0x1){*/
+  if (1){
+    fprintf(stdout, "Using Window\n");
+    Cal_BddDynamicReordering(bddManager, CAL_REORDER_WINDOW);
+  }
+  else{
+    fprintf(stdout, "Using Sift\n");
+    Cal_BddDynamicReordering(bddManager, CAL_REORDER_SIFT);
+  }
+  /* Create some blocks */
+  block1 = Cal_BddNewVarBlock(bddManager,
+                              vars[bddManager->indexToId[0]-1],
+                              4); 
+  block2 = Cal_BddNewVarBlock(bddManager,
+                              vars[bddManager->indexToId[4]-1],
+                              4);
+  block3 = Cal_BddNewVarBlock(bddManager,
+                              vars[bddManager->indexToId[8]-1],
+                              4);
+  Cal_BddVarBlockReorderable(bddManager, block2, 1);
+  Cal_BddReorder(bddManager);
+  newFunction = EncodingToBdd(table);
+  if (Cal_BddIsEqual(bddManager, f, newFunction) == 0){
+    Error("Reordering (window)", bddManager, newFunction, f, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, newFunction);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+TestReorder(Cal_BddManager bddManager, TruthTable_t table, Cal_Bdd f)
+{
+  Cal_Bdd newFunction;
+  
+  if (CalUtilRandom()&0x1){
+    fprintf(stdout, "Using Window\n");
+    Cal_BddDynamicReordering(bddManager, CAL_REORDER_WINDOW);
+  }
+  else{
+    fprintf(stdout, "Using Sift\n");
+    Cal_BddDynamicReordering(bddManager, CAL_REORDER_SIFT);
+  }
+  if (CalUtilRandom()&0x1){
+    bddManager->reorderMethod = CAL_REORDER_METHOD_BF;
+  }
+  else{
+    bddManager->reorderMethod = CAL_REORDER_METHOD_DF;
+  }
+  Cal_BddReorder(bddManager);
+  newFunction = EncodingToBdd(table);
+  if (Cal_BddIsEqual(bddManager, f, newFunction) == 0){
+    Error("Reordering (window)", bddManager, newFunction, f, (Cal_Bdd) 0);
+  }
+  Cal_BddFree(bddManager, newFunction);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+handler(int ignored)
+{
+  printf("arthimetic exception ############\n");
+}
+
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+static void
+RandomTests(int numVars, int  iterations)
+{
+  int i, seed;
+  TruthTable_t table1, table2, table3;
+  Cal_Bdd f1, f2, f3/*, f4*/;
+  CalAssociation_t *assoc, *nextAssoc;
+  /* Cal_Block block1, block2; */
+  
+  signal(SIGFPE, handler);
+  
+  printf("Random operation tests...\n");
+  bddManager  = Cal_BddManagerInit();
+  seed = 1;
+  /*
+  (void) time((time_t *)&seed);
+  */
+  CalUtilSRandom((long)seed);
+
+  for(i = 0; i < numVars; ++i){
+    vars[i] = Cal_BddManagerCreateNewVarLast(bddManager);
+  }
+  
+  /*
+  f1 = Cal_BddAnd(bddManager, vars[1], vars[2]);
+  f2 = Cal_BddAnd(bddManager, vars[1], vars[0]);
+  f3 = Cal_BddOr(bddManager, f1, f2);
+  Cal_BddFree(bddManager, f1);
+  Cal_BddFree(bddManager, f2);
+  Cal_BddDynamicReordering(bddManager, Cal_BddReorderSift);
+  fprintf(stdout,"Original function:\n");
+  Cal_BddFunctionPrint(bddManager, f3, "a");
+  Cal_BddReorderNew(bddManager);
+  f1 = Cal_BddAnd(bddManager, vars[1], vars[2]);
+  f2 = Cal_BddAnd(bddManager, vars[1], vars[0]);
+  f4 = Cal_BddOr(bddManager, f1, f2);
+  Cal_BddFree(bddManager, f1);
+  Cal_BddFree(bddManager, f2);
+  fprintf(stdout,"New function:\n");
+  Cal_BddFunctionPrint(bddManager, f4, "a");
+  Cal_Assert(Cal_BddIsEqual(bddManager, f3, f4));
+  Cal_BddFree(bddManager, f3);
+  Cal_BddFree(bddManager, f4);
+  */
+
+/*
+  block1 = Cal_BddNewVarBlock(bddManager,
+                              vars[0], 2);
+  block2 = Cal_BddNewVarBlock(bddManager, vars[3], 2);
+  Cal_BddVarBlockReorderable(bddManager, block2, 1);
+  */
+  for (i = 0; i < iterations; i++){
+    printf("Iteration %3d\n", i);
+    table1 = (TruthTable_t)CalUtilRandom();
+    table2 = (TruthTable_t)CalUtilRandom();
+    table3 = (TruthTable_t)CalUtilRandom();
+    f1 = EncodingToBdd(table1);
+    f2 = EncodingToBdd(table2);
+    f3 = EncodingToBdd(table3);
+
+    /* The following tests will fail if you do not use 5 variables */
+    if (numVars == 5){
+      TestGenCof(bddManager, f1, table1, f2, table2);
+      TestSubstitute(bddManager, f1, table1, f2, table2, f3, table3);
+      TestSwapVars(bddManager, f1, table1);
+      TestCompose(bddManager, f1, table1, f2, table2);
+      TestRelProd(bddManager, f1, table1, f2, table2, 0, 0, 0, 0);
+      TestQnt(bddManager, f1, table1, 1, 1, 1);
+      TestVarSubstitute(bddManager, f1, table1, f2, table2, f3,
+                        table3);
+    }
+    /* The following can be tested for larger number of variables */
+    TestAnd(bddManager,f1, table1, f2, table2);
+    TestIdNot(bddManager, f1, table1);
+    TestITE(bddManager, f1, table1, f2, table2, f3, table3);
+    TestNand(bddManager,f1, table1, f2, table2);
+    TestOr(bddManager, f1, table1, f2, table2);
+    TestXor(bddManager,f1, table1, f2, table2);
+    TestMultiwayOr(bddManager, f1, table1, f2, table2, f3, table3);
+    TestMultiwayAnd(bddManager, f1, table1, f2, table2, f3, table3);
+    TestArrayOp(bddManager, 10);
+    TestInterImpl(bddManager, f1, table1, f2, table2);
+    TestReduce(bddManager, f1, table1, f2, table2);
+    TestSize(bddManager, f1, table1, f2, table2);
+    TestSatisfy(bddManager, f1, table1);
+    TestAssoc(bddManager, f1, table1);
+    TestDump(bddManager, f1); 
+    TestPipeline(bddManager, f1, table1, f2, table2, f3, table3);
+    TestReorder(bddManager, table1, f1);
+    Cal_BddFree(bddManager, f1);
+    Cal_BddFree(bddManager, f2);
+    Cal_BddFree(bddManager, f3);
+  	if (i && (i % 10 == 0)) {
+      Cal_BddManagerGC(bddManager);
+      (void)CalPackNodes(bddManager);
+    }
+  }
+  for(i = 0; i < numVars; ++i){
+    Cal_BddFree(bddManager, vars[i]);
+  }
+  Cal_BddStats(bddManager, stdout);
+  for(assoc = bddManager->associationList;
+      assoc != Cal_Nil(CalAssociation_t); assoc = nextAssoc){
+    nextAssoc = assoc->next;
+    for (i=1; i <= bddManager->numVars; i++){
+      if (CalBddIsBddNull(bddManager, assoc->varAssociation[i]) == 0){
+        CalBddDcrRefCount(assoc->varAssociation[i]);
+        assoc->varAssociation[i] = bddManager->bddNull;
+        assoc->lastBddIndex = -1;
+      }
+    }
+  }
+  /* fix temporary association */
+  assoc = bddManager->tempAssociation;
+  for (i=1; i <= bddManager->numVars; i++){
+    if (CalBddIsBddNull(bddManager, assoc->varAssociation[i]) == 0){
+      CalBddDcrRefCount(assoc->varAssociation[i]);
+      assoc->varAssociation[i] = bddManager->bddNull;
+      assoc->lastBddIndex = -1;
+    }
+  }
+
+  Cal_BddManagerGC(bddManager);
+  Cal_BddStats(bddManager, stdout);
+  /*CalUniqueTablePrint(bddManager);*/
+  Cal_BddManagerQuit(bddManager);
+}
Index: /vis_dev/glu-2.1/src/calBdd/calTitle.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calTitle.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calTitle.html	(revision 6)
@@ -0,0 +1,17 @@
+<HTML>
+<HEAD><TITLE>The cal package: Title</TITLE></HEAD>
+<BODY>
+
+<TABLE BORDER WIDTH="100%">
+  <TR>
+    <TD ALIGN=center> <A HREF="calExt.html" TARGET="_top">
+        Programmer view</A> </TD>
+    <TD ALIGN=center> <A HREF="calAllByFunc.html" TARGET="_top">
+	Maintainer by function</A> </TD>
+    <TD ALIGN=center> <A HREF="calAllByFile.html" TARGET="_top">
+        Maintainer by file</A> </TD>
+  </TR>
+</TABLE>
+
+</BODY>
+</HTML>
Index: /vis_dev/glu-2.1/src/calBdd/calUtil.c
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/calUtil.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/calUtil.c	(revision 6)
@@ -0,0 +1,698 @@
+/**CFile***********************************************************************
+
+  FileName    [calUtil.c]
+
+  PackageName [cal]
+
+  Synopsis    [Utility functions for the Cal package.]
+
+  Description [Utility functions used in the Cal package.]
+
+  SeeAlso     [optional]
+
+  Author      [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu)
+               Rajeev K. Ranjan   (rajeev@eecs.berkeley.edu)
+              ]
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calUtil.c,v 1.4 2002/09/10 00:10:37 fabio Exp $]
+
+******************************************************************************/
+
+#include "calInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+/* Random generator constants. */
+#define CAL_MODULUS1 2147483563
+#define CAL_LEQA1 40014
+#define CAL_LEQQ1 53668
+#define CAL_LEQR1 12211
+#define CAL_MODULUS2 2147483399
+#define CAL_LEQA2 40692
+#define CAL_LEQQ2 52774
+#define CAL_LEQR2 3791
+#define CAL_STAB_SIZE 64
+#define CAL_STAB_DIV (1 + (CAL_MODULUS1 - 1) / CAL_STAB_SIZE)
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static long utilRand = 0;
+static long utilRand2;
+static long shuffleSelect;
+static long shuffleTable[CAL_STAB_SIZE];
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+void
+Cal_ImageDump(Cal_BddManager_t *bddManager, FILE *fp)
+{
+
+  CalPageManager_t *pageManager;
+  int i, j;
+  char *segment, c;
+  int count = NUM_PAGES_PER_SEGMENT * PAGE_SIZE;
+
+  pageManager = bddManager->pageManager1;
+  for(i = 0; i < pageManager->numSegments; i++){
+    segment = (char *) pageManager->pageSegmentArray[i];
+    for(j = 1; j <= count; j++){
+      c = segment[j];
+      fprintf(fp, "%c", j%64?c:'\n');
+    }
+  }
+  pageManager = bddManager->pageManager2;
+  for(i = 0; i < pageManager->numSegments; i++){
+    segment = (char *) pageManager->pageSegmentArray[i];
+    for(j = 1; j <= count; j++){
+      c = segment[j];
+      fprintf(fp, "%c", j%64?c:'\n');
+    }
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the function implemented by the argument BDD]
+
+  Description [Prints the function implemented by the argument BDD]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+Cal_BddFunctionPrint(Cal_BddManager bddManager, Cal_Bdd  userBdd,
+                     char *name)
+{
+  Cal_Bdd_t calBdd;
+  calBdd = CalBddGetInternalBdd(bddManager, userBdd);
+  CalBddFunctionPrint(bddManager, calBdd, name);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalUniqueTablePrint(Cal_BddManager_t *bddManager)
+{
+  int i;
+  for(i = 0; i <= bddManager->numVars; i++){
+    CalHashTablePrint(bddManager->uniqueTable[i]);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the function implemented by the argument BDD]
+
+  Description [Prints the function implemented by the argument BDD]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+CalBddFunctionPrint(Cal_BddManager_t * bddManager,
+                    Cal_Bdd_t  calBdd,
+                    char * name)
+{
+  Cal_Bdd_t T,E;
+  Cal_BddId_t id;
+  char c;
+  static int level;
+
+  if(level == 0)printf("%s = ",name);
+  level++;
+  printf("( ");
+  if(CalBddIsBddZero(bddManager, calBdd)){
+    printf("0 ");
+  }
+  else if(CalBddIsBddOne(bddManager, calBdd)){
+    printf("1 ");
+  }
+  else{
+    id = CalBddGetBddId(calBdd);
+    c = (char)((int)'a' + id - 1);
+    printf("%c ", c);
+    CalBddGetCofactors(calBdd, id, T, E);
+    CalBddFunctionPrint(bddManager, T, " ");
+    printf("+ %c' ", c);
+    CalBddFunctionPrint(bddManager, E, " ");
+  }
+  level--;
+  printf(") ");
+  if(level == 0)printf("\n");
+}
+
+/**Function********************************************************************
+  
+  Synopsis    [required]
+  
+  Description [optional]
+  
+  SideEffects [required]
+  
+  SeeAlso     [optional]
+  
+******************************************************************************/
+#if HAVE_STDARG_H
+int
+CalBddPreProcessing(Cal_BddManager_t *bddManager, int count, ...)
+{
+  int allValid;
+  va_list ap;
+  Cal_Bdd fUserBdd;
+  Cal_Bdd_t f;
+  
+  va_start(ap, count);
+#else
+#  if HAVE_VARARGS_H
+int
+CalBddPreProcessing(va_alist)
+va_dcl
+{
+  int allValid;
+  va_list ap;
+  Cal_Bdd *fUserBdd;
+  int count;
+  Cal_BddManager_t *bddManager;
+  Cal_Bdd_t f;
+  
+  va_start(ap);
+  bddManager = va_arg(ap, Cal_BddManager_t *);
+  count = va_arg(ap, int);
+#  endif
+#endif  
+
+  allValid=1;
+  while (count){
+    fUserBdd = va_arg(ap, Cal_Bdd);
+	if (fUserBdd == 0){
+	  allValid=0;
+    }
+	else {
+      f = CalBddGetInternalBdd(bddManager, fUserBdd);
+      if (CalBddIsRefCountZero(f)){
+        CalBddFatalMessage("Bdd With Zero Reference Count Used.");
+      }
+    }
+    --count;
+  }
+  if (allValid) {
+    CalBddPostProcessing(bddManager);
+  }
+  va_end(ap);
+  return (allValid);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+int
+CalBddPostProcessing(Cal_BddManager_t *bddManager)
+{
+  if (bddManager->gcCheck > 0) return CAL_BDD_OK;
+  bddManager->gcCheck = CAL_GC_CHECK;
+  if(bddManager->numNodes > bddManager->uniqueTableGCLimit){
+    long origNodes = bddManager->numNodes;
+    Cal_BddManagerGC(bddManager);
+    if ((bddManager->numNodes > bddManager->reorderingThreshold) &&
+        (3*bddManager->numNodes > 2* bddManager->uniqueTableGCLimit) &&
+        (bddManager->dynamicReorderingEnableFlag) &&
+        (bddManager->reorderTechnique != CAL_REORDER_NONE)){
+      CalCacheTableTwoFlush(bddManager->cacheTable);
+      if (bddManager->reorderMethod == CAL_REORDER_METHOD_BF){
+        CalBddReorderAuxBF(bddManager);
+      }
+      else{
+        CalBddReorderAuxDF(bddManager);
+      }
+    }
+    else {
+      /* Check if we should repack */
+      Cal_Assert(CalCheckAllValidity(bddManager));
+      if (bddManager->numNodes <
+          bddManager->repackAfterGCThreshold*origNodes){
+        CalRepackNodesAfterGC(bddManager);
+      }
+      Cal_Assert(CalCheckAllValidity(bddManager));
+    }
+    Cal_BddManagerSetGCLimit(bddManager);
+    if (bddManager->nodeLimit && (bddManager->numNodes >
+                                  bddManager->nodeLimit)){ 
+      CalBddWarningMessage("Overflow: Node Limit Exceeded");
+      bddManager->overflow = 1;
+      return CAL_BDD_OVERFLOWED;
+    }
+    /*
+     * Check to see if the cache table needs to be rehashed.
+     */
+    CalCacheTableRehash(bddManager);
+  }
+  return CAL_BDD_OK;
+}
+
+/**Function********************************************************************
+  
+  Synopsis    [required]
+  
+  Description [optional]
+  
+  SideEffects [required]
+  
+  SeeAlso     [optional]
+  
+******************************************************************************/
+int
+CalBddArrayPreProcessing(Cal_BddManager_t *bddManager, Cal_Bdd *userBddArray) 
+{
+  int i = 0;
+  Cal_Bdd userBdd;
+  while ((userBdd = userBddArray[i++])){
+    if (CalBddPreProcessing(bddManager, 1, userBdd) == 0){
+      return 0;
+    }
+  }
+  return 1;
+}
+    
+                       
+/**Function********************************************************************
+
+  Name        [CalBddFatalMessage]
+
+  Synopsis    [Prints fatal message and exits.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd_t
+CalBddGetInternalBdd(Cal_BddManager bddManager, Cal_Bdd userBdd)
+{
+  Cal_Bdd_t resultBdd;
+  if (CalBddNodeIsOutPos(userBdd)){
+    CalBddNodeGetThenBdd(userBdd, resultBdd);
+  }
+  else {
+    Cal_Bdd userBddNot = CalBddNodeNot(userBdd);
+    Cal_Bdd_t internalBdd;
+	CalBddNodeGetThenBdd(userBddNot,internalBdd);
+    CalBddNot(internalBdd, resultBdd);
+  }
+  return resultBdd;
+}
+
+/**Function********************************************************************
+
+  Name        [CalBddFatalMessage]
+
+  Synopsis    [Prints fatal message and exits.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+Cal_Bdd
+CalBddGetExternalBdd(Cal_BddManager_t *bddManager, Cal_Bdd_t internalBdd)
+{
+  CalHashTable_t *hashTableForUserBdd = bddManager->uniqueTable[0];
+  Cal_Bdd_t resultBdd;
+  int found;
+  
+  if(CalBddIsOutPos(internalBdd)){
+    found = CalHashTableFindOrAdd(hashTableForUserBdd, internalBdd,
+                          bddManager->bddOne, &resultBdd);
+  }
+  else {
+    Cal_Bdd_t internalBddNot;
+    CalBddNot(internalBdd, internalBddNot);
+    found = CalHashTableFindOrAdd(hashTableForUserBdd, internalBddNot,
+                          bddManager->bddOne, &resultBdd);
+    CalBddNot(resultBdd, resultBdd);
+  }
+  if (found == 0){
+    CalBddIcrRefCount(internalBdd);
+  }
+  CalBddIcrRefCount(resultBdd);
+  return CalBddGetBddNode(resultBdd);
+}
+
+
+/**Function********************************************************************
+
+  Name        [CalBddFatalMessage]
+
+  Synopsis    [Prints fatal message and exits.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddFatalMessage(char *string)
+{
+  (void) fprintf(stderr,"Fatal: %s\n", string);
+  exit(-1);
+}
+/**Function********************************************************************
+
+  Name        [CalBddWarningMessage]
+
+  Synopsis    [Prints warning message.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddWarningMessage(char *string)
+{
+  (void) fprintf(stderr,"Warning: %s\n", string);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalBddNodePrint(CalBddNode_t *bddNode)
+{
+  int refCount;
+  CalBddNodeGetRefCount(bddNode, refCount);
+  printf("Node (%lx) thenBdd(%2d %lx)  elseBdd(%2d %lx) ref_count (%d) next (%lx)\n",
+         (CalAddress_t)bddNode,
+         CalBddNodeGetThenBddId(bddNode),
+         (CalAddress_t) CalBddNodeGetThenBddNode(bddNode), 
+         CalBddNodeGetElseBddId(bddNode),
+         (CalAddress_t) CalBddNodeGetElseBddNode(bddNode),
+         refCount, (CalAddress_t)bddNode->nextBddNode);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+
+void
+CalBddPrint(Cal_Bdd_t calBdd)
+{
+  printf("Id(%2d) node(%lx) ",
+      CalBddGetBddId(calBdd), (CalAddress_t) CalBddGetBddNode(calBdd));
+  printf("thenBdd(%2d %lx)  elseBdd(%2d %lx)\n",
+         CalBddGetThenBddId(calBdd),
+         (CalAddress_t) CalBddGetThenBddNode(calBdd), 
+         CalBddGetElseBddId(calBdd),
+         (CalAddress_t) CalBddGetElseBddNode(calBdd));
+}
+
+#ifdef TEST_CALBDDNODE
+main(int argc, char **argv)
+{
+  CalBddNode_t *bddNode, *thenBddNode, *elseBddNode;
+
+  bddNode = Cal_MemAlloc(CalBddNode_t, 1);
+  thenBddNode = Cal_MemAlloc(CalBddNode_t, 1);
+  elseBddNode = Cal_MemAlloc(CalBddNode_t, 1);
+
+  CalBddNodePutThenBddId(bddNode, 1);
+  CalBddNodePutThenBddNode(bddNode, thenBddNode);
+  CalBddNodePutElseBddId(bddNode, 2);
+  CalBddNodePutElseBddNode(bddNode, elseBddNode);
+
+  printf("then( 1 %x) else( 2 %x)\n", thenBddNode, elseBddNode);
+  CalBddNodePrint(bddNode);
+}
+#endif
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints a hash table.]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTablePrint(CalHashTable_t *hashTable)
+{
+  int i;
+  CalBddNode_t *ptr;
+  Cal_Bdd_t calBdd, T, E;
+  int refCount, firstFlag;
+
+  printf("HashTable bddId(%d) entries(%ld) bins(%ld) capacity(%ld)\n",
+         hashTable->bddId, hashTable->numEntries, hashTable->numBins,
+         hashTable->maxCapacity);
+  for(i = 0; i < hashTable->numBins; i++){
+    ptr = hashTable->bins[i];
+    firstFlag = 1;
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      CalBddPutBddNode(calBdd, ptr);
+      CalBddNodeGetThenBdd(ptr, T);
+      CalBddNodeGetElseBdd(ptr, E);
+      if (firstFlag){
+        printf("\tbin = (%d) ", i);
+        firstFlag = 0;
+      }
+      printf("\t\tbddNode(%lx) ", (CalAddress_t)ptr);
+      printf("thenId(%d) ", CalBddGetBddId(T)); 
+      printf("thenBddNode(%lx) ", (CalAddress_t) CalBddGetBddNode(T));
+      printf("elseId(%d) ", CalBddGetBddId(E)); 
+      printf("elseBddNode(%lx) ", (unsigned long)CalBddGetBddNode(E));
+      CalBddGetRefCount(calBdd, refCount);
+      printf("refCount(%d)\n", refCount);
+      ptr = CalBddNodeGetNextBddNode(ptr);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+void
+CalHashTableOnePrint(CalHashTable_t *hashTable, int flag)
+{
+  int i;
+  CalBddNode_t *ptr, *node;
+  Cal_Bdd_t keyBdd;
+
+  printf("*************************************************\n");
+  for(i = 0; i < hashTable->numBins; i++){
+    ptr = hashTable->bins[i];
+    while(ptr != Cal_Nil(CalBddNode_t)){
+      CalBddNodeGetThenBdd(ptr, keyBdd);
+      node = CalBddNodeGetElseBddNode(ptr);
+      if(flag == 1){
+        printf("Key(%d %lx) Value(%f)\n", 
+            CalBddGetBddId(keyBdd), (CalAddress_t)CalBddGetBddNode(keyBdd), *(double *)node); 
+      }
+      else{
+        printf("Key(%d %lx) Value(%d)\n",
+            CalBddGetBddId(keyBdd), (CalAddress_t)CalBddGetBddNode(keyBdd),  *(int *)node); 
+      }
+      ptr = CalBddNodeGetNextBddNode(ptr);
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Initializer for the portable random number generator.]
+
+  Description [Initializer for the portable number generator based on
+  ran2 in "Numerical Recipes in C." The input is the seed for the
+  generator. If it is negative, its absolute value is taken as seed.
+  If it is 0, then 1 is taken as seed. The initialized sets up the two
+  recurrences used to generate a long-period stream, and sets up the
+  shuffle table.]
+
+  SideEffects [None]
+
+  SeeAlso     [CalUtilRandom]
+
+******************************************************************************/
+void
+CalUtilSRandom(long seed)
+{
+    int i;
+
+    if (seed < 0)       utilRand = -seed;
+    else if (seed == 0) utilRand = 1;
+    else                utilRand = seed;
+    utilRand2 = utilRand;
+    /* Load the shuffle table (after 11 warm-ups). */
+    for (i = 0; i < CAL_STAB_SIZE + 11; i++) {
+	long int w;
+	w = utilRand / CAL_LEQQ1;
+	utilRand = CAL_LEQA1 * (utilRand - w * CAL_LEQQ1) - w * CAL_LEQR1;
+	utilRand += (utilRand < 0) * CAL_MODULUS1;
+	shuffleTable[i % CAL_STAB_SIZE] = utilRand;
+    }
+    shuffleSelect = shuffleTable[1 % CAL_STAB_SIZE];
+} /* end of CalUtilSRandom */
+
+/**Function********************************************************************
+
+  Synopsis    [Portable random number generator.]
+
+  Description [Portable number generator based on ran2 from "Numerical
+  Recipes in C." It is a long period (> 2 * 10^18) random number generator
+  of L'Ecuyer with Bays-Durham shuffle. Returns a long integer uniformly
+  distributed between 0 and 2147483561 (inclusive of the endpoint values).
+  The random generator can be explicitly initialized by calling
+  CalUtilSRandom. If no explicit initialization is performed, then the
+  seed 1 is assumed.]
+
+  SideEffects []
+
+  SeeAlso     [CalUtilSRandom]
+
+******************************************************************************/
+long
+CalUtilRandom(void)
+{
+    int i;	/* index in the shuffle table */
+    long int w; /* work variable */
+
+    /* utilRand == 0 if the geneartor has not been initialized yet. */
+    if (utilRand == 0) CalUtilSRandom((long)1);
+
+    /* Compute utilRand = (utilRand * CAL_LEQA1) % CAL_MODULUS1 avoiding
+    ** overflows by Schrage's method.
+    */
+    w          = utilRand / CAL_LEQQ1;
+    utilRand   = CAL_LEQA1 * (utilRand - w * CAL_LEQQ1) - w * CAL_LEQR1;
+    utilRand  += (utilRand < 0) * CAL_MODULUS1;
+
+    /* Compute utilRand2 = (utilRand2 * CAL_LEQA2) % CAL_MODULUS2 avoiding
+    ** overflows by Schrage's method.
+    */
+    w          = utilRand2 / CAL_LEQQ2;
+    utilRand2  = CAL_LEQA2 * (utilRand2 - w * CAL_LEQQ2) - w * CAL_LEQR2;
+    utilRand2 += (utilRand2 < 0) * CAL_MODULUS2;
+
+    /* utilRand is shuffled with the Bays-Durham algorithm.
+    ** shuffleSelect and utilRand2 are combined to generate the output.
+    */
+
+    /* Pick one element from the shuffle table; "i" will be in the range
+    ** from 0 to CAL_STAB_SIZE-1.
+    */
+    i = shuffleSelect / CAL_STAB_DIV;
+    /* Mix the element of the shuffle table with the current iterate of
+    ** the second sub-generator, and replace the chosen element of the
+    ** shuffle table with the current iterate of the first sub-generator.
+    */
+    shuffleSelect   = shuffleTable[i] - utilRand2;
+    shuffleTable[i] = utilRand;
+    shuffleSelect  += (shuffleSelect < 1) * (CAL_MODULUS1 - 1);
+    /* Since shuffleSelect != 0, and we want to be able to return 0,
+    ** here we subtract 1 before returning.
+    */
+    return(shuffleSelect - 1);
+
+} /* end of CalUtilRandom */
+
+
Index: /vis_dev/glu-2.1/src/calBdd/credit.html
===================================================================
--- /vis_dev/glu-2.1/src/calBdd/credit.html	(revision 6)
+++ /vis_dev/glu-2.1/src/calBdd/credit.html	(revision 6)
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD><TITLE>Credit</TITLE></HEAD>
+<BODY>
+<TABLE BORDER WIDTH="100%">
+  <TR>
+    <TD ALIGN=center> <A HREF="commands.html" TARGET="_top">
+        Command Documentation</A> </TD>
+    <TD ALIGN=center> <A HREF="packages.html" TARGET="_top">
+	Package Documentation</A> </TD>
+    <TD ALIGN=center> Generated by <A HREF="http://www.eecs.berkeley.edu/~sedwards/ext" TARGET="_top">
+        <B>the Ext system</B></A> </TD>
+  </TD>
+</TABLE>
+</BODY>
+</HTML>
Index: /vis_dev/glu-2.1/src/calPort/calPort.c
===================================================================
--- /vis_dev/glu-2.1/src/calPort/calPort.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calPort/calPort.c	(revision 6)
@@ -0,0 +1,3716 @@
+/**CFile***********************************************************************
+
+  FileName    [calPort.c]
+
+  PackageName [cal_port]
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+******************************************************************************/
+#include "calPortInt.h"
+#ifndef	EPD_MAX_BIN
+#include "epd.h" 
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void InvalidType(FILE *file, char *field, char *expected);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis           [Function to construct a bdd_t.]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+bdd_t *
+bdd_construct_bdd_t(bdd_manager *mgr, bdd_node *fn)
+{
+  bdd_t *result;
+  if (!fn){
+	fail("bdd_construct_bdd_t: possible memory overflow");
+  }
+  result = Cal_MemAlloc(bdd_t, 1);
+  result->bddManager = (Cal_BddManager_t *) mgr;
+  result->calBdd = (Cal_Bdd) fn;
+  result->free = 0;
+  return result;
+}
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_package_type_t
+bdd_get_package_name(void)
+{
+  return CAL;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void
+bdd_end(void *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  void *hooks;
+  hooks = Cal_BddManagerGetHooks(mgr);
+  Cal_MemFree(hooks); 
+  Cal_BddManagerQuit(mgr);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_manager *
+bdd_start(int nvariables)
+{
+  Cal_BddManager mgr;
+  int i;
+  bdd_external_hooks *hooks;
+  
+  mgr = Cal_BddManagerInit();
+  for (i = 0; i < nvariables; i++) {
+	(void) Cal_BddManagerCreateNewVarLast(mgr);
+  }
+  hooks = Cal_MemAlloc(bdd_external_hooks, 1);
+  hooks->mdd = hooks->network = hooks->undef1 = (char *) 0;
+  Cal_BddManagerSetHooks(mgr, (void *)hooks);
+  return (bdd_manager *)mgr;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_create_variable(bdd_manager *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return bdd_construct_bdd_t(mgr, Cal_BddManagerCreateNewVarLast(mgr));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_create_variable_after(bdd_manager *manager, bdd_variableId afterId)
+{
+  Cal_Bdd afterVar;
+  bdd_t 	*result;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  afterVar = Cal_BddManagerGetVarWithId(mgr, afterId + 1);
+  result =  bdd_construct_bdd_t(mgr,
+                                Cal_BddManagerCreateNewVarAfter(mgr,
+                                                                afterVar));  
+  
+  /* No need to free after_var, since single variable BDDs are never garbage collected */
+  
+  return result;
+}
+
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_get_variable(bdd_manager *manager, bdd_variableId varId)
+{
+  Cal_Bdd varBdd;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  varBdd = Cal_BddManagerGetVarWithId(mgr, varId + 1);
+  if (!varBdd){
+	fprintf(stderr,"bdd_get_variable: Variable has not been created");
+    exit(-1);
+  }
+  return bdd_construct_bdd_t(mgr, varBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_dup(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddIdentity(f->bddManager, f->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void
+bdd_free(bdd_t *f)
+{
+  if (f == NIL(bdd_t)) {
+	fail("bdd_free: trying to free a NIL bdd_t");			
+  }
+  if (f->free){
+    fail("bdd_free: Trying to free a freed bdd_t");
+  }
+  Cal_BddFree(f->bddManager, f->calBdd);
+  f->calBdd = (Cal_Bdd) 0;
+  f->bddManager = NIL(Cal_BddManager_t);
+  f->free = 1;
+  Cal_MemFree(f);  
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_node *
+bdd_get_node(bdd_t *f, boolean *isComplemented)
+{
+  *isComplemented = CAL_TAG0(f->calBdd);
+  return (f->calBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_and(bdd_t *f,bdd_t *g, boolean f_phase, boolean g_phase)
+{
+  Cal_Bdd temp1, temp2;
+  bdd_t *result;
+  Cal_BddManager mgr;
+  
+  mgr = f->bddManager;
+  temp1 = ((f_phase == TRUE) ? Cal_BddIdentity(mgr, f->calBdd) :
+           Cal_BddNot(mgr, f->calBdd)); 
+  temp2 = ((g_phase == TRUE) ? Cal_BddIdentity(mgr, g->calBdd) :
+           Cal_BddNot(mgr, g->calBdd));
+  result = bdd_construct_bdd_t(mgr, Cal_BddAnd(mgr, temp1, temp2));
+  Cal_BddFree(mgr, temp1);
+  Cal_BddFree(mgr, temp2);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [AND of BDDs with limit on nodes created]
+
+  Description        [AND of BDDs with limit on nodes created.  This function
+  is not supported by the CAL package.  We fall back to the standard AND.]
+
+  SideEffects        [required]
+
+  SeeAlso            [bdd_and]
+******************************************************************************/
+bdd_t *
+bdd_and_with_limit(bdd_t *f, bdd_t *g, boolean f_phase, boolean g_phase, unsigned int limit)
+{
+  return bdd_and(f, g, f_phase, g_phase);
+}
+
+bdd_t *
+bdd_and_array(bdd_t *f, array_t *g_array, boolean f_phase, boolean g_phase)
+{
+  Cal_Bdd temp1, temp2, result;
+  bdd_t *g;
+  Cal_BddManager mgr;
+  int i;
+
+  mgr = f->bddManager;
+  result = ((f_phase == TRUE) ? Cal_BddIdentity(mgr, f->calBdd) :
+            Cal_BddNot(mgr, f->calBdd)); 
+
+  for (i = 0; i < array_n(g_array); i++) {
+    g = array_fetch(bdd_t *, g_array, i);
+    temp1 = result;
+    temp2 = ((g_phase == TRUE) ? Cal_BddIdentity(mgr, g->calBdd) :
+             Cal_BddNot(mgr, g->calBdd));
+    result = Cal_BddAnd(mgr, temp1, temp2);
+    Cal_BddFree(mgr, temp1);
+    Cal_BddFree(mgr, temp2);
+    if (result == NULL)
+      return(NULL);
+  }
+
+  return(bdd_construct_bdd_t(mgr, result));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_multiway_and(bdd_manager *manager, array_t *bddArray)
+{
+  int i;
+  Cal_Bdd *calBddArray;
+  bdd_t *operand, *result;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  
+  calBddArray = Cal_MemAlloc(Cal_Bdd, array_n(bddArray)+1);
+  for (i=0; i<array_n(bddArray); i++){
+    operand = array_fetch(bdd_t*, bddArray, i);
+    calBddArray[i] = operand->calBdd;
+  }
+  calBddArray[i] = (Cal_Bdd)0;
+  result = bdd_construct_bdd_t(mgr,
+                               Cal_BddMultiwayAnd(mgr, calBddArray));
+  Cal_MemFree(calBddArray);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_multiway_or(bdd_manager *manager, array_t *bddArray)
+{
+  int i;
+  Cal_Bdd *calBddArray;
+  bdd_t *operand, *result;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  
+  calBddArray = Cal_MemAlloc(Cal_Bdd, array_n(bddArray)+1);
+  for (i=0; i<array_n(bddArray); i++){
+    operand = array_fetch(bdd_t*, bddArray, i);
+    calBddArray[i] = operand->calBdd;
+  }
+  calBddArray[i] = (Cal_Bdd)0;
+  result = bdd_construct_bdd_t(mgr,
+                               Cal_BddMultiwayOr(mgr, calBddArray));
+  Cal_MemFree(calBddArray);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_multiway_xor(bdd_manager *manager, array_t *bddArray)
+{
+  int i;
+  Cal_Bdd *calBddArray;
+  bdd_t *operand, *result;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  
+  calBddArray = Cal_MemAlloc(Cal_Bdd, array_n(bddArray)+1);
+  for (i=0; i<array_n(bddArray); i++){
+    operand = array_fetch(bdd_t*, bddArray, i);
+    calBddArray[i] = operand->calBdd;
+  }
+  calBddArray[i] = (Cal_Bdd)0;
+  result = bdd_construct_bdd_t(mgr,
+                               Cal_BddMultiwayXor(mgr, calBddArray));
+  Cal_MemFree(calBddArray);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+array_t *
+bdd_pairwise_and(bdd_manager *manager, array_t *bddArray1,
+                 array_t *bddArray2) 
+{
+  int i;
+  array_t *resultArray;
+  Cal_Bdd *calBddArray, *calBddResultArray;
+  bdd_t *operand;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  
+  if (array_n(bddArray1) != array_n(bddArray2)){
+    fprintf(stderr, "bdd_pairwise_and: Arrays of different lengths.\n");
+    return NIL(array_t);
+  }
+  calBddArray = Cal_MemAlloc(Cal_Bdd, 2*array_n(bddArray1)+1);
+  for (i=0; i<array_n(bddArray1); i++){
+    operand = array_fetch(bdd_t*, bddArray1, i);
+    calBddArray[i<<1] = operand->calBdd;
+    operand = array_fetch(bdd_t*, bddArray2, i);
+    calBddArray[(i<<1)+1] = operand->calBdd;
+  }
+  calBddArray[i<<1] = (Cal_Bdd)0;
+  calBddResultArray = Cal_BddPairwiseAnd(mgr, calBddArray);
+  resultArray = array_alloc(bdd_t*, 0);
+  for (i=0; i<array_n(bddArray1); i++){
+    array_insert_last(bdd_t *, resultArray, 
+                      bdd_construct_bdd_t(mgr, calBddResultArray[i]));
+  }
+  Cal_MemFree(calBddArray);
+  Cal_MemFree(calBddResultArray);
+  return resultArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+array_t *
+bdd_pairwise_or(bdd_manager *manager, array_t *bddArray1,
+                array_t *bddArray2) 
+{
+  int i;
+  array_t *resultArray;
+  Cal_Bdd *calBddArray, *calBddResultArray;
+  bdd_t *operand;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  
+  if (array_n(bddArray1) != array_n(bddArray2)){
+    fprintf(stderr, "bdd_pairwise_or: Arrays of different lengths.\n");
+    return NIL(array_t);
+  }
+  calBddArray = Cal_MemAlloc(Cal_Bdd, 2*array_n(bddArray1)+1);
+  for (i=0; i<array_n(bddArray1); i++){
+    operand = array_fetch(bdd_t*, bddArray1, i);
+    calBddArray[i<<1] = operand->calBdd;
+    operand = array_fetch(bdd_t*, bddArray2, i);
+    calBddArray[(i<<1)+1] = operand->calBdd;
+  }
+  calBddArray[i<<1] = (Cal_Bdd)0;
+  calBddResultArray = Cal_BddPairwiseOr(mgr, calBddArray);
+  resultArray = array_alloc(bdd_t*, 0);
+  for (i=0; i<array_n(bddArray1); i++){
+    array_insert_last(bdd_t *, resultArray, 
+                      bdd_construct_bdd_t(mgr, calBddResultArray[i]));
+  }
+  Cal_MemFree(calBddArray);
+  Cal_MemFree(calBddResultArray);
+  return resultArray;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+array_t *
+bdd_pairwise_xor(bdd_manager *manager, array_t *bddArray1,
+                 array_t *bddArray2) 
+{
+  int i;
+  array_t *resultArray;
+  Cal_Bdd *calBddArray, *calBddResultArray;
+  bdd_t *operand;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  
+  if (array_n(bddArray1) != array_n(bddArray2)){
+    fprintf(stderr, "bdd_pairwise_xor: Arrays of different lengths.\n");
+    return NIL(array_t);
+  }
+  calBddArray = Cal_MemAlloc(Cal_Bdd, 2*array_n(bddArray1)+1);
+  for (i=0; i<array_n(bddArray1); i++){
+    operand = array_fetch(bdd_t*, bddArray1, i);
+    calBddArray[i<<1] = operand->calBdd;
+    operand = array_fetch(bdd_t*, bddArray2, i);
+    calBddArray[(i<<1)+1] = operand->calBdd;
+  }
+  calBddArray[i<<1] = (Cal_Bdd)0;
+  calBddResultArray = Cal_BddPairwiseXor(mgr, calBddArray);
+  resultArray = array_alloc(bdd_t*, 0);
+  for (i=0; i<array_n(bddArray1); i++){
+    array_insert_last(bdd_t *, resultArray, 
+                      bdd_construct_bdd_t(mgr, calBddResultArray[i]));
+  }
+  Cal_MemFree(calBddArray);
+  Cal_MemFree(calBddResultArray);
+  return resultArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_and_smooth(bdd_t *f, bdd_t *g, array_t *smoothingVars)
+{
+  int num_vars, i;
+  bdd_t *fn, *result;
+  Cal_Bdd *assoc;
+  Cal_BddManager mgr;
+  int assocId;
+  
+  num_vars = array_n(smoothingVars);
+  if (num_vars == 0) {
+    fprintf(stderr,"bdd_and_smooth: no smoothing variables");
+    return bdd_and(f, g, 1, 1);
+  }
+  mgr = f->bddManager;
+  assoc = Cal_MemAlloc(Cal_Bdd, num_vars+1);
+  for (i = 0; i < num_vars; i++) {
+	fn = array_fetch(bdd_t *, smoothingVars, i);
+	assoc[i] = fn->calBdd;
+  }
+  assoc[num_vars] = 0;
+  assocId = Cal_AssociationInit(mgr, assoc, 0);
+  Cal_AssociationSetCurrent(mgr, assocId);
+  result = bdd_construct_bdd_t(mgr, Cal_BddRelProd(mgr, f->calBdd, g->calBdd));
+  Cal_MemFree(assoc);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [Unsupported: Fall back to standard and_smooth]
+
+  SideEffects        [required]
+
+  SeeAlso            [bdd_and_smooth]
+
+******************************************************************************/
+bdd_t *
+bdd_and_smooth_with_limit(bdd_t *f, bdd_t *g, array_t *smoothingVars, unsigned int limit)
+{
+  return bdd_and_smooth(f, g, smoothingVars);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_between(bdd_t *fMin, bdd_t *fMax)
+{
+  return bdd_construct_bdd_t(fMin->bddManager,
+                             Cal_BddBetween(fMin->bddManager,
+                                            fMin->calBdd,
+                                            fMax->calBdd));
+}
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_cofactor(bdd_t *f,bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->bddManager,
+                             Cal_BddCofactor(f->bddManager,
+                                             f->calBdd,
+                                             g->calBdd));  
+}
+
+bdd_t *
+bdd_cofactor_array(bdd_t *f, array_t *bddArray)
+{
+  bdd_t *operand;
+  Cal_Bdd result, temp;
+  int i;
+
+  result = Cal_BddIdentity(f->bddManager, f->calBdd);
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cal_BddCofactor(f->bddManager, result, operand->calBdd);
+    if (temp == NULL) {
+      Cal_BddFree(f->bddManager, result);
+      return(NULL);
+    }
+    Cal_BddFree(f->bddManager, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(f->bddManager, result));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_compose(bdd_t *f,bdd_t *v,bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->bddManager,
+                             Cal_BddCompose(f->bddManager,
+                                            f->calBdd,
+                                            v->calBdd,
+                                            g->calBdd)); 
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_consensus(bdd_t *f, array_t *quantifyingVars)
+{
+  int num_vars, i;
+  bdd_t *fn, *result;
+  Cal_Bdd *assoc;
+  Cal_BddManager mgr;
+  
+  num_vars = array_n(quantifyingVars);
+  if (num_vars == 0) {
+    fprintf(stderr, "bdd_consensus: no smoothing variables");
+    return f;
+  }
+  mgr = f->bddManager;
+  assoc = Cal_MemAlloc(Cal_Bdd, num_vars+1);
+  for (i = 0; i < num_vars; i++) {
+	fn = array_fetch(bdd_t *, quantifyingVars, i);
+	assoc[i] = fn->calBdd;
+  }
+  assoc[num_vars] = 0;
+  Cal_TempAssociationInit(mgr, assoc, 0);
+  Cal_AssociationSetCurrent(mgr, -1);
+  result = bdd_construct_bdd_t(mgr, Cal_BddForAll(mgr, f->calBdd));
+  Cal_MemFree(assoc);
+  Cal_TempAssociationQuit(mgr);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_cproject(bdd_t *f,array_t *quantifyingVars)
+{
+  return NIL(bdd_t);
+  
+  /*
+  int num_vars, i;
+  bdd_t *fn, *result;
+  Cal_Bdd_t*assoc;
+  Cal_BddManager mgr;
+  
+  if (f == NIL(bdd_t))
+	fail ("bdd_cproject: invalid BDD");
+  
+  num_vars = array_n(quantifying_vars);
+  if (num_vars <= 0) {
+      printf("Warning: bdd_cproject: no projection variables\n");
+      result = bdd_dup(f);
+  }
+  else {
+    assoc = Cal_MemAlloc(Cal_Bdd_t, num_vars+1);
+    for (i = 0; i < num_vars; i++) {
+      fn = array_fetch(bdd_t *, quantifying_vars, i);
+      assoc[i] = fn->calBdd;
+    }
+    assoc[num_vars] = (struct bdd_ *) 0;
+    mgr = f->bddManager;
+    cmu_bdd_temp_assoc(mgr, assoc, 0);
+    (void) cmu_bdd_assoc(mgr, -1); 
+    result = bdd_construct_bdd_t(mgr, cmu_bdd_project(mgr, f->calBdd));
+    Cal_MemFree(assoc);
+  }
+  return result;
+  */
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_else(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddElse(f->bddManager, f->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_ite(bdd_t *i,bdd_t *t,bdd_t *e,boolean i_phase,
+        boolean t_phase,boolean e_phase) 
+{
+  Cal_Bdd temp1, temp2, temp3;
+  bdd_t *result;
+  Cal_BddManager mgr;
+  
+  mgr = i->bddManager;
+  temp1 = (i_phase ? Cal_BddIdentity(mgr, i->calBdd) : Cal_BddNot(mgr, i->calBdd));
+  temp2 = (t_phase ? Cal_BddIdentity(mgr, t->calBdd) : Cal_BddNot(mgr, t->calBdd));
+  temp3 = (e_phase ? Cal_BddIdentity(mgr, e->calBdd) : Cal_BddNot(mgr, e->calBdd));
+  result = bdd_construct_bdd_t(mgr, Cal_BddITE(mgr, temp1, temp2, temp3));
+  Cal_BddFree(mgr, temp1);
+  Cal_BddFree(mgr, temp2);
+  Cal_BddFree(mgr, temp3);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_minimize(bdd_t *f, bdd_t *c)
+{
+  return bdd_construct_bdd_t(f->bddManager,
+                             Cal_BddReduce(f->bddManager,
+                                           f->calBdd, c->calBdd));
+}
+
+bdd_t *
+bdd_minimize_array(bdd_t *f, array_t *bddArray)
+{
+  bdd_t *operand;
+  Cal_Bdd result, temp;
+  int i;
+
+  result = Cal_BddIdentity(f->bddManager, f->calBdd);
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cal_BddReduce(f->bddManager, result, operand->calBdd);
+    if (temp == NULL) {
+      Cal_BddFree(f->bddManager, result);
+      return(NULL);
+    }
+    Cal_BddFree(f->bddManager, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(f->bddManager, result));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_not(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddNot(f->bddManager, f->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_one(bdd_manager *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return bdd_construct_bdd_t(mgr, Cal_BddOne(mgr));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_or(bdd_t *f, bdd_t *g, boolean f_phase, boolean g_phase)
+{
+  Cal_Bdd temp1, temp2;
+  bdd_t *result;
+  Cal_BddManager mgr;
+
+  mgr = f->bddManager;
+  temp1 = (f_phase ? Cal_BddIdentity(mgr, f->calBdd) : Cal_BddNot(mgr, f->calBdd));
+  temp2 = (g_phase ? Cal_BddIdentity(mgr, g->calBdd) : Cal_BddNot(mgr, g->calBdd));
+  result = bdd_construct_bdd_t(mgr, Cal_BddOr(mgr, temp1, temp2));
+  Cal_BddFree(mgr, temp1);
+  Cal_BddFree(mgr, temp2);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_smooth(bdd_t *f, array_t *smoothingVars)
+{
+  int numVars, i;
+  bdd_t *fn, *result;
+  Cal_Bdd *assoc;
+  Cal_BddManager mgr;
+  int assocId;
+
+  numVars = array_n(smoothingVars);
+  if (numVars == 0) {
+	fprintf(stderr,"bdd_smooth: no smoothing variables");
+    return f;
+  }
+  mgr = f->bddManager;
+  assoc = Cal_MemAlloc(Cal_Bdd, numVars+1);
+  for (i = 0; i < numVars; i++) {
+	fn = array_fetch(bdd_t *, smoothingVars, i);
+	assoc[i] = fn->calBdd;
+  }
+  assoc[numVars] = 0;
+  assocId = Cal_AssociationInit(mgr, assoc, 0);
+  (void) Cal_AssociationSetCurrent(mgr, assocId);  /* set the temp
+                                                 association as the
+                                                 current association
+                                                 */ 
+  result = bdd_construct_bdd_t(mgr, Cal_BddExists(mgr, f->calBdd));
+  Cal_MemFree(assoc);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_substitute(bdd_t *f, array_t *old_array, array_t *new_array)
+{
+  int num_old_vars, num_new_vars, i;
+  bdd_t *fn_old, *fn_new, *result;
+  Cal_Bdd *assoc;
+  Cal_BddManager mgr;
+  int assocId;
+
+  num_old_vars = array_n(old_array);
+  num_new_vars = array_n(new_array);
+  if (num_old_vars != num_new_vars) {
+	fprintf(stderr,"bdd_substitute: mismatch of number of new and old variables"); 
+    exit(-1);
+  }
+  mgr = f->bddManager;
+  assoc = Cal_MemAlloc(Cal_Bdd, 2*num_old_vars+1);
+  for (i = 0; i < num_old_vars; i++) {
+	fn_old = array_fetch(bdd_t *, old_array, i);
+	fn_new = array_fetch(bdd_t *, new_array, i);
+	assoc[2*i]   = fn_old->calBdd;
+	assoc[2*i+1] = fn_new->calBdd;
+  }
+  assoc[2*num_old_vars] = 0;
+  assocId = Cal_AssociationInit(mgr, assoc, 1);
+  (void) Cal_AssociationSetCurrent(mgr, assocId);  
+  result = bdd_construct_bdd_t(mgr, Cal_BddSubstitute(mgr, f->calBdd));
+  Cal_MemFree(assoc);
+  Cal_TempAssociationQuit(mgr);
+  return result;
+}
+
+array_t *
+bdd_substitute_array(array_t *f_array, array_t *old_array, array_t *new_array)
+{
+  int	i;
+  bdd_t	*f, *new_;
+  array_t *substitute_array = array_alloc(bdd_t *, 0);
+
+  arrayForEachItem(bdd_t *, f_array, i, f) {
+    new_ = bdd_substitute(f, old_array, new_array);
+    array_insert_last(bdd_t *, substitute_array, new_);
+  }
+  return(substitute_array);
+}
+
+/**Function********************************************************************
+ 
+  Synopsis           [Returns the pointer of the BDD.]
+ 
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+ 
+******************************************************************************/
+void *
+bdd_pointer(bdd_t *f)
+{
+    return((void *)f->calBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_then(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddThen(f->bddManager, f->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_top_var(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddIf(f->bddManager, f->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_xnor(bdd_t *f,bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddXnor(f->bddManager, f->calBdd, g->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_xor(bdd_t *f,bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddXor(f->bddManager, f->calBdd, g->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_zero(bdd_manager *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return bdd_construct_bdd_t(mgr, Cal_BddZero(mgr));
+}
+
+/*
+Queries about BDD Formulas ----------------------------------------------------
+*/
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_equal(bdd_t *f,bdd_t *g)
+{
+  return Cal_BddIsEqual(f->bddManager, f->calBdd, g->calBdd);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_equal_mod_care_set(bdd_t *f, bdd_t *g, bdd_t *CareSet)
+{
+  bdd_t	*diffBdd;
+  boolean result;
+
+  if (bdd_equal(f, g))
+    return 1;
+
+  diffBdd = bdd_xor(f, g);
+
+  result = bdd_leq(diffBdd, CareSet, 1, 0);
+  bdd_free(diffBdd);
+
+  return(result);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_intersects(bdd_t *f,bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->bddManager, Cal_BddIntersects(f->bddManager,
+                                                       f->calBdd,
+                                                       g->calBdd)); 
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_closest_cube(bdd_t *f,bdd_t *g,int *dist)
+{
+  return NIL(bdd_t); 
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_is_tautology(bdd_t *f, boolean phase)
+{
+  return ((phase == TRUE) ? Cal_BddIsBddOne(f->bddManager, f->calBdd):
+          Cal_BddIsBddZero(f->bddManager, f->calBdd));
+  
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_leq(bdd_t *f, bdd_t *g, boolean f_phase, boolean g_phase)
+{
+  Cal_Bdd temp1, temp2, impliesFn;
+  Cal_BddManager mgr;
+  boolean resultValue;
+  
+  mgr = f->bddManager;
+  temp1 = (f_phase ? Cal_BddIdentity(mgr, f->calBdd) : Cal_BddNot(mgr, f->calBdd));
+  temp2 = (g_phase ? Cal_BddIdentity(mgr, g->calBdd) : Cal_BddNot(mgr, g->calBdd));
+  impliesFn = Cal_BddImplies(mgr, temp1, temp2); /* returns a minterm
+                                                     of temp1*!temp2
+                                                     */ 
+  resultValue = Cal_BddIsBddZero(mgr, impliesFn);
+  Cal_BddFree(mgr, temp1);
+  Cal_BddFree(mgr, temp2);
+  Cal_BddFree(mgr, impliesFn);
+  return resultValue;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_lequal_mod_care_set(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase,
+  bdd_t *careSet)
+{
+  bdd_t *temp;
+  boolean result;
+
+  if (bdd_leq(f, g, f_phase, g_phase))
+    return 1;
+
+  temp = bdd_and(f, careSet, f_phase, 1);
+
+  result = bdd_leq(temp, g, 1, g_phase);
+  bdd_free(temp);
+
+  return(result);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_leq_array(bdd_t *f, array_t *g_array, boolean f_phase, boolean g_phase)
+{
+  int	i;
+  bdd_t	*g;
+  boolean result;
+
+  arrayForEachItem(bdd_t *, g_array, i, g) {
+    result = bdd_leq(f, g, f_phase, g_phase);
+    if (g_phase) {
+      if (!result)
+	return(0);
+    } else {
+      if (result)
+	return(1);
+    }
+  }
+  if (g_phase)
+    return(1);
+  else
+    return(0);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+double 
+bdd_count_onset(bdd_t *f, array_t *var_array)
+{
+  int numVars;
+  double fraction;
+  numVars = array_n(var_array);
+  fraction = Cal_BddSatisfyingFraction(f->bddManager, f->calBdd);
+  return (fraction * pow((double) 2, (double) numVars));
+}
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of minterms in the on set.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_epd_count_onset(
+  bdd_t *f,
+  array_t *var_array /* of bdd_t *'s */,
+  EpDouble *epd)
+{
+  double nMinterms;
+
+  nMinterms = bdd_count_onset(f, var_array);
+  EpdConvert(nMinterms, epd);
+  return 0;
+} /* end of bdd_epd_count_onset */
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+int
+bdd_get_free(bdd_t *f)
+{
+    return (f->free);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_manager *
+bdd_get_manager(bdd_t *f)
+{
+    return (bdd_manager *) (f->bddManager);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+var_set_t *
+bdd_get_support(bdd_t *f)
+{
+  Cal_Bdd *support, var;
+  Cal_BddManager mgr;
+  long num_vars;
+  var_set_t *result;
+  int id, i;
+  
+  mgr = f->bddManager;
+  num_vars = Cal_BddVars(mgr);
+  result = var_set_new((int) num_vars);
+  support = Cal_MemAlloc(Cal_Bdd, (num_vars+1) * sizeof(Cal_Bdd));
+  for (i = 0; i <= num_vars; ++i) {
+	support[i] = 0; 
+  }
+  
+  (void) Cal_BddSupport(mgr, f->calBdd, support);
+  for (i = 0; i < num_vars; ++i) {
+	var = support[i]; 
+	if (var) {
+      id = (int) (Cal_BddGetIfId(mgr, var) - 1);
+      var_set_set_elt(result, id);
+    }
+  }
+  
+  Cal_MemFree(support);
+  return result;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a BDD is a support of f.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_is_support_var(bdd_t *f, bdd_t *var)
+{
+    return(bdd_is_support_var_id(f, bdd_top_var_id(var)));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a BDD index is a support of f.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_is_support_var_id(bdd_t *f, int index)
+{
+  Cal_Bdd *support, var;
+  Cal_BddManager mgr;
+  long num_vars;
+  int id, i;
+  
+  mgr = f->bddManager;
+  num_vars = Cal_BddVars(mgr);
+  support = Cal_MemAlloc(Cal_Bdd, (num_vars+1) * sizeof(Cal_Bdd));
+  for (i = 0; i <= num_vars; ++i) {
+    support[i] = 0; 
+  }
+  
+  (void) Cal_BddSupport(mgr, f->calBdd, support);
+  for (i = 0; i < num_vars; ++i) {
+    var = support[i]; 
+    if (var) {
+      id = (int) (Cal_BddGetIfId(mgr, var) - 1);
+      if (id == index) {
+	Cal_MemFree(support);
+	return 1;
+      }
+    }
+  }
+  
+  Cal_MemFree(support);
+  return 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+array_t *
+bdd_get_varids(array_t *var_array)
+{
+  int i;
+  bdd_t *var;
+  array_t *result;
+  bdd_variableId varId;
+  
+  result = array_alloc(bdd_variableId, 0);
+  for (i = 0; i < array_n(var_array); i++) {
+    var = array_fetch(bdd_t *, var_array, i);
+    varId = (int) bdd_top_var_id(var);
+    array_insert_last(bdd_variableId, result, varId);
+  }
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+unsigned int 
+bdd_num_vars(bdd_manager *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return (Cal_BddVars(mgr));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void
+bdd_print(bdd_t *f)
+{
+  Cal_BddPrintBdd(f->bddManager, f->calBdd, Cal_BddNamingFnNone,
+                  Cal_BddTerminalIdFnNone, (Cal_Pointer_t) 0, (FILE *)stdout); 
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void
+bdd_print_stats(bdd_manager *manager, FILE *file)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  Cal_BddManagerGC(mgr);
+  Cal_BddStats(mgr, file);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+int
+bdd_size(bdd_t *f)
+{
+  return ((int) Cal_BddSize(f->bddManager, f->calBdd, 1));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the number of nodes of a BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_node_size(bdd_node *f)
+{
+    return(0);
+
+} /* end of bdd_node_size */
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+long
+bdd_size_multiple(array_t *bdd_array)
+{
+  long result;
+  Cal_Bdd *vector_bdd;
+  bdd_t *f;
+  int i;
+  Cal_BddManager mgr;
+  
+  if ((bdd_array == NIL(array_t)) || (array_n(bdd_array) == 0))
+    return 0;
+  
+  f = array_fetch(bdd_t*, bdd_array, 0);
+  mgr = f->bddManager;
+  vector_bdd = Cal_MemAlloc(Cal_Bdd, array_n(bdd_array)+1);
+  for(i=0; i<array_n(bdd_array);i++){
+    f = array_fetch(bdd_t*, bdd_array, i);
+    vector_bdd[i] = f->calBdd;
+  }
+  vector_bdd[array_n(bdd_array)] = 0;
+  result =  Cal_BddSizeMultiple(mgr, vector_bdd,1);
+  Cal_MemFree(vector_bdd);
+  return result;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_variableId
+bdd_top_var_id(bdd_t *f)
+{
+  return ((bdd_variableId) (Cal_BddGetIfId(f->bddManager, f->calBdd) - 1));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_external_hooks *
+bdd_get_external_hooks(bdd_manager *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return (bdd_external_hooks *) Cal_BddManagerGetHooks(mgr);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void
+bdd_set_gc_mode(bdd_manager *manager,boolean no_gc)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  Cal_BddSetGCMode(mgr, (int) no_gc);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void 
+bdd_dynamic_reordering(bdd_manager *manager, bdd_reorder_type_t
+                       algorithm_type, bdd_reorder_verbosity_t verbosity)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+    switch(algorithm_type) {
+      case BDD_REORDER_SIFT:
+        Cal_BddDynamicReordering(mgr, CAL_REORDER_SIFT);
+      break;
+      case BDD_REORDER_WINDOW:
+        Cal_BddDynamicReordering(mgr, CAL_REORDER_WINDOW);
+      break;
+      case BDD_REORDER_NONE:
+        Cal_BddDynamicReordering(mgr, CAL_REORDER_NONE);
+      break;
+      default:
+        fprintf(stderr,"CAL: bdd_dynamic_reordering: unknown algorithm type\n");
+        fprintf(stderr,"Using SIFT method instead\n");
+        Cal_BddDynamicReordering(mgr, CAL_REORDER_SIFT);
+    }
+  
+}
+
+void 
+bdd_dynamic_reordering_zdd(bdd_manager *manager, bdd_reorder_type_t
+                       algorithm_type, bdd_reorder_verbosity_t verbosity)
+{
+    return;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+void 
+bdd_reorder(bdd_manager *manager)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  Cal_BddReorder(mgr);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_variableId
+bdd_get_id_from_level(bdd_manager *manager, long level)
+{
+  Cal_Bdd fn;
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  fn = Cal_BddManagerGetVarWithIndex(mgr, level);
+  if (!fn){
+    /* variable should always be found, since they are created at bdd_start */
+    fprintf(stderr, "bdd_get_id_from_level: assumption violated");
+    exit(-1);
+  }
+  return ((bdd_variableId)(Cal_BddGetIfId(mgr, fn) - 1 ));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+long
+bdd_top_var_level(bdd_manager *manager, bdd_t *fn)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return (long)Cal_BddGetIfIndex(mgr, fn->calBdd);
+}
+
+/*
+ */
+/**Function********************************************************************
+
+  Synopsis           [Return TRUE if f is a cube, else return FALSE.]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+boolean
+bdd_is_cube(bdd_t *f)
+{
+  Cal_BddManager mgr;
+  if (f == NIL(bdd_t)) {
+    fail("bdd_is_cube: invalid BDD");
+  }
+  if(f->free) fail ("Freed Bdd passed to bdd_is_cube");
+  mgr = f->bddManager;
+  return ((boolean)Cal_BddIsCube(mgr, f->calBdd));
+}
+
+/**Function********************************************************************
+
+  Synopsis           []
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_block *
+bdd_new_var_block(bdd_t *f, long length)
+{
+	return (bdd_block *) Cal_BddNewVarBlock(f->bddManager, f->calBdd, length);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [Return TRUE if f is a cube, else return FALSE.]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_t *
+bdd_var_with_index(bdd_manager *manager, int index)
+{
+  Cal_BddManager mgr = (Cal_BddManager) manager;
+  return bdd_construct_bdd_t(mgr,
+                             Cal_BddManagerGetVarWithIndex(mgr,
+                                                           index)); 
+}
+
+
+/**Function********************************************************************
+
+  Synopsis [Sets the internal parameters of the package to the given values.]
+
+  Description [The CAL package has a set of parameters that can be assigned
+  different values. This function receives a table which maps strings to
+  values and sets the parameters represented by the strings to the pertinent
+  values. Some basic type checking is done. It returns 1 if everything is
+  correct and 0 otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_set_parameters(
+  bdd_manager *mgr,
+  avl_tree *valueTable,
+  FILE *file)
+{
+  /* int reorderMethod; */
+  st_table *newValueTable;
+  st_generator *stgen;
+  avl_generator *avlgen;
+  char *paramName;
+  char *paramValue;
+  Cal_BddManager bddManager = (Cal_BddManager)mgr;
+  
+
+  /* Build a new table with the parameter names but with
+  ** the prefix removed. */
+  newValueTable = st_init_table(st_ptrcmp, st_ptrhash);
+  avl_foreach_item(valueTable, avlgen, AVL_FORWARD, (char **)&paramName, 
+                   (char **)&paramValue) {
+    if (strncmp(paramName, "BDD.", 4) == 0) {
+      st_insert(newValueTable, (char *)&paramName[4],
+                (char *)paramValue);
+    }
+  }
+  
+  st_foreach_item(newValueTable, stgen, &paramName, &paramValue) {
+    unsigned int uvalue;
+    double value;
+    char *invalidChar;
+    
+    invalidChar = NIL(char);
+    
+    if (strcmp(paramName, "Node limit") == 0) {
+      uvalue = (unsigned int) strtol(paramValue, &invalidChar, 10);
+      /* RB an unsigned will never be < 0 */
+      if (*invalidChar /*|| uvalue < 0*/) {
+	InvalidType(file, "Node limit", "unsigned integer");
+      }
+      else {
+	bddManager->nodeLimit = uvalue;
+      }
+    }
+    else if (strcmp(paramName, "Garbage collection enabled") == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	bddManager->gcMode = 1;
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	bddManager->gcMode = 0;
+      }
+      else {
+	InvalidType(file, "Garbage collection enabled", "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, 
+		    "Maximum number of variables sifted per reordering") == 0) {
+      uvalue = (unsigned int) strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar /*|| uvalue < 0*/) {
+	InvalidType(file, "Maximum number of variables sifted per reordering",
+		    "unsigned integer");
+      }
+      else {
+	bddManager->maxNumVarsSiftedPerReordering = uvalue;
+      }
+    }
+    else if (strcmp(paramName,
+		    "Maximum number of variable swaps per reordering") == 0) {
+      uvalue = (unsigned int) strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar /*|| uvalue < 0*/) {
+	InvalidType(file, "Maximum number of variable swaps per reordering", 
+		    "unsigned integer");
+      }
+      else {
+	bddManager->maxNumSwapsPerReordering = uvalue;
+      }
+    }
+    else if (strcmp(paramName, 
+		    "Maximum growth while sifting a variable") == 0) {
+      value = strtod(paramValue, &invalidChar);
+      if (*invalidChar) {
+	InvalidType(file, "Maximum growth while sifting a variable",
+		    "real");
+      }
+      else {
+	bddManager->maxSiftingGrowth = value;
+      }
+    }
+    else if (strcmp(paramName, "Dynamic reordering of BDDs enabled") == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	bddManager->dynamicReorderingEnableFlag = 1;
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	bddManager->dynamicReorderingEnableFlag = 0;
+      }
+      else {
+	InvalidType(file, "Dynamic reordering of BDDs enabled",
+		    "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, "Use old reordering")
+	     == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	bddManager->reorderMethod = CAL_REORDER_METHOD_BF;
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	bddManager->reorderMethod = CAL_REORDER_METHOD_DF;
+      }
+      else {
+	InvalidType(file, "Dynamic reordering of BDDs enabled",
+		    "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, "Dynamic reordering threshold") == 0) {
+      uvalue = (unsigned int) strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar /*|| uvalue < 0*/) {
+        InvalidType(file, "Dynamic reordering threshold", "unsigned integer");
+      }
+      else {
+        bddManager->reorderingThreshold = uvalue;
+      }
+    }
+    else if (strcmp(paramName, "Repacking after GC threshold")
+	     == 0) {
+      value = strtod(paramValue, &invalidChar);
+      if (*invalidChar || value < 0) {
+        InvalidType(file, "Repacking after GC threshold", "unsigned real");
+      }
+      else {
+        bddManager->repackAfterGCThreshold = value;
+      }
+    }
+    else if (strcmp(paramName, "Table repacking threshold")
+	     == 0) {
+      value = strtod(paramValue, &invalidChar);
+      if (*invalidChar || value < 0) {
+        InvalidType(file, "Table repacking threshold", "unsigned real");
+      }
+      else {
+        bddManager->tableRepackThreshold = value;
+      }
+    }
+    else {
+      (void) fprintf(file, "Warning: Parameter %s not recognized.",
+                     paramName);
+      (void) fprintf(file, " Ignored.\n");
+    }
+  } /* end of st_foreach_item */
+  
+  /* Clean up. */
+  st_free_table(newValueTable);
+  
+  return(1);
+  
+} /* end of bdd_set_parameters */
+
+/**Function********************************************************************
+
+  Synopsis    [Dummy functions defined in bdd.h]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_compact(bdd_t *f, bdd_t *g)
+{
+    return 0;
+}
+
+bdd_t *
+bdd_squeeze(bdd_t *f, bdd_t *g)
+{
+    return 0;
+}
+bdd_t *
+bdd_clipping_and_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars	/* of bdd_t *'s */,
+  int maxDepth,
+  int over)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_hb(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_sp(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  int hardlimit)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_ua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  int safe,
+  double quality)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_remap_ua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  double quality)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_biased_rua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  bdd_t *bias,
+  int numVars,
+  int threshold,
+  double quality,
+  double quality1)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_compress(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold)
+{
+  return NIL(bdd_t);
+}
+
+int
+bdd_gen_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t ***conjArray)
+{
+  return 0;
+}
+
+int
+bdd_var_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t ***conjArray)
+{
+  return 0;
+}
+
+int 
+bdd_approx_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t ***conjArray)
+{
+  return 0;
+}
+
+int
+bdd_add_hook(
+  bdd_manager *mgr,
+  int (*procedure)(bdd_manager *, char *, void *),
+  bdd_hook_type_t whichHook)
+{
+  return 0;
+}
+
+int
+bdd_remove_hook(
+  bdd_manager *mgr,
+  int (*procedure)(bdd_manager *, char *, void *),
+  bdd_hook_type_t whichHook)
+{
+  return 0;
+}
+
+int
+bdd_enable_reordering_reporting(bdd_manager *mgr)
+{
+  return 0;
+}
+int
+bdd_disable_reordering_reporting(bdd_manager *mgr)
+{
+  return 0;
+}
+
+bdd_reorder_verbosity_t 
+bdd_reordering_reporting(bdd_manager *mgr)
+{
+  return BDD_REORDER_VERBOSITY_DEFAULT;
+}
+
+int 
+bdd_print_apa_minterm(
+  FILE *fp,
+  bdd_t *f,
+  int nvars,
+  int precision)
+{
+  return 0;
+}
+
+int 
+bdd_apa_compare_ratios(
+  int nvars,
+  bdd_t *f1,
+  bdd_t *f2,
+  int f1Num,
+  int f2Num)
+{
+  return 0;
+}
+
+int
+bdd_iter_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t  ***conjArray)
+{
+  return 0;
+}
+
+int
+bdd_reordering_status(
+  bdd_manager *mgr,
+  bdd_reorder_type_t *method)
+{
+  return 0;
+}
+
+int
+bdd_read_node_count(bdd_manager *mgr)
+{
+  return 0;
+}
+
+double
+bdd_correlation(bdd_t *f, bdd_t *g)
+{
+    return 0.0;
+}
+
+
+bdd_t *
+bdd_pick_one_minterm(bdd_t *f, array_t *varsArray)
+{
+    return NIL(bdd_t);
+}
+
+array_t *
+bdd_bdd_pick_arbitrary_minterms(
+  bdd_t *f,
+  array_t *varsArray,
+  int n,
+  int k)
+{
+    return NIL(array_t);
+}
+
+
+int
+bdd_reordering_zdd_status(
+  bdd_manager *mgr,
+  bdd_reorder_type_t *method)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_bdd_to_add(
+  bdd_manager *mgr,
+  bdd_node *fn)
+{
+  return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_add_permute(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  int *permut)
+{
+  return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_permute(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  int *permut)
+{
+  return NIL(bdd_node);
+}
+
+
+void
+bdd_ref(bdd_node *fn)
+{
+  return ;
+}
+
+
+void
+bdd_recursive_deref(bdd_manager *mgr, bdd_node *f)
+{
+  return;
+}
+
+
+bdd_node *
+bdd_add_exist_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *vars)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_apply(
+  bdd_manager *mgr,
+  bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **),
+  bdd_node *fn1,
+  bdd_node *fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_nonsim_compose(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node **vector)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_residue(
+  bdd_manager *mgr,
+  int n,
+  int m,
+  int options,
+  int top)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node **vector)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_times(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_check_zero_ref(bdd_manager *mgr)
+{
+  return 0;
+}
+
+
+void
+bdd_dynamic_reordering_disable(bdd_manager *mgr)
+{
+  return;
+}
+
+void
+bdd_dynamic_reordering_zdd_disable(bdd_manager *mgr)
+{
+  return;
+}
+
+
+bdd_node *
+bdd_add_xnor(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_shuffle_heap(
+  bdd_manager *mgr,
+  int *permut)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_add_compose(
+  bdd_manager *mgr,
+  bdd_node *fn1,
+  bdd_node *fn2,
+  int var)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_ith_var(
+  bdd_manager *mgr,
+  int i)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_get_level_from_id(
+  bdd_manager *mgr,
+  int id)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_bdd_exist_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *cube)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_equal_sup_norm(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *gn,
+  BDD_VALUE_TYPE tolerance,
+  int pr)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_read_logic_zero(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_ith_var(
+  bdd_manager *mgr,
+  int i)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_divide(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_constrain(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *c)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_restrict(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *c)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_hamming(
+  bdd_manager *mgr,
+  bdd_node **xVars,
+  bdd_node **yVars,
+  int nVars)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_ite(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *h)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_find_max(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+
+int
+bdd_bdd_pick_one_cube(
+  bdd_manager *mgr,
+  bdd_node *node,
+  char *string)
+{
+    return 0;
+}
+
+
+bdd_node *
+bdd_add_swap_variables(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  bdd_node **y,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_swap_variables(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  bdd_node **y,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_or(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_t *
+bdd_compute_cube(
+  bdd_manager *mgr,
+  array_t *vars)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_compute_cube_with_phase(
+  bdd_manager *mgr,
+  array_t *vars,
+  array_t *phase)
+{
+  return NIL(bdd_t);
+}
+
+
+bdd_node *
+bdd_bdd_compute_cube(
+  bdd_manager *mgr,
+  bdd_node **vars,
+  int *phase,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_indices_to_cube(
+  bdd_manager *mgr,
+  int *idArray,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_and(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_matrix_multiply(
+  bdd_manager *mgr,
+  bdd_node *A,
+  bdd_node *B,
+  bdd_node **z,
+  int nz)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_compute_cube(
+  bdd_manager *mgr,
+  bdd_node **vars,
+  int *phase,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_const(
+  bdd_manager *mgr,
+  BDD_VALUE_TYPE c)
+{
+    return NIL(bdd_node);
+}
+
+
+double
+bdd_count_minterm(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int n)
+{
+    return 0;
+}
+
+
+bdd_node *
+bdd_add_bdd_threshold(
+  bdd_manager *mgr,
+  bdd_node *f,
+  BDD_VALUE_TYPE value)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_bdd_strict_threshold(
+  bdd_manager *mgr,
+  bdd_node *f,
+  BDD_VALUE_TYPE value)
+{
+    return NIL(bdd_node);
+}
+
+BDD_VALUE_TYPE
+bdd_read_epsilon(bdd_manager *mgr)
+{
+    return 0;
+}
+
+bdd_node *
+bdd_read_one(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_pick_one_minterm(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vars,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_read_zero(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_new_var(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_and_abstract(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *cube)
+{
+    return NIL(bdd_node);
+}
+
+void
+bdd_deref(bdd_node *f)
+{
+    return;
+}
+
+bdd_node *
+bdd_add_plus(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_read_reorderings(bdd_manager *mgr)
+{
+    return 0;
+}
+
+int
+bdd_read_next_reordering(bdd_manager *mgr)
+{
+    return 0;
+}
+
+void
+bdd_set_next_reordering(bdd_manager *mgr, int next)
+{
+}
+
+bdd_node *
+bdd_bdd_xnor(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vector)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_extract_node_as_is(bdd_t *fn)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_get_node(
+  bdd_manager *mgr,
+  int id,
+  bdd_node *g,
+  bdd_node *h)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_product(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_product_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_union(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return(NIL(bdd_node));
+}
+
+
+bdd_node *
+bdd_zdd_weak_div(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_weak_div_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_isop_recur(
+  bdd_manager *mgr,
+  bdd_node *L,
+  bdd_node *U,
+  bdd_node **zdd_I)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_isop(
+  bdd_manager *mgr,
+  bdd_node *L,
+  bdd_node *U,
+  bdd_node **zdd_I)
+{
+    return NIL(bdd_node);
+}
+
+int
+bdd_zdd_get_cofactors3(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int v,
+  bdd_node **f1,
+  bdd_node **f0,
+  bdd_node **fd)
+{
+    return 0;
+}
+
+bdd_node *
+bdd_bdd_and_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+     return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_unique_inter(
+  bdd_manager *mgr,
+  int v,
+  bdd_node *f,
+  bdd_node *g)
+{
+     return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_unique_inter_ivo(
+  bdd_manager *mgr,
+  int v,
+  bdd_node *f,
+  bdd_node *g)
+{
+     return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_diff(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_diff_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+} 
+
+int
+bdd_num_zdd_vars(bdd_manager *mgr)
+{
+    return -1;
+}
+
+bdd_node *
+bdd_regular(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+int
+bdd_is_constant(bdd_node *f)
+{
+    return 0;
+}
+
+int
+bdd_is_complement(bdd_node *f)
+{
+    return 0;
+}
+
+bdd_node *
+bdd_bdd_T(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_E(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_not_bdd_node(bdd_node *f)
+{
+    return NIL(bdd_node);
+} 
+
+void
+bdd_recursive_deref_zdd(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+    return;
+} 
+
+int
+bdd_zdd_count(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+    return 0;
+}
+
+int
+bdd_read_zdd_level(
+  bdd_manager *mgr,
+  int index)
+{
+    return -1;
+} 
+
+int
+bdd_zdd_vars_from_bdd_vars(
+  bdd_manager *mgr,
+  int multiplicity)
+{
+   return 0;
+} 
+
+void
+bdd_zdd_realign_enable(bdd_manager *mgr)
+{
+    return;
+} 
+
+void
+bdd_zdd_realign_disable(bdd_manager *mgr)
+{
+    return;
+} 
+
+int
+bdd_zdd_realignment_enabled(bdd_manager *mgr)
+{
+    return 0;
+} 
+
+void
+bdd_realign_enable(bdd_manager *mgr)
+{
+    return;
+} 
+
+void
+bdd_realign_disable(bdd_manager *mgr)
+{
+    return;
+} 
+
+int
+bdd_realignment_enabled(bdd_manager *mgr)
+{
+    return 0;
+} 
+
+int
+bdd_node_read_index(bdd_node *f)
+{
+    return -1;
+}
+
+bdd_node *
+bdd_read_next(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+void
+bdd_set_next(bdd_node *f, bdd_node *g)
+{
+    return;
+}
+
+int
+bdd_read_reordered_field(bdd_manager *mgr)
+{
+    return -1;
+}
+
+void
+bdd_set_reordered_field(bdd_manager *mgr, int n)
+{
+    return;
+}
+
+bdd_node *
+bdd_add_apply_recur(
+  bdd_manager *mgr,
+  bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **),
+  bdd_node *fn1,
+  bdd_node *fn2)
+{
+    return NIL(bdd_node);
+}
+
+
+BDD_VALUE_TYPE
+bdd_add_value(bdd_node *f)
+{
+    return 0.0; 
+}
+
+int
+bdd_print_minterm(bdd_t *f)
+{
+  return 0;
+}
+
+
+bdd_t *
+bdd_xor_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars)
+{
+    return NIL(bdd_t);
+}
+
+
+bdd_node *
+bdd_read_plus_infinity(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_read_plus_infinity */
+
+
+
+bdd_node *
+bdd_priority_select(
+  bdd_manager *mgr,
+  bdd_node *R,
+  bdd_node  **x,
+  bdd_node **y,
+  bdd_node **z,
+  bdd_node *Pi,
+  int n,
+  bdd_node  *(*Pifunc)(bdd_manager *, int, bdd_node **, bdd_node **, bdd_node **))
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_priority_select */
+
+
+void
+bdd_set_background(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+    return;
+ 
+} /* end of bdd_set_background */
+
+
+bdd_node *
+bdd_read_background(bdd_manager *mgr)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_read_background */
+
+
+bdd_node *
+bdd_bdd_cofactor(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_cofactor */
+
+
+bdd_node *
+bdd_bdd_ite(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *h)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_ite */
+
+
+bdd_node *
+bdd_add_minus(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_add_plus */
+
+
+bdd_node *
+bdd_dxygtdxz(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y,
+  bdd_node **z)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_dxygtdxz */
+
+
+bdd_node *
+bdd_bdd_univ_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *vars)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_univ_abstract */
+
+
+bdd_node *
+bdd_bdd_cprojection(
+  bdd_manager *mgr,
+  bdd_node *R,
+  bdd_node *Y)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_cprojection */
+
+bdd_node *
+bdd_xeqy(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_xeqy */
+
+bdd_node *
+bdd_add_roundoff(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int N)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_add_roundoff */
+
+bdd_node *
+bdd_xgty(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_xgty */
+
+bdd_node *
+bdd_add_cmpl(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_add_cmpl */
+
+bdd_node *
+bdd_split_set(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  int n,
+  double m)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_split_set */
+
+
+int
+bdd_debug_check(bdd_manager *mgr)
+{
+    return -1;
+
+} /* end of bdd_debug_check */
+
+bdd_node *
+bdd_bdd_xor(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+void 
+bdd_dump_blif(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  char *model,
+  FILE *fp)
+{
+  return;
+}
+
+void 
+bdd_dump_blif_body(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  FILE *fp)
+{
+  return;
+}
+
+void 
+bdd_dump_dot(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  FILE *fp)
+{
+  return;
+}
+
+bdd_node *
+bdd_make_bdd_from_zdd_cover(bdd_manager *mgr, bdd_node *node)
+{
+    return(NIL(bdd_node));
+}
+
+bdd_node *
+bdd_zdd_complement(bdd_manager *mgr, bdd_node *node)
+{
+    return(NIL(bdd_node));
+}
+
+bdd_node *
+bdd_bdd_vector_support(
+  bdd_manager *mgr,
+  bdd_node **F,
+  int n)
+{
+  return NIL(bdd_node);
+}
+
+int
+bdd_bdd_vector_support_size(
+  bdd_manager *mgr,
+  bdd_node **F,
+  int n)
+{
+  return -1;
+}
+
+
+int
+bdd_bdd_support_size(
+  bdd_manager *mgr,
+  bdd_node *F)
+{
+  return -1;
+}
+
+bdd_node *
+bdd_bdd_support(
+  bdd_manager *mgr,
+  bdd_node *F)
+{
+  return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_add_general_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vectorOn,
+  bdd_node **vectorOff)
+{
+  return NIL(bdd_node);
+}
+
+int
+bdd_bdd_leq(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+  return -1;
+} 
+
+bdd_node *
+bdd_bdd_boolean_diff(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int x)
+{
+  return NIL(bdd_node);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Compares two bdds are same.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_ptrcmp(bdd_t *f, bdd_t *g)
+{
+  if (f->calBdd == g->calBdd)
+    return(0);
+  else
+    return(1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the hash value of a bdd.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_ptrhash(bdd_t *f, int size)
+{
+  int hash;
+
+  hash = (int)((unsigned long)f->calBdd >> 2) % size;
+  return(hash);
+}
+
+bdd_t *
+bdd_subset_with_mask_vars(
+  bdd_t *f,
+  array_t *varsArray,
+  array_t *maskVarsArray)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_and_smooth_with_cube(
+  bdd_t *f,
+  bdd_t *g,
+  bdd_t *cube)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_smooth_with_cube(bdd_t *f, bdd_t *cube)
+{
+  int i;
+  bdd_t *var, *res;
+  array_t *smoothingVars;
+  var_set_t *supportVarSet;
+
+  smoothingVars = array_alloc(bdd_t *, 0);
+  supportVarSet = bdd_get_support(f);
+  for (i = 0; i < supportVarSet->n_elts; i++) {
+    if (var_set_get_elt(supportVarSet, i) == 1) {
+      var = bdd_var_with_index(f->bddManager, i);
+      array_insert_last(bdd_t *, smoothingVars, var);
+    }
+  }
+  var_set_free(supportVarSet);
+
+  res = bdd_smooth(f, smoothingVars);
+
+  for (i = 0; i < array_n(smoothingVars); i++) {
+    var = array_fetch(bdd_t *, smoothingVars, i);
+    bdd_free(var);
+  }
+  array_free(smoothingVars);
+  return res;
+}
+
+bdd_t *
+bdd_substitute_with_permut(bdd_t *f, int *permut)
+{
+  return NIL(bdd_t);
+}
+
+array_t *
+bdd_substitute_array_with_permut(array_t *f_array, int *permut)
+{
+  return NIL(array_t);
+}
+
+bdd_t *
+bdd_vector_compose(
+  bdd_t *f,
+  array_t *varArray,
+  array_t *funcArray)
+{
+  return NIL(bdd_t);
+}
+
+double *
+bdd_cof_minterm(bdd_t *f)
+{
+  return(NIL(double));
+}
+
+int
+bdd_var_is_dependent(
+  bdd_t *f,
+  bdd_t *var)
+{
+  return(0);
+}
+
+array_t *
+bdd_find_essential(bdd_t *f)
+{
+  return(NIL(array_t));
+}
+
+bdd_t *
+bdd_find_essential_cube(bdd_t *f)
+{
+  return(NIL(bdd_t));
+}
+
+int
+bdd_estimate_cofactor(
+  bdd_t *f,
+  bdd_t *var,
+  int phase)
+{
+  return(0);
+}
+
+long
+bdd_read_peak_memory(bdd_manager *mgr)
+{
+  return(0);
+}
+
+int
+bdd_read_peak_live_node(bdd_manager *mgr)
+{
+  return(0);
+}
+
+int
+bdd_set_pi_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_set_ps_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_set_ns_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_pi_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_ps_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_ns_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_set_pair_index(
+  bdd_manager *mgr,
+  int index,
+  int pairIndex)
+{
+    return(0);
+}
+
+int
+bdd_read_pair_index(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_set_var_to_be_grouped(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_set_var_hard_group(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_reset_var_to_be_grouped(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_var_to_be_grouped(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_var_hard_group(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_var_to_be_ungrouped(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_set_var_to_be_ungrouped(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_bind_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_unbind_var(
+  bdd_manager *mgr,
+  int index)
+{
+    return(0);
+}
+
+int
+bdd_is_lazy_sift(bdd_manager *mgr)
+{
+    return(0);
+}
+
+void
+bdd_discard_all_var_groups(bdd_manager *mgr)
+{
+    return;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis [Function to print a warning that an illegal value was read.]
+
+  SideEffects        []
+
+  SeeAlso            [bdd_set_parameters]
+
+******************************************************************************/
+static void
+InvalidType(
+  FILE *file,
+  char *field,
+  char *expected)
+{
+    (void) fprintf(file, "Warning: In parameter \"%s\"\n", field);
+    (void) fprintf(file, "Illegal type detected. %s expected\n", expected);
+
+} /* end of InvalidType */
Index: /vis_dev/glu-2.1/src/calPort/calPort.make
===================================================================
--- /vis_dev/glu-2.1/src/calPort/calPort.make	(revision 6)
+++ /vis_dev/glu-2.1/src/calPort/calPort.make	(revision 6)
@@ -0,0 +1,4 @@
+CSRC_cal += calPort.c calPortIter.c
+HEADERS_cal += calPortInt.h
+
+DEPENDENCYFILES = $(CSRC_cal)
Index: /vis_dev/glu-2.1/src/calPort/calPortInt.h
===================================================================
--- /vis_dev/glu-2.1/src/calPort/calPortInt.h	(revision 6)
+++ /vis_dev/glu-2.1/src/calPort/calPortInt.h	(revision 6)
@@ -0,0 +1,85 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [calPortInt.h]
+
+  PackageName [cal]
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: calPortInt.h,v 1.2 2002/08/25 05:30:11 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _CAL_PORT_INT_H
+#define _CAL_PORT_INT_H
+#include "util.h"  
+#include "array.h"
+#include "st.h"
+#include "avl.h"
+#include "var_set.h"
+#include "bdd.h"
+#include "calInt.h"
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+struct bdd_t {
+  Cal_Bdd calBdd;
+  Cal_BddManager_t *bddManager; 
+  int free;
+};
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+
+#endif 
+
Index: /vis_dev/glu-2.1/src/calPort/calPortIter.c
===================================================================
--- /vis_dev/glu-2.1/src/calPort/calPortIter.c	(revision 6)
+++ /vis_dev/glu-2.1/src/calPort/calPortIter.c	(revision 6)
@@ -0,0 +1,667 @@
+/**CFile***********************************************************************
+
+  FileName    [calPortIter.c]
+
+  PackageName [calPort]
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan. Modified from the CMU port package
+  written by Tom Shiple.]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+******************************************************************************/
+#include "calPortInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct CalBddGenStruct CalBddGen_t;
+/*
+ * Traversal of BDD Formulas
+ */
+
+typedef enum {
+    bdd_gen_cubes,
+    bdd_gen_nodes
+} bdd_gen_type;
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+struct CalBddGenStruct {
+  Cal_BddManager manager;
+  bdd_gen_status status;
+  bdd_gen_type type;
+  union {
+	struct {
+      array_t *cube;	/* of bdd_literal */
+	} cubes;
+	struct {
+      st_table *visited;	/* of bdd_node* */
+	} nodes;
+  } gen;	
+  struct {
+	int sp;
+	CalBddNode_t **nodeStack;
+    int *idStack;
+  } stack;
+  CalBddNode_t *node;
+};
+
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+static void pop_node_stack(CalBddGen_t *gen);
+static void push_node_stack(Cal_Bdd_t f, CalBddGen_t *gen);
+static void pop_cube_stack(CalBddGen_t *gen);
+static void push_cube_stack(Cal_Bdd_t f, CalBddGen_t *gen);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/*
+ *    Defines an iterator on the onset of a BDD.  Two routines are
+ *    provided: bdd_first_cube, which extracts one cube from a BDD and
+ *    returns a bdd_gen structure containing the information necessary to
+ *    continue the enumeration; and bdd_next_cube, which returns 1 if
+ *     another cube was 
+ *    found, and 0 otherwise. A cube is represented
+ *    as an array of bdd_literal (which are integers in {0, 1, 2}),
+ *    where 0 represents 
+ *    negated literal, 1 for literal, and 2 for don't care.  Returns a
+ *    disjoint 
+ *    cover.  A third routine is there to clean up. 
+ */
+
+bdd_gen_status
+bdd_gen_read_status(bdd_gen *gen)
+{
+  return ((CalBddGen_t *)gen)->status;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [bdd_first_cube - return the first cube of the function.
+  A generator is returned that will iterate over the rest. Return the
+  generator. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+bdd_gen *
+bdd_first_cube(bdd_t *fn,array_t **cube)
+{
+  Cal_BddManager_t *manager;
+  CalBddGen_t *gen;
+  int i;
+  long numVars;
+  Cal_Bdd function;
+  Cal_Bdd_t calBdd;
+  
+  if (fn == NIL(bdd_t)) {
+	CalBddFatalMessage("bdd_first_cube: invalid BDD");
+  }
+
+  manager = fn->bddManager;
+  function = fn->calBdd;
+  
+  /*
+   *    Allocate a new generator structure and fill it in; the stack and the 
+   *    cube will be used, but the visited table and the node will not be used.
+   */
+  gen = ALLOC(CalBddGen_t, 1);
+  
+    /*
+     *    first - init all the members to a rational value for cube iteration
+     */
+  gen->manager = manager;
+  gen->status = bdd_EMPTY;
+  gen->type = bdd_gen_cubes;
+  gen->gen.cubes.cube = NIL(array_t);
+  gen->stack.sp = 0;
+  gen->stack.nodeStack = NIL(CalBddNode_t *);
+  gen->stack.idStack = NIL(int);
+  gen->node = NIL(CalBddNode_t);
+  
+  numVars = Cal_BddVars(manager);
+  gen->gen.cubes.cube = array_alloc(bdd_literal, numVars);
+    
+  /*
+   * Initialize each literal to 2 (don't care).
+   */
+  for (i = 0; i < numVars; i++) {
+    array_insert(bdd_literal, gen->gen.cubes.cube, i, 2);
+  }
+  
+  /*
+   * The stack size will never exceed the number of variables in the BDD, since
+   * the longest possible path from root to constant 1 is the number
+   * of variables in the BDD.
+   */
+  gen->stack.sp = 0;
+  gen->stack.nodeStack = ALLOC(CalBddNode_t *, numVars);
+  gen->stack.idStack = ALLOC(int, numVars);
+
+  /*
+   * Clear out the stack so that in bdd_gen_free, we can decrement the
+   * ref count of those nodes still on the stack.
+   */
+  for (i = 0; i < numVars; i++) {
+	gen->stack.nodeStack[i] = NIL(CalBddNode_t);
+	gen->stack.idStack[i] = -1;
+  }
+  
+  if (Cal_BddIsBddZero(manager, function)){
+	/*
+	 *    All done, for this was but the zero constant ...
+	 *    We are enumerating the onset, (which is vacuous).
+     *    gen->status initialized to bdd_EMPTY above, so this
+     *    appears to be redundant.
+	 */
+	gen->status = bdd_EMPTY;
+  } else {
+	/*
+	 *    Get to work enumerating the onset.  Get the first cube.  Note that
+     *    if fn is just the constant 1, push_cube_stack will properly
+     *    handle this. 
+	 *    Get a new pointer to fn->node beforehand: this increments 
+	 *    the reference count of fn->node; this is necessary, because
+     *    when fn->node 
+	 *    is popped from the stack at the very end, it's ref count is
+     *    decremented. 
+	 */
+	gen->status = bdd_NONEMPTY;
+    calBdd = CalBddGetInternalBdd(manager, function);
+    push_cube_stack(calBdd, gen);
+  }
+  *cube = gen->gen.cubes.cube;
+  return (bdd_gen *)(gen);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [bdd_next_cube - get the next cube on the generator.
+  Returns {TRUE, FALSE} when {more, no more}.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+boolean
+bdd_next_cube(bdd_gen *gen_, array_t **cube)
+{
+  CalBddGen_t *gen = (CalBddGen_t *) gen_;
+  pop_cube_stack(gen);
+  if (gen->status == bdd_EMPTY) {
+    return (FALSE);
+  }
+  *cube = gen->gen.cubes.cube;
+  return (TRUE);
+}
+
+bdd_gen *
+bdd_first_disjoint_cube(bdd_t *fn,array_t **cube)
+{
+  return(bdd_first_cube(fn,cube));
+}
+
+boolean
+bdd_next_disjoint_cube(bdd_gen *gen_, array_t **cube)
+{
+  return(bdd_next_cube(gen_,cube));
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [bdd_first_node - enumerates all bdd_node in fn. 
+  Return the generator.]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+bdd_gen *
+bdd_first_node(bdd_t *fn, bdd_node **node)
+{
+  Cal_BddManager_t *manager;
+  CalBddGen_t *gen;
+  long numVars;
+  int i;
+  Cal_Bdd_t calBdd;
+  Cal_Bdd function;
+  
+  if (fn == NIL(bdd_t)) {
+	CalBddFatalMessage("bdd_first_node: invalid BDD");
+  }
+  
+  manager = fn->bddManager;
+  function = fn->calBdd;
+  
+  /*
+   *    Allocate a new generator structure and fill it in; the
+   *    visited table will be used, as will the stack, but the
+   *    cube array will not be used.
+   */
+  gen = ALLOC(CalBddGen_t, 1);
+  
+  /*
+   *    first - init all the members to a rational value for node iteration.
+   */
+  gen->manager = manager;
+  gen->status = bdd_NONEMPTY;
+  gen->type = bdd_gen_nodes;
+  gen->gen.nodes.visited = NIL(st_table);
+  gen->stack.sp = 0;
+  gen->stack.nodeStack = NIL(CalBddNode_t *);
+  gen->stack.idStack = NIL(int);
+  gen->node = NIL(CalBddNode_t);
+  
+  /* 
+   * Set up the hash table for visited nodes.  Every time we visit a node,
+   * we insert it into the table.
+   */
+  gen->gen.nodes.visited = st_init_table(st_ptrcmp, st_ptrhash);
+  
+  /*
+   * The stack size will never exceed the number of variables in the BDD, since
+   * the longest possible path from root to constant 1 is the number
+   * of variables in the BDD.
+   */
+  gen->stack.sp = 0;
+  numVars = Cal_BddVars(manager);
+  gen->stack.nodeStack = ALLOC(CalBddNode_t *, numVars);
+  gen->stack.idStack = ALLOC(int, numVars);
+  /*
+   * Clear out the stack so that in bdd_gen_free, we can decrement the
+   * ref count of those nodes still on the stack.
+   */
+  for (i = 0; i < numVars; i++) {
+	gen->stack.nodeStack[i] = NIL(CalBddNode_t);
+	gen->stack.idStack[i] = -1;
+  }
+  
+  /*
+   * Get the first node.  Get a new pointer to fn->node beforehand:
+   * this increments 
+   * the reference count of fn->node; this is necessary, because when fn->node
+   * is popped from the stack at the very end, it's ref count is decremented.
+   */
+  calBdd = CalBddGetInternalBdd(manager, function);
+  push_node_stack(calBdd, gen);
+  gen->status = bdd_NONEMPTY;
+  
+  *node = (bdd_node *)gen->node;	/* return the node */
+  return (bdd_gen *)(gen);	/* and the new generator */
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [bdd_next_node - get the next node in the BDD.
+  Return {TRUE, FALSE} when {more, no more}. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+boolean
+bdd_next_node(bdd_gen *gen_,bdd_node **node)
+{
+  CalBddGen_t *gen = (CalBddGen_t *) gen_;
+  pop_node_stack(gen);
+  if (gen->status == bdd_EMPTY) {
+	return (FALSE);
+  }
+  *node = (bdd_node *) gen->node;
+  return (TRUE);
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [bdd_gen_free - frees up the space used by the generator.
+  Return an int so that it is easier to fit in a foreach macro.
+  Return 0 (to make it easy to put in expressions). ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+int
+bdd_gen_free(bdd_gen *gen_)
+{
+  CalBddGen_t *gen = (CalBddGen_t *) gen_;
+  st_table *visited_table;
+
+  switch (gen->type) {
+    case bdd_gen_cubes:
+      array_free(gen->gen.cubes.cube);
+      gen->gen.cubes.cube = NIL(array_t);
+      break;
+    case bdd_gen_nodes:
+      visited_table = gen->gen.nodes.visited;
+      st_free_table(visited_table);
+      visited_table = NIL(st_table);
+      break;
+  }
+  FREE(gen->stack.nodeStack);
+  FREE(gen->stack.idStack);
+  FREE(gen);
+  return (0);	/* make it return some sort of an int */
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+/*
+ *    Invariants:
+ *
+ *    gen->stack.stack contains nodes that remain to be explored.
+ *
+ *    For a cube generator,
+ *        gen->gen.cubes.cube reflects the choices made to reach node
+ *        at top of the stack. 
+ *    For a node generator,
+ *        gen->gen.nodes.visited reflects the nodes already visited in
+ *         the BDD dag. 
+ */
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [push_cube_stack - push a cube onto the stack to
+  visit. Return nothing, just do it. 
+  The BDD is traversed using depth-first search, with the ELSE branch
+  searched before the THEN branch. 
+  Caution: If you are creating new BDD's while iterating through the
+  cubes, and a garbage collection happens to be performed during this
+  process, then the BDD generator will get lost and an error will result. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+push_cube_stack(Cal_Bdd_t f, CalBddGen_t *gen)
+{
+  bdd_variableId topId;
+  Cal_Bdd_t f0, f1;
+  Cal_BddManager_t *manager;
+
+  manager = gen->manager;
+  
+  if (CalBddIsBddOne(manager, f)){
+    return;
+  }
+
+  topId = f.bddId-1;
+  CalBddGetElseBdd(f, f0);
+  CalBddGetThenBdd(f, f1);
+
+  if (CalBddIsBddZero(manager, f1)){ 
+/*
+ *    No choice: take the 0 branch.  Since there is only one branch to 
+ *    explore from f, there is no need to push f onto the stack, because
+ *    after exploring this branch we are done with f.  A consequence of 
+ *    this is that there will be no f to pop either.  Same goes for the
+ *    next case.  Decrement the ref count of f and of the branch leading
+ *    to zero, since we will no longer need to access these nodes.
+ */
+    array_insert(bdd_literal, gen->gen.cubes.cube, topId, 0);
+	push_cube_stack(f0, gen);
+  }
+  else if (CalBddIsBddZero(manager, f0)){
+	/*
+	 *    No choice: take the 1 branch
+	 */
+	array_insert(bdd_literal, gen->gen.cubes.cube, topId, 1);
+	push_cube_stack(f1, gen);
+  } else {
+    /*
+     * In this case, we must explore both branches of f.  We always choose
+     * to explore the 0 branch first.  We must push f on the stack, so that
+     * we can later pop it and explore its 1 branch. Decrement the ref count 
+     * of f1 since we will no longer need to access this node.  Note that 
+     * the parent of f1 was bdd_freed above or in pop_cube_stack.
+     */
+    gen->stack.nodeStack[gen->stack.sp] = f.bddNode;
+    gen->stack.idStack[gen->stack.sp++] = f.bddId;
+    array_insert(bdd_literal, gen->gen.cubes.cube, topId, 0);
+    push_cube_stack(f0, gen);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+pop_cube_stack(CalBddGen_t *gen)
+{
+  CalBddNode_t *fNode;
+  int fId, fIndex, i;
+  Cal_Bdd_t f1, f;
+  Cal_BddManager_t *manager;
+  
+  manager = gen->manager;
+  if (gen->stack.sp == 0) {
+    /*
+     * Stack is empty.  Have already explored both the 0 and 1 branches of 
+     * the root of the BDD.
+     */
+	gen->status = bdd_EMPTY;
+  } else {
+    /*
+     * Explore the 1 branch of the node at the top of the stack (since it is
+     * on the stack, this means we have already explored the 0 branch).  We 
+     * permanently pop the top node, and bdd_free it, since there are
+     * no more edges left to explore. 
+     */
+	fNode = gen->stack.nodeStack[--gen->stack.sp];
+	fId = gen->stack.idStack[gen->stack.sp];
+	gen->stack.nodeStack[gen->stack.sp] = NIL(CalBddNode_t); /* overwrite */
+                                                         /* with NIL */
+	gen->stack.idStack[gen->stack.sp] = -1;
+	array_insert(bdd_literal, gen->gen.cubes.cube, fId-1, 1);
+    fIndex = manager->idToIndex[fId];
+	for (i = fIndex + 1; i < array_n(gen->gen.cubes.cube); i++) {
+      array_insert(bdd_literal, gen->gen.cubes.cube,
+                   manager->indexToId[i]-1, 2); 
+	}
+    f.bddNode = fNode;
+    f.bddId = fId;
+    CalBddGetThenBdd(f, f1);
+	push_cube_stack(f1, gen);
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [push_node_stack - push a node onto the stack.
+  The same as push_cube_stack but for enumerating nodes instead of cubes.
+  The BDD is traversed using depth-first search, with the ELSE branch
+  searched before the THEN branch, and a node returned only after its
+  children have been returned.  Note that the returned bdd_node
+  pointer has the complement bit zeroed out.
+  Caution: If you are creating new BDD's while iterating through the
+  nodes, and a garbage collection happens to be performed during this
+  process, then the BDD generator will get lost and an error will result. ]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+static void
+push_node_stack(Cal_Bdd_t f, CalBddGen_t *gen)
+{
+  Cal_Bdd_t f0, f1;
+  bdd_node *reg_f, *reg_f0, *reg_f1;
+
+  reg_f = (CalBddNode_t *) CAL_BDD_POINTER(f.bddNode);  /* use of calInt.h */
+  if (st_is_member(gen->gen.nodes.visited, (char *) reg_f)){
+    /* 
+     * Already been visited.
+     */
+	return;
+  }
+  
+  if (CalBddIsBddConst(f)){
+    /*
+     * If f is the constant node and it has not been visited yet, then
+     * put it in the visited table and set the gen->node pointer.
+     * There is no need to put it in the stack because 
+     * the constant node does not have any branches, and there is no
+     * need to free f because constant nodes have a saturated
+     * reference count. 
+     */
+	st_insert(gen->gen.nodes.visited, (char *) reg_f, NIL(char));
+	gen->node = (CalBddNode_t *) reg_f;
+  } else {
+    /*
+     * f has not been marked as visited.  We don't know yet if any of
+     * its branches remain to be explored.  First get its branches.
+     */
+    CalBddGetElseBdd(f, f0);
+    CalBddGetThenBdd(f, f1);
+
+	reg_f0 = (CalBddNode_t *) CAL_BDD_POINTER(f0.bddNode);
+	reg_f1 = (CalBddNode_t *) CAL_BDD_POINTER(f1.bddNode);
+
+	if (st_is_member(gen->gen.nodes.visited, (char *) reg_f0) == 0){
+      /* 
+       * The 0 child has not been visited, so explore the 0 branch.
+       * First push f on the stack.  Bdd_free f1 since we will not
+       * need to access this exact pointer any more.
+       */
+      gen->stack.nodeStack[gen->stack.sp] = f.bddNode;
+      gen->stack.idStack[gen->stack.sp++] = f.bddId;
+      push_node_stack(f0, gen);
+	} else{
+      if (st_is_member(gen->gen.nodes.visited, (char *) reg_f1) == 0){
+        /* 
+         * The 0 child has been visited, but the 1 child has not been
+         * visited, so explore the 1 branch.  First push f on the
+         * stack. 
+         */
+        gen->stack.nodeStack[gen->stack.sp] = f.bddNode;
+        gen->stack.idStack[gen->stack.sp++] = f.bddId;
+        push_node_stack(f1, gen);
+      } else {
+        /*
+         * Both the 0 and 1 children have been visited. Thus we are done
+         * exploring from f.   
+         * Mark f as visited (put it in the visited table), and set the
+         * gen->node pointer. 
+         */
+        st_insert(gen->gen.nodes.visited, (char *) reg_f, NIL(char));
+        gen->node = (CalBddNode_t *) reg_f;
+      }
+    }
+  }
+}
+
+/**Function********************************************************************
+
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+
+******************************************************************************/
+
+static void
+pop_node_stack(CalBddGen_t *gen)
+{
+  CalBddNode_t *fNode;
+  int fId;
+  Cal_Bdd_t calBdd;
+  
+  if (gen->stack.sp == 0) {
+    gen->status = bdd_EMPTY;
+    return;
+  }
+  fNode = gen->stack.nodeStack[--gen->stack.sp]; 
+  fId = gen->stack.idStack[gen->stack.sp];
+  gen->stack.nodeStack[gen->stack.sp] = NIL(CalBddNode_t);
+  gen->stack.idStack[gen->stack.sp] = -1;
+  calBdd.bddNode = fNode;
+  calBdd.bddId = fId;
+  push_node_stack(calBdd, gen);
+}
+
Index: /vis_dev/glu-2.1/src/cmuBdd/bdd.3
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bdd.3	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bdd.3	(revision 6)
@@ -0,0 +1,2001 @@
+.\" BDD library man page
+.TH BDD 3 "11 June 1993"
+.SH NAME
+bdd \- a binary decision diagram (BDD) package
+.SH SYNOPSIS
+.B #include <bdduser.h>
+.SH DESCRIPTION
+The
+.B libbdd
+library provides a set of routines for manipulating binary decision
+diagrams (BDDs).  Some support is also provided for multi-terminal
+BDDs (MTBDDs).  Programs designed to be used with the library should
+use the
+.B -lbdd -lmem
+options to
+.B cc
+when linking.
+.SH "LIST OF FUNCTIONS"
+.nf
+.ta 3in
+\fIName\fP	\fIFunction\fP
+bdd_init	Initialize the library
+bdd_quit	Finish using the library
+bdd_new_var_first	Create a variable first in the order
+bdd_new_var_last	Create a variable last in the order
+bdd_new_var_before	Create a variable before an existing one
+bdd_new_var_after	Create a variable after an existing one
+bdd_var_with_index	Obtain an existing variable
+bdd_var_with_id	Obtain an existing variable
+bdd_one	Constant TRUE
+bdd_zero	Constant FALSE
+bdd_and	Logical AND
+bdd_nand	Logical NAND
+bdd_or	Logical OR
+bdd_nor	Logical NOR
+bdd_xor	Logical XOR
+bdd_xnor	Logical XNOR
+bdd_identity	Logical identity
+bdd_not	Logical NOT
+bdd_ite	Logical IF-THEN-ELSE
+bdd_if	Get the variable of the top node in a BDD
+bdd_then	Get the THEN branch of the top node in a BDD
+bdd_else	Get the ELSE branch of the top node in a BDD
+bdd_if_index	Get the index of the top variable in a BDD
+bdd_if_id	Get a unique ID number for the top variable
+bdd_intersects	Check intersection
+bdd_implies	Check boolean implication
+bdd_new_assoc	Make a new variable association
+bdd_free_assoc	Free a variable association
+bdd_temp_assoc	Set the temporary variable association
+bdd_augment_temp_assoc	Set the temporary variable association
+bdd_assoc	Set the current variable association
+bdd_exists	Existential quantification
+bdd_forall	Universal quantification
+bdd_rel_prod	Relational product
+bdd_compose	Substitute for a variable
+bdd_substitute	Substitute for a set of variables
+bdd_reduce	Simplify given a constraint
+bdd_cofactor	Generalized cofactor
+bdd_depends_on	Determine if a BDD depends on a variable
+bdd_support	Find the support of a BDD
+bdd_satisfy	Find a satisfying assignment
+bdd_satisfy_support	Find a satisfying assignment
+bdd_satisfying_fraction	Fraction of valuations satisfying a BDD
+bdd_swap_vars	Swap two variables in a BDD
+bdd_apply2	Generic apply routine
+bdd_apply1	Generic apply routine
+bdd_size	Number of nodes in a BDD
+bdd_size_multiple	Number of nodes in multiple BDDs
+bdd_profile	Node profile of a BDD
+bdd_profile_multiple	Node profile of multiple BDDs
+bdd_function_profile	Function profile of a BDD
+bdd_function_profile_multiple	Function profile of multiple BDDs
+bdd_print_bdd	Print a BDD in human-readable form
+bdd_print_profile	Print a node profile of a BDD
+bdd_print_profile_multiple	Print a profile of multiple BDDs
+bdd_print_function_profile	Print a function profile of a BDD
+bdd_dump_bdd	Write a BDD to a file
+bdd_undump_bdd	Load a BDD from a file
+bdd_type	Classify a BDD
+bdd_free	Decrease the reference count of a BDD
+bdd_unfree	Increase the reference count of a BDD
+bdd_clear_refs	Set all BDD reference counts to zero
+bdd_gc	Garbage collect unused BDD nodes
+bdd_total_size	Total number of BDD nodes in use
+bdd_vars	Total number of variables in existence
+bdd_cache_ratio	Get/set operation result cache size
+bdd_node_limit	Get/set the number of BDD nodes allowed
+bdd_overflow	Get/clear overflow flag
+bdd_overflow_closure	Set a closure to invoke on overflow
+bdd_abort_closure	Used to abort operations in progress
+bdd_stats	Print statistics
+bdd_dynamic_reordering	Specify dynamic reordering technique
+bdd_reorder	Invoke dynamic reordering
+bdd_new_var_block	Create variable block
+bdd_var_block_reorderable	Set block reorderability
+mtbdd_free_terminal_closure	Called when freeing an MTBDD terminal
+mtbdd_get_terminal	Get an MTBDD terminal node
+mtbdd_terminal_value	Get the value of an MTBDD terminal node
+mtbdd_ite	IF-THEN-ELSE operation for MTBDDs
+mtbdd_equal	Equality operation for MTBDDs
+mtbdd_transform	Applies the current transform to an MTBDD
+mtbdd_transform_closure	Called to set the MTBDD transform
+mtbdd_one_data	Sets the MTBDD data value for TRUE
+.fi
+.SH "BASIC CONCEPTS"
+For a general overview of BDDs, see the original article by Bryant
+[1].
+
+Almost all of the BDD library routines require a BDD manager as one of
+their arguments.  A BDD manager is a structure which holds various
+variables used by the BDD routines.  The type
+.B bdd_manager
+is a pointer to this structure.  BDDs themselves are also represented
+internally as structures.  The type
+.B bdd
+is a pointer to one of these structures.
+
+There is a global ordering on the boolean variables which may appear
+in a BDD.  The variable at the root of a BDD is earlier in the
+ordering than all other variables in the BDD.  Each variable has an
+index which represents its position in the ordering;
+.I v1
+appears before
+.I v2
+in the ordering if and only if the index for
+.I v1
+is less than the ordering for \fIv2\fR.  Each variable is also
+assigned a unique ID number that is invariant.  Since variables can be
+created at any position within the order, this is not true for the
+index.  Also, the library supports dynamic variable reordering.  With
+dynamic variable reordering, variables may be shuffled around in the
+middle of an operation in order to reduce the number of BDD nodes in
+use.
+
+Some routines such as
+.B bdd_substitute
+require a mapping from variables to BDDs to operate.  This mapping is
+supplied in the form of a variable association which is a set of
+pairs.  The first element of each pair is the variable, and the second
+element is the BDD that the variable is associated with.  Multiple
+associations may exist at any one time.  Other routines such as
+.B bdd_exists
+require sets of variables.  Sets of variables are represented by
+variable associations where only the fact that a variable is
+associated with some BDD is significant.  There is one association,
+called the temporary variable association, which is special in two
+ways.  First, this association always exists.  Second, results are not
+cached across calls when this association is used.  The temporary
+association is intended for when an association will not be reused.
+The advantage of using it is that setting the temporary association
+does not require scanning the result cache to flush out-of-date
+results.
+
+The results returned by the library represent canonical forms and may
+be checked for equivalence using the standard C comparison operators.
+For example:
+
+.nf
+{
+  bdd_manager bddm;
+  bdd f;
+  ...
+  if (f == bdd_one(bddm))  /* Tautology check */
+    ...
+}
+.fi
+
+For checking for relations such as boolean implication, use
+.B bdd_intersects
+and \fBbdd_implies\fR.
+
+Multi-terminal BDDs are like BDDs, except an MTBDD may have more than
+just the constants TRUE and FALSE at the leaves.  Passing an MTBDD to
+a routine expecting a BDD will give undefined results, except where
+noted below.  MTBDDs are built up using
+.B mtbdd_get_terminal
+and \fBmtbdd_ite\fR.
+.SH "STORAGE MANAGEMENT"
+Each BDD node has an associated reference count which records the
+number of references to the BDD (internal and external).  Whenever a
+BDD is returned from a function, the reference count for its top node
+is incremented.  (If the BDD did not exist before, the reference count
+will be 1.)  Each time a garbage collection occurs, either internally
+or because of a call to \fBbdd_gc\fR, all nodes which are not
+referenced are reclaimed.  The reference count of a BDD may be
+decremented by calling \fBbdd_free\fR.  This should be done whenever
+possible for maximum space efficiency.  You may also specify a limit
+for the total number of BDD nodes using \fBbdd_node_limit\fR.  If it
+is not possible to complete an operation without exceeding this limit,
+the operation is aborted and (by default) a null pointer is returned.
+Whenever this happens, the reference counts of all nodes are restored
+to what they were before the operation.  If a null pointer is passed
+to a routine, the routine simply returns null.  Thus, it is not
+necessary to check for overflows after each operation.  There is also
+an internal flag that indicates whether any operation has caused an
+overflow.  It may be read and reset by \fBbdd_overflow\fR.
+Optionally, a user-defined closure may be invoked when an overflow
+occurs; see \fBbdd_overflow_closure\fR.  Also see \fBbdd_free\fR,
+\fBbdd_unfree\fR, \fBbdd_clear_refs\fR, \fBbdd_node_limit\fR and
+\fBbdd_gc\fR.  The library also includes high-performance replacements
+for
+.B malloc
+and \fBfree\fR.  See the discussion at the end of the section on
+adding new routines.
+.SH "DETAILED DESCRIPTION"
+.B bdd_manager
+.br
+.B bdd_init()
+.in +4
+Creates and initializes a new BDD manager.  Multiple BDD managers may
+exist at any time.
+.LP
+.B void
+.br
+.B bdd_quit(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Deallocates the BDD manager given by
+.B bddm
+and all the storage associated with it.
+.LP
+.B bdd
+.br
+.B bdd_new_var_first(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Creates a new variable at the start of the BDD variable ordering and
+returns the BDD for it.
+.LP
+.B bdd
+.br
+.B bdd_new_var_last(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Creates a new variable at the end of the BDD variable ordering and
+returns the BDD for it.
+.LP
+.B bdd
+.br
+.B bdd_new_var_before(bddm, var)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd var;
+.in +4
+Creates a new variable which is before
+.B var
+in the BDD variable ordering and returns the BDD for the new variable.
+.LP
+.B bdd
+.br
+.B bdd_new_var_after(bddm, var)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd var;
+.in +4
+Creates a new variable which is after
+.B var
+in the BDD variable ordering and returns the BDD for the new variable.
+.LP
+.B bdd
+.br
+.B bdd_var_with_index(bddm, i)
+.br
+.B bdd_manager bddm;
+.br
+.B long i;
+.in +4
+If a variable with index
+.B i
+has been created, returns the BDD for the variable.  If no such
+variable exists, returns null.  See also \fBbdd_if_index\fR.
+.LP
+.B bdd
+.br
+.B bdd_var_with_id(bddm, i)
+.br
+.B bdd_manager bddm;
+.br
+.B long i;
+.in +4
+If a variable with ID
+.B i
+has been created, returns the BDD for the variable.  If no such
+variable has been created, returns null.  See also \fBbdd_if_id\fR.
+.LP
+.B bdd
+.br
+.B bdd_one(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Returns the BDD for the constant TRUE.
+.LP
+.B bdd
+.br
+.B bdd_zero(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Returns the BDD for the constant FALSE.
+.LP
+.B bdd
+.br
+.B bdd_and(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical AND of
+.B f
+and \fBg\fR.
+.LP
+.B bdd
+.br
+.B bdd_nand(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical NAND of
+.B f
+and \fBg\fR.
+.LP
+.B bdd
+.br
+.B bdd_or(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical OR of
+.B f
+and \fBg\fR.
+.LP
+.B bdd
+.br
+.B bdd_nor(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical NOR of
+.B f
+and \fBg\fR.
+.LP
+.B bdd
+.br
+.B bdd_xor(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical XOR of
+.B f
+and \fBg\fR.
+.LP
+.B bdd
+.br
+.B bdd_xnor(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical XNOR of
+.B f
+and \fBg\fR.
+.LP
+.B bdd
+.br
+.B bdd_identity(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for \fBf\fR.  The only real effect of this function is
+to increase the reference count of \fBf\fR.  Also works with MTBDDs.
+.LP
+.B bdd
+.br
+.B bdd_not(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for the logical NOT of \fBf\fR.
+.LP
+.B bdd
+.br
+.B bdd_ite(bddm, f, g, h)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g, h;
+.in +4
+Returns the BDD for the logical operation IF
+.B f
+THEN
+.B g
+ELSE \fBh\fR.
+.LP
+.B bdd
+.br
+.B bdd_if(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for the variable which labels the root of the BDD
+given by \fBf\fR.  Also works with MTBDDs.  The result is undefined if
+.B f
+is one of the constants TRUE or FALSE or an MTBDD terminal node.
+.LP
+.B bdd
+.br
+.B bdd_then(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for the THEN branch of the root of the BDD given by
+\fBf\fR.  Also works with MTBDDs.  The result is undefined if
+.B f
+is one of the constants TRUE or FALSE or an MTBDD terminal node.
+.LP
+.B bdd
+.br
+.B bdd_else(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for the ELSE branch of the root of the BDD given by
+\fBf\fR.  Also works with MTBDDs.  The result is undefined if
+.B f
+is one of the constants TRUE or FALSE or an MTBDD terminal node.
+.LP
+.B long
+.br
+.B bdd_if_index(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the index of the variable which labels the root of the BDD
+given by \fBf\fR.  Also works with MTBDDs.  The result is undefined if
+.B f
+is one of the constants TRUE or FALSE or an MTBDD terminal node.  The
+variable at the start of variable ordering has index 0, the next has
+index 1, etc.  Note that creating new variables may change the index
+of existing variables.  Dynamic reordering may also change the index
+of variables.
+.LP
+.B long
+.br
+.B bdd_if_id(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns a unique ID number for the variable which labels the root of
+the BDD given by \fBf\fR.  Also works with MTBDDs.  The result is
+undefined if
+.B f
+is one of the constants TRUE or FALSE or an MTBDD terminal node.  The
+ID for a variable is fixed at the time the variable is created and
+never changes after that.
+.LP
+.B bdd
+.br
+.B bdd_intersects(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Computes a BDD that implies the conjunction of
+.B f
+and \fBg\fR.  If the conjunction is not FALSE, then the BDD returned
+will not be FALSE.  Also, the function tries to construct as few new
+nodes as possible.  This routine is intended for cases where you need
+to test for a FALSE conjunction, and, when it the conjunction is not
+FALSE, to obtain just one valuation satisfying both
+.B f
+and \fBg\fR.  A non-FALSE result from
+.B bdd_intersects
+can be passed directly to a routine like \fBbdd_satisfy_support\fR.
+.LP
+.B bdd
+.br
+.B bdd_implies(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+This is equivalent to calling
+.B bdd_intersects
+with
+.B f
+and NOT \fBg\fR.
+.LP
+.B int
+.br
+.B bdd_new_assoc(bddm, assoc, pairs)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *assoc;
+.br
+.B int pairs;
+.in +4
+Creates or finds a variable association.  The association is specified
+by
+.B assoc
+and should be a null-terminated array of BDDs.  If
+.B pairs
+is 0, the array is assumed to be an array of variables.  In this case,
+each variable is paired with the BDD for TRUE.  Such an association
+may essentially be viewed as specifying a set of variables for use
+with routines such as \fBbdd_exists\fR.  If
+.B pairs
+is nonzero, then the even numbered array elements should be variables
+and the odd numbered elements should be the BDDs which they are mapped
+to.  In both cases, the return value is an integer identifier for this
+association.  Note: if the given association is equivalent to one
+which already exists, the same identifier is used for both, and the
+reference count of the association is increased by one.
+.LP
+.B void
+.br
+.B bdd_free_assoc(bddm, id)
+.br
+.B bdd_manager bddm;
+.br
+.B int id;
+.in +4
+Decrements the reference count of the variable association with
+identifier \fBid\fR, and frees it if the reference count becomes zero.
+.LP
+.B void
+.br
+.B bdd_temp_assoc(bddm, assoc, pairs)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *assoc;
+.br
+.B int pairs;
+.in +4
+Sets the temporary variable association.  The arguments
+.B assoc
+and
+.B pairs
+are as in \fBbdd_new_assoc\fR.
+.LP
+.B void
+.br
+.B bdd_augment_temp_assoc(bddm, assoc, pairs)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *assoc;
+.br
+.B int pairs;
+.in +4
+Add to the temporary variable association.  The arguments
+.B assoc
+and
+.B pairs
+are as in \fBbdd_new_assoc\fR.  Any existing associations are
+overwritten.  This is mainly used when doing things like substituting
+for all variables in a BDD.  It isn't necessary to clear out the
+temporary association in such cases, so you can save a little time by
+using this routine.
+.LP
+.B int
+.br
+.B bdd_assoc(bddm, id)
+.br
+.B bdd_manager bddm;
+.br
+.B int id;
+.in +4
+Sets the current variable association to the one identified by
+\fBid\fR.  The identifier for the old current association is returned.
+The temporary variable association has identifier -1.
+.LP
+.B bdd
+.br
+.B bdd_exists(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for
+.B f
+with all the variables that are paired with something in the current
+variable association existentially quantified out.
+.LP
+.B bdd
+.br
+.B bdd_forall(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for
+.B f
+with all the variables that are paired with something in the current
+variable association universally quantified out.
+.LP
+.B bdd
+.br
+.B bdd_rel_prod(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns the BDD for the logical AND of
+.B f
+and
+.B g
+with all the variables that are paired with something in the current
+variable association existentially quantified out.  If
+.B f
+and
+.B g
+are viewed as boolean relations, this operation corresponds to
+relational product.  This routine is generally much more efficient
+than doing the operations separately.
+.LP
+.B bdd
+.br
+.B bdd_compose(bddm, f, g, h)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g, h;
+.in +4
+Returns the BDD for the substitution of
+.B h
+for the variable
+.B g
+in \fBf\fR.  When
+.B h
+does not depend on \fBg\fR, the operation may be viewed as composition
+of boolean functions.  If
+.B h
+does depend on \fBg\fR, it corresponds to instantaneous substitution
+in a boolean formula.
+.LP
+.B bdd
+.br
+.B bdd_substitute(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the BDD for
+.B f
+under a substitution defined by the current variable association.
+Each variable is replaced by its associated BDD.  The substitution is
+effectively simultaneous.
+.LP
+.B bdd
+.br
+.B bdd_reduce(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns a BDD which agrees with
+.B f
+for all valuations which satisfy \fBg\fR.  The result is usually
+smaller in terms of number of BDD nodes than \fBf\fR.  This operation
+is typically used in state space searches to simplify the
+representation for the set of states which will be expanded at each
+step.
+.LP
+.B bdd
+.br
+.B bdd_cofactor(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f, g;
+.in +4
+Returns a BDD for the generalized cofactor of
+.B f
+by \fBg\fR.  The BDD indicated by
+.B g
+should not be the constant FALSE.  For some properties of this
+operation, see Touati
+.I et al.
+[2].
+.LP
+.B int
+.br
+.B bdd_depends_on(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B bdd g;
+.in +4
+Returns 1 if the BDD or MTBDD
+.B f
+depends on the variable given by the BDD \fBg\fR, and returns 0
+otherwise.
+.LP
+.B void
+.br
+.B bdd_support(bddm, f, support)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B bdd *support;
+.in +4
+Stores the support of
+.B f
+as a null-terminated sequence of variables in \fBsupport\fR.  Works
+for MTBDDs also.
+.LP
+.B bdd
+.br
+.B bdd_satisfy(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns a BDD which is not false, implies \fBf\fR, and has at most one
+BDD node at each level.  The BDD indicated by
+.B f
+should not be the constant FALSE.
+.LP
+.B bdd
+.br
+.B bdd_satisfy_support(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns a BDD which is not false, implies \fBf\fR, has at most one
+BDD node at each level, and has a node labeled with each variable
+which is paired with something in the current variable association.
+If
+.B f
+is the constant FALSE, the result is undefined.
+.LP
+.B double
+.br
+.B bdd_satisfying_fraction(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns the fraction of valuations which satisfy \fBf\fR.  If
+.B f
+is a function of 
+.I n
+variables, then 2 to the power
+.I n
+times this fraction is the number of valuations which satisfy \fBf\fR.
+.LP
+.B bdd
+.br
+.B bdd_swap_vars(bddm, f, g, h)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B bdd g;
+.br
+.B bdd h;
+.in +4
+Returns the BDD for
+.B f
+with
+.B g
+substituted for
+.B h
+and
+.B h
+substituted for \fBg\fR.  The substitution is effectively
+simultaneous.
+.LP
+.B bdd
+.br
+.B bdd_apply2(bddm, terminal_fn, f, g, env)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd (*terminal_fn)();
+.br
+.B bdd f;
+.br
+.B bdd g;
+.br
+.B pointer env;
+.in +4
+This is a generic two-argument operation.  The behavior of the
+operation on terminal values is given by \fBterminal_fn\fR.  It should
+take as arguments: the BDD manager, pointers to two BDDs (the
+arguments for the call), and the pointer given by \fBenv\fR.  If the
+value of the call can be determined immediately from the arguments, it
+should return that value.  Otherwise, it should return a null pointer.
+In this case, it may also use the BDD pointers that it received to
+alter the arguments to the call.  A typical use for this ability is to
+put the arguments in a canonical order for commutative operations.
+The function should not alter the reference counts of either the
+arguments or the returned value.  Also, the returned value (if
+non-null) has its temporary reference count incremented once
+automatically.  If your function always returns one of the arguments
+or TRUE or FALSE, this is the right thing and you don't have to worry
+about it.  If you want to call other routines to determine the return
+value, you should read the section on adding new routines below.
+Works with MTBDDs.
+.LP
+.B bdd
+.br
+.B bdd_apply1(bddm, terminal_fn, f, env)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd (*terminal_fn)();
+.br
+.B bdd f;
+.br
+.B pointer env;
+.in +4
+This is a generic one-argument operation.  It is basically like
+\fBbdd_apply2\fR, except that
+.B terminal_fn
+takes a single BDD pointer argument instead of the pair of pointers in
+the two-argument case.  Works with MTBDDs.
+.LP
+.B long
+.br
+.B bdd_size(bddm, f, negout)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B int negout;
+.in +4
+Returns the number of nodes in \fBf\fR.  The parameter
+.B negout
+is a flag indicating whether negative output pointers should be
+considered.  The library uses this type of pointer flag internally,
+so if the flag is nonzero, the actual number of nodes used is
+returned.  If the flag is zero, the return value is the number of
+nodes which would be needed to represent
+.B f
+using a basic BDD.  Works for MTBDDs too.
+.LP
+.B long
+.br
+.B bdd_size_multiple(bddm, fs, negout)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *fs;
+.br
+.B int negout;
+.in +4
+Returns the number of nodes in the set of BDDs or MTBDDs given by
+\fBfs\fR, which should be a null-terminated array.  Nodes which are
+shared among the BDDs are only counted once.  The parameter
+.B negout
+is as in \fBbdd_size\fR.
+.LP
+.B void
+.br
+.B bdd_profile(bddm, f, level_counts, negout)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B long *level_counts;
+.br
+.B int negout;
+.in +4
+Returns the ``node profile'' of \fBf\fR, i.e., the number of nodes at
+each level in \fBf\fR.  The parameter
+.B level_counts
+should be an array of longs of size one plus the number of variables
+in existence (see \fBbdd_vars\fR).  On return, this array holds the
+profile; the \fIi\fRth entry is the number of nodes labeled with the
+variable of index \fIi\fR.  The last entry corresponds to the nodes
+for TRUE and FALSE.  The parameter
+.B negout
+is as in \fBbdd_size\fR.  Works for MTBDDs too; in this case, the
+last entry corresponds to the MTBDD terminal nodes.
+.LP
+.B void
+.br
+.B bdd_profile_multiple(bddm, fs, level_counts, negout)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd* fs;
+.br
+.B long *level_counts;
+.br
+.B int negout;
+.in +4
+Returns the ``node profile'' of the set of BDDs or MTBDDs given by
+\fBfs\fR, which should be a null-terminated array.  The parameters
+\fBlevel_counts\fR and
+.B negout
+are as in \fBbdd_profile\fR.
+.LP
+.B void
+.br
+.B bdd_function_profile(bddm, f, func_counts)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B long *func_counts;
+.in +4
+Returns the ``function profile'' of \fBf\fR, i.e., the number of
+functions at or below each level in \fBf\fR.  The parameter
+.B func_counts
+should be an array of longs of size one plus the number of variables
+in existence (see \fBbdd_vars\fR).  On return, this array holds the
+profile.  The \fIi\fRth entry corresponds to the number of functions
+which can be obtained by restricting those variables of index less
+than \fIi\fR, provided that
+.B f
+has at least one node labeled with the variable of index \fIi\fR.  If
+.B f
+has no nodes labeled with the variable of index \fIi\fR, then the
+\fIi\fRth entry of the profile is 0.  Works for MTBDDs also.
+.LP
+.B void
+.br
+.B bdd_function_profile_multiple(bddm, fs, func_counts)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *fs;
+.br
+.B long *func_counts;
+.in +4
+Returns the ``function profile'' of the set of BDDs or MTBDDs given by
+\fBfs\fR, which should be a null-terminated array.  The parameter
+.B func_counts
+is as in \fBbdd_function_profile\fR.
+.LP
+.B void
+.br
+.B bdd_print_bdd(bddm, f, naming_fn, terminal_id_fn, env, fp)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B char *(*naming_fn)();
+.br
+.B char *(*terminal_id_fn)();
+.br
+.B pointer env;
+.br
+.B FILE *fp;
+.in +4
+Prints a human-readable representation of the BDD or MTBDD
+.B f
+to the file given by \fBfp\fR.  The
+.B naming_fn
+should be a pointer to a function taking a \fBbdd_manager\fR, a
+.B bdd
+and the pointer given by \fBenv\fR.  This function should return
+either a null pointer or a string that is the name of the supplied
+variable.  If it returns a null pointer, a default name is generated
+based on the index of the variable.  It is also legal for
+.B naming_fn
+to be null; in this case, default names are generated for all variables.
+The macro
+.B bdd_naming_fn_none
+is a null pointer of suitable type.
+.B terminal_id_fn
+should be a pointer to a function taking a
+.B bdd_manager
+and two longs, plus the pointer given by \fBenv\fR.  It should
+return either a null pointer or a string representing the MTBDD
+terminal represented by the given value.  If it returns a null
+pointer, or if
+.B terminal_id_fn
+is null, then default names are generated for the terminals.
+The macro
+.B bdd_terminal_id_fn_none
+is a null pointer of suitable type.
+.LP
+.B void
+.br
+.B bdd_print_profile(bddm, f, naming_fn, env, width, fp)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B char *(*naming_fn)();
+.br
+.B pointer env;
+.br
+.B int width;
+.br
+.B FILE *fp;
+.in +4
+Prints a node profile of a BDD in histogram form.  The argument
+.B naming_fn
+should be as described in \fBbdd_print_bdd\fR.  The width of the
+output stream is specified by \fBwidth\fR.  This is used to determine
+how to scale the histogram.
+.LP
+.B void
+.br
+.B bdd_print_profile_multiple(bddm, fs, naming_fn, env, width, fp)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *fs;
+.br
+.B char *(*naming_fn)();
+.br
+.B pointer env;
+.br
+.B int width;
+.br
+.B FILE *fp;
+.in +4
+Prints a node profile of a set of BDDs, which should be given as a
+null-terminated array.  The other arguments are as in
+\fBbdd_print_profile\fR.
+.LP
+.B void
+.br
+.B bdd_print_function_profile(bddm, f, naming_fn, env, width, fp)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B char *(*naming_fn)();
+.br
+.B pointer env;
+.br
+.B int width;
+.br
+.B FILE *fp;
+.in +4
+Prints a function profile of a BDD in histogram form.  The arguments
+are the same as those to \fBbdd_print_profile\fR.
+.LP
+.B int
+.br
+.B bdd_dump_bdd(bddm, f, vars, fp)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B bdd *vars;
+.br
+.B FILE *fp;
+.in +4
+Writes an encoded description of the BDD or MTBDD
+.B f
+to the file given by \fBfp\fR.  The argument
+.B vars
+should be a null-terminated array of variables that include the
+support of \fBf\fR.  These variables need not be in order of
+increasing index.  The function returns a nonzero value if
+.B f
+was written to the file successfully.
+.LP
+.B bdd
+.br
+.B bdd_undump_bdd(bddm, vars, fp, error)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd *vars;
+.br
+.B FILE *fp;
+.br
+.B int *error;
+.in +4
+Loads an encoded description of a BDD or MTBDD from the file given by
+\fBfp\fR.  The argument
+.B vars
+should be a null-terminated array of variables that will become the
+support of the BDD.  As in \fBbdd_dump_bdd\fR, these need not be in
+order of increasing index.  If the same array of variables is used in
+dumping and undumping, the BDD returned will be equal to the one that
+was dumped.  More generally, if the array
+.B v1
+is used when dumping, and the array
+.B v2
+is used when undumping, the BDD returned will be equal to the original
+BDD with the \fIi\fRth variable in
+.B v2
+substituted for the \fIi\fRth variable in
+.B v1
+for all \fIi\fR.  Null is returned if the operation fails for some
+reason (node limit reached, I/O error, invalid file format, etc.).
+In this case, an error code is stored in \fBerror\fR.  The code will
+be one of the following.
+.nf
+.ta 3in
+\fIValue\fR	\fIMeaning\fR
+BDD_UNDUMP_FORMAT	Invalid file format
+BDD_UNDUMP_OVERFLOW	Node limit exceeded
+BDD_UNDUMP_IOERROR	File I/O error
+BDD_UNDUMP_EOF	Unexpected EOF
+.fi
+.LP
+.B int
+.br
+.B bdd_type(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Returns an integer classifying the BDD or MTBDD \fBf\fR.  The possible
+return values and their meanings are as follows.
+.nf
+.ta 3in
+\fIValue\fR	\fIMeaning\fR
+BDD_TYPE_OVERFLOW	\fBf\fR is a null pointer
+BDD_TYPE_ZERO	\fBf\fR is the constant FALSE
+BDD_TYPE_ONE	\fBf\fR is the constant TRUE
+BDD_TYPE_CONSTANT	\fBf\fR is an MTBDD constant
+BDD_TYPE_POSVAR	\fBf\fR is a variable
+BDD_TYPE_NEGVAR	\fBf\fR is the negation of a variable
+BDD_TYPE_NONTERMINAL	\fBf\fR is not one of the above
+.fi
+.LP
+.B void
+.br
+.B bdd_free(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Decreases the reference count of
+.B f
+by one.  When the reference count of a BDD or MTBDD node reaches 0,
+the node and any of its children that are not otherwise referenced may
+eventually be garbage collected and reused.  Intermediate results and
+unused BDDs and MTBDDs should be freed whenever possible.  For
+example:
+
+.nf
+bdd
+f_or_g_and_h(bddm, f, g, h)
+     bdd_manager bddm;
+     bdd f, g, h;
+{
+  bdd temp, result;
+  temp=bdd_and(bddm, g, h);
+  result=bdd_or(bddm, f, temp);
+  bdd_free(bddm, temp);    /* Free intermediate */
+  return (result);
+}
+.fi
+.LP
+.B void
+.br
+.B bdd_unfree(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Increases the reference count of
+.B f
+by one.  This is usually used in conjunction with
+\fBbdd_clear_refs\fR.  Works with MTBDDs.
+.LP
+.B void
+.br
+.B bdd_clear_refs(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Sets the reference counts of all BDD and MTBDD nodes (except for the
+node for TRUE/FALSE) to 0.  Calling this routine and then immediately
+calling
+.B bdd_unfree
+on a set of BDDs has the effect of disposing of all BDDs except those
+in the set.
+.LP
+.B void
+.br
+.B bdd_gc(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Forces a BDD garbage collection; all nodes not reachable from a node
+with a nonzero reference count are disposed of.  (Garbage collections
+also occur internally at various times.)
+.LP
+.B long
+.br
+.B bdd_total_size(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Returns the number of BDD and MTBDD nodes in existence (including
+those which are eligible for garbage collection).
+.LP
+.B long
+.br
+.B bdd_vars(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Returns the number of variables in existence.
+.LP
+.B int
+.br
+.B bdd_cache_ratio(bddm, ratio)
+.br
+.B bdd_manager bddm;
+.br
+.B int ratio;
+.in +4
+Sets the BDD operation cache size ratio to
+.B ratio
+and returns the old cache size ratio.  The number of cache entries is
+constrained to be (roughly) less than the cache size ratio divided by
+16 times the number of BDD nodes in existence.  The default size ratio
+is 4, which gives about 1 cache entry per 4 BDD nodes.  The amount of
+memory required per node will be about 17+(\fBratio\fR/16)*20 bytes on
+a machine with 32-bit words.
+.LP
+.B void
+.br
+.B bdd_node_limit(bddm, limit)
+.br
+.B bdd_manager bddm;
+.br
+.B long limit;
+.in +4
+Sets the number of allowed BDD nodes to
+.B limit
+and returns the old limit.  A value of 0 specifies no limit.  If in
+the course of an operation, the number of nodes reaches the limit, an
+internal garbage collection takes place.  If this does not free enough
+nodes to continue, the operation is aborted and a null value is
+returned.  When dynamic reordering is used to shift around large
+variable block, this limit may be exceeded during reordering.
+.LP
+.B int
+.br
+.B bdd_overflow(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Returns 1 if any operation has caused an overflow in the number of
+nodes, and 0 otherwise.  Calling this routine clears the internal
+overflow flag, so subsequent calls will return 0 until the next
+overflow occurs.
+.LP
+.B void
+.br
+.B bdd_overflow_closure(bddm, overflow_fn, overflow_env)
+.br
+.B bdd_manager bddm;
+.br
+.B void (*overflow_fn)();
+.br
+.B pointer overflow_env;
+.in +4
+Sets the closure to invoke when an overflow occurs.  The function
+given by
+.B overflow_fn
+will be invoked as the last stage in the cleanup after the overflow.
+The function is passed the BDD manager and the pointer given by
+\fBoverflow_env\fR.  Typically, the function will jump to a
+user-provided error recovery routine.
+.LP
+.B void
+.br
+.B bdd_abort_closure(bddm, abort_fn, abort_env)
+.br
+.B bdd_manager bddm;
+.br
+.B void (*abort_fn)();
+.br
+.B pointer abort_env;
+.in +4
+Sets a closure to invoke when the next node creation is attempted.
+All temporary results will be cleaned up just before the function
+given by
+.B abort_fn
+is called.  The function is passed the BDD manager and the pointer
+given by \fBabort_env\fR.  Typically, the function will jump to a
+user-provided error recovery routine.  This functionality is intended
+to be used to cleanly interrupt BDD operations.  Typically,
+.B bdd_abort_closure
+will be called within a signal handler.
+.LP
+.B void
+.br
+.B bdd_stats(bddm, fp)
+.br
+.B bdd_manager bddm;
+.br
+.B FILE *fp;
+.in +4
+Prints some statistics to the file given by \fBfp\fR.
+.LP
+.B void
+.br
+.B bdd_dynamic_reordering(bddm, reorder_fn)
+.br
+.B bdd_manager bddm;
+.br
+.B void (*reorder_fn)();
+.in +4
+Selects the method for dynamic reordering.  When dynamic reordering is
+being used, the library may attempt to rearrange the BDD variable
+ordering in the midst of an operation so as to reduce the number of
+nodes in use.  There are currently two available reordering methods.
+The first, \fBbdd_reorder_stable_window3\fR, permutes the variables
+within windows of three adjacent variables so as to minimize the
+overall BDD size.  This process is repeated until no more reduction in
+size occurs.  The second method, \fBbdd_reorder_sift\fR, moves each
+variable throughout the order to find an optimal position for that
+variable (assuming all other variables are fixed).  This generally
+achieves greater size reductions than the window-based method, but is
+slower.  The
+.B reorder_fn
+may also be
+.B bdd_reorder_none
+(an appropriately cast null pointer), in which case dynamic reordering
+is turned off.  Also see the discussion on variable blocks in
+\fBbdd_new_var_block\fR.
+.LP
+.B void
+.br
+.B bdd_reorder(bddm)
+.br
+.B bdd_manager bddm;
+.in +4
+Invoke the current dynamic reordering method.
+.LP
+.B block
+.br
+.B bdd_new_var_block(bddm, v, n)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd v;
+.br
+.B long n;
+.in +4
+Groups the variable
+.B v
+and the \fBn\fR-1 variables after it in the ordering into a single
+block for purposes of dynamic reordering.  The purpose of blocks is to
+provide control over the possible orders that dynamic reordering will
+consider.  In general, the variable blocks form a hierarchy.  For
+example, a block consisting of the variables with indexes 0 through 3
+might be made up of two sub-blocks, one for the variables with index 0
+and 1, and one for the variables with index 2 and 3.  When dynamic
+reordering is invoked, it is actually applied to each block within the
+hierarchy.  Reordering a block involves shuffling around the
+sub-blocks within it.  Thus, dynamic reordering actually moves groups
+of variables rather than single variables.  If you know that a group
+of variables should be together in the ordering, you should collect
+them together into a block.  As an example, in BDD-based sequential
+verification algorithms, the variables representing the current state
+and next state of a state-holding element should generally be adjacent
+in a good ordering.  By grouping these variables into a block, we can
+ensure that only orderings with this property are considered.  After a
+block has been reordered, each sub-block within it is recursively
+reordered as well.  You can also specify that certain blocks should
+not be reordered (see
+.B bdd_var_block_reorderable
+below).
+.LP
+.B void
+.br
+.B bdd_var_block_reorderable(bddm, b, reorderable)
+.br
+.B bdd_manager bddm;
+.br
+.B block b;
+.br
+.B int reorderable;
+.in +4
+If
+.B reorderable
+is non-zero, turns on reordering for the given block, otherwise turns
+it off.  By default, blocks are not reorderable.  As an example,
+suppose we are building the BDDs representing a circuit with distinct
+control and data path.  In such a case, we typically want to have the
+control variables at the top of the ordering.  For the data path, we
+probably want to have the variables for each bit slice grouped
+together, and we want the bit slices to be ordered from
+most-significant to least-significant.  However, we want to allow
+reordering within the control part and within each slice.  To do this,
+we create the variables in the following order: control variables
+first, down to LSB slice variables.  Then we create separate variable
+blocks for the control part and for each slice.  We then turn on
+reordering for these blocks.  Next, we create a block containing all
+of the variables, and we leave reordering off for this block.  When
+dynamic reordering is invoked, it will rearrange the control variables
+and the variables within each slice, but will not move the control
+variables or the slices in relation to each other.
+.LP
+.B void
+.br
+.B bdd_free_terminal_closure(bddm, free_terminal_fn, free_terminal_env)
+.br
+.B bdd_manager bddm;
+.br
+.B void (*free_terminal_fn)();
+.br
+.B pointer free_terminal_env;
+.in +4
+Sets a closure to invoke when freeing an MTBDD terminal node.  The
+function receives the BDD manager, two longs representing the value of
+the terminal, and the pointer given by \fBfree_terminal_env\fR.  If
+you using the terminal value to hold pointers to other data
+structures, you can set up this routine to free those structures.
+.LP
+.B bdd
+.br
+.B mtbdd_get_terminal(bddm, value1, value2)
+.br
+.B bdd_manager bddm;
+.br
+.B long value1;
+.br
+.B long value2;
+.in +4
+Creates an MTBDD terminal node corresponding to the value given by
+.B value1
+and \fBvalue2\fR.  If a terminal node with the value already exists,
+its reference count is increased.  See also
+\fBbdd_free_terminal_closure\fR.
+.LP
+.B void
+.br
+.B mtbdd_terminal_value(bddm, f, value1, value2)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B long *value1;
+.br
+.B long *value2;
+.in +4
+.B f
+should be an MTBDD terminal node.  The value of the node is stored in
+.B value1
+and \fBvalue2\fR.
+.LP
+.B bdd
+.br
+.B mtbdd_ite(bddm, f, g, h)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B bdd g;
+.br
+.B bdd h;
+.in +4
+.B f
+should be a BDD and
+.B g
+and
+.B h
+should be MTBDDs.  Returns the MTBDD for the operation IF
+.B f
+THEN
+.B g
+ELSE \fBh\fR.
+.LP
+.B bdd
+.br
+.B mtbdd_substitute(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Does the analog of
+.B bdd_substitute
+for the MTBDD \fBf\fR.  The elements in the variable association must
+be BDDs.
+.LP
+.B bdd
+.br
+.B mtbdd_equal(bddm, f, g)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.br
+.B bdd g;
+.in +4
+Returns the BDD which is true for those valuations on which the MTBDDs
+.B f
+and
+.B g
+are equal.  That is, this is the analog of a logical XNOR for MTBDDs.
+.LP
+.B bdd
+.br
+.B mtbdd_transform(bddm, f)
+.br
+.B bdd_manager bddm;
+.br
+.B bdd f;
+.in +4
+Conceptually applies the user-defined transform to all terminals of
+the specified MTBDD.  (This is actually done by just flipping the
+pointer flag, so this routine is really a macro for \fBbdd_not\fR.)
+See \fBmtbdd_transform_closure\fR.
+.LP
+.B void
+.br
+.B mtbdd_transform_closure(bddm, canonical_fn, transform_fn, env)
+.br
+.B bdd_manager bddm;
+.br
+.B int (*canonical_fn)();
+.br
+.B void (*transform_fn)();
+.br
+.B pointer env;
+.in +4
+Sets the MTBDD terminal transformation closure.  Currently in the
+library, the pointer representing a boolean function and the pointer
+representing the negation of that function are identical except for
+the low-order bit.  Complementing a function is done by simply
+toggling that bit.  The MTBDD terminal transformation allows this
+mechanism to be extended to MTBDDs.  Whenever a terminal is created,
+.B canonical_fn
+will be called.  It is passed the BDD manager, two longs representing
+the terminal being created, and the pointer given by \fBenv\fR.  The
+function should return zero if the value is already canonical, and a
+non-zero result if it needs to be transformed.  If the value needs to
+be transformed, then
+.B transform_fn
+will be called, with the BDD manager, two longs representing the value
+to be transformed, pointers to two longs to hold the result, and the
+pointer given by \fBenv\fR.  The actual terminal node that is created
+will contain the transformed value.  The original terminal requested
+will be represented by a pointer to this node, with the low-order bit
+of the pointer set.  Also see \fBmtbdd_one_data\fR.  If you are going
+to call this function, you should do it before creating any MTBDD
+terminals.
+.LP
+.B void
+.br
+.B mtbdd_one_data(bddm, value1, value2)
+.br
+.B bdd_manager bddm;
+.br
+.B long value1;
+.br
+.B long value2;
+.in +4
+If you are planning to use MTBDDs that contain TRUE and FALSE as well
+as other values, you may need to use this function to set the MTBDD
+value for the node representing TRUE.  In this case, also keep in mind
+that the when the transformation function is applied to this value, it
+should yield the value that you want for FALSE.  Also, the value for
+TRUE should be regarding as canonical, i.e., TRUE must be represented
+by a pointer with the low-order bit cleared.  As an example, suppose
+that we are planning to use MTBDDs to represent spectral transforms of
+boolean functions [4].  In this case, the MTBDD terminal values will
+conceptually be integers.  Further, it is convenient for TRUE to be
+represented by the value -1, and FALSE to be represented by +1.  We
+will represent terminal values using two longs, with the first long
+representing the most-significant part of the integer.  We will also
+assume a 2's complement representation, so TRUE should be represented
+by the data values -1 and -1.  Since the value for FALSE is the
+negation of that for TRUE, we will have our transform function
+represent integer negation.  Also, since we want the value for TRUE to
+be canonical, we will regard nonnegative values as canonical.  Thus,
+we define
+
+.nf
+int
+canonical_fn(bddm, value1, value2, env)
+     bdd_manager bddm;
+     long value1;
+     long value2;
+     pointer env;
+{
+  return (value1 > 0 || (!value1 && value2 > 0));
+}
+
+void
+transform_fn(bddm, value1, value2, result1, result2, env)
+     bdd_manager bddm;
+     long value1;
+     long value2;
+     long *result1;
+     long *result2;
+     pointer env;
+{
+  if (!value2)
+    /* Will be a carry when taking 2's complement of value2.  Thus, */
+    /* take 2's complement of high part. */
+    value1= -value1;
+  else
+    {
+      value2= -value2;
+      value1= ~value1;
+    }
+  *result1=value1;
+  *result2=value2;
+}
+.fi
+
+We then call
+.B mtbdd_transform_closure
+to register these functions, and use
+
+.nf
+bdd_one_data(bddm, -1l, -1l);
+.fi
+
+to set the value for TRUE to -1.  (The default canonical checking and
+transformation functions and the default MTBDD values for TRUE and
+FALSE are actually as given in this example.)  If you are going to
+call \fBbdd_one_data\fR, you should do it before creating any MTBDD
+terminals.
+.SH "ADDING NEW ROUTINES"
+If you want to add new routines to the library, you would be
+well-advised to look at some of the existing ones to get a feel for
+how they operate.  Good ones include \fBbdd_ite\fR (the basic logical
+operation) and \fBbdd_exists\fR (a routine using variable
+associations).  Some basic points are explained below.  To get the
+declarations of the internal library data structures and routines, you
+should
+.B #include <bddint.h>
+instead of using \fBbdduser.h\fR.  You will probably want to study
+this file to become familiar with the data structures.
+
+Pointers to BDD nodes and cache entries are tagged using the low three
+bits of the pointer.  Because of this, all structures must be aligned
+on eight byte boundaries.  The storage allocation routines guarantee
+this alignment.  The tag field of a tagged pointer is extracted with
+the
+.B TAG
+macro.  The
+.B POINTER
+macro masks off the tag to get the actual pointer.  If the pointer is
+a pointer to a BDD node, you can use
+.B BDD_POINTER
+instead; this just casts the result to a
+.B bdd
+after masking off the tag.  The tag can be set using \fBSET_TAG\fR, and
+individual tag bits can be manipulated with \fBTAG0\fR,
+.B FLIP_TAG0
+and \fBSET_TAG0\fR for tag bit 0, and the analogous macros for tag
+bits 1 and 2.  More commonly, slightly higher level macros are used
+for manipulating tags.  For BDD nodes, there is only one tag bit that
+is actually used.  When it is set, it indicates the pointer should be
+interpreted as representing the complement of the node that it points
+to.  (Or for MTBDDs, that it should be interpreted as transformed
+using the user-definable transformation function).  There are macros
+for testing, clearing, and flipping the negation flag.
+
+Before using the macros below on a pointer \fBf\fR, you need to use
+\fBBDD_SETUP(f)\fR.  This actually declares a new variable to hold the
+masked pointer \fBBDD_POINTER(f)\fR.  Hence, it needs to be placed at
+some point where a variable declaration could legally go.  If you
+change \fBf\fR, you can reset this internal variable using
+\fBBDD_RESET\fR.
+
+BDD pointers are generally manipulated using the following macros.
+Below, ``node'' refers to the node referenced by the pointer.
+.LP
+.B BDD_IS_CONST
+.in +4
+Tests if the node represents the constant TRUE or FALSE or an MTBDD
+terminal node.
+.LP
+.B BDD_INDEX
+.in +4
+Returns the index of the node, or
+.B BDD_MAX_INDEX
+if given a constant node.
+.LP
+.B BDD_INDEXINDEX
+.in +4
+Returns the index index of a node.  This field is the value returned
+by \fBbdd_if_id\fR and is invariant; when you create a new variable,
+the index of old nodes may change, but the index index stays the same.
+When you call \fBbdd_find\fR, you pass the desired index index of the
+new node, not the index.
+.LP
+.B BDD_NOT
+.in +4
+Flips the negation flag on a pointer.
+.LP
+.B BDD_THEN, BDD_ELSE
+.in +4
+Return the THEN and ELSE pointers of a node, taking proper account of
+pointer flags.  These are used for doing Shannon expansions on a node.
+.LP
+.B BDD_TOP_VAR2
+Takes a \fBbdd_manager\fR, a variable that can hold an index index,
+and two \fBbdd\fRs.  Sets the index index variable to the index index
+of the variable with the lowest index among the variables at the roots
+of the BDDs.  This index index can then be used with...
+.LP
+.B BDD_COFACTOR
+Takes an index index, a BDD, and two variables of type \fBbdd\fR, and
+sets the two variables either to the original BDD or to the cofactors
+of the original BDD with respect to its top variable, depending on
+whether the index index of the first BDD matches that specified.  You
+can do a Shannon expansion on the top variable of two BDDs by using
+.B BDD_TOP_VAR2
+to get the index index of the highest variable and then using
+.B BDD_COFACTOR
+to take the appropriate cofactors.
+.LP
+.B BDD_MARK
+.in +4
+Accesses the mark field of a node.  This expands to a l-value, so you
+can set the mark with this as well.  (But see BDD_TEMP_REFS below.)
+.LP
+.B BDD_ONE, BDD_ZERO
+.in +4
+Take a BDD manager and give back the BDDs for TRUE and FALSE.
+.LP
+.B BDD_REFS
+.in +4
+Accesses the reference count field of a node.
+.LP
+.B BDD_INCREFS, BDD_DECREFS
+.in +4
+Increment and decrement the reference count.
+.LP
+.B BDD_TEMP_REFS
+.in +4
+Accesses the temporary reference count field of a node.  The temporary
+reference count and the mark actually share storage, so you can't use
+both at once!  That is, unless you are very clever, you can't write a
+routine that builds temporary nodes and uses the marks.
+.LP
+.B BDD_TEMP_INCREFS, BDD_TEMP_DECREFS
+.in +4
+Increment and decrement the temporary reference count.
+.LP
+
+New BDD nodes are created using \fBbdd_find\fR.  This routine takes a
+BDD manager, an index index, and two subBDDs as arguments.  New MTBDD
+terminals can be created with \fBbdd_find_terminal\fR.  The result
+cache is manipulated using the
+.B bdd_lookup_in_cache
+and
+.B bdd_insert_in_cache
+routines.  There are different versions of these routines depending on
+exactly what is being cached.  The basic ones are
+\fBbdd_lookup_in_cache31\fR and \fBbdd_insert_in_cache31\fR.
+The first of these takes a cache entry type (CACHE_TYPE_ITE,
+CACHE_TYPE_TWO, etc.), three arguments of unspecified type (passed as
+longs), and a pointer to an unspecified type of result (a pointer to a
+long).  It returns a nonzero result if the lookup succeeds.  The
+corresponding insert routine is similar except that the result is
+passed in as a long, and nothing is returned.  There are similar
+functions that are for routines that take two arguments and return two
+results (or a single double-word result), or for routines that take
+one argument and return three results.  There are also macros such as
+\fBbdd_lookup_in_cache2\fR that are wrappers for things like
+two-argument functions, etc.  In general, some action must be taken
+when results are returned from the cache, when entries are purged from
+the cache, when entries are garbage collected, and when a variable
+association ID is reclaimed.  For the built-in cache entry types,
+these actions are done automatically.  For example, when a BDD is
+returned from an entry with CACHE_TYPE_TWO, the temporary reference
+count of the BDD is incremented.  Some of the entry types are
+available for customization.  The actions to take for these entry
+types are specified by calling \fBbdd_cache_functions\fR.  This
+function takes a BDD manager, an integer between 1 and 3 specifying
+the number of arguments you want to cache on, and four function
+pointers.  When returning a result, purging an entry, garbage
+collecting, or reclaiming an association ID, these functions are
+called.  The first three functions are passed the BDD manager and the
+entry.  (The tag bits will have already been masked off the entry
+pointer.)  The last receives these plus the association ID being freed
+(cast to a pointer).  The garbage collection function should return a
+nonzero result if the entry should be garbage collected.  If the entry
+contains some BDD nodes, they should be tested with \fBBDD_IS_USED\fR.
+The function called when an association ID is reclaimed should return
+a nonzero result if the entry should be flushed from the cache.  This
+function and the purge function and return functions may be null,
+specifying that no action need be taken.  \fBbdd_cache_functions\fR
+returns an integer that represents a tag to use with the cache
+insertion and lookup routines, or -1 if there are no more free tags
+available.  The routine \fBbdd_free_cache_tag\fR makes a tag available
+again.
+
+Routines that build new BDD nodes must take into account the
+possibility of running into the node limit.  The package is set up to
+make this easy if you use the following strategy.  Organize your
+routine as a top-level (user-callable) procedure and an internal
+procedure for performing the actual computation.  The top-level
+procedure should check its arguments before calling the internal
+routine.  The
+.B bdd_check_arguments
+function can be used to test for null arguments (indicating a prior
+overflow) or arguments with a zero reference count (indicating a bug).
+It should also use the
+.B FIREWALL
+macro to set up an overflow trap.  The internal routine should use
+temporary reference counts to keep track of the nodes it is using.
+When a node is returned from the internal routine, increment its
+temporary reference count once.  (You don't have to do this for the
+constants or for variables, since they can't be garbage collected.)
+When you pass a node to \fBbdd_find\fR, its temporary reference count
+is decremented once automatically, and its reference count is
+incremented.  Also, the result of \fBbdd_find\fR has its temporary
+reference count incremented once automatically.  Hence, if you your
+routine has the standard organization (Shannon's expansion followed by
+\fBbdd_find\fR on the subresults), you usually don't have to worry
+about incrementing or decrementing the reference counts yourself.  If
+you don't use a subresult, or if you want a subresult to stick around
+after calling \fBbdd_find\fR, you'll have to do the appropriate
+twiddling.  When the internal routine finally returns, you should have
+a BDD with a single temporary reference count.  Use
+.B RETURN_BDD
+to convert this temporary reference count to an external one and
+return the result to the user.  If you follow this strategy, you won't
+have to deal with overflow; when the node limit is reached,
+\fBbdd_find\fR will try garbage collecting, and if that doesn't work,
+will call the overflow trap set up by \fBFIREWALL\fR.  The overflow
+trap handler will automatically zero all temporary reference counts
+and return a null pointer to the user.  Note: if you want to call
+other routines, such as the IF-THEN-ELSE routine, within your internal
+procedure, you should call the internal procedure for the routine.
+That way, the overflow handler will give control back to the user
+if the routine you are calling causes an overflow.
+
+A typical routine looks like:
+
+.nf
+bdd
+foo_step(bddm, f, g)
+     bdd_manager bddm;
+     bdd f, g;
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+  
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (<terminal case>)
+    {
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (bdd_lookup_in_cache2(bddm, <op>, f, g, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=foo_step(bddm, f1, g1);
+  temp2=foo_step(bddm, f2, g2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache2(bddm, <op>, f, g, result);
+  return (result);
+}
+
+bdd
+foo(bddm, f, g)
+     bdd_manager bddm;
+     bdd f, g;
+{
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(foo_step(bddm, f, g));
+    }
+  return ((bdd)0);
+}
+.fi
+
+In the case of dynamic variable reordering, the same abort mechanism
+is used.  After reordering, all reference counts are reset to their
+original values and the operation is retried.  This is handled
+automatically by the FIREWALL macro.  (The operation is aborted since
+after reordering, the implicit ordering represented in the C
+subroutine call stack may be different from the new variable order.
+Reordering occurs before freeing the temporaries, since we want to
+minimize the aggregate size of the operands plus the result that is
+being constructed.)
+
+Storage can be allocated through a number of mechanisms.  The routines
+\fBmem_get_block\fR, \fBmem_free_block\fR, and \fBmem_resize_block\fR
+are generally used for large single items.  For smaller uniformly
+sized items, you probably should use a record manager.
+.B mem_new_rec_mgr
+will return a record manager that handles blocks of a given size.
+Use
+.B mem_new_rec
+and
+.B mem_free_rec
+to obtain and free individual records.  Finally,
+.B mem_free_rec_mgr
+will dispose of the record manager and all of its associated records.
+These routines are documented in more detail in the storage management
+library man page.  If your structures are at most 64 bytes in size,
+you can use the macros
+.B BDD_NEW_REC
+and \fBBDD_FREE_REC\fR.  These obtain records from the internal BDD
+record managers.
+.SH "PORTABILITY NOTES"
+Since pointer tagging is heavily used, you'll have major problems if
+you can't cast back and forth between pointers and longs without
+losing something.  The low-level storage management routines are
+fairly UNIX specific; they call
+.B sbrk
+directly.  If you don't have something similar, you may have to
+rewrite them.  The storage management routines also need to be able to
+move and clear blocks of memory whose size is given by a long.  You
+may have to fiddle with these, especially if you have a machine where
+int and long are different.  If you encounter portability problems,
+let me know; maybe the next release will be able to accommodate your
+machine.
+.SH "SEE ALSO"
+mem(3)
+.SH BUGS
+Surely you're joking.
+.SH REFERENCES
+[1] R. E. Bryant.  Graph Based Algorithms for Boolean Function
+Manipulation.  \fIIEEE Transactions on Computers\fR, C-35(8):677-691,
+August 1986.
+.LP
+[2] H. J. Touati, H. Savoj, B. Lin, R. K. Brayton, and A.
+Sangiovanni-Vincentelli.  Implicit State Enumeration of Finite State
+Machines using BDD's.  In \fIProceedings of the 1990 IEEE
+International Conference on Computer-Aided Design\fR, November, 1990.
+.LP
+[3] K. S. Brace, R. L. Rudell, and R. E. Bryant.  Efficient
+Implementation of a BDD Package.  In \fIProceedings of the 27th
+ACM/IEEE Design Automation Conference\fR, June, 1990.
+.LP
+[4] E. M. Clarke, K. L. McMillan, X. Zhao, M. Fujita, and J. C.-Y.
+Yang.  Spectral Transforms for Large Boolean Functions with
+Applications to Technology Mapping.  In \fIProceedings of the 30th
+ACM/IEEE Design Automation Conference\fR, June, 1993.
+.SH AUTHOR
+David E. Long
+.br
+long@research.att.com
Index: /vis_dev/glu-2.1/src/cmuBdd/bdd.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bdd.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bdd.c	(revision 6)
@@ -0,0 +1,1097 @@
+/* Basic BDD routines */
+
+
+#include "bddint.h"
+
+
+/* cmu_bdd_one(bddm) gives the BDD for true. */
+
+bdd
+cmu_bdd_one(cmu_bdd_manager bddm)
+{
+  return (BDD_ONE(bddm));
+}
+
+
+/* cmu_bdd_zero(bddm) gives the BDD for false. */
+
+bdd
+cmu_bdd_zero(cmu_bdd_manager bddm)
+{
+  return (BDD_ZERO(bddm));
+}
+
+
+bdd
+bdd_make_external(bdd f)
+{
+  BDD_SETUP(f);
+  BDD_INCREFS(f);
+  BDD_TEMP_DECREFS(f);
+  return (f);
+}
+
+
+long
+bdd_find_block(block b, long index)
+{
+  long i, j, k;
+
+  i=0;
+  j=b->num_children-1;
+  while (i <= j)
+    {
+      k=(i+j)/2;
+      if (b->children[k]->first_index <= index && b->children[k]->last_index >= index)
+	return (k);
+      if (b->children[k]->first_index > index)
+	j=k-1;
+      else
+	i=k+1;
+    }
+  return (i);
+}
+
+
+void
+bdd_block_delta(block b, long delta)
+{
+  long i;
+
+  b->first_index+=delta;
+  b->last_index+=delta;
+  for (i=0; i < b->num_children; ++i)
+    bdd_block_delta(b->children[i], delta);
+}
+
+
+static
+block
+shift_block(cmu_bdd_manager bddm, block b, long index)
+{
+  long i, j;
+  block p;
+
+  if (b->first_index >= index)
+    {
+      bdd_block_delta(b, 1l);
+      return (b);
+    }
+  if (b->last_index < index)
+    return (b);
+  b->last_index++;
+  i=bdd_find_block(b, index);
+  if (i == b->num_children || b->children[i]->first_index == index)
+    {
+      b->children=(block *)mem_resize_block((pointer)b->children, (SIZE_T)(sizeof(block)*(b->num_children+1)));
+      for (j=b->num_children-1; j >= i; --j)
+	b->children[j+1]=shift_block(bddm, b->children[j], index);
+      b->num_children++;
+      p=(block)BDD_NEW_REC(bddm, sizeof(struct block_));
+      p->reorderable=0;
+      p->first_index=index;
+      p->last_index=index;
+      p->num_children=0;
+      p->children=0;
+      b->children[i]=p;
+    }
+  else
+    while (i < b->num_children)
+      {
+	shift_block(bddm, b->children[i], index);
+	++i;
+      }
+  return (b);
+}
+
+
+/* bdd_new_var(bddm, index) creates a new variable with the */
+/* specified index.  Existing variables with greater or equal index */
+/* have their index incremented. */
+
+static
+bdd
+bdd_new_var(cmu_bdd_manager bddm, bdd_index_type index)
+{
+  long i;
+  long temp;
+  long oldmax;
+  assoc_list p;
+  bdd var;
+
+  if (bddm->vars == BDD_MAX_INDEXINDEX)
+    cmu_bdd_fatal("bdd_new_var: no more indexes");
+  if (index > bddm->vars)
+    cmu_bdd_fatal("bdd_new_var: index out of range");
+  if (bddm->vars == bddm->maxvars)
+    {
+      /* Expand indexing tables and variable associations. */
+      oldmax=bddm->maxvars;
+      temp=bddm->maxvars*2;
+      if (temp > BDD_MAX_INDEXINDEX-1)
+	temp=BDD_MAX_INDEXINDEX-1;
+      bddm->maxvars=temp;
+      bddm->variables=(bdd *)mem_resize_block((pointer)bddm->variables,
+					      (SIZE_T)((bddm->maxvars+1)*sizeof(bdd)));
+      bddm->indexes=(bdd_index_type *)mem_resize_block((pointer)bddm->indexes,
+						       (SIZE_T)((bddm->maxvars+1)*sizeof(bdd_index_type)));
+      bddm->indexindexes=
+	(bdd_indexindex_type *)mem_resize_block((pointer)bddm->indexindexes,
+						(SIZE_T)(bddm->maxvars*sizeof(bdd_indexindex_type)));
+      bddm->unique_table.tables=
+	(var_table *)mem_resize_block((pointer)bddm->unique_table.tables,
+				      (SIZE_T)((bddm->maxvars+1)*sizeof(var_table)));
+      /* Variable associations are padded with nulls in case new variables */
+      /* are created. */
+      for (p=bddm->assocs; p; p=p->next)
+	{
+	  p->va.assoc=(bdd *)mem_resize_block((pointer)p->va.assoc, (SIZE_T)((bddm->maxvars+1)*sizeof(bdd)));
+	  for (i=oldmax; i < bddm->maxvars; ++i)
+	    p->va.assoc[i+1]=0;
+	}
+      bddm->temp_assoc.assoc=(bdd *)mem_resize_block((pointer)bddm->temp_assoc.assoc, (SIZE_T)((bddm->maxvars+1)*sizeof(bdd)));
+      for (i=oldmax; i < bddm->maxvars; ++i)
+	bddm->temp_assoc.assoc[i+1]=0;
+    }
+  /* Shift index of following variables. */
+  if (index != bddm->vars)
+    for (i=0; i < bddm->vars; ++i)
+      if (bddm->indexes[i+1] >= index)
+	bddm->indexes[i+1]++;
+  for (p=bddm->assocs; p; p=p->next)
+    if (p->va.last >= index)
+      p->va.last++;
+  if (bddm->temp_assoc.last >= index)
+    bddm->temp_assoc.last++;
+  /* Shift indexindex values. */
+  for (i=bddm->vars; i > index; --i)
+    bddm->indexindexes[i]=bddm->indexindexes[i-1];
+  /* Make a new variable table. */
+  bddm->vars++;
+  bddm->unique_table.tables[bddm->vars]=bdd_new_var_table(bddm);
+  /* Create the variable. */
+  var=bdd_find_aux(bddm, (bdd_indexindex_type)bddm->vars, (INT_PTR)BDD_ONE(bddm), (INT_PTR)BDD_ZERO(bddm));
+  var->refs=BDD_MAX_REFS;
+  /* Record everything. */
+  bddm->variables[bddm->vars]=var;
+  bddm->indexes[bddm->vars]=index;
+  bddm->indexindexes[index]=bddm->vars;
+  /* Make a new variable block containing the variable. */
+  shift_block(bddm, bddm->super_block, (long)index);
+  return (var);
+}
+
+
+/* cmu_bdd_new_var_first(bddm) returns the BDD for a new variable at the */
+/* start of the variable order. */
+
+bdd
+cmu_bdd_new_var_first(cmu_bdd_manager bddm)
+{
+  return (bdd_new_var(bddm, (bdd_index_type)0));
+}
+
+
+/* cmu_bdd_new_var_last(bddm) returns the BDD for a new variable at the */
+/* end of the variable order. */
+
+bdd
+cmu_bdd_new_var_last(cmu_bdd_manager bddm)
+{
+  return (bdd_new_var(bddm, (bdd_index_type)bddm->vars));
+}
+
+
+/* cmu_bdd_new_var_before(bddm, var) returns the BDD for a new variable */
+/* before the specified one in the variable order. */
+
+bdd
+cmu_bdd_new_var_before(cmu_bdd_manager bddm, bdd var)
+{
+  if (bdd_check_arguments(1, var))
+    {
+      BDD_SETUP(var);
+      if (cmu_bdd_type_aux(bddm, var) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_new_var_before: argument is not a positive variable");
+	  if (BDD_IS_CONST(var))
+	    return (cmu_bdd_new_var_last(bddm));
+	}
+      return (bdd_new_var(bddm, BDD_INDEX(bddm, var)));
+    }
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_new_var_after(bddm, var) returns the BDD for a new variable */
+/* after the specified one in the variable order. */
+
+bdd
+cmu_bdd_new_var_after(cmu_bdd_manager bddm, bdd var)
+{
+  if (bdd_check_arguments(1, var))
+    {
+      BDD_SETUP(var);
+      if (cmu_bdd_type_aux(bddm, var) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_new_var_after: argument is not a positive variable");
+	  if (BDD_IS_CONST(var))
+	    return (cmu_bdd_new_var_last(bddm));
+	}
+      return (bdd_new_var(bddm, BDD_INDEX(bddm, var)+1));
+    }
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_var_with_index(bddm, index) returns the variable with the */
+/* specified index, or null if there is no such variable. */
+
+bdd
+cmu_bdd_var_with_index(cmu_bdd_manager bddm, long index)
+{
+  if (index < 0 || index >= bddm->vars)
+    return ((bdd)0);
+  return (bddm->variables[bddm->indexindexes[index]]);
+}
+
+
+/* cmu_bdd_var_with_id(bddm, id) returns the variable with the specified */
+/* id, or null if there is no such variable. */
+
+bdd
+cmu_bdd_var_with_id(cmu_bdd_manager bddm, long indexindex)
+{
+  if (indexindex <= 0 || indexindex > bddm->vars)
+    return ((bdd)0);
+  return (bddm->variables[indexindex]);
+}
+
+
+static
+bdd
+cmu_bdd_and_step(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (BDD_IS_CONST(f))
+    {
+      if (f == BDD_ZERO(bddm))
+	return (f);
+      BDD_TEMP_INCREFS(g);
+      return (g);
+    }
+  /* f is not constant. */
+  if (BDD_IS_CONST(g))
+    {
+      if (g == BDD_ZERO(bddm))
+	return (g);
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  /* f and g are not constant. */
+  if (BDD_SAME_OR_NEGATIONS(f, g))
+    {
+      if (f == g)
+	{
+	  BDD_TEMP_INCREFS(f);
+	  return (f);
+	}
+      return (BDD_ZERO(bddm));
+    }
+  /* f and g are not constant and are not equal or negations. */
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (bdd_lookup_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)BDD_ZERO(bddm), (INT_PTR *)&result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=cmu_bdd_and_step(bddm, f1, g1);
+  temp2=cmu_bdd_and_step(bddm, f2, g2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)BDD_ZERO(bddm), (INT_PTR)result);
+  return (result);
+}
+
+
+static
+bdd
+cmu_bdd_xnor_step(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  int outneg;
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (BDD_IS_CONST(f))
+    {
+      BDD_TEMP_INCREFS(g);
+      if (f == BDD_ONE(bddm))
+	return (g);
+      return (BDD_NOT(g));
+    }
+  if (BDD_IS_CONST(g))
+    {
+      BDD_TEMP_INCREFS(f);
+      if (g == BDD_ONE(bddm))
+	return (f);
+      return (BDD_NOT(f));
+    }
+  /* f and g are not constant. */
+  if (BDD_SAME_OR_NEGATIONS(f, g))
+    {
+      if (f == g)
+	return (BDD_ONE(bddm));
+      return (BDD_ZERO(bddm));
+    }
+  /* f and g are not constant, not same, not negations. */
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (BDD_IS_OUTPOS(g))
+    outneg=0;
+  else
+    {
+      outneg=1;
+      g=BDD_NOT(g);
+    }
+  /* g is an uncomplemented output pointer. */
+  if (bdd_lookup_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)BDD_NOT(g), (INT_PTR *)&result))
+    return (outneg ? BDD_NOT(result) : result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=cmu_bdd_xnor_step(bddm, f1, g1);
+  temp2=cmu_bdd_xnor_step(bddm, f2, g2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)BDD_NOT(g), (INT_PTR)result);
+  return (outneg ? BDD_NOT(result) : result);
+}
+
+
+bdd
+cmu_bdd_ite_step(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  int outneg;
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd h1, h2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  BDD_SETUP(h);
+  if (BDD_IS_CONST(f))
+    {
+      if (f == BDD_ONE(bddm))
+	{
+	  BDD_TEMP_INCREFS(g);
+	  return (g);
+	}
+      BDD_TEMP_INCREFS(h);
+      return (h);
+    }
+  /* f is not constant. */
+  if (BDD_SAME_OR_NEGATIONS(f, g))
+    {
+      if (f == g)
+	g=BDD_ONE(bddm);
+      else
+	g=BDD_ZERO(bddm);
+      BDD_RESET(g);
+    }
+  if (BDD_SAME_OR_NEGATIONS(f, h))
+    {
+      if (f == h)
+	h=BDD_ZERO(bddm);
+      else
+	h=BDD_ONE(bddm);
+      BDD_RESET(h);
+    }
+  if (BDD_IS_CONST(g))
+    {
+      if (BDD_IS_CONST(h))
+	{
+	  if (g == h)
+	    return (g);
+	  BDD_TEMP_INCREFS(f);
+	  if (g == BDD_ONE(bddm))
+	    return (f);
+	  return (BDD_NOT(f));
+	}
+      if (g == BDD_ZERO(bddm))
+	return (cmu_bdd_and_step(bddm, BDD_NOT(f), h));
+      return (BDD_NOT(cmu_bdd_and_step(bddm, BDD_NOT(f), BDD_NOT(h))));
+    }
+  else if (BDD_SAME_OR_NEGATIONS(g, h))
+    {
+      if (g == h)
+	{
+	  BDD_TEMP_INCREFS(g);
+	  return (g);
+	}
+      return (cmu_bdd_xnor_step(bddm, f, g));
+    }
+  else if (BDD_IS_CONST(h))
+    {
+    if (h == BDD_ZERO(bddm))
+      return (cmu_bdd_and_step(bddm, f, g));
+    else
+      return (BDD_NOT(cmu_bdd_and_step(bddm, f, BDD_NOT(g))));
+    }
+  /* No special cases; it's a real if-then-else. */
+  if (!BDD_IS_OUTPOS(f))
+    {
+      f=BDD_NOT(f);
+      BDD_SWAP(g, h);
+    }
+  /* f is now an uncomplemented output pointer. */
+  if (BDD_IS_OUTPOS(g))
+    outneg=0;
+  else
+    {
+      outneg=1;
+      g=BDD_NOT(g);
+      h=BDD_NOT(h);
+    }
+  /* g is now an uncomplemented output pointer. */
+  if (bdd_lookup_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)h, (INT_PTR *)&result))
+    return (outneg ? BDD_NOT(result) : result);
+  BDD_TOP_VAR3(top_indexindex, bddm, f, g, h);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  BDD_COFACTOR(top_indexindex, h, h1, h2);
+  temp1=cmu_bdd_ite_step(bddm, f1, g1, h1);
+  temp2=cmu_bdd_ite_step(bddm, f2, g2, h2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)h, (INT_PTR)result);
+  return (outneg ? BDD_NOT(result) : result);
+}
+
+
+/* cmu_bdd_ite(bddm, f, g, h) returns the BDD for "if f then g else h". */
+
+bdd
+cmu_bdd_ite(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  if (bdd_check_arguments(3, f, g, h))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_bdd_ite_step(bddm, f, g, h));
+    }
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_and(bddm, f, g) returns the BDD for "f and g". */
+
+bdd
+cmu_bdd_and(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  return (cmu_bdd_ite(bddm, f, g, BDD_ZERO(bddm)));
+}
+
+
+/* cmu_bdd_nand(bddm, f, g) returns the BDD for "f nand g". */
+
+bdd
+cmu_bdd_nand(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  bdd temp;
+
+  if ((temp=cmu_bdd_and(bddm, f, g)))
+    return (BDD_NOT(temp));
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_or(bddm, f, g) returns the BDD for "f or g". */
+
+bdd
+cmu_bdd_or(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  return (cmu_bdd_ite(bddm, f, BDD_ONE(bddm), g));
+}
+
+
+/* cmu_bdd_nor(bddm, f, g) returns the BDD for "f nor g". */
+
+bdd
+cmu_bdd_nor(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  bdd temp;
+
+  if ((temp=cmu_bdd_or(bddm, f, g)))
+    return (BDD_NOT(temp));
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_xor(bddm, f, g) returns the BDD for "f xor g". */
+
+bdd
+cmu_bdd_xor(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  return (cmu_bdd_ite(bddm, f, BDD_NOT(g), g));
+}
+
+
+/* cmu_bdd_xnor(bddm, f, g) returns the BDD for "f xnor g". */
+
+bdd
+cmu_bdd_xnor(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  bdd temp;
+
+  if ((temp=cmu_bdd_xor(bddm, f, g)))
+    return (BDD_NOT(temp));
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_identity(bddm, f) returns the BDD for f.  (The only effect is */
+/* to increase the reference count for f.) */
+
+bdd
+cmu_bdd_identity(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      BDD_INCREFS(f);
+    }
+  return (f);
+}
+
+
+/* cmu_bdd_not(bddm, f) returns the BDD for "not f". */
+
+bdd
+cmu_bdd_not(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      BDD_INCREFS(f);
+      return (BDD_NOT(f));
+    }
+  return ((bdd)0);
+}
+ 
+
+/* cmu_bdd_if(bddm, f) returns the BDD for the variable at the top of f. */
+
+bdd
+cmu_bdd_if(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      if (BDD_IS_CONST(f))
+	{
+	  cmu_bdd_warning("cmu_bdd_if: argument is a constant");
+	  return (f);
+	}
+      FIREWALL(bddm);
+      RETURN_BDD(BDD_IF(bddm, f));
+    }
+  return (f);
+}
+
+
+/* cmu_bdd_if_index(bddm, f) returns the index for the variable at the top */
+/* of f. */
+
+long
+cmu_bdd_if_index(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      if (BDD_IS_CONST(f))
+	return (-1l);
+      return ((long)BDD_INDEX(bddm, f));
+    }
+  return (-1l);
+}
+
+
+/* cmu_bdd_if_id(bddm, f) returns a unique identifier for the variable at */
+/* the top of f. */
+
+long
+cmu_bdd_if_id(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      if (BDD_IS_CONST(f))
+	return (-1l);
+      return ((long)BDD_INDEXINDEX(f));
+    }
+  return (-1l);
+}
+
+
+/* cmu_bdd_then(bddm, f) returns the BDD for the "then" pointer of f. */
+
+bdd
+cmu_bdd_then(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      if (BDD_IS_CONST(f))
+	{
+	  cmu_bdd_warning("cmu_bdd_then: argument is a constant");
+	  return (f);
+	}
+      f=BDD_THEN(f);
+      BDD_RESET(f);
+      BDD_INCREFS(f);
+    }
+  return (f);
+}
+ 
+
+/* cmu_bdd_else(bddm, f) returns the BDD for the "else" pointer of f. */
+
+bdd
+cmu_bdd_else(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      if (BDD_IS_CONST(f))
+	{
+	  cmu_bdd_warning("cmu_bdd_else: argument is a constant");
+	  return (f);
+	}
+      f=BDD_ELSE(f);
+      BDD_RESET(f);
+      BDD_INCREFS(f);
+    }
+  return (f);
+}
+
+
+static
+bdd
+cmu_bdd_intersects_step(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (BDD_IS_CONST(f))
+    {
+      if (f == BDD_ZERO(bddm))
+	return (f);
+      BDD_TEMP_INCREFS(g);
+      return (g);
+    }
+  /* f is not constant. */
+  if (BDD_IS_CONST(g))
+    {
+      if (g == BDD_ZERO(bddm))
+	return (g);
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  /* f and g are not constant. */
+  if (BDD_SAME_OR_NEGATIONS(f, g))
+    {
+      if (f == g)
+	{
+	  BDD_TEMP_INCREFS(f);
+	  return (f);
+	}
+      return (BDD_ZERO(bddm));
+    }
+  /* f and g are not constant and are not equal or negations. */
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (bdd_lookup_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)BDD_ZERO(bddm), (INT_PTR *)&temp))
+    return (temp);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp=cmu_bdd_intersects_step(bddm, f1, g1);
+  if (temp != BDD_ZERO(bddm))
+    return (bdd_find(bddm, top_indexindex, temp, BDD_ZERO(bddm)));
+  temp=bdd_find(bddm, top_indexindex, BDD_ZERO(bddm), cmu_bdd_intersects_step(bddm, f2, g2));
+  if (temp == BDD_ZERO(bddm))
+    bdd_insert_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)BDD_ZERO(bddm), (INT_PTR)temp);
+  return (temp);
+}
+
+
+/* cmu_bdd_intersects(bddm, f, g) returns a BDD contained in "f and g", */
+/* while building as few nodes as possible.  The idea is that it */
+/* gives us a fast test for intersection, and, when f and g do */
+/* intersect, we can call cmu_bdd_satisfy or cmu_bdd_satisfy_support on the */
+/* result to get a valuation in the intersection. */
+
+bdd
+cmu_bdd_intersects(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_bdd_intersects_step(bddm, f, g));
+    }
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_implies(bddm, f, g) is analogous to cmu_bdd_intersects, but it */
+/* looks for things in "f and not g". */
+
+bdd
+cmu_bdd_implies(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_bdd_intersects_step(bddm, f, BDD_NOT(g)));
+    }
+  return ((bdd)0);
+}
+
+
+int
+cmu_bdd_type_aux(cmu_bdd_manager bddm, bdd f)
+{
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f))
+    {
+      if (f == BDD_ZERO(bddm))
+	return (BDD_TYPE_ZERO);
+      if (f == BDD_ONE(bddm))
+	return (BDD_TYPE_ONE);
+      return (BDD_TYPE_CONSTANT);
+    }
+  if (BDD_THEN(f) == BDD_ONE(bddm) && BDD_ELSE(f) == BDD_ZERO(bddm))
+    return (BDD_TYPE_POSVAR);
+  if (BDD_THEN(f) == BDD_ZERO(bddm) && BDD_ELSE(f) == BDD_ONE(bddm))
+    return (BDD_TYPE_NEGVAR);
+  return (BDD_TYPE_NONTERMINAL);
+}
+
+
+/* cmu_bdd_type(bddm, f) returns BDD_TYPE_ZERO if f is false, BDD_TYPE_ONE */
+/* if f is true, BDD_TYPE_CONSTANT if f is an MTBDD constant, */
+/* BDD_TYPE_POSVAR is f is an unnegated variable, BDD_TYPE_NEGVAR if */
+/* f is a negated variable, BDD_TYPE_OVERFLOW if f is null, and */
+/* BDD_TYPE_NONTERMINAL otherwise. */
+
+int
+cmu_bdd_type(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    return (cmu_bdd_type_aux(bddm, f));
+  return (BDD_TYPE_OVERFLOW);
+}
+
+
+/* cmu_bdd_unfree(bddm, f) increments the reference count for f. */
+
+void
+cmu_bdd_unfree(cmu_bdd_manager bddm, bdd f)
+{
+  if (f)
+    {
+      BDD_SETUP(f);
+      BDD_INCREFS(f);
+    }
+}
+
+
+/* cmu_bdd_free(bddm, f) decrements the reference count for f. */
+
+void
+cmu_bdd_free(cmu_bdd_manager bddm, bdd f)
+{
+  if (f)
+    {
+      BDD_SETUP(f);
+      if (BDD_REFS(f) == 0)
+	cmu_bdd_fatal("cmu_bdd_free: attempt to free node with zero references");
+      else
+	BDD_DECREFS(f);
+    }
+}
+
+
+/* cmu_bdd_vars(bddm) returns the number of variables in existence. */
+
+long
+cmu_bdd_vars(cmu_bdd_manager bddm)
+{
+  return (bddm->vars);
+}
+
+
+/* cmu_bdd_total_size(bddm) returns the number of BDD nodes in existence. */
+
+long
+cmu_bdd_total_size(cmu_bdd_manager bddm)
+{
+  return (bddm->unique_table.entries);
+}
+
+
+/* cmu_bdd_cache_ratio(bddm, new_ratio) sets the cache size ratio to */
+/* new_ratio and returns the old ratio. */
+
+int
+cmu_bdd_cache_ratio(cmu_bdd_manager bddm, int new_ratio)
+{
+  int old_ratio;
+
+  old_ratio=bddm->op_cache.cache_ratio;
+  if (new_ratio < 1)
+    new_ratio=1;
+  else if (new_ratio > 32)
+    new_ratio=32;
+  bddm->op_cache.cache_ratio=new_ratio;
+  return (old_ratio);
+}
+
+
+/* cmu_bdd_node_limit(bddm, new_limit) sets the node limit to */
+/* new_limit and returns the old limit. */
+
+long
+cmu_bdd_node_limit(cmu_bdd_manager bddm, long new_limit)
+{
+  long old_limit;
+
+  old_limit=bddm->unique_table.node_limit;
+  if (new_limit < 0)
+    new_limit=0;
+  bddm->unique_table.node_limit=new_limit;
+  if (new_limit && bddm->unique_table.gc_limit > new_limit)
+    bddm->unique_table.gc_limit=new_limit;
+  return (old_limit);
+}
+
+
+/* cmu_bdd_overflow(bddm) returns 1 if the node limit has been exceeded */
+/* and 0 otherwise.  The overflow flag is cleared. */
+
+int
+cmu_bdd_overflow(cmu_bdd_manager bddm)
+{
+  int result;
+
+  result=bddm->overflow;
+  bddm->overflow=0;
+  return (result);
+}
+
+
+/* cmu_bdd_overflow_closure(bddm, overflow_fn, overflow_env) sets the */
+/* closure to be invoked on overflow.  If overflow_fn is null, it */
+/* indicates that no function should be called. */
+
+void
+cmu_bdd_overflow_closure(cmu_bdd_manager bddm, void (*overflow_fn)(cmu_bdd_manager, pointer), pointer overflow_env)
+{
+  bddm->overflow_fn=overflow_fn;
+  bddm->overflow_env=overflow_env;
+}
+
+
+/* cmu_bdd_abort_closure(bddm, abort_fn, abort_env) sets a closure to be */
+/* invoked when the next find operation is attempted.  This is */
+/* intended for aborting BDD operations from signal handlers.  The */
+/* handler should set this closure so that invoking it will cause */
+/* a longjmp to a recovery routine. */
+
+void
+cmu_bdd_abort_closure(cmu_bdd_manager bddm, void (*abort_fn)(cmu_bdd_manager, pointer), pointer abort_env)
+{
+  bddm->bag_it_fn=abort_fn;
+  bddm->bag_it_env=abort_env;
+}
+
+
+/* cmu_bdd_stats(bddm, fp) prints random statistics to the file indicated */
+/* by fp. */
+
+void
+cmu_bdd_stats(cmu_bdd_manager bddm, FILE *fp)
+{
+  long i;
+  long ue, ce, cs, mem;
+  SIZE_T alloc;
+  assoc_list q;
+
+  ue=bddm->unique_table.entries;
+  ce=bddm->op_cache.entries;
+  cs=bddm->op_cache.size;
+  mem=0;
+  for (i=0; i < bddm->vars; ++i)
+    {
+      mem+=sizeof(struct var_table_);
+      mem+=bddm->unique_table.tables[i]->size*sizeof(bdd);
+    }
+  mem=ue*sizeof(struct bdd_);
+  mem+=cs*sizeof(struct cache_bin_)+ce*sizeof(struct cache_entry_);
+  mem+=bddm->maxvars*(sizeof(bdd_index_type)+sizeof(bdd_indexindex_type)+sizeof(bdd)+sizeof(var_table));
+  for (q=bddm->assocs, i=1; q; q=q->next, ++i);
+  mem+=i*bddm->maxvars*sizeof(bdd);
+  if ((alloc=mem_allocation()))
+    /* mem_allocation may be meaningless depending on mem library. */
+    fprintf(fp, "Memory manager bytes allocated: %ld\n", (long)alloc);
+  fprintf(fp, "Approximate bytes used: %ld\n", mem);
+  fprintf(fp, "Number of nodes: %ld\n", ue);
+  if (bddm->unique_table.node_limit)
+    fprintf(fp, "Node limit: %ld\n", bddm->unique_table.node_limit);
+  else
+    fprintf(fp, "Node limit: ---\n");
+  fprintf(fp, "Overflow: %s\n", bddm->overflow ? "yes" : "no");
+  fprintf(fp, "Approximate bytes per node: %-.2f\n", ((double)mem)/ue);
+  fprintf(fp, "Cache entries: %ld\n", ce);
+  fprintf(fp, "Cache size: %ld\n", 2*cs);
+  fprintf(fp, "Cache load factor: %-.2f\n", ((double)ce)/(2*cs));
+  fprintf(fp, "Cache look ups: %ld\n", bddm->op_cache.lookups);
+  fprintf(fp, "Cache hits: %ld\n", bddm->op_cache.hits);
+  if (bddm->op_cache.lookups)
+    fprintf(fp, "Cache hit rate: %-.2f\n", ((double)(bddm->op_cache.hits))/bddm->op_cache.lookups);
+  else
+    fprintf(fp, "Cache hit rate: ---\n");
+  fprintf(fp, "Cache insertions: %ld\n", bddm->op_cache.inserts);
+  fprintf(fp, "Cache collisions: %ld\n", bddm->op_cache.collisions);
+  fprintf(fp, "Number of variables: %ld\n", bddm->vars);
+  fprintf(fp, "Number of variable associations: %ld\n", i);
+  fprintf(fp, "Number of garbage collections: %ld\n", bddm->unique_table.gcs);
+  fprintf(fp, "Number of nodes garbage collected: %ld\n", bddm->unique_table.freed);
+  fprintf(fp, "Number of find operations: %ld\n", bddm->unique_table.finds);
+}
+
+
+static
+int
+bdd_default_canonical_fn(cmu_bdd_manager bddm, INT_PTR value1, INT_PTR value2, pointer junk)
+{
+  /* Default transformation is treat the value as a 64-bit integer and to */
+  /* negate it if it is positive. */
+  return ((long)value1 > 0 || (!value1 && (long)value2 > 0));
+}
+
+
+static
+void
+bdd_default_transform_fn(cmu_bdd_manager bddm, INT_PTR value1, INT_PTR value2, INT_PTR *result1, INT_PTR *result2, pointer junk)
+{
+  if (!value2)
+    /* Will be a carry when taking 2's complement of value2.  Thus, */
+    /* take 2's complement of high part. */
+    value1= -(long)value1;
+  else
+    {
+      value2= -(long)value2;
+      value1= ~value1;
+    }
+  *result1=value1;
+  *result2=value2;
+}
+
+
+/* cmu_bdd_init() creates and returns a new BDD manager. */
+
+cmu_bdd_manager
+cmu_bdd_init(void)
+{
+  cmu_bdd_manager bddm;
+  long i;
+
+  bddm=(cmu_bdd_manager)mem_get_block((SIZE_T)sizeof(struct bdd_manager_));
+  bddm->overflow=0;
+  bddm->overflow_fn=0;
+  bddm->overflow_env=0;
+  bddm->bag_it_fn=0;
+  bddm->bag_it_env=0;
+  bddm->canonical_fn=bdd_default_canonical_fn;
+  bddm->transform_fn=bdd_default_transform_fn;
+  bddm->transform_env=0;
+  bddm->reorder_fn=0;
+  bddm->reorder_data=0;
+  bddm->vars=0;
+  bddm->maxvars=30; 
+  bddm->check=1;
+  bddm->variables=(bdd *)mem_get_block((SIZE_T)((bddm->maxvars+1)*sizeof(bdd)));
+  bddm->indexes=(bdd_index_type *)mem_get_block((SIZE_T)((bddm->maxvars+1)*sizeof(bdd_index_type)));
+  bddm->indexindexes=(bdd_indexindex_type *)mem_get_block((SIZE_T)(bddm->maxvars*sizeof(bdd_indexindex_type)));
+  bddm->indexes[BDD_CONST_INDEXINDEX]=BDD_MAX_INDEX;
+  for (i=0; i < REC_MGRS; ++i)
+    bddm->rms[i]=mem_new_rec_mgr(MIN_REC_SIZE+ALLOC_ALIGNMENT*i);
+  bddm->temp_assoc.assoc=(bdd *)mem_get_block((SIZE_T)((bddm->maxvars+1)*sizeof(bdd)));
+  bddm->temp_assoc.last= -1;
+  for (i=0; i < bddm->maxvars; ++i)
+    bddm->temp_assoc.assoc[i+1]=0;
+  bddm->curr_assoc_id= -1;
+  bddm->curr_assoc= &bddm->temp_assoc;
+  bddm->assocs=0;
+  bddm->temp_op= -1;
+  bddm->super_block=(block)BDD_NEW_REC(bddm, sizeof(struct block_));
+  bddm->super_block->num_children=0;
+  bddm->super_block->children=0;
+  bddm->super_block->reorderable=1;
+  bddm->super_block->first_index= -1;
+  bddm->super_block->last_index=0;
+  cmu_bdd_init_unique(bddm);
+  cmu_bdd_init_cache(bddm);
+  bddm->one=bdd_find_terminal(bddm, ~(INT_PTR)0, ~(INT_PTR)0);
+  bddm->one->refs=BDD_MAX_REFS;
+  bddm->one->mark=0;
+  bddm->zero=BDD_NOT(bddm->one);
+  if (sizeof(double) > 2*sizeof(long))
+    cmu_bdd_warning("cmu_bdd_init: portability problem for cmu_bdd_satisfying_fraction");
+  return (bddm);
+}
+
+
+/* cmu_bdd_quit(bddm) frees all storage associated with the BDD manager */
+/* bddm. */
+
+void
+cmu_bdd_quit(cmu_bdd_manager bddm)
+{
+  int i;
+  assoc_list p, q;
+
+  cmu_bdd_free_unique(bddm);
+  cmu_bdd_free_cache(bddm);
+  mem_free_block((pointer)bddm->variables);
+  mem_free_block((pointer)bddm->indexes);
+  mem_free_block((pointer)bddm->indexindexes);
+  mem_free_block((pointer)bddm->temp_assoc.assoc);
+  for (p=bddm->assocs; p; p=q)
+    {
+      q=p->next;
+      mem_free_block((pointer)p->va.assoc);
+      BDD_FREE_REC(bddm, (pointer)p, sizeof(struct assoc_list_));
+    }
+  BDD_FREE_REC(bddm, (pointer)bddm->super_block, sizeof(struct block_));
+  for (i=0; i < REC_MGRS; ++i)
+    mem_free_rec_mgr(bddm->rms[i]);
+  mem_free_block((pointer)bddm);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bdd_is_cube.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bdd_is_cube.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bdd_is_cube.c	(revision 6)
@@ -0,0 +1,31 @@
+#include "bddint.h"
+/*
+ * Recursively determine if f is a cube. f is a cube if there is a single
+ * path to the constant one.
+ */
+int
+cmu_bdd_is_cube(struct bdd_manager_ *manager, struct bdd_ *f)
+{
+  struct bdd_ *f0, *f1;
+
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f)){
+    if (f == BDD_ZERO(manager)){
+      cmu_bdd_fatal("cmu_bdd_is_cube called with 0");
+    }
+    else return 1;
+  }
+  BDD_COFACTOR(BDD_INDEXINDEX(f), f, f1, f0);
+  
+  /*
+   * Exactly one branch of f must point to ZERO to be a cube.
+   */
+  if (f1 == BDD_ZERO(manager)) {
+	return (cmu_bdd_is_cube(manager, f0));
+  } else if (f0 == BDD_ZERO(manager)) {
+	return (cmu_bdd_is_cube(manager, f1));
+  } else { /* not a cube, because neither branch is zero */
+	return 0;
+  }
+}
+
Index: /vis_dev/glu-2.1/src/cmuBdd/bddapply.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddapply.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddapply.c	(revision 6)
@@ -0,0 +1,98 @@
+/* BDD generic apply routines */
+
+
+#include "bddint.h"
+
+
+static
+bdd
+bdd_apply2_step(cmu_bdd_manager bddm,
+		bdd (*terminal_fn)(cmu_bdd_manager, bdd *, bdd *, pointer),
+		long op,
+		bdd f,
+		bdd g,
+		pointer env)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+
+  if ((result=(*terminal_fn)(bddm, &f, &g, env)))
+    {
+      BDD_SETUP(result);
+      BDD_TEMP_INCREFS(result);
+      return (result);
+    }
+  if (bdd_lookup_in_cache2(bddm, op, f, g, &result))
+    return (result);
+  {
+    BDD_SETUP(f);
+    BDD_SETUP(g);
+    BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+    BDD_COFACTOR(top_indexindex, f, f1, f2);
+    BDD_COFACTOR(top_indexindex, g, g1, g2);
+    temp1=bdd_apply2_step(bddm, terminal_fn, op, f1, g1, env);
+    temp2=bdd_apply2_step(bddm, terminal_fn, op, f2, g2, env);
+    result=bdd_find(bddm, top_indexindex, temp1, temp2);
+    bdd_insert_in_cache2(bddm, op, f, g, result);
+    return (result);
+  }
+}
+
+
+bdd
+bdd_apply2(cmu_bdd_manager bddm, bdd (*terminal_fn)(cmu_bdd_manager, bdd *, bdd *, pointer), bdd f, bdd g, pointer env)
+{
+  long op;
+
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      op=bddm->temp_op--;
+      RETURN_BDD(bdd_apply2_step(bddm, terminal_fn, op, f, g, env));
+    }
+  return ((bdd)0);
+}
+
+
+static
+bdd
+bdd_apply1_step(cmu_bdd_manager bddm, bdd (*terminal_fn)(cmu_bdd_manager, bdd *, pointer), long op, bdd f, pointer env)
+{
+  bdd temp1, temp2;
+  bdd result;
+
+  if ((result=(*terminal_fn)(bddm, &f, env)))
+    {
+      BDD_SETUP(result);
+      BDD_TEMP_INCREFS(result);
+      return (result);
+    }
+  if (bdd_lookup_in_cache1(bddm, op, f, &result))
+    return (result);
+  {
+    BDD_SETUP(f);
+    temp1=bdd_apply1_step(bddm, terminal_fn, op, BDD_THEN(f), env);
+    temp2=bdd_apply1_step(bddm, terminal_fn, op, BDD_ELSE(f), env);
+    result=bdd_find(bddm, BDD_INDEXINDEX(f), temp1, temp2);
+    bdd_insert_in_cache1(bddm, op, f, result);
+    return (result);
+  }
+}
+
+
+bdd
+bdd_apply1(cmu_bdd_manager bddm, bdd (*terminal_fn)(cmu_bdd_manager, bdd *, pointer), bdd f, pointer env)
+{
+  long op;
+
+  if (bdd_check_arguments(1, f))
+    {
+      FIREWALL(bddm);
+      op=bddm->temp_op--;
+      RETURN_BDD(bdd_apply1_step(bddm, terminal_fn, op, f, env));
+    }
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddassoc.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddassoc.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddassoc.c	(revision 6)
@@ -0,0 +1,273 @@
+/* BDD variable association routines */
+
+
+#include "bddint.h"
+
+
+static
+int
+cmu_bdd_assoc_eq(cmu_bdd_manager bddm, bdd *p, bdd *q)
+{
+  bdd_indexindex_type i;
+
+  for (i=0; i < bddm->maxvars; ++i)
+    if (p[i+1] != q[i+1])
+      return (0);
+  return (1);
+}
+
+
+static
+int
+check_assoc(cmu_bdd_manager bddm, bdd *assoc_info, int pairs)
+{
+  bdd_check_array(assoc_info);
+  if (pairs)
+    while (assoc_info[0] && assoc_info[1])
+      {
+	if (cmu_bdd_type_aux(bddm, assoc_info[0]) != BDD_TYPE_POSVAR)
+	  {
+	    cmu_bdd_warning("check_assoc: first element in pair is not a positive variable");
+	    return (0);
+	  }
+	assoc_info+=2;
+      }
+  return (1);
+}
+
+  
+/* cmu_bdd_new_assoc(bddm, assoc_info, pairs) creates or finds a variable */
+/* association given by assoc_info.  pairs is 0 if the information */
+/* represents only a list of variables rather than a full association. */
+
+int
+cmu_bdd_new_assoc(cmu_bdd_manager bddm, bdd *assoc_info, int pairs)
+{
+  long i;
+  assoc_list p, *q;
+  bdd f;
+  bdd *assoc;
+  bdd_indexindex_type j;
+  long last;
+
+  if (!check_assoc(bddm, assoc_info, pairs))
+    return (-1);
+  assoc=(bdd *)mem_get_block((SIZE_T)((bddm->maxvars+1)*sizeof(bdd)));
+  /* Unpack the association. */
+  for (i=0; i < bddm->maxvars; ++i)
+    assoc[i+1]=0;
+  if (pairs)
+    for (i=0; (f=assoc_info[i]) && assoc_info[i+1]; i+=2)
+      {
+	BDD_SETUP(f);
+	assoc[BDD_INDEXINDEX(f)]=assoc_info[i+1];
+      }
+  else
+    for (i=0; (f=assoc_info[i]); ++i)
+      {
+	BDD_SETUP(f);
+	assoc[BDD_INDEXINDEX(f)]=BDD_ONE(bddm);
+      }
+  /* Check for existence. */
+  for (p=bddm->assocs; p; p=p->next)
+    if (cmu_bdd_assoc_eq(bddm, p->va.assoc, assoc))
+      {
+	mem_free_block((pointer)assoc);
+	p->refs++;
+	return (p->id);
+      }
+  /* Find the first unused id. */
+  for (q= &bddm->assocs, p= *q, i=0; p && p->id == i; q= &p->next, p= *q, ++i);
+  p=(assoc_list)BDD_NEW_REC(bddm, sizeof(struct assoc_list_));
+  p->id=i;
+  p->next= *q;
+  *q=p;
+  p->va.assoc=assoc;
+  last= -1;
+  if (pairs)
+    for (i=0; (f=assoc_info[i]) && assoc_info[i+1]; i+=2)
+      {
+	BDD_SETUP(f);
+	j=BDD_INDEXINDEX(f);
+	if ((long)bddm->indexes[j] > last)
+	  last=bddm->indexes[j];
+      }
+  else
+    for (i=0; (f=assoc_info[i]); ++i)
+      {
+	BDD_SETUP(f);
+	j=BDD_INDEXINDEX(f);
+	if ((long)bddm->indexes[j] > last)
+	  last=bddm->indexes[j];
+      }
+  p->va.last=last;
+  p->refs=1;
+  /* Protect BDDs in the association. */
+  if (pairs)
+    for (i=0; assoc_info[i] && (f=assoc_info[i+1]); i+=2)
+      {
+	BDD_SETUP(f);
+	BDD_INCREFS(f);
+      }
+  return (p->id);
+}
+
+
+static
+int
+bdd_flush_id_entries(cmu_bdd_manager bddm, cache_entry p, pointer closure)
+{
+  int (*flush_fn)(cmu_bdd_manager, cache_entry, pointer);
+
+  flush_fn=bddm->op_cache.flush_fn[TAG(p)];
+  if (flush_fn)
+    return ((*flush_fn)(bddm, CACHE_POINTER(p), closure));
+  return (0);
+}
+
+
+/* cmu_bdd_free_assoc(bddm, id) deletes the variable association given by */
+/* id. */
+
+void
+cmu_bdd_free_assoc(cmu_bdd_manager bddm, int assoc_id)
+{
+  bdd_indexindex_type i;
+  bdd f;
+  assoc_list p, *q;
+
+  if (bddm->curr_assoc_id == assoc_id)
+    {
+      bddm->curr_assoc_id= -1;
+      bddm->curr_assoc= &bddm->temp_assoc;
+    }
+  for (q= &bddm->assocs, p= *q; p; q= &p->next, p= *q)
+    if (p->id == assoc_id)
+      {
+	p->refs--;
+	if (!p->refs)
+	  {
+	    /* Unprotect the BDDs in the association. */
+	    for (i=0; i < bddm->vars; ++i)
+	      if ((f=p->va.assoc[i+1]))
+		{
+		  BDD_SETUP(f);
+		  BDD_DECREFS(f);
+		}
+	    /* Flush old cache entries. */
+	    bdd_flush_cache(bddm, bdd_flush_id_entries, (pointer)((long)assoc_id));
+	    *q=p->next;
+	    mem_free_block((pointer)(p->va.assoc));
+	    BDD_FREE_REC(bddm, (pointer)p, sizeof(struct assoc_list_));
+	  }
+	return;
+      }
+  cmu_bdd_warning("cmu_bdd_free_assoc: no variable association with specified ID");
+}
+
+
+/* cmu_bdd_augment_temp_assoc(bddm, assoc_info, pairs) adds to the temporary */
+/* variable association as specified by assoc_info.  pairs is 0 if the */
+/* information represents only a list of variables rather than a full */
+/* association. */
+
+void
+cmu_bdd_augment_temp_assoc(cmu_bdd_manager bddm, bdd *assoc_info, int pairs)
+{
+  long i;
+  bdd_indexindex_type j;
+  bdd f;
+  long last;
+
+  if (check_assoc(bddm, assoc_info, pairs))
+    {
+      last=bddm->temp_assoc.last;
+      if (pairs)
+	for (i=0; (f=assoc_info[i]) && assoc_info[i+1]; i+=2)
+	  {
+	    BDD_SETUP(f);
+	    j=BDD_INDEXINDEX(f);
+	    if ((long)bddm->indexes[j] > last)
+	      last=bddm->indexes[j];
+	    if ((f=bddm->temp_assoc.assoc[j]))
+	      {
+		BDD_SETUP(f);
+		BDD_DECREFS(f);
+	      }
+	    f=assoc_info[i+1];
+	    BDD_RESET(f);
+	    bddm->temp_assoc.assoc[j]=f;
+	    /* Protect BDDs in the association. */
+	    BDD_INCREFS(f);
+	  }
+      else
+	for (i=0; (f=assoc_info[i]); ++i)
+	  {
+	    BDD_SETUP(f);
+	    j=BDD_INDEXINDEX(f);
+	    if ((long)bddm->indexes[j] > last)
+	      last=bddm->indexes[j];
+	    if ((f=bddm->temp_assoc.assoc[j]))
+	      {
+		BDD_SETUP(f);
+		BDD_DECREFS(f);
+	      }
+	    bddm->temp_assoc.assoc[j]=BDD_ONE(bddm);
+	  }
+      bddm->temp_assoc.last=last;
+    }
+}
+
+
+/* cmu_bdd_temp_assoc(bddm, assoc_info, pairs) sets the temporary variable */
+/* association as specified by assoc_info.  pairs is 0 if the */
+/* information represents only a list of variables rather than a full */
+/* association. */
+
+void
+cmu_bdd_temp_assoc(cmu_bdd_manager bddm, bdd *assoc_info, int pairs)
+{
+  long i;
+  bdd f;
+
+  /* Clean up old temporary association. */
+  for (i=0; i < bddm->vars; ++i)
+    {
+      if ((f=bddm->temp_assoc.assoc[i+1]))
+	{
+	  BDD_SETUP(f);
+	  BDD_DECREFS(f);
+	}
+      bddm->temp_assoc.assoc[i+1]=0;
+    }
+  bddm->temp_assoc.last= -1;
+  cmu_bdd_augment_temp_assoc(bddm, assoc_info, pairs);
+}
+
+
+/* cmu_bdd_assoc(bddm, id) sets the current variable association to the */
+/* one given by id and returns the ID of the old association.  An */
+/* id of -1 indicates the temporary association. */
+
+int
+cmu_bdd_assoc(cmu_bdd_manager bddm, int assoc_id)
+{
+  int old_assoc;
+  assoc_list p;
+
+  old_assoc=bddm->curr_assoc_id;
+  if (assoc_id != -1)
+    {
+      for (p=bddm->assocs; p; p=p->next)
+	if (p->id == assoc_id)
+	  {
+	    bddm->curr_assoc_id=p->id;
+	    bddm->curr_assoc= &p->va;
+	    return (old_assoc);
+	  }
+      cmu_bdd_warning("cmu_bdd_assoc: no variable association with specified ID");
+    }
+  bddm->curr_assoc_id= -1;
+  bddm->curr_assoc= &bddm->temp_assoc;
+  return (old_assoc);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddblk.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddblk.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddblk.c	(revision 6)
@@ -0,0 +1,82 @@
+/* BDD variable block routines */
+
+
+#include "bddint.h"
+
+
+static
+void
+add_block(block b1, block b2)
+{
+  long i, j, k;
+  block start, end;
+
+  if (b1->num_children)
+    {
+      i=bdd_find_block(b1, b2->first_index);
+      start=b1->children[i];
+      j=bdd_find_block(b1, b2->last_index);
+      end=b1->children[j];
+      if (i == j)
+	add_block(start, b2);
+      else
+	{
+	  if (start->first_index != b2->first_index || end->last_index != b2->last_index)
+	    cmu_bdd_fatal("add_block: illegal block overlap");
+	  b2->num_children=j-i+1;
+	  b2->children=(block *)mem_get_block((SIZE_T)(sizeof(block)*b2->num_children));
+	  for (k=0; k < b2->num_children; ++k)
+	    b2->children[k]=b1->children[i+k];
+	  b1->children[i]=b2;
+	  ++i;
+	  for (k=j+1; k < b1->num_children; ++k, ++i)
+	    b1->children[i]=b1->children[k];
+	  b1->num_children-=(b2->num_children-1);
+	  b1->children=(block *)mem_resize_block((pointer)b1->children, (SIZE_T)(sizeof(block)*b1->num_children));
+	}
+    }
+  else
+    {
+      /* b1 and b2 are blocks representing just single variables. */
+      b1->num_children=1;
+      b1->children=(block *)mem_get_block((SIZE_T)(sizeof(block)*b1->num_children));
+      b1->children[0]=b2;
+      b2->num_children=0;
+      b2->children=0;
+    }
+}
+
+
+block
+cmu_bdd_new_var_block(cmu_bdd_manager bddm, bdd v, long n)
+{
+  block b;
+
+  if (bdd_check_arguments(1, v))
+    {
+      BDD_SETUP(v);
+      if (cmu_bdd_type_aux(bddm, v) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_new_var_block: second argument is not a positive variable");
+	  if (BDD_IS_CONST(v))
+	    return ((block)0);
+	}
+      b=(block)BDD_NEW_REC(bddm, sizeof(struct block_));
+      b->reorderable=0;
+      b->first_index=BDD_INDEX(bddm, v);
+      if (n <= 0)
+	{
+	  cmu_bdd_warning("cmu_bdd_new_var_block: invalid final argument");
+	  n=1;
+	}
+      b->last_index=b->first_index+n-1;
+      if (b->last_index >= bddm->vars)
+	{
+	  cmu_bdd_warning("cmu_bdd_new_var_block: range covers non-existent variables");
+	  b->last_index=bddm->vars-1;
+	}
+      add_block(bddm->super_block, b);
+      return (b);
+    }
+  return ((block)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddcache.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddcache.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddcache.c	(revision 6)
@@ -0,0 +1,637 @@
+/* BDD system cache routines */
+
+
+#include "bddint.h"
+
+
+#define HASH1(d1) ((INT_PTR)d1)
+#define HASH2(d1, d2) ((INT_PTR)(d1)+(((INT_PTR)(d2)) << 1))
+#define HASH3(d1, d2, d3) ((INT_PTR)(d1)+(((INT_PTR)(d2)) << 1)+(((INT_PTR)(d3)) << 2))
+
+
+static
+void
+bdd_purge_entry(cmu_bdd_manager bddm, cache_entry *bin)
+{
+  void (*purge_fn)(cmu_bdd_manager, cache_entry);
+  cache_entry p;
+
+  p= *bin;
+  purge_fn=bddm->op_cache.purge_fn[TAG(p)];
+  p=CACHE_POINTER(p);
+  if (purge_fn)
+    (*purge_fn)(bddm, p);
+  bddm->op_cache.entries--;
+  BDD_FREE_REC(bddm, (pointer)p, sizeof(struct cache_entry_));
+  *bin=0;
+}
+
+
+static
+void
+bdd_purge_lru(cmu_bdd_manager bddm, cache_entry *bin)
+{
+  if (bin[1])
+    bdd_purge_entry(bddm, bin+1);
+  bin[1]=bin[0];
+}
+
+
+static
+cache_entry
+bdd_get_entry(cmu_bdd_manager bddm, int tag, cache_entry *bin)
+{
+  void (*purge_fn)(cmu_bdd_manager, cache_entry);
+  cache_entry p;
+
+  if (bin[0] && bin[1])
+    {
+      p=bin[1];
+      purge_fn=bddm->op_cache.purge_fn[TAG(p)];
+      p=CACHE_POINTER(p);
+      if (purge_fn)
+	(*purge_fn)(bddm, p);
+      bddm->op_cache.collisions++;
+      if (bddm->op_cache.cache_level == 0)
+	bin[1]=bin[0];
+      else
+	++bin;
+    }
+  else
+    {
+      p=(cache_entry)BDD_NEW_REC(bddm, sizeof(struct cache_entry_));
+      bddm->op_cache.entries++;
+      if (bin[0])
+	++bin;
+    }
+  *bin=(cache_entry)SET_TAG(p, tag);
+  return (p);
+}
+
+
+static
+long
+bdd_rehash1(cmu_bdd_manager bddm, cache_entry p)
+{
+  return (HASH1(p->slot[0]));
+}
+
+
+static
+long
+bdd_rehash2(cmu_bdd_manager bddm, cache_entry p)
+{
+  return (HASH2(p->slot[0], p->slot[1]));
+}
+
+
+static
+long
+bdd_rehash3(cmu_bdd_manager bddm, cache_entry p)
+{
+  return (HASH3(p->slot[0], p->slot[1], p->slot[2]));
+}
+
+
+void
+bdd_rehash_cache(cmu_bdd_manager bddm, int grow)
+{
+  long i;
+  long hash;
+  int j;
+  long oldsize;
+  cache_bin *newtable;
+  cache_entry *bin;
+  cache_entry *newbin;
+  cache_entry p;
+  cache_entry q;
+
+  oldsize=bddm->op_cache.size;
+  if (grow)
+    bddm->op_cache.size_index++;
+  else
+    bddm->op_cache.size_index--;
+  bddm->op_cache.size=TABLE_SIZE(bddm->op_cache.size_index);
+  newtable=(cache_bin *)mem_get_block((SIZE_T)(bddm->op_cache.size*sizeof(struct cache_bin_)));
+  for (i=0; i < bddm->op_cache.size; ++i)
+    for (j=0; j < 2; ++j)
+      newtable[i].entry[j]=0;
+  /* Rehash LRU first. */
+  for (j=1; j >= 0; --j)
+    for (i=0; i < oldsize; ++i)
+      {
+	bin=bddm->op_cache.table[i].entry;
+	if ((p=bin[j]))
+	  {
+	    q=CACHE_POINTER(p);
+	    hash=(*bddm->op_cache.rehash_fn[TAG(p)])(bddm, q);
+	    BDD_REDUCE(hash, bddm->op_cache.size);
+	    newbin=newtable[hash].entry;
+	    bdd_purge_lru(bddm, newbin);
+	    newbin[0]=p;
+	  }
+    }
+  mem_free_block((pointer)(bddm->op_cache.table));
+  bddm->op_cache.table=newtable;
+}
+
+
+/* The routines bdd_insert_in_cachex insert things in the cache. */
+/* The routines bdd_lookup_in_cachex look up things in the cache. */
+
+void
+bdd_insert_in_cache31(cmu_bdd_manager bddm, int tag, INT_PTR d1, INT_PTR d2, INT_PTR d3, INT_PTR result)
+{
+  long hash;
+  cache_entry p;
+
+  hash=HASH3(d1, d2, d3);
+  BDD_REDUCE(hash, bddm->op_cache.size);
+  if (hash < 0)
+    hash= -hash;
+  p=bdd_get_entry(bddm, tag, bddm->op_cache.table[hash].entry);
+  p->slot[0]=d1;
+  p->slot[1]=d2;
+  p->slot[2]=d3;
+  p->slot[3]=result;
+  bddm->op_cache.inserts++;
+}
+
+
+#define RETURN_BDD_FN ((void (*)(cmu_bdd_manager, cache_entry))-1)
+
+
+int
+bdd_lookup_in_cache31(cmu_bdd_manager bddm, int tag, INT_PTR d1, INT_PTR d2, INT_PTR d3, INT_PTR *result)
+{
+  long hash;
+  cache_entry *bin;
+  cache_entry p;
+  cache_entry q;
+  bdd f;
+  void (*return_fn)(cmu_bdd_manager, cache_entry);
+
+  bddm->op_cache.lookups++;
+  hash=HASH3(d1, d2, d3);
+  BDD_REDUCE(hash, bddm->op_cache.size);
+  bin=bddm->op_cache.table[hash].entry;
+  if ((p=bin[0]))
+    {
+      q=CACHE_POINTER(p);
+      if (q->slot[0] != d1 || q->slot[1] != d2 || q->slot[2] != d3 || TAG(p) != tag)
+	{
+	if ((p=bin[1]))
+	  {
+	    q=CACHE_POINTER(p);
+	    if (q->slot[0] != d1 || q->slot[1] != d2 || q->slot[2] != d3 || TAG(p) != tag)
+	      return (0);
+	    bin[1]=bin[0];
+	    bin[0]=p;
+	  }
+	else
+	  return (0);
+	}
+    }
+  else
+    return (0);
+  bddm->op_cache.hits++;
+  if ((return_fn=bddm->op_cache.return_fn[TAG(p)]))
+    {
+    if (return_fn == RETURN_BDD_FN)
+      {
+	f=(bdd)q->slot[3];
+	{
+	  BDD_SETUP(f);
+	  BDD_TEMP_INCREFS(f);
+	}
+      }
+    else
+      (*return_fn)(bddm, q);
+    }
+  *result=q->slot[3];
+  return (1);
+}
+
+
+void
+bdd_insert_in_cache22(cmu_bdd_manager bddm, int tag, INT_PTR d1, INT_PTR d2, INT_PTR result1, INT_PTR result2)
+{
+  long hash;
+  cache_entry p;
+
+  hash=HASH2(d1, d2);
+  BDD_REDUCE(hash, bddm->op_cache.size);
+  p=bdd_get_entry(bddm, tag, bddm->op_cache.table[hash].entry);
+  p->slot[0]=d1;
+  p->slot[1]=d2;
+  p->slot[2]=result1;
+  p->slot[3]=result2;
+  bddm->op_cache.inserts++;
+}
+
+
+int
+bdd_lookup_in_cache22(cmu_bdd_manager bddm, int tag, INT_PTR d1, INT_PTR d2, INT_PTR *result1, INT_PTR *result2)
+{
+  long hash;
+  cache_entry *bin;
+  cache_entry p;
+  cache_entry q;
+  void (*return_fn)(cmu_bdd_manager, cache_entry);
+
+  bddm->op_cache.lookups++;
+  hash=HASH2(d1, d2);
+  BDD_REDUCE(hash, bddm->op_cache.size);
+  bin=bddm->op_cache.table[hash].entry;
+  if ((p=bin[0]))
+    {
+      q=CACHE_POINTER(p);
+      if (q->slot[0] != d1 || q->slot[1] != d2 || TAG(p) != tag)
+	{
+	if ((p=bin[1]))
+	  {
+	    q=CACHE_POINTER(p);
+	    if (q->slot[0] != d1 || q->slot[1] != d2 || TAG(p) != tag)
+	      return (0);
+	    bin[1]=bin[0];
+	    bin[0]=p;
+	  }
+	else
+	  return (0);
+	}
+    }
+  else
+    return (0);
+  bddm->op_cache.hits++;
+  if ((return_fn=bddm->op_cache.return_fn[TAG(p)]))
+    (*return_fn)(bddm, q);
+  *result1=q->slot[2];
+  *result2=q->slot[3];
+  return (1);
+}
+
+
+void
+bdd_insert_in_cache13(cmu_bdd_manager bddm, int tag, INT_PTR d1, INT_PTR result1, INT_PTR result2, INT_PTR result3)
+{
+  long hash;
+  cache_entry p;
+
+  hash=HASH1(d1);
+  BDD_REDUCE(hash, bddm->op_cache.size);
+  p=bdd_get_entry(bddm, tag, bddm->op_cache.table[hash].entry);
+  p->slot[0]=d1;
+  p->slot[1]=result1;
+  p->slot[2]=result2;
+  p->slot[3]=result3;
+  bddm->op_cache.inserts++;
+}
+
+
+int
+bdd_lookup_in_cache13(cmu_bdd_manager bddm, int tag, INT_PTR d1, INT_PTR *result1, INT_PTR *result2, INT_PTR *result3)
+{
+  long hash;
+  cache_entry *bin;
+  cache_entry p;
+  cache_entry q;
+  void (*return_fn)(cmu_bdd_manager, cache_entry);
+
+  bddm->op_cache.lookups++;
+  hash=HASH1(d1);
+  BDD_REDUCE(hash, bddm->op_cache.size);
+  bin=bddm->op_cache.table[hash].entry;
+  if ((p=bin[0]))
+    {
+      q=CACHE_POINTER(p);
+      if (q->slot[0] != d1 || TAG(p) != tag)
+	{
+	if ((p=bin[1]))
+	  {
+	    q=CACHE_POINTER(p);
+	    if (q->slot[0] != d1 || TAG(p) != tag)
+	      return (0);
+	    bin[1]=bin[0];
+	    bin[0]=p;
+	  }
+	else
+	  return (0);
+	}
+    }
+  else
+    return (0);
+  bddm->op_cache.hits++;
+  if ((return_fn=bddm->op_cache.return_fn[TAG(p)]))
+    (*return_fn)(bddm, q);
+  *result1=q->slot[1];
+  *result2=q->slot[2];
+  *result3=q->slot[3];
+  return (1);
+}
+
+
+static
+int
+cmu_bdd_ite_gc_fn(cmu_bdd_manager bddm, cache_entry p)
+{
+  int i;
+  bdd f;
+
+  for (i=0; i < 4; ++i)
+    {
+      f=(bdd)p->slot[i];
+      {
+	BDD_SETUP(f);
+	if (!BDD_IS_USED(f))
+	  return (1);
+      }
+    }
+  return (0);
+}
+
+
+static
+int
+bdd_two_gc_fn(cmu_bdd_manager bddm, cache_entry p)
+{
+  int i;
+  bdd f;
+
+  for (i=1; i < 4; ++i)
+    {
+      f=(bdd)p->slot[i];
+      {
+	BDD_SETUP(f);
+	if (!BDD_IS_USED(f))
+	  return (1);
+      }
+    }
+  return (0);
+}
+
+
+static
+int
+bdd_two_data_gc_fn(cmu_bdd_manager bddm, cache_entry p)
+{
+  int i;
+  bdd f;
+
+  for (i=1; i < 3; ++i)
+    {
+      f=(bdd)p->slot[i];
+      {
+	BDD_SETUP(f);
+	if (!BDD_IS_USED(f))
+	  return (1);
+      }
+    }
+  return (0);
+}
+
+
+static
+int
+cmu_bdd_one_data_gc_fn(cmu_bdd_manager bddm, cache_entry p)
+{
+  bdd f;
+
+  f=(bdd)p->slot[1];
+  {
+    BDD_SETUP(f);
+    return (!BDD_IS_USED(f));
+  }
+}
+
+
+/* bdd_purge_cache(bddm) purges the cache of any entries which mention */
+/* a BDD node that is about to be garbage collected. */
+
+void
+bdd_purge_cache(cmu_bdd_manager bddm)
+{
+  long i;
+  int j;
+  cache_entry *bin;
+  cache_entry p;
+  cache_entry q;
+
+  for (i=0; i < bddm->op_cache.size; ++i)
+    {
+      bin= &bddm->op_cache.table[i].entry[0];
+      for (j=0; j < 2; ++j)
+	if ((p=bin[j]))
+	  {
+	    q=CACHE_POINTER(p);
+	    if ((*bddm->op_cache.gc_fn[TAG(p)])(bddm, q))
+	      bdd_purge_entry(bddm, bin+j);
+	    else if (j == 1 && !bin[0])
+	      {
+		bin[0]=bin[1];	/* LRU is only one left */
+		bin[1]=0;
+	      }
+	  }
+	else
+	  break;
+    }
+}
+
+
+/* bdd_flush_cache(bddm, flush_fn, closure) purges all entries for which */
+/* the given function returns true. */
+
+void
+bdd_flush_cache(cmu_bdd_manager bddm, int (*flush_fn)(cmu_bdd_manager, cache_entry, pointer), pointer closure)
+{
+  long i;
+  int j;
+  cache_entry *bin;
+
+  for (i=0; i < bddm->op_cache.size; ++i)
+    {
+      bin=bddm->op_cache.table[i].entry;
+      for (j=0; j < 2; ++j)
+	if (bin[j])
+	  {
+	    if ((*flush_fn)(bddm, bin[j], closure))
+	      bdd_purge_entry(bddm, bin+j);
+	    else if (j == 1 && !bin[0])
+	      {
+		bin[0]=bin[1];	/* LRU is only one left */
+		bin[1]=0;
+	      }
+	  }
+	else
+	  break;
+    }
+}
+
+
+/* bdd_flush_all(bddm) flushes the entire cache. */
+
+void
+bdd_flush_all(cmu_bdd_manager bddm)
+{
+  long i;
+  int j;
+  cache_entry *bin;
+
+  for (i=0; i < bddm->op_cache.size; ++i)
+    {
+      bin=bddm->op_cache.table[i].entry;
+      for (j=0; j < 2; ++j)
+	if (bin[j])
+	  bdd_purge_entry(bddm, bin+j);
+	else
+	  break;
+    }
+}
+
+
+/* bdd_cache_functions(bddm, args, gc_fn, purge_fn, return_fn, flush_fn) */
+/* controls the user cache types.  Allocates an unused cache entry type */
+/* tag and returns the tag, or -1 if no more tags are available. */
+
+int
+bdd_cache_functions(cmu_bdd_manager bddm,
+		    int args,
+		    int (*gc_fn)(cmu_bdd_manager, cache_entry),
+		    void (*purge_fn)(cmu_bdd_manager, cache_entry),
+		    void (*return_fn)(cmu_bdd_manager, cache_entry),
+		    int (*flush_fn)(cmu_bdd_manager, cache_entry, pointer))
+{
+  long (*rehash_fn)(cmu_bdd_manager, cache_entry);
+  int i;
+
+  if (args == 1)
+    rehash_fn=bdd_rehash1;
+  else if (args == 2)
+    rehash_fn=bdd_rehash2;
+  else if (args == 3)
+    rehash_fn=bdd_rehash3;
+  else
+    {
+      rehash_fn=0;
+      cmu_bdd_fatal("bdd_cache_functions: illegal number of cache arguments");
+    }
+  for (i=CACHE_TYPE_USER1; i < CACHE_TYPE_USER1+USER_ENTRY_TYPES; ++i)
+    if (!bddm->op_cache.rehash_fn[i])
+      break;
+  if (i == CACHE_TYPE_USER1+USER_ENTRY_TYPES)
+    return (-1);
+  bddm->op_cache.rehash_fn[i]=rehash_fn;
+  bddm->op_cache.gc_fn[i]=gc_fn;
+  bddm->op_cache.purge_fn[i]=purge_fn;
+  bddm->op_cache.return_fn[i]=return_fn;
+  bddm->op_cache.flush_fn[i]=flush_fn;
+  return (i);
+}
+
+
+static
+int
+bdd_flush_tag(cmu_bdd_manager bddm, cache_entry p, pointer tag)
+{
+  /*return (TAG(p) == (int)tag);*/
+  return (TAG(p) == (long)tag);
+}
+
+
+/* cmu_bdd_free_cache_tag(bddm, tag) frees a previously allocated user */
+/* cache tag. */
+
+void
+cmu_bdd_free_cache_tag(cmu_bdd_manager bddm, long tag)
+{
+  if (tag < CACHE_TYPE_USER1 ||
+      tag >= CACHE_TYPE_USER1+USER_ENTRY_TYPES ||
+      !bddm->op_cache.rehash_fn[(long)tag])
+    cmu_bdd_fatal("cmu_bdd_free_cache_tag: attempt to free unallocated tag");
+  bdd_flush_cache(bddm, bdd_flush_tag, (pointer)tag);
+  bddm->op_cache.rehash_fn[tag]=0;
+  bddm->op_cache.gc_fn[tag]=0;
+  bddm->op_cache.purge_fn[tag]=0;
+  bddm->op_cache.return_fn[tag]=0;
+  bddm->op_cache.flush_fn[tag]=0;
+}
+
+
+static
+int
+bdd_two_flush_fn(cmu_bdd_manager bddm, cache_entry p, pointer closure)
+{
+  int id_to_nuke;
+
+  id_to_nuke=(long)closure;
+  return (p->slot[0] == OP_RELPROD+id_to_nuke ||
+	  p->slot[0] == OP_QNT+id_to_nuke ||
+	  p->slot[0] == OP_SUBST+id_to_nuke);
+}
+
+
+/* cmu_bdd_init_cache(bddm) initializes the cache for a BDD manager. */
+
+void
+cmu_bdd_init_cache(cmu_bdd_manager bddm)
+{
+  long i;
+  int j;
+
+  bddm->op_cache.size_index=13;
+  bddm->op_cache.size=TABLE_SIZE(bddm->op_cache.size_index);
+  bddm->op_cache.table=(cache_bin *)mem_get_block((SIZE_T)(bddm->op_cache.size*sizeof(cache_bin)));
+  for (i=0; i < bddm->op_cache.size; ++i)
+    for (j=0; j < 2; ++j)
+      bddm->op_cache.table[i].entry[j]=0;
+  /* ITE cache control functions. */
+  bddm->op_cache.rehash_fn[CACHE_TYPE_ITE]=bdd_rehash3;
+  bddm->op_cache.gc_fn[CACHE_TYPE_ITE]=cmu_bdd_ite_gc_fn;
+  bddm->op_cache.purge_fn[CACHE_TYPE_ITE]=0;
+  bddm->op_cache.return_fn[CACHE_TYPE_ITE]=RETURN_BDD_FN;
+  bddm->op_cache.flush_fn[CACHE_TYPE_ITE]=0;
+  /* Two argument op cache control functions. */
+  bddm->op_cache.rehash_fn[CACHE_TYPE_TWO]=bdd_rehash3;
+  bddm->op_cache.gc_fn[CACHE_TYPE_TWO]=bdd_two_gc_fn;
+  bddm->op_cache.purge_fn[CACHE_TYPE_TWO]=0;
+  bddm->op_cache.return_fn[CACHE_TYPE_TWO]=RETURN_BDD_FN;
+  bddm->op_cache.flush_fn[CACHE_TYPE_TWO]=bdd_two_flush_fn;
+  /* One argument op w/ data result cache control functions. */
+  bddm->op_cache.rehash_fn[CACHE_TYPE_ONEDATA]=bdd_rehash2;
+  bddm->op_cache.gc_fn[CACHE_TYPE_ONEDATA]=cmu_bdd_one_data_gc_fn;
+  bddm->op_cache.purge_fn[CACHE_TYPE_ONEDATA]=0;
+  bddm->op_cache.return_fn[CACHE_TYPE_ONEDATA]=0;
+  bddm->op_cache.flush_fn[CACHE_TYPE_ONEDATA]=0;
+  /* Two argument op w/ data result cache control functions. */
+  bddm->op_cache.rehash_fn[CACHE_TYPE_TWODATA]=bdd_rehash3;
+  bddm->op_cache.gc_fn[CACHE_TYPE_TWODATA]=bdd_two_data_gc_fn;
+  bddm->op_cache.purge_fn[CACHE_TYPE_TWODATA]=0;
+  bddm->op_cache.return_fn[CACHE_TYPE_TWODATA]=0;
+  bddm->op_cache.flush_fn[CACHE_TYPE_TWODATA]=0;
+  /* User-defined cache control functions. */
+  for (j=CACHE_TYPE_USER1; j < CACHE_TYPE_USER1+USER_ENTRY_TYPES; ++j)
+    {
+      bddm->op_cache.rehash_fn[j]=0;
+      bddm->op_cache.gc_fn[j]=0;
+      bddm->op_cache.purge_fn[j]=0;
+      bddm->op_cache.return_fn[j]=0;
+      bddm->op_cache.flush_fn[j]=0;
+    }
+  bddm->op_cache.cache_ratio=4;
+  bddm->op_cache.cache_level=0;
+  bddm->op_cache.entries=0;
+  bddm->op_cache.lookups=0;
+  bddm->op_cache.hits=0;
+  bddm->op_cache.inserts=0;
+  bddm->op_cache.collisions=0;
+}
+
+
+/* cmu_bdd_free_cache(bddm) frees the storage associated with the cache of */
+/* the indicated BDD manager. */
+
+void
+cmu_bdd_free_cache(cmu_bdd_manager bddm)
+{
+  bdd_flush_all(bddm);
+  mem_free_block((pointer)bddm->op_cache.table);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddcmp.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddcmp.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddcmp.c	(revision 6)
@@ -0,0 +1,83 @@
+/* BDD comparison routine */
+
+
+#include "bddint.h"
+
+
+static
+int
+bdd_fraction_compare(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  double f_frac, g_frac;
+
+  bddm->op_cache.cache_level++;
+  f_frac=cmu_bdd_satisfying_fraction_step(bddm, f);
+  g_frac=cmu_bdd_satisfying_fraction_step(bddm, g);
+  bddm->op_cache.cache_level--;
+  if (f_frac < g_frac)
+    return (-1);
+  if (f_frac > g_frac)
+    return (1);
+  return (0);
+}
+
+
+static
+int
+cmu_bdd_compare_step(cmu_bdd_manager bddm, bdd f, bdd g, bdd_indexindex_type v_indexindex, long op)
+{
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd_indexindex_type top_indexindex;
+  INT_PTR result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (f == g)
+    return (0);
+  if (BDD_IS_CONST(f) || BDD_IS_CONST(g))
+    {
+      if (f == BDD_ZERO(bddm) || g == BDD_ONE(bddm))
+	return (-1);
+      return (1);
+    }
+  if (bdd_lookup_in_cache2d(bddm, op, f, g, &result))
+    return ((int)result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  if (bddm->indexes[top_indexindex] > bddm->indexes[v_indexindex])
+    result=bdd_fraction_compare(bddm, f, g);
+  else
+    {
+      BDD_COFACTOR(top_indexindex, f, f1, f2);
+      BDD_COFACTOR(top_indexindex, g, g1, g2);
+      if (!(result=cmu_bdd_compare_step(bddm, f2, g2, v_indexindex, op)))
+	result=cmu_bdd_compare_step(bddm, f1, g1, v_indexindex, op);
+    }
+  bdd_insert_in_cache2d(bddm, op, f, g, result);
+  return ((int)result);
+}
+
+
+int
+cmu_bdd_compare_temp(cmu_bdd_manager bddm, bdd f, bdd g, bdd v)
+{
+  BDD_SETUP(v);
+  return (cmu_bdd_compare_step(bddm, f, g, BDD_INDEXINDEX(v), OP_CMPTO+BDD_INDEXINDEX(v)));
+}
+
+
+int
+cmu_bdd_compare(cmu_bdd_manager bddm, bdd f, bdd g, bdd v)
+{
+  if (bdd_check_arguments(3, f, g, v))
+    {
+      BDD_SETUP(v);
+      if (cmu_bdd_type_aux(bddm, v) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_compare: third argument is not a positive variable");
+	  return (0);
+	}
+      return (cmu_bdd_compare_step(bddm, f, g, BDD_INDEXINDEX(v), OP_CMPTO+BDD_INDEXINDEX(v)));
+    }
+  return (0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddcomp.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddcomp.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddcomp.c	(revision 6)
@@ -0,0 +1,195 @@
+/* BDD composition routines */
+
+
+#include "bddint.h"
+
+
+static
+bdd
+bdd_restrict_step(cmu_bdd_manager bddm, bdd f, bdd_indexindex_type g_indexindex, bdd h, long op)
+{
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  if (BDD_INDEX(bddm, f) > bddm->indexes[g_indexindex])
+    {
+      /* f doesn't depend on the variable g. */
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (BDD_INDEXINDEX(f) == g_indexindex)
+    {
+      /* Do the restriction. */
+      result=(h == BDD_ONE(bddm) ? BDD_THEN(f) : BDD_ELSE(f));
+      {
+	BDD_SETUP(result);
+	BDD_TEMP_INCREFS(result);
+	return (result);
+      }
+    }
+  if (bdd_lookup_in_cache2(bddm, op, BDD_OUTPOS(f), h, &result))
+    return (BDD_IS_OUTPOS(f) ? result : BDD_NOT(result));
+  temp1=bdd_restrict_step(bddm, BDD_THEN(f), g_indexindex, h, op);
+  temp2=bdd_restrict_step(bddm, BDD_ELSE(f), g_indexindex, h, op);
+  result=bdd_find(bddm, BDD_INDEXINDEX(f), temp1, temp2);
+  if (BDD_IS_OUTPOS(f))
+    bdd_insert_in_cache2(bddm, op, f, h, result);
+  else
+    bdd_insert_in_cache2(bddm, op, BDD_NOT(f), h, BDD_NOT(result));
+  return (result);
+}
+
+
+static
+bdd
+cmu_bdd_compose_step(cmu_bdd_manager bddm, bdd f, bdd_indexindex_type g_indexindex, bdd h, long op)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd h1, h2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(h);
+  /* Use restriction if possible. */
+  if (BDD_IS_CONST(h))
+    return (bdd_restrict_step(bddm, f, g_indexindex, h, op));
+  if (BDD_INDEX(bddm, f) > bddm->indexes[g_indexindex])
+    {
+      /* f doesn't depend on the variable g. */
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (bdd_lookup_in_cache2(bddm, op, BDD_OUTPOS(f), h, &result))
+    return (BDD_IS_OUTPOS(f) ? result : BDD_NOT(result));
+  if (BDD_INDEXINDEX(f) == g_indexindex)
+    {
+      /* Do the replacement. */
+      bddm->op_cache.cache_level++;
+      result=cmu_bdd_ite_step(bddm, h, BDD_THEN(f), BDD_ELSE(f));
+      bddm->op_cache.cache_level--;
+    }
+  else
+    {
+      BDD_TOP_VAR2(top_indexindex, bddm, f, h);
+      BDD_COFACTOR(top_indexindex, f, f1, f2);
+      BDD_COFACTOR(top_indexindex, h, h1, h2);
+      temp1=cmu_bdd_compose_step(bddm, f1, g_indexindex, h1, op);
+      temp2=cmu_bdd_compose_step(bddm, f2, g_indexindex, h2, op);
+      result=bdd_find(bddm, top_indexindex, temp1, temp2);
+    }
+  if (BDD_IS_OUTPOS(f))
+    bdd_insert_in_cache2(bddm, op, f, h, result);
+  else
+    bdd_insert_in_cache2(bddm, op, BDD_NOT(f), h, BDD_NOT(result));
+  return (result);
+}
+
+
+/* cmu_bdd_compose_temp is used internally by cmu_bdd_swap_vars. */
+
+bdd
+cmu_bdd_compose_temp(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  BDD_SETUP(g);
+  return (cmu_bdd_compose_step(bddm, f, BDD_INDEXINDEX(g), h, OP_COMP+BDD_INDEXINDEX(g)));
+}
+
+
+/* cmu_bdd_compose(bddm, f, g, h) returns the BDD for substituting h for */
+/* the variable g in f.  h may depend on g. */
+
+bdd
+cmu_bdd_compose(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  if (bdd_check_arguments(3, f, g, h))
+    {
+      BDD_SETUP(f);
+      BDD_SETUP(g);
+      if (cmu_bdd_type_aux(bddm, g) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_compose: second argument is not a positive variable");
+	  BDD_INCREFS(f);
+	  return (f);
+	}
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_bdd_compose_step(bddm, f, BDD_INDEXINDEX(g), h, OP_COMP+BDD_INDEXINDEX(g)));
+    }
+  return ((bdd)0);
+}
+
+
+bdd
+cmu_bdd_substitute_step(cmu_bdd_manager bddm, bdd f, long op, bdd (*ite_fn)(cmu_bdd_manager, bdd, bdd, bdd), var_assoc subst)
+{
+  bdd g;
+  bdd temp1, temp2;
+  bdd result;
+  bdd_index_type g_index;
+
+  BDD_SETUP(f);
+  if ((long)BDD_INDEX(bddm, f) > subst->last)
+    {
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (bdd_lookup_in_cache1(bddm, op, BDD_OUTPOS(f), &result))
+    return (BDD_IS_OUTPOS(f) ? result : BDD_NOT(result));
+  g=subst->assoc[BDD_INDEXINDEX(f)];
+  /* See if we are substituting a constant at this level. */
+  if (g == BDD_ONE(bddm))
+    return (cmu_bdd_substitute_step(bddm, BDD_THEN(f), op, ite_fn, subst));
+  if (g == BDD_ZERO(bddm))
+    return (cmu_bdd_substitute_step(bddm, BDD_ELSE(f), op, ite_fn, subst));
+  temp1=cmu_bdd_substitute_step(bddm, BDD_THEN(f), op, ite_fn, subst);
+  temp2=cmu_bdd_substitute_step(bddm, BDD_ELSE(f), op, ite_fn, subst);
+  if (!g)
+    g=BDD_IF(bddm, f);
+  {
+    BDD_SETUP(g);
+    BDD_SETUP(temp1);
+    BDD_SETUP(temp2);
+    if (g == BDD_IF(bddm, g) &&
+	(g_index=BDD_INDEX(bddm, g)) < BDD_INDEX(bddm, temp1) &&
+	g_index < BDD_INDEX(bddm, temp2))
+      /* Substituting with variable above the tops of the subresults. */
+      result=bdd_find(bddm, BDD_INDEXINDEX(g), temp1, temp2);
+    else
+      {
+	/* Do an ITE. */
+	bddm->op_cache.cache_level++;
+	result=(*ite_fn)(bddm, g, temp1, temp2);
+	BDD_TEMP_DECREFS(temp1);
+	BDD_TEMP_DECREFS(temp2);
+	bddm->op_cache.cache_level--;
+      }
+  }
+  if (BDD_IS_OUTPOS(f))
+    bdd_insert_in_cache1(bddm, op, f, result);
+  else
+    bdd_insert_in_cache1(bddm, op, BDD_NOT(f), BDD_NOT(result));
+  return (result);
+}
+
+
+/* cmu_bdd_substitute(bddm, f) returns the BDD for substituting in f */
+/* according to the current variable association. */
+
+bdd
+cmu_bdd_substitute(cmu_bdd_manager bddm, bdd f)
+{
+  long op;
+
+  if (bdd_check_arguments(1, f))
+    {
+      FIREWALL(bddm);
+      if (bddm->curr_assoc_id == -1)
+	op=bddm->temp_op--;
+      else
+	op=OP_SUBST+bddm->curr_assoc_id;
+      RETURN_BDD(cmu_bdd_substitute_step(bddm, f, op, cmu_bdd_ite_step, bddm->curr_assoc));
+    }
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddcproject.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddcproject.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddcproject.c	(revision 6)
@@ -0,0 +1,200 @@
+/* Written by Gitanjali M. Swamy */
+/* 	bddcproject.c,v 1.2 1994/06/02 02:36:30 shiple Exp	 */
+/*      bddcproject.c,v
+ * Revision 1.2  1994/06/02  02:36:30  shiple
+ * Fixed bug in RETURN_BDD use.
+ *
+ * Revision 1.1  1994/06/02  00:48:50  shiple
+ * Initial revision
+ *
+ * Revision 1.5  1994/05/31  15:19:32  gms
+ * May31 Tues
+ *                                                            */
+
+#ifndef lint
+static char vcid[] = "bddcproject.c,v 1.2 1994/06/02 02:36:30 shiple Exp";
+#endif /* lint */
+
+#include "bddint.h"   /* CMU internal routines; for use in bdd_get_node() */
+
+#define OP_CPROJ 5000001
+
+extern bdd cmu_bdd_project(cmu_bdd_manager, bdd);
+
+/* INTERNAL ONLY */
+
+/*
+ *    smooth - recursively perform the smoothing
+ *
+ *    return the result of the reorganization
+ */
+
+static
+bdd
+cmu_bdd_smooth_g_step(cmu_bdd_manager bddm, bdd f, long op, var_assoc vars ,long id)
+{
+    bdd temp1, temp2;
+    bdd result;
+    int quantifying;
+
+    BDD_SETUP(f);
+    if ((long)BDD_INDEX(bddm, f) > vars->last)
+        {
+            BDD_TEMP_INCREFS(f);
+            return (f);
+        }
+    if (bdd_lookup_in_cache1(bddm, op, f, &result))
+        return (result);
+    quantifying=(vars->assoc[BDD_INDEXINDEX(f)] != 0);
+
+    temp1=cmu_bdd_smooth_g_step(bddm, BDD_THEN(f), op, vars,id);
+
+    if ((quantifying && temp1 == BDD_ONE(bddm))&&((long)BDD_INDEX(bddm, f) > id ))
+
+        result=temp1;
+    else
+        {
+            temp2=cmu_bdd_smooth_g_step(bddm, BDD_ELSE(f), op, vars,id);
+            if (quantifying)
+                {
+                    BDD_SETUP(temp1);
+                    BDD_SETUP(temp2);
+                    bddm->op_cache.cache_level++;
+                    result=cmu_bdd_ite_step(bddm, temp1, BDD_ONE(bddm), temp2);
+                    BDD_TEMP_DECREFS(temp1);
+                    BDD_TEMP_DECREFS(temp2);
+                    bddm->op_cache.cache_level--;
+                }
+            else
+                result=bdd_find(bddm, BDD_INDEXINDEX(f), temp1, temp2);
+        }
+    bdd_insert_in_cache1(bddm, op, f, result);
+
+   
+    return (result);
+}
+
+
+static
+bdd
+cmu_bdd_smooth_g(cmu_bdd_manager bddm, bdd f, long id)
+{
+    long op;
+    
+            if (bddm->curr_assoc_id == -1)
+                op=bddm->temp_op--;
+            else
+                op=OP_QNT+bddm->curr_assoc_id;
+            RETURN_BDD(cmu_bdd_smooth_g_step(bddm, f, op, bddm->curr_assoc,id));
+  }
+
+
+/*
+ *    project - recursively perform compatible projection
+ *
+ *    return the result of the reorganization
+ */
+
+
+
+static
+bdd
+cmu_bdd_project_step(cmu_bdd_manager bddm, bdd f, long op, var_assoc vars)
+
+{
+    bdd temp1, temp2;
+    bdd sm, pr;
+    bdd result;
+    int quantifying;
+
+    BDD_SETUP(f);
+    if ((long)BDD_INDEX(bddm, f) > vars->last)
+        {
+            BDD_TEMP_INCREFS(f);
+            return (f);
+        }
+    if (bdd_lookup_in_cache1(bddm, op, f, &result))
+        return (result);
+    quantifying=(vars->assoc[BDD_INDEXINDEX(f)] != 0);
+
+    if (quantifying)
+        {
+
+            sm  = cmu_bdd_smooth_g(bddm,BDD_THEN(f),(long)BDD_INDEXINDEX(f)); 
+            if (sm == BDD_ONE(bddm))
+                {
+                    pr  = cmu_bdd_project_step(bddm, BDD_THEN(f), op, vars);
+                    {
+                    BDD_SETUP(pr);
+                    result = bdd_find(bddm, BDD_INDEXINDEX(f), pr,BDD_ZERO(bddm));
+                   BDD_TEMP_DECREFS(pr);
+                    }
+                    
+                }
+      else if (sm == BDD_ZERO(bddm))
+                {
+                    pr = cmu_bdd_project_step(bddm, BDD_ELSE(f), op, vars);
+                    {
+                    BDD_SETUP(pr);
+                    result = bdd_find(bddm, BDD_INDEXINDEX(f), BDD_ZERO(bddm), pr);
+                   BDD_TEMP_DECREFS(pr);
+                    }
+                    
+                }
+            else 
+                {
+                    temp1 = cmu_bdd_project_step(bddm, BDD_THEN(f), op, vars);
+                    temp2 = cmu_bdd_project_step(bddm, BDD_ELSE(f),op, vars);
+                    {
+                    BDD_SETUP(temp1);
+                    BDD_SETUP(temp2);
+                    pr = cmu_bdd_ite_step(bddm, sm, BDD_ZERO(bddm), temp2);
+                    bddm->op_cache.cache_level++;
+                    result = bdd_find(bddm, BDD_INDEXINDEX(f), temp1, pr);
+                    BDD_TEMP_DECREFS(temp1);
+                    BDD_TEMP_DECREFS(temp2);
+                    bddm->op_cache.cache_level--;
+                    }
+            
+                }
+        }
+  
+    else
+        {
+            temp1=cmu_bdd_project_step(bddm, BDD_THEN(f), op, vars);
+            temp2=cmu_bdd_project_step(bddm, BDD_ELSE(f), op, vars);
+            result=bdd_find(bddm, BDD_INDEXINDEX(f), temp1, temp2);
+
+        }
+  
+    bdd_insert_in_cache1(bddm, op, f, result);
+    return (result);
+}
+
+bdd
+cmu_bdd_project(cmu_bdd_manager bddm, bdd f)
+{
+    long op;
+
+    if (bdd_check_arguments(1, f))
+        {
+            FIREWALL(bddm);
+            if (bddm->curr_assoc_id == -1)
+                op=bddm->temp_op--;
+            else
+                op=OP_CPROJ+bddm->curr_assoc_id;
+            RETURN_BDD(cmu_bdd_project_step(bddm, f, op, bddm->curr_assoc));
+        }
+    return ((bdd)0);
+}
+
+
+
+
+
+
+
+
+
+
+
Index: /vis_dev/glu-2.1/src/cmuBdd/bdddump.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bdddump.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bdddump.c	(revision 6)
@@ -0,0 +1,405 @@
+/* BDD library dump/undump routines */
+
+
+#include "bddint.h"
+
+
+#define MAGIC_COOKIE 0x5e02f795l
+#define BDD_IOERROR 100
+
+
+#define TRUE_ENCODING 0xffffff00l
+#define FALSE_ENCODING 0xffffff01l
+#define POSVAR_ENCODING 0xffffff02l
+#define NEGVAR_ENCODING 0xffffff03l
+#define POSNODE_ENCODING 0xffffff04l
+#define NEGNODE_ENCODING 0xffffff05l
+#define NODELABEL_ENCODING 0xffffff06l
+#define CONSTANT_ENCODING 0xffffff07l
+
+
+static
+int
+bytes_needed(long n)
+{
+  if (n <= 0x100l)
+    return (1);
+  if (n <= 0x10000l)
+    return (2);
+  if (n <= 0x1000000l)
+    return (3);
+  return (4);
+}
+
+
+static
+void
+write(cmu_bdd_manager bddm, unsigned long n, int bytes, FILE *fp)
+{
+  while (bytes)
+    {
+      if (fputc((char)(n >> (8*(bytes-1)) & 0xff), fp) == EOF)
+	longjmp(bddm->abort.context, BDD_IOERROR);
+      --bytes;
+    }
+}
+
+
+static
+void
+cmu_bdd_dump_bdd_step(cmu_bdd_manager bddm,
+		  bdd f,
+		  FILE *fp,
+		  hash_table h,
+		  bdd_index_type *normalized_indexes,
+		  int index_size,
+		  int node_number_size)
+{
+  int negated;
+  long *number;
+
+  BDD_SETUP(f);
+  switch (cmu_bdd_type_aux(bddm, f))
+    {
+    case BDD_TYPE_ZERO:
+      write(bddm, FALSE_ENCODING, index_size+1, fp);
+      break;
+    case BDD_TYPE_ONE:
+      write(bddm, TRUE_ENCODING, index_size+1, fp);
+      break;
+    case BDD_TYPE_CONSTANT:
+      write(bddm, CONSTANT_ENCODING, index_size+1, fp);
+      write(bddm, (unsigned long)BDD_DATA(f)[0], sizeof(long), fp);
+      write(bddm, (unsigned long)BDD_DATA(f)[1], sizeof(long), fp);
+      break;
+    case BDD_TYPE_POSVAR:
+      write(bddm, POSVAR_ENCODING, index_size+1, fp);
+      write(bddm, (unsigned long)normalized_indexes[BDD_INDEX(bddm, f)], index_size, fp);
+      break;
+    case BDD_TYPE_NEGVAR:
+      write(bddm, NEGVAR_ENCODING, index_size+1, fp);
+      write(bddm, (unsigned long)normalized_indexes[BDD_INDEX(bddm, f)], index_size, fp);
+      break;
+    case BDD_TYPE_NONTERMINAL:
+      if (bdd_lookup_in_hash_table(h, BDD_NOT(f)))
+	{
+	  f=BDD_NOT(f);
+	  negated=1;
+	}
+      else
+	negated=0;
+      number=(long *)bdd_lookup_in_hash_table(h, f);
+      if (number && *number < 0)
+	{
+	  if (negated)
+	    write(bddm, NEGNODE_ENCODING, index_size+1, fp);
+	  else
+	    write(bddm, POSNODE_ENCODING, index_size+1, fp);
+	  write(bddm, (unsigned long)(-*number-1), node_number_size, fp);
+	}
+      else
+	{
+	  if (number)
+	    {
+	      write(bddm, NODELABEL_ENCODING, index_size+1, fp);
+	      *number= -*number-1;
+	    }
+	  write(bddm, (unsigned long)normalized_indexes[BDD_INDEX(bddm, f)], index_size, fp);
+	  cmu_bdd_dump_bdd_step(bddm, BDD_THEN(f), fp, h, normalized_indexes, index_size, node_number_size);
+	  cmu_bdd_dump_bdd_step(bddm, BDD_ELSE(f), fp, h, normalized_indexes, index_size, node_number_size);
+	}
+      break;
+    default:
+      cmu_bdd_fatal("cmu_bdd_dump_bdd_step: unknown type returned by cmu_bdd_type");
+    }
+}
+
+
+int
+cmu_bdd_dump_bdd(cmu_bdd_manager bddm, bdd f, bdd *vars, FILE *fp)
+{
+  long i;
+  bdd_index_type *normalized_indexes;
+  bdd_index_type v_index;
+  bdd var;
+  bdd_index_type number_vars;
+  bdd *support;
+  int ok;
+  hash_table h;
+  int index_size;
+  long next;
+  int node_number_size;
+
+  if (bdd_check_arguments(1, f))
+    {
+      for (i=0; vars[i]; ++i)
+	if (cmu_bdd_type(bddm, vars[i]) != BDD_TYPE_POSVAR)
+	  {
+	    cmu_bdd_warning("cmu_bdd_dump_bdd: support is not all positive variables");
+	    return (0);
+	  }
+      normalized_indexes=(bdd_index_type *)mem_get_block((SIZE_T)(bddm->vars*sizeof(bdd_index_type)));
+      for (i=0; i < bddm->vars; ++i)
+	normalized_indexes[i]=BDD_MAX_INDEX;
+      for (i=0; (var=vars[i]); ++i)
+	{
+	  BDD_SETUP(var);
+	  v_index=BDD_INDEX(bddm, var);
+	  if (normalized_indexes[v_index] != BDD_MAX_INDEX)
+	    {
+	      cmu_bdd_warning("cmu_bdd_dump_bdd: variables duplicated in support");
+	      mem_free_block((pointer)normalized_indexes);
+	      return (0);
+	    }
+	  normalized_indexes[v_index]=i;
+	}
+      number_vars=i;
+      support=(bdd *)mem_get_block((SIZE_T)((bddm->vars+1)*sizeof(bdd)));
+      cmu_bdd_support(bddm, f, support);
+      ok=1;
+      for (i=0; ok && (var=support[i]); ++i)
+	{
+	  BDD_SETUP(var);
+	  if (normalized_indexes[BDD_INDEX(bddm, var)] == BDD_MAX_INDEX)
+	    {
+	      cmu_bdd_warning("cmu_bdd_dump_bdd: incomplete support specified");
+	      ok=0;
+	    }
+	}
+      if (!ok)
+	{
+	  mem_free_block((pointer)normalized_indexes);
+	  mem_free_block((pointer)support);
+	  return (0);
+	}
+      mem_free_block((pointer)support);
+      /* Everything checked now; barring I/O errors, we should be able to */
+      /* write a valid output file. */
+      h=bdd_new_hash_table(bddm, sizeof(long));
+      FIREWALL1(bddm,
+		if (retcode == BDD_IOERROR)
+		  {
+		    cmu_bdd_free_hash_table(h);
+		    mem_free_block((pointer)normalized_indexes);
+		    return (0);
+		  }
+		else
+		  cmu_bdd_fatal("cmu_bdd_dump_bdd: got unexpected retcode");
+		);
+      index_size=bytes_needed(number_vars+1);
+      bdd_mark_shared_nodes(bddm, f);
+      next=0;
+      bdd_number_shared_nodes(bddm, f, h, &next);
+      node_number_size=bytes_needed(next);
+      write(bddm, MAGIC_COOKIE, sizeof(long), fp);
+      write(bddm, (unsigned long)number_vars, sizeof(bdd_index_type), fp);
+      write(bddm, (unsigned long)next, sizeof(long), fp);
+      cmu_bdd_dump_bdd_step(bddm, f, fp, h, normalized_indexes, index_size, node_number_size);
+      cmu_bdd_free_hash_table(h);
+      mem_free_block((pointer)normalized_indexes);
+      return (1);
+    }
+  return (0);
+}
+
+
+static
+unsigned long
+read(int *error, int bytes, FILE *fp)
+{
+  int c;
+  long result;
+
+  result=0;
+  if (*error)
+    return (result);
+  while (bytes)
+    {
+      c=fgetc(fp);
+      if (c == EOF)
+	{
+	  if (ferror(fp))
+	    *error=BDD_UNDUMP_IOERROR;
+	  else
+	    *error=BDD_UNDUMP_EOF;
+	  return (0l);
+	}
+      result=(result << 8)+c;
+      --bytes;
+    }
+  return (result);
+}
+
+
+static long index_mask[]={0xffl, 0xffffl, 0xffffffl};
+
+
+static
+bdd
+cmu_bdd_undump_bdd_step(cmu_bdd_manager bddm,
+		    bdd *vars,
+		    FILE *fp,
+		    bdd_index_type number_vars,
+		    bdd *shared,
+		    long number_shared,
+		    long *shared_so_far,
+		    int index_size,
+		    int node_number_size,
+		    int *error)
+{
+  long node_number;
+  long encoding;
+  bdd_index_type i;
+  INT_PTR value1, value2;
+  bdd v;
+  bdd temp1, temp2;
+  bdd result;
+
+  i=read(error, index_size, fp);
+  if (*error)
+    return ((bdd)0);
+  if (i == index_mask[index_size-1])
+    {
+      encoding=0xffffff00l+read(error, 1, fp);
+      if (*error)
+	return ((bdd)0);
+      switch (encoding)
+	{
+	case TRUE_ENCODING:
+	  return (BDD_ONE(bddm));
+	case FALSE_ENCODING:
+	  return (BDD_ZERO(bddm));
+	case CONSTANT_ENCODING:
+	  value1=read(error, sizeof(long), fp);
+	  value2=read(error, sizeof(long), fp);
+	  if (*error)
+	    return ((bdd)0);
+	  if ((result=cmu_mtbdd_get_terminal(bddm, value1, value2)))
+	    return (result);
+	  *error=BDD_UNDUMP_OVERFLOW;
+	  return ((bdd)0);
+	case POSVAR_ENCODING:
+	case NEGVAR_ENCODING:
+	  i=read(error, index_size, fp);
+	  if (!*error && i >= number_vars)
+	    *error=BDD_UNDUMP_FORMAT;
+	  if (*error)
+	    return ((bdd)0);
+	  v=vars[i];
+	  if (encoding == POSVAR_ENCODING)
+	    return (v);
+	  else
+	    return (BDD_NOT(v));
+	case POSNODE_ENCODING:
+	case NEGNODE_ENCODING:
+	  node_number=read(error, node_number_size, fp);
+	  if (!*error && (node_number >= number_shared || !shared[node_number]))
+	    *error=BDD_UNDUMP_FORMAT;
+	  if (*error)
+	    return ((bdd)0);
+	  v=shared[node_number];
+	  v=cmu_bdd_identity(bddm, v);
+	  if (encoding == POSNODE_ENCODING)
+	    return (v);
+	  else
+	    return (BDD_NOT(v));
+	case NODELABEL_ENCODING:
+	  node_number= *shared_so_far;
+	  ++*shared_so_far;
+	  v=cmu_bdd_undump_bdd_step(bddm, vars, fp, number_vars, shared, number_shared,
+				shared_so_far, index_size, node_number_size, error);
+	  shared[node_number]=v;
+	  v=cmu_bdd_identity(bddm, v);
+	  return (v);
+	default:
+	  *error=BDD_UNDUMP_FORMAT;
+	  return ((bdd)0);
+	}
+    }
+  if (i >= number_vars)
+    {
+      *error=BDD_UNDUMP_FORMAT;
+      return ((bdd)0);
+    }
+  temp1=cmu_bdd_undump_bdd_step(bddm, vars, fp, number_vars, shared, number_shared,
+			    shared_so_far, index_size, node_number_size, error);
+  temp2=cmu_bdd_undump_bdd_step(bddm, vars, fp, number_vars, shared, number_shared,
+			    shared_so_far, index_size, node_number_size, error);
+  if (*error)
+    {
+      cmu_bdd_free(bddm, temp1);
+      return ((bdd)0);
+    }
+  result=cmu_bdd_ite(bddm, vars[i], temp1, temp2);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  if (!result)
+    *error=BDD_UNDUMP_OVERFLOW;
+  return (result);
+}
+
+
+bdd
+cmu_bdd_undump_bdd(cmu_bdd_manager bddm, bdd *vars, FILE *fp, int *error)
+{
+  long i;
+  bdd_index_type number_vars;
+  long number_shared;
+  int index_size;
+  int node_number_size;
+  bdd *shared;
+  long shared_so_far;
+  bdd v;
+  bdd result;
+
+  *error=0;
+  for (i=0; vars[i]; ++i)
+    if (cmu_bdd_type(bddm, vars[i]) != BDD_TYPE_POSVAR)
+      {
+	cmu_bdd_warning("cmu_bdd_undump_bdd: support is not all positive variables");
+	return ((bdd)0);
+      }
+  if (read(error, sizeof(long), fp) != MAGIC_COOKIE)
+    {
+      if (!*error)
+	*error=BDD_UNDUMP_FORMAT;
+      return ((bdd)0);
+    }
+  number_vars=read(error, sizeof(bdd_index_type), fp);
+  if (*error)
+    return ((bdd)0);
+  if (number_vars != i)
+    {
+      *error=BDD_UNDUMP_FORMAT;
+      return ((bdd)0);
+    }
+  number_shared=read(error, sizeof(long), fp);
+  if (*error)
+    return ((bdd)0);
+  index_size=bytes_needed(number_vars+1);
+  node_number_size=bytes_needed(number_shared);
+  if (number_shared < 0)
+    {
+      *error=BDD_UNDUMP_FORMAT;
+      return ((bdd)0);
+    }
+  shared=(bdd *)mem_get_block((SIZE_T)(number_shared*sizeof(bdd)));
+  for (i=0; i < number_shared; ++i)
+    shared[i]=0;
+  shared_so_far=0;
+  result=cmu_bdd_undump_bdd_step(bddm, vars, fp, number_vars, shared, number_shared,
+			     &shared_so_far, index_size, node_number_size, error);
+  for (i=0; i < number_shared; ++i)
+    if ((v=shared[i]))
+      cmu_bdd_free(bddm, v);
+  if (!*error && shared_so_far != number_shared)
+    *error=BDD_UNDUMP_FORMAT;
+  mem_free_block((pointer)shared);
+  if (*error)
+    {
+      if (result)
+	cmu_bdd_free(bddm, result);
+      return ((bdd)0);
+    }
+  return (result);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddhash.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddhash.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddhash.c	(revision 6)
@@ -0,0 +1,121 @@
+/* BDD hash table routines */
+
+
+#include "bddint.h"
+
+
+#define HASH(d) ((INT_PTR)(d))
+
+
+/* bdd_rehash_hash_table(h) increases the size of h by roughly a */
+/* factor of 2 and rehashes all of its entries. */
+
+static
+void
+bdd_rehash_hash_table(hash_table h)
+{
+  long i;
+  long hash;
+  long oldsize;
+  hash_rec *newtable;
+  hash_rec p, q;
+
+  oldsize=h->size;
+  h->size_index++;
+  h->size=TABLE_SIZE(h->size_index);
+  newtable=(hash_rec *)mem_get_block((SIZE_T)(h->size*sizeof(hash_rec)));
+  for (i=0; i < h->size; ++i)
+    newtable[i]=0;
+  for (i=0; i < oldsize; ++i)
+    for (p=h->table[i]; p; p=q)
+      {
+	q=p->next;
+	hash=HASH(p->key);
+	BDD_REDUCE(hash, h->size);
+	p->next=newtable[hash];
+	newtable[hash]=p;
+      }
+  mem_free_block((pointer)h->table);
+  h->table=newtable;
+}
+
+
+/* bdd_insert_in_hash_table(h, f, data) associates the specified data */
+/* with f in h. */
+
+void
+bdd_insert_in_hash_table(hash_table h, bdd f, pointer data)
+{
+  long hash;
+  hash_rec p;
+
+  p=(hash_rec)BDD_NEW_REC(h->bddm, ALIGN(sizeof(struct hash_rec_))+h->item_size);
+  p->key=f;
+  mem_copy((pointer)(ALIGN(sizeof(struct hash_rec_))+(INT_PTR)p), data, (SIZE_T)h->item_size);
+  hash=HASH(f);
+  BDD_REDUCE(hash, h->size);
+  p->next=h->table[hash];
+  h->table[hash]=p;
+  h->entries++;
+  if ((h->size << 2) < h->entries)
+    bdd_rehash_hash_table(h);
+}
+
+
+/* bdd_lookup_in_hash_table(h, f) looks up f in h and returns either a */
+/* pointer to the associated data or null. */
+
+pointer
+bdd_lookup_in_hash_table(hash_table h, bdd f)
+{
+  long hash;
+  hash_rec p;
+
+  hash=HASH(f);
+  BDD_REDUCE(hash, h->size);
+  for (p=h->table[hash]; p; p=p->next)
+    if (p->key == f)
+      return ((pointer)(ALIGN(sizeof(struct hash_rec_))+(char *)p));
+  return ((pointer)0);
+}
+
+
+/* bdd_new_hash_table(bddm, item_size) creates a new hash table with */
+/* the specified data item size. */
+
+hash_table
+bdd_new_hash_table(cmu_bdd_manager bddm, int item_size)
+{
+  long i;
+  hash_table h;
+
+  h=(hash_table)BDD_NEW_REC(bddm, sizeof(struct hash_table_));
+  h->size_index=10;
+  h->size=TABLE_SIZE(h->size_index);
+  h->table=(hash_rec *)mem_get_block((SIZE_T)(h->size*sizeof(hash_rec)));
+  for (i=0; i < h->size; ++i)
+    h->table[i]=0;
+  h->entries=0;
+  h->item_size=item_size;
+  h->bddm=bddm;
+  return (h);
+}
+
+
+/* cmu_bdd_free_hash_table(h) frees up the storage associated with h. */
+
+void
+cmu_bdd_free_hash_table(hash_table h)
+{
+  long i;
+  hash_rec p, q;
+
+  for (i=0; i < h->size; ++i)
+    for (p=h->table[i]; p; p=q)
+      {
+	q=p->next;
+	BDD_FREE_REC(h->bddm, (pointer)p, ALIGN(sizeof(struct hash_rec_))+h->item_size);
+      }
+  mem_free_block((pointer)h->table);
+  BDD_FREE_REC(h->bddm, (pointer)h, sizeof(struct hash_table_));
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddint.h
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddint.h	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddint.h	(revision 6)
@@ -0,0 +1,720 @@
+/* BDD package internal definitions */
+
+
+#if !defined(_BDDINTH)
+#define _BDDINTH
+
+
+#include <setjmp.h>
+
+
+/* >>> Configuration things */
+
+/* Define this for cache and unique sizes to be a power of 2. */
+/* Probably not a good idea given the current simplistic hash function. */
+
+/* #define POWER_OF_2_SIZES */
+
+/* Define this if your C preprocessor is broken in such a way that */
+/* token concatenation can be done with something like: */
+/* #define CONCAT(f, g) f/''/g */
+/* where /''/ above would be an empty comment (' => *) if this */
+/* wasn't itself a comment.  Most of the (non-ANSI) UNIX C preprocessors */
+/* do seem to be broken, which is why this is defined.  If your C */
+/* preprocessor is ANSI, this shouldn't have any effect. */
+
+#define BROKEN_CPP
+
+
+
+/* >>> All user-visible stuff */
+
+#include "bdduser.h"
+
+
+#define ARGS(args) args
+
+
+/* Miscellaneous type definitions */
+
+typedef struct hash_table_ *hash_table;
+
+
+/* >>> BDD data structures */
+
+#if !defined(POWER_OF_2_SIZES)
+extern long bdd_primes[];
+#endif
+
+
+/* Pointer tagging stuff */
+
+#define POINTER(p) ((pointer)(((INT_PTR)(p)) & ~(INT_PTR)0x7))
+#define BDD_POINTER(p) ((bdd)POINTER(p))
+#define CACHE_POINTER(p) ((cache_entry)POINTER(p))
+
+#define TAG(p) ((int)(((INT_PTR)(p)) & 0x7))
+#define SET_TAG(p, t) ((pointer)((INT_PTR)POINTER(p) | (t)))
+
+#define TAG0(p) ((int)((INT_PTR)(p) & 0x1))
+#define FLIP_TAG0(p) ((pointer)((INT_PTR)(p) ^ 0x1))
+#define TAG0_HI(p) ((pointer)((INT_PTR)(p) | 0x1))
+#define TAG0_LO(p) ((pointer)((INT_PTR)(p) & ~(INT_PTR)0x1))
+
+#define TAG1(p) ((int)((INT_PTR)(p) & 0x2))
+#define FLIP_TAG1(p) ((pointer)((INT_PTR)(p) ^ 0x2))
+#define TAG1_HI(p) ((pointer)((INT_PTR)(p) | 0x2))
+#define TAG1_LO(p) ((pointer)((INT_PTR)(p) & ~(INT_PTR)0x2))
+
+#define TAG2(p) ((int)((INT_PTR)(p) & 0x4))
+#define FLIP_TAG2(p) ((pointer)((INT_PTR)(p) ^ 0x4))
+#define TAG2_HI(p) ((pointer)((INT_PTR)(p) | 0x4))
+#define TAG2_LO(p) ((pointer)((INT_PTR)(p) & ~(INT_PTR)0x4))
+
+
+/* Indexes */
+
+typedef unsigned short bdd_index_type;
+
+
+/* Types of various BDD node fields */
+
+typedef unsigned short bdd_indexindex_type;
+typedef unsigned char bdd_refcount_type;
+typedef unsigned char bdd_mark_type;
+
+
+/* A BDD node */
+
+struct bdd_
+{
+  bdd_indexindex_type indexindex;
+				/* Index into indexes table */
+  bdd_refcount_type refs;	/* External reference count */
+  bdd_mark_type mark;		/* Mark and temporary ref count */
+  INT_PTR data[2];		/* Then and else pointers, or data */
+				/* values for terminals */
+  struct bdd_ *next;
+};
+
+
+/* Maximum reference counts */
+
+#define BDD_MAX_REFS ((bdd_refcount_type)((1l << (8*sizeof(bdd_refcount_type))) - 1))
+#define BDD_MAX_TEMP_REFS ((bdd_mark_type)((1l << (8*sizeof(bdd_mark_type)-1)) - 1))
+
+#define BDD_GC_MARK ((bdd_mark_type)(1l << (8*sizeof(bdd_mark_type)-1)))
+
+
+/* Special indexindexes and indexes */
+
+#define BDD_CONST_INDEXINDEX 0
+#define BDD_MAX_INDEXINDEX ((bdd_indexindex_type)((1l << (8*sizeof(bdd_indexindex_type))) - 1))
+#define BDD_MAX_INDEX ((bdd_index_type)((1l << (8*sizeof(bdd_index_type))) - 1))
+
+
+/* Can this be done legally with a non-ANSI cpp? */
+
+#define CONCAT_PTR(f) f##_ptr
+
+#if defined(CONCAT_PTR)
+/* Field accessing stuff */
+
+#define BDD_SETUP(f) bdd CONCAT_PTR(f)=BDD_POINTER(f)
+#define BDD_RESET(f) CONCAT_PTR(f)=BDD_POINTER(f)
+#define BDD_INDEXINDEX(f) (CONCAT_PTR(f)->indexindex)
+#define BDD_DATA(f) (CONCAT_PTR(f)->data)
+#define BDD_DATA0(f) (CONCAT_PTR(f)->data[0])
+#define BDD_DATA1(f) (CONCAT_PTR(f)->data[1])
+#define BDD_REFS(f) (CONCAT_PTR(f)->refs)
+#define BDD_MARK(f) (CONCAT_PTR(f)->mark)
+#define BDD_TEMP_REFS(f) (CONCAT_PTR(f)->mark)
+
+
+/* Basic stuff stuff for indexes, testing, etc. */
+
+#define BDD_INDEX(bddm, f) ((bddm)->indexes[BDD_INDEXINDEX(f)])
+#define BDD_THEN(f) ((bdd)(BDD_DATA0(f) ^ TAG0(f)))
+#define BDD_ELSE(f) ((bdd)(BDD_DATA1(f) ^ TAG0(f)))
+#define BDD_SAME_OR_NEGATIONS(f, g) (CONCAT_PTR(f) == CONCAT_PTR(g))
+#define BDD_IS_CONST(f) (BDD_INDEXINDEX(f) == BDD_CONST_INDEXINDEX)
+#else
+/* Field accessing stuff */
+
+#define BDD_SETUP(f)
+#define BDD_RESET(f)
+#define BDD_INDEXINDEX(f) (BDD_POINTER(f)->indexindex)
+#define BDD_DATA(f) (BDD_POINTER(f)->data)
+#define BDD_DATA0(f) (BDD_POINTER(f)->data[0])
+#define BDD_DATA1(f) (BDD_POINTER(f)->data[1])
+#define BDD_REFS(f) (BDD_POINTER(f)->refs)
+#define BDD_MARK(f) (BDD_POINTER(f)->mark)
+#define BDD_TEMP_REFS(f) (BDD_POINTER(f)->mark)
+
+
+/* Basic stuff stuff for indexes, testing, etc. */
+
+#define BDD_INDEX(bddm, f) ((bddm)->indexes[BDD_INDEXINDEX(f)])
+#define BDD_THEN(f) ((bdd)(BDD_DATA0(f) ^ TAG0(f)))
+#define BDD_ELSE(f) ((bdd)(BDD_DATA1(f) ^ TAG0(f)))
+#define BDD_SAME_OR_NEGATIONS(f, g) (BDD_POINTER(f) == BDD_POINTER(g))
+#define BDD_IS_CONST(f) (BDD_INDEXINDEX(f) == BDD_CONST_INDEXINDEX)
+#endif
+
+
+/* BDD complement flag stuff */
+
+#define BDD_IS_OUTPOS(f) (!TAG0(f))
+#define BDD_OUTPOS(f) ((bdd)TAG0_LO(f))
+#define BDD_NOT(f) ((bdd)FLIP_TAG0(f))
+
+
+/* Cofactoring stuff */
+
+#define BDD_TOP_VAR2(top_indexindex, bddm, f, g)\
+do\
+  if (BDD_INDEX(bddm, f) < BDD_INDEX(bddm, g))\
+    top_indexindex=BDD_INDEXINDEX(f);\
+  else\
+    top_indexindex=BDD_INDEXINDEX(g);\
+while (0)
+
+#define BDD_TOP_VAR3(top_indexindex, bddm, f, g, h)\
+do\
+  if (BDD_INDEX(bddm, f) < BDD_INDEX(bddm, g))\
+    {\
+      top_indexindex=BDD_INDEXINDEX(f);\
+      if ((bddm)->indexes[top_indexindex] > BDD_INDEX(bddm, h))\
+	top_indexindex=BDD_INDEXINDEX(h);\
+    }\
+  else\
+    {\
+      top_indexindex=BDD_INDEXINDEX(g);\
+      if ((bddm)->indexes[top_indexindex] > BDD_INDEX(bddm, h))\
+	top_indexindex=BDD_INDEXINDEX(h);\
+    }\
+while (0)
+
+#define BDD_COFACTOR(top_indexindex, f, f_then, f_else)\
+do\
+  if (BDD_INDEXINDEX(f) == top_indexindex)\
+    {\
+      f_then=BDD_THEN(f);\
+      f_else=BDD_ELSE(f);\
+    }\
+  else\
+    {\
+      f_then=f;\
+      f_else=f;\
+    }\
+while (0)
+
+
+/* Ordering stuff */
+
+#define BDD_OUT_OF_ORDER(f, g) ((INT_PTR)f > (INT_PTR)g)
+
+#if defined(CONCAT_PTR)
+#define BDD_SWAP(f, g)\
+do\
+  {\
+    bdd _temp;\
+    _temp=f;\
+    f=g;\
+    g=_temp;\
+    _temp=CONCAT_PTR(f);\
+    CONCAT_PTR(f)=CONCAT_PTR(g);\
+    CONCAT_PTR(g)=_temp;\
+  }\
+while (0)
+#else
+#define BDD_SWAP(f, g)\
+do\
+  {\
+    bdd _temp;\
+    _temp=f;\
+    f=g;\
+    g=_temp;\
+  }\
+while (0)
+#endif
+
+
+/* This gets the variable at the top of a node. */
+
+#define BDD_IF(bddm, f) ((bddm)->variables[BDD_INDEXINDEX(f)])
+
+
+/* Reference count stuff */
+
+#define BDD_INCREFS(f)\
+do\
+  {\
+    if (BDD_REFS(f) >= BDD_MAX_REFS-1)\
+      {\
+	BDD_REFS(f)=BDD_MAX_REFS;\
+	BDD_TEMP_REFS(f)=0;\
+      }\
+   else\
+     BDD_REFS(f)++;\
+  }\
+while (0)
+
+#define BDD_DECREFS(f)\
+do\
+  {\
+    if (BDD_REFS(f) < BDD_MAX_REFS)\
+      BDD_REFS(f)--;\
+  }\
+while (0)
+
+#define BDD_TEMP_INCREFS(f)\
+do\
+  {\
+    if (BDD_REFS(f) < BDD_MAX_REFS)\
+      {\
+	BDD_TEMP_REFS(f)++;\
+	if (BDD_TEMP_REFS(f) == BDD_MAX_TEMP_REFS)\
+	  {\
+	    BDD_REFS(f)=BDD_MAX_REFS;\
+	    BDD_TEMP_REFS(f)=0;\
+	  }\
+      }\
+  }\
+while (0)
+
+#define BDD_TEMP_DECREFS(f)\
+do\
+  {\
+    if (BDD_REFS(f) < BDD_MAX_REFS)\
+      BDD_TEMP_REFS(f)--;\
+  }\
+while (0)
+
+#define BDD_IS_USED(f) ((BDD_MARK(f) & BDD_GC_MARK) != 0)
+
+
+/* Convert an internal reference to an external one and return. */
+
+#define RETURN_BDD(thing)\
+return (bdd_make_external(thing))
+
+
+/* These return the constants. */
+
+#define BDD_ONE(bddm) ((bddm)->one)
+#define BDD_ZERO(bddm) ((bddm)->zero)
+
+
+/* Cache entries */
+
+struct cache_entry_
+{
+  INT_PTR slot[4];
+};
+
+typedef struct cache_entry_ *cache_entry;
+
+
+/* Cache entry tags; ITE is for IF-THEN-ELSE operations.  TWO is for */
+/* the two argument operations that return a BDD result.  ONEDATA */
+/* and TWODATA are for one and two argument operations that return */
+/* double and single word data results.  Everything else is under */
+/* user control. */
+
+#define CACHE_TYPE_ITE 0x0
+#define CACHE_TYPE_TWO 0x1
+#define CACHE_TYPE_ONEDATA 0x2
+#define CACHE_TYPE_TWODATA 0x3
+#define CACHE_TYPE_USER1 0x4
+
+#define USER_ENTRY_TYPES 4
+
+
+/* Operation numbers (for CACHE_TYPE_TWO) */
+/* OP_RELPROD, OP_QNT and OP_SUBST need a reasonable number of holes */
+/* after them since the variable association number is added to them */
+/* to get the actual op.  OP_COMP, OP_SWAP and OP_CMPTO need */
+/* BDD_MAX_INDEX.  OP_SWAPAUX needs 2*BDD_MAX_INDEX.  Negative */
+/* operation numbers denote temporaries and are generated as needed. */
+
+#define OP_COFACTOR 100l
+#define OP_SATFRAC 200l
+#define OP_FWD 300l
+#define OP_REV 400l
+#define OP_RED 500l
+#define OP_EQUAL 600l
+#define OP_QNT 10000l
+#define OP_RELPROD 20000l
+#define OP_SUBST 30000l
+#define OP_COMP 100000l
+#define OP_CMPTO 200000l
+#define OP_SWAP 300000l
+#define OP_SWAPAUX 400000l
+
+
+/* Variable associations */
+
+struct var_assoc_
+{
+  bdd *assoc;			/* Array with associated BDDs */
+  long last;			/* Indexindex for lowest variable */
+};
+
+typedef struct var_assoc_ *var_assoc;
+
+
+struct assoc_list_
+{
+  struct var_assoc_ va;		/* The association */
+  int id;			/* Identifier for this association */
+  int refs;			/* Number of outstanding references */
+  struct assoc_list_ *next;	/* The next association */
+};
+
+typedef struct assoc_list_ *assoc_list;
+
+
+/* Variable blocks */
+
+struct block_
+{
+  long num_children;
+  struct block_ **children;
+  int reorderable;
+  long first_index;
+  long last_index;
+};
+
+
+/* A cache bin; the cache is two-way associative. */
+
+struct cache_bin_
+{
+  cache_entry entry[2];		/* LRU has index 1 */
+};
+
+typedef struct cache_bin_ cache_bin;
+
+
+/* The cache */
+
+struct cache_
+{
+  cache_bin *table;		/* The cache itself */
+  int size_index;		/* Index giving number of cache lines */
+  long size;			/* Number of cache lines */
+  int cache_level;		/* Bin to start search in cache */
+				/* Cache control functions: */
+  long (*rehash_fn[8]) ARGS((cmu_bdd_manager, cache_entry));
+				/* Rehashes a cache entry */
+  int (*gc_fn[8]) ARGS((cmu_bdd_manager, cache_entry));
+				/* Checks to see if an entry needs flushing */
+  void (*purge_fn[8]) ARGS((cmu_bdd_manager, cache_entry));
+				/* Called when purging an entry */
+  void (*return_fn[8]) ARGS((cmu_bdd_manager, cache_entry));
+				/* Called before returning from cache hit */
+  int (*flush_fn[8]) ARGS((cmu_bdd_manager, cache_entry, pointer));
+				/* Called when freeing variable association */
+  int cache_ratio;		/* Cache to unique table size ratio */
+  long entries;			/* Number of cache entries */
+  long lookups;			/* Number of cache lookups */
+  long hits;			/* Number of cache hits */
+  long inserts;			/* Number of cache inserts */
+  long collisions;		/* Number of cache collisions */
+};
+
+typedef struct cache_ cache;
+
+
+/* One part of the node table */
+
+struct var_table_
+{
+  bdd *table;			/* Pointers to the start of each bucket */
+  int size_index;		/* Index giving number of buckets */
+  long size;			/* Number of buckets */
+  long entries;			/* Number of BDD nodes in table */
+};
+
+typedef struct var_table_ *var_table;
+
+
+/* The BDD node table */
+
+struct unique_
+{
+  var_table *tables;		/* Individual variable tables */
+  void (*free_terminal_fn) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer));
+				/* Called when freeing MTBDD terminals */
+  pointer free_terminal_env;	/* Environment for free terminal function */
+  long entries;			/* Total number of BDD nodes */
+  long gc_limit;		/* Try garbage collection at this point */
+  long node_limit;		/* Maximum number of BDD nodes allowed */
+  long gcs;			/* Number of garbage collections */
+  long freed;			/* Number of nodes freed */
+  long finds;			/* Number of find operations */
+};
+
+typedef struct unique_ unique;
+
+
+/* Record manager size range stuff */
+
+#define MIN_REC_SIZE ALLOC_ALIGNMENT
+#define MAX_REC_SIZE 64
+
+#define REC_MGRS (((MAX_REC_SIZE-MIN_REC_SIZE)/ALLOC_ALIGNMENT)+1)
+
+
+/* Wrapper for jmp_buf since we may need to copy it sometimes and */
+/* we can't easily do it if it happens to be an array. */
+
+struct jump_buf_
+{
+  jmp_buf context;
+};
+
+typedef struct jump_buf_ jump_buf;
+
+
+/* A BDD manager */
+
+struct bdd_manager_
+{
+  unique unique_table;		/* BDD node table */
+  cache op_cache;		/* System result cache */
+  int check;			/* Number of find calls 'til size checks */
+  bdd one;			/* BDD for one */
+  bdd zero;			/* BDD for zero */
+  int overflow;			/* Nonzero if node limit exceeded */
+  void (*overflow_fn) ARGS((cmu_bdd_manager, pointer));
+				/* Function to call on overflow */
+  pointer overflow_env;		/* Environment for overflow function */
+  void (*transform_fn) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, INT_PTR *, INT_PTR *, pointer));
+				/* Function to transform terminal values */
+  pointer transform_env;	/* Environment for transform_fn */
+  int (*canonical_fn) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer));
+				/* Function to check if a terminal value is */
+				/* canonical */
+  block super_block;		/* Top-level variable block */
+  void (*reorder_fn) ARGS((cmu_bdd_manager));
+				/* Function to call to reorder variables */
+  pointer reorder_data;		/* For saving information btwn reorderings */
+  int allow_reordering;		/* Nonzero if reordering allowed */
+  long nodes_at_start;		/* Nodes at start of operation */
+  long vars;			/* Number of variables */
+  long maxvars;			/* Maximum number of variables w/o resize */
+  bdd *variables;		/* Array of variables, by indexindex */
+  bdd_index_type *indexes;	/* indexindex -> index table */
+  bdd_indexindex_type *indexindexes;
+				/* index -> indexindex table */
+  int curr_assoc_id;		/* Current variable association number */
+  var_assoc curr_assoc;		/* Current variable association */
+  assoc_list assocs;		/* Variable associations */
+  struct var_assoc_ temp_assoc;	/* Temporary variable association */
+  rec_mgr rms[REC_MGRS];	/* Record managers */
+  long temp_op;			/* Current temporary operation number */
+  jump_buf abort;		/* Jump for out-of-memory cleanup */
+  void (*bag_it_fn) ARGS((cmu_bdd_manager, pointer));
+				/* Non-null if going to abort at next find */
+  pointer bag_it_env; char *hooks;		/* Environment for bag it function */
+};
+
+
+/* Abort stuff */
+
+#define BDD_ABORTED 1
+#define BDD_OVERFLOWED 2
+#define BDD_REORDERED 3
+
+
+#define FIREWALL(bddm)\
+do\
+  {\
+    int retcode;\
+    (bddm)->allow_reordering=1;\
+    (bddm)->nodes_at_start=(bddm)->unique_table.entries;\
+    while ((retcode=(setjmp((bddm)->abort.context))))\
+      {\
+	bdd_cleanup(bddm, retcode);\
+	if (retcode == BDD_ABORTED || retcode == BDD_OVERFLOWED)\
+	  return ((bdd)0);\
+	(bddm)->nodes_at_start=(bddm)->unique_table.entries;\
+      }\
+  }\
+while (0)
+
+
+#define FIREWALL1(bddm, cleanupcode)\
+do\
+  {\
+    int retcode;\
+    (bddm)->allow_reordering=1;\
+    (bddm)->nodes_at_start=(bddm)->unique_table.entries;\
+    while ((retcode=(setjmp((bddm)->abort.context))))\
+      {\
+	bdd_cleanup(bddm, retcode);\
+	cleanupcode\
+	(bddm)->nodes_at_start=(bddm)->unique_table.entries;\
+      }\
+  }\
+while (0)
+
+
+/* Node hash function */
+
+#define HASH_NODE(f, g) (((f) << 1)+(g))
+
+
+/* Table size stuff */
+
+#if defined(POWER_OF_2_SIZES)
+#define TABLE_SIZE(size_index) (1l << (size_index))
+#define BDD_REDUCE(i, size) (i)&=(size)-1
+#else
+#define TABLE_SIZE(size_index) (bdd_primes[size_index])
+#define BDD_REDUCE(i, size)\
+do\
+  {\
+    (i)%=(size);\
+    if ((i) < 0)\
+      (i)= -(i);\
+  }\
+while (0)
+#endif
+
+
+/* Record management */
+
+#define BDD_NEW_REC(bddm, size) mem_new_rec((bddm)->rms[(ROUNDUP(size)-MIN_REC_SIZE)/ALLOC_ALIGNMENT])
+#define BDD_FREE_REC(bddm, rec, size) mem_free_rec((bddm)->rms[(ROUNDUP(size)-MIN_REC_SIZE)/ALLOC_ALIGNMENT], (rec))
+
+
+/* >>> Declarations for random routines */
+
+/* Internal BDD routines */
+
+extern int bdd_check_arguments ARGS((int, ...));
+extern void bdd_check_array ARGS((bdd *));
+extern bdd bdd_make_external ARGS((bdd));
+extern int cmu_bdd_type_aux ARGS((cmu_bdd_manager, bdd));
+extern int cmu_bdd_is_cube ARGS((cmu_bdd_manager, bdd));
+extern void bdd_rehash_var_table ARGS((var_table, int));
+extern bdd bdd_find_aux ARGS((cmu_bdd_manager, bdd_indexindex_type, INT_PTR, INT_PTR));
+extern bdd cmu_bdd_ite_step ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern bdd cmu_bdd_exists_temp ARGS((cmu_bdd_manager, bdd, long));
+extern bdd cmu_bdd_compose_temp ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern bdd cmu_bdd_substitute_step ARGS((cmu_bdd_manager, bdd, long, bdd (*) ARGS((cmu_bdd_manager, bdd, bdd, bdd)), var_assoc));
+extern bdd cmu_bdd_swap_vars_temp ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern int cmu_bdd_compare_temp ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern double cmu_bdd_satisfying_fraction_step ARGS((cmu_bdd_manager, bdd));
+extern void bdd_mark_shared_nodes ARGS((cmu_bdd_manager, bdd));
+extern void bdd_number_shared_nodes ARGS((cmu_bdd_manager, bdd, hash_table, long *));
+extern char *bdd_terminal_id ARGS((cmu_bdd_manager, bdd, char *(*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)), pointer));
+extern char *bdd_var_name ARGS((cmu_bdd_manager, bdd, char *(*) ARGS((cmu_bdd_manager, bdd, pointer)), pointer));
+extern long bdd_find_block ARGS((block, long));
+extern void bdd_block_delta ARGS((block, long));
+extern void cmu_bdd_reorder_aux ARGS((cmu_bdd_manager));
+extern void cmu_mtbdd_terminal_value_aux ARGS((cmu_bdd_manager, bdd, INT_PTR *, INT_PTR *));
+
+
+/* System cache routines */
+
+extern void bdd_insert_in_cache31 ARGS((cmu_bdd_manager, int, INT_PTR, INT_PTR, INT_PTR, INT_PTR));
+extern int bdd_lookup_in_cache31 ARGS((cmu_bdd_manager, int, INT_PTR, INT_PTR, INT_PTR, INT_PTR *));
+extern void bdd_insert_in_cache22 ARGS((cmu_bdd_manager, int, INT_PTR, INT_PTR, INT_PTR, INT_PTR));
+extern int bdd_lookup_in_cache22 ARGS((cmu_bdd_manager, int, INT_PTR, INT_PTR, INT_PTR *, INT_PTR *));
+extern void bdd_insert_in_cache13 ARGS((cmu_bdd_manager, int, INT_PTR, INT_PTR, INT_PTR, INT_PTR));
+extern int bdd_lookup_in_cache13 ARGS((cmu_bdd_manager, int, INT_PTR, INT_PTR *, INT_PTR *, INT_PTR *));
+extern void bdd_flush_cache ARGS((cmu_bdd_manager, int (*) ARGS((cmu_bdd_manager, cache_entry, pointer)), pointer));
+extern void bdd_purge_cache ARGS((cmu_bdd_manager));
+extern void bdd_flush_all ARGS((cmu_bdd_manager));
+extern int bdd_cache_functions ARGS((cmu_bdd_manager,
+				     int,
+				     int (*) ARGS((cmu_bdd_manager, cache_entry)),
+				     void (*) ARGS((cmu_bdd_manager, cache_entry)),
+				     void (*) ARGS((cmu_bdd_manager,cache_entry)),
+				     int (*) ARGS((cmu_bdd_manager, cache_entry, pointer))));
+extern void cmu_bdd_free_cache_tag ARGS((cmu_bdd_manager, long));
+extern void bdd_rehash_cache ARGS((cmu_bdd_manager, int));
+extern void cmu_bdd_init_cache ARGS((cmu_bdd_manager));
+extern void cmu_bdd_free_cache ARGS((cmu_bdd_manager));
+
+#define bdd_insert_in_cache2(bddm, op, f, g, result)\
+bdd_insert_in_cache31((bddm), CACHE_TYPE_TWO, (INT_PTR)(op), (INT_PTR)(f), (INT_PTR)(g), (INT_PTR)(result))
+#define bdd_lookup_in_cache2(bddm, op, f, g, result)\
+bdd_lookup_in_cache31((bddm), CACHE_TYPE_TWO, (INT_PTR)(op), (INT_PTR)(f), (INT_PTR)(g), (INT_PTR *)(result))
+
+#define bdd_insert_in_cache1(bddm, op, f, result)\
+bdd_insert_in_cache2((bddm), (op), (f), BDD_ONE(bddm), (result))
+#define bdd_lookup_in_cache1(bddm, op, f, result)\
+bdd_lookup_in_cache2((bddm), (op), (f), BDD_ONE(bddm), (result))
+
+#define bdd_insert_in_cache2d(bddm, op, f, g, result)\
+bdd_insert_in_cache31((bddm), CACHE_TYPE_TWODATA, (INT_PTR)(op), (INT_PTR)(f), (INT_PTR)(g), (INT_PTR)(result))
+#define bdd_lookup_in_cache2d(bddm, op, f, g, result)\
+bdd_lookup_in_cache31((bddm), CACHE_TYPE_TWODATA, (INT_PTR)(op), (INT_PTR)(f), (INT_PTR)(g), (INT_PTR *)(result))
+
+#define bdd_insert_in_cache1d(bddm, op, f, result1, result2)\
+bdd_insert_in_cache22((bddm), CACHE_TYPE_ONEDATA, (INT_PTR)(op), (INT_PTR)(f), (INT_PTR)(result1), (INT_PTR)(result2))
+#define bdd_lookup_in_cache1d(bddm, op, f, result1, result2)\
+bdd_lookup_in_cache22((bddm), CACHE_TYPE_ONEDATA, (INT_PTR)(op), (INT_PTR)(f), (INT_PTR *)(result1), (INT_PTR *)(result2))
+
+#define cache_return_fn_none ((void (*)(cmu_bdd_manager, cache_entry))0)
+#define cache_purge_fn_none ((void (*)(cmu_bdd_manager, cache_entry))0)
+#define cache_reclaim_fn_none ((int (*)(cmu_bdd_manager, cache_entry, pointer))0)
+
+
+/* Unique table routines */
+
+extern void bdd_clear_temps ARGS((cmu_bdd_manager));
+extern void bdd_sweep_var_table ARGS((cmu_bdd_manager, long, int));
+extern void bdd_sweep ARGS((cmu_bdd_manager));
+extern void bdd_cleanup ARGS((cmu_bdd_manager, int));
+extern bdd bdd_find ARGS((cmu_bdd_manager, bdd_indexindex_type, bdd, bdd));
+extern bdd bdd_find_terminal ARGS((cmu_bdd_manager, INT_PTR, INT_PTR));
+extern var_table bdd_new_var_table ARGS((cmu_bdd_manager));
+extern void cmu_bdd_init_unique ARGS((cmu_bdd_manager));
+extern void cmu_bdd_free_unique ARGS((cmu_bdd_manager));
+
+
+/* Error routines */
+
+extern void cmu_bdd_fatal ARGS((char *));
+extern void cmu_bdd_warning ARGS((char *));
+
+
+/* >>> Hash table declarations */
+
+struct hash_rec_
+{
+  bdd key;
+  struct hash_rec_ *next;
+};
+
+typedef struct hash_rec_ *hash_rec;
+
+
+struct hash_table_
+{
+  hash_rec *table;
+  int size_index;
+  long size;
+  long entries;
+  int item_size;
+  cmu_bdd_manager bddm;
+};
+
+
+/* Hash table routines */
+
+extern void bdd_insert_in_hash_table ARGS((hash_table, bdd, pointer));
+extern pointer bdd_lookup_in_hash_table ARGS((hash_table, bdd));
+extern hash_table bdd_new_hash_table ARGS((cmu_bdd_manager, int));
+extern void cmu_bdd_free_hash_table ARGS((hash_table));
+
+
+#undef ARGS
+
+#endif
Index: /vis_dev/glu-2.1/src/cmuBdd/bddmisc.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddmisc.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddmisc.c	(revision 6)
@@ -0,0 +1,103 @@
+/* Support functions need by miscellaneous BDD routines */
+
+
+#include "bddint.h"
+
+
+void
+bdd_mark_shared_nodes(cmu_bdd_manager bddm, bdd f)
+{
+  BDD_SETUP(f);
+  f=BDD_OUTPOS(f);
+  if (BDD_IS_CONST(f) || cmu_bdd_type_aux(bddm, f) == BDD_TYPE_POSVAR)
+    return;
+  if (BDD_MARK(f))
+    {
+      if (BDD_MARK(f) == 1)
+	BDD_MARK(f)=2;
+      return;
+    }
+  BDD_MARK(f)=1;
+  bdd_mark_shared_nodes(bddm, BDD_THEN(f));
+  bdd_mark_shared_nodes(bddm, BDD_ELSE(f));
+}
+
+
+void
+bdd_number_shared_nodes(cmu_bdd_manager bddm, bdd f, hash_table h, long *next)
+{
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f) || ((1 << cmu_bdd_type_aux(bddm, f)) & ((1 << BDD_TYPE_POSVAR) | (1 << BDD_TYPE_NEGVAR))))
+    return;
+  if (BDD_MARK(f) == 0)
+    return;
+  if (BDD_MARK(f) == 2)
+    {
+      bdd_insert_in_hash_table(h, f, (pointer)next);
+      ++*next;
+    }
+  BDD_MARK(f)=0;
+  bdd_number_shared_nodes(bddm, BDD_THEN(f), h, next);
+  bdd_number_shared_nodes(bddm, BDD_ELSE(f), h, next);
+}
+
+
+static char default_terminal_id[]="terminal XXXXXXXXXX XXXXXXXXXX";
+static char default_var_name[]="var.XXXXXXXXXX";
+
+
+char *
+bdd_terminal_id(cmu_bdd_manager bddm, bdd f, char *(*terminal_id_fn)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer), pointer env)
+{
+  char *id;
+  INT_PTR v1, v2;
+
+  cmu_mtbdd_terminal_value_aux(bddm, f, &v1, &v2);
+  if (terminal_id_fn)
+    id=(*terminal_id_fn)(bddm, v1, v2, env);
+  else
+    id=0;
+  if (!id)
+    {
+      if (f == BDD_ONE(bddm))
+	return ("1");
+      if (f == BDD_ZERO(bddm))
+	return ("0");
+      sprintf(default_terminal_id, "terminal %ld %ld", (long)v1, (long)v2);
+      id=default_terminal_id;
+    }
+  return (id);
+}
+
+
+char *
+bdd_var_name(cmu_bdd_manager bddm, bdd v, char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer), pointer env)
+{
+  char *name;
+
+  if (var_naming_fn)
+    name=(*var_naming_fn)(bddm, v, env);
+  else
+    name=0;
+  if (!name)
+    {
+      BDD_SETUP(v);
+      sprintf(default_var_name, "var.%d", BDD_INDEX(bddm, v));
+      name=default_var_name;
+    }
+  return (name);
+}
+
+
+void
+cmu_mtbdd_terminal_value_aux(cmu_bdd_manager bddm, bdd f, INT_PTR *value1, INT_PTR *value2)
+{
+  BDD_SETUP(f);
+  if (BDD_IS_OUTPOS(f))
+    {
+      *value1=BDD_DATA0(f);
+      *value2=BDD_DATA1(f);
+    }
+  else
+    (*bddm->transform_fn)(bddm, BDD_DATA0(f), BDD_DATA1(f), value1, value2, bddm->transform_env);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddprimes.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddprimes.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddprimes.c	(revision 6)
@@ -0,0 +1,55 @@
+/* BDD routine prime numbers for table sizes */
+
+
+long bdd_primes[]=
+{
+  1,
+  2,
+  3,
+  7,
+  13,
+  23,
+  59,
+  113,
+  241,
+  503,
+  1019,
+  2039,
+  4091,
+  8179,
+  11587,
+  16369,
+  23143,
+  32749,
+  46349,
+  65521,
+  92683,
+  131063,
+  185363,
+  262139,
+  330287,
+  416147,
+  524269,
+  660557,
+  832253,
+  1048571,
+  1321109,
+  1664501,
+  2097143,
+  2642201,
+  3328979,
+  4194287,
+  5284393,
+  6657919,
+  8388593,
+  10568797,
+  13315831,
+  16777199,
+  33554393,
+  67108859,
+  134217689,
+  268435399,
+  536870879,
+  1073741789,
+  2147483629
+};
Index: /vis_dev/glu-2.1/src/cmuBdd/bddprint.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddprint.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddprint.c	(revision 6)
@@ -0,0 +1,135 @@
+/* BDD library print routines */
+
+
+#include "bddint.h"
+
+
+static
+void
+chars(char c, int n, FILE *fp)
+{
+  int i;
+
+  for (i=0; i < n; ++i)
+    fputc(c, fp);
+}
+
+
+static
+void
+bdd_print_top_var(cmu_bdd_manager bddm,
+		  bdd f,
+		  char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+		  pointer env,
+		  FILE *fp)
+{
+  BDD_SETUP(f);
+  fputs(bdd_var_name(bddm, BDD_IF(bddm, f), var_naming_fn, env), fp);
+  fputc('\n', fp);
+}
+
+
+static
+void
+cmu_bdd_print_bdd_step(cmu_bdd_manager bddm,
+		   bdd f,
+		   char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+		   char *(*terminal_id_fn)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer),
+		   pointer env,
+		   FILE *fp,
+		   hash_table h,
+		   int indentation)
+{
+  int negated;
+  long *number;
+
+  BDD_SETUP(f);
+  chars(' ', indentation, fp);
+  switch (cmu_bdd_type_aux(bddm, f))
+    {
+    case BDD_TYPE_ZERO:
+    case BDD_TYPE_ONE:
+    case BDD_TYPE_CONSTANT:
+      fputs(bdd_terminal_id(bddm, f, terminal_id_fn, env), fp);
+      fputc('\n', fp);
+      break;
+    case BDD_TYPE_NEGVAR:
+      fputc('!', fp);
+      /* fall through */
+    case BDD_TYPE_POSVAR:
+      bdd_print_top_var(bddm, f, var_naming_fn, env, fp);
+      break;
+    case BDD_TYPE_NONTERMINAL:
+      if (bdd_lookup_in_hash_table(h, BDD_NOT(f)))
+	{
+	  f=BDD_NOT(f);
+	  negated=1;
+	}
+      else
+	negated=0;
+      number=(long *)bdd_lookup_in_hash_table(h, f);
+      if (number && *number < 0)
+	{
+	  if (negated)
+	    fputc('!', fp);
+	  fprintf(fp, "subformula %ld\n", -*number-1);
+	}
+      else
+	{
+	  if (number)
+	    {
+	      fprintf(fp, "%ld: ", *number);
+	      *number= -*number-1;
+	    }
+	  fputs("if ", fp);
+	  bdd_print_top_var(bddm, f, var_naming_fn, env, fp);
+	  cmu_bdd_print_bdd_step(bddm, BDD_THEN(f), var_naming_fn, terminal_id_fn, env, fp, h, indentation+2);
+	  chars(' ', indentation, fp);
+	  fputs("else if !", fp);
+	  bdd_print_top_var(bddm, f, var_naming_fn, env, fp);
+	  cmu_bdd_print_bdd_step(bddm, BDD_ELSE(f), var_naming_fn, terminal_id_fn, env, fp, h, indentation+2);
+	  chars(' ', indentation, fp);
+	  fputs("endif ", fp);
+	  bdd_print_top_var(bddm, f, var_naming_fn, env, fp);
+	}
+      break;
+    default:
+      cmu_bdd_fatal("cmu_bdd_print_bdd_step: unknown type returned by cmu_bdd_type");
+    }
+}
+
+
+/* cmu_bdd_print_bdd(bddm, f, var_naming_fn, terminal_id_fn, env, fp) prints a */
+/* human-readable representation of f to the file given by fp.  If */
+/* var_naming_fn is non-null, it should be a pointer to a function that */
+/* assigns names to BDD variables.  It is passed bddm, a BDD representing */
+/* a variable, and the pointer given by env, and should return a string */
+/* giving the name of the variable or null.  If terminal_id_fn is */
+/* non-null, it should be a pointer to a function that formats terminal */
+/* nodes.  It is passed bddm, two longs representing the data value of */
+/* the terminal node, and env.  It should return a string for the */
+/* terminal node, or null. */
+
+void
+cmu_bdd_print_bdd(cmu_bdd_manager bddm,
+	      bdd f,
+	      char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+	      char *(*terminal_id_fn)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer),
+	      pointer env,
+	      FILE *fp)
+{
+  long next;
+  hash_table h;
+
+  if (!bdd_check_arguments(1, f))
+    {
+      fprintf(fp, "overflow\n");
+      return;
+    }
+  bdd_mark_shared_nodes(bddm, f);
+  h=bdd_new_hash_table(bddm, sizeof(long));
+  next=0;
+  bdd_number_shared_nodes(bddm, f, h, &next);
+  cmu_bdd_print_bdd_step(bddm, f, var_naming_fn, terminal_id_fn, env, fp, h, 0);
+  cmu_bdd_free_hash_table(h);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddprprofile.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddprprofile.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddprprofile.c	(revision 6)
@@ -0,0 +1,184 @@
+/* BDD library profile printing routines */
+
+
+#include "bddint.h"
+#if STDC_HEADERS
+#include <string.h>
+#endif
+
+static char profile_width[]="XXXXXXXXX";
+
+
+static
+void
+chars(char c, int n, FILE *fp)
+{
+  int i;
+
+  for (i=0; i < n; ++i)
+    fputc(c, fp);
+}
+
+
+/* cmu_bdd_print_profile_aux(bddm, level_counts, var_naming_fn, line_length, */
+/* env, fp) prints a profile to the file given by fp.  The var_naming_fn */
+/* is as in cmu_bdd_print_bdd.  line_length gives the line width to scale the */
+/* profile to. */
+
+void
+cmu_bdd_print_profile_aux(cmu_bdd_manager bddm,
+		      long *level_counts,
+		      char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+		      pointer env,
+		      int line_length,
+		      FILE *fp)
+{
+  long i, n;
+  int l;
+  char *name;
+  int max_prefix_len;
+  int max_profile_width;
+  int histogram_column;
+  int histogram_width;
+  int profile_scale;
+  long total;
+
+  n=bddm->vars;
+  /* max_... initialized with values for leaf nodes */
+  max_prefix_len=5;
+  max_profile_width=level_counts[n];
+  total=level_counts[n];
+  for (i=0; i < n; ++i)
+    if (level_counts[i])
+      {
+	sprintf(profile_width, "%ld", level_counts[i]);
+	l=strlen(bdd_var_name(bddm, bddm->variables[bddm->indexindexes[i]], var_naming_fn, env))+strlen(profile_width);
+	if (l > max_prefix_len)
+	  max_prefix_len=l;
+	if (level_counts[i] > max_profile_width)
+	  max_profile_width=level_counts[i];
+	total+=level_counts[i];
+      }
+  histogram_column=max_prefix_len+3;
+  histogram_width=line_length-histogram_column-1;
+  if (histogram_width < 20)
+    histogram_width=20;		/* Random minimum width */
+  if (histogram_width >= max_profile_width)
+    profile_scale=1;
+  else
+    profile_scale=(max_profile_width+histogram_width-1)/histogram_width;
+  for (i=0; i < n; ++i)
+    if (level_counts[i])
+      {
+	name=bdd_var_name(bddm, bddm->variables[bddm->indexindexes[i]], var_naming_fn, env);
+	fputs(name, fp);
+	fputc(':', fp);
+	sprintf(profile_width, "%ld", level_counts[i]);
+	chars(' ', (int)(max_prefix_len-strlen(name)-strlen(profile_width)+1), fp);
+	fputs(profile_width, fp);
+	fputc(' ', fp);
+	chars('#', level_counts[i]/profile_scale, fp);
+	fputc('\n', fp);
+      }
+  fputs("leaf:", fp);
+  sprintf(profile_width, "%ld", level_counts[n]);
+  chars(' ', (int)(max_prefix_len-4-strlen(profile_width)+1), fp);
+  fputs(profile_width, fp);
+  fputc(' ', fp);
+  chars('#', level_counts[n]/profile_scale, fp);
+  fputc('\n', fp);
+  fprintf(fp, "Total: %ld\n", total);
+}
+
+
+/* cmu_bdd_print_profile(bddm, f, var_naming_fn, env, line_length, fp) displays */
+/* the node profile for f on fp.  line_length specifies the maximum line */
+/* length.  var_naming_fn is as in cmu_bdd_print_bdd. */
+
+void
+cmu_bdd_print_profile(cmu_bdd_manager bddm,
+		  bdd f,
+		  char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+		  pointer env,
+		  int line_length,
+		  FILE *fp)
+{
+  long *level_counts;
+
+  if (bdd_check_arguments(1, f))
+    {
+      level_counts=(long *)mem_get_block((SIZE_T)((bddm->vars+1)*sizeof(long)));
+      cmu_bdd_profile(bddm, f, level_counts, 1);
+      cmu_bdd_print_profile_aux(bddm, level_counts, var_naming_fn, env, line_length, fp);
+      mem_free_block((pointer)level_counts);
+    }
+  else
+    fputs("overflow\n", fp);
+}
+
+
+/* cmu_bdd_print_profile_multiple is like cmu_bdd_print_profile except it displays */
+/* the profile for a set of BDDs. */
+
+void
+cmu_bdd_print_profile_multiple(cmu_bdd_manager bddm,
+			   bdd* fs,
+			   char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+			   pointer env,
+			   int line_length,
+			   FILE *fp)
+{
+  long *level_counts;
+
+  bdd_check_array(fs);
+  level_counts=(long *)mem_get_block((SIZE_T)((bddm->vars+1)*sizeof(long)));
+  cmu_bdd_profile_multiple(bddm, fs, level_counts, 1);
+  cmu_bdd_print_profile_aux(bddm, level_counts, var_naming_fn, env, line_length, fp);
+  mem_free_block((pointer)level_counts);
+}
+
+
+/* cmu_bdd_print_function_profile is like cmu_bdd_print_profile except it displays */
+/* a function profile for f. */
+
+void
+cmu_bdd_print_function_profile(cmu_bdd_manager bddm,
+			   bdd f,
+			   char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+			   pointer env,
+			   int line_length,
+			   FILE *fp)
+{
+  long *level_counts;
+
+  if (bdd_check_arguments(1, f))
+    {
+      level_counts=(long *)mem_get_block((SIZE_T)((bddm->vars+1)*sizeof(long)));
+      cmu_bdd_function_profile(bddm, f, level_counts);
+      cmu_bdd_print_profile_aux(bddm, level_counts, var_naming_fn, env, line_length, fp);
+      mem_free_block((pointer)level_counts);
+    }
+  else
+    fputs("overflow\n", fp);
+}
+
+
+/* cmu_bdd_print_function_profile_multiple is like cmu_bdd_print_function_profile */
+/* except for multiple BDDs. */
+
+void
+cmu_bdd_print_function_profile_multiple(cmu_bdd_manager bddm,
+				    bdd* fs,
+				    char *(*var_naming_fn)(cmu_bdd_manager, bdd, pointer),
+				    pointer env,
+				    int line_length,
+				    FILE *fp)
+{
+  long *level_counts;
+
+  bdd_check_array(fs);
+  level_counts=(long *)mem_get_block((SIZE_T)((bddm->vars+1)*sizeof(long)));
+  cmu_bdd_function_profile_multiple(bddm, fs, level_counts);
+  cmu_bdd_print_profile_aux(bddm, level_counts, var_naming_fn, env, line_length, fp);
+  mem_free_block((pointer)level_counts);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddqnt.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddqnt.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddqnt.c	(revision 6)
@@ -0,0 +1,93 @@
+/* BDD quantification routines */
+
+
+#include "bddint.h"
+
+
+static
+bdd
+cmu_bdd_exists_step(cmu_bdd_manager bddm, bdd f, long op, var_assoc vars)
+{
+  bdd temp1, temp2;
+  bdd result;
+  int quantifying;
+
+  BDD_SETUP(f);
+  if ((long)BDD_INDEX(bddm, f) > vars->last)
+    {
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (bdd_lookup_in_cache1(bddm, op, f, &result))
+    return (result);
+  quantifying=(vars->assoc[BDD_INDEXINDEX(f)] != 0);
+  temp1=cmu_bdd_exists_step(bddm, BDD_THEN(f), op, vars);
+  if (quantifying && temp1 == BDD_ONE(bddm))
+    result=temp1;
+  else
+    {
+      temp2=cmu_bdd_exists_step(bddm, BDD_ELSE(f), op, vars);
+      if (quantifying)
+	{
+	  BDD_SETUP(temp1);
+	  BDD_SETUP(temp2);
+	  bddm->op_cache.cache_level++;
+	  result=cmu_bdd_ite_step(bddm, temp1, BDD_ONE(bddm), temp2);
+	  BDD_TEMP_DECREFS(temp1);
+	  BDD_TEMP_DECREFS(temp2);
+	  bddm->op_cache.cache_level--;
+	}
+      else
+	result=bdd_find(bddm, BDD_INDEXINDEX(f), temp1, temp2);
+    }
+  bdd_insert_in_cache1(bddm, op, f, result);
+  return (result);
+}
+
+
+/* cmu_bdd_exists_temp is used internally by cmu_bdd_rel_prod. */
+
+bdd
+cmu_bdd_exists_temp(cmu_bdd_manager bddm, bdd f, long op)
+{
+  if (bddm->curr_assoc_id != -1)
+    op=OP_QNT+bddm->curr_assoc_id;
+  return (cmu_bdd_exists_step(bddm, f, op, bddm->curr_assoc));
+}
+
+
+/* cmu_bdd_exists(bddm, f) returns the BDD for existentially quantifying */
+/* out in f all variables which are associated with something in the */
+/* current variable association. */
+
+bdd
+cmu_bdd_exists(cmu_bdd_manager bddm, bdd f)
+{
+  long op;
+
+  if (bdd_check_arguments(1, f))
+    {
+      FIREWALL(bddm);
+      if (bddm->curr_assoc_id == -1)
+	op=bddm->temp_op--;
+      else
+	op=OP_QNT+bddm->curr_assoc_id;
+      RETURN_BDD(cmu_bdd_exists_step(bddm, f, op, bddm->curr_assoc));
+    }
+  return ((bdd)0);
+}
+
+
+/* cmu_bdd_forall(bddm, f) returns the BDD for universally quantifying */
+/* out in f all variables which are associated with something in the */
+/* current variable association. */
+
+bdd
+cmu_bdd_forall(cmu_bdd_manager bddm, bdd f)
+{
+  bdd temp;
+
+  if ((temp=cmu_bdd_exists(bddm, BDD_NOT(f))))
+    return (BDD_NOT(temp));
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddreduce.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddreduce.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddreduce.c	(revision 6)
@@ -0,0 +1,141 @@
+/* BDD reduce routines */
+
+
+#include "bddint.h"
+
+
+static
+bdd
+cmu_bdd_reduce_step(cmu_bdd_manager bddm, bdd f, bdd c)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd c1, c2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(c);
+  if (BDD_IS_CONST(c))
+    {
+      if (c == BDD_ZERO(bddm))
+	return ((bdd)0);
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (BDD_IS_CONST(f))
+    return (f);
+  if (bdd_lookup_in_cache2(bddm, OP_RED, f, c, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, c);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, c, c1, c2);
+  if (f == f1)
+    {
+      bddm->op_cache.cache_level++;
+      temp1=cmu_bdd_ite_step(bddm, c1, BDD_ONE(bddm), c2);
+      bddm->op_cache.cache_level--;
+      result=cmu_bdd_reduce_step(bddm, f, temp1);
+      {
+	BDD_SETUP(temp1);
+	BDD_TEMP_DECREFS(temp1);
+      }
+    }
+  else
+    {
+      temp1=cmu_bdd_reduce_step(bddm, f1, c1);
+      temp2=cmu_bdd_reduce_step(bddm, f2, c2);
+      if (!temp1)
+	result=temp2;
+      else if (!temp2)
+	result=temp1;
+      else
+	result=bdd_find(bddm, top_indexindex, temp1, temp2);
+    }
+  bdd_insert_in_cache2(bddm, OP_RED, f, c, result);
+  return (result);
+}
+
+
+/* cmu_bdd_reduce(bddm, f, c) returns a BDD which agrees with f for all */
+/* valuations for which c is true, and which is hopefully smaller than */
+/* f. */
+
+bdd
+cmu_bdd_reduce(cmu_bdd_manager bddm, bdd f, bdd c)
+{
+  bdd result;
+
+  if (bdd_check_arguments(2, f, c))
+    {
+      FIREWALL(bddm);
+      result=cmu_bdd_reduce_step(bddm, f, c);
+      if (!result)
+	return (BDD_ZERO(bddm));
+      RETURN_BDD(result);
+    }
+  return ((bdd)0);
+}
+
+
+static
+bdd
+cmu_bdd_cofactor_step(cmu_bdd_manager bddm, bdd f, bdd c)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd c1, c2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(c);
+  if (BDD_IS_CONST(c))
+    {
+      if (c == BDD_ZERO(bddm))
+	return ((bdd)0);
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (BDD_IS_CONST(f))
+    return (f);
+  if (bdd_lookup_in_cache2(bddm, OP_COFACTOR, f, c, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, c);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, c, c1, c2);
+  temp1=cmu_bdd_cofactor_step(bddm, f1, c1);
+  temp2=cmu_bdd_cofactor_step(bddm, f2, c2);
+  if (!temp1)
+    result=temp2;
+  else if (!temp2)
+    result=temp1;
+  else
+    result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache2(bddm, OP_COFACTOR, f, c, result);
+  return (result);
+}
+
+
+/* cmu_bdd_cofactor(bddm, f, c) returns a BDD for the generalized cofactor */
+/* of f by c.  This operation has the useful property that if */
+/* [f1, ..., fn] is a function vector and fi|c denotes the g.c. of fi */
+/* by c, then the image of [f1|c, ..., fn|c] over all valuations is */
+/* the same as the image of [f1, ..., fn] over the valuations for */
+/* which c is true. */
+
+bdd
+cmu_bdd_cofactor(cmu_bdd_manager bddm, bdd f, bdd c)
+{
+  if (bdd_check_arguments(2, f, c))
+    {
+      if (c == BDD_ZERO(bddm))
+	{
+	  cmu_bdd_warning("cmu_bdd_cofactor: second argument is false");
+	  return (BDD_ONE(bddm));
+	}
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_bdd_cofactor_step(bddm, f, c));
+    }
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddrelprod.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddrelprod.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddrelprod.c	(revision 6)
@@ -0,0 +1,90 @@
+/* BDD relational product routine */
+
+
+#include "bddint.h"
+
+
+static
+bdd
+cmu_bdd_rel_prod_step(cmu_bdd_manager bddm, bdd f, bdd g, long op, var_assoc vars)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+  int quantifying;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (BDD_IS_CONST(f) || BDD_IS_CONST(g))
+    {
+      if (f == BDD_ZERO(bddm) || g == BDD_ZERO(bddm))
+	return (BDD_ZERO(bddm));
+      if (f == BDD_ONE(bddm))
+	return (cmu_bdd_exists_temp(bddm, g, op-1));
+      return (cmu_bdd_exists_temp(bddm, f, op-1));
+    }
+  if ((long)BDD_INDEX(bddm, f) > vars->last && (long)BDD_INDEX(bddm, g) > vars->last)
+    return (cmu_bdd_ite_step(bddm, f, g, BDD_ZERO(bddm)));
+  /* Put in canonical order. */
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (bdd_lookup_in_cache2(bddm, op, f, g, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  quantifying=(vars->assoc[top_indexindex] != 0);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=cmu_bdd_rel_prod_step(bddm, f1, g1, op, vars);
+  if (quantifying && temp1 == BDD_ONE(bddm))
+    result=temp1;
+  else
+    {
+      temp2=cmu_bdd_rel_prod_step(bddm, f2, g2, op, vars);
+      if (quantifying)
+	{
+	  BDD_SETUP(temp1);
+	  BDD_SETUP(temp2);
+	  bddm->op_cache.cache_level++;
+	  result=cmu_bdd_ite_step(bddm, temp1, BDD_ONE(bddm), temp2);
+	  BDD_TEMP_DECREFS(temp1);
+	  BDD_TEMP_DECREFS(temp2);
+	  bddm->op_cache.cache_level--;
+	}
+      else
+	result=bdd_find(bddm, top_indexindex, temp1, temp2);
+    }
+  bdd_insert_in_cache2(bddm, op, f, g, result);
+  return (result);
+}
+
+
+/* cmu_bdd_rel_prod(bddm, f, g) returns the BDD for "f and g" with those */
+/* variables which are associated with something in the current */
+/* variable association quantified out. */
+
+bdd
+cmu_bdd_rel_prod(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  long op;
+
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      if (bddm->curr_assoc_id == -1)
+	{
+	  op=bddm->temp_op--;
+	  /* We decrement the temporary opcode once more because */
+	  /* cmu_bdd_rel_prod may call cmu_bdd_exists_temp, and we don't */
+	  /* want to generate new temporary opcodes for each such */
+	  /* call.  Instead, we pass op-1 to cmu_bdd_exists_temp, and */
+	  /* have it use this opcode for caching. */
+	  bddm->temp_op--;
+	}
+      else
+	op=OP_RELPROD+bddm->curr_assoc_id;
+      RETURN_BDD(cmu_bdd_rel_prod_step(bddm, f, g, op, bddm->curr_assoc));
+    }
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddreorder.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddreorder.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddreorder.c	(revision 6)
@@ -0,0 +1,700 @@
+/* BDD dynamic reordering stuff */
+
+
+#include "bddint.h"
+
+
+static
+void
+increfs(bdd f)
+{
+  bdd g;
+
+  BDD_SETUP(f);
+  BDD_INCREFS(f);
+  if (BDD_REFS(f) == 1 && !BDD_TEMP_REFS(f))
+    {
+      g=(bdd)BDD_DATA0(f);
+      {
+	BDD_SETUP(g);
+	BDD_INCREFS(g);
+      }
+      g=(bdd)BDD_DATA1(f);
+      {
+	BDD_SETUP(g);
+	BDD_INCREFS(g);
+      }
+    }
+}
+
+
+static
+void
+decrefs(bdd f)
+{
+  bdd g;
+
+  BDD_SETUP(f);
+  BDD_DECREFS(f);
+  if (!BDD_REFS(f) && !BDD_TEMP_REFS(f))
+    {
+      g=(bdd)BDD_DATA0(f);
+      {
+	BDD_SETUP(g);
+	BDD_DECREFS(g);
+      }
+      g=(bdd)BDD_DATA1(f);
+      {
+	BDD_SETUP(g);
+	BDD_DECREFS(g);
+      }
+    }
+}
+
+
+static
+void
+bdd_exchange_aux(cmu_bdd_manager bddm, bdd f, bdd_indexindex_type next_indexindex)
+{
+  bdd f1, f2;
+  bdd f11, f12, f21, f22;
+  bdd temp1, temp2;
+
+  BDD_SETUP(f);
+  f1=BDD_THEN(f);
+  f2=BDD_ELSE(f);
+  {
+    BDD_SETUP(f1);
+    BDD_SETUP(f2);
+    if (BDD_INDEXINDEX(f1) == next_indexindex)
+      {
+	f11=BDD_THEN(f1);
+	f12=BDD_ELSE(f1);
+      }
+    else
+      {
+	f11=f1;
+	f12=f1;
+      }
+    if (BDD_INDEXINDEX(f2) == next_indexindex)
+      {
+	f21=BDD_THEN(f2);
+	f22=BDD_ELSE(f2);
+      }
+    else
+      {
+	f21=f2;
+	f22=f2;
+      }
+    if (f11 == f21)
+      temp1=f11;
+    else
+      temp1=bdd_find_aux(bddm, BDD_INDEXINDEX(f), (INT_PTR)f11, (INT_PTR)f21);
+    if (f12 == f22)
+      temp2=f12;
+    else if (BDD_IS_OUTPOS(f12))
+      temp2=bdd_find_aux(bddm, BDD_INDEXINDEX(f), (INT_PTR)f12, (INT_PTR)f22);
+    else
+      temp2=BDD_NOT(bdd_find_aux(bddm, BDD_INDEXINDEX(f), (INT_PTR)BDD_NOT(f12), (INT_PTR)BDD_NOT(f22)));
+    BDD_INDEXINDEX(f)=next_indexindex;
+    BDD_DATA0(f)=(INT_PTR)temp1;
+    BDD_DATA1(f)=(INT_PTR)temp2;
+    if (BDD_REFS(f) || BDD_TEMP_REFS(f))
+      {
+	increfs(temp1);
+	increfs(temp2);
+	decrefs(f1);
+	decrefs(f2);
+      }
+    else
+      cmu_bdd_fatal("bdd_exchange_aux: how did this happen?");
+  }
+}
+
+
+static
+void
+fixup_assoc(cmu_bdd_manager bddm, long indexindex1, long indexindex2, var_assoc va)
+{
+  /* Variable with indexindex1 is moving down a spot. */
+  if (va->assoc[indexindex1] && va->last == bddm->indexes[indexindex1])
+    va->last++;
+  else if (!va->assoc[indexindex1] && va->assoc[indexindex2] && va->last == bddm->indexes[indexindex2])
+    va->last--;
+}
+
+
+static
+void
+sweep_var_table(cmu_bdd_manager bddm, long i)
+{
+  long j;
+  var_table table;
+  bdd f, *p;
+
+  table=bddm->unique_table.tables[i];
+  for (j=0; j < table->size; ++j)
+    for (p= &table->table[j], f= *p; f; f= *p)
+      {
+	BDD_SETUP(f);
+	if (BDD_REFS(f) || BDD_TEMP_REFS(f))
+	  p= &f->next;
+	else
+	  {
+	    *p=f->next;
+	    BDD_FREE_REC(bddm, (pointer)f, sizeof(struct bdd_));
+	    table->entries--;
+	    bddm->unique_table.entries--;
+	    bddm->unique_table.freed++;
+	  }
+      }
+}
+
+
+static
+void
+bdd_exchange(cmu_bdd_manager bddm, long i)
+{
+  bdd_indexindex_type next_indexindex;
+  var_table table, next_table;
+  long j;
+  bdd f, *p;
+  bdd f1, f2;
+  bdd g;
+  long hash;
+  bdd_index_type temp;
+  assoc_list q;
+
+  next_indexindex=bddm->indexindexes[bddm->indexes[i]+1];
+  table=bddm->unique_table.tables[i];
+  next_table=bddm->unique_table.tables[next_indexindex];
+  g=0;
+  for (j=0; j < table->size; ++j)
+    for (p= &table->table[j], f= *p; f; f= *p)
+      {
+	BDD_SETUP(f);
+	if (BDD_REFS(f) || BDD_TEMP_REFS(f))
+	  {
+	    f1=(bdd)BDD_DATA0(f);
+	    f2=(bdd)BDD_DATA1(f);
+	    {
+	      BDD_SETUP(f1);
+	      BDD_SETUP(f2);
+	      if (BDD_INDEXINDEX(f1) != next_indexindex && BDD_INDEXINDEX(f2) != next_indexindex)
+		p= &f->next;
+	      else
+		{
+		  *p=f->next;
+		  f->next=g;
+		  g=f;
+		}
+	    }
+	  }
+	else
+	  {
+	    *p=f->next;
+	    BDD_FREE_REC(bddm, (pointer)f, sizeof(struct bdd_));
+	    table->entries--;
+	    bddm->unique_table.entries--;
+	    bddm->unique_table.freed++;
+	  }
+      }
+  for (f=g; f; f=g)
+    {
+      bdd_exchange_aux(bddm, f, next_indexindex);
+      g=f->next;
+      hash=HASH_NODE(f->data[0], f->data[1]);
+      BDD_REDUCE(hash, next_table->size);
+      f->next=next_table->table[hash];
+      next_table->table[hash]=f;
+      table->entries--;
+      next_table->entries++;
+      if (4*next_table->size < next_table->entries)
+	bdd_rehash_var_table(next_table, 1);
+    }
+  fixup_assoc(bddm, i, next_indexindex, &bddm->temp_assoc);
+  for (q=bddm->assocs; q; q=q->next)
+    fixup_assoc(bddm, i, next_indexindex, &q->va);
+  sweep_var_table(bddm, next_indexindex);
+  temp=bddm->indexes[i];
+  bddm->indexes[i]=bddm->indexes[next_indexindex];
+  bddm->indexes[next_indexindex]=temp;
+  bddm->indexindexes[temp]=next_indexindex;
+  bddm->indexindexes[bddm->indexes[i]]=i;
+}
+
+
+void
+cmu_bdd_var_block_reorderable(cmu_bdd_manager bddm, block b, int reorderable)
+{
+  b->reorderable=reorderable;
+}
+
+
+static
+void
+bdd_exchange_var_blocks(cmu_bdd_manager bddm, block parent, long bi)
+{
+  block b1, b2;
+  long i, j, k, l;
+  long delta;
+  block temp;
+
+  b1=parent->children[bi];
+  b2=parent->children[bi+1];
+  /* This slides the blocks past each other in a kind of interleaving */
+  /* fashion. */
+  for (i=0; i <= b1->last_index-b1->first_index+b2->last_index-b2->first_index; ++i)
+    {
+      j=i-b1->last_index+b1->first_index;
+      if (j < 0)
+	j=0;
+      k=i;
+      if (k > b2->last_index-b2->first_index)
+	k=b2->last_index-b2->first_index;
+      while (j <= k)
+	{
+	  l=b2->first_index+j-i+j;
+	  bdd_exchange(bddm, bddm->indexindexes[l-1]);
+	  ++j;
+	}
+    }
+  delta=b2->last_index-b2->first_index+1;
+  bdd_block_delta(b1, delta);
+  delta=b1->last_index-b1->first_index+1;
+  bdd_block_delta(b2, -delta);
+  temp=parent->children[bi];
+  parent->children[bi]=parent->children[bi+1];
+  parent->children[bi+1]=temp;
+}
+
+
+static
+int
+cmu_bdd_reorder_window2(cmu_bdd_manager bddm, block b, long i)
+{
+  long size, best_size;
+
+  /* 1 2 */
+  best_size=bddm->unique_table.entries;
+  bdd_exchange_var_blocks(bddm, b, i);
+  /* 2 1 */
+  size=bddm->unique_table.entries;
+  if (size < best_size)
+    return (1);
+  bdd_exchange_var_blocks(bddm, b, i);
+  return (0);
+}
+
+
+static
+int
+cmu_bdd_reorder_window3(cmu_bdd_manager bddm, block b, long i)
+{
+  int best;
+  long size, best_size;
+
+  best=0;
+  /* 1 2 3 */
+  best_size=bddm->unique_table.entries;
+  bdd_exchange_var_blocks(bddm, b, i);
+  /* 2 1 3 */
+  size=bddm->unique_table.entries;
+  if (size < best_size)
+    {
+      best=1;
+      best_size=size;
+    }
+  bdd_exchange_var_blocks(bddm, b, i+1);
+  /* 2 3 1 */
+  size=bddm->unique_table.entries;
+  if (size < best_size)
+    {
+      best=2;
+      best_size=size;
+    }
+  bdd_exchange_var_blocks(bddm, b, i);
+  /* 3 2 1 */
+  size=bddm->unique_table.entries;
+  if (size < best_size)
+    {
+      best=3;
+      best_size=size;
+    }
+  bdd_exchange_var_blocks(bddm, b, i+1);
+  /* 3 1 2 */
+  size=bddm->unique_table.entries;
+  if (size < best_size)
+    {
+      best=4;
+      best_size=size;
+    }
+  bdd_exchange_var_blocks(bddm, b, i);
+  /* 1 3 2 */
+  size=bddm->unique_table.entries;
+  if (size < best_size)
+    {
+      best=5;
+      best_size=size;
+    }
+  switch (best)
+    {
+    case 0:
+      bdd_exchange_var_blocks(bddm, b, i+1);
+      break;
+    case 1:
+      bdd_exchange_var_blocks(bddm, b, i+1);
+      bdd_exchange_var_blocks(bddm, b, i);
+      break;
+    case 2:
+      bdd_exchange_var_blocks(bddm, b, i+1);
+      bdd_exchange_var_blocks(bddm, b, i);
+      bdd_exchange_var_blocks(bddm, b, i+1);
+      break;
+    case 3:
+      bdd_exchange_var_blocks(bddm, b, i);
+      bdd_exchange_var_blocks(bddm, b, i+1);
+      break;
+    case 4:
+      bdd_exchange_var_blocks(bddm, b, i);
+      break;
+    case 5:
+      break;
+    }
+  return (best > 0);
+}
+
+
+static
+void
+cmu_bdd_reorder_stable_window3_aux(cmu_bdd_manager bddm, block b, char *levels)
+{
+  long i;
+  int moved;
+  int any_swapped;
+
+  if (b->reorderable)
+    {
+      for (i=0; i < b->num_children-1; ++i)
+	levels[i]=1;
+      do
+	{
+	  any_swapped=0;
+	  for (i=0; i < b->num_children-1; ++i)
+	    if (levels[i])
+	      {
+		if (i < b->num_children-2)
+		  moved=cmu_bdd_reorder_window3(bddm, b, i);
+		else
+		  moved=cmu_bdd_reorder_window2(bddm, b, i);
+		if (moved)
+		  {
+		    if (i > 0)
+		      {
+			levels[i-1]=1;
+			if (i > 1)
+			  levels[i-2]=1;
+		      }
+		    levels[i]=1;
+		    levels[i+1]=1;
+		    if (i < b->num_children-2)
+		      {
+			levels[i+2]=1;
+			if (i < b->num_children-3)
+			  {
+			    levels[i+3]=1;
+			    if (i < b->num_children-4)
+			      levels[i+4]=1;
+			  }
+		      }
+		    any_swapped=1;
+		  }
+		else
+		  levels[i]=0;
+	      }
+	}
+      while (any_swapped);
+    }
+  for (i=0; i < b->num_children; ++i)
+    cmu_bdd_reorder_stable_window3_aux(bddm, b->children[i], levels);
+}
+
+
+void
+cmu_bdd_reorder_stable_window3(cmu_bdd_manager bddm)
+{
+  char *levels;
+
+  levels=(char *)mem_get_block(bddm->vars*sizeof(char));
+  cmu_bdd_reorder_stable_window3_aux(bddm, bddm->super_block, levels);
+  mem_free_block((pointer)levels);
+}
+
+
+static
+void
+bdd_sift_block(cmu_bdd_manager bddm, block b, long start_pos, double max_size_factor)
+{
+  long start_size;
+  long best_size;
+  long best_pos;
+  long curr_size;
+  long curr_pos;
+  long max_size;
+
+  start_size=bddm->unique_table.entries;
+  best_size=start_size;
+  best_pos=start_pos;
+  curr_size=start_size;
+  curr_pos=start_pos;
+  max_size=max_size_factor*start_size;
+  if (bddm->unique_table.node_limit && max_size > bddm->unique_table.node_limit)
+    max_size=bddm->unique_table.node_limit;
+  while (curr_pos < b->num_children-1 && curr_size <= max_size)
+    {
+      bdd_exchange_var_blocks(bddm, b, curr_pos);
+      ++curr_pos;
+      curr_size=bddm->unique_table.entries;
+      if (curr_size < best_size)
+	{
+	  best_size=curr_size;
+	  best_pos=curr_pos;
+	}
+    }
+  while (curr_pos != start_pos)
+    {
+      --curr_pos;
+      bdd_exchange_var_blocks(bddm, b, curr_pos);
+    }
+  curr_size=start_size;
+  while (curr_pos && curr_size <= max_size)
+    {
+      --curr_pos;
+      bdd_exchange_var_blocks(bddm, b, curr_pos);
+      curr_size=bddm->unique_table.entries;
+      if (curr_size < best_size)
+	{
+	  best_size=curr_size;
+	  best_pos=curr_pos;
+	}
+    }
+  while (curr_pos != best_pos)
+    {
+      bdd_exchange_var_blocks(bddm, b, curr_pos);
+      ++curr_pos;
+    }
+}
+
+
+static
+void
+cmu_bdd_reorder_sift_aux(cmu_bdd_manager bddm, block b, block *to_sift, double max_size_factor)
+{
+  long i, j, k;
+  long w;
+  long max_w;
+  long widest;
+
+  if (b->reorderable)
+    {
+      for (i=0; i < b->num_children; ++i)
+	to_sift[i]=b->children[i];
+      while (i)
+	{
+	  --i;
+	  max_w=0;
+	  widest=0;
+	  for (j=0; j <= i; ++j)
+	    {
+	      for (w=0, k=to_sift[j]->first_index; k <= to_sift[j]->last_index; ++k)
+		w+=bddm->unique_table.tables[bddm->indexindexes[k]]->entries;
+	      w/=to_sift[j]->last_index-to_sift[j]->first_index+1;
+	      if (w > max_w)
+		{
+		  max_w=w;
+		  widest=j;
+		}
+	    }
+	  if (max_w > 1)
+	    {
+	      for (j=0; b->children[j] != to_sift[widest]; ++j);
+	      bdd_sift_block(bddm, b, j, max_size_factor);
+	      to_sift[widest]=to_sift[i];
+	    }
+	  else
+	    break;
+	}
+    }
+  for (i=0; i < b->num_children; ++i)
+    cmu_bdd_reorder_sift_aux(bddm, b->children[i], to_sift, max_size_factor);
+}
+
+
+static
+void
+cmu_bdd_reorder_sift_aux1(cmu_bdd_manager bddm, double max_size_factor)
+{
+  block *to_sift;
+
+  to_sift=(block *)mem_get_block(bddm->vars*sizeof(block));
+  cmu_bdd_reorder_sift_aux(bddm, bddm->super_block, to_sift, max_size_factor);
+  mem_free_block((pointer)to_sift);
+}
+
+
+void
+cmu_bdd_reorder_sift(cmu_bdd_manager bddm)
+{
+  cmu_bdd_reorder_sift_aux1(bddm, 2.0);
+}
+
+
+void
+cmu_bdd_reorder_hybrid(cmu_bdd_manager bddm)
+{
+  long nodes;
+  double max_size_factor;
+
+  nodes=bddm->unique_table.entries;
+  max_size_factor= *(double *)bddm->reorder_data;
+  if (max_size_factor > 2.0 || nodes < 10000)
+    max_size_factor=2.0;
+  cmu_bdd_reorder_sift_aux1(bddm, max_size_factor);
+  *(double *)bddm->reorder_data=1.0+(2.0*(nodes-bddm->unique_table.entries))/nodes;
+}
+
+
+/* cmu_bdd_dynamic_reordering(bddm, reorder_fn) sets the dynamic reordering */
+/* method to that specified by reorder_fn. */
+
+void
+cmu_bdd_dynamic_reordering(cmu_bdd_manager bddm, void (*reorder_fn)(cmu_bdd_manager))
+{
+  bddm->reorder_fn=reorder_fn;
+  if (bddm->reorder_data)
+    mem_free_block(bddm->reorder_data);
+  bddm->reorder_data=0;
+  if (reorder_fn == cmu_bdd_reorder_hybrid)
+    {
+      bddm->reorder_data=mem_get_block((SIZE_T)sizeof(double));
+      *(double *)bddm->reorder_data=2.0;
+    }
+}
+
+
+static
+void
+bdd_add_internal_references(cmu_bdd_manager bddm)
+{
+  long i, j;
+  var_table table;
+  bdd *f, g, h;
+
+  for (i=0; i <= bddm->vars; ++i)
+    {
+      if (i == bddm->vars)
+	table=bddm->unique_table.tables[BDD_CONST_INDEXINDEX];
+      else
+	table=bddm->unique_table.tables[bddm->indexindexes[i]];
+      for (j=0; j < table->size; ++j)
+	{
+	  f= &table->table[j];
+	  while ((g= *f))
+	    {
+	      BDD_SETUP(g);
+	      if (BDD_REFS(g) || BDD_TEMP_REFS(g))
+		{
+		  if (!BDD_IS_CONST(g))
+		    {
+		      h=(bdd)BDD_DATA0(g);
+		      {
+			BDD_SETUP(h);
+			BDD_INCREFS(h);
+		      }
+		      h=(bdd)BDD_DATA1(g);
+		      {
+			BDD_SETUP(h);
+			BDD_INCREFS(h);
+		      }
+		    }
+		  f= &g->next;
+		}
+	      else
+		{
+		  *f=g->next;
+		  if (i == bddm->vars && bddm->unique_table.free_terminal_fn)
+		    (*bddm->unique_table.free_terminal_fn)(bddm,
+							   BDD_DATA0(g),
+							   BDD_DATA1(g),
+							   bddm->unique_table.free_terminal_env);
+		  BDD_FREE_REC(bddm, (pointer)g, sizeof(struct bdd_));
+		  table->entries--;
+		  bddm->unique_table.entries--;
+		  bddm->unique_table.freed++;
+		}
+	    }
+	}
+    }
+}
+
+
+static
+void
+bdd_nuke_internal_references(cmu_bdd_manager bddm)
+{
+  long i, j;
+  var_table table;
+  bdd *f, g, h;
+
+  for (i=bddm->vars-1; i >= 0; --i)
+    {
+      table=bddm->unique_table.tables[bddm->indexindexes[i]];
+      for (j=0; j < table->size; ++j)
+	{
+	  f= &table->table[j];
+	  while ((g= *f))
+	    {
+	      BDD_SETUP(g);
+	      if (BDD_REFS(g) || BDD_TEMP_REFS(g))
+		{
+		  h=(bdd)BDD_DATA0(g);
+		  {
+		    BDD_SETUP(h);
+		    BDD_DECREFS(h);
+		  }
+		  h=(bdd)BDD_DATA1(g);
+		  {
+		    BDD_SETUP(h);
+		    BDD_DECREFS(h);
+		  }
+		  f= &g->next;
+		}
+	      else
+		cmu_bdd_fatal("bdd_nuke_internal_references: what happened?");
+	    }
+	}
+    }
+}
+
+
+void
+cmu_bdd_reorder_aux(cmu_bdd_manager bddm)
+{
+  if (bddm->reorder_fn)
+    {
+      bdd_flush_all(bddm);
+      bdd_add_internal_references(bddm);
+      (*bddm->reorder_fn)(bddm);
+      bdd_nuke_internal_references(bddm);
+    }
+}
+
+
+/* cmu_bdd_reorder(bddm) invokes the current dynamic reordering method. */
+
+void
+cmu_bdd_reorder(cmu_bdd_manager bddm)
+{
+  cmu_bdd_gc(bddm);
+  cmu_bdd_reorder_aux(bddm);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddsat.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddsat.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddsat.c	(revision 6)
@@ -0,0 +1,196 @@
+/* BDD satisfying valuation routines */
+
+
+#include "bddint.h"
+
+#ifdef STDC_HEADERS
+#  include <stdlib.h>
+#else
+extern void qsort(pointer, unsigned long, unsigned long, int (*)(const void *, const void *));
+#endif
+
+static
+bdd
+cmu_bdd_satisfy_step(cmu_bdd_manager bddm, bdd f)
+{
+  bdd temp;
+  bdd result;
+
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f))
+    return (f);
+  if (BDD_THEN(f) == BDD_ZERO(bddm))
+    {
+      temp=cmu_bdd_satisfy_step(bddm, BDD_ELSE(f));
+      result=bdd_find(bddm, BDD_INDEXINDEX(f), BDD_ZERO(bddm), temp);
+    }
+  else
+    {
+      temp=cmu_bdd_satisfy_step(bddm, BDD_THEN(f));
+      result=bdd_find(bddm, BDD_INDEXINDEX(f), temp, BDD_ZERO(bddm));
+    }
+  return (result);
+}
+
+
+/* cmu_bdd_satisfy(bddm, f) returns a BDD which implies f, is true for */
+/* some valuation on which f is true, and which has at most one node */
+/* at each level. */
+
+bdd
+cmu_bdd_satisfy(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      if (f == BDD_ZERO(bddm))
+	{
+	  cmu_bdd_warning("cmu_bdd_satisfy: argument is false");
+	  return (f);
+	}
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_bdd_satisfy_step(bddm, f));
+    }
+  return ((bdd)0);
+}
+
+
+static
+bdd
+cmu_bdd_satisfy_support_step(cmu_bdd_manager bddm, bdd f, bdd_indexindex_type *support)
+{
+  bdd temp;
+  bdd result;
+
+  BDD_SETUP(f);
+  if (!*support)
+    return (cmu_bdd_satisfy_step(bddm, f));
+  if (BDD_INDEX(bddm, f) <= bddm->indexes[*support])
+    {
+      if (BDD_INDEXINDEX(f) == *support)
+	++support;
+      if (BDD_THEN(f) == BDD_ZERO(bddm))
+	{
+	  temp=cmu_bdd_satisfy_support_step(bddm, BDD_ELSE(f), support);
+	  result=bdd_find(bddm, BDD_INDEXINDEX(f), BDD_ZERO(bddm), temp);
+	}
+      else
+	{
+	  temp=cmu_bdd_satisfy_support_step(bddm, BDD_THEN(f), support);
+	  result=bdd_find(bddm, BDD_INDEXINDEX(f), temp, BDD_ZERO(bddm));
+	}
+    }
+  else
+    {
+      temp=cmu_bdd_satisfy_support_step(bddm, f, support+1);
+      result=bdd_find(bddm, *support, BDD_ZERO(bddm), temp);
+    }
+  return (result);
+}
+
+
+static
+int
+index_cmp(pointer p1, pointer p2)
+{
+  bdd_index_type i1, i2;
+
+  i1= *(bdd_indexindex_type *)p1;
+  i2= *(bdd_indexindex_type *)p2;
+  if (i1 < i2)
+    return (-1);
+  if (i1 > i2)
+    return (1);
+  return (0);
+}
+
+
+/* cmu_bdd_satisfy_support(bddm, f) returns a BDD which implies f, is true */
+/* for some valuation on which f is true, which has at most one node */
+/* at each level, and which has exactly one node corresponding to each */
+/* variable which is associated with something in the current variable */
+/* association. */
+
+bdd
+cmu_bdd_satisfy_support(cmu_bdd_manager bddm, bdd f)
+{
+  bdd_indexindex_type *support, *p;
+  long i;
+  bdd result;
+
+  if (bdd_check_arguments(1, f))
+    {
+      if (f == BDD_ZERO(bddm))
+	{
+	  cmu_bdd_warning("cmu_bdd_satisfy_support: argument is false");
+	  return (f);
+	}
+      support=(bdd_indexindex_type *)mem_get_block((bddm->vars+1)*sizeof(bdd));
+      FIREWALL1(bddm,
+		if (retcode == BDD_ABORTED || retcode == BDD_OVERFLOWED)
+		  {
+		    mem_free_block((pointer)support);
+		    return ((bdd)0);
+		  }
+		);
+      for (i=0, p=support; i < bddm->vars; ++i)
+	if (bddm->curr_assoc->assoc[i+1])
+	  {
+	    *p=bddm->indexes[i+1];
+	    ++p;
+	  }
+      *p=0;
+      qsort((pointer)support, (unsigned)(p-support),
+	    sizeof(bdd_indexindex_type),
+	    (int (*)(const void *, const void *))index_cmp);
+      while (p != support)
+	{
+	  --p;
+	  *p=bddm->indexindexes[*p];
+	}
+      result=cmu_bdd_satisfy_support_step(bddm, f, support);
+      mem_free_block((pointer)support);
+      RETURN_BDD(result);
+    }
+  return ((bdd)0);
+}
+
+
+double
+cmu_bdd_satisfying_fraction_step(cmu_bdd_manager bddm, bdd f)
+{
+  union {
+    long cache_result[2];
+    double result;
+  } u;
+
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f))
+    {
+      if (f == BDD_ZERO(bddm))
+	return (0.0);
+      return (1.0);
+    }
+  if (bdd_lookup_in_cache1d(bddm, OP_SATFRAC, f,
+			    &(u.cache_result[0]), &(u.cache_result[1])))
+    {
+      return (u.result);
+    }
+  u.result=0.5*cmu_bdd_satisfying_fraction_step(bddm, BDD_THEN(f))+
+    0.5*cmu_bdd_satisfying_fraction_step(bddm, BDD_ELSE(f));
+  bdd_insert_in_cache1d(bddm, OP_SATFRAC, f, u.cache_result[0],
+			u.cache_result[1]);
+  return (u.result);
+}
+
+
+/* cmu_bdd_satisfying_fraction(bddm, f) returns the fraction of valuations */
+/* which make f true.  (Note that this fraction is independent of */
+/* whatever set of variables f is supposed to be a function of.) */
+
+double
+cmu_bdd_satisfying_fraction(cmu_bdd_manager bddm, bdd f)
+{
+  if (bdd_check_arguments(1, f))
+    return (cmu_bdd_satisfying_fraction_step(bddm, f));
+  return (0.0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddsize.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddsize.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddsize.c	(revision 6)
@@ -0,0 +1,345 @@
+/* BDD size and profile routines */
+
+
+#include "bddint.h"
+
+
+static
+void
+bdd_mark_bdd(bdd f)
+{
+  int curr_marking, this_marking;
+
+  BDD_SETUP(f);
+  curr_marking=BDD_MARK(f);
+  this_marking=(1 << TAG(f));
+  if (curr_marking & this_marking)
+    return;
+  BDD_MARK(f)=curr_marking | this_marking;
+  if (BDD_IS_CONST(f))
+    return;
+  bdd_mark_bdd(BDD_THEN(f));
+  bdd_mark_bdd(BDD_ELSE(f));
+}
+
+
+static
+int
+bdd_count_no_nodes(bdd f)
+{
+  BDD_SETUP(f);
+  return (BDD_MARK(f) > 0);
+}
+
+
+static
+int
+bdd_count_nodes(bdd f)
+{
+  int mark;
+
+  BDD_SETUP(f);
+  mark=BDD_MARK(f);
+  return (((mark & 0x1) != 0)+((mark & 0x2) != 0));
+}
+
+
+static
+int (*(counting_fns[]))(bdd)=
+{
+  bdd_count_no_nodes,
+  bdd_count_nodes,
+};
+
+
+static
+long
+cmu_bdd_size_step(bdd f, int (*count_fn)(bdd))
+{
+  long result;
+
+  BDD_SETUP(f);
+  if (!BDD_MARK(f))
+    return (0l);
+  result=(*count_fn)(f);
+  if (!BDD_IS_CONST(f))
+    result+=cmu_bdd_size_step(BDD_THEN(f), count_fn)+cmu_bdd_size_step(BDD_ELSE(f), count_fn);
+  BDD_MARK(f)=0;
+  return (result);
+}
+
+
+/* cmu_bdd_size(bddm, f, negout) returns the number of nodes in f when */
+/* negout is nonzero.  If negout is zero, we pretend that the BDDs */
+/* don't have negative-output pointers. */
+
+long
+cmu_bdd_size(cmu_bdd_manager bddm, bdd f, int negout)
+{
+  bdd g;
+
+  if (bdd_check_arguments(1, f))
+    {
+      g=BDD_ONE(bddm);
+      {
+	BDD_SETUP(g);
+	BDD_MARK(g)=0;
+      }
+      bdd_mark_bdd(f);
+      return (cmu_bdd_size_step(f, counting_fns[!negout]));
+    }
+  return (0l);
+}
+
+
+/* cmu_bdd_size_multiple is like cmu_bdd_size, but takes a null-terminated */
+/* array of BDDs and accounts for sharing of nodes. */
+
+long
+cmu_bdd_size_multiple(cmu_bdd_manager bddm, bdd* fs, int negout)
+{
+  long size;
+  bdd *f;
+  bdd g;
+
+  bdd_check_array(fs);
+  g=BDD_ONE(bddm);
+  {
+    BDD_SETUP(g);
+    BDD_MARK(g)=0;
+  }
+  for (f=fs; *f; ++f)
+    bdd_mark_bdd(*f);
+  size=0l;
+  for (f=fs; *f; ++f)
+    size+=cmu_bdd_size_step(*f, counting_fns[!negout]);
+  return (size);
+}
+
+
+static
+void
+cmu_bdd_profile_step(cmu_bdd_manager bddm, bdd f, long *level_counts, int (*count_fn)(bdd))
+{
+  BDD_SETUP(f);
+  if (!BDD_MARK(f))
+    return;
+  if (BDD_IS_CONST(f))
+    level_counts[bddm->vars]+=(*count_fn)(f);
+  else
+    {
+      level_counts[BDD_INDEX(bddm, f)]+=(*count_fn)(f);
+      cmu_bdd_profile_step(bddm, BDD_THEN(f), level_counts, count_fn);
+      cmu_bdd_profile_step(bddm, BDD_ELSE(f), level_counts, count_fn);
+    }
+  BDD_MARK(f)=0;
+}
+
+
+/* cmu_bdd_profile(bddm, f, level_counts, negout) returns a "node profile" */
+/* of f, i.e., the number of nodes at each level in f.  negout is as in */
+/* cmu_bdd_size.  level_counts should be an array of size cmu_bdd_vars(bddm)+1 */
+/* to hold the profile. */
+
+void
+cmu_bdd_profile(cmu_bdd_manager bddm, bdd f, long *level_counts, int negout)
+{
+  bdd_index_type i;
+  bdd g;
+
+  for (i=0; i <= bddm->vars; ++i)
+    level_counts[i]=0l;
+  if (bdd_check_arguments(1, f))
+    {
+      g=BDD_ONE(bddm);
+      {
+	BDD_SETUP(g);
+	BDD_MARK(g)=0;
+      }
+      bdd_mark_bdd(f);
+      cmu_bdd_profile_step(bddm, f, level_counts, counting_fns[!negout]);
+    }
+}
+
+
+/* cmu_bdd_profile_multiple is to cmu_bdd_profile as cmu_bdd_size_multiple is to */
+/* cmu_bdd_size. */
+
+void
+cmu_bdd_profile_multiple(cmu_bdd_manager bddm, bdd *fs, long *level_counts, int negout)
+{
+  bdd_index_type i;
+  bdd *f;
+  bdd g;
+
+  bdd_check_array(fs);
+  for (i=0; i <= bddm->vars; ++i)
+    level_counts[i]=0l;
+  g=BDD_ONE(bddm);
+  {
+    BDD_SETUP(g);
+    BDD_MARK(g)=0;
+  }
+  for (f=fs; *f; ++f)
+    bdd_mark_bdd(*f);
+  for (f=fs; *f; ++f)
+    cmu_bdd_profile_step(bddm, *f, level_counts, counting_fns[!negout]);
+}
+
+
+static
+void
+bdd_highest_ref_step(cmu_bdd_manager bddm, bdd f, hash_table h)
+{
+  long *hash_result;
+  long f_index;
+
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f))
+    return;
+  f_index=BDD_INDEX(bddm, f);
+  if ((hash_result=(long *)bdd_lookup_in_hash_table(h, BDD_THEN(f))))
+    {
+      if (*hash_result > f_index)
+	*hash_result=f_index;
+    }
+  else
+    {
+      bdd_insert_in_hash_table(h, BDD_THEN(f), (pointer)&f_index);
+      bdd_highest_ref_step(bddm, BDD_THEN(f), h);
+    }
+  if ((hash_result=(long *)bdd_lookup_in_hash_table(h, BDD_ELSE(f))))
+    {
+      if (*hash_result > f_index)
+	*hash_result=f_index;
+    }
+  else
+    {
+      bdd_insert_in_hash_table(h, BDD_ELSE(f), (pointer)&f_index);
+      bdd_highest_ref_step(bddm, BDD_ELSE(f), h);
+    }
+}
+
+
+static
+void
+bdd_dominated_step(cmu_bdd_manager bddm, bdd f, long *func_counts, hash_table h)
+{
+  long *hash_result;
+
+  hash_result=(long *)bdd_lookup_in_hash_table(h, f);
+  if (*hash_result >= 0)
+    func_counts[*hash_result]-=2;
+  if (*hash_result > -2)
+    {
+      BDD_SETUP(f);
+      *hash_result= -2;
+      if (!BDD_IS_CONST(f))
+	{
+	  bdd_dominated_step(bddm, BDD_THEN(f), func_counts, h);
+	  bdd_dominated_step(bddm, BDD_ELSE(f), func_counts, h);
+	}
+    }
+}
+
+
+/* cmu_bdd_function_profile(bddm, f, func_counts) returns a "function */
+/* profile" for f.  The nth entry of the function profile array is the */
+/* number of subfunctions of f which may be obtained by restricting */
+/* the variables whose index is less than n.  An entry of zero */
+/* indicates that f is independent of the variable with the */
+/* corresponding index. */
+
+void
+cmu_bdd_function_profile(cmu_bdd_manager bddm, bdd f, long *func_counts)
+{
+  long i;
+  bdd_index_type j;
+  hash_table h;
+
+  /* The number of subfunctions obtainable by restricting the */
+  /* variables of index < n is the number of subfunctions whose top */
+  /* variable has index n plus the number of subfunctions obtainable */
+  /* by restricting the variables of index < n+1 minus the number of */
+  /* these latter subfunctions whose highest reference is by a node at */
+  /* level n. */
+  /* The strategy will be to start with the number of subfunctions */
+  /* whose top variable has index n.  We compute the highest level at */
+  /* which each subfunction is referenced.  Then we work bottom up; at */
+  /* level n we add in the result from level n+1 and subtract the */
+  /* number of subfunctions whose highest reference is at level n. */
+  cmu_bdd_profile(bddm, f, func_counts, 0);
+  if (bdd_check_arguments(1, f))
+    {
+      /* Encode the profile.  The low bit of a count will be zero for */
+      /* those levels where f actually has a node. */
+      for (j=0; j < bddm->vars; ++j)
+	if (!func_counts[j])
+	  func_counts[j]=1;
+	else
+	  func_counts[j]<<=1;
+      h=bdd_new_hash_table(bddm, sizeof(long));
+      /* For each subfunction in f, compute the highest level where it is */
+      /* referenced.  f itself is conceptually referenced at the highest */
+      /* possible level, which we represent by -1. */
+      i= -1;
+      bdd_insert_in_hash_table(h, f, (pointer)&i);
+      bdd_highest_ref_step(bddm, f, h);
+      /* Walk through these results.  For each subfunction, decrement the */
+      /* count at the highest level where it is referenced. */
+      bdd_dominated_step(bddm, f, func_counts, h);
+      cmu_bdd_free_hash_table(h);
+      /* Now add each level n+1 result to that of level n. */
+      for (i=bddm->vars-1, j=i+1; i>= 0; --i)
+	if (func_counts[i] != 1)
+	  {
+	    func_counts[i]=(func_counts[i] >> 1)+func_counts[j];
+	    j=i;
+	  }
+	else
+	  func_counts[i]=0;
+    }
+}
+
+
+/* cmu_bdd_function_profile_multiple is to cmu_bdd_function_profile as */
+/* cmu_bdd_size_multiple is to cmu_bdd_size. */
+
+void
+cmu_bdd_function_profile_multiple(cmu_bdd_manager bddm, bdd *fs, long *func_counts)
+{
+  long i;
+  bdd_index_type j;
+  bdd *f;
+  long *hash_result;
+  hash_table h;
+
+  bdd_check_array(fs);
+  /* See cmu_bdd_function_profile for the strategy involved here. */
+  cmu_bdd_profile_multiple(bddm, fs, func_counts, 0);
+  for (j=0; j < bddm->vars; ++j)
+    if (!func_counts[j])
+      func_counts[j]=1;
+    else
+      func_counts[j]<<=1;
+  h=bdd_new_hash_table(bddm, sizeof(long));
+  for (f=fs; *f; ++f)
+    bdd_highest_ref_step(bddm, *f, h);
+  i= -1;
+  for (f=fs; *f; ++f)
+    if ((hash_result=(long *)bdd_lookup_in_hash_table(h, *f)))
+      *hash_result= -1;
+    else
+      bdd_insert_in_hash_table(h, *f, (pointer)&i);
+  for (f=fs; *f; ++f)
+    bdd_dominated_step(bddm, *f, func_counts, h);
+  cmu_bdd_free_hash_table(h);
+  for (i=bddm->vars-1, j=i+1; i>= 0; --i)
+    if (func_counts[i] != 1)
+      {
+	func_counts[i]=(func_counts[i] >> 1)+func_counts[j];
+	j=i;
+      }
+    else
+      func_counts[i]=0;
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddsupport.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddsupport.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddsupport.c	(revision 6)
@@ -0,0 +1,111 @@
+/* BDD support routines */
+
+
+#include "bddint.h"
+
+
+static
+int
+cmu_bdd_depends_on_step(cmu_bdd_manager bddm, bdd f, bdd_index_type var_index, int mark)
+{
+  bdd_index_type f_index;
+
+  BDD_SETUP(f);
+  f_index=BDD_INDEX(bddm, f);
+  if (f_index > var_index)
+    return (0);
+  if (f_index == var_index)
+    return (1);
+  if (BDD_MARK(f) == mark)
+    return (0);
+  BDD_MARK(f)=mark;
+  if (cmu_bdd_depends_on_step(bddm, BDD_THEN(f), var_index, mark))
+    return (1);
+  return (cmu_bdd_depends_on_step(bddm, BDD_ELSE(f), var_index, mark));
+}
+
+
+/* cmu_bdd_depends_on(bddm, f, var) returns 1 if f depends on var and */
+/* returns 0 otherwise. */
+
+int
+cmu_bdd_depends_on(cmu_bdd_manager bddm, bdd f, bdd var)
+{
+  if (bdd_check_arguments(2, f, var))
+    {
+      BDD_SETUP(var);
+      if (cmu_bdd_type_aux(bddm, var) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_depends_on: second argument is not a positive variable");
+	  if (BDD_IS_CONST(var))
+	    return (1);
+	}
+      (void)cmu_bdd_depends_on_step(bddm, f, BDD_INDEX(bddm, var), 1);
+      return (cmu_bdd_depends_on_step(bddm, f, BDD_INDEX(bddm, var), 0));
+    }
+  return (0);
+}
+
+
+static
+void
+bdd_unmark_nodes(cmu_bdd_manager bddm, bdd f)
+{
+  bdd temp;
+
+  BDD_SETUP(f);
+  if (!BDD_MARK(f) || BDD_IS_CONST(f))
+    return;
+  BDD_MARK(f)=0;
+  temp=BDD_IF(bddm, f);
+  {
+    BDD_SETUP(temp);
+    BDD_MARK(temp)=0;
+  }
+  bdd_unmark_nodes(bddm, BDD_THEN(f));
+  bdd_unmark_nodes(bddm, BDD_ELSE(f));
+}
+
+
+static
+bdd *
+cmu_bdd_support_step(cmu_bdd_manager bddm, bdd f, bdd *support)
+{
+  bdd temp;
+
+  BDD_SETUP(f);
+  if (BDD_MARK(f) || BDD_IS_CONST(f))
+    return (support);
+  temp=BDD_IF(bddm, f);
+  {
+    BDD_SETUP(temp);
+    if (!BDD_MARK(temp))
+      {
+	BDD_MARK(temp)=1;
+	*support=temp;
+	++support;
+      }
+  }
+  BDD_MARK(f)=1;
+  support=cmu_bdd_support_step(bddm, BDD_THEN(f), support);
+  return (cmu_bdd_support_step(bddm, BDD_ELSE(f), support));
+}
+
+
+/* cmu_bdd_support(bddm, f, support) returns the support of f as a */
+/* null-terminated array of variables. */
+
+void
+cmu_bdd_support(cmu_bdd_manager bddm, bdd f, bdd *support)
+{
+  bdd *end;
+
+  if (bdd_check_arguments(1, f))
+    {
+      end=cmu_bdd_support_step(bddm, f, support);
+      *end=0;
+      bdd_unmark_nodes(bddm, f);
+    }
+  else
+    *support=0;
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddswap.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddswap.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddswap.c	(revision 6)
@@ -0,0 +1,156 @@
+/* BDD variable exchange routine */
+
+
+#include "bddint.h"
+
+
+static
+bdd
+cmu_bdd_swap_vars_aux_step(cmu_bdd_manager bddm, bdd f, bdd g, bdd h, bdd_indexindex_type h_indexindex, long op)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd_index_type f_index, g_index;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  f_index=BDD_INDEX(bddm, f);
+  g_index=BDD_INDEX(bddm, g);
+  if (f_index == bddm->indexes[h_indexindex])
+    {
+      if (op & 1)
+	f=BDD_THEN(f);
+      else
+	f=BDD_ELSE(f);
+      BDD_RESET(f);
+    }
+  if (g_index == bddm->indexes[h_indexindex])
+    {
+      if (op & 1)
+	g=BDD_THEN(g);
+      else
+	g=BDD_ELSE(g);
+      BDD_RESET(g);
+    }
+  if (f == g)
+    {
+    if (op & 1)
+      return (cmu_bdd_compose_temp(bddm, f, h, BDD_ONE(bddm)));
+    else
+      return (cmu_bdd_compose_temp(bddm, f, h, BDD_ZERO(bddm)));
+    }
+  if (f_index >= bddm->indexes[h_indexindex] && g_index >= bddm->indexes[h_indexindex])
+    {
+      BDD_TEMP_INCREFS(f);
+      BDD_TEMP_INCREFS(g);
+      return (bdd_find(bddm, h_indexindex, f, g));
+    }
+  if (bdd_lookup_in_cache2(bddm, op, f, g, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=cmu_bdd_swap_vars_aux_step(bddm, f1, g1, h, h_indexindex, op);
+  temp2=cmu_bdd_swap_vars_aux_step(bddm, f2, g2, h, h_indexindex, op);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache2(bddm, op, f, g, result);
+  return (result);
+}
+
+
+static
+bdd
+cmu_bdd_swap_vars_step(cmu_bdd_manager bddm, bdd f, bdd_indexindex_type g_indexindex, bdd h, long op)
+{
+  bdd_index_type f_index;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  if (BDD_IS_CONST(f))
+    return (f);
+  if (bdd_lookup_in_cache2(bddm, op, f, h, &result))
+    return (result);
+  f_index=BDD_INDEX(bddm, f);
+  if (f_index > bddm->indexes[g_indexindex])
+    {
+      temp1=cmu_bdd_compose_temp(bddm, f, h, BDD_ONE(bddm));
+      temp2=cmu_bdd_compose_temp(bddm, f, h, BDD_ZERO(bddm));
+      result=bdd_find(bddm, g_indexindex, temp1, temp2);
+    }
+  else if (f_index < bddm->indexes[g_indexindex])
+    {
+      temp1=cmu_bdd_swap_vars_step(bddm, BDD_THEN(f), g_indexindex, h, op);
+      temp2=cmu_bdd_swap_vars_step(bddm, BDD_ELSE(f), g_indexindex, h, op);
+      result=bdd_find(bddm, BDD_INDEXINDEX(f), temp1, temp2);
+    }
+  else
+    {
+      BDD_SETUP(h);
+      temp1=cmu_bdd_swap_vars_aux_step(bddm, BDD_THEN(f), BDD_ELSE(f), h, BDD_INDEXINDEX(h), OP_SWAPAUX+2*BDD_INDEXINDEX(h)+1);
+      temp2=cmu_bdd_swap_vars_aux_step(bddm, BDD_THEN(f), BDD_ELSE(f), h, BDD_INDEXINDEX(h), OP_SWAPAUX+2*BDD_INDEXINDEX(h));
+      result=bdd_find(bddm, g_indexindex, temp1, temp2);
+    }
+  bdd_insert_in_cache2(bddm, op, f, h, result);
+  return (result);
+}
+
+
+bdd
+cmu_bdd_swap_vars_temp(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  bdd_index_type g_index, h_index;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  BDD_SETUP(h);
+  g_index=BDD_INDEX(bddm, g);
+  h_index=BDD_INDEX(bddm, h);
+  if (g_index == h_index)
+    {
+      BDD_TEMP_INCREFS(f);
+      return (f);
+    }
+  if (g_index > h_index)
+    return (cmu_bdd_swap_vars_step(bddm, f, BDD_INDEXINDEX(h), g, OP_SWAP+BDD_INDEXINDEX(h)));
+  else
+    return (cmu_bdd_swap_vars_step(bddm, f, BDD_INDEXINDEX(g), h, OP_SWAP+BDD_INDEXINDEX(g)));
+}
+
+
+/* cmu_bdd_swap_vars(bddm, f, g, h) substitutes g for h and h for g in f. */
+
+bdd
+cmu_bdd_swap_vars(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  bdd_index_type g_index, h_index;
+
+  if (bdd_check_arguments(3, f, g, h))
+    {
+      BDD_SETUP(f);
+      BDD_SETUP(g);
+      BDD_SETUP(h);
+      if (cmu_bdd_type_aux(bddm, g) != BDD_TYPE_POSVAR || cmu_bdd_type_aux(bddm, h) != BDD_TYPE_POSVAR)
+	{
+	  cmu_bdd_warning("cmu_bdd_swap_vars: second and third arguments are not both positive variables");
+	  BDD_INCREFS(f);
+	  return (f);
+	}
+      FIREWALL(bddm);
+      g_index=BDD_INDEX(bddm, g);
+      h_index=BDD_INDEX(bddm, h);
+      if (g_index == h_index)
+	{
+	  BDD_INCREFS(f);
+	  return (f);
+	}
+      if (g_index > h_index)
+	RETURN_BDD(cmu_bdd_swap_vars_step(bddm, f, BDD_INDEXINDEX(h), g, OP_SWAP+BDD_INDEXINDEX(h)));
+      else
+	RETURN_BDD(cmu_bdd_swap_vars_step(bddm, f, BDD_INDEXINDEX(g), h, OP_SWAP+BDD_INDEXINDEX(g)));
+    }
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bddunique.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddunique.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddunique.c	(revision 6)
@@ -0,0 +1,414 @@
+/* BDD unique table routines */
+
+
+#include "bddint.h"
+
+
+#define MIN_GC_LIMIT 10000
+
+
+void
+bdd_rehash_var_table(var_table table, int grow)
+{
+  long i;
+  long hash;
+  long oldsize;
+  bdd *newtable;
+  bdd p, q;
+
+  oldsize=table->size;
+  if (grow)
+    table->size_index++;
+  else
+    table->size_index--;
+  table->size=TABLE_SIZE(table->size_index);
+  newtable=(bdd *)mem_get_block((SIZE_T)(table->size*sizeof(bdd)));
+  for (i=0; i < table->size; ++i)
+    newtable[i]=0;
+  for (i=0; i < oldsize; ++i)
+    for (p=table->table[i]; p; p=q)
+      {
+	q=p->next;
+	hash=HASH_NODE(p->data[0], p->data[1]);
+	BDD_REDUCE(hash, table->size);
+	p->next=newtable[hash];
+	newtable[hash]=p;
+      }
+  mem_free_block((pointer)table->table);
+  table->table=newtable;
+}
+
+
+static
+void
+bdd_mark(cmu_bdd_manager bddm)
+{
+  long i, j;
+  var_table table;
+  bdd f, g;
+
+  for (i=0; i <= bddm->vars; ++i)
+    {
+      if (i == bddm->vars)
+	table=bddm->unique_table.tables[BDD_CONST_INDEXINDEX];
+      else
+	table=bddm->unique_table.tables[bddm->indexindexes[i]];
+      for (j=0; j < table->size; ++j)
+	for (f=table->table[j]; f; f=f->next)
+	  {
+	    BDD_SETUP(f);
+	    if (BDD_REFS(f) || BDD_TEMP_REFS(f))
+	      BDD_MARK(f)|=BDD_GC_MARK;
+	    if (BDD_IS_USED(f) && !BDD_IS_CONST(f))
+	      {
+		g=(bdd)BDD_DATA0(f);
+		{
+		  BDD_SETUP(g);
+		  BDD_MARK(g)|=BDD_GC_MARK;
+		}
+		g=(bdd)BDD_DATA1(f);
+		{
+		  BDD_SETUP(g);
+		  BDD_MARK(g)|=BDD_GC_MARK;
+		}
+	      }
+	  }
+    }
+}
+
+
+void
+bdd_sweep_var_table(cmu_bdd_manager bddm, long i, int maybe_rehash)
+{
+  long j;
+  var_table table;
+  bdd f, *p;
+
+  table=bddm->unique_table.tables[i];
+  for (j=0; j < table->size; ++j)
+    for (p= &table->table[j], f= *p; f; f= *p)
+      {
+	BDD_SETUP(f);
+	if (BDD_IS_USED(f))
+	  {
+	    BDD_SETUP(f);
+	    BDD_MARK(f)&=~BDD_GC_MARK;
+	    p= &f->next;
+	  }
+	else
+	  {
+	    *p=f->next;
+	    if (i == BDD_CONST_INDEXINDEX && bddm->unique_table.free_terminal_fn)
+	      (*bddm->unique_table.free_terminal_fn)(bddm,
+						     BDD_DATA0(f),
+						     BDD_DATA1(f),
+						     bddm->unique_table.free_terminal_env);
+	    BDD_FREE_REC(bddm, (pointer)f, sizeof(struct bdd_));
+	    table->entries--;
+	    bddm->unique_table.entries--;
+	    bddm->unique_table.freed++;
+	  }
+      }
+  if (maybe_rehash && table->size > table->entries && table->size_index > 3)
+    bdd_rehash_var_table(table, 0);
+}
+
+
+void
+bdd_sweep(cmu_bdd_manager bddm)
+{
+  long i;
+
+  for (i=0; i <= bddm->vars; ++i)
+    bdd_sweep_var_table(bddm, i, 1);
+}
+
+
+/* cmu_bdd_gc(bddm) performs a garbage collection. */
+
+void
+cmu_bdd_gc(cmu_bdd_manager bddm)
+{
+  bdd_mark(bddm);
+  bdd_purge_cache(bddm);
+  bdd_sweep(bddm);
+  bddm->unique_table.gcs++;
+}
+
+
+static
+void
+bdd_set_gc_limit(cmu_bdd_manager bddm)
+{
+  bddm->unique_table.gc_limit=2*bddm->unique_table.entries;
+  if (bddm->unique_table.gc_limit < MIN_GC_LIMIT)
+    bddm->unique_table.gc_limit=MIN_GC_LIMIT;
+  if (bddm->unique_table.node_limit &&
+      bddm->unique_table.gc_limit > bddm->unique_table.node_limit)
+    bddm->unique_table.gc_limit=bddm->unique_table.node_limit;
+}
+
+
+void
+bdd_clear_temps(cmu_bdd_manager bddm)
+{
+  long i, j;
+  var_table table;
+  bdd f;
+
+  for (i=0; i <= bddm->vars; ++i)
+    {
+      table=bddm->unique_table.tables[i];
+      for (j=0; j < table->size; ++j)
+	for (f=table->table[j]; f; f=f->next)
+	  {
+	    BDD_SETUP(f);
+	    BDD_TEMP_REFS(f)=0;
+	  }
+    }
+  cmu_bdd_gc(bddm);
+  bdd_set_gc_limit(bddm);
+}  
+
+
+void
+bdd_cleanup(cmu_bdd_manager bddm, int code)
+{
+  bdd_clear_temps(bddm);
+  switch (code)
+    {
+    case BDD_ABORTED:
+      (*bddm->bag_it_fn)(bddm, bddm->bag_it_env);
+      break;
+    case BDD_OVERFLOWED:
+      if (bddm->overflow_fn)
+	(*bddm->overflow_fn)(bddm, bddm->overflow_env);
+      break;
+    }
+}
+
+
+bdd
+bdd_find_aux(cmu_bdd_manager bddm, bdd_indexindex_type indexindex, INT_PTR d1, INT_PTR d2)
+{
+  var_table table;
+  long hash;
+  bdd temp;
+
+  table=bddm->unique_table.tables[indexindex];
+  hash=HASH_NODE(d1, d2);
+  BDD_REDUCE(hash, table->size);
+  for (temp=table->table[hash]; temp; temp=temp->next)
+    if (temp->data[0] == d1 && temp->data[1] == d2)
+      break;
+  if (!temp)
+    {
+      /* Not found; make a new node. */
+      temp=(bdd)BDD_NEW_REC(bddm, sizeof(struct bdd_));
+      temp->indexindex=indexindex;
+      temp->refs=0;
+      temp->mark=0;
+      temp->data[0]=d1;
+      temp->data[1]=d2;
+      temp->next=table->table[hash];
+      table->table[hash]=temp;
+      table->entries++;
+      bddm->unique_table.entries++;
+      if (4*table->size < table->entries)
+	bdd_rehash_var_table(table, 1);
+    }
+  bddm->unique_table.finds++;
+  return (temp);
+}
+
+
+static
+void
+bdd_check(cmu_bdd_manager bddm)
+{
+  long nodes;
+
+  bddm->check=100;
+  /* When bag_it_fn set, clean up and abort immediately. */
+  if (bddm->bag_it_fn)
+    longjmp(bddm->abort.context, BDD_ABORTED);
+  if (bddm->unique_table.entries > bddm->unique_table.gc_limit)
+    {
+      cmu_bdd_gc(bddm);
+      /* Table full. */
+      nodes=bddm->unique_table.entries;
+      if (3*nodes > 2*bddm->unique_table.gc_limit && bddm->allow_reordering && bddm->reorder_fn)
+	{
+	  cmu_bdd_reorder_aux(bddm);
+	  if (4*bddm->unique_table.entries > 3*nodes && 3*nodes > 4*bddm->nodes_at_start)
+	    /* If we didn't save much, but we have created a reasonable number */
+	    /* of nodes, then don't bother reordering next time. */
+	    bddm->allow_reordering=0;
+	  /* Go try again. */
+	  bdd_set_gc_limit(bddm);
+	  longjmp(bddm->abort.context, BDD_REORDERED);
+	}
+      bdd_set_gc_limit(bddm);
+      if (bddm->unique_table.node_limit &&
+	  bddm->unique_table.entries >= bddm->unique_table.node_limit-1000)
+	{
+	  /* Out of memory; go clean up. */
+	  bddm->overflow=1;
+	  longjmp(bddm->abort.context, BDD_OVERFLOWED);
+	}
+    }
+  /* Maybe increase cache size if it's getting full. */
+  if (3*bddm->op_cache.size < 2*bddm->op_cache.entries &&
+      32*bddm->op_cache.size < bddm->op_cache.cache_ratio*bddm->unique_table.entries)
+    bdd_rehash_cache(bddm, 1);
+}
+
+
+/* bdd_find(bddm, indexindex, f, g) creates or finds a node with the */
+/* given indexindex, "then" pointer, and "else" pointer. */
+
+bdd
+bdd_find(cmu_bdd_manager bddm, bdd_indexindex_type indexindex, bdd f, bdd g)
+{
+  bdd temp;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (f == g)
+    {
+      BDD_TEMP_DECREFS(f);
+      temp=f;
+    }
+  else
+    {
+      if (BDD_IS_OUTPOS(f))
+	temp=bdd_find_aux(bddm, indexindex, (INT_PTR)f, (INT_PTR)g);
+      else
+	temp=BDD_NOT(bdd_find_aux(bddm, indexindex, (INT_PTR)BDD_NOT(f), (INT_PTR)BDD_NOT(g)));
+      {
+	BDD_SETUP(temp);
+	BDD_TEMP_INCREFS(temp);
+      }
+      BDD_TEMP_DECREFS(f);
+      BDD_TEMP_DECREFS(g);
+    }
+  bddm->check--;
+  if (!bddm->check)
+    bdd_check(bddm);
+  return (temp);
+}
+
+
+/* bdd_find_terminal(bddm, value1, value2) creates or finds a terminal */
+/* node with the given data value. */
+
+bdd
+bdd_find_terminal(cmu_bdd_manager bddm, INT_PTR value1, INT_PTR value2)
+{
+  bdd temp;
+
+  if ((*bddm->canonical_fn)(bddm, value1, value2, bddm->transform_env))
+    {
+      (*bddm->transform_fn)(bddm, value1, value2, &value1, &value2, bddm->transform_env);
+      temp=BDD_NOT(bdd_find_aux(bddm, BDD_CONST_INDEXINDEX, value1, value2));
+    }
+  else
+    temp=bdd_find_aux(bddm, BDD_CONST_INDEXINDEX, value1, value2);
+  {
+    BDD_SETUP(temp);
+    BDD_TEMP_INCREFS(temp);
+  }
+  bddm->check--;
+  if (!bddm->check)
+    bdd_check(bddm);
+  return (temp);
+}
+
+
+/* cmu_bdd_clear_refs(bddm) sets the reference count of all nodes to 0. */
+
+void
+cmu_bdd_clear_refs(cmu_bdd_manager bddm)
+{
+  long i, j;
+  var_table table;
+  bdd f;
+  assoc_list q;
+
+  for (i=0; i <= bddm->vars; ++i)
+    {
+      table=bddm->unique_table.tables[i];
+      for (j=0; j < table->size; ++j)
+	for (f=table->table[j]; f; f=f->next)
+	  {
+	    BDD_SETUP(f);
+	    BDD_REFS(f)=0;
+	  }
+    }
+  for (i=0; i < bddm->vars; ++i)
+    bddm->variables[i+1]->refs=BDD_MAX_REFS;
+  bddm->one->refs=BDD_MAX_REFS;
+  for (q=bddm->assocs; q; q=q->next)
+    for (i=0; i < bddm->vars; ++i)
+      if ((f=q->va.assoc[i+1]))
+	{
+	  BDD_SETUP(f);
+	  BDD_INCREFS(f);
+	}
+}
+
+
+var_table
+bdd_new_var_table(cmu_bdd_manager bddm)
+{
+  long i;
+  var_table table;
+
+  table=(var_table)BDD_NEW_REC(bddm, sizeof(struct var_table_));
+  table->size_index=3;
+  table->size=TABLE_SIZE(table->size_index);
+  table->entries=0;
+  table->table=(bdd *)mem_get_block((SIZE_T)(table->size*sizeof(bdd)));
+  for (i=0; i < table->size; ++i)
+    table->table[i]=0;
+  return (table);
+}
+
+
+void
+cmu_bdd_init_unique(cmu_bdd_manager bddm)
+{
+  bddm->unique_table.tables=(var_table *)mem_get_block((SIZE_T)((bddm->maxvars+1)*sizeof(var_table)));
+  bddm->unique_table.tables[BDD_CONST_INDEXINDEX]=bdd_new_var_table(bddm);
+  bddm->unique_table.gc_limit=MIN_GC_LIMIT;
+  bddm->unique_table.node_limit=0;
+  bddm->unique_table.entries=0;
+  bddm->unique_table.freed=0;
+  bddm->unique_table.gcs=0;
+  bddm->unique_table.finds=0;
+  bddm->unique_table.free_terminal_fn=0;
+  bddm->unique_table.free_terminal_env=0;
+}
+
+
+void
+cmu_bdd_free_unique(cmu_bdd_manager bddm)
+{
+  long i, j;
+  var_table table;
+  bdd p, q;
+
+  for (i=0; i <= bddm->vars; ++i)
+    {
+      table=bddm->unique_table.tables[i];
+      for (j=0; j < table->size; ++j)
+	for (p=table->table[j]; p; p=q)
+	  {
+	    q=p->next;
+	    BDD_FREE_REC(bddm, (pointer)p, sizeof(struct bdd_));
+	  }
+      mem_free_block((pointer)table->table);
+      BDD_FREE_REC(bddm, (pointer)table, sizeof(struct var_table_));
+    }
+  mem_free_block((pointer)bddm->unique_table.tables);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/bdduser.h
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bdduser.h	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bdduser.h	(revision 6)
@@ -0,0 +1,246 @@
+/* BDD user-visible definitions */
+
+
+#if !defined(_BDDUSERH)
+#define _BDDUSERH
+
+
+#include <stdio.h>
+#include <memuser.h>
+
+
+#define ARGS(args) args
+
+
+/* Types */
+
+typedef struct bdd_ *bdd;
+typedef struct bdd_manager_ *cmu_bdd_manager;
+typedef struct block_ *block;
+
+
+/* Return values for cmu_bdd_type */
+
+#define BDD_TYPE_NONTERMINAL 0
+#define BDD_TYPE_ZERO 1
+#define BDD_TYPE_ONE 2
+#define BDD_TYPE_POSVAR 3
+#define BDD_TYPE_NEGVAR 4
+#define BDD_TYPE_OVERFLOW 5
+#define BDD_TYPE_CONSTANT 6
+
+
+/* Error codes for cmu_bdd_undump_bdd */
+
+#define BDD_UNDUMP_FORMAT 1
+#define BDD_UNDUMP_OVERFLOW 2
+#define BDD_UNDUMP_IOERROR 3
+#define BDD_UNDUMP_EOF 4
+
+
+/* Basic BDD routine declarations */
+
+extern bdd cmu_bdd_one ARGS((cmu_bdd_manager));
+extern bdd cmu_bdd_zero ARGS((cmu_bdd_manager));
+extern bdd cmu_bdd_new_var_first ARGS((cmu_bdd_manager));
+extern bdd cmu_bdd_new_var_last ARGS((cmu_bdd_manager));
+extern bdd cmu_bdd_new_var_before ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_new_var_after ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_var_with_index ARGS((cmu_bdd_manager, long));
+extern bdd cmu_bdd_var_with_id ARGS((cmu_bdd_manager, long));
+extern bdd cmu_bdd_ite ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern bdd cmu_bdd_and ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_nand ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_or ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_nor ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_xor ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_xnor ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_identity ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_not ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_if ARGS((cmu_bdd_manager, bdd));
+extern long cmu_bdd_if_index ARGS((cmu_bdd_manager, bdd));
+extern long cmu_bdd_if_id ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_then ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_else ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_intersects ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_implies ARGS((cmu_bdd_manager, bdd, bdd));
+extern int cmu_bdd_type ARGS((cmu_bdd_manager, bdd));
+extern void cmu_bdd_unfree ARGS((cmu_bdd_manager, bdd));
+extern void cmu_bdd_free ARGS((cmu_bdd_manager, bdd));
+extern long cmu_bdd_vars ARGS((cmu_bdd_manager));
+extern long cmu_bdd_total_size ARGS((cmu_bdd_manager));
+extern int cmu_bdd_cache_ratio ARGS((cmu_bdd_manager, int));
+extern long cmu_bdd_node_limit ARGS((cmu_bdd_manager, long));
+extern int cmu_bdd_overflow ARGS((cmu_bdd_manager));
+extern void cmu_bdd_overflow_closure ARGS((cmu_bdd_manager, void (*) ARGS((cmu_bdd_manager, pointer)), pointer));
+extern void cmu_bdd_abort_closure ARGS((cmu_bdd_manager, void (*) ARGS((cmu_bdd_manager, pointer)), pointer));
+extern void cmu_bdd_stats ARGS((cmu_bdd_manager, FILE *));
+extern cmu_bdd_manager cmu_bdd_init ARGS((void));
+extern void cmu_bdd_quit ARGS((cmu_bdd_manager));
+
+
+/* Variable association routine declarations */
+
+extern int cmu_bdd_new_assoc ARGS((cmu_bdd_manager, bdd *, int));
+extern void cmu_bdd_free_assoc ARGS((cmu_bdd_manager, int));
+extern void cmu_bdd_temp_assoc ARGS((cmu_bdd_manager, bdd *, int));
+extern void cmu_bdd_augment_temp_assoc ARGS((cmu_bdd_manager, bdd *, int));
+extern int cmu_bdd_assoc ARGS((cmu_bdd_manager, int));
+
+
+/* Comparison routine declarations */
+
+extern int cmu_bdd_compare ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+
+
+/* Composition routine declarations */
+
+extern bdd cmu_bdd_compose ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern bdd cmu_bdd_substitute ARGS((cmu_bdd_manager, bdd));
+
+
+/* Variable exchange routine declarations */
+
+extern bdd cmu_bdd_swap_vars ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+
+
+/* Quantification routine declarations */
+
+extern bdd cmu_bdd_exists ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_forall ARGS((cmu_bdd_manager, bdd));
+
+
+/* Reduce routine declarations */
+
+extern bdd cmu_bdd_reduce ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd cmu_bdd_cofactor ARGS((cmu_bdd_manager, bdd, bdd));
+
+
+/* Relational product routine declarations */
+
+extern bdd cmu_bdd_rel_prod ARGS((cmu_bdd_manager, bdd, bdd));
+
+
+/* Satisfying valuation routine declarations */
+
+extern bdd cmu_bdd_satisfy ARGS((cmu_bdd_manager, bdd));
+extern bdd cmu_bdd_satisfy_support ARGS((cmu_bdd_manager, bdd));
+extern double cmu_bdd_satisfying_fraction ARGS((cmu_bdd_manager, bdd));
+
+
+/* Generic apply routine declarations */
+
+extern bdd bdd_apply2 ARGS((cmu_bdd_manager, bdd (*) ARGS((cmu_bdd_manager, bdd *, bdd *, pointer)), bdd, bdd, pointer));
+extern bdd bdd_apply1 ARGS((cmu_bdd_manager, bdd (*) ARGS((cmu_bdd_manager, bdd *, pointer)), bdd, pointer));
+
+
+/* Size and profile routine declarations */
+
+extern long cmu_bdd_size ARGS((cmu_bdd_manager, bdd, int));
+extern long cmu_bdd_size_multiple ARGS((cmu_bdd_manager, bdd *, int));
+extern void cmu_bdd_profile ARGS((cmu_bdd_manager, bdd, long *, int));
+extern void cmu_bdd_profile_multiple ARGS((cmu_bdd_manager, bdd *, long *, int));
+extern void cmu_bdd_function_profile ARGS((cmu_bdd_manager, bdd, long *));
+extern void cmu_bdd_function_profile_multiple ARGS((cmu_bdd_manager, bdd *, long *));
+
+
+/* Print routine declarations */
+
+#define bdd_naming_fn_none ((char *(*)(cmu_bdd_manager, bdd, pointer))0)
+#define bdd_terminal_id_fn_none ((char *(*)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer))0)
+
+extern void cmu_bdd_print_bdd ARGS((cmu_bdd_manager,
+				bdd,
+				char *(*) ARGS((cmu_bdd_manager, bdd, pointer)),
+				char *(*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)),
+				pointer,
+				FILE *));
+extern void cmu_bdd_print_profile_aux ARGS((cmu_bdd_manager,
+					long *,
+					char *(*) ARGS((cmu_bdd_manager, bdd, pointer)),
+					pointer,
+					int,
+					FILE *));
+extern void cmu_bdd_print_profile ARGS((cmu_bdd_manager,
+				    bdd,
+				    char *(*) ARGS((cmu_bdd_manager, bdd, pointer)),
+				    pointer,
+				    int,
+				    FILE *));
+extern void cmu_bdd_print_profile_multiple ARGS((cmu_bdd_manager,
+					     bdd *,
+					     char *(*) ARGS((cmu_bdd_manager, bdd, pointer)),
+					     pointer,
+					     int,
+					     FILE *));
+extern void cmu_bdd_print_function_profile ARGS((cmu_bdd_manager,
+					     bdd,
+					     char *(*) ARGS((cmu_bdd_manager, bdd, pointer)),
+					     pointer,
+					     int,
+					     FILE *));
+extern void cmu_bdd_print_function_profile_multiple ARGS((cmu_bdd_manager,
+						      bdd *,
+						      char *(*) ARGS((cmu_bdd_manager, bdd, pointer)),
+						      pointer,
+						      int,
+						      FILE *));
+
+
+/* Dump/undump routine declarations */
+
+extern int cmu_bdd_dump_bdd ARGS((cmu_bdd_manager, bdd, bdd *, FILE *));
+extern bdd cmu_bdd_undump_bdd ARGS((cmu_bdd_manager, bdd *, FILE *, int *));
+
+
+/* Support routine declarations */
+
+extern int cmu_bdd_depends_on ARGS((cmu_bdd_manager, bdd, bdd));
+extern void cmu_bdd_support ARGS((cmu_bdd_manager, bdd, bdd *));
+
+
+/* Unique table routine declarations */
+
+extern void cmu_bdd_gc ARGS((cmu_bdd_manager));
+extern void cmu_bdd_clear_refs ARGS((cmu_bdd_manager));
+
+
+/* Dynamic reordering routines */
+
+#define cmu_bdd_reorder_none ((void (*)(cmu_bdd_manager))0)
+
+extern void cmu_bdd_reorder_stable_window3 ARGS((cmu_bdd_manager));
+extern void cmu_bdd_reorder_sift ARGS((cmu_bdd_manager));
+extern void cmu_bdd_reorder_hybrid ARGS((cmu_bdd_manager));
+extern void cmu_bdd_var_block_reorderable ARGS((cmu_bdd_manager, block, int));
+extern void cmu_bdd_dynamic_reordering ARGS((cmu_bdd_manager, void (*) ARGS((cmu_bdd_manager))));
+extern void cmu_bdd_reorder ARGS((cmu_bdd_manager));
+
+extern bdd cmu_bdd_project ARGS((cmu_bdd_manager, bdd));
+
+/* Variable block routines */
+
+extern block cmu_bdd_new_var_block ARGS((cmu_bdd_manager, bdd, long));
+
+
+/* Multi-terminal BDD routine declarations */
+
+extern void mtbdd_transform_closure ARGS((cmu_bdd_manager,
+					  int (*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)),
+					  void (*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, INT_PTR *, INT_PTR *, pointer)),
+					  pointer));
+extern void mtcmu_bdd_one_data ARGS((cmu_bdd_manager, INT_PTR, INT_PTR));
+extern void cmu_mtbdd_free_terminal_closure ARGS((cmu_bdd_manager,
+					      void (*) ARGS((cmu_bdd_manager, INT_PTR, INT_PTR, pointer)),
+					      pointer));
+extern bdd cmu_mtbdd_get_terminal ARGS((cmu_bdd_manager, INT_PTR, INT_PTR));
+extern void cmu_mtbdd_terminal_value ARGS((cmu_bdd_manager, bdd, INT_PTR *, INT_PTR *));
+extern bdd mtcmu_bdd_ite ARGS((cmu_bdd_manager, bdd, bdd, bdd));
+extern bdd cmu_mtbdd_equal ARGS((cmu_bdd_manager, bdd, bdd));
+extern bdd mtcmu_bdd_substitute ARGS((cmu_bdd_manager, bdd));
+#define mtbdd_transform(bddm, f) (cmu_bdd_not(bddm, f))
+
+
+#undef ARGS
+
+#endif
Index: /vis_dev/glu-2.1/src/cmuBdd/bddwarn.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/bddwarn.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/bddwarn.c	(revision 6)
@@ -0,0 +1,72 @@
+/* BDD error and argument checking routines */
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "bddint.h"
+
+#if STDC_HEADERS
+#  include <stdlib.h>
+#else
+#  if defined(__STDC__)
+extern void exit(int);
+#  else
+extern void exit();
+#  endif
+#endif
+
+
+/* cmu_bdd_warning(message) prints a warning and returns. */
+
+void
+cmu_bdd_warning(char *message)
+{
+  fprintf(stderr, "BDD library: warning: %s\n", message);
+}
+
+
+/* cmu_bdd_fatal(message) prints an error message and exits. */
+
+void
+cmu_bdd_fatal(char *message)
+{
+  fprintf(stderr, "BDD library: error: %s\n", message);
+  exit(1);
+  /* NOTREACHED */
+}
+
+
+int
+bdd_check_arguments(int count, ...)
+{
+  int all_valid;
+  va_list ap;
+  bdd f;
+
+  va_start(ap, count);
+  all_valid=1;
+  while (count)
+    {
+      f=va_arg(ap, bdd);
+      {
+	BDD_SETUP(f);
+	if (!f)
+	  all_valid=0;
+	else if (BDD_REFS(f) == 0)
+	  cmu_bdd_fatal("bdd_check_arguments: argument has zero references");
+      }
+      --count;
+    }
+  return (all_valid);
+}
+
+
+void
+bdd_check_array(bdd *fs)
+{
+  while (*fs)
+    {
+      bdd_check_arguments(1, *fs);
+      ++fs;
+    }
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/cmuBdd.make
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/cmuBdd.make	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/cmuBdd.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC_cmu += bdd.c bdd_is_cube.c bddapply.c bddassoc.c bddblk.c bddcache.c bddcmp.c bddcomp.c bddcproject.c bdddump.c bddhash.c bddmisc.c bddprimes.c bddprint.c bddprprofile.c bddqnt.c bddreduce.c bddrelprod.c bddreorder.c bddsat.c bddsize.c bddsupport.c bddswap.c bddunique.c bddwarn.c mtbdd.c 
+HEADERS_cmu += bddint.h bdduser.h 
+MISC += testbdd.c bdd.3 
+
+DEPENDENCYFILES = $(CSRC_cmu)
Index: /vis_dev/glu-2.1/src/cmuBdd/mtbdd.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/mtbdd.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/mtbdd.c	(revision 6)
@@ -0,0 +1,228 @@
+/* Basic multi-terminal BDD routines */
+
+
+#include "bddint.h"
+
+
+/* mtbdd_transform_closure(bddm, canonical_fn, transform_fn, env) sets */
+/* the transformation for MTBDD terminal values for the "negative-output" */
+/* pointer flag.  The canonical_fn receives the BDD manager, two longs */
+/* representing the input value, and the value of env.  It should return */
+/* a non-zero value if the result needs to be transformed.  The */
+/* transform_fn receives the BDD manager, two longs (the input value), */
+/* pointers to two longs (for the output) and the value of env.  This */
+/* should not be called after any MTBDD terminals are created. */
+
+void
+mtbdd_transform_closure(cmu_bdd_manager bddm,
+			int (*canonical_fn)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer),
+			void (*transform_fn)(cmu_bdd_manager, INT_PTR, INT_PTR, INT_PTR *, INT_PTR *, pointer),
+			pointer transform_env)
+{
+  bddm->transform_fn=transform_fn;
+  bddm->transform_env=transform_env;
+  bddm->canonical_fn=canonical_fn;
+}
+
+
+/* mtcmu_bdd_one_data(bddm, value1, value2) sets the MTBDD value for TRUE. */
+/* This should not be called after MTBDD terminals have been created. */
+
+void
+mtcmu_bdd_one_data(cmu_bdd_manager bddm, INT_PTR value1, INT_PTR value2)
+{
+  var_table table;
+  long hash;
+
+  table=bddm->unique_table.tables[BDD_CONST_INDEXINDEX];
+  if (table->entries != 1)
+    cmu_bdd_fatal("mtcmu_bdd_one_data: other terminal nodes already exist");
+  hash=HASH_NODE(bddm->one->data[0], bddm->one->data[1]);
+  BDD_REDUCE(hash, table->size);
+  table->table[hash]=0;
+  bddm->one->data[0]=value1;
+  bddm->one->data[1]=value2;
+  hash=HASH_NODE(bddm->one->data[0], bddm->one->data[1]);
+  BDD_REDUCE(hash, table->size);
+  table->table[hash]=bddm->one;
+}
+
+
+/* cmu_mtbdd_free_terminal_closure(bddm, free_terminal_fn, free_terminal_env) */
+/* sets the closure to be invoked on when freeing MTBDD terminals.  If */
+/* free_terminal_fn is null, it indicates that no function should be */
+/* called.  The free_terminal_fn gets the BDD manager, two longs */
+/* holding the data for the terminal, and the value of free_terminal_env. */
+
+void
+cmu_mtbdd_free_terminal_closure(cmu_bdd_manager bddm,
+			    void (*free_terminal_fn)(cmu_bdd_manager, INT_PTR, INT_PTR, pointer),
+			    pointer free_terminal_env)
+{
+  bddm->unique_table.free_terminal_fn=free_terminal_fn;
+  bddm->unique_table.free_terminal_env=free_terminal_env;
+}
+
+
+/* cmu_mtbdd_get_terminal(bddm, value1, value2) returns the multi-terminal */
+/* BDD for a constant. */
+
+bdd
+cmu_mtbdd_get_terminal(cmu_bdd_manager bddm, INT_PTR value1, INT_PTR value2)
+{
+  FIREWALL(bddm);
+  RETURN_BDD(bdd_find_terminal(bddm, value1, value2));
+}
+
+
+/* cmu_mtbdd_terminal_value(bddm, f, value1, value2) returns the data value */
+/* for the terminal node f. */
+
+void
+cmu_mtbdd_terminal_value(cmu_bdd_manager bddm, bdd f, INT_PTR *value1, INT_PTR *value2)
+{
+  if (bdd_check_arguments(1, f))
+    {
+      BDD_SETUP(f);
+      if (!BDD_IS_CONST(f))
+	{
+	  cmu_bdd_warning("mtbdd_terminal_data: argument is terminal node");
+	  *value1=0;
+	  *value2=0;
+	  return;
+	}
+      cmu_mtbdd_terminal_value_aux(bddm, f, value1, value2);
+    }
+}
+
+
+static
+bdd
+mtcmu_bdd_ite_step(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd h1, h2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  BDD_SETUP(h);
+  if (BDD_IS_CONST(f))
+    {
+      if (f == BDD_ONE(bddm))
+	{
+	  BDD_TEMP_INCREFS(g);
+	  return (g);
+	}
+      BDD_TEMP_INCREFS(h);
+      return (h);
+    }
+  /* f is not constant. */
+  if (g == h)
+    {
+      BDD_TEMP_INCREFS(g);
+      return (g);
+    }
+  /* f is not constant, g and h are distinct. */
+  if (!BDD_IS_OUTPOS(f))
+    {
+      f=BDD_NOT(f);
+      BDD_SWAP(g, h);
+    }
+  /* f is now an uncomplemented output pointer. */
+  if (bdd_lookup_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)h, (INT_PTR *)&result))
+    return (result);
+  BDD_TOP_VAR3(top_indexindex, bddm, f, g, h);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  BDD_COFACTOR(top_indexindex, h, h1, h2);
+  temp1=mtcmu_bdd_ite_step(bddm, f1, g1, h1);
+  temp2=mtcmu_bdd_ite_step(bddm, f2, g2, h2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache31(bddm, CACHE_TYPE_ITE, (INT_PTR)f, (INT_PTR)g, (INT_PTR)h, (INT_PTR)result);
+  return (result);
+}
+
+
+/* mtcmu_bdd_ite(bddm, f, g, h) returns the BDD for "if f then g else h", */
+/* where g and h are multi-terminal BDDs. */
+
+bdd
+mtcmu_bdd_ite(cmu_bdd_manager bddm, bdd f, bdd g, bdd h)
+{
+  if (bdd_check_arguments(3, f, g, h))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(mtcmu_bdd_ite_step(bddm, f, g, h));
+    }
+  return ((bdd)0);
+}
+
+
+/* mtcmu_bdd_substitute(bddm, f) does the analog of cmu_bdd_substitute for MTBDDs. */
+
+bdd
+mtcmu_bdd_substitute(cmu_bdd_manager bddm, bdd f)
+{
+  long op;
+
+  if (bdd_check_arguments(1, f))
+    {
+      FIREWALL(bddm);
+      if (bddm->curr_assoc_id == -1)
+	op=bddm->temp_op--;
+      else
+	op=OP_SUBST+bddm->curr_assoc_id;
+      RETURN_BDD(cmu_bdd_substitute_step(bddm, f, op, mtcmu_bdd_ite_step, bddm->curr_assoc));
+    }
+  return ((bdd)0);
+}
+
+
+static
+bdd
+cmu_mtbdd_equal_step(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (f == g)
+    return (BDD_ONE(bddm));
+  if (BDD_IS_CONST(f) && BDD_IS_CONST(g))
+    return (BDD_ZERO(bddm));
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (bdd_lookup_in_cache2(bddm, OP_EQUAL, f, g, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=cmu_mtbdd_equal_step(bddm, f1, g1);
+  temp2=cmu_mtbdd_equal_step(bddm, f2, g2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache2(bddm, OP_EQUAL, f, g, result);
+  return (result);
+}
+
+
+/* cmu_mtbdd_equal(bddm, f, g) returns a BDD indicating when the */
+/* multi-terminal BDDs f and g are equal. */
+
+bdd
+cmu_mtbdd_equal(cmu_bdd_manager bddm, bdd f, bdd g)
+{
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(cmu_mtbdd_equal_step(bddm, f, g));
+    }
+  return ((bdd)0);
+}
Index: /vis_dev/glu-2.1/src/cmuBdd/testbdd.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuBdd/testbdd.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuBdd/testbdd.c	(revision 6)
@@ -0,0 +1,1319 @@
+/* Basic operation tests */
+
+
+#include <stdio.h>
+#if HAVE_STDARG_H
+#  include <stdarg.h>
+#else
+#  if HAVE_VARARGS_H
+#    include <varargs.h>
+#  else
+#    error "Need to have HAVE_STDARG_H or HAVE_VARARGS_H defined for variable arguments"
+#  endif
+#endif
+#if STDC_HEADERS
+#  include <stdlib.h>
+#endif
+
+#include "bddint.h"
+
+
+#define VARS 500
+
+
+#define TT_BITS 32		/* Size of tt in bits */
+#define TT_VARS 5		/* log2 of BITS */
+/* Also see cofactor_masks below. */
+
+	/* Number of trials to run */
+/* #define ITERATIONS 20000 */
+#define ITERATIONS 200
+
+
+#if defined(__STDC__)
+#if STDC_HEADERS
+#include <stdlib.h>
+#else
+extern void srandom(unsigned int);
+extern long random(void);
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#else
+extern int unlink(char *);
+#endif
+#else
+extern void srandom();
+extern long random();
+extern int unlink();
+#endif
+
+
+typedef unsigned long tt;	/* "Truth table" */
+
+
+static cmu_bdd_manager bddm;
+
+
+static bdd vars[VARS];
+static bdd aux_vars[VARS];
+
+
+static tt cofactor_masks[]=
+{
+  0xffff0000,
+  0xff00ff00,
+  0xf0f0f0f0,
+  0xcccccccc,
+  0xaaaaaaaa,
+};
+
+
+static
+bdd
+#if defined(__STDC__)
+decode(int var, tt table)
+#else
+decode(var, table)
+     int var;
+     tt table;
+#endif
+{
+  bdd temp1, temp2;
+  bdd result;
+
+  if (var == TT_VARS)
+    return ((table & 1) ? cmu_bdd_one(bddm) : cmu_bdd_zero(bddm));
+  temp1=decode(var+1, table >> (1 << (TT_VARS-var-1)));
+  temp2=decode(var+1, table);
+  result=cmu_bdd_ite(bddm, vars[var], temp1, temp2);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  return (result);
+}
+
+
+#define encoding_to_bdd(table) (decode(0, (table)))
+
+
+static union hack_u {
+  INT_PTR as_double_space[2];
+  double  double_value;
+} hack;
+
+static
+double
+#if defined(__STDC__)
+as_double(INT_PTR v1, INT_PTR v2)
+#else
+as_double(v1, v2)
+     INT_PTR v1;
+     INT_PTR v2;
+#endif
+{
+  hack.as_double_space[0]=v1;
+  hack.as_double_space[1]=v2;
+  return (hack.double_value);
+}
+
+
+static
+void
+#if defined(__STDC__)
+as_INT_PTRs(double n, INT_PTR *r1, INT_PTR *r2)
+#else
+as_INT_PTRs(n, r1, r2)
+     double n;
+     INT_PTR *r1;
+     INT_PTR *r2;
+#endif
+{
+  hack.double_value=n;
+  *r1=hack.as_double_space[0];
+  *r2=hack.as_double_space[1];
+}
+
+
+static
+char *
+#if defined(__STDC__)
+terminal_id_fn(cmu_bdd_manager bddm, INT_PTR v1, INT_PTR v2, pointer junk)
+#else
+terminal_id_fn(bddm, v1, v2, junk)
+     cmu_bdd_manager bddm;
+     INT_PTR v1;
+     INT_PTR v2;
+     pointer junk;
+#endif
+{
+  static char result[100];
+
+  sprintf(result, "%g", as_double(v1, v2));
+  return (result);
+}
+
+
+static
+void
+#if defined(__STDC__)
+print_bdd(bdd f)
+#else
+print_bdd(f)
+     bdd f;
+#endif
+{
+  cmu_bdd_print_bdd(bddm, f, bdd_naming_fn_none, terminal_id_fn, (pointer)0, stderr);
+}
+
+
+#if defined(__STDC__)
+static
+void
+error(char *op, bdd result, bdd expected, ...)
+{
+  int i;
+  va_list ap;
+  bdd f;
+
+  va_start(ap, expected);
+  fprintf(stderr, "\nError: operation %s:\n", op);
+  i=0;
+  while (1)
+    {
+      f=va_arg(ap, bdd);
+      if (f)
+	{
+	  ++i;
+	  fprintf(stderr, "Argument %d:\n", i);
+	  print_bdd(f);
+	}
+      else
+	break;
+    }
+  fprintf(stderr, "Result:\n");
+  print_bdd(result);
+  fprintf(stderr, "Expected result:\n");
+  print_bdd(expected);
+  va_end(ap);
+}
+#else
+static
+void
+error(va_alist)
+     va_dcl
+{
+  int i;
+  va_list ap;
+  char *op;
+  bdd result;
+  bdd expected;
+  bdd f;
+
+  va_start(ap);
+  op=va_arg(ap, char *);
+  result=va_arg(ap, bdd);
+  expected=va_arg(ap, bdd);
+  fprintf(stderr, "\nError: operation %s:\n", op);
+  i=0;
+  while (1)
+    {
+      f=va_arg(ap, bdd);
+      if (f)
+	{
+	  ++i;
+	  fprintf(stderr, "Argument %d:\n", i);
+	  print_bdd(f);
+	}
+      else
+	break;
+    }
+  fprintf(stderr, "Result:\n");
+  print_bdd(result);
+  fprintf(stderr, "Expected result:\n");
+  print_bdd(expected);
+  va_end(ap);
+}
+#endif
+
+
+static
+tt
+#if defined(__STDC__)
+cofactor(tt table, int var, int value)
+#else
+cofactor(table, var, value)
+     tt table;
+     int var;
+     int value;
+#endif
+{
+  int shift;
+
+  shift=1 << (TT_VARS-var-1);
+  if (value)
+    {
+      table&=cofactor_masks[var];
+      table|=table >> shift;
+    }
+  else
+    {
+      table&=~cofactor_masks[var];
+      table|=table << shift;
+    }
+  return (table);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_ite(bdd f1, tt table1, bdd f2, tt table2, bdd f3, tt table3)
+#else
+test_ite(f1, table1, f2, table2, f3, table3)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+     bdd f3;
+     tt table3;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  result=cmu_bdd_ite(bddm, f1, f2, f3);
+  resulttable=(table1 & table2) | (~table1 & table3);
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("ITE", result, expected, f1, f2, f3, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_and(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_and(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  result=cmu_bdd_and(bddm, f1, f2);
+  resulttable=table1 & table2;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("and", result, expected, f1, f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_or(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_or(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  result=cmu_bdd_or(bddm, f1, f2);
+  resulttable=table1 | table2;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("or", result, expected, f1, f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_xor(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_xor(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  result=cmu_bdd_xor(bddm, f1, f2);
+  resulttable=table1 ^ table2;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("xor", result, expected, f1, f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_id_not(bdd f, tt table)
+#else
+test_id_not(f, table)
+     bdd f;
+     tt table;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  result=cmu_bdd_not(bddm, f);
+  resulttable= ~table;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("not", result, expected, f, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+  result=cmu_bdd_identity(bddm, f);
+  resulttable=table;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("identity", result, expected, f, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_compose(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_compose(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  int var;
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  var=((unsigned long)random())%TT_VARS;
+  result=cmu_bdd_compose(bddm, f1, vars[var], cmu_bdd_one(bddm));
+  resulttable=cofactor(table1, var, 1);
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("restrict1", result, expected, f1, vars[var], (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+  result=cmu_bdd_compose(bddm, f1, vars[var], cmu_bdd_zero(bddm));
+  resulttable=cofactor(table1, var, 0);
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("restrict0", result, expected, f1, vars[var], (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+  result=cmu_bdd_compose(bddm, f1, vars[var], f2);
+  resulttable=(table2 & cofactor(table1, var, 1)) | (~table2 & cofactor(table1, var, 0));
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("compose", result, expected, f1, vars[var], f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_qnt(bdd f, tt table)
+#else
+test_qnt(f, table)
+     bdd f;
+     tt table;
+#endif
+{
+  int var1, var2;
+  bdd assoc[3];
+  bdd temp;
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  var1=((unsigned long)random())%TT_VARS;
+  do
+    var2=((unsigned long)random())%TT_VARS;
+  while (var1 == var2);
+  assoc[0]=vars[var1];
+  assoc[1]=vars[var2];
+  assoc[2]=0;
+  cmu_bdd_temp_assoc(bddm, assoc, 0);
+  cmu_bdd_assoc(bddm, -1);
+  if (random()%2)
+    result=cmu_bdd_exists(bddm, f);
+  else
+    {
+      temp=cmu_bdd_not(bddm, f);
+      result=cmu_bdd_forall(bddm, temp);
+      cmu_bdd_free(bddm, temp);
+      temp=result;
+      result=cmu_bdd_not(bddm, temp);
+      cmu_bdd_free(bddm, temp);
+    }
+  resulttable=cofactor(table, var1, 1) | cofactor(table, var1, 0);
+  resulttable=cofactor(resulttable, var2, 1) | cofactor(resulttable, var2, 0);
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("quantification", result, expected, f, vars[var1], vars[var2], (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_rel_prod(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_rel_prod(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  int var1, var2;
+  bdd assoc[3];
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  var1=((unsigned long)random())%TT_VARS;
+  do
+    var2=((unsigned long)random())%TT_VARS;
+  while (var1 == var2);
+  assoc[0]=vars[var1];
+  assoc[1]=vars[var2];
+  assoc[2]=0;
+  cmu_bdd_temp_assoc(bddm, assoc, 0);
+  cmu_bdd_assoc(bddm, -1);
+  result=cmu_bdd_rel_prod(bddm, f1, f2);
+  table1&=table2;
+  resulttable=cofactor(table1, var1, 1) | cofactor(table1, var1, 0);
+  resulttable=cofactor(resulttable, var2, 1) | cofactor(resulttable, var2, 0);
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("relational product", result, expected, f1, f2, vars[var1], vars[var2], (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_subst(bdd f1, tt table1, bdd f2, tt table2, bdd f3, tt table3)
+#else
+test_subst(f1, table1, f2, table2, f3, table3)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+     bdd f3;
+     tt table3;
+#endif
+{
+  int var1, var2;
+  bdd assoc[6];
+  bdd result;
+  tt resulttable;
+  tt temp1, temp2, temp3, temp4;
+  bdd expected;
+
+  var1=((unsigned long)random())%TT_VARS;
+  do
+    var2=((unsigned long)random())%TT_VARS;
+  while (var1 == var2);
+  assoc[0]=vars[var1];
+  assoc[1]=f2;
+  assoc[2]=vars[var2];
+  assoc[3]=f3;
+  assoc[4]=0;
+  assoc[5]=0;
+  cmu_bdd_temp_assoc(bddm, assoc, 1);
+  cmu_bdd_assoc(bddm, -1);
+  result=cmu_bdd_substitute(bddm, f1);
+  temp1=cofactor(cofactor(table1, var1, 1), var2, 1);
+  temp2=cofactor(cofactor(table1, var1, 1), var2, 0);
+  temp3=cofactor(cofactor(table1, var1, 0), var2, 1);
+  temp4=cofactor(cofactor(table1, var1, 0), var2, 0);
+  resulttable=table2 & table3 & temp1;
+  resulttable|=table2 & ~table3 & temp2;
+  resulttable|=~table2 & table3 & temp3;
+  resulttable|=~table2 & ~table3 & temp4;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("substitute", result, expected, f1, vars[var1], f2, vars[var2], f3, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_inter_impl(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_inter_impl(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+  bdd implies_result;
+
+  result=cmu_bdd_intersects(bddm, f1, f2);
+  resulttable=table1 & table2;
+  expected=encoding_to_bdd(resulttable);
+  implies_result=cmu_bdd_implies(bddm, result, expected);
+  if (implies_result != cmu_bdd_zero(bddm))
+    {
+      error("intersection test", result, expected, f1, f2, (bdd)0);
+      cmu_bdd_free(bddm, implies_result);
+    }
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_sat(bdd f, tt table)
+#else
+test_sat(f, table)
+     bdd f;
+     tt table;
+#endif
+{
+  int var1, var2;
+  bdd assoc[TT_VARS+1];
+  bdd result;
+  bdd temp1, temp2, temp3;
+
+  if (f == cmu_bdd_zero(bddm))
+    return;
+  result=cmu_bdd_satisfy(bddm, f);
+  temp1=cmu_bdd_not(bddm, f);
+  temp2=cmu_bdd_intersects(bddm, temp1, result);
+  if (temp2 != cmu_bdd_zero(bddm))
+    error("intersection of satisfy result with negated argument", temp2, cmu_bdd_zero(bddm), f, (bdd)0);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  var1=((unsigned long)random())%TT_VARS;
+  do
+    var2=((unsigned long)random())%TT_VARS;
+  while (var1 == var2);
+  assoc[0]=vars[var1];
+  assoc[1]=vars[var2];
+  assoc[2]=0;
+  cmu_bdd_temp_assoc(bddm, assoc, 0);
+  cmu_bdd_assoc(bddm, -1);
+  temp1=cmu_bdd_satisfy_support(bddm, result);
+  temp2=cmu_bdd_not(bddm, result);
+  temp3=cmu_bdd_intersects(bddm, temp2, temp1);
+  if (temp3 != cmu_bdd_zero(bddm))
+    error("intersection of satisfy support result with negated argument", temp3, cmu_bdd_zero(bddm), result, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  cmu_bdd_free(bddm, temp3);
+  temp1=cmu_bdd_compose(bddm, f, vars[var1], cmu_bdd_zero(bddm));
+  temp2=cmu_bdd_compose(bddm, f, vars[var1], cmu_bdd_one(bddm));
+  if (cmu_bdd_satisfying_fraction(bddm, temp1)+cmu_bdd_satisfying_fraction(bddm, temp2) !=
+      2.0*cmu_bdd_satisfying_fraction(bddm, f))
+    {
+      fprintf(stderr, "\nError: operation satisfying fraction:\n");
+      fprintf(stderr, "Argument:\n");
+      print_bdd(f);
+      fprintf(stderr, "Cofactor on:\n");
+      print_bdd(vars[var1]);
+    }
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_gen_cof(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_gen_cof(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  int var1, var2;
+  bdd result;
+  bdd temp1, temp2, temp3;
+  tt resulttable;
+  bdd expected;
+
+  result=cmu_bdd_cofactor(bddm, f1, f2);
+  temp1=cmu_bdd_xnor(bddm, result, f1);
+  temp2=cmu_bdd_not(bddm, f2);
+  temp3=cmu_bdd_or(bddm, temp1, temp2);
+  if (temp3 != cmu_bdd_one(bddm))
+    error("d.c. comparison of generalized cofactor", temp3, cmu_bdd_one(bddm), f1, f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  cmu_bdd_free(bddm, temp3);
+  var1=((unsigned long)random())%TT_VARS;
+  do
+    var2=((unsigned long)random())%TT_VARS;
+  while (var1 == var2);
+  temp1=cmu_bdd_not(bddm, vars[var2]);
+  temp2=cmu_bdd_and(bddm, vars[var1], temp1);
+  cmu_bdd_free(bddm, temp1);
+  result=cmu_bdd_cofactor(bddm, f1, temp2);
+  resulttable=cofactor(cofactor(table1, var1, 1), var2, 0);
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("generalized cofactor", result, expected, f1, temp2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+  cmu_bdd_free(bddm, temp2);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_reduce(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_reduce(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  bdd result;
+  bdd temp1, temp2, temp3;
+
+  result=cmu_bdd_reduce(bddm, f1, f2);
+  temp1=cmu_bdd_xnor(bddm, result, f1);
+  temp2=cmu_bdd_not(bddm, f2);
+  temp3=cmu_bdd_or(bddm, temp1, temp2);
+  if (temp3 != cmu_bdd_one(bddm))
+    error("d.c. comparison of reduce", temp3, cmu_bdd_one(bddm), f1, f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  cmu_bdd_free(bddm, temp3);
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+apply_and(cmu_bdd_manager bddm, bdd *f, bdd *g, pointer env)
+#else
+apply_and(bddm, f, g, env)
+     cmu_bdd_manager bddm;
+     bdd *f;
+     bdd *g;
+     pointer env;
+#endif
+{
+  bdd f1, g1;
+
+  f1= *f;
+  g1= *g;
+  {
+    if (f1 == BDD_ZERO(bddm))
+      return (f1);
+    if (g1 == BDD_ZERO(bddm))
+      return (g1);
+    if (f1 == BDD_ONE(bddm))
+      return (g1);
+    if (g1 == BDD_ONE(bddm))
+      return (f1);
+    if ((INT_PTR)f1 < (INT_PTR)g1)
+      {
+	*f=g1;
+	*g=f1;
+      }
+    return ((bdd)0);
+  }
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_apply(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_apply(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  bdd result;
+  tt resulttable;
+  bdd expected;
+
+  result=bdd_apply2(bddm, apply_and, f1, f2, (pointer)0);
+  resulttable=table1 & table2;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("apply2", result, expected, f1, f2, (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_size(bdd f1, tt table1, bdd f2, tt table2)
+#else
+test_size(f1, table1, f2, table2)
+     bdd f1;
+     tt table1;
+     bdd f2;
+     tt table2;
+#endif
+{
+  int i;
+  long size;
+  long profile[2*TT_VARS+1];
+  bdd fs[3];
+
+  size=cmu_bdd_size(bddm, f1, 1);
+  cmu_bdd_profile(bddm, f1, profile, 1);
+  for (i=0; i < 2*TT_VARS+1; ++i)
+    size-=profile[i];
+  if (size)
+    {
+      fprintf(stderr, "\nError: size count vs. profile sum:\n");
+      fprintf(stderr, "Argument:\n");
+      print_bdd(f1);
+    }
+  size=cmu_bdd_size(bddm, f1, 0);
+  cmu_bdd_profile(bddm, f1, profile, 0);
+  for (i=0; i < 2*TT_VARS+1; ++i)
+    size-=profile[i];
+  if (size)
+    {
+      fprintf(stderr, "\nError: no negout size count vs. profile sum:\n");
+      fprintf(stderr, "Argument:\n");
+      print_bdd(f1);
+    }
+  fs[0]=f1;
+  fs[1]=f2;
+  fs[2]=0;
+  size=cmu_bdd_size_multiple(bddm, fs, 1);
+  cmu_bdd_profile_multiple(bddm, fs, profile, 1);
+  for (i=0; i < 2*TT_VARS+1; ++i)
+    size-=profile[i];
+  if (size)
+    {
+      fprintf(stderr, "\nError: multiple size count vs. multiple profile sum:\n");
+      fprintf(stderr, "Argument 1:\n");
+      print_bdd(f1);
+      fprintf(stderr, "Argument 2:\n");
+      print_bdd(f2);
+    }
+}
+
+
+static
+int
+#if defined(__STDC__)
+canonical_fn(cmu_bdd_manager bddm, INT_PTR v1, INT_PTR v2, pointer env)
+#else
+canonical_fn(bddm, v1, v2, env)
+     cmu_bdd_manager bddm;
+     INT_PTR v1;
+     INT_PTR v2;
+     pointer env;
+#endif
+{
+  return (as_double(v1, v2) > 0);
+}
+
+
+static
+void
+#if defined(__STDC__)
+transform_fn(cmu_bdd_manager bddm, INT_PTR v1, INT_PTR v2, INT_PTR *r1, INT_PTR *r2, pointer env)
+#else
+transform_fn(bddm, v1, v2, r1, r2, env)
+     cmu_bdd_manager bddm;
+     INT_PTR v1;
+     INT_PTR v2;
+     INT_PTR *r1;
+     INT_PTR *r2;
+     pointer env;
+#endif
+{
+  as_INT_PTRs(-as_double(v1, v2), r1, r2);
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+terminal(double n)
+#else
+terminal(n)
+     double n;
+#endif
+{
+  INT_PTR v1, v2;
+
+  as_INT_PTRs(n, &v1, &v2);
+  return (cmu_mtbdd_get_terminal(bddm, v1, v2));
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+walsh_matrix(int n)
+#else
+walsh_matrix(n)
+     int n;
+#endif
+{
+  bdd temp1, temp2, temp3;
+  bdd result;
+
+  if (n == TT_VARS)
+    return (terminal(1.0));
+  temp1=walsh_matrix(n+1);
+  temp2=mtbdd_transform(bddm, temp1);
+  temp3=temp2;
+  temp2=mtcmu_bdd_ite(bddm, aux_vars[n], temp3, temp1);
+  cmu_bdd_free(bddm, temp3);
+  result=mtcmu_bdd_ite(bddm, vars[n], temp2, temp1);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  return (result);
+}
+
+
+#define OP_MULT 1000l
+#define OP_ADD 1100l
+
+
+static
+bdd
+#if defined(__STDC__)
+mtbdd_mult_step(cmu_bdd_manager bddm, bdd f, bdd g)
+#else
+mtbdd_mult_step(bddm, f, g)
+     cmu_bdd_manager bddm;
+     bdd f;
+     bdd g;
+#endif
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+  INT_PTR u1, u2;
+  INT_PTR v1, v2;
+  
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (BDD_IS_CONST(f) && BDD_IS_CONST(g))
+    {
+      cmu_mtbdd_terminal_value_aux(bddm, f, &u1, &u2);
+      cmu_mtbdd_terminal_value_aux(bddm, g, &v1, &v2);
+      as_INT_PTRs(as_double(u1, u2)*as_double(v1, v2), &u1, &u2);
+      return (bdd_find_terminal(bddm, u1, u2));
+    }
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (bdd_lookup_in_cache2(bddm, OP_MULT, f, g, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=mtbdd_mult_step(bddm, f1, g1);
+  temp2=mtbdd_mult_step(bddm, f2, g2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache2(bddm, OP_MULT, f, g, result);
+  return (result);
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+mtbdd_mult(cmu_bdd_manager bddm, bdd f, bdd g)
+#else
+mtbdd_mult(bddm, f, g)
+     cmu_bdd_manager bddm;
+     bdd f;
+     bdd g;
+#endif
+{
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(mtbdd_mult_step(bddm, f, g));
+    }
+  return ((bdd)0);
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+mtbdd_add_step(cmu_bdd_manager bddm, bdd f, bdd g)
+#else
+mtbdd_add_step(bddm, f, g)
+     cmu_bdd_manager bddm;
+     bdd f;
+     bdd g;
+#endif
+{
+  bdd_indexindex_type top_indexindex;
+  bdd f1, f2;
+  bdd g1, g2;
+  bdd temp1, temp2;
+  bdd result;
+  INT_PTR u1, u2;
+  INT_PTR v1, v2;
+  
+  BDD_SETUP(f);
+  BDD_SETUP(g);
+  if (BDD_IS_CONST(f) && BDD_IS_CONST(g))
+    {
+      cmu_mtbdd_terminal_value_aux(bddm, f, &u1, &u2);
+      cmu_mtbdd_terminal_value_aux(bddm, g, &v1, &v2);
+      as_INT_PTRs(as_double(u1, u2)+as_double(v1, v2), &u1, &u2);
+      return (bdd_find_terminal(bddm, u1, u2));
+    }
+  if (BDD_OUT_OF_ORDER(f, g))
+    BDD_SWAP(f, g);
+  if (bdd_lookup_in_cache2(bddm, OP_ADD, f, g, &result))
+    return (result);
+  BDD_TOP_VAR2(top_indexindex, bddm, f, g);
+  BDD_COFACTOR(top_indexindex, f, f1, f2);
+  BDD_COFACTOR(top_indexindex, g, g1, g2);
+  temp1=mtbdd_add_step(bddm, f1, g1);
+  temp2=mtbdd_add_step(bddm, f2, g2);
+  result=bdd_find(bddm, top_indexindex, temp1, temp2);
+  bdd_insert_in_cache2(bddm, OP_ADD, f, g, result);
+  return (result);
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+mtbdd_add(cmu_bdd_manager bddm, bdd f, bdd g)
+#else
+mtbdd_add(bddm, f, g)
+     cmu_bdd_manager bddm;
+     bdd f;
+     bdd g;
+#endif
+{
+  if (bdd_check_arguments(2, f, g))
+    {
+      FIREWALL(bddm);
+      RETURN_BDD(mtbdd_add_step(bddm, f, g));
+    }
+  return ((bdd)0);
+}
+
+
+static
+bdd
+#if defined(__STDC__)
+transform(bdd f, bdd g, bdd *elim_vars)
+#else
+transform(f, g, elim_vars)
+     bdd f;
+     bdd g;
+     bdd *elim_vars;
+#endif
+{
+  int i;
+  bdd temp1, temp2;
+  bdd result;
+
+  result=mtbdd_mult(bddm, f, g);
+  for (i=0; i < TT_VARS; ++i)
+    {
+      temp1=cmu_bdd_compose(bddm, result, elim_vars[i], cmu_bdd_one(bddm));
+      temp2=cmu_bdd_compose(bddm, result, elim_vars[i], cmu_bdd_zero(bddm));
+      cmu_bdd_free(bddm, result);
+      result=mtbdd_add(bddm, temp1, temp2);
+      cmu_bdd_free(bddm, temp1);
+      cmu_bdd_free(bddm, temp2);
+    }
+  return (result);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_mtbdd(bdd f1, tt table1)
+#else
+test_mtbdd(f1, table1)
+     bdd f1;
+     tt table1;
+#endif
+{
+  bdd wm;
+  bdd temp1, temp2;
+  bdd result;
+
+  wm=walsh_matrix(0);
+  temp1=transform(wm, f1, vars);
+  temp2=temp1;
+  temp1=transform(wm, temp2, aux_vars);
+  cmu_bdd_free(bddm, wm);
+  cmu_bdd_free(bddm, temp2);
+  temp2=terminal(1.0/TT_BITS);
+  result=mtbdd_mult(bddm, temp1, temp2);
+  cmu_bdd_free(bddm, temp1);
+  cmu_bdd_free(bddm, temp2);
+  if (f1 != result)
+    error("Walsh transformation and inverse", result, f1, (bdd)0);
+  cmu_bdd_free(bddm, result);
+}
+
+
+static
+void
+#if defined(__STDC__)
+test_swap(bdd f, tt table)
+#else
+test_swap(f, table)
+     bdd f;
+     tt table;
+#endif
+{
+  int var1, var2;
+  bdd result;
+  tt resulttable;
+  tt temp1, temp2, temp3, temp4;
+  bdd expected;
+
+  var1=((unsigned long)random())%TT_VARS;
+  var2=((unsigned long)random())%TT_VARS;
+  result=cmu_bdd_swap_vars(bddm, f, vars[var1], vars[var2]);
+  temp1=cofactor(cofactor(table, var1, 1), var2, 1);
+  temp2=cofactor(cofactor(table, var1, 1), var2, 0);
+  temp3=cofactor(cofactor(table, var1, 0), var2, 1);
+  temp4=cofactor(cofactor(table, var1, 0), var2, 0);
+  resulttable=cofactor_masks[var2] & cofactor_masks[var1] & temp1;
+  resulttable|=cofactor_masks[var2] & ~cofactor_masks[var1] & temp2;
+  resulttable|=~cofactor_masks[var2] & cofactor_masks[var1] & temp3;
+  resulttable|=~cofactor_masks[var2] & ~cofactor_masks[var1] & temp4;
+  expected=encoding_to_bdd(resulttable);
+  if (result != expected)
+    error("swap variables", result, expected, f, vars[var1], vars[var2], (bdd)0);
+  cmu_bdd_free(bddm, result);
+  cmu_bdd_free(bddm, expected);
+}
+
+
+static void
+#if defined(__STDC__)
+test_dump(bdd f, tt table)
+#else
+test_dump(f, table)
+     bdd f;
+     tt table;
+#endif
+{
+  FILE *fp;
+  int i, j;
+  bdd dump_vars[TT_VARS+1];
+  bdd temp;
+  bdd result;
+  int err;
+
+  if (!(fp=tmpfile()))
+    {
+      fprintf(stderr, "could not open temporary file\n");
+      exit(1);
+    }
+  for (i=0; i < TT_VARS; ++i)
+    dump_vars[i]=vars[i];
+  dump_vars[i]=0;
+  for (i=0; i < TT_VARS-1; ++i)
+    {
+      j=i+((unsigned long)random())%(TT_VARS-i);
+      temp=dump_vars[i];
+      dump_vars[i]=dump_vars[j];
+      dump_vars[j]=temp;
+    }
+  if (!cmu_bdd_dump_bdd(bddm, f, dump_vars, fp))
+    {
+      fprintf(stderr, "Error: dump failure:\n");
+      fprintf(stderr, "Argument:\n");
+      print_bdd(f);
+      fclose(fp);
+      return;
+    }
+  rewind(fp);
+  if (!(result=cmu_bdd_undump_bdd(bddm, dump_vars, fp, &err)) || err)
+    {
+      fprintf(stderr, "Error: undump failure: code %d:\n", err);
+      fprintf(stderr, "Argument:\n");
+      print_bdd(f);
+      fclose(fp);
+      return;
+    }
+  fclose(fp);
+  if (result != f)
+    error("dump/undump", result, f, f, (bdd)0);
+  cmu_bdd_free(bddm, result);
+}
+
+
+static
+void
+#if defined(__STDC__)
+check_leak(void)
+#else
+check_leak()
+#endif
+{
+  bdd assoc[1];
+
+  assoc[0]=0;
+  cmu_bdd_temp_assoc(bddm, assoc, 0);
+  cmu_bdd_gc(bddm);
+  if (cmu_bdd_total_size(bddm) != 2*TT_VARS+1l)
+    fprintf(stderr, "Memory leak somewhere...\n");
+}
+
+
+static
+void
+#if defined(__STDC__)
+random_tests(int iterations)
+#else
+random_tests(iterations)
+     int iterations;
+#endif
+{
+  int i;
+  tt table1, table2, table3;
+  bdd f1, f2, f3;
+  INT_PTR v1, v2;
+
+  printf("Random operation tests...\n");
+  bddm=cmu_bdd_init();
+  cmu_bdd_node_limit(bddm, 5000);
+  mtbdd_transform_closure(bddm, canonical_fn, transform_fn, (pointer)0);
+  as_INT_PTRs(-1.0, &v1, &v2);
+  mtcmu_bdd_one_data(bddm, v1, v2);
+  vars[1]=cmu_bdd_new_var_last(bddm);
+  vars[0]=cmu_bdd_new_var_first(bddm);
+  vars[4]=cmu_bdd_new_var_after(bddm, vars[1]);
+  vars[3]=cmu_bdd_new_var_before(bddm, vars[4]);
+  vars[2]=cmu_bdd_new_var_after(bddm, vars[1]);
+  for (i=0; i < 5; ++i)
+    aux_vars[i]=cmu_bdd_new_var_after(bddm, vars[i]);
+  for (i=0; i < iterations; ++i)
+    {
+      if ((i & 0xf) == 0)
+	{
+	  putchar('.');
+	  fflush(stdout);
+	}
+      if ((i & 0x3ff) == 0x3ff)
+	{
+	  putchar('\n');
+	  fflush(stdout);
+	  check_leak();
+	}
+      table1=random();
+      table2=random();
+      table3=random();
+      f1=encoding_to_bdd(table1);
+      f2=encoding_to_bdd(table2);
+      f3=encoding_to_bdd(table3);
+      test_ite(f1, table1, f2, table2, f3, table3);
+      test_and(f1, table1, f2, table2);
+      test_or(f1, table1, f2, table2);
+      test_xor(f1, table1, f2, table2);
+      test_id_not(f1, table1);
+      test_compose(f1, table1, f2, table2);
+      test_qnt(f1, table1);
+      test_rel_prod(f1, table1, f2, table2);
+      test_subst(f1, table1, f2, table2, f3, table3);
+      test_inter_impl(f1, table1, f2, table2);
+      test_sat(f1, table1);
+      test_gen_cof(f1, table1, f2, table2);
+      test_reduce(f1, table1, f2, table2);
+      test_apply(f1, table1, f2, table2);
+      test_size(f1, table1, f2, table2);
+      test_mtbdd(f1, table1);
+      test_swap(f1, table1);
+      if (i < 100)
+	test_dump(f1, table1);
+      cmu_bdd_free(bddm, f1);
+      cmu_bdd_free(bddm, f2);
+      cmu_bdd_free(bddm, f3);
+    }
+  putchar('\n');
+  cmu_bdd_stats(bddm, stdout);
+  cmu_bdd_quit(bddm);
+}
+
+
+int
+#if defined(__STDC__)
+main(void)
+#else
+main()
+#endif
+{
+  (void) srandom((unsigned) 1);
+  random_tests(ITERATIONS);
+  exit(0);
+}
Index: /vis_dev/glu-2.1/src/cmuPort/cmuPort.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuPort/cmuPort.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuPort/cmuPort.c	(revision 6)
@@ -0,0 +1,2936 @@
+/**CFile***********************************************************************
+
+  FileName    [cmuPort.c]
+
+  PackageName [cmu_port]
+
+  Synopsis    [Port routines for CMU package.]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Thomas R. Shiple. Some changes by Rajeev K. Ranjan.]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: cmuPort.c,v 1.78 2003/08/05 20:28:24 fabio Exp $]
+
+******************************************************************************/
+
+#include "cmuPortInt.h" 
+#ifndef	EPD_MAX_BIN
+#include "epd.h" 
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Builds the bdd_t structure.]
+
+  Description [Builds the bdd_t structure from manager and node.
+  Assumes that the reference count of the node has already been
+  increased.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_construct_bdd_t(bdd_manager *manager, bdd_node *func)
+{
+    bdd_t *result;
+    cmu_bdd_manager mgr = (cmu_bdd_manager)manager;
+    bdd fn = (bdd)func;
+
+    if (fn == (struct bdd_ *) 0) {
+	cmu_bdd_fatal("bdd_construct_bdd_t: possible memory overflow");
+    }
+
+    result = ALLOC(bdd_t, 1);
+    result->mgr = mgr;
+    result->node = fn;
+    result->free = FALSE;
+    return result;
+}
+
+/**Function********************************************************************
+  Synopsis           [required]
+
+  Description        [optional]
+
+  SideEffects        [required]
+
+  SeeAlso            [optional]
+******************************************************************************/
+bdd_package_type_t
+bdd_get_package_name(void)
+{
+  return CMU;
+}
+
+/*
+BDD Manager Allocation And Destruction ----------------------------------------
+*/
+void
+bdd_end(bdd_manager *manager)
+{
+    bdd_external_hooks *hooks;
+    cmu_bdd_manager mgr = (cmu_bdd_manager)manager;
+    hooks = (bdd_external_hooks *) mgr->hooks;
+    FREE(hooks); 
+    cmu_bdd_quit(mgr);
+}
+
+
+bdd_manager *
+bdd_start(int nvariables)
+{
+    struct bdd_manager_ *mgr;
+    int i;
+    bdd_external_hooks *hooks;
+   
+    mgr = cmu_bdd_init();    /*no args*/
+
+    /*
+     * Calls to UCB bdd_get_variable are translated into cmu_bdd_var_with_id calls.  However,
+     * cmu_bdd_var_with_id assumes that single variable BDDs have already been created for 
+     * all the variables that we wish to access.  Thus, following, we explicitly create n
+     * variables.  We do not care about the return value of cmu_bdd_new_var_last; in the 
+     * CMU package, the single variable BDDs are NEVER garbage collected.
+     */
+    for (i = 0; i < nvariables; i++) {
+	(void) cmu_bdd_new_var_last(mgr);
+    }
+
+    hooks = ALLOC(bdd_external_hooks, 1);
+    hooks->mdd = hooks->network = hooks->undef1 = (char *) 0;
+    mgr->hooks = (char *) hooks;  /* new field added to CMU manager */
+
+    return (bdd_manager *) mgr;
+}
+
+/*
+BDD Variable Allocation -------------------------------------------------------
+*/
+
+bdd_t *
+bdd_create_variable(bdd_manager *manager)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  return bdd_construct_bdd_t(mgr, cmu_bdd_new_var_last(mgr));
+}
+
+bdd_t *
+bdd_create_variable_after(bdd_manager *manager, bdd_variableId after_id)
+{
+  struct bdd_ *after_var;
+  bdd_t 	*result;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+
+  after_var = cmu_bdd_var_with_id(mgr, (long)after_id + 1);
+  
+  result =  bdd_construct_bdd_t(mgr, cmu_bdd_new_var_after(mgr, after_var));
+  
+  /* No need to free after_var, since single variable BDDs are never garbage collected */
+  
+  return result;
+}
+
+
+
+bdd_t *
+bdd_get_variable(bdd_manager *manager, bdd_variableId variable_ID)
+{
+  struct bdd_ *fn;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  fn = cmu_bdd_var_with_id(mgr, (long) (variable_ID + 1));
+
+  if (fn == (struct bdd_ *) 0) {
+	/* variable should always be found, since they are created at bdd_start */
+	cmu_bdd_fatal("bdd_get_variable: assumption violated");
+  }
+  
+  return bdd_construct_bdd_t(mgr, fn);
+}
+
+/*
+BDD Formula Management --------------------------------------------------------
+*/
+
+bdd_t *
+bdd_dup(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->mgr, cmu_bdd_identity(f->mgr, f->node));
+}
+
+void
+bdd_free(bdd_t *f)
+{
+  if (f == NIL(bdd_t)) {
+	fail("bdd_free: trying to free a NIL bdd_t");			
+  }
+  
+  if (f->free == TRUE) {
+	fail("bdd_free: trying to free a freed bdd_t");			
+  }	
+  
+  cmu_bdd_free(f->mgr, f->node);
+  
+  /*
+   * In case the user tries to free this bdd_t again, set the free field to TRUE, 
+     * and NIL out the other fields.  Then free the bdd_t structure itself.
+     */
+  f->free = TRUE;
+  f->node = NIL(struct bdd_);
+  f->mgr = NIL(struct bdd_manager_);
+  FREE(f);  
+}
+
+/*
+  Operations on BDD Formulas ----------------------------------------------------
+  */
+
+bdd_t *
+bdd_and(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase)
+{
+  struct bdd_ *temp1, *temp2;
+  bdd_t *result;
+  struct bdd_manager_ *mgr;
+  
+  mgr = f->mgr;
+  temp1 = ( (f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : cmu_bdd_not(mgr, f->node));
+  temp2 = ( (g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : cmu_bdd_not(mgr, g->node));
+  result = bdd_construct_bdd_t(mgr, cmu_bdd_and(mgr, temp1, temp2));
+  cmu_bdd_free(mgr, temp1);
+  cmu_bdd_free(mgr, temp2);
+  return result;
+}
+
+bdd_t *
+bdd_and_with_limit(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase,
+  unsigned int limit)
+{
+  /* Unsupported: fall back on standard AND. */
+  return bdd_and(f, g, f_phase, g_phase);
+}
+
+bdd_t *
+bdd_and_array(
+  bdd_t *f,
+  array_t *g_array,
+  boolean f_phase,
+  boolean g_phase)
+{
+  struct bdd_ *temp1, *temp2, *result;
+  bdd_t *g;
+  struct bdd_manager_ *mgr;
+  int i;
+
+  mgr = f->mgr;
+  result = ((f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) :
+            cmu_bdd_not(mgr, f->node)); 
+
+  for (i = 0; i < array_n(g_array); i++) {
+    g = array_fetch(bdd_t *, g_array, i);
+    temp1 = result;
+    temp2 = ((g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) :
+             cmu_bdd_not(mgr, g->node));
+    result = cmu_bdd_and(mgr, temp1, temp2);
+    cmu_bdd_free(mgr, temp1);
+    cmu_bdd_free(mgr, temp2);
+    if (result == NULL)
+      return(NULL);
+  }
+
+  return(bdd_construct_bdd_t(mgr, result));
+}
+
+bdd_t *
+bdd_multiway_and(bdd_manager *manager, array_t *bddArray)
+{
+  int i;
+  bdd temp, result;
+  bdd_t *operand;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  result = cmu_bdd_one(mgr);
+  for (i=0; i<array_n(bddArray); i++){
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = cmu_bdd_and(mgr, result, operand->node);
+    cmu_bdd_free(mgr, result);
+    result = temp;
+  }
+  return bdd_construct_bdd_t(mgr, result);
+}
+
+bdd_t *
+bdd_multiway_or(bdd_manager *manager, array_t *bddArray)
+{
+  int i;
+  bdd temp, result;
+  bdd_t *operand;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  result = cmu_bdd_zero(mgr);
+  for (i=0; i<array_n(bddArray); i++){
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = cmu_bdd_or(mgr, result, operand->node);
+    cmu_bdd_free(mgr, result);
+    result = temp;
+  }
+  return bdd_construct_bdd_t(mgr, result);
+}
+
+bdd_t *
+bdd_multiway_xor(bdd_manager *manager, array_t *bddArray)
+{
+  int i;
+  bdd temp, result;
+  bdd_t *operand;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  result = cmu_bdd_zero(mgr);
+  for (i=0; i<array_n(bddArray); i++){
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = cmu_bdd_xor(mgr, result, operand->node);
+    cmu_bdd_free(mgr, result);
+    result = temp;
+  }
+  return bdd_construct_bdd_t(mgr, result);
+}
+
+array_t *
+bdd_pairwise_or(bdd_manager *manager, array_t *bddArray1, array_t
+                *bddArray2) 
+{
+  int i;
+  bdd_t *operand1, *operand2;
+  array_t *resultArray;
+  bdd result;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  if (array_n(bddArray1) != array_n(bddArray2)){
+    fprintf(stderr, "bdd_pairwise_or: Arrays of different lengths.\n");
+    return NIL(array_t);
+  }
+  resultArray = array_alloc(bdd_t *, 0);
+  for (i=0; i<array_n(bddArray1); i++){
+    operand1 = array_fetch(bdd_t *, bddArray1, i);
+    operand2 = array_fetch(bdd_t *, bddArray2, i);
+    result = cmu_bdd_or(mgr, operand1->node, operand2->node);
+    array_insert_last(bdd_t*, resultArray,
+                      bdd_construct_bdd_t(mgr, result)); 
+  }
+  return resultArray;
+}
+
+array_t *
+bdd_pairwise_and(bdd_manager *manager, array_t *bddArray1, array_t
+                 *bddArray2) 
+{
+  int i;
+  bdd_t *operand1, *operand2;
+  array_t *resultArray;
+  bdd result;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  if (array_n(bddArray1) != array_n(bddArray2)){
+    fprintf(stderr, "bdd_pairwise_and: Arrays of different lengths.\n");
+    return NIL(array_t);
+  }
+  resultArray = array_alloc(bdd_t *, 0);
+  for (i=0; i<array_n(bddArray1); i++){
+    operand1 = array_fetch(bdd_t *, bddArray1, i);
+    operand2 = array_fetch(bdd_t *, bddArray2, i);
+    result = cmu_bdd_and(mgr, operand1->node, operand2->node);
+    array_insert_last(bdd_t*, resultArray,
+                      bdd_construct_bdd_t(mgr, result)); 
+  }
+  return resultArray;
+}
+
+array_t *
+bdd_pairwise_xor(bdd_manager *manager, array_t *bddArray1, array_t
+                 *bddArray2) 
+{
+  int i;
+  bdd_t *operand1, *operand2;
+  array_t *resultArray;
+  bdd result;
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  if (array_n(bddArray1) != array_n(bddArray2)){
+    fprintf(stderr, "bdd_pairwise_xor: Arrays of different lengths.\n");
+    return NIL(array_t);
+  }
+  resultArray = array_alloc(bdd_t *, 0);
+  for (i=0; i<array_n(bddArray1); i++){
+    operand1 = array_fetch(bdd_t *, bddArray1, i);
+    operand2 = array_fetch(bdd_t *, bddArray2, i);
+    result = cmu_bdd_xor(mgr, operand1->node, operand2->node);
+    array_insert_last(bdd_t*, resultArray,
+                      bdd_construct_bdd_t(mgr, result)); 
+  }
+  return resultArray;
+}
+
+bdd_t *
+bdd_and_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars /* of bdd_t *'s */)
+{
+  int num_vars, i;
+  bdd_t *fn, *result;
+  struct bdd_ **assoc;
+  struct bdd_manager_ *mgr;
+  
+  num_vars = array_n(smoothing_vars);
+  if (num_vars <= 0) {
+	cmu_bdd_fatal("bdd_and_smooth: no smoothing variables");
+  }
+  
+  assoc = ALLOC(struct bdd_ *, num_vars+1);
+  
+  for (i = 0; i < num_vars; i++) {
+	fn = array_fetch(bdd_t *, smoothing_vars, i);
+	assoc[i] = fn->node;
+  }
+  assoc[num_vars] = (struct bdd_ *) 0;
+  
+  mgr = f->mgr;
+  cmu_bdd_temp_assoc(mgr, assoc, 0);
+  (void) cmu_bdd_assoc(mgr, -1);  /* set the temp association as the current association */
+  
+  result = bdd_construct_bdd_t(mgr, cmu_bdd_rel_prod(mgr, f->node, g->node));
+  FREE(assoc);
+  return result;
+}
+
+bdd_t *
+bdd_and_smooth_with_limit(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars /* of bdd_t *'s */,
+  unsigned int limit)
+{
+  /* Unsupported: fall back to standard and_smooth */
+  return bdd_and_smooth(f, g, smoothing_vars);
+}
+
+bdd_t *
+bdd_between(bdd_t *f_min, bdd_t *f_max)
+{
+  bdd_t *temp, *ret;
+  long size1, size2, size3; 
+  temp = bdd_or(f_min, f_max, 1, 0);
+  ret = bdd_minimize(f_min, temp);
+  bdd_free(temp);
+  size1 = bdd_size(f_min);
+  size2 = bdd_size(f_max);
+  size3 = bdd_size(ret);
+  if (size3 < size1) {
+	if (size3 < size2){
+      return ret;
+    }
+    else {
+      bdd_free(ret);
+      return bdd_dup(f_max);
+    }
+  }
+  else {
+    bdd_free(ret);
+    if (size1 < size2){
+      return bdd_dup(f_min);
+    }
+    else {
+      return bdd_dup(f_max);
+    }
+  }
+}
+
+bdd_t *
+bdd_cofactor(bdd_t *f, bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->mgr, cmu_bdd_cofactor(f->mgr, f->node, g->node));
+}
+
+bdd_t *
+bdd_cofactor_array(bdd_t *f, array_t *bddArray)
+{
+  bdd_t *operand;
+  struct bdd_ *result, *temp;
+  int i;
+
+  result = cmu_bdd_identity(f->mgr, f->node);
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = cmu_bdd_cofactor(f->mgr, result, operand->node);
+    if (temp == NULL) {
+      cmu_bdd_free(f->mgr, result);
+      return(NULL);
+    }
+    cmu_bdd_free(f->mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(f->mgr, result));
+}
+
+bdd_t *
+bdd_compose(
+  bdd_t *f,
+  bdd_t *v,
+  bdd_t *g)
+{
+  return bdd_construct_bdd_t(f->mgr, cmu_bdd_compose(f->mgr, f->node, v->node, g->node));
+}
+
+bdd_t *
+bdd_consensus(
+  bdd_t *f,
+  array_t *quantifying_vars /* of bdd_t *'s */)
+{
+  int num_vars, i;
+  bdd_t *fn, *result;
+  struct bdd_ **assoc;
+  struct bdd_manager_ *mgr;
+  
+  num_vars = array_n(quantifying_vars);
+  if (num_vars <= 0) {
+	cmu_bdd_fatal("bdd_consensus: no quantifying variables");
+  }
+  
+  assoc = ALLOC(struct bdd_ *, num_vars+1);
+  
+  for (i = 0; i < num_vars; i++) {
+	fn = array_fetch(bdd_t *, quantifying_vars, i);
+	assoc[i] = fn->node;
+  }
+  assoc[num_vars] = (struct bdd_ *) 0;
+  
+  mgr = f->mgr;
+  cmu_bdd_temp_assoc(mgr, assoc, 0);
+  (void) cmu_bdd_assoc(mgr, -1);  /* set the temp association as the current association */
+  
+  result = bdd_construct_bdd_t(mgr, cmu_bdd_forall(mgr, f->node));
+  FREE(assoc);
+  return result;
+}
+
+
+bdd_t *
+bdd_cproject(
+  bdd_t *f,
+  array_t *quantifying_vars /* of bdd_t* */)
+{
+  int num_vars, i;
+  bdd_t *fn, *result;
+  struct bdd_ **assoc;
+  struct bdd_manager_ *mgr;
+  
+  if (f == NIL(bdd_t)) fail ("bdd_cproject: invalid BDD");
+  
+  num_vars = array_n(quantifying_vars);
+  if (num_vars <= 0) {
+    printf("Warning: bdd_cproject: no projection variables\n");
+    result = bdd_dup(f);
+  }
+  else {
+    assoc = ALLOC(struct bdd_ *, num_vars+1);
+    for (i = 0; i < num_vars; i++) {
+      fn = array_fetch(bdd_t *, quantifying_vars, i);
+      assoc[i] = fn->node;
+    }
+    assoc[num_vars] = (struct bdd_ *) 0;
+    mgr = f->mgr;
+    cmu_bdd_temp_assoc(mgr, assoc, 0);
+    (void) cmu_bdd_assoc(mgr, -1);  /* set the temp association as the current a
+                                       ssociation */
+    
+    result = bdd_construct_bdd_t(mgr, cmu_bdd_project(mgr, f->node));
+    FREE(assoc);
+  }
+  return result;
+}
+
+
+bdd_t *
+bdd_else(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->mgr, cmu_bdd_else(f->mgr, f->node));
+}
+
+
+bdd_t *
+bdd_ite(
+  bdd_t *i,
+  bdd_t *t,
+  bdd_t *e,
+  boolean i_phase,
+  boolean t_phase,
+  boolean e_phase)
+{
+  struct bdd_ *temp1, *temp2, *temp3;
+  bdd_t *result;
+  struct bdd_manager_ *mgr;
+  
+  mgr = i->mgr;
+  temp1 = ( (i_phase == TRUE) ? cmu_bdd_identity(mgr, i->node) : cmu_bdd_not(mgr, i->node));
+  temp2 = ( (t_phase == TRUE) ? cmu_bdd_identity(mgr, t->node) : cmu_bdd_not(mgr, t->node));
+  temp3 = ( (e_phase == TRUE) ? cmu_bdd_identity(mgr, e->node) : cmu_bdd_not(mgr, e->node));
+  result = bdd_construct_bdd_t(mgr, cmu_bdd_ite(mgr, temp1, temp2, temp3));
+  cmu_bdd_free(mgr, temp1);
+  cmu_bdd_free(mgr, temp2);
+  cmu_bdd_free(mgr, temp3);
+  return result;
+}
+
+bdd_t *
+bdd_minimize(bdd_t *f, bdd_t *c)
+{
+  bdd_t *result = bdd_construct_bdd_t(f->mgr, cmu_bdd_reduce(f->mgr,
+                                                             f->node,
+                                                             c->node)); 
+  if (bdd_size(result) < bdd_size(f)){
+    return result;
+  }
+  else{
+    bdd_free(result);
+    return bdd_dup(f);
+  }
+}
+
+bdd_t *
+bdd_minimize_array(bdd_t *f, array_t *bddArray)
+{
+  bdd_t *operand;
+  struct bdd_ *result, *temp;
+  bdd_t *final;
+  int i;
+
+  result = cmu_bdd_identity(f->mgr, f->node);
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = cmu_bdd_reduce(f->mgr, result, operand->node);
+    if (temp == NULL) {
+      cmu_bdd_free(f->mgr, result);
+      return(NULL);
+    }
+    cmu_bdd_free(f->mgr, result);
+    result = temp;
+  }
+
+  final = bdd_construct_bdd_t(f->mgr, result);
+
+  if (bdd_size(final) < bdd_size(f)){
+    return final;
+  }
+  else{
+    bdd_free(final);
+    return bdd_dup(f);
+  }
+}
+
+
+bdd_t *
+bdd_not(bdd_t *f)
+{
+  return bdd_construct_bdd_t(f->mgr, cmu_bdd_not(f->mgr, f->node));
+}
+
+bdd_t *
+bdd_one(bdd_manager *manager)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  return bdd_construct_bdd_t(mgr, cmu_bdd_one(mgr));
+}
+
+bdd_t *
+bdd_or(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase)
+{
+  struct bdd_ *temp1, *temp2;
+  bdd_t *result;
+  struct bdd_manager_ *mgr;
+  
+  mgr = f->mgr;
+  temp1 = ( (f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : cmu_bdd_not(mgr, f->node));
+  temp2 = ( (g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : cmu_bdd_not(mgr, g->node));
+  result = bdd_construct_bdd_t(mgr, cmu_bdd_or(mgr, temp1, temp2));
+  cmu_bdd_free(mgr, temp1);
+  cmu_bdd_free(mgr, temp2);
+  return result;
+}
+
+bdd_t *
+bdd_smooth(
+  bdd_t *f,
+  array_t *smoothing_vars /* of bdd_t *'s */)
+{
+  int num_vars, i;
+  bdd_t *fn, *result;
+  struct bdd_ **assoc;
+  struct bdd_manager_ *mgr;
+  
+  num_vars = array_n(smoothing_vars);
+  if (num_vars <= 0) {
+	cmu_bdd_fatal("bdd_smooth: no smoothing variables");
+  }
+  
+  assoc = ALLOC(struct bdd_ *, num_vars+1);
+  
+  for (i = 0; i < num_vars; i++) {
+	fn = array_fetch(bdd_t *, smoothing_vars, i);
+	assoc[i] = fn->node;
+  }
+  assoc[num_vars] = (struct bdd_ *) 0;
+  
+  mgr = f->mgr;
+  cmu_bdd_temp_assoc(mgr, assoc, 0);
+  (void) cmu_bdd_assoc(mgr, -1);  /* set the temp association as the current association */
+  
+  result = bdd_construct_bdd_t(mgr, cmu_bdd_exists(mgr, f->node));
+  FREE(assoc);
+  return result;
+}
+
+bdd_t *
+bdd_substitute(
+  bdd_t *f,
+  array_t *old_array /* of bdd_t *'s */,
+  array_t *new_array /* of bdd_t *'s */)
+{
+    int num_old_vars, num_new_vars, i;
+    bdd_t *fn_old, *fn_new, *result;
+    struct bdd_ **assoc;
+    struct bdd_manager_ *mgr;
+
+    num_old_vars = array_n(old_array);
+    num_new_vars = array_n(new_array);
+    if (num_old_vars != num_new_vars) {
+	cmu_bdd_fatal("bdd_substitute: mismatch of number of new and old variables");
+    }
+
+    assoc = ALLOC(struct bdd_ *, 2*(num_old_vars+1));
+
+    for (i = 0; i < num_old_vars; i++) {
+	fn_old = array_fetch(bdd_t *, old_array, i);
+	fn_new = array_fetch(bdd_t *, new_array, i);
+	assoc[2*i]   = fn_old->node;
+	assoc[2*i+1] = fn_new->node;
+    }
+    assoc[2*num_old_vars]   = (struct bdd_ *) 0;
+    assoc[2*num_old_vars+1] = (struct bdd_ *) 0;  /* not sure if we need this second 0 */
+
+    mgr = f->mgr;
+    cmu_bdd_temp_assoc(mgr, assoc, 1);
+    (void) cmu_bdd_assoc(mgr, -1);  /* set the temp association as the current association */
+
+    result = bdd_construct_bdd_t(mgr, cmu_bdd_substitute(mgr, f->node));
+    FREE(assoc);
+    return result;
+}
+
+array_t *
+bdd_substitute_array(
+  array_t *f_array,
+  array_t *old_array /* of bdd_t *'s */,
+  array_t *new_array /* of bdd_t *'s */)
+{
+  int	i;
+  bdd_t	*f, *new_;
+  array_t *substitute_array = array_alloc(bdd_t *, 0);
+
+  arrayForEachItem(bdd_t *, f_array, i, f) {
+    new_ = bdd_substitute(f, old_array, new_array);
+    array_insert_last(bdd_t *, substitute_array, new_);
+  }
+  return(substitute_array);
+}
+
+void *
+bdd_pointer(bdd_t *f)
+{
+    return((void *)f->node);
+}
+
+bdd_t *
+bdd_then(bdd_t *f)
+{
+    return bdd_construct_bdd_t(f->mgr, cmu_bdd_then(f->mgr, f->node));
+}
+
+bdd_t *
+bdd_top_var(bdd_t *f)
+{
+    return bdd_construct_bdd_t(f->mgr, cmu_bdd_if(f->mgr, f->node));
+}
+
+bdd_t *
+bdd_xnor(bdd_t *f, bdd_t *g)
+{
+    return bdd_construct_bdd_t(f->mgr, cmu_bdd_xnor(f->mgr, f->node, g->node));
+}
+
+bdd_t *
+bdd_xor(bdd_t *f, bdd_t *g)
+{
+    return bdd_construct_bdd_t(f->mgr, cmu_bdd_xor(f->mgr, f->node, g->node));
+}
+
+bdd_t *
+bdd_zero(bdd_manager *manager)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  return bdd_construct_bdd_t(mgr, cmu_bdd_zero(mgr));
+}
+
+/*
+Queries about BDD Formulas ----------------------------------------------------
+*/
+
+boolean
+bdd_equal(bdd_t *f, bdd_t *g)
+{
+    return (f->node == g->node);
+}
+
+boolean
+bdd_equal_mod_care_set(bdd_t *f, bdd_t *g, bdd_t *CareSet)
+{
+  bdd_t	*diffBdd;
+  boolean result;
+
+  if (bdd_equal(f, g))
+    return 1;
+
+  diffBdd = bdd_xor(f, g);
+
+  result = bdd_leq(diffBdd, CareSet, 1, 0);
+  bdd_free(diffBdd);
+
+  return(result);
+}
+
+bdd_t *
+bdd_intersects(bdd_t *f, bdd_t *g)
+{
+    return bdd_construct_bdd_t(f->mgr, cmu_bdd_intersects(f->mgr, f->node, g->node));
+}
+
+bdd_t *
+bdd_closest_cube(bdd_t *f, bdd_t *g, int *dist)
+{
+    return (NULL);
+}
+
+boolean
+bdd_is_tautology(bdd_t *f, boolean phase)
+{
+    return ((phase == TRUE) ? (f->node == cmu_bdd_one(f->mgr)) : (f->node == cmu_bdd_zero(f->mgr)));
+}
+
+boolean
+bdd_leq(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase)
+{
+    struct bdd_ *temp1, *temp2, *implies_fn;
+    struct bdd_manager_ *mgr;
+    boolean result_value;
+
+    mgr = f->mgr;
+    temp1 = ( (f_phase == TRUE) ? cmu_bdd_identity(mgr, f->node) : cmu_bdd_not(mgr, f->node));
+    temp2 = ( (g_phase == TRUE) ? cmu_bdd_identity(mgr, g->node) : cmu_bdd_not(mgr, g->node));
+    implies_fn = cmu_bdd_implies(mgr, temp1, temp2); /* returns a minterm of temp1*!temp2 */
+    result_value = (implies_fn == cmu_bdd_zero(mgr));
+    cmu_bdd_free(mgr, temp1);
+    cmu_bdd_free(mgr, temp2);
+    cmu_bdd_free(mgr, implies_fn);
+    return result_value;
+}
+
+boolean
+bdd_lequal_mod_care_set(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase,
+  bdd_t *careSet)
+{
+  bdd_t *temp;
+  boolean result;
+
+  if (bdd_leq(f, g, f_phase, g_phase))
+    return 1;
+
+  temp = bdd_and(f, careSet, f_phase, 1);
+
+  result = bdd_leq(temp, g, 1, g_phase);
+  bdd_free(temp);
+
+  return(result);
+}
+
+boolean
+bdd_leq_array(
+  bdd_t *f,
+  array_t *g_array,
+  boolean f_phase,
+  boolean g_phase)
+{
+  int	i;
+  bdd_t	*g;
+  boolean result;
+
+  arrayForEachItem(bdd_t *, g_array, i, g) {
+    result = bdd_leq(f, g, f_phase, g_phase);
+    if (g_phase) {
+      if (!result)
+	return(0);
+    } else {
+      if (result)
+	return(1);
+    }
+  }
+  if (g_phase)
+    return(1);
+  else
+    return(0);
+}
+
+/*
+Statistics and Other Queries --------------------------------------------------
+*/
+
+double 
+bdd_count_onset(
+  bdd_t *f,
+  array_t *var_array /* of bdd_t *'s */)
+{
+    int num_vars;
+    double fraction;
+
+    num_vars = array_n(var_array);
+    fraction = cmu_bdd_satisfying_fraction(f->mgr, f->node); /* cannot give support vars */
+    return (fraction * pow((double) 2, (double) num_vars));
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of minterms in the on set.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_epd_count_onset(
+  bdd_t *f,
+  array_t *var_array /* of bdd_t *'s */,
+  EpDouble *epd)
+{
+  double nMinterms;
+
+  nMinterms = bdd_count_onset(f, var_array);
+  EpdConvert(nMinterms, epd);
+  return 0;
+} /* end of bdd_epd_count_onset */
+
+int
+bdd_get_free(bdd_t *f)
+{
+    return (f->free);
+}
+
+bdd_manager *
+bdd_get_manager(bdd_t *f)
+{
+    return (bdd_manager *) (f->mgr);
+}
+
+bdd_node *
+bdd_get_node(
+  bdd_t *f,
+  boolean *is_complemented /* return */)
+{
+    *is_complemented = (boolean) TAG0(f->node);  /* using bddint.h */
+    return ((bdd_node *) BDD_POINTER(f->node));  /* using bddint.h */
+}
+
+var_set_t *
+bdd_get_support(bdd_t *f)
+{
+    struct bdd_ **support, *var;
+    struct bdd_manager_ *mgr;
+    long num_vars;
+    var_set_t *result;
+    int id, i;
+
+    mgr = f->mgr;
+    num_vars = cmu_bdd_vars(mgr);
+
+    result = var_set_new((int) num_vars);
+    support = (struct bdd_ **) mem_get_block((num_vars+1) * sizeof(struct bdd_ *));
+    (void) cmu_bdd_support(mgr, f->node, support);
+
+    for (i = 0; i < num_vars; ++i) {  /* can never have more than num_var non-zero entries in array */
+	var = support[i]; 
+	if (var == (struct bdd_ *) 0) {
+	    break;  /* have reach end of null-terminated array */
+	}
+	id = (int) (cmu_bdd_if_id(mgr, var) - 1);  /* a variable is never garbage collected, so no need to free */
+	var_set_set_elt(result, id);
+    }
+
+    mem_free_block((pointer)support);
+
+    return result;
+}
+
+int
+bdd_is_support_var(bdd_t *f, bdd_t *var)
+{
+    return(bdd_is_support_var_id(f, bdd_top_var_id(var)));
+}
+
+int
+bdd_is_support_var_id(bdd_t *f, int index)
+{
+    struct bdd_ **support, *var;
+    struct bdd_manager_ *mgr;
+    long num_vars;
+    int id, i;
+
+    mgr = f->mgr;
+    num_vars = cmu_bdd_vars(mgr);
+
+    support = (struct bdd_ **) mem_get_block((num_vars+1) * sizeof(struct bdd_ *));
+    (void) cmu_bdd_support(mgr, f->node, support);
+
+    for (i = 0; i < num_vars; ++i) {  /* can never have more than num_var non-zero entries in array */
+	var = support[i]; 
+	if (var == (struct bdd_ *) 0) {
+	    break;  /* have reach end of null-terminated array */
+	}
+	id = (int) (cmu_bdd_if_id(mgr, var) - 1);  /* a variable is never garbage collected, so no need to free */
+	if (id == index) {
+	    mem_free_block((pointer)support);
+	    return 1;
+	}
+    }
+
+    mem_free_block((pointer)support);
+
+    return 0;
+}
+
+array_t *
+bdd_get_varids(array_t *var_array)
+{
+  int i;
+  bdd_t *var;
+  array_t *result;
+ 
+  result = array_alloc(bdd_variableId, 0);
+  for (i = 0; i < array_n(var_array); i++) {
+    var = array_fetch(bdd_t *, var_array, i);
+    array_insert_last(bdd_variableId, result, bdd_top_var_id(var));
+  }
+  return result;
+}
+
+unsigned int 
+bdd_num_vars(bdd_manager *manager)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  return (cmu_bdd_vars(mgr));
+}
+
+void
+bdd_print(bdd_t *f)
+{
+    cmu_bdd_print_bdd(f->mgr, f->node, bdd_naming_fn_none, bdd_terminal_id_fn_none, (pointer) 0, stdout);
+}
+
+void
+bdd_print_stats(bdd_manager *manager, FILE *file)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  cmu_bdd_stats(mgr, file);
+}
+
+/**Function********************************************************************
+
+  Synopsis [Sets the internal parameters of the package to the given values.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_set_parameters(
+  bdd_manager *mgr,
+  avl_tree *valueTable,
+  FILE *file)
+{
+  (void) fprintf(file, "Functionality not supported yet in the CMU package\n");
+  return 1;
+} /* End of bdd_set_parameters */
+
+int
+bdd_size(bdd_t *f)
+{
+    return ((int) cmu_bdd_size(f->mgr, f->node, 1));
+}
+
+int
+bdd_node_size(bdd_node *f)
+{
+  return(0);
+}
+
+long
+bdd_size_multiple(array_t *bdd_array)
+{
+    long result;
+    struct bdd_ **vector_bdd;
+    bdd_t *f;
+    int i;
+    struct bdd_manager_ *mgr;
+
+    if ((bdd_array == NIL(array_t)) || (array_n(bdd_array) == 0))
+        return 0;
+
+    f = array_fetch(bdd_t*, bdd_array, 0);
+    mgr = f->mgr;
+
+    vector_bdd = (struct bdd_ **)
+                        malloc((array_n(bdd_array)+1)*sizeof(struct bdd_ *));
+
+    for(i=0; i<array_n(bdd_array);i++){
+        f = array_fetch(bdd_t*, bdd_array, i);
+        vector_bdd[i] = f->node;
+    }
+    vector_bdd[array_n(bdd_array)] = 0;
+    result =  cmu_bdd_size_multiple(mgr, vector_bdd,1);
+    FREE(vector_bdd);
+    return result;
+}
+
+bdd_variableId
+bdd_top_var_id(bdd_t *f)
+{
+    return ((bdd_variableId) (cmu_bdd_if_id(f->mgr, f->node) - 1));
+}
+
+/*
+Miscellaneous -----------------------------------------------------------------
+*/
+
+bdd_external_hooks *
+bdd_get_external_hooks(bdd_manager *manager)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  return ((bdd_external_hooks *) mgr->hooks);
+}
+
+
+void
+bdd_set_gc_mode(bdd_manager *manager, boolean no_gc)
+{
+  cmu_bdd_warning("bdd_set_gc_mode: translated to no-op in CMU package");
+}
+
+void 
+bdd_dynamic_reordering(bdd_manager *manager, bdd_reorder_type_t
+                       algorithm_type, bdd_reorder_verbosity_t verbosity) 
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+    switch(algorithm_type) {
+    case BDD_REORDER_SIFT:
+	cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_sift);
+	break;
+    case BDD_REORDER_WINDOW:
+	cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_stable_window3);
+	break;
+    case BDD_REORDER_NONE:
+	cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_none);
+	break;
+    default:
+      fprintf(stderr,"CMU: bdd_dynamic_reordering: unknown algorithm type\n");
+      fprintf(stderr,"Using SIFT method instead\n");
+      cmu_bdd_dynamic_reordering(mgr, cmu_bdd_reorder_sift);
+    }
+}
+
+void 
+bdd_dynamic_reordering_zdd(bdd_manager *manager, bdd_reorder_type_t
+                       algorithm_type, bdd_reorder_verbosity_t verbosity) 
+{
+    return;
+}
+
+void 
+bdd_reorder(bdd_manager *manager)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  cmu_bdd_reorder(mgr);
+}
+
+bdd_variableId
+bdd_get_id_from_level(bdd_manager *manager, long level)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  struct bdd_ *fn;
+
+  fn = cmu_bdd_var_with_index(mgr, level);
+  
+  if (fn == (struct bdd_ *) 0) {
+    /* variable should always be found, since they are created at bdd_start */
+    cmu_bdd_fatal("bdd_get_id_from_level: assumption violated");
+  }
+  
+  return ((bdd_variableId)(cmu_bdd_if_id(mgr, fn) - 1 ));
+  
+}
+
+long
+bdd_top_var_level(bdd_manager *manager, bdd_t *fn)
+{
+  cmu_bdd_manager mgr = (cmu_bdd_manager) manager;
+  return cmu_bdd_if_index(mgr, fn->node);
+}
+
+/*
+ * Return TRUE if f is a cube, else return FALSE.
+ */
+boolean
+bdd_is_cube(bdd_t *f)
+{
+  struct bdd_manager_ *manager;
+
+  if (f == NIL(bdd_t)) {
+        fail("bdd_is_cube: invalid BDD");
+  }
+  if(  f->free ) fail ("Freed Bdd passed to bdd_is_cube");
+  manager = f->mgr;
+  return ((boolean)cmu_bdd_is_cube(manager, f->node));
+}
+
+bdd_block *
+bdd_new_var_block(bdd_t *f, long length)
+{
+  struct bdd_manager_ *manager;
+  if (f == NIL(bdd_t)) {
+        fail("bdd_new_var_block: invalid BDD");
+  }
+  manager = f->mgr;
+  return (bdd_block *)cmu_bdd_new_var_block(manager, f->node, length);
+}
+
+bdd_t *
+bdd_var_with_index(bdd_manager *manager, int index)
+{
+  return bdd_construct_bdd_t(manager, 
+		            cmu_bdd_var_with_index((cmu_bdd_manager) manager,
+                                                   index));
+}
+
+bdd_t *
+bdd_compact(bdd_t *f, bdd_t *g)
+{
+    return (NULL);
+}
+
+
+bdd_t *
+bdd_squeeze(bdd_t *f, bdd_t *g)
+{
+    return (NULL);
+}
+
+double
+bdd_correlation(bdd_t *f, bdd_t *g)
+{
+    return (0.0);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Dummy functions defined in bdd.h]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_reordering_status(
+  bdd_manager *mgr,
+  bdd_reorder_type_t *method)
+{
+  return 0;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Dummy functions defined in bdd.h]
+
+  SideEffects []
+
+******************************************************************************/
+
+bdd_t *
+bdd_compute_cube(
+  bdd_manager *mgr,
+  array_t *vars)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_compute_cube_with_phase(
+  bdd_manager *mgr,
+  array_t *vars,
+  array_t *phase)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_clipping_and_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars /* of bdd_t *'s */,
+  int maxDepth,
+  int over)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_hb(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_sp(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  int hardlimit)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_ua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  int safe,
+  double quality)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_remap_ua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  double quality)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_biased_rua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  bdd_t *bias,
+  int numVars,
+  int threshold,
+  double quality,
+  double quality1)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_approx_compress(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold)
+{
+  return NIL(bdd_t);
+}
+
+int
+bdd_gen_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t ***conjArray)
+{
+  return 0;
+}
+
+int
+bdd_var_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t ***conjArray)
+{
+  return 0;
+}
+
+int 
+bdd_approx_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t ***conjArray)
+{
+  return 0;
+}
+
+int
+bdd_iter_decomp(
+  bdd_t *f,
+  bdd_partition_type_t partType,
+  bdd_t  ***conjArray)
+{
+  return 0;
+}
+
+int
+bdd_add_hook(
+  bdd_manager *mgr,
+  int (*procedure)(bdd_manager *, char *, void *),
+  bdd_hook_type_t whichHook)
+{
+  return 0;
+}
+
+int
+bdd_remove_hook(
+  bdd_manager *mgr,
+  int (*procedure)(bdd_manager *, char *, void *),
+  bdd_hook_type_t whichHook)
+{
+  return 0;
+}
+
+int
+bdd_enable_reordering_reporting(bdd_manager *mgr)
+{
+  return 0;
+}
+
+int
+bdd_disable_reordering_reporting(bdd_manager *mgr)
+{
+  return 0;
+}
+
+bdd_reorder_verbosity_t 
+bdd_reordering_reporting(bdd_manager *mgr)
+{
+  return BDD_REORDER_VERBOSITY_DEFAULT;
+}
+
+int 
+bdd_print_apa_minterm(
+  FILE *fp,
+  bdd_t *f,
+  int nvars,
+  int precision)
+{
+  return 0;
+}
+
+int 
+bdd_apa_compare_ratios(
+  int nvars,
+  bdd_t *f1,
+  bdd_t *f2,
+  int f1Num,
+  int f2Num)
+{
+  return 0;
+}
+
+int
+bdd_read_node_count(bdd_manager *mgr)
+{
+  return 0;
+}
+
+
+int
+bdd_reordering_zdd_status(
+  bdd_manager *mgr,
+  bdd_reorder_type_t *method)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_bdd_to_add(
+  bdd_manager *mgr,
+  bdd_node *fn)
+{
+  return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_add_permute(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  int *permut)
+{
+  return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_permute(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  int *permut)
+{
+  return NIL(bdd_node);
+}
+
+void
+bdd_ref(bdd_node *fn)
+{
+  return ;
+}
+
+
+void
+bdd_recursive_deref(bdd_manager *mgr, bdd_node *f)
+{
+  return;
+}
+
+
+bdd_node *
+bdd_add_exist_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *vars)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_apply(
+  bdd_manager *mgr,
+  bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **),
+  bdd_node *fn1,
+  bdd_node *fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_nonsim_compose(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node **vector)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_residue(
+  bdd_manager *mgr,
+  int n,
+  int m,
+  int options,
+  int top)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node **vector)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_times(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+  
+
+int
+bdd_check_zero_ref(bdd_manager *mgr)
+{
+  return 0;
+}
+
+
+void
+bdd_dynamic_reordering_disable(bdd_manager *mgr)
+{
+  return;
+}
+
+void
+bdd_dynamic_reordering_zdd_disable(bdd_manager *mgr)
+{
+  return;
+}
+
+
+bdd_node *
+bdd_add_xnor(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_shuffle_heap(
+  bdd_manager *mgr,
+  int *permut)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_add_compose(
+  bdd_manager *mgr,
+  bdd_node *fn1,
+  bdd_node *fn2,
+  int var)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_ith_var(
+  bdd_manager *mgr,
+  int i)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_get_level_from_id(
+  bdd_manager *mgr,
+  int id)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_bdd_exist_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *cube)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_equal_sup_norm(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *gn,
+  BDD_VALUE_TYPE tolerance,
+  int pr)
+{
+  return 0;
+}
+
+
+bdd_node *
+bdd_read_logic_zero(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_ith_var(bdd_manager *mgr, int i)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_divide(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_constrain(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *c)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_restrict(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *c)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_hamming(
+  bdd_manager *mgr,
+  bdd_node **xVars,
+  bdd_node **yVars,
+  int nVars)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_ite(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *h)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_find_max(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+
+int
+bdd_bdd_pick_one_cube(
+  bdd_manager *mgr,
+  bdd_node *node,
+  char *string)
+{
+    return 0;
+}
+
+
+bdd_node *
+bdd_add_swap_variables(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  bdd_node **y,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_swap_variables(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  bdd_node **y,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_or(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_compute_cube(
+  bdd_manager *mgr,
+  bdd_node **vars,
+  int *phase,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_indices_to_cube(
+  bdd_manager *mgr,
+  int *idArray,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_and(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_matrix_multiply(
+  bdd_manager *mgr,
+  bdd_node *A,
+  bdd_node *B,
+  bdd_node **z,
+  int nz)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_compute_cube(
+  bdd_manager *mgr,
+  bdd_node **vars,
+  int *phase,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_const(
+  bdd_manager *mgr,
+  BDD_VALUE_TYPE c)
+{
+    return NIL(bdd_node);
+}
+
+
+double
+bdd_count_minterm(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int n)
+{
+    return 0;
+}
+
+
+bdd_node *
+bdd_add_bdd_threshold(
+  bdd_manager *mgr,
+  bdd_node *f,
+  BDD_VALUE_TYPE value)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_add_bdd_strict_threshold(
+  bdd_manager *mgr,
+  bdd_node *f,
+  BDD_VALUE_TYPE value)
+{
+    return NIL(bdd_node);
+}
+
+BDD_VALUE_TYPE
+bdd_read_epsilon(bdd_manager *mgr)
+{
+    return 0;
+}
+
+bdd_node *
+bdd_read_one(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_pick_one_minterm(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vars,
+  int n)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_t *
+bdd_pick_one_minterm(
+  bdd_t *f,
+  array_t *varsArray)
+{
+    return NIL(bdd_t);
+}
+
+
+array_t *
+bdd_bdd_pick_arbitrary_minterms(
+  bdd_t *f,
+  array_t *varsArray,
+  int n,
+  int k)
+{
+    return NIL(array_t);
+}
+
+bdd_node *
+bdd_read_zero(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_new_var(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_bdd_and_abstract(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *cube)
+{
+    return NIL(bdd_node);
+}
+
+void
+bdd_deref(bdd_node *f)
+{
+}
+
+bdd_node *
+bdd_add_plus(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  return NIL(bdd_node);
+}
+
+
+int
+bdd_read_reorderings(bdd_manager *mgr)
+{
+    return 0;
+}
+
+int
+bdd_read_next_reordering(bdd_manager *mgr)
+{
+    return 0;
+}
+
+void
+bdd_set_next_reordering(bdd_manager *mgr, int next)
+{
+}
+
+
+bdd_node *
+bdd_bdd_xnor(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vector)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_extract_node_as_is(bdd_t *fn)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_get_node(
+  bdd_manager *mgr,
+  int id,
+  bdd_node *g,
+  bdd_node *h)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_product(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_product_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_union(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+  return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_weak_div(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_weak_div_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_zdd_isop_recur(
+  bdd_manager *mgr,
+  bdd_node *L,
+  bdd_node *U,
+  bdd_node **zdd_I)
+{
+    return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_isop(
+  bdd_manager *mgr,
+  bdd_node *L,
+  bdd_node *U,
+  bdd_node **zdd_I)
+{
+    return NIL(bdd_node);
+}
+
+int
+bdd_zdd_get_cofactors3(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int v,
+  bdd_node **f1,
+  bdd_node **f0,
+  bdd_node **fd)
+{
+    return 0;
+}
+
+bdd_node *
+bdd_bdd_and_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+     return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_unique_inter(
+  bdd_manager *mgr,
+  int v,
+  bdd_node *f,
+  bdd_node *g)
+{
+     return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_unique_inter_ivo(
+  bdd_manager *mgr,
+  int v,
+  bdd_node *f,
+  bdd_node *g)
+{
+     return NIL(bdd_node);
+}
+
+
+bdd_node *
+bdd_zdd_diff(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+} 
+
+bdd_node *
+bdd_zdd_diff_recur(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+} 
+
+int
+bdd_num_zdd_vars(bdd_manager *mgr)
+{
+    return -1;
+}
+
+bdd_node *
+bdd_regular(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+int
+bdd_is_constant(bdd_node *f)
+{
+    return 0;
+}
+
+int
+bdd_is_complement(bdd_node *f)
+{
+    return 0;
+}
+
+bdd_node *
+bdd_bdd_T(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_bdd_E(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_not_bdd_node(bdd_node *f)
+{
+    return NIL(bdd_node);
+} 
+
+void
+bdd_recursive_deref_zdd(bdd_manager *mgr, bdd_node *f)
+{
+    return;
+} 
+
+int
+bdd_zdd_count(bdd_manager *mgr, bdd_node *f)
+{
+    return 0;
+}
+
+int
+bdd_read_zdd_level(bdd_manager *mgr, int index)
+{
+    return -1;
+} 
+
+int
+bdd_zdd_vars_from_bdd_vars(bdd_manager *mgr, int multiplicity)
+{
+   return 0;
+} 
+
+void
+bdd_zdd_realign_enable(bdd_manager *mgr)
+{
+    return;
+} 
+
+void
+bdd_zdd_realign_disable(bdd_manager *mgr)
+{
+    return;
+} 
+
+int
+bdd_zdd_realignment_enabled(bdd_manager *mgr)
+{
+    return 0;
+} 
+
+void
+bdd_realign_enable(bdd_manager *mgr)
+{
+    return;
+} 
+
+void
+bdd_realign_disable(bdd_manager *mgr)
+{
+    return;
+} 
+
+int
+bdd_realignment_enabled(bdd_manager *mgr)
+{
+    return 0;
+} 
+
+int
+bdd_node_read_index(bdd_node *f)
+{
+    return -1;
+}
+
+bdd_node *
+bdd_read_next(bdd_node *f)
+{
+    return NIL(bdd_node);
+}
+
+
+void
+bdd_set_next(bdd_node *f, bdd_node *g)
+{
+    return;
+}
+
+
+int
+bdd_read_reordered_field(bdd_manager *mgr)
+{
+    return -1;
+}
+
+void
+bdd_set_reordered_field(bdd_manager *mgr, int n)
+{
+    return;
+}
+
+bdd_node *
+bdd_add_apply_recur(
+  bdd_manager *mgr,
+  bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **),
+  bdd_node *fn1,
+  bdd_node *fn2)
+{
+    return NIL(bdd_node);
+}
+
+BDD_VALUE_TYPE
+bdd_add_value(bdd_node *f)
+{
+    return 0.0; 
+}
+
+int
+bdd_print_minterm(bdd_t *f)
+{
+  return 0;
+}
+
+bdd_t *
+bdd_xor_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars)
+{
+    return NIL(bdd_t);
+}
+
+
+bdd_node *
+bdd_read_plus_infinity(bdd_manager *mgr)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_read_plus_infinity */
+
+
+bdd_node *
+bdd_priority_select(
+  bdd_manager *mgr,
+  bdd_node *R,
+  bdd_node **x,
+  bdd_node **y,
+  bdd_node **z,
+  bdd_node *Pi,
+  int n,
+  bdd_node *(*Pifunc)(bdd_manager *, int, bdd_node **, bdd_node **, bdd_node **))
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_priority_select */
+
+
+void
+bdd_set_background(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+    return;
+ 
+} /* end of bdd_set_background */
+
+
+bdd_node *
+bdd_read_background(bdd_manager *mgr)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_read_background */
+
+
+bdd_node *
+bdd_bdd_cofactor(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_cofactor */
+
+
+bdd_node *
+bdd_bdd_ite(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *h)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_ite */
+
+
+bdd_node *
+bdd_add_minus(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_add_plus */
+
+
+bdd_node *
+bdd_dxygtdxz(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y,
+  bdd_node **z)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_dxygtdxz */
+
+
+bdd_node *
+bdd_bdd_univ_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *vars)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_univ_abstract */
+
+
+bdd_node *
+bdd_bdd_cprojection(
+  bdd_manager *mgr,
+  bdd_node *R,
+  bdd_node *Y)
+{
+    return NIL(bdd_node);
+
+} /* end of bdd_bdd_cprojection */
+
+bdd_node *
+bdd_xeqy(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_xeqy */
+
+bdd_node *
+bdd_add_roundoff(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int N)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_add_roundoff */
+
+bdd_node *
+bdd_xgty(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_xgty */
+
+bdd_node *
+bdd_add_cmpl(
+  bdd_manager *mgr,
+  bdd_node *f)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_add_cmpl */
+
+bdd_node *
+bdd_split_set(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  int n,
+  double m)
+{
+  return NIL(bdd_node);
+
+} /* end of bdd_split_set */
+
+
+int
+bdd_debug_check(bdd_manager *mgr)
+{
+    return (-1);
+
+} /* end of bdd_debug_check */
+
+bdd_node *
+bdd_bdd_xor(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+    return NIL(bdd_node);
+}
+
+void 
+bdd_dump_blif(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  char *model,
+  FILE *fp)
+{
+  return;
+}
+
+void 
+bdd_dump_blif_body(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  FILE *fp)
+{
+  return;
+}
+
+void 
+bdd_dump_dot(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  FILE *fp)
+{
+  return;
+}
+
+bdd_node *
+bdd_make_bdd_from_zdd_cover(bdd_manager *mgr, bdd_node *node)
+{
+    return(NIL(bdd_node));
+}
+
+bdd_node *
+bdd_zdd_complement(bdd_manager *mgr, bdd_node *node)
+{
+    return(NIL(bdd_node));
+}
+
+bdd_node *
+bdd_bdd_vector_support(
+  bdd_manager *mgr,
+  bdd_node **F,
+  int n)
+{
+  return NIL(bdd_node);
+}
+
+int
+bdd_bdd_vector_support_size(
+  bdd_manager *mgr,
+  bdd_node **F,
+  int n)
+{
+  return -1;
+}
+
+int
+bdd_bdd_support_size(
+  bdd_manager *mgr,
+  bdd_node *F)
+{
+  return -1;
+}
+
+bdd_node *
+bdd_bdd_support(
+  bdd_manager *mgr,
+  bdd_node *F)
+{
+  return NIL(bdd_node);
+}
+
+bdd_node *
+bdd_add_general_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vectorOn,
+  bdd_node **vectorOff)
+{
+  return NIL(bdd_node);
+}
+
+int
+bdd_bdd_leq(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g)
+{
+  return -1;
+} 
+
+bdd_node *
+bdd_bdd_boolean_diff(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int x)
+{
+  return NIL(bdd_node);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Compares two bdds are same.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_ptrcmp(bdd_t *f, bdd_t *g)
+{
+  if (f->node == g->node)
+    return(0);
+  else
+    return(1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the hash value of a bdd.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_ptrhash(bdd_t *f, int size)
+{
+  int hash;
+
+  hash = (int)((unsigned long)f->node >> 2) % size;
+  return(hash);
+}
+
+bdd_t *
+bdd_subset_with_mask_vars(
+  bdd_t *f,
+  array_t *varsArray,
+  array_t *maskVarsArray)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_and_smooth_with_cube(
+  bdd_t *f,
+  bdd_t *g,
+  bdd_t *cube)
+{
+  return NIL(bdd_t);
+}
+
+bdd_t *
+bdd_smooth_with_cube(bdd_t *f, bdd_t *cube)
+{
+  int i;
+  bdd_t *var, *res;
+  array_t *smoothingVars;
+  var_set_t *supportVarSet;
+
+  smoothingVars = array_alloc(bdd_t *, 0);
+  supportVarSet = bdd_get_support(f);
+  for (i = 0; i < supportVarSet->n_elts; i++) {
+    if (var_set_get_elt(supportVarSet, i) == 1) {
+      var = bdd_var_with_index(f->mgr, i);
+      array_insert_last(bdd_t *, smoothingVars, var);
+    }
+  }
+  var_set_free(supportVarSet);
+
+  res = bdd_smooth(f, smoothingVars);
+
+  for (i = 0; i < array_n(smoothingVars); i++) {
+    var = array_fetch(bdd_t *, smoothingVars, i);
+    bdd_free(var);
+  }
+  array_free(smoothingVars);
+  return res;
+}
+
+bdd_t *
+bdd_substitute_with_permut(bdd_t *f, int *permut)
+{
+  return NIL(bdd_t);
+}
+
+array_t *
+bdd_substitute_array_with_permut(
+  array_t *f_array,
+  int *permut)
+{
+  return NIL(array_t);
+}
+
+bdd_t *
+bdd_vector_compose(
+  bdd_t *f,
+  array_t *varArray,
+  array_t *funcArray)
+{
+  return NIL(bdd_t);
+}
+
+double *
+bdd_cof_minterm(bdd_t *f)
+{
+  return(NIL(double));
+}
+
+int
+bdd_var_is_dependent(bdd_t *f, bdd_t *var)
+{
+  return(0);
+}
+
+array_t *
+bdd_find_essential(bdd_t *f)
+{
+  return(NIL(array_t));
+}
+
+bdd_t *
+bdd_find_essential_cube(bdd_t *f)
+{
+  return(NIL(bdd_t));
+}
+
+int
+bdd_estimate_cofactor(bdd_t *f, bdd_t *var, int phase)
+{
+  return(0);
+}
+
+long
+bdd_read_peak_memory(bdd_manager *mgr)
+{
+  return(0);
+}
+
+int
+bdd_read_peak_live_node(bdd_manager *mgr)
+{
+  return(0);
+}
+
+int
+bdd_set_pi_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_set_ps_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_set_ns_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_pi_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_ps_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_ns_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_set_pair_index(bdd_manager *mgr, int index, int pairIndex)
+{
+    return(0);
+}
+
+int
+bdd_read_pair_index(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_set_var_to_be_grouped(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_set_var_hard_group(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_reset_var_to_be_grouped(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_var_to_be_grouped(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_var_hard_group(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_var_to_be_ungrouped(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_set_var_to_be_ungrouped(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_bind_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_unbind_var(bdd_manager *mgr, int index)
+{
+    return(0);
+}
+
+int
+bdd_is_lazy_sift(bdd_manager *mgr)
+{
+    return(0);
+}
+
+void
+bdd_discard_all_var_groups(bdd_manager *mgr)
+{
+    return;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+
Index: /vis_dev/glu-2.1/src/cmuPort/cmuPort.make
===================================================================
--- /vis_dev/glu-2.1/src/cmuPort/cmuPort.make	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuPort/cmuPort.make	(revision 6)
@@ -0,0 +1,4 @@
+CSRC_cmu += cmuPortIter.c cmuPort.c
+HEADERS_cmu += cmuPortInt.h
+
+DEPENDENCYFILES = $(CSRC_cmu)
Index: /vis_dev/glu-2.1/src/cmuPort/cmuPortInt.h
===================================================================
--- /vis_dev/glu-2.1/src/cmuPort/cmuPortInt.h	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuPort/cmuPortInt.h	(revision 6)
@@ -0,0 +1,93 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [cmuPortInt.h]
+
+  PackageName [cmu_port]
+
+  Synopsis    [Header file used by cmu_port.]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Rajeev K. Ranjan]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: cmuPortInt.h,v 1.1.1.2 1997/02/12 21:15:26 hsv Exp $]
+
+******************************************************************************/
+
+#ifndef _CMU_PORT_INT
+#define _CMU_PORT_INT
+
+#include "util.h"     /* includes math.h */
+#include "array.h"
+#include "st.h"
+#include "bdd.h"      
+#include "bddint.h"   /* CMU internal routines; for use in bdd_get_branches() and for BDD_POINTER */
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+#ifndef refany
+/* this otta be a typedef somewhere */
+#define refany char *	/* a void * or any sort of untyped pointer */
+#endif
+
+#ifndef any	/* Ansi C defines this right? */
+/* this otta be a typedef somewhere */
+#define any char	/* so that NIL(any) == refany */
+#endif
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+struct bdd_t {
+  boolean free; /* TRUE if this is free, FALSE otherwise ... */
+  struct bdd_ *node; /* ptr to the top node of the function */
+  struct bdd_manager_ *mgr; /* the manager */
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _CMU_PORT_INT */
Index: /vis_dev/glu-2.1/src/cmuPort/cmuPortIter.c
===================================================================
--- /vis_dev/glu-2.1/src/cmuPort/cmuPortIter.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cmuPort/cmuPortIter.c	(revision 6)
@@ -0,0 +1,642 @@
+/**CFile***********************************************************************
+
+  FileName    [cmuPort.c]
+
+  PackageName [cmu_port]
+
+  Synopsis    [Port routines for CMU package.]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Thomas R. Shiple. Some changes by Rajeev K. Ranjan.]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: cmuPortIter.c,v 1.4 2005/04/15 23:24:39 fabio Exp $]
+
+******************************************************************************/
+#include "cmuPortInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+/*
+ * Traversal of BDD Formulas
+ */
+
+typedef enum {
+    bdd_gen_cubes,
+    bdd_gen_nodes
+} bdd_gen_type;
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+typedef struct {
+  cmu_bdd_manager manager;
+    bdd_gen_status status;
+    bdd_gen_type type;
+    union {
+	struct {
+	    array_t *cube;	/* of bdd_literal */
+	    /* ... expansion ... */
+	} cubes;
+	struct {
+	    st_table *visited;	/* of bdd_node* */
+	    /* ... expansion ... */
+	} nodes;
+    } gen;	
+    struct {
+	int sp;
+	bdd_node **stack;
+    } stack;
+    bdd_node *node;
+} cmu_bdd_gen;
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+static void pop_cube_stack(cmu_bdd_gen *gen);
+static void pop_node_stack(cmu_bdd_gen *gen);
+static void push_cube_stack(bdd_node *f, cmu_bdd_gen *gen);
+static void push_node_stack(bdd_node *f, cmu_bdd_gen *gen);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+bdd_gen_status
+bdd_gen_read_status(bdd_gen *gen)
+{
+  return ((cmu_bdd_gen *)gen)->status;
+}
+
+/*
+ *    Defines an iterator on the onset of a BDD.  Two routines are
+ *    provided: bdd_first_cube, which extracts one cube from a BDD and
+ *    returns a bdd_gen structure containing the information necessary to
+ *    continue the enumeration; and bdd_next_cube, which returns 1 if another cube was
+ *    found, and 0 otherwise. A cube is represented
+ *    as an array of bdd_literal (which are integers in {0, 1, 2}), where 0 represents
+ *    negated literal, 1 for literal, and 2 for don't care.  Returns a disjoint
+ *    cover.  A third routine is there to clean up. 
+ */
+
+/*
+ *    bdd_first_cube - return the first cube of the function.
+ *    A generator is returned that will iterate over the rest.
+ *    Return the generator.
+ */
+bdd_gen *
+bdd_first_cube(bdd_t *fn, array_t **cube /* of bdd_literal */)
+{
+    struct bdd_manager_ *manager;
+    cmu_bdd_gen *gen;
+    int i;
+    long num_vars;
+    bdd_node *f;
+
+    if (fn == NIL(bdd_t)) {
+	cmu_bdd_fatal("bdd_first_cube: invalid BDD");
+    }
+
+    manager = fn->mgr;
+
+    /*
+     *    Allocate a new generator structure and fill it in; the stack and the 
+     *    cube will be used, but the visited table and the node will not be used.
+     */
+    gen = ALLOC(cmu_bdd_gen, 1);
+    if (gen == NIL(cmu_bdd_gen)) {
+	cmu_bdd_fatal("bdd_first_cube: failed on memory allocation, location 1");
+    }
+
+    /*
+     *    first - init all the members to a rational value for cube iteration
+     */
+    gen->manager = manager;
+    gen->status = bdd_EMPTY;
+    gen->type = bdd_gen_cubes;
+    gen->gen.cubes.cube = NIL(array_t);
+    gen->stack.sp = 0;
+    gen->stack.stack = NIL(bdd_node *);
+    gen->node = NIL(bdd_node);
+
+    num_vars = cmu_bdd_vars(manager);
+    gen->gen.cubes.cube = array_alloc(bdd_literal, num_vars);
+    if (gen->gen.cubes.cube == NIL(array_t)) {
+	cmu_bdd_fatal("bdd_first_cube: failed on memory allocation, location 2");
+    }
+    
+    /*
+     * Initialize each literal to 2 (don't care).
+     */
+    for (i = 0; i < num_vars; i++) {
+        array_insert(bdd_literal, gen->gen.cubes.cube, i, 2);
+    }
+
+    /*
+     * The stack size will never exceed the number of variables in the BDD, since
+     * the longest possible path from root to constant 1 is the number of variables 
+     * in the BDD.
+     */
+    gen->stack.sp = 0;
+    gen->stack.stack = ALLOC(bdd_node *, num_vars);
+    if (gen->stack.stack == NIL(bdd_node *)) {
+	cmu_bdd_fatal("bdd_first_cube: failed on memory allocation, location 3");
+    }
+    /*
+     * Clear out the stack so that in bdd_gen_free, we can decrement the ref count
+     * of those nodes still on the stack.
+     */
+    for (i = 0; i < num_vars; i++) {
+	gen->stack.stack[i] = NIL(bdd_node);
+    }
+
+    if (bdd_is_tautology(fn, 0)) {
+	/*
+	 *    All done, for this was but the zero constant ...
+	 *    We are enumerating the onset, (which is vacuous).
+         *    gen->status initialized to bdd_EMPTY above, so this
+         *    appears to be redundant.
+	 */
+	gen->status = bdd_EMPTY;
+    } else {
+	/*
+	 *    Get to work enumerating the onset.  Get the first cube.  Note that
+         *    if fn is just the constant 1, push_cube_stack will properly handle this.
+	 *    Get a new pointer to fn->node beforehand: this increments
+	 *    the reference count of fn->node; this is necessary, because when fn->node
+	 *    is popped from the stack at the very end, it's ref count is decremented.
+	 */
+	gen->status = bdd_NONEMPTY;
+	f = cmu_bdd_identity(manager, fn->node);
+	push_cube_stack(f, gen);
+    }
+
+    *cube = gen->gen.cubes.cube;
+    return (bdd_gen *)(gen);
+}
+
+/*
+ *    bdd_next_cube - get the next cube on the generator.
+ *    Returns {TRUE, FALSE} when {more, no more}.
+ */
+boolean
+bdd_next_cube(bdd_gen *gen_, array_t **cube /* of bdd_literal */)
+{
+  cmu_bdd_gen *gen = (cmu_bdd_gen *) gen_;
+  pop_cube_stack(gen);
+  if (gen->status == bdd_EMPTY) {
+    return (FALSE);
+  }
+  *cube = gen->gen.cubes.cube;
+  return (TRUE);
+}
+
+bdd_gen *
+bdd_first_disjoint_cube(bdd_t *fn,array_t **cube)
+{
+  return(bdd_first_cube(fn,cube));
+}
+
+boolean
+bdd_next_disjoint_cube(bdd_gen *gen_, array_t **cube)
+{
+  return(bdd_next_cube(gen_,cube));
+}
+
+/*
+ *    bdd_first_node - enumerates all bdd_node * in fn.
+ *    Return the generator.
+ */
+bdd_gen *
+bdd_first_node(bdd_t *fn, bdd_node **node /* return */)
+{
+    struct bdd_manager_ *manager;
+    cmu_bdd_gen *gen;
+    long num_vars;
+    bdd_node *f;
+    int i;
+
+    if (fn == NIL(bdd_t)) {
+	cmu_bdd_fatal("bdd_first_node: invalid BDD");
+    }
+
+    manager = fn->mgr;
+
+    /*
+     *    Allocate a new generator structure and fill it in; the
+     *    visited table will be used, as will the stack, but the
+     *    cube array will not be used.
+     */
+    gen = ALLOC(cmu_bdd_gen, 1);
+    if (gen == NIL(bdd_gen)) {
+	cmu_bdd_fatal("bdd_first_node: failed on memory allocation, location 1");
+    }
+
+    /*
+     *    first - init all the members to a rational value for node iteration.
+     */
+    gen->manager = manager;
+    gen->status = bdd_NONEMPTY;
+    gen->type = bdd_gen_nodes;
+    gen->gen.nodes.visited = NIL(st_table);
+    gen->stack.sp = 0;
+    gen->stack.stack = NIL(bdd_node *);
+    gen->node = NIL(bdd_node);
+  
+    /* 
+     * Set up the hash table for visited nodes.  Every time we visit a node,
+     * we insert it into the table.
+     */
+    gen->gen.nodes.visited = st_init_table(st_ptrcmp, st_ptrhash);
+    if (gen->gen.nodes.visited == NIL(st_table)) {
+	cmu_bdd_fatal("bdd_first_node: failed on memory allocation, location 2");
+    }
+
+    /*
+     * The stack size will never exceed the number of variables in the BDD, since
+     * the longest possible path from root to constant 1 is the number of variables 
+     * in the BDD.
+     */
+    gen->stack.sp = 0;
+    num_vars = cmu_bdd_vars(manager);
+    gen->stack.stack = ALLOC(bdd_node *, num_vars);
+    if (gen->stack.stack == NIL(bdd_node *)) {
+	cmu_bdd_fatal("bdd_first_node: failed on memory allocation, location 3");
+    }
+    /*
+     * Clear out the stack so that in bdd_gen_free, we can decrement the ref count
+     * of those nodes still on the stack.
+     */
+    for (i = 0; i < num_vars; i++) {
+	gen->stack.stack[i] = NIL(bdd_node);
+    }
+
+    /*
+     * Get the first node.  Get a new pointer to fn->node beforehand: this increments
+     * the reference count of fn->node; this is necessary, because when fn->node
+     * is popped from the stack at the very end, it's ref count is decremented.
+     */
+    f = cmu_bdd_identity(manager, fn->node);
+    push_node_stack(f, gen);
+    gen->status = bdd_NONEMPTY;
+
+    *node = gen->node;	/* return the node */
+    return (bdd_gen *) (gen);	/* and the new generator */
+}
+
+/*
+ *    bdd_next_node - get the next node in the BDD.
+ *    Return {TRUE, FALSE} when {more, no more}.
+ */
+boolean
+bdd_next_node(bdd_gen *gen_, bdd_node **node /* return */)
+{
+  cmu_bdd_gen *gen = (cmu_bdd_gen *) gen_;
+  
+    pop_node_stack(gen);
+    if (gen->status == bdd_EMPTY) {
+	return (FALSE);
+    }
+    *node = gen->node;
+    return (TRUE);
+}
+
+/*
+ *    bdd_gen_free - frees up the space used by the generator.
+ *    Return an int so that it is easier to fit in a foreach macro.
+ *    Return 0 (to make it easy to put in expressions).
+ */
+int
+bdd_gen_free(bdd_gen *gen_)
+{
+    long num_vars;
+    int i;
+    struct bdd_manager_ *mgr;
+    bdd_node *f;
+    st_table *visited_table;
+    st_generator *visited_gen;
+    cmu_bdd_gen *gen = (cmu_bdd_gen *) gen_;
+
+    mgr = gen->manager;
+
+    switch (gen->type) {
+    case bdd_gen_cubes:
+	array_free(gen->gen.cubes.cube);
+	gen->gen.cubes.cube = NIL(array_t);
+	break;
+    case bdd_gen_nodes:
+        visited_table = gen->gen.nodes.visited;
+	st_foreach_item(visited_table, visited_gen, &f, NIL(refany)) {
+	    cmu_bdd_free(mgr, (bdd) f);
+	}
+	st_free_table(visited_table);
+	visited_table = NIL(st_table);
+	break;
+    }
+
+    /*
+     * Free the data associated with this generator.  If there are any nodes remaining
+     * on the stack, we must free them, to get their ref counts back to what they were before.
+     */
+    num_vars = cmu_bdd_vars(mgr);
+    for (i = 0; i < num_vars; i++) {
+	f = gen->stack.stack[i];
+	if (f != NIL(bdd_node)) {
+	    cmu_bdd_free(mgr, (bdd) f);
+	}
+    }
+    FREE(gen->stack.stack);
+
+    FREE(gen);
+
+    return (0);	/* make it return some sort of an int */
+}
+
+/*
+ *    INTERNAL INTERFACE
+ *
+ *    Invariants:
+ *
+ *    gen->stack.stack contains nodes that remain to be explored.
+ *
+ *    For a cube generator,
+ *        gen->gen.cubes.cube reflects the choices made to reach node at top of the stack.
+ *    For a node generator,
+ *        gen->gen.nodes.visited reflects the nodes already visited in the BDD dag.
+ */
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+/*
+ *    push_cube_stack - push a cube onto the stack to visit.
+ *    Return nothing, just do it.
+ *
+ *    The BDD is traversed using depth-first search, with the ELSE branch 
+ *    searched before the THEN branch.
+ *
+ *    Caution: If you are creating new BDD's while iterating through the
+ *    cubes, and a garbage collection happens to be performed during this
+ *    process, then the BDD generator will get lost and an error will result.
+ *
+ */
+static void
+push_cube_stack(bdd_node *f, cmu_bdd_gen *gen)
+{
+    bdd_variableId topf_id;
+    bdd_node *f0, *f1;
+    struct bdd_manager_ *mgr;
+
+    mgr = gen->manager;
+
+    if (f == cmu_bdd_one(mgr)) {
+	return;
+    }
+
+    topf_id = (bdd_variableId) (cmu_bdd_if_id(mgr, (bdd) f) - 1);
+
+    /* 
+     * Get the then and else branches of f. Note that cmu_bdd_then and cmu_bdd_else 
+     * automatically take care of inverted pointers.  
+     */
+    f0 = cmu_bdd_else(mgr, (bdd) f);
+    f1 = cmu_bdd_then(mgr, (bdd) f);
+
+    if (f1 == cmu_bdd_zero(mgr)) {
+	/*
+	 *    No choice: take the 0 branch.  Since there is only one branch to 
+         *    explore from f, there is no need to push f onto the stack, because
+         *    after exploring this branch we are done with f.  A consequence of 
+         *    this is that there will be no f to pop either.  Same goes for the
+         *    next case.  Decrement the ref count of f and of the branch leading
+         *    to zero, since we will no longer need to access these nodes.
+	 */
+	array_insert(bdd_literal, gen->gen.cubes.cube, topf_id, 0);
+	push_cube_stack(f0, gen);
+        cmu_bdd_free(mgr, (bdd) f1);
+        cmu_bdd_free(mgr, (bdd) f);
+    } else if (f0 == cmu_bdd_zero(mgr)) {
+	/*
+	 *    No choice: take the 1 branch
+	 */
+	array_insert(bdd_literal, gen->gen.cubes.cube, topf_id, 1);
+	push_cube_stack(f1, gen);
+        cmu_bdd_free(mgr, (bdd) f0);
+        cmu_bdd_free(mgr, (bdd) f);
+    } else {
+        /*
+         * In this case, we must explore both branches of f.  We always choose
+         * to explore the 0 branch first.  We must push f on the stack, so that
+         * we can later pop it and explore its 1 branch. Decrement the ref count 
+	 * of f1 since we will no longer need to access this node.  Note that 
+         * the parent of f1 was bdd_freed above or in pop_cube_stack.
+         */
+	gen->stack.stack[gen->stack.sp++] = f;
+	array_insert(bdd_literal, gen->gen.cubes.cube, topf_id, 0);
+	push_cube_stack(f0, gen);
+        cmu_bdd_free(mgr, (bdd) f1);
+    }
+}
+
+static void
+pop_cube_stack(cmu_bdd_gen *gen)
+{
+    bdd_variableId topf_id, level_i_id;
+    bdd_node *branch_f;
+    bdd_node *f1;
+    int i;
+    long topf_level;
+    struct bdd_manager_ *mgr;
+    struct bdd_ *var_bdd;
+
+    mgr = gen->manager;
+
+    if (gen->stack.sp == 0) {
+        /*
+         * Stack is empty.  Have already explored both the 0 and 1 branches of 
+         * the root of the BDD.
+         */
+	gen->status = bdd_EMPTY;
+    } else {
+        /*
+         * Explore the 1 branch of the node at the top of the stack (since it is
+         * on the stack, this means we have already explored the 0 branch).  We 
+         * permanently pop the top node, and bdd_free it, since there are no more edges left to 
+         * explore. 
+         */
+	branch_f = gen->stack.stack[--gen->stack.sp];
+	gen->stack.stack[gen->stack.sp] = NIL(bdd_node); /* overwrite with NIL */
+        topf_id = (bdd_variableId) (cmu_bdd_if_id(mgr, (bdd) branch_f) - 1);
+	array_insert(bdd_literal, gen->gen.cubes.cube, topf_id, 1);
+
+        /* 
+         * We must set the variables with levels greater than the level of branch_f,
+         * back to 2 (don't care).  This is because these variables are not
+         * on the current path, and thus there values are don't care.
+         *
+         * Note the following correspondence:
+         *   CMU          UCB
+         *  index         level   (both start at zero)
+         *  indexindex    id      (CMU has id 0 for constant, thus really start numbering at 1;
+         *                                           UCB starts numbering at 0)
+         */
+        topf_level = cmu_bdd_if_index(mgr, (bdd) branch_f);
+	for (i = topf_level + 1; i < array_n(gen->gen.cubes.cube); i++) {
+            var_bdd = cmu_bdd_var_with_index(mgr, i);
+            level_i_id = (bdd_variableId) (cmu_bdd_if_id(mgr, var_bdd) - 1);
+	    /*
+             * No need to free var_bdd, since single variable BDDs are never garbage collected.
+             * Note that level_i_id is just (mgr->indexindexes[i] - 1); however, wanted
+             * to avoid using CMU internals.
+             */
+	    array_insert(bdd_literal, gen->gen.cubes.cube, level_i_id, 2);
+	}
+	f1 = cmu_bdd_then(mgr, (bdd) branch_f);
+	push_cube_stack(f1, gen);
+	cmu_bdd_free(mgr, (bdd) branch_f);
+    }
+}
+
+/*
+ *    push_node_stack - push a node onto the stack.
+ *
+ *    The same as push_cube_stack but for enumerating nodes instead of cubes.
+ *    The BDD is traversed using depth-first search, with the ELSE branch searched 
+ *    before the THEN branch, and a node returned only after its children have been
+ *    returned.  Note that the returned bdd_node pointer has the complement
+ *    bit zeroed out.
+ *
+ *    Caution: If you are creating new BDD's while iterating through the
+ *    nodes, and a garbage collection happens to be performed during this
+ *    process, then the BDD generator will get lost and an error will result.
+ *
+ *    Return nothing, just do it.
+ */
+static void
+push_node_stack(bdd_node *f, cmu_bdd_gen *gen)
+{
+    bdd_node *f0, *f1;
+    bdd_node *reg_f, *reg_f0, *reg_f1;
+    struct bdd_manager_ *mgr;
+
+    mgr = gen->manager;
+
+    reg_f = (bdd_node *) BDD_POINTER(f);  /* use of bddint.h */
+    if (st_lookup(gen->gen.nodes.visited, (refany) reg_f, NIL(refany))) {
+        /* 
+         * Already been visited.
+         */
+	return;
+    }
+
+    if (f == cmu_bdd_one(mgr) || f == cmu_bdd_zero(mgr)) {
+        /*
+         * If f is the constant node and it has not been visited yet, then put it in the visited table
+         * and set the gen->node pointer.  There is no need to put it in the stack because
+         * the constant node does not have any branches, and there is no need to free f because 
+         * constant nodes have a saturated reference count.
+         */
+	st_insert(gen->gen.nodes.visited, (refany) reg_f, NIL(any));
+	gen->node = reg_f;
+    } else {
+        /*
+         * f has not been marked as visited.  We don't know yet if any of its branches 
+         * remain to be explored.  First get its branches.  Note that cmu_bdd_then and 
+         * cmu_bdd_else automatically take care of inverted pointers.  
+         */
+	f0 = cmu_bdd_else(mgr, (bdd) f);
+	f1 = cmu_bdd_then(mgr, (bdd) f);
+
+	reg_f0 = (bdd_node *) BDD_POINTER(f0);  /* use of bddint.h */
+	reg_f1 = (bdd_node *) BDD_POINTER(f1);
+	if (! st_lookup(gen->gen.nodes.visited, (refany) reg_f0, NIL(refany))) {
+            /* 
+             * The 0 child has not been visited, so explore the 0 branch.  First push f on 
+             * the stack.  Bdd_free f1 since we will not need to access this exact pointer
+             * any more.
+             */
+	    gen->stack.stack[gen->stack.sp++] = f;
+            push_node_stack(f0, gen);
+	    cmu_bdd_free(mgr, (bdd) f1);
+	} else if (! st_lookup(gen->gen.nodes.visited, (refany) reg_f1, NIL(refany))) {
+            /* 
+             * The 0 child has been visited, but the 1 child has not been visited, so 
+             * explore the 1 branch.  First push f on the stack. We are done with f0, 
+	     * so bdd_free it.
+             */
+	    gen->stack.stack[gen->stack.sp++] = f;
+            push_node_stack(f1, gen);
+	    cmu_bdd_free(mgr, (bdd) f0);
+	} else {
+            /*
+             * Both the 0 and 1 children have been visited. Thus we are done exploring from f.  
+             * Mark f as visited (put it in the visited table), and set the gen->node pointer.
+	     * We will no longer need to refer to f0 and f1, so bdd_free them.  f will be
+             * bdd_freed when the visited table is freed.
+             */
+            st_insert(gen->gen.nodes.visited, (refany) reg_f, NIL(any));
+	    gen->node = reg_f;
+	    cmu_bdd_free(mgr, (bdd) f0);
+	    cmu_bdd_free(mgr, (bdd) f1);
+	}
+    }
+}
+
+static void
+pop_node_stack(cmu_bdd_gen *gen)
+{
+    bdd_node *branch_f;
+
+    if (gen->stack.sp == 0) {
+	gen->status = bdd_EMPTY;
+    } else {
+	branch_f = gen->stack.stack[--gen->stack.sp];  /* overwrite with NIL */
+	gen->stack.stack[gen->stack.sp] = NIL(bdd_node);
+	push_node_stack(branch_f, gen);
+    }
+}
+
Index: /vis_dev/glu-2.1/src/cuBdd/cudd.h
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cudd.h	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cudd.h	(revision 6)
@@ -0,0 +1,1039 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [cudd.h]
+
+  PackageName [cudd]
+
+  Synopsis    [The University of Colorado decision diagram package.]
+
+  Description [External functions and data strucures of the CUDD package.
+  <ul>
+  <li> To turn on the gathering of statistics, define DD_STATS.
+  <li> To link with mis, define DD_MIS.
+  </ul>
+  Modified by Abelardo Pardo to interface it to VIS.
+  ]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+  Revision    [$Id: cudd.h,v 1.170 2005/05/18 06:07:41 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _CUDD
+#define _CUDD
+
+/*---------------------------------------------------------------------------*/
+/* Nested includes                                                           */
+/*---------------------------------------------------------------------------*/
+
+#include "mtr.h"
+#include "epd.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#define CUDD_VERSION "2.4.1"
+
+#ifndef SIZEOF_VOID_P
+#define SIZEOF_VOID_P 4
+#endif
+#ifndef SIZEOF_INT
+#define SIZEOF_INT 4
+#endif
+#ifndef SIZEOF_LONG
+#define SIZEOF_LONG 4
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#define CUDD_VALUE_TYPE		double
+#define CUDD_OUT_OF_MEM		-1
+/* The sizes of the subtables and the cache must be powers of two. */
+#define CUDD_UNIQUE_SLOTS	256	/* initial size of subtables */
+#define CUDD_CACHE_SLOTS	262144	/* default size of the cache */
+
+/* Constants for residue functions. */
+#define CUDD_RESIDUE_DEFAULT	0
+#define CUDD_RESIDUE_MSB	1
+#define CUDD_RESIDUE_TC		2
+
+/* CUDD_MAXINDEX is defined in such a way that on 32-bit and 64-bit
+** machines one can cast an index to (int) without generating a negative
+** number.
+*/
+#if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
+#define CUDD_MAXINDEX		(((DdHalfWord) ~0) >> 1)
+#else
+#define CUDD_MAXINDEX		((DdHalfWord) ~0)
+#endif
+
+/* CUDD_CONST_INDEX is the index of constant nodes.  Currently this
+** is a synonim for CUDD_MAXINDEX. */
+#define CUDD_CONST_INDEX	CUDD_MAXINDEX
+
+/* These constants define the digits used in the representation of
+** arbitrary precision integers.  The two configurations tested use 8
+** and 16 bits for each digit.  The typedefs should be in agreement
+** with these definitions.
+*/
+#define DD_APA_BITS	16
+#define DD_APA_BASE	(1 << DD_APA_BITS)
+#define DD_APA_MASK	(DD_APA_BASE - 1)
+#define DD_APA_HEXPRINT	"%04x"
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/**Enum************************************************************************
+
+  Synopsis    [Type of reordering algorithm.]
+
+  Description [Type of reordering algorithm.]
+
+******************************************************************************/
+typedef enum {
+    CUDD_REORDER_SAME,
+    CUDD_REORDER_NONE,
+    CUDD_REORDER_RANDOM,
+    CUDD_REORDER_RANDOM_PIVOT,
+    CUDD_REORDER_SIFT,
+    CUDD_REORDER_SIFT_CONVERGE,
+    CUDD_REORDER_SYMM_SIFT,
+    CUDD_REORDER_SYMM_SIFT_CONV,
+    CUDD_REORDER_WINDOW2,
+    CUDD_REORDER_WINDOW3,
+    CUDD_REORDER_WINDOW4,
+    CUDD_REORDER_WINDOW2_CONV,
+    CUDD_REORDER_WINDOW3_CONV,
+    CUDD_REORDER_WINDOW4_CONV,
+    CUDD_REORDER_GROUP_SIFT,
+    CUDD_REORDER_GROUP_SIFT_CONV,
+    CUDD_REORDER_ANNEALING,
+    CUDD_REORDER_GENETIC,
+    CUDD_REORDER_LINEAR,
+    CUDD_REORDER_LINEAR_CONVERGE,
+    CUDD_REORDER_LAZY_SIFT,
+    CUDD_REORDER_EXACT
+} Cudd_ReorderingType;
+
+
+/**Enum************************************************************************
+
+  Synopsis    [Type of aggregation methods.]
+
+  Description [Type of aggregation methods.]
+
+******************************************************************************/
+typedef enum {
+    CUDD_NO_CHECK,
+    CUDD_GROUP_CHECK,
+    CUDD_GROUP_CHECK2,
+    CUDD_GROUP_CHECK3,
+    CUDD_GROUP_CHECK4,
+    CUDD_GROUP_CHECK5,
+    CUDD_GROUP_CHECK6,
+    CUDD_GROUP_CHECK7,
+    CUDD_GROUP_CHECK8,
+    CUDD_GROUP_CHECK9
+} Cudd_AggregationType;
+
+
+/**Enum************************************************************************
+
+  Synopsis    [Type of hooks.]
+
+  Description [Type of hooks.]
+
+******************************************************************************/
+typedef enum {
+    CUDD_PRE_GC_HOOK,
+    CUDD_POST_GC_HOOK,
+    CUDD_PRE_REORDERING_HOOK,
+    CUDD_POST_REORDERING_HOOK
+} Cudd_HookType;
+
+
+/**Enum************************************************************************
+
+  Synopsis    [Type of error codes.]
+
+  Description [Type of  error codes.]
+
+******************************************************************************/
+typedef enum {
+    CUDD_NO_ERROR,
+    CUDD_MEMORY_OUT,
+    CUDD_TOO_MANY_NODES,
+    CUDD_MAX_MEM_EXCEEDED,
+    CUDD_INVALID_ARG,
+    CUDD_INTERNAL_ERROR
+} Cudd_ErrorType;
+
+
+/**Enum************************************************************************
+
+  Synopsis    [Group type for lazy sifting.]
+
+  Description [Group type for lazy sifting.]
+
+******************************************************************************/
+typedef enum {
+    CUDD_LAZY_NONE,
+    CUDD_LAZY_SOFT_GROUP,
+    CUDD_LAZY_HARD_GROUP,
+    CUDD_LAZY_UNGROUP
+} Cudd_LazyGroupType;
+
+
+/**Enum************************************************************************
+
+  Synopsis    [Variable type.]
+
+  Description [Variable type. Currently used only in lazy sifting.]
+
+******************************************************************************/
+typedef enum {
+    CUDD_VAR_PRIMARY_INPUT,
+    CUDD_VAR_PRESENT_STATE,
+    CUDD_VAR_NEXT_STATE
+} Cudd_VariableType;
+
+
+#if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
+typedef unsigned int   DdHalfWord;
+#else
+typedef unsigned short DdHalfWord;
+#endif
+
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+
+typedef struct DdNode DdNode;
+
+typedef struct DdChildren {
+    struct DdNode *T;
+    struct DdNode *E;
+} DdChildren;
+
+/* The DdNode structure is the only one exported out of the package */
+struct DdNode {
+    DdHalfWord index;
+    DdHalfWord ref;		/* reference count */
+    DdNode *next;		/* next pointer for unique table */
+    union {
+	CUDD_VALUE_TYPE value;	/* for constant nodes */
+	DdChildren kids;	/* for internal nodes */
+    } type;
+};
+
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+
+typedef struct DdManager DdManager;
+
+typedef struct DdGen DdGen;
+
+/* These typedefs for arbitrary precision arithmetic should agree with
+** the corresponding constant definitions above. */
+typedef unsigned short int DdApaDigit;
+typedef unsigned long int DdApaDoubleDigit;
+typedef DdApaDigit * DdApaNumber;
+
+/* Return type for function computing two-literal clauses. */
+typedef struct DdTlcInfo DdTlcInfo;
+
+/* Type of hook function. */
+typedef int (*DD_HFP)(DdManager *, const char *, void *);
+/* Type of priority function */
+typedef DdNode * (*DD_PRFP)(DdManager * , int, DdNode **, DdNode **,
+			    DdNode **);
+/* Type of apply operator. */
+typedef DdNode * (*DD_AOP)(DdManager *, DdNode **, DdNode **);
+/* Type of monadic apply operator. */
+typedef DdNode * (*DD_MAOP)(DdManager *, DdNode *);
+/* Types of cache tag functions. */
+typedef DdNode * (*DD_CTFP)(DdManager *, DdNode *, DdNode *);
+typedef DdNode * (*DD_CTFP1)(DdManager *, DdNode *);
+/* Type of memory-out function. */
+typedef void (*DD_OOMFP)(long);
+/* Type of comparison function for qsort. */
+typedef int (*DD_QSFP)(const void *, const void *);
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns 1 if the node is a constant node.]
+
+  Description  [Returns 1 if the node is a constant node (rather than an
+  internal node). All constant nodes have the same index
+  (CUDD_CONST_INDEX). The pointer passed to Cudd_IsConstant may be either
+  regular or complemented.]
+
+  SideEffects  [none]
+
+  SeeAlso      []
+
+******************************************************************************/
+#define Cudd_IsConstant(node) ((Cudd_Regular(node))->index == CUDD_CONST_INDEX)
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Complements a DD.]
+
+  Description  [Complements a DD by flipping the complement attribute of
+  the pointer (the least significant bit).]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_NotCond]
+
+******************************************************************************/
+#define Cudd_Not(node) ((DdNode *)((long)(node) ^ 01))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Complements a DD if a condition is true.]
+
+  Description  [Complements a DD if condition c is true; c should be
+  either 0 or 1, because it is used directly (for efficiency). If in
+  doubt on the values c may take, use "(c) ? Cudd_Not(node) : node".]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_Not]
+
+******************************************************************************/
+#define Cudd_NotCond(node,c) ((DdNode *)((long)(node) ^ (c)))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns the regular version of a pointer.]
+
+  Description  []
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_Complement Cudd_IsComplement]
+
+******************************************************************************/
+#define Cudd_Regular(node) ((DdNode *)((unsigned long)(node) & ~01))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns the complemented version of a pointer.]
+
+  Description  []
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_Regular Cudd_IsComplement]
+
+******************************************************************************/
+#define Cudd_Complement(node) ((DdNode *)((unsigned long)(node) | 01))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns 1 if a pointer is complemented.]
+
+  Description  []
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_Regular Cudd_Complement]
+
+******************************************************************************/
+#define Cudd_IsComplement(node)	((int) ((long) (node) & 01))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns the then child of an internal node.]
+
+  Description  [Returns the then child of an internal node. If
+  <code>node</code> is a constant node, the result is unpredictable.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_E Cudd_V]
+
+******************************************************************************/
+#define Cudd_T(node) ((Cudd_Regular(node))->type.kids.T)
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns the else child of an internal node.]
+
+  Description  [Returns the else child of an internal node. If
+  <code>node</code> is a constant node, the result is unpredictable.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_T Cudd_V]
+
+******************************************************************************/
+#define Cudd_E(node) ((Cudd_Regular(node))->type.kids.E)
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns the value of a constant node.]
+
+  Description  [Returns the value of a constant node. If
+  <code>node</code> is an internal node, the result is unpredictable.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_T Cudd_E]
+
+******************************************************************************/
+#define Cudd_V(node) ((Cudd_Regular(node))->type.value)
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Returns the current position in the order of variable
+  index.]
+
+  Description [Returns the current position in the order of variable
+  index. This macro is obsolete and is kept for compatibility. New
+  applications should use Cudd_ReadPerm instead.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_ReadPerm]
+
+******************************************************************************/
+#define Cudd_ReadIndex(dd,index) (Cudd_ReadPerm(dd,index))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Iterates over the cubes of a decision diagram.]
+
+  Description  [Iterates over the cubes of a decision diagram f.
+  <ul>
+  <li> DdManager *manager;
+  <li> DdNode *f;
+  <li> DdGen *gen;
+  <li> int *cube;
+  <li> CUDD_VALUE_TYPE value;
+  </ul>
+  Cudd_ForeachCube allocates and frees the generator. Therefore the
+  application should not try to do that. Also, the cube is freed at the
+  end of Cudd_ForeachCube and hence is not available outside of the loop.<p>
+  CAUTION: It is assumed that dynamic reordering will not occur while
+  there are open generators. It is the user's responsibility to make sure
+  that dynamic reordering does not occur. As long as new nodes are not created
+  during generation, and dynamic reordering is not called explicitly,
+  dynamic reordering will not occur. Alternatively, it is sufficient to
+  disable dynamic reordering. It is a mistake to dispose of a diagram
+  on which generation is ongoing.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_ForeachNode Cudd_FirstCube Cudd_NextCube Cudd_GenFree
+  Cudd_IsGenEmpty Cudd_AutodynDisable]
+
+******************************************************************************/
+#define Cudd_ForeachCube(manager, f, gen, cube, value)\
+    for((gen) = Cudd_FirstCube(manager, f, &cube, &value);\
+	Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : TRUE;\
+	(void) Cudd_NextCube(gen, &cube, &value))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Iterates over the primes of a Boolean function.]
+
+  Description  [Iterates over the primes of a Boolean function producing
+  a prime and irredundant cover.
+  <ul>
+  <li> DdManager *manager;
+  <li> DdNode *l;
+  <li> DdNode *u;
+  <li> DdGen *gen;
+  <li> int *cube;
+  </ul>
+  The Boolean function is described by an upper bound and a lower bound.  If
+  the function is completely specified, the two bounds coincide.
+  Cudd_ForeachPrime allocates and frees the generator.  Therefore the
+  application should not try to do that.  Also, the cube is freed at the
+  end of Cudd_ForeachPrime and hence is not available outside of the loop.<p>
+  CAUTION: It is a mistake to change a diagram on which generation is ongoing.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_ForeachCube Cudd_FirstPrime Cudd_NextPrime Cudd_GenFree
+  Cudd_IsGenEmpty]
+
+******************************************************************************/
+#define Cudd_ForeachPrime(manager, l, u, gen, cube)\
+    for((gen) = Cudd_FirstPrime(manager, l, u, &cube);\
+	Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : TRUE;\
+	(void) Cudd_NextPrime(gen, &cube))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Iterates over the nodes of a decision diagram.]
+
+  Description  [Iterates over the nodes of a decision diagram f.
+  <ul>
+  <li> DdManager *manager;
+  <li> DdNode *f;
+  <li> DdGen *gen;
+  <li> DdNode *node;
+  </ul>
+  The nodes are returned in a seemingly random order.
+  Cudd_ForeachNode allocates and frees the generator. Therefore the
+  application should not try to do that.<p>
+  CAUTION: It is assumed that dynamic reordering will not occur while
+  there are open generators. It is the user's responsibility to make sure
+  that dynamic reordering does not occur. As long as new nodes are not created
+  during generation, and dynamic reordering is not called explicitly,
+  dynamic reordering will not occur. Alternatively, it is sufficient to
+  disable dynamic reordering. It is a mistake to dispose of a diagram
+  on which generation is ongoing.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_ForeachCube Cudd_FirstNode Cudd_NextNode Cudd_GenFree
+  Cudd_IsGenEmpty Cudd_AutodynDisable]
+
+******************************************************************************/
+#define Cudd_ForeachNode(manager, f, gen, node)\
+    for((gen) = Cudd_FirstNode(manager, f, &node);\
+	Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : TRUE;\
+	(void) Cudd_NextNode(gen, &node))
+
+
+/**Macro***********************************************************************
+
+  Synopsis     [Iterates over the paths of a ZDD.]
+
+  Description  [Iterates over the paths of a ZDD f.
+  <ul>
+  <li> DdManager *manager;
+  <li> DdNode *f;
+  <li> DdGen *gen;
+  <li> int *path;
+  </ul>
+  Cudd_zddForeachPath allocates and frees the generator. Therefore the
+  application should not try to do that. Also, the path is freed at the
+  end of Cudd_zddForeachPath and hence is not available outside of the loop.<p>
+  CAUTION: It is assumed that dynamic reordering will not occur while
+  there are open generators.  It is the user's responsibility to make sure
+  that dynamic reordering does not occur.  As long as new nodes are not created
+  during generation, and dynamic reordering is not called explicitly,
+  dynamic reordering will not occur.  Alternatively, it is sufficient to
+  disable dynamic reordering.  It is a mistake to dispose of a diagram
+  on which generation is ongoing.]
+
+  SideEffects  [none]
+
+  SeeAlso      [Cudd_zddFirstPath Cudd_zddNextPath Cudd_GenFree
+  Cudd_IsGenEmpty Cudd_AutodynDisable]
+
+******************************************************************************/
+#define Cudd_zddForeachPath(manager, f, gen, path)\
+    for((gen) = Cudd_zddFirstPath(manager, f, &path);\
+	Cudd_IsGenEmpty(gen) ? Cudd_GenFree(gen) : TRUE;\
+	(void) Cudd_zddNextPath(gen, &path))
+
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+extern DdNode * Cudd_addNewVar (DdManager *dd);
+extern DdNode * Cudd_addNewVarAtLevel (DdManager *dd, int level);
+extern DdNode * Cudd_bddNewVar (DdManager *dd);
+extern DdNode * Cudd_bddNewVarAtLevel (DdManager *dd, int level);
+extern DdNode * Cudd_addIthVar (DdManager *dd, int i);
+extern DdNode * Cudd_bddIthVar (DdManager *dd, int i);
+extern DdNode * Cudd_zddIthVar (DdManager *dd, int i);
+extern int Cudd_zddVarsFromBddVars (DdManager *dd, int multiplicity);
+extern DdNode * Cudd_addConst (DdManager *dd, CUDD_VALUE_TYPE c);
+extern int Cudd_IsNonConstant (DdNode *f);
+extern void Cudd_AutodynEnable (DdManager *unique, Cudd_ReorderingType method);
+extern void Cudd_AutodynDisable (DdManager *unique);
+extern int Cudd_ReorderingStatus (DdManager *unique, Cudd_ReorderingType *method);
+extern void Cudd_AutodynEnableZdd (DdManager *unique, Cudd_ReorderingType method);
+extern void Cudd_AutodynDisableZdd (DdManager *unique);
+extern int Cudd_ReorderingStatusZdd (DdManager *unique, Cudd_ReorderingType *method);
+extern int Cudd_zddRealignmentEnabled (DdManager *unique);
+extern void Cudd_zddRealignEnable (DdManager *unique);
+extern void Cudd_zddRealignDisable (DdManager *unique);
+extern int Cudd_bddRealignmentEnabled (DdManager *unique);
+extern void Cudd_bddRealignEnable (DdManager *unique);
+extern void Cudd_bddRealignDisable (DdManager *unique);
+extern DdNode * Cudd_ReadOne (DdManager *dd);
+extern DdNode * Cudd_ReadZddOne (DdManager *dd, int i);
+extern DdNode * Cudd_ReadZero (DdManager *dd);
+extern DdNode * Cudd_ReadLogicZero (DdManager *dd);
+extern DdNode * Cudd_ReadPlusInfinity (DdManager *dd);
+extern DdNode * Cudd_ReadMinusInfinity (DdManager *dd);
+extern DdNode * Cudd_ReadBackground (DdManager *dd);
+extern void Cudd_SetBackground (DdManager *dd, DdNode *bck);
+extern unsigned int Cudd_ReadCacheSlots (DdManager *dd);
+extern double Cudd_ReadCacheUsedSlots (DdManager * dd);
+extern double Cudd_ReadCacheLookUps (DdManager *dd);
+extern double Cudd_ReadCacheHits (DdManager *dd);
+extern double Cudd_ReadRecursiveCalls (DdManager * dd);
+extern unsigned int Cudd_ReadMinHit (DdManager *dd);
+extern void Cudd_SetMinHit (DdManager *dd, unsigned int hr);
+extern unsigned int Cudd_ReadLooseUpTo (DdManager *dd);
+extern void Cudd_SetLooseUpTo (DdManager *dd, unsigned int lut);
+extern unsigned int Cudd_ReadMaxCache (DdManager *dd);
+extern unsigned int Cudd_ReadMaxCacheHard (DdManager *dd);
+extern void Cudd_SetMaxCacheHard (DdManager *dd, unsigned int mc);
+extern int Cudd_ReadSize (DdManager *dd);
+extern int Cudd_ReadZddSize (DdManager *dd);
+extern unsigned int Cudd_ReadSlots (DdManager *dd);
+extern double Cudd_ReadUsedSlots (DdManager * dd);
+extern double Cudd_ExpectedUsedSlots (DdManager * dd);
+extern unsigned int Cudd_ReadKeys (DdManager *dd);
+extern unsigned int Cudd_ReadDead (DdManager *dd);
+extern unsigned int Cudd_ReadMinDead (DdManager *dd);
+extern int Cudd_ReadReorderings (DdManager *dd);
+extern long Cudd_ReadReorderingTime (DdManager * dd);
+extern int Cudd_ReadGarbageCollections (DdManager * dd);
+extern long Cudd_ReadGarbageCollectionTime (DdManager * dd);
+extern double Cudd_ReadNodesFreed (DdManager * dd);
+extern double Cudd_ReadNodesDropped (DdManager * dd);
+extern double Cudd_ReadUniqueLookUps (DdManager * dd);
+extern double Cudd_ReadUniqueLinks (DdManager * dd);
+extern int Cudd_ReadSiftMaxVar (DdManager *dd);
+extern void Cudd_SetSiftMaxVar (DdManager *dd, int smv);
+extern int Cudd_ReadSiftMaxSwap (DdManager *dd);
+extern void Cudd_SetSiftMaxSwap (DdManager *dd, int sms);
+extern double Cudd_ReadMaxGrowth (DdManager *dd);
+extern void Cudd_SetMaxGrowth (DdManager *dd, double mg);
+extern double Cudd_ReadMaxGrowthAlternate (DdManager * dd);
+extern void Cudd_SetMaxGrowthAlternate (DdManager * dd, double mg);
+extern int Cudd_ReadReorderingCycle (DdManager * dd);
+extern void Cudd_SetReorderingCycle (DdManager * dd, int cycle);
+extern MtrNode * Cudd_ReadTree (DdManager *dd);
+extern void Cudd_SetTree (DdManager *dd, MtrNode *tree);
+extern void Cudd_FreeTree (DdManager *dd);
+extern MtrNode * Cudd_ReadZddTree (DdManager *dd);
+extern void Cudd_SetZddTree (DdManager *dd, MtrNode *tree);
+extern void Cudd_FreeZddTree (DdManager *dd);
+extern unsigned int Cudd_NodeReadIndex (DdNode *node);
+extern int Cudd_ReadPerm (DdManager *dd, int i);
+extern int Cudd_ReadPermZdd (DdManager *dd, int i);
+extern int Cudd_ReadInvPerm (DdManager *dd, int i);
+extern int Cudd_ReadInvPermZdd (DdManager *dd, int i);
+extern DdNode * Cudd_ReadVars (DdManager *dd, int i);
+extern CUDD_VALUE_TYPE Cudd_ReadEpsilon (DdManager *dd);
+extern void Cudd_SetEpsilon (DdManager *dd, CUDD_VALUE_TYPE ep);
+extern Cudd_AggregationType Cudd_ReadGroupcheck (DdManager *dd);
+extern void Cudd_SetGroupcheck (DdManager *dd, Cudd_AggregationType gc);
+extern int Cudd_GarbageCollectionEnabled (DdManager *dd);
+extern void Cudd_EnableGarbageCollection (DdManager *dd);
+extern void Cudd_DisableGarbageCollection (DdManager *dd);
+extern int Cudd_DeadAreCounted (DdManager *dd);
+extern void Cudd_TurnOnCountDead (DdManager *dd);
+extern void Cudd_TurnOffCountDead (DdManager *dd);
+extern int Cudd_ReadRecomb (DdManager *dd);
+extern void Cudd_SetRecomb (DdManager *dd, int recomb);
+extern int Cudd_ReadSymmviolation (DdManager *dd);
+extern void Cudd_SetSymmviolation (DdManager *dd, int symmviolation);
+extern int Cudd_ReadArcviolation (DdManager *dd);
+extern void Cudd_SetArcviolation (DdManager *dd, int arcviolation);
+extern int Cudd_ReadPopulationSize (DdManager *dd);
+extern void Cudd_SetPopulationSize (DdManager *dd, int populationSize);
+extern int Cudd_ReadNumberXovers (DdManager *dd);
+extern void Cudd_SetNumberXovers (DdManager *dd, int numberXovers);
+extern unsigned long Cudd_ReadMemoryInUse (DdManager *dd);
+extern int Cudd_PrintInfo (DdManager *dd, FILE *fp);
+extern long Cudd_ReadPeakNodeCount (DdManager *dd);
+extern int Cudd_ReadPeakLiveNodeCount (DdManager * dd);
+extern long Cudd_ReadNodeCount (DdManager *dd);
+extern long Cudd_zddReadNodeCount (DdManager *dd);
+extern int Cudd_AddHook (DdManager *dd, DD_HFP f, Cudd_HookType where);
+extern int Cudd_RemoveHook (DdManager *dd, DD_HFP f, Cudd_HookType where);
+extern int Cudd_IsInHook (DdManager * dd, DD_HFP f, Cudd_HookType where);
+extern int Cudd_StdPreReordHook (DdManager *dd, const char *str, void *data);
+extern int Cudd_StdPostReordHook (DdManager *dd, const char *str, void *data);
+extern int Cudd_EnableReorderingReporting (DdManager *dd);
+extern int Cudd_DisableReorderingReporting (DdManager *dd);
+extern int Cudd_ReorderingReporting (DdManager *dd);
+extern Cudd_ErrorType Cudd_ReadErrorCode (DdManager *dd);
+extern void Cudd_ClearErrorCode (DdManager *dd);
+extern FILE * Cudd_ReadStdout (DdManager *dd);
+extern void Cudd_SetStdout (DdManager *dd, FILE *fp);
+extern FILE * Cudd_ReadStderr (DdManager *dd);
+extern void Cudd_SetStderr (DdManager *dd, FILE *fp);
+extern unsigned int Cudd_ReadNextReordering (DdManager *dd);
+extern void Cudd_SetNextReordering (DdManager *dd, unsigned int next);
+extern double Cudd_ReadSwapSteps (DdManager *dd);
+extern unsigned int Cudd_ReadMaxLive (DdManager *dd);
+extern void Cudd_SetMaxLive (DdManager *dd, unsigned int maxLive);
+extern unsigned long Cudd_ReadMaxMemory (DdManager *dd);
+extern void Cudd_SetMaxMemory (DdManager *dd, unsigned long maxMemory);
+extern int Cudd_bddBindVar (DdManager *dd, int index);
+extern int Cudd_bddUnbindVar (DdManager *dd, int index);
+extern int Cudd_bddVarIsBound (DdManager *dd, int index);
+extern DdNode * Cudd_addExistAbstract (DdManager *manager, DdNode *f, DdNode *cube);
+extern DdNode * Cudd_addUnivAbstract (DdManager *manager, DdNode *f, DdNode *cube);
+extern DdNode * Cudd_addOrAbstract (DdManager *manager, DdNode *f, DdNode *cube);
+extern DdNode * Cudd_addApply (DdManager *dd, DdNode * (*)(DdManager *, DdNode **, DdNode **), DdNode *f, DdNode *g);
+extern DdNode * Cudd_addPlus (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addTimes (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addThreshold (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addSetNZ (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addDivide (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addMinus (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addMinimum (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addMaximum (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addOneZeroMaximum (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addDiff (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addAgreement (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addOr (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addNand (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addNor (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addXor (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addXnor (DdManager *dd, DdNode **f, DdNode **g);
+extern DdNode * Cudd_addMonadicApply (DdManager * dd, DdNode * (*op)(DdManager *, DdNode *), DdNode * f);
+extern DdNode * Cudd_addLog (DdManager * dd, DdNode * f);
+extern DdNode * Cudd_addFindMax (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_addFindMin (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_addIthBit (DdManager *dd, DdNode *f, int bit);
+extern DdNode * Cudd_addScalarInverse (DdManager *dd, DdNode *f, DdNode *epsilon);
+extern DdNode * Cudd_addIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
+extern DdNode * Cudd_addIteConstant (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
+extern DdNode * Cudd_addEvalConst (DdManager *dd, DdNode *f, DdNode *g);
+extern int Cudd_addLeq (DdManager * dd, DdNode * f, DdNode * g);
+extern DdNode * Cudd_addCmpl (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_addNegate (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_addRoundOff (DdManager *dd, DdNode *f, int N);
+extern DdNode * Cudd_addWalsh (DdManager *dd, DdNode **x, DdNode **y, int n);
+extern DdNode * Cudd_addResidue (DdManager *dd, int n, int m, int options, int top);
+extern DdNode * Cudd_bddAndAbstract (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube);
+extern DdNode * Cudd_bddAndAbstractLimit (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube, unsigned int limit);
+extern int Cudd_ApaNumberOfDigits (int binaryDigits);
+extern DdApaNumber Cudd_NewApaNumber (int digits);
+extern void Cudd_ApaCopy (int digits, DdApaNumber source, DdApaNumber dest);
+extern DdApaDigit Cudd_ApaAdd (int digits, DdApaNumber a, DdApaNumber b, DdApaNumber sum);
+extern DdApaDigit Cudd_ApaSubtract (int digits, DdApaNumber a, DdApaNumber b, DdApaNumber diff);
+extern DdApaDigit Cudd_ApaShortDivision (int digits, DdApaNumber dividend, DdApaDigit divisor, DdApaNumber quotient);
+extern unsigned int Cudd_ApaIntDivision (int  digits, DdApaNumber dividend, unsigned int  divisor, DdApaNumber  quotient);
+extern void Cudd_ApaShiftRight (int digits, DdApaDigit in, DdApaNumber a, DdApaNumber b);
+extern void Cudd_ApaSetToLiteral (int digits, DdApaNumber number, DdApaDigit literal);
+extern void Cudd_ApaPowerOfTwo (int digits, DdApaNumber number, int power);
+extern int Cudd_ApaCompare (int digitsFirst, DdApaNumber  first, int digitsSecond, DdApaNumber  second);
+extern int Cudd_ApaCompareRatios (int digitsFirst, DdApaNumber firstNum, unsigned int firstDen, int digitsSecond, DdApaNumber secondNum, unsigned int secondDen);
+extern int Cudd_ApaPrintHex (FILE *fp, int digits, DdApaNumber number);
+extern int Cudd_ApaPrintDecimal (FILE *fp, int digits, DdApaNumber number);
+extern int Cudd_ApaPrintExponential (FILE * fp, int  digits, DdApaNumber  number, int precision);
+extern DdApaNumber Cudd_ApaCountMinterm (DdManager *manager, DdNode *node, int nvars, int *digits);
+extern int Cudd_ApaPrintMinterm (FILE *fp, DdManager *dd, DdNode *node, int nvars);
+extern int Cudd_ApaPrintMintermExp (FILE * fp, DdManager * dd, DdNode * node, int  nvars, int precision);
+extern int Cudd_ApaPrintDensity (FILE * fp, DdManager * dd, DdNode * node, int  nvars);
+extern DdNode * Cudd_UnderApprox (DdManager *dd, DdNode *f, int numVars, int threshold, int safe, double quality);
+extern DdNode * Cudd_OverApprox (DdManager *dd, DdNode *f, int numVars, int threshold, int safe, double quality);
+extern DdNode * Cudd_RemapUnderApprox (DdManager *dd, DdNode *f, int numVars, int threshold, double quality);
+extern DdNode * Cudd_RemapOverApprox (DdManager *dd, DdNode *f, int numVars, int threshold, double quality);
+extern DdNode * Cudd_BiasedUnderApprox (DdManager *dd, DdNode *f, DdNode *b, int numVars, int threshold, double quality1, double quality0);
+extern DdNode * Cudd_BiasedOverApprox (DdManager *dd, DdNode *f, DdNode *b, int numVars, int threshold, double quality1, double quality0);
+extern DdNode * Cudd_bddExistAbstract (DdManager *manager, DdNode *f, DdNode *cube);
+extern DdNode * Cudd_bddXorExistAbstract (DdManager *manager, DdNode *f, DdNode *g, DdNode *cube);
+extern DdNode * Cudd_bddUnivAbstract (DdManager *manager, DdNode *f, DdNode *cube);
+extern DdNode * Cudd_bddBooleanDiff (DdManager *manager, DdNode *f, int x);
+extern int Cudd_bddVarIsDependent (DdManager *dd, DdNode *f, DdNode *var);
+extern double Cudd_bddCorrelation (DdManager *manager, DdNode *f, DdNode *g);
+extern double Cudd_bddCorrelationWeights (DdManager *manager, DdNode *f, DdNode *g, double *prob);
+extern DdNode * Cudd_bddIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
+extern DdNode * Cudd_bddIteConstant (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
+extern DdNode * Cudd_bddIntersect (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddAnd (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddAndLimit (DdManager *dd, DdNode *f, DdNode *g, unsigned int limit);
+extern DdNode * Cudd_bddOr (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddNand (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddNor (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddXor (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddXnor (DdManager *dd, DdNode *f, DdNode *g);
+extern int Cudd_bddLeq (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_addBddThreshold (DdManager *dd, DdNode *f, CUDD_VALUE_TYPE value);
+extern DdNode * Cudd_addBddStrictThreshold (DdManager *dd, DdNode *f, CUDD_VALUE_TYPE value);
+extern DdNode * Cudd_addBddInterval (DdManager *dd, DdNode *f, CUDD_VALUE_TYPE lower, CUDD_VALUE_TYPE upper);
+extern DdNode * Cudd_addBddIthBit (DdManager *dd, DdNode *f, int bit);
+extern DdNode * Cudd_BddToAdd (DdManager *dd, DdNode *B);
+extern DdNode * Cudd_addBddPattern (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_bddTransfer (DdManager *ddSource, DdManager *ddDestination, DdNode *f);
+extern int Cudd_DebugCheck (DdManager *table);
+extern int Cudd_CheckKeys (DdManager *table);
+extern DdNode * Cudd_bddClippingAnd (DdManager *dd, DdNode *f, DdNode *g, int maxDepth, int direction);
+extern DdNode * Cudd_bddClippingAndAbstract (DdManager *dd, DdNode *f, DdNode *g, DdNode *cube, int maxDepth, int direction);
+extern DdNode * Cudd_Cofactor (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_bddCompose (DdManager *dd, DdNode *f, DdNode *g, int v);
+extern DdNode * Cudd_addCompose (DdManager *dd, DdNode *f, DdNode *g, int v);
+extern DdNode * Cudd_addPermute (DdManager *manager, DdNode *node, int *permut);
+extern DdNode * Cudd_addSwapVariables (DdManager *dd, DdNode *f, DdNode **x, DdNode **y, int n);
+extern DdNode * Cudd_bddPermute (DdManager *manager, DdNode *node, int *permut);
+extern DdNode * Cudd_bddVarMap (DdManager *manager, DdNode *f);
+extern int Cudd_SetVarMap (DdManager *manager, DdNode **x, DdNode **y, int n);
+extern DdNode * Cudd_bddSwapVariables (DdManager *dd, DdNode *f, DdNode **x, DdNode **y, int n);
+extern DdNode * Cudd_bddAdjPermuteX (DdManager *dd, DdNode *B, DdNode **x, int n);
+extern DdNode * Cudd_addVectorCompose (DdManager *dd, DdNode *f, DdNode **vector);
+extern DdNode * Cudd_addGeneralVectorCompose (DdManager *dd, DdNode *f, DdNode **vectorOn, DdNode **vectorOff);
+extern DdNode * Cudd_addNonSimCompose (DdManager *dd, DdNode *f, DdNode **vector);
+extern DdNode * Cudd_bddVectorCompose (DdManager *dd, DdNode *f, DdNode **vector);
+extern int Cudd_bddApproxConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts);
+extern int Cudd_bddApproxDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts);
+extern int Cudd_bddIterConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts);
+extern int Cudd_bddIterDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts);
+extern int Cudd_bddGenConjDecomp (DdManager *dd, DdNode *f, DdNode ***conjuncts);
+extern int Cudd_bddGenDisjDecomp (DdManager *dd, DdNode *f, DdNode ***disjuncts);
+extern int Cudd_bddVarConjDecomp (DdManager *dd, DdNode * f, DdNode ***conjuncts);
+extern int Cudd_bddVarDisjDecomp (DdManager *dd, DdNode * f, DdNode ***disjuncts);
+extern DdNode * Cudd_FindEssential (DdManager *dd, DdNode *f);
+extern int Cudd_bddIsVarEssential (DdManager *manager, DdNode *f, int id, int phase);
+extern DdTlcInfo * Cudd_FindTwoLiteralClauses (DdManager * dd, DdNode * f);
+extern int Cudd_PrintTwoLiteralClauses (DdManager * dd, DdNode * f, char **names, FILE *fp);
+extern int Cudd_ReadIthClause (DdTlcInfo * tlc, int i, DdHalfWord *var1, DdHalfWord *var2, int *phase1, int *phase2);
+extern void Cudd_tlcInfoFree (DdTlcInfo * t);
+extern int Cudd_DumpBlif (DdManager *dd, int n, DdNode **f, char **inames, char **onames, char *mname, FILE *fp);
+extern int Cudd_DumpBlifBody (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp);
+extern int Cudd_DumpDot (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp);
+extern int Cudd_DumpDaVinci (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp);
+extern int Cudd_DumpDDcal (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp);
+extern int Cudd_DumpFactoredForm (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp);
+extern DdNode * Cudd_bddConstrain (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode * Cudd_bddRestrict (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode * Cudd_bddNPAnd (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode * Cudd_addConstrain (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode ** Cudd_bddConstrainDecomp (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_addRestrict (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode ** Cudd_bddCharToVect (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_bddLICompaction (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode * Cudd_bddSqueeze (DdManager *dd, DdNode *l, DdNode *u);
+extern DdNode * Cudd_bddMinimize (DdManager *dd, DdNode *f, DdNode *c);
+extern DdNode * Cudd_SubsetCompress (DdManager *dd, DdNode *f, int nvars, int threshold);
+extern DdNode * Cudd_SupersetCompress (DdManager *dd, DdNode *f, int nvars, int threshold);
+extern MtrNode * Cudd_MakeTreeNode (DdManager *dd, unsigned int low, unsigned int size, unsigned int type);
+extern int Cudd_addHarwell (FILE *fp, DdManager *dd, DdNode **E, DdNode ***x, DdNode ***y, DdNode ***xn, DdNode ***yn_, int *nx, int *ny, int *m, int *n, int bx, int sx, int by, int sy, int pr);
+extern DdManager * Cudd_Init (unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory);
+extern void Cudd_Quit (DdManager *unique);
+extern int Cudd_PrintLinear (DdManager *table);
+extern int Cudd_ReadLinear (DdManager *table, int x, int y);
+extern DdNode * Cudd_bddLiteralSetIntersection (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode * Cudd_addMatrixMultiply (DdManager *dd, DdNode *A, DdNode *B, DdNode **z, int nz);
+extern DdNode * Cudd_addTimesPlus (DdManager *dd, DdNode *A, DdNode *B, DdNode **z, int nz);
+extern DdNode * Cudd_addTriangle (DdManager *dd, DdNode *f, DdNode *g, DdNode **z, int nz);
+extern DdNode * Cudd_addOuterSum (DdManager *dd, DdNode *M, DdNode *r, DdNode *c);
+extern DdNode * Cudd_PrioritySelect (DdManager *dd, DdNode *R, DdNode **x, DdNode **y, DdNode **z, DdNode *Pi, int n, DdNode * (*)(DdManager *, int, DdNode **, DdNode **, DdNode **));
+extern DdNode * Cudd_Xgty (DdManager *dd, int N, DdNode **z, DdNode **x, DdNode **y);
+extern DdNode * Cudd_Xeqy (DdManager *dd, int N, DdNode **x, DdNode **y);
+extern DdNode * Cudd_addXeqy (DdManager *dd, int N, DdNode **x, DdNode **y);
+extern DdNode * Cudd_Dxygtdxz (DdManager *dd, int N, DdNode **x, DdNode **y, DdNode **z);
+extern DdNode * Cudd_Dxygtdyz (DdManager *dd, int N, DdNode **x, DdNode **y, DdNode **z);
+extern DdNode * Cudd_CProjection (DdManager *dd, DdNode *R, DdNode *Y);
+extern DdNode * Cudd_addHamming (DdManager *dd, DdNode **xVars, DdNode **yVars, int nVars);
+extern int Cudd_MinHammingDist (DdManager *dd, DdNode *f, int *minterm, int upperBound);
+extern DdNode * Cudd_bddClosestCube (DdManager *dd, DdNode * f, DdNode *g, int *distance);
+extern int Cudd_addRead (FILE *fp, DdManager *dd, DdNode **E, DdNode ***x, DdNode ***y, DdNode ***xn, DdNode ***yn_, int *nx, int *ny, int *m, int *n, int bx, int sx, int by, int sy);
+extern int Cudd_bddRead (FILE *fp, DdManager *dd, DdNode **E, DdNode ***x, DdNode ***y, int *nx, int *ny, int *m, int *n, int bx, int sx, int by, int sy);
+extern void Cudd_Ref (DdNode *n);
+extern void Cudd_RecursiveDeref (DdManager *table, DdNode *n);
+extern void Cudd_IterDerefBdd (DdManager *table, DdNode *n);
+extern void Cudd_DelayedDerefBdd (DdManager * table, DdNode * n);
+extern void Cudd_RecursiveDerefZdd (DdManager *table, DdNode *n);
+extern void Cudd_Deref (DdNode *node);
+extern int Cudd_CheckZeroRef (DdManager *manager);
+extern int Cudd_ReduceHeap (DdManager *table, Cudd_ReorderingType heuristic, int minsize);
+extern int Cudd_ShuffleHeap (DdManager *table, int *permutation);
+extern DdNode * Cudd_Eval (DdManager *dd, DdNode *f, int *inputs);
+extern DdNode * Cudd_ShortestPath (DdManager *manager, DdNode *f, int *weight, int *support, int *length);
+extern DdNode * Cudd_LargestCube (DdManager *manager, DdNode *f, int *length);
+extern int Cudd_ShortestLength (DdManager *manager, DdNode *f, int *weight);
+extern DdNode * Cudd_Decreasing (DdManager *dd, DdNode *f, int i);
+extern DdNode * Cudd_Increasing (DdManager *dd, DdNode *f, int i);
+extern int Cudd_EquivDC (DdManager *dd, DdNode *F, DdNode *G, DdNode *D);
+extern int Cudd_bddLeqUnless (DdManager *dd, DdNode *f, DdNode *g, DdNode *D);
+extern int Cudd_EqualSupNorm (DdManager *dd, DdNode *f, DdNode *g, CUDD_VALUE_TYPE tolerance, int pr);
+extern DdNode * Cudd_bddMakePrime (DdManager *dd, DdNode *cube, DdNode *f);
+extern double * Cudd_CofMinterm (DdManager *dd, DdNode *node);
+extern DdNode * Cudd_SolveEqn (DdManager * bdd, DdNode *F, DdNode *Y, DdNode **G, int **yIndex, int n);
+extern DdNode * Cudd_VerifySol (DdManager * bdd, DdNode *F, DdNode **G, int *yIndex, int n);
+extern DdNode * Cudd_SplitSet (DdManager *manager, DdNode *S, DdNode **xVars, int n, double m);
+extern DdNode * Cudd_SubsetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold);
+extern DdNode * Cudd_SupersetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold);
+extern DdNode * Cudd_SubsetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit);
+extern DdNode * Cudd_SupersetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit);
+extern void Cudd_SymmProfile (DdManager *table, int lower, int upper);
+extern unsigned int Cudd_Prime (unsigned int p);
+extern int Cudd_PrintMinterm (DdManager *manager, DdNode *node);
+extern int Cudd_bddPrintCover (DdManager *dd, DdNode *l, DdNode *u);
+extern int Cudd_PrintDebug (DdManager *dd, DdNode *f, int n, int pr);
+extern int Cudd_DagSize (DdNode *node);
+extern int Cudd_EstimateCofactor (DdManager *dd, DdNode * node, int i, int phase);
+extern int Cudd_EstimateCofactorSimple (DdNode * node, int i);
+extern int Cudd_SharingSize (DdNode **nodeArray, int n);
+extern double Cudd_CountMinterm (DdManager *manager, DdNode *node, int nvars);
+extern int Cudd_EpdCountMinterm (DdManager *manager, DdNode *node, int nvars, EpDouble *epd);
+extern double Cudd_CountPath (DdNode *node);
+extern double Cudd_CountPathsToNonZero (DdNode *node);
+extern DdNode * Cudd_Support (DdManager *dd, DdNode *f);
+extern int * Cudd_SupportIndex (DdManager *dd, DdNode *f);
+extern int Cudd_SupportSize (DdManager *dd, DdNode *f);
+extern DdNode * Cudd_VectorSupport (DdManager *dd, DdNode **F, int n);
+extern int * Cudd_VectorSupportIndex (DdManager *dd, DdNode **F, int n);
+extern int Cudd_VectorSupportSize (DdManager *dd, DdNode **F, int n);
+extern int Cudd_ClassifySupport (DdManager *dd, DdNode *f, DdNode *g, DdNode **common, DdNode **onlyF, DdNode **onlyG);
+extern int Cudd_CountLeaves (DdNode *node);
+extern int Cudd_bddPickOneCube (DdManager *ddm, DdNode *node, char *string);
+extern DdNode * Cudd_bddPickOneMinterm (DdManager *dd, DdNode *f, DdNode **vars, int n);
+extern DdNode ** Cudd_bddPickArbitraryMinterms (DdManager *dd, DdNode *f, DdNode **vars, int n, int k);
+extern DdNode * Cudd_SubsetWithMaskVars (DdManager *dd, DdNode *f, DdNode **vars, int nvars, DdNode **maskVars, int mvars);
+extern DdGen * Cudd_FirstCube (DdManager *dd, DdNode *f, int **cube, CUDD_VALUE_TYPE *value);
+extern int Cudd_NextCube (DdGen *gen, int **cube, CUDD_VALUE_TYPE *value);
+extern DdGen * Cudd_FirstPrime(DdManager *dd, DdNode *l, DdNode *u, int **cube);
+extern int Cudd_NextPrime(DdGen *gen, int **cube);
+extern DdNode * Cudd_bddComputeCube (DdManager *dd, DdNode **vars, int *phase, int n);
+extern DdNode * Cudd_addComputeCube (DdManager *dd, DdNode **vars, int *phase, int n);
+extern DdNode * Cudd_CubeArrayToBdd (DdManager *dd, int *array);
+extern int Cudd_BddToCubeArray (DdManager *dd, DdNode *cube, int *array);
+extern DdGen * Cudd_FirstNode (DdManager *dd, DdNode *f, DdNode **node);
+extern int Cudd_NextNode (DdGen *gen, DdNode **node);
+extern int Cudd_GenFree (DdGen *gen);
+extern int Cudd_IsGenEmpty (DdGen *gen);
+extern DdNode * Cudd_IndicesToCube (DdManager *dd, int *array, int n);
+extern void Cudd_PrintVersion (FILE *fp);
+extern double Cudd_AverageDistance (DdManager *dd);
+extern long Cudd_Random (void);
+extern void Cudd_Srandom (long seed);
+extern double Cudd_Density (DdManager *dd, DdNode *f, int nvars);
+extern void Cudd_OutOfMem (long size);
+extern int Cudd_zddCount (DdManager *zdd, DdNode *P);
+extern double Cudd_zddCountDouble (DdManager *zdd, DdNode *P);
+extern DdNode	* Cudd_zddProduct (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode	* Cudd_zddUnateProduct (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode	* Cudd_zddWeakDiv (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode	* Cudd_zddDivide (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode	* Cudd_zddWeakDivF (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode	* Cudd_zddDivideF (DdManager *dd, DdNode *f, DdNode *g);
+extern DdNode	* Cudd_zddComplement (DdManager *dd, DdNode *node);
+extern MtrNode * Cudd_MakeZddTreeNode (DdManager *dd, unsigned int low, unsigned int size, unsigned int type);
+extern DdNode	* Cudd_zddIsop (DdManager *dd, DdNode *L, DdNode *U, DdNode **zdd_I);
+extern DdNode	* Cudd_bddIsop (DdManager *dd, DdNode *L, DdNode *U);
+extern DdNode	* Cudd_MakeBddFromZddCover (DdManager *dd, DdNode *node);
+extern int Cudd_zddDagSize (DdNode *p_node);
+extern double Cudd_zddCountMinterm (DdManager *zdd, DdNode *node, int path);
+extern void Cudd_zddPrintSubtable (DdManager *table);
+extern DdNode * Cudd_zddPortFromBdd (DdManager *dd, DdNode *B);
+extern DdNode * Cudd_zddPortToBdd (DdManager *dd, DdNode *f);
+extern int Cudd_zddReduceHeap (DdManager *table, Cudd_ReorderingType heuristic, int minsize);
+extern int Cudd_zddShuffleHeap (DdManager *table, int *permutation);
+extern DdNode * Cudd_zddIte (DdManager *dd, DdNode *f, DdNode *g, DdNode *h);
+extern DdNode * Cudd_zddUnion (DdManager *dd, DdNode *P, DdNode *Q);
+extern DdNode * Cudd_zddIntersect (DdManager *dd, DdNode *P, DdNode *Q);
+extern DdNode * Cudd_zddDiff (DdManager *dd, DdNode *P, DdNode *Q);
+extern DdNode * Cudd_zddDiffConst (DdManager *zdd, DdNode *P, DdNode *Q);
+extern DdNode * Cudd_zddSubset1 (DdManager *dd, DdNode *P, int var);
+extern DdNode * Cudd_zddSubset0 (DdManager *dd, DdNode *P, int var);
+extern DdNode * Cudd_zddChange (DdManager *dd, DdNode *P, int var);
+extern void Cudd_zddSymmProfile (DdManager *table, int lower, int upper);
+extern int Cudd_zddPrintMinterm (DdManager *zdd, DdNode *node);
+extern int Cudd_zddPrintCover (DdManager *zdd, DdNode *node);
+extern int Cudd_zddPrintDebug (DdManager *zdd, DdNode *f, int n, int pr);
+extern DdGen * Cudd_zddFirstPath (DdManager *zdd, DdNode *f, int **path);
+extern int Cudd_zddNextPath (DdGen *gen, int **path);
+extern char * Cudd_zddCoverPathToString (DdManager *zdd, int *path, char *str);
+extern int Cudd_zddDumpDot (DdManager *dd, int n, DdNode **f, char **inames, char **onames, FILE *fp);
+extern int Cudd_bddSetPiVar (DdManager *dd, int index);
+extern int Cudd_bddSetPsVar (DdManager *dd, int index);
+extern int Cudd_bddSetNsVar (DdManager *dd, int index);
+extern int Cudd_bddIsPiVar (DdManager *dd, int index);
+extern int Cudd_bddIsPsVar (DdManager *dd, int index);
+extern int Cudd_bddIsNsVar (DdManager *dd, int index);
+extern int Cudd_bddSetPairIndex (DdManager *dd, int index, int pairIndex);
+extern int Cudd_bddReadPairIndex (DdManager *dd, int index);
+extern int Cudd_bddSetVarToBeGrouped (DdManager *dd, int index);
+extern int Cudd_bddSetVarHardGroup (DdManager *dd, int index);
+extern int Cudd_bddResetVarToBeGrouped (DdManager *dd, int index);
+extern int Cudd_bddIsVarToBeGrouped (DdManager *dd, int index);
+extern int Cudd_bddSetVarToBeUngrouped (DdManager *dd, int index);
+extern int Cudd_bddIsVarToBeUngrouped (DdManager *dd, int index);
+extern int Cudd_bddIsVarHardGroup (DdManager *dd, int index);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
+#endif /* _CUDD */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddAddAbs.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddAddAbs.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddAddAbs.c	(revision 6)
@@ -0,0 +1,579 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddAddAbs.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Quantification functions for ADDs.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> Cudd_addExistAbstract()
+		<li> Cudd_addUnivAbstract()
+		<li> Cudd_addOrAbstract()
+		</ul>
+	Internal procedures included in this module:
+		<ul>
+		<li> cuddAddExistAbstractRecur()
+		<li> cuddAddUnivAbstractRecur()
+		<li> cuddAddOrAbstractRecur()
+		</ul>
+	Static procedures included in this module:
+		<ul>
+		<li> addCheckPositiveCube()
+		</ul>]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddAddAbs.c,v 1.15 2004/08/13 18:04:45 fabio Exp $";
+#endif
+
+static	DdNode	*two;
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int addCheckPositiveCube (DdManager *manager, DdNode *cube);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Existentially Abstracts all the variables in cube from f.]
+
+  Description [Abstracts all the variables in cube from f by summing
+  over all possible values taken by the variables. Returns the
+  abstracted ADD.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addUnivAbstract Cudd_bddExistAbstract
+  Cudd_addOrAbstract]
+
+******************************************************************************/
+DdNode *
+Cudd_addExistAbstract(
+  DdManager * manager,
+  DdNode * f,
+  DdNode * cube)
+{
+    DdNode *res;
+
+    two = cuddUniqueConst(manager,(CUDD_VALUE_TYPE) 2);
+    if (two == NULL) return(NULL);
+    cuddRef(two);
+
+    if (addCheckPositiveCube(manager, cube) == 0) {
+        (void) fprintf(manager->err,"Error: Can only abstract cubes");
+        return(NULL);
+    }
+
+    do {
+	manager->reordered = 0;
+	res = cuddAddExistAbstractRecur(manager, f, cube);
+    } while (manager->reordered == 1);
+
+    if (res == NULL) {
+	Cudd_RecursiveDeref(manager,two);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(manager,two);
+    cuddDeref(res);
+
+    return(res);
+
+} /* end of Cudd_addExistAbstract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Universally Abstracts all the variables in cube from f.]
+
+  Description [Abstracts all the variables in cube from f by taking
+  the product over all possible values taken by the variable. Returns
+  the abstracted ADD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addExistAbstract Cudd_bddUnivAbstract
+  Cudd_addOrAbstract]
+
+******************************************************************************/
+DdNode *
+Cudd_addUnivAbstract(
+  DdManager * manager,
+  DdNode * f,
+  DdNode * cube)
+{
+    DdNode		*res;
+
+    if (addCheckPositiveCube(manager, cube) == 0) {
+	(void) fprintf(manager->err,"Error:  Can only abstract cubes");
+	return(NULL);
+    }
+
+    do {
+	manager->reordered = 0;
+	res = cuddAddUnivAbstractRecur(manager, f, cube);
+    } while (manager->reordered == 1);
+
+    return(res);
+
+} /* end of Cudd_addUnivAbstract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Disjunctively abstracts all the variables in cube from the
+  0-1 ADD f.]
+
+  Description [Abstracts all the variables in cube from the 0-1 ADD f
+  by taking the disjunction over all possible values taken by the
+  variables.  Returns the abstracted ADD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addUnivAbstract Cudd_addExistAbstract]
+
+******************************************************************************/
+DdNode *
+Cudd_addOrAbstract(
+  DdManager * manager,
+  DdNode * f,
+  DdNode * cube)
+{
+    DdNode *res;
+
+    if (addCheckPositiveCube(manager, cube) == 0) {
+        (void) fprintf(manager->err,"Error: Can only abstract cubes");
+        return(NULL);
+    }
+
+    do {
+	manager->reordered = 0;
+	res = cuddAddOrAbstractRecur(manager, f, cube);
+    } while (manager->reordered == 1);
+    return(res);
+
+} /* end of Cudd_addOrAbstract */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addExistAbstract.]
+
+  Description [Performs the recursive step of Cudd_addExistAbstract.
+  Returns the ADD obtained by abstracting the variables of cube from f,
+  if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+cuddAddExistAbstractRecur(
+  DdManager * manager,
+  DdNode * f,
+  DdNode * cube)
+{
+    DdNode	*T, *E, *res, *res1, *res2, *zero;
+
+    statLine(manager);
+    zero = DD_ZERO(manager);
+
+    /* Cube is guaranteed to be a cube at this point. */	
+    if (f == zero || cuddIsConstant(cube)) {  
+        return(f);
+    }
+
+    /* Abstract a variable that does not appear in f => multiply by 2. */
+    if (cuddI(manager,f->index) > cuddI(manager,cube->index)) {
+	res1 = cuddAddExistAbstractRecur(manager, f, cuddT(cube));
+	if (res1 == NULL) return(NULL);
+	cuddRef(res1);
+	/* Use the "internal" procedure to be alerted in case of
+	** dynamic reordering. If dynamic reordering occurs, we
+	** have to abort the entire abstraction.
+	*/
+	res = cuddAddApplyRecur(manager,Cudd_addTimes,res1,two);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+	cuddRef(res);
+	Cudd_RecursiveDeref(manager,res1);
+	cuddDeref(res);
+        return(res);
+    }
+
+    if ((res = cuddCacheLookup2(manager, Cudd_addExistAbstract, f, cube)) != NULL) {
+	return(res);
+    }
+
+    T = cuddT(f);
+    E = cuddE(f);
+
+    /* If the two indices are the same, so are their levels. */
+    if (f->index == cube->index) {
+	res1 = cuddAddExistAbstractRecur(manager, T, cuddT(cube));
+	if (res1 == NULL) return(NULL);
+        cuddRef(res1);
+	res2 = cuddAddExistAbstractRecur(manager, E, cuddT(cube));
+	if (res2 == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+        cuddRef(res2);
+	res = cuddAddApplyRecur(manager, Cudd_addPlus, res1, res2);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    Cudd_RecursiveDeref(manager,res2);
+	    return(NULL);
+	}
+	cuddRef(res);
+	Cudd_RecursiveDeref(manager,res1);
+	Cudd_RecursiveDeref(manager,res2);
+	cuddCacheInsert2(manager, Cudd_addExistAbstract, f, cube, res);
+	cuddDeref(res);
+        return(res);
+    } else { /* if (cuddI(manager,f->index) < cuddI(manager,cube->index)) */
+	res1 = cuddAddExistAbstractRecur(manager, T, cube);
+	if (res1 == NULL) return(NULL);
+        cuddRef(res1);
+	res2 = cuddAddExistAbstractRecur(manager, E, cube);
+	if (res2 == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+        cuddRef(res2);
+	res = (res1 == res2) ? res1 :
+	    cuddUniqueInter(manager, (int) f->index, res1, res2);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    Cudd_RecursiveDeref(manager,res2);
+	    return(NULL);
+	}
+	cuddDeref(res1);
+	cuddDeref(res2);
+	cuddCacheInsert2(manager, Cudd_addExistAbstract, f, cube, res);
+        return(res);
+    }	    
+
+} /* end of cuddAddExistAbstractRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addUnivAbstract.]
+
+  Description [Performs the recursive step of Cudd_addUnivAbstract.
+  Returns the ADD obtained by abstracting the variables of cube from f,
+  if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+cuddAddUnivAbstractRecur(
+  DdManager * manager,
+  DdNode * f,
+  DdNode * cube)
+{
+    DdNode	*T, *E, *res, *res1, *res2, *one, *zero;
+
+    statLine(manager);
+    one = DD_ONE(manager);
+    zero = DD_ZERO(manager);
+
+    /* Cube is guaranteed to be a cube at this point.
+    ** zero and one are the only constatnts c such that c*c=c.
+    */
+    if (f == zero || f == one || cube == one) {  
+	return(f);
+    }
+
+    /* Abstract a variable that does not appear in f. */
+    if (cuddI(manager,f->index) > cuddI(manager,cube->index)) {
+	res1 = cuddAddUnivAbstractRecur(manager, f, cuddT(cube));
+	if (res1 == NULL) return(NULL);
+	cuddRef(res1);
+	/* Use the "internal" procedure to be alerted in case of
+	** dynamic reordering. If dynamic reordering occurs, we
+	** have to abort the entire abstraction.
+	*/
+	res = cuddAddApplyRecur(manager, Cudd_addTimes, res1, res1);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+	cuddRef(res);
+	Cudd_RecursiveDeref(manager,res1);
+	cuddDeref(res);
+	return(res);
+    }
+
+    if ((res = cuddCacheLookup2(manager, Cudd_addUnivAbstract, f, cube)) != NULL) {
+	return(res);
+    }
+
+    T = cuddT(f);
+    E = cuddE(f);
+
+    /* If the two indices are the same, so are their levels. */
+    if (f->index == cube->index) {
+	res1 = cuddAddUnivAbstractRecur(manager, T, cuddT(cube));
+	if (res1 == NULL) return(NULL);
+        cuddRef(res1);
+	res2 = cuddAddUnivAbstractRecur(manager, E, cuddT(cube));
+	if (res2 == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+        cuddRef(res2);
+	res = cuddAddApplyRecur(manager, Cudd_addTimes, res1, res2);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    Cudd_RecursiveDeref(manager,res2);
+	    return(NULL);
+	}
+	cuddRef(res);
+	Cudd_RecursiveDeref(manager,res1);
+	Cudd_RecursiveDeref(manager,res2);
+	cuddCacheInsert2(manager, Cudd_addUnivAbstract, f, cube, res);
+	cuddDeref(res);
+        return(res);
+    } else { /* if (cuddI(manager,f->index) < cuddI(manager,cube->index)) */
+	res1 = cuddAddUnivAbstractRecur(manager, T, cube);
+	if (res1 == NULL) return(NULL);
+        cuddRef(res1);
+	res2 = cuddAddUnivAbstractRecur(manager, E, cube);
+	if (res2 == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+        cuddRef(res2);
+	res = (res1 == res2) ? res1 :
+	    cuddUniqueInter(manager, (int) f->index, res1, res2);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    Cudd_RecursiveDeref(manager,res2);
+	    return(NULL);
+	}
+	cuddDeref(res1);
+	cuddDeref(res2);
+	cuddCacheInsert2(manager, Cudd_addUnivAbstract, f, cube, res);
+        return(res);
+    }
+
+} /* end of cuddAddUnivAbstractRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addOrAbstract.]
+
+  Description [Performs the recursive step of Cudd_addOrAbstract.
+  Returns the ADD obtained by abstracting the variables of cube from f,
+  if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+cuddAddOrAbstractRecur(
+  DdManager * manager,
+  DdNode * f,
+  DdNode * cube)
+{
+    DdNode	*T, *E, *res, *res1, *res2, *one;
+
+    statLine(manager);
+    one = DD_ONE(manager);
+
+    /* Cube is guaranteed to be a cube at this point. */
+    if (cuddIsConstant(f) || cube == one) {  
+	return(f);
+    }
+
+    /* Abstract a variable that does not appear in f. */
+    if (cuddI(manager,f->index) > cuddI(manager,cube->index)) {
+	res = cuddAddOrAbstractRecur(manager, f, cuddT(cube));
+	return(res);
+    }
+
+    if ((res = cuddCacheLookup2(manager, Cudd_addOrAbstract, f, cube)) != NULL) {
+	return(res);
+    }
+
+    T = cuddT(f);
+    E = cuddE(f);
+
+    /* If the two indices are the same, so are their levels. */
+    if (f->index == cube->index) {
+	res1 = cuddAddOrAbstractRecur(manager, T, cuddT(cube));
+	if (res1 == NULL) return(NULL);
+        cuddRef(res1);
+	if (res1 != one) {
+	    res2 = cuddAddOrAbstractRecur(manager, E, cuddT(cube));
+	    if (res2 == NULL) {
+		Cudd_RecursiveDeref(manager,res1);
+		return(NULL);
+	    }
+	    cuddRef(res2);
+	    res = cuddAddApplyRecur(manager, Cudd_addOr, res1, res2);
+	    if (res == NULL) {
+		Cudd_RecursiveDeref(manager,res1);
+		Cudd_RecursiveDeref(manager,res2);
+		return(NULL);
+	    }
+	    cuddRef(res);
+	    Cudd_RecursiveDeref(manager,res1);
+	    Cudd_RecursiveDeref(manager,res2);
+	} else {
+	    res = res1;
+	}
+	cuddCacheInsert2(manager, Cudd_addOrAbstract, f, cube, res);
+	cuddDeref(res);
+        return(res);
+    } else { /* if (cuddI(manager,f->index) < cuddI(manager,cube->index)) */
+	res1 = cuddAddOrAbstractRecur(manager, T, cube);
+	if (res1 == NULL) return(NULL);
+        cuddRef(res1);
+	res2 = cuddAddOrAbstractRecur(manager, E, cube);
+	if (res2 == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    return(NULL);
+	}
+        cuddRef(res2);
+	res = (res1 == res2) ? res1 :
+	    cuddUniqueInter(manager, (int) f->index, res1, res2);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(manager,res1);
+	    Cudd_RecursiveDeref(manager,res2);
+	    return(NULL);
+	}
+	cuddDeref(res1);
+	cuddDeref(res2);
+	cuddCacheInsert2(manager, Cudd_addOrAbstract, f, cube, res);
+        return(res);
+    }
+
+} /* end of cuddAddOrAbstractRecur */
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether cube is an ADD representing the product
+  of positive literals.]
+
+  Description [Checks whether cube is an ADD representing the product of
+  positive literals. Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+addCheckPositiveCube(
+  DdManager * manager,
+  DdNode * cube)
+{
+    if (Cudd_IsComplement(cube)) return(0);
+    if (cube == DD_ONE(manager)) return(1);
+    if (cuddIsConstant(cube)) return(0);
+    if (cuddE(cube) == DD_ZERO(manager)) {
+        return(addCheckPositiveCube(manager, cuddT(cube)));
+    }
+    return(0);
+
+} /* end of addCheckPositiveCube */
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddAnneal.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddAnneal.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddAnneal.c	(revision 6)
@@ -0,0 +1,814 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddAnneal.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Reordering of DDs based on simulated annealing]
+
+  Description [Internal procedures included in this file:
+		<ul>
+		<li> cuddAnnealing()
+		</ul>
+	       Static procedures included in this file:
+		<ul>
+		<li> stopping_criterion()
+		<li> random_generator()
+		<li> ddExchange()
+		<li> ddJumpingAux()
+		<li> ddJumpingUp()
+		<li> ddJumpingDown()
+		<li> siftBackwardProb()
+		<li> copyOrder()
+		<li> restoreOrder()
+		</ul>
+		]
+
+  SeeAlso     []
+
+  Author      [Jae-Young Jang, Jorgen Sivesind]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/* Annealing parameters */
+#define BETA 0.6 
+#define ALPHA 0.90
+#define EXC_PROB 0.4 
+#define JUMP_UP_PROB 0.36
+#define MAXGEN_RATIO 15.0
+#define STOP_TEMP 1.0
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddAnneal.c,v 1.14 2004/08/13 18:04:46 fabio Exp $";
+#endif
+
+#ifdef DD_STATS
+extern	int	ddTotalNumberSwapping;
+extern	int	ddTotalNISwaps;
+static	int	tosses;
+static	int	acceptances;
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int stopping_criterion (int c1, int c2, int c3, int c4, double temp);
+static double random_generator (void);
+static int ddExchange (DdManager *table, int x, int y, double temp);
+static int ddJumpingAux (DdManager *table, int x, int x_low, int x_high, double temp);
+static Move * ddJumpingUp (DdManager *table, int x, int x_low, int initial_size);
+static Move * ddJumpingDown (DdManager *table, int x, int x_high, int initial_size);
+static int siftBackwardProb (DdManager *table, Move *moves, int size, double temp);
+static void copyOrder (DdManager *table, int *array, int lower, int upper);
+static int restoreOrder (DdManager *table, int *array, int lower, int upper);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Get new variable-order by simulated annealing algorithm.]
+
+  Description [Get x, y by random selection. Choose either
+  exchange or jump randomly. In case of jump, choose between jump_up
+  and jump_down randomly. Do exchange or jump and get optimal case.
+  Loop until there is no improvement or temperature reaches
+  minimum. Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddAnnealing(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int         nvars;
+    int         size;
+    int         x,y;
+    int         result;
+    int		c1, c2, c3, c4;
+    int		BestCost;
+    int		*BestOrder;
+    double	NewTemp, temp;
+    double	rand1;
+    int         innerloop, maxGen;
+    int         ecount, ucount, dcount;
+   
+    nvars = upper - lower + 1;
+
+    result = cuddSifting(table,lower,upper);
+#ifdef DD_STATS
+    (void) fprintf(table->out,"\n");
+#endif
+    if (result == 0) return(0);
+
+    size = table->keys - table->isolated;
+
+    /* Keep track of the best order. */
+    BestCost = size;
+    BestOrder = ALLOC(int,nvars);
+    if (BestOrder == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    copyOrder(table,BestOrder,lower,upper);
+
+    temp = BETA * size;
+    maxGen = (int) (MAXGEN_RATIO * nvars);
+
+    c1 = size + 10;
+    c2 = c1 + 10;
+    c3 = size;
+    c4 = c2 + 10;
+    ecount = ucount = dcount = 0;
+ 
+    while (!stopping_criterion(c1, c2, c3, c4, temp)) {
+#ifdef DD_STATS
+	(void) fprintf(table->out,"temp=%f\tsize=%d\tgen=%d\t",
+		       temp,size,maxGen);
+	tosses = acceptances = 0;
+#endif
+	for (innerloop = 0; innerloop < maxGen; innerloop++) {
+	    /* Choose x, y  randomly. */
+	    x = (int) Cudd_Random() % nvars;
+	    do {
+		y = (int) Cudd_Random() % nvars;
+	    } while (x == y);
+	    x += lower;
+	    y += lower;
+	    if (x > y) {
+		int tmp = x;
+		x = y;
+		y = tmp;
+	    }
+
+	    /* Choose move with roulette wheel. */
+	    rand1 = random_generator();
+	    if (rand1 < EXC_PROB) {
+		result = ddExchange(table,x,y,temp);       /* exchange */
+		ecount++;
+#if 0
+		(void) fprintf(table->out,
+			       "Exchange of %d and %d: size = %d\n",
+			       x,y,table->keys - table->isolated);
+#endif
+	    } else if (rand1 < EXC_PROB + JUMP_UP_PROB) {
+		result = ddJumpingAux(table,y,x,y,temp); /* jumping_up */
+		ucount++;
+#if 0
+		(void) fprintf(table->out,
+			       "Jump up of %d to %d: size = %d\n",
+			       y,x,table->keys - table->isolated);
+#endif
+	    } else {
+		result = ddJumpingAux(table,x,x,y,temp); /* jumping_down */
+		dcount++;
+#if 0
+		(void) fprintf(table->out,
+			       "Jump down of %d to %d: size = %d\n",
+			       x,y,table->keys - table->isolated);
+#endif
+	    }
+
+	    if (!result) {
+		FREE(BestOrder);
+		return(0);
+	    }
+
+	    size = table->keys - table->isolated;	/* keep current size */
+	    if (size < BestCost) {			/* update best order */
+		BestCost = size;
+		copyOrder(table,BestOrder,lower,upper);
+	    }
+	}
+	c1 = c2;
+	c2 = c3;
+	c3 = c4;
+	c4 = size;
+	NewTemp = ALPHA * temp;
+	if (NewTemp >= 1.0) {
+	    maxGen = (int)(log(NewTemp) / log(temp) * maxGen);
+	}
+	temp = NewTemp;	                /* control variable */
+#ifdef DD_STATS
+	(void) fprintf(table->out,"uphill = %d\taccepted = %d\n",
+		       tosses,acceptances);
+	fflush(table->out);
+#endif
+    }
+
+    result = restoreOrder(table,BestOrder,lower,upper);
+    FREE(BestOrder);
+    if (!result) return(0);
+#ifdef DD_STATS
+    fprintf(table->out,"#:N_EXCHANGE %8d : total exchanges\n",ecount);
+    fprintf(table->out,"#:N_JUMPUP   %8d : total jumps up\n",ucount);
+    fprintf(table->out,"#:N_JUMPDOWN %8d : total jumps down",dcount);
+#endif
+    return(1);
+
+} /* end of cuddAnnealing */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Checks termination condition.]
+
+  Description [If temperature is STOP_TEMP or there is no improvement
+  then terminates. Returns 1 if the termination criterion is met; 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+stopping_criterion(
+  int  c1,
+  int  c2,
+  int  c3,
+  int  c4,
+  double  temp)
+{
+    if (STOP_TEMP < temp) {
+	return(0);
+    } else if ((c1 == c2) && (c1 == c3) && (c1 == c4)) {
+	return(1);
+    } else {
+	return(0);
+    }
+
+} /* end of stopping_criterion */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Random number generator.]
+
+  Description [Returns a double precision value between 0.0 and 1.0.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static double
+random_generator(void)
+{
+    return((double)(Cudd_Random() / 2147483561.0));
+
+} /* end of random_generator */
+
+
+/**Function********************************************************************
+
+  Synopsis    [This function is for exchanging two variables, x and y.]
+
+  Description [This is the same funcion as ddSwapping except for
+  comparison expression.  Use probability function, exp(-size_change/temp).]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+ddExchange(
+  DdManager * table,
+  int  x,
+  int  y,
+  double  temp)
+{
+    Move       *move,*moves;
+    int        tmp;
+    int        x_ref,y_ref;
+    int        x_next,y_next;
+    int        size, result;
+    int        initial_size, limit_size;
+
+    x_ref = x;
+    y_ref = y;
+
+    x_next = cuddNextHigh(table,x);
+    y_next = cuddNextLow(table,y);
+    moves = NULL;
+    initial_size = limit_size = table->keys - table->isolated;
+
+    for (;;) {
+	if (x_next == y_next) {
+	    size = cuddSwapInPlace(table,x,x_next);
+	    if (size == 0) goto ddExchangeOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL) goto ddExchangeOutOfMem;
+	    move->x = x;
+	    move->y = x_next;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    size = cuddSwapInPlace(table,y_next,y);
+	    if (size == 0) goto ddExchangeOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL) goto ddExchangeOutOfMem;
+	    move->x = y_next;
+	    move->y = y;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    size = cuddSwapInPlace(table,x,x_next);
+	    if (size == 0) goto ddExchangeOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL) goto ddExchangeOutOfMem;
+	    move->x = x;
+	    move->y = x_next;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+
+	    tmp = x;
+	    x = y;
+	    y = tmp;
+	} else if (x == y_next) {
+	    size = cuddSwapInPlace(table,x,x_next);
+	    if (size == 0) goto ddExchangeOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL) goto ddExchangeOutOfMem;
+	    move->x = x;
+	    move->y = x_next;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    tmp = x;
+	    x = y;
+	    y = tmp;
+	} else {
+	    size = cuddSwapInPlace(table,x,x_next);
+	    if (size == 0) goto ddExchangeOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL) goto ddExchangeOutOfMem;
+	    move->x = x;
+	    move->y = x_next;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    size = cuddSwapInPlace(table,y_next,y);
+	    if (size == 0) goto ddExchangeOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL) goto ddExchangeOutOfMem;
+	    move->x = y_next;
+	    move->y = y;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    x = x_next;
+	    y = y_next;
+	}
+
+	x_next = cuddNextHigh(table,x);
+	y_next = cuddNextLow(table,y);
+	if (x_next > y_ref) break;
+
+	if ((double) size > DD_MAX_REORDER_GROWTH * (double) limit_size) {
+	    break;
+	} else if (size < limit_size) {
+	    limit_size = size;
+	}
+    }
+
+    if (y_next>=x_ref) {
+        size = cuddSwapInPlace(table,y_next,y);
+        if (size == 0) goto ddExchangeOutOfMem;
+        move = (Move *)cuddDynamicAllocNode(table);
+        if (move == NULL) goto ddExchangeOutOfMem;
+        move->x = y_next;
+        move->y = y;
+        move->size = size;
+        move->next = moves;
+        moves = move;
+    }
+
+    /* move backward and stop at best position or accept uphill move */
+    result = siftBackwardProb(table,moves,initial_size,temp);
+    if (!result) goto ddExchangeOutOfMem;
+
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(1);
+
+ddExchangeOutOfMem:
+    while (moves != NULL) {
+        move = moves->next;
+        cuddDeallocMove(table, moves);
+        moves = move;
+    }
+    return(0);
+
+} /* end of ddExchange */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Moves a variable to a specified position.]
+
+  Description [If x==x_low, it executes jumping_down. If x==x_high, it
+  executes jumping_up. This funcion is similar to ddSiftingAux. Returns
+  1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+ddJumpingAux(
+  DdManager * table,
+  int  x,
+  int  x_low,
+  int  x_high,
+  double  temp)
+{
+    Move       *move;
+    Move       *moves;        /* list of moves */
+    int        initial_size;
+    int        result;
+
+    initial_size = table->keys - table->isolated;
+
+#ifdef DD_DEBUG
+    assert(table->subtables[x].keys > 0);
+#endif
+
+    moves = NULL;
+
+    if (cuddNextLow(table,x) < x_low) {
+	if (cuddNextHigh(table,x) > x_high) return(1);
+	moves = ddJumpingDown(table,x,x_high,initial_size);
+	/* after that point x --> x_high unless early termination */
+	if (moves == NULL) goto ddJumpingAuxOutOfMem;
+	/* move backward and stop at best position or accept uphill move */
+	result = siftBackwardProb(table,moves,initial_size,temp);
+	if (!result) goto ddJumpingAuxOutOfMem;
+    } else if (cuddNextHigh(table,x) > x_high) {
+	moves = ddJumpingUp(table,x,x_low,initial_size);
+	/* after that point x --> x_low unless early termination */
+	if (moves == NULL) goto ddJumpingAuxOutOfMem;
+	/* move backward and stop at best position or accept uphill move */
+	result = siftBackwardProb(table,moves,initial_size,temp);
+	if (!result) goto ddJumpingAuxOutOfMem;
+    } else {
+	(void) fprintf(table->err,"Unexpected condition in ddJumping\n");
+	goto ddJumpingAuxOutOfMem;
+    }
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(1);
+
+ddJumpingAuxOutOfMem:
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(0);
+
+} /* end of ddJumpingAux */
+
+
+/**Function********************************************************************
+
+  Synopsis    [This function is for jumping up.]
+
+  Description [This is a simplified version of ddSiftingUp. It does not
+  use lower bounding. Returns the set of moves in case of success; NULL
+  if memory is full.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static Move *
+ddJumpingUp(
+  DdManager * table,
+  int  x,
+  int  x_low,
+  int  initial_size)
+{
+    Move       *moves;
+    Move       *move;
+    int        y;
+    int        size;
+    int        limit_size = initial_size;
+
+    moves = NULL;
+    y = cuddNextLow(table,x);
+    while (y >= x_low) {
+	size = cuddSwapInPlace(table,y,x);
+	if (size == 0) goto ddJumpingUpOutOfMem;
+	move = (Move *)cuddDynamicAllocNode(table);
+	if (move == NULL) goto ddJumpingUpOutOfMem;
+	move->x = y;
+	move->y = x;
+	move->size = size;
+	move->next = moves;
+	moves = move;
+	if ((double) size > table->maxGrowth * (double) limit_size) {
+	    break;
+	} else if (size < limit_size) {
+	    limit_size = size;
+	}
+	x = y;
+	y = cuddNextLow(table,x);
+    }
+    return(moves);
+
+ddJumpingUpOutOfMem:
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(NULL);
+
+} /* end of ddJumpingUp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [This function is for jumping down.]
+
+  Description [This is a simplified version of ddSiftingDown. It does not
+  use lower bounding. Returns the set of moves in case of success; NULL
+  if memory is full.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static Move *
+ddJumpingDown(
+  DdManager * table,
+  int  x,
+  int  x_high,
+  int  initial_size)
+{
+    Move       *moves;
+    Move       *move;
+    int        y;
+    int        size;
+    int        limit_size = initial_size;
+
+    moves = NULL;
+    y = cuddNextHigh(table,x);
+    while (y <= x_high) {
+	size = cuddSwapInPlace(table,x,y);
+	if (size == 0) goto ddJumpingDownOutOfMem;
+	move = (Move *)cuddDynamicAllocNode(table);
+	if (move == NULL) goto ddJumpingDownOutOfMem;
+	move->x = x;
+	move->y = y;
+	move->size = size;
+	move->next = moves;
+	moves = move;
+	if ((double) size > table->maxGrowth * (double) limit_size) {
+	    break;
+	} else if (size < limit_size) {
+	    limit_size = size;
+	}
+	x = y;
+	y = cuddNextHigh(table,x);
+    }
+    return(moves);
+
+ddJumpingDownOutOfMem:
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(NULL);
+
+} /* end of ddJumpingDown */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the DD to the best position encountered during
+  sifting if there was improvement.]
+
+  Description [Otherwise, "tosses a coin" to decide whether to keep
+  the current configuration or return the DD to the original
+  one. Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+siftBackwardProb(
+  DdManager * table,
+  Move * moves,
+  int  size,
+  double  temp)
+{
+    Move   *move;
+    int    res;
+    int    best_size = size;
+    double coin, threshold;
+
+    /* Look for best size during the last sifting */
+    for (move = moves; move != NULL; move = move->next) {
+	if (move->size < best_size) {
+	    best_size = move->size;
+	}
+    }
+    
+    /* If best_size equals size, the last sifting did not produce any
+    ** improvement. We now toss a coin to decide whether to retain
+    ** this change or not.
+    */
+    if (best_size == size) {
+	coin = random_generator();
+#ifdef DD_STATS
+	tosses++;
+#endif
+	threshold = exp(-((double)(table->keys - table->isolated - size))/temp);
+	if (coin < threshold) {
+#ifdef DD_STATS
+	    acceptances++;
+#endif
+	    return(1);
+	}
+    }
+
+    /* Either there was improvement, or we have decided not to
+    ** accept the uphill move. Go to best position.
+    */
+    res = table->keys - table->isolated;
+    for (move = moves; move != NULL; move = move->next) {
+	if (res == best_size) return(1);
+	res = cuddSwapInPlace(table,(int)move->x,(int)move->y);
+	if (!res) return(0);
+    }
+
+    return(1);
+
+} /* end of sift_backward_prob */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Copies the current variable order to array.]
+
+  Description [Copies the current variable order to array.
+  At the same time inverts the permutation.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+copyOrder(
+  DdManager * table,
+  int * array,
+  int  lower,
+  int  upper)
+{
+    int i;
+    int nvars;
+
+    nvars = upper - lower + 1;
+    for (i = 0; i < nvars; i++) {
+	array[i] = table->invperm[i+lower];
+    }
+
+} /* end of copyOrder */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Restores the variable order in array by a series of sifts up.]
+
+  Description [Restores the variable order in array by a series of sifts up.
+  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+restoreOrder(
+  DdManager * table,
+  int * array,
+  int  lower,
+  int  upper)
+{
+    int i, x, y, size;
+    int nvars = upper - lower + 1;
+
+    for (i = 0; i < nvars; i++) {
+	x = table->perm[array[i]];
+#ifdef DD_DEBUG
+    assert(x >= lower && x <= upper);
+#endif
+	y = cuddNextLow(table,x);
+	while (y >= i + lower) {
+	    size = cuddSwapInPlace(table,y,x);
+	    if (size == 0) return(0);
+	    x = y;
+	    y = cuddNextLow(table,x);
+	}
+    }
+
+    return(1);
+
+} /* end of restoreOrder */
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddApa.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddApa.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddApa.c	(revision 6)
@@ -0,0 +1,964 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddApa.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Arbitrary precision arithmetic functions.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> 
+		</ul>
+	Internal procedures included in this module:
+		<ul>
+		<li> ()
+		</ul>
+	Static procedures included in this module:
+		<ul>
+		<li> ()
+		</ul>]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddApa.c,v 1.16 2004/08/13 18:04:46 fabio Exp $";
+#endif
+
+static	DdNode	*background, *zero;
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static DdApaNumber cuddApaCountMintermAux (DdNode * node, int digits, DdApaNumber max, DdApaNumber min, st_table * table);
+static enum st_retval cuddApaStCountfree (char * key, char * value, char * arg);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Finds the number of digits for an arbitrary precision
+  integer.]
+
+  Description [Finds the number of digits for an arbitrary precision
+  integer given the maximum number of binary digits.  The number of
+  binary digits should be positive. Returns the number of digits if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Cudd_ApaNumberOfDigits(
+  int  binaryDigits)
+{
+    int digits;
+
+    digits = binaryDigits / DD_APA_BITS;
+    if ((digits * DD_APA_BITS) != binaryDigits)
+	digits++;
+    return(digits);
+
+} /* end of Cudd_ApaNumberOfDigits */
+	   
+
+/**Function********************************************************************
+
+  Synopsis    [Allocates memory for an arbitrary precision integer.]
+
+  Description [Allocates memory for an arbitrary precision
+  integer. Returns a pointer to the allocated memory if successful;
+  NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdApaNumber
+Cudd_NewApaNumber(
+  int  digits)
+{
+    return(ALLOC(DdApaDigit, digits));
+
+} /* end of Cudd_NewApaNumber */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes a copy of an arbitrary precision integer.]
+
+  Description [Makes a copy of an arbitrary precision integer.]
+
+  SideEffects [Changes parameter <code>dest</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cudd_ApaCopy(
+  int  digits,
+  DdApaNumber  source,
+  DdApaNumber  dest)
+{
+    int i;
+
+    for (i = 0; i < digits; i++) {
+	dest[i] = source[i];
+    }
+
+} /* end of Cudd_ApaCopy */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adds two arbitrary precision integers.]
+
+  Description [Adds two arbitrary precision integers.  Returns the
+  carry out of the most significant digit.]
+
+  SideEffects [The result of the sum is stored in parameter <code>sum</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdApaDigit
+Cudd_ApaAdd(
+  int  digits,
+  DdApaNumber  a,
+  DdApaNumber  b,
+  DdApaNumber  sum)
+{
+    int i;
+    DdApaDoubleDigit partial = 0;
+
+    for (i = digits - 1; i >= 0; i--) {
+	partial = a[i] + b[i] + DD_MSDIGIT(partial);
+	sum[i] = (DdApaDigit) DD_LSDIGIT(partial);
+    }
+    return((DdApaDigit) DD_MSDIGIT(partial));
+
+} /* end of Cudd_ApaAdd */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subtracts two arbitrary precision integers.]
+
+  Description [Subtracts two arbitrary precision integers.  Returns the
+  borrow out of the most significant digit.]
+
+  SideEffects [The result of the subtraction is stored in parameter
+  <code>diff</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdApaDigit
+Cudd_ApaSubtract(
+  int  digits,
+  DdApaNumber  a,
+  DdApaNumber  b,
+  DdApaNumber  diff)
+{
+    int i;
+    DdApaDoubleDigit partial = DD_APA_BASE;
+
+    for (i = digits - 1; i >= 0; i--) {
+	partial = a[i] - b[i] + DD_MSDIGIT(partial) + DD_APA_MASK;
+	diff[i] = (DdApaDigit) DD_LSDIGIT(partial);
+    }
+    return((DdApaDigit) DD_MSDIGIT(partial) - 1);
+
+} /* end of Cudd_ApaSubtract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Divides an arbitrary precision integer by a digit.]
+
+  Description [Divides an arbitrary precision integer by a digit.]
+
+  SideEffects [The quotient is returned in parameter <code>quotient</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdApaDigit
+Cudd_ApaShortDivision(
+  int  digits,
+  DdApaNumber  dividend,
+  DdApaDigit  divisor,
+  DdApaNumber  quotient)
+{
+    int i;
+    DdApaDigit remainder;
+    DdApaDoubleDigit partial;
+
+    remainder = 0;
+    for (i = 0; i < digits; i++) {
+	partial = remainder * DD_APA_BASE + dividend[i];
+	quotient[i] = (DdApaDigit) (partial/(DdApaDoubleDigit)divisor);
+	remainder = (DdApaDigit) (partial % divisor);
+    }
+
+    return(remainder);
+
+} /* end of Cudd_ApaShortDivision */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Divides an arbitrary precision integer by an integer.]
+
+  Description [Divides an arbitrary precision integer by a 32-bit
+  unsigned integer. Returns the remainder of the division. This
+  procedure relies on the assumption that the number of bits of a
+  DdApaDigit plus the number of bits of an unsigned int is less the
+  number of bits of the mantissa of a double. This guarantees that the
+  product of a DdApaDigit and an unsigned int can be represented
+  without loss of precision by a double. On machines where this
+  assumption is not satisfied, this procedure will malfunction.]
+
+  SideEffects [The quotient is returned in parameter <code>quotient</code>.]
+
+  SeeAlso     [Cudd_ApaShortDivision]
+
+******************************************************************************/
+unsigned int
+Cudd_ApaIntDivision(
+  int  digits,
+  DdApaNumber dividend,
+  unsigned int divisor,
+  DdApaNumber quotient)
+{
+    int i;
+    double partial;
+    unsigned int remainder = 0;
+    double ddiv = (double) divisor;
+
+    for (i = 0; i < digits; i++) {
+	partial = (double) remainder * DD_APA_BASE + dividend[i];
+	quotient[i] = (DdApaDigit) (partial / ddiv);
+	remainder = (unsigned int) (partial - ((double)quotient[i] * ddiv));
+    }
+
+    return(remainder);
+
+} /* end of Cudd_ApaIntDivision */
+
+
+/**Function********************************************************************
+
+  Synopsis [Shifts right an arbitrary precision integer by one binary
+  place.]
+
+  Description [Shifts right an arbitrary precision integer by one
+  binary place. The most significant binary digit of the result is
+  taken from parameter <code>in</code>.]
+
+  SideEffects [The result is returned in parameter <code>b</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cudd_ApaShiftRight(
+  int  digits,
+  DdApaDigit  in,
+  DdApaNumber  a,
+  DdApaNumber  b)
+{
+    int i;
+
+    for (i = digits - 1; i > 0; i--) {
+	b[i] = (a[i] >> 1) | ((a[i-1] & 1) << (DD_APA_BITS - 1));
+    }
+    b[0] = (a[0] >> 1) | (in << (DD_APA_BITS - 1));
+
+} /* end of Cudd_ApaShiftRight */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets an arbitrary precision integer to a one-digit literal.]
+
+  Description [Sets an arbitrary precision integer to a one-digit literal.]
+
+  SideEffects [The result is returned in parameter <code>number</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cudd_ApaSetToLiteral(
+  int  digits,
+  DdApaNumber  number,
+  DdApaDigit  literal)
+{
+    int i;
+
+    for (i = 0; i < digits - 1; i++)
+	number[i] = 0;
+    number[digits - 1] = literal;
+
+} /* end of Cudd_ApaSetToLiteral */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets an arbitrary precision integer to a power of two.]
+
+  Description [Sets an arbitrary precision integer to a power of
+  two. If the power of two is too large to be represented, the number
+  is set to 0.]
+
+  SideEffects [The result is returned in parameter <code>number</code>.]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cudd_ApaPowerOfTwo(
+  int  digits,
+  DdApaNumber  number,
+  int  power)
+{
+    int i;
+    int index;
+
+    for (i = 0; i < digits; i++)
+	number[i] = 0;
+    i = digits - 1 - power / DD_APA_BITS;
+    if (i < 0) return;
+    index = power & (DD_APA_BITS - 1);
+    number[i] = 1 << index;
+
+} /* end of Cudd_ApaPowerOfTwo */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Compares two arbitrary precision integers.]
+
+  Description [Compares two arbitrary precision integers. Returns 1 if
+  the first number is larger; 0 if they are equal; -1 if the second
+  number is larger.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Cudd_ApaCompare(
+  int digitsFirst,
+  DdApaNumber  first,
+  int digitsSecond,
+  DdApaNumber  second)
+{
+    int i;
+    int firstNZ, secondNZ;
+
+    /* Find first non-zero in both numbers. */
+    for (firstNZ = 0; firstNZ < digitsFirst; firstNZ++)
+	if (first[firstNZ] != 0) break;
+    for (secondNZ = 0; secondNZ < digitsSecond; secondNZ++)
+	if (second[secondNZ] != 0) break;
+    if (digitsFirst - firstNZ > digitsSecond - secondNZ) return(1);
+    else if (digitsFirst - firstNZ < digitsSecond - secondNZ) return(-1);
+    for (i = 0; i < digitsFirst - firstNZ; i++) {
+	if (first[firstNZ + i] > second[secondNZ + i]) return(1);
+	else if (first[firstNZ + i] < second[secondNZ + i]) return(-1);
+    }
+    return(0);
+
+} /* end of Cudd_ApaCompare */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Compares the ratios of two arbitrary precision integers to two
+  unsigned ints.]
+
+  Description [Compares the ratios of two arbitrary precision integers
+  to two unsigned ints. Returns 1 if the first number is larger; 0 if
+  they are equal; -1 if the second number is larger.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Cudd_ApaCompareRatios(
+  int digitsFirst,
+  DdApaNumber firstNum,
+  unsigned int firstDen,
+  int digitsSecond,
+  DdApaNumber secondNum,
+  unsigned int secondDen)
+{
+    int result;
+    DdApaNumber first, second;
+    unsigned int firstRem, secondRem;
+
+    first = Cudd_NewApaNumber(digitsFirst);
+    firstRem = Cudd_ApaIntDivision(digitsFirst,firstNum,firstDen,first);
+    second = Cudd_NewApaNumber(digitsSecond);
+    secondRem = Cudd_ApaIntDivision(digitsSecond,secondNum,secondDen,second);
+    result = Cudd_ApaCompare(digitsFirst,first,digitsSecond,second);
+    if (result == 0) {
+	if ((double)firstRem/firstDen > (double)secondRem/secondDen)
+	    return(1);
+	else if ((double)firstRem/firstDen < (double)secondRem/secondDen)
+	    return(-1);
+    }
+    return(result);
+
+} /* end of Cudd_ApaCompareRatios */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints an arbitrary precision integer in hexadecimal format.]
+
+  Description [Prints an arbitrary precision integer in hexadecimal format.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_ApaPrintDecimal Cudd_ApaPrintExponential]
+
+******************************************************************************/
+int
+Cudd_ApaPrintHex(
+  FILE * fp,
+  int  digits,
+  DdApaNumber  number)
+{
+    int i, result;
+
+    for (i = 0; i < digits; i++) {
+	result = fprintf(fp,DD_APA_HEXPRINT,number[i]);
+	if (result == EOF)
+	    return(0);
+    }
+    return(1);
+
+} /* end of Cudd_ApaPrintHex */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints an arbitrary precision integer in decimal format.]
+
+  Description [Prints an arbitrary precision integer in decimal format.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_ApaPrintHex Cudd_ApaPrintExponential]
+
+******************************************************************************/
+int
+Cudd_ApaPrintDecimal(
+  FILE * fp,
+  int  digits,
+  DdApaNumber  number)
+{
+    int i, result;
+    DdApaDigit remainder;
+    DdApaNumber work;
+    unsigned char *decimal;
+    int leadingzero;
+    int decimalDigits = (int) (digits * log10((double) DD_APA_BASE)) + 1;
+    
+    work = Cudd_NewApaNumber(digits);
+    if (work == NULL)
+	return(0);
+    decimal = ALLOC(unsigned char, decimalDigits);
+    if (decimal == NULL) {
+	FREE(work);
+	return(0);
+    }
+    Cudd_ApaCopy(digits,number,work);
+    for (i = decimalDigits - 1; i >= 0; i--) {
+	remainder = Cudd_ApaShortDivision(digits,work,(DdApaDigit) 10,work);
+	decimal[i] = remainder;
+    }
+    FREE(work);
+
+    leadingzero = 1;
+    for (i = 0; i < decimalDigits; i++) {
+	leadingzero = leadingzero && (decimal[i] == 0);
+	if ((!leadingzero) || (i == (decimalDigits - 1))) {
+	    result = fprintf(fp,"%1d",decimal[i]);
+	    if (result == EOF) {
+		FREE(decimal);
+		return(0);
+	    }
+	}
+    }
+    FREE(decimal);
+    return(1);
+
+} /* end of Cudd_ApaPrintDecimal */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints an arbitrary precision integer in exponential format.]
+
+  Description [Prints an arbitrary precision integer in exponential format.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_ApaPrintHex Cudd_ApaPrintDecimal]
+
+******************************************************************************/
+int
+Cudd_ApaPrintExponential(
+  FILE * fp,
+  int  digits,
+  DdApaNumber  number,
+  int precision)
+{
+    int i, first, last, result;
+    DdApaDigit remainder;
+    DdApaNumber work;
+    unsigned char *decimal;
+    int decimalDigits = (int) (digits * log10((double) DD_APA_BASE)) + 1;
+    
+    work = Cudd_NewApaNumber(digits);
+    if (work == NULL)
+	return(0);
+    decimal = ALLOC(unsigned char, decimalDigits);
+    if (decimal == NULL) {
+	FREE(work);
+	return(0);
+    }
+    Cudd_ApaCopy(digits,number,work);
+    first = decimalDigits - 1;
+    for (i = decimalDigits - 1; i >= 0; i--) {
+	remainder = Cudd_ApaShortDivision(digits,work,(DdApaDigit) 10,work);
+	decimal[i] = remainder;
+	if (remainder != 0) first = i; /* keep track of MS non-zero */
+    }
+    FREE(work);
+    last = ddMin(first + precision, decimalDigits);
+
+    for (i = first; i < last; i++) {
+	result = fprintf(fp,"%s%1d",i == first+1 ? "." : "", decimal[i]);
+	if (result == EOF) {
+	    FREE(decimal);
+	    return(0);
+	}
+    }
+    FREE(decimal);
+    result = fprintf(fp,"e+%d",decimalDigits - first - 1);
+    if (result == EOF) {
+	return(0);
+    }
+    return(1);
+
+} /* end of Cudd_ApaPrintExponential */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of minterms of a DD.]
+
+  Description [Counts the number of minterms of a DD. The function is
+  assumed to depend on nvars variables. The minterm count is
+  represented as an arbitrary precision unsigned integer, to allow for
+  any number of variables CUDD supports.  Returns a pointer to the
+  array representing the number of minterms of the function rooted at
+  node if successful; NULL otherwise.]
+
+  SideEffects [The number of digits of the result is returned in
+  parameter <code>digits</code>.]
+
+  SeeAlso     [Cudd_CountMinterm]
+
+******************************************************************************/
+DdApaNumber
+Cudd_ApaCountMinterm(
+  DdManager * manager,
+  DdNode * node,
+  int  nvars,
+  int * digits)
+{
+    DdApaNumber	max, min;
+    st_table	*table;
+    DdApaNumber	i,count;	
+
+    background = manager->background;
+    zero = Cudd_Not(manager->one);
+
+    *digits = Cudd_ApaNumberOfDigits(nvars+1);
+    max = Cudd_NewApaNumber(*digits);
+    if (max == NULL) {
+	return(NULL);
+    }
+    Cudd_ApaPowerOfTwo(*digits,max,nvars);
+    min = Cudd_NewApaNumber(*digits);
+    if (min == NULL) {
+	FREE(max);
+	return(NULL);
+    }
+    Cudd_ApaSetToLiteral(*digits,min,0);
+    table = st_init_table(st_ptrcmp,st_ptrhash);
+    if (table == NULL) {
+	FREE(max);
+	FREE(min);
+	return(NULL);
+    }
+    i = cuddApaCountMintermAux(Cudd_Regular(node),*digits,max,min,table);
+    if (i == NULL) {
+	FREE(max);
+	FREE(min);
+	st_foreach(table, cuddApaStCountfree, NULL);
+	st_free_table(table);
+	return(NULL);
+    }
+    count = Cudd_NewApaNumber(*digits);
+    if (count == NULL) {
+	FREE(max);
+	FREE(min);
+	st_foreach(table, cuddApaStCountfree, NULL);
+	st_free_table(table);
+	if (Cudd_Regular(node)->ref == 1) FREE(i);
+	return(NULL);
+    }
+    if (Cudd_IsComplement(node)) {
+	(void) Cudd_ApaSubtract(*digits,max,i,count);
+    } else {
+	Cudd_ApaCopy(*digits,i,count);
+    }
+    FREE(max);
+    FREE(min);
+    st_foreach(table, cuddApaStCountfree, NULL);
+    st_free_table(table);
+    if (Cudd_Regular(node)->ref == 1) FREE(i);
+    return(count);
+
+} /* end of Cudd_ApaCountMinterm */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the number of minterms of a BDD or ADD using
+  arbitrary precision arithmetic.]
+
+  Description [Prints the number of minterms of a BDD or ADD using
+  arbitrary precision arithmetic. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_ApaPrintMintermExp]
+
+******************************************************************************/
+int
+Cudd_ApaPrintMinterm(
+  FILE * fp,
+  DdManager * dd,
+  DdNode * node,
+  int  nvars)
+{
+    int digits;
+    int result;
+    DdApaNumber count;
+
+    count = Cudd_ApaCountMinterm(dd,node,nvars,&digits);
+    if (count == NULL)
+	return(0);
+    result = Cudd_ApaPrintDecimal(fp,digits,count);
+    FREE(count);
+    if (fprintf(fp,"\n") == EOF) {
+	return(0);
+    }
+    return(result);
+
+} /* end of Cudd_ApaPrintMinterm */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the number of minterms of a BDD or ADD in exponential
+  format using arbitrary precision arithmetic.]
+
+  Description [Prints the number of minterms of a BDD or ADD in
+  exponential format using arbitrary precision arithmetic. Parameter
+  precision controls the number of signficant digits printed. Returns
+  1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_ApaPrintMinterm]
+
+******************************************************************************/
+int
+Cudd_ApaPrintMintermExp(
+  FILE * fp,
+  DdManager * dd,
+  DdNode * node,
+  int  nvars,
+  int precision)
+{
+    int digits;
+    int result;
+    DdApaNumber count;
+
+    count = Cudd_ApaCountMinterm(dd,node,nvars,&digits);
+    if (count == NULL)
+	return(0);
+    result = Cudd_ApaPrintExponential(fp,digits,count,precision);
+    FREE(count);
+    if (fprintf(fp,"\n") == EOF) {
+	return(0);
+    }
+    return(result);
+
+} /* end of Cudd_ApaPrintMintermExp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the density of a BDD or ADD using
+  arbitrary precision arithmetic.]
+
+  Description [Prints the density of a BDD or ADD using
+  arbitrary precision arithmetic. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Cudd_ApaPrintDensity(
+  FILE * fp,
+  DdManager * dd,
+  DdNode * node,
+  int  nvars)
+{
+    int digits;
+    int result;
+    DdApaNumber count,density;
+    unsigned int size, remainder, fractional;
+
+    count = Cudd_ApaCountMinterm(dd,node,nvars,&digits);
+    if (count == NULL)
+	return(0);
+    size = Cudd_DagSize(node);
+    density = Cudd_NewApaNumber(digits);
+    remainder = Cudd_ApaIntDivision(digits,count,size,density);
+    result = Cudd_ApaPrintDecimal(fp,digits,density);
+    FREE(count);
+    FREE(density);
+    fractional = (unsigned int)((double)remainder / size * 1000000);
+    if (fprintf(fp,".%u\n", fractional) == EOF) {
+	return(0);
+    }
+    return(result);
+
+} /* end of Cudd_ApaPrintDensity */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_ApaCountMinterm.]
+
+  Description [Performs the recursive step of Cudd_ApaCountMinterm.
+  It is based on the following identity. Let |f| be the
+  number of minterms of f. Then:
+  <xmp>
+    |f| = (|f0|+|f1|)/2
+  </xmp>
+  where f0 and f1 are the two cofactors of f.
+  Uses the identity <code>|f'| = max - |f|</code>.
+  The procedure expects the argument "node" to be a regular pointer, and
+  guarantees this condition is met in the recursive calls.
+  For efficiency, the result of a call is cached only if the node has
+  a reference count greater than 1.
+  Returns the number of minterms of the function rooted at node.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static DdApaNumber
+cuddApaCountMintermAux(
+  DdNode * node,
+  int  digits,
+  DdApaNumber  max,
+  DdApaNumber  min,
+  st_table * table)
+{
+    DdNode      *Nt, *Ne;
+    DdApaNumber	mint, mint1, mint2;
+    DdApaDigit	carryout;
+
+    if (cuddIsConstant(node)) {
+	if (node == background || node == zero) {
+	    return(min);
+	} else {
+	    return(max);
+	}
+    }
+    if (node->ref > 1 && st_lookup(table, node, &mint)) {
+	return(mint);
+    }
+
+    Nt = cuddT(node); Ne = cuddE(node);
+
+    mint1 = cuddApaCountMintermAux(Nt,  digits, max, min, table);
+    if (mint1 == NULL) return(NULL);
+    mint2 = cuddApaCountMintermAux(Cudd_Regular(Ne), digits, max, min, table);
+    if (mint2 == NULL) {
+	if (Nt->ref == 1) FREE(mint1);
+	return(NULL);
+    }
+    mint = Cudd_NewApaNumber(digits);
+    if (mint == NULL) {
+	if (Nt->ref == 1) FREE(mint1);
+	if (Cudd_Regular(Ne)->ref == 1) FREE(mint2);
+	return(NULL);
+    }
+    if (Cudd_IsComplement(Ne)) {
+	(void) Cudd_ApaSubtract(digits,max,mint2,mint);
+	carryout = Cudd_ApaAdd(digits,mint1,mint,mint);
+    } else {
+	carryout = Cudd_ApaAdd(digits,mint1,mint2,mint);
+    }
+    Cudd_ApaShiftRight(digits,carryout,mint,mint);
+    /* If the refernce count of a child is 1, its minterm count
+    ** hasn't been stored in table.  Therefore, it must be explicitly
+    ** freed here. */
+    if (Nt->ref == 1) FREE(mint1);
+    if (Cudd_Regular(Ne)->ref == 1) FREE(mint2);
+    
+    if (node->ref > 1) {
+	if (st_insert(table, (char *)node, (char *)mint) == ST_OUT_OF_MEM) {
+	    FREE(mint);
+	    return(NULL);
+	}
+    }
+    return(mint);
+
+} /* end of cuddApaCountMintermAux */
+
+
+/**Function********************************************************************
+
+  Synopsis [Frees the memory used to store the minterm counts recorded
+  in the visited table.]
+
+  Description [Frees the memory used to store the minterm counts
+  recorded in the visited table. Returns ST_CONTINUE.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static enum st_retval
+cuddApaStCountfree(
+  char * key,
+  char * value,
+  char * arg)
+{
+    DdApaNumber	d;
+
+    d = (DdApaNumber) value;
+    FREE(d);
+    return(ST_CONTINUE);
+
+} /* end of cuddApaStCountfree */
+
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddBridge.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddBridge.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddBridge.c	(revision 6)
@@ -0,0 +1,1016 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddBridge.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Translation from BDD to ADD and vice versa and transfer between
+  different managers.]
+
+  Description [External procedures included in this file:
+	    <ul>
+	    <li> Cudd_addBddThreshold()
+	    <li> Cudd_addBddStrictThreshold()
+	    <li> Cudd_addBddInterval()
+	    <li> Cudd_addBddIthBit()
+	    <li> Cudd_BddToAdd()
+	    <li> Cudd_addBddPattern()
+	    <li> Cudd_bddTransfer()
+	    </ul>
+	Internal procedures included in this file:
+	    <ul>
+	    <li> cuddBddTransfer()
+	    <li> cuddAddBddDoPattern()
+	    </ul>
+	Static procedures included in this file:
+	    <ul>
+	    <li> addBddDoThreshold()
+	    <li> addBddDoStrictThreshold()
+	    <li> addBddDoInterval()
+	    <li> addBddDoIthBit()
+	    <li> ddBddToAddRecur()
+	    <li> cuddBddTransferRecur()
+	    </ul>
+	    ]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddBridge.c,v 1.18 2004/08/13 18:04:46 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static DdNode * addBddDoThreshold (DdManager *dd, DdNode *f, DdNode *val);
+static DdNode * addBddDoStrictThreshold (DdManager *dd, DdNode *f, DdNode *val);
+static DdNode * addBddDoInterval (DdManager *dd, DdNode *f, DdNode *l, DdNode *u);
+static DdNode * addBddDoIthBit (DdManager *dd, DdNode *f, DdNode *index);
+static DdNode * ddBddToAddRecur (DdManager *dd, DdNode *B);
+static DdNode * cuddBddTransferRecur (DdManager *ddS, DdManager *ddD, DdNode *f, st_table *table);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an ADD to a BDD.]
+
+  Description [Converts an ADD to a BDD by replacing all
+  discriminants greater than or equal to value with 1, and all other
+  discriminants with 0. Returns a pointer to the resulting BDD if
+  successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addBddInterval Cudd_addBddPattern Cudd_BddToAdd
+  Cudd_addBddStrictThreshold]
+
+******************************************************************************/
+DdNode *
+Cudd_addBddThreshold(
+  DdManager * dd,
+  DdNode * f,
+  CUDD_VALUE_TYPE  value)
+{
+    DdNode *res;
+    DdNode *val;
+    
+    val = cuddUniqueConst(dd,value);
+    if (val == NULL) return(NULL);
+    cuddRef(val);
+
+    do {
+	dd->reordered = 0;
+	res = addBddDoThreshold(dd, f, val);
+    } while (dd->reordered == 1);
+
+    if (res == NULL) {
+	Cudd_RecursiveDeref(dd, val);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(dd, val);
+    cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addBddThreshold */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an ADD to a BDD.]
+
+  Description [Converts an ADD to a BDD by replacing all
+  discriminants STRICTLY greater than value with 1, and all other
+  discriminants with 0. Returns a pointer to the resulting BDD if
+  successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addBddInterval Cudd_addBddPattern Cudd_BddToAdd 
+  Cudd_addBddThreshold]
+
+******************************************************************************/
+DdNode *
+Cudd_addBddStrictThreshold(
+  DdManager * dd,
+  DdNode * f,
+  CUDD_VALUE_TYPE  value)
+{
+    DdNode *res;
+    DdNode *val;
+    
+    val = cuddUniqueConst(dd,value);
+    if (val == NULL) return(NULL);
+    cuddRef(val);
+
+    do {
+	dd->reordered = 0;
+	res = addBddDoStrictThreshold(dd, f, val);
+    } while (dd->reordered == 1);
+
+    if (res == NULL) {
+	Cudd_RecursiveDeref(dd, val);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(dd, val);
+    cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addBddStrictThreshold */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an ADD to a BDD.]
+
+  Description [Converts an ADD to a BDD by replacing all
+  discriminants greater than or equal to lower and less than or equal to
+  upper with 1, and all other discriminants with 0. Returns a pointer to
+  the resulting BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addBddThreshold Cudd_addBddStrictThreshold 
+  Cudd_addBddPattern Cudd_BddToAdd]
+
+******************************************************************************/
+DdNode *
+Cudd_addBddInterval(
+  DdManager * dd,
+  DdNode * f,
+  CUDD_VALUE_TYPE  lower,
+  CUDD_VALUE_TYPE  upper)
+{
+    DdNode *res;
+    DdNode *l;
+    DdNode *u;
+    
+    /* Create constant nodes for the interval bounds, so that we can use
+    ** the global cache.
+    */
+    l = cuddUniqueConst(dd,lower);
+    if (l == NULL) return(NULL);
+    cuddRef(l);
+    u = cuddUniqueConst(dd,upper);
+    if (u == NULL) {
+	Cudd_RecursiveDeref(dd,l);
+	return(NULL);
+    }
+    cuddRef(u);
+
+    do {
+	dd->reordered = 0;
+	res = addBddDoInterval(dd, f, l, u);
+    } while (dd->reordered == 1);
+
+    if (res == NULL) {
+	Cudd_RecursiveDeref(dd, l);
+	Cudd_RecursiveDeref(dd, u);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(dd, l);
+    Cudd_RecursiveDeref(dd, u);
+    cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addBddInterval */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an ADD to a BDD by extracting the i-th bit from
+  the leaves.]
+
+  Description [Converts an ADD to a BDD by replacing all
+  discriminants whose i-th bit is equal to 1 with 1, and all other
+  discriminants with 0. The i-th bit refers to the integer
+  representation of the leaf value. If the value is has a fractional
+  part, it is ignored. Repeated calls to this procedure allow one to
+  transform an integer-valued ADD into an array of BDDs, one for each
+  bit of the leaf values. Returns a pointer to the resulting BDD if
+  successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addBddInterval Cudd_addBddPattern Cudd_BddToAdd]
+
+******************************************************************************/
+DdNode *
+Cudd_addBddIthBit(
+  DdManager * dd,
+  DdNode * f,
+  int  bit)
+{
+    DdNode *res;
+    DdNode *index;
+    
+    index = cuddUniqueConst(dd,(CUDD_VALUE_TYPE) bit);
+    if (index == NULL) return(NULL);
+    cuddRef(index);
+
+    do {
+	dd->reordered = 0;
+	res = addBddDoIthBit(dd, f, index);
+    } while (dd->reordered == 1);
+
+    if (res == NULL) {
+	Cudd_RecursiveDeref(dd, index);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(dd, index);
+    cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addBddIthBit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts a BDD to a 0-1 ADD.]
+
+  Description [Converts a BDD to a 0-1 ADD. Returns a pointer to the
+  resulting ADD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addBddPattern Cudd_addBddThreshold Cudd_addBddInterval
+  Cudd_addBddStrictThreshold]
+
+******************************************************************************/
+DdNode *
+Cudd_BddToAdd(
+  DdManager * dd,
+  DdNode * B)
+{
+    DdNode *res;
+
+    do {
+	dd->reordered = 0;
+	res = ddBddToAddRecur(dd, B);
+    } while (dd->reordered ==1);
+    return(res);
+
+} /* end of Cudd_BddToAdd */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an ADD to a BDD.]
+
+  Description [Converts an ADD to a BDD by replacing all
+  discriminants different from 0 with 1. Returns a pointer to the
+  resulting BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_BddToAdd Cudd_addBddThreshold Cudd_addBddInterval
+  Cudd_addBddStrictThreshold]
+
+******************************************************************************/
+DdNode *
+Cudd_addBddPattern(
+  DdManager * dd,
+  DdNode * f)
+{
+    DdNode *res;
+    
+    do {
+	dd->reordered = 0;
+	res = cuddAddBddDoPattern(dd, f);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_addBddPattern */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Convert a BDD from a manager to another one.]
+
+  Description [Convert a BDD from a manager to another one. The orders of the
+  variables in the two managers may be different. Returns a
+  pointer to the BDD in the destination manager if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+Cudd_bddTransfer(
+  DdManager * ddSource,
+  DdManager * ddDestination,
+  DdNode * f)
+{
+    DdNode *res;
+    do {
+	ddDestination->reordered = 0;
+	res = cuddBddTransfer(ddSource, ddDestination, f);
+    } while (ddDestination->reordered == 1);
+    return(res);
+
+} /* end of Cudd_bddTransfer */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Convert a BDD from a manager to another one.]
+
+  Description [Convert a BDD from a manager to another one. Returns a
+  pointer to the BDD in the destination manager if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddTransfer]
+
+******************************************************************************/
+DdNode *
+cuddBddTransfer(
+  DdManager * ddS,
+  DdManager * ddD,
+  DdNode * f)
+{
+    DdNode *res;
+    st_table *table = NULL;
+    st_generator *gen = NULL;
+    DdNode *key, *value;
+
+    table = st_init_table(st_ptrcmp,st_ptrhash);
+    if (table == NULL) goto failure;
+    res = cuddBddTransferRecur(ddS, ddD, f, table);
+    if (res != NULL) cuddRef(res);
+
+    /* Dereference all elements in the table and dispose of the table.
+    ** This must be done also if res is NULL to avoid leaks in case of
+    ** reordering. */
+    gen = st_init_gen(table);
+    if (gen == NULL) goto failure;
+    while (st_gen(gen, &key, &value)) {
+	Cudd_RecursiveDeref(ddD, value);
+    }
+    st_free_gen(gen); gen = NULL;
+    st_free_table(table); table = NULL;
+
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+failure:
+    if (table != NULL) st_free_table(table);
+    if (gen != NULL) st_free_gen(gen);
+    return(NULL);
+
+} /* end of cuddBddTransfer */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step for Cudd_addBddPattern.]
+
+  Description [Performs the recursive step for Cudd_addBddPattern. Returns a
+  pointer to the resulting BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+cuddAddBddDoPattern(
+  DdManager * dd,
+  DdNode * f)
+{
+    DdNode *res, *T, *E;
+    DdNode *fv, *fvn;
+    int v;
+
+    statLine(dd);
+    /* Check terminal case. */
+    if (cuddIsConstant(f)) {
+	return(Cudd_NotCond(DD_ONE(dd),f == DD_ZERO(dd)));
+    }
+
+    /* Check cache. */
+    res = cuddCacheLookup1(dd,Cudd_addBddPattern,f);
+    if (res != NULL) return(res);
+
+    /* Recursive step. */
+    v = f->index;
+    fv = cuddT(f); fvn = cuddE(f);
+
+    T = cuddAddBddDoPattern(dd,fv);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+
+    E = cuddAddBddDoPattern(dd,fvn);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+    if (Cudd_IsComplement(T)) {
+	res = (T == E) ? Cudd_Not(T) : cuddUniqueInter(dd,v,Cudd_Not(T),Cudd_Not(E));
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+	res = Cudd_Not(res);
+    } else {
+	res = (T == E) ? T : cuddUniqueInter(dd,v,T,E);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+    }
+    cuddDeref(T);
+    cuddDeref(E);
+
+    /* Store result. */
+    cuddCacheInsert1(dd,Cudd_addBddPattern,f,res);
+
+    return(res);
+
+} /* end of cuddAddBddDoPattern */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step for Cudd_addBddThreshold.]
+
+  Description [Performs the recursive step for Cudd_addBddThreshold.
+  Returns a pointer to the BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [addBddDoStrictThreshold]
+
+******************************************************************************/
+static DdNode *
+addBddDoThreshold(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * val)
+{
+    DdNode *res, *T, *E;
+    DdNode *fv, *fvn;
+    int v;
+
+    statLine(dd);
+    /* Check terminal case. */
+    if (cuddIsConstant(f)) {
+	return(Cudd_NotCond(DD_ONE(dd),cuddV(f) < cuddV(val)));
+    }
+
+    /* Check cache. */
+    res = cuddCacheLookup2(dd,addBddDoThreshold,f,val);
+    if (res != NULL) return(res);
+
+    /* Recursive step. */
+    v = f->index;
+    fv = cuddT(f); fvn = cuddE(f);
+
+    T = addBddDoThreshold(dd,fv,val);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+
+    E = addBddDoThreshold(dd,fvn,val);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+    if (Cudd_IsComplement(T)) {
+	res = (T == E) ? Cudd_Not(T) : cuddUniqueInter(dd,v,Cudd_Not(T),Cudd_Not(E));
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+	res = Cudd_Not(res);
+    } else {
+	res = (T == E) ? T : cuddUniqueInter(dd,v,T,E);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+    }
+    cuddDeref(T);
+    cuddDeref(E);
+
+    /* Store result. */
+    cuddCacheInsert2(dd,addBddDoThreshold,f,val,res);
+
+    return(res);
+
+} /* end of addBddDoThreshold */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step for Cudd_addBddStrictThreshold.]
+
+  Description [Performs the recursive step for Cudd_addBddStrictThreshold.
+  Returns a pointer to the BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [addBddDoThreshold]
+
+******************************************************************************/
+static DdNode *
+addBddDoStrictThreshold(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * val)
+{
+    DdNode *res, *T, *E;
+    DdNode *fv, *fvn;
+    int v;
+
+    statLine(dd);
+    /* Check terminal case. */
+    if (cuddIsConstant(f)) {
+	return(Cudd_NotCond(DD_ONE(dd),cuddV(f) <= cuddV(val)));
+    }
+
+    /* Check cache. */
+    res = cuddCacheLookup2(dd,addBddDoStrictThreshold,f,val);
+    if (res != NULL) return(res);
+
+    /* Recursive step. */
+    v = f->index;
+    fv = cuddT(f); fvn = cuddE(f);
+
+    T = addBddDoStrictThreshold(dd,fv,val);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+
+    E = addBddDoStrictThreshold(dd,fvn,val);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+    if (Cudd_IsComplement(T)) {
+	res = (T == E) ? Cudd_Not(T) : cuddUniqueInter(dd,v,Cudd_Not(T),Cudd_Not(E));
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+	res = Cudd_Not(res);
+    } else {
+	res = (T == E) ? T : cuddUniqueInter(dd,v,T,E);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+    }
+    cuddDeref(T);
+    cuddDeref(E);
+
+    /* Store result. */
+    cuddCacheInsert2(dd,addBddDoStrictThreshold,f,val,res);
+
+    return(res);
+
+} /* end of addBddDoStrictThreshold */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step for Cudd_addBddInterval.]
+
+  Description [Performs the recursive step for Cudd_addBddInterval.
+  Returns a pointer to the BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [addBddDoThreshold addBddDoStrictThreshold]
+
+******************************************************************************/
+static DdNode *
+addBddDoInterval(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * l,
+  DdNode * u)
+{
+    DdNode *res, *T, *E;
+    DdNode *fv, *fvn;
+    int v;
+
+    statLine(dd);
+    /* Check terminal case. */
+    if (cuddIsConstant(f)) {
+	return(Cudd_NotCond(DD_ONE(dd),cuddV(f) < cuddV(l) || cuddV(f) > cuddV(u)));
+    }
+
+    /* Check cache. */
+    res = cuddCacheLookup(dd,DD_ADD_BDD_DO_INTERVAL_TAG,f,l,u);
+    if (res != NULL) return(res);
+
+    /* Recursive step. */
+    v = f->index;
+    fv = cuddT(f); fvn = cuddE(f);
+
+    T = addBddDoInterval(dd,fv,l,u);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+
+    E = addBddDoInterval(dd,fvn,l,u);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+    if (Cudd_IsComplement(T)) {
+	res = (T == E) ? Cudd_Not(T) : cuddUniqueInter(dd,v,Cudd_Not(T),Cudd_Not(E));
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+	res = Cudd_Not(res);
+    } else {
+	res = (T == E) ? T : cuddUniqueInter(dd,v,T,E);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+    }
+    cuddDeref(T);
+    cuddDeref(E);
+
+    /* Store result. */
+    cuddCacheInsert(dd,DD_ADD_BDD_DO_INTERVAL_TAG,f,l,u,res);
+
+    return(res);
+
+} /* end of addBddDoInterval */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step for Cudd_addBddIthBit.]
+
+  Description [Performs the recursive step for Cudd_addBddIthBit.
+  Returns a pointer to the BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdNode *
+addBddDoIthBit(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * index)
+{
+    DdNode *res, *T, *E;
+    DdNode *fv, *fvn;
+    int mask, value;
+    int v;
+
+    statLine(dd);
+    /* Check terminal case. */
+    if (cuddIsConstant(f)) {
+	mask = 1 << ((int) cuddV(index));
+	value = (int) cuddV(f);
+	return(Cudd_NotCond(DD_ONE(dd),(value & mask) == 0));
+    }
+
+    /* Check cache. */
+    res = cuddCacheLookup2(dd,addBddDoIthBit,f,index);
+    if (res != NULL) return(res);
+
+    /* Recursive step. */
+    v = f->index;
+    fv = cuddT(f); fvn = cuddE(f);
+
+    T = addBddDoIthBit(dd,fv,index);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+
+    E = addBddDoIthBit(dd,fvn,index);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+    if (Cudd_IsComplement(T)) {
+	res = (T == E) ? Cudd_Not(T) : cuddUniqueInter(dd,v,Cudd_Not(T),Cudd_Not(E));
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+	res = Cudd_Not(res);
+    } else {
+	res = (T == E) ? T : cuddUniqueInter(dd,v,T,E);
+	if (res == NULL) {
+	    Cudd_RecursiveDeref(dd, T);
+	    Cudd_RecursiveDeref(dd, E);
+	    return(NULL);
+	}
+    }
+    cuddDeref(T);
+    cuddDeref(E);
+
+    /* Store result. */
+    cuddCacheInsert2(dd,addBddDoIthBit,f,index,res);
+
+    return(res);
+
+} /* end of addBddDoIthBit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step for Cudd_BddToAdd.]
+
+  Description [Performs the recursive step for Cudd_BddToAdd. Returns a
+  pointer to the resulting ADD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdNode *
+ddBddToAddRecur(
+  DdManager * dd,
+  DdNode * B)
+{
+    DdNode *one;
+    DdNode *res, *res1, *T, *E, *Bt, *Be;
+    int complement = 0;
+
+    statLine(dd);
+    one = DD_ONE(dd);
+
+    if (Cudd_IsConstant(B)) {
+	if (B == one) {
+	    res = one;
+	} else {
+	    res = DD_ZERO(dd);
+	}
+	return(res);
+    }
+    /* Check visited table */
+    res = cuddCacheLookup1(dd,ddBddToAddRecur,B);
+    if (res != NULL) return(res);
+
+    if (Cudd_IsComplement(B)) {
+	complement = 1;
+	Bt = cuddT(Cudd_Regular(B));
+	Be = cuddE(Cudd_Regular(B));
+    } else {
+	Bt = cuddT(B);
+	Be = cuddE(B);
+    }
+
+    T = ddBddToAddRecur(dd, Bt);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+
+    E = ddBddToAddRecur(dd, Be);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* No need to check for T == E, because it is guaranteed not to happen. */
+    res = cuddUniqueInter(dd, (int) Cudd_Regular(B)->index, T, E);
+    if (res == NULL) {
+	Cudd_RecursiveDeref(dd ,T);
+	Cudd_RecursiveDeref(dd ,E);
+	return(NULL);
+    }
+    cuddDeref(T);
+    cuddDeref(E);
+
+    if (complement) {
+	cuddRef(res);
+	res1 = cuddAddCmplRecur(dd, res);
+	if (res1 == NULL) {
+	    Cudd_RecursiveDeref(dd, res);
+	    return(NULL);
+	}
+	cuddRef(res1);
+	Cudd_RecursiveDeref(dd, res);
+	res = res1;
+	cuddDeref(res);
+    }
+
+    /* Store result. */
+    cuddCacheInsert1(dd,ddBddToAddRecur,B,res);
+
+    return(res);
+
+} /* end of ddBddToAddRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_bddTransfer.]
+
+  Description [Performs the recursive step of Cudd_bddTransfer.
+  Returns a pointer to the result if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddBddTransfer]
+
+******************************************************************************/
+static DdNode *
+cuddBddTransferRecur(
+  DdManager * ddS,
+  DdManager * ddD,
+  DdNode * f,
+  st_table * table)
+{
+    DdNode *ft, *fe, *t, *e, *var, *res;
+    DdNode *one, *zero;
+    int	   index;
+    int    comple = 0;
+
+    statLine(ddD);
+    one = DD_ONE(ddD);
+    comple = Cudd_IsComplement(f);
+
+    /* Trivial cases. */
+    if (Cudd_IsConstant(f)) return(Cudd_NotCond(one, comple));
+
+    /* Make canonical to increase the utilization of the cache. */
+    f = Cudd_NotCond(f,comple);
+    /* Now f is a regular pointer to a non-constant node. */
+
+    /* Check the cache. */
+    if(st_lookup(table, f, &res))
+	return(Cudd_NotCond(res,comple));
+    
+    /* Recursive step. */
+    index = f->index;
+    ft = cuddT(f); fe = cuddE(f);
+
+    t = cuddBddTransferRecur(ddS, ddD, ft, table);
+    if (t == NULL) {
+    	return(NULL);
+    }
+    cuddRef(t);
+
+    e = cuddBddTransferRecur(ddS, ddD, fe, table);
+    if (e == NULL) {
+    	Cudd_RecursiveDeref(ddD, t);
+    	return(NULL);
+    }
+    cuddRef(e);
+
+    zero = Cudd_Not(one);
+    var = cuddUniqueInter(ddD,index,one,zero);
+    if (var == NULL) {
+	Cudd_RecursiveDeref(ddD, t);
+	Cudd_RecursiveDeref(ddD, e);
+    	return(NULL);
+    }
+    res = cuddBddIteRecur(ddD,var,t,e);
+    if (res == NULL) {
+	Cudd_RecursiveDeref(ddD, t);
+	Cudd_RecursiveDeref(ddD, e);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(ddD, t);
+    Cudd_RecursiveDeref(ddD, e);
+
+    if (st_add_direct(table, (char *) f, (char *) res) == ST_OUT_OF_MEM) {
+	Cudd_RecursiveDeref(ddD, res);
+	return(NULL);
+    }
+    return(Cudd_NotCond(res,comple));
+
+} /* end of cuddBddTransferRecur */
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddCheck.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddCheck.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddCheck.c	(revision 6)
@@ -0,0 +1,879 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddCheck.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions to check consistency of data structures.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> Cudd_DebugCheck()
+		<li> Cudd_CheckKeys()
+		</ul>
+	       Internal procedures included in this module:
+		<ul>
+		<li> cuddHeapProfile()
+		<li> cuddPrintNode()
+		<li> cuddPrintVarGroups()
+		</ul>
+	       Static procedures included in this module:
+		<ul>
+		<li> debugFindParent()
+		</ul>
+		]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddCheck.c,v 1.33 2004/08/13 18:04:47 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void debugFindParent (DdManager *table, DdNode *node);
+#if 0
+static void debugCheckParent (DdManager *table, DdNode *node);
+#endif
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks for inconsistencies in the DD heap.]
+
+  Description [Checks for inconsistencies in the DD heap:
+  <ul>
+  <li> node has illegal index
+  <li> live node has dead children
+  <li> node has illegal Then or Else pointers
+  <li> BDD/ADD node has identical children
+  <li> ZDD node has zero then child
+  <li> wrong number of total nodes
+  <li> wrong number of dead nodes
+  <li> ref count error at node
+  </ul>
+  Returns 0 if no inconsistencies are found; DD_OUT_OF_MEM if there is
+  not enough memory; 1 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_CheckKeys]
+
+******************************************************************************/
+int
+Cudd_DebugCheck(
+  DdManager * table)
+{
+    unsigned int i;
+    int		j,count;
+    int		slots;
+    DdNodePtr	*nodelist;
+    DdNode	*f;
+    DdNode	*sentinel = &(table->sentinel);
+    st_table	*edgeTable;	/* stores internal ref count for each node */
+    st_generator	*gen;
+    int		flag = 0;
+    int		totalNode;
+    int		deadNode;
+    int		index;
+    
+
+    edgeTable = st_init_table(st_ptrcmp,st_ptrhash);
+    if (edgeTable == NULL) return(CUDD_OUT_OF_MEM);
+
+    /* Check the BDD/ADD subtables. */
+    for (i = 0; i < (unsigned) table->size; i++) {
+	index = table->invperm[i];
+	if (i != (unsigned) table->perm[index]) {
+	    (void) fprintf(table->err,
+			   "Permutation corrupted: invperm[%d] = %d\t perm[%d] = %d\n",
+			   i, index, index, table->perm[index]);
+	}
+	nodelist = table->subtables[i].nodelist;
+	slots = table->subtables[i].slots;
+
+	totalNode = 0;
+	deadNode = 0;
+	for (j = 0; j < slots; j++) {	/* for each subtable slot */
+	    f = nodelist[j];
+	    while (f != sentinel) {
+		totalNode++;
+		if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref != 0) { 
+		    if ((int) f->index != index) {
+			(void) fprintf(table->err,
+				       "Error: node has illegal index\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if ((unsigned) cuddI(table,cuddT(f)->index) <= i ||
+			(unsigned) cuddI(table,Cudd_Regular(cuddE(f))->index)
+			<= i) {
+			(void) fprintf(table->err,
+				       "Error: node has illegal children\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if (Cudd_Regular(cuddT(f)) != cuddT(f)) {
+			(void) fprintf(table->err,
+				       "Error: node has illegal form\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if (cuddT(f) == cuddE(f)) {
+			(void) fprintf(table->err,
+				       "Error: node has identical children\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if (cuddT(f)->ref == 0 || Cudd_Regular(cuddE(f))->ref == 0) {
+			(void) fprintf(table->err,
+				       "Error: live node has dead children\n");
+			cuddPrintNode(f,table->err);
+			flag =1;
+		    }
+		    /* Increment the internal reference count for the
+		    ** then child of the current node.
+		    */
+		    if (st_lookup_int(edgeTable,(char *)cuddT(f),&count)) {
+			count++;
+		    } else {
+			count = 1;
+		    }
+		    if (st_insert(edgeTable,(char *)cuddT(f),
+		    (char *)(long)count) == ST_OUT_OF_MEM) {
+			st_free_table(edgeTable);
+			return(CUDD_OUT_OF_MEM);
+		    }
+		
+		    /* Increment the internal reference count for the
+		    ** else child of the current node.
+		    */
+		    if (st_lookup_int(edgeTable,(char *)Cudd_Regular(cuddE(f)),
+				      &count)) {
+			count++;
+		    } else {
+			count = 1;
+		    }
+		    if (st_insert(edgeTable,(char *)Cudd_Regular(cuddE(f)),
+		    (char *)(long)count) == ST_OUT_OF_MEM) {
+			st_free_table(edgeTable);
+			return(CUDD_OUT_OF_MEM);
+		    }
+		} else if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref == 0) {
+		    deadNode++;
+#if 0
+		    debugCheckParent(table,f);
+#endif
+		} else {
+		    fprintf(table->err,
+			    "Error: node has illegal Then or Else pointers\n");
+		    cuddPrintNode(f,table->err);
+		    flag = 1;
+		}
+
+		f = f->next;
+	    }	/* for each element of the collision list */
+	}	/* for each subtable slot */
+
+	if ((unsigned) totalNode != table->subtables[i].keys) {
+	    fprintf(table->err,"Error: wrong number of total nodes\n");
+	    flag = 1;
+	}
+	if ((unsigned) deadNode != table->subtables[i].dead) {
+	    fprintf(table->err,"Error: wrong number of dead nodes\n");
+	    flag = 1;
+	}
+    }	/* for each BDD/ADD subtable */
+
+    /* Check the ZDD subtables. */
+    for (i = 0; i < (unsigned) table->sizeZ; i++) {
+	index = table->invpermZ[i];
+	if (i != (unsigned) table->permZ[index]) {
+	    (void) fprintf(table->err,
+			   "Permutation corrupted: invpermZ[%d] = %d\t permZ[%d] = %d in ZDD\n",
+			   i, index, index, table->permZ[index]);
+	}
+	nodelist = table->subtableZ[i].nodelist;
+	slots = table->subtableZ[i].slots;
+
+	totalNode = 0;
+	deadNode = 0;
+	for (j = 0; j < slots; j++) {	/* for each subtable slot */
+	    f = nodelist[j];
+	    while (f != NULL) {
+		totalNode++;
+		if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref != 0) { 
+		    if ((int) f->index != index) {
+			(void) fprintf(table->err,
+				       "Error: ZDD node has illegal index\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if (Cudd_IsComplement(cuddT(f)) ||
+			Cudd_IsComplement(cuddE(f))) {
+			(void) fprintf(table->err,
+				       "Error: ZDD node has complemented children\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if ((unsigned) cuddIZ(table,cuddT(f)->index) <= i ||
+		    (unsigned) cuddIZ(table,cuddE(f)->index) <= i) {
+			(void) fprintf(table->err,
+				       "Error: ZDD node has illegal children\n");
+			cuddPrintNode(f,table->err);
+			cuddPrintNode(cuddT(f),table->err);
+			cuddPrintNode(cuddE(f),table->err);
+			flag = 1;
+		    }
+		    if (cuddT(f) == DD_ZERO(table)) {
+			(void) fprintf(table->err,
+				       "Error: ZDD node has zero then child\n");
+			cuddPrintNode(f,table->err);
+			flag = 1;
+		    }
+		    if (cuddT(f)->ref == 0 || cuddE(f)->ref == 0) {
+			(void) fprintf(table->err,
+				       "Error: ZDD live node has dead children\n");
+			cuddPrintNode(f,table->err);
+			flag =1;
+		    }
+		    /* Increment the internal reference count for the
+		    ** then child of the current node.
+		    */
+		    if (st_lookup_int(edgeTable,(char *)cuddT(f),&count)) {
+			count++;
+		    } else {
+			count = 1;
+		    }
+		    if (st_insert(edgeTable,(char *)cuddT(f),
+		    (char *)(long)count) == ST_OUT_OF_MEM) {
+			st_free_table(edgeTable);
+			return(CUDD_OUT_OF_MEM);
+		    }
+		
+		    /* Increment the internal reference count for the
+		    ** else child of the current node.
+		    */
+		    if (st_lookup_int(edgeTable,(char *)cuddE(f),&count)) {
+			count++;
+		    } else {
+			count = 1;
+		    }
+		    if (st_insert(edgeTable,(char *)cuddE(f),
+		    (char *)(long)count) == ST_OUT_OF_MEM) {
+			st_free_table(edgeTable);
+			table->errorCode = CUDD_MEMORY_OUT;
+			return(CUDD_OUT_OF_MEM);
+		    }
+		} else if (cuddT(f) != NULL && cuddE(f) != NULL && f->ref == 0) {
+		    deadNode++;
+#if 0
+		    debugCheckParent(table,f);
+#endif
+		} else {
+		    fprintf(table->err,
+			    "Error: ZDD node has illegal Then or Else pointers\n");
+		    cuddPrintNode(f,table->err);
+		    flag = 1;
+		}
+
+		f = f->next;
+	    }	/* for each element of the collision list */
+	}	/* for each subtable slot */
+
+	if ((unsigned) totalNode != table->subtableZ[i].keys) {
+	    fprintf(table->err,
+		    "Error: wrong number of total nodes in ZDD\n");
+	    flag = 1;
+	}
+	if ((unsigned) deadNode != table->subtableZ[i].dead) {
+	    fprintf(table->err,
+		    "Error: wrong number of dead nodes in ZDD\n");
+	    flag = 1;
+	}
+    }	/* for each ZDD subtable */
+
+    /* Check the constant table. */
+    nodelist = table->constants.nodelist;
+    slots = table->constants.slots;
+
+    totalNode = 0;
+    deadNode = 0;
+    for (j = 0; j < slots; j++) {
+	f = nodelist[j];
+	while (f != NULL) {
+	    totalNode++;
+	    if (f->ref != 0) { 
+		if (f->index != CUDD_CONST_INDEX) {
+		    fprintf(table->err,"Error: node has illegal index\n");
+#if SIZEOF_VOID_P == 8
+		    fprintf(table->err,
+			    "       node 0x%lx, id = %d, ref = %d, value = %g\n",
+			    (unsigned long)f,f->index,f->ref,cuddV(f));
+#else
+		    fprintf(table->err,
+			    "       node 0x%x, id = %d, ref = %d, value = %g\n",
+			    (unsigned)f,f->index,f->ref,cuddV(f));
+#endif
+		    flag = 1;
+		}
+	    } else {
+		deadNode++;
+	    }
+	    f = f->next;
+	}
+    }
+    if ((unsigned) totalNode != table->constants.keys) {
+	(void) fprintf(table->err,
+		       "Error: wrong number of total nodes in constants\n");
+	flag = 1;
+    }
+    if ((unsigned) deadNode != table->constants.dead) {
+	(void) fprintf(table->err,
+		       "Error: wrong number of dead nodes in constants\n");
+	flag = 1;
+    }
+    gen = st_init_gen(edgeTable);
+    while (st_gen(gen, &f, &count)) {
+	if (count > (int)(f->ref) && f->ref != DD_MAXREF) {
+#if SIZEOF_VOID_P == 8
+	    fprintf(table->err,"ref count error at node 0x%lx, count = %d, id = %d, ref = %d, then = 0x%lx, else = 0x%lx\n",(unsigned long)f,count,f->index,f->ref,(unsigned long)cuddT(f),(unsigned long)cuddE(f));
+#else
+	    fprintf(table->err,"ref count error at node 0x%x, count = %d, id = %d, ref = %d, then = 0x%x, else = 0x%x\n",(unsigned)f,count,f->index,f->ref,(unsigned)cuddT(f),(unsigned)cuddE(f));
+#endif
+	    debugFindParent(table,f);
+	    flag = 1;
+	}
+    }
+    st_free_gen(gen);
+    st_free_table(edgeTable);
+
+    return (flag);
+
+} /* end of Cudd_DebugCheck */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks for several conditions that should not occur.]
+
+  Description [Checks for the following conditions:
+  <ul>
+  <li>Wrong sizes of subtables.
+  <li>Wrong number of keys found in unique subtable.
+  <li>Wrong number of dead found in unique subtable.
+  <li>Wrong number of keys found in the constant table
+  <li>Wrong number of dead found in the constant table
+  <li>Wrong number of total slots found
+  <li>Wrong number of maximum keys found
+  <li>Wrong number of total dead found
+  </ul>
+  Reports the average length of non-empty lists. Returns the number of
+  subtables for which the number of keys is wrong.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_DebugCheck]
+
+******************************************************************************/
+int
+Cudd_CheckKeys(
+  DdManager * table)
+{
+    int size;
+    int i,j;
+    DdNodePtr *nodelist;
+    DdNode *node;
+    DdNode *sentinel = &(table->sentinel);
+    DdSubtable *subtable;
+    int keys;
+    int dead;
+    int count = 0;
+    int totalKeys = 0;
+    int totalSlots = 0;
+    int totalDead = 0;
+    int nonEmpty = 0;
+    unsigned int slots;
+    int logSlots;
+    int shift;
+
+    size = table->size;
+
+    for (i = 0; i < size; i++) {
+	subtable = &(table->subtables[i]);
+	nodelist = subtable->nodelist;
+	keys = subtable->keys;
+	dead = subtable->dead;
+	totalKeys += keys;
+	slots = subtable->slots;
+	shift = subtable->shift;
+	logSlots = sizeof(int) * 8 - shift;
+	if (((slots >> logSlots) << logSlots) != slots) {
+	    (void) fprintf(table->err,
+			   "Unique table %d is not the right power of 2\n", i);
+	    (void) fprintf(table->err,
+			   "    slots = %u shift = %d\n", slots, shift);
+	}
+	totalSlots += slots;
+	totalDead += dead;
+	for (j = 0; (unsigned) j < slots; j++) {
+	    node = nodelist[j];
+	    if (node != sentinel) {
+		nonEmpty++;
+	    }
+	    while (node != sentinel) {
+		keys--;
+		if (node->ref == 0) {
+		    dead--;
+		}
+		node = node->next;
+	    }
+	}
+	if (keys != 0) {
+	    (void) fprintf(table->err, "Wrong number of keys found \
+in unique table %d (difference=%d)\n", i, keys);
+	    count++;
+	}
+	if (dead != 0) {
+	    (void) fprintf(table->err, "Wrong number of dead found \
+in unique table no. %d (difference=%d)\n", i, dead);
+	}
+    }	/* for each BDD/ADD subtable */
+
+    /* Check the ZDD subtables. */
+    size = table->sizeZ;
+
+    for (i = 0; i < size; i++) {
+	subtable = &(table->subtableZ[i]);
+	nodelist = subtable->nodelist;
+	keys = subtable->keys;
+	dead = subtable->dead;
+	totalKeys += keys;
+	totalSlots += subtable->slots;
+	totalDead += dead;
+	for (j = 0; (unsigned) j < subtable->slots; j++) {
+	    node = nodelist[j];
+	    if (node != NULL) {
+		nonEmpty++;
+	    }
+	    while (node != NULL) {
+		keys--;
+		if (node->ref == 0) {
+		    dead--;
+		}
+		node = node->next;
+	    }
+	}
+	if (keys != 0) {
+	    (void) fprintf(table->err, "Wrong number of keys found \
+in ZDD unique table no. %d (difference=%d)\n", i, keys);
+	    count++;
+	}
+	if (dead != 0) {
+	    (void) fprintf(table->err, "Wrong number of dead found \
+in ZDD unique table no. %d (difference=%d)\n", i, dead);
+	}
+    }	/* for each ZDD subtable */
+
+    /* Check the constant table. */
+    subtable = &(table->constants);
+    nodelist = subtable->nodelist;
+    keys = subtable->keys;
+    dead = subtable->dead;
+    totalKeys += keys;
+    totalSlots += subtable->slots;
+    totalDead += dead;
+    for (j = 0; (unsigned) j < subtable->slots; j++) {
+	node = nodelist[j];
+	if (node != NULL) {
+	    nonEmpty++;
+	}
+	while (node != NULL) {
+	    keys--;
+	    if (node->ref == 0) {
+		dead--;
+	    }
+	    node = node->next;
+	}
+    }
+    if (keys != 0) {
+	(void) fprintf(table->err, "Wrong number of keys found \
+in the constant table (difference=%d)\n", keys);
+	count++;
+    }
+    if (dead != 0) {
+	(void) fprintf(table->err, "Wrong number of dead found \
+in the constant table (difference=%d)\n", dead);
+    }
+    if ((unsigned) totalKeys != table->keys + table->keysZ) {
+	(void) fprintf(table->err, "Wrong number of total keys found \
+(difference=%d)\n", totalKeys-table->keys);
+    }
+    if ((unsigned) totalSlots != table->slots) {
+	(void) fprintf(table->err, "Wrong number of total slots found \
+(difference=%d)\n", totalSlots-table->slots);
+    }
+    if (table->minDead != (unsigned) (table->gcFrac * table->slots)) {
+	(void) fprintf(table->err, "Wrong number of minimum dead found \
+(%d vs. %d)\n", table->minDead,
+	(unsigned) (table->gcFrac * (double) table->slots));
+    }
+    if ((unsigned) totalDead != table->dead + table->deadZ) {
+	(void) fprintf(table->err, "Wrong number of total dead found \
+(difference=%d)\n", totalDead-table->dead);
+    }
+    (void)printf("Average length of non-empty lists = %g\n",
+    (double) table->keys / (double) nonEmpty);
+
+    return(count);
+
+} /* end of Cudd_CheckKeys */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints information about the heap.]
+
+  Description [Prints to the manager's stdout the number of live nodes for each
+  level of the DD heap that contains at least one live node.  It also
+  prints a summary containing:
+  <ul>
+  <li> total number of tables;
+  <li> number of tables with live nodes;
+  <li> table with the largest number of live nodes;
+  <li> number of nodes in that table.
+  </ul>
+  If more than one table contains the maximum number of live nodes,
+  only the one of lowest index is reported. Returns 1 in case of success
+  and 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddHeapProfile(
+  DdManager * dd)
+{
+    int ntables = dd->size;
+    DdSubtable *subtables = dd->subtables;
+    int i,		/* loop index */
+	nodes,		/* live nodes in i-th layer */
+	retval,		/* return value of fprintf */
+	largest = -1,	/* index of the table with most live nodes */
+	maxnodes = -1,	/* maximum number of live nodes in a table */
+	nonempty = 0;	/* number of tables with live nodes */
+
+    /* Print header. */
+#if SIZEOF_VOID_P == 8
+    retval = fprintf(dd->out,"*** DD heap profile for 0x%lx ***\n",
+		     (unsigned long) dd);
+#else
+    retval = fprintf(dd->out,"*** DD heap profile for 0x%x ***\n",
+		     (unsigned) dd);
+#endif
+    if (retval == EOF) return 0;
+
+    /* Print number of live nodes for each nonempty table. */
+    for (i=0; i<ntables; i++) {
+	nodes = subtables[i].keys - subtables[i].dead;
+	if (nodes) {
+	    nonempty++;
+	    retval = fprintf(dd->out,"%5d: %5d nodes\n", i, nodes);
+	    if (retval == EOF) return 0;
+	    if (nodes > maxnodes) {
+		maxnodes = nodes;
+		largest = i;
+	    }
+	}
+    }
+
+    nodes = dd->constants.keys - dd->constants.dead;
+    if (nodes) {
+	nonempty++;
+	retval = fprintf(dd->out,"const: %5d nodes\n", nodes);
+	if (retval == EOF) return 0;
+	if (nodes > maxnodes) {
+	    maxnodes = nodes;
+	    largest = CUDD_CONST_INDEX;
+	}
+    }
+
+    /* Print summary. */
+    retval = fprintf(dd->out,"Summary: %d tables, %d non-empty, largest: %d ",
+	  ntables+1, nonempty, largest);
+    if (retval == EOF) return 0;
+    retval = fprintf(dd->out,"(with %d nodes)\n", maxnodes);
+    if (retval == EOF) return 0;
+
+    return(1);
+
+} /* end of cuddHeapProfile */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints out information on a node.]
+
+  Description [Prints out information on a node.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddPrintNode(
+  DdNode * f,
+  FILE *fp)
+{
+    f = Cudd_Regular(f);
+#if SIZEOF_VOID_P == 8
+    (void) fprintf(fp,"       node 0x%lx, id = %d, ref = %d, then = 0x%lx, else = 0x%lx\n",(unsigned long)f,f->index,f->ref,(unsigned long)cuddT(f),(unsigned long)cuddE(f));
+#else
+    (void) fprintf(fp,"       node 0x%x, id = %d, ref = %d, then = 0x%x, else = 0x%x\n",(unsigned)f,f->index,f->ref,(unsigned)cuddT(f),(unsigned)cuddE(f));
+#endif
+
+} /* end of cuddPrintNode */
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the variable groups as a parenthesized list.]
+
+  Description [Prints the variable groups as a parenthesized list.
+  For each group the level range that it represents is printed. After
+  each group, the group's flags are printed, preceded by a `|'.  For
+  each flag (except MTR_TERMINAL) a character is printed.
+  <ul>
+  <li>F: MTR_FIXED
+  <li>N: MTR_NEWNODE
+  <li>S: MTR_SOFT
+  </ul>
+  The second argument, silent, if different from 0, causes
+  Cudd_PrintVarGroups to only check the syntax of the group tree.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddPrintVarGroups(
+  DdManager * dd /* manager */,
+  MtrNode * root /* root of the group tree */,
+  int zdd /* 0: BDD; 1: ZDD */,
+  int silent /* flag to check tree syntax only */)
+{
+    MtrNode *node;
+    int level;
+
+    assert(root != NULL);
+    assert(root->younger == NULL || root->younger->elder == root);
+    assert(root->elder == NULL || root->elder->younger == root);
+    if (zdd) {
+	level = dd->permZ[root->index];
+    } else {
+	level = dd->perm[root->index];
+    }
+    if (!silent) (void) printf("(%d",level);
+    if (MTR_TEST(root,MTR_TERMINAL) || root->child == NULL) {
+	if (!silent) (void) printf(",");
+    } else {
+	node = root->child;
+	while (node != NULL) {
+	    assert(node->low >= root->low && (int) (node->low + node->size) <= (int) (root->low + root->size));
+	    assert(node->parent == root);
+	    cuddPrintVarGroups(dd,node,zdd,silent);
+	    node = node->younger;
+	}
+    }
+    if (!silent) {
+	(void) printf("%d", level + root->size - 1);
+	if (root->flags != MTR_DEFAULT) {
+	    (void) printf("|");
+	    if (MTR_TEST(root,MTR_FIXED)) (void) printf("F");
+	    if (MTR_TEST(root,MTR_NEWNODE)) (void) printf("N");
+	    if (MTR_TEST(root,MTR_SOFT)) (void) printf("S");
+	}
+	(void) printf(")");
+	if (root->parent == NULL) (void) printf("\n");
+    }
+    assert((root->flags &~(MTR_TERMINAL | MTR_SOFT | MTR_FIXED | MTR_NEWNODE)) == 0);
+    return;
+
+} /* end of cuddPrintVarGroups */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Searches the subtables above node for its parents.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+debugFindParent(
+  DdManager * table,
+  DdNode * node)
+{
+    int         i,j;
+    int		slots;
+    DdNodePtr	*nodelist;
+    DdNode	*f;
+	
+    for (i = 0; i < cuddI(table,node->index); i++) {
+	nodelist = table->subtables[i].nodelist;
+	slots = table->subtables[i].slots;
+
+	for (j=0;j<slots;j++) {
+	    f = nodelist[j];
+	    while (f != NULL) {
+		if (cuddT(f) == node || Cudd_Regular(cuddE(f)) == node) {
+#if SIZEOF_VOID_P == 8
+		    (void) fprintf(table->out,"parent is at 0x%lx, id = %d, ref = %d, then = 0x%lx, else = 0x%lx\n",
+			(unsigned long)f,f->index,f->ref,(unsigned long)cuddT(f),(unsigned long)cuddE(f));
+#else
+		    (void) fprintf(table->out,"parent is at 0x%x, id = %d, ref = %d, then = 0x%x, else = 0x%x\n",
+			(unsigned)f,f->index,f->ref,(unsigned)cuddT(f),(unsigned)cuddE(f));
+#endif
+		}
+		f = f->next;
+	    }
+	}
+    }
+
+} /* end of debugFindParent */
+
+
+#if 0
+/**Function********************************************************************
+
+  Synopsis    [Reports an error if a (dead) node has a non-dead parent.]
+
+  Description [Searches all the subtables above node. Very expensive.
+  The same check is now implemented more efficiently in ddDebugCheck.]
+
+  SideEffects [None]
+
+  SeeAlso     [debugFindParent]
+
+******************************************************************************/
+static void
+debugCheckParent(
+  DdManager * table,
+  DdNode * node)
+{
+    int         i,j;
+    int		slots;
+    DdNode	**nodelist,*f;
+    
+    for (i = 0; i < cuddI(table,node->index); i++) {
+	nodelist = table->subtables[i].nodelist;
+	slots = table->subtables[i].slots;
+
+	for (j=0;j<slots;j++) {
+	    f = nodelist[j];
+	    while (f != NULL) {
+		if ((Cudd_Regular(cuddE(f)) == node || cuddT(f) == node) && f->ref != 0) {
+		    (void) fprintf(table->err,
+				   "error with zero ref count\n");
+		    (void) fprintf(table->err,"parent is 0x%x, id = %d, ref = %d, then = 0x%x, else = 0x%x\n",f,f->index,f->ref,cuddT(f),cuddE(f));
+		    (void) fprintf(table->err,"child  is 0x%x, id = %d, ref = %d, then = 0x%x, else = 0x%x\n",node,node->index,node->ref,cuddT(node),cuddE(node));
+		}
+		f = f->next;
+	    }
+	}
+    }
+}
+#endif
Index: /vis_dev/glu-2.1/src/cuBdd/cuddCompose.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddCompose.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddCompose.c	(revision 6)
@@ -0,0 +1,1749 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddCompose.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functional composition and variable permutation of DDs.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> Cudd_bddCompose()
+		<li> Cudd_addCompose()
+		<li> Cudd_addPermute()
+		<li> Cudd_addSwapVariables()
+		<li> Cudd_bddPermute()
+		<li> Cudd_bddVarMap()
+		<li> Cudd_SetVarMap()
+		<li> Cudd_bddSwapVariables()
+		<li> Cudd_bddAdjPermuteX()
+		<li> Cudd_addVectorCompose()
+		<li> Cudd_addGeneralVectorCompose()
+		<li> Cudd_addNonSimCompose()
+		<li> Cudd_bddVectorCompose()
+		</ul>
+	       Internal procedures included in this module:
+		<ul>
+		<li> cuddBddComposeRecur()
+		<li> cuddAddComposeRecur()
+		</ul>
+	       Static procedures included in this module:
+		<ul>
+		<li> cuddAddPermuteRecur()
+		<li> cuddBddPermuteRecur()
+		<li> cuddBddVarMapRecur()
+		<li> cuddAddVectorComposeRecur()
+		<li> cuddAddGeneralVectorComposeRecur()
+		<li> cuddAddNonSimComposeRecur()
+		<li> cuddBddVectorComposeRecur()
+		<li> ddIsIthAddVar()
+		<li> ddIsIthAddVarPair()
+	       </ul>
+  The permutation functions use a local cache because the results to
+  be remembered depend on the permutation being applied.  Since the
+  permutation is just an array, it cannot be stored in the global
+  cache. There are different procedured for BDDs and ADDs. This is
+  because bddPermuteRecur uses cuddBddIteRecur. If this were changed,
+  the procedures could be merged.]
+
+  Author      [Fabio Somenzi and Kavita Ravi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddCompose.c,v 1.45 2004/08/13 18:04:47 fabio Exp $";
+#endif
+
+#ifdef DD_DEBUG
+static int addPermuteRecurHits;
+static int bddPermuteRecurHits;
+static int bddVectorComposeHits;
+static int addVectorComposeHits;
+
+static int addGeneralVectorComposeHits;
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static DdNode * cuddAddPermuteRecur (DdManager *manager, DdHashTable *table, DdNode *node, int *permut);
+static DdNode * cuddBddPermuteRecur (DdManager *manager, DdHashTable *table, DdNode *node, int *permut);
+static DdNode * cuddBddVarMapRecur (DdManager *manager, DdNode *f);
+static DdNode * cuddAddVectorComposeRecur (DdManager *dd, DdHashTable *table, DdNode *f, DdNode **vector, int deepest);
+static DdNode * cuddAddNonSimComposeRecur (DdManager *dd, DdNode *f, DdNode **vector, DdNode *key, DdNode *cube, int lastsub);
+static DdNode * cuddBddVectorComposeRecur (DdManager *dd, DdHashTable *table, DdNode *f, DdNode **vector, int deepest);
+DD_INLINE static int ddIsIthAddVar (DdManager *dd, DdNode *f, unsigned int i);
+
+static DdNode * cuddAddGeneralVectorComposeRecur (DdManager *dd, DdHashTable *table, DdNode *f, DdNode **vectorOn, DdNode **vectorOff, int deepest);
+DD_INLINE static int ddIsIthAddVarPair (DdManager *dd, DdNode *f, DdNode *g, unsigned int i);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Substitutes g for x_v in the BDD for f.]
+
+  Description [Substitutes g for x_v in the BDD for f. v is the index of the
+  variable to be substituted. Cudd_bddCompose passes the corresponding
+  projection function to the recursive procedure, so that the cache may
+  be used.  Returns the composed BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addCompose]
+
+******************************************************************************/
+DdNode *
+Cudd_bddCompose(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g,
+  int  v)
+{
+    DdNode *proj, *res;
+
+    /* Sanity check. */
+    if (v < 0 || v >= dd->size) return(NULL);
+
+    proj =  dd->vars[v];
+    do {
+	dd->reordered = 0;
+	res = cuddBddComposeRecur(dd,f,g,proj);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_bddCompose */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Substitutes g for x_v in the ADD for f.]
+
+  Description [Substitutes g for x_v in the ADD for f. v is the index of the
+  variable to be substituted. g must be a 0-1 ADD. Cudd_bddCompose passes
+  the corresponding projection function to the recursive procedure, so
+  that the cache may be used.  Returns the composed ADD if successful;
+  NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddCompose]
+
+******************************************************************************/
+DdNode *
+Cudd_addCompose(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g,
+  int  v)
+{
+    DdNode *proj, *res;
+
+    /* Sanity check. */
+    if (v < 0 || v >= dd->size) return(NULL);
+
+    proj =  dd->vars[v];
+    do {
+	dd->reordered = 0;
+	res = cuddAddComposeRecur(dd,f,g,proj);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_addCompose */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Permutes the variables of an ADD.]
+
+  Description [Given a permutation in array permut, creates a new ADD
+  with permuted variables. There should be an entry in array permut
+  for each variable in the manager. The i-th entry of permut holds the
+  index of the variable that is to substitute the i-th
+  variable. Returns a pointer to the resulting ADD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddPermute Cudd_addSwapVariables]
+
+******************************************************************************/
+DdNode *
+Cudd_addPermute(
+  DdManager * manager,
+  DdNode * node,
+  int * permut)
+{
+    DdHashTable		*table;
+    DdNode		*res;
+
+    do {
+	manager->reordered = 0;
+	table = cuddHashTableInit(manager,1,2);
+	if (table == NULL) return(NULL);
+	/* Recursively solve the problem. */
+	res = cuddAddPermuteRecur(manager,table,node,permut);
+	if (res != NULL) cuddRef(res);
+	/* Dispose of local cache. */
+	cuddHashTableQuit(table);
+    } while (manager->reordered == 1);
+
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addPermute */
+
+
+/**Function********************************************************************
+
+  Synopsis [Swaps two sets of variables of the same size (x and y) in
+  the ADD f.]
+
+  Description [Swaps two sets of variables of the same size (x and y) in
+  the ADD f.  The size is given by n. The two sets of variables are
+  assumed to be disjoint. Returns a pointer to the resulting ADD if
+  successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addPermute Cudd_bddSwapVariables]
+
+******************************************************************************/
+DdNode *
+Cudd_addSwapVariables(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** x,
+  DdNode ** y,
+  int  n)
+{
+    DdNode *swapped;
+    int	 i, j, k;
+    int	 *permut;
+
+    permut = ALLOC(int,dd->size);
+    if (permut == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    for (i = 0; i < dd->size; i++) permut[i] = i;
+    for (i = 0; i < n; i++) {
+	j = x[i]->index;
+	k = y[i]->index;
+	permut[j] = k;
+	permut[k] = j;
+    }
+
+    swapped = Cudd_addPermute(dd,f,permut);
+    FREE(permut);
+
+    return(swapped);
+
+} /* end of Cudd_addSwapVariables */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Permutes the variables of a BDD.]
+
+  Description [Given a permutation in array permut, creates a new BDD
+  with permuted variables. There should be an entry in array permut
+  for each variable in the manager. The i-th entry of permut holds the
+  index of the variable that is to substitute the i-th variable.
+  Returns a pointer to the resulting BDD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addPermute Cudd_bddSwapVariables]
+
+******************************************************************************/
+DdNode *
+Cudd_bddPermute(
+  DdManager * manager,
+  DdNode * node,
+  int * permut)
+{
+    DdHashTable		*table;
+    DdNode		*res;
+
+    do {
+	manager->reordered = 0;
+	table = cuddHashTableInit(manager,1,2);
+	if (table == NULL) return(NULL);
+	res = cuddBddPermuteRecur(manager,table,node,permut);
+	if (res != NULL) cuddRef(res);
+	/* Dispose of local cache. */
+	cuddHashTableQuit(table);
+
+    } while (manager->reordered == 1);
+
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_bddPermute */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Remaps the variables of a BDD using the default variable map.]
+
+  Description [Remaps the variables of a BDD using the default
+  variable map.  A typical use of this function is to swap two sets of
+  variables.  The variable map must be registered with Cudd_SetVarMap.
+  Returns a pointer to the resulting BDD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddPermute Cudd_bddSwapVariables Cudd_SetVarMap]
+
+******************************************************************************/
+DdNode *
+Cudd_bddVarMap(
+  DdManager * manager /* DD manager */,
+  DdNode * f /* function in which to remap variables */)
+{
+    DdNode *res;
+
+    if (manager->map == NULL) return(NULL);
+    do {
+	manager->reordered = 0;
+	res = cuddBddVarMapRecur(manager, f);
+    } while (manager->reordered == 1);
+
+    return(res);
+
+} /* end of Cudd_bddVarMap */
+
+
+/**Function********************************************************************
+
+  Synopsis [Registers a variable mapping with the manager.]
+
+  Description [Registers with the manager a variable mapping described
+  by two sets of variables.  This variable mapping is then used by
+  functions like Cudd_bddVarMap.  This function is convenient for
+  those applications that perform the same mapping several times.
+  However, if several different permutations are used, it may be more
+  efficient not to rely on the registered mapping, because changing
+  mapping causes the cache to be cleared.  (The initial setting,
+  however, does not clear the cache.) The two sets of variables (x and
+  y) must have the same size (x and y).  The size is given by n. The
+  two sets of variables are normally disjoint, but this restriction is
+  not imposeded by the function. When new variables are created, the
+  map is automatically extended (each new variable maps to
+  itself). The typical use, however, is to wait until all variables
+  are created, and then create the map.  Returns 1 if the mapping is
+  successfully registered with the manager; 0 otherwise.]
+
+  SideEffects [Modifies the manager. May clear the cache.]
+
+  SeeAlso     [Cudd_bddVarMap Cudd_bddPermute Cudd_bddSwapVariables]
+
+******************************************************************************/
+int
+Cudd_SetVarMap (
+  DdManager *manager /* DD manager */,
+  DdNode **x /* first array of variables */,
+  DdNode **y /* second array of variables */,
+  int n /* length of both arrays */)
+{
+    int i;
+
+    if (manager->map != NULL) {
+	cuddCacheFlush(manager);
+    } else {
+	manager->map = ALLOC(int,manager->maxSize);
+	if (manager->map == NULL) {
+	    manager->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	manager->memused += sizeof(int) * manager->maxSize;
+    }
+    /* Initialize the map to the identity. */
+    for (i = 0; i < manager->size; i++) {
+	manager->map[i] = i;
+    }
+    /* Create the map. */
+    for (i = 0; i < n; i++) {
+	manager->map[x[i]->index] = y[i]->index;
+	manager->map[y[i]->index] = x[i]->index;
+    }
+    return(1);
+
+} /* end of Cudd_SetVarMap */
+
+
+/**Function********************************************************************
+
+  Synopsis [Swaps two sets of variables of the same size (x and y) in
+  the BDD f.]
+
+  Description [Swaps two sets of variables of the same size (x and y)
+  in the BDD f. The size is given by n. The two sets of variables are
+  assumed to be disjoint.  Returns a pointer to the resulting BDD if
+  successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddPermute Cudd_addSwapVariables]
+
+******************************************************************************/
+DdNode *
+Cudd_bddSwapVariables(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** x,
+  DdNode ** y,
+  int  n)
+{
+    DdNode *swapped;
+    int	 i, j, k;
+    int	 *permut;
+
+    permut = ALLOC(int,dd->size);
+    if (permut == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    for (i = 0; i < dd->size; i++) permut[i] = i;
+    for (i = 0; i < n; i++) {
+	j = x[i]->index;
+	k = y[i]->index;
+	permut[j] = k;
+	permut[k] = j;
+    }
+
+    swapped = Cudd_bddPermute(dd,f,permut);
+    FREE(permut);
+
+    return(swapped);
+
+} /* end of Cudd_bddSwapVariables */
+
+
+/**Function********************************************************************
+
+  Synopsis [Rearranges a set of variables in the BDD B.]
+
+  Description [Rearranges a set of variables in the BDD B. The size of
+  the set is given by n. This procedure is intended for the
+  `randomization' of the priority functions. Returns a pointer to the
+  BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddPermute Cudd_bddSwapVariables
+  Cudd_Dxygtdxz Cudd_Dxygtdyz Cudd_PrioritySelect]
+
+******************************************************************************/
+DdNode *
+Cudd_bddAdjPermuteX(
+  DdManager * dd,
+  DdNode * B,
+  DdNode ** x,
+  int  n)
+{
+    DdNode *swapped;
+    int	 i, j, k;
+    int	 *permut;
+
+    permut = ALLOC(int,dd->size);
+    if (permut == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    for (i = 0; i < dd->size; i++) permut[i] = i;
+    for (i = 0; i < n-2; i += 3) {
+	j = x[i]->index;
+	k = x[i+1]->index;
+	permut[j] = k;
+	permut[k] = j;
+    }
+
+    swapped = Cudd_bddPermute(dd,B,permut);
+    FREE(permut);
+
+    return(swapped);
+
+} /* end of Cudd_bddAdjPermuteX */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Composes an ADD with a vector of 0-1 ADDs.]
+
+  Description [Given a vector of 0-1 ADDs, creates a new ADD by
+  substituting the 0-1 ADDs for the variables of the ADD f.  There
+  should be an entry in vector for each variable in the manager.
+  If no substitution is sought for a given variable, the corresponding
+  projection function should be specified in the vector.
+  This function implements simultaneous composition.
+  Returns a pointer to the resulting ADD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addNonSimCompose Cudd_addPermute Cudd_addCompose
+  Cudd_bddVectorCompose]
+
+******************************************************************************/
+DdNode *
+Cudd_addVectorCompose(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** vector)
+{
+    DdHashTable		*table;
+    DdNode		*res;
+    int			deepest;
+    int                 i;
+
+    do {
+	dd->reordered = 0;
+	/* Initialize local cache. */
+	table = cuddHashTableInit(dd,1,2);
+	if (table == NULL) return(NULL);
+
+	/* Find deepest real substitution. */
+	for (deepest = dd->size - 1; deepest >= 0; deepest--) {
+	    i = dd->invperm[deepest];
+	    if (!ddIsIthAddVar(dd,vector[i],i)) {
+		break;
+	    }
+	}
+
+	/* Recursively solve the problem. */
+	res = cuddAddVectorComposeRecur(dd,table,f,vector,deepest);
+	if (res != NULL) cuddRef(res);
+
+	/* Dispose of local cache. */
+	cuddHashTableQuit(table);
+    } while (dd->reordered == 1);
+
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addVectorCompose */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Composes an ADD with a vector of ADDs.]
+
+  Description [Given a vector of ADDs, creates a new ADD by substituting the
+  ADDs for the variables of the ADD f. vectorOn contains ADDs to be substituted
+  for the x_v and vectorOff the ADDs to be substituted for x_v'. There should
+  be an entry in vector for each variable in the manager.  If no substitution
+  is sought for a given variable, the corresponding projection function should
+  be specified in the vector.  This function implements simultaneous
+  composition.  Returns a pointer to the resulting ADD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso [Cudd_addVectorCompose Cudd_addNonSimCompose Cudd_addPermute
+  Cudd_addCompose Cudd_bddVectorCompose]
+
+******************************************************************************/
+DdNode *
+Cudd_addGeneralVectorCompose(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** vectorOn,
+  DdNode ** vectorOff)
+{
+    DdHashTable		*table;
+    DdNode		*res;
+    int			deepest;
+    int                 i;
+
+    do {
+	dd->reordered = 0;
+	/* Initialize local cache. */
+	table = cuddHashTableInit(dd,1,2);
+	if (table == NULL) return(NULL);
+
+	/* Find deepest real substitution. */
+	for (deepest = dd->size - 1; deepest >= 0; deepest--) {
+	    i = dd->invperm[deepest];
+	    if (!ddIsIthAddVarPair(dd,vectorOn[i],vectorOff[i],i)) {
+		break;
+	    }
+	}
+
+	/* Recursively solve the problem. */
+	res = cuddAddGeneralVectorComposeRecur(dd,table,f,vectorOn,
+					       vectorOff,deepest);
+	if (res != NULL) cuddRef(res);
+
+	/* Dispose of local cache. */
+	cuddHashTableQuit(table);
+    } while (dd->reordered == 1);
+
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addGeneralVectorCompose */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Composes an ADD with a vector of 0-1 ADDs.]
+
+  Description [Given a vector of 0-1 ADDs, creates a new ADD by
+  substituting the 0-1 ADDs for the variables of the ADD f.  There
+  should be an entry in vector for each variable in the manager.
+  This function implements non-simultaneous composition. If any of the
+  functions being composed depends on any of the variables being
+  substituted, then the result depends on the order of composition,
+  which in turn depends on the variable order: The variables farther from
+  the roots in the order are substituted first.
+  Returns a pointer to the resulting ADD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addVectorCompose Cudd_addPermute Cudd_addCompose]
+
+******************************************************************************/
+DdNode *
+Cudd_addNonSimCompose(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** vector)
+{
+    DdNode		*cube, *key, *var, *tmp, *piece;
+    DdNode		*res;
+    int			i, lastsub;
+
+    /* The cache entry for this function is composed of three parts:
+    ** f itself, the replacement relation, and the cube of the
+    ** variables being substituted.
+    ** The replacement relation is the product of the terms (yi EXNOR gi).
+    ** This apporach allows us to use the global cache for this function,
+    ** with great savings in memory with respect to using arrays for the
+    ** cache entries.
+    ** First we build replacement relation and cube of substituted
+    ** variables from the vector specifying the desired composition.
+    */
+    key = DD_ONE(dd);
+    cuddRef(key);
+    cube = DD_ONE(dd);
+    cuddRef(cube);
+    for (i = (int) dd->size - 1; i >= 0; i--) {
+	if (ddIsIthAddVar(dd,vector[i],(unsigned int)i)) {
+	    continue;
+	}
+	var = Cudd_addIthVar(dd,i);
+	if (var == NULL) {
+	    Cudd_RecursiveDeref(dd,key);
+	    Cudd_RecursiveDeref(dd,cube);
+	    return(NULL);
+	}
+	cuddRef(var);
+	/* Update cube. */
+	tmp = Cudd_addApply(dd,Cudd_addTimes,var,cube);
+	if (tmp == NULL) {
+	    Cudd_RecursiveDeref(dd,key);
+	    Cudd_RecursiveDeref(dd,cube);
+	    Cudd_RecursiveDeref(dd,var);
+	    return(NULL);
+	}
+	cuddRef(tmp);
+	Cudd_RecursiveDeref(dd,cube);
+	cube = tmp;
+	/* Update replacement relation. */
+	piece = Cudd_addApply(dd,Cudd_addXnor,var,vector[i]);
+	if (piece == NULL) {
+	    Cudd_RecursiveDeref(dd,key);
+	    Cudd_RecursiveDeref(dd,var);
+	    return(NULL);
+	}
+	cuddRef(piece);
+	Cudd_RecursiveDeref(dd,var);
+	tmp = Cudd_addApply(dd,Cudd_addTimes,key,piece);
+	if (tmp == NULL) {
+	    Cudd_RecursiveDeref(dd,key);
+	    Cudd_RecursiveDeref(dd,piece);
+	    return(NULL);
+	}
+	cuddRef(tmp);
+	Cudd_RecursiveDeref(dd,key);
+	Cudd_RecursiveDeref(dd,piece);
+	key = tmp;
+    }
+
+    /* Now try composition, until no reordering occurs. */
+    do {
+	/* Find real substitution with largest index. */
+	for (lastsub = dd->size - 1; lastsub >= 0; lastsub--) {
+	    if (!ddIsIthAddVar(dd,vector[lastsub],(unsigned int)lastsub)) {
+		break;
+	    }
+	}
+
+	/* Recursively solve the problem. */
+	dd->reordered = 0;
+	res = cuddAddNonSimComposeRecur(dd,f,vector,key,cube,lastsub+1);
+	if (res != NULL) cuddRef(res);
+
+    } while (dd->reordered == 1);
+
+    Cudd_RecursiveDeref(dd,key);
+    Cudd_RecursiveDeref(dd,cube);
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_addNonSimCompose */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Composes a BDD with a vector of BDDs.]
+
+  Description [Given a vector of BDDs, creates a new BDD by
+  substituting the BDDs for the variables of the BDD f.  There
+  should be an entry in vector for each variable in the manager.
+  If no substitution is sought for a given variable, the corresponding
+  projection function should be specified in the vector.
+  This function implements simultaneous composition.
+  Returns a pointer to the resulting BDD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddPermute Cudd_bddCompose Cudd_addVectorCompose]
+
+******************************************************************************/
+DdNode *
+Cudd_bddVectorCompose(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** vector)
+{
+    DdHashTable		*table;
+    DdNode		*res;
+    int			deepest;
+    int                 i;
+
+    do {
+	dd->reordered = 0;
+	/* Initialize local cache. */
+	table = cuddHashTableInit(dd,1,2);
+	if (table == NULL) return(NULL);
+
+	/* Find deepest real substitution. */
+	for (deepest = dd->size - 1; deepest >= 0; deepest--) {
+	    i = dd->invperm[deepest];
+	    if (vector[i] != dd->vars[i]) {
+		break;
+	    }
+	}
+
+	/* Recursively solve the problem. */
+	res = cuddBddVectorComposeRecur(dd,table,f,vector, deepest);
+	if (res != NULL) cuddRef(res);
+
+	/* Dispose of local cache. */
+	cuddHashTableQuit(table);
+    } while (dd->reordered == 1);
+
+    if (res != NULL) cuddDeref(res);
+    return(res);
+
+} /* end of Cudd_bddVectorCompose */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_bddCompose.]
+
+  Description [Performs the recursive step of Cudd_bddCompose.
+  Exploits the fact that the composition of f' with g
+  produces the complement of the composition of f with g to better
+  utilize the cache.  Returns the composed BDD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddCompose]
+
+******************************************************************************/
+DdNode *
+cuddBddComposeRecur(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g,
+  DdNode * proj)
+{
+    DdNode	*F, *G, *f1, *f0, *g1, *g0, *r, *t, *e;
+    unsigned int v, topf, topg, topindex;
+    int		comple;
+
+    statLine(dd);
+    v = dd->perm[proj->index];
+    F = Cudd_Regular(f);
+    topf = cuddI(dd,F->index);
+
+    /* Terminal case. Subsumes the test for constant f. */
+    if (topf > v) return(f);
+
+    /* We solve the problem for a regular pointer, and then complement
+    ** the result if the pointer was originally complemented.
+    */
+    comple = Cudd_IsComplement(f);
+
+    /* Check cache. */
+    r = cuddCacheLookup(dd,DD_BDD_COMPOSE_RECUR_TAG,F,g,proj);
+    if (r != NULL) {
+	return(Cudd_NotCond(r,comple));
+    }
+
+    if (topf == v) {
+	/* Compose. */
+	f1 = cuddT(F);
+	f0 = cuddE(F);
+	r = cuddBddIteRecur(dd, g, f1, f0);
+	if (r == NULL) return(NULL);
+    } else {
+	/* Compute cofactors of f and g. Remember the index of the top
+	** variable.
+	*/
+	G = Cudd_Regular(g);
+	topg = cuddI(dd,G->index);
+	if (topf > topg) {
+	    topindex = G->index;
+	    f1 = f0 = F;
+	} else {
+	    topindex = F->index;
+	    f1 = cuddT(F);
+	    f0 = cuddE(F);
+	}
+	if (topg > topf) {
+	    g1 = g0 = g;
+	} else {
+	    g1 = cuddT(G);
+	    g0 = cuddE(G);
+	    if (g != G) {
+		g1 = Cudd_Not(g1);
+		g0 = Cudd_Not(g0);
+	    }
+	}
+	/* Recursive step. */
+	t = cuddBddComposeRecur(dd, f1, g1, proj);
+	if (t == NULL) return(NULL);
+	cuddRef(t);
+	e = cuddBddComposeRecur(dd, f0, g0, proj);
+	if (e == NULL) {
+	    Cudd_IterDerefBdd(dd, t);
+	    return(NULL);
+	}
+	cuddRef(e);
+
+	r = cuddBddIteRecur(dd, dd->vars[topindex], t, e);
+	if (r == NULL) {
+	    Cudd_IterDerefBdd(dd, t);
+	    Cudd_IterDerefBdd(dd, e);
+	    return(NULL);
+	}
+	cuddRef(r);
+	Cudd_IterDerefBdd(dd, t); /* t & e not necessarily part of r */
+	Cudd_IterDerefBdd(dd, e);
+	cuddDeref(r);
+    }
+
+    cuddCacheInsert(dd,DD_BDD_COMPOSE_RECUR_TAG,F,g,proj,r);
+
+    return(Cudd_NotCond(r,comple));
+
+} /* end of cuddBddComposeRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addCompose.]
+
+  Description [Performs the recursive step of Cudd_addCompose.
+  Returns the composed BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addCompose]
+
+******************************************************************************/
+DdNode *
+cuddAddComposeRecur(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g,
+  DdNode * proj)
+{
+    DdNode *f1, *f0, *g1, *g0, *r, *t, *e;
+    unsigned int v, topf, topg, topindex;
+
+    statLine(dd);
+    v = dd->perm[proj->index];
+    topf = cuddI(dd,f->index);
+
+    /* Terminal case. Subsumes the test for constant f. */
+    if (topf > v) return(f);
+
+    /* Check cache. */
+    r = cuddCacheLookup(dd,DD_ADD_COMPOSE_RECUR_TAG,f,g,proj);
+    if (r != NULL) {
+	return(r);
+    }
+
+    if (topf == v) {
+	/* Compose. */
+	f1 = cuddT(f);
+	f0 = cuddE(f);
+	r = cuddAddIteRecur(dd, g, f1, f0);
+	if (r == NULL) return(NULL);
+    } else {
+	/* Compute cofactors of f and g. Remember the index of the top
+	** variable.
+	*/
+	topg = cuddI(dd,g->index);
+	if (topf > topg) {
+	    topindex = g->index;
+	    f1 = f0 = f;
+	} else {
+	    topindex = f->index;
+	    f1 = cuddT(f);
+	    f0 = cuddE(f);
+	}
+	if (topg > topf) {
+	    g1 = g0 = g;
+	} else {
+	    g1 = cuddT(g);
+	    g0 = cuddE(g);
+	}
+	/* Recursive step. */
+	t = cuddAddComposeRecur(dd, f1, g1, proj);
+	if (t == NULL) return(NULL);
+	cuddRef(t);
+	e = cuddAddComposeRecur(dd, f0, g0, proj);
+	if (e == NULL) {
+	    Cudd_RecursiveDeref(dd, t);
+	    return(NULL);
+	}
+	cuddRef(e);
+
+	if (t == e) {
+	    r = t;
+	} else {
+	    r = cuddUniqueInter(dd, (int) topindex, t, e);
+	    if (r == NULL) {
+		Cudd_RecursiveDeref(dd, t);
+		Cudd_RecursiveDeref(dd, e);
+		return(NULL);
+	    }
+	}
+	cuddDeref(t);
+	cuddDeref(e);
+    }
+
+    cuddCacheInsert(dd,DD_ADD_COMPOSE_RECUR_TAG,f,g,proj,r);
+
+    return(r);
+
+} /* end of cuddAddComposeRecur */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_addPermute.]
+
+  Description [ Recursively puts the ADD in the order given in the
+  array permut. Checks for trivial cases to terminate recursion, then
+  splits on the children of this node.  Once the solutions for the
+  children are obtained, it puts into the current position the node
+  from the rest of the ADD that should be here. Then returns this ADD.
+  The key here is that the node being visited is NOT put in its proper
+  place by this instance, but rather is switched when its proper
+  position is reached in the recursion tree.<p>
+  The DdNode * that is returned is the same ADD as passed in as node,
+  but in the new order.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addPermute cuddBddPermuteRecur]
+
+******************************************************************************/
+static DdNode *
+cuddAddPermuteRecur(
+  DdManager * manager /* DD manager */,
+  DdHashTable * table /* computed table */,
+  DdNode * node /* ADD to be reordered */,
+  int * permut /* permutation array */)
+{
+    DdNode	*T,*E;
+    DdNode	*res,*var;
+    int		index;
+    
+    statLine(manager);
+    /* Check for terminal case of constant node. */
+    if (cuddIsConstant(node)) {
+	return(node);
+    }
+
+    /* If problem already solved, look up answer and return. */
+    if (node->ref != 1 && (res = cuddHashTableLookup1(table,node)) != NULL) {
+#ifdef DD_DEBUG
+	addPermuteRecurHits++;
+#endif
+	return(res);
+    }
+
+    /* Split and recur on children of this node. */
+    T = cuddAddPermuteRecur(manager,table,cuddT(node),permut);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+    E = cuddAddPermuteRecur(manager,table,cuddE(node),permut);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(manager, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* Move variable that should be in this position to this position
+    ** by creating a single var ADD for that variable, and calling
+    ** cuddAddIteRecur with the T and E we just created.
+    */
+    index = permut[node->index];
+    var = cuddUniqueInter(manager,index,DD_ONE(manager),DD_ZERO(manager));
+    if (var == NULL) return(NULL);
+    cuddRef(var);
+    res = cuddAddIteRecur(manager,var,T,E);
+    if (res == NULL) {
+	Cudd_RecursiveDeref(manager,var);
+	Cudd_RecursiveDeref(manager, T);
+	Cudd_RecursiveDeref(manager, E);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(manager,var);
+    Cudd_RecursiveDeref(manager, T);
+    Cudd_RecursiveDeref(manager, E);
+
+    /* Do not keep the result if the reference count is only 1, since
+    ** it will not be visited again.
+    */
+    if (node->ref != 1) {
+	ptrint fanout = (ptrint) node->ref;
+	cuddSatDec(fanout);
+	if (!cuddHashTableInsert1(table,node,res,fanout)) {
+	    Cudd_RecursiveDeref(manager, res);
+	    return(NULL);
+	}
+    }
+    cuddDeref(res);
+    return(res);
+
+} /* end of cuddAddPermuteRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_bddPermute.]
+
+  Description [ Recursively puts the BDD in the order given in the array permut.
+  Checks for trivial cases to terminate recursion, then splits on the
+  children of this node.  Once the solutions for the children are
+  obtained, it puts into the current position the node from the rest of
+  the BDD that should be here. Then returns this BDD.
+  The key here is that the node being visited is NOT put in its proper
+  place by this instance, but rather is switched when its proper position
+  is reached in the recursion tree.<p>
+  The DdNode * that is returned is the same BDD as passed in as node,
+  but in the new order.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddPermute cuddAddPermuteRecur]
+
+******************************************************************************/
+static DdNode *
+cuddBddPermuteRecur(
+  DdManager * manager /* DD manager */,
+  DdHashTable * table /* computed table */,
+  DdNode * node /* BDD to be reordered */,
+  int * permut /* permutation array */)
+{
+    DdNode	*N,*T,*E;
+    DdNode	*res;
+    int		index;
+
+    statLine(manager);
+    N = Cudd_Regular(node);
+
+    /* Check for terminal case of constant node. */
+    if (cuddIsConstant(N)) {
+	return(node);
+    }
+
+    /* If problem already solved, look up answer and return. */
+    if (N->ref != 1 && (res = cuddHashTableLookup1(table,N)) != NULL) {
+#ifdef DD_DEBUG
+	bddPermuteRecurHits++;
+#endif
+	return(Cudd_NotCond(res,N != node));
+    }
+
+    /* Split and recur on children of this node. */
+    T = cuddBddPermuteRecur(manager,table,cuddT(N),permut);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+    E = cuddBddPermuteRecur(manager,table,cuddE(N),permut);
+    if (E == NULL) {
+	Cudd_IterDerefBdd(manager, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* Move variable that should be in this position to this position
+    ** by retrieving the single var BDD for that variable, and calling
+    ** cuddBddIteRecur with the T and E we just created.
+    */
+    index = permut[N->index];
+    res = cuddBddIteRecur(manager,manager->vars[index],T,E);
+    if (res == NULL) {
+	Cudd_IterDerefBdd(manager, T);
+	Cudd_IterDerefBdd(manager, E);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_IterDerefBdd(manager, T);
+    Cudd_IterDerefBdd(manager, E);
+
+    /* Do not keep the result if the reference count is only 1, since
+    ** it will not be visited again.
+    */
+    if (N->ref != 1) {
+	ptrint fanout = (ptrint) N->ref;
+	cuddSatDec(fanout);
+	if (!cuddHashTableInsert1(table,N,res,fanout)) {
+	    Cudd_IterDerefBdd(manager, res);
+	    return(NULL);
+	}
+    }
+    cuddDeref(res);
+    return(Cudd_NotCond(res,N != node));
+
+} /* end of cuddBddPermuteRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_bddVarMap.]
+
+  Description [Implements the recursive step of Cudd_bddVarMap.
+  Returns a pointer to the result if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddVarMap]
+
+******************************************************************************/
+static DdNode *
+cuddBddVarMapRecur(
+  DdManager *manager /* DD manager */,
+  DdNode *f /* BDD to be remapped */)
+{
+    DdNode	*F, *T, *E;
+    DdNode	*res;
+    int		index;
+
+    statLine(manager);
+    F = Cudd_Regular(f);
+
+    /* Check for terminal case of constant node. */
+    if (cuddIsConstant(F)) {
+	return(f);
+    }
+
+    /* If problem already solved, look up answer and return. */
+    if (F->ref != 1 &&
+	(res = cuddCacheLookup1(manager,Cudd_bddVarMap,F)) != NULL) {
+	return(Cudd_NotCond(res,F != f));
+    }
+
+    /* Split and recur on children of this node. */
+    T = cuddBddVarMapRecur(manager,cuddT(F));
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+    E = cuddBddVarMapRecur(manager,cuddE(F));
+    if (E == NULL) {
+	Cudd_IterDerefBdd(manager, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* Move variable that should be in this position to this position
+    ** by retrieving the single var BDD for that variable, and calling
+    ** cuddBddIteRecur with the T and E we just created.
+    */
+    index = manager->map[F->index];
+    res = cuddBddIteRecur(manager,manager->vars[index],T,E);
+    if (res == NULL) {
+	Cudd_IterDerefBdd(manager, T);
+	Cudd_IterDerefBdd(manager, E);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_IterDerefBdd(manager, T);
+    Cudd_IterDerefBdd(manager, E);
+
+    /* Do not keep the result if the reference count is only 1, since
+    ** it will not be visited again.
+    */
+    if (F->ref != 1) {
+	cuddCacheInsert1(manager,Cudd_bddVarMap,F,res);
+    }
+    cuddDeref(res);
+    return(Cudd_NotCond(res,F != f));
+
+} /* end of cuddBddVarMapRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addVectorCompose.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdNode *
+cuddAddVectorComposeRecur(
+  DdManager * dd /* DD manager */,
+  DdHashTable * table /* computed table */,
+  DdNode * f /* ADD in which to compose */,
+  DdNode ** vector /* functions to substitute */,
+  int  deepest /* depth of deepest substitution */)
+{
+    DdNode	*T,*E;
+    DdNode	*res;
+
+    statLine(dd);
+    /* If we are past the deepest substitution, return f. */
+    if (cuddI(dd,f->index) > deepest) {
+	return(f);
+    }
+
+    if ((res = cuddHashTableLookup1(table,f)) != NULL) {
+#ifdef DD_DEBUG
+	addVectorComposeHits++;
+#endif
+	return(res);
+    }
+
+    /* Split and recur on children of this node. */
+    T = cuddAddVectorComposeRecur(dd,table,cuddT(f),vector,deepest);
+    if (T == NULL)  return(NULL);
+    cuddRef(T);
+    E = cuddAddVectorComposeRecur(dd,table,cuddE(f),vector,deepest);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* Retrieve the 0-1 ADD for the current top variable and call
+    ** cuddAddIteRecur with the T and E we just created.
+    */
+    res = cuddAddIteRecur(dd,vector[f->index],T,E);
+    if (res == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	Cudd_RecursiveDeref(dd, E);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(dd, T);
+    Cudd_RecursiveDeref(dd, E);
+
+    /* Do not keep the result if the reference count is only 1, since
+    ** it will not be visited again
+    */
+    if (f->ref != 1) {
+	ptrint fanout = (ptrint) f->ref;
+	cuddSatDec(fanout);
+	if (!cuddHashTableInsert1(table,f,res,fanout)) {
+	    Cudd_RecursiveDeref(dd, res);
+	    return(NULL);
+	}
+    }
+    cuddDeref(res);
+    return(res);
+
+} /* end of cuddAddVectorComposeRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addGeneralVectorCompose.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdNode *
+cuddAddGeneralVectorComposeRecur(
+  DdManager * dd /* DD manager */,
+  DdHashTable * table /* computed table */,
+  DdNode * f /* ADD in which to compose */,
+  DdNode ** vectorOn /* functions to substitute for x_i */,
+  DdNode ** vectorOff /* functions to substitute for x_i' */,
+  int  deepest /* depth of deepest substitution */)
+{
+    DdNode	*T,*E,*t,*e;
+    DdNode	*res;
+
+    /* If we are past the deepest substitution, return f. */
+    if (cuddI(dd,f->index) > deepest) {
+	return(f);
+    }
+
+    if ((res = cuddHashTableLookup1(table,f)) != NULL) {
+#ifdef DD_DEBUG
+	addGeneralVectorComposeHits++;
+#endif
+	return(res);
+    }
+
+    /* Split and recur on children of this node. */
+    T = cuddAddGeneralVectorComposeRecur(dd,table,cuddT(f),
+					 vectorOn,vectorOff,deepest);
+    if (T == NULL)  return(NULL);
+    cuddRef(T);
+    E = cuddAddGeneralVectorComposeRecur(dd,table,cuddE(f),
+					 vectorOn,vectorOff,deepest);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* Retrieve the compose ADDs for the current top variable and call
+    ** cuddAddApplyRecur with the T and E we just created.
+    */
+    t = cuddAddApplyRecur(dd,Cudd_addTimes,vectorOn[f->index],T);
+    if (t == NULL) {
+      Cudd_RecursiveDeref(dd,T);
+      Cudd_RecursiveDeref(dd,E);
+      return(NULL);
+    }
+    cuddRef(t);
+    e = cuddAddApplyRecur(dd,Cudd_addTimes,vectorOff[f->index],E);
+    if (e == NULL) {
+      Cudd_RecursiveDeref(dd,T);
+      Cudd_RecursiveDeref(dd,E);
+      Cudd_RecursiveDeref(dd,t);
+      return(NULL);
+    }
+    cuddRef(e);
+    res = cuddAddApplyRecur(dd,Cudd_addPlus,t,e);
+    if (res == NULL) {
+      Cudd_RecursiveDeref(dd,T);
+      Cudd_RecursiveDeref(dd,E);
+      Cudd_RecursiveDeref(dd,t);
+      Cudd_RecursiveDeref(dd,e);
+      return(NULL);
+    }
+    cuddRef(res);
+    Cudd_RecursiveDeref(dd,T);
+    Cudd_RecursiveDeref(dd,E);
+    Cudd_RecursiveDeref(dd,t);
+    Cudd_RecursiveDeref(dd,e);
+
+    /* Do not keep the result if the reference count is only 1, since
+    ** it will not be visited again
+    */
+    if (f->ref != 1) {
+	ptrint fanout = (ptrint) f->ref;
+	cuddSatDec(fanout);
+	if (!cuddHashTableInsert1(table,f,res,fanout)) {
+	    Cudd_RecursiveDeref(dd, res);
+	    return(NULL);
+	}
+    }
+    cuddDeref(res);
+    return(res);
+
+} /* end of cuddAddGeneralVectorComposeRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_addNonSimCompose.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdNode *
+cuddAddNonSimComposeRecur(
+  DdManager * dd,
+  DdNode * f,
+  DdNode ** vector,
+  DdNode * key,
+  DdNode * cube,
+  int  lastsub)
+{
+    DdNode *f1, *f0, *key1, *key0, *cube1, *var;
+    DdNode *T,*E;
+    DdNode *r;
+    unsigned int top, topf, topk, topc;
+    unsigned int index;
+    int i;
+    DdNode **vect1;
+    DdNode **vect0;
+
+    statLine(dd);
+    /* If we are past the deepest substitution, return f. */
+    if (cube == DD_ONE(dd) || cuddIsConstant(f)) {
+	return(f);
+    }
+
+    /* If problem already solved, look up answer and return. */
+    r = cuddCacheLookup(dd,DD_ADD_NON_SIM_COMPOSE_TAG,f,key,cube);
+    if (r != NULL) {
+	return(r);
+    }
+
+    /* Find top variable. we just need to look at f, key, and cube,
+    ** because all the varibles in the gi are in key.
+    */
+    topf = cuddI(dd,f->index);
+    topk = cuddI(dd,key->index);
+    top = ddMin(topf,topk);
+    topc = cuddI(dd,cube->index);
+    top = ddMin(top,topc);
+    index = dd->invperm[top];
+
+    /* Compute the cofactors. */
+    if (topf == top) {
+	f1 = cuddT(f);
+	f0 = cuddE(f);
+    } else {
+	f1 = f0 = f;
+    }
+    if (topc == top) {
+	cube1 = cuddT(cube);
+	/* We want to eliminate vector[index] from key. Otherwise
+	** cache performance is severely affected. Hence we
+	** existentially quantify the variable with index "index" from key.
+	*/
+	var = Cudd_addIthVar(dd, (int) index);
+	if (var == NULL) {
+	    return(NULL);
+	}
+	cuddRef(var);
+	key1 = cuddAddExistAbstractRecur(dd, key, var);
+	if (key1 == NULL) {
+	    Cudd_RecursiveDeref(dd,var);
+	    return(NULL);
+	}
+	cuddRef(key1);
+	Cudd_RecursiveDeref(dd,var);
+	key0 = key1;
+    } else {
+	cube1 = cube;
+	if (topk == top) {
+	    key1 = cuddT(key);
+	    key0 = cuddE(key);
+	} else {
+	    key1 = key0 = key;
+	}
+	cuddRef(key1);
+    }
+
+    /* Allocate two new vectors for the cofactors of vector. */
+    vect1 = ALLOC(DdNode *,lastsub);
+    if (vect1 == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	Cudd_RecursiveDeref(dd,key1);
+	return(NULL);
+    }
+    vect0 = ALLOC(DdNode *,lastsub);
+    if (vect0 == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	Cudd_RecursiveDeref(dd,key1);
+	FREE(vect1);
+	return(NULL);
+    }
+
+    /* Cofactor the gi. Eliminate vect1[index] and vect0[index], because
+    ** we do not need them.
+    */
+    for (i = 0; i < lastsub; i++) {
+	DdNode *gi = vector[i];
+	if (gi == NULL) {
+	    vect1[i] = vect0[i] = NULL;
+	} else if (gi->index == index) {
+	    vect1[i] = cuddT(gi);
+	    vect0[i] = cuddE(gi);
+	} else {
+	    vect1[i] = vect0[i] = gi;
+	}
+    }
+    vect1[index] = vect0[index] = NULL;
+
+    /* Recur on children. */
+    T = cuddAddNonSimComposeRecur(dd,f1,vect1,key1,cube1,lastsub);
+    FREE(vect1);
+    if (T == NULL) {
+	Cudd_RecursiveDeref(dd,key1);
+	FREE(vect0);
+	return(NULL);
+    }
+    cuddRef(T);
+    E = cuddAddNonSimComposeRecur(dd,f0,vect0,key0,cube1,lastsub);
+    FREE(vect0);
+    if (E == NULL) {
+	Cudd_RecursiveDeref(dd,key1);
+	Cudd_RecursiveDeref(dd,T);
+	return(NULL);
+    }
+    cuddRef(E);
+    Cudd_RecursiveDeref(dd,key1);
+
+    /* Retrieve the 0-1 ADD for the current top variable from vector,
+    ** and call cuddAddIteRecur with the T and E we just created.
+    */
+    r = cuddAddIteRecur(dd,vector[index],T,E);
+    if (r == NULL) {
+	Cudd_RecursiveDeref(dd,T);
+	Cudd_RecursiveDeref(dd,E);
+	return(NULL);
+    }
+    cuddRef(r);
+    Cudd_RecursiveDeref(dd,T);
+    Cudd_RecursiveDeref(dd,E);
+    cuddDeref(r);
+
+    /* Store answer to trim recursion. */
+    cuddCacheInsert(dd,DD_ADD_NON_SIM_COMPOSE_TAG,f,key,cube,r);
+
+    return(r);
+
+} /* end of cuddAddNonSimComposeRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_bddVectorCompose.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdNode *
+cuddBddVectorComposeRecur(
+  DdManager * dd /* DD manager */,
+  DdHashTable * table /* computed table */,
+  DdNode * f /* BDD in which to compose */,
+  DdNode ** vector /* functions to be composed */,
+  int deepest /* depth of the deepest substitution */)
+{
+    DdNode	*F,*T,*E;
+    DdNode	*res;
+
+    statLine(dd);
+    F = Cudd_Regular(f);
+
+    /* If we are past the deepest substitution, return f. */
+    if (cuddI(dd,F->index) > deepest) {
+	return(f);
+    }
+
+    /* If problem already solved, look up answer and return. */
+    if ((res = cuddHashTableLookup1(table,F)) != NULL) {
+#ifdef DD_DEBUG
+	bddVectorComposeHits++;
+#endif
+	return(Cudd_NotCond(res,F != f));
+    }
+
+    /* Split and recur on children of this node. */
+    T = cuddBddVectorComposeRecur(dd,table,cuddT(F),vector, deepest);
+    if (T == NULL) return(NULL);
+    cuddRef(T);
+    E = cuddBddVectorComposeRecur(dd,table,cuddE(F),vector, deepest);
+    if (E == NULL) {
+	Cudd_IterDerefBdd(dd, T);
+	return(NULL);
+    }
+    cuddRef(E);
+
+    /* Call cuddBddIteRecur with the BDD that replaces the current top
+    ** variable and the T and E we just created.
+    */
+    res = cuddBddIteRecur(dd,vector[F->index],T,E);
+    if (res == NULL) {
+	Cudd_IterDerefBdd(dd, T);
+	Cudd_IterDerefBdd(dd, E);
+	return(NULL);
+    }
+    cuddRef(res);
+    Cudd_IterDerefBdd(dd, T);
+    Cudd_IterDerefBdd(dd, E);	
+
+    /* Do not keep the result if the reference count is only 1, since
+    ** it will not be visited again.
+    */
+    if (F->ref != 1) {
+	ptrint fanout = (ptrint) F->ref;
+	cuddSatDec(fanout);
+	if (!cuddHashTableInsert1(table,F,res,fanout)) {
+	    Cudd_IterDerefBdd(dd, res);
+	    return(NULL);
+	}
+    }
+    cuddDeref(res);
+    return(Cudd_NotCond(res,F != f));
+
+} /* end of cuddBddVectorComposeRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Comparison of a function to the i-th ADD variable.]
+
+  Description [Comparison of a function to the i-th ADD variable. Returns 1 if
+  the function is the i-th ADD variable; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DD_INLINE
+static int
+ddIsIthAddVar(
+  DdManager * dd,
+  DdNode * f,
+  unsigned int  i)
+{
+    return(f->index == i && cuddT(f) == DD_ONE(dd) && cuddE(f) == DD_ZERO(dd));
+
+} /* end of ddIsIthAddVar */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Comparison of a pair of functions to the i-th ADD variable.]
+
+  Description [Comparison of a pair of functions to the i-th ADD
+  variable. Returns 1 if the functions are the i-th ADD variable and its
+  complement; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DD_INLINE
+static int
+ddIsIthAddVarPair(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g,
+  unsigned int  i)
+{
+    return(f->index == i && g->index == i && 
+	   cuddT(f) == DD_ONE(dd) && cuddE(f) == DD_ZERO(dd) &&
+	   cuddT(g) == DD_ZERO(dd) && cuddE(g) == DD_ONE(dd));
+
+} /* end of ddIsIthAddVarPair */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddEssent.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddEssent.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddEssent.c	(revision 6)
@@ -0,0 +1,1468 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddEssent.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions for the detection of essential variables.]
+
+  Description [External procedures included in this file:
+		<ul>
+		<li> Cudd_FindEssential()
+		<li> Cudd_bddIsVarEssential()
+		<li> Cudd_FindTwoLiteralClauses()
+		<li> Cudd_ReadIthClause()
+		<li> Cudd_PrintTwoLiteralClauses()
+		<li> Cudd_tlcInfoFree()
+		</ul>
+	Static procedures included in this module:
+		<ul>
+		<li> ddFindEssentialRecur()
+		<li> ddFindTwoLiteralClausesRecur()
+		<li> computeClauses()
+		<li> computeClausesWithUniverse()
+		<li> emptyClauseSet()
+		<li> sentinelp()
+		<li> equalp()
+		<li> beforep()
+		<li> oneliteralp()
+		<li> impliedp()
+		<li> bitVectorAlloc()
+		<li> bitVectorClear()
+		<li> bitVectorFree()
+		<li> bitVectorRead()
+		<li> bitVectorSet()
+		<li> tlcInfoAlloc()
+		</ul>]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/* These definitions are for the bit vectors. */
+#if SIZEOF_LONG == 8
+#define BPL 64
+#define LOGBPL 6
+#else
+#define BPL 32
+#define LOGBPL 5
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/* This structure holds the set of clauses for a node.  Each clause consists
+** of two literals.  For one-literal clauses, the second lietral is FALSE.
+** Each literal is composed of a variable and a phase.  A variable is a node
+** index, and requires sizeof(DdHalfWord) bytes.  The constant literals use
+** CUDD_MAXINDEX as variable indicator.  Each phase is a bit: 0 for positive
+** phase, and 1 for negative phase.
+** Variables and phases are stored separately for the sake of compactness.
+** The variables are stored in an array of DdHalfWord's terminated by a
+** sentinel (a pair of zeroes).  The phases are stored in a bit vector.
+** The cnt field holds, at the end, the number of clauses.
+** The clauses of the set are kept sorted.  For each clause, the first literal
+** is the one of least index.  So, the clause with literals +2 and -4 is stored
+** as (+2,-4).  A one-literal clause with literal +3 is stored as
+** (+3,-CUDD_MAXINDEX).  Clauses are sorted in decreasing order as follows:
+**      (+5,-7)
+**      (+5,+6)
+**      (-5,+7)
+**      (-4,FALSE)
+**      (-4,+8)
+**      ...
+** That is, one first looks at the variable of the first literal, then at the
+** phase of the first litral, then at the variable of the second literal,
+** and finally at the phase of the second literal.
+*/
+struct DdTlcInfo {
+    DdHalfWord *vars;
+    long *phases;
+    DdHalfWord cnt;
+};
+
+/* This structure is for temporary representation of sets of clauses.  It is
+** meant to be used in link lists, when the number of clauses is not yet
+** known. The encoding of a clause is the same as in DdTlcInfo, though
+** the phase information is not stored in a bit array. */
+struct TlClause {
+    DdHalfWord v1, v2;
+    short p1, p2;
+    struct TlClause *next;
+};
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+typedef long BitVector;
+typedef struct TlClause TlClause;
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddEssent.c,v 1.21 2004/08/13 18:04:48 fabio Exp $";
+#endif
+
+static BitVector *Tolv;
+static BitVector *Tolp;
+static BitVector *Eolv;
+static BitVector *Eolp;
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static DdNode * ddFindEssentialRecur (DdManager *dd, DdNode *f);
+static DdTlcInfo * ddFindTwoLiteralClausesRecur (DdManager * dd, DdNode * f, st_table *table);
+static DdTlcInfo * computeClauses (DdTlcInfo *Tres, DdTlcInfo *Eres, DdHalfWord label, int size);
+static DdTlcInfo * computeClausesWithUniverse (DdTlcInfo *Cres, DdHalfWord label, short phase, int size);
+static DdTlcInfo * emptyClauseSet (void);
+static int sentinelp (DdHalfWord var1, DdHalfWord var2);
+static int equalp (DdHalfWord var1a, short phase1a, DdHalfWord var1b, short phase1b, DdHalfWord var2a, short phase2a, DdHalfWord var2b, short phase2b);
+static int beforep (DdHalfWord var1a, short phase1a, DdHalfWord var1b, short phase1b, DdHalfWord var2a, short phase2a, DdHalfWord var2b, short phase2b);
+static int oneliteralp (DdHalfWord var);
+static int impliedp (DdHalfWord var1, short phase1, DdHalfWord var2, short phase2, BitVector *olv, BitVector *olp);
+static BitVector * bitVectorAlloc (int size);
+DD_INLINE static void bitVectorClear (BitVector *vector, int size);
+static void bitVectorFree (BitVector *vector);
+DD_INLINE static short bitVectorRead (BitVector *vector, int i);
+DD_INLINE static void bitVectorSet (BitVector * vector, int i, short val);
+static DdTlcInfo * tlcInfoAlloc (void);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Finds the essential variables of a DD.]
+
+  Description [Returns the cube of the essential variables. A positive
+  literal means that the variable must be set to 1 for the function to be
+  1. A negative literal means that the variable must be set to 0 for the
+  function to be 1. Returns a pointer to the cube BDD if successful;
+  NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_bddIsVarEssential]
+
+******************************************************************************/
+DdNode *
+Cudd_FindEssential(
+  DdManager * dd,
+  DdNode * f)
+{
+    DdNode *res;
+
+    do {
+	dd->reordered = 0;
+	res = ddFindEssentialRecur(dd,f);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_FindEssential */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Determines whether a given variable is essential with a
+  given phase in a BDD.]
+
+  Description [Determines whether a given variable is essential with a
+  given phase in a BDD. Uses Cudd_bddIteConstant. Returns 1 if phase == 1
+  and f-->x_id, or if phase == 0 and f-->x_id'.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_FindEssential]
+
+******************************************************************************/
+int
+Cudd_bddIsVarEssential(
+  DdManager * manager,
+  DdNode * f,
+  int  id,
+  int  phase)
+{
+    DdNode	*var;
+    int		res;
+
+    var = Cudd_bddIthVar(manager, id);
+
+    var = Cudd_NotCond(var,phase == 0);
+
+    res = Cudd_bddLeq(manager, f, var);
+
+    return(res);
+
+} /* end of Cudd_bddIsVarEssential */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Finds the two literal clauses of a DD.]
+
+  Description [Returns the one- and two-literal clauses of a DD.
+  Returns a pointer to the structure holding the clauses if
+  successful; NULL otherwise.  For a constant DD, the empty set of clauses
+  is returned.  This is obviously correct for a non-zero constant.  For the
+  constant zero, it is based on the assumption that only those clauses
+  containing variables in the support of the function are considered.  Since
+  the support of a constant function is empty, no clauses are returned.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_FindEssential]
+
+******************************************************************************/
+DdTlcInfo *
+Cudd_FindTwoLiteralClauses(
+  DdManager * dd,
+  DdNode * f)
+{
+    DdTlcInfo *res;
+    st_table *table;
+    st_generator *gen;
+    DdTlcInfo *tlc;
+    DdNode *node;
+    int size = dd->size;
+
+    if (Cudd_IsConstant(f)) {
+	res = emptyClauseSet();
+	return(res);
+    }
+    table = st_init_table(st_ptrcmp,st_ptrhash);
+    if (table == NULL) return(NULL);
+    Tolv = bitVectorAlloc(size);
+    if (Tolv == NULL) {
+	st_free_table(table);
+	return(NULL);
+    }
+    Tolp = bitVectorAlloc(size);
+    if (Tolp == NULL) {
+	st_free_table(table);
+	bitVectorFree(Tolv);
+        return(NULL);
+    }
+    Eolv = bitVectorAlloc(size);
+    if (Eolv == NULL) {
+	st_free_table(table);
+	bitVectorFree(Tolv);
+	bitVectorFree(Tolp);
+        return(NULL);
+    }
+    Eolp = bitVectorAlloc(size);
+    if (Eolp == NULL) {
+	st_free_table(table);
+	bitVectorFree(Tolv);
+	bitVectorFree(Tolp);
+	bitVectorFree(Eolv);
+        return(NULL);
+    }
+
+    res = ddFindTwoLiteralClausesRecur(dd,f,table);
+    /* Dispose of table contents and free table. */
+    st_foreach_item(table, gen, &node, &tlc) {
+	if (node != f) {
+	    Cudd_tlcInfoFree(tlc);
+	}
+    }
+    st_free_table(table);
+    bitVectorFree(Tolv);
+    bitVectorFree(Tolp);
+    bitVectorFree(Eolv);
+    bitVectorFree(Eolp);
+
+    if (res != NULL) {
+	int i;
+	for (i = 0; !sentinelp(res->vars[i], res->vars[i+1]); i += 2);
+	res->cnt = i >> 1;
+    }
+
+    return(res);
+
+} /* end of Cudd_FindTwoLiteralClauses */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Accesses the i-th clause of a DD.]
+
+  Description [Accesses the i-th clause of a DD given the clause set which
+  must be already computed.  Returns 1 if successful; 0 if i is out of range,
+  or in case of error.]
+
+  SideEffects [the four components of a clause are returned as side effects.]
+
+  SeeAlso     [Cudd_FindTwoLiteralClauses]
+
+******************************************************************************/
+int
+Cudd_ReadIthClause(
+  DdTlcInfo * tlc,
+  int i,
+  DdHalfWord *var1,
+  DdHalfWord *var2,
+  int *phase1,
+  int *phase2)
+{
+    if (tlc == NULL) return(0);
+    if (tlc->vars == NULL || tlc->phases == NULL) return(0);
+    if (i >= tlc->cnt) return(0);
+    *var1 = tlc->vars[2*i];
+    *var2 = tlc->vars[2*i+1];
+    *phase1 = (int) bitVectorRead(tlc->phases, 2*i);
+    *phase2 = (int) bitVectorRead(tlc->phases, 2*i+1);
+    return(1);
+
+} /* end of Cudd_ReadIthClause */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the two literal clauses of a DD.]
+
+  Description [Prints the one- and two-literal clauses. Returns 1 if
+  successful; 0 otherwise.  The argument "names" can be NULL, in which case
+  the variable indices are printed.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_FindTwoLiteralClauses]
+
+******************************************************************************/
+int
+Cudd_PrintTwoLiteralClauses(
+  DdManager * dd,
+  DdNode * f,
+  char **names,
+  FILE *fp)
+{
+    DdHalfWord *vars;
+    BitVector *phases;
+    int i;
+    DdTlcInfo *res = Cudd_FindTwoLiteralClauses(dd, f);
+    FILE *ifp = fp == NULL ? dd->out : fp;
+    
+    if (res == NULL) return(0);
+    vars = res->vars;
+    phases = res->phases;
+    for (i = 0; !sentinelp(vars[i], vars[i+1]); i += 2) {
+	if (names != NULL) {
+	    if (vars[i+1] == CUDD_MAXINDEX) {
+		(void) fprintf(ifp, "%s%s\n",
+			       bitVectorRead(phases, i) ? "~" : " ",
+			       names[vars[i]]);
+	    } else {
+		(void) fprintf(ifp, "%s%s | %s%s\n",
+			       bitVectorRead(phases, i) ? "~" : " ",
+			       names[vars[i]],
+			       bitVectorRead(phases, i+1) ? "~" : " ",
+			       names[vars[i+1]]);
+	    }
+	} else {
+	    if (vars[i+1] == CUDD_MAXINDEX) {
+		(void) fprintf(ifp, "%s%d\n",
+			       bitVectorRead(phases, i) ? "~" : " ",
+			       (int) vars[i]);
+	    } else {
+		(void) fprintf(ifp, "%s%d | %s%d\n",
+			       bitVectorRead(phases, i) ? "~" : " ",
+			       (int) vars[i],
+			       bitVectorRead(phases, i+1) ? "~" : " ",
+			       (int) vars[i+1]);
+	    }
+	}
+    }
+    Cudd_tlcInfoFree(res);
+
+    return(1);
+    
+} /* end of Cudd_PrintTwoLiteralClauses */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees a DdTlcInfo Structure.]
+
+  Description [Frees a DdTlcInfo Structure as well as the memory pointed
+  by it.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cudd_tlcInfoFree(
+  DdTlcInfo * t)
+{
+    if (t->vars != NULL) FREE(t->vars);
+    if (t->phases != NULL) FREE(t->phases);
+    FREE(t);
+
+} /* end of Cudd_tlcInfoFree */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_FindEssential.]
+
+  Description [Implements the recursive step of Cudd_FindEssential.
+  Returns a pointer to the cube BDD if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static DdNode *
+ddFindEssentialRecur(
+  DdManager * dd,
+  DdNode * f)
+{
+    DdNode	*T, *E, *F;
+    DdNode	*essT, *essE, *res;
+    int		index;
+    DdNode	*one, *lzero, *azero;
+
+    one = DD_ONE(dd);
+    F = Cudd_Regular(f);
+    /* If f is constant the set of essential variables is empty. */
+    if (cuddIsConstant(F)) return(one);
+
+    res = cuddCacheLookup1(dd,Cudd_FindEssential,f);
+    if (res != NULL) {
+	return(res);
+    }
+
+    lzero = Cudd_Not(one);
+    azero = DD_ZERO(dd);
+    /* Find cofactors: here f is non-constant. */
+    T = cuddT(F);
+    E = cuddE(F);
+    if (Cudd_IsComplement(f)) {
+	T = Cudd_Not(T); E = Cudd_Not(E);
+    }
+
+    index = F->index;
+    if (Cudd_IsConstant(T) && T != lzero && T != azero) {
+	/* if E is zero, index is essential, otherwise there are no
+	** essentials, because index is not essential and no other variable
+	** can be, since setting index = 1 makes the function constant and
+	** different from 0.
+	*/
+	if (E == lzero || E == azero) {
+	    res = dd->vars[index];
+	} else {
+	    res = one;
+	}
+    } else if (T == lzero || T == azero) {
+	if (Cudd_IsConstant(E)) { /* E cannot be zero here */
+	    res = Cudd_Not(dd->vars[index]);
+	} else { /* E == non-constant */
+	    /* find essentials in the else branch */
+	    essE = ddFindEssentialRecur(dd,E);
+	    if (essE == NULL) {
+		return(NULL);
+	    }
+	    cuddRef(essE);
+
+	    /* add index to the set with negative phase */
+	    res = cuddUniqueInter(dd,index,one,Cudd_Not(essE));
+	    if (res == NULL) {
+		Cudd_RecursiveDeref(dd,essE);
+		return(NULL);
+	    }
+	    res = Cudd_Not(res);
+	    cuddDeref(essE);
+	}
+    } else { /* T == non-const */
+	if (E == lzero || E == azero) {
+	    /* find essentials in the then branch */
+	    essT = ddFindEssentialRecur(dd,T);
+	    if (essT == NULL) {
+		return(NULL);
+	    }
+	    cuddRef(essT);
+
+	    /* add index to the set with positive phase */
+	    /* use And because essT may be complemented */
+	    res = cuddBddAndRecur(dd,dd->vars[index],essT);
+	    if (res == NULL) {
+		Cudd_RecursiveDeref(dd,essT);
+		return(NULL);
+	    }
+	    cuddDeref(essT);
+	} else if (!Cudd_IsConstant(E)) {
+	    /* if E is a non-zero constant there are no essentials
+	    ** because T is non-constant.
+	    */
+	    essT = ddFindEssentialRecur(dd,T);
+	    if (essT == NULL) {
+		return(NULL);
+	    }
+	    if (essT == one) {
+		res = one;
+	    } else {
+		cuddRef(essT);
+		essE = ddFindEssentialRecur(dd,E);
+		if (essE == NULL) {
+		    Cudd_RecursiveDeref(dd,essT);
+		    return(NULL);
+		}
+		cuddRef(essE);
+
+		/* res = intersection(essT, essE) */
+		res = cuddBddLiteralSetIntersectionRecur(dd,essT,essE);
+		if (res == NULL) {
+		    Cudd_RecursiveDeref(dd,essT);
+		    Cudd_RecursiveDeref(dd,essE);
+		    return(NULL);
+		}
+		cuddRef(res);
+		Cudd_RecursiveDeref(dd,essT);
+		Cudd_RecursiveDeref(dd,essE);
+		cuddDeref(res);
+	    }
+	} else {	/* E is a non-zero constant */
+	    res = one;
+	}
+    }
+
+    cuddCacheInsert1(dd,Cudd_FindEssential, f, res);
+    return(res);
+
+} /* end of ddFindEssentialRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_FindTwoLiteralClauses.]
+
+  Description [Implements the recursive step of
+  Cudd_FindTwoLiteralClauses.  The DD node is assumed to be not
+  constant.  Returns a pointer to a set of clauses if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_FindTwoLiteralClauses]
+
+******************************************************************************/
+static DdTlcInfo *
+ddFindTwoLiteralClausesRecur(
+  DdManager * dd,
+  DdNode * f,
+  st_table *table)
+{
+    DdNode *T, *E, *F;
+    DdNode *one, *lzero, *azero;
+    DdTlcInfo *res, *Tres, *Eres;
+    DdHalfWord index;
+
+    F = Cudd_Regular(f);
+
+    assert(!cuddIsConstant(F));
+
+    /* Check computed table.  Separate entries are necessary for
+    ** a node and its complement.  We should update the counter here. */
+    if (st_lookup(table, f, &res)) {
+	return(res);
+    }
+
+    /* Easy access to the constants for BDDs and ADDs. */
+    one = DD_ONE(dd);
+    lzero = Cudd_Not(one);
+    azero = DD_ZERO(dd);
+
+    /* Find cofactors and variable labeling the top node. */
+    T = cuddT(F); E = cuddE(F);
+    if (Cudd_IsComplement(f)) {
+	T = Cudd_Not(T); E = Cudd_Not(E);
+    }
+    index = F->index;
+
+    if (Cudd_IsConstant(T) && T != lzero && T != azero) {
+	/* T is a non-zero constant.  If E is zero, then this node's index
+        ** is a one-literal clause.  Otherwise, if E is a non-zero
+	** constant, there are no clauses for this node.  Finally,
+	** if E is not constant, we recursively compute its clauses, and then
+	** merge using the empty set for T. */
+	if (E == lzero || E == azero) {
+	    /* Create the clause (index + 0). */
+	    res = tlcInfoAlloc();
+	    if (res == NULL) return(NULL);
+	    res->vars = ALLOC(DdHalfWord,4);
+	    if (res->vars == NULL) {
+		FREE(res);
+		return(NULL);
+	    }
+	    res->phases = bitVectorAlloc(2);
+	    if (res->phases == NULL) {
+		FREE(res->vars);
+		FREE(res);
+		return(NULL);
+	    }
+	    res->vars[0] = index;
+	    res->vars[1] = CUDD_MAXINDEX;
+	    res->vars[2] = 0;
+	    res->vars[3] = 0;
+	    bitVectorSet(res->phases, 0, 0); /* positive phase */
+	    bitVectorSet(res->phases, 1, 1); /* negative phase */
+	} else if (Cudd_IsConstant(E)) {
+	    /* If E is a non-zero constant, no clauses. */
+	    res = emptyClauseSet();
+	} else {
+	    /* E is non-constant */
+	    Tres = emptyClauseSet();
+	    if (Tres == NULL) return(NULL);
+	    Eres = ddFindTwoLiteralClausesRecur(dd, E, table);
+	    if (Eres == NULL) {
+	        Cudd_tlcInfoFree(Tres);
+	        return(NULL);
+	    }
+	    res = computeClauses(Tres, Eres, index, dd->size);
+	    Cudd_tlcInfoFree(Tres);
+	}
+    } else if (T == lzero || T == azero) {
+	/* T is zero.  If E is a non-zero constant, then the
+        ** complement of this node's index is a one-literal clause.
+        ** Otherwise, if E is not constant, we recursively compute its
+        ** clauses, and then merge using the universal set for T. */
+	if (Cudd_IsConstant(E)) { /* E cannot be zero here */
+	    /* Create the clause (!index + 0). */
+	    res = tlcInfoAlloc();
+	    if (res == NULL) return(NULL);
+	    res->vars = ALLOC(DdHalfWord,4);
+	    if (res->vars == NULL) {
+		FREE(res);
+		return(NULL);
+	    }
+	    res->phases = bitVectorAlloc(2);
+	    if (res->phases == NULL) {
+		FREE(res->vars);
+		FREE(res);
+		return(NULL);
+	    }
+	    res->vars[0] = index;
+	    res->vars[1] = CUDD_MAXINDEX;
+	    res->vars[2] = 0;
+	    res->vars[3] = 0;
+	    bitVectorSet(res->phases, 0, 1); /* negative phase */
+	    bitVectorSet(res->phases, 1, 1); /* negative phase */
+	} else { /* E == non-constant */
+	    Eres = ddFindTwoLiteralClausesRecur(dd, E, table);
+	    if (Eres == NULL) return(NULL);
+	    res = computeClausesWithUniverse(Eres, index, 1, dd->size);
+	}
+    } else { /* T == non-const */
+	Tres = ddFindTwoLiteralClausesRecur(dd, T, table);
+	if (Tres == NULL) return(NULL);
+	if (Cudd_IsConstant(E)) {
+	    if (E == lzero || E == azero) {
+		res = computeClausesWithUniverse(Tres, index, 0, dd->size);
+	    } else {
+		Eres = emptyClauseSet();
+		if (Eres == NULL) return(NULL);
+		res = computeClauses(Tres, Eres, index, dd->size);
+		Cudd_tlcInfoFree(Eres);
+	    }
+	} else {
+	    Eres = ddFindTwoLiteralClausesRecur(dd, E, table);
+	    if (Eres == NULL) return(NULL);
+	    res = computeClauses(Tres, Eres, index, dd->size);
+	}
+    }
+
+    /* Cache results. */
+    if (st_add_direct(table, (char *)f, (char *)res) == ST_OUT_OF_MEM) {
+	FREE(res);
+	return(NULL);
+    }
+    return(res);
+
+} /* end of ddFindTwoLiteralClausesRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the two-literal clauses for a node.]
+
+  Description [Computes the two-literal clauses for a node given the
+  clauses for its children and the label of the node.  Returns a
+  pointer to a TclInfo structure if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [computeClausesWithUniverse]
+
+******************************************************************************/
+static DdTlcInfo *
+computeClauses(
+  DdTlcInfo *Tres /* list of clauses for T child */,
+  DdTlcInfo *Eres /* list of clauses for E child */,
+  DdHalfWord label /* variable labeling the current node */,
+  int size /* number of variables in the manager */)
+{
+    DdHalfWord *Tcv = Tres->vars; /* variables of clauses for the T child */
+    BitVector *Tcp = Tres->phases; /* phases of clauses for the T child */
+    DdHalfWord *Ecv = Eres->vars; /* variables of clauses for the E child */
+    BitVector *Ecp = Eres->phases; /* phases of clauses for the E child */
+    DdHalfWord *Vcv = NULL; /* pointer to variables of the clauses for v */
+    BitVector *Vcp = NULL; /* pointer to phases of the clauses for v */
+    DdTlcInfo *res = NULL; /* the set of clauses to be returned */
+    int pt = 0; /* index in the list of clauses of T */
+    int pe = 0; /* index in the list of clauses of E */
+    int cv = 0; /* counter of the clauses for this node */
+    TlClause *iclauses = NULL; /* list of inherited clauses */
+    TlClause *tclauses = NULL; /* list of 1-literal clauses of T */
+    TlClause *eclauses = NULL; /* list of 1-literal clauses of E */
+    TlClause *nclauses = NULL; /* list of new (non-inherited) clauses */
+    TlClause *lnclause = NULL; /* pointer to last new clause */
+    TlClause *newclause; /* temporary pointer to new clauses */
+
+    /* Initialize sets of one-literal clauses.  The one-literal clauses
+    ** are stored redundantly.  These sets allow constant-time lookup, which
+    ** we need when we check for implication of a two-literal clause by a
+    ** one-literal clause.  The linked lists allow fast sequential
+    ** processing. */
+    bitVectorClear(Tolv, size);
+    bitVectorClear(Tolp, size);
+    bitVectorClear(Eolv, size);
+    bitVectorClear(Eolp, size);
+
+    /* Initialize result structure. */
+    res = tlcInfoAlloc();
+    if (res == NULL) goto cleanup;
+
+    /* Scan the two input list.  Extract inherited two-literal clauses
+    ** and set aside one-literal clauses from each list.  The incoming lists
+    ** are sorted in the order defined by beforep.  The three linked list
+    ** produced by this loop are sorted in the reverse order because we
+    ** always append to the front of the lists.
+    ** The inherited clauses are those clauses (both one- and two-literal)
+    ** that are common to both children; and the two-literal clauses of
+    ** one child that are implied by a one-literal clause of the other
+    ** child. */
+    while (!sentinelp(Tcv[pt], Tcv[pt+1]) || !sentinelp(Ecv[pe], Ecv[pe+1])) {
+	if (equalp(Tcv[pt], bitVectorRead(Tcp, pt),
+		   Tcv[pt+1], bitVectorRead(Tcp, pt+1),
+		   Ecv[pe], bitVectorRead(Ecp, pe),
+		   Ecv[pe+1], bitVectorRead(Ecp, pe+1))) {
+	    /* Add clause to inherited list. */
+	    newclause = ALLOC(TlClause,1);
+	    if (newclause == NULL) goto cleanup;
+	    newclause->v1 = Tcv[pt];
+	    newclause->v2 = Tcv[pt+1];
+	    newclause->p1 = bitVectorRead(Tcp, pt);
+	    newclause->p2 = bitVectorRead(Tcp, pt+1);
+	    newclause->next = iclauses;
+	    iclauses = newclause;
+	    pt += 2; pe += 2; cv++;
+	} else if (beforep(Tcv[pt], bitVectorRead(Tcp, pt),
+		   Tcv[pt+1], bitVectorRead(Tcp, pt+1),
+		   Ecv[pe], bitVectorRead(Ecp, pe),
+		   Ecv[pe+1], bitVectorRead(Ecp, pe+1))) {
+	    if (oneliteralp(Tcv[pt+1])) {
+		/* Add this one-literal clause to the T set. */
+		newclause = ALLOC(TlClause,1);
+		if (newclause == NULL) goto cleanup;
+		newclause->v1 = Tcv[pt];
+		newclause->v2 = CUDD_MAXINDEX;
+		newclause->p1 = bitVectorRead(Tcp, pt);
+		newclause->p2 = 1;
+		newclause->next = tclauses;
+		tclauses = newclause;
+		bitVectorSet(Tolv, Tcv[pt], 1);
+		bitVectorSet(Tolp, Tcv[pt], bitVectorRead(Tcp, pt));
+	    } else {
+		if (impliedp(Tcv[pt], bitVectorRead(Tcp, pt),
+			     Tcv[pt+1], bitVectorRead(Tcp, pt+1),
+			     Eolv, Eolp)) {
+		    /* Add clause to inherited list. */
+		    newclause = ALLOC(TlClause,1);
+		    if (newclause == NULL) goto cleanup;
+		    newclause->v1 = Tcv[pt];
+		    newclause->v2 = Tcv[pt+1];
+		    newclause->p1 = bitVectorRead(Tcp, pt);
+		    newclause->p2 = bitVectorRead(Tcp, pt+1);
+		    newclause->next = iclauses;
+		    iclauses = newclause;
+		    cv++;
+		}
+	    }
+	    pt += 2;
+	} else { /* !beforep() */
+	    if (oneliteralp(Ecv[pe+1])) {
+		/* Add this one-literal clause to the E set. */
+		newclause = ALLOC(TlClause,1);
+		if (newclause == NULL) goto cleanup;
+		newclause->v1 = Ecv[pe];
+		newclause->v2 = CUDD_MAXINDEX;
+		newclause->p1 = bitVectorRead(Ecp, pe);
+		newclause->p2 = 1;
+		newclause->next = eclauses;
+		eclauses = newclause;
+		bitVectorSet(Eolv, Ecv[pe], 1);
+		bitVectorSet(Eolp, Ecv[pe], bitVectorRead(Ecp, pe));
+	    } else {
+		if (impliedp(Ecv[pe], bitVectorRead(Ecp, pe),
+			     Ecv[pe+1], bitVectorRead(Ecp, pe+1),
+			     Tolv, Tolp)) {
+		    /* Add clause to inherited list. */
+		    newclause = ALLOC(TlClause,1);
+		    if (newclause == NULL) goto cleanup;
+		    newclause->v1 = Ecv[pe];
+		    newclause->v2 = Ecv[pe+1];
+		    newclause->p1 = bitVectorRead(Ecp, pe);
+		    newclause->p2 = bitVectorRead(Ecp, pe+1);
+		    newclause->next = iclauses;
+		    iclauses = newclause;
+		    cv++;
+		}
+	    }
+	    pe += 2;
+	}
+    }
+
+    /* Add one-literal clauses for the label variable to the front of
+    ** the two lists. */
+    newclause = ALLOC(TlClause,1);
+    if (newclause == NULL) goto cleanup;
+    newclause->v1 = label;
+    newclause->v2 = CUDD_MAXINDEX;
+    newclause->p1 = 0;
+    newclause->p2 = 1;
+    newclause->next = tclauses;
+    tclauses = newclause;
+    newclause = ALLOC(TlClause,1);
+    if (newclause == NULL) goto cleanup;
+    newclause->v1 = label;
+    newclause->v2 = CUDD_MAXINDEX;
+    newclause->p1 = 1;
+    newclause->p2 = 1;
+    newclause->next = eclauses;
+    eclauses = newclause;
+
+    /* Produce the non-inherited clauses.  We preserve the "reverse"
+    ** order of the two input lists by appending to the end of the
+    ** list.  In this way, iclauses and nclauses are consistent. */
+    while (tclauses != NULL && eclauses != NULL) {
+	if (beforep(eclauses->v1, eclauses->p1, eclauses->v2, eclauses->p2,
+		    tclauses->v1, tclauses->p1, tclauses->v2, tclauses->p2)) {
+	    TlClause *nextclause = tclauses->next;
+	    TlClause *otherclauses = eclauses;
+	    while (otherclauses != NULL) {
+		if (tclauses->v1 != otherclauses->v1) {
+		    newclause = ALLOC(TlClause,1);
+		    if (newclause == NULL) goto cleanup;
+		    newclause->v1 = tclauses->v1;
+		    newclause->v2 = otherclauses->v1;
+		    newclause->p1 = tclauses->p1;
+		    newclause->p2 = otherclauses->p1;
+		    newclause->next = NULL;
+		    if (nclauses == NULL) {
+			nclauses = newclause;
+			lnclause = newclause;
+		    } else {
+			lnclause->next = newclause;
+			lnclause = newclause;
+		    }
+		    cv++;
+		}
+		otherclauses = otherclauses->next;
+	    }
+	    FREE(tclauses);
+	    tclauses = nextclause;
+	} else {
+	    TlClause *nextclause = eclauses->next;
+	    TlClause *otherclauses = tclauses;
+	    while (otherclauses != NULL) {
+		if (eclauses->v1 != otherclauses->v1) {
+		    newclause = ALLOC(TlClause,1);
+		    if (newclause == NULL) goto cleanup;
+		    newclause->v1 = eclauses->v1;
+		    newclause->v2 = otherclauses->v1;
+		    newclause->p1 = eclauses->p1;
+		    newclause->p2 = otherclauses->p1;
+		    newclause->next = NULL;
+		    if (nclauses == NULL) {
+			nclauses = newclause;
+			lnclause = newclause;
+		    } else {
+			lnclause->next = newclause;
+			lnclause = newclause;
+		    }
+		    cv++;
+		}
+		otherclauses = otherclauses->next;
+	    }
+	    FREE(eclauses);
+	    eclauses = nextclause;
+	}
+    }
+    while (tclauses != NULL) {
+	TlClause *nextclause = tclauses->next;
+	FREE(tclauses);
+	tclauses = nextclause;
+    }
+    while (eclauses != NULL) {
+	TlClause *nextclause = eclauses->next;
+	FREE(eclauses);
+	eclauses = nextclause;
+    }
+
+    /* Merge inherited and non-inherited clauses.  Now that we know the
+    ** total number, we allocate the arrays, and we fill them bottom-up
+    ** to restore the proper ordering. */
+    Vcv = ALLOC(DdHalfWord, 2*(cv+1));
+    if (Vcv == NULL) goto cleanup;
+    if (cv > 0) {
+	Vcp = bitVectorAlloc(2*cv);
+	if (Vcp == NULL) goto cleanup;
+    } else {
+	Vcp = NULL;
+    }
+    res->vars = Vcv;
+    res->phases = Vcp;
+    /* Add sentinel. */
+    Vcv[2*cv] = 0;
+    Vcv[2*cv+1] = 0;
+    while (iclauses != NULL || nclauses != NULL) {
+	TlClause *nextclause;
+	cv--;
+	if (nclauses == NULL || (iclauses != NULL &&
+	    beforep(nclauses->v1, nclauses->p1, nclauses->v2, nclauses->p2,
+		    iclauses->v1, iclauses->p1, iclauses->v2, iclauses->p2))) {
+	    Vcv[2*cv] = iclauses->v1;
+	    Vcv[2*cv+1] = iclauses->v2;
+	    bitVectorSet(Vcp, 2*cv, iclauses->p1);
+	    bitVectorSet(Vcp, 2*cv+1, iclauses->p2);
+	    nextclause = iclauses->next;
+	    FREE(iclauses);
+	    iclauses = nextclause;
+	} else {
+	    Vcv[2*cv] = nclauses->v1;
+	    Vcv[2*cv+1] = nclauses->v2;
+	    bitVectorSet(Vcp, 2*cv, nclauses->p1);
+	    bitVectorSet(Vcp, 2*cv+1, nclauses->p2);
+	    nextclause = nclauses->next;
+	    FREE(nclauses);
+	    nclauses = nextclause;
+	}
+    }
+    assert(cv == 0);
+
+    return(res);
+
+ cleanup:
+    if (res != NULL) Cudd_tlcInfoFree(res);
+    while (iclauses != NULL) {
+	TlClause *nextclause = iclauses->next;
+	FREE(iclauses);
+	iclauses = nextclause;
+    }
+    while (nclauses != NULL) {
+	TlClause *nextclause = nclauses->next;
+	FREE(nclauses);
+	nclauses = nextclause;
+    }
+    while (tclauses != NULL) {
+	TlClause *nextclause = tclauses->next;
+	FREE(tclauses);
+	tclauses = nextclause;
+    }
+    while (eclauses != NULL) {
+	TlClause *nextclause = eclauses->next;
+	FREE(eclauses);
+	eclauses = nextclause;
+    }
+
+    return(NULL);
+
+} /* end of computeClauses */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the two-literal clauses for a node.]
+
+  Description [Computes the two-literal clauses for a node with a zero
+  child, given the clauses for its other child and the label of the
+  node.  Returns a pointer to a TclInfo structure if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [computeClauses]
+
+******************************************************************************/
+static DdTlcInfo *
+computeClausesWithUniverse(
+  DdTlcInfo *Cres /* list of clauses for child */,
+  DdHalfWord label /* variable labeling the current node */,
+  short phase /* 0 if E child is zero; 1 if T child is zero */,
+  int size /* number of variables in the manager */)
+{
+    DdHalfWord *Ccv = Cres->vars; /* variables of clauses for child */
+    BitVector *Ccp = Cres->phases; /* phases of clauses for child */
+    DdHalfWord *Vcv = NULL; /* pointer to the variables of the clauses for v */
+    BitVector *Vcp = NULL; /* pointer to the phases of the clauses for v */
+    DdTlcInfo *res = NULL; /* the set of clauses to be returned */
+    int i;
+
+    /* Initialize result. */
+    res = tlcInfoAlloc();
+    if (res == NULL) goto cleanup;
+    /* Count entries for new list and allocate accordingly. */
+    for (i = 0; !sentinelp(Ccv[i], Ccv[i+1]); i += 2);
+    /* At this point, i is twice the number of clauses in the child's
+    ** list.  We need four more entries for this node: 2 for the one-literal
+    ** clause for the label, and 2 for the sentinel. */
+    Vcv = ALLOC(DdHalfWord,i+4);
+    if (Vcv == NULL) goto cleanup;
+    Vcp = bitVectorAlloc(i+4);
+    if (Vcp == NULL) goto cleanup;
+    res->vars = Vcv;
+    res->phases = Vcp;
+    /* Copy old list into new. */
+    for (i = 0; !sentinelp(Ccv[i], Ccv[i+1]); i += 2) {
+	Vcv[i] = Ccv[i];
+	Vcv[i+1] = Ccv[i+1];
+	bitVectorSet(Vcp, i, bitVectorRead(Ccp, i));
+	bitVectorSet(Vcp, i+1, bitVectorRead(Ccp, i+1));
+    }
+    /* Add clause corresponding to label. */
+    Vcv[i] = label;
+    bitVectorSet(Vcp, i, phase);
+    i++;
+    Vcv[i] = CUDD_MAXINDEX;
+    bitVectorSet(Vcp, i, 1);
+    i++;
+    /* Add sentinel. */
+    Vcv[i] = 0;
+    Vcv[i+1] = 0;
+    bitVectorSet(Vcp, i, 0);
+    bitVectorSet(Vcp, i+1, 0);
+
+    return(res);
+
+ cleanup:
+    if (Vcv != NULL) FREE(Vcv);
+    if (Vcp != NULL) bitVectorFree(Vcp);
+    if (res != NULL) Cudd_tlcInfoFree(res);
+
+    return(NULL);
+
+} /* end of computeClausesWithUniverse */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an enpty set of clauses.]
+
+  Description [Returns a pointer to an empty set of clauses if
+  successful; NULL otherwise.  No bit vector for the phases is
+  allocated.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static DdTlcInfo *
+emptyClauseSet(void)
+{
+    DdTlcInfo *eset;
+
+    eset = ALLOC(DdTlcInfo,1);
+    if (eset == NULL) return(NULL);
+    eset->vars = ALLOC(DdHalfWord,2);
+    if (eset->vars == NULL) {
+	FREE(eset);
+	return(NULL);
+    }
+    /* Sentinel */
+    eset->vars[0] = 0;
+    eset->vars[1] = 0;
+    eset->phases = NULL; /* does not matter */
+    eset->cnt = 0;
+    return(eset);
+
+} /* end of emptyClauseSet */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns true iff the argument is the sentinel clause.]
+
+  Description [Returns true iff the argument is the sentinel clause.
+  A sentinel clause has both variables equal to 0.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+sentinelp(
+  DdHalfWord var1,
+  DdHalfWord var2)
+{
+    return(var1 == 0 && var2 == 0);
+
+} /* end of sentinelp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns true iff the two arguments are identical clauses.]
+
+  Description [Returns true iff the two arguments are identical
+  clauses.  Since literals are sorted, we only need to compare
+  literals in the same position.]
+
+  SideEffects [None]
+
+  SeeAlso     [beforep]
+
+******************************************************************************/
+static int
+equalp(
+  DdHalfWord var1a,
+  short phase1a,
+  DdHalfWord var1b,
+  short phase1b,
+  DdHalfWord var2a,
+  short phase2a,
+  DdHalfWord var2b,
+  short phase2b)
+{
+    return(var1a == var2a && phase1a == phase2a &&
+	   var1b == var2b && phase1b == phase2b);
+
+} /* end of equalp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns true iff the first argument precedes the second in
+  the clause order.]
+
+  Description [Returns true iff the first argument precedes the second
+  in the clause order.  A clause precedes another if its first lieral
+  precedes the first literal of the other, or if the first literals
+  are the same, and its second literal precedes the second literal of
+  the other clause.  A literal precedes another if it has a higher
+  index, of if it has the same index, but it has lower phase.  Phase 0
+  is the positive phase, and it is lower than Phase 1 (negative
+  phase).]
+
+  SideEffects [None]
+
+  SeeAlso     [equalp]
+
+******************************************************************************/
+static int
+beforep(
+  DdHalfWord var1a,
+  short phase1a,
+  DdHalfWord var1b,
+  short phase1b,
+  DdHalfWord var2a,
+  short phase2a,
+  DdHalfWord var2b,
+  short phase2b)
+{
+    return(var1a > var2a || (var1a == var2a &&
+	   (phase1a < phase2a || (phase1a == phase2a &&
+	    (var1b > var2b || (var1b == var2b && phase1b < phase2b))))));
+
+} /* end of beforep */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns true iff the argument is a one-literal clause.]
+
+  Description [Returns true iff the argument is a one-literal clause.
+  A one-litaral clause has the constant FALSE as second literal.
+  Since the constant TRUE is never used, it is sufficient to test for
+  a constant.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+oneliteralp(
+  DdHalfWord var)
+{
+    return(var == CUDD_MAXINDEX);
+
+} /* end of oneliteralp */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns true iff either literal of a clause is in a set of
+  literals.]
+
+  Description [Returns true iff either literal of a clause is in a set
+  of literals.  The first four arguments specify the clause.  The
+  remaining two arguments specify the literal set.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+impliedp(
+  DdHalfWord var1,
+  short phase1,
+  DdHalfWord var2,
+  short phase2,
+  BitVector *olv,
+  BitVector *olp)
+{
+    return((bitVectorRead(olv, var1) &&
+	    bitVectorRead(olp, var1) == phase1) ||
+	   (bitVectorRead(olv, var2) &&
+	    bitVectorRead(olp, var2) == phase2));
+
+} /* end of impliedp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Allocates a bit vector.]
+
+  Description [Allocates a bit vector.  The parameter size gives the
+  number of bits.  This procedure allocates enough long's to hold the
+  specified number of bits.  Returns a pointer to the allocated vector
+  if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [bitVectorClear bitVectorFree]
+
+******************************************************************************/
+static BitVector *
+bitVectorAlloc(
+  int size)
+{
+    int allocSize;
+    BitVector *vector;
+
+    /* Find out how many long's we need.
+    ** There are sizeof(long) * 8 bits in a long.
+    ** The ceiling of the ratio of two integers m and n is given
+    ** by ((n-1)/m)+1.  Putting all this together, we get... */
+    allocSize = ((size - 1) / (sizeof(BitVector) * 8)) + 1;
+    vector = ALLOC(BitVector, allocSize);
+    if (vector == NULL) return(NULL);
+    /* Clear the whole array. */
+    (void) memset(vector, 0, allocSize * sizeof(BitVector));
+    return(vector);
+    
+} /* end of bitVectorAlloc */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Clears a bit vector.]
+
+  Description [Clears a bit vector.  The parameter size gives the
+  number of bits.]
+
+  SideEffects [None]
+
+  SeeAlso     [bitVectorAlloc]
+
+******************************************************************************/
+DD_INLINE
+static void
+bitVectorClear(
+  BitVector *vector,
+  int size)
+{
+    int allocSize;
+
+    /* Find out how many long's we need.
+    ** There are sizeof(long) * 8 bits in a long.
+    ** The ceiling of the ratio of two integers m and n is given
+    ** by ((n-1)/m)+1.  Putting all this together, we get... */
+    allocSize = ((size - 1) / (sizeof(BitVector) * 8)) + 1;
+    /* Clear the whole array. */
+    (void) memset(vector, 0, allocSize * sizeof(BitVector));
+    return;
+    
+} /* end of bitVectorClear */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees a bit vector.]
+
+  Description [Frees a bit vector.]
+
+  SideEffects [None]
+
+  SeeAlso     [bitVectorAlloc]
+
+******************************************************************************/
+static void
+bitVectorFree(
+  BitVector *vector)
+{
+    FREE(vector);
+
+} /* end of bitVectorFree */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the i-th entry of a bit vector.]
+
+  Description [Returns the i-th entry of a bit vector.]
+
+  SideEffects [None]
+
+  SeeAlso     [bitVectorSet]
+
+******************************************************************************/
+DD_INLINE
+static short
+bitVectorRead(
+  BitVector *vector,
+  int i)
+{
+    int word, bit;
+    short result;
+
+    if (vector == NULL) return((short) 0);
+
+    word = i >> LOGBPL;
+    bit = i & (BPL - 1);
+    result = (short) ((vector[word] >> bit) & 1L);
+    return(result);
+
+} /* end of bitVectorRead */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets the i-th entry of a bit vector to a value.]
+
+  Description [Sets the i-th entry of a bit vector to a value.]
+
+  SideEffects [None]
+
+  SeeAlso     [bitVectorRead]
+
+******************************************************************************/
+DD_INLINE
+static void
+bitVectorSet(
+  BitVector * vector,
+  int i,
+  short val)
+{
+    int word, bit;
+
+    word = i >> LOGBPL;
+    bit = i & (BPL - 1);
+    vector[word] &= ~(1L << bit);
+    vector[word] |= (((long) val) << bit);
+
+} /* end of bitVectorSet */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Allocates a DdTlcInfo Structure.]
+
+  Description [Returns a pointer to a DdTlcInfo Structure if successful;
+  NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_tlcInfoFree]
+
+******************************************************************************/
+static DdTlcInfo *
+tlcInfoAlloc(void)
+{
+    DdTlcInfo *res = ALLOC(DdTlcInfo,1);
+    if (res == NULL) return(NULL);
+    res->vars = NULL;
+    res->phases = NULL;
+    res->cnt = 0;
+    return(res);
+
+} /* end of tlcInfoAlloc */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddExact.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddExact.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddExact.c	(revision 6)
@@ -0,0 +1,1018 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddExact.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions for exact variable reordering.]
+
+  Description [External procedures included in this file:
+		<ul>
+		</ul>
+	Internal procedures included in this module:
+		<ul>
+		<li> cuddExact()
+		</ul>
+	Static procedures included in this module:
+		<ul> 
+                <li> getMaxBinomial()
+		<li> gcd()
+                <li> getMatrix()
+		<li> freeMatrix()
+                <li> getLevelKeys()
+                <li> ddShuffle()
+                <li> ddSiftUp()
+		<li> updateUB()
+		<li> ddCountRoots()
+		<li> ddClearGlobal()
+		<li> computeLB()
+		<li> updateEntry()
+		<li> pushDown()
+		<li> initSymmInfo()
+                </ul>]
+
+  Author      [Cheng Hua, Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddExact.c,v 1.26 2004/08/13 18:04:48 fabio Exp $";
+#endif
+
+#ifdef DD_STATS
+static int ddTotalShuffles;
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int getMaxBinomial (int n);
+static DdHalfWord ** getMatrix (int rows, int cols);
+static void freeMatrix (DdHalfWord **matrix);
+static int getLevelKeys (DdManager *table, int l);
+static int ddShuffle (DdManager *table, DdHalfWord *permutation, int lower, int upper);
+static int ddSiftUp (DdManager *table, int x, int xLow);
+static int updateUB (DdManager *table, int oldBound, DdHalfWord *bestOrder, int lower, int upper);
+static int ddCountRoots (DdManager *table, int lower, int upper);
+static void ddClearGlobal (DdManager *table, int lower, int maxlevel);
+static int computeLB (DdManager *table, DdHalfWord *order, int roots, int cost, int lower, int upper, int level);
+static int updateEntry (DdManager *table, DdHalfWord *order, int level, int cost, DdHalfWord **orders, int *costs, int subsets, char *mask, int lower, int upper);
+static void pushDown (DdHalfWord *order, int j, int level);
+static DdHalfWord * initSymmInfo (DdManager *table, int lower, int upper);
+static int checkSymmInfo (DdManager *table, DdHalfWord *symmInfo, int index, int level);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Exact variable ordering algorithm.]
+
+  Description [Exact variable ordering algorithm. Finds an optimum
+  order for the variables between lower and upper.  Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddExact(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int k, i, j;
+    int maxBinomial, oldSubsets, newSubsets;
+    int subsetCost;
+    int size;			/* number of variables to be reordered */
+    int unused, nvars, level, result;
+    int upperBound, lowerBound, cost;
+    int roots;
+    char *mask = NULL;
+    DdHalfWord  *symmInfo = NULL;
+    DdHalfWord **newOrder = NULL;
+    DdHalfWord **oldOrder = NULL;
+    int *newCost = NULL;
+    int *oldCost = NULL;
+    DdHalfWord **tmpOrder;
+    int *tmpCost;
+    DdHalfWord *bestOrder = NULL;
+    DdHalfWord *order;
+#ifdef DD_STATS
+    int  ddTotalSubsets;
+#endif
+
+    /* Restrict the range to be reordered by excluding unused variables
+    ** at the two ends. */
+    while (table->subtables[lower].keys == 1 &&
+	   table->vars[table->invperm[lower]]->ref == 1 &&
+	   lower < upper)
+	lower++;
+    while (table->subtables[upper].keys == 1 &&
+	   table->vars[table->invperm[upper]]->ref == 1 &&
+	   lower < upper)
+	upper--;
+    if (lower == upper) return(1); /* trivial problem */
+
+    /* Apply symmetric sifting to get a good upper bound and to extract
+    ** symmetry information. */
+    result = cuddSymmSiftingConv(table,lower,upper);
+    if (result == 0) goto cuddExactOutOfMem;
+
+#ifdef DD_STATS
+    (void) fprintf(table->out,"\n");
+    ddTotalShuffles = 0;
+    ddTotalSubsets = 0;
+#endif
+
+    /* Initialization. */
+    nvars = table->size;
+    size = upper - lower + 1;
+    /* Count unused variable among those to be reordered.  This is only
+    ** used to compute maxBinomial. */
+    unused = 0;
+    for (i = lower + 1; i < upper; i++) {
+	if (table->subtables[i].keys == 1 &&
+	    table->vars[table->invperm[i]]->ref == 1)
+	    unused++;
+    }
+
+    /* Find the maximum number of subsets we may have to store. */
+    maxBinomial = getMaxBinomial(size - unused);
+    if (maxBinomial == -1) goto cuddExactOutOfMem;
+
+    newOrder = getMatrix(maxBinomial, size);
+    if (newOrder == NULL) goto cuddExactOutOfMem;
+
+    newCost = ALLOC(int, maxBinomial);
+    if (newCost == NULL) goto cuddExactOutOfMem;
+
+    oldOrder = getMatrix(maxBinomial, size);
+    if (oldOrder == NULL) goto cuddExactOutOfMem;
+
+    oldCost = ALLOC(int, maxBinomial);
+    if (oldCost == NULL) goto cuddExactOutOfMem;
+
+    bestOrder = ALLOC(DdHalfWord, size);
+    if (bestOrder == NULL) goto cuddExactOutOfMem;
+
+    mask = ALLOC(char, nvars);
+    if (mask == NULL) goto cuddExactOutOfMem;
+
+    symmInfo = initSymmInfo(table, lower, upper);
+    if (symmInfo == NULL) goto cuddExactOutOfMem;
+
+    roots = ddCountRoots(table, lower, upper);
+
+    /* Initialize the old order matrix for the empty subset and the best
+    ** order to the current order. The cost for the empty subset includes
+    ** the cost of the levels between upper and the constants. These levels
+    ** are not going to change. Hence, we count them only once.
+    */
+    oldSubsets = 1;
+    for (i = 0; i < size; i++) {
+	oldOrder[0][i] = bestOrder[i] = (DdHalfWord) table->invperm[i+lower];
+    }
+    subsetCost = table->constants.keys;
+    for (i = upper + 1; i < nvars; i++)
+	subsetCost += getLevelKeys(table,i);
+    oldCost[0] = subsetCost;
+    /* The upper bound is initialized to the current size of the BDDs. */
+    upperBound = table->keys - table->isolated;
+
+    /* Now consider subsets of increasing size. */
+    for (k = 1; k <= size; k++) {
+#if DD_STATS
+	(void) fprintf(table->out,"Processing subsets of size %d\n", k);
+	fflush(table->out);
+#endif
+	newSubsets = 0;
+	level = size - k;		/* offset of first bottom variable */
+
+	for (i = 0; i < oldSubsets; i++) { /* for each subset of size k-1 */
+	    order = oldOrder[i];
+	    cost = oldCost[i];
+	    lowerBound = computeLB(table, order, roots, cost, lower, upper,
+				   level);
+	    if (lowerBound >= upperBound)
+		continue;
+	    /* Impose new order. */
+	    result = ddShuffle(table, order, lower, upper);
+	    if (result == 0) goto cuddExactOutOfMem;
+	    upperBound = updateUB(table,upperBound,bestOrder,lower,upper);
+	    /* For each top bottom variable. */
+	    for (j = level; j >= 0; j--) {
+		/* Skip unused variables. */
+		if (table->subtables[j+lower-1].keys == 1 &&
+		    table->vars[table->invperm[j+lower-1]]->ref == 1) continue;
+		/* Find cost under this order. */
+		subsetCost = cost + getLevelKeys(table, lower + level);
+		newSubsets = updateEntry(table, order, level, subsetCost,
+					 newOrder, newCost, newSubsets, mask,
+					 lower, upper);
+		if (j == 0)
+		    break;
+		if (checkSymmInfo(table, symmInfo, order[j-1], level) == 0)
+		    continue;
+		pushDown(order,j-1,level);
+		/* Impose new order. */
+		result = ddShuffle(table, order, lower, upper);
+		if (result == 0) goto cuddExactOutOfMem;
+		upperBound = updateUB(table,upperBound,bestOrder,lower,upper);
+	    } /* for each bottom variable */
+	} /* for each subset of size k */
+
+	/* New orders become old orders in preparation for next iteration. */
+	tmpOrder = oldOrder; tmpCost = oldCost;
+	oldOrder = newOrder; oldCost = newCost;
+	newOrder = tmpOrder; newCost = tmpCost;
+#ifdef DD_STATS
+	ddTotalSubsets += newSubsets;
+#endif
+	oldSubsets = newSubsets;
+    }
+    result = ddShuffle(table, bestOrder, lower, upper);
+    if (result == 0) goto cuddExactOutOfMem;
+#ifdef DD_STATS
+#ifdef DD_VERBOSE
+    (void) fprintf(table->out,"\n");
+#endif
+    (void) fprintf(table->out,"#:S_EXACT   %8d: total subsets\n",
+		   ddTotalSubsets);
+    (void) fprintf(table->out,"#:H_EXACT   %8d: total shuffles",
+		   ddTotalShuffles);
+#endif
+
+    freeMatrix(newOrder);
+    freeMatrix(oldOrder);
+    FREE(bestOrder);
+    FREE(oldCost);
+    FREE(newCost);
+    FREE(symmInfo);
+    FREE(mask);
+    return(1);
+
+cuddExactOutOfMem:
+
+    if (newOrder != NULL) freeMatrix(newOrder);
+    if (oldOrder != NULL) freeMatrix(oldOrder);
+    if (bestOrder != NULL) FREE(bestOrder);
+    if (oldCost != NULL) FREE(oldCost);
+    if (newCost != NULL) FREE(newCost);
+    if (symmInfo != NULL) FREE(symmInfo);
+    if (mask != NULL) FREE(mask);
+    table->errorCode = CUDD_MEMORY_OUT;
+    return(0);
+
+} /* end of cuddExact */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the maximum value of (n choose k) for a given n.]
+
+  Description [Computes the maximum value of (n choose k) for a given
+  n.  The maximum value occurs for k = n/2 when n is even, or k =
+  (n-1)/2 when n is odd.  The algorithm used in this procedure avoids
+  intermediate overflow problems.  It is based on the identity
+  <pre>
+    binomial(n,k) = n/k * binomial(n-1,k-1).
+  </pre>
+  Returns the computed value if successful; -1 if out of range.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+getMaxBinomial(
+  int n)
+{
+    double i, j, result;
+
+    if (n < 0 || n > 33) return(-1); /* error */
+    if (n < 2) return(1);
+
+    for (result = (double)((n+3)/2), i = result+1, j=2; i <= n; i++, j++) {
+	result *= i;
+	result /= j;
+    }
+
+    return((int)result);
+
+} /* end of getMaxBinomial */
+
+
+#if 0
+/**Function********************************************************************
+
+  Synopsis    [Returns the gcd of two integers.]
+
+  Description [Returns the gcd of two integers. Uses the binary GCD
+  algorithm described in Cormen, Leiserson, and Rivest.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+gcd(
+  int  x,
+  int  y)
+{
+    int a;
+    int b;
+    int lsbMask;
+
+    /* GCD(n,0) = n. */
+    if (x == 0) return(y);
+    if (y == 0) return(x);
+
+    a = x; b = y; lsbMask = 1;
+    
+    /* Here both a and b are != 0. The iteration maintains this invariant.
+    ** Hence, we only need to check for when they become equal.
+    */
+    while (a != b) {
+	if (a & lsbMask) {
+	    if (b & lsbMask) {	/* both odd */
+		if (a < b) {
+		    b = (b - a) >> 1;
+		} else {
+		    a = (a - b) >> 1;
+		}
+	    } else {		/* a odd, b even */
+		b >>= 1;
+	    }
+	} else {
+	    if (b & lsbMask) {	/* a even, b odd */
+		a >>= 1;
+	    } else {		/* both even */
+		lsbMask <<= 1;
+	    }
+	}
+    }
+
+    return(a);
+
+} /* end of gcd */
+#endif
+
+
+/**Function********************************************************************
+
+  Synopsis    [Allocates a two-dimensional matrix of ints.]
+
+  Description [Allocates a two-dimensional matrix of ints.
+  Returns the pointer to the matrix if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [freeMatrix]
+
+******************************************************************************/
+static DdHalfWord **
+getMatrix(
+  int  rows /* number of rows */,
+  int  cols /* number of columns */)
+{
+    DdHalfWord **matrix;
+    int i;
+
+    if (cols*rows == 0) return(NULL);
+    matrix = ALLOC(DdHalfWord *, rows);
+    if (matrix == NULL) return(NULL);
+    matrix[0] = ALLOC(DdHalfWord, cols*rows);
+    if (matrix[0] == NULL) return(NULL);
+    for (i = 1; i < rows; i++) {
+	matrix[i] = matrix[i-1] + cols;
+    }
+    return(matrix);
+
+} /* end of getMatrix */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees a two-dimensional matrix allocated by getMatrix.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [getMatrix]
+
+******************************************************************************/
+static void
+freeMatrix(
+  DdHalfWord ** matrix)
+{
+    FREE(matrix[0]);
+    FREE(matrix);
+    return;
+
+} /* end of freeMatrix */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of nodes at one level of a unique table.]
+
+  Description [Returns the number of nodes at one level of a unique table.
+  The projection function, if isolated, is not counted.]
+
+  SideEffects [None]
+
+  SeeAlso []
+
+******************************************************************************/
+static int
+getLevelKeys(
+  DdManager * table,
+  int  l)
+{
+    int isolated;
+    int x;        /* x is an index */
+
+    x = table->invperm[l];
+    isolated = table->vars[x]->ref == 1;
+
+    return(table->subtables[l].keys - isolated);
+
+} /* end of getLevelKeys */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reorders variables according to a given permutation.]
+
+  Description [Reorders variables according to a given permutation.
+  The i-th permutation array contains the index of the variable that
+  should be brought to the i-th level. ddShuffle assumes that no
+  dead nodes are present and that the interaction matrix is properly
+  initialized.  The reordering is achieved by a series of upward sifts.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso []
+
+******************************************************************************/
+static int
+ddShuffle(
+  DdManager * table,
+  DdHalfWord * permutation,
+  int  lower,
+  int  upper)
+{
+    DdHalfWord	index;
+    int		level;
+    int		position;
+#if 0
+    int		numvars;
+#endif
+    int		result;
+#ifdef DD_STATS
+    long	localTime;
+    int		initialSize;
+#ifdef DD_VERBOSE
+    int		finalSize;
+#endif
+    int		previousSize;
+#endif
+
+#ifdef DD_STATS
+    localTime = util_cpu_time();
+    initialSize = table->keys - table->isolated;
+#endif
+
+#if 0
+    numvars = table->size;
+
+    (void) fprintf(table->out,"%d:", ddTotalShuffles);
+    for (level = 0; level < numvars; level++) {
+	(void) fprintf(table->out," %d", table->invperm[level]);
+    }
+    (void) fprintf(table->out,"\n");
+#endif
+
+    for (level = 0; level <= upper - lower; level++) {
+	index = permutation[level];
+	position = table->perm[index];
+#ifdef DD_STATS
+	previousSize = table->keys - table->isolated;
+#endif
+	result = ddSiftUp(table,position,level+lower);
+	if (!result) return(0);
+    }
+
+#ifdef DD_STATS
+    ddTotalShuffles++;
+#ifdef DD_VERBOSE
+    finalSize = table->keys - table->isolated;
+    if (finalSize < initialSize) {
+	(void) fprintf(table->out,"-");
+    } else if (finalSize > initialSize) {
+	(void) fprintf(table->out,"+");
+    } else {
+	(void) fprintf(table->out,"=");
+    }
+    if ((ddTotalShuffles & 63) == 0) (void) fprintf(table->out,"\n");
+    fflush(table->out);
+#endif
+#endif
+
+    return(1);
+
+} /* end of ddShuffle */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Moves one variable up.]
+
+  Description [Takes a variable from position x and sifts it up to
+  position xLow;  xLow should be less than or equal to x.
+  Returns 1 if successful; 0 otherwise]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+ddSiftUp(
+  DdManager * table,
+  int  x,
+  int  xLow)
+{
+    int        y;
+    int        size;
+
+    y = cuddNextLow(table,x);
+    while (y >= xLow) {
+	size = cuddSwapInPlace(table,y,x);
+	if (size == 0) {
+	    return(0);
+	}
+	x = y;
+	y = cuddNextLow(table,x);
+    }
+    return(1);
+
+} /* end of ddSiftUp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Updates the upper bound and saves the best order seen so far.]
+
+  Description [Updates the upper bound and saves the best order seen so far.
+  Returns the current value of the upper bound.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+updateUB(
+  DdManager * table,
+  int  oldBound,
+  DdHalfWord * bestOrder,
+  int  lower,
+  int  upper)
+{
+    int i;
+    int newBound = table->keys - table->isolated;
+
+    if (newBound < oldBound) {
+#ifdef DD_STATS
+	(void) fprintf(table->out,"New upper bound = %d\n", newBound);
+	fflush(table->out);
+#endif
+	for (i = lower; i <= upper; i++)
+	    bestOrder[i-lower] = (DdHalfWord) table->invperm[i];
+	return(newBound);
+    } else {
+	return(oldBound);
+    }
+
+} /* end of updateUB */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of roots.]
+
+  Description [Counts the number of roots at the levels between lower and
+  upper.  The computation is based on breadth-first search.
+  A node is a root if it is not reachable from any previously visited node.
+  (All the nodes at level lower are therefore considered roots.)
+  The visited flag uses the LSB of the next pointer.  Returns the root
+  count. The roots that are constant nodes are always ignored.]
+
+  SideEffects [None]
+
+  SeeAlso     [ddClearGlobal]
+
+******************************************************************************/
+static int
+ddCountRoots(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int i,j;
+    DdNode *f;
+    DdNodePtr *nodelist;
+    DdNode *sentinel = &(table->sentinel);
+    int slots;
+    int roots = 0;
+    int maxlevel = lower;
+
+    for (i = lower; i <= upper; i++) {
+	nodelist = table->subtables[i].nodelist;
+	slots = table->subtables[i].slots;
+	for (j = 0; j < slots; j++) {
+	    f = nodelist[j];
+	    while (f != sentinel) {
+		/* A node is a root of the DAG if it cannot be
+		** reached by nodes above it. If a node was never
+		** reached during the previous depth-first searches,
+		** then it is a root, and we start a new depth-first
+		** search from it.
+		*/
+		if (!Cudd_IsComplement(f->next)) {
+		    if (f != table->vars[f->index]) {
+			roots++;
+		    }
+		}
+		if (!Cudd_IsConstant(cuddT(f))) {
+		    cuddT(f)->next = Cudd_Complement(cuddT(f)->next);
+		    if (table->perm[cuddT(f)->index] > maxlevel)
+			maxlevel = table->perm[cuddT(f)->index];
+		}
+		if (!Cudd_IsConstant(cuddE(f))) {
+		    Cudd_Regular(cuddE(f))->next =
+			Cudd_Complement(Cudd_Regular(cuddE(f))->next);
+		    if (table->perm[Cudd_Regular(cuddE(f))->index] > maxlevel)
+			maxlevel = table->perm[Cudd_Regular(cuddE(f))->index];
+		}
+		f = Cudd_Regular(f->next);
+	    }
+	}
+    }
+    ddClearGlobal(table, lower, maxlevel);
+
+    return(roots);
+
+} /* end of ddCountRoots */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Scans the DD and clears the LSB of the next pointers.]
+
+  Description [Scans the DD and clears the LSB of the next pointers.
+  The LSB of the next pointers are used as markers to tell whether a
+  node was reached. Once the roots are counted, these flags are
+  reset.]
+
+  SideEffects [None]
+
+  SeeAlso     [ddCountRoots]
+
+******************************************************************************/
+static void
+ddClearGlobal(
+  DdManager * table,
+  int  lower,
+  int  maxlevel)
+{
+    int i,j;
+    DdNode *f;
+    DdNodePtr *nodelist;
+    DdNode *sentinel = &(table->sentinel);
+    int slots;
+
+    for (i = lower; i <= maxlevel; i++) {
+	nodelist = table->subtables[i].nodelist;
+	slots = table->subtables[i].slots;
+	for (j = 0; j < slots; j++) {
+	    f = nodelist[j];
+	    while (f != sentinel) {
+		f->next = Cudd_Regular(f->next);
+		f = f->next;
+	    }
+	}
+    }
+
+} /* end of ddClearGlobal */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes a lower bound on the size of a BDD.]
+
+  Description [Computes a lower bound on the size of a BDD from the
+  following factors:
+  <ul>
+  <li> size of the lower part of it;
+  <li> size of the part of the upper part not subjected to reordering;
+  <li> number of roots in the part of the BDD subjected to reordering;
+  <li> variable in the support of the roots in the upper part of the
+       BDD subjected to reordering.
+  <ul/>]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+computeLB(
+  DdManager * table		/* manager */,
+  DdHalfWord * order		/* optimal order for the subset */,
+  int  roots			/* roots between lower and upper */,
+  int  cost			/* minimum cost for the subset */,
+  int  lower			/* lower level to be reordered */,
+  int  upper			/* upper level to be reordered */,
+  int  level			/* offset for the current top bottom var */
+  )
+{
+    int i;
+    int lb = cost;
+    int lb1 = 0;
+    int lb2;
+    int support;
+    DdHalfWord ref;
+
+    /* The levels not involved in reordering are not going to change.
+    ** Add their sizes to the lower bound.
+    */
+    for (i = 0; i < lower; i++) {
+	lb += getLevelKeys(table,i);
+    }
+    /* If a variable is in the support, then there is going
+    ** to be at least one node labeled by that variable.
+    */
+    for (i = lower; i <= lower+level; i++) {
+	support = table->subtables[i].keys > 1 ||
+	    table->vars[order[i-lower]]->ref > 1;
+	lb1 += support;
+    }
+
+    /* Estimate the number of nodes required to connect the roots to
+    ** the nodes in the bottom part. */
+    if (lower+level+1 < table->size) {
+	if (lower+level < upper)
+	    ref = table->vars[order[level+1]]->ref;
+	else
+	    ref = table->vars[table->invperm[upper+1]]->ref;
+	lb2 = table->subtables[lower+level+1].keys -
+	    (ref > (DdHalfWord) 1) - roots;
+    } else {
+	lb2 = 0;
+    }
+
+    lb += lb1 > lb2 ? lb1 : lb2;
+
+    return(lb);
+
+} /* end of computeLB */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Updates entry for a subset.]
+
+  Description [Updates entry for a subset. Finds the subset, if it exists.
+  If the new order for the subset has lower cost, or if the subset did not
+  exist, it stores the new order and cost. Returns the number of subsets
+  currently in the table.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+updateEntry(
+  DdManager * table,
+  DdHalfWord * order,
+  int  level,
+  int  cost,
+  DdHalfWord ** orders,
+  int * costs,
+  int  subsets,
+  char * mask,
+  int  lower,
+  int  upper)
+{
+    int i, j;
+    int size = upper - lower + 1;
+
+    /* Build a mask that says what variables are in this subset. */
+    for (i = lower; i <= upper; i++)
+	mask[table->invperm[i]] = 0;
+    for (i = level; i < size; i++)
+	mask[order[i]] = 1;
+
+    /* Check each subset until a match is found or all subsets are examined. */
+    for (i = 0; i < subsets; i++) {
+	DdHalfWord *subset = orders[i];
+	for (j = level; j < size; j++) {
+	    if (mask[subset[j]] == 0)
+		break;
+	}
+	if (j == size)		/* no mismatches: success */
+	    break;
+    }
+    if (i == subsets || cost < costs[i]) {		/* add or replace */
+	for (j = 0; j < size; j++)
+	    orders[i][j] = order[j];
+	costs[i] = cost;
+	subsets += (i == subsets);
+    }
+    return(subsets);
+
+} /* end of updateEntry */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Pushes a variable in the order down to position "level."]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+pushDown(
+  DdHalfWord * order,
+  int  j,
+  int  level)
+{
+    int i;
+    DdHalfWord tmp;
+
+    tmp = order[j];
+    for (i = j; i < level; i++) {
+	order[i] = order[i+1];
+    }
+    order[level] = tmp;
+    return;
+
+} /* end of pushDown */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gathers symmetry information.]
+
+  Description [Translates the symmetry information stored in the next
+  field of each subtable from level to indices. This procedure is called
+  immediately after symmetric sifting, so that the next fields are correct.
+  By translating this informaton in terms of indices, we make it independent
+  of subsequent reorderings. The format used is that of the next fields:
+  a circular list where each variable points to the next variable in the
+  same symmetry group. Only the entries between lower and upper are
+  considered.  The procedure returns a pointer to an array
+  holding the symmetry information if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [checkSymmInfo]
+
+******************************************************************************/
+static DdHalfWord *
+initSymmInfo(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int level, index, next, nextindex;
+    DdHalfWord *symmInfo;
+
+    symmInfo =  ALLOC(DdHalfWord, table->size);
+    if (symmInfo == NULL) return(NULL);
+
+    for (level = lower; level <= upper; level++) {
+	index = table->invperm[level];
+	next =  table->subtables[level].next;
+	nextindex = table->invperm[next];
+	symmInfo[index] = nextindex;
+    }
+    return(symmInfo);
+
+} /* end of initSymmInfo */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Check symmetry condition.]
+
+  Description [Returns 1 if a variable is the one with the highest index
+  among those belonging to a symmetry group that are in the top part of
+  the BDD.  The top part is given by level.]
+
+  SideEffects [None]
+
+  SeeAlso     [initSymmInfo]
+
+******************************************************************************/
+static int
+checkSymmInfo(
+  DdManager * table,
+  DdHalfWord * symmInfo,
+  int  index,
+  int  level)
+{
+    int i;
+
+    i = symmInfo[index];
+    while (i != index) {
+	if (index < i && table->perm[i] <= level)
+	    return(0);
+	i = symmInfo[i];
+    }
+    return(1);
+
+} /* end of checkSymmInfo */
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddHarwell.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddHarwell.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddHarwell.c	(revision 6)
@@ -0,0 +1,568 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddHarwell.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Function to read a matrix in Harwell format.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> Cudd_addHarwell()
+		</ul>
+	]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddHarwell.c,v 1.9 2004/08/13 18:04:49 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Reads in a matrix in the format of the Harwell-Boeing
+  benchmark suite.]
+
+  Description [Reads in a matrix in the format of the Harwell-Boeing
+  benchmark suite. The variables are ordered as follows:
+  <blockquote>
+  x\[0\] y\[0\] x\[1\] y\[1\] ...
+  </blockquote>
+  0 is the most significant bit.  On input, nx and ny hold the numbers
+  of row and column variables already in existence. On output, they
+  hold the numbers of row and column variables actually used by the
+  matrix.  m and n are set to the numbers of rows and columns of the
+  matrix.  Their values on input are immaterial.  Returns 1 on
+  success; 0 otherwise. The ADD for the sparse matrix is returned in
+  E, and its reference count is > 0.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_addRead Cudd_bddRead]
+
+******************************************************************************/
+int
+Cudd_addHarwell(
+  FILE * fp /* pointer to the input file */,
+  DdManager * dd /* DD manager */,
+  DdNode ** E /* characteristic function of the graph */,
+  DdNode *** x /* array of row variables */,
+  DdNode *** y /* array of column variables */,
+  DdNode *** xn /* array of complemented row variables */,
+  DdNode *** yn_ /* array of complemented column variables */,
+  int * nx /* number or row variables */,
+  int * ny /* number or column variables */,
+  int * m /* number of rows */,
+  int * n /* number of columns */,
+  int  bx /* first index of row variables */,
+  int  sx /* step of row variables */,
+  int  by /* first index of column variables */,
+  int  sy /* step of column variables */,
+  int  pr /* verbosity level */)
+{
+    DdNode *one, *zero;
+    DdNode *w;
+    DdNode *cubex, *cubey, *minterm1;
+    int u, v, err, i, j, nv;
+    double val;
+    DdNode **lx, **ly, **lxn, **lyn;	/* local copies of x, y, xn, yn_ */
+    int lnx, lny;			/* local copies of nx and ny */
+    char title[73], key[9], mxtype[4], rhstyp[4];
+    int totcrd, ptrcrd, indcrd, valcrd, rhscrd,
+        nrow, ncol, nnzero, neltvl,
+	nrhs, nrhsix;
+    int *colptr, *rowind;
+#if 0
+    int nguess, nexact;
+    int	*rhsptr, *rhsind;
+#endif
+
+    if (*nx < 0 || *ny < 0) return(0);
+
+    one = DD_ONE(dd);
+    zero = DD_ZERO(dd);
+
+    /* Read the header */
+    err = fscanf(fp, "%72c %8c", title, key);
+    if (err == EOF) {
+	return(0);
+    } else if (err != 2) {
+        return(0);
+    }
+    title[72] = (char) 0;
+    key[8] = (char) 0;
+
+    err = fscanf(fp, "%d %d %d %d %d", &totcrd, &ptrcrd, &indcrd,
+    &valcrd, &rhscrd);
+    if (err == EOF) {
+	return(0);
+    } else if (err != 5) {
+        return(0);
+    }
+
+    err = fscanf(fp, "%3s %d %d %d %d", mxtype, &nrow, &ncol,
+    &nnzero, &neltvl);
+    if (err == EOF) {
+	return(0);
+    } else if (err != 5) {
+        return(0);
+    }
+
+    /* Skip FORTRAN formats */
+    if (rhscrd == 0) {
+	err = fscanf(fp, "%*s %*s %*s \n");
+    } else {
+	err = fscanf(fp, "%*s %*s %*s %*s \n");
+    }
+    if (err == EOF) {
+	return(0);
+    } else if (err != 0) {
+        return(0);
+    }
+
+    /* Print out some stuff if requested to be verbose */
+    if (pr>0) {
+	(void) fprintf(dd->out,"%s: type %s, %d rows, %d columns, %d entries\n", key,
+	mxtype, nrow, ncol, nnzero);
+	if (pr>1) (void) fprintf(dd->out,"%s\n", title);
+    }
+
+    /* Check matrix type */
+    if (mxtype[0] != 'R' || mxtype[1] != 'U' || mxtype[2] != 'A') {
+	(void) fprintf(dd->err,"%s: Illegal matrix type: %s\n",
+		       key, mxtype);
+	return(0);
+    }
+    if (neltvl != 0) return(0);
+
+    /* Read optional 5-th line */
+    if (rhscrd != 0) {
+	err = fscanf(fp, "%3c %d %d", rhstyp, &nrhs, &nrhsix);
+	if (err == EOF) {
+	    return(0);
+	} else if (err != 3) {
+	    return(0);
+	}
+	rhstyp[3] = (char) 0;
+	if (rhstyp[0] != 'F') {
+	    (void) fprintf(dd->err,
+	    "%s: Sparse right-hand side not yet supported\n", key);
+	    return(0);
+	}
+	if (pr>0) (void) fprintf(dd->out,"%d right-hand side(s)\n", nrhs);
+    } else {
+	nrhs = 0;
+    }
+
+    /* Compute the number of variables */
+
+    /* row and column numbers start from 0 */
+    u = nrow - 1;
+    for (i=0; u > 0; i++) {
+	u >>= 1;
+    }
+    lnx = i;
+    if (nrhs == 0) {
+	v = ncol - 1;
+    } else {
+	v = 2* (ddMax(ncol, nrhs) - 1);
+    }
+    for (i=0; v > 0; i++) {
+	v >>= 1;
+    }
+    lny = i;
+
+    /* Allocate or reallocate arrays for variables as needed */
+    if (*nx == 0) {
+	if (lnx > 0) {
+	    *x = lx = ALLOC(DdNode *,lnx);
+	    if (lx == NULL) {
+		dd->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    *xn = lxn =  ALLOC(DdNode *,lnx);
+	    if (lxn == NULL) {
+		dd->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	} else {
+	    *x = *xn = NULL;
+	}
+    } else if (lnx > *nx) {
+	*x = lx = REALLOC(DdNode *, *x, lnx);
+	if (lx == NULL) {
+	    dd->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	*xn = lxn =  REALLOC(DdNode *, *xn, lnx);
+	if (lxn == NULL) {
+	    dd->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+    } else {
+	lx = *x;
+	lxn = *xn;
+    }
+    if (*ny == 0) {
+	if (lny >0) {
+	    *y = ly = ALLOC(DdNode *,lny);
+	    if (ly == NULL) {
+		dd->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    *yn_ = lyn = ALLOC(DdNode *,lny);
+	    if (lyn == NULL) {
+		dd->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	} else {
+	    *y = *yn_ = NULL;
+	}
+    } else if (lny > *ny) {
+	*y = ly = REALLOC(DdNode *, *y, lny);
+	if (ly == NULL) {
+	    dd->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	*yn_ = lyn = REALLOC(DdNode *, *yn_, lny);
+	if (lyn == NULL) {
+	    dd->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+    } else {
+	ly = *y;
+	lyn = *yn_;
+    }
+
+    /* Create new variables as needed */
+    for (i= *nx,nv=bx+(*nx)*sx; i < lnx; i++,nv+=sx) {
+	do {
+	    dd->reordered = 0;
+	    lx[i] = cuddUniqueInter(dd, nv, one, zero);
+	} while (dd->reordered == 1);
+	if (lx[i] == NULL) return(0);
+        cuddRef(lx[i]);
+	do {
+	    dd->reordered = 0;
+	    lxn[i] = cuddUniqueInter(dd, nv, zero, one);
+	} while (dd->reordered == 1);
+	if (lxn[i] == NULL) return(0);
+        cuddRef(lxn[i]);
+    }
+    for (i= *ny,nv=by+(*ny)*sy; i < lny; i++,nv+=sy) {
+	do {
+	    dd->reordered = 0;
+	    ly[i] = cuddUniqueInter(dd, nv, one, zero);
+	} while (dd->reordered == 1);
+	if (ly[i] == NULL) return(0);
+	cuddRef(ly[i]);
+	do {
+	    dd->reordered = 0;
+	    lyn[i] = cuddUniqueInter(dd, nv, zero, one);
+	} while (dd->reordered == 1);
+	if (lyn[i] == NULL) return(0);
+	cuddRef(lyn[i]);
+    }
+
+    /* Update matrix parameters */
+    *nx = lnx;
+    *ny = lny;
+    *m = nrow;
+    if (nrhs == 0) {
+	*n = ncol;
+    } else {
+	*n = (1 << (lny - 1)) + nrhs;
+    }
+    
+    /* Read structure data */
+    colptr = ALLOC(int, ncol+1);
+    if (colptr == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    rowind = ALLOC(int, nnzero);
+    if (rowind == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+
+    for (i=0; i<ncol+1; i++) {
+	err = fscanf(fp, " %d ", &u);
+	if (err == EOF){ 
+	    FREE(colptr);
+	    FREE(rowind);
+	    return(0);
+	} else if (err != 1) {
+	    FREE(colptr);
+	    FREE(rowind);
+	    return(0);
+	}
+	colptr[i] = u - 1;
+    }
+    if (colptr[0] != 0) {
+	(void) fprintf(dd->err,"%s: Unexpected colptr[0] (%d)\n",
+		       key,colptr[0]);
+	FREE(colptr);
+	FREE(rowind);
+	return(0);
+    }
+    for (i=0; i<nnzero; i++) {
+	err = fscanf(fp, " %d ", &u);
+	if (err == EOF){ 
+	    FREE(colptr);
+	    FREE(rowind);
+	    return(0);
+	} else if (err != 1) {
+	    FREE(colptr);
+	    FREE(rowind);
+	    return(0);
+	}
+	rowind[i] = u - 1;
+    }
+
+    *E = zero; cuddRef(*E);
+
+    for (j=0; j<ncol; j++) {
+	v = j;
+	cubey = one; cuddRef(cubey);
+	for (nv = lny - 1; nv>=0; nv--) {
+	    if (v & 1) {
+		w = Cudd_addApply(dd, Cudd_addTimes, cubey, ly[nv]);
+	    } else {
+		w = Cudd_addApply(dd, Cudd_addTimes, cubey, lyn[nv]);
+	    }
+	    if (w == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		FREE(colptr);
+		FREE(rowind);
+		return(0);
+	    }
+	    cuddRef(w);
+	    Cudd_RecursiveDeref(dd, cubey);
+	    cubey = w;
+	    v >>= 1;
+	}
+	for (i=colptr[j]; i<colptr[j+1]; i++) {
+	    u = rowind[i];
+	    err = fscanf(fp, " %lf ", &val);
+	    if (err == EOF || err != 1){ 
+		Cudd_RecursiveDeref(dd, cubey);
+		FREE(colptr);
+		FREE(rowind);
+		return(0);
+	    }
+	    /* Create new Constant node if necessary */
+	    cubex = cuddUniqueConst(dd, (CUDD_VALUE_TYPE) val);
+	    if (cubex == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		FREE(colptr);
+		FREE(rowind);
+		return(0);
+	    }
+	    cuddRef(cubex);
+
+	    for (nv = lnx - 1; nv>=0; nv--) {
+		if (u & 1) {
+		    w = Cudd_addApply(dd, Cudd_addTimes, cubex, lx[nv]);
+		} else { 
+		    w = Cudd_addApply(dd, Cudd_addTimes, cubex, lxn[nv]);
+		}
+		if (w == NULL) {
+		    Cudd_RecursiveDeref(dd, cubey);
+		    Cudd_RecursiveDeref(dd, cubex);
+		    FREE(colptr);
+		    FREE(rowind);
+		    return(0);
+		}
+		cuddRef(w);
+		Cudd_RecursiveDeref(dd, cubex);
+		cubex = w;
+		u >>= 1;
+	    }
+	    minterm1 = Cudd_addApply(dd, Cudd_addTimes, cubey, cubex);
+	    if (minterm1 == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		Cudd_RecursiveDeref(dd, cubex);
+		FREE(colptr);
+		FREE(rowind);
+		return(0);
+	    }
+	    cuddRef(minterm1);
+	    Cudd_RecursiveDeref(dd, cubex);
+	    w = Cudd_addApply(dd, Cudd_addPlus, *E, minterm1);
+	    if (w == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		FREE(colptr);
+		FREE(rowind);
+		return(0);
+	    }
+	    cuddRef(w);
+	    Cudd_RecursiveDeref(dd, minterm1);
+	    Cudd_RecursiveDeref(dd, *E);
+	    *E = w;
+	}
+	Cudd_RecursiveDeref(dd, cubey);
+    }
+    FREE(colptr);
+    FREE(rowind);
+
+    /* Read right-hand sides */
+    for (j=0; j<nrhs; j++) {
+	v = j + (1<< (lny-1));
+	cubey = one; cuddRef(cubey);
+	for (nv = lny - 1; nv>=0; nv--) {
+	    if (v & 1) {
+		w = Cudd_addApply(dd, Cudd_addTimes, cubey, ly[nv]);
+	    } else {
+		w = Cudd_addApply(dd, Cudd_addTimes, cubey, lyn[nv]);
+	    }
+	    if (w == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		return(0);
+	    }
+	    cuddRef(w);
+	    Cudd_RecursiveDeref(dd, cubey);
+	    cubey = w;
+	    v >>= 1;
+	}
+	for (i=0; i<nrow; i++) {
+	    u = i;
+	    err = fscanf(fp, " %lf ", &val);
+	    if (err == EOF || err != 1){ 
+		Cudd_RecursiveDeref(dd, cubey);
+		return(0);
+	    }
+	    /* Create new Constant node if necessary */
+	    if (val == (double) 0.0) continue;
+	    cubex = cuddUniqueConst(dd, (CUDD_VALUE_TYPE) val);
+	    if (cubex == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		return(0);
+	    }
+	    cuddRef(cubex);
+
+	    for (nv = lnx - 1; nv>=0; nv--) {
+		if (u & 1) {
+		   w = Cudd_addApply(dd, Cudd_addTimes, cubex, lx[nv]);
+		} else { 
+		    w = Cudd_addApply(dd, Cudd_addTimes, cubex, lxn[nv]);
+		}
+		if (w == NULL) {
+		    Cudd_RecursiveDeref(dd, cubey);
+		    Cudd_RecursiveDeref(dd, cubex);
+		    return(0);
+		}
+		cuddRef(w);
+		Cudd_RecursiveDeref(dd, cubex);
+		cubex = w;
+		u >>= 1;
+	    }
+	    minterm1 = Cudd_addApply(dd, Cudd_addTimes, cubey, cubex);
+	    if (minterm1 == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		Cudd_RecursiveDeref(dd, cubex);
+		return(0);
+	    }
+	    cuddRef(minterm1);
+	    Cudd_RecursiveDeref(dd, cubex);
+	    w = Cudd_addApply(dd, Cudd_addPlus, *E, minterm1);
+	    if (w == NULL) {
+		Cudd_RecursiveDeref(dd, cubey);
+		return(0);
+	    }
+	    cuddRef(w);
+	    Cudd_RecursiveDeref(dd, minterm1);
+	    Cudd_RecursiveDeref(dd, *E);
+	    *E = w;
+	}
+	Cudd_RecursiveDeref(dd, cubey);
+    }
+
+    return(1);
+
+} /* end of Cudd_addHarwell */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddInit.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddInit.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddInit.c	(revision 6)
@@ -0,0 +1,308 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddInit.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions to initialize and shut down the DD manager.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> Cudd_Init()
+		<li> Cudd_Quit()
+		</ul>
+	       Internal procedures included in this module:
+		<ul>
+		<li> cuddZddInitUniv()
+		<li> cuddZddFreeUniv()
+		</ul>
+	      ]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddInit.c,v 1.32 2004/08/13 18:04:49 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a new DD manager.]
+
+  Description [Creates a new DD manager, initializes the table, the
+  basic constants and the projection functions. If maxMemory is 0,
+  Cudd_Init decides suitable values for the maximum size of the cache
+  and for the limit for fast unique table growth based on the available
+  memory. Returns a pointer to the manager if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_Quit]
+
+******************************************************************************/
+DdManager *
+Cudd_Init(
+  unsigned int numVars /* initial number of BDD variables (i.e., subtables) */,
+  unsigned int numVarsZ /* initial number of ZDD variables (i.e., subtables) */,
+  unsigned int numSlots /* initial size of the unique tables */,
+  unsigned int cacheSize /* initial size of the cache */,
+  unsigned long maxMemory /* target maximum memory occupation */)
+{
+    DdManager *unique;
+    int i,result;
+    DdNode *one, *zero;
+    unsigned int maxCacheSize;
+    unsigned int looseUpTo;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    if (maxMemory == 0) {
+	maxMemory = getSoftDataLimit();
+    }
+    looseUpTo = (unsigned int) ((maxMemory / sizeof(DdNode)) /
+				DD_MAX_LOOSE_FRACTION);
+    unique = cuddInitTable(numVars,numVarsZ,numSlots,looseUpTo);
+    unique->maxmem = (unsigned long) maxMemory / 10 * 9;
+    if (unique == NULL) return(NULL);
+    maxCacheSize = (unsigned int) ((maxMemory / sizeof(DdCache)) /
+				   DD_MAX_CACHE_FRACTION);
+    result = cuddInitCache(unique,cacheSize,maxCacheSize);
+    if (result == 0) return(NULL);
+
+    saveHandler = MMoutOfMemory;
+    MMoutOfMemory = Cudd_OutOfMem;
+    unique->stash = ALLOC(char,(maxMemory / DD_STASH_FRACTION) + 4);
+    MMoutOfMemory = saveHandler;
+    if (unique->stash == NULL) {
+	(void) fprintf(unique->err,"Unable to set aside memory\n");
+    }
+
+    /* Initialize constants. */
+    unique->one = cuddUniqueConst(unique,1.0);
+    if (unique->one == NULL) return(0);
+    cuddRef(unique->one);
+    unique->zero = cuddUniqueConst(unique,0.0);
+    if (unique->zero == NULL) return(0);
+    cuddRef(unique->zero);
+#ifdef HAVE_IEEE_754
+    if (DD_PLUS_INF_VAL != DD_PLUS_INF_VAL * 3 ||
+	DD_PLUS_INF_VAL != DD_PLUS_INF_VAL / 3) {
+	(void) fprintf(unique->err,"Warning: Crippled infinite values\n");
+	(void) fprintf(unique->err,"Recompile without -DHAVE_IEEE_754\n");
+    }
+#endif
+    unique->plusinfinity = cuddUniqueConst(unique,DD_PLUS_INF_VAL);
+    if (unique->plusinfinity == NULL) return(0);
+    cuddRef(unique->plusinfinity);
+    unique->minusinfinity = cuddUniqueConst(unique,DD_MINUS_INF_VAL);
+    if (unique->minusinfinity == NULL) return(0);
+    cuddRef(unique->minusinfinity);
+    unique->background = unique->zero;
+
+    /* The logical zero is different from the CUDD_VALUE_TYPE zero! */
+    one = unique->one;
+    zero = Cudd_Not(one);
+    /* Create the projection functions. */
+    unique->vars = ALLOC(DdNodePtr,unique->maxSize);
+    if (unique->vars == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    for (i = 0; i < unique->size; i++) {
+	unique->vars[i] = cuddUniqueInter(unique,i,one,zero);
+	if (unique->vars[i] == NULL) return(0);
+	cuddRef(unique->vars[i]);
+    }
+
+    if (unique->sizeZ)
+	cuddZddInitUniv(unique);
+
+    unique->memused += sizeof(DdNode *) * unique->maxSize;
+
+    return(unique);
+
+} /* end of Cudd_Init */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Deletes resources associated with a DD manager.]
+
+  Description [Deletes resources associated with a DD manager and
+  resets the global statistical counters. (Otherwise, another manaqger
+  subsequently created would inherit the stats of this one.)]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_Init]
+
+******************************************************************************/
+void
+Cudd_Quit(
+  DdManager * unique)
+{
+    if (unique->stash != NULL) FREE(unique->stash);
+    cuddFreeTable(unique);
+
+} /* end of Cudd_Quit */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes the ZDD universe.]
+
+  Description [Initializes the ZDD universe. Returns 1 if successful; 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddZddFreeUniv]
+
+******************************************************************************/
+int
+cuddZddInitUniv(
+  DdManager * zdd)
+{
+    DdNode	*p, *res;
+    int		i;
+
+    zdd->univ = ALLOC(DdNodePtr, zdd->sizeZ);
+    if (zdd->univ == NULL) {
+	zdd->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+
+    res = DD_ONE(zdd);
+    cuddRef(res);
+    for (i = zdd->sizeZ - 1; i >= 0; i--) {
+	unsigned int index = zdd->invpermZ[i];
+	p = res;
+	res = cuddUniqueInterZdd(zdd, index, p, p);
+	if (res == NULL) {
+	    Cudd_RecursiveDerefZdd(zdd,p);
+	    FREE(zdd->univ);
+	    return(0);
+	}
+	cuddRef(res);
+	cuddDeref(p);
+	zdd->univ[i] = res;
+    }
+
+#ifdef DD_VERBOSE
+    cuddZddP(zdd, zdd->univ[0]);
+#endif
+
+    return(1);
+
+} /* end of cuddZddInitUniv */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees the ZDD universe.]
+
+  Description [Frees the ZDD universe.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddZddInitUniv]
+
+******************************************************************************/
+void
+cuddZddFreeUniv(
+  DdManager * zdd)
+{
+    if (zdd->univ) {
+	Cudd_RecursiveDerefZdd(zdd, zdd->univ[0]);
+	FREE(zdd->univ);
+    }
+
+} /* end of cuddZddFreeUniv */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddLCache.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddLCache.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddLCache.c	(revision 6)
@@ -0,0 +1,1455 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddLCache.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions for local caches.]
+
+  Description [Internal procedures included in this module:
+		<ul>
+		<li> cuddLocalCacheInit()
+		<li> cuddLocalCacheQuit()
+		<li> cuddLocalCacheInsert()
+		<li> cuddLocalCacheLookup()
+		<li> cuddLocalCacheClearDead()
+		<li> cuddLocalCacheClearAll()
+		<li> cuddLocalCacheProfile()
+		<li> cuddHashTableInit()
+		<li> cuddHashTableQuit()
+		<li> cuddHashTableInsert()
+		<li> cuddHashTableLookup()
+		<li> cuddHashTableInsert2()
+		<li> cuddHashTableLookup2()
+		<li> cuddHashTableInsert3()
+		<li> cuddHashTableLookup3()
+		</ul>
+	    Static procedures included in this module:
+		<ul>
+		<li> cuddLocalCacheResize()
+		<li> ddLCHash()
+		<li> cuddLocalCacheAddToList()
+		<li> cuddLocalCacheRemoveFromList()
+		<li> cuddHashTableResize()
+		<li> cuddHashTableAlloc()
+		</ul> ]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#define DD_MAX_HASHTABLE_DENSITY 2	/* tells when to resize a table */
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddLCache.c,v 1.21 2004/08/13 18:04:49 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**Macro***********************************************************************
+
+  Synopsis    [Computes hash function for keys of two operands.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [ddLCHash3 ddLCHash]
+
+******************************************************************************/
+#if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
+#define ddLCHash2(f,g,shift) \
+((((unsigned)(unsigned long)(f) * DD_P1 + \
+   (unsigned)(unsigned long)(g)) * DD_P2) >> (shift))
+#else
+#define ddLCHash2(f,g,shift) \
+((((unsigned)(f) * DD_P1 + (unsigned)(g)) * DD_P2) >> (shift))
+#endif
+
+
+/**Macro***********************************************************************
+
+  Synopsis    [Computes hash function for keys of three operands.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [ddLCHash2 ddLCHash]
+
+******************************************************************************/
+#define ddLCHash3(f,g,h,shift) ddCHash2(f,g,h,shift)
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void cuddLocalCacheResize (DdLocalCache *cache);
+DD_INLINE static unsigned int ddLCHash (DdNodePtr *key, unsigned int keysize, int shift);
+static void cuddLocalCacheAddToList (DdLocalCache *cache);
+static void cuddLocalCacheRemoveFromList (DdLocalCache *cache);
+static int cuddHashTableResize (DdHashTable *hash);
+DD_INLINE static DdHashItem * cuddHashTableAlloc (DdHashTable *hash);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes a local computed table.]
+
+  Description [Initializes a computed table.  Returns a pointer the
+  the new local cache in case of success; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddInitCache]
+
+******************************************************************************/
+DdLocalCache *
+cuddLocalCacheInit(
+  DdManager * manager /* manager */,
+  unsigned int  keySize /* size of the key (number of operands) */,
+  unsigned int  cacheSize /* Initial size of the cache */,
+  unsigned int  maxCacheSize /* Size of the cache beyond which no resizing occurs */)
+{
+    DdLocalCache *cache;
+    int logSize;
+
+    cache = ALLOC(DdLocalCache,1);
+    if (cache == NULL) {
+	manager->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    cache->manager = manager;
+    cache->keysize = keySize;
+    cache->itemsize = (keySize + 1) * sizeof(DdNode *);
+#ifdef DD_CACHE_PROFILE
+    cache->itemsize += sizeof(ptrint);
+#endif
+    logSize = cuddComputeFloorLog2(ddMax(cacheSize,manager->slots/2));
+    cacheSize = 1 << logSize;
+    cache->item = (DdLocalCacheItem *)
+	ALLOC(char, cacheSize * cache->itemsize);
+    if (cache->item == NULL) {
+	manager->errorCode = CUDD_MEMORY_OUT;
+	FREE(cache);
+	return(NULL);
+    }
+    cache->slots = cacheSize;
+    cache->shift = sizeof(int) * 8 - logSize;
+    cache->maxslots = ddMin(maxCacheSize,manager->slots);
+    cache->minHit = manager->minHit;
+    /* Initialize to avoid division by 0 and immediate resizing. */
+    cache->lookUps = (double) (int) (cacheSize * cache->minHit + 1);
+    cache->hits = 0;
+    manager->memused += cacheSize * cache->itemsize + sizeof(DdLocalCache);
+
+    /* Initialize the cache. */
+    memset(cache->item, 0, cacheSize * cache->itemsize);
+
+    /* Add to manager's list of local caches for GC. */
+    cuddLocalCacheAddToList(cache);
+
+    return(cache);
+
+} /* end of cuddLocalCacheInit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Shuts down a local computed table.]
+
+  Description [Initializes the computed table. It is called by
+  Cudd_Init. Returns a pointer the the new local cache in case of
+  success; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddLocalCacheInit]
+
+******************************************************************************/
+void
+cuddLocalCacheQuit(
+  DdLocalCache * cache /* cache to be shut down */)
+{
+    cache->manager->memused -=
+	cache->slots * cache->itemsize + sizeof(DdLocalCache);
+    cuddLocalCacheRemoveFromList(cache);
+    FREE(cache->item);
+    FREE(cache);
+
+    return;
+
+} /* end of cuddLocalCacheQuit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts a result in a local cache.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddLocalCacheInsert(
+  DdLocalCache * cache,
+  DdNodePtr * key,
+  DdNode * value)
+{
+    unsigned int posn;
+    DdLocalCacheItem *entry;
+
+    posn = ddLCHash(key,cache->keysize,cache->shift);
+    entry = (DdLocalCacheItem *) ((char *) cache->item +
+				  posn * cache->itemsize);
+    memcpy(entry->key,key,cache->keysize * sizeof(DdNode *));
+    entry->value = value;
+#ifdef DD_CACHE_PROFILE
+    entry->count++;
+#endif
+
+} /* end of cuddLocalCacheInsert */
+
+
+/**Function********************************************************************
+
+  Synopsis [Looks up in a local cache.]
+
+  Description [Looks up in a local cache. Returns the result if found;
+  it returns NULL if no result is found.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+cuddLocalCacheLookup(
+  DdLocalCache * cache,
+  DdNodePtr * key)
+{
+    unsigned int posn;
+    DdLocalCacheItem *entry;
+    DdNode *value;
+
+    cache->lookUps++;
+    posn = ddLCHash(key,cache->keysize,cache->shift);
+    entry = (DdLocalCacheItem *) ((char *) cache->item +
+				  posn * cache->itemsize);
+    if (entry->value != NULL &&
+	memcmp(key,entry->key,cache->keysize*sizeof(DdNode *)) == 0) {
+	cache->hits++;
+	value = Cudd_Regular(entry->value);
+	if (value->ref == 0) {
+	    cuddReclaim(cache->manager,value);
+	}
+	return(entry->value);
+    }
+
+    /* Cache miss: decide whether to resize */
+
+    if (cache->slots < cache->maxslots &&
+	cache->hits > cache->lookUps * cache->minHit) {
+	cuddLocalCacheResize(cache);
+    }
+
+    return(NULL);
+
+} /* end of cuddLocalCacheLookup */
+
+
+/**Function********************************************************************
+
+  Synopsis [Clears the dead entries of the local caches of a manager.]
+
+  Description [Clears the dead entries of the local caches of a manager.
+  Used during garbage collection.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddLocalCacheClearDead(
+  DdManager * manager)
+{
+    DdLocalCache *cache = manager->localCaches;
+    unsigned int keysize;
+    unsigned int itemsize;
+    unsigned int slots;
+    DdLocalCacheItem *item;
+    DdNodePtr *key;
+    unsigned int i, j;
+
+    while (cache != NULL) {
+	keysize = cache->keysize;
+	itemsize = cache->itemsize;
+	slots = cache->slots;
+	item = cache->item;
+	for (i = 0; i < slots; i++) {
+	    if (item->value != NULL && Cudd_Regular(item->value)->ref == 0) {
+		item->value = NULL;
+	    } else {
+		key = item->key;
+		for (j = 0; j < keysize; j++) {
+		    if (Cudd_Regular(key[j])->ref == 0) {
+			item->value = NULL;
+			break;
+		    }
+		}
+	    }
+	    item = (DdLocalCacheItem *) ((char *) item + itemsize);
+	}
+	cache = cache->next;
+    }
+    return;
+
+} /* end of cuddLocalCacheClearDead */
+
+
+/**Function********************************************************************
+
+  Synopsis [Clears the local caches of a manager.]
+
+  Description [Clears the local caches of a manager.
+  Used before reordering.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddLocalCacheClearAll(
+  DdManager * manager)
+{
+    DdLocalCache *cache = manager->localCaches;
+
+    while (cache != NULL) {
+	memset(cache->item, 0, cache->slots * cache->itemsize);
+	cache = cache->next;
+    }
+    return;
+
+} /* end of cuddLocalCacheClearAll */
+
+
+#ifdef DD_CACHE_PROFILE
+
+#define DD_HYSTO_BINS 8
+
+/**Function********************************************************************
+
+  Synopsis    [Computes and prints a profile of a local cache usage.]
+
+  Description [Computes and prints a profile of a local cache usage.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddLocalCacheProfile(
+  DdLocalCache * cache)
+{
+    double count, mean, meansq, stddev, expected;
+    long max, min;
+    int imax, imin;
+    int i, retval, slots;
+    long *hystogram;
+    int nbins = DD_HYSTO_BINS;
+    int bin;
+    long thiscount;
+    double totalcount;
+    int nzeroes;
+    DdLocalCacheItem *entry;
+    FILE *fp = cache->manager->out;
+
+    slots = cache->slots;
+
+    meansq = mean = expected = 0.0;
+    max = min = (long) cache->item[0].count;
+    imax = imin = nzeroes = 0;
+    totalcount = 0.0;
+
+    hystogram = ALLOC(long, nbins);
+    if (hystogram == NULL) {
+	return(0);
+    }
+    for (i = 0; i < nbins; i++) {
+	hystogram[i] = 0;
+    }
+
+    for (i = 0; i < slots; i++) {
+	entry = (DdLocalCacheItem *) ((char *) cache->item +
+				      i * cache->itemsize);
+	thiscount = (long) entry->count;
+	if (thiscount > max) {
+	    max = thiscount;
+	    imax = i;
+	}
+	if (thiscount < min) {
+	    min = thiscount;
+	    imin = i;
+	}
+	if (thiscount == 0) {
+	    nzeroes++;
+	}
+	count = (double) thiscount;
+	mean += count;
+	meansq += count * count;
+	totalcount += count;
+	expected += count * (double) i;
+	bin = (i * nbins) / slots;
+	hystogram[bin] += thiscount;
+    }
+    mean /= (double) slots;
+    meansq /= (double) slots;
+    stddev = sqrt(meansq - mean*mean);
+
+    retval = fprintf(fp,"Cache stats: slots = %d average = %g ", slots, mean);
+    if (retval == EOF) return(0);
+    retval = fprintf(fp,"standard deviation = %g\n", stddev);
+    if (retval == EOF) return(0);
+    retval = fprintf(fp,"Cache max accesses = %ld for slot %d\n", max, imax);
+    if (retval == EOF) return(0);
+    retval = fprintf(fp,"Cache min accesses = %ld for slot %d\n", min, imin);
+    if (retval == EOF) return(0);
+    retval = fprintf(fp,"Cache unused slots = %d\n", nzeroes);
+    if (retval == EOF) return(0);
+
+    if (totalcount) {
+	expected /= totalcount;
+	retval = fprintf(fp,"Cache access hystogram for %d bins", nbins);
+	if (retval == EOF) return(0);
+	retval = fprintf(fp," (expected bin value = %g)\n# ", expected);
+	if (retval == EOF) return(0);
+	for (i = nbins - 1; i>=0; i--) {
+	    retval = fprintf(fp,"%ld ", hystogram[i]);
+	    if (retval == EOF) return(0);
+	}
+	retval = fprintf(fp,"\n");
+	if (retval == EOF) return(0);
+    }
+
+    FREE(hystogram);
+    return(1);
+
+} /* end of cuddLocalCacheProfile */
+#endif
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes a hash table.]
+
+  Description [Initializes a hash table. Returns a pointer to the new
+  table if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableQuit]
+
+******************************************************************************/
+DdHashTable *
+cuddHashTableInit(
+  DdManager * manager,
+  unsigned int  keySize,
+  unsigned int  initSize)
+{
+    DdHashTable *hash;
+    int logSize;
+
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+    hash = ALLOC(DdHashTable, 1);
+    if (hash == NULL) {
+	manager->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    hash->keysize = keySize;
+    hash->manager = manager;
+    hash->memoryList = NULL;
+    hash->nextFree = NULL;
+    hash->itemsize = (keySize + 1) * sizeof(DdNode *) +
+	sizeof(ptrint) + sizeof(DdHashItem *);
+    /* We have to guarantee that the shift be < 32. */
+    if (initSize < 2) initSize = 2;
+    logSize = cuddComputeFloorLog2(initSize);
+    hash->numBuckets = 1 << logSize;
+    hash->shift = sizeof(int) * 8 - logSize;
+    hash->bucket = ALLOC(DdHashItem *, hash->numBuckets);
+    if (hash->bucket == NULL) {
+	manager->errorCode = CUDD_MEMORY_OUT;
+	FREE(hash);
+	return(NULL);
+    }
+    memset(hash->bucket, 0, hash->numBuckets * sizeof(DdHashItem *));
+    hash->size = 0;
+    hash->maxsize = hash->numBuckets * DD_MAX_HASHTABLE_DENSITY;
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+    return(hash);
+
+} /* end of cuddHashTableInit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Shuts down a hash table.]
+
+  Description [Shuts down a hash table, dereferencing all the values.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableInit]
+
+******************************************************************************/
+void
+cuddHashTableQuit(
+  DdHashTable * hash)
+{
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+    unsigned int i;
+    DdManager *dd = hash->manager;
+    DdHashItem *bucket;
+    DdHashItem **memlist, **nextmem;
+    unsigned int numBuckets = hash->numBuckets;
+
+    for (i = 0; i < numBuckets; i++) {
+	bucket = hash->bucket[i];
+	while (bucket != NULL) {
+	    Cudd_RecursiveDeref(dd, bucket->value);
+	    bucket = bucket->next;
+	}
+    }
+
+    memlist = hash->memoryList;
+    while (memlist != NULL) {
+	nextmem = (DdHashItem **) memlist[0];
+	FREE(memlist);
+	memlist = nextmem;
+    }
+
+    FREE(hash->bucket);
+    FREE(hash);
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+
+    return;
+
+} /* end of cuddHashTableQuit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts an item in a hash table.]
+
+  Description [Inserts an item in a hash table when the key has more than
+  three pointers.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [[cuddHashTableInsert1 cuddHashTableInsert2 cuddHashTableInsert3
+  cuddHashTableLookup]
+
+******************************************************************************/
+int
+cuddHashTableInsert(
+  DdHashTable * hash,
+  DdNodePtr * key,
+  DdNode * value,
+  ptrint count)
+{
+    int result;
+    unsigned int posn;
+    DdHashItem *item;
+    unsigned int i;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize > 3);
+#endif
+
+    if (hash->size > hash->maxsize) {
+	result = cuddHashTableResize(hash);
+	if (result == 0) return(0);
+    }
+    item = cuddHashTableAlloc(hash);
+    if (item == NULL) return(0);
+    hash->size++;
+    item->value = value;
+    cuddRef(value);
+    item->count = count;
+    for (i = 0; i < hash->keysize; i++) {
+	item->key[i] = key[i];
+    }
+    posn = ddLCHash(key,hash->keysize,hash->shift);
+    item->next = hash->bucket[posn];
+    hash->bucket[posn] = item;
+
+    return(1);
+
+} /* end of cuddHashTableInsert */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Looks up a key in a hash table.]
+
+  Description [Looks up a key consisting of more than three pointers
+  in a hash table.  Returns the value associated to the key if there
+  is an entry for the given key in the table; NULL otherwise. If the
+  entry is present, its reference counter is decremented if not
+  saturated. If the counter reaches 0, the value of the entry is
+  dereferenced, and the entry is returned to the free list.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableLookup1 cuddHashTableLookup2 cuddHashTableLookup3
+  cuddHashTableInsert]
+
+******************************************************************************/
+DdNode *
+cuddHashTableLookup(
+  DdHashTable * hash,
+  DdNodePtr * key)
+{
+    unsigned int posn;
+    DdHashItem *item, *prev;
+    unsigned int i, keysize;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize > 3);
+#endif
+
+    posn = ddLCHash(key,hash->keysize,hash->shift);
+    item = hash->bucket[posn];
+    prev = NULL;
+
+    keysize = hash->keysize;
+    while (item != NULL) {
+	DdNodePtr *key2 = item->key;
+	int equal = 1;
+	for (i = 0; i < keysize; i++) {
+	    if (key[i] != key2[i]) {
+		equal = 0;
+		break;
+	    }
+	}
+	if (equal) {
+	    DdNode *value = item->value;
+	    cuddSatDec(item->count);
+	    if (item->count == 0) {
+		cuddDeref(value);
+		if (prev == NULL) {
+		    hash->bucket[posn] = item->next;
+		} else {
+		    prev->next = item->next;
+		}
+		item->next = hash->nextFree;
+		hash->nextFree = item;
+		hash->size--;
+	    }
+	    return(value);
+	}
+	prev = item;
+	item = item->next;
+    }
+    return(NULL);
+
+} /* end of cuddHashTableLookup */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts an item in a hash table.]
+
+  Description [Inserts an item in a hash table when the key is one pointer.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableInsert cuddHashTableInsert2 cuddHashTableInsert3
+  cuddHashTableLookup1]
+
+******************************************************************************/
+int
+cuddHashTableInsert1(
+  DdHashTable * hash,
+  DdNode * f,
+  DdNode * value,
+  ptrint count)
+{
+    int result;
+    unsigned int posn;
+    DdHashItem *item;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize == 1);
+#endif
+
+    if (hash->size > hash->maxsize) {
+	result = cuddHashTableResize(hash);
+	if (result == 0) return(0);
+    }
+    item = cuddHashTableAlloc(hash);
+    if (item == NULL) return(0);
+    hash->size++;
+    item->value = value;
+    cuddRef(value);
+    item->count = count;
+    item->key[0] = f;
+    posn = ddLCHash2(f,f,hash->shift);
+    item->next = hash->bucket[posn];
+    hash->bucket[posn] = item;
+
+    return(1);
+
+} /* end of cuddHashTableInsert1 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Looks up a key consisting of one pointer in a hash table.]
+
+  Description [Looks up a key consisting of one pointer in a hash table.
+  Returns the value associated to the key if there is an entry for the given
+  key in the table; NULL otherwise. If the entry is present, its reference
+  counter is decremented if not saturated. If the counter reaches 0, the
+  value of the entry is dereferenced, and the entry is returned to the free
+  list.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableLookup cuddHashTableLookup2 cuddHashTableLookup3
+  cuddHashTableInsert1]
+
+******************************************************************************/
+DdNode *
+cuddHashTableLookup1(
+  DdHashTable * hash,
+  DdNode * f)
+{
+    unsigned int posn;
+    DdHashItem *item, *prev;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize == 1);
+#endif
+
+    posn = ddLCHash2(f,f,hash->shift);
+    item = hash->bucket[posn];
+    prev = NULL;
+
+    while (item != NULL) {
+	DdNodePtr *key = item->key;
+	if (f == key[0]) {
+	    DdNode *value = item->value;
+	    cuddSatDec(item->count);
+	    if (item->count == 0) {
+		cuddDeref(value);
+		if (prev == NULL) {
+		    hash->bucket[posn] = item->next;
+		} else {
+		    prev->next = item->next;
+		}
+		item->next = hash->nextFree;
+		hash->nextFree = item;
+		hash->size--;
+	    }
+	    return(value);
+	}
+	prev = item;
+	item = item->next;
+    }
+    return(NULL);
+
+} /* end of cuddHashTableLookup1 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts an item in a hash table.]
+
+  Description [Inserts an item in a hash table when the key is
+  composed of two pointers. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableInsert cuddHashTableInsert1 cuddHashTableInsert3
+  cuddHashTableLookup2]
+
+******************************************************************************/
+int
+cuddHashTableInsert2(
+  DdHashTable * hash,
+  DdNode * f,
+  DdNode * g,
+  DdNode * value,
+  ptrint count)
+{
+    int result;
+    unsigned int posn;
+    DdHashItem *item;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize == 2);
+#endif
+
+    if (hash->size > hash->maxsize) {
+	result = cuddHashTableResize(hash);
+	if (result == 0) return(0);
+    }
+    item = cuddHashTableAlloc(hash);
+    if (item == NULL) return(0);
+    hash->size++;
+    item->value = value;
+    cuddRef(value);
+    item->count = count;
+    item->key[0] = f;
+    item->key[1] = g;
+    posn = ddLCHash2(f,g,hash->shift);
+    item->next = hash->bucket[posn];
+    hash->bucket[posn] = item;
+
+    return(1);
+
+} /* end of cuddHashTableInsert2 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Looks up a key consisting of two pointers in a hash table.]
+
+  Description [Looks up a key consisting of two pointer in a hash table.
+  Returns the value associated to the key if there is an entry for the given
+  key in the table; NULL otherwise. If the entry is present, its reference
+  counter is decremented if not saturated. If the counter reaches 0, the
+  value of the entry is dereferenced, and the entry is returned to the free
+  list.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableLookup cuddHashTableLookup1 cuddHashTableLookup3
+  cuddHashTableInsert2]
+
+******************************************************************************/
+DdNode *
+cuddHashTableLookup2(
+  DdHashTable * hash,
+  DdNode * f,
+  DdNode * g)
+{
+    unsigned int posn;
+    DdHashItem *item, *prev;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize == 2);
+#endif
+
+    posn = ddLCHash2(f,g,hash->shift);
+    item = hash->bucket[posn];
+    prev = NULL;
+
+    while (item != NULL) {
+	DdNodePtr *key = item->key;
+	if ((f == key[0]) && (g == key[1])) {
+	    DdNode *value = item->value;
+	    cuddSatDec(item->count);
+	    if (item->count == 0) {
+		cuddDeref(value);
+		if (prev == NULL) {
+		    hash->bucket[posn] = item->next;
+		} else {
+		    prev->next = item->next;
+		}
+		item->next = hash->nextFree;
+		hash->nextFree = item;
+		hash->size--;
+	    }
+	    return(value);
+	}
+	prev = item;
+	item = item->next;
+    }
+    return(NULL);
+
+} /* end of cuddHashTableLookup2 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts an item in a hash table.]
+
+  Description [Inserts an item in a hash table when the key is
+  composed of three pointers. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableInsert cuddHashTableInsert1 cuddHashTableInsert2
+  cuddHashTableLookup3]
+
+******************************************************************************/
+int
+cuddHashTableInsert3(
+  DdHashTable * hash,
+  DdNode * f,
+  DdNode * g,
+  DdNode * h,
+  DdNode * value,
+  ptrint count)
+{
+    int result;
+    unsigned int posn;
+    DdHashItem *item;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize == 3);
+#endif
+
+    if (hash->size > hash->maxsize) {
+	result = cuddHashTableResize(hash);
+	if (result == 0) return(0);
+    }
+    item = cuddHashTableAlloc(hash);
+    if (item == NULL) return(0);
+    hash->size++;
+    item->value = value;
+    cuddRef(value);
+    item->count = count;
+    item->key[0] = f;
+    item->key[1] = g;
+    item->key[2] = h;
+    posn = ddLCHash3(f,g,h,hash->shift);
+    item->next = hash->bucket[posn];
+    hash->bucket[posn] = item;
+
+    return(1);
+
+} /* end of cuddHashTableInsert3 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Looks up a key consisting of three pointers in a hash table.]
+
+  Description [Looks up a key consisting of three pointers in a hash table.
+  Returns the value associated to the key if there is an entry for the given
+  key in the table; NULL otherwise. If the entry is present, its reference
+  counter is decremented if not saturated. If the counter reaches 0, the
+  value of the entry is dereferenced, and the entry is returned to the free
+  list.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableLookup cuddHashTableLookup1 cuddHashTableLookup2
+  cuddHashTableInsert3]
+
+******************************************************************************/
+DdNode *
+cuddHashTableLookup3(
+  DdHashTable * hash,
+  DdNode * f,
+  DdNode * g,
+  DdNode * h)
+{
+    unsigned int posn;
+    DdHashItem *item, *prev;
+
+#ifdef DD_DEBUG
+    assert(hash->keysize == 3);
+#endif
+
+    posn = ddLCHash3(f,g,h,hash->shift);
+    item = hash->bucket[posn];
+    prev = NULL;
+
+    while (item != NULL) {
+	DdNodePtr *key = item->key;
+	if ((f == key[0]) && (g == key[1]) && (h == key[2])) {
+	    DdNode *value = item->value;
+	    cuddSatDec(item->count);
+	    if (item->count == 0) {
+		cuddDeref(value);
+		if (prev == NULL) {
+		    hash->bucket[posn] = item->next;
+		} else {
+		    prev->next = item->next;
+		}
+		item->next = hash->nextFree;
+		hash->nextFree = item;
+		hash->size--;
+	    }
+	    return(value);
+	}
+	prev = item;
+	item = item->next;
+    }
+    return(NULL);
+
+} /* end of cuddHashTableLookup3 */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Resizes a local cache.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+cuddLocalCacheResize(
+  DdLocalCache * cache)
+{
+    DdLocalCacheItem *item, *olditem, *entry, *old;
+    int i, shift;
+    unsigned int posn;
+    unsigned int slots, oldslots;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    olditem = cache->item;
+    oldslots = cache->slots;
+    slots = cache->slots = oldslots << 1;
+
+#ifdef DD_VERBOSE
+    (void) fprintf(cache->manager->err,
+		   "Resizing local cache from %d to %d entries\n",
+		   oldslots, slots);
+    (void) fprintf(cache->manager->err,
+		   "\thits = %.0f\tlookups = %.0f\thit ratio = %5.3f\n",
+		   cache->hits, cache->lookUps, cache->hits / cache->lookUps);
+#endif
+
+    saveHandler = MMoutOfMemory;
+    MMoutOfMemory = Cudd_OutOfMem;
+    cache->item = item =
+	(DdLocalCacheItem *) ALLOC(char, slots * cache->itemsize);
+    MMoutOfMemory = saveHandler;
+    /* If we fail to allocate the new table we just give up. */
+    if (item == NULL) {
+#ifdef DD_VERBOSE
+	(void) fprintf(cache->manager->err,"Resizing failed. Giving up.\n");
+#endif
+	cache->slots = oldslots;
+	cache->item = olditem;
+	/* Do not try to resize again. */
+	cache->maxslots = oldslots - 1;
+	return;
+    }
+    shift = --(cache->shift);
+    cache->manager->memused += (slots - oldslots) * cache->itemsize;
+
+    /* Clear new cache. */
+    memset(item, 0, slots * cache->itemsize);
+
+    /* Copy from old cache to new one. */
+    for (i = 0; (unsigned) i < oldslots; i++) {
+	old = (DdLocalCacheItem *) ((char *) olditem + i * cache->itemsize);
+	if (old->value != NULL) {
+	    posn = ddLCHash(old->key,cache->keysize,shift);
+	    entry = (DdLocalCacheItem *) ((char *) item +
+					  posn * cache->itemsize);
+	    memcpy(entry->key,old->key,cache->keysize*sizeof(DdNode *));
+	    entry->value = old->value;	
+	}
+    }
+
+    FREE(olditem);
+
+    /* Reinitialize measurements so as to avoid division by 0 and
+    ** immediate resizing.
+    */
+    cache->lookUps = (double) (int) (slots * cache->minHit + 1);
+    cache->hits = 0;
+
+} /* end of cuddLocalCacheResize */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the hash value for a local cache.]
+
+  Description [Computes the hash value for a local cache. Returns the
+  bucket index.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DD_INLINE
+static unsigned int
+ddLCHash(
+  DdNodePtr * key,
+  unsigned int keysize,
+  int shift)
+{
+    unsigned int val = (unsigned int) (ptrint) key[0] * DD_P2;
+    unsigned int i;
+
+    for (i = 1; i < keysize; i++) {
+	val = val * DD_P1 + (int) (ptrint) key[i];
+    }
+
+    return(val >> shift);
+
+} /* end of ddLCHash */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts a local cache in the manager list.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+cuddLocalCacheAddToList(
+  DdLocalCache * cache)
+{
+    DdManager *manager = cache->manager;
+
+    cache->next = manager->localCaches;
+    manager->localCaches = cache;
+    return;
+
+} /* end of cuddLocalCacheAddToList */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Removes a local cache from the manager list.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+cuddLocalCacheRemoveFromList(
+  DdLocalCache * cache)
+{
+    DdManager *manager = cache->manager;
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+    DdLocalCache **prevCache, *nextCache;
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+
+    prevCache = &(manager->localCaches);
+    nextCache = manager->localCaches;
+
+    while (nextCache != NULL) {
+	if (nextCache == cache) {
+	    *prevCache = nextCache->next;
+	    return;
+	}
+	prevCache = &(nextCache->next);
+	nextCache = nextCache->next;
+    }
+    return;			/* should never get here */
+
+} /* end of cuddLocalCacheRemoveFromList */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Resizes a hash table.]
+
+  Description [Resizes a hash table. Returns 1 if successful; 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddHashTableInsert]
+
+******************************************************************************/
+static int
+cuddHashTableResize(
+  DdHashTable * hash)
+{
+    int j;
+    unsigned int posn;
+    DdHashItem *item;
+    DdHashItem *next;
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+    DdNode **key;
+    int numBuckets;
+    DdHashItem **buckets;
+    DdHashItem **oldBuckets = hash->bucket;
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+    int shift;
+    int oldNumBuckets = hash->numBuckets;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    /* Compute the new size of the table. */
+    numBuckets = oldNumBuckets << 1;
+    saveHandler = MMoutOfMemory;
+    MMoutOfMemory = Cudd_OutOfMem;
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+    buckets = ALLOC(DdHashItem *, numBuckets);
+    MMoutOfMemory = saveHandler;
+    if (buckets == NULL) {
+	hash->maxsize <<= 1;
+	return(1);
+    }
+
+    hash->bucket = buckets;
+    hash->numBuckets = numBuckets;
+    shift = --(hash->shift);
+    hash->maxsize <<= 1;
+    memset(buckets, 0, numBuckets * sizeof(DdHashItem *));
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+    if (hash->keysize == 1) {
+	for (j = 0; j < oldNumBuckets; j++) {
+	    item = oldBuckets[j];
+	    while (item != NULL) {
+		next = item->next;
+		key = item->key;
+		posn = ddLCHash2(key[0], key[0], shift);
+		item->next = buckets[posn];
+		buckets[posn] = item;
+		item = next;
+	    }
+	}
+    } else if (hash->keysize == 2) {
+	for (j = 0; j < oldNumBuckets; j++) {
+	    item = oldBuckets[j];
+	    while (item != NULL) {
+		next = item->next;
+		key = item->key;
+		posn = ddLCHash2(key[0], key[1], shift);
+		item->next = buckets[posn];
+		buckets[posn] = item;
+		item = next;
+	    }
+	}
+    } else if (hash->keysize == 3) {
+	for (j = 0; j < oldNumBuckets; j++) {
+	    item = oldBuckets[j];
+	    while (item != NULL) {
+		next = item->next;
+		key = item->key;
+		posn = ddLCHash3(key[0], key[1], key[2], shift);
+		item->next = buckets[posn];
+		buckets[posn] = item;
+		item = next;
+	    }
+	}
+    } else {
+	for (j = 0; j < oldNumBuckets; j++) {
+	    item = oldBuckets[j];
+	    while (item != NULL) {
+		next = item->next;
+		posn = ddLCHash(item->key, hash->keysize, shift);
+		item->next = buckets[posn];
+		buckets[posn] = item;
+		item = next;
+	    }
+	}
+    }
+    FREE(oldBuckets);
+    return(1);
+
+} /* end of cuddHashTableResize */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Fast storage allocation for items in a hash table.]
+
+  Description [Fast storage allocation for items in a hash table. The
+  first 4 bytes of a chunk contain a pointer to the next block; the
+  rest contains DD_MEM_CHUNK spaces for hash items.  Returns a pointer to
+  a new item if successful; NULL is memory is full.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddAllocNode cuddDynamicAllocNode]
+
+******************************************************************************/
+DD_INLINE
+static DdHashItem *
+cuddHashTableAlloc(
+  DdHashTable * hash)
+{
+    int i;
+    unsigned int itemsize = hash->itemsize;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+    DdHashItem **mem, *thisOne, *next, *item;
+
+    if (hash->nextFree == NULL) {
+	saveHandler = MMoutOfMemory;
+	MMoutOfMemory = Cudd_OutOfMem;
+	mem = (DdHashItem **) ALLOC(char,(DD_MEM_CHUNK+1) * itemsize);
+	MMoutOfMemory = saveHandler;
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+	if (mem == NULL) {
+	    if (hash->manager->stash != NULL) {
+		FREE(hash->manager->stash);
+		hash->manager->stash = NULL;
+		/* Inhibit resizing of tables. */
+		hash->manager->maxCacheHard = hash->manager->cacheSlots - 1;
+		hash->manager->cacheSlack = -(hash->manager->cacheSlots + 1);
+		for (i = 0; i < hash->manager->size; i++) {
+		    hash->manager->subtables[i].maxKeys <<= 2;
+		}
+		hash->manager->gcFrac = 0.2;
+		hash->manager->minDead =
+		    (unsigned) (0.2 * (double) hash->manager->slots);
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+		mem = (DdHashItem **) ALLOC(char,(DD_MEM_CHUNK+1) * itemsize);
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+	    }
+	    if (mem == NULL) {
+		(*MMoutOfMemory)((long)((DD_MEM_CHUNK + 1) * itemsize));
+		hash->manager->errorCode = CUDD_MEMORY_OUT;
+		return(NULL);
+	    }
+	}
+
+	mem[0] = (DdHashItem *) hash->memoryList;
+	hash->memoryList = mem;
+
+	thisOne = (DdHashItem *) ((char *) mem + itemsize);
+	hash->nextFree = thisOne;
+	for (i = 1; i < DD_MEM_CHUNK; i++) {
+	    next = (DdHashItem *) ((char *) thisOne + itemsize);
+	    thisOne->next = next;
+	    thisOne = next;
+	}
+
+	thisOne->next = NULL;
+
+    }
+    item = hash->nextFree;
+    hash->nextFree = item->next;
+    return(item);
+
+} /* end of cuddHashTableAlloc */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddSign.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddSign.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddSign.c	(revision 6)
@@ -0,0 +1,319 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddSign.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Computation of signatures]
+
+  Description [External procedures included in this module:
+		    <ul>
+		    <li> Cudd_CofMinterm();
+		    </ul>
+		Static procedures included in this module:
+		    <ul>
+		    <li> ddCofMintermAux()
+		    </ul>
+		    ]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddSign.c,v 1.21 2005/05/14 17:27:11 fabio Exp $";
+#endif
+
+static int    size;
+
+#ifdef DD_STATS
+static int num_calls;	/* should equal 2n-1 (n is the # of nodes) */
+static int table_mem;
+#endif
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static double * ddCofMintermAux (DdManager *dd, DdNode *node, st_table *table);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis [Computes the fraction of minterms in the on-set of all the
+  positive cofactors of a BDD or ADD.]
+
+  Description [Computes the fraction of minterms in the on-set of all
+  the positive cofactors of DD. Returns the pointer to an array of
+  doubles if successful; NULL otherwise. The array has as many
+  positions as there are BDD variables in the manager plus one. The
+  last position of the array contains the fraction of the minterms in
+  the ON-set of the function represented by the BDD or ADD. The other
+  positions of the array hold the variable signatures.]
+
+  SideEffects [None]
+
+******************************************************************************/
+double *
+Cudd_CofMinterm(
+  DdManager * dd,
+  DdNode * node)
+{
+    st_table	*table;
+    double	*values;
+    double	*result = NULL;
+    int		i, firstLevel;
+
+#ifdef DD_STATS
+    long startTime;
+    startTime = util_cpu_time();
+    num_calls = 0;
+    table_mem = sizeof(st_table);
+#endif
+
+    table = st_init_table(st_ptrcmp, st_ptrhash);
+    if (table == NULL) {
+	(void) fprintf(dd->err,
+		       "out-of-memory, couldn't measure DD cofactors.\n");
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    size = dd->size;
+    values = ddCofMintermAux(dd, node, table);
+    if (values != NULL) {
+	result = ALLOC(double,size + 1);
+	if (result != NULL) {
+#ifdef DD_STATS
+	    table_mem += (size + 1) * sizeof(double);
+#endif
+	    if (Cudd_IsConstant(node))
+		firstLevel = 1;
+	    else
+		firstLevel = cuddI(dd,Cudd_Regular(node)->index);
+	    for (i = 0; i < size; i++) {
+		if (i >= cuddI(dd,Cudd_Regular(node)->index)) {
+		    result[dd->invperm[i]] = values[i - firstLevel];
+		} else {
+		    result[dd->invperm[i]] = values[size - firstLevel];
+		}
+	    }
+	    result[size] = values[size - firstLevel];
+	} else {
+	    dd->errorCode = CUDD_MEMORY_OUT;
+	}
+    }
+
+#ifdef DD_STATS
+    table_mem += table->num_bins * sizeof(st_table_entry *);
+#endif
+    if (Cudd_Regular(node)->ref == 1) FREE(values);
+    st_foreach(table, cuddStCountfree, NULL);
+    st_free_table(table);
+#ifdef DD_STATS
+    (void) fprintf(dd->out,"Number of calls: %d\tTable memory: %d bytes\n",
+   		  num_calls, table_mem);
+    (void) fprintf(dd->out,"Time to compute measures: %s\n",
+		  util_print_time(util_cpu_time() - startTime));
+#endif
+    if (result == NULL) {
+	(void) fprintf(dd->out,
+		       "out-of-memory, couldn't measure DD cofactors.\n");
+	dd->errorCode = CUDD_MEMORY_OUT;
+    }
+    return(result);
+
+} /* end of Cudd_CofMinterm */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Recursive Step for Cudd_CofMinterm function.]
+
+  Description [Traverses the DD node and computes the fraction of
+  minterms in the on-set of all positive cofactors simultaneously.
+  It allocates an array with two more entries than there are
+  variables below the one labeling the node.  One extra entry (the
+  first in the array) is for the variable labeling the node. The other
+  entry (the last one in the array) holds the fraction of minterms of
+  the function rooted at node.  Each other entry holds the value for
+  one cofactor. The array is put in a symbol table, to avoid repeated
+  computation, and its address is returned by the procedure, for use
+  by the caller.  Returns a pointer to the array of cofactor measures.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static double *
+ddCofMintermAux(
+  DdManager * dd,
+  DdNode * node,
+  st_table * table)
+{
+    DdNode	*N;		/* regular version of node */
+    DdNode	*Nv, *Nnv;
+    double	*values;
+    double	*valuesT, *valuesE;
+    int		i;
+    int		localSize, localSizeT, localSizeE;
+    double	vT, vE;
+
+    statLine(dd);
+#ifdef DD_STATS
+    num_calls++;
+#endif
+
+    if (st_lookup(table, node, &values)) {
+	return(values);
+    }
+
+    N = Cudd_Regular(node);
+    if (cuddIsConstant(N)) {
+	localSize = 1;
+    } else {
+	localSize = size - cuddI(dd,N->index) + 1;
+    }
+    values = ALLOC(double, localSize);
+    if (values == NULL) {
+	dd->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+
+    if (cuddIsConstant(N)) {
+	if (node == DD_ZERO(dd) || node == Cudd_Not(DD_ONE(dd))) {
+	    values[0] = 0.0;
+	} else {
+	    values[0] = 1.0;
+	}
+    } else {
+	Nv = Cudd_NotCond(cuddT(N),N!=node);
+	Nnv = Cudd_NotCond(cuddE(N),N!=node);
+
+	valuesT = ddCofMintermAux(dd, Nv, table);
+	if (valuesT == NULL) return(NULL);
+	valuesE = ddCofMintermAux(dd, Nnv, table);
+	if (valuesE == NULL) return(NULL);
+
+	if (Cudd_IsConstant(Nv)) {
+	    localSizeT = 1;
+	} else {
+	    localSizeT = size - cuddI(dd,Cudd_Regular(Nv)->index) + 1;
+	}
+	if (Cudd_IsConstant(Nnv)) {
+	    localSizeE = 1;
+	} else {
+	    localSizeE = size - cuddI(dd,Cudd_Regular(Nnv)->index) + 1;
+	}
+	values[0] = valuesT[localSizeT - 1];
+	for (i = 1; i < localSize; i++) {
+	    if (i >= cuddI(dd,Cudd_Regular(Nv)->index) - cuddI(dd,N->index)) {
+		vT = valuesT[i - cuddI(dd,Cudd_Regular(Nv)->index) +
+			    cuddI(dd,N->index)];
+	    } else {
+		vT = valuesT[localSizeT - 1];
+	    }
+	    if (i >= cuddI(dd,Cudd_Regular(Nnv)->index) - cuddI(dd,N->index)) {
+		vE = valuesE[i - cuddI(dd,Cudd_Regular(Nnv)->index) +
+			    cuddI(dd,N->index)];
+	    } else {
+		vE = valuesE[localSizeE - 1];
+	    }
+	    values[i] = (vT + vE) / 2.0;
+	}
+	if (Cudd_Regular(Nv)->ref == 1) FREE(valuesT);
+	if (Cudd_Regular(Nnv)->ref == 1) FREE(valuesE);
+    }
+
+    if (N->ref > 1) {
+	if (st_add_direct(table, (char *) node, (char *) values) == ST_OUT_OF_MEM) {
+	    FREE(values);
+	    return(NULL);
+	}
+#ifdef DD_STATS
+	table_mem += localSize * sizeof(double) + sizeof(st_table_entry);
+#endif
+    }
+    return(values);
+
+} /* end of ddCofMintermAux */
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddSolve.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddSolve.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddSolve.c	(revision 6)
@@ -0,0 +1,366 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddSolve.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Boolean equation solver and related functions.]
+
+  Description [External functions included in this modoule:
+		<ul>
+		<li> Cudd_SolveEqn()
+		<li> Cudd_VerifySol()
+		</ul>
+	Internal functions included in this module:
+		<ul>
+		<li> cuddSolveEqnRecur()
+		<li> cuddVerifySol()
+		</ul> ]
+
+  SeeAlso     []
+
+  Author      [Balakrishna Kumthekar]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddSolve.c,v 1.12 2004/08/13 18:04:51 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the solution of F(x,y) = 0.]
+
+  Description [Implements the solution for F(x,y) = 0. The return
+  value is the consistency condition. The y variables are the unknowns
+  and the remaining variables are the parameters.  Returns the
+  consistency condition if successful; NULL otherwise. Cudd_SolveEqn
+  allocates an array and fills it with the indices of the
+  unknowns. This array is used by Cudd_VerifySol.]
+
+  SideEffects [The solution is returned in G; the indices of the y
+  variables are returned in yIndex.]
+
+  SeeAlso     [Cudd_VerifySol]
+
+******************************************************************************/
+DdNode *
+Cudd_SolveEqn(
+  DdManager *  bdd,
+  DdNode * F /* the left-hand side of the equation */,
+  DdNode * Y /* the cube of the y variables */,
+  DdNode ** G /* the array of solutions (return parameter) */,
+  int ** yIndex /* index of y variables */,
+  int  n /* numbers of unknowns */)
+{
+    DdNode *res;
+    int *temp;
+
+    *yIndex = temp = ALLOC(int, n);
+    if (temp == NULL) {
+	bdd->errorCode = CUDD_MEMORY_OUT;
+	(void) fprintf(bdd->out,
+		       "Cudd_SolveEqn: Out of memory for yIndex\n");
+	return(NULL);
+    }
+
+    do {
+	bdd->reordered = 0;
+	res = cuddSolveEqnRecur(bdd, F, Y, G, n, temp, 0);
+    } while (bdd->reordered == 1);
+
+    return(res);
+
+} /* end of Cudd_SolveEqn */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks the solution of F(x,y) = 0.]
+
+  Description [Checks the solution of F(x,y) = 0. This procedure 
+  substitutes the solution components for the unknowns of F and returns 
+  the resulting BDD for F.] 
+
+  SideEffects [Frees the memory pointed by yIndex.]
+
+  SeeAlso     [Cudd_SolveEqn]
+
+******************************************************************************/
+DdNode *
+Cudd_VerifySol(
+  DdManager *  bdd,
+  DdNode * F /* the left-hand side of the equation */,
+  DdNode ** G /* the array of solutions */,
+  int * yIndex /* index of y variables */,
+  int  n /* numbers of unknowns */)
+{
+    DdNode *res;
+
+    do {
+	bdd->reordered = 0;
+	res = cuddVerifySol(bdd, F, G, yIndex, n);
+    } while (bdd->reordered == 1);
+
+    FREE(yIndex);
+
+    return(res);
+
+} /* end of Cudd_VerifySol */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_SolveEqn.]
+
+  Description [Implements the recursive step of Cudd_SolveEqn. 
+  Returns NULL if the intermediate solution blows up
+  or reordering occurs. The parametric solutions are
+  stored in the array G.]
+
+  SideEffects [none]
+
+  SeeAlso     [Cudd_SolveEqn, Cudd_VerifySol]
+
+******************************************************************************/
+DdNode *
+cuddSolveEqnRecur(
+  DdManager * bdd,
+  DdNode * F /* the left-hand side of the equation */,
+  DdNode * Y /* the cube of remaining y variables */,
+  DdNode ** G /* the array of solutions */,
+  int  n /* number of unknowns */,
+  int * yIndex /* array holding the y variable indices */,
+  int  i /* level of recursion */)
+{
+    DdNode *Fn, *Fm1, *Fv, *Fvbar, *T, *w, *nextY, *one;
+    DdNodePtr *variables;
+
+    int j;
+
+    statLine(bdd);
+    variables = bdd->vars;
+    one = DD_ONE(bdd);
+
+    /* Base condition. */
+    if (Y == one) {
+	return F;
+    }
+
+    /* Cofactor of Y. */
+    yIndex[i] = Y->index;
+    nextY = Cudd_T(Y);
+
+    /* Universal abstraction of F with respect to the top variable index. */
+    Fm1 = cuddBddExistAbstractRecur(bdd, Cudd_Not(F), variables[yIndex[i]]);
+    if (Fm1) {
+	Fm1 = Cudd_Not(Fm1);
+	cuddRef(Fm1);
+    } else {
+	return(NULL);
+    }
+
+    Fn = cuddSolveEqnRecur(bdd, Fm1, nextY, G, n, yIndex, i+1);
+    if (Fn) {
+	cuddRef(Fn);
+    } else {
+	Cudd_RecursiveDeref(bdd, Fm1);
+	return(NULL);
+    }
+
+    Fv = cuddCofactorRecur(bdd, F, variables[yIndex[i]]);
+    if (Fv) {
+	cuddRef(Fv);
+    } else {
+	Cudd_RecursiveDeref(bdd, Fm1);
+	Cudd_RecursiveDeref(bdd, Fn);
+	return(NULL);
+    }
+
+    Fvbar = cuddCofactorRecur(bdd, F, Cudd_Not(variables[yIndex[i]]));
+    if (Fvbar) {
+	cuddRef(Fvbar);
+    } else {
+	Cudd_RecursiveDeref(bdd, Fm1);
+	Cudd_RecursiveDeref(bdd, Fn);
+	Cudd_RecursiveDeref(bdd, Fv);
+	return(NULL);
+    }
+
+    /* Build i-th component of the solution. */
+    w = cuddBddIteRecur(bdd, variables[yIndex[i]], Cudd_Not(Fv), Fvbar);
+    if (w) {
+	cuddRef(w);
+    } else {
+	Cudd_RecursiveDeref(bdd, Fm1);
+	Cudd_RecursiveDeref(bdd, Fn);
+	Cudd_RecursiveDeref(bdd, Fv);
+	Cudd_RecursiveDeref(bdd, Fvbar);
+	return(NULL);
+    }
+
+    T = cuddBddRestrictRecur(bdd, w, Cudd_Not(Fm1));
+    if(T) {
+	cuddRef(T);
+    } else {
+	Cudd_RecursiveDeref(bdd, Fm1);
+	Cudd_RecursiveDeref(bdd, Fn);
+	Cudd_RecursiveDeref(bdd, Fv);
+	Cudd_RecursiveDeref(bdd, Fvbar);
+	Cudd_RecursiveDeref(bdd, w);
+	return(NULL);
+    }
+
+    Cudd_RecursiveDeref(bdd,Fm1);
+    Cudd_RecursiveDeref(bdd,w);
+    Cudd_RecursiveDeref(bdd,Fv);
+    Cudd_RecursiveDeref(bdd,Fvbar);
+
+    /* Substitute components of solution already found into solution. */
+    for (j = n-1; j > i; j--) {
+	w = cuddBddComposeRecur(bdd,T, G[j], variables[yIndex[j]]);
+	if(w) {
+	    cuddRef(w);
+	} else {
+	    Cudd_RecursiveDeref(bdd, Fn);
+	    Cudd_RecursiveDeref(bdd, T);
+	    return(NULL);
+	}
+	Cudd_RecursiveDeref(bdd,T);
+	T = w;
+    }
+    G[i] = T;
+
+    Cudd_Deref(Fn);
+
+    return(Fn);
+
+} /* end of cuddSolveEqnRecur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_VerifySol. ]
+
+  Description []
+
+  SideEffects [none]
+
+  SeeAlso     [Cudd_VerifySol]
+
+******************************************************************************/
+DdNode *
+cuddVerifySol(
+  DdManager * bdd,
+  DdNode * F /* the left-hand side of the equation */,
+  DdNode ** G /* the array of solutions */,
+  int * yIndex /* array holding the y variable indices */,
+  int  n /* number of unknowns */)
+{
+    DdNode *w, *R;
+
+    int j;
+
+    R = F;
+    cuddRef(R);
+    for(j = n - 1; j >= 0; j--) {
+	 w = Cudd_bddCompose(bdd, R, G[j], yIndex[j]);
+	if (w) {
+	    cuddRef(w);
+	} else {
+	    return(NULL); 
+	}
+	Cudd_RecursiveDeref(bdd,R);
+	R = w;
+    }
+
+    cuddDeref(R);
+
+    return(R);
+
+} /* end of cuddVerifySol */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddSplit.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddSplit.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddSplit.c	(revision 6)
@@ -0,0 +1,684 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddSplit.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Returns a subset of minterms from a boolean function.]
+
+  Description [External functions included in this modoule:
+		<ul>
+		<li> Cudd_SplitSet()
+		</ul>
+	Internal functions included in this module:
+		<ul>
+		<li> cuddSplitSetRecur()
+		</u>
+        Static functions included in this module:
+		<ul>
+		<li> selectMintermsFromUniverse()
+		<li> mintermsFromUniverse()
+		<li> bddAnnotateMintermCount()
+		</ul> ]
+
+  SeeAlso     []
+
+  Author      [Balakrishna Kumthekar]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static DdNode * selectMintermsFromUniverse (DdManager *manager, int *varSeen, double n);
+static DdNode * mintermsFromUniverse (DdManager *manager, DdNode **vars, int numVars, double n, int index);
+static double bddAnnotateMintermCount (DdManager *manager, DdNode *node, double max, st_table *table);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns m minterms from a BDD.]
+
+  Description [Returns <code>m</code> minterms from a BDD whose
+  support has <code>n</code> variables at most.  The procedure tries
+  to create as few extra nodes as possible. The function represented
+  by <code>S</code> depends on at most <code>n</code> of the variables
+  in <code>xVars</code>. Returns a BDD with <code>m</code> minterms
+  of the on-set of S if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode *
+Cudd_SplitSet(
+  DdManager * manager,
+  DdNode * S,
+  DdNode ** xVars,
+  int  n,
+  double  m)
+{
+    DdNode *result;
+    DdNode *zero, *one;
+    double  max, num;
+    st_table *mtable;
+    int *varSeen;
+    int i,index, size;
+
+    size = manager->size;
+    one = DD_ONE(manager);
+    zero = Cudd_Not(one);
+
+    /* Trivial cases. */
+    if (m == 0.0) {
+	return(zero);
+    }
+    if (S == zero) {
+	return(NULL);
+    }
+
+    max = pow(2.0,(double)n);
+    if (m > max)
+	return(NULL);
+
+    do {
+	manager->reordered = 0;
+	/* varSeen is used to mark the variables that are encountered
+	** while traversing the BDD S.
+	*/
+	varSeen = ALLOC(int, size);
+	if (varSeen == NULL) {
+	    manager->errorCode = CUDD_MEMORY_OUT;
+	    return(NULL);
+	}
+	for (i = 0; i < size; i++) {
+	    varSeen[i] = -1;
+	}
+	for (i = 0; i < n; i++) {
+	    index = (xVars[i])->index;
+	    varSeen[manager->invperm[index]] = 0;
+	}
+
+	if (S == one) {
+	    if (m == max) 
+		return(S);
+	    result = selectMintermsFromUniverse(manager,varSeen,m);
+	    if (result)
+		cuddRef(result);
+	    FREE(varSeen);
+	} else {
+	    mtable = st_init_table(st_ptrcmp,st_ptrhash);
+	    if (mtable == NULL) {
+		(void) fprintf(manager->out,
+			       "Cudd_SplitSet: out-of-memory.\n");
+		FREE(varSeen);
+		manager->errorCode = CUDD_MEMORY_OUT;
+		return(NULL);
+	    }
+	    /* The nodes of BDD S are annotated by the number of minterms
+	    ** in their onset. The node and the number of minterms in its
+	    ** onset are stored in mtable.
+	    */
+	    num = bddAnnotateMintermCount(manager,S,max,mtable);
+	    if (m == num) {
+		st_foreach(mtable,cuddStCountfree,NIL(char));
+		st_free_table(mtable);
+		FREE(varSeen);
+		return(S);
+	    }
+	    
+	    result = cuddSplitSetRecur(manager,mtable,varSeen,S,m,max,0);
+	    if (result)
+		cuddRef(result);
+	    st_foreach(mtable,cuddStCountfree,NULL);
+	    st_free_table(mtable);
+	    FREE(varSeen);
+	}
+    } while (manager->reordered == 1);
+
+    cuddDeref(result);
+    return(result);
+
+} /* end of Cudd_SplitSet */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Implements the recursive step of Cudd_SplitSet.]
+
+  Description [Implements the recursive step of Cudd_SplitSet. The
+  procedure recursively traverses the BDD and checks to see if any
+  node satisfies the minterm requirements as specified by 'n'. At any
+  node X, n is compared to the number of minterms in the onset of X's
+  children. If either of the child nodes have exactly n minterms, then
+  that node is returned; else, if n is greater than the onset of one
+  of the child nodes, that node is retained and the difference in the
+  number of minterms is extracted from the other child. In case n
+  minterms can be extracted from constant 1, the algorithm returns the
+  result with at most log(n) nodes.]
+
+  SideEffects [The array 'varSeen' is updated at every recursive call
+  to set the variables traversed by the procedure.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode*
+cuddSplitSetRecur(
+  DdManager * manager,
+  st_table * mtable,
+  int * varSeen,
+  DdNode * p,
+  double  n,
+  double  max,
+  int  index)
+{
+    DdNode *one, *zero, *N, *Nv;
+    DdNode *Nnv, *q, *r, *v;
+    DdNode *result;
+    double *dummy, numT, numE;
+    int variable, positive;
+  
+    statLine(manager);
+    one = DD_ONE(manager);
+    zero = Cudd_Not(one);
+
+    /* If p is constant, extract n minterms from constant 1.  The procedure by
+    ** construction guarantees that minterms will not be extracted from
+    ** constant 0.
+    */
+    if (Cudd_IsConstant(p)) {
+	q = selectMintermsFromUniverse(manager,varSeen,n);
+	return(q);
+    }
+
+    N = Cudd_Regular(p);
+
+    /* Set variable as seen. */
+    variable = N->index;
+    varSeen[manager->invperm[variable]] = -1;
+
+    Nv = cuddT(N);
+    Nnv = cuddE(N);
+    if (Cudd_IsComplement(p)) {
+	Nv = Cudd_Not(Nv);
+	Nnv = Cudd_Not(Nnv);
+    }
+
+    /* If both the children of 'p' are constants, extract n minterms from a
+    ** constant node.
+    */
+    if (Cudd_IsConstant(Nv) && Cudd_IsConstant(Nnv)) {
+	q = selectMintermsFromUniverse(manager,varSeen,n);
+	if (q == NULL) {
+	    return(NULL);
+	}
+	cuddRef(q);
+	r = cuddBddAndRecur(manager,p,q);
+	if (r == NULL) {
+	    Cudd_RecursiveDeref(manager,q);
+	    return(NULL);
+	}
+	cuddRef(r);
+	Cudd_RecursiveDeref(manager,q);
+	cuddDeref(r);
+	return(r);
+    }
+  
+    /* Lookup the # of minterms in the onset of the node from the table. */
+    if (!Cudd_IsConstant(Nv)) {
+	st_lookup(mtable, Nv, &dummy);
+	numT = *dummy/(2*(1<<index));
+    } else if (Nv == one) {
+	numT = max/(2*(1<<index));
+    } else {
+	numT = 0;
+    }
+  
+    if (!Cudd_IsConstant(Nnv)) {
+	st_lookup(mtable, Nnv, &dummy);
+	numE = *dummy/(2*(1<<index));
+    } else if (Nnv == one) {
+	numE = max/(2*(1<<index));
+    } else {
+	numE = 0;
+    }
+
+    v = cuddUniqueInter(manager,variable,one,zero);
+    cuddRef(v);
+
+    /* If perfect match. */
+    if (numT == n) {
+	q = cuddBddAndRecur(manager,v,Nv);
+	if (q == NULL) {
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(q);
+	Cudd_RecursiveDeref(manager,v);
+	cuddDeref(q);
+	return(q);
+    }
+    if (numE == n) {
+	q = cuddBddAndRecur(manager,Cudd_Not(v),Nnv);
+	if (q == NULL) {
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(q);
+	Cudd_RecursiveDeref(manager,v);
+	cuddDeref(q);
+	return(q);
+    }
+    /* If n is greater than numT, extract the difference from the ELSE child
+    ** and retain the function represented by the THEN branch.
+    */
+    if (numT < n) {
+	q = cuddSplitSetRecur(manager,mtable,varSeen,
+			      Nnv,(n-numT),max,index+1);
+	if (q == NULL) {
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(q);
+	r = cuddBddIteRecur(manager,v,Nv,q);
+	if (r == NULL) {
+	    Cudd_RecursiveDeref(manager,q);
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(r);
+	Cudd_RecursiveDeref(manager,q);
+	Cudd_RecursiveDeref(manager,v);
+	cuddDeref(r);
+	return(r);
+    }
+    /* If n is greater than numE, extract the difference from the THEN child
+    ** and retain the function represented by the ELSE branch.
+    */
+    if (numE < n) {
+	q = cuddSplitSetRecur(manager,mtable,varSeen,
+			      Nv, (n-numE),max,index+1);
+	if (q == NULL) {
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(q);
+	r = cuddBddIteRecur(manager,v,q,Nnv);
+	if (r == NULL) {
+	    Cudd_RecursiveDeref(manager,q);
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(r);
+	Cudd_RecursiveDeref(manager,q);
+	Cudd_RecursiveDeref(manager,v);
+	cuddDeref(r);    
+	return(r);
+    }
+
+    /* None of the above cases; (n < numT and n < numE) and either of
+    ** the Nv, Nnv or both are not constants. If possible extract the
+    ** required minterms the constant branch.
+    */
+    if (Cudd_IsConstant(Nv) && !Cudd_IsConstant(Nnv)) {
+	q = selectMintermsFromUniverse(manager,varSeen,n);
+	if (q == NULL) {
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(q);
+	result = cuddBddAndRecur(manager,v,q);
+	if (result == NULL) {
+	    Cudd_RecursiveDeref(manager,q);
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(result);
+	Cudd_RecursiveDeref(manager,q);
+	Cudd_RecursiveDeref(manager,v);
+	cuddDeref(result);
+	return(result);
+    } else if (!Cudd_IsConstant(Nv) && Cudd_IsConstant(Nnv)) {
+	q = selectMintermsFromUniverse(manager,varSeen,n);
+	if (q == NULL) {
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(q);
+	result = cuddBddAndRecur(manager,Cudd_Not(v),q);
+	if (result == NULL) {
+	    Cudd_RecursiveDeref(manager,q);
+	    Cudd_RecursiveDeref(manager,v);
+	    return(NULL);
+	}
+	cuddRef(result);
+	Cudd_RecursiveDeref(manager,q);
+	Cudd_RecursiveDeref(manager,v);
+	cuddDeref(result);
+	return(result);
+    }
+
+    /* Both Nv and Nnv are not constants. So choose the one which
+    ** has fewer minterms in its onset.
+    */
+    positive = 0;
+    if (numT < numE) {
+	q = cuddSplitSetRecur(manager,mtable,varSeen,
+			      Nv,n,max,index+1);
+	positive = 1;
+    } else {
+	q = cuddSplitSetRecur(manager,mtable,varSeen,
+			      Nnv,n,max,index+1);
+    }
+
+    if (q == NULL) {
+	Cudd_RecursiveDeref(manager,v);
+	return(NULL);
+    }
+    cuddRef(q);
+
+    if (positive) {
+	result = cuddBddAndRecur(manager,v,q);
+    } else {
+	result = cuddBddAndRecur(manager,Cudd_Not(v),q);
+    }
+    if (result == NULL) {
+	Cudd_RecursiveDeref(manager,q);
+	Cudd_RecursiveDeref(manager,v);
+	return(NULL);
+    }
+    cuddRef(result);
+    Cudd_RecursiveDeref(manager,q);
+    Cudd_RecursiveDeref(manager,v);
+    cuddDeref(result);
+
+    return(result);
+
+} /* end of cuddSplitSetRecur */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis [This function prepares an array of variables which have not been
+  encountered so far when traversing the procedure cuddSplitSetRecur.]
+
+  Description [This function prepares an array of variables which have not been
+  encountered so far when traversing the procedure cuddSplitSetRecur. This
+  array is then used to extract the required number of minterms from a constant
+  1. The algorithm guarantees that the size of BDD will be utmost \log(n).]
+
+  SideEffects [None]
+
+******************************************************************************/
+static DdNode *
+selectMintermsFromUniverse(
+  DdManager * manager,
+  int * varSeen,
+  double  n)
+{
+    int numVars;
+    int i, size, j;
+     DdNode *one, *zero, *result;
+    DdNode **vars;
+
+    numVars = 0;
+    size = manager->size;
+    one = DD_ONE(manager);
+    zero = Cudd_Not(one);
+
+    /* Count the number of variables not encountered so far in procedure
+    ** cuddSplitSetRecur.
+    */
+    for (i = size-1; i >= 0; i--) {
+	if(varSeen[i] == 0)
+	    numVars++;
+    }
+    vars = ALLOC(DdNode *, numVars);
+    if (!vars) {
+	manager->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+
+    j = 0;
+    for (i = size-1; i >= 0; i--) {
+	if(varSeen[i] == 0) {
+	    vars[j] = cuddUniqueInter(manager,manager->perm[i],one,zero);
+	    cuddRef(vars[j]);
+	    j++;
+	}
+    }
+
+    /* Compute a function which has n minterms and depends on at most
+    ** numVars variables.
+    */
+    result = mintermsFromUniverse(manager,vars,numVars,n, 0);
+    if (result) 
+	cuddRef(result);
+
+    for (i = 0; i < numVars; i++)
+	Cudd_RecursiveDeref(manager,vars[i]);
+    FREE(vars);
+
+    return(result);
+
+} /* end of selectMintermsFromUniverse */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Recursive procedure to extract n mintems from constant 1.]
+
+  Description [Recursive procedure to extract n mintems from constant 1.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static DdNode *
+mintermsFromUniverse(
+  DdManager * manager,
+  DdNode ** vars,
+  int  numVars,
+  double  n,
+  int  index)
+{
+    DdNode *one, *zero;
+    DdNode *q, *result;
+    double max, max2;
+    
+    statLine(manager);
+    one = DD_ONE(manager);
+    zero = Cudd_Not(one);
+
+    max = pow(2.0, (double)numVars);
+    max2 = max / 2.0;
+
+    if (n == max)
+	return(one);
+    if (n == 0.0)
+	return(zero);
+    /* if n == 2^(numVars-1), return a single variable */
+    if (n == max2)
+	return vars[index];
+    else if (n > max2) {
+	/* When n > 2^(numVars-1), a single variable vars[index]
+	** contains 2^(numVars-1) minterms. The rest are extracted
+	** from a constant with 1 less variable.
+	*/
+	q = mintermsFromUniverse(manager,vars,numVars-1,(n-max2),index+1);
+	if (q == NULL)
+	    return(NULL);
+	cuddRef(q);
+	result = cuddBddIteRecur(manager,vars[index],one,q);
+    } else {
+	/* When n < 2^(numVars-1), a literal of variable vars[index]
+	** is selected. The required n minterms are extracted from a
+	** constant with 1 less variable.
+	*/
+	q = mintermsFromUniverse(manager,vars,numVars-1,n,index+1);
+	if (q == NULL)
+	    return(NULL);
+	cuddRef(q);
+	result = cuddBddAndRecur(manager,vars[index],q);
+    }
+    
+    if (result == NULL) {
+	Cudd_RecursiveDeref(manager,q);
+	return(NULL);
+    }
+    cuddRef(result);
+    Cudd_RecursiveDeref(manager,q);
+    cuddDeref(result);
+    return(result);
+
+} /* end of mintermsFromUniverse */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Annotates every node in the BDD node with its minterm count.]
+
+  Description [Annotates every node in the BDD node with its minterm count.
+  In this function, every node and the minterm count represented by it are
+  stored in a hash table.]
+
+  SideEffects [Fills up 'table' with the pair <node,minterm_count>.]
+
+******************************************************************************/
+static double
+bddAnnotateMintermCount(
+  DdManager * manager,
+  DdNode * node,
+  double  max,
+  st_table * table)
+{
+
+    DdNode *N,*Nv,*Nnv;
+    register double min_v,min_nv;
+    register double min_N;
+    double *pmin;
+    double *dummy;
+
+    statLine(manager);
+    N = Cudd_Regular(node);
+    if (cuddIsConstant(N)) {
+	if (node == DD_ONE(manager)) {
+	    return(max);
+	} else {
+	    return(0.0);
+	}
+    }
+
+    if (st_lookup(table, node, &dummy)) {
+	return(*dummy);
+    }	
+  
+    Nv = cuddT(N);
+    Nnv = cuddE(N);
+    if (N != node) {
+	Nv = Cudd_Not(Nv);
+	Nnv = Cudd_Not(Nnv);
+    }
+
+    /* Recur on the two branches. */
+    min_v  = bddAnnotateMintermCount(manager,Nv,max,table) / 2.0;
+    if (min_v == (double)CUDD_OUT_OF_MEM)
+	return ((double)CUDD_OUT_OF_MEM);
+    min_nv = bddAnnotateMintermCount(manager,Nnv,max,table) / 2.0;
+    if (min_nv == (double)CUDD_OUT_OF_MEM)
+	return ((double)CUDD_OUT_OF_MEM);
+    min_N  = min_v + min_nv;
+
+    pmin = ALLOC(double,1);
+    if (pmin == NULL) {
+	manager->errorCode = CUDD_MEMORY_OUT;
+	return((double)CUDD_OUT_OF_MEM);
+    }
+    *pmin = min_N;
+
+    if (st_insert(table,(char *)node, (char *)pmin) == ST_OUT_OF_MEM) {
+	FREE(pmin);
+	return((double)CUDD_OUT_OF_MEM);
+    }
+    
+    return(min_N);
+
+} /* end of bddAnnotateMintermCount */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddTable.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddTable.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddTable.c	(revision 6)
@@ -0,0 +1,3098 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddTable.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Unique table management functions.]
+
+  Description [External procedures included in this module:
+		<ul>
+		<li> Cudd_Prime()
+		</ul>
+	Internal procedures included in this module:
+		<ul>
+		<li> cuddAllocNode()
+		<li> cuddInitTable()
+		<li> cuddFreeTable()
+		<li> cuddGarbageCollect()
+		<li> cuddZddGetNode()
+		<li> cuddZddGetNodeIVO()
+		<li> cuddUniqueInter()
+		<li> cuddUniqueInterIVO()
+		<li> cuddUniqueInterZdd()
+		<li> cuddUniqueConst()
+		<li> cuddRehash()
+		<li> cuddShrinkSubtable()
+		<li> cuddInsertSubtables()
+		<li> cuddDestroySubtables()
+		<li> cuddResizeTableZdd()
+		<li> cuddSlowTableGrowth()
+		</ul>
+	Static procedures included in this module:
+		<ul>
+		<li> ddRehashZdd()
+		<li> ddResizeTable()
+		<li> cuddFindParent()
+		<li> cuddOrderedInsert()
+		<li> cuddOrderedThread()
+		<li> cuddRotateLeft()
+		<li> cuddRotateRight()
+		<li> cuddDoRebalance()
+		<li> cuddCheckCollisionOrdering()
+		</ul>]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+/* Constants for red/black trees. */
+#define DD_STACK_SIZE 128
+#define DD_RED   0
+#define DD_BLACK 1
+#define DD_PAGE_SIZE 8192
+#define DD_PAGE_MASK ~(DD_PAGE_SIZE - 1)
+#endif
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/* This is a hack for when CUDD_VALUE_TYPE is double */
+typedef union hack {
+    CUDD_VALUE_TYPE value;
+    unsigned int bits[2];
+} hack;
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddTable.c,v 1.119 2004/08/13 18:04:52 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+/* Macros for red/black trees. */
+#define DD_INSERT_COMPARE(x,y) \
+	(((ptruint) (x) & DD_PAGE_MASK) - ((ptruint) (y) & DD_PAGE_MASK))
+#define DD_COLOR(p)  ((p)->index)
+#define DD_IS_BLACK(p) ((p)->index == DD_BLACK)
+#define DD_IS_RED(p) ((p)->index == DD_RED)
+#define DD_LEFT(p) cuddT(p)
+#define DD_RIGHT(p) cuddE(p)
+#define DD_NEXT(p) ((p)->next)
+#endif
+#endif
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void ddRehashZdd (DdManager *unique, int i);
+static int ddResizeTable (DdManager *unique, int index);
+static int cuddFindParent (DdManager *table, DdNode *node);
+DD_INLINE static void ddFixLimits (DdManager *unique);
+#ifdef DD_RED_BLACK_FREE_LIST
+static void cuddOrderedInsert (DdNodePtr *root, DdNodePtr node);
+static DdNode * cuddOrderedThread (DdNode *root, DdNode *list);
+static void cuddRotateLeft (DdNodePtr *nodeP);
+static void cuddRotateRight (DdNodePtr *nodeP);
+static void cuddDoRebalance (DdNodePtr **stack, int stackN);
+#endif
+static void ddPatchTree (DdManager *dd, MtrNode *treenode);
+#ifdef DD_DEBUG
+static int cuddCheckCollisionOrdering (DdManager *unique, int i, int j);
+#endif
+static void ddReportRefMess (DdManager *unique, int i, const char *caller);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the next prime &gt;= p.]
+
+  Description []
+
+  SideEffects [None]
+
+******************************************************************************/
+unsigned int
+Cudd_Prime(
+  unsigned int  p)
+{
+    int i,pn;
+
+    p--;
+    do {
+        p++;
+        if (p&1) {
+	    pn = 1;
+	    i = 3;
+	    while ((unsigned) (i * i) <= p) {
+		if (p % i == 0) {
+		    pn = 0;
+		    break;
+		}
+		i += 2;
+	    }
+	} else {
+	    pn = 0;
+	}
+    } while (!pn);
+    return(p);
+
+} /* end of Cudd_Prime */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Fast storage allocation for DdNodes in the table.]
+
+  Description [Fast storage allocation for DdNodes in the table. The
+  first 4 bytes of a chunk contain a pointer to the next block; the
+  rest contains DD_MEM_CHUNK spaces for DdNodes.  Returns a pointer to
+  a new node if successful; NULL is memory is full.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddDynamicAllocNode]
+
+******************************************************************************/
+DdNode *
+cuddAllocNode(
+  DdManager * unique)
+{
+    int i;
+    DdNodePtr *mem;
+    DdNode *list, *node;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    if (unique->nextFree == NULL) {	/* free list is empty */
+	/* Check for exceeded limits. */
+	if ((unique->keys - unique->dead) + (unique->keysZ - unique->deadZ) >
+	    unique->maxLive) {
+	    unique->errorCode = CUDD_TOO_MANY_NODES;
+	    return(NULL);
+	}
+	if (unique->stash == NULL || unique->memused > unique->maxmemhard) {
+	    (void) cuddGarbageCollect(unique,1);
+	    mem = NULL;
+	}
+	if (unique->nextFree == NULL) {
+	    if (unique->memused > unique->maxmemhard) {
+		unique->errorCode = CUDD_MAX_MEM_EXCEEDED;
+		return(NULL);
+	    }
+	    /* Try to allocate a new block. */
+	    saveHandler = MMoutOfMemory;
+	    MMoutOfMemory = Cudd_OutOfMem;
+	    mem = (DdNodePtr *) ALLOC(DdNode,DD_MEM_CHUNK + 1);
+	    MMoutOfMemory = saveHandler;
+	    if (mem == NULL) {
+		/* No more memory: Try collecting garbage. If this succeeds,
+		** we end up with mem still NULL, but unique->nextFree !=
+		** NULL. */
+		if (cuddGarbageCollect(unique,1) == 0) {
+		    /* Last resort: Free the memory stashed away, if there
+		    ** any. If this succeeeds, mem != NULL and
+		    ** unique->nextFree still NULL. */
+		    if (unique->stash != NULL) {
+			FREE(unique->stash);
+			unique->stash = NULL;
+			/* Inhibit resizing of tables. */
+			cuddSlowTableGrowth(unique);
+			/* Now try again. */
+			mem = (DdNodePtr *) ALLOC(DdNode,DD_MEM_CHUNK + 1);
+		    }
+		    if (mem == NULL) {
+			/* Out of luck. Call the default handler to do
+			** whatever it specifies for a failed malloc.
+			** If this handler returns, then set error code,
+			** print warning, and return. */
+			(*MMoutOfMemory)(sizeof(DdNode)*(DD_MEM_CHUNK + 1));
+			unique->errorCode = CUDD_MEMORY_OUT;
+#ifdef DD_VERBOSE
+			(void) fprintf(unique->err,
+				       "cuddAllocNode: out of memory");
+			(void) fprintf(unique->err, "Memory in use = %lu\n",
+				       unique->memused);
+#endif
+			return(NULL);
+		    }
+		}
+	    }
+	    if (mem != NULL) {	/* successful allocation; slice memory */
+		ptruint offset;
+		unique->memused += (DD_MEM_CHUNK + 1) * sizeof(DdNode);
+		mem[0] = (DdNodePtr) unique->memoryList;
+		unique->memoryList = mem;
+
+		/* Here we rely on the fact that a DdNode is as large
+		** as 4 pointers.  */
+		offset = (ptruint) mem & (sizeof(DdNode) - 1);
+		mem += (sizeof(DdNode) - offset) / sizeof(DdNodePtr);
+		assert(((ptruint) mem & (sizeof(DdNode) - 1)) == 0);
+		list = (DdNode *) mem;
+
+		i = 1;
+		do {
+		    list[i - 1].ref = 0;
+		    list[i - 1].next = &list[i];
+		} while (++i < DD_MEM_CHUNK);
+
+		list[DD_MEM_CHUNK-1].ref = 0;
+		list[DD_MEM_CHUNK-1].next = NULL;
+
+		unique->nextFree = &list[0];
+	    }
+	}
+    }
+    unique->allocated++;
+    node = unique->nextFree;
+    unique->nextFree = node->next;
+    return(node);
+
+} /* end of cuddAllocNode */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates and initializes the unique table.]
+
+  Description [Creates and initializes the unique table. Returns a pointer
+  to the table if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_Init cuddFreeTable]
+
+******************************************************************************/
+DdManager *
+cuddInitTable(
+  unsigned int numVars  /* Initial number of BDD variables (and subtables) */,
+  unsigned int numVarsZ /* Initial number of ZDD variables (and subtables) */,
+  unsigned int numSlots /* Initial size of the BDD subtables */,
+  unsigned int looseUpTo /* Limit for fast table growth */)
+{
+    DdManager	*unique = ALLOC(DdManager,1);
+    int		i, j;
+    DdNodePtr	*nodelist;
+    DdNode	*sentinel;
+    unsigned int slots;
+    int shift;
+
+    if (unique == NULL) {
+	return(NULL);
+    }
+    sentinel = &(unique->sentinel);
+    sentinel->ref = 0;
+    sentinel->index = 0;
+    cuddT(sentinel) = NULL;
+    cuddE(sentinel) = NULL;
+    sentinel->next = NULL;
+    unique->epsilon = DD_EPSILON;
+    unique->maxGrowth = DD_MAX_REORDER_GROWTH;
+    unique->maxGrowthAlt = 2.0 * DD_MAX_REORDER_GROWTH;
+    unique->reordCycle = 0;	/* do not use alternate threshold */
+    unique->size = numVars;
+    unique->sizeZ = numVarsZ;
+    unique->maxSize = ddMax(DD_DEFAULT_RESIZE, numVars);
+    unique->maxSizeZ = ddMax(DD_DEFAULT_RESIZE, numVarsZ);
+
+    /* Adjust the requested number of slots to a power of 2. */
+    slots = 8;
+    while (slots < numSlots) {
+	slots <<= 1;
+    }
+    unique->initSlots = slots;
+    shift = sizeof(int) * 8 - cuddComputeFloorLog2(slots);
+
+    unique->slots = (numVars + numVarsZ + 1) * slots;
+    unique->keys = 0;
+    unique->maxLive = ~0;	/* very large number */
+    unique->keysZ = 0;
+    unique->dead = 0;
+    unique->deadZ = 0;
+    unique->gcFrac = DD_GC_FRAC_HI;
+    unique->minDead = (unsigned) (DD_GC_FRAC_HI * (double) unique->slots);
+    unique->looseUpTo = looseUpTo;
+    unique->gcEnabled = 1;
+    unique->allocated = 0;
+    unique->reclaimed = 0;
+    unique->subtables = ALLOC(DdSubtable,unique->maxSize);
+    if (unique->subtables == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->subtableZ = ALLOC(DdSubtable,unique->maxSizeZ);
+    if (unique->subtableZ == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->perm = ALLOC(int,unique->maxSize);
+    if (unique->perm == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->invperm = ALLOC(int,unique->maxSize);
+    if (unique->invperm == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->permZ = ALLOC(int,unique->maxSizeZ);
+    if (unique->permZ == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->invpermZ = ALLOC(int,unique->maxSizeZ);
+    if (unique->invpermZ == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->map = NULL;
+    unique->stack = ALLOC(DdNodePtr,ddMax(unique->maxSize,unique->maxSizeZ)+1);
+    if (unique->stack == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    unique->stack[0] = NULL; /* to suppress harmless UMR */
+
+#ifndef DD_NO_DEATH_ROW
+    unique->deathRowDepth = 1 << cuddComputeFloorLog2(unique->looseUpTo >> 2);
+    unique->deathRow = ALLOC(DdNodePtr,unique->deathRowDepth);
+    if (unique->deathRow == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(0);
+    }
+    for (i = 0; i < unique->deathRowDepth; i++) {
+	unique->deathRow[i] = NULL;
+    }
+    unique->nextDead = 0;
+    unique->deadMask = unique->deathRowDepth - 1;
+#endif
+
+    for (i = 0; (unsigned) i < numVars; i++) {
+	unique->subtables[i].slots = slots;
+	unique->subtables[i].shift = shift;
+	unique->subtables[i].keys = 0;
+	unique->subtables[i].dead = 0;
+	unique->subtables[i].maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+	unique->subtables[i].bindVar = 0;
+	unique->subtables[i].varType = CUDD_VAR_PRIMARY_INPUT;
+	unique->subtables[i].pairIndex = 0;
+	unique->subtables[i].varHandled = 0;
+	unique->subtables[i].varToBeGrouped = CUDD_LAZY_NONE;
+
+	nodelist = unique->subtables[i].nodelist = ALLOC(DdNodePtr,slots);
+	if (nodelist == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(NULL);
+	}
+	for (j = 0; (unsigned) j < slots; j++) {
+	    nodelist[j] = sentinel;
+	}
+	unique->perm[i] = i;
+	unique->invperm[i] = i;
+    }
+    for (i = 0; (unsigned) i < numVarsZ; i++) {
+	unique->subtableZ[i].slots = slots;
+	unique->subtableZ[i].shift = shift;
+	unique->subtableZ[i].keys = 0;
+	unique->subtableZ[i].dead = 0;
+	unique->subtableZ[i].maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+	nodelist = unique->subtableZ[i].nodelist = ALLOC(DdNodePtr,slots);
+	if (nodelist == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(NULL);
+	}
+	for (j = 0; (unsigned) j < slots; j++) {
+	    nodelist[j] = NULL;
+	}
+	unique->permZ[i] = i;
+	unique->invpermZ[i] = i;
+    }
+    unique->constants.slots = slots;
+    unique->constants.shift = shift;
+    unique->constants.keys = 0;
+    unique->constants.dead = 0;
+    unique->constants.maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+    nodelist = unique->constants.nodelist = ALLOC(DdNodePtr,slots);
+    if (nodelist == NULL) {
+	unique->errorCode = CUDD_MEMORY_OUT;
+	return(NULL);
+    }
+    for (j = 0; (unsigned) j < slots; j++) {
+	nodelist[j] = NULL;
+    }
+
+    unique->memoryList = NULL;
+    unique->nextFree = NULL;
+
+    unique->memused = sizeof(DdManager) + (unique->maxSize + unique->maxSizeZ)
+	* (sizeof(DdSubtable) + 2 * sizeof(int)) + (numVars + 1) *
+	slots * sizeof(DdNodePtr) +
+	(ddMax(unique->maxSize,unique->maxSizeZ) + 1) * sizeof(DdNodePtr);
+#ifndef DD_NO_DEATH_ROW
+    unique->memused += unique->deathRowDepth * sizeof(DdNodePtr);
+#endif
+
+    /* Initialize fields concerned with automatic dynamic reordering */
+    unique->reorderings = 0;
+    unique->autoDyn = 0;	/* initially disabled */
+    unique->autoDynZ = 0;	/* initially disabled */
+    unique->realign = 0;	/* initially disabled */
+    unique->realignZ = 0;	/* initially disabled */
+    unique->reordered = 0;
+    unique->autoMethod = CUDD_REORDER_SIFT;
+    unique->autoMethodZ = CUDD_REORDER_SIFT;
+    unique->nextDyn = DD_FIRST_REORDER;
+    unique->countDead = ~0;
+    unique->siftMaxVar = DD_SIFT_MAX_VAR;
+    unique->siftMaxSwap = DD_SIFT_MAX_SWAPS;
+    unique->tree = NULL;
+    unique->treeZ = NULL;
+    unique->groupcheck = CUDD_GROUP_CHECK7;
+    unique->recomb = DD_DEFAULT_RECOMB;
+    unique->symmviolation = 0;
+    unique->arcviolation = 0;
+    unique->populationSize = 0;
+    unique->numberXovers = 0;
+    unique->linear = NULL;
+    unique->linearSize = 0;
+
+    /* Initialize ZDD universe. */
+    unique->univ = (DdNodePtr *)NULL;
+
+    /* Initialize auxiliary fields. */
+    unique->localCaches = NULL;
+    unique->preGCHook = NULL;
+    unique->postGCHook = NULL;
+    unique->preReorderingHook = NULL;
+    unique->postReorderingHook = NULL;
+    unique->out = stdout;
+    unique->err = stderr;
+    unique->errorCode = CUDD_NO_ERROR;
+
+    /* Initialize statistical counters. */
+    unique->maxmemhard = (unsigned long) ((~ (unsigned long) 0) >> 1);
+    unique->garbageCollections = 0;
+    unique->GCTime = 0;
+    unique->reordTime = 0;
+#ifdef DD_STATS
+    unique->nodesDropped = 0;
+    unique->nodesFreed = 0;
+#endif
+    unique->peakLiveNodes = 0;
+#ifdef DD_UNIQUE_PROFILE
+    unique->uniqueLookUps = 0;
+    unique->uniqueLinks = 0;
+#endif
+#ifdef DD_COUNT
+    unique->recursiveCalls = 0;
+    unique->swapSteps = 0;
+#ifdef DD_STATS
+    unique->nextSample = 250000;
+#endif
+#endif
+
+    return(unique);
+
+} /* end of cuddInitTable */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees the resources associated to a unique table.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [cuddInitTable]
+
+******************************************************************************/
+void
+cuddFreeTable(
+  DdManager * unique)
+{
+    DdNodePtr *next;
+    DdNodePtr *memlist = unique->memoryList;
+    int i;
+
+    if (unique->univ != NULL) cuddZddFreeUniv(unique);
+    while (memlist != NULL) {
+        next = (DdNodePtr *) memlist[0];	/* link to next block */
+	FREE(memlist);
+	memlist = next;
+    }
+    unique->nextFree = NULL;
+    unique->memoryList = NULL;
+
+    for (i = 0; i < unique->size; i++) {
+	FREE(unique->subtables[i].nodelist);
+    }
+    for (i = 0; i < unique->sizeZ; i++) {
+	FREE(unique->subtableZ[i].nodelist);
+    }
+    FREE(unique->constants.nodelist);
+    FREE(unique->subtables);
+    FREE(unique->subtableZ);
+    FREE(unique->acache);
+    FREE(unique->perm);
+    FREE(unique->permZ);
+    FREE(unique->invperm);
+    FREE(unique->invpermZ);
+    FREE(unique->vars);
+    if (unique->map != NULL) FREE(unique->map);
+    FREE(unique->stack);
+#ifndef DD_NO_DEATH_ROW
+    FREE(unique->deathRow);
+#endif
+    if (unique->tree != NULL) Mtr_FreeTree(unique->tree);
+    if (unique->treeZ != NULL) Mtr_FreeTree(unique->treeZ);
+    if (unique->linear != NULL) FREE(unique->linear);
+    while (unique->preGCHook != NULL)
+	Cudd_RemoveHook(unique,unique->preGCHook->f,CUDD_PRE_GC_HOOK);
+    while (unique->postGCHook != NULL)
+	Cudd_RemoveHook(unique,unique->postGCHook->f,CUDD_POST_GC_HOOK);
+    while (unique->preReorderingHook != NULL)
+	Cudd_RemoveHook(unique,unique->preReorderingHook->f,
+			CUDD_PRE_REORDERING_HOOK);
+    while (unique->postReorderingHook != NULL)
+	Cudd_RemoveHook(unique,unique->postReorderingHook->f,
+			CUDD_POST_REORDERING_HOOK);
+    FREE(unique);
+
+} /* end of cuddFreeTable */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs garbage collection on the unique tables.]
+
+  Description [Performs garbage collection on the BDD and ZDD unique tables.
+  If clearCache is 0, the cache is not cleared. This should only be
+  specified if the cache has been cleared right before calling
+  cuddGarbageCollect. (As in the case of dynamic reordering.)
+  Returns the total number of deleted nodes.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddGarbageCollect(
+  DdManager * unique,
+  int  clearCache)
+{
+    DdHook	*hook;
+    DdCache	*cache = unique->cache;
+    DdNode	*sentinel = &(unique->sentinel);
+    DdNodePtr	*nodelist;
+    int		i, j, deleted, totalDeleted, totalDeletedZ;
+    DdCache	*c;
+    DdNode	*node,*next;
+    DdNodePtr	*lastP;
+    int		slots;
+    long	localTime;
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+    DdNodePtr	tree;
+#else
+    DdNodePtr *memListTrav, *nxtNode;
+    DdNode *downTrav, *sentry;
+    int k;
+#endif
+#endif
+
+#ifndef DD_NO_DEATH_ROW
+    cuddClearDeathRow(unique);
+#endif
+
+    hook = unique->preGCHook;
+    while (hook != NULL) {
+	int res = (hook->f)(unique,"DD",NULL);
+	if (res == 0) return(0);
+	hook = hook->next;
+    }
+
+    if (unique->dead + unique->deadZ == 0) {
+	hook = unique->postGCHook;
+	while (hook != NULL) {
+	    int res = (hook->f)(unique,"DD",NULL);
+	    if (res == 0) return(0);
+	    hook = hook->next;
+	}
+        return(0);
+    }
+
+    /* If many nodes are being reclaimed, we want to resize the tables
+    ** more aggressively, to reduce the frequency of garbage collection.
+    */
+    if (clearCache && unique->gcFrac == DD_GC_FRAC_LO &&
+	unique->slots <= unique->looseUpTo && unique->stash != NULL) {
+	unique->minDead = (unsigned) (DD_GC_FRAC_HI * (double) unique->slots);
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,"GC fraction = %.2f\t", DD_GC_FRAC_HI);
+	(void) fprintf(unique->err,"minDead = %d\n", unique->minDead);
+#endif
+	unique->gcFrac = DD_GC_FRAC_HI;
+	return(0);
+    }
+
+    localTime = util_cpu_time();
+
+    unique->garbageCollections++;
+#ifdef DD_VERBOSE
+    (void) fprintf(unique->err,
+		   "garbage collecting (%d dead BDD nodes out of %d, min %d)...",
+    		   unique->dead, unique->keys, unique->minDead);
+    (void) fprintf(unique->err,
+		   "                   (%d dead ZDD nodes out of %d)...",
+    		   unique->deadZ, unique->keysZ);
+#endif
+
+    /* Remove references to garbage collected nodes from the cache. */
+    if (clearCache) {
+	slots = unique->cacheSlots;
+	for (i = 0; i < slots; i++) {
+	    c = &cache[i];
+	    if (c->data != NULL) {
+		if (cuddClean(c->f)->ref == 0 ||
+		cuddClean(c->g)->ref == 0 ||
+		(((ptruint)c->f & 0x2) && Cudd_Regular(c->h)->ref == 0) ||
+		(c->data != DD_NON_CONSTANT &&
+		Cudd_Regular(c->data)->ref == 0)) {
+		    c->data = NULL;
+		    unique->cachedeletions++;
+		}
+	    }
+	}
+	cuddLocalCacheClearDead(unique);
+    }
+
+    /* Now return dead nodes to free list. Count them for sanity check. */
+    totalDeleted = 0;
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+    tree = NULL;
+#endif
+#endif
+
+    for (i = 0; i < unique->size; i++) {
+	if (unique->subtables[i].dead == 0) continue;
+	nodelist = unique->subtables[i].nodelist;
+
+	deleted = 0;
+	slots = unique->subtables[i].slots;
+	for (j = 0; j < slots; j++) {
+	    lastP = &(nodelist[j]);
+	    node = *lastP;
+	    while (node != sentinel) {
+		next = node->next;
+		if (node->ref == 0) {
+		    deleted++;
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+		    cuddOrderedInsert(&tree,node);
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+#endif
+#else
+		    cuddDeallocNode(unique,node);
+#endif
+		} else {
+		    *lastP = node;
+		    lastP = &(node->next);
+		}
+		node = next;
+	    }
+	    *lastP = sentinel;
+	}
+	if ((unsigned) deleted != unique->subtables[i].dead) {
+	    ddReportRefMess(unique, i, "cuddGarbageCollect");
+	}
+	totalDeleted += deleted;
+	unique->subtables[i].keys -= deleted;
+	unique->subtables[i].dead = 0;
+    }
+    if (unique->constants.dead != 0) {
+	nodelist = unique->constants.nodelist;
+	deleted = 0;
+	slots = unique->constants.slots;
+	for (j = 0; j < slots; j++) {
+	    lastP = &(nodelist[j]);
+	    node = *lastP;
+	    while (node != NULL) {
+		next = node->next;
+		if (node->ref == 0) {
+		    deleted++;
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+		    cuddOrderedInsert(&tree,node);
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+#endif
+#else
+		    cuddDeallocNode(unique,node);
+#endif
+		} else {
+		    *lastP = node;
+		    lastP = &(node->next);
+		}
+		node = next;
+	    }
+	    *lastP = NULL;
+	}
+	if ((unsigned) deleted != unique->constants.dead) {
+	    ddReportRefMess(unique, CUDD_CONST_INDEX, "cuddGarbageCollect");
+	}
+	totalDeleted += deleted;
+	unique->constants.keys -= deleted;
+	unique->constants.dead = 0;
+    }
+    if ((unsigned) totalDeleted != unique->dead) {
+	ddReportRefMess(unique, -1, "cuddGarbageCollect");
+    }
+    unique->keys -= totalDeleted;
+    unique->dead = 0;
+#ifdef DD_STATS
+    unique->nodesFreed += (double) totalDeleted;
+#endif
+
+    totalDeletedZ = 0;
+
+    for (i = 0; i < unique->sizeZ; i++) {
+	if (unique->subtableZ[i].dead == 0) continue;
+	nodelist = unique->subtableZ[i].nodelist;
+
+	deleted = 0;
+	slots = unique->subtableZ[i].slots;
+	for (j = 0; j < slots; j++) {
+	    lastP = &(nodelist[j]);
+	    node = *lastP;
+	    while (node != NULL) {
+		next = node->next;
+		if (node->ref == 0) {
+		    deleted++;
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+#ifdef __osf__
+#pragma pointer_size save
+#pragma pointer_size short
+#endif
+		    cuddOrderedInsert(&tree,node);
+#ifdef __osf__
+#pragma pointer_size restore
+#endif
+#endif
+#else
+		    cuddDeallocNode(unique,node);
+#endif
+		} else {
+		    *lastP = node;
+		    lastP = &(node->next);
+		}
+		node = next;
+	    }
+	    *lastP = NULL;
+	}
+	if ((unsigned) deleted != unique->subtableZ[i].dead) {
+	    ddReportRefMess(unique, i, "cuddGarbageCollect");
+	}
+	totalDeletedZ += deleted;
+	unique->subtableZ[i].keys -= deleted;
+	unique->subtableZ[i].dead = 0;
+    }
+
+    /* No need to examine the constant table for ZDDs.
+    ** If we did we should be careful not to count whatever dead
+    ** nodes we found there among the dead ZDD nodes. */
+    if ((unsigned) totalDeletedZ != unique->deadZ) {
+	ddReportRefMess(unique, -1, "cuddGarbageCollect");
+    }
+    unique->keysZ -= totalDeletedZ;
+    unique->deadZ = 0;
+#ifdef DD_STATS
+    unique->nodesFreed += (double) totalDeletedZ;
+#endif
+
+
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+    unique->nextFree = cuddOrderedThread(tree,unique->nextFree);
+#else
+    memListTrav = unique->memoryList;
+    sentry = NULL;
+    while (memListTrav != NULL) {
+        ptruint offset;
+        nxtNode = (DdNodePtr *)memListTrav[0];
+	offset = (ptruint) memListTrav & (sizeof(DdNode) - 1);
+	memListTrav += (sizeof(DdNode) - offset) / sizeof(DdNodePtr);
+	downTrav = (DdNode *)memListTrav;
+	k = 0;
+	do {
+	    if (downTrav[k].ref == 0) {
+	        if (sentry == NULL) {
+		    unique->nextFree = sentry = &downTrav[k];
+		} else {
+		    /* First hook sentry->next to the dead node and then
+		    ** reassign sentry to the dead node. */
+		    sentry = (sentry->next = &downTrav[k]);
+		}
+	    }
+	} while (++k < DD_MEM_CHUNK);
+	memListTrav = nxtNode;
+    }
+    sentry->next = NULL;
+#endif
+#endif
+
+    unique->GCTime += util_cpu_time() - localTime;
+
+    hook = unique->postGCHook;
+    while (hook != NULL) {
+	int res = (hook->f)(unique,"DD",NULL);
+	if (res == 0) return(0);
+	hook = hook->next;
+    }
+
+#ifdef DD_VERBOSE
+    (void) fprintf(unique->err," done\n");
+#endif
+
+    return(totalDeleted+totalDeletedZ);
+
+} /* end of cuddGarbageCollect */
+
+
+/**Function********************************************************************
+
+  Synopsis [Wrapper for cuddUniqueInterZdd.]
+
+  Description [Wrapper for cuddUniqueInterZdd, which applies the ZDD
+  reduction rule. Returns a pointer to the result node under normal
+  conditions; NULL if reordering occurred or memory was exhausted.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddUniqueInterZdd]
+
+******************************************************************************/
+DdNode *
+cuddZddGetNode(
+  DdManager * zdd,
+  int  id,
+  DdNode * T,
+  DdNode * E)
+{
+    DdNode	*node;
+
+    if (T == DD_ZERO(zdd))
+	return(E);
+    node = cuddUniqueInterZdd(zdd, id, T, E);
+    return(node);
+
+} /* end of cuddZddGetNode */
+
+
+/**Function********************************************************************
+
+  Synopsis [Wrapper for cuddUniqueInterZdd that is independent of variable
+  ordering.]
+
+  Description [Wrapper for cuddUniqueInterZdd that is independent of
+  variable ordering (IVO). This function does not require parameter
+  index to precede the indices of the top nodes of g and h in the
+  variable order.  Returns a pointer to the result node under normal
+  conditions; NULL if reordering occurred or memory was exhausted.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddZddGetNode cuddZddIsop]
+
+******************************************************************************/
+DdNode *
+cuddZddGetNodeIVO(
+  DdManager * dd,
+  int  index,
+  DdNode * g,
+  DdNode * h)
+{
+    DdNode	*f, *r, *t;
+    DdNode	*zdd_one = DD_ONE(dd);
+    DdNode	*zdd_zero = DD_ZERO(dd);
+
+    f = cuddUniqueInterZdd(dd, index, zdd_one, zdd_zero);
+    if (f == NULL) {
+	return(NULL);
+    }
+    cuddRef(f);
+    t = cuddZddProduct(dd, f, g);
+    if (t == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f);
+	return(NULL);
+    }
+    cuddRef(t);
+    Cudd_RecursiveDerefZdd(dd, f);
+    r = cuddZddUnion(dd, t, h);
+    if (r == NULL) {
+	Cudd_RecursiveDerefZdd(dd, t);
+	return(NULL);
+    }
+    cuddRef(r);
+    Cudd_RecursiveDerefZdd(dd, t);
+
+    cuddDeref(r);
+    return(r);
+
+} /* end of cuddZddGetNodeIVO */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks the unique table for the existence of an internal node.]
+
+  Description [Checks the unique table for the existence of an internal
+  node. If it does not exist, it creates a new one.  Does not
+  modify the reference count of whatever is returned.  A newly created
+  internal node comes back with a reference count 0.  For a newly
+  created node, increments the reference counts of what T and E point
+  to.  Returns a pointer to the new node if successful; NULL if memory
+  is exhausted or if reordering took place.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddUniqueInterZdd]
+
+******************************************************************************/
+DdNode *
+cuddUniqueInter(
+  DdManager * unique,
+  int  index,
+  DdNode * T,
+  DdNode * E)
+{
+    int pos;
+    unsigned int level;
+    int retval;
+    DdNodePtr *nodelist;
+    DdNode *looking;
+    DdNodePtr *previousP;
+    DdSubtable *subtable;
+    int gcNumber;
+
+#ifdef DD_UNIQUE_PROFILE
+    unique->uniqueLookUps++;
+#endif
+
+    if (index >= unique->size) {
+	if (!ddResizeTable(unique,index)) return(NULL);
+    }
+
+    level = unique->perm[index];
+    subtable = &(unique->subtables[level]);
+
+#ifdef DD_DEBUG
+    assert(level < (unsigned) cuddI(unique,T->index));
+    assert(level < (unsigned) cuddI(unique,Cudd_Regular(E)->index));
+#endif
+
+    pos = ddHash(T, E, subtable->shift);
+    nodelist = subtable->nodelist;
+    previousP = &(nodelist[pos]);
+    looking = *previousP;
+
+    while (T < cuddT(looking)) {
+	previousP = &(looking->next);
+	looking = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+	unique->uniqueLinks++;
+#endif
+    }
+    while (T == cuddT(looking) && E < cuddE(looking)) {
+	previousP = &(looking->next);
+	looking = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+	unique->uniqueLinks++;
+#endif
+    }
+    if (T == cuddT(looking) && E == cuddE(looking)) {
+	if (looking->ref == 0) {
+	    cuddReclaim(unique,looking);
+	}
+	return(looking);
+    }
+
+    /* countDead is 0 if deads should be counted and ~0 if they should not. */
+    if (unique->autoDyn &&
+    unique->keys - (unique->dead & unique->countDead) >= unique->nextDyn) {
+#ifdef DD_DEBUG
+	retval = Cudd_DebugCheck(unique);
+	if (retval != 0) return(NULL);
+	retval = Cudd_CheckKeys(unique);
+	if (retval != 0) return(NULL);
+#endif
+	retval = Cudd_ReduceHeap(unique,unique->autoMethod,10); /* 10 = whatever */
+	if (retval == 0) unique->reordered = 2;
+#ifdef DD_DEBUG
+	retval = Cudd_DebugCheck(unique);
+	if (retval != 0) unique->reordered = 2;
+	retval = Cudd_CheckKeys(unique);
+	if (retval != 0) unique->reordered = 2;
+#endif
+	return(NULL);
+    }
+
+    if (subtable->keys > subtable->maxKeys) {
+        if (unique->gcEnabled &&
+	    ((unique->dead > unique->minDead) ||
+	    ((unique->dead > unique->minDead / 2) &&
+	    (subtable->dead > subtable->keys * 0.95)))) { /* too many dead */
+	    (void) cuddGarbageCollect(unique,1);
+	} else {
+	    cuddRehash(unique,(int)level);
+	}
+	/* Update pointer to insertion point. In the case of rehashing,
+	** the slot may have changed. In the case of garbage collection,
+	** the predecessor may have been dead. */
+	pos = ddHash(T, E, subtable->shift);
+	nodelist = subtable->nodelist;
+	previousP = &(nodelist[pos]);
+	looking = *previousP;
+
+	while (T < cuddT(looking)) {
+	    previousP = &(looking->next);
+	    looking = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+	    unique->uniqueLinks++;
+#endif
+	}
+	while (T == cuddT(looking) && E < cuddE(looking)) {
+	    previousP = &(looking->next);
+	    looking = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+	    unique->uniqueLinks++;
+#endif
+	}
+    }
+
+    gcNumber = unique->garbageCollections;
+    looking = cuddAllocNode(unique);
+    if (looking == NULL) {
+	return(NULL);
+    }
+    unique->keys++;
+    subtable->keys++;
+
+    if (gcNumber != unique->garbageCollections) {
+	DdNode *looking2;
+	pos = ddHash(T, E, subtable->shift);
+	nodelist = subtable->nodelist;
+	previousP = &(nodelist[pos]);
+	looking2 = *previousP;
+
+	while (T < cuddT(looking2)) {
+	    previousP = &(looking2->next);
+	    looking2 = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+	    unique->uniqueLinks++;
+#endif
+	}
+	while (T == cuddT(looking2) && E < cuddE(looking2)) {
+	    previousP = &(looking2->next);
+	    looking2 = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+	    unique->uniqueLinks++;
+#endif
+	}
+    }
+    looking->index = index;
+    cuddT(looking) = T;
+    cuddE(looking) = E;
+    looking->next = *previousP;
+    *previousP = looking;
+    cuddSatInc(T->ref);		/* we know T is a regular pointer */
+    cuddRef(E);
+
+#ifdef DD_DEBUG
+    cuddCheckCollisionOrdering(unique,level,pos);
+#endif
+
+    return(looking);
+
+} /* end of cuddUniqueInter */
+
+
+/**Function********************************************************************
+
+  Synopsis [Wrapper for cuddUniqueInter that is independent of variable
+  ordering.]
+
+  Description [Wrapper for cuddUniqueInter that is independent of
+  variable ordering (IVO). This function does not require parameter
+  index to precede the indices of the top nodes of T and E in the
+  variable order.  Returns a pointer to the result node under normal
+  conditions; NULL if reordering occurred or memory was exhausted.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddUniqueInter Cudd_MakeBddFromZddCover]
+
+******************************************************************************/
+DdNode *
+cuddUniqueInterIVO(
+  DdManager * unique,
+  int  index,
+  DdNode * T,
+  DdNode * E)
+{
+    DdNode *result;
+    DdNode *v;
+
+    v = cuddUniqueInter(unique, index, DD_ONE(unique),
+			Cudd_Not(DD_ONE(unique)));
+    if (v == NULL)
+	return(NULL);
+    cuddRef(v);
+    result = cuddBddIteRecur(unique, v, T, E);
+    Cudd_RecursiveDeref(unique, v);
+    return(result);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks the unique table for the existence of an internal
+  ZDD node.]
+
+  Description [Checks the unique table for the existence of an internal
+  ZDD node. If it does not exist, it creates a new one.  Does not
+  modify the reference count of whatever is returned.  A newly created
+  internal node comes back with a reference count 0.  For a newly
+  created node, increments the reference counts of what T and E point
+  to.  Returns a pointer to the new node if successful; NULL if memory
+  is exhausted or if reordering took place.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddUniqueInter]
+
+******************************************************************************/
+DdNode *
+cuddUniqueInterZdd(
+  DdManager * unique,
+  int  index,
+  DdNode * T,
+  DdNode * E)
+{
+    int pos;
+    unsigned int level;
+    int retval;
+    DdNodePtr *nodelist;
+    DdNode *looking;
+    DdSubtable *subtable;
+
+#ifdef DD_UNIQUE_PROFILE
+    unique->uniqueLookUps++;
+#endif
+
+    if (index >= unique->sizeZ) {
+	if (!cuddResizeTableZdd(unique,index)) return(NULL);
+    }
+
+    level = unique->permZ[index];
+    subtable = &(unique->subtableZ[level]);
+
+#ifdef DD_DEBUG
+    assert(level < (unsigned) cuddIZ(unique,T->index));
+    assert(level < (unsigned) cuddIZ(unique,Cudd_Regular(E)->index));
+#endif
+
+    if (subtable->keys > subtable->maxKeys) {
+        if (unique->gcEnabled && ((unique->deadZ > unique->minDead) ||
+	(10 * subtable->dead > 9 * subtable->keys))) { 	/* too many dead */
+	    (void) cuddGarbageCollect(unique,1);
+	} else {
+	    ddRehashZdd(unique,(int)level);
+	}
+    }
+
+    pos = ddHash(T, E, subtable->shift);
+    nodelist = subtable->nodelist;
+    looking = nodelist[pos];
+
+    while (looking != NULL) {
+        if (cuddT(looking) == T && cuddE(looking) == E) {
+	    if (looking->ref == 0) {
+		cuddReclaimZdd(unique,looking);
+	    }
+	    return(looking);
+	}
+	looking = looking->next;
+#ifdef DD_UNIQUE_PROFILE
+	unique->uniqueLinks++;
+#endif
+    }
+
+    /* countDead is 0 if deads should be counted and ~0 if they should not. */
+    if (unique->autoDynZ &&
+    unique->keysZ - (unique->deadZ & unique->countDead) >= unique->nextDyn) {
+#ifdef DD_DEBUG
+	retval = Cudd_DebugCheck(unique);
+	if (retval != 0) return(NULL);
+	retval = Cudd_CheckKeys(unique);
+	if (retval != 0) return(NULL);
+#endif
+	retval = Cudd_zddReduceHeap(unique,unique->autoMethodZ,10); /* 10 = whatever */
+	if (retval == 0) unique->reordered = 2;
+#ifdef DD_DEBUG
+	retval = Cudd_DebugCheck(unique);
+	if (retval != 0) unique->reordered = 2;
+	retval = Cudd_CheckKeys(unique);
+	if (retval != 0) unique->reordered = 2;
+#endif
+	return(NULL);
+    }
+
+    unique->keysZ++;
+    subtable->keys++;
+
+    looking = cuddAllocNode(unique);
+    if (looking == NULL) return(NULL);
+    looking->index = index;
+    cuddT(looking) = T;
+    cuddE(looking) = E;
+    looking->next = nodelist[pos];
+    nodelist[pos] = looking;
+    cuddRef(T);
+    cuddRef(E);
+
+    return(looking);
+
+} /* end of cuddUniqueInterZdd */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks the unique table for the existence of a constant node.]
+
+  Description [Checks the unique table for the existence of a constant node.
+  If it does not exist, it creates a new one.  Does not
+  modify the reference count of whatever is returned.  A newly created
+  internal node comes back with a reference count 0.  Returns a
+  pointer to the new node.]
+
+  SideEffects [None]
+
+******************************************************************************/
+DdNode *
+cuddUniqueConst(
+  DdManager * unique,
+  CUDD_VALUE_TYPE  value)
+{
+    int pos;
+    DdNodePtr *nodelist;
+    DdNode *looking;
+    hack split;
+
+#ifdef DD_UNIQUE_PROFILE
+    unique->uniqueLookUps++;
+#endif
+
+    if (unique->constants.keys > unique->constants.maxKeys) {
+        if (unique->gcEnabled && ((unique->dead > unique->minDead) ||
+	(10 * unique->constants.dead > 9 * unique->constants.keys))) { 	/* too many dead */
+	    (void) cuddGarbageCollect(unique,1);
+	} else {
+	    cuddRehash(unique,CUDD_CONST_INDEX);
+	}
+    }
+
+    cuddAdjust(value); /* for the case of crippled infinities */
+
+    if (ddAbs(value) < unique->epsilon) {
+	value = 0.0;
+    }
+    split.value = value;
+
+    pos = ddHash(split.bits[0], split.bits[1], unique->constants.shift);
+    nodelist = unique->constants.nodelist;
+    looking = nodelist[pos];
+
+    /* Here we compare values both for equality and for difference less
+     * than epsilon. The first comparison is required when values are
+     * infinite, since Infinity - Infinity is NaN and NaN < X is 0 for
+     * every X.
+     */
+    while (looking != NULL) {
+        if (looking->type.value == value ||
+	ddEqualVal(looking->type.value,value,unique->epsilon)) {
+	    if (looking->ref == 0) {
+		cuddReclaim(unique,looking);
+	    }
+	    return(looking);
+	}
+	looking = looking->next;
+#ifdef DD_UNIQUE_PROFILE
+	unique->uniqueLinks++;
+#endif
+    }
+
+    unique->keys++;
+    unique->constants.keys++;
+
+    looking = cuddAllocNode(unique);
+    if (looking == NULL) return(NULL);
+    looking->index = CUDD_CONST_INDEX;
+    looking->type.value = value;
+    looking->next = nodelist[pos];
+    nodelist[pos] = looking;
+
+    return(looking);
+
+} /* end of cuddUniqueConst */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Rehashes a unique subtable.]
+
+  Description [Doubles the size of a unique subtable and rehashes its
+  contents.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddRehash(
+  DdManager * unique,
+  int i)
+{
+    unsigned int slots, oldslots;
+    int shift, oldshift;
+    int j, pos;
+    DdNodePtr *nodelist, *oldnodelist;
+    DdNode *node, *next;
+    DdNode *sentinel = &(unique->sentinel);
+    hack split;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    if (unique->gcFrac == DD_GC_FRAC_HI && unique->slots > unique->looseUpTo) {
+	unique->gcFrac = DD_GC_FRAC_LO;
+	unique->minDead = (unsigned) (DD_GC_FRAC_LO * (double) unique->slots);
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,"GC fraction = %.2f\t", DD_GC_FRAC_LO);
+	(void) fprintf(unique->err,"minDead = %d\n", unique->minDead);
+#endif
+    }
+
+    if (unique->gcFrac != DD_GC_FRAC_MIN && unique->memused > unique->maxmem) {
+	unique->gcFrac = DD_GC_FRAC_MIN;
+	unique->minDead = (unsigned) (DD_GC_FRAC_MIN * (double) unique->slots);
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,"GC fraction = %.2f\t", DD_GC_FRAC_MIN);
+	(void) fprintf(unique->err,"minDead = %d\n", unique->minDead);
+#endif
+	cuddShrinkDeathRow(unique);
+	if (cuddGarbageCollect(unique,1) > 0) return;
+    }
+
+    if (i != CUDD_CONST_INDEX) {
+	oldslots = unique->subtables[i].slots;
+	oldshift = unique->subtables[i].shift;
+	oldnodelist = unique->subtables[i].nodelist;
+
+	/* Compute the new size of the subtable. */
+	slots = oldslots << 1;
+	shift = oldshift - 1;
+
+	saveHandler = MMoutOfMemory;
+	MMoutOfMemory = Cudd_OutOfMem;
+	nodelist = ALLOC(DdNodePtr, slots);
+	MMoutOfMemory = saveHandler;
+	if (nodelist == NULL) {
+	    (void) fprintf(unique->err,
+			   "Unable to resize subtable %d for lack of memory\n",
+			   i);
+	    /* Prevent frequent resizing attempts. */
+	    (void) cuddGarbageCollect(unique,1);
+	    if (unique->stash != NULL) {
+		FREE(unique->stash);
+		unique->stash = NULL;
+		/* Inhibit resizing of tables. */
+		cuddSlowTableGrowth(unique);
+	    }
+	    return;
+	}
+	unique->subtables[i].nodelist = nodelist;
+	unique->subtables[i].slots = slots;
+	unique->subtables[i].shift = shift;
+	unique->subtables[i].maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+
+	/* Move the nodes from the old table to the new table.
+	** This code depends on the type of hash function.
+	** It assumes that the effect of doubling the size of the table
+	** is to retain one more bit of the 32-bit hash value.
+	** The additional bit is the LSB. */
+	for (j = 0; (unsigned) j < oldslots; j++) {
+	    DdNodePtr *evenP, *oddP;
+	    node = oldnodelist[j];
+	    evenP = &(nodelist[j<<1]);
+	    oddP = &(nodelist[(j<<1)+1]);
+	    while (node != sentinel) {
+		next = node->next;
+		pos = ddHash(cuddT(node), cuddE(node), shift);
+		if (pos & 1) {
+		    *oddP = node;
+		    oddP = &(node->next);
+		} else {
+		    *evenP = node;
+		    evenP = &(node->next);
+		}
+		node = next;
+	    }
+	    *evenP = *oddP = sentinel;
+	}
+	FREE(oldnodelist);
+
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,
+		       "rehashing layer %d: keys %d dead %d new size %d\n",
+		       i, unique->subtables[i].keys,
+		       unique->subtables[i].dead, slots);
+#endif
+    } else {
+	oldslots = unique->constants.slots;
+	oldshift = unique->constants.shift;
+	oldnodelist = unique->constants.nodelist;
+
+	/* The constant subtable is never subjected to reordering.
+	** Therefore, when it is resized, it is because it has just
+	** reached the maximum load. We can safely just double the size,
+	** with no need for the loop we use for the other tables.
+	*/
+	slots = oldslots << 1;
+	shift = oldshift - 1;
+	saveHandler = MMoutOfMemory;
+	MMoutOfMemory = Cudd_OutOfMem;
+	nodelist = ALLOC(DdNodePtr, slots);
+	MMoutOfMemory = saveHandler;
+	if (nodelist == NULL) {
+	    int j;
+	    (void) fprintf(unique->err,
+			   "Unable to resize constant subtable for lack of memory\n");
+	    (void) cuddGarbageCollect(unique,1);
+	    for (j = 0; j < unique->size; j++) {
+		unique->subtables[j].maxKeys <<= 1;
+	    }
+	    unique->constants.maxKeys <<= 1;
+	    return;
+	}
+	unique->constants.slots = slots;
+	unique->constants.shift = shift;
+	unique->constants.maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+	unique->constants.nodelist = nodelist;
+	for (j = 0; (unsigned) j < slots; j++) {
+	    nodelist[j] = NULL;
+	}
+	for (j = 0; (unsigned) j < oldslots; j++) {
+	    node = oldnodelist[j];
+	    while (node != NULL) {
+		next = node->next;
+		split.value = cuddV(node);
+		pos = ddHash(split.bits[0], split.bits[1], shift);
+		node->next = nodelist[pos];
+		nodelist[pos] = node;
+		node = next;
+	    }
+	}
+	FREE(oldnodelist);
+
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,
+		       "rehashing constants: keys %d dead %d new size %d\n",
+		       unique->constants.keys,unique->constants.dead,slots);
+#endif
+    }
+
+    /* Update global data */
+
+    unique->memused += (slots - oldslots) * sizeof(DdNodePtr);
+    unique->slots += (slots - oldslots);
+    ddFixLimits(unique);
+
+} /* end of cuddRehash */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Shrinks a subtable.]
+
+  Description [Shrinks a subtable.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddRehash]
+
+******************************************************************************/
+void
+cuddShrinkSubtable(
+  DdManager *unique,
+  int i)
+{
+    int j;
+    int shift, posn;
+    DdNodePtr *nodelist, *oldnodelist;
+    DdNode *node, *next;
+    DdNode *sentinel = &(unique->sentinel);
+    unsigned int slots, oldslots;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    oldnodelist = unique->subtables[i].nodelist;
+    oldslots = unique->subtables[i].slots;
+    slots = oldslots >> 1;
+    saveHandler = MMoutOfMemory;
+    MMoutOfMemory = Cudd_OutOfMem;
+    nodelist = ALLOC(DdNodePtr, slots);
+    MMoutOfMemory = saveHandler;
+    if (nodelist == NULL) {
+	return;
+    }
+    unique->subtables[i].nodelist = nodelist;
+    unique->subtables[i].slots = slots;
+    unique->subtables[i].shift++;
+    unique->subtables[i].maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+#ifdef DD_VERBOSE
+    (void) fprintf(unique->err,
+		   "shrunk layer %d (%d keys) from %d to %d slots\n",
+		   i, unique->subtables[i].keys, oldslots, slots);
+#endif
+
+    for (j = 0; (unsigned) j < slots; j++) {
+	nodelist[j] = sentinel;
+    }
+    shift = unique->subtables[i].shift;
+    for (j = 0; (unsigned) j < oldslots; j++) {
+	node = oldnodelist[j];
+	while (node != sentinel) {
+	    DdNode *looking, *T, *E;
+	    DdNodePtr *previousP;
+	    next = node->next;
+	    posn = ddHash(cuddT(node), cuddE(node), shift);
+	    previousP = &(nodelist[posn]);
+	    looking = *previousP;
+	    T = cuddT(node);
+	    E = cuddE(node);
+	    while (T < cuddT(looking)) {
+		previousP = &(looking->next);
+		looking = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+		unique->uniqueLinks++;
+#endif
+	    }
+	    while (T == cuddT(looking) && E < cuddE(looking)) {
+		previousP = &(looking->next);
+		looking = *previousP;
+#ifdef DD_UNIQUE_PROFILE
+		unique->uniqueLinks++;
+#endif
+	    }
+	    node->next = *previousP;
+	    *previousP = node;
+	    node = next;
+	}
+    }
+    FREE(oldnodelist);
+
+    unique->memused += ((long) slots - (long) oldslots) * sizeof(DdNode *);
+    unique->slots += slots - oldslots;
+    unique->minDead = (unsigned) (unique->gcFrac * (double) unique->slots);
+    unique->cacheSlack = (int)
+	ddMin(unique->maxCacheHard,DD_MAX_CACHE_TO_SLOTS_RATIO * unique->slots)
+	- 2 * (int) unique->cacheSlots;
+
+} /* end of cuddShrinkSubtable */
+
+
+/**Function********************************************************************
+
+  Synopsis [Inserts n new subtables in a unique table at level.]
+
+  Description [Inserts n new subtables in a unique table at level.
+  The number n should be positive, and level should be an existing level.
+  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddDestroySubtables]
+
+******************************************************************************/
+int
+cuddInsertSubtables(
+  DdManager * unique,
+  int  n,
+  int  level)
+{
+    DdSubtable *newsubtables;
+    DdNodePtr *newnodelist;
+    DdNodePtr *newvars;
+    DdNode *sentinel = &(unique->sentinel);
+    int oldsize,newsize;
+    int i,j,index,reorderSave;
+    unsigned int numSlots = unique->initSlots;
+    int *newperm, *newinvperm, *newmap;
+    DdNode *one, *zero;
+
+#ifdef DD_DEBUG
+    assert(n > 0 && level < unique->size);
+#endif
+
+    oldsize = unique->size;
+    /* Easy case: there is still room in the current table. */
+    if (oldsize + n <= unique->maxSize) {
+	/* Shift the tables at and below level. */
+	for (i = oldsize - 1; i >= level; i--) {
+	    unique->subtables[i+n].slots    = unique->subtables[i].slots;
+	    unique->subtables[i+n].shift    = unique->subtables[i].shift;
+	    unique->subtables[i+n].keys     = unique->subtables[i].keys;
+	    unique->subtables[i+n].maxKeys  = unique->subtables[i].maxKeys;
+	    unique->subtables[i+n].dead     = unique->subtables[i].dead;
+	    unique->subtables[i+n].nodelist = unique->subtables[i].nodelist;
+	    unique->subtables[i+n].bindVar  = unique->subtables[i].bindVar;
+	    unique->subtables[i+n].varType  = unique->subtables[i].varType;
+	    unique->subtables[i+n].pairIndex  = unique->subtables[i].pairIndex;
+	    unique->subtables[i+n].varHandled = unique->subtables[i].varHandled;
+	    unique->subtables[i+n].varToBeGrouped =
+		unique->subtables[i].varToBeGrouped;
+
+	    index                           = unique->invperm[i];
+	    unique->invperm[i+n]            = index;
+	    unique->perm[index]            += n;
+	}
+	/* Create new subtables. */
+	for (i = 0; i < n; i++) {
+	    unique->subtables[level+i].slots = numSlots;
+	    unique->subtables[level+i].shift = sizeof(int) * 8 -
+		cuddComputeFloorLog2(numSlots);
+	    unique->subtables[level+i].keys = 0;
+	    unique->subtables[level+i].maxKeys = numSlots * DD_MAX_SUBTABLE_DENSITY;
+	    unique->subtables[level+i].dead = 0;
+	    unique->subtables[level+i].bindVar = 0;
+	    unique->subtables[level+i].varType = CUDD_VAR_PRIMARY_INPUT;
+	    unique->subtables[level+i].pairIndex = 0;
+	    unique->subtables[level+i].varHandled = 0;
+	    unique->subtables[level+i].varToBeGrouped = CUDD_LAZY_NONE;
+
+	    unique->perm[oldsize+i] = level + i;
+	    unique->invperm[level+i] = oldsize + i;
+	    newnodelist = unique->subtables[level+i].nodelist =
+		ALLOC(DdNodePtr, numSlots);
+	    if (newnodelist == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    for (j = 0; (unsigned) j < numSlots; j++) {
+		newnodelist[j] = sentinel;
+	    }
+	}
+	if (unique->map != NULL) {
+	    for (i = 0; i < n; i++) {
+		unique->map[oldsize+i] = oldsize + i;
+	    }
+	}
+    } else {
+	/* The current table is too small: we need to allocate a new,
+	** larger one; move all old subtables, and initialize the new
+	** subtables.
+	*/
+	newsize = oldsize + n + DD_DEFAULT_RESIZE;
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,
+		       "Increasing the table size from %d to %d\n",
+	    unique->maxSize, newsize);
+#endif
+	/* Allocate memory for new arrays (except nodelists). */
+	newsubtables = ALLOC(DdSubtable,newsize);
+	if (newsubtables == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	newvars = ALLOC(DdNodePtr,newsize);
+	if (newvars == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    FREE(newsubtables);
+	    return(0);
+	}
+	newperm = ALLOC(int,newsize);
+	if (newperm == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    FREE(newsubtables);
+	    FREE(newvars);
+	    return(0);
+	}
+	newinvperm = ALLOC(int,newsize);
+	if (newinvperm == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    FREE(newsubtables);
+	    FREE(newvars);
+	    FREE(newperm);
+	    return(0);
+	}
+	if (unique->map != NULL) {
+	    newmap = ALLOC(int,newsize);
+	    if (newmap == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		FREE(newsubtables);
+		FREE(newvars);
+		FREE(newperm);
+		FREE(newinvperm);
+		return(0);
+	    }
+	    unique->memused += (newsize - unique->maxSize) * sizeof(int);
+	}
+	unique->memused += (newsize - unique->maxSize) * ((numSlots+1) *
+	    sizeof(DdNode *) + 2 * sizeof(int) + sizeof(DdSubtable));
+	/* Copy levels before insertion points from old tables. */
+	for (i = 0; i < level; i++) {
+	    newsubtables[i].slots = unique->subtables[i].slots;
+	    newsubtables[i].shift = unique->subtables[i].shift;
+	    newsubtables[i].keys = unique->subtables[i].keys;
+	    newsubtables[i].maxKeys = unique->subtables[i].maxKeys;
+	    newsubtables[i].dead = unique->subtables[i].dead;
+	    newsubtables[i].nodelist = unique->subtables[i].nodelist;
+	    newsubtables[i].bindVar = unique->subtables[i].bindVar;
+	    newsubtables[i].varType = unique->subtables[i].varType;
+	    newsubtables[i].pairIndex = unique->subtables[i].pairIndex;
+	    newsubtables[i].varHandled = unique->subtables[i].varHandled;
+	    newsubtables[i].varToBeGrouped = unique->subtables[i].varToBeGrouped;
+
+	    newvars[i] = unique->vars[i];
+	    newperm[i] = unique->perm[i];
+	    newinvperm[i] = unique->invperm[i];
+	}
+	/* Finish initializing permutation for new table to old one. */
+	for (i = level; i < oldsize; i++) {
+	    newperm[i] = unique->perm[i];
+	}
+	/* Initialize new levels. */
+	for (i = level; i < level + n; i++) {
+	    newsubtables[i].slots = numSlots;
+	    newsubtables[i].shift = sizeof(int) * 8 -
+		cuddComputeFloorLog2(numSlots);
+	    newsubtables[i].keys = 0;
+	    newsubtables[i].maxKeys = numSlots * DD_MAX_SUBTABLE_DENSITY;
+	    newsubtables[i].dead = 0;
+	    newsubtables[i].bindVar = 0;
+	    newsubtables[i].varType = CUDD_VAR_PRIMARY_INPUT;
+	    newsubtables[i].pairIndex = 0;
+	    newsubtables[i].varHandled = 0;
+	    newsubtables[i].varToBeGrouped = CUDD_LAZY_NONE;
+
+	    newperm[oldsize + i - level] = i;
+	    newinvperm[i] = oldsize + i - level;
+	    newnodelist = newsubtables[i].nodelist = ALLOC(DdNodePtr, numSlots);
+	    if (newnodelist == NULL) {
+		/* We are going to leak some memory.  We should clean up. */
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    for (j = 0; (unsigned) j < numSlots; j++) {
+		newnodelist[j] = sentinel;
+	    }
+	}
+	/* Copy the old tables for levels past the insertion point. */
+	for (i = level; i < oldsize; i++) {
+	    newsubtables[i+n].slots    = unique->subtables[i].slots;
+	    newsubtables[i+n].shift    = unique->subtables[i].shift;
+	    newsubtables[i+n].keys     = unique->subtables[i].keys;
+	    newsubtables[i+n].maxKeys  = unique->subtables[i].maxKeys;
+	    newsubtables[i+n].dead     = unique->subtables[i].dead;
+	    newsubtables[i+n].nodelist = unique->subtables[i].nodelist;
+	    newsubtables[i+n].bindVar  = unique->subtables[i].bindVar;
+	    newsubtables[i+n].varType  = unique->subtables[i].varType;
+	    newsubtables[i+n].pairIndex  = unique->subtables[i].pairIndex;
+	    newsubtables[i+n].varHandled  = unique->subtables[i].varHandled;
+	    newsubtables[i+n].varToBeGrouped  =
+		unique->subtables[i].varToBeGrouped;
+
+	    newvars[i]                 = unique->vars[i];
+	    index                      = unique->invperm[i];
+	    newinvperm[i+n]            = index;
+	    newperm[index]            += n;
+	}
+	/* Update the map. */
+	if (unique->map != NULL) {
+	    for (i = 0; i < oldsize; i++) {
+		newmap[i] = unique->map[i];
+	    }
+	    for (i = oldsize; i < oldsize + n; i++) {
+		newmap[i] = i;
+	    }
+	    FREE(unique->map);
+	    unique->map = newmap;
+	}
+	/* Install the new tables and free the old ones. */
+	FREE(unique->subtables);
+	unique->subtables = newsubtables;
+	unique->maxSize = newsize;
+	FREE(unique->vars);
+	unique->vars = newvars;
+	FREE(unique->perm);
+	unique->perm = newperm;
+	FREE(unique->invperm);
+	unique->invperm = newinvperm;
+	/* Update the stack for iterative procedures. */
+	if (newsize > unique->maxSizeZ) {
+	    FREE(unique->stack);
+	    unique->stack = ALLOC(DdNodePtr,newsize + 1);
+	    if (unique->stack == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    unique->stack[0] = NULL; /* to suppress harmless UMR */
+	    unique->memused +=
+		(newsize - ddMax(unique->maxSize,unique->maxSizeZ))
+		* sizeof(DdNode *);
+	}
+    }
+    /* Update manager parameters to account for the new subtables. */
+    unique->slots += n * numSlots;
+    ddFixLimits(unique);
+    unique->size += n;
+
+    /* Now that the table is in a coherent state, create the new
+    ** projection functions. We need to temporarily disable reordering,
+    ** because we cannot reorder without projection functions in place.
+    **/
+    one = unique->one;
+    zero = Cudd_Not(one);
+
+    reorderSave = unique->autoDyn;
+    unique->autoDyn = 0;
+    for (i = oldsize; i < oldsize + n; i++) {
+	unique->vars[i] = cuddUniqueInter(unique,i,one,zero);
+	if (unique->vars[i] == NULL) {
+	    unique->autoDyn = reorderSave;
+	    /* Shift everything back so table remains coherent. */
+	    for (j = oldsize; j < i; j++) {
+		Cudd_IterDerefBdd(unique,unique->vars[j]);
+		cuddDeallocNode(unique,unique->vars[j]);
+		unique->vars[j] = NULL;
+	    }
+	    for (j = level; j < oldsize; j++) {
+		unique->subtables[j].slots    = unique->subtables[j+n].slots;
+		unique->subtables[j].slots    = unique->subtables[j+n].slots;
+		unique->subtables[j].shift    = unique->subtables[j+n].shift;
+		unique->subtables[j].keys     = unique->subtables[j+n].keys;
+		unique->subtables[j].maxKeys  =
+		    unique->subtables[j+n].maxKeys;
+		unique->subtables[j].dead     = unique->subtables[j+n].dead;
+		FREE(unique->subtables[j].nodelist);
+		unique->subtables[j].nodelist =
+		    unique->subtables[j+n].nodelist;
+		unique->subtables[j+n].nodelist = NULL;
+		unique->subtables[j].bindVar  =
+		    unique->subtables[j+n].bindVar;
+		unique->subtables[j].varType  =
+		    unique->subtables[j+n].varType;
+		unique->subtables[j].pairIndex =
+		    unique->subtables[j+n].pairIndex;
+		unique->subtables[j].varHandled =
+		    unique->subtables[j+n].varHandled;
+		unique->subtables[j].varToBeGrouped =
+		    unique->subtables[j+n].varToBeGrouped;
+		index                         = unique->invperm[j+n];
+		unique->invperm[j]            = index;
+		unique->perm[index]          -= n;
+	    }
+	    unique->size = oldsize;
+	    unique->slots -= n * numSlots;
+	    ddFixLimits(unique);
+	    (void) Cudd_DebugCheck(unique);
+	    return(0);
+	}
+	cuddRef(unique->vars[i]);
+    }
+    if (unique->tree != NULL) {
+	unique->tree->size += n;
+	unique->tree->index = unique->invperm[0];
+	ddPatchTree(unique,unique->tree);
+    }
+    unique->autoDyn = reorderSave;
+
+    return(1);
+
+} /* end of cuddInsertSubtables */
+
+
+/**Function********************************************************************
+
+  Synopsis [Destroys the n most recently created subtables in a unique table.]
+
+  Description [Destroys the n most recently created subtables in a unique
+  table.  n should be positive. The subtables should not contain any live
+  nodes, except the (isolated) projection function. The projection
+  functions are freed.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [The variable map used for fast variable substitution is
+  destroyed if it exists. In this case the cache is also cleared.]
+
+  SeeAlso     [cuddInsertSubtables Cudd_SetVarMap]
+
+******************************************************************************/
+int
+cuddDestroySubtables(
+  DdManager * unique,
+  int  n)
+{
+    DdSubtable *subtables;
+    DdNodePtr *nodelist;
+    DdNodePtr *vars;
+    int firstIndex, lastIndex;
+    int index, level, newlevel;
+    int lowestLevel;
+    int shift;
+    int found;
+
+    /* Sanity check and set up. */
+    if (n <= 0) return(0);
+    if (n > unique->size) n = unique->size;
+
+    subtables = unique->subtables;
+    vars = unique->vars;
+    firstIndex = unique->size - n;
+    lastIndex  = unique->size;
+
+    /* Check for nodes labeled by the variables being destroyed
+    ** that may still be in use.  It is allowed to destroy a variable
+    ** only if there are no such nodes. Also, find the lowest level
+    ** among the variables being destroyed. This will make further
+    ** processing more efficient.
+    */
+    lowestLevel = unique->size;
+    for (index = firstIndex; index < lastIndex; index++) {
+	level = unique->perm[index];
+	if (level < lowestLevel) lowestLevel = level;
+	nodelist = subtables[level].nodelist;
+	if (subtables[level].keys - subtables[level].dead != 1) return(0);
+	/* The projection function should be isolated. If the ref count
+	** is 1, everything is OK. If the ref count is saturated, then
+	** we need to make sure that there are no nodes pointing to it.
+	** As for the external references, we assume the application is
+	** responsible for them.
+	*/
+	if (vars[index]->ref != 1) {
+	    if (vars[index]->ref != DD_MAXREF) return(0);
+	    found = cuddFindParent(unique,vars[index]);
+	    if (found) {
+		return(0);
+	    } else {
+		vars[index]->ref = 1;
+	    }
+	}
+	Cudd_RecursiveDeref(unique,vars[index]);
+    }
+
+    /* Collect garbage, because we cannot afford having dead nodes pointing
+    ** to the dead nodes in the subtables being destroyed.
+    */
+    (void) cuddGarbageCollect(unique,1);
+
+    /* Here we know we can destroy our subtables. */
+    for (index = firstIndex; index < lastIndex; index++) {
+	level = unique->perm[index];
+	nodelist = subtables[level].nodelist;
+#ifdef DD_DEBUG
+	assert(subtables[level].keys == 0);
+#endif
+	FREE(nodelist);
+	unique->memused -= sizeof(DdNodePtr) * subtables[level].slots;
+	unique->slots -= subtables[level].slots;
+	unique->dead -= subtables[level].dead;
+    }
+
+    /* Here all subtables to be destroyed have their keys field == 0 and
+    ** their hash tables have been freed.
+    ** We now scan the subtables from level lowestLevel + 1 to level size - 1,
+    ** shifting the subtables as required. We keep a running count of
+    ** how many subtables have been moved, so that we know by how many
+    ** positions each subtable should be shifted.
+    */
+    shift = 1;
+    for (level = lowestLevel + 1; level < unique->size; level++) {
+	if (subtables[level].keys == 0) {
+	    shift++;
+	    continue;
+	}
+	newlevel = level - shift;
+	subtables[newlevel].slots = subtables[level].slots;
+	subtables[newlevel].shift = subtables[level].shift;
+	subtables[newlevel].keys = subtables[level].keys;
+	subtables[newlevel].maxKeys = subtables[level].maxKeys;
+	subtables[newlevel].dead = subtables[level].dead;
+	subtables[newlevel].nodelist = subtables[level].nodelist;
+	index = unique->invperm[level];
+	unique->perm[index] = newlevel;
+	unique->invperm[newlevel]  = index;
+	subtables[newlevel].bindVar = subtables[level].bindVar;
+	subtables[newlevel].varType = subtables[level].varType;
+	subtables[newlevel].pairIndex = subtables[level].pairIndex;
+	subtables[newlevel].varHandled = subtables[level].varHandled;
+	subtables[newlevel].varToBeGrouped = subtables[level].varToBeGrouped;
+    }
+    /* Destroy the map. If a surviving variable is
+    ** mapped to a dying variable, and the map were used again,
+    ** an out-of-bounds access to unique->vars would result. */
+    if (unique->map != NULL) {
+	cuddCacheFlush(unique);
+	FREE(unique->map);
+	unique->map = NULL;
+    }
+
+    unique->minDead = (unsigned) (unique->gcFrac * (double) unique->slots);
+    unique->size -= n;
+
+    return(1);
+
+} /* end of cuddDestroySubtables */
+
+
+/**Function********************************************************************
+
+  Synopsis [Increases the number of ZDD subtables in a unique table so
+  that it meets or exceeds index.]
+
+  Description [Increases the number of ZDD subtables in a unique table so
+  that it meets or exceeds index.  When new ZDD variables are created, it
+  is possible to preserve the functions unchanged, or it is possible to
+  preserve the covers unchanged, but not both. cuddResizeTableZdd preserves
+  the covers.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [ddResizeTable]
+
+******************************************************************************/
+int
+cuddResizeTableZdd(
+  DdManager * unique,
+  int  index)
+{
+    DdSubtable *newsubtables;
+    DdNodePtr *newnodelist;
+    int oldsize,newsize;
+    int i,j,reorderSave;
+    unsigned int numSlots = unique->initSlots;
+    int *newperm, *newinvperm;
+
+    oldsize = unique->sizeZ;
+    /* Easy case: there is still room in the current table. */
+    if (index < unique->maxSizeZ) {
+	for (i = oldsize; i <= index; i++) {
+	    unique->subtableZ[i].slots = numSlots;
+	    unique->subtableZ[i].shift = sizeof(int) * 8 -
+		cuddComputeFloorLog2(numSlots);
+	    unique->subtableZ[i].keys = 0;
+	    unique->subtableZ[i].maxKeys = numSlots * DD_MAX_SUBTABLE_DENSITY;
+	    unique->subtableZ[i].dead = 0;
+	    unique->permZ[i] = i;
+	    unique->invpermZ[i] = i;
+	    newnodelist = unique->subtableZ[i].nodelist =
+		ALLOC(DdNodePtr, numSlots);
+	    if (newnodelist == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    for (j = 0; (unsigned) j < numSlots; j++) {
+		newnodelist[j] = NULL;
+	    }
+	}
+    } else {
+	/* The current table is too small: we need to allocate a new,
+	** larger one; move all old subtables, and initialize the new
+	** subtables up to index included.
+	*/
+	newsize = index + DD_DEFAULT_RESIZE;
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,
+		       "Increasing the ZDD table size from %d to %d\n",
+	    unique->maxSizeZ, newsize);
+#endif
+	newsubtables = ALLOC(DdSubtable,newsize);
+	if (newsubtables == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	newperm = ALLOC(int,newsize);
+	if (newperm == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	newinvperm = ALLOC(int,newsize);
+	if (newinvperm == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	unique->memused += (newsize - unique->maxSizeZ) * ((numSlots+1) *
+	    sizeof(DdNode *) + 2 * sizeof(int) + sizeof(DdSubtable));
+	if (newsize > unique->maxSize) {
+	    FREE(unique->stack);
+	    unique->stack = ALLOC(DdNodePtr,newsize + 1);
+	    if (unique->stack == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    unique->stack[0] = NULL; /* to suppress harmless UMR */
+	    unique->memused +=
+		(newsize - ddMax(unique->maxSize,unique->maxSizeZ))
+		* sizeof(DdNode *);
+	}
+	for (i = 0; i < oldsize; i++) {
+	    newsubtables[i].slots = unique->subtableZ[i].slots;
+	    newsubtables[i].shift = unique->subtableZ[i].shift;
+	    newsubtables[i].keys = unique->subtableZ[i].keys;
+	    newsubtables[i].maxKeys = unique->subtableZ[i].maxKeys;
+	    newsubtables[i].dead = unique->subtableZ[i].dead;
+	    newsubtables[i].nodelist = unique->subtableZ[i].nodelist;
+	    newperm[i] = unique->permZ[i];
+	    newinvperm[i] = unique->invpermZ[i];
+	}
+	for (i = oldsize; i <= index; i++) {
+	    newsubtables[i].slots = numSlots;
+	    newsubtables[i].shift = sizeof(int) * 8 -
+		cuddComputeFloorLog2(numSlots);
+	    newsubtables[i].keys = 0;
+	    newsubtables[i].maxKeys = numSlots * DD_MAX_SUBTABLE_DENSITY;
+	    newsubtables[i].dead = 0;
+	    newperm[i] = i;
+	    newinvperm[i] = i;
+	    newnodelist = newsubtables[i].nodelist = ALLOC(DdNodePtr, numSlots);
+	    if (newnodelist == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    for (j = 0; (unsigned) j < numSlots; j++) {
+		newnodelist[j] = NULL;
+	    }
+	}
+	FREE(unique->subtableZ);
+	unique->subtableZ = newsubtables;
+	unique->maxSizeZ = newsize;
+	FREE(unique->permZ);
+	unique->permZ = newperm;
+	FREE(unique->invpermZ);
+	unique->invpermZ = newinvperm;
+    }
+    unique->slots += (index + 1 - unique->sizeZ) * numSlots;
+    ddFixLimits(unique);
+    unique->sizeZ = index + 1;
+
+    /* Now that the table is in a coherent state, update the ZDD
+    ** universe. We need to temporarily disable reordering,
+    ** because we cannot reorder without universe in place.
+    */
+
+    reorderSave = unique->autoDynZ;
+    unique->autoDynZ = 0;
+    cuddZddFreeUniv(unique);
+    if (!cuddZddInitUniv(unique)) {
+	unique->autoDynZ = reorderSave;
+	return(0);
+    }
+    unique->autoDynZ = reorderSave;
+
+    return(1);
+
+} /* end of cuddResizeTableZdd */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adjusts parameters of a table to slow down its growth.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+cuddSlowTableGrowth(
+  DdManager *unique)
+{
+    int i;
+
+    unique->maxCacheHard = unique->cacheSlots - 1;
+    unique->cacheSlack = -(unique->cacheSlots + 1);
+    for (i = 0; i < unique->size; i++) {
+	unique->subtables[i].maxKeys <<= 2;
+    }
+    unique->gcFrac = DD_GC_FRAC_MIN;
+    unique->minDead = (unsigned) (DD_GC_FRAC_MIN * (double) unique->slots);
+    cuddShrinkDeathRow(unique);
+    (void) fprintf(unique->err,"Slowing down table growth: ");
+    (void) fprintf(unique->err,"GC fraction = %.2f\t", unique->gcFrac);
+    (void) fprintf(unique->err,"minDead = %d\n", unique->minDead);
+
+} /* end of cuddSlowTableGrowth */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Rehashes a ZDD unique subtable.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [cuddRehash]
+
+******************************************************************************/
+static void
+ddRehashZdd(
+  DdManager * unique,
+  int  i)
+{
+    unsigned int slots, oldslots;
+    int shift, oldshift;
+    int j, pos;
+    DdNodePtr *nodelist, *oldnodelist;
+    DdNode *node, *next;
+    extern DD_OOMFP MMoutOfMemory;
+    DD_OOMFP saveHandler;
+
+    if (unique->slots > unique->looseUpTo) {
+	unique->minDead = (unsigned) (DD_GC_FRAC_LO * (double) unique->slots);
+#ifdef DD_VERBOSE
+	if (unique->gcFrac == DD_GC_FRAC_HI) {
+	    (void) fprintf(unique->err,"GC fraction = %.2f\t",
+			   DD_GC_FRAC_LO);
+	    (void) fprintf(unique->err,"minDead = %d\n", unique->minDead);
+	}
+#endif
+	unique->gcFrac = DD_GC_FRAC_LO;
+    }
+
+    assert(i != CUDD_MAXINDEX);
+    oldslots = unique->subtableZ[i].slots;
+    oldshift = unique->subtableZ[i].shift;
+    oldnodelist = unique->subtableZ[i].nodelist;
+
+    /* Compute the new size of the subtable. Normally, we just
+    ** double.  However, after reordering, a table may be severely
+    ** overloaded. Therefore, we iterate. */
+    slots = oldslots;
+    shift = oldshift;
+    do {
+	slots <<= 1;
+	shift--;
+    } while (slots * DD_MAX_SUBTABLE_DENSITY < unique->subtableZ[i].keys);
+
+    saveHandler = MMoutOfMemory;
+    MMoutOfMemory = Cudd_OutOfMem;
+    nodelist = ALLOC(DdNodePtr, slots);
+    MMoutOfMemory = saveHandler;
+    if (nodelist == NULL) {
+	int j;
+	(void) fprintf(unique->err,
+		       "Unable to resize ZDD subtable %d for lack of memory.\n",
+		       i);
+	(void) cuddGarbageCollect(unique,1);
+	for (j = 0; j < unique->sizeZ; j++) {
+	    unique->subtableZ[j].maxKeys <<= 1;
+	}
+	return;
+    }
+    unique->subtableZ[i].nodelist = nodelist;
+    unique->subtableZ[i].slots = slots;
+    unique->subtableZ[i].shift = shift;
+    unique->subtableZ[i].maxKeys = slots * DD_MAX_SUBTABLE_DENSITY;
+    for (j = 0; (unsigned) j < slots; j++) {
+	nodelist[j] = NULL;
+    }
+    for (j = 0; (unsigned) j < oldslots; j++) {
+	node = oldnodelist[j];
+	while (node != NULL) {
+	    next = node->next;
+	    pos = ddHash(cuddT(node), cuddE(node), shift);
+	    node->next = nodelist[pos];
+	    nodelist[pos] = node;
+	    node = next;
+	}
+    }
+    FREE(oldnodelist);
+
+#ifdef DD_VERBOSE
+    (void) fprintf(unique->err,
+		   "rehashing layer %d: keys %d dead %d new size %d\n",
+		   i, unique->subtableZ[i].keys,
+		   unique->subtableZ[i].dead, slots);
+#endif
+
+    /* Update global data. */
+    unique->memused += (slots - oldslots) * sizeof(DdNode *);
+    unique->slots += (slots - oldslots);
+    ddFixLimits(unique);
+
+} /* end of ddRehashZdd */
+
+
+/**Function********************************************************************
+
+  Synopsis [Increases the number of subtables in a unique table so
+  that it meets or exceeds index.]
+
+  Description [Increases the number of subtables in a unique table so
+  that it meets or exceeds index. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddResizeTableZdd]
+
+******************************************************************************/
+static int
+ddResizeTable(
+  DdManager * unique,
+  int index)
+{
+    DdSubtable *newsubtables;
+    DdNodePtr *newnodelist;
+    DdNodePtr *newvars;
+    DdNode *sentinel = &(unique->sentinel);
+    int oldsize,newsize;
+    int i,j,reorderSave;
+    int numSlots = unique->initSlots;
+    int *newperm, *newinvperm, *newmap;
+    DdNode *one, *zero;
+
+    oldsize = unique->size;
+    /* Easy case: there is still room in the current table. */
+    if (index < unique->maxSize) {
+	for (i = oldsize; i <= index; i++) {
+	    unique->subtables[i].slots = numSlots;
+	    unique->subtables[i].shift = sizeof(int) * 8 -
+		cuddComputeFloorLog2(numSlots);
+	    unique->subtables[i].keys = 0;
+	    unique->subtables[i].maxKeys = numSlots * DD_MAX_SUBTABLE_DENSITY;
+	    unique->subtables[i].dead = 0;
+	    unique->subtables[i].bindVar = 0;
+	    unique->subtables[i].varType = CUDD_VAR_PRIMARY_INPUT;
+	    unique->subtables[i].pairIndex = 0;
+	    unique->subtables[i].varHandled = 0;
+	    unique->subtables[i].varToBeGrouped = CUDD_LAZY_NONE;
+
+	    unique->perm[i] = i;
+	    unique->invperm[i] = i;
+	    newnodelist = unique->subtables[i].nodelist =
+		ALLOC(DdNodePtr, numSlots);
+	    if (newnodelist == NULL) {
+		for (j = oldsize; j < i; j++) {
+		    FREE(unique->subtables[j].nodelist);
+		}
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    for (j = 0; j < numSlots; j++) {
+		newnodelist[j] = sentinel;
+	    }
+	}
+	if (unique->map != NULL) {
+	    for (i = oldsize; i <= index; i++) {
+		unique->map[i] = i;
+	    }
+	}
+    } else {
+	/* The current table is too small: we need to allocate a new,
+	** larger one; move all old subtables, and initialize the new
+	** subtables up to index included.
+	*/
+	newsize = index + DD_DEFAULT_RESIZE;
+#ifdef DD_VERBOSE
+	(void) fprintf(unique->err,
+		       "Increasing the table size from %d to %d\n",
+		       unique->maxSize, newsize);
+#endif
+	newsubtables = ALLOC(DdSubtable,newsize);
+	if (newsubtables == NULL) {
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	newvars = ALLOC(DdNodePtr,newsize);
+	if (newvars == NULL) {
+	    FREE(newsubtables);
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	newperm = ALLOC(int,newsize);
+	if (newperm == NULL) {
+	    FREE(newsubtables);
+	    FREE(newvars);
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	newinvperm = ALLOC(int,newsize);
+	if (newinvperm == NULL) {
+	    FREE(newsubtables);
+	    FREE(newvars);
+	    FREE(newperm);
+	    unique->errorCode = CUDD_MEMORY_OUT;
+	    return(0);
+	}
+	if (unique->map != NULL) {
+	    newmap = ALLOC(int,newsize);
+	    if (newmap == NULL) {
+		FREE(newsubtables);
+		FREE(newvars);
+		FREE(newperm);
+		FREE(newinvperm);
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    unique->memused += (newsize - unique->maxSize) * sizeof(int);
+	}
+	unique->memused += (newsize - unique->maxSize) * ((numSlots+1) *
+	    sizeof(DdNode *) + 2 * sizeof(int) + sizeof(DdSubtable));
+	if (newsize > unique->maxSizeZ) {
+	    FREE(unique->stack);
+	    unique->stack = ALLOC(DdNodePtr,newsize + 1);
+	    if (unique->stack == NULL) {
+		FREE(newsubtables);
+		FREE(newvars);
+		FREE(newperm);
+		FREE(newinvperm);
+		if (unique->map != NULL) {
+		    FREE(newmap);
+		}
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    unique->stack[0] = NULL; /* to suppress harmless UMR */
+	    unique->memused +=
+		(newsize - ddMax(unique->maxSize,unique->maxSizeZ))
+		* sizeof(DdNode *);
+	}
+	for (i = 0; i < oldsize; i++) {
+	    newsubtables[i].slots = unique->subtables[i].slots;
+	    newsubtables[i].shift = unique->subtables[i].shift;
+	    newsubtables[i].keys = unique->subtables[i].keys;
+	    newsubtables[i].maxKeys = unique->subtables[i].maxKeys;
+	    newsubtables[i].dead = unique->subtables[i].dead;
+	    newsubtables[i].nodelist = unique->subtables[i].nodelist;
+	    newsubtables[i].bindVar = unique->subtables[i].bindVar;
+	    newsubtables[i].varType = unique->subtables[i].varType;
+	    newsubtables[i].pairIndex = unique->subtables[i].pairIndex;
+	    newsubtables[i].varHandled = unique->subtables[i].varHandled;
+	    newsubtables[i].varToBeGrouped = unique->subtables[i].varToBeGrouped;
+
+	    newvars[i] = unique->vars[i];
+	    newperm[i] = unique->perm[i];
+	    newinvperm[i] = unique->invperm[i];
+	}
+	for (i = oldsize; i <= index; i++) {
+	    newsubtables[i].slots = numSlots;
+	    newsubtables[i].shift = sizeof(int) * 8 -
+		cuddComputeFloorLog2(numSlots);
+	    newsubtables[i].keys = 0;
+	    newsubtables[i].maxKeys = numSlots * DD_MAX_SUBTABLE_DENSITY;
+	    newsubtables[i].dead = 0;
+	    newsubtables[i].bindVar = 0;
+	    newsubtables[i].varType = CUDD_VAR_PRIMARY_INPUT;
+	    newsubtables[i].pairIndex = 0;
+	    newsubtables[i].varHandled = 0;
+	    newsubtables[i].varToBeGrouped = CUDD_LAZY_NONE;
+
+	    newperm[i] = i;
+	    newinvperm[i] = i;
+	    newnodelist = newsubtables[i].nodelist = ALLOC(DdNodePtr, numSlots);
+	    if (newnodelist == NULL) {
+		unique->errorCode = CUDD_MEMORY_OUT;
+		return(0);
+	    }
+	    for (j = 0; j < numSlots; j++) {
+		newnodelist[j] = sentinel;
+	    }
+	}
+	if (unique->map != NULL) {
+	    for (i = 0; i < oldsize; i++) {
+		newmap[i] = unique->map[i];
+	    }
+	    for (i = oldsize; i <= index; i++) {
+		newmap[i] = i;
+	    }
+	    FREE(unique->map);
+	    unique->map = newmap;
+	}
+	FREE(unique->subtables);
+	unique->subtables = newsubtables;
+	unique->maxSize = newsize;
+	FREE(unique->vars);
+	unique->vars = newvars;
+	FREE(unique->perm);
+	unique->perm = newperm;
+	FREE(unique->invperm);
+	unique->invperm = newinvperm;
+    }
+
+    /* Now that the table is in a coherent state, create the new
+    ** projection functions. We need to temporarily disable reordering,
+    ** because we cannot reorder without projection functions in place.
+    **/
+    one = unique->one;
+    zero = Cudd_Not(one);
+
+    unique->size = index + 1;
+    unique->slots += (index + 1 - oldsize) * numSlots;
+    ddFixLimits(unique);
+
+    reorderSave = unique->autoDyn;
+    unique->autoDyn = 0;
+    for (i = oldsize; i <= index; i++) {
+	unique->vars[i] = cuddUniqueInter(unique,i,one,zero);
+	if (unique->vars[i] == NULL) {
+	    unique->autoDyn = reorderSave;
+	    for (j = oldsize; j < i; j++) {
+		Cudd_IterDerefBdd(unique,unique->vars[j]);
+		cuddDeallocNode(unique,unique->vars[j]);
+		unique->vars[j] = NULL;
+	    }
+	    for (j = oldsize; j <= index; j++) {
+		FREE(unique->subtables[j].nodelist);
+		unique->subtables[j].nodelist = NULL;
+	    }
+	    unique->size = oldsize;
+	    unique->slots -= (index + 1 - oldsize) * numSlots;
+	    ddFixLimits(unique);
+	    return(0);
+	}
+	cuddRef(unique->vars[i]);
+    }
+    unique->autoDyn = reorderSave;
+
+    return(1);
+
+} /* end of ddResizeTable */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Searches the subtables above node for a parent.]
+
+  Description [Searches the subtables above node for a parent. Returns 1
+  as soon as one parent is found. Returns 0 is the search is fruitless.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+cuddFindParent(
+  DdManager * table,
+  DdNode * node)
+{
+    int         i,j;
+    int		slots;
+    DdNodePtr	*nodelist;
+    DdNode	*f;
+
+    for (i = cuddI(table,node->index) - 1; i >= 0; i--) {
+	nodelist = table->subtables[i].nodelist;
+	slots = table->subtables[i].slots;
+
+	for (j = 0; j < slots; j++) {
+	    f = nodelist[j];
+	    while (cuddT(f) > node) {
+		f = f->next;
+	    }
+	    while (cuddT(f) == node && Cudd_Regular(cuddE(f)) > node) {
+		f = f->next;
+	    }
+	    if (cuddT(f) == node && Cudd_Regular(cuddE(f)) == node) {
+		return(1);
+	    }
+	}
+    }
+
+    return(0);
+
+} /* end of cuddFindParent */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adjusts the values of table limits.]
+
+  Description [Adjusts the values of table fields controlling the.
+  sizes of subtables and computed table. If the computed table is too small
+  according to the new values, it is resized.]
+
+  SideEffects [Modifies manager fields. May resize computed table.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DD_INLINE
+static void
+ddFixLimits(
+  DdManager *unique)
+{
+    unique->minDead = (unsigned) (unique->gcFrac * (double) unique->slots);
+    unique->cacheSlack = (int) ddMin(unique->maxCacheHard,
+	DD_MAX_CACHE_TO_SLOTS_RATIO * unique->slots) -
+	2 * (int) unique->cacheSlots;
+    if (unique->cacheSlots < unique->slots/2 && unique->cacheSlack >= 0)
+	cuddCacheResize(unique);
+    return;
+
+} /* end of ddFixLimits */
+
+
+#ifndef DD_UNSORTED_FREE_LIST
+#ifdef DD_RED_BLACK_FREE_LIST
+/**Function********************************************************************
+
+  Synopsis    [Inserts a DdNode in a red/black search tree.]
+
+  Description [Inserts a DdNode in a red/black search tree. Nodes from
+  the same "page" (defined by DD_PAGE_MASK) are linked in a LIFO list.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddOrderedThread]
+
+******************************************************************************/
+static void
+cuddOrderedInsert(
+  DdNodePtr * root,
+  DdNodePtr node)
+{
+    DdNode *scan;
+    DdNodePtr *scanP;
+    DdNodePtr *stack[DD_STACK_SIZE];
+    int stackN = 0;
+
+    scanP = root;
+    while ((scan = *scanP) != NULL) {
+	stack[stackN++] = scanP;
+	if (DD_INSERT_COMPARE(node, scan) == 0) { /* add to page list */
+	    DD_NEXT(node) = DD_NEXT(scan);
+	    DD_NEXT(scan) = node;
+	    return;
+	}
+	scanP = (node < scan) ? &DD_LEFT(scan) : &DD_RIGHT(scan);
+    }
+    DD_RIGHT(node) = DD_LEFT(node) = DD_NEXT(node) = NULL;
+    DD_COLOR(node) = DD_RED;
+    *scanP = node;
+    stack[stackN] = &node;
+    cuddDoRebalance(stack,stackN);
+
+} /* end of cuddOrderedInsert */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Threads all the nodes of a search tree into a linear list.]
+
+  Description [Threads all the nodes of a search tree into a linear
+  list. For each node of the search tree, the "left" child, if non-null, has
+  a lower address than its parent, and the "right" child, if non-null, has a
+  higher address than its parent.
+  The list is sorted in order of increasing addresses. The search
+  tree is destroyed as a result of this operation. The last element of
+  the linear list is made to point to the address passed in list. Each
+  node if the search tree is a linearly-linked list of nodes from the
+  same memory page (as defined in DD_PAGE_MASK). When a node is added to
+  the linear list, all the elements of the linked list are added.]
+
+  SideEffects [The search tree is destroyed as a result of this operation.]
+
+  SeeAlso     [cuddOrderedInsert]
+
+******************************************************************************/
+static DdNode *
+cuddOrderedThread(
+  DdNode * root,
+  DdNode * list)
+{
+    DdNode *current, *next, *prev, *end;
+
+    current = root;
+    /* The first word in the node is used to implement a stack that holds
+    ** the nodes from the root of the tree to the current node. Here we
+    ** put the root of the tree at the bottom of the stack.
+    */
+    *((DdNodePtr *) current) = NULL;
+
+    while (current != NULL) {
+	if (DD_RIGHT(current) != NULL) {
+	    /* If possible, we follow the "right" link. Eventually we'll
+	    ** find the node with the largest address in the current tree.
+	    ** In this phase we use the first word of a node to implemen
+	    ** a stack of the nodes on the path from the root to "current".
+	    ** Also, we disconnect the "right" pointers to indicate that
+	    ** we have already followed them.
+	    */
+	    next = DD_RIGHT(current);
+	    DD_RIGHT(current) = NULL;
+	    *((DdNodePtr *)next) = current;
+	    current = next;
+	} else {
+	    /* We can't proceed along the "right" links any further.
+	    ** Hence "current" is the largest element in the current tree.
+	    ** We make this node the new head of "list". (Repeating this
+	    ** operation until the tree is empty yields the desired linear
+	    ** threading of all nodes.)
+	    */
+	    prev = *((DdNodePtr *) current); /* save prev node on stack in prev */
+	    /* Traverse the linked list of current until the end. */
+	    for (end = current; DD_NEXT(end) != NULL; end = DD_NEXT(end));
+	    DD_NEXT(end) = list; /* attach "list" at end and make */
+	    list = current;   /* "current" the new head of "list" */
+	    /* Now, if current has a "left" child, we push it on the stack.
+	    ** Otherwise, we just continue with the parent of "current".
+	    */
+	    if (DD_LEFT(current) != NULL) {
+		next = DD_LEFT(current);
+		*((DdNodePtr *) next) = prev;
+		current = next;
+	    } else {
+		current = prev;
+	    }
+	}
+    }
+
+    return(list);
+
+} /* end of cuddOrderedThread */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the left rotation for red/black trees.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [cuddRotateRight]
+
+******************************************************************************/
+DD_INLINE
+static void
+cuddRotateLeft(
+  DdNodePtr * nodeP)
+{
+    DdNode *newRoot;
+    DdNode *oldRoot = *nodeP;
+
+    *nodeP = newRoot = DD_RIGHT(oldRoot);
+    DD_RIGHT(oldRoot) = DD_LEFT(newRoot);
+    DD_LEFT(newRoot) = oldRoot;
+
+} /* end of cuddRotateLeft */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the right rotation for red/black trees.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [cuddRotateLeft]
+
+******************************************************************************/
+DD_INLINE
+static void
+cuddRotateRight(
+  DdNodePtr * nodeP)
+{
+    DdNode *newRoot;
+    DdNode *oldRoot = *nodeP;
+
+    *nodeP = newRoot = DD_LEFT(oldRoot);
+    DD_LEFT(oldRoot) = DD_RIGHT(newRoot);
+    DD_RIGHT(newRoot) = oldRoot;
+
+} /* end of cuddRotateRight */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Rebalances a red/black tree.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+cuddDoRebalance(
+  DdNodePtr ** stack,
+  int  stackN)
+{
+    DdNodePtr *xP, *parentP, *grandpaP;
+    DdNode *x, *y, *parent, *grandpa;
+
+    xP = stack[stackN];
+    x = *xP;
+    /* Work our way back up, re-balancing the tree. */
+    while (--stackN >= 0) {
+	parentP = stack[stackN];
+	parent = *parentP;
+	if (DD_IS_BLACK(parent)) break;
+	/* Since the root is black, here a non-null grandparent exists. */
+	grandpaP = stack[stackN-1];
+	grandpa = *grandpaP;
+	if (parent == DD_LEFT(grandpa)) {
+	    y = DD_RIGHT(grandpa);
+	    if (y != NULL && DD_IS_RED(y)) {
+		DD_COLOR(parent) = DD_BLACK;
+		DD_COLOR(y) = DD_BLACK;
+		DD_COLOR(grandpa) = DD_RED;
+		x = grandpa;
+		stackN--;
+	    } else {
+		if (x == DD_RIGHT(parent)) {
+		    cuddRotateLeft(parentP);
+		    DD_COLOR(x) = DD_BLACK;
+		} else {
+		    DD_COLOR(parent) = DD_BLACK;
+		}
+		DD_COLOR(grandpa) = DD_RED;
+		cuddRotateRight(grandpaP);
+		break;
+	    }
+	} else {
+	    y = DD_LEFT(grandpa);
+	    if (y != NULL && DD_IS_RED(y)) {
+		DD_COLOR(parent) = DD_BLACK;
+		DD_COLOR(y) = DD_BLACK;
+		DD_COLOR(grandpa) = DD_RED;
+		x = grandpa;
+		stackN--;
+	    } else {
+		if (x == DD_LEFT(parent)) {
+		    cuddRotateRight(parentP);
+		    DD_COLOR(x) = DD_BLACK;
+		} else {
+		    DD_COLOR(parent) = DD_BLACK;
+		}
+		DD_COLOR(grandpa) = DD_RED;
+		cuddRotateLeft(grandpaP);
+	    }
+	}
+    }
+    DD_COLOR(*(stack[0])) = DD_BLACK;
+
+} /* end of cuddDoRebalance */
+#endif
+#endif
+
+
+/**Function********************************************************************
+
+  Synopsis    [Fixes a variable tree after the insertion of new subtables.]
+
+  Description [Fixes a variable tree after the insertion of new subtables.
+  After such an insertion, the low fields of the tree below the insertion
+  point are inconsistent.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+ddPatchTree(
+  DdManager *dd,
+  MtrNode *treenode)
+{
+    MtrNode *auxnode = treenode;
+
+    while (auxnode != NULL) {
+	auxnode->low = dd->perm[auxnode->index];
+	if (auxnode->child != NULL) {
+	    ddPatchTree(dd, auxnode->child);
+	}
+	auxnode = auxnode->younger;
+    }
+
+    return;
+
+} /* end of ddPatchTree */
+
+
+#ifdef DD_DEBUG
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a collision list is ordered.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+cuddCheckCollisionOrdering(
+  DdManager *unique,
+  int i,
+  int j)
+{
+    int slots;
+    DdNode *node, *next;
+    DdNodePtr *nodelist;
+    DdNode *sentinel = &(unique->sentinel);
+
+    nodelist = unique->subtables[i].nodelist;
+    slots = unique->subtables[i].slots;
+    node = nodelist[j];
+    if (node == sentinel) return(1);
+    next = node->next;
+    while (next != sentinel) {
+	if (cuddT(node) < cuddT(next) ||
+	    (cuddT(node) == cuddT(next) && cuddE(node) < cuddE(next))) {
+	    (void) fprintf(unique->err,
+			   "Unordered list: index %u, position %d\n", i, j);
+	    return(0);
+	}
+	node = next;
+	next = node->next;
+    }
+    return(1);
+
+} /* end of cuddCheckCollisionOrdering */
+#endif
+
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reports problem in garbage collection.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [cuddGarbageCollect cuddGarbageCollectZdd]
+
+******************************************************************************/
+static void
+ddReportRefMess(
+  DdManager *unique /* manager */,
+  int i /* table in which the problem occurred */,
+  const char *caller /* procedure that detected the problem */)
+{
+    if (i == CUDD_CONST_INDEX) {
+	(void) fprintf(unique->err,
+			   "%s: problem in constants\n", caller);
+    } else if (i != -1) {
+	(void) fprintf(unique->err,
+			   "%s: problem in table %d\n", caller, i);
+    }
+    (void) fprintf(unique->err, "  dead count != deleted\n");
+    (void) fprintf(unique->err, "  This problem is often due to a missing \
+call to Cudd_Ref\n  or to an extra call to Cudd_RecursiveDeref.\n  \
+See the CUDD Programmer's Guide for additional details.");
+    abort();
+
+} /* end of ddReportRefMess */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddZddCount.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddZddCount.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddZddCount.c	(revision 6)
@@ -0,0 +1,357 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddZddCount.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Procedures to count the number of minterms of a ZDD.]
+
+  Description [External procedures included in this module:
+		    <ul>
+		    <li> Cudd_zddCount();
+		    <li> Cudd_zddCountDouble();
+		    </ul>
+	       Internal procedures included in this module:
+		    <ul>
+		    </ul>
+	       Static procedures included in this module:
+		    <ul>
+       		    <li> cuddZddCountStep();
+		    <li> cuddZddCountDoubleStep();
+		    <li> st_zdd_count_dbl_free()
+		    <li> st_zdd_countfree()
+		    </ul>
+	      ]
+
+  SeeAlso     []
+
+  Author      [Hyong-Kyoon Shin, In-Ho Moon]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddZddCount.c,v 1.14 2004/08/13 18:04:53 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int cuddZddCountStep (DdNode *P, st_table *table, DdNode *base, DdNode *empty);
+static double cuddZddCountDoubleStep (DdNode *P, st_table *table, DdNode *base, DdNode *empty);
+static enum st_retval st_zdd_countfree (char *key, char *value, char *arg);
+static enum st_retval st_zdd_count_dbl_free (char *key, char *value, char *arg);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis [Counts the number of minterms in a ZDD.]
+
+  Description [Returns an integer representing the number of minterms
+  in a ZDD.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddCountDouble]
+
+******************************************************************************/
+int
+Cudd_zddCount(
+  DdManager * zdd,
+  DdNode * P)
+{
+    st_table	*table;
+    int		res;
+    DdNode	*base, *empty;
+
+    base  = DD_ONE(zdd);
+    empty = DD_ZERO(zdd);
+    table = st_init_table(st_ptrcmp, st_ptrhash);
+    if (table == NULL) return(CUDD_OUT_OF_MEM);
+    res = cuddZddCountStep(P, table, base, empty);
+    if (res == CUDD_OUT_OF_MEM) {
+	zdd->errorCode = CUDD_MEMORY_OUT;
+    }
+    st_foreach(table, st_zdd_countfree, NIL(char));
+    st_free_table(table);
+
+    return(res);
+
+} /* end of Cudd_zddCount */
+
+
+/**Function********************************************************************
+
+  Synopsis [Counts the number of minterms of a ZDD.]
+
+  Description [Counts the number of minterms of a ZDD. The result is
+  returned as a double. If the procedure runs out of memory, it
+  returns (double) CUDD_OUT_OF_MEM. This procedure is used in
+  Cudd_zddCountMinterm.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddCountMinterm Cudd_zddCount]
+
+******************************************************************************/
+double
+Cudd_zddCountDouble(
+  DdManager * zdd,
+  DdNode * P)
+{
+    st_table	*table;
+    double	res;
+    DdNode	*base, *empty;
+
+    base  = DD_ONE(zdd);
+    empty = DD_ZERO(zdd);
+    table = st_init_table(st_ptrcmp, st_ptrhash);
+    if (table == NULL) return((double)CUDD_OUT_OF_MEM);
+    res = cuddZddCountDoubleStep(P, table, base, empty);
+    if (res == (double)CUDD_OUT_OF_MEM) {
+	zdd->errorCode = CUDD_MEMORY_OUT;
+    }
+    st_foreach(table, st_zdd_count_dbl_free, NIL(char));
+    st_free_table(table);
+
+    return(res);
+
+} /* end of Cudd_zddCountDouble */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis [Performs the recursive step of Cudd_zddCount.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+cuddZddCountStep(
+  DdNode * P,
+  st_table * table,
+  DdNode * base,
+  DdNode * empty)
+{
+    int		res;
+    int		*dummy;
+
+    if (P == empty)
+	return(0);
+    if (P == base)
+	return(1);
+
+    /* Check cache. */
+    if (st_lookup(table, P, &dummy)) {
+	res = *dummy;
+	return(res);
+    }
+
+    res = cuddZddCountStep(cuddE(P), table, base, empty) +
+	cuddZddCountStep(cuddT(P), table, base, empty);
+
+    dummy = ALLOC(int, 1);
+    if (dummy == NULL) {
+	return(CUDD_OUT_OF_MEM);
+    }
+    *dummy = res;
+    if (st_insert(table, (char *)P, (char *)dummy) == ST_OUT_OF_MEM) {
+	FREE(dummy);
+	return(CUDD_OUT_OF_MEM);
+    }
+
+    return(res);
+
+} /* end of cuddZddCountStep */
+
+
+/**Function********************************************************************
+
+  Synopsis [Performs the recursive step of Cudd_zddCountDouble.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static double
+cuddZddCountDoubleStep(
+  DdNode * P,
+  st_table * table,
+  DdNode * base,
+  DdNode * empty)
+{
+    double	res;
+    double	*dummy;
+
+    if (P == empty)
+	return((double)0.0);
+    if (P == base)
+	return((double)1.0);
+
+    /* Check cache */
+    if (st_lookup(table, P, &dummy)) {
+	res = *dummy;
+	return(res);
+    }
+
+    res = cuddZddCountDoubleStep(cuddE(P), table, base, empty) +
+	cuddZddCountDoubleStep(cuddT(P), table, base, empty);
+
+    dummy = ALLOC(double, 1);
+    if (dummy == NULL) {
+	return((double)CUDD_OUT_OF_MEM);
+    }
+    *dummy = res;
+    if (st_insert(table, (char *)P, (char *)dummy) == ST_OUT_OF_MEM) {
+	FREE(dummy);
+	return((double)CUDD_OUT_OF_MEM);
+    }
+
+    return(res);
+
+} /* end of cuddZddCountDoubleStep */
+
+
+/**Function********************************************************************
+
+  Synopsis [Frees the memory associated with the computed table of
+  Cudd_zddCount.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static enum st_retval
+st_zdd_countfree(
+  char * key,
+  char * value,
+  char * arg)
+{
+    int	*d;
+
+    d = (int *)value;
+    FREE(d);
+    return(ST_CONTINUE);
+
+} /* end of st_zdd_countfree */
+
+
+/**Function********************************************************************
+
+  Synopsis [Frees the memory associated with the computed table of
+  Cudd_zddCountDouble.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static enum st_retval
+st_zdd_count_dbl_free(
+  char * key,
+  char * value,
+  char * arg)
+{
+    double	*d;
+
+    d = (double *)value;
+    FREE(d);
+    return(ST_CONTINUE);
+
+} /* end of st_zdd_count_dbl_free */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddZddFuncs.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddZddFuncs.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddZddFuncs.c	(revision 6)
@@ -0,0 +1,1630 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddZddFuncs.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions to manipulate covers represented as ZDDs.]
+
+  Description [External procedures included in this module:
+		    <ul>
+		    <li> Cudd_zddProduct();
+		    <li> Cudd_zddUnateProduct();
+		    <li> Cudd_zddWeakDiv();
+		    <li> Cudd_zddWeakDivF();
+		    <li> Cudd_zddDivide();
+		    <li> Cudd_zddDivideF();
+		    <li> Cudd_zddComplement();
+		    </ul>
+	       Internal procedures included in this module:
+		    <ul>
+		    <li> cuddZddProduct();
+		    <li> cuddZddUnateProduct();
+		    <li> cuddZddWeakDiv();
+		    <li> cuddZddWeakDivF();
+		    <li> cuddZddDivide();
+		    <li> cuddZddDivideF();
+		    <li> cuddZddGetCofactors3()
+		    <li> cuddZddGetCofactors2()
+		    <li> cuddZddComplement();
+		    <li> cuddZddGetPosVarIndex();
+		    <li> cuddZddGetNegVarIndex();
+		    <li> cuddZddGetPosVarLevel();
+		    <li> cuddZddGetNegVarLevel();
+		    </ul>
+	       Static procedures included in this module:
+		    <ul>
+		    </ul>
+	      ]
+
+  SeeAlso     []
+
+  Author      [In-Ho Moon]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddZddFuncs.c,v 1.14 2004/08/13 18:04:53 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the product of two covers represented by ZDDs.]
+
+  Description [Computes the product of two covers represented by
+  ZDDs. The result is also a ZDD. Returns a pointer to the result if
+  successful; NULL otherwise.  The covers on which Cudd_zddProduct
+  operates use two ZDD variables for each function variable (one ZDD
+  variable for each literal of the variable). Those two ZDD variables
+  should be adjacent in the order.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddUnateProduct]
+
+******************************************************************************/
+DdNode	*
+Cudd_zddProduct(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    DdNode	*res;
+
+    do {
+	dd->reordered = 0;
+	res = cuddZddProduct(dd, f, g);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_zddProduct */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the product of two unate covers.]
+
+  Description [Computes the product of two unate covers represented as
+  ZDDs. Unate covers use one ZDD variable for each BDD
+  variable. Returns a pointer to the result if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddProduct]
+
+******************************************************************************/
+DdNode	*
+Cudd_zddUnateProduct(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    DdNode	*res;
+
+    do {
+	dd->reordered = 0;
+	res = cuddZddUnateProduct(dd, f, g);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_zddUnateProduct */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Applies weak division to two covers.]
+
+  Description [Applies weak division to two ZDDs representing two
+  covers. Returns a pointer to the ZDD representing the result if
+  successful; NULL otherwise. The result of weak division depends on
+  the variable order. The covers on which Cudd_zddWeakDiv operates use
+  two ZDD variables for each function variable (one ZDD variable for
+  each literal of the variable). Those two ZDD variables should be
+  adjacent in the order.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddDivide]
+
+******************************************************************************/
+DdNode	*
+Cudd_zddWeakDiv(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    DdNode	*res;
+
+    do {
+	dd->reordered = 0;
+	res = cuddZddWeakDiv(dd, f, g);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_zddWeakDiv */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the quotient of two unate covers.]
+
+  Description [Computes the quotient of two unate covers represented
+  by ZDDs.  Unate covers use one ZDD variable for each BDD
+  variable. Returns a pointer to the resulting ZDD if successful; NULL
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddWeakDiv]
+
+******************************************************************************/
+DdNode	*
+Cudd_zddDivide(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    DdNode	*res;
+
+    do {
+	dd->reordered = 0;
+	res = cuddZddDivide(dd, f, g);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_zddDivide */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Modified version of Cudd_zddWeakDiv.]
+
+  Description [Modified version of Cudd_zddWeakDiv. This function may
+  disappear in future releases.]
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddWeakDiv]
+
+******************************************************************************/
+DdNode	*
+Cudd_zddWeakDivF(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    DdNode	*res;
+
+    do {
+	dd->reordered = 0;
+	res = cuddZddWeakDivF(dd, f, g);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_zddWeakDivF */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Modified version of Cudd_zddDivide.]
+
+  Description [Modified version of Cudd_zddDivide. This function may
+  disappear in future releases.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode	*
+Cudd_zddDivideF(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    DdNode	*res;
+
+    do {
+	dd->reordered = 0;
+	res = cuddZddDivideF(dd, f, g);
+    } while (dd->reordered == 1);
+    return(res);
+
+} /* end of Cudd_zddDivideF */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes a complement cover for a ZDD node.]
+
+  Description [Computes a complement cover for a ZDD node. For lack of a
+  better method, we first extract the function BDD from the ZDD cover,
+  then make the complement of the ZDD cover from the complement of the
+  BDD node by using ISOP. Returns a pointer to the resulting cover if
+  successful; NULL otherwise. The result depends on current variable
+  order.]
+
+  SideEffects [The result depends on current variable order.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode	*
+Cudd_zddComplement(
+  DdManager *dd,
+  DdNode *node)
+{
+    DdNode	*b, *isop, *zdd_I;
+
+    /* Check cache */
+    zdd_I = cuddCacheLookup1Zdd(dd, cuddZddComplement, node);
+    if (zdd_I)
+	return(zdd_I);
+
+    b = Cudd_MakeBddFromZddCover(dd, node);
+    if (!b)
+	return(NULL);
+    Cudd_Ref(b);
+    isop = Cudd_zddIsop(dd, Cudd_Not(b), Cudd_Not(b), &zdd_I);
+    if (!isop) {
+	Cudd_RecursiveDeref(dd, b);
+	return(NULL);
+    }
+    Cudd_Ref(isop);
+    Cudd_Ref(zdd_I);
+    Cudd_RecursiveDeref(dd, b);
+    Cudd_RecursiveDeref(dd, isop);
+
+    cuddCacheInsert1(dd, cuddZddComplement, node, zdd_I);
+    Cudd_Deref(zdd_I);
+    return(zdd_I);
+} /* end of Cudd_zddComplement */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis [Performs the recursive step of Cudd_zddProduct.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddProduct]
+
+******************************************************************************/
+DdNode	*
+cuddZddProduct(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    int		v, top_f, top_g;
+    DdNode	*tmp, *term1, *term2, *term3;
+    DdNode	*f0, *f1, *fd, *g0, *g1, *gd;
+    DdNode	*R0, *R1, *Rd, *N0, *N1;
+    DdNode	*r;
+    DdNode	*one = DD_ONE(dd);
+    DdNode	*zero = DD_ZERO(dd);
+    int		flag;
+    int		pv, nv;
+
+    statLine(dd);
+    if (f == zero || g == zero)
+        return(zero);
+    if (f == one)
+        return(g);
+    if (g == one)
+        return(f);
+
+    top_f = dd->permZ[f->index];
+    top_g = dd->permZ[g->index];
+
+    if (top_f > top_g)
+	return(cuddZddProduct(dd, g, f));
+
+    /* Check cache */
+    r = cuddCacheLookup2Zdd(dd, cuddZddProduct, f, g);
+    if (r)
+	return(r);
+
+    v = f->index;	/* either yi or zi */
+    flag = cuddZddGetCofactors3(dd, f, v, &f1, &f0, &fd);
+    if (flag == 1)
+	return(NULL);
+    Cudd_Ref(f1);
+    Cudd_Ref(f0);
+    Cudd_Ref(fd);
+    flag = cuddZddGetCofactors3(dd, g, v, &g1, &g0, &gd);
+    if (flag == 1) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	return(NULL);
+    }
+    Cudd_Ref(g1);
+    Cudd_Ref(g0);
+    Cudd_Ref(gd);
+    pv = cuddZddGetPosVarIndex(dd, v);
+    nv = cuddZddGetNegVarIndex(dd, v);
+
+    Rd = cuddZddProduct(dd, fd, gd);
+    if (Rd == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	return(NULL);
+    }
+    Cudd_Ref(Rd);
+
+    term1 = cuddZddProduct(dd, f0, g0);
+    if (term1 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, Rd);
+	return(NULL);
+    }
+    Cudd_Ref(term1);
+    term2 = cuddZddProduct(dd, f0, gd);
+    if (term2 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, Rd);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	return(NULL);
+    }
+    Cudd_Ref(term2);
+    term3 = cuddZddProduct(dd, fd, g0);
+    if (term3 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, Rd);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	return(NULL);
+    }
+    Cudd_Ref(term3);
+    Cudd_RecursiveDerefZdd(dd, f0);
+    Cudd_RecursiveDerefZdd(dd, g0);
+    tmp = cuddZddUnion(dd, term1, term2);
+    if (tmp == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, Rd);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	Cudd_RecursiveDerefZdd(dd, term3);
+	return(NULL);
+    }
+    Cudd_Ref(tmp);
+    Cudd_RecursiveDerefZdd(dd, term1);
+    Cudd_RecursiveDerefZdd(dd, term2);
+    R0 = cuddZddUnion(dd, tmp, term3);
+    if (R0 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, Rd);
+	Cudd_RecursiveDerefZdd(dd, term3);
+	Cudd_RecursiveDerefZdd(dd, tmp);
+	return(NULL);
+    }
+    Cudd_Ref(R0);
+    Cudd_RecursiveDerefZdd(dd, tmp);
+    Cudd_RecursiveDerefZdd(dd, term3);
+    N0 = cuddZddGetNode(dd, nv, R0, Rd); /* nv = zi */
+    if (N0 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, Rd);
+	Cudd_RecursiveDerefZdd(dd, R0);
+	return(NULL);
+    }
+    Cudd_Ref(N0);
+    Cudd_RecursiveDerefZdd(dd, R0);
+    Cudd_RecursiveDerefZdd(dd, Rd);
+
+    term1 = cuddZddProduct(dd, f1, g1);
+    if (term1 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, N0);
+	return(NULL);
+    }
+    Cudd_Ref(term1);
+    term2 = cuddZddProduct(dd, f1, gd);
+    if (term2 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, N0);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	return(NULL);
+    }
+    Cudd_Ref(term2);
+    term3 = cuddZddProduct(dd, fd, g1);
+    if (term3 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	Cudd_RecursiveDerefZdd(dd, N0);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	return(NULL);
+    }
+    Cudd_Ref(term3);
+    Cudd_RecursiveDerefZdd(dd, f1);
+    Cudd_RecursiveDerefZdd(dd, g1);
+    Cudd_RecursiveDerefZdd(dd, fd);
+    Cudd_RecursiveDerefZdd(dd, gd);
+    tmp = cuddZddUnion(dd, term1, term2);
+    if (tmp == NULL) {
+	Cudd_RecursiveDerefZdd(dd, N0);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	Cudd_RecursiveDerefZdd(dd, term3);
+	return(NULL);
+    }
+    Cudd_Ref(tmp);
+    Cudd_RecursiveDerefZdd(dd, term1);
+    Cudd_RecursiveDerefZdd(dd, term2);
+    R1 = cuddZddUnion(dd, tmp, term3);
+    if (R1 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, N0);
+	Cudd_RecursiveDerefZdd(dd, term3);
+	Cudd_RecursiveDerefZdd(dd, tmp);
+	return(NULL);
+    }
+    Cudd_Ref(R1);
+    Cudd_RecursiveDerefZdd(dd, tmp);
+    Cudd_RecursiveDerefZdd(dd, term3);
+    N1 = cuddZddGetNode(dd, pv, R1, N0); /* pv = yi */
+    if (N1 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, N0);
+	Cudd_RecursiveDerefZdd(dd, R1);
+	return(NULL);
+    }
+    Cudd_Ref(N1);
+    Cudd_RecursiveDerefZdd(dd, R1);
+    Cudd_RecursiveDerefZdd(dd, N0);
+
+    cuddCacheInsert2(dd, cuddZddProduct, f, g, N1);
+    Cudd_Deref(N1);
+    return(N1);
+
+} /* end of cuddZddProduct */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_zddUnateProduct.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddUnateProduct]
+
+******************************************************************************/
+DdNode	*
+cuddZddUnateProduct(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    int		v, top_f, top_g;
+    DdNode	*term1, *term2, *term3, *term4;
+    DdNode	*sum1, *sum2;
+    DdNode	*f0, *f1, *g0, *g1;
+    DdNode	*r;
+    DdNode	*one = DD_ONE(dd);
+    DdNode	*zero = DD_ZERO(dd);
+    int		flag;
+
+    statLine(dd);
+    if (f == zero || g == zero)
+        return(zero);
+    if (f == one)
+        return(g);
+    if (g == one)
+        return(f);
+
+    top_f = dd->permZ[f->index];
+    top_g = dd->permZ[g->index];
+
+    if (top_f > top_g)
+	return(cuddZddUnateProduct(dd, g, f));
+
+    /* Check cache */
+    r = cuddCacheLookup2Zdd(dd, cuddZddUnateProduct, f, g);
+    if (r)
+	return(r);
+
+    v = f->index;	/* either yi or zi */
+    flag = cuddZddGetCofactors2(dd, f, v, &f1, &f0);
+    if (flag == 1)
+	return(NULL);
+    Cudd_Ref(f1);
+    Cudd_Ref(f0);
+    flag = cuddZddGetCofactors2(dd, g, v, &g1, &g0);
+    if (flag == 1) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	return(NULL);
+    }
+    Cudd_Ref(g1);
+    Cudd_Ref(g0);
+
+    term1 = cuddZddUnateProduct(dd, f1, g1);
+    if (term1 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	return(NULL);
+    }
+    Cudd_Ref(term1);
+    term2 = cuddZddUnateProduct(dd, f1, g0);
+    if (term2 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	return(NULL);
+    }
+    Cudd_Ref(term2);
+    term3 = cuddZddUnateProduct(dd, f0, g1);
+    if (term3 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	return(NULL);
+    }
+    Cudd_Ref(term3);
+    term4 = cuddZddUnateProduct(dd, f0, g0);
+    if (term4 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	Cudd_RecursiveDerefZdd(dd, term3);
+	return(NULL);
+    }
+    Cudd_Ref(term4);
+    Cudd_RecursiveDerefZdd(dd, f1);
+    Cudd_RecursiveDerefZdd(dd, f0);
+    Cudd_RecursiveDerefZdd(dd, g1);
+    Cudd_RecursiveDerefZdd(dd, g0);
+    sum1 = cuddZddUnion(dd, term1, term2);
+    if (sum1 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, term2);
+	Cudd_RecursiveDerefZdd(dd, term3);
+	Cudd_RecursiveDerefZdd(dd, term4);
+	return(NULL);
+    }
+    Cudd_Ref(sum1);
+    Cudd_RecursiveDerefZdd(dd, term1);
+    Cudd_RecursiveDerefZdd(dd, term2);
+    sum2 = cuddZddUnion(dd, sum1, term3);
+    if (sum2 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, term3);
+	Cudd_RecursiveDerefZdd(dd, term4);
+	Cudd_RecursiveDerefZdd(dd, sum1);
+	return(NULL);
+    }
+    Cudd_Ref(sum2);
+    Cudd_RecursiveDerefZdd(dd, sum1);
+    Cudd_RecursiveDerefZdd(dd, term3);
+    r = cuddZddGetNode(dd, v, sum2, term4);
+    if (r == NULL) {
+	Cudd_RecursiveDerefZdd(dd, term4);
+	Cudd_RecursiveDerefZdd(dd, sum2);
+	return(NULL);
+    }
+    Cudd_Ref(r);
+    Cudd_RecursiveDerefZdd(dd, sum2);
+    Cudd_RecursiveDerefZdd(dd, term4);
+
+    cuddCacheInsert2(dd, cuddZddUnateProduct, f, g, r);
+    Cudd_Deref(r);
+    return(r);
+
+} /* end of cuddZddUnateProduct */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_zddWeakDiv.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddWeakDiv]
+
+******************************************************************************/
+DdNode	*
+cuddZddWeakDiv(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    int		v;
+    DdNode	*one = DD_ONE(dd);
+    DdNode	*zero = DD_ZERO(dd);
+    DdNode	*f0, *f1, *fd, *g0, *g1, *gd;
+    DdNode	*q, *tmp;
+    DdNode	*r;
+    int		flag;
+
+    statLine(dd);
+    if (g == one)
+	return(f);
+    if (f == zero || f == one)
+	return(zero);
+    if (f == g)
+	return(one);
+
+    /* Check cache. */
+    r = cuddCacheLookup2Zdd(dd, cuddZddWeakDiv, f, g);
+    if (r)
+	return(r);
+
+    v = g->index;
+
+    flag = cuddZddGetCofactors3(dd, f, v, &f1, &f0, &fd);
+    if (flag == 1)
+	return(NULL);
+    Cudd_Ref(f1);
+    Cudd_Ref(f0);
+    Cudd_Ref(fd);
+    flag = cuddZddGetCofactors3(dd, g, v, &g1, &g0, &gd);
+    if (flag == 1) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	return(NULL);
+    }
+    Cudd_Ref(g1);
+    Cudd_Ref(g0);
+    Cudd_Ref(gd);
+
+    q = g;
+
+    if (g0 != zero) {
+	q = cuddZddWeakDiv(dd, f0, g0);
+	if (q == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, g0);
+	    Cudd_RecursiveDerefZdd(dd, gd);
+	    return(NULL);
+	}
+	Cudd_Ref(q);
+    }
+    else
+	Cudd_Ref(q);
+    Cudd_RecursiveDerefZdd(dd, f0);
+    Cudd_RecursiveDerefZdd(dd, g0);
+
+    if (q == zero) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	cuddCacheInsert2(dd, cuddZddWeakDiv, f, g, zero);
+	Cudd_Deref(q);
+	return(zero);
+    }
+
+    if (g1 != zero) {
+	Cudd_RecursiveDerefZdd(dd, q);
+	tmp = cuddZddWeakDiv(dd, f1, g1);
+	if (tmp == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, gd);
+	    return(NULL);
+	}
+	Cudd_Ref(tmp);
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	if (q == g)
+	    q = tmp;
+	else {
+	    q = cuddZddIntersect(dd, q, tmp);
+	    if (q == NULL) {
+		Cudd_RecursiveDerefZdd(dd, fd);
+		Cudd_RecursiveDerefZdd(dd, gd);
+		return(NULL);
+	    }
+	    Cudd_Ref(q);
+	    Cudd_RecursiveDerefZdd(dd, tmp);
+	}
+    }
+    else {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, g1);
+    }
+
+    if (q == zero) {
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	cuddCacheInsert2(dd, cuddZddWeakDiv, f, g, zero);
+	Cudd_Deref(q);
+	return(zero);
+    }
+
+    if (gd != zero) {
+	Cudd_RecursiveDerefZdd(dd, q);
+	tmp = cuddZddWeakDiv(dd, fd, gd);
+	if (tmp == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, gd);
+	    return(NULL);
+	}
+	Cudd_Ref(tmp);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	if (q == g)
+	    q = tmp;
+	else {
+	    q = cuddZddIntersect(dd, q, tmp);
+	    if (q == NULL) {
+		Cudd_RecursiveDerefZdd(dd, tmp);
+		return(NULL);
+	    }
+	    Cudd_Ref(q);
+	    Cudd_RecursiveDerefZdd(dd, tmp);
+	}
+    }
+    else {
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+    }
+
+    cuddCacheInsert2(dd, cuddZddWeakDiv, f, g, q);
+    Cudd_Deref(q);
+    return(q);
+
+} /* end of cuddZddWeakDiv */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_zddWeakDivF.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddWeakDivF]
+
+******************************************************************************/
+DdNode	*
+cuddZddWeakDivF(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    int		v, top_f, top_g, vf, vg;
+    DdNode	*one = DD_ONE(dd);
+    DdNode	*zero = DD_ZERO(dd);
+    DdNode	*f0, *f1, *fd, *g0, *g1, *gd;
+    DdNode	*q, *tmp;
+    DdNode	*r;
+    DdNode	*term1, *term0, *termd;
+    int		flag;
+    int		pv, nv;
+
+    statLine(dd);
+    if (g == one)
+	return(f);
+    if (f == zero || f == one)
+	return(zero);
+    if (f == g)
+	return(one);
+
+    /* Check cache. */
+    r = cuddCacheLookup2Zdd(dd, cuddZddWeakDivF, f, g);
+    if (r)
+	return(r);
+
+    top_f = dd->permZ[f->index];
+    top_g = dd->permZ[g->index];
+    vf = top_f >> 1;
+    vg = top_g >> 1;
+    v = ddMin(top_f, top_g);
+
+    if (v == top_f && vf < vg) {
+	v = f->index;
+	flag = cuddZddGetCofactors3(dd, f, v, &f1, &f0, &fd);
+	if (flag == 1)
+	    return(NULL);
+	Cudd_Ref(f1);
+	Cudd_Ref(f0);
+	Cudd_Ref(fd);
+
+	pv = cuddZddGetPosVarIndex(dd, v);
+	nv = cuddZddGetNegVarIndex(dd, v);
+
+	term1 = cuddZddWeakDivF(dd, f1, g);
+	if (term1 == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    return(NULL);
+	}
+	Cudd_Ref(term1);
+	Cudd_RecursiveDerefZdd(dd, f1);
+	term0 = cuddZddWeakDivF(dd, f0, g);
+	if (term0 == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, term1);
+	    return(NULL);
+	}
+	Cudd_Ref(term0);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	termd = cuddZddWeakDivF(dd, fd, g);
+	if (termd == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, term1);
+	    Cudd_RecursiveDerefZdd(dd, term0);
+	    return(NULL);
+	}
+	Cudd_Ref(termd);
+	Cudd_RecursiveDerefZdd(dd, fd);
+
+	tmp = cuddZddGetNode(dd, nv, term0, termd); /* nv = zi */
+	if (tmp == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, term1);
+	    Cudd_RecursiveDerefZdd(dd, term0);
+	    Cudd_RecursiveDerefZdd(dd, termd);
+	    return(NULL);
+	}
+	Cudd_Ref(tmp);
+	Cudd_RecursiveDerefZdd(dd, term0);
+	Cudd_RecursiveDerefZdd(dd, termd);
+	q = cuddZddGetNode(dd, pv, term1, tmp); /* pv = yi */
+	if (q == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, term1);
+	    Cudd_RecursiveDerefZdd(dd, tmp);
+	    return(NULL);
+	}
+	Cudd_Ref(q);
+	Cudd_RecursiveDerefZdd(dd, term1);
+	Cudd_RecursiveDerefZdd(dd, tmp);
+
+	cuddCacheInsert2(dd, cuddZddWeakDivF, f, g, q);
+	Cudd_Deref(q);
+	return(q);
+    }
+
+    if (v == top_f)
+	v = f->index;
+    else
+	v = g->index;
+
+    flag = cuddZddGetCofactors3(dd, f, v, &f1, &f0, &fd);
+    if (flag == 1)
+	return(NULL);
+    Cudd_Ref(f1);
+    Cudd_Ref(f0);
+    Cudd_Ref(fd);
+    flag = cuddZddGetCofactors3(dd, g, v, &g1, &g0, &gd);
+    if (flag == 1) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	return(NULL);
+    }
+    Cudd_Ref(g1);
+    Cudd_Ref(g0);
+    Cudd_Ref(gd);
+
+    q = g;
+
+    if (g0 != zero) {
+	q = cuddZddWeakDivF(dd, f0, g0);
+	if (q == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, g0);
+	    Cudd_RecursiveDerefZdd(dd, gd);
+	    return(NULL);
+	}
+	Cudd_Ref(q);
+    }
+    else
+	Cudd_Ref(q);
+    Cudd_RecursiveDerefZdd(dd, f0);
+    Cudd_RecursiveDerefZdd(dd, g0);
+
+    if (q == zero) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	cuddCacheInsert2(dd, cuddZddWeakDivF, f, g, zero);
+	Cudd_Deref(q);
+	return(zero);
+    }
+
+    if (g1 != zero) {
+	Cudd_RecursiveDerefZdd(dd, q);
+	tmp = cuddZddWeakDivF(dd, f1, g1);
+	if (tmp == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, gd);
+	    return(NULL);
+	}
+	Cudd_Ref(tmp);
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	if (q == g)
+	    q = tmp;
+	else {
+	    q = cuddZddIntersect(dd, q, tmp);
+	    if (q == NULL) {
+		Cudd_RecursiveDerefZdd(dd, fd);
+		Cudd_RecursiveDerefZdd(dd, gd);
+		return(NULL);
+	    }
+	    Cudd_Ref(q);
+	    Cudd_RecursiveDerefZdd(dd, tmp);
+	}
+    }
+    else {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, g1);
+    }
+
+    if (q == zero) {
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	cuddCacheInsert2(dd, cuddZddWeakDivF, f, g, zero);
+	Cudd_Deref(q);
+	return(zero);
+    }
+
+    if (gd != zero) {
+	Cudd_RecursiveDerefZdd(dd, q);
+	tmp = cuddZddWeakDivF(dd, fd, gd);
+	if (tmp == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, fd);
+	    Cudd_RecursiveDerefZdd(dd, gd);
+	    return(NULL);
+	}
+	Cudd_Ref(tmp);
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+	if (q == g)
+	    q = tmp;
+	else {
+	    q = cuddZddIntersect(dd, q, tmp);
+	    if (q == NULL) {
+		Cudd_RecursiveDerefZdd(dd, tmp);
+		return(NULL);
+	    }
+	    Cudd_Ref(q);
+	    Cudd_RecursiveDerefZdd(dd, tmp);
+	}
+    }
+    else {
+	Cudd_RecursiveDerefZdd(dd, fd);
+	Cudd_RecursiveDerefZdd(dd, gd);
+    }
+
+    cuddCacheInsert2(dd, cuddZddWeakDivF, f, g, q);
+    Cudd_Deref(q);
+    return(q);
+
+} /* end of cuddZddWeakDivF */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_zddDivide.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddDivide]
+
+******************************************************************************/
+DdNode	*
+cuddZddDivide(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    int		v;
+    DdNode	*one = DD_ONE(dd);
+    DdNode	*zero = DD_ZERO(dd);
+    DdNode	*f0, *f1, *g0, *g1;
+    DdNode	*q, *r, *tmp;
+    int		flag;
+
+    statLine(dd);
+    if (g == one)
+	return(f);
+    if (f == zero || f == one)
+	return(zero);
+    if (f == g)
+	return(one);
+
+    /* Check cache. */
+    r = cuddCacheLookup2Zdd(dd, cuddZddDivide, f, g);
+    if (r)
+	return(r);
+
+    v = g->index;
+
+    flag = cuddZddGetCofactors2(dd, f, v, &f1, &f0);
+    if (flag == 1)
+	return(NULL);
+    Cudd_Ref(f1);
+    Cudd_Ref(f0);
+    flag = cuddZddGetCofactors2(dd, g, v, &g1, &g0);	/* g1 != zero */
+    if (flag == 1) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	return(NULL);
+    }
+    Cudd_Ref(g1);
+    Cudd_Ref(g0);
+
+    r = cuddZddDivide(dd, f1, g1);
+    if (r == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	return(NULL);
+    }
+    Cudd_Ref(r);
+
+    if (r != zero && g0 != zero) {
+	tmp = r;
+	q = cuddZddDivide(dd, f0, g0);
+	if (q == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, g0);
+	    return(NULL);
+	}
+	Cudd_Ref(q);
+	r = cuddZddIntersect(dd, r, q);
+	if (r == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, g0);
+	    Cudd_RecursiveDerefZdd(dd, q);
+	    return(NULL);
+	}
+	Cudd_Ref(r);
+	Cudd_RecursiveDerefZdd(dd, q);
+	Cudd_RecursiveDerefZdd(dd, tmp);
+    }
+
+    Cudd_RecursiveDerefZdd(dd, f1);
+    Cudd_RecursiveDerefZdd(dd, f0);
+    Cudd_RecursiveDerefZdd(dd, g1);
+    Cudd_RecursiveDerefZdd(dd, g0);
+    
+    cuddCacheInsert2(dd, cuddZddDivide, f, g, r);
+    Cudd_Deref(r);
+    return(r);
+
+} /* end of cuddZddDivide */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Performs the recursive step of Cudd_zddDivideF.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Cudd_zddDivideF]
+
+******************************************************************************/
+DdNode	*
+cuddZddDivideF(
+  DdManager * dd,
+  DdNode * f,
+  DdNode * g)
+{
+    int		v;
+    DdNode	*one = DD_ONE(dd);
+    DdNode	*zero = DD_ZERO(dd);
+    DdNode	*f0, *f1, *g0, *g1;
+    DdNode	*q, *r, *tmp;
+    int		flag;
+
+    statLine(dd);
+    if (g == one)
+	return(f);
+    if (f == zero || f == one)
+	return(zero);
+    if (f == g)
+	return(one);
+
+    /* Check cache. */
+    r = cuddCacheLookup2Zdd(dd, cuddZddDivideF, f, g);
+    if (r)
+	return(r);
+
+    v = g->index;
+
+    flag = cuddZddGetCofactors2(dd, f, v, &f1, &f0);
+    if (flag == 1)
+	return(NULL);
+    Cudd_Ref(f1);
+    Cudd_Ref(f0);
+    flag = cuddZddGetCofactors2(dd, g, v, &g1, &g0);	/* g1 != zero */
+    if (flag == 1) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	return(NULL);
+    }
+    Cudd_Ref(g1);
+    Cudd_Ref(g0);
+
+    r = cuddZddDivideF(dd, f1, g1);
+    if (r == NULL) {
+	Cudd_RecursiveDerefZdd(dd, f1);
+	Cudd_RecursiveDerefZdd(dd, f0);
+	Cudd_RecursiveDerefZdd(dd, g1);
+	Cudd_RecursiveDerefZdd(dd, g0);
+	return(NULL);
+    }
+    Cudd_Ref(r);
+
+    if (r != zero && g0 != zero) {
+	tmp = r;
+	q = cuddZddDivideF(dd, f0, g0);
+	if (q == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, g0);
+	    return(NULL);
+	}
+	Cudd_Ref(q);
+	r = cuddZddIntersect(dd, r, q);
+	if (r == NULL) {
+	    Cudd_RecursiveDerefZdd(dd, f1);
+	    Cudd_RecursiveDerefZdd(dd, f0);
+	    Cudd_RecursiveDerefZdd(dd, g1);
+	    Cudd_RecursiveDerefZdd(dd, g0);
+	    Cudd_RecursiveDerefZdd(dd, q);
+	    return(NULL);
+	}
+	Cudd_Ref(r);
+	Cudd_RecursiveDerefZdd(dd, q);
+	Cudd_RecursiveDerefZdd(dd, tmp);
+    }
+
+    Cudd_RecursiveDerefZdd(dd, f1);
+    Cudd_RecursiveDerefZdd(dd, f0);
+    Cudd_RecursiveDerefZdd(dd, g1);
+    Cudd_RecursiveDerefZdd(dd, g0);
+    
+    cuddCacheInsert2(dd, cuddZddDivideF, f, g, r);
+    Cudd_Deref(r);
+    return(r);
+
+} /* end of cuddZddDivideF */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the three-way decomposition of f w.r.t. v.]
+
+  Description [Computes the three-way decomposition of function f (represented
+  by a ZDD) wit respect to variable v.]
+
+  SideEffects [The results are returned in f1, f0, and fd.]
+
+  SeeAlso     [cuddZddGetCofactors2]
+
+******************************************************************************/
+int
+cuddZddGetCofactors3(
+  DdManager * dd,
+  DdNode * f,
+  int  v,
+  DdNode ** f1,
+  DdNode ** f0,
+  DdNode ** fd)
+{
+    DdNode	*pc, *nc;
+    DdNode	*zero = DD_ZERO(dd);
+    int		top, hv, ht, pv, nv;
+    int		level;
+
+    top = dd->permZ[f->index];
+    level = dd->permZ[v];
+    hv = level >> 1;
+    ht = top >> 1;
+
+    if (hv < ht) {
+	*f1 = zero;
+	*f0 = zero;
+	*fd = f;
+    }
+    else {
+	pv = cuddZddGetPosVarIndex(dd, v);
+	nv = cuddZddGetNegVarIndex(dd, v);
+
+	/* not to create intermediate ZDD node */
+	if (cuddZddGetPosVarLevel(dd, v) < cuddZddGetNegVarLevel(dd, v)) {
+	    pc = cuddZddSubset1(dd, f, pv);
+	    if (pc == NULL)
+		return(1);
+	    Cudd_Ref(pc);
+	    nc = cuddZddSubset0(dd, f, pv);
+	    if (nc == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		return(1);
+	    }
+	    Cudd_Ref(nc);
+
+	    *f1 = cuddZddSubset0(dd, pc, nv);
+	    if (*f1 == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		Cudd_RecursiveDerefZdd(dd, nc);
+		return(1);
+	    }
+	    Cudd_Ref(*f1);
+	    *f0 = cuddZddSubset1(dd, nc, nv);
+	    if (*f0 == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		Cudd_RecursiveDerefZdd(dd, nc);
+		Cudd_RecursiveDerefZdd(dd, *f1);
+		return(1);
+	    }
+	    Cudd_Ref(*f0);
+
+	    *fd = cuddZddSubset0(dd, nc, nv);
+	    if (*fd == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		Cudd_RecursiveDerefZdd(dd, nc);
+		Cudd_RecursiveDerefZdd(dd, *f1);
+		Cudd_RecursiveDerefZdd(dd, *f0);
+		return(1);
+	    }
+	    Cudd_Ref(*fd);
+	} else {
+	    pc = cuddZddSubset1(dd, f, nv);
+	    if (pc == NULL)
+		return(1);
+	    Cudd_Ref(pc);
+	    nc = cuddZddSubset0(dd, f, nv);
+	    if (nc == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		return(1);
+	    }
+	    Cudd_Ref(nc);
+
+	    *f0 = cuddZddSubset0(dd, pc, pv);
+	    if (*f0 == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		Cudd_RecursiveDerefZdd(dd, nc);
+		return(1);
+	    }
+	    Cudd_Ref(*f0);
+	    *f1 = cuddZddSubset1(dd, nc, pv);
+	    if (*f1 == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		Cudd_RecursiveDerefZdd(dd, nc);
+		Cudd_RecursiveDerefZdd(dd, *f1);
+		return(1);
+	    }
+	    Cudd_Ref(*f1);
+
+	    *fd = cuddZddSubset0(dd, nc, pv);
+	    if (*fd == NULL) {
+		Cudd_RecursiveDerefZdd(dd, pc);
+		Cudd_RecursiveDerefZdd(dd, nc);
+		Cudd_RecursiveDerefZdd(dd, *f1);
+		Cudd_RecursiveDerefZdd(dd, *f0);
+		return(1);
+	    }
+	    Cudd_Ref(*fd);
+	}
+
+	Cudd_RecursiveDerefZdd(dd, pc);
+	Cudd_RecursiveDerefZdd(dd, nc);
+	Cudd_Deref(*f1);
+	Cudd_Deref(*f0);
+	Cudd_Deref(*fd);
+    }
+    return(0);
+
+} /* end of cuddZddGetCofactors3 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the two-way decomposition of f w.r.t. v.]
+
+  Description []
+
+  SideEffects [The results are returned in f1 and f0.]
+
+  SeeAlso     [cuddZddGetCofactors3]
+
+******************************************************************************/
+int
+cuddZddGetCofactors2(
+  DdManager * dd,
+  DdNode * f,
+  int  v,
+  DdNode ** f1,
+  DdNode ** f0)
+{
+    *f1 = cuddZddSubset1(dd, f, v);
+    if (*f1 == NULL)
+	return(1);
+    *f0 = cuddZddSubset0(dd, f, v);
+    if (*f0 == NULL) {
+	Cudd_RecursiveDerefZdd(dd, *f1);
+	return(1);
+    }
+    return(0);
+
+} /* end of cuddZddGetCofactors2 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes a complement of a ZDD node.]
+
+  Description [Computes the complement of a ZDD node. So far, since we
+  couldn't find a direct way to get the complement of a ZDD cover, we first
+  convert a ZDD cover to a BDD, then make the complement of the ZDD cover
+  from the complement of the BDD node by using ISOP.]
+
+  SideEffects [The result depends on current variable order.]
+
+  SeeAlso     []
+
+******************************************************************************/
+DdNode	*
+cuddZddComplement(
+  DdManager * dd,
+  DdNode *node)
+{
+    DdNode	*b, *isop, *zdd_I;
+
+    /* Check cache */
+    zdd_I = cuddCacheLookup1Zdd(dd, cuddZddComplement, node);
+    if (zdd_I)
+	return(zdd_I);
+
+    b = cuddMakeBddFromZddCover(dd, node);
+    if (!b)
+	return(NULL);
+    cuddRef(b);
+    isop = cuddZddIsop(dd, Cudd_Not(b), Cudd_Not(b), &zdd_I);
+    if (!isop) {
+	Cudd_RecursiveDeref(dd, b);
+	return(NULL);
+    }
+    cuddRef(isop);
+    cuddRef(zdd_I);
+    Cudd_RecursiveDeref(dd, b);
+    Cudd_RecursiveDeref(dd, isop);
+
+    cuddCacheInsert1(dd, cuddZddComplement, node, zdd_I);
+    cuddDeref(zdd_I);
+    return(zdd_I);
+} /* end of cuddZddComplement */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the index of positive ZDD variable.]
+
+  Description [Returns the index of positive ZDD variable.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddZddGetPosVarIndex(
+  DdManager * dd,
+  int index)
+{
+    int	pv = (index >> 1) << 1;
+    return(pv);
+} /* end of cuddZddGetPosVarIndex */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the index of negative ZDD variable.]
+
+  Description [Returns the index of negative ZDD variable.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddZddGetNegVarIndex(
+  DdManager * dd,
+  int index)
+{
+    int	nv = index | 0x1;
+    return(nv);
+} /* end of cuddZddGetPosVarIndex */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the level of positive ZDD variable.]
+
+  Description [Returns the level of positive ZDD variable.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddZddGetPosVarLevel(
+  DdManager * dd,
+  int index)
+{
+    int	pv = cuddZddGetPosVarIndex(dd, index);
+    return(dd->permZ[pv]);
+} /* end of cuddZddGetPosVarLevel */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the level of negative ZDD variable.]
+
+  Description [Returns the level of negative ZDD variable.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddZddGetNegVarLevel(
+  DdManager * dd,
+  int index)
+{
+    int	nv = cuddZddGetNegVarIndex(dd, index);
+    return(dd->permZ[nv]);
+} /* end of cuddZddGetNegVarLevel */
Index: /vis_dev/glu-2.1/src/cuBdd/cuddZddGroup.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddZddGroup.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddZddGroup.c	(revision 6)
@@ -0,0 +1,1337 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddZddGroup.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions for ZDD group sifting.]
+
+  Description [External procedures included in this file:
+		<ul>
+		<li> Cudd_MakeZddTreeNode()
+		</ul>
+	Internal procedures included in this file:
+		<ul>
+		<li> cuddZddTreeSifting()
+		</ul>
+	Static procedures included in this module:
+		<ul>
+		<li> zddTreeSiftingAux()
+		<li> zddCountInternalMtrNodes()
+		<li> zddReorderChildren()
+		<li> zddFindNodeHiLo()
+		<li> zddUniqueCompareGroup()
+		<li> zddGroupSifting()
+		<li> zddGroupSiftingAux()
+		<li> zddGroupSiftingUp()
+		<li> zddGroupSiftingDown()
+		<li> zddGroupMove()
+		<li> zddGroupMoveBackward()
+		<li> zddGroupSiftingBackward()
+		<li> zddMergeGroups()
+		</ul>]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddZddGroup.c,v 1.19 2004/08/13 18:04:53 fabio Exp $";
+#endif
+
+static	int	*entry;
+extern	int	zddTotalNumberSwapping;
+#ifdef DD_STATS
+static  int     extsymmcalls;
+static  int     extsymm;
+static  int     secdiffcalls;
+static  int     secdiff;
+static  int     secdiffmisfire;
+#endif
+#ifdef DD_DEBUG
+static	int	pr = 0;	/* flag to enable printing while debugging */
+			/* by depositing a 1 into it */
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int zddTreeSiftingAux (DdManager *table, MtrNode *treenode, Cudd_ReorderingType method);
+#ifdef DD_STATS
+static int zddCountInternalMtrNodes (DdManager *table, MtrNode *treenode);
+#endif
+static int zddReorderChildren (DdManager *table, MtrNode *treenode, Cudd_ReorderingType method);
+static void zddFindNodeHiLo (DdManager *table, MtrNode *treenode, int *lower, int *upper);
+static int zddUniqueCompareGroup (int *ptrX, int *ptrY);
+static int zddGroupSifting (DdManager *table, int lower, int upper);
+static int zddGroupSiftingAux (DdManager *table, int x, int xLow, int xHigh);
+static int zddGroupSiftingUp (DdManager *table, int y, int xLow, Move **moves);
+static int zddGroupSiftingDown (DdManager *table, int x, int xHigh, Move **moves);
+static int zddGroupMove (DdManager *table, int x, int y, Move **moves);
+static int zddGroupMoveBackward (DdManager *table, int x, int y);
+static int zddGroupSiftingBackward (DdManager *table, Move *moves, int size);
+static void zddMergeGroups (DdManager *table, MtrNode *treenode, int low, int high);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a new ZDD variable group.]
+
+  Description [Creates a new ZDD variable group. The group starts at
+  variable and contains size variables. The parameter low is the index
+  of the first variable. If the variable already exists, its current
+  position in the order is known to the manager. If the variable does
+  not exist yet, the position is assumed to be the same as the index.
+  The group tree is created if it does not exist yet.
+  Returns a pointer to the group if successful; NULL otherwise.]
+
+  SideEffects [The ZDD variable tree is changed.]
+
+  SeeAlso     [Cudd_MakeTreeNode]
+
+******************************************************************************/
+MtrNode *
+Cudd_MakeZddTreeNode(
+  DdManager * dd /* manager */,
+  unsigned int  low /* index of the first group variable */,
+  unsigned int  size /* number of variables in the group */,
+  unsigned int  type /* MTR_DEFAULT or MTR_FIXED */)
+{
+    MtrNode *group;
+    MtrNode *tree;
+    unsigned int level;
+
+    /* If the variable does not exist yet, the position is assumed to be
+    ** the same as the index. Therefore, applications that rely on
+    ** Cudd_bddNewVarAtLevel or Cudd_addNewVarAtLevel to create new
+    ** variables have to create the variables before they group them.
+    */
+    level = (low < (unsigned int) dd->sizeZ) ? dd->permZ[low] : low;
+
+    if (level + size - 1> (int) MTR_MAXHIGH)
+	return(NULL);
+
+    /* If the tree does not exist yet, create it. */
+    tree = dd->treeZ;
+    if (tree == NULL) {
+	dd->treeZ = tree = Mtr_InitGroupTree(0, dd->sizeZ);
+	if (tree == NULL)
+	    return(NULL);
+	tree->index = dd->invpermZ[0];
+    }
+
+    /* Extend the upper bound of the tree if necessary. This allows the
+    ** application to create groups even before the variables are created.
+    */
+    tree->size = ddMax(tree->size, level + size);
+
+    /* Create the group. */
+    group = Mtr_MakeGroup(tree, level, size, type);
+    if (group == NULL)
+	return(NULL);
+
+    /* Initialize the index field to the index of the variable currently
+    ** in position low. This field will be updated by the reordering
+    ** procedure to provide a handle to the group once it has been moved.
+    */
+    group->index = (MtrHalfWord) low;
+
+    return(group);
+
+} /* end of Cudd_MakeZddTreeNode */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Tree sifting algorithm for ZDDs.]
+
+  Description [Tree sifting algorithm for ZDDs. Assumes that a tree
+  representing a group hierarchy is passed as a parameter. It then
+  reorders each group in postorder fashion by calling
+  zddTreeSiftingAux.  Assumes that no dead nodes are present.  Returns
+  1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+int
+cuddZddTreeSifting(
+  DdManager * table /* DD table */,
+  Cudd_ReorderingType method /* reordering method for the groups of leaves */)
+{
+    int i;
+    int nvars;
+    int result;
+    int tempTree;
+
+    /* If no tree is provided we create a temporary one in which all
+    ** variables are in a single group. After reordering this tree is
+    ** destroyed.
+    */
+    tempTree = table->treeZ == NULL;
+    if (tempTree) {
+	table->treeZ = Mtr_InitGroupTree(0,table->sizeZ);
+	table->treeZ->index = table->invpermZ[0];
+    }
+    nvars = table->sizeZ;
+
+#ifdef DD_DEBUG
+    if (pr > 0 && !tempTree)
+	(void) fprintf(table->out,"cuddZddTreeSifting:");
+    Mtr_PrintGroups(table->treeZ,pr <= 0);
+#endif
+#if 0
+    /* Debugging code. */
+    if (table->tree && table->treeZ) {
+	(void) fprintf(table->out,"\n");
+	Mtr_PrintGroups(table->tree, 0);
+	cuddPrintVarGroups(table,table->tree,0,0);
+	for (i = 0; i < table->size; i++) {
+	    (void) fprintf(table->out,"%s%d",
+			   (i == 0) ? "" : ",", table->invperm[i]);
+	}
+	(void) fprintf(table->out,"\n");
+	for (i = 0; i < table->size; i++) {
+	    (void) fprintf(table->out,"%s%d",
+			   (i == 0) ? "" : ",", table->perm[i]);
+	}
+	(void) fprintf(table->out,"\n\n");
+	Mtr_PrintGroups(table->treeZ,0);
+	cuddPrintVarGroups(table,table->treeZ,1,0);
+	for (i = 0; i < table->sizeZ; i++) {
+	    (void) fprintf(table->out,"%s%d",
+			   (i == 0) ? "" : ",", table->invpermZ[i]);
+	}
+	(void) fprintf(table->out,"\n");
+	for (i = 0; i < table->sizeZ; i++) {
+	    (void) fprintf(table->out,"%s%d",
+			   (i == 0) ? "" : ",", table->permZ[i]);
+	}
+	(void) fprintf(table->out,"\n");
+    }
+    /* End of debugging code. */
+#endif
+#ifdef DD_STATS
+    extsymmcalls = 0;
+    extsymm = 0;
+    secdiffcalls = 0;
+    secdiff = 0;
+    secdiffmisfire = 0;
+
+    (void) fprintf(table->out,"\n");
+    if (!tempTree)
+	(void) fprintf(table->out,"#:IM_NODES  %8d: group tree nodes\n",
+		       zddCountInternalMtrNodes(table,table->treeZ));
+#endif
+
+    /* Initialize the group of each subtable to itself. Initially
+    ** there are no groups. Groups are created according to the tree
+    ** structure in postorder fashion.
+    */
+    for (i = 0; i < nvars; i++)
+        table->subtableZ[i].next = i;
+
+    /* Reorder. */
+    result = zddTreeSiftingAux(table, table->treeZ, method);
+
+#ifdef DD_STATS		/* print stats */
+    if (!tempTree && method == CUDD_REORDER_GROUP_SIFT &&
+	(table->groupcheck == CUDD_GROUP_CHECK7 ||
+	 table->groupcheck == CUDD_GROUP_CHECK5)) {
+	(void) fprintf(table->out,"\nextsymmcalls = %d\n",extsymmcalls);
+	(void) fprintf(table->out,"extsymm = %d",extsymm);
+    }
+    if (!tempTree && method == CUDD_REORDER_GROUP_SIFT &&
+	table->groupcheck == CUDD_GROUP_CHECK7) {
+	(void) fprintf(table->out,"\nsecdiffcalls = %d\n",secdiffcalls);
+	(void) fprintf(table->out,"secdiff = %d\n",secdiff);
+	(void) fprintf(table->out,"secdiffmisfire = %d",secdiffmisfire);
+    }
+#endif
+
+    if (tempTree)
+	Cudd_FreeZddTree(table);
+    return(result);
+
+} /* end of cuddZddTreeSifting */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Visits the group tree and reorders each group.]
+
+  Description [Recursively visits the group tree and reorders each
+  group in postorder fashion.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddTreeSiftingAux(
+  DdManager * table,
+  MtrNode * treenode,
+  Cudd_ReorderingType method)
+{
+    MtrNode  *auxnode;
+    int res;
+
+#ifdef DD_DEBUG
+    Mtr_PrintGroups(treenode,1);
+#endif
+
+    auxnode = treenode;
+    while (auxnode != NULL) {
+	if (auxnode->child != NULL) {
+	    if (!zddTreeSiftingAux(table, auxnode->child, method))
+		return(0);
+	    res = zddReorderChildren(table, auxnode, CUDD_REORDER_GROUP_SIFT);
+	    if (res == 0)
+		return(0);
+	} else if (auxnode->size > 1) {
+	    if (!zddReorderChildren(table, auxnode, method))
+		return(0);
+	}
+	auxnode = auxnode->younger;
+    }
+
+    return(1);
+
+} /* end of zddTreeSiftingAux */
+
+
+#ifdef DD_STATS
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of internal nodes of the group tree.]
+
+  Description [Counts the number of internal nodes of the group tree.
+  Returns the count.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddCountInternalMtrNodes(
+  DdManager * table,
+  MtrNode * treenode)
+{
+    MtrNode *auxnode;
+    int     count,nodeCount;
+
+
+    nodeCount = 0;
+    auxnode = treenode;
+    while (auxnode != NULL) {
+	if (!(MTR_TEST(auxnode,MTR_TERMINAL))) {
+	    nodeCount++;
+	    count = zddCountInternalMtrNodes(table,auxnode->child);
+	    nodeCount += count;
+	}
+	auxnode = auxnode->younger;
+    }
+
+    return(nodeCount);
+
+} /* end of zddCountInternalMtrNodes */
+#endif
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reorders the children of a group tree node according to
+  the options.]
+
+  Description [Reorders the children of a group tree node according to
+  the options. After reordering puts all the variables in the group
+  and/or its descendents in a single group. This allows hierarchical
+  reordering.  If the variables in the group do not exist yet, simply
+  does nothing. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddReorderChildren(
+  DdManager * table,
+  MtrNode * treenode,
+  Cudd_ReorderingType method)
+{
+    int lower;
+    int upper;
+    int result;
+    unsigned int initialSize;
+
+    zddFindNodeHiLo(table,treenode,&lower,&upper);
+    /* If upper == -1 these variables do not exist yet. */
+    if (upper == -1)
+	return(1);
+
+    if (treenode->flags == MTR_FIXED) {
+	result = 1;
+    } else {
+#ifdef DD_STATS
+	(void) fprintf(table->out," ");
+#endif
+	switch (method) {
+	case CUDD_REORDER_RANDOM:
+	case CUDD_REORDER_RANDOM_PIVOT:
+	    result = cuddZddSwapping(table,lower,upper,method);
+	    break;
+	case CUDD_REORDER_SIFT:
+	    result = cuddZddSifting(table,lower,upper);
+	    break;
+	case CUDD_REORDER_SIFT_CONVERGE:
+	    do {
+		initialSize = table->keysZ;
+		result = cuddZddSifting(table,lower,upper);
+		if (initialSize <= table->keysZ)
+		    break;
+#ifdef DD_STATS
+		else
+		    (void) fprintf(table->out,"\n");
+#endif
+	    } while (result != 0);
+	    break;
+	case CUDD_REORDER_SYMM_SIFT:
+	    result = cuddZddSymmSifting(table,lower,upper);
+	    break;
+	case CUDD_REORDER_SYMM_SIFT_CONV:
+	    result = cuddZddSymmSiftingConv(table,lower,upper);
+	    break;
+	case CUDD_REORDER_GROUP_SIFT:
+	    result = zddGroupSifting(table,lower,upper);
+	    break;
+	case CUDD_REORDER_LINEAR:
+	    result = cuddZddLinearSifting(table,lower,upper);
+	    break;
+	case CUDD_REORDER_LINEAR_CONVERGE:
+	    do {
+		initialSize = table->keysZ;
+		result = cuddZddLinearSifting(table,lower,upper);
+		if (initialSize <= table->keysZ)
+		    break;
+#ifdef DD_STATS
+		else
+		    (void) fprintf(table->out,"\n");
+#endif
+	    } while (result != 0);
+	    break;
+	default:
+	    return(0);
+	}
+    }
+
+    /* Create a single group for all the variables that were sifted,
+    ** so that they will be treated as a single block by successive
+    ** invocations of zddGroupSifting.
+    */
+    zddMergeGroups(table,treenode,lower,upper);
+
+#ifdef DD_DEBUG
+    if (pr > 0) (void) fprintf(table->out,"zddReorderChildren:");
+#endif
+
+    return(result);
+
+} /* end of zddReorderChildren */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Finds the lower and upper bounds of the group represented
+  by treenode.]
+
+  Description [Finds the lower and upper bounds of the group represented
+  by treenode.  The high and low fields of treenode are indices.  From
+  those we need to derive the current positions, and find maximum and
+  minimum.]
+
+  SideEffects [The bounds are returned as side effects.]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+zddFindNodeHiLo(
+  DdManager * table,
+  MtrNode * treenode,
+  int * lower,
+  int * upper)
+{
+    int low;
+    int high;
+
+    /* Check whether no variables in this group already exist.
+    ** If so, return immediately. The calling procedure will know from
+    ** the values of upper that no reordering is needed.
+    */
+    if ((int) treenode->low >= table->sizeZ) {
+	*lower = table->sizeZ;
+	*upper = -1;
+	return;
+    }
+
+    *lower = low = (unsigned int) table->permZ[treenode->index];
+    high = (int) (low + treenode->size - 1);
+
+    if (high >= table->sizeZ) {
+	/* This is the case of a partially existing group. The aim is to
+	** reorder as many variables as safely possible.  If the tree
+	** node is terminal, we just reorder the subset of the group
+	** that is currently in existence.  If the group has
+	** subgroups, then we only reorder those subgroups that are
+	** fully instantiated.  This way we avoid breaking up a group.
+	*/
+	MtrNode *auxnode = treenode->child;
+	if (auxnode == NULL) {
+	    *upper = (unsigned int) table->sizeZ - 1;
+	} else {
+	    /* Search the subgroup that strands the table->sizeZ line.
+	    ** If the first group starts at 0 and goes past table->sizeZ
+	    ** upper will get -1, thus correctly signaling that no reordering
+	    ** should take place.
+	    */
+	    while (auxnode != NULL) {
+		int thisLower = table->permZ[auxnode->low];
+		int thisUpper = thisLower + auxnode->size - 1;
+		if (thisUpper >= table->sizeZ && thisLower < table->sizeZ)
+		    *upper = (unsigned int) thisLower - 1;
+		auxnode = auxnode->younger;
+	    }
+	}
+    } else {
+	/* Normal case: All the variables of the group exist. */
+	*upper = (unsigned int) high;
+    }
+
+#ifdef DD_DEBUG
+    /* Make sure that all variables in group are contiguous. */
+    assert(treenode->size >= *upper - *lower + 1);
+#endif
+
+    return;
+
+} /* end of zddFindNodeHiLo */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Comparison function used by qsort.]
+
+  Description [Comparison function used by qsort to order the variables
+  according to the number of keys in the subtables.  Returns the
+  difference in number of keys between the two variables being
+  compared.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddUniqueCompareGroup(
+  int * ptrX,
+  int * ptrY)
+{
+#if 0
+    if (entry[*ptrY] == entry[*ptrX]) {
+	return((*ptrX) - (*ptrY));
+    }
+#endif
+    return(entry[*ptrY] - entry[*ptrX]);
+
+} /* end of zddUniqueCompareGroup */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sifts from treenode->low to treenode->high.]
+
+  Description [Sifts from treenode->low to treenode->high. If
+  croupcheck == CUDD_GROUP_CHECK7, it checks for group creation at the
+  end of the initial sifting. If a group is created, it is then sifted
+  again. After sifting one variable, the group that contains it is
+  dissolved.  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupSifting(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int		*var;
+    int		i,j,x,xInit;
+    int		nvars;
+    int		classes;
+    int		result;
+    int		*sifted;
+#ifdef DD_STATS
+    unsigned	previousSize;
+#endif
+    int		xindex;
+
+    nvars = table->sizeZ;
+
+    /* Order variables to sift. */
+    entry = NULL;
+    sifted = NULL;
+    var = ALLOC(int,nvars);
+    if (var == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto zddGroupSiftingOutOfMem;
+    }
+    entry = ALLOC(int,nvars);
+    if (entry == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto zddGroupSiftingOutOfMem;
+    }
+    sifted = ALLOC(int,nvars);
+    if (sifted == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto zddGroupSiftingOutOfMem;
+    }
+
+    /* Here we consider only one representative for each group. */
+    for (i = 0, classes = 0; i < nvars; i++) {
+	sifted[i] = 0;
+	x = table->permZ[i];
+	if ((unsigned) x >= table->subtableZ[x].next) {
+	    entry[i] = table->subtableZ[x].keys;
+	    var[classes] = i;
+	    classes++;
+	}
+    }
+
+    qsort((void *)var,classes,sizeof(int),(DD_QSFP)zddUniqueCompareGroup);
+
+    /* Now sift. */
+    for (i = 0; i < ddMin(table->siftMaxVar,classes); i++) {
+	if (zddTotalNumberSwapping >= table->siftMaxSwap)
+	    break;
+	xindex = var[i];
+	if (sifted[xindex] == 1) /* variable already sifted as part of group */
+	    continue;
+        x = table->permZ[xindex]; /* find current level of this variable */
+	if (x < lower || x > upper)
+	    continue;
+#ifdef DD_STATS
+	previousSize = table->keysZ;
+#endif
+#ifdef DD_DEBUG
+	/* x is bottom of group */
+        assert((unsigned) x >= table->subtableZ[x].next);
+#endif
+	result = zddGroupSiftingAux(table,x,lower,upper);
+	if (!result) goto zddGroupSiftingOutOfMem;
+
+#ifdef DD_STATS
+	if (table->keysZ < previousSize) {
+	    (void) fprintf(table->out,"-");
+	} else if (table->keysZ > previousSize) {
+	    (void) fprintf(table->out,"+");
+	} else {
+	    (void) fprintf(table->out,"=");
+	}
+	fflush(table->out);
+#endif
+
+	/* Mark variables in the group just sifted. */
+	x = table->permZ[xindex];
+	if ((unsigned) x != table->subtableZ[x].next) {
+	    xInit = x;
+	    do {
+		j = table->invpermZ[x];
+		sifted[j] = 1;
+		x = table->subtableZ[x].next;
+	    } while (x != xInit);
+	}
+
+#ifdef DD_DEBUG
+	if (pr > 0) (void) fprintf(table->out,"zddGroupSifting:");
+#endif
+    } /* for */
+
+    FREE(sifted);
+    FREE(var);
+    FREE(entry);
+
+    return(1);
+
+zddGroupSiftingOutOfMem:
+    if (entry != NULL)	FREE(entry);
+    if (var != NULL)	FREE(var);
+    if (sifted != NULL)	FREE(sifted);
+
+    return(0);
+
+} /* end of zddGroupSifting */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sifts one variable up and down until it has taken all
+  positions. Checks for aggregation.]
+
+  Description [Sifts one variable up and down until it has taken all
+  positions. Checks for aggregation. There may be at most two sweeps,
+  even if the group grows.  Assumes that x is either an isolated
+  variable, or it is the bottom of a group. All groups may not have
+  been found. The variable being moved is returned to the best position
+  seen during sifting.  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupSiftingAux(
+  DdManager * table,
+  int  x,
+  int  xLow,
+  int  xHigh)
+{
+    Move *move;
+    Move *moves;	/* list of moves */
+    int  initialSize;
+    int  result;
+
+
+#ifdef DD_DEBUG
+    if (pr > 0) (void) fprintf(table->out,"zddGroupSiftingAux from %d to %d\n",xLow,xHigh);
+    assert((unsigned) x >= table->subtableZ[x].next); /* x is bottom of group */
+#endif
+
+    initialSize = table->keysZ;
+    moves = NULL;
+
+    if (x == xLow) { /* Sift down */
+#ifdef DD_DEBUG
+	/* x must be a singleton */
+	assert((unsigned) x == table->subtableZ[x].next);
+#endif
+	if (x == xHigh) return(1);	/* just one variable */
+
+        if (!zddGroupSiftingDown(table,x,xHigh,&moves))
+            goto zddGroupSiftingAuxOutOfMem;
+	/* at this point x == xHigh, unless early term */
+
+	/* move backward and stop at best position */
+	result = zddGroupSiftingBackward(table,moves,initialSize);
+#ifdef DD_DEBUG
+	assert(table->keysZ <= (unsigned) initialSize);
+#endif
+        if (!result) goto zddGroupSiftingAuxOutOfMem;
+
+    } else if (cuddZddNextHigh(table,x) > xHigh) { /* Sift up */
+#ifdef DD_DEBUG
+	/* x is bottom of group */
+        assert((unsigned) x >= table->subtableZ[x].next);
+#endif
+        /* Find top of x's group */
+        x = table->subtableZ[x].next;
+
+        if (!zddGroupSiftingUp(table,x,xLow,&moves))
+            goto zddGroupSiftingAuxOutOfMem;
+	/* at this point x == xLow, unless early term */
+
+	/* move backward and stop at best position */
+	result = zddGroupSiftingBackward(table,moves,initialSize);
+#ifdef DD_DEBUG
+	assert(table->keysZ <= (unsigned) initialSize);
+#endif
+        if (!result) goto zddGroupSiftingAuxOutOfMem;
+
+    } else if (x - xLow > xHigh - x) { /* must go down first: shorter */
+        if (!zddGroupSiftingDown(table,x,xHigh,&moves))
+            goto zddGroupSiftingAuxOutOfMem;
+	/* at this point x == xHigh, unless early term */
+
+        /* Find top of group */
+	if (moves) {
+	    x = moves->y;
+	}
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+	x = table->subtableZ[x].next;
+#ifdef DD_DEBUG
+        /* x should be the top of a group */
+        assert((unsigned) x <= table->subtableZ[x].next);
+#endif
+
+        if (!zddGroupSiftingUp(table,x,xLow,&moves))
+            goto zddGroupSiftingAuxOutOfMem;
+
+	/* move backward and stop at best position */
+	result = zddGroupSiftingBackward(table,moves,initialSize);
+#ifdef DD_DEBUG
+	assert(table->keysZ <= (unsigned) initialSize);
+#endif
+        if (!result) goto zddGroupSiftingAuxOutOfMem;
+
+    } else { /* moving up first: shorter */
+        /* Find top of x's group */
+        x = table->subtableZ[x].next;
+
+        if (!zddGroupSiftingUp(table,x,xLow,&moves))
+            goto zddGroupSiftingAuxOutOfMem;
+	/* at this point x == xHigh, unless early term */
+
+        if (moves) {
+	    x = moves->x;
+	}
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+#ifdef DD_DEBUG
+        /* x is bottom of a group */
+        assert((unsigned) x >= table->subtableZ[x].next);
+#endif
+
+        if (!zddGroupSiftingDown(table,x,xHigh,&moves))
+            goto zddGroupSiftingAuxOutOfMem;
+
+	/* move backward and stop at best position */
+	result = zddGroupSiftingBackward(table,moves,initialSize);
+#ifdef DD_DEBUG
+	assert(table->keysZ <= (unsigned) initialSize);
+#endif
+        if (!result) goto zddGroupSiftingAuxOutOfMem;
+    }
+
+    while (moves != NULL) {
+        move = moves->next;
+        cuddDeallocMove(table, moves);
+        moves = move;
+    }
+
+    return(1);
+
+zddGroupSiftingAuxOutOfMem:
+    while (moves != NULL) {
+        move = moves->next;
+        cuddDeallocMove(table, moves);
+        moves = move;
+    }
+
+    return(0);
+
+} /* end of zddGroupSiftingAux */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sifts up a variable until either it reaches position xLow
+  or the size of the DD heap increases too much.]
+
+  Description [Sifts up a variable until either it reaches position
+  xLow or the size of the DD heap increases too much. Assumes that y is
+  the top of a group (or a singleton).  Checks y for aggregation to the
+  adjacent variables. Records all the moves that are appended to the
+  list of moves received as input and returned as a side effect.
+  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupSiftingUp(
+  DdManager * table,
+  int  y,
+  int  xLow,
+  Move ** moves)
+{
+    Move *move;
+    int  x;
+    int  size;
+    int  gxtop;
+    int  limitSize;
+
+    limitSize = table->keysZ;
+
+    x = cuddZddNextLow(table,y);
+    while (x >= xLow) {
+        gxtop = table->subtableZ[x].next;
+        if (table->subtableZ[x].next == (unsigned) x &&
+	    table->subtableZ[y].next == (unsigned) y) {
+            /* x and y are self groups */
+            size = cuddZddSwapInPlace(table,x,y);
+#ifdef DD_DEBUG
+            assert(table->subtableZ[x].next == (unsigned) x);
+            assert(table->subtableZ[y].next == (unsigned) y);
+#endif
+            if (size == 0) goto zddGroupSiftingUpOutOfMem;
+            move = (Move *)cuddDynamicAllocNode(table);
+            if (move == NULL) goto zddGroupSiftingUpOutOfMem;
+            move->x = x;
+            move->y = y;
+	    move->flags = MTR_DEFAULT;
+            move->size = size;
+            move->next = *moves;
+            *moves = move;
+
+#ifdef DD_DEBUG
+	    if (pr > 0) (void) fprintf(table->out,"zddGroupSiftingUp (2 single groups):\n");
+#endif
+            if ((double) size > (double) limitSize * table->maxGrowth)
+		return(1);
+            if (size < limitSize) limitSize = size;
+        } else { /* group move */
+            size = zddGroupMove(table,x,y,moves);
+	    if (size == 0) goto zddGroupSiftingUpOutOfMem;
+            if ((double) size > (double) limitSize * table->maxGrowth)
+		return(1);
+            if (size < limitSize) limitSize = size;
+        }
+        y = gxtop;
+        x = cuddZddNextLow(table,y);
+    }
+
+    return(1);
+
+zddGroupSiftingUpOutOfMem:
+    while (*moves != NULL) {
+        move = (*moves)->next;
+        cuddDeallocMove(table, *moves);
+        *moves = move;
+    }
+    return(0);
+
+} /* end of zddGroupSiftingUp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sifts down a variable until it reaches position xHigh.]
+
+  Description [Sifts down a variable until it reaches position xHigh.
+  Assumes that x is the bottom of a group (or a singleton).  Records
+  all the moves.  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupSiftingDown(
+  DdManager * table,
+  int  x,
+  int  xHigh,
+  Move ** moves)
+{
+    Move *move;
+    int  y;
+    int  size;
+    int  limitSize;
+    int  gybot;
+
+
+    /* Initialize R */
+    limitSize = size = table->keysZ;
+    y = cuddZddNextHigh(table,x);
+    while (y <= xHigh) {
+	/* Find bottom of y group. */
+        gybot = table->subtableZ[y].next;
+        while (table->subtableZ[gybot].next != (unsigned) y)
+            gybot = table->subtableZ[gybot].next;
+
+        if (table->subtableZ[x].next == (unsigned) x &&
+	    table->subtableZ[y].next == (unsigned) y) {
+            /* x and y are self groups */
+            size = cuddZddSwapInPlace(table,x,y);
+#ifdef DD_DEBUG
+            assert(table->subtableZ[x].next == (unsigned) x);
+            assert(table->subtableZ[y].next == (unsigned) y);
+#endif
+            if (size == 0) goto zddGroupSiftingDownOutOfMem;
+
+	    /* Record move. */
+            move = (Move *) cuddDynamicAllocNode(table);
+            if (move == NULL) goto zddGroupSiftingDownOutOfMem;
+            move->x = x;
+            move->y = y;
+	    move->flags = MTR_DEFAULT;
+            move->size = size;
+            move->next = *moves;
+            *moves = move;
+
+#ifdef DD_DEBUG
+            if (pr > 0) (void) fprintf(table->out,"zddGroupSiftingDown (2 single groups):\n");
+#endif
+            if ((double) size > (double) limitSize * table->maxGrowth)
+                return(1);
+            if (size < limitSize) limitSize = size;
+            x = y;
+            y = cuddZddNextHigh(table,x);
+        } else { /* Group move */
+            size = zddGroupMove(table,x,y,moves);
+            if (size == 0) goto zddGroupSiftingDownOutOfMem;
+            if ((double) size > (double) limitSize * table->maxGrowth)
+		return(1);
+            if (size < limitSize) limitSize = size;
+        }
+        x = gybot;
+        y = cuddZddNextHigh(table,x);
+    }
+
+    return(1);
+
+zddGroupSiftingDownOutOfMem:
+    while (*moves != NULL) {
+        move = (*moves)->next;
+        cuddDeallocMove(table, *moves);
+        *moves = move;
+    }
+
+    return(0);
+
+} /* end of zddGroupSiftingDown */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Swaps two groups and records the move.]
+
+  Description [Swaps two groups and records the move. Returns the
+  number of keys in the DD table in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupMove(
+  DdManager * table,
+  int  x,
+  int  y,
+  Move ** moves)
+{
+    Move *move;
+    int  size;
+    int  i,j,xtop,xbot,xsize,ytop,ybot,ysize,newxtop;
+    int  swapx,swapy;
+#if defined(DD_DEBUG) && defined(DD_VERBOSE)
+    int  initialSize,bestSize;
+#endif
+
+#if DD_DEBUG
+    /* We assume that x < y */
+    assert(x < y);
+#endif
+    /* Find top, bottom, and size for the two groups. */
+    xbot = x;
+    xtop = table->subtableZ[x].next;
+    xsize = xbot - xtop + 1;
+    ybot = y;
+    while ((unsigned) ybot < table->subtableZ[ybot].next)
+        ybot = table->subtableZ[ybot].next;
+    ytop = y;
+    ysize = ybot - ytop + 1;
+
+#if defined(DD_DEBUG) && defined(DD_VERBOSE)
+    initialSize = bestSize = table->keysZ;
+#endif
+    /* Sift the variables of the second group up through the first group */
+    for (i = 1; i <= ysize; i++) {
+        for (j = 1; j <= xsize; j++) {
+            size = cuddZddSwapInPlace(table,x,y);
+            if (size == 0) goto zddGroupMoveOutOfMem;
+#if defined(DD_DEBUG) && defined(DD_VERBOSE)
+	    if (size < bestSize)
+		bestSize = size;
+#endif
+            swapx = x; swapy = y;
+            y = x;
+            x = cuddZddNextLow(table,y);
+        }
+        y = ytop + i;
+        x = cuddZddNextLow(table,y);
+    }
+#if defined(DD_DEBUG) && defined(DD_VERBOSE)
+    if ((bestSize < initialSize) && (bestSize < size))
+	(void) fprintf(table->out,"Missed local minimum: initialSize:%d  bestSize:%d  finalSize:%d\n",initialSize,bestSize,size);
+#endif
+
+    /* fix groups */
+    y = xtop; /* ytop is now where xtop used to be */
+    for (i = 0; i < ysize - 1; i++) {
+        table->subtableZ[y].next = cuddZddNextHigh(table,y);
+        y = cuddZddNextHigh(table,y);
+    }
+    table->subtableZ[y].next = xtop; /* y is bottom of its group, join */
+                                    /* it to top of its group */
+    x = cuddZddNextHigh(table,y);
+    newxtop = x;
+    for (i = 0; i < xsize - 1; i++) {
+        table->subtableZ[x].next = cuddZddNextHigh(table,x);
+        x = cuddZddNextHigh(table,x);
+    }
+    table->subtableZ[x].next = newxtop; /* x is bottom of its group, join */
+                                    /* it to top of its group */
+#ifdef DD_DEBUG
+    if (pr > 0) (void) fprintf(table->out,"zddGroupMove:\n");
+#endif
+
+    /* Store group move */
+    move = (Move *) cuddDynamicAllocNode(table);
+    if (move == NULL) goto zddGroupMoveOutOfMem;
+    move->x = swapx;
+    move->y = swapy;
+    move->flags = MTR_DEFAULT;
+    move->size = table->keysZ;
+    move->next = *moves;
+    *moves = move;
+
+    return(table->keysZ);
+
+zddGroupMoveOutOfMem:
+    while (*moves != NULL) {
+        move = (*moves)->next;
+        cuddDeallocMove(table, *moves);
+        *moves = move;
+    }
+    return(0);
+
+} /* end of zddGroupMove */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Undoes the swap two groups.]
+
+  Description [Undoes the swap two groups.  Returns 1 in case of
+  success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupMoveBackward(
+  DdManager * table,
+  int  x,
+  int  y)
+{
+    int size;
+    int i,j,xtop,xbot,xsize,ytop,ybot,ysize,newxtop;
+
+
+#if DD_DEBUG
+    /* We assume that x < y */
+    assert(x < y);
+#endif
+
+    /* Find top, bottom, and size for the two groups. */
+    xbot = x;
+    xtop = table->subtableZ[x].next;
+    xsize = xbot - xtop + 1;
+    ybot = y;
+    while ((unsigned) ybot < table->subtableZ[ybot].next)
+        ybot = table->subtableZ[ybot].next;
+    ytop = y;
+    ysize = ybot - ytop + 1;
+
+    /* Sift the variables of the second group up through the first group */
+    for (i = 1; i <= ysize; i++) {
+        for (j = 1; j <= xsize; j++) {
+            size = cuddZddSwapInPlace(table,x,y);
+            if (size == 0)
+                return(0);
+            y = x;
+            x = cuddZddNextLow(table,y);
+        }
+        y = ytop + i;
+        x = cuddZddNextLow(table,y);
+    }
+
+    /* fix groups */
+    y = xtop;
+    for (i = 0; i < ysize - 1; i++) {
+        table->subtableZ[y].next = cuddZddNextHigh(table,y);
+        y = cuddZddNextHigh(table,y);
+    }
+    table->subtableZ[y].next = xtop; /* y is bottom of its group, join */
+                                    /* to its top */
+    x = cuddZddNextHigh(table,y);
+    newxtop = x;
+    for (i = 0; i < xsize - 1; i++) {
+        table->subtableZ[x].next = cuddZddNextHigh(table,x);
+        x = cuddZddNextHigh(table,x);
+    }
+    table->subtableZ[x].next = newxtop; /* x is bottom of its group, join */
+                                    /* to its top */
+#ifdef DD_DEBUG
+    if (pr > 0) (void) fprintf(table->out,"zddGroupMoveBackward:\n");
+#endif
+
+    return(1);
+
+} /* end of zddGroupMoveBackward */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Determines the best position for a variables and returns
+  it there.]
+
+  Description [Determines the best position for a variables and returns
+  it there.  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static int
+zddGroupSiftingBackward(
+  DdManager * table,
+  Move * moves,
+  int  size)
+{
+    Move *move;
+    int  res;
+
+
+    for (move = moves; move != NULL; move = move->next) {
+        if (move->size < size) {
+            size = move->size;
+        }
+    }
+
+    for (move = moves; move != NULL; move = move->next) {
+        if (move->size == size) return(1);
+        if ((table->subtableZ[move->x].next == move->x) &&
+	(table->subtableZ[move->y].next == move->y)) {
+            res = cuddZddSwapInPlace(table,(int)move->x,(int)move->y);
+            if (!res) return(0);
+#ifdef DD_DEBUG
+            if (pr > 0) (void) fprintf(table->out,"zddGroupSiftingBackward:\n");
+            assert(table->subtableZ[move->x].next == move->x);
+            assert(table->subtableZ[move->y].next == move->y);
+#endif
+        } else { /* Group move necessary */
+	    res = zddGroupMoveBackward(table,(int)move->x,(int)move->y);
+	    if (!res) return(0);
+        }
+    }
+
+    return(1);
+
+} /* end of zddGroupSiftingBackward */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Merges groups in the DD table.]
+
+  Description [Creates a single group from low to high and adjusts the
+  idex field of the tree node.]
+
+  SideEffects [None]
+
+******************************************************************************/
+static void
+zddMergeGroups(
+  DdManager * table,
+  MtrNode * treenode,
+  int  low,
+  int  high)
+{
+    int i;
+    MtrNode *auxnode;
+    int saveindex;
+    int newindex;
+
+    /* Merge all variables from low to high in one group, unless
+    ** this is the topmost group. In such a case we do not merge lest
+    ** we lose the symmetry information. */
+    if (treenode != table->treeZ) {
+	for (i = low; i < high; i++)
+	    table->subtableZ[i].next = i+1;
+	table->subtableZ[high].next = low;
+    }
+
+    /* Adjust the index fields of the tree nodes. If a node is the
+    ** first child of its parent, then the parent may also need adjustment. */
+    saveindex = treenode->index;
+    newindex = table->invpermZ[low];
+    auxnode = treenode;
+    do {
+	auxnode->index = newindex;
+	if (auxnode->parent == NULL ||
+		(int) auxnode->parent->index != saveindex)
+	    break;
+	auxnode = auxnode->parent;
+    } while (1);
+    return;
+
+} /* end of zddMergeGroups */
+
Index: /vis_dev/glu-2.1/src/cuBdd/cuddZddSymm.c
===================================================================
--- /vis_dev/glu-2.1/src/cuBdd/cuddZddSymm.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuBdd/cuddZddSymm.c	(revision 6)
@@ -0,0 +1,1699 @@
+/**CFile***********************************************************************
+
+  FileName    [cuddZddSymm.c]
+
+  PackageName [cudd]
+
+  Synopsis    [Functions for symmetry-based ZDD variable reordering.]
+
+  Description [External procedures included in this module:
+		    <ul>
+		    <li> Cudd_zddSymmProfile()
+		    </ul>
+	       Internal procedures included in this module:
+		    <ul>
+		    <li> cuddZddSymmCheck()
+		    <li> cuddZddSymmSifting()
+		    <li> cuddZddSymmSiftingConv()
+		    </ul>
+	       Static procedures included in this module:
+		    <ul>
+		    <li> cuddZddUniqueCompare()
+		    <li> cuddZddSymmSiftingAux()
+		    <li> cuddZddSymmSiftingConvAux()
+		    <li> cuddZddSymmSifting_up()
+		    <li> cuddZddSymmSifting_down()
+		    <li> zdd_group_move()
+		    <li> cuddZddSymmSiftingBackward()
+		    <li> zdd_group_move_backward()
+		    </ul>
+	      ]
+
+  SeeAlso     [cuddSymmetry.c]
+
+  Author      [Hyong-Kyoon Shin, In-Ho Moon]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "cuddInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#define ZDD_MV_OOM (Move *)1
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuddZddSymm.c,v 1.29 2004/08/13 18:04:54 fabio Exp $";
+#endif
+
+extern int   	*zdd_entry;
+
+extern int	zddTotalNumberSwapping;
+
+static DdNode	*empty;
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int cuddZddSymmSiftingAux (DdManager *table, int x, int x_low, int x_high);
+static int cuddZddSymmSiftingConvAux (DdManager *table, int x, int x_low, int x_high);
+static Move * cuddZddSymmSifting_up (DdManager *table, int x, int x_low, int initial_size);
+static Move * cuddZddSymmSifting_down (DdManager *table, int x, int x_high, int initial_size);
+static int cuddZddSymmSiftingBackward (DdManager *table, Move *moves, int size);
+static int zdd_group_move (DdManager *table, int x, int y, Move **moves);
+static int zdd_group_move_backward (DdManager *table, int x, int y);
+static void cuddZddSymmSummary (DdManager *table, int lower, int upper, int *symvars, int *symgroups);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis [Prints statistics on symmetric ZDD variables.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Cudd_zddSymmProfile(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int		i, x, gbot;
+    int		TotalSymm = 0;
+    int 	TotalSymmGroups = 0;
+
+    for (i = lower; i < upper; i++) {
+	if (table->subtableZ[i].next != (unsigned) i) {
+	    x = i;
+	    (void) fprintf(table->out,"Group:");
+	    do {
+		(void) fprintf(table->out,"  %d", table->invpermZ[x]);
+		TotalSymm++;
+		gbot = x;
+		x = table->subtableZ[x].next;
+	    } while (x != i);
+	    TotalSymmGroups++;
+#ifdef DD_DEBUG
+	    assert(table->subtableZ[gbot].next == (unsigned) i);
+#endif
+	    i = gbot;
+	    (void) fprintf(table->out,"\n");
+	}
+    }
+    (void) fprintf(table->out,"Total Symmetric = %d\n", TotalSymm);
+    (void) fprintf(table->out,"Total Groups = %d\n", TotalSymmGroups);
+
+} /* end of Cudd_zddSymmProfile */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis [Checks for symmetry of x and y.]
+
+  Description [Checks for symmetry of x and y. Ignores projection
+  functions, unless they are isolated. Returns 1 in case of
+  symmetry; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+cuddZddSymmCheck(
+  DdManager * table,
+  int  x,
+  int  y)
+{
+    int		i;
+    DdNode	*f, *f0, *f1, *f01, *f00, *f11, *f10;
+    int		yindex;
+    int 	xsymmy = 1;
+    int		xsymmyp = 1;
+    int 	arccount = 0;
+    int 	TotalRefCount = 0;
+    int 	symm_found;
+
+    empty = table->zero;
+
+    yindex = table->invpermZ[y];
+    for (i = table->subtableZ[x].slots - 1; i >= 0; i--) {
+	f = table->subtableZ[x].nodelist[i];
+	while (f != NULL) {
+	    /* Find f1, f0, f11, f10, f01, f00 */
+	    f1 = cuddT(f);
+	    f0 = cuddE(f);
+	    if ((int) f1->index == yindex) {
+		f11 = cuddT(f1);
+		f10 = cuddE(f1);
+		if (f10 != empty)
+		    arccount++;
+	    } else {
+		if ((int) f0->index != yindex) {
+		    return(0); /* f bypasses layer y */
+		}
+		f11 = empty;
+		f10 = f1;
+	    }
+	    if ((int) f0->index == yindex) {
+		f01 = cuddT(f0);
+		f00 = cuddE(f0);
+		if (f00 != empty)
+		    arccount++;
+	    } else {
+		f01 = empty;
+		f00 = f0;
+	    }
+	    if (f01 != f10)
+		xsymmy = 0;
+	    if (f11 != f00)
+		xsymmyp = 0;
+	    if ((xsymmy == 0) && (xsymmyp == 0))
+		return(0);
+
+	    f = f->next;
+	} /* for each element of the collision list */
+    } /* for each slot of the subtable */
+
+    /* Calculate the total reference counts of y
+    ** whose else arc is not empty.
+    */
+    for (i = table->subtableZ[y].slots - 1; i >= 0; i--) {
+	f = table->subtableZ[y].nodelist[i];
+	while (f != NIL(DdNode)) {
+	    if (cuddE(f) != empty)
+		TotalRefCount += f->ref;
+	    f = f->next;
+	}
+    }
+
+    symm_found = (arccount == TotalRefCount);
+#if defined(DD_DEBUG) && defined(DD_VERBOSE)
+    if (symm_found) {
+	int xindex = table->invpermZ[x];
+	(void) fprintf(table->out,
+		       "Found symmetry! x =%d\ty = %d\tPos(%d,%d)\n",
+		       xindex,yindex,x,y);
+    }
+#endif
+
+    return(symm_found);
+
+} /* end cuddZddSymmCheck */
+
+
+/**Function********************************************************************
+
+  Synopsis [Symmetric sifting algorithm for ZDDs.]
+
+  Description [Symmetric sifting algorithm.
+  Assumes that no dead nodes are present.
+    <ol>
+    <li> Order all the variables according to the number of entries in
+    each unique subtable.
+    <li> Sift the variable up and down, remembering each time the total
+    size of the ZDD heap and grouping variables that are symmetric.
+    <li> Select the best permutation.
+    <li> Repeat 3 and 4 for all variables.
+    </ol>
+  Returns 1 plus the number of symmetric variables if successful; 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddZddSymmSiftingConv]
+
+******************************************************************************/
+int
+cuddZddSymmSifting(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int		i;
+    int		*var;
+    int		nvars;
+    int		x;
+    int		result;
+    int		symvars;
+    int		symgroups;
+    int		iteration;
+#ifdef DD_STATS
+    int		previousSize;
+#endif
+
+    nvars = table->sizeZ;
+
+    /* Find order in which to sift variables. */
+    var = NULL;
+    zdd_entry = ALLOC(int, nvars);
+    if (zdd_entry == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto cuddZddSymmSiftingOutOfMem;
+    }
+    var = ALLOC(int, nvars);
+    if (var == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto cuddZddSymmSiftingOutOfMem;
+    }
+
+    for (i = 0; i < nvars; i++) {
+	x = table->permZ[i];
+	zdd_entry[i] = table->subtableZ[x].keys;
+	var[i] = i;
+    }
+
+    qsort((void *)var, nvars, sizeof(int), (DD_QSFP)cuddZddUniqueCompare);
+
+    /* Initialize the symmetry of each subtable to itself. */
+    for (i = lower; i <= upper; i++)
+	table->subtableZ[i].next = i;
+
+    iteration = ddMin(table->siftMaxVar, nvars);
+    for (i = 0; i < iteration; i++) {
+	if (zddTotalNumberSwapping >= table->siftMaxSwap)
+	    break;
+	x = table->permZ[var[i]];
+#ifdef DD_STATS
+	previousSize = table->keysZ;
+#endif
+	if (x < lower || x > upper) continue;
+	if (table->subtableZ[x].next == (unsigned) x) {
+	    result = cuddZddSymmSiftingAux(table, x, lower, upper);
+	    if (!result)
+		goto cuddZddSymmSiftingOutOfMem;
+#ifdef DD_STATS
+	    if (table->keysZ < (unsigned) previousSize) {
+		(void) fprintf(table->out,"-");
+	    } else if (table->keysZ > (unsigned) previousSize) {
+		(void) fprintf(table->out,"+");
+#ifdef DD_VERBOSE
+		(void) fprintf(table->out,"\nSize increased from %d to %d while sifting variable %d\n", previousSize, table->keysZ, var[i]);
+#endif
+	    } else {
+		(void) fprintf(table->out,"=");
+	    }
+	    fflush(table->out);
+#endif
+	}
+    }
+
+    FREE(var);
+    FREE(zdd_entry);
+
+    cuddZddSymmSummary(table, lower, upper, &symvars, &symgroups);
+
+#ifdef DD_STATS
+    (void) fprintf(table->out,"\n#:S_SIFTING %8d: symmetric variables\n",symvars);
+    (void) fprintf(table->out,"#:G_SIFTING %8d: symmetric groups\n",symgroups);
+#endif
+
+    return(1+symvars);
+
+cuddZddSymmSiftingOutOfMem:
+
+    if (zdd_entry != NULL)
+	FREE(zdd_entry);
+    if (var != NULL)
+	FREE(var);
+
+    return(0);
+
+} /* end of cuddZddSymmSifting */
+
+
+/**Function********************************************************************
+
+  Synopsis [Symmetric sifting to convergence algorithm for ZDDs.]
+
+  Description [Symmetric sifting to convergence algorithm for ZDDs.
+  Assumes that no dead nodes are present.
+    <ol>
+    <li> Order all the variables according to the number of entries in
+    each unique subtable.
+    <li> Sift the variable up and down, remembering each time the total
+    size of the ZDD heap and grouping variables that are symmetric.
+    <li> Select the best permutation.
+    <li> Repeat 3 and 4 for all variables.
+    <li> Repeat 1-4 until no further improvement.
+    </ol>
+  Returns 1 plus the number of symmetric variables if successful; 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [cuddZddSymmSifting]
+
+******************************************************************************/
+int
+cuddZddSymmSiftingConv(
+  DdManager * table,
+  int  lower,
+  int  upper)
+{
+    int		i;
+    int		*var;
+    int		nvars;
+    int		initialSize;
+    int		x;
+    int		result;
+    int		symvars;
+    int		symgroups;
+    int		classes;
+    int		iteration;
+#ifdef DD_STATS
+    int         previousSize;
+#endif
+
+    initialSize = table->keysZ;
+
+    nvars = table->sizeZ;
+
+    /* Find order in which to sift variables. */
+    var = NULL;
+    zdd_entry = ALLOC(int, nvars);
+    if (zdd_entry == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto cuddZddSymmSiftingConvOutOfMem;
+    }
+    var = ALLOC(int, nvars);
+    if (var == NULL) {
+	table->errorCode = CUDD_MEMORY_OUT;
+	goto cuddZddSymmSiftingConvOutOfMem;
+    }
+
+    for (i = 0; i < nvars; i++) {
+	x = table->permZ[i];
+	zdd_entry[i] = table->subtableZ[x].keys;
+	var[i] = i;
+    }
+
+    qsort((void *)var, nvars, sizeof(int), (DD_QSFP)cuddZddUniqueCompare);
+
+    /* Initialize the symmetry of each subtable to itself
+    ** for first pass of converging symmetric sifting.
+    */
+    for (i = lower; i <= upper; i++)
+	table->subtableZ[i].next = i;
+
+    iteration = ddMin(table->siftMaxVar, table->sizeZ);
+    for (i = 0; i < iteration; i++) {
+	if (zddTotalNumberSwapping >= table->siftMaxSwap)
+	    break;
+	x = table->permZ[var[i]];
+	if (x < lower || x > upper) continue;
+	/* Only sift if not in symmetry group already. */
+	if (table->subtableZ[x].next == (unsigned) x) {
+#ifdef DD_STATS
+	    previousSize = table->keysZ;
+#endif
+	    result = cuddZddSymmSiftingAux(table, x, lower, upper);
+	    if (!result)
+		goto cuddZddSymmSiftingConvOutOfMem;
+#ifdef DD_STATS
+	    if (table->keysZ < (unsigned) previousSize) {
+		(void) fprintf(table->out,"-");
+	    } else if (table->keysZ > (unsigned) previousSize) {
+		(void) fprintf(table->out,"+");
+#ifdef DD_VERBOSE
+		(void) fprintf(table->out,"\nSize increased from %d to %d while sifting variable %d\n", previousSize, table->keysZ, var[i]);
+#endif
+	    } else {
+		(void) fprintf(table->out,"=");
+	    }
+	    fflush(table->out);
+#endif
+	}
+    }
+
+    /* Sifting now until convergence. */
+    while ((unsigned) initialSize > table->keysZ) {
+	initialSize = table->keysZ;
+#ifdef DD_STATS
+	(void) fprintf(table->out,"\n");
+#endif
+	/* Here we consider only one representative for each symmetry class. */
+	for (x = lower, classes = 0; x <= upper; x++, classes++) {
+	    while ((unsigned) x < table->subtableZ[x].next)
+		x = table->subtableZ[x].next;
+	    /* Here x is the largest index in a group.
+	    ** Groups consists of adjacent variables.
+	    ** Hence, the next increment of x will move it to a new group.
+	    */
+	    i = table->invpermZ[x];
+	    zdd_entry[i] = table->subtableZ[x].keys;
+	    var[classes] = i;
+	}
+
+	qsort((void *)var,classes,sizeof(int),(DD_QSFP)cuddZddUniqueCompare);
+
+	/* Now sift. */
+	iteration = ddMin(table->siftMaxVar, nvars);
+	for (i = 0; i < iteration; i++) {
+	    if (zddTotalNumberSwapping >= table->siftMaxSwap)
+		break;
+	    x = table->permZ[var[i]];
+	    if ((unsigned) x >= table->subtableZ[x].next) {
+#ifdef DD_STATS
+		previousSize = table->keysZ;
+#endif
+		result = cuddZddSymmSiftingConvAux(table, x, lower, upper);
+		if (!result)
+		    goto cuddZddSymmSiftingConvOutOfMem;
+#ifdef DD_STATS
+		if (table->keysZ < (unsigned) previousSize) {
+		    (void) fprintf(table->out,"-");
+		} else if (table->keysZ > (unsigned) previousSize) {
+		    (void) fprintf(table->out,"+");
+#ifdef DD_VERBOSE
+		(void) fprintf(table->out,"\nSize increased from %d to %d while sifting variable %d\n", previousSize, table->keysZ, var[i]);
+#endif
+		} else {
+		    (void) fprintf(table->out,"=");
+		}
+		fflush(table->out);
+#endif
+	    }
+	} /* for */
+    }
+
+    cuddZddSymmSummary(table, lower, upper, &symvars, &symgroups);
+
+#ifdef DD_STATS
+    (void) fprintf(table->out,"\n#:S_SIFTING %8d: symmetric variables\n",
+		   symvars);
+    (void) fprintf(table->out,"#:G_SIFTING %8d: symmetric groups\n",
+		   symgroups);
+#endif
+
+    FREE(var);
+    FREE(zdd_entry);
+
+    return(1+symvars);
+
+cuddZddSymmSiftingConvOutOfMem:
+
+    if (zdd_entry != NULL)
+	FREE(zdd_entry);
+    if (var != NULL)
+	FREE(var);
+
+    return(0);
+
+} /* end of cuddZddSymmSiftingConv */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis [Given x_low <= x <= x_high moves x up and down between the
+  boundaries.]
+
+  Description [Given x_low <= x <= x_high moves x up and down between the
+  boundaries. Finds the best position and does the required changes.
+  Assumes that x is not part of a symmetry group. Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+cuddZddSymmSiftingAux(
+  DdManager * table,
+  int  x,
+  int  x_low,
+  int  x_high)
+{
+    Move *move;
+    Move *move_up;	/* list of up move */
+    Move *move_down;	/* list of down move */
+    int	 initial_size;
+    int	 result;
+    int	 i;
+    int  topbot;	/* index to either top or bottom of symmetry group */
+    int	 init_group_size, final_group_size;
+
+    initial_size = table->keysZ;
+
+    move_down = NULL;
+    move_up = NULL;
+
+    /* Look for consecutive symmetries above x. */
+    for (i = x; i > x_low; i--) {
+	if (!cuddZddSymmCheck(table, i - 1, i))
+            break;
+	/* find top of i-1's symmetry */
+	topbot = table->subtableZ[i - 1].next;
+	table->subtableZ[i - 1].next = i;
+	table->subtableZ[x].next = topbot;
+	/* x is bottom of group so its symmetry is top of i-1's
+	   group */
+	i = topbot + 1; /* add 1 for i--, new i is top of symm group */
+    }
+    /* Look for consecutive symmetries below x. */
+    for (i = x; i < x_high; i++) {
+	if (!cuddZddSymmCheck(table, i, i + 1))
+            break;
+	/* find bottom of i+1's symm group */
+	topbot = i + 1;
+	while ((unsigned) topbot < table->subtableZ[topbot].next)
+	    topbot = table->subtableZ[topbot].next;
+
+	table->subtableZ[topbot].next = table->subtableZ[i].next;
+	table->subtableZ[i].next = i + 1;
+	i = topbot - 1; /* add 1 for i++,
+			   new i is bottom of symm group */
+    }
+
+    /* Now x maybe in the middle of a symmetry group. */
+    if (x == x_low) { /* Sift down */
+	/* Find bottom of x's symm group */
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+
+	i = table->subtableZ[x].next;
+	init_group_size = x - i + 1;
+
+	move_down = cuddZddSymmSifting_down(table, x, x_high,
+	    initial_size);
+	/* after that point x --> x_high, unless early term */
+	if (move_down == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+
+	if (move_down == NULL ||
+	    table->subtableZ[move_down->y].next != move_down->y) {
+	    /* symmetry detected may have to make another complete
+	       pass */
+            if (move_down != NULL)
+		x = move_down->y;
+	    else
+		x = table->subtableZ[x].next;
+	    i = x;
+	    while ((unsigned) i < table->subtableZ[i].next) {
+		i = table->subtableZ[i].next;
+	    }
+	    final_group_size = i - x + 1;
+
+	    if (init_group_size == final_group_size) {
+		/* No new symmetry groups detected,
+		   return to best position */
+		result = cuddZddSymmSiftingBackward(table,
+		    move_down, initial_size);
+	    }
+	    else {
+		initial_size = table->keysZ;
+		move_up = cuddZddSymmSifting_up(table, x, x_low,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_down,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+    }
+    else if (x == x_high) { /* Sift up */
+	/* Find top of x's symm group */
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+	x = table->subtableZ[x].next;
+
+	i = x;
+	while ((unsigned) i < table->subtableZ[i].next) {
+	    i = table->subtableZ[i].next;
+	}
+	init_group_size = i - x + 1;
+
+	move_up = cuddZddSymmSifting_up(table, x, x_low, initial_size);
+	/* after that point x --> x_low, unless early term */
+	if (move_up == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+
+	if (move_up == NULL ||
+	    table->subtableZ[move_up->x].next != move_up->x) {
+	    /* symmetry detected may have to make another complete
+		pass */
+            if (move_up != NULL)
+		x = move_up->x;
+	    else {
+		while ((unsigned) x < table->subtableZ[x].next)
+		    x = table->subtableZ[x].next;
+	    }
+	    i = table->subtableZ[x].next;
+	    final_group_size = x - i + 1;
+
+	    if (init_group_size == final_group_size) {
+		/* No new symmetry groups detected,
+		   return to best position */
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	    else {
+		initial_size = table->keysZ;
+		move_down = cuddZddSymmSifting_down(table, x, x_high,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_up,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+    }
+    else if ((x - x_low) > (x_high - x)) { /* must go down first:
+						shorter */
+	/* Find bottom of x's symm group */
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+
+	move_down = cuddZddSymmSifting_down(table, x, x_high,
+	    initial_size);
+	/* after that point x --> x_high, unless early term */
+	if (move_down == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+
+	if (move_down != NULL) {
+	    x = move_down->y;
+	}
+	else {
+	    x = table->subtableZ[x].next;
+	}
+	i = x;
+	while ((unsigned) i < table->subtableZ[i].next) {
+	    i = table->subtableZ[i].next;
+	}
+	init_group_size = i - x + 1;
+
+	move_up = cuddZddSymmSifting_up(table, x, x_low, initial_size);
+	if (move_up == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+
+	if (move_up == NULL ||
+	    table->subtableZ[move_up->x].next != move_up->x) {
+	    /* symmetry detected may have to make another complete
+	       pass */
+	    if (move_up != NULL) {
+		x = move_up->x;
+	    }
+	    else {
+		while ((unsigned) x < table->subtableZ[x].next)
+		    x = table->subtableZ[x].next;
+	    }
+	    i = table->subtableZ[x].next;
+	    final_group_size = x - i + 1;
+
+	    if (init_group_size == final_group_size) {
+		/* No new symmetry groups detected,
+		   return to best position */
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	    else {
+		while (move_down != NULL) {
+		    move = move_down->next;
+		    cuddDeallocMove(table, move_down);
+		    move_down = move;
+		}
+		initial_size = table->keysZ;
+		move_down = cuddZddSymmSifting_down(table, x, x_high,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_up,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+    }
+    else { /* moving up first:shorter */
+        /* Find top of x's symmetry group */
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+	x = table->subtableZ[x].next;
+
+	move_up = cuddZddSymmSifting_up(table, x, x_low, initial_size);
+	/* after that point x --> x_high, unless early term */
+	if (move_up == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+
+	if (move_up != NULL) {
+	    x = move_up->x;
+	}
+	else {
+	    while ((unsigned) x < table->subtableZ[x].next)
+		x = table->subtableZ[x].next;
+	}
+	i = table->subtableZ[x].next;
+	init_group_size = x - i + 1;
+
+	move_down = cuddZddSymmSifting_down(table, x, x_high,
+	    initial_size);
+	if (move_down == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+
+	if (move_down == NULL ||
+	    table->subtableZ[move_down->y].next != move_down->y) {
+	    /* symmetry detected may have to make another complete
+	       pass */
+            if (move_down != NULL) {
+		x = move_down->y;
+	    }
+	    else {
+		x = table->subtableZ[x].next;
+	    }
+	    i = x;
+	    while ((unsigned) i < table->subtableZ[i].next) {
+		i = table->subtableZ[i].next;
+	    }
+	    final_group_size = i - x + 1;
+
+	    if (init_group_size == final_group_size) {
+		/* No new symmetries detected,
+		   go back to best position */
+		result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+	    }
+	    else {
+		while (move_up != NULL) {
+		    move = move_up->next;
+		    cuddDeallocMove(table, move_up);
+		    move_up = move;
+		}
+		initial_size = table->keysZ;
+		move_up = cuddZddSymmSifting_up(table, x, x_low,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_down,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingAuxOutOfMem;
+    }
+
+    while (move_down != NULL) {
+	move = move_down->next;
+	cuddDeallocMove(table, move_down);
+	move_down = move;
+    }
+    while (move_up != NULL) {
+	move = move_up->next;
+	cuddDeallocMove(table, move_up);
+	move_up = move;
+    }
+
+    return(1);
+
+cuddZddSymmSiftingAuxOutOfMem:
+    if (move_down != ZDD_MV_OOM) {
+	while (move_down != NULL) {
+	    move = move_down->next;
+	    cuddDeallocMove(table, move_down);
+	    move_down = move;
+	}
+    }
+    if (move_up != ZDD_MV_OOM) {
+	while (move_up != NULL) {
+	    move = move_up->next;
+	    cuddDeallocMove(table, move_up);
+	    move_up = move;
+	}
+    }
+
+    return(0);
+
+} /* end of cuddZddSymmSiftingAux */
+
+
+/**Function********************************************************************
+
+  Synopsis [Given x_low <= x <= x_high moves x up and down between the
+  boundaries.]
+
+  Description [Given x_low <= x <= x_high moves x up and down between the
+  boundaries. Finds the best position and does the required changes.
+  Assumes that x is either an isolated variable, or it is the bottom of
+  a symmetry group. All symmetries may not have been found, because of
+  exceeded growth limit. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+cuddZddSymmSiftingConvAux(
+  DdManager * table,
+  int  x,
+  int  x_low,
+  int  x_high)
+{
+    Move	*move;
+    Move	*move_up;	/* list of up move */
+    Move	*move_down;	/* list of down move */
+    int		initial_size;
+    int		result;
+    int		i;
+    int		init_group_size, final_group_size;
+
+    initial_size = table->keysZ;
+
+    move_down = NULL;
+    move_up = NULL;
+
+    if (x == x_low) { /* Sift down */
+        i = table->subtableZ[x].next;
+	init_group_size = x - i + 1;
+
+	move_down = cuddZddSymmSifting_down(table, x, x_high,
+	    initial_size);
+	/* after that point x --> x_high, unless early term */
+	if (move_down == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+
+	if (move_down == NULL ||
+	    table->subtableZ[move_down->y].next != move_down->y) {
+	    /* symmetry detected may have to make another complete
+		pass */
+            if (move_down != NULL)
+		x = move_down->y;
+	    else {
+		while ((unsigned) x < table->subtableZ[x].next)
+		    x = table->subtableZ[x].next;
+		x = table->subtableZ[x].next;
+	    }
+	    i = x;
+	    while ((unsigned) i < table->subtableZ[i].next) {
+		i = table->subtableZ[i].next;
+	    }
+	    final_group_size = i - x + 1;
+
+	    if (init_group_size == final_group_size) {
+		/* No new symmetries detected,
+		   go back to best position */
+		result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+	    }
+	    else {
+		initial_size = table->keysZ;
+		move_up = cuddZddSymmSifting_up(table, x, x_low,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_down,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+    }
+    else if (x == x_high) { /* Sift up */
+	/* Find top of x's symm group */
+	while ((unsigned) x < table->subtableZ[x].next)
+	    x = table->subtableZ[x].next;
+	x = table->subtableZ[x].next;
+
+	i = x;
+	while ((unsigned) i < table->subtableZ[i].next) {
+	    i = table->subtableZ[i].next;
+	}
+	init_group_size = i - x + 1;
+
+	move_up = cuddZddSymmSifting_up(table, x, x_low, initial_size);
+	/* after that point x --> x_low, unless early term */
+	if (move_up == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+
+	if (move_up == NULL ||
+	    table->subtableZ[move_up->x].next != move_up->x) {
+	    /* symmetry detected may have to make another complete
+	       pass */
+            if (move_up != NULL)
+		x = move_up->x;
+	    else {
+		while ((unsigned) x < table->subtableZ[x].next)
+		    x = table->subtableZ[x].next;
+	    }
+	    i = table->subtableZ[x].next;
+	    final_group_size = x - i + 1;
+
+	    if (init_group_size == final_group_size) {
+		/* No new symmetry groups detected,
+		   return to best position */
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	    else {
+		initial_size = table->keysZ;
+		move_down = cuddZddSymmSifting_down(table, x, x_high,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_up,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+    }
+    else if ((x - x_low) > (x_high - x)) { /* must go down first:
+						shorter */
+	move_down = cuddZddSymmSifting_down(table, x, x_high,
+	    initial_size);
+	/* after that point x --> x_high */
+	if (move_down == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+
+	if (move_down != NULL) {
+	    x = move_down->y;
+	}
+	else {
+	    while ((unsigned) x < table->subtableZ[x].next)
+		x = table->subtableZ[x].next;
+	    x = table->subtableZ[x].next;
+	}
+	i = x;
+	while ((unsigned) i < table->subtableZ[i].next) {
+	    i = table->subtableZ[i].next;
+	}
+	init_group_size = i - x + 1;
+
+	move_up = cuddZddSymmSifting_up(table, x, x_low, initial_size);
+	if (move_up == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+
+	if (move_up == NULL ||
+	    table->subtableZ[move_up->x].next != move_up->x) {
+	    /* symmetry detected may have to make another complete
+	       pass */
+	    if (move_up != NULL) {
+		x = move_up->x;
+	    }
+	    else {
+		while ((unsigned) x < table->subtableZ[x].next)
+		    x = table->subtableZ[x].next;
+	    }
+            i = table->subtableZ[x].next;
+            final_group_size = x - i + 1;
+
+            if (init_group_size == final_group_size) {
+		/* No new symmetry groups detected,
+		   return to best position */
+                result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+            }
+	    else {
+		while (move_down != NULL) {
+		    move = move_down->next;
+		    cuddDeallocMove(table, move_down);
+		    move_down = move;
+		}
+		initial_size = table->keysZ;
+		move_down = cuddZddSymmSifting_down(table, x, x_high,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_up,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+    }
+    else { /* moving up first:shorter */
+	/* Find top of x's symmetry group */
+	x = table->subtableZ[x].next;
+
+	move_up = cuddZddSymmSifting_up(table, x, x_low, initial_size);
+	/* after that point x --> x_high, unless early term */
+	if (move_up == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+
+	if (move_up != NULL) {
+	    x = move_up->x;
+	}
+	else {
+	    while ((unsigned) x < table->subtableZ[x].next)
+		x = table->subtableZ[x].next;
+	}
+        i = table->subtableZ[x].next;
+        init_group_size = x - i + 1;
+
+	move_down = cuddZddSymmSifting_down(table, x, x_high,
+	    initial_size);
+	if (move_down == ZDD_MV_OOM)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+
+	if (move_down == NULL ||
+	    table->subtableZ[move_down->y].next != move_down->y) {
+	    /* symmetry detected may have to make another complete
+	       pass */
+            if (move_down != NULL) {
+		x = move_down->y;
+	    }
+	    else {
+		while ((unsigned) x < table->subtableZ[x].next)
+		    x = table->subtableZ[x].next;
+		x = table->subtableZ[x].next;
+	    }
+            i = x;
+            while ((unsigned) i < table->subtableZ[i].next) {
+                i = table->subtableZ[i].next;
+            }
+	    final_group_size = i - x + 1;
+
+            if (init_group_size == final_group_size) {
+		/* No new symmetries detected,
+		   go back to best position */
+                result = cuddZddSymmSiftingBackward(table, move_down,
+		    initial_size);
+            }
+	    else {
+		while (move_up != NULL) {
+		    move = move_up->next;
+		    cuddDeallocMove(table, move_up);
+		    move_up = move;
+		}
+		initial_size = table->keysZ;
+		move_up = cuddZddSymmSifting_up(table, x, x_low,
+		    initial_size);
+		result = cuddZddSymmSiftingBackward(table, move_up,
+		    initial_size);
+	    }
+	}
+	else {
+	    result = cuddZddSymmSiftingBackward(table, move_down,
+		initial_size);
+	    /* move backward and stop at best position */
+	}
+	if (!result)
+	    goto cuddZddSymmSiftingConvAuxOutOfMem;
+    }
+
+    while (move_down != NULL) {
+	move = move_down->next;
+	cuddDeallocMove(table, move_down);
+	move_down = move;
+    }
+    while (move_up != NULL) {
+	move = move_up->next;
+	cuddDeallocMove(table, move_up);
+	move_up = move;
+    }
+
+    return(1);
+
+cuddZddSymmSiftingConvAuxOutOfMem:
+    if (move_down != ZDD_MV_OOM) {
+	while (move_down != NULL) {
+	    move = move_down->next;
+	    cuddDeallocMove(table, move_down);
+	    move_down = move;
+	}
+    }
+    if (move_up != ZDD_MV_OOM) {
+	while (move_up != NULL) {
+	    move = move_up->next;
+	    cuddDeallocMove(table, move_up);
+	    move_up = move;
+	}
+    }
+
+    return(0);
+
+} /* end of cuddZddSymmSiftingConvAux */
+
+
+/**Function********************************************************************
+
+  Synopsis [Moves x up until either it reaches the bound (x_low) or
+  the size of the ZDD heap increases too much.]
+
+  Description [Moves x up until either it reaches the bound (x_low) or
+  the size of the ZDD heap increases too much. Assumes that x is the top
+  of a symmetry group.  Checks x for symmetry to the adjacent
+  variables. If symmetry is found, the symmetry group of x is merged
+  with the symmetry group of the other variable. Returns the set of
+  moves in case of success; ZDD_MV_OOM if memory is full.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static Move *
+cuddZddSymmSifting_up(
+  DdManager * table,
+  int  x,
+  int  x_low,
+  int  initial_size)
+{
+    Move	*moves;
+    Move	*move;
+    int		y;
+    int		size;
+    int		limit_size = initial_size;
+    int		i, gytop;
+
+    moves = NULL;
+    y = cuddZddNextLow(table, x);
+    while (y >= x_low) {
+	gytop = table->subtableZ[y].next;
+	if (cuddZddSymmCheck(table, y, x)) {
+	    /* Symmetry found, attach symm groups */
+	    table->subtableZ[y].next = x;
+	    i = table->subtableZ[x].next;
+	    while (table->subtableZ[i].next != (unsigned) x)
+		i = table->subtableZ[i].next;
+	    table->subtableZ[i].next = gytop;
+	}
+	else if ((table->subtableZ[x].next == (unsigned) x) &&
+	    (table->subtableZ[y].next == (unsigned) y)) {
+	    /* x and y have self symmetry */
+	    size = cuddZddSwapInPlace(table, y, x);
+	    if (size == 0)
+		goto cuddZddSymmSifting_upOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL)
+		goto cuddZddSymmSifting_upOutOfMem;
+	    move->x = y;
+	    move->y = x;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    if ((double)size >
+		(double)limit_size * table->maxGrowth)
+		return(moves);
+	    if (size < limit_size)
+		limit_size = size;
+	}
+	else { /* Group move */
+	    size = zdd_group_move(table, y, x, &moves);
+	    if ((double)size >
+		(double)limit_size * table->maxGrowth)
+		return(moves);
+	    if (size < limit_size)
+		limit_size = size;
+	}
+	x = gytop;
+	y = cuddZddNextLow(table, x);
+    }
+
+    return(moves);
+
+cuddZddSymmSifting_upOutOfMem:
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(ZDD_MV_OOM);
+
+} /* end of cuddZddSymmSifting_up */
+
+
+/**Function********************************************************************
+
+  Synopsis [Moves x down until either it reaches the bound (x_high) or
+  the size of the ZDD heap increases too much.]
+
+  Description [Moves x down until either it reaches the bound (x_high)
+  or the size of the ZDD heap increases too much. Assumes that x is the
+  bottom of a symmetry group. Checks x for symmetry to the adjacent
+  variables. If symmetry is found, the symmetry group of x is merged
+  with the symmetry group of the other variable. Returns the set of
+  moves in case of success; ZDD_MV_OOM if memory is full.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static Move *
+cuddZddSymmSifting_down(
+  DdManager * table,
+  int  x,
+  int  x_high,
+  int  initial_size)
+{
+    Move	*moves;
+    Move	*move;
+    int		y;
+    int		size;
+    int		limit_size = initial_size;
+    int		i, gxtop, gybot;
+
+    moves = NULL;
+    y = cuddZddNextHigh(table, x);
+    while (y <= x_high) {
+	gybot = table->subtableZ[y].next;
+	while (table->subtableZ[gybot].next != (unsigned) y)
+	    gybot = table->subtableZ[gybot].next;
+	if (cuddZddSymmCheck(table, x, y)) {
+	    /* Symmetry found, attach symm groups */
+	    gxtop = table->subtableZ[x].next;
+	    table->subtableZ[x].next = y;
+	    i = table->subtableZ[y].next;
+	    while (table->subtableZ[i].next != (unsigned) y)
+		i = table->subtableZ[i].next;
+	    table->subtableZ[i].next = gxtop;
+	}
+	else if ((table->subtableZ[x].next == (unsigned) x) &&
+	    (table->subtableZ[y].next == (unsigned) y)) {
+	    /* x and y have self symmetry */
+	    size = cuddZddSwapInPlace(table, x, y);
+	    if (size == 0)
+		goto cuddZddSymmSifting_downOutOfMem;
+	    move = (Move *)cuddDynamicAllocNode(table);
+	    if (move == NULL)
+		goto cuddZddSymmSifting_downOutOfMem;
+	    move->x = x;
+	    move->y = y;
+	    move->size = size;
+	    move->next = moves;
+	    moves = move;
+	    if ((double)size >
+		(double)limit_size * table->maxGrowth)
+		return(moves);
+	    if (size < limit_size)
+		limit_size = size;
+	    x = y;
+	    y = cuddZddNextHigh(table, x);
+	}
+	else { /* Group move */
+	    size = zdd_group_move(table, x, y, &moves);
+	    if ((double)size >
+		(double)limit_size * table->maxGrowth)
+		return(moves);
+	    if (size < limit_size)
+		limit_size = size;
+	}
+	x = gybot;
+	y = cuddZddNextHigh(table, x);
+    }
+
+    return(moves);
+
+cuddZddSymmSifting_downOutOfMem:
+    while (moves != NULL) {
+	move = moves->next;
+	cuddDeallocMove(table, moves);
+	moves = move;
+    }
+    return(ZDD_MV_OOM);
+
+} /* end of cuddZddSymmSifting_down */
+
+
+/**Function********************************************************************
+
+  Synopsis [Given a set of moves, returns the ZDD heap to the position
+  giving the minimum size.]
+
+  Description [Given a set of moves, returns the ZDD heap to the
+  position giving the minimum size. In case of ties, returns to the
+  closest position giving the minimum size. Returns 1 in case of
+  success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+cuddZddSymmSiftingBackward(
+  DdManager * table,
+  Move * moves,
+  int  size)
+{
+    int		i;
+    int		i_best;
+    Move	*move;
+    int		res;
+
+    i_best = -1;
+    for (move = moves, i = 0; move != NULL; move = move->next, i++) {
+	if (move->size < size) {
+	    i_best = i;
+	    size = move->size;
+	}
+    }
+
+    for (move = moves, i = 0; move != NULL; move = move->next, i++) {
+	if (i == i_best) break;
+	if ((table->subtableZ[move->x].next == move->x) &&
+	    (table->subtableZ[move->y].next == move->y)) {
+	    res = cuddZddSwapInPlace(table, move->x, move->y);
+	    if (!res) return(0);
+	}
+	else { /* Group move necessary */
+	    res = zdd_group_move_backward(table, move->x, move->y);
+	}
+	if (i_best == -1 && res == size)
+	    break;
+    }
+
+    return(1);
+
+} /* end of cuddZddSymmSiftingBackward */
+
+
+/**Function********************************************************************
+
+  Synopsis [Swaps two groups.]
+
+  Description [Swaps two groups. x is assumed to be the bottom variable
+  of the first group. y is assumed to be the top variable of the second
+  group.  Updates the list of moves. Returns the number of keys in the
+  table if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+zdd_group_move(
+  DdManager * table,
+  int  x,
+  int  y,
+  Move ** moves)
+{
+    Move	*move;
+    int		size;
+    int		i, temp, gxtop, gxbot, gybot, yprev;
+    int		swapx, swapy;
+
+#ifdef DD_DEBUG
+    assert(x < y);	/* we assume that x < y */
+#endif
+    /* Find top and bottom for the two groups. */
+    gxtop = table->subtableZ[x].next;
+    gxbot = x;
+    gybot = table->subtableZ[y].next;
+    while (table->subtableZ[gybot].next != (unsigned) y)
+	gybot = table->subtableZ[gybot].next;
+    yprev = gybot;
+
+    while (x <= y) {
+	while (y > gxtop) {
+	    /* Set correct symmetries. */
+	    temp = table->subtableZ[x].next;
+	    if (temp == x)
+		temp = y;
+	    i = gxtop;
+	    for (;;) {
+		if (table->subtableZ[i].next == (unsigned) x) {
+		    table->subtableZ[i].next = y;
+		    break;
+		} else {
+		    i = table->subtableZ[i].next;
+		}
+	    }
+	    if (table->subtableZ[y].next != (unsigned) y) {
+		table->subtableZ[x].next = table->subtableZ[y].next;
+	    } else {
+		table->subtableZ[x].next = x;
+	    }
+
+	    if (yprev != y) {
+		table->subtableZ[yprev].next = x;
+	    } else {
+		yprev = x;
+	    }
+	    table->subtableZ[y].next = temp;
+
+	    size = cuddZddSwapInPlace(table, x, y);
+	    if (size == 0)
+		goto zdd_group_moveOutOfMem;
+            swapx = x;
+	    swapy = y;
+	    y = x;
+	    x--;
+	} /* while y > gxtop */
+
+	/* Trying to find the next y. */
+	if (table->subtableZ[y].next <= (unsigned) y) {
+	    gybot = y;
+	} else {
+	    y = table->subtableZ[y].next;
+	}
+
+	yprev = gxtop;
+	gxtop++;
+	gxbot++;
+	x = gxbot;
+    } /* while x <= y, end of group movement */
+    move = (Move *)cuddDynamicAllocNode(table);
+    if (move == NULL)
+	goto zdd_group_moveOutOfMem;
+    move->x = swapx;
+    move->y = swapy;
+    move->size = table->keysZ;
+    move->next = *moves;
+    *moves = move;
+
+    return(table->keysZ);
+
+zdd_group_moveOutOfMem:
+    while (*moves != NULL) {
+	move = (*moves)->next;
+	cuddDeallocMove(table, *moves);
+	*moves = move;
+    }
+    return(0);
+
+} /* end of zdd_group_move */
+
+
+/**Function********************************************************************
+
+  Synopsis [Undoes the swap of two groups.]
+
+  Description [Undoes the swap of two groups. x is assumed to be the
+  bottom variable of the first group. y is assumed to be the top
+  variable of the second group.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+zdd_group_move_backward(
+  DdManager * table,
+  int  x,
+  int  y)
+{
+    int	       size;
+    int        i, temp, gxtop, gxbot, gybot, yprev;
+
+#ifdef DD_DEBUG
+    assert(x < y);	/* we assume that x < y */
+#endif
+    /* Find top and bottom of the two groups. */
+    gxtop = table->subtableZ[x].next;
+    gxbot = x;
+    gybot = table->subtableZ[y].next;
+    while (table->subtableZ[gybot].next != (unsigned) y)
+	gybot = table->subtableZ[gybot].next;
+    yprev = gybot;
+
+    while (x <= y) {
+	while (y > gxtop) {
+	    /* Set correct symmetries. */
+	    temp = table->subtableZ[x].next;
+	    if (temp == x)
+		temp = y;
+	    i = gxtop;
+	    for (;;) {
+		if (table->subtableZ[i].next == (unsigned) x) {
+		    table->subtableZ[i].next = y;
+		    break;
+		} else {
+		    i = table->subtableZ[i].next;
+		}
+	    }
+	    if (table->subtableZ[y].next != (unsigned) y) {
+		table->subtableZ[x].next = table->subtableZ[y].next;
+	    } else {
+		table->subtableZ[x].next = x;
+	    }
+
+	    if (yprev != y) {
+		table->subtableZ[yprev].next = x;
+	    } else {
+		yprev = x;
+	    }
+	    table->subtableZ[y].next = temp;
+
+	    size = cuddZddSwapInPlace(table, x, y);
+	    if (size == 0)
+		return(0);
+	    y = x;
+	    x--;
+	} /* while y > gxtop */
+
+	/* Trying to find the next y. */
+	if (table->subtableZ[y].next <= (unsigned) y) {
+	    gybot = y;
+	} else {
+	    y = table->subtableZ[y].next;
+	}
+
+	yprev = gxtop;
+	gxtop++;
+	gxbot++;
+	x = gxbot;
+    } /* while x <= y, end of group movement backward */
+
+    return(size);
+
+} /* end of zdd_group_move_backward */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Counts numbers of symmetric variables and symmetry
+  groups.]
+
+  Description []
+
+  SideEffects [None]
+
+******************************************************************************/
+static void
+cuddZddSymmSummary(
+  DdManager * table,
+  int  lower,
+  int  upper,
+  int * symvars,
+  int * symgroups)
+{
+    int i,x,gbot;
+    int TotalSymm = 0;
+    int TotalSymmGroups = 0;
+
+    for (i = lower; i <= upper; i++) {
+	if (table->subtableZ[i].next != (unsigned) i) {
+	    TotalSymmGroups++;
+	    x = i;
+	    do {
+		TotalSymm++;
+		gbot = x;
+		x = table->subtableZ[x].next;
+	    } while (x != i);
+#ifdef DD_DEBUG
+	    assert(table->subtableZ[gbot].next == (unsigned) i);
+#endif
+	    i = gbot;
+	}
+    }
+    *symvars = TotalSymm;
+    *symgroups = TotalSymmGroups;
+
+    return;
+
+} /* end of cuddZddSymmSummary */
+
Index: /vis_dev/glu-2.1/src/cuPort/cuPort.c
===================================================================
--- /vis_dev/glu-2.1/src/cuPort/cuPort.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuPort/cuPort.c	(revision 6)
@@ -0,0 +1,7332 @@
+/**CFile***********************************************************************
+
+  FileName    [cuPort.c]
+
+  PackageName [cudd]
+
+  Synopsis [SIS/VIS interface to the Decision Diagram Package of the University
+  of Colorado.]
+
+  Description [This file implements an interface between the functions in the
+    Berkeley BDD package and the functions provided by the CUDD (decision
+    diagram) package from the University of Colorado. The CUDD package is a
+    generic implementation of a decision diagram data structure. For the time
+    being, only Boole expansion is implemented and the leaves in the in the
+    nodes can be the constants zero, one or any arbitrary value.]
+
+  Author      [Abelardo Pardo, Kavita Ravi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "cuPortInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] DD_UNUSED = "$Id: cuPort.c,v 1.127 2004/08/13 18:39:30 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void InvalidType( FILE *file, char *field, char *expected);
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Builds the bdd_t structure.]
+
+  Description [Builds the bdd_t structure from manager and node.
+  Assumes that the reference count of the node has already been
+  increased. If it fails to create a new bdd_t structure it disposes of
+  the node to simplify error handling for the caller. Returns a
+  pointer to the newly created structure if successful; NULL
+  otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_construct_bdd_t(bdd_manager *mgr, bdd_node *fn)
+{
+  bdd_t *result;
+
+  result = ALLOC(bdd_t, 1);
+  if (result == NULL) {
+    printf("problem d'allocation \n");	  
+    Cudd_RecursiveDeref((DdManager *)mgr,(DdNode *)fn);
+    return(NULL);
+  }
+  result->mgr = (DdManager *) mgr;
+  result->node = (DdNode *) fn;
+  result->free = FALSE;
+  return(result);
+
+} /* end of bdd_construct_bdd_t */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Function to identify the bdd package being used]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_package_type_t
+bdd_get_package_name(void)
+{
+  return(CUDD);
+
+} /* end of bdd_get_package_name */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Terminates the bdd package.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_end(bdd_manager *mgr)
+{
+  DdManager *manager;
+
+  manager = (DdManager *)mgr;
+  if (manager->hooks != NULL) FREE(manager->hooks);
+  Cudd_Quit(manager);
+
+} /* end of bdd_end */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Starts the manager with nvariables variables.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_manager *
+bdd_start(int nvariables)
+{
+  DdManager *mgr;
+  bdd_external_hooks *hooks;
+
+  mgr =  Cudd_Init((unsigned int)nvariables, 0, CUDD_UNIQUE_SLOTS,
+		   CUDD_CACHE_SLOTS, getSoftDataLimit() / 10 * 9);
+
+  hooks = ALLOC(bdd_external_hooks,1);
+  hooks->mdd = hooks->network = hooks->undef1 = (char *) 0;
+  mgr->hooks = (char *) hooks;
+
+  return(bdd_manager *)mgr;
+
+} /* end of bdd_start */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a new variable in the manager.]
+
+  SideEffects [Modifies the manager]
+
+  SeeAlso     [bdd_create_variable_after]
+
+******************************************************************************/
+bdd_t *
+bdd_create_variable(bdd_manager *mgr)
+{
+  DdNode *var;
+  DdManager *dd = (DdManager *) mgr;
+  DdNode *one = DD_ONE(dd);
+
+  if (dd->size >= CUDD_MAXINDEX -1) return(NULL);
+  do {
+    dd->reordered = 0;
+    var = cuddUniqueInter(dd,dd->size,one,Cudd_Not(one));
+  } while (dd->reordered == 1);
+
+  if (var == NULL) return((bdd_t *)NULL);
+  cuddRef(var);
+  return(bdd_construct_bdd_t(dd,var));
+
+} /* end of bdd_create_variable */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a new variable and positions it after the
+  variable with the specified index.]
+
+  SideEffects [Modifies the manager.]
+
+  SeeAlso     [bdd_create_variable]
+
+******************************************************************************/
+bdd_t *
+bdd_create_variable_after(bdd_manager *mgr, bdd_variableId after_id)
+{
+  DdNode *var;
+  DdManager *dd = (DdManager *) mgr;
+  int level;
+
+  if (after_id >= (bdd_variableId) dd->size) return(NULL);
+  level = 1 + dd->perm[after_id];
+  var = Cudd_bddNewVarAtLevel(dd,level);
+  if (var == NULL) return((bdd_t *)NULL);
+  cuddRef(var);
+  return(bdd_construct_bdd_t(dd,var));
+
+} /* end of bdd_create_variable_after */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD representing the variable with given ID.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_get_variable(bdd_manager *mgr, bdd_variableId variable_ID)
+{
+  DdNode *var;
+  DdManager *dd = (DdManager *) mgr;
+  DdNode *one = DD_ONE(dd);
+
+  if (variable_ID >= CUDD_MAXINDEX -1) return(NULL);
+  do {
+    dd->reordered = 0;
+    var = cuddUniqueInter(dd,(int)variable_ID,one,Cudd_Not(one));
+  } while (dd->reordered == 1);
+
+  if (var == NULL) return((bdd_t *)NULL);
+  cuddRef(var);
+  return(bdd_construct_bdd_t(dd,var));
+
+} /* end of bdd_get_variable */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a copy of the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_dup(bdd_t *f)
+{
+  cuddRef(f->node);
+  return(bdd_construct_bdd_t(f->mgr,f->node));
+
+} /* end of bdd_dup */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Deletes the BDD of f.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_free(bdd_t *f)
+{
+  if (f == NULL) {
+    fail("bdd_free: trying to free a NULL bdd_t");
+  }
+
+  if (f->free == TRUE) {
+    fail("bdd_free: trying to free a freed bdd_t");
+  }
+
+  Cudd_RecursiveDeref(f->mgr,f->node);
+  /* This is a bit overconservative. */
+  f->node = NULL;
+  f->mgr = NULL;
+  f->free = TRUE;
+  FREE(f);
+  return;
+
+} /* end of bdd_free */
+
+
+/**Function********************************************************************
+
+  Synopsis    [And of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_and(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase)
+{
+  DdManager *dd;
+  DdNode *newf, *newg, *fandg;
+
+  /* Make sure both BDDs belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* Modify the phases of the operands according to the parameters. */
+  newf = Cudd_NotCond(f->node,!f_phase);
+  newg = Cudd_NotCond(g->node,!g_phase);
+
+  /* Perform the AND operation. */
+  dd = f->mgr;
+  fandg = Cudd_bddAnd(f->mgr,newf,newg);
+  if (fandg == NULL) return(NULL);
+  cuddRef(fandg);
+
+  return(bdd_construct_bdd_t(dd,fandg));
+
+} /* end of bdd_and */
+
+
+/**Function********************************************************************
+
+  Synopsis    [And of two BDDs with limit on new nodes.]
+
+  Description [If more new nodes than specified by limit must be created,
+  this function returns NULL.  The caller must be prepared for this
+  occurrence.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_and_with_limit(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase,
+  unsigned int limit)
+{
+  DdManager *dd;
+  DdNode *newf, *newg, *fandg;
+
+  /* Make sure both BDDs belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* Modify the phases of the operands according to the parameters. */
+  newf = Cudd_NotCond(f->node,!f_phase);
+  newg = Cudd_NotCond(g->node,!g_phase);
+
+  /* Perform the AND operation. */
+  dd = f->mgr;
+  fandg = Cudd_bddAndLimit(f->mgr,newf,newg,limit);
+  if (fandg == NULL) return(NULL);
+  cuddRef(fandg);
+
+  return(bdd_construct_bdd_t(dd,fandg));
+
+} /* end of bdd_and_with_limit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [And of a BDD and an array of BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_and_array(
+  bdd_t *f,
+  array_t *g_array,
+  boolean f_phase,
+  boolean g_phase)
+{
+  bdd_t *g;
+  DdNode *result, *temp;
+  int i;
+  DdNode *newf, *newg;
+
+  /* Modify the phases of the operands according to the parameters. */
+  newf = Cudd_NotCond(f->node,!f_phase);
+
+  Cudd_Ref(result = newf);
+
+  for (i = 0; i < array_n(g_array); i++) {
+    g = array_fetch(bdd_t *, g_array, i);
+
+    /* Modify the phases of the operands according to the parameters. */
+    newg = Cudd_NotCond(g->node,!g_phase);
+
+    temp = Cudd_bddAnd(f->mgr, result, newg);
+    if (temp == NULL) {
+      Cudd_RecursiveDeref(f->mgr, result);
+      return(NULL);
+    }
+    cuddRef(temp);
+    Cudd_RecursiveDeref(f->mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_and_array */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Takes the and of an array of functions.]
+
+  SideEffects        [None]
+
+******************************************************************************/
+bdd_t *
+bdd_multiway_and(bdd_manager *manager, array_t *bddArray)
+{
+  DdManager *mgr;
+  bdd_t *operand;
+  DdNode *result, *temp;
+  int i;
+
+  mgr = (DdManager *)manager;
+
+  Cudd_Ref(result = DD_ONE(mgr));
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cudd_bddAnd(mgr, result, operand->node);
+    if (temp == NULL) {
+      Cudd_RecursiveDeref(mgr, result);
+      return(NULL);
+    }
+    cuddRef(temp);
+    Cudd_RecursiveDeref(mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_multiway_and */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Takes the or of an array of functions.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_t *
+bdd_multiway_or(bdd_manager *manager, array_t *bddArray)
+{
+  DdManager *mgr;
+  bdd_t *operand;
+  DdNode *result, *temp;
+  int i;
+  
+  mgr = (DdManager *)manager;
+  Cudd_Ref(result = Cudd_Not(DD_ONE(mgr)));
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cudd_bddOr(mgr, result, operand->node);
+    if (temp == NULL) {
+      Cudd_RecursiveDeref(mgr, result);
+      return(NULL);
+    }
+    cuddRef(temp);
+    Cudd_RecursiveDeref(mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_multiway_or */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Takes the xor of an array of functions.]
+
+  SideEffects        [None]
+
+******************************************************************************/
+bdd_t *
+bdd_multiway_xor(bdd_manager *manager, array_t *bddArray)
+{
+  DdManager *mgr;
+  bdd_t *operand;
+  DdNode *result, *temp;
+  int i;
+
+  mgr = (DdManager *)manager;
+
+  Cudd_Ref(result = Cudd_Not(DD_ONE(mgr)));
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cudd_bddXor(mgr, result, operand->node);
+    if (temp == NULL) {
+      Cudd_RecursiveDeref(mgr, result);
+      return(NULL);
+    }
+    cuddRef(temp);
+    Cudd_RecursiveDeref(mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_multiway_xor */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Takes the pairwise or of two arrays of bdds of the same length.]
+
+  SideEffects [None]
+
+******************************************************************************/
+array_t *
+bdd_pairwise_or(bdd_manager *manager, array_t *bddArray1, array_t *bddArray2)
+{
+  DdManager *mgr;
+  bdd_t *op1, *op2;
+  bdd_t *unit;
+  DdNode *result;
+  array_t *resultArray;
+  int i;
+
+  mgr = (DdManager *)manager;
+
+  if (array_n(bddArray1) != array_n(bddArray2)) {
+    (void) fprintf(stderr,
+		   "bdd_pairwise_or: Arrays of different lengths.\n");
+    return(NULL);
+  }
+
+  resultArray = array_alloc(bdd_t *, array_n(bddArray1));
+  for (i = 0; i < array_n(bddArray1); i++) {
+    op1 = array_fetch(bdd_t *, bddArray1, i);
+    op2 = array_fetch(bdd_t *, bddArray2, i);
+
+    result = Cudd_bddOr(mgr, op1->node, op2->node);
+    if (result == NULL) {
+      int j;
+      bdd_t *item;
+      for (j = 0; j < array_n(resultArray); j++) {
+	item = array_fetch(bdd_t *, resultArray, j);
+	bdd_free(item);
+      }
+      array_free(resultArray);
+      return((array_t *)NULL);
+    }
+    cuddRef(result);
+    
+    unit = bdd_construct_bdd_t(mgr, result);
+    array_insert(bdd_t *, resultArray, i, unit);
+  }
+
+  return(resultArray);
+
+} /* end of bdd_pairwise_or */
+
+
+/**Function********************************************************************
+
+  Synopsis [Takes the pairwise and of two arrays of bdds of the same length.]
+
+  SideEffects [required]
+
+******************************************************************************/
+array_t *
+bdd_pairwise_and(bdd_manager *manager, array_t *bddArray1, array_t *bddArray2)
+{
+  DdManager *mgr;
+  bdd_t *op1, *op2;
+  bdd_t *unit;
+  DdNode *result;
+  array_t *resultArray;
+  int i;
+
+  mgr = (DdManager *)manager;
+
+  if (array_n(bddArray1) != array_n(bddArray2)) {
+    (void) fprintf(stderr,
+		   "bdd_pairwise_or: Arrays of different lengths.\n");
+    return(NULL);
+  }
+        
+  resultArray = array_alloc(bdd_t *, array_n(bddArray1));
+  for (i = 0; i < array_n(bddArray1); i++) {
+    op1 = array_fetch(bdd_t *, bddArray1, i);
+    op2 = array_fetch(bdd_t *, bddArray2, i);
+
+    result = Cudd_bddAnd(mgr, op1->node, op2->node);
+    if (result == NULL) {
+      int j;
+      bdd_t *item;
+      for (j = 0; j < array_n(resultArray); j++) {
+	item = array_fetch(bdd_t *, resultArray, j);
+	bdd_free(item);
+      }
+      array_free(resultArray);
+      return((array_t *)NULL);
+    }
+    cuddRef(result);
+
+    unit = bdd_construct_bdd_t(mgr, result);
+    array_insert(bdd_t *, resultArray, i, unit);
+  }
+
+  return(resultArray);
+
+} /* end of bdd_pairwise_and */
+
+
+/**Function********************************************************************
+
+  Synopsis [Takes the pairwise xor of two arrays of bdds of the same length.]
+
+  SideEffects [required]
+
+******************************************************************************/
+array_t *
+bdd_pairwise_xor(bdd_manager *manager, array_t *bddArray1, array_t *bddArray2)
+{
+  DdManager *mgr;
+  bdd_t *op1, *op2;
+  bdd_t *unit;
+  DdNode *result;
+  array_t *resultArray;
+  int i;
+
+  mgr = (DdManager *)manager;
+
+  if (array_n(bddArray1) != array_n(bddArray2)) {
+    (void) fprintf(stderr,
+		   "bdd_pairwise_or: Arrays of different lengths.\n");
+    return(NULL);
+  }
+   
+  resultArray = array_alloc(bdd_t *, array_n(bddArray1));
+  for (i = 0; i < array_n(bddArray1); i++) {
+    op1 = array_fetch(bdd_t *, bddArray1, i);
+    op2 = array_fetch(bdd_t *, bddArray2, i);
+
+    result = Cudd_bddXor(mgr, op1->node, op2->node);
+    if (result == NULL) {
+      int j;
+      bdd_t *item;
+      for (j = 0; j < array_n(resultArray); j++) {
+	item = array_fetch(bdd_t *, resultArray, j);
+	bdd_free(item);
+      }
+      array_free(resultArray);
+      return((array_t *)NULL);
+    }
+    cuddRef(result);
+
+    unit = bdd_construct_bdd_t(mgr, result);
+    array_insert(bdd_t *, resultArray, i, unit);
+  }
+
+  return(resultArray);
+
+} /* end of bdd_pairwise_xor */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Abstracts variables from the product of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_and_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars	/* of bdd_t *'s */)
+{
+  int i;
+  bdd_t *variable;
+  DdNode *cube, *tmpDd, *result;
+  DdManager *mgr;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* CUDD needs the smothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+  Cudd_Ref(cube = DD_ONE(mgr));
+  for (i = 0; i < array_n(smoothing_vars); i++) {
+    variable = array_fetch(bdd_t *,smoothing_vars,i);
+
+    /* Make sure the variable belongs to the same manager. */
+    assert(mgr == variable->mgr);
+
+    tmpDd = Cudd_bddAnd(mgr,cube,variable->node);
+    if (tmpDd == NULL) {
+      Cudd_RecursiveDeref(mgr,cube);
+      return(NULL);
+    }
+    cuddRef(tmpDd);
+    Cudd_RecursiveDeref(mgr, cube);
+    cube = tmpDd;
+  }
+
+  /* Perform the smoothing */
+  result = Cudd_bddAndAbstract(mgr,f->node,g->node,cube);
+  if (result == NULL) {
+    Cudd_RecursiveDeref(mgr, cube);
+    return(NULL);
+  }
+  cuddRef(result);
+  /* Get rid of temporary results. */
+  Cudd_RecursiveDeref(mgr, cube);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_and_smooth */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Abstracts variables from the product of two BDDs with limit
+  on new nodes.]
+
+  Description [If more new nodes than specified by limit must be created,
+  this function returns NULL.  The caller must be prepared for this
+  occurrence.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_and_smooth_with_limit(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars /* of bdd_t *'s */,
+  unsigned int limit)
+{
+  int i;
+  bdd_t *variable;
+  DdNode *cube, *tmpDd, *result;
+  DdManager *mgr;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* CUDD needs the smothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+  Cudd_Ref(cube = DD_ONE(mgr));
+  for (i = 0; i < array_n(smoothing_vars); i++) {
+    variable = array_fetch(bdd_t *,smoothing_vars,i);
+
+    /* Make sure the variable belongs to the same manager. */
+    assert(mgr == variable->mgr);
+
+    tmpDd = Cudd_bddAnd(mgr,cube,variable->node);
+    if (tmpDd == NULL) {
+      Cudd_RecursiveDeref(mgr,cube);
+      return(NULL);
+    }
+    cuddRef(tmpDd);
+    Cudd_RecursiveDeref(mgr, cube);
+    cube = tmpDd;
+  }
+
+  /* Perform the smoothing */
+  result = Cudd_bddAndAbstractLimit(mgr,f->node,g->node,cube,limit);
+  if (result == NULL) {
+    Cudd_RecursiveDeref(mgr, cube);
+    return(NULL);
+  }
+  cuddRef(result);
+  /* Get rid of temporary results. */
+  Cudd_RecursiveDeref(mgr, cube);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_and_smooth_with_limit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Abstracts variables from the product of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_and_smooth_with_cube(bdd_t *f, bdd_t *g, bdd_t *cube)
+{
+  DdNode *result;
+  DdManager *mgr;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* The Boulder package needs the smothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+
+  /* Perform the smoothing */
+  result = Cudd_bddAndAbstract(mgr,f->node,g->node,cube->node);
+  if (result == NULL)
+    return(NULL);
+  cuddRef(result);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_and_smooth_with_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis [Abstracts variables from the product of two
+  BDDs. Computation is clipped at a certain depth.]
+
+  Description [Abstracts variables from the product of two
+  BDDs. Computation is clipped at a certain depth. This procedure is
+  similar to bdd_and_smooth but large depth recursions are
+  avoided. maxDepth specifies the recursion depth. over specifies
+  which kind of approximation is used 0 - under approximation and 1 -
+  for over approximation. ]
+  
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_clipping_and_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars /* of bdd_t *'s */,
+  int maxDepth,
+  int over)
+{
+  int i;
+  bdd_t *variable;
+  DdNode *cube,*tmpDd,*result;
+  DdManager *mgr;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* The Boulder package needs the smothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+  Cudd_Ref(cube = DD_ONE(mgr));
+  for (i = 0; i < array_n(smoothing_vars); i++) {
+    variable = array_fetch(bdd_t *,smoothing_vars,i);
+
+    /* Make sure the variable belongs to the same manager. */
+    assert(mgr == variable->mgr);
+
+    tmpDd = Cudd_bddAnd(mgr,cube,variable->node);
+    if (tmpDd == NULL) {
+      Cudd_RecursiveDeref(mgr,cube);
+      return(NULL);
+    }
+    cuddRef(tmpDd);
+    Cudd_RecursiveDeref(mgr, cube);
+    cube = tmpDd;
+  }
+
+  /* Perform the smoothing */
+  result = Cudd_bddClippingAndAbstract(mgr,f->node,g->node,cube, maxDepth, over);
+  if (result == NULL) {
+    Cudd_RecursiveDeref(mgr, cube);
+    return(NULL);
+  }
+  cuddRef(result);
+  /* Get rid of temporary results. */
+  Cudd_RecursiveDeref(mgr, cube);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_clipping_and_smooth */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Abstracts variables from the exclusive OR of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_xor_smooth(
+  bdd_t *f,
+  bdd_t *g,
+  array_t *smoothing_vars /* of bdd_t *'s */)
+{
+  int i;
+  bdd_t *variable;
+  DdNode *cube,*tmpDd,*result;
+  DdManager *mgr;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  /* The Boulder package needs the smothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+  Cudd_Ref(cube = DD_ONE(mgr));
+  for (i = 0; i < array_n(smoothing_vars); i++) {
+    variable = array_fetch(bdd_t *,smoothing_vars,i);
+
+    /* Make sure the variable belongs to the same manager. */
+    assert(mgr == variable->mgr);
+
+    tmpDd = Cudd_bddAnd(mgr,cube,variable->node);
+    if (tmpDd == NULL) {
+      Cudd_RecursiveDeref(mgr,cube);
+      return(NULL);
+    }
+    cuddRef(tmpDd);
+    Cudd_RecursiveDeref(mgr, cube);
+    cube = tmpDd;
+  }
+
+  /* Perform the smoothing */
+  result = Cudd_bddXorExistAbstract(mgr,f->node,g->node,cube);
+  if (result == NULL) {
+    Cudd_RecursiveDeref(mgr, cube);
+    return(NULL);
+  }
+  cuddRef(result);
+  /* Get rid of temporary results. */
+  Cudd_RecursiveDeref(mgr, cube);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_xor_smooth */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Return a minimum size BDD between bounds.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_between(bdd_t *f_min, bdd_t *f_max)
+{
+  bdd_t *care_set, *ret;
+
+  if (bdd_equal(f_min, f_max)) {
+    return (bdd_dup(f_min));
+  }
+  care_set = bdd_or(f_min, f_max, 1, 0);
+  ret = bdd_minimize(f_min, care_set);
+  bdd_free(care_set);
+  /* The size of ret is never larger than the size of f_min. We need
+  ** only to check ret against f_max. */
+  if (bdd_size(f_max) <= bdd_size(ret)) {
+    bdd_free(ret);
+    return(bdd_dup(f_max));
+  } else {
+    return(ret);
+  }
+
+} /* end of bdd_between */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the cube of an array of mdd ids. The cube
+  is positive unate.  Returns a pointer to the result if successful;
+  NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_compute_cube(bdd_manager *mgr, array_t *vars)
+{
+  DdNode *result;
+  DdNode **nodeArray;
+  int i, id;
+    
+  if (vars == NIL(array_t)) return NIL(bdd_t);
+  if (array_n(vars) == 0) return NIL(bdd_t);
+  /* create an array of DdNodes */
+  nodeArray = ALLOC(DdNode *, array_n(vars));
+  arrayForEachItem(int, vars, i, id) {
+    assert(id < bdd_num_vars(mgr));
+    nodeArray[i] = Cudd_bddIthVar((DdManager *)mgr, id);
+  }
+  result = Cudd_bddComputeCube((DdManager *)mgr, (DdNode **)nodeArray,
+			       NULL, array_n(vars));
+  FREE(nodeArray);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_compute_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the cube of an array of mdd ids. The phase if
+  each variable is given in the phase array.  Returns a pointer to the
+  result if successful; NULL otherwise.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_compute_cube_with_phase(bdd_manager *mgr, array_t *vars, array_t *phase)
+{
+  DdNode *result;
+  DdNode **nodeArray;
+  int *phaseArray;
+  int i, id, ph;
+    
+  if (vars == NIL(array_t)) return NIL(bdd_t);
+  if (array_n(vars) == 0) return NIL(bdd_t);
+  if (phase != NIL(array_t) && array_n(vars) != array_n(phase))
+    return NIL(bdd_t);
+  /* create an array of DdNodes */
+  nodeArray = ALLOC(DdNode *, array_n(vars));
+  phaseArray = NIL(int);
+  if (phase != NIL(array_t)) phaseArray = ALLOC(int, array_n(phase));
+  arrayForEachItem(int, vars, i, id) {
+    assert(id < bdd_num_vars(mgr));
+    nodeArray[i] = Cudd_bddIthVar((DdManager *)mgr, id);
+  }
+  arrayForEachItem(int, phase, i, ph) {
+    assert(ph == 0 || ph == 1);
+    phaseArray[i] = ph;
+  }
+  result = Cudd_bddComputeCube((DdManager *)mgr, (DdNode **)nodeArray,
+			       phaseArray, array_n(vars));
+  FREE(nodeArray);
+  if (phaseArray != NIL(int)) FREE(phaseArray);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_compute_cube_with_phase */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the cofactor of f with respect to g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_cofactor(bdd_t *f, bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager */
+  assert(f->mgr == g->mgr);
+
+  /* We use Cudd_bddConstrain instead of Cudd_Cofactor for generality. */
+  result = Cudd_bddConstrain(f->mgr,f->node,
+			     g->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_cofactor */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the cofactor of f with respect to g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_cofactor_array(bdd_t *f, array_t *bddArray)
+{
+  bdd_t *operand;
+  DdNode *result, *temp;
+  int i;
+
+  Cudd_Ref(result = f->node);
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cudd_bddConstrain(f->mgr, result, operand->node);
+    if (temp == NULL) {
+      Cudd_RecursiveDeref(f->mgr, result);
+      return(NULL);
+    }
+    cuddRef(temp);
+    Cudd_RecursiveDeref(f->mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_cofactor_array */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the cofactor of f with respect to g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_var_cofactor(bdd_t *f, bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager */
+  assert(f->mgr == g->mgr);
+
+  result = Cudd_Cofactor(f->mgr,f->node,
+			 g->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_var_cofactor */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the cofactor of f with respect to g in a safe manner.]
+
+  Description [Performs safe minimization of a BDD. Given the BDD
+  <code>f</code> of a function to be minimized and a BDD
+  <code>c</code> representing the care set, Cudd_bddLICompaction
+  produces the BDD of a function that agrees with <code>f</code>
+  wherever <code>c</code> is 1.  Safe minimization means that the size
+  of the result is guaranteed not to exceed the size of
+  <code>f</code>. This function is based on the DAC97 paper by Hong et
+  al..  Returns a pointer to the result if successful; NULL
+  otherwise.]
+  
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_compact(bdd_t *f, bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager */
+  assert(f->mgr == g->mgr);
+
+  result = Cudd_bddLICompaction(f->mgr,f->node,
+				g->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_compact */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes a bdd between l and u.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_squeeze(bdd_t *l, bdd_t *u)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager */
+  assert(l->mgr == u->mgr);
+
+  result = Cudd_bddSqueeze(l->mgr,l->node,
+			   u->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(l->mgr,result));
+
+} /* end of bdd_squeeze */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Functional composition of a function by a variable.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_compose(bdd_t *f, bdd_t *v, bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure all operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+  assert(f->mgr == v->mgr);
+
+  result = Cudd_bddCompose(f->mgr,f->node,
+			   g->node,
+			   (int)Cudd_Regular(v->node)->index);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis [Composes a BDD with a vector of BDDs. Given a vector of
+  BDDs, creates a new BDD by substituting the BDDs for the variables
+  of the BDD f.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_vector_compose(bdd_t *f, array_t *varArray, array_t *funcArray)
+{
+  int i, n, nVars, index;
+  bdd_t *var, *func;
+  DdNode *result;
+  DdNode **vector;
+
+  assert(array_n(varArray) == array_n(funcArray));
+  n = array_n(varArray);
+  nVars = ((DdManager *)f->mgr)->size;
+  vector = ALLOC(DdNode *, sizeof(DdNode *) * nVars);
+  memset(vector, 0, sizeof(DdNode *) * nVars);
+
+  for (i = 0; i < n; i++) {
+    var = array_fetch(bdd_t *, varArray, i);
+    func = array_fetch(bdd_t *, funcArray, i);
+    index = (int)bdd_top_var_id(var);
+    vector[index] = (DdNode *)func->node;
+    cuddRef(vector[index]);
+  }
+  for (i = 0; i < nVars; i++) {
+    if (!vector[i]) {
+      vector[i] = Cudd_bddIthVar((DdManager *)f->mgr, i);
+      cuddRef(vector[i]);
+    }
+  }
+
+  result = Cudd_bddVectorCompose(f->mgr, f->node, vector);
+
+  for (i = 0; i < nVars; i++)
+    Cudd_RecursiveDeref((DdManager *)f->mgr, vector[i]);
+  FREE(vector);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_vector_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Universal Abstraction of Variables.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_consensus(
+  bdd_t *f,
+  array_t *quantifying_vars /* of bdd_t *'s */)
+{
+  int i;
+  bdd_t *variable;
+  DdNode *cube,*tmpDd,*result;
+  DdManager *mgr;
+
+  /* The Boulder package needs the smothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of the variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+  Cudd_Ref(cube = DD_ONE(mgr));
+  for (i = 0; i < array_n(quantifying_vars); i++) {
+    variable = array_fetch(bdd_t *,quantifying_vars,i);
+
+    /* Make sure the variable belongs to the same manager */
+    assert(mgr == variable->mgr);
+
+    tmpDd = Cudd_bddAnd(mgr,cube,variable->node);
+    if (tmpDd == NULL) {
+      Cudd_RecursiveDeref(mgr, cube);
+      return(NULL);
+    }
+    cuddRef(tmpDd);
+    Cudd_RecursiveDeref(mgr, cube);
+    cube = tmpDd;
+  }
+
+  /* Perform the consensus */
+  result = Cudd_bddUnivAbstract(mgr,f->node,cube);
+  if (result == NULL) {
+    Cudd_RecursiveDeref(mgr, cube);
+    return(NULL);
+  }
+  cuddRef(result);
+  /* Get rid of temporary results */
+  Cudd_RecursiveDeref(mgr, cube);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_consensus */
+
+bdd_t *
+bdd_consensus_with_cube(
+  bdd_t *f,
+  bdd_t *cube)
+{
+  DdNode *result;
+  DdManager *mgr;
+
+  mgr = f->mgr;
+  /* Perform the consensus */
+  result = Cudd_bddUnivAbstract(mgr,f->node,cube->node);
+  if (result == NULL)
+    return(NULL);
+  cuddRef(result);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_consensus */
+
+/**Function********************************************************************
+
+  Synopsis    [The compatible projection function.]
+
+  Description [The compatible projection function. The reference minterm
+  is chosen based on the phases of the quantifying variables. If all
+  variables are in positive phase, the minterm 111...111 is used as
+  reference.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_cproject(
+  bdd_t *f,
+  array_t *quantifying_vars /* of bdd_t* */)
+{
+  DdManager *dd;
+  DdNode *cube;
+  DdNode *res;
+  bdd_t *fi;
+  int nvars, i;
+
+  if (f == NULL) {
+    fail ("bdd_cproject: invalid BDD");
+  }
+
+  nvars = array_n(quantifying_vars);
+  if (nvars <= 0) {
+    fail("bdd_cproject: no projection variables");
+  }
+  dd = f->mgr;
+
+  cube = DD_ONE(dd);
+  cuddRef(cube);
+  for (i = nvars - 1; i >= 0; i--) {
+    DdNode *tmpp;
+    fi = array_fetch(bdd_t *, quantifying_vars, i);
+    tmpp = Cudd_bddAnd(dd,fi->node,cube);
+    if (tmpp == NULL) {
+      Cudd_RecursiveDeref(dd,cube);
+      return(NULL);
+    }
+    cuddRef(tmpp);
+    Cudd_RecursiveDeref(dd,cube);
+    cube = tmpp;
+  }
+
+  res = Cudd_CProjection(dd,f->node,cube);
+  if (res == NULL) {
+    Cudd_RecursiveDeref(dd,cube);
+    return(NULL);
+  }
+  cuddRef(res);
+  Cudd_RecursiveDeref(dd,cube);
+
+  return(bdd_construct_bdd_t(dd,res));
+
+} /* end of bdd_cproject */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the else branch of a BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_else(bdd_t *f)
+{
+  DdNode *result;
+
+  result = Cudd_E(f->node);
+  result =  Cudd_NotCond(result,Cudd_IsComplement(f->node));
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_else */
+
+
+/**Function********************************************************************
+
+  Synopsis    [ITE.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_ite(
+  bdd_t *i,
+  bdd_t *t,
+  bdd_t *e,
+  boolean i_phase,
+  boolean t_phase,
+  boolean e_phase)
+{
+  DdNode *newi,*newt,*newe,*ite;
+
+  /* Make sure both bdds belong to the same mngr */
+  assert(i->mgr == t->mgr);
+  assert(i->mgr == e->mgr);
+
+  /* Modify the phases of the operands according to the parameters */
+  if (!i_phase) {
+    newi = Cudd_Not(i->node);
+  } else {
+    newi = i->node;
+  }
+  if (!t_phase) {
+    newt = Cudd_Not(t->node);
+  } else {
+    newt = t->node;
+  }
+  if (!e_phase) {
+    newe = Cudd_Not(e->node);
+  } else {
+    newe = e->node;
+  }
+
+  /* Perform the ITE operation */
+  ite = Cudd_bddIte(i->mgr,newi,newt,newe);
+  if (ite == NULL) return(NULL);
+  cuddRef(ite);
+  return(bdd_construct_bdd_t(i->mgr,ite));
+
+} /* end of bdd_ite */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Restrict operator as described in Coudert et al. ICCAD90.]
+
+  Description [Restrict operator as described in Coudert et
+  al. ICCAD90.  Always returns a BDD not larger than the input
+  <code>f</code> if successful; NULL otherwise.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_minimize(bdd_t *f, bdd_t *c)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == c->mgr);
+
+  result = Cudd_bddRestrict(f->mgr, f->node, c->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t(f->mgr,result);
+  return(output);
+
+} /* end of bdd_minimize */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Restrict operator as described in Coudert et al. ICCAD90.]
+
+  Description [Restrict operator as described in Coudert et
+  al. ICCAD90.  Always returns a BDD not larger than the input
+  <code>f</code> if successful; NULL otherwise.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_minimize_array(bdd_t *f, array_t *bddArray)
+{
+  bdd_t *operand;
+  DdNode *result, *temp;
+  int i;
+
+  Cudd_Ref(result = f->node);
+
+  for (i = 0; i < array_n(bddArray); i++) {
+    operand = array_fetch(bdd_t *, bddArray, i);
+    temp = Cudd_bddRestrict(f->mgr, result, operand->node);
+    if (temp == NULL) {
+      Cudd_RecursiveDeref(f->mgr, result);
+      return(NULL);
+    }
+    cuddRef(temp);
+    Cudd_RecursiveDeref(f->mgr, result);
+    result = temp;
+  }
+
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_minimize_array */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subset (superset) operator.]
+
+  Description [It computes a bdd which is a subset (superset) of the
+  given operand and has less nodes. approxDir specifies over/under
+  approximation. The number of variables is an estimate of the support
+  of the operand, and threshold is the maximum number of vertices
+  allowed in the result. The technique applied to eliminate nodes is
+  to remove a child of a node, starting with the root, that contribute
+  to fewer minterms than the other child. Refer to Ravi & Somenzi
+  ICCAD95.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_approx_hb(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  switch (approxDir) {
+  case BDD_OVER_APPROX:
+    result = Cudd_SupersetHeavyBranch(f->mgr, f->node, numVars, threshold);
+    break;
+  case BDD_UNDER_APPROX:
+    result = Cudd_SubsetHeavyBranch(f->mgr, f->node, numVars, threshold);
+    break;
+  default:
+    result = NULL;
+  }
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t(f->mgr,result);
+  return(output);
+
+} /* end of bdd_approx_hb */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subset (superset) operator.]
+
+  Description [It computes a bdd which is a subset (superset) of the
+  given operand and it has less nodes. approxDir specifies over/under
+  approximation. The number of variables is an estimate of the support
+  of the operand, and threshold is the maximum number of vertices
+  allowed in the result. If unsure, pass NULL for the number of
+  variables.  The method used is to extract the smallest cubes in the
+  bdd which also correspond to the shortest paths in the bdd to the
+  constant 1. hardlimit indicates that the node limit is strict. Refer
+  to Ravi and Somenzi ICCAD95.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_approx_sp(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  int hardlimit)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  switch (approxDir) {
+  case BDD_OVER_APPROX:
+    result = Cudd_SupersetShortPaths(f->mgr, f->node, numVars, threshold, hardlimit);
+    break;
+  case BDD_UNDER_APPROX:
+    result = Cudd_SubsetShortPaths(f->mgr, f->node, numVars, threshold, hardlimit);
+    break;
+  default:
+    result = NULL;
+  }
+
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t(f->mgr,result);
+  return(output);
+
+} /* end of bdd_approx_sp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subset (superset) operator.]
+
+  Description [It computes a bdd which is a subset (superset) of the
+  given operand and it has less nodes. The bdd chooses to preserve
+  nodes that contribute a large number and throws away those that
+  contribute fewer minterms and dominate a large number of
+  nodes. approxDir specifies over/under approximation. numVars is the
+  number of variables in the true support of f. threshold is a limit
+  specified on the number of nodes. safe is a parameter to ensure that
+  the result is never larger than the operand. quality is a factor
+  that affects replacement of nodes: 1 is the default value. Values
+  for quality imply that the ratio of the density of the result of
+  replaced nodes to the original original is equal to the value. Refer
+  to Shiple thesis.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_approx_ua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  int safe,
+  double quality)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  switch (approxDir) {
+  case BDD_OVER_APPROX:
+    result = Cudd_OverApprox(f->mgr, f->node, numVars, threshold, safe, quality);
+    break;
+  case BDD_UNDER_APPROX:
+    result = Cudd_UnderApprox(f->mgr, f->node, numVars, threshold, safe, quality);
+    break;
+  default:
+    result = NULL;
+  }
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t(f->mgr,result);
+  return(output);
+
+} /* end of bdd_approx_ua */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subset (superset) operator.]
+
+  Description [It computes a bdd which is a subset (superset) of the
+  given operand and it has less nodes.The bdd chooses to preserve
+  nodes that contribute a large number and throws away those that
+  contribute fewer minterms and dominate a large number of nodes. Some
+  nodes may be remapped to existing nodes in the BDD. approxDir
+  specifies over/under approximation. numVars is the number of
+  variables in the true support of f. threshold is a limit specified
+  on the number of nodes. safe is a parameter to ensure that the
+  result is never larger than the operand. quality is a factor that
+  affects replacement of nodes: 1 is the default value. Values for
+  quality imply that the ratio of the density of the result with
+  replaced nodes to the original bdd is equal to the value. Refer to
+  Shiple, Somenzi DAC98. ]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_approx_remap_ua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold,
+  double quality)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  switch (approxDir) {
+  case BDD_OVER_APPROX:
+    result = Cudd_RemapOverApprox((DdManager *)f->mgr, (DdNode *)f->node, numVars, threshold, quality);
+    break;
+  case BDD_UNDER_APPROX:
+    result = Cudd_RemapUnderApprox((DdManager *)f->mgr, (DdNode *)f->node, numVars, threshold, quality);
+    break;
+  default:
+    result = NULL;
+  }
+
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t((DdManager *)f->mgr,result);
+  return(output);
+
+} /* end of bdd_approx_remap_ua */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subset (superset) operator.]
+
+  Description [It computes a bdd which is a subset (superset) of the
+  given operand and it has less nodes.The bdd chooses to preserve
+  nodes that contribute a large number and throws away those that
+  contribute fewer minterms and dominate a large number of nodes. Some
+  nodes may be remapped to existing nodes in the BDD. approxDir
+  specifies over/under approximation. numVars is the number of
+  variables in the true support of f. threshold is a limit specified
+  on the number of nodes. safe is a parameter to ensure that the
+  result is never larger than the operand. quality is a factor that
+  affects replacement of nodes: 1 is the default value. Values for
+  quality imply that the ratio of the density of the result with
+  replaced nodes to the original bdd is equal to the value. Refer
+  Shiple, Somenzi DAC98. The only difference between this function and
+  bdd_approx_remap_ua is that this function takes a bias BDD and tries
+  to lean the approximation towards the bias]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_approx_biased_rua(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  bdd_t *bias,
+  int numVars,
+  int threshold,
+  double quality,
+  double qualityBias)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  assert(bias->mgr == f->mgr);
+  switch (approxDir) {
+  case BDD_OVER_APPROX:
+    result = Cudd_BiasedOverApprox((DdManager *)f->mgr, (DdNode *)f->node, (DdNode *)bias->node,  numVars, threshold, quality, qualityBias);
+    break;
+  case BDD_UNDER_APPROX:
+    result = Cudd_BiasedUnderApprox((DdManager *)f->mgr, (DdNode *)f->node, (DdNode *)bias->node, numVars, threshold, quality, qualityBias);
+    break;
+  default:
+    result = NULL;
+  }
+
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t((DdManager *)f->mgr,result);
+  return(output);
+
+} /* end of bdd_approx_biased_rua */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subset (superset) operator.]
+
+  Description [It computes a bdd which is a subset (superset) of the
+  given operand and it has less nodes. approxDir specifies over/under
+  approximation. The number of variables is an estimate of the support
+  of the operand, and threshold is the maximum number of vertices
+  allowed in the result. It applies short paths with the given
+  threshold first and then uses remap_ua to increase density.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_t *
+bdd_approx_compress(
+  bdd_t *f,
+  bdd_approx_dir_t approxDir,
+  int numVars,
+  int threshold)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  switch (approxDir) {
+  case BDD_OVER_APPROX:
+    result = Cudd_SupersetCompress(f->mgr, f->node, numVars, threshold);
+    break;
+  case BDD_UNDER_APPROX:
+    result = Cudd_SubsetCompress(f->mgr, f->node, numVars, threshold);
+    break;
+  default:
+    result = NULL;
+  }
+
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t(f->mgr,result);
+  return(output);
+
+} /* end of bdd_approx_compress */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Finds a shortest path in a DD.]
+
+  Description [Finds a shortest path in a DD. f is the DD we want to
+  get the shortest path for; weight\[i\] is the weight of the THEN arc
+  coming from the node whose index is i. If weight is NULL, then unit
+  weights are assumed for all THEN arcs. All ELSE arcs have 0 weight.
+  If non-NULL, both weight and support should point to arrays with at
+  least as many entries as there are variables in the manager.
+  Returns the shortest path as the BDD of a cube.]
+
+  SideEffects [support contains on return the true support of f.
+  If support is NULL on entry, then Cudd_ShortestPath does not compute
+  the true support info. length contains the length of the path.]
+
+******************************************************************************/
+bdd_t *
+bdd_shortest_path(
+  bdd_t *f,
+  int *weight,
+  int *support,
+  int *length)
+{
+  DdNode *result;
+  bdd_t *output;
+
+  result = Cudd_ShortestPath(f->mgr, f->node, weight, support, length);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+
+  output = bdd_construct_bdd_t(f->mgr,result);
+  return(output);
+
+} /* end of bdd_shortest_path */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Negation.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_not(bdd_t *f)
+{
+  DdNode *result;
+
+  Cudd_Ref(result = Cudd_Not(f->node));
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_not */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the one BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_one(bdd_manager *mgr)
+{
+  DdNode *result;
+
+  Cudd_Ref(result = DD_ONE((DdManager *)mgr));
+  return(bdd_construct_bdd_t((DdManager *)mgr,result));
+
+} /* end of bdd_one */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Or of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_or(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase)
+{
+  DdNode *newf,*newg,*forg;
+  bdd_t *result;
+
+  /* Make sure both bdds belong to the same mngr */
+  assert(f->mgr == g->mgr);
+
+  /* Modify the phases of the operands according to the parameters */
+  if (f_phase) {
+    newf = Cudd_Not(f->node);
+  } else {
+    newf = f->node;
+  }
+  if (g_phase) {
+    newg = Cudd_Not(g->node);
+  } else {
+    newg = g->node;
+  }
+
+  /* Perform the OR operation */
+  forg = Cudd_bddAnd(f->mgr,newf,newg);
+  if (forg == NULL) return(NULL);
+  forg = Cudd_Not(forg);
+  cuddRef(forg);
+  result = bdd_construct_bdd_t(f->mgr,forg);
+
+  return(result);
+
+} /* end of bdd_or */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Existential abstraction of variables.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_smooth(
+  bdd_t *f,
+  array_t *smoothing_vars /* of bdd_t *'s */)
+{
+  int i;
+  bdd_t *variable;
+  DdNode *cube,*tmpDd,*result;
+  DdManager *mgr;
+  DdNode **vars;
+  int nVars, level;
+
+  /* The Boulder package needs the smoothing variables passed as a cube.
+   * Therefore we must build that cube from the indices of the variables
+   * in the array before calling the procedure.
+   */
+  mgr = f->mgr;
+  nVars = mgr->size;
+  vars = ALLOC(DdNode *, sizeof(DdNode *) * nVars);
+  memset(vars, 0, sizeof(DdNode *) * nVars);
+  for (i = 0; i < array_n(smoothing_vars); i++) {
+    variable = array_fetch(bdd_t *,smoothing_vars,i);
+
+    /* Make sure the variable belongs to the same manager. */
+    assert(mgr == variable->mgr);
+
+    level = Cudd_ReadPerm(mgr, Cudd_NodeReadIndex(variable->node));
+    vars[level] = variable->node;
+  }
+  Cudd_Ref(cube = DD_ONE(mgr));
+  for (i = nVars - 1; i >= 0; i--) {
+    if (!vars[i])
+      continue;
+    tmpDd = Cudd_bddAnd(mgr,cube,vars[i]);
+    if (tmpDd == NULL) {
+      Cudd_RecursiveDeref(mgr, cube);
+      return(NULL);
+    }
+    cuddRef(tmpDd);
+    Cudd_RecursiveDeref(mgr, cube);
+    cube = tmpDd;
+  }
+  FREE(vars);
+
+  /* Perform the smoothing */
+  result = Cudd_bddExistAbstract(mgr,f->node,cube);
+  if (result == NULL) {
+    Cudd_RecursiveDeref(mgr, cube);
+    return(NULL);
+  }
+  cuddRef(result);
+
+  /* Get rid of temporary results */
+  Cudd_RecursiveDeref(mgr, cube);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_smooth */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Existential abstraction of variables.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_smooth_with_cube(bdd_t *f, bdd_t *cube)
+{
+  DdNode *result;
+  DdManager *mgr;
+
+  mgr = f->mgr;
+
+  /* Perform the smoothing */
+  result = Cudd_bddExistAbstract(mgr,f->node,cube->node);
+  if (result == NULL)
+    return(NULL);
+  cuddRef(result);
+
+  /* Build the bdd_t structure for the result */
+  return(bdd_construct_bdd_t(mgr,result));
+
+} /* end of bdd_smooth_with_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Permutes the variables.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_substitute(
+  bdd_t *f,
+  array_t *old_array /* of bdd_t *'s */,
+  array_t *new_array /* of bdd_t *'s */)
+{
+  int i,from,to;
+  int *permut;
+  bdd_t *variable;
+  DdNode *result;
+
+  /* Make sure both arrays have the same number of elements. */
+  assert(array_n(old_array) == array_n(new_array));
+
+  /* Allocate and fill the array with the trivial permutation. */
+  permut = ALLOC(int, Cudd_ReadSize((DdManager *)f->mgr));
+  for (i = 0; i < Cudd_ReadSize((DdManager *)f->mgr); i++) permut[i] = i;
+
+  /* Modify the permutation by looking at both arrays old and new. */
+  for (i = 0; i < array_n(old_array); i++) {
+    variable = array_fetch(bdd_t *, old_array, i);
+    from = Cudd_Regular(variable->node)->index;
+    variable = array_fetch(bdd_t *, new_array, i);
+    /* Make sure the variable belongs to this manager. */
+    assert(f->mgr == variable->mgr);
+
+    to = Cudd_Regular(variable->node)->index;
+    permut[from] = to;
+  }
+
+  result = Cudd_bddPermute(f->mgr,f->node,permut);
+  FREE(permut);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_substitute */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Permutes the variables.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_substitute_with_permut(
+  bdd_t *f,
+  int *permut)
+{
+  DdNode *result;
+
+  result = Cudd_bddPermute(f->mgr,f->node,permut);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_substitute_with_permut */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Permutes the variables.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+bdd_substitute_array(
+  array_t *f_array,
+  array_t *old_array,	/* of bdd_t *'s */
+  array_t *new_array)	/* of bdd_t *'s */
+{
+  int	i;
+  bdd_t	*f, *new_;
+  array_t *substitute_array = array_alloc(bdd_t *, 0);
+
+  arrayForEachItem(bdd_t *, f_array, i, f) {
+    new_ = bdd_substitute(f, old_array, new_array);
+    array_insert_last(bdd_t *, substitute_array, new_);
+  }
+  return(substitute_array);
+
+} /* end of bdd_substitute_array */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Permutes the variables.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+bdd_substitute_array_with_permut(
+  array_t *f_array,
+  int *permut)
+{
+  int	i;
+  bdd_t	*f, *new_;
+  array_t *substitute_array = array_alloc(bdd_t *, 0);
+
+  arrayForEachItem(bdd_t *, f_array, i, f) {
+    new_ = bdd_substitute_with_permut(f, permut);
+    array_insert_last(bdd_t *, substitute_array, new_);
+  }
+  return(substitute_array);
+
+} /* end of bdd_substitute_array_with_permut */
+
+
+/**Function********************************************************************
+ 
+  Synopsis    [Returns the pointer of the BDD.]
+ 
+  SideEffects []
+ 
+******************************************************************************/
+void *
+bdd_pointer(bdd_t *f)
+{
+  return((void *)f->node);
+
+} /* end of bdd_pointer */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the Then branch of the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_then(bdd_t *f)
+{
+  DdNode *result;
+
+  result = Cudd_T(f->node);
+  result =  Cudd_NotCond(result,Cudd_IsComplement(f->node));
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_then */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the BDD of the top variable.]
+
+  Description [Returns the BDD of the top variable of the argument. If
+  the argument is constant, it returns the constant function itself.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_top_var(bdd_t *f)
+{
+  DdNode *result;
+
+  if (Cudd_IsConstant(f->node)) {
+    result = f->node;
+  } else {
+    result = f->mgr->vars[Cudd_Regular(f->node)->index];
+  }
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_top_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the exclusive nor of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_xnor(bdd_t *f, bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  result = Cudd_bddXnor(f->mgr,f->node,g->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_xnor */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the exclusive or of two BDDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_xor(bdd_t *f, bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  result = Cudd_bddXor(f->mgr,f->node,g->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_xor */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the constant logical zero BDD.]
+
+  SideEffects [bdd_read_zero]
+
+******************************************************************************/
+bdd_t *
+bdd_zero(bdd_manager *mgr)
+{
+  DdManager *manager;
+  DdNode *result;
+
+  manager = (DdManager *)mgr;
+  Cudd_Ref(result = Cudd_Not(DD_ONE((manager))));
+  return(bdd_construct_bdd_t(manager,result));
+
+} /* end of bdd_zero */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Equality check.]
+
+  SideEffects []
+
+******************************************************************************/
+boolean
+bdd_equal(bdd_t *f, bdd_t *g)
+{
+  return(f->node == g->node);
+
+} /* end of bdd_equal */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Equality check with don't care conditions.]
+
+  Description [Returns 1 if f equals g wherever careSet is 1.]
+
+  SideEffects [None: No new nodes are created.]
+
+******************************************************************************/
+boolean
+bdd_equal_mod_care_set(
+  bdd_t *f,
+  bdd_t *g,
+  bdd_t *careSet)
+{
+  /* Make sure all operands belong to the same manager. */
+  assert(f->mgr == g->mgr && f->mgr == careSet->mgr);
+  return(Cudd_EquivDC(f->mgr, f->node, g->node, Cudd_Not(careSet->node)));
+
+} /* end of bdd_equal_mod_care_set */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a BDD included in the intersection of f and g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_intersects(
+  bdd_t *f,
+  bdd_t *g)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  result = Cudd_bddIntersect(f->mgr,f->node,g->node);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_intersects */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a BDD included in f at minimum distance from g.]
+
+  SideEffects [The distance is returned as a side effect in dist.]
+
+******************************************************************************/
+bdd_t *
+bdd_closest_cube(
+  bdd_t *f,
+  bdd_t *g,
+  int *dist)
+{
+  DdNode *result;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+
+  result = Cudd_bddClosestCube(f->mgr,f->node,g->node,dist);
+  if (result == NULL) return(NULL);
+  cuddRef(result);
+  return(bdd_construct_bdd_t(f->mgr,result));
+
+} /* end of bdd_closest_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks a BDD for tautology.]
+
+  SideEffects []
+
+******************************************************************************/
+boolean
+bdd_is_tautology(bdd_t *f, boolean phase)
+{
+  if (phase) {
+    return(f->node == DD_ONE(f->mgr));
+  } else {
+    return(f->node == Cudd_Not(DD_ONE(f->mgr)));
+  }
+
+} /* end of bdd_is_tautology */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Tests for containment of f in g.]
+
+  SideEffects [None: No new nodes are created.]
+
+******************************************************************************/
+boolean
+bdd_leq(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase)
+{
+  DdNode *newf, *newg;
+
+  /* Make sure both operands belong to the same manager. */
+  assert(f->mgr == g->mgr);
+  newf = Cudd_NotCond(f->node, !f_phase);
+  newg = Cudd_NotCond(g->node, !g_phase);
+
+  return(Cudd_bddLeq(f->mgr,newf,newg));
+
+} /* end of bdd_leq */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Implication check with don't care conditions.]
+
+  Description [Returns 1 if f implies g wherever careSet is 1.]
+
+  SideEffects [None: No new nodes are created.]
+
+******************************************************************************/
+boolean
+bdd_lequal_mod_care_set(
+  bdd_t *f,
+  bdd_t *g,
+  boolean f_phase,
+  boolean g_phase,
+  bdd_t *careSet)
+{
+  DdNode *newf, *newg;
+
+  /* Make sure all operands belong to the same manager. */
+  assert(f->mgr == g->mgr && f->mgr == careSet->mgr);
+  newf = Cudd_NotCond(f->node, !f_phase);
+  newg = Cudd_NotCond(g->node, !g_phase);
+    
+  return(Cudd_bddLeqUnless(f->mgr, newf, newg, Cudd_Not(careSet->node)));
+
+} /* end of bdd_lequal_mod_care_set */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Tests for containment of f in g.]
+
+  SideEffects []
+
+******************************************************************************/
+boolean
+bdd_leq_array(
+  bdd_t *f,
+  array_t *g_array,
+  boolean f_phase,
+  boolean g_phase)
+{
+  int	i;
+  bdd_t	*g;
+  boolean result;
+
+  arrayForEachItem(bdd_t *, g_array, i, g) {
+    result = bdd_leq(f, g, f_phase, g_phase);
+    if (g_phase) {
+      if (!result)
+	return(0);
+    } else {
+      if (result)
+	return(1);
+    }
+  }
+  if (g_phase)
+    return(1);
+  else
+    return(0);
+
+} /* end of bdd_leq_array */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of minterms in the on set.]
+
+  SideEffects []
+
+******************************************************************************/
+double
+bdd_count_onset(
+  bdd_t *f,
+  array_t *var_array /* of bdd_t *'s */)
+{
+  return(Cudd_CountMinterm(f->mgr,f->node,array_n(var_array)));
+
+} /* end of bdd_count_onset */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Counts the number of minterms in the on set.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_epd_count_onset(
+  bdd_t *f,
+  array_t *var_array /* of bdd_t *'s */,
+  EpDouble *epd)
+{
+  return(Cudd_EpdCountMinterm(f->mgr,f->node,array_n(var_array),epd));
+
+} /* end of bdd_epd_count_onset */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the free field of the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_get_free(bdd_t *f)
+{
+  return(f->free);
+
+} /* end of bdd_get_free */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Obtains the manager of the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_manager *
+bdd_get_manager(bdd_t *f)
+{
+  return(f->mgr);
+
+} /* end of bdd_get_manager */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the node of the BDD.]
+
+  SideEffects [Sets is_complemented.]
+
+******************************************************************************/
+bdd_node *
+bdd_get_node(
+  bdd_t *f,
+  boolean *is_complemented /* return */)
+{
+  if (Cudd_IsComplement(f->node)) {
+    *is_complemented = TRUE;
+    return(Cudd_Regular(f->node));
+  }
+  *is_complemented = FALSE;
+  return(f->node);
+
+} /* end of bdd_get_node */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Obtains the support of the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+var_set_t *
+bdd_get_support(bdd_t *f)
+{
+  int i, size, *support;
+  var_set_t *result;
+
+  size = (unsigned int)Cudd_ReadSize((DdManager *)f->mgr);
+  support = Cudd_SupportIndex(f->mgr,f->node);
+  if (support == NULL) return(NULL);
+
+  result = var_set_new((int) f->mgr->size);
+  for (i = 0; i < size; i++) {
+    if (support[i])
+      var_set_set_elt(result, i);
+  }
+  FREE(support);
+
+  return(result);
+
+} /* end of bdd_get_support */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a BDD is a support of f.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_is_support_var(bdd_t *f, bdd_t *var)
+{
+  return(bdd_is_support_var_id(f, bdd_top_var_id(var)));
+
+} /* end of bdd_is_support_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a BDD index is a support of f.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_is_support_var_id(bdd_t *f, int index)
+{
+  DdNode *support, *scan;
+
+  support = Cudd_Support(f->mgr,f->node);
+  if (support == NULL) return(-1);
+  cuddRef(support);
+
+  scan = support;
+  while (!cuddIsConstant(scan)) {
+    if (scan->index == index) {
+      Cudd_RecursiveDeref(f->mgr,support);
+      return(1);
+    }
+    scan = cuddT(scan);
+  }
+  Cudd_RecursiveDeref(f->mgr,support);
+
+  return(0);
+
+} /* end of bdd_is_support_var_id */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Obtains the array of indices of an array of variables.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+bdd_get_varids(array_t *var_array)
+{
+  int i;
+  int index;
+  bdd_t *var;
+  array_t *result = array_alloc(int,array_n(var_array));
+
+  for (i = 0; i < array_n(var_array); i++) {
+    var = array_fetch(bdd_t *, var_array, i);
+    index = Cudd_Regular(var->node)->index;
+    (void) array_insert_last(int, result, index);
+  }
+  return(result);
+
+} /* end of bdd_get_varids */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of variables in the manager.]
+
+  SideEffects []
+
+******************************************************************************/
+unsigned int
+bdd_num_vars(bdd_manager *mgr)
+{
+  unsigned int size;
+  size = (unsigned int)Cudd_ReadSize((DdManager *)mgr);
+  return(size);
+
+} /* end of bdd_num_vars */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_print(bdd_t *f)
+{
+  (void) cuddP(f->mgr,f->node);
+
+} /* end of bdd_print */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints statistics about the package.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_print_stats(bdd_manager *mgr, FILE *file)
+{
+  Cudd_PrintInfo((DdManager *)mgr, file);
+
+  /* Print some guidance to the parameters */
+  (void) fprintf(file, "\nMore detailed information about the semantics ");
+  (void) fprintf(file, "and values of these parameters\n");
+  (void) fprintf(file, "can be found in the documentation about the CU ");
+  (void) fprintf(file, "Decision Diagram Package.\n");
+  
+  return;
+
+} /* end of bdd_print_stats */
+
+
+/**Function********************************************************************
+
+  Synopsis [Sets the internal parameters of the package to the given values.]
+
+  Description [The CUDD package has a set of parameters that can be assigned
+  different values. This function receives a table which maps strings to
+  values and sets the parameters represented by the strings to the pertinent
+  values. Some basic type checking is done. It returns 1 if everything is
+  correct and 0 otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_set_parameters(
+  bdd_manager *mgr,
+  avl_tree *valueTable,
+  FILE *file)
+{
+  Cudd_ReorderingType reorderMethod;
+  Cudd_ReorderingType zddReorderMethod;
+  st_table *newValueTable;
+  st_generator *stgen;
+  avl_generator *avlgen;
+  char *paramName;
+  char *paramValue;
+
+  /* Initial value of the variables. */
+  reorderMethod = CUDD_REORDER_SAME;
+  zddReorderMethod = CUDD_REORDER_SAME;
+
+  /* Build a new table with the parameter names but with
+  ** the prefix removed. */
+  newValueTable = st_init_table(st_ptrcmp, st_ptrhash);
+  avl_foreach_item(valueTable, avlgen, AVL_FORWARD, (char **)&paramName, 
+		   (char **)&paramValue) {
+    if (strncmp(paramName, "BDD.", 4) == 0) {
+      st_insert(newValueTable, (char *)&paramName[4],
+		(char *)paramValue);
+    }
+  }
+
+  st_foreach_item(newValueTable, stgen, &paramName, &paramValue) {
+    int uvalue;
+    char *invalidChar;
+
+    invalidChar = NIL(char);
+
+    if (strcmp(paramName, "Hard limit for cache size") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Hard limit for cache size",
+		    "unsigned integer");
+      }
+      else {
+	Cudd_SetMaxCacheHard((DdManager *) mgr, (unsigned int) uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Cache hit threshold for resizing") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Cache hit threshold for resizing",
+		    "unsigned integer");
+      }
+      else {
+	Cudd_SetMinHit((DdManager *) mgr, (unsigned int) uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Garbage collection enabled") == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	Cudd_EnableGarbageCollection((DdManager *) mgr);
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	Cudd_DisableGarbageCollection((DdManager *) mgr);
+      }
+      else {
+	InvalidType(file, "Garbage collection enabled", "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, "Limit for fast unique table growth")
+	     == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Limit for fast unique table growth", 
+		    "unsigned integer");
+      }
+      else {
+	Cudd_SetLooseUpTo((DdManager *) mgr, (unsigned int) uvalue);
+      }
+    }
+    else if (strcmp(paramName, 
+		    "Maximum number of variables sifted per reordering") 
+	     == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Maximum number of variables sifted per reordering",
+		    "unsigned integer");
+      }
+      else {
+	Cudd_SetSiftMaxVar((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, 
+		    "Maximum number of variable swaps per reordering")
+	     == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Maximum number of variable swaps per reordering", 
+		    "unsigned integer");
+      }
+      else {
+	Cudd_SetSiftMaxSwap((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, 
+		    "Maximum growth while sifting a variable") == 0) {
+      double value;
+
+      value = strtod(paramValue, &invalidChar);
+      if (*invalidChar) {
+	InvalidType(file, "Maximum growth while sifting a variable",
+		    "real");
+      }
+      else {
+	Cudd_SetMaxGrowth((DdManager *) mgr, value);
+      }
+    }
+    else if (strcmp(paramName, "Dynamic reordering of BDDs enabled")
+	     == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	Cudd_AutodynEnable((DdManager *) mgr, reorderMethod);
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	Cudd_AutodynDisable((DdManager *) mgr);
+      }
+      else {
+	InvalidType(file, "Dynamic reordering of BDDs enabled",
+		    "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, "Default BDD reordering method") == 0) {
+      Cudd_ReorderingType reorderInt;
+
+      reorderMethod = (Cudd_ReorderingType) strtol(paramValue,
+						   &invalidChar, 10);
+      if (*invalidChar || reorderMethod < 0) {
+	InvalidType(file, "Default BDD reordering method", "integer");
+      }
+      else {
+	if (Cudd_ReorderingStatus((DdManager *) mgr, &reorderInt)) {
+	  Cudd_AutodynEnable((DdManager *) mgr, reorderMethod);
+	}
+      }
+    }
+    else if (strcmp(paramName, "Dynamic reordering of ZDDs enabled")
+	     == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	Cudd_AutodynEnableZdd((DdManager *) mgr, zddReorderMethod);
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	Cudd_AutodynDisableZdd((DdManager *) mgr);
+      }
+      else {
+	InvalidType(file, "Dynamic reordering of ZDDs enabled", "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, "Default ZDD reordering method") == 0) {
+      Cudd_ReorderingType reorderInt;
+
+      zddReorderMethod = (Cudd_ReorderingType) strtol(paramValue,
+						      &invalidChar, 10);
+      if (*invalidChar || zddReorderMethod < 0) {
+	InvalidType(file, "Default ZDD reordering method", "integer");
+      }
+      else {
+	if (Cudd_ReorderingStatusZdd((DdManager *) mgr, &reorderInt)) {
+	  Cudd_AutodynEnableZdd((DdManager *) mgr, zddReorderMethod);
+	}
+      }
+    }
+    else if (strcmp(paramName, "Realignment of ZDDs to BDDs enabled")
+	     == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	Cudd_zddRealignEnable((DdManager *) mgr);
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	Cudd_zddRealignDisable((DdManager *) mgr);
+      }
+      else {
+	InvalidType(file, "Realignment of ZDDs to BDDs enabled",
+		    "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, 
+		    "Dead node counted in triggering reordering") == 0) {
+      if (strcmp(paramValue, "yes") == 0) {
+	Cudd_TurnOnCountDead((DdManager *) mgr);
+      }
+      else if (strcmp(paramValue, "no") == 0) {
+	Cudd_TurnOffCountDead((DdManager *) mgr);
+      }
+      else {
+	InvalidType(file,
+		    "Dead node counted in triggering reordering", 
+		    "(yes,no)");
+      }
+    }
+    else if (strcmp(paramName, "Group checking criterion") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Group checking criterion", "integer");
+      }
+      else {
+	Cudd_SetGroupcheck((DdManager *) mgr, (Cudd_AggregationType) uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Recombination threshold") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Recombination threshold", "integer");
+      }
+      else {
+	Cudd_SetRecomb((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Symmetry violation threshold") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Symmetry violation threshold", "integer");
+      }
+      else {
+	Cudd_SetSymmviolation((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Arc violation threshold") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Arc violation threshold", "integer");
+      }
+      else {
+	Cudd_SetArcviolation((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, "GA population size") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar  || uvalue < 0) {
+	InvalidType(file, "GA population size", "integer");
+      }
+      else {
+	Cudd_SetPopulationSize((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Number of crossovers for GA") == 0) {
+
+      uvalue = strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Number of crossovers for GA", "integer");
+      }
+      else {
+	Cudd_SetNumberXovers((DdManager *) mgr, uvalue);
+      }
+    }
+    else if (strcmp(paramName, "Next reordering threshold") == 0) {
+
+      uvalue = (unsigned int) strtol(paramValue, &invalidChar, 10);
+      if (*invalidChar || uvalue < 0) {
+	InvalidType(file, "Next reordering threshold", "integer");
+      }
+      else {
+	Cudd_SetNextReordering((DdManager *) mgr, uvalue);
+      }
+    }
+    else {
+      (void) fprintf(file, "Warning: Parameter %s not recognized.",
+		     paramName);
+      (void) fprintf(file, " Ignored.\n");
+    }
+  } /* end of st_foreach_item */
+
+  /* Clean up. */
+  st_free_table(newValueTable);
+
+  return(1);
+
+} /* end of bdd_set_parameters */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the number of nodes of a BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_size(bdd_t *f)
+{
+  return(Cudd_DagSize(f->node));
+
+} /* end of bdd_size */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the number of nodes of a BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_node_size(bdd_node *f)
+{
+  return(Cudd_DagSize((DdNode *) f));
+
+} /* end of bdd_node_size */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the shared size of an array of BDDs.]
+
+  Description [Computes the shared size of an array of BDDs. Returns
+  CUDD_OUT_OF_MEM in case of failure.]
+
+  SideEffects []
+
+******************************************************************************/
+long
+bdd_size_multiple(array_t *bddArray)
+{
+  DdNode **nodeArray;
+  bdd_t *bddUnit;
+  long result;
+  int i;
+
+  nodeArray = ALLOC(DdNode *, array_n(bddArray));
+  if (nodeArray == NULL) return(CUDD_OUT_OF_MEM);
+  for (i = 0; i < array_n(bddArray); i++) {
+    bddUnit = array_fetch(bdd_t *, bddArray, i);
+    nodeArray[i] = bddUnit->node;
+  }
+
+  result = Cudd_SharingSize(nodeArray,array_n(bddArray));
+
+  /* Clean up */
+  FREE(nodeArray);
+
+  return(result);
+
+} /* end of bdd_size_multiple */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Accesses the id of the top variable.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_variableId
+bdd_top_var_id(bdd_t *f)
+{
+  return(Cudd_Regular(f->node)->index);
+
+} /* end of bdd_top_var_id */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Accesses the external_hooks field of the manager.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_external_hooks *
+bdd_get_external_hooks(bdd_manager *mgr)
+{
+  return((bdd_external_hooks *)(((DdManager *)mgr)->hooks));
+
+} /* end of bdd_get_external_hooks */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adds a function to a hook.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_add_hook(
+  bdd_manager *mgr,
+  int (*procedure)(bdd_manager *, char *, void *),
+  bdd_hook_type_t whichHook)
+{
+  int retval;
+  Cudd_HookType hook;
+  switch (whichHook) {
+  case BDD_PRE_GC_HOOK: hook = CUDD_PRE_GC_HOOK; break;
+  case BDD_POST_GC_HOOK: hook = CUDD_POST_GC_HOOK; break;
+  case BDD_PRE_REORDERING_HOOK: hook = CUDD_PRE_REORDERING_HOOK; break;
+  case BDD_POST_REORDERING_HOOK: hook = CUDD_POST_REORDERING_HOOK; break;
+  default: fprintf(stderr, "Dont know which hook"); return 0;
+  }
+    
+  retval = Cudd_AddHook((DdManager *)mgr, (DD_HFP)procedure, hook);
+  return retval;
+
+} /* end of bdd_add_hook */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Removes the function from the hook.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_remove_hook(
+  bdd_manager *mgr,
+  int (*procedure)(bdd_manager *, char *, void *),
+  bdd_hook_type_t whichHook)
+{
+  int retval;
+  Cudd_HookType hook;
+  switch (whichHook) {
+  case BDD_PRE_GC_HOOK: hook = CUDD_PRE_GC_HOOK; break;
+  case BDD_POST_GC_HOOK: hook = CUDD_POST_GC_HOOK; break;
+  case BDD_PRE_REORDERING_HOOK: hook = CUDD_PRE_REORDERING_HOOK; break;
+  case BDD_POST_REORDERING_HOOK: hook = CUDD_POST_REORDERING_HOOK; break;
+  default: fprintf(stderr, "Dont know which hook"); return 0;
+  }
+  retval = Cudd_RemoveHook((DdManager *)mgr, (DD_HFP)procedure, hook);
+  return retval;
+
+} /* end of bdd_remove_hook */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Enables reporting of reordering stats.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_enable_reordering_reporting(bdd_manager *mgr)
+{
+  int retval;
+  retval = Cudd_EnableReorderingReporting((DdManager *) mgr);
+  return retval;
+
+} /* end of bdd_enable_reordering_reporting */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Disables reporting of reordering stats.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_disable_reordering_reporting(bdd_manager *mgr)
+{
+  int retval;
+  retval = Cudd_DisableReorderingReporting((DdManager *) mgr);
+  return retval;
+
+} /* end of bdd_disable_reordering_reporting */
+
+
+/**Function********************************************************************
+
+  Synopsis    [ Reporting of reordering stats.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_reorder_verbosity_t 
+bdd_reordering_reporting(bdd_manager *mgr)
+{
+  int retval;
+  bdd_reorder_verbosity_t reorderVerbosity;
+  retval = Cudd_ReorderingReporting((DdManager *) mgr);
+  switch(retval) {
+  case 0: reorderVerbosity = BDD_REORDER_NO_VERBOSITY; break;
+  case 1: reorderVerbosity = BDD_REORDER_VERBOSITY; break;
+  default: reorderVerbosity = BDD_REORDER_VERBOSITY_DEFAULT; break;
+  }
+  return reorderVerbosity;
+
+} /* end of bdd_reordering_reporting */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Turns on or off garbage collection.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_set_gc_mode(bdd_manager *mgr, boolean no_gc)
+{
+  if (no_gc) {
+    Cudd_DisableGarbageCollection((DdManager *) mgr);
+  } else {
+    Cudd_EnableGarbageCollection((DdManager *) mgr);
+  }
+  return;
+
+} /* end of bdd_set_gc_mode */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reorders the BDD pool.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_dynamic_reordering(
+  bdd_manager *mgr_,
+  bdd_reorder_type_t algorithm_type,
+  bdd_reorder_verbosity_t verbosity)
+{
+  DdManager *mgr;
+
+  mgr = (DdManager *)mgr_;
+
+  switch (algorithm_type) {
+  case BDD_REORDER_SIFT:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_SIFT);
+    break;
+  case BDD_REORDER_WINDOW:
+  case BDD_REORDER_WINDOW3_CONV:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_WINDOW3_CONV);
+    break;
+  case BDD_REORDER_NONE:
+    Cudd_AutodynDisable(mgr);
+    break;
+  case BDD_REORDER_SAME:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_SAME);
+    break;
+  case BDD_REORDER_RANDOM:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_RANDOM);
+    break;
+  case BDD_REORDER_RANDOM_PIVOT:	
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_RANDOM_PIVOT);
+    break;
+  case BDD_REORDER_SIFT_CONVERGE:
+    Cudd_AutodynEnable(mgr,CUDD_REORDER_SIFT_CONVERGE);
+    break;
+  case BDD_REORDER_SYMM_SIFT:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_SYMM_SIFT);
+    break;
+  case BDD_REORDER_SYMM_SIFT_CONV:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_SYMM_SIFT_CONV);
+    break;
+  case BDD_REORDER_WINDOW2:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_WINDOW2);
+    break;
+  case BDD_REORDER_WINDOW4:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_WINDOW4);
+    break;
+  case BDD_REORDER_WINDOW2_CONV:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_WINDOW2_CONV);
+    break;
+  case BDD_REORDER_WINDOW3:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_WINDOW3);
+    break;
+  case BDD_REORDER_WINDOW4_CONV:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_WINDOW4_CONV);
+    break;
+  case BDD_REORDER_GROUP_SIFT:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_GROUP_SIFT);
+    break;
+  case BDD_REORDER_GROUP_SIFT_CONV:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_GROUP_SIFT_CONV);	
+    break;
+  case BDD_REORDER_ANNEALING:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_ANNEALING);
+    break;
+  case BDD_REORDER_GENETIC:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_GENETIC);
+    break;
+  case BDD_REORDER_EXACT:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_EXACT);
+    break;
+  case BDD_REORDER_LAZY_SIFT:
+    Cudd_AutodynEnable(mgr, CUDD_REORDER_LAZY_SIFT);
+    break;
+  default:
+    fprintf(stderr,"CU DD Package: Reordering algorithm not considered\n");
+  }
+
+  if (verbosity == BDD_REORDER_NO_VERBOSITY) {
+    (void) bdd_disable_reordering_reporting((DdManager *)mgr);
+  } else if (verbosity ==  BDD_REORDER_VERBOSITY) {
+    (void) bdd_enable_reordering_reporting((DdManager *)mgr);
+  }
+    
+} /* end of bdd_dynamic_reordering */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reorders the ZDD pool.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_dynamic_reordering_zdd(
+  bdd_manager *mgr_,
+  bdd_reorder_type_t algorithm_type,
+  bdd_reorder_verbosity_t verbosity)
+{
+  DdManager *mgr;
+
+  mgr = (DdManager *)mgr_;
+
+  switch (algorithm_type) {
+  case BDD_REORDER_SIFT:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_SIFT);
+    break;
+  case BDD_REORDER_WINDOW:
+  case BDD_REORDER_WINDOW3_CONV:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_WINDOW3_CONV);
+    break;
+  case BDD_REORDER_NONE:
+    Cudd_AutodynDisable(mgr);
+    break;
+  case BDD_REORDER_SAME:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_SAME);
+    break;
+  case BDD_REORDER_RANDOM:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_RANDOM);
+    break;
+  case BDD_REORDER_RANDOM_PIVOT:	
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_RANDOM_PIVOT);
+    break;
+  case BDD_REORDER_SIFT_CONVERGE:
+    Cudd_AutodynEnableZdd(mgr,CUDD_REORDER_SIFT_CONVERGE);
+    break;
+  case BDD_REORDER_SYMM_SIFT:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_SYMM_SIFT);
+    break;
+  case BDD_REORDER_SYMM_SIFT_CONV:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_SYMM_SIFT_CONV);
+    break;
+  case BDD_REORDER_WINDOW2:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_WINDOW2);
+    break;
+  case BDD_REORDER_WINDOW4:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_WINDOW4);
+    break;
+  case BDD_REORDER_WINDOW2_CONV:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_WINDOW2_CONV);
+    break;
+  case BDD_REORDER_WINDOW3:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_WINDOW3);
+    break;
+  case BDD_REORDER_WINDOW4_CONV:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_WINDOW4_CONV);
+    break;
+  case BDD_REORDER_GROUP_SIFT:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_GROUP_SIFT);
+    break;
+  case BDD_REORDER_GROUP_SIFT_CONV:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_GROUP_SIFT_CONV);	
+    break;
+  case BDD_REORDER_ANNEALING:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_ANNEALING);
+    break;
+  case BDD_REORDER_GENETIC:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_GENETIC);
+    break;
+  case BDD_REORDER_EXACT:
+    Cudd_AutodynEnableZdd(mgr, CUDD_REORDER_EXACT);
+    break;
+  default:
+    fprintf(stderr,"CU DD Package: Reordering algorithm not considered\n");
+  }
+  if (verbosity == BDD_REORDER_NO_VERBOSITY) {
+    (void) bdd_disable_reordering_reporting((DdManager *)mgr);
+  } else if (verbosity ==  BDD_REORDER_VERBOSITY) {
+    (void) bdd_enable_reordering_reporting((DdManager *)mgr);
+  }
+    
+} /* end of bdd_dynamic_reordering_zdd */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Calls reordering explicitly.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_reorder(bdd_manager *mgr)
+{
+  /* 10 = whatever (Verbatim from file ddTable.c) */
+  (void) Cudd_ReduceHeap((DdManager *)mgr,((DdManager *)mgr)->autoMethod,10);
+  return;
+
+} /* end of bdd_reorder */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gets the id variable for one level in the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_variableId
+bdd_get_id_from_level(bdd_manager *mgr, long level)
+{
+  int result;
+  result = Cudd_ReadInvPerm((DdManager *) mgr, (int)level);
+  return(result);
+
+} /* end of bdd_get_id_from_level */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gets the level of the top variable of the BDD.]
+
+  SideEffects []
+
+******************************************************************************/
+long
+bdd_top_var_level(bdd_manager *mgr, bdd_t *fn)
+{
+  return((long) cuddI((DdManager *)mgr,Cudd_Regular(fn->node)->index));
+
+} /* end of bdd_top_var_level */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns TRUE if the argument BDD is a cube; FALSE
+  otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+boolean
+bdd_is_cube(bdd_t *f)
+{
+  struct DdManager *manager;
+
+  if (f == NULL) {
+    fail("bdd_is_cube: invalid BDD");
+  }
+  if (f->free) fail ("Freed BDD passed to bdd_is_cube");
+  manager =  f->mgr;
+  return((boolean)cuddCheckCube(manager,f->node));
+
+} /* end of bdd_is_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Builds a group of variables that should stay adjacent
+  during reordering.]
+
+  Description [Builds a group of variables that should stay adjacent
+  during reordering. The group is made up of n variables. The first
+  variable in the group is f. The other variables are the n-1
+  variables following f in the order at the time of invocation of this
+  function. Returns a handle to the variable group if successful; NULL
+  otherwise.]
+
+  SideEffects [Modifies the variable tree.]
+
+******************************************************************************/
+bdd_block *
+bdd_new_var_block(bdd_t *f, long n)
+{
+  DdManager *manager;
+  DdNode *node;
+  MtrNode *group;
+  int index;
+
+  manager = (DdManager *) f->mgr;
+  node = Cudd_Regular(f->node);
+  index = node->index;
+  if (index == CUDD_MAXINDEX)
+    return(NULL);
+  group = Cudd_MakeTreeNode(manager, index, n, MTR_DEFAULT);
+    
+  return((bdd_block *) group);
+
+} /* end of bdd_new_var_block */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Function that creates a variable of a given index.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_var_with_index(bdd_manager *manager, int index)
+{
+  DdNode *var;
+
+  var = Cudd_bddIthVar((DdManager *) manager, index);
+  cuddRef(var);
+  return(bdd_construct_bdd_t(manager, var));
+
+} /* end of bdd_var_with_index */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a variable is dependent on others in a
+  function f. Returns 1 if it is, else 0. ]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_var_is_dependent(bdd_t *f, bdd_t *var)
+{
+  return (Cudd_bddVarIsDependent((DdManager *)f->mgr, (DdNode *)f->node,
+				 (DdNode *)var->node));
+
+} /* end of bdd_var_is_dependent */
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_reordering_status(bdd_manager *mgr, bdd_reorder_type_t *method)
+{
+  int dyn;
+
+  dyn = Cudd_ReorderingStatus((DdManager *)mgr, (Cudd_ReorderingType  *)method);
+  switch (*method) {
+  case CUDD_REORDER_SIFT:
+    *method = BDD_REORDER_SIFT;
+    break;
+  case CUDD_REORDER_WINDOW3_CONV:
+    *method = BDD_REORDER_WINDOW3_CONV;
+    break;
+  case CUDD_REORDER_NONE:
+    *method = BDD_REORDER_NONE;
+    break;
+  case CUDD_REORDER_SAME:
+    *method = BDD_REORDER_SAME;
+    break;
+  case CUDD_REORDER_RANDOM:
+    *method = BDD_REORDER_RANDOM;
+    break;
+  case CUDD_REORDER_RANDOM_PIVOT:	
+    *method = BDD_REORDER_RANDOM_PIVOT;
+    break;
+  case CUDD_REORDER_SIFT_CONVERGE:
+    *method = BDD_REORDER_SIFT_CONVERGE;
+    break;
+  case CUDD_REORDER_SYMM_SIFT:
+    *method = BDD_REORDER_SYMM_SIFT;
+    break;
+  case CUDD_REORDER_SYMM_SIFT_CONV:
+    *method = BDD_REORDER_SYMM_SIFT_CONV;
+    break;
+  case CUDD_REORDER_WINDOW2:
+    *method = BDD_REORDER_WINDOW2;
+    break;
+  case CUDD_REORDER_WINDOW4:
+    *method = BDD_REORDER_WINDOW4;
+    break;
+  case CUDD_REORDER_WINDOW2_CONV:
+    *method = BDD_REORDER_WINDOW2_CONV;
+    break;
+  case CUDD_REORDER_WINDOW3:
+    *method = BDD_REORDER_WINDOW3;
+    break;
+  case CUDD_REORDER_WINDOW4_CONV:
+    *method = BDD_REORDER_WINDOW4_CONV;
+    break;
+  case CUDD_REORDER_GROUP_SIFT:
+    *method = BDD_REORDER_GROUP_SIFT;
+    break;
+  case CUDD_REORDER_GROUP_SIFT_CONV:
+    *method = BDD_REORDER_GROUP_SIFT_CONV;	
+    break;
+  case CUDD_REORDER_ANNEALING:
+    *method = BDD_REORDER_ANNEALING;
+    break;
+  case CUDD_REORDER_GENETIC:
+    *method = BDD_REORDER_GENETIC;
+    break;
+  case CUDD_REORDER_EXACT:
+    *method = BDD_REORDER_EXACT;
+    break;
+  default:
+    break;
+  }
+  return(dyn);
+
+} /* end of bdd_reordering_status */
+
+
+/**Function********************************************************************
+
+  Synopsis    []
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_reordering_zdd_status(bdd_manager *mgr, bdd_reorder_type_t *method)
+{
+  int dyn;
+  dyn = Cudd_ReorderingStatusZdd((DdManager *)mgr, (Cudd_ReorderingType  *)method);
+  switch (*method) {
+  case CUDD_REORDER_SIFT:
+    *method = BDD_REORDER_SIFT;
+    break;
+  case CUDD_REORDER_WINDOW3_CONV:
+    *method = BDD_REORDER_WINDOW3_CONV;
+    break;
+  case CUDD_REORDER_NONE:
+    *method = BDD_REORDER_NONE;
+    break;
+  case CUDD_REORDER_SAME:
+    *method = BDD_REORDER_SAME;
+    break;
+  case CUDD_REORDER_RANDOM:
+    *method = BDD_REORDER_RANDOM;
+    break;
+  case CUDD_REORDER_RANDOM_PIVOT:	
+    *method = BDD_REORDER_RANDOM_PIVOT;
+    break;
+  case CUDD_REORDER_SIFT_CONVERGE:
+    *method = BDD_REORDER_SIFT_CONVERGE;
+    break;
+  case CUDD_REORDER_SYMM_SIFT:
+    *method = BDD_REORDER_SYMM_SIFT;
+    break;
+  case CUDD_REORDER_SYMM_SIFT_CONV:
+    *method = BDD_REORDER_SYMM_SIFT_CONV;
+    break;
+  case CUDD_REORDER_WINDOW2:
+    *method = BDD_REORDER_WINDOW2;
+    break;
+  case CUDD_REORDER_WINDOW4:
+    *method = BDD_REORDER_WINDOW4;
+    break;
+  case CUDD_REORDER_WINDOW2_CONV:
+    *method = BDD_REORDER_WINDOW2_CONV;
+    break;
+  case CUDD_REORDER_WINDOW3:
+    *method = BDD_REORDER_WINDOW3;
+    break;
+  case CUDD_REORDER_WINDOW4_CONV:
+    *method = BDD_REORDER_WINDOW4_CONV;
+    break;
+  case CUDD_REORDER_GROUP_SIFT:
+    *method = BDD_REORDER_GROUP_SIFT;
+    break;
+  case CUDD_REORDER_GROUP_SIFT_CONV:
+    *method = BDD_REORDER_GROUP_SIFT_CONV;
+    break;
+  case CUDD_REORDER_ANNEALING:
+    *method = BDD_REORDER_ANNEALING;
+    break;
+  case CUDD_REORDER_GENETIC:
+    *method = BDD_REORDER_GENETIC;
+    break;
+  case CUDD_REORDER_EXACT:
+    *method = BDD_REORDER_EXACT;
+    break;
+  default:
+    break;
+  }
+  return(dyn);
+
+} /* end of bdd_reordering_zdd_status */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Converts a bdd to an add.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_to_add(bdd_manager *mgr, bdd_node *fn)
+{
+  DdNode *result;
+  result = Cudd_BddToAdd((DdManager *)mgr,(DdNode *)fn);
+  return((bdd_node *)result);
+
+} /* end of bdd_bdd_to_add */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Permutes the variables in a given function using the permut array..]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_permute(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  int *permut)
+{
+  DdNode *result;
+  result = Cudd_addPermute((DdManager *)mgr, (DdNode *)fn, permut);
+  return(result);
+
+} /* end of bdd_add_permute */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Permutes the variables in a given function using the permut array..]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_permute(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  int *permut)
+{
+  DdNode *result;
+  result = Cudd_bddPermute((DdManager *)mgr, (DdNode *)fn, permut);
+  return(result);
+
+} /* end of bdd_bdd_permute */
+
+
+/**Function********************************************************************
+
+  Synopsis           [References a bdd]
+
+  SideEffects        []
+
+******************************************************************************/
+void
+bdd_ref(bdd_node *fn)
+{
+  Cudd_Ref((DdNode *)fn);
+  return;
+
+} /* end of bdd_ref */
+
+
+/**Function********************************************************************
+
+  Synopsis [Decreases the reference count of node.If f dies,
+  recursively decreases the reference counts of its children.  It is
+  used to dispose of a DD that is no longer needed.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_recursive_deref(bdd_manager *mgr, bdd_node *f)
+{
+  Cudd_RecursiveDeref((DdManager *)mgr, (DdNode *)f);
+
+} /* end of bdd_recursive_deref */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Existentially abstracts out the variables from the function]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_exist_abstract(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *vars)
+{
+  DdNode *result;
+  result = Cudd_addExistAbstract((DdManager *)mgr, (DdNode *)fn,
+				 (DdNode *)vars);
+  return(result);
+
+} /* end of bdd_add_exist_abstract */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the apply operation on ADds]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_apply(
+  bdd_manager *mgr,
+  bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **),
+  bdd_node *fn1,
+  bdd_node *fn2)
+{
+  DdNode *result;
+  result = Cudd_addApply((DdManager *)mgr,
+			 (DdNode *(*)(DdManager *, DdNode **, DdNode **))
+			 operation, (DdNode *)fn1, (DdNode *)fn2);
+  return(result);
+
+} /* end of bdd_add_apply */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the non-simple compose on ADds]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_nonsim_compose(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node **vector)
+{
+  DdNode *result;
+  result = Cudd_addNonSimCompose((DdManager *)mgr, (DdNode *)fn,
+				 (DdNode **)vector);
+  return(result);
+
+} /* end of bdd_add_nonsim_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Computes the residue ADD of n variables with respect to m]
+  
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_residue(
+  bdd_manager *mgr,
+  int n,
+  int m,
+  int options,
+  int top)
+{
+  DdNode *result;
+  result = Cudd_addResidue((DdManager *)mgr, n, m, options, top);
+  return(result);
+
+} /* end of bdd_add_residue */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the vector compose on ADds]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node **vector)
+{
+  DdNode *result;
+  result = Cudd_addVectorCompose((DdManager *)mgr, (DdNode *)fn,
+				 (DdNode **)vector);
+  return(result);
+
+} /* end of bdd_add_vector_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the times (multiplication operation)  on Adds]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_times(
+  bdd_manager *mgr,
+  bdd_node **fn1,
+  bdd_node **fn2)
+{
+  DdNode *result;
+  result = Cudd_addTimes((DdManager *)mgr, (DdNode **)fn1, (DdNode **)fn2);
+  return(result);
+
+} /* end of bdd_add_times */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the zero reference count check on the manager.]
+
+  SideEffects        []
+
+******************************************************************************/
+int
+bdd_check_zero_ref(bdd_manager *mgr)
+{
+  int result;
+  result = Cudd_CheckZeroRef((DdManager *)mgr);
+  return(result);
+
+} /* end of bdd_check_zero_ref */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Disables dynamic reordering in the manager.]
+
+  SideEffects        []
+
+******************************************************************************/
+void
+bdd_dynamic_reordering_disable(bdd_manager *mgr)
+{
+  Cudd_AutodynDisable((DdManager *)mgr);
+  return;
+
+} /* end of bdd_dynamic_reordering_disable */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Disables dynamic reordering for ZDD in the manager.]
+
+  SideEffects        []
+
+******************************************************************************/
+void
+bdd_dynamic_reordering_zdd_disable(bdd_manager *mgr)
+{
+  Cudd_AutodynDisableZdd((DdManager *)mgr);
+  return;
+
+} /* end of bdd_dynamic_reordering_zdd_disable */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the xnor (\equiv operation)  on Adds]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_xnor(bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2)
+{
+  DdNode *result;
+  result = Cudd_addXnor((DdManager *)mgr, (DdNode **)fn1, (DdNode **)fn2);
+  return(result);
+
+} /* end of bdd_add_xnor */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Shuffles the variables in the manager in the given order.]
+
+  SideEffects        []
+
+******************************************************************************/
+int
+bdd_shuffle_heap(bdd_manager *mgr, int *permut)
+{
+  int result;
+  result = Cudd_ShuffleHeap((DdManager *)mgr, permut);
+  return(result);
+
+} /* end of bdd_shuffle_heap */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs compose operation on  ADds]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_compose(
+  bdd_manager *mgr,
+  bdd_node *fn1,
+  bdd_node *fn2,
+  int var)
+{
+  DdNode *result;
+  result = Cudd_addCompose((DdManager *)mgr, (DdNode *)fn1,
+			   (DdNode *)fn2, var);
+  return(result);
+
+} /* end of bdd_add_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Gets the ith add variable in the manager ]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_ith_var(bdd_manager *mgr, int i)
+{
+  DdNode *result;
+  result = Cudd_addIthVar((DdManager *)mgr, i);
+  return(result);
+
+} /* end of bdd_add_ith_var */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Gets the level of the ith variable in the manager ]
+
+  SideEffects        []
+
+******************************************************************************/
+int
+bdd_get_level_from_id(bdd_manager *mgr, int id)
+{
+  int level;
+  level = Cudd_ReadPerm((DdManager *)mgr, id);
+  return(level);
+
+} /* end of bdd_get_level_from_id */
+
+
+/**Function********************************************************************
+
+  Synopsis [Existentially abstracts out the variables from the function.
+  Here the fn is assumed to be a BDD function.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_exist_abstract(bdd_manager *mgr, bdd_node *fn, bdd_node *cube)
+{
+  DdNode *result;
+  result = Cudd_bddExistAbstract((DdManager *)mgr, (DdNode *)fn, 
+				 (DdNode *)cube);
+  return(result);
+
+} /* end of bdd_bdd_exist_abstract */
+
+
+/**Function********************************************************************
+
+  Synopsis [Compares two ADDs for equality within tolerance. pr is verbosity
+  level.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_equal_sup_norm(
+  bdd_manager *mgr,
+  bdd_node *fn,
+  bdd_node *gn,
+  BDD_VALUE_TYPE tolerance,
+  int pr)
+{
+  int result;
+  result = Cudd_EqualSupNorm((DdManager *)mgr, (DdNode *)fn, 
+			     (DdNode *)gn, (CUDD_VALUE_TYPE)tolerance, pr);
+  return(result);
+
+} /* end of bdd_equal_sup_norm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Reads constant logic zero bdd_node.]
+
+
+  SideEffects [bdd_zero]
+
+******************************************************************************/
+bdd_node *
+bdd_read_logic_zero(bdd_manager *mgr)
+{
+  DdNode *result;
+  result = Cudd_ReadLogicZero((DdManager *)mgr);
+
+  return(result);
+
+} /* end of bdd_read_logic_zero */
+
+
+/**Function********************************************************************
+
+  Synopsis [Get the ith bdd node in the manager.]
+
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_ith_var(bdd_manager *mgr, int i)
+{
+  DdNode *result;
+  result = Cudd_bddIthVar((DdManager *)mgr, i);
+    
+  return(result);
+
+} /* end of bdd_bdd_ith_var */
+
+
+/**Function********************************************************************
+
+  Synopsis           [Performs the divide operation on ADDs]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_divide(bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2)
+{
+  DdNode *result;
+  result = Cudd_addDivide((DdManager *)mgr, (DdNode **)fn1, (DdNode **)fn2);
+
+  return(result);
+
+} /* end of bdd_add_divide */
+
+
+/**Function********************************************************************
+
+  Synopsis [Performs the constrain operation.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_constrain(bdd_manager *mgr, bdd_node *f, bdd_node *c)
+{
+  DdNode *result;
+  result = Cudd_bddConstrain((DdManager *)mgr, (DdNode *)f, (DdNode *)c);
+
+  return(result);
+
+} /* end of bdd_bdd_constrain */
+
+
+/**Function********************************************************************
+
+  Synopsis [Performs the restrict operation.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_restrict(bdd_manager *mgr, bdd_node *f, bdd_node *c)
+{
+  DdNode *result;
+  result = Cudd_bddRestrict((DdManager *)mgr, (DdNode *)f, (DdNode *)c);
+
+  return(result);
+
+} /* end of bdd_bdd_restrict */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the hamming distance ADD between two sets of variables.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_hamming(
+  bdd_manager *mgr,
+  bdd_node **xVars,
+  bdd_node **yVars,
+  int nVars)
+{
+  DdNode *result;
+  result = Cudd_addHamming((DdManager *)mgr, (DdNode **)xVars,
+			   (DdNode **)yVars, nVars);
+
+  return(result);
+
+} /* end of bdd_add_hamming */
+
+
+/**Function********************************************************************
+
+  Synopsis [Performs the ITE operation for ADDs.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_ite(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *h)
+{
+  DdNode *result;
+  result = Cudd_addIte((DdManager *)mgr, (DdNode *)f, (DdNode *)g,
+		       (DdNode *)h);
+
+  return(result);
+
+} /* end of bdd_add_ite */
+
+
+/**Function********************************************************************
+
+  Synopsis [Finds the maximum discriminant of f. Returns a pointer to a 
+  constant ADD.]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_find_max(bdd_manager *mgr, bdd_node *f)
+{
+  DdNode *result;
+  result = Cudd_addFindMax((DdManager *)mgr, (DdNode *)f);
+
+  return(result);
+
+} /* end of bdd_add_find_max */
+
+
+/**Function********************************************************************
+
+  Synopsis [Picks one on-set cube randomly from the given DD. The cube is 
+  written into an array of characters. The array must have at least as many
+  entries as there are variables. Returns 1 if successful; 0 otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_bdd_pick_one_cube(bdd_manager *mgr, bdd_node *node, char *string)
+{
+  return(Cudd_bddPickOneCube((DdManager *)mgr, (DdNode *)node, string));
+
+} /* end of bdd_bdd_pick_one_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis [Swap two sets of variables in ADD f]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_add_swap_variables(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  bdd_node **y,
+  int n)
+{
+  DdNode *result;
+  result = Cudd_addSwapVariables((DdManager *)mgr, (DdNode *)f,
+				 (DdNode **)x, (DdNode **)y, n);
+
+  return(result);
+
+} /* end of bdd_add_swap_variables */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the disjunction of two BDDs f and g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_or(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_bddOr((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+
+  return(result);
+
+} /* end of bdd_bdd_or */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the cube of an array of BDD variables.If
+  non-null, the phase argument indicates which literal of each
+  variable should appear in the cube. If phase\[i\] is nonzero, then
+  the positive literal is used. If phase is NULL, the cube is positive
+  unate.  Returns a pointer to the result if successful; NULL
+  otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_compute_cube(
+  bdd_manager *mgr,
+  bdd_node **vars,
+  int *phase,
+  int n)
+{
+  DdNode *result;
+  result = Cudd_bddComputeCube((DdManager *)mgr, (DdNode **)vars,
+			       phase, n);
+
+  return(result);
+
+} /* end of bdd_bdd_compute_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Builds a cube of BDD variables from an array of indices.]
+
+  Description [Builds a cube of BDD variables from an array of indices.
+  Returns a pointer to the result if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [bdd_bdd_compute_cube]
+
+******************************************************************************/
+bdd_node *
+bdd_indices_to_cube(bdd_manager *mgr, int *idArray, int n)
+{
+  DdNode *result;
+  result = Cudd_IndicesToCube((DdManager *)mgr, idArray, n); 
+
+  return(result);
+
+} /* end of bdd_indices_to_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the conjunction of two BDDs f and g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_and(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_bddAnd((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+    
+  return(result);
+
+} /* end of bdd_bdd_and */
+
+
+/**Function********************************************************************
+
+  Synopsis [Multiply two matrices represented by A and B. A is assumed to
+  depend on x (rows) and z (columns). B is assumed to depend on z (rows)
+  and y (columns). The product depends on x and y. Only z needs to be 
+  explicitly identified.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_matrix_multiply(
+  bdd_manager *mgr,
+  bdd_node *A,
+  bdd_node *B,
+  bdd_node **z,
+  int nz)
+{
+  DdNode *result;
+  result = Cudd_addMatrixMultiply((DdManager *)mgr, (DdNode *)A,
+				  (DdNode *)B, (DdNode **)z, nz);
+
+  return(result);
+
+} /* end of bdd_add_matrix_multiply */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the cube of an array of ADD variables.  If
+  non-null, the phase argument indicates which literal of each
+  variable should appear in the cube. If phase\[i\] is nonzero, then the
+  positive literal is used. If phase is NULL, the cube is positive unate.
+  Returns a pointer to the result if successful; NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_compute_cube(
+  bdd_manager *mgr,
+  bdd_node **vars,
+  int *phase,
+  int n)
+{
+  DdNode *result;
+  result = Cudd_addComputeCube((DdManager *)mgr, (DdNode **)vars, phase, n);
+				 
+  return(result);
+
+} /* end of bdd_add_compute_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the ADD for constant c.]
+
+  Description [Returns the ADD for constant c if successful. NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_const(bdd_manager *mgr, BDD_VALUE_TYPE c)
+{
+  DdNode *result;
+  result = Cudd_addConst((DdManager *)mgr, (CUDD_VALUE_TYPE)c);
+
+  return(result);
+
+} /* end of bdd_add_const */
+
+
+/**Function********************************************************************
+
+  Synopsis [Swaps two sets of variables of the same size (x and y) in
+  the BDD f.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_swap_variables(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  bdd_node **y,
+  int n)
+{
+  DdNode *result;
+  result = Cudd_bddSwapVariables((DdManager *)mgr, (DdNode *)f, 
+				 (DdNode **)x, (DdNode **)y, n);
+
+  return(result);
+
+} /* end of bdd_bdd_swap_variables */
+
+
+/**Function********************************************************************
+
+  Synopsis [Counts the number of minters in the on set of f which depends on
+  atmost n variables.]
+
+  SideEffects []
+
+******************************************************************************/
+double
+bdd_count_minterm(bdd_manager *mgr, bdd_node *f, int n)
+{
+  double result;
+  result = Cudd_CountMinterm((DdManager *)mgr, (DdNode *)f, n);
+
+  return(result);
+
+} /* end of bdd_count_minterm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Converts an ADD to a BDD by replacing all
+  discriminants greater than or equal to value with 1, and all other
+  discriminants with 0. Returns a pointer to the resulting BDD if
+  successful; NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_bdd_threshold(
+  bdd_manager *mgr,
+  bdd_node *f,
+  BDD_VALUE_TYPE value)
+{
+  DdNode *result;
+  result = Cudd_addBddThreshold((DdManager *) mgr, (DdNode *) f,
+				(CUDD_VALUE_TYPE)value);
+    
+  return(result);
+
+} /* end of bdd_add_bdd_threshold */
+
+
+/**Function********************************************************************
+
+  Synopsis [Converts an ADD to a BDD by replacing all discriminants strictly
+  greater than value with 1, and all other discriminants with 0. Returns a
+  pointer to the resulting BDD if successful; NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_bdd_strict_threshold(
+  bdd_manager *mgr,
+  bdd_node *f,
+  BDD_VALUE_TYPE value)
+{
+  DdNode *result;
+  result = Cudd_addBddStrictThreshold((DdManager *) mgr, (DdNode *) f,
+				      (CUDD_VALUE_TYPE)value);
+    
+  return(result);
+
+} /* end of bdd_add_bdd_strict_threshold */
+
+
+/**Function********************************************************************
+
+  Synopsis [Reads the epsilon parameter of the manager.]
+
+  SideEffects []
+
+******************************************************************************/
+BDD_VALUE_TYPE
+bdd_read_epsilon(bdd_manager *mgr)
+{
+  return((DdManager *)mgr)->epsilon;
+
+} /* end of bdd_read_epsilon */
+
+
+/**Function********************************************************************
+
+  Synopsis [Reads the constant 1 of the manager.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_read_one(bdd_manager *mgr)
+{
+  return(DD_ONE((DdManager *)mgr));
+
+} /* end of bdd_read_one */
+
+
+/**Function********************************************************************
+
+  Synopsis [Pick a random minterm from the onset of f.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_pick_one_minterm(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vars,
+  int n)
+{
+  DdNode *result;
+  result = Cudd_bddPickOneMinterm((DdManager *)mgr, (DdNode *)f,
+				  (DdNode **)vars, n);
+
+  return(result);
+
+} /* end of bdd_bdd_pick_one_minterm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Pick a random minterm from the onset of f.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_t *
+bdd_pick_one_minterm(bdd_t *f, array_t *varsArray /* of bdd_t * */)
+{
+  DdNode **vars, *minterm;
+  int i, n;
+
+  n = array_n(varsArray);
+  vars = ALLOC(DdNode *, n);
+  if (vars == NIL(DdNode *)) return NIL(bdd_t);
+  for (i = 0; i < n; i++) {
+    bdd_t *var = array_fetch(bdd_t *, varsArray, i);
+    assert(f->mgr == var->mgr);
+    vars[i] = var->node;
+  }
+  minterm = Cudd_bddPickOneMinterm(f->mgr, f->node, vars, n);
+  cuddRef(minterm);
+  FREE(vars);
+  if (minterm == NIL(DdNode)) return NIL(bdd_t);
+  return bdd_construct_bdd_t(f->mgr,minterm);
+
+} /* end of bdd_pick_one_minterm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Pick arbitrary number of minterms evenly distributed from the
+  onset of f.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+bdd_bdd_pick_arbitrary_minterms(
+  bdd_t *f,
+  array_t *varsArray,
+  int n,
+  int k)
+{
+  int i;
+  DdNode **minterms, **vars;
+  bdd_t *var;
+  array_t *resultArray;
+
+  vars = ALLOC(DdNode *, n);
+  if (vars == NULL)
+    return((array_t *)NULL);
+  for (i = 0; i < n; i++) {
+    var = array_fetch(bdd_t *, varsArray, i);
+    vars[i] = var->node;
+  }
+
+  minterms = (DdNode **)Cudd_bddPickArbitraryMinterms((DdManager *)f->mgr,
+						      (DdNode *)f->node, (DdNode **)vars, n, k);
+
+  resultArray = array_alloc(bdd_t *, k);
+  for (i = 0; i < k; i++) {
+    cuddRef(minterms[i]);
+    array_insert(bdd_t *, resultArray, i,
+		 bdd_construct_bdd_t(f->mgr,minterms[i]));
+  }
+
+  FREE(vars);
+  FREE(minterms);
+  return(resultArray);
+
+} /* end of bdd_bdd_pick_arbitrary_minterms */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Extracts a subset from a BDD with mask variables.]
+
+  Description [Extracts a subset from a BDD in the following procedure.
+  1. Compute the weight for each mask variable by counting the number of
+     minterms for both positive and negative cofactors of the BDD with
+     respect to each mask variable. (weight = #positive - #negative)
+  2. Find a representative cube of the BDD by using the weight. From the
+     top variable of the BDD, for each variable, if the weight is greater
+     than 0.0, choose THEN branch, othereise ELSE branch, until meeting
+     the constant 1.
+  3. Quantify out the variables not in maskVars from the representative
+     cube and if a variable in maskVars is don't care, replace the
+     variable with a constant(1 or 0) depending on the weight.
+  4. Make a subset of the BDD by multiplying with the modified cube.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+bdd_t *
+bdd_subset_with_mask_vars(bdd_t *f, array_t *varsArray, array_t *maskVarsArray)
+{
+  int i;
+  DdNode *subset, **vars, **maskVars;
+  bdd_t *var;
+  int	n = array_n(varsArray);
+  int	m = array_n(maskVarsArray);
+
+  vars = ALLOC(DdNode *, n);
+  if (vars == NULL)
+    return((bdd_t *)NULL);
+  for (i = 0; i < n; i++) {
+    var = array_fetch(bdd_t *, varsArray, i);
+    vars[i] = var->node;
+  }
+
+  maskVars = ALLOC(DdNode *, m);
+  if (maskVars == NULL) {
+    FREE(vars);
+    return((bdd_t *)NULL);
+  }
+  for (i = 0; i < m; i++) {
+    var = array_fetch(bdd_t *, maskVarsArray, i);
+    maskVars[i] = var->node;
+  }
+
+  subset = (DdNode *)Cudd_SubsetWithMaskVars((DdManager *)f->mgr,
+					     (DdNode *)f->node, (DdNode **)vars, n, (DdNode **)maskVars, m);
+  if (subset == NULL) return((bdd_t *)NULL);
+
+  cuddRef(subset);
+  FREE(vars);
+  FREE(maskVars);
+
+  return(bdd_construct_bdd_t(f->mgr,subset));
+
+} /* end of bdd_subset_with_mask_vars */
+
+
+/**Function********************************************************************
+
+  Synopsis [Read constant zero of the manager. This is different from the
+  logical zero which is the complement of logical one.]
+
+  SideEffects [bdd_zero]
+
+******************************************************************************/
+bdd_node *
+bdd_read_zero(bdd_manager *mgr)
+{
+  return(DD_ZERO((DdManager *)mgr));
+
+} /* bdd_read_zero */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns a new BDD variable.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_new_var(bdd_manager *mgr)
+{
+  DdNode *result;
+  result = Cudd_bddNewVar((DdManager *)mgr);
+
+  return(result);
+
+} /* end of bdd_bdd_new_var */
+
+
+/**Function********************************************************************
+
+  Synopsis [Takes the AND of two BDDs and simultaneously abstracts the
+  variables in cube.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_and_abstract(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node *g,
+  bdd_node *cube)
+{
+  DdNode *result;
+  result = Cudd_bddAndAbstract((DdManager *)mgr, (DdNode *)f,
+			       (DdNode *)g, (DdNode *)cube);
+  return(result);
+
+} /* end of bdd_bdd_and_abstract */
+
+
+/**Function********************************************************************
+
+  Synopsis [Decreases the reference count of node.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_deref(bdd_node *f)
+{
+  Cudd_Deref((DdNode *)f);
+
+} /* end of bdd_deref */
+
+
+/**Function********************************************************************
+
+  Synopsis [Integer and floating point addition.Returns NULL if not
+  a terminal case; f+g otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_plus(bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2)
+{
+  DdNode *result;
+  result = Cudd_addPlus((DdManager *)mgr, (DdNode **)fn1, (DdNode **)fn2);
+  return(result);
+
+} /* end of bdd_add_plus */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the number of times reordering has occurred.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_read_reorderings(bdd_manager *mgr)
+{
+  return(Cudd_ReadReorderings((DdManager *)mgr));
+
+} /* end of bdd_read_reorderings */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the threshold for the next dynamic reordering.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_read_next_reordering(bdd_manager *mgr)
+{
+  return(Cudd_ReadNextReordering((DdManager *)mgr));
+
+} /* end of bdd_read_next_reordering */
+
+
+/**Function********************************************************************
+
+  Synopsis [Sets the threshold for the next dynamic reordering.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_set_next_reordering(bdd_manager *mgr, int next)
+{
+  Cudd_SetNextReordering((DdManager *)mgr, next);
+
+} /* end of bdd_set_next_reordering */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the exclusive-nor of f and g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_xnor(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_bddXnor((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+
+  return(result);
+
+} /* end of bdd_bdd_xnor */
+
+
+/**Function********************************************************************
+
+  Synopsis [Composes a BDD with a vector of BDDs.Given a vector of
+  BDDs, creates a new BDD by substituting the BDDs for the variables
+  of the BDD f.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_vector_compose(bdd_manager *mgr, bdd_node *f, bdd_node **vector)
+{
+  DdNode *result;
+  result = Cudd_bddVectorCompose((DdManager *)mgr, (DdNode *)f,
+				 (DdNode **)vector);
+  return(result);
+
+} /* end of bdd_bdd_vector_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis [Extracts a BDD node from the bdd_t structure without making
+  it regular.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_extract_node_as_is(bdd_t *fn)
+{
+  return((bdd_node *)fn->node);
+
+} /* end of bdd_extract_node_as_is */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns a zdd node with index i and g and h as its children.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_get_node(
+  bdd_manager *mgr,
+  int id,
+  bdd_node *g,
+  bdd_node *h)
+{
+  DdNode *result;
+  result = cuddZddGetNode((DdManager *)mgr, id, (DdNode *)g,
+			  (DdNode *)h);
+
+  return(result);
+
+} /*end of bdd_zdd_get_node */ 
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the product of two cover represented by ZDDs. The covers
+  on which bdd_zdd_product operates use two ZDD variables for each
+  function variable (one ZDD variable for each literal of the variable). Those
+  two ZDD variables should be adjacent in the order.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_product(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_zddProduct((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_product */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the product of two cover represented by ZDDs. The covers
+  on which bdd_zdd_product_recur operates use two ZDD variables for each
+  function variable (one ZDD variable for each literal of the variable). Those
+  two ZDD variables should be adjacent in the order.  This is a recursive
+  procedure. It returns the ZDD of the product if successful. Reference count
+  of the result is not incremented. NULL is returned if re-ordering takes place
+  or if memory is exhausted.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_product_recur(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = cuddZddProduct((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_product_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the union of two ZDDs.]
+
+  Description [Computes the union of two ZDDs. Returns a pointer to the
+  result if successful; NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_union(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_zddUnion((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_union */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the union of two ZDDs.]
+
+  Description [Computes the union of two ZDDs. Returns a pointer to the
+  result if successful; NULL otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_union_recur(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = cuddZddUnion((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_union_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis [Applies weak division to two ZDDs representing two covers. The
+  result of weak division depends on the variable order. The covers on which
+  bdd_zdd_weak_div operates use two ZDD variables for each function
+  variable (one ZDD variable for each literal of the variable). Those two ZDD
+  variables should be adjacent in the order.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_weak_div(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_zddWeakDiv((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_weak_div */
+
+
+/**Function********************************************************************
+
+  Synopsis [Applies weak division to two ZDDs representing two covers. The
+  result of weak division depends on the variable order. The covers on which
+  bdd_zdd_weak_div_recur operates use two ZDD variables for each function
+  variable (one ZDD variable for each literal of the variable). Those two ZDD
+  variables should be adjacent in the order. This is a recursive procedure. It
+  returns a pointer to the result if successful; Reference count of the result
+  is not incremented. NULL is returned if re-ordering takes place or if memory
+  is exhausted.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_weak_div_recur(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = cuddZddWeakDiv((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+
+  return(result);
+
+} /* end of bdd_zdd_weak_div_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes an irredundant sum of products (ISOP) in ZDD form from
+  BDDs. This is a recursive procedure. Returns the pointer to the ZDD on
+  success. Reference count of the result is not incremented. NULL in the case
+  of re-ordering or if memory is exhausted.]
+
+  SideEffects [zdd_I holds the pointer to the ZDD for the ISOP on successful
+  return.]
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_isop_recur(
+  bdd_manager *mgr,
+  bdd_node *L,
+  bdd_node *U,
+  bdd_node **zdd_I)
+{
+  DdNode *result;
+  result = cuddZddIsop((DdManager *)mgr, (DdNode *)L, (DdNode *)U,
+		       (DdNode **)zdd_I);
+
+  return(result);
+
+} /* end of bdd_zdd_isop_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes an irredundant sum of products (ISOP) in ZDD form from
+  BDDs. This is an interface to an external function.]
+
+  SideEffects [zdd_I holds the pointer to the ZDD for the ISOP on successful
+  return.]
+  
+  SeeAlso [bdd_zdd_isop_recur]
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_isop(
+  bdd_manager *mgr,
+  bdd_node *L,
+  bdd_node *U,
+  bdd_node **zdd_I)
+{
+  DdNode *result;
+  result = Cudd_zddIsop((DdManager *)mgr, (DdNode *)L, (DdNode *)U,
+			(DdNode **)zdd_I);
+
+  return(result);
+
+} /* end of bdd_zdd_isop */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the three-way decomposition of f w.r.t. v.]
+
+  Description [Computes the three-way decomposition of function f (represented
+  by a ZDD) w.r.t respect to variable v. Returns 1 on failure, 0 on
+  success. Reference counts of f1, f0 and fd are not incremented. ]
+
+  SideEffects [The results are returned in f1, f0, and fd. They are NULL in
+  case of failure.]
+
+******************************************************************************/
+int
+bdd_zdd_get_cofactors3(
+  bdd_manager *mgr,
+  bdd_node *f,
+  int v,
+  bdd_node **f1,
+  bdd_node **f0,
+  bdd_node **fd)
+{
+  int result;
+  result = cuddZddGetCofactors3((DdManager *)mgr, (DdNode *)f, v,
+				(DdNode **)f1, (DdNode **)f0,
+				(DdNode **)fd);
+
+  return(result);
+
+} /* end of bdd_zdd_get_cofactors3 */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Recursive procedure to compute AND of two bdd_nodes.]
+
+  Description [Recursive procedure to compute AND of two bdd_nodes.  Returns
+  the pointer to the BDD on success. The reference count of the result is not
+  incremented. NULL is returned in case of reordering or if memory is
+  exhausted.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_and_recur(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = cuddBddAndRecur((DdManager *)mgr, (DdNode *)f,
+			   (DdNode *)g);
+  return(result);
+
+} /* end of bdd_bdd_and_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a bdd_node whose index is v and g and h as its
+  children.]
+
+  Description [Returns a bdd_node whose index is v and g and h as its
+  children. Returns the bdd_node after success. The reference count of the
+  returned BDD is not incremented. Returns NULL in case of reordering or if
+  memory is exhausted.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_node *
+bdd_unique_inter(
+  bdd_manager *mgr,
+  int v,
+  bdd_node *f,
+  bdd_node *g)
+{
+  DdNode *result;
+  result = cuddUniqueInter((DdManager *)mgr, v, (DdNode *)f,
+			   (DdNode *)g);
+  return(result);
+
+} /* end of bdd_unique_inter */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a bdd_node whose index is v and f and g as its
+  children.]
+
+  Description [Returns a bdd_node whose index is v and f and g as its
+  children. Returns the bdd_node after success. The reference count of the
+  returned BDD is not incremented. Returns NULL in case of reordering or if
+  memory is exhausted.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_node *
+bdd_unique_inter_ivo(
+  bdd_manager *mgr,
+  int v,
+  bdd_node *f,
+  bdd_node *g)
+{
+  DdNode *result;
+  DdNode *t;
+
+  t = cuddUniqueInter((DdManager *)mgr, v, (DdNode *)bdd_read_one(mgr),
+		      (DdNode *)bdd_not_bdd_node(bdd_read_one(mgr)));
+  if (t == NULL)
+    return(NULL);
+  Cudd_Ref(t);
+  result = cuddBddIteRecur((DdManager *)mgr, t, (DdNode *)f, (DdNode *)g);
+  Cudd_RecursiveDeref((DdManager *)mgr,(DdNode *)t);
+  return(result);
+
+} /* end of bdd_unique_inter_ivo */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the set difference of two ZDDs.]
+
+  Description [Computes the set difference of two ZDDs. Returns a pointer to
+  the result if successful. The reference count of the result is not
+  incremented. NULL is returned in case of re-ordering of if memory is
+  exhausted.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_diff(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_zddDiff((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_diff */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the set difference of two ZDDs.]
+
+  Description [Computes the set difference of two ZDDs. Returns a pointer to
+  the result if successful. The reference count of the result is not
+  incremented. NULL is returned in case of re-ordering of if memory is
+  exhausted.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_diff_recur(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = cuddZddDiff((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+  return(result);
+
+} /* end of bdd_zdd_diff_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of ZDD variables.]
+
+  Description [Returns the number of ZDD variables.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_num_zdd_vars(bdd_manager *mgr)
+{
+  return(((DdManager *)mgr)->sizeZ);
+
+} /* end of bdd_num_zdd_vars */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes the bdd_node a regular one.]
+
+  Description [Makes the bdd_node a retular one.]
+
+  SideEffects [none]
+
+******************************************************************************/
+bdd_node *
+bdd_regular(bdd_node *f)
+{
+  return(Cudd_Regular((DdNode *)f));
+
+} /* end of bdd_regular */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the bdd_node is a constant; 0 otherwise.]
+
+  Description [Returns 1 if the bdd_node is a constant; 0 otherwise.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_constant(bdd_node *f)
+{
+  return(Cudd_IsConstant((DdNode *)f));
+
+} /* end of bdd_is_constant */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns 1 if the bdd_node is complemented. 0 otherwise.]
+
+  Description [Returns 1 if the bdd_node is complemented. 0 otherwise.]]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_complement(bdd_node *f)
+{
+  return(Cudd_IsComplement((DdNode *)f));
+
+} /* end of bdd_is_complement */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the then child of f.]
+
+  Description [Returns the then child of f. This is different from
+  bdd_then.]
+
+  SideEffects [none]
+
+  SeeAlso [bdd_then]
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_T(bdd_node *f)
+{
+  return(Cudd_T((DdNode *)f));
+
+} /* end of bdd_bdd_T */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the else child of f.]
+
+  Description [Returns the else child of f. This is different from
+  bdd_else.]
+
+  SideEffects []
+
+  SeeAlso [bdd_else]
+******************************************************************************/
+bdd_node *
+bdd_bdd_E(bdd_node *f)
+{
+  return(Cudd_E((DdNode *)f));
+
+} /* end of bdd_bdd_E */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the complement of a bdd_node.]
+
+  Description [Returns the complement of a bdd_node.]
+
+  SideEffects []
+
+  SeeAlso [bdd_not]
+******************************************************************************/
+bdd_node *
+bdd_not_bdd_node(bdd_node *f)
+{
+  return(Cudd_Not((DdNode *)f));
+
+} /* end of bdd_not_bdd_node */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Recursively derefs a ZDD.]
+
+  Description [Recursively derefs a ZDD.]
+
+  SideEffects [bdd_recursive_deref]
+
+  
+******************************************************************************/
+void
+bdd_recursive_deref_zdd(bdd_manager *mgr, bdd_node *f)
+{
+  Cudd_RecursiveDerefZdd((DdManager *)mgr, (DdNode *)f);
+
+} /* end of bdd_recursive_deref_zdd */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Count the number of mintems of a ZDD.]
+
+  Description [Count the number of mintems of a ZDD.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_zdd_count(bdd_manager *mgr, bdd_node *f)
+{
+  return(Cudd_zddCount((DdManager *)mgr, (DdNode *)f));
+
+} /* end of bdd_zdd_count */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the level of a of a bdd_node with index, index.]
+
+  Description [Returns the level of a of a bdd_node with index, index.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_read_zdd_level(bdd_manager *mgr, int index)
+{
+  return(Cudd_ReadPermZdd((DdManager *)mgr, index));
+
+} /* end of bdd_read_zdd_level  */
+
+
+/**Function********************************************************************
+
+  Synopsis [Creates multiplicity number of ZDD vars for each BDD var.]
+
+  Description [Creates one or more ZDD variables for each BDD variable.  If
+  some ZDD variables already exist, only the missing variables are created.
+  Parameter multiplicity allows the caller to control how many variables are
+  created for each BDD variable in existence. For instance, if ZDDs are used to
+  represent covers, two ZDD variables are required for each BDD variable.  The
+  order of the BDD variables is transferred to the ZDD variables. If a variable
+  group tree exists for the BDD variables, a corresponding ZDD variable group
+  tree is created by expanding the BDD variable tree. In any case, the ZDD
+  variables derived from the same BDD variable are merged in a ZDD variable
+  group. If a ZDD variable group tree exists, it is freed. Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_zdd_vars_from_bdd_vars(bdd_manager *mgr, int multiplicity)
+{
+  return(Cudd_zddVarsFromBddVars((DdManager *)mgr, multiplicity));
+
+} /* end of bdd_zdd_vars_from_bdd_vars */
+
+
+/**Function********************************************************************
+
+  Synopsis [Enables the alignment of ZDD vars with that of corresponding BDD
+  vars.]
+
+  Description [Enables the alignment of ZDD vars with that of corresponding BDD
+  vars.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_zdd_realign_enable(bdd_manager *mgr)
+{
+  Cudd_zddRealignEnable((DdManager *)mgr);
+
+} /* end of bdd_zdd_realign_enable */
+
+
+/**Function********************************************************************
+
+  Synopsis [Disables the alignment of ZDD vars with that of corresponding BDD
+  vars.]
+
+  Description [Disables the alignment of ZDD vars with that of corresponding BDD
+  vars.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_zdd_realign_disable(bdd_manager *mgr)
+{
+  Cudd_zddRealignDisable((DdManager *)mgr);
+
+} /* end of bdd_zdd_realign_disable */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the value of the variable for the alignment of ZDD vars
+  with that of corresponding BDD vars.]
+
+  Description [Returns the value of the variable for the alignment of ZDD vars
+  with that of corresponding BDD vars.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_zdd_realignment_enabled(bdd_manager *mgr)
+{
+  return(Cudd_zddRealignmentEnabled((DdManager *)mgr));
+
+} /* end of bdd_zdd_realignment_enabled */
+
+
+/**Function********************************************************************
+
+  Synopsis [Enables the alignment of BDD vars with that of corresponding ZDD
+  vars.]
+
+  Description [Enables the alignment of BDD vars with that of corresponding ZDD
+  vars.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_realign_enable(bdd_manager *mgr)
+{
+  Cudd_bddRealignEnable((DdManager *)mgr);
+
+} /* end of bdd_realign_enable */
+
+
+/**Function********************************************************************
+
+  Synopsis [Disables the alignment of BDD vars with that of corresponding ZDD
+  vars.]
+
+  Description [Disables the alignment of BDD vars with that of corresponding ZDD
+  vars.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_realign_disable(bdd_manager *mgr)
+{
+  Cudd_bddRealignDisable((DdManager *)mgr);
+
+} /* end of bdd_realign_disable */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the value of the variable for the alignment of BDD vars
+  with that of corresponding ZDD vars.]
+
+  Description [Returns the value of the variable for the alignment of BDD vars
+  with that of corresponding ZDD vars.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_realignment_enabled(bdd_manager *mgr)
+{
+  return(Cudd_bddRealignmentEnabled((DdManager *)mgr));
+
+} /* end of bdd_realignment_enabled */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the index of bdd_node f.]
+
+  Description [Returns the index of bdd_node f.]
+
+  SideEffects []
+
+  SeeAlso     [bdd_top_var_id]
+
+******************************************************************************/
+int
+bdd_node_read_index(bdd_node *f)
+{
+  return(Cudd_NodeReadIndex((DdNode *)f));
+
+} /* end of bdd_node_read_index */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reads the next field of a DdNode.]
+
+  Description [Reads the next field of a DdNode.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_read_next(bdd_node *f)
+{
+  return(((DdNode *)f)->next);
+
+} /* end of bdd_read_next */
+
+
+/**Function********************************************************************
+
+  Synopsis [Sets the next field of a DdNode. This function should NOT be used
+  by an external user. This is provided here as a patch.  This will not be a
+  part of any further release.]
+
+  Description [Sets the next field of a DdNode. This function should NOT be
+  used by an external user. This is provided here as a patch.  This will not be
+  a part of any further release.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_set_next(bdd_node *f, bdd_node *g)
+{
+  ((DdNode *)f)->next = (DdNode *)g;
+
+} /* end of bdd_set_next */
+
+
+/**Function********************************************************************
+
+  Synopsis [Read the reordered field of the manager.]
+
+  Description [Read the reordered field of the manager.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_read_reordered_field(bdd_manager *mgr)
+{
+  return(((DdManager *)mgr)->reordered);
+
+} /* end of bdd_read_reordered_field */
+
+
+/**Function********************************************************************
+
+  Synopsis [Set the reordered field of the manager.This is NOT to be
+  used by an external user. This function will not be a part of future
+  release.]
+
+  Description [Set the reordered field of the manager.This is NOT to be
+  used by an external user. This function will not be a part of future
+  release.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_set_reordered_field(bdd_manager *mgr, int n)
+{
+  ((DdManager *)mgr)->reordered = n;
+
+} /* end of bdd_set_reordered_field */
+
+
+/**Function********************************************************************
+
+  Synopsis [Implements the recursive call of bdd_add_apply.]
+
+  Description [Implements the recursive call of bdd_add_apply. This should be
+  used only in recursive procedures where the order of the variables needs to
+  remain constant during the entire operation of the procedure. Returns a
+  pointer to the result if successful. NULL is returned if reordering takes
+  place or if memory is exhausted.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_apply_recur(
+  bdd_manager *mgr,
+  bdd_node *(*operation)(bdd_manager *, bdd_node **, bdd_node **),
+  bdd_node *fn1,
+  bdd_node *fn2)
+{
+  DdNode *result;
+  result = cuddAddApplyRecur((DdManager *)mgr,
+			     (DdNode *(*)(DdManager *, DdNode **, DdNode **))
+			     operation, (DdNode *)fn1, (DdNode *)fn2);
+  return(result);
+
+} /* end of bdd_add_apply_recur */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the value of the ADD node.]
+
+  Description [Returns the value of the ADD node.]
+
+  SideEffects []
+
+******************************************************************************/
+BDD_VALUE_TYPE
+bdd_add_value(bdd_node *f)
+{
+  return(Cudd_V((DdNode *)f));
+
+} /* end of bdd_add_value */
+
+
+/**Function********************************************************************
+
+  Synopsis [Prints minterms of the bdd.]
+
+  Description [.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_print_minterm(bdd_t *f)
+{
+  int result;
+  result = Cudd_PrintMinterm((DdManager *)f->mgr, (DdNode *)f->node);
+  return result;
+
+} /* end of bdd_print_minterm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Reads the plus inifinity field of the BDD manager.]
+
+  Description [Reads the plus inifinity field of the BDD manager.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_read_plus_infinity(bdd_manager *mgr)
+{
+  DdNode *result;
+  result = Cudd_ReadPlusInfinity((DdManager *)mgr);
+  return (bdd_node *)result;
+
+} /* end of bdd_read_plus_infinity */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Selects pairs from R using a priority function.]
+
+  Description [Selects pairs from a relation R(x,y) (given as a BDD)
+  in such a way that a given x appears in one pair only. Uses a
+  priority function to determine which y should be paired to a given
+  x.  bdd_priority_select returns a pointer to the selected function
+  if successful; NULL otherwise. Three of the arguments--x, y, and
+  z--are vectors of BDD variables. The first two are the variables on
+  which R depends. The third is a vector of auxiliary variables, used
+  during the computation. This vector is optional. If a NULL value is
+  passed instead, bdd_priority_select will create the working
+  variables on the fly.  The sizes of x and y (and z if it is not
+  NULL) should equal n.  The priority function Pi can be passed as a
+  BDD, or can be built by Cudd_PrioritySelect. If NULL is passed
+  instead of a bdd_node *, parameter Pifunc is used by
+  Cudd_PrioritySelect to build a BDD for the priority
+  function. (Pifunc is a pointer to a C function.) If Pi is not NULL,
+  then Pifunc is ignored. Pifunc should have the same interface as the
+  standard priority functions (e.g., bdd_dxygtdxz).]
+
+  SideEffects [If called with z == NULL, will create new variables in
+  the manager.]
+
+  SeeAlso     [bdd_dxygtdxz bdd_xgty]
+
+******************************************************************************/
+bdd_node *
+bdd_priority_select(
+  bdd_manager *mgr,
+  bdd_node *R,
+  bdd_node **x,
+  bdd_node **y,
+  bdd_node **z,
+  bdd_node *Pi,
+  int n,
+  bdd_node  *(*Pifunc)(bdd_manager *, int, bdd_node **, bdd_node **, bdd_node **))
+{
+  DdNode *result;
+  result = Cudd_PrioritySelect((DdManager *)mgr,(DdNode *)R,
+			       (DdNode **)x,(DdNode **)y,
+			       (DdNode **)z,(DdNode *)Pi,
+			       n,(DdNode *(*)(DdManager *, int, DdNode **,
+					      DdNode **, DdNode **))Pifunc);
+  return (bdd_node *)result;
+
+} /* end of bdd_priority_select */
+
+
+/**Function********************************************************************
+
+  Synopsis [Set the background value of BDD manager.]
+
+  Description [Set the background value of BDD manager.]
+
+  SideEffects []
+
+******************************************************************************/
+void
+bdd_set_background(bdd_manager *mgr, bdd_node *f)
+{
+  Cudd_SetBackground((DdManager *)mgr,(DdNode *)f);
+ 
+} /* end of bdd_set_background */
+
+
+/**Function********************************************************************
+
+  Synopsis [Read the background value of BDD manager.]
+
+  Description [Read the background value of BDD manager.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_read_background(bdd_manager *mgr)
+{
+  DdNode *result;
+  result = Cudd_ReadBackground((DdManager *)mgr);
+  return (bdd_node *)result;
+
+} /* end of bdd_read_background */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the cofactor of f w.r.t g]
+
+  Description [Returns the cofactor of f w.r.t g]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_cofactor(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_Cofactor((DdManager *)mgr,(DdNode *)f,
+			 (DdNode *)g);
+  return (bdd_node *)result;
+
+} /* end of bdd_bdd_cofactor */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the ITE of f,g and h]
+
+  Description [Returns the ITE of f,g and h]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_ite(bdd_manager *mgr, bdd_node *f, bdd_node *g, bdd_node *h)
+{
+  DdNode *result;
+  result = Cudd_bddIte((DdManager *)mgr,(DdNode *)f,
+		       (DdNode *)g,(DdNode *)h);
+  return (bdd_node *)result;
+
+} /* end of bdd_bdd_ite */
+
+
+/**Function********************************************************************
+
+  Synopsis [Integer and floating point subtraction.Returns NULL if not a
+  terminal case; f-g otherwise.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_minus(bdd_manager *mgr, bdd_node **fn1, bdd_node **fn2)
+{
+  DdNode *result;
+  result = Cudd_addMinus((DdManager *)mgr, (DdNode **)fn1, (DdNode **)fn2);
+  return((bdd_node *)result);
+
+} /* end of bdd_add_plus */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Generates a BDD for the function d(x,y) &gt; d(x,z).]
+
+  Description [This function generates a BDD for the function d(x,y)
+  &gt; d(x,z);
+  x, y, and z are N-bit numbers, x\[0\] x\[1\] ... x\[N-1\],
+  y\[0\] y\[1\] ...  y\[N-1\], and z\[0\] z\[1\] ...  z\[N-1\],
+  with 0 the most significant bit.
+  The distance d(x,y) is defined as:
+	\sum_{i=0}^{N-1}(|x_i - y_i| \cdot 2^{N-i-1}).
+  The BDD is built bottom-up.
+  It has 7*N-3 internal nodes, if the variables are ordered as follows: 
+  x\[0\] y\[0\] z\[0\] x\[1\] y\[1\] z\[1\] ... x\[N-1\] y\[N-1\] z\[N-1\]. ]
+
+  SideEffects [None]
+
+  SeeAlso     [bdd_xgty]
+
+******************************************************************************/
+bdd_node *
+bdd_dxygtdxz(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y,
+  bdd_node **z)
+{
+  DdNode *result;
+  result = Cudd_Dxygtdxz((DdManager *)mgr,N,(DdNode **)x,
+			 (DdNode **)y,(DdNode **)z);
+  return((bdd_node *)result);
+
+} /* end of bdd_dxygtdxz */
+
+
+/**Function********************************************************************
+
+  Synopsis [Universally abstracts out the variables from the function]
+
+  SideEffects        []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_univ_abstract(bdd_manager *mgr, bdd_node *fn, bdd_node *vars)
+{
+  DdNode *result;
+  result = Cudd_bddUnivAbstract((DdManager *)mgr, (DdNode *)fn,
+				(DdNode *)vars);
+  return((bdd_node *)result);
+
+} /* end of bdd_bdd_univ_abstract */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the compatible projection of R w.r.t. cube Y.]
+
+  Description [Computes the compatible projection of relation R with
+  respect to cube Y.]
+
+  SideEffects [None]
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_cprojection(bdd_manager *mgr, bdd_node *R, bdd_node *Y)
+{
+  DdNode *result;
+  result = Cudd_CProjection((DdManager *)mgr,(DdNode *)R,
+			    (DdNode *)Y);
+  return (bdd_node *)result;
+
+} /* end of bdd_bdd_cprojection */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the correlation of f and g.]
+
+  Description [Computes the correlation of f and g. If f == g, their
+  correlation is 1. If f == g', their correlation is 0.  Returns the
+  fraction of minterms in the ON-set of the EXNOR of f and g.]
+
+  SideEffects [None]
+
+******************************************************************************/
+double
+bdd_correlation(bdd_t *f, bdd_t *g)
+{
+  double result ;
+  assert(f->mgr == g->mgr);
+  result = Cudd_bddCorrelation(f->mgr, f->node, g->node);
+  return (result);
+
+} /* end of bdd_correlation */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes 2 partitions of a function.]
+
+  Description [Computes 2 partitions of a function. Method based on
+  DAC98 - Ravi, Somenzi. Picks decomposition points and replaces one
+  child in each conjunct with 1 (0). returns 2 conjuncts(disjuncts).]
+  
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_gen_decomp(bdd_t *f, bdd_partition_type_t partType, bdd_t ***conjArray)
+{
+  DdNode **ddArray = NULL;
+  int i, num = 0;
+  bdd_t *result;
+  
+  switch (partType) {
+  case BDD_CONJUNCTS:
+    num = Cudd_bddGenConjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  case BDD_DISJUNCTS:
+    num = Cudd_bddGenDisjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  }
+  if ((ddArray == NULL) || (!num)) {
+    return 0;
+  }
+  
+  *conjArray = ALLOC(bdd_t *, num);
+  if ((*conjArray) == NULL) goto outOfMem;
+  for (i = 0; i < num; i++) {
+    result = ALLOC(bdd_t, 1);
+    if (result == NULL) {
+      FREE(*conjArray);
+      goto outOfMem;
+    }
+    result->mgr = f->mgr;
+    result->node = ddArray[i];
+    result->free = FALSE;
+    (*conjArray)[i] = result;
+  }
+  FREE(ddArray);
+  return (num);
+
+ outOfMem:
+  for (i = 0; i < num; i++) {
+    Cudd_RecursiveDeref((DdManager *)f->mgr,(DdNode *)ddArray[i]);
+  }
+  FREE(ddArray);
+  return(0);
+
+} /* end of bdd_gen_decomp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes 2 partitions of a function.]
+
+  Description [Computes 2 partitions of a function. Method based on
+  Cabodi 94. Picks a var and replaces one child in each conjunct with
+  1 (0). returns 2 conjuncts(disjuncts).]
+  
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_var_decomp(bdd_t *f, bdd_partition_type_t partType, bdd_t ***conjArray)
+{
+  DdNode **ddArray = NULL;
+  int i, num = 0;
+  bdd_t *result;
+
+  switch (partType) {
+  case BDD_CONJUNCTS:
+    num = Cudd_bddVarConjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  case BDD_DISJUNCTS:
+    num = Cudd_bddVarDisjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  }
+  if ((ddArray == NULL) || (!num)) {
+    return 0;
+  }
+  
+  *conjArray = ALLOC(bdd_t *, num);
+  if ((*conjArray) == NULL) goto outOfMem;
+  for (i = 0; i < num; i++) {
+    result = ALLOC(bdd_t, 1);
+    if (result == NULL) {
+      FREE(*conjArray);
+      goto outOfMem;
+    }
+    result->mgr = f->mgr;
+    result->node = (ddArray)[i];
+    result->free = FALSE;
+    (*conjArray)[i] = result;
+  }
+  FREE(ddArray);
+  return (num);
+
+ outOfMem:
+  for (i = 0; i < num; i++) {
+    Cudd_RecursiveDeref((DdManager *)f->mgr,(DdNode *)ddArray[i]);
+  }
+  FREE(ddArray);
+  return(0);
+
+} /* end of bdd_var_decomp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes 2 partitions of a function.]
+
+  Description [Computes 2 partitions of a function.  Picks a subset of
+  a function and minimizes the rest of the function w.r.t. the subset.
+  returns 2 conjuncts(disjuncts).]
+  
+  SideEffects []
+
+******************************************************************************/
+int 
+bdd_approx_decomp(bdd_t *f, bdd_partition_type_t partType, bdd_t ***conjArray)
+{
+  DdNode **ddArray = NULL;
+  int i, num = 0;
+  bdd_t *result;
+
+  switch (partType) {
+  case BDD_CONJUNCTS:
+    num = Cudd_bddApproxConjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  case BDD_DISJUNCTS:
+    num = Cudd_bddApproxDisjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  }
+  if ((ddArray == NULL) || (!num)) {
+    return 0;
+  }
+  
+  *conjArray = ALLOC(bdd_t *, num);
+  if ((*conjArray) == NULL) goto outOfMem;
+  for (i = 0; i < num; i++) {
+    result = ALLOC(bdd_t, 1);
+    if (result == NULL) {
+      FREE(*conjArray);
+      goto outOfMem;
+    }
+    result->mgr = f->mgr;
+    result->node = ddArray[i];
+    result->free = FALSE;
+    (*conjArray)[i] = result;
+  }
+  FREE(ddArray);
+  return (num);
+
+ outOfMem:
+  for (i = 0; i < num; i++) {
+    Cudd_RecursiveDeref((DdManager *)f->mgr,(DdNode *)ddArray[i]);
+  }
+  FREE(ddArray);
+  return(0);
+
+} /* end of bdd_approx_decomp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes 2 partitions of a function.]
+
+  Description [Computes 2 partitions of a function.  Picks a subset of
+  a function and minimizes the rest of the function w.r.t. the
+  subset. Performs this iteratively.  returns 2 conjuncts(disjuncts).]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_iter_decomp(bdd_t *f, bdd_partition_type_t partType, bdd_t ***conjArray)
+{
+  DdNode **ddArray;
+  int i, num = 0;
+  bdd_t *result;
+
+  switch (partType) {
+  case BDD_CONJUNCTS:
+    num = Cudd_bddIterConjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  case BDD_DISJUNCTS:
+    num = Cudd_bddIterDisjDecomp(f->mgr, f->node, &ddArray);
+    break;
+  }
+  if ((ddArray == NULL) || (!num)) {
+    return 0;
+  }
+  
+  *conjArray = ALLOC(bdd_t *, num);
+  if ((*conjArray) == NULL) goto outOfMem;
+  for (i = 0; i < num; i++) {
+    result = ALLOC(bdd_t, 1);
+    if (result == NULL) {
+      FREE(*conjArray);
+      goto outOfMem;
+    }
+    result->mgr = f->mgr;
+    result->node = ddArray[i];
+    result->free = FALSE;
+    (*conjArray)[i] = result;
+  }
+  FREE(ddArray);
+  return (num);
+
+ outOfMem:
+  for (i = 0; i < num; i++) {
+    Cudd_RecursiveDeref((DdManager *)f->mgr,(DdNode *)ddArray[i]);
+  }
+  FREE(ddArray);
+  return(0);
+  
+} /* end of bdd_iter_decomp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reports the number of nodes in the manager.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_read_node_count(bdd_manager *mgr)
+{
+  return(Cudd_ReadNodeCount((DdManager *)mgr));
+
+} /* end of bdd_read_node_count */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes the fraction of minterms in the on-set of all the
+  positive cofactors of a BDD, called signatures.]
+
+  SideEffects [Creates an array of doubles as large as the number of
+  variables in the manager + 1. The extra position is to the fraction
+  of minterms in the on-set of the function.]
+
+******************************************************************************/
+double *
+bdd_cof_minterm(bdd_t *f)
+{
+  double *signatures;
+  signatures = Cudd_CofMinterm((DdManager *)f->mgr, (DdNode *)f->node);
+  return (signatures);
+
+} /* end of bdd_cof_minterm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Estimates the size of the cofactor of f with respect to
+  var in the specified phase. Return the number of nodes in the
+  estimated size.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_estimate_cofactor(bdd_t *f, bdd_t *var, int phase)
+{
+  return (Cudd_EstimateCofactor((DdManager *)f->mgr, (DdNode *)f->node,
+				(int)bdd_top_var_id(var), phase));
+
+} /* end of bdd_estimate_cofactor */
+
+
+/**Function********************************************************************
+
+  Synopsis [Tests if the varid is unate in f in the specified
+  phase. If yes, return 1, else 0.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_test_unate(bdd_t *f, int varId, int phase)
+{
+  DdNode *result;
+  DdNode *one = DD_ONE((DdManager *)f->mgr);
+
+  if (phase) {
+    result = Cudd_Increasing((DdManager *)f->mgr, (DdNode *)f->node, varId);
+  } else {
+    result = Cudd_Decreasing((DdManager *)f->mgr, (DdNode *)f->node, varId);
+  }
+
+  if (result == one) {
+    return 1;
+  } else {
+    return 0;
+  }
+    
+} /* end of bdd_test_unate */
+
+
+/**Function********************************************************************
+
+  Synopsis [Finds the essential variable in a bdd f. Returns an
+  array_t of vars which are the projection variables.]
+
+  SideEffects [Creates an array_t of bdd_t. Freed by the caller ]
+
+******************************************************************************/
+array_t *
+bdd_find_essential(bdd_t *f)
+{
+  DdNode *C, *result, *scan, *cube;
+  array_t *varArray = NIL(array_t);
+  bdd_t *var;
+    
+  result = Cudd_FindEssential((DdManager *)f->mgr, (DdNode *)f->node);
+  if (result == NULL) return NULL;
+  cuddRef(result);
+    
+  cube = result;
+  C = Cudd_Regular(cube);
+  varArray = array_alloc(bdd_t *, 0);
+  if (!cuddIsConstant(C)) {
+    while (!cuddIsConstant(C)) {
+      var = bdd_var_with_index(f->mgr, C->index);
+      array_insert_last(bdd_t *, varArray, var);
+      scan = cuddT(C);
+      if (cuddIsConstant(scan)) scan = cuddE(C);
+      cube = Cudd_NotCond(scan, Cudd_IsComplement(cube));
+      C = Cudd_Regular(cube);
+    }
+  }
+
+  Cudd_RecursiveDeref((DdManager *)f->mgr,result);
+  return varArray;
+
+} /* end of bdd_find_essential */
+
+
+/**Function********************************************************************
+
+  Synopsis [Finds the essential variables in a bdd f. Returns a cube
+  of the variables.]
+
+  SideEffects [ ]
+
+******************************************************************************/
+bdd_t *
+bdd_find_essential_cube(bdd_t *f)
+{
+  DdNode *cube;
+  bdd_t *result;
+    
+  cube = Cudd_FindEssential((DdManager *)f->mgr, (DdNode *)f->node);
+  if (cube == NULL) return NULL;
+  cuddRef(cube);
+  result = bdd_construct_bdd_t(f->mgr,cube);
+
+  return(result);
+
+} /* end of bdd_find_essential_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis [Generates a BDD for the function x==y.]]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_xeqy(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y)
+{
+  DdNode *result;
+  result = Cudd_Xeqy((DdManager *)mgr,N,(DdNode **)x,
+		     (DdNode **)y);
+  return((bdd_node *)result);
+
+} /* end of bdd_xeqy */
+
+
+/**Function********************************************************************
+
+  Synopsis [Rounds off the discriminants of an ADD.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_roundoff(bdd_manager *mgr, bdd_node *f, int N)
+{
+  DdNode *result;
+  result = Cudd_addRoundOff((DdManager *)mgr,(DdNode *)f,N);
+  return((bdd_node *)result);
+
+} /* end of bdd_add_roundoff */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Generates a BDD for the function x &gt; y.]
+
+  Description [This function generates a BDD for the function x &gt; y.
+  Both x and y are N-bit numbers, x\[0\] x\[1\] ... x\[N-1\] and
+  y\[0\] y\[1\] ...  y\[N-1\], with 0 the most significant bit.
+  The BDD is built bottom-up.
+  It has 3*N-1 internal nodes, if the variables are ordered as follows: 
+  x\[0\] y\[0\] x\[1\] y\[1\] ... x\[N-1\] y\[N-1\].]
+
+  SideEffects [None]
+
+  SeeAlso     [bdd_dxygtdxz]
+
+******************************************************************************/
+bdd_node *
+bdd_xgty(
+  bdd_manager *mgr,
+  int N,
+  bdd_node **x,
+  bdd_node **y)
+{
+  DdNode *result;
+  result = Cudd_Xgty((DdManager *)mgr,N, NIL(DdNode *),
+		     (DdNode **)x, (DdNode **)y);
+  return((bdd_node *)result);
+
+} /* end of bdd_xgty */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the complement of an ADD a la C language.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_cmpl(bdd_manager *mgr, bdd_node *f)
+{
+  DdNode *result;
+  result = Cudd_addCmpl((DdManager *)mgr,(DdNode *)f);
+  return((bdd_node *)result);
+
+} /* end of bdd_add_cmpl */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns m minterms from a BDD.]
+
+  Description [Returns <code>m</code> minterms from a BDD whose
+  support has <code>n</code> variables at most.  The procedure tries
+  to create as few extra nodes as possible. The function represented
+  by <code>f</code> depends on at most <code>n</code> of the variables
+  in <code>x</code>. Returns a BDD with <code>m</code> minterms of the
+  on-set of f if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+bdd_node *
+bdd_split_set(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **x,
+  int n,
+  double m)
+{
+  DdNode *result;
+  result = Cudd_SplitSet((DdManager *)mgr,(DdNode *)f,
+			 (DdNode **)x, n, m);
+  return((bdd_node *)result);
+
+} /* end of bdd_split_set */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks for inconsistencies in the BDD manager.]
+
+  Description [Checks for inconsistencies in the BDD manager.]
+
+  SideEffects [None]
+
+  SeeAlso [Cudd_DebugCheck]
+
+******************************************************************************/
+int
+bdd_debug_check(bdd_manager *mgr)
+{
+  return Cudd_DebugCheck((DdManager *)mgr);
+
+} /* end of bdd_debug_check */
+
+
+/**Function********************************************************************
+
+  Synopsis [Prints the minterns of f in the file stream fp. Precision
+  can be specified in the last argument. Result is 1 if printing is
+  successful, else 0.]
+
+  SideEffects []
+
+******************************************************************************/
+int 
+bdd_print_apa_minterm(
+  FILE *fp,
+  bdd_t *f,
+  int nvars,
+  int precision)
+{
+  int result;
+  result = Cudd_ApaPrintMintermExp(fp, (DdManager *)f->mgr,(DdNode *)f->node, nvars, precision);
+  return(result);
+
+} /* end of bdd_print_apa_minterm */
+
+
+/**Function********************************************************************
+
+  Synopsis [Compares the ratios of the minterms of 2 bdds and two numbers.
+  The ratio compared is  ((Min(f1)/f1Num)/(Min(f2)/f2Num)). The procedure
+  returns 1 if the ratio is greater than 1, 0 if they are equal and -1 if the
+  ratio is less than 1. ]
+
+  SideEffects []
+
+******************************************************************************/
+int 
+bdd_apa_compare_ratios(
+  int nvars,
+  bdd_t *f1,
+  bdd_t *f2,
+  int f1Num,
+  int f2Num)
+{
+  int result;
+  DdApaNumber f1Min, f2Min;
+  int digits1, digits2;
+
+  f1Min = Cudd_ApaCountMinterm((DdManager *)f1->mgr, (DdNode *)f1->node, nvars, &digits1);
+  f2Min = Cudd_ApaCountMinterm((DdManager *)f2->mgr, (DdNode *)f2->node, nvars, &digits2);
+    
+  result = Cudd_ApaCompareRatios(digits1, f1Min, f1Num, digits2, f2Min, f2Num);
+  return(result);
+
+} /* end of bdd_apa_compare_ratios */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the exclusive-or of f and g.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_xor(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  DdNode *result;
+  result = Cudd_bddXor((DdManager *)mgr, (DdNode *)f, (DdNode *)g);
+
+  return(result);
+
+} /* end of bdd_bdd_xor */
+
+
+/**Function********************************************************************
+
+  Synopsis [Generates a blif file by dumpping BDDs. nBdds is the number
+  of BDDs, bdds is the array of BDDs, inames is the array of primary
+  input variable names, onames is the array of variable names of BDDs,
+  and model is a model name in BLIF. inames, onames and model can be
+  NULL.]
+
+  SideEffects []
+
+******************************************************************************/
+void 
+bdd_dump_blif(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  char *model,
+  FILE *fp)
+{
+  Cudd_DumpBlif((DdManager *)mgr, nBdds, (DdNode **)bdds, inames, onames,
+		model, fp);
+
+} /* end of bdd_dump_blif */
+
+
+/**Function********************************************************************
+
+  Synopsis [Generates a blif body by dumpping BDDs. nBdds is the number
+  of BDDs, bdds is the array of BDDs, inames is the array of primary
+  input variable names, onames is the array of variable names of BDDs,
+  and inames, onames and model can be NULL. This function prints out
+  only .names body.]
+
+  SideEffects []
+
+******************************************************************************/
+void 
+bdd_dump_blif_body(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  FILE *fp)
+{
+  Cudd_DumpBlifBody((DdManager *)mgr, nBdds, (DdNode **)bdds, inames, onames,
+		    fp);
+
+} /* end of bdd_dump_blif_body */
+
+
+/**Function********************************************************************
+
+  Synopsis [Generates a dot file by dumpping BDDs. nBdds is the number
+  of BDDs, bdds is the array of BDDs, inames is the array of primary
+  input variable names, and onames is the array of variable names of BDDs.
+  inames, onames and model can be NULL.]
+
+  SideEffects []
+
+******************************************************************************/
+void 
+bdd_dump_dot(
+  bdd_manager *mgr,
+  int nBdds,
+  bdd_node **bdds,
+  char **inames,
+  char **onames,
+  FILE *fp)
+{
+  Cudd_DumpDot((DdManager *)mgr, nBdds, (DdNode **)bdds, inames, onames, fp);
+
+} /* end of bdd_dump_dot */
+
+
+/**Function********************************************************************
+
+  Synopsis [Converts a ZDD cover to a BDD graph.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_make_bdd_from_zdd_cover(bdd_manager *mgr, bdd_node *node)
+{
+  return((bdd_node *)Cudd_MakeBddFromZddCover((DdManager *)mgr, (DdNode *)node));
+
+} /* end of bdd_make_bdd_from_zdd_cover */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the complement of a ZDD cover.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_zdd_complement(bdd_manager *mgr, bdd_node *node)
+{
+  return((bdd_node *)Cudd_zddComplement((DdManager *)mgr, (DdNode *)node));
+
+} /* end of bdd_zdd_complement */
+
+
+/**Function********************************************************************
+
+  Synopsis [Finds the variables on which a set of DDs depends.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_vector_support(bdd_manager *mgr, bdd_node **F, int n)
+{
+  return((bdd_node *)Cudd_VectorSupport((DdManager *)mgr,(DdNode **)F,n));
+
+} /* end of bdd_bdd_vector_support */
+
+
+/**Function********************************************************************
+
+  Synopsis [Count the variables on which a set of DDs depend.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_bdd_vector_support_size(bdd_manager *mgr, bdd_node **F, int n)
+{
+  return(Cudd_VectorSupportSize((DdManager *)mgr,(DdNode **)F,n));
+
+} /* end of bdd_bdd_vector_support_size */
+
+
+/**Function********************************************************************
+
+  Synopsis [Count the variables on which a DD depends.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_bdd_support_size(bdd_manager *mgr, bdd_node *F)
+{
+  return(Cudd_SupportSize((DdManager *)mgr,(DdNode *)F));
+
+} /* end of bdd_bdd_support_size */
+
+
+/**Function********************************************************************
+
+  Synopsis [Returns the BDD of the variables on which F depends.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_support(bdd_manager *mgr, bdd_node *F)
+{
+  return((bdd_node *)Cudd_Support((DdManager *)mgr,(DdNode *)F));
+
+} /* end of bdd_bdd_support */
+
+
+/**Function********************************************************************
+
+  Synopsis [Composes an ADD with a vector of ADDs.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_add_general_vector_compose(
+  bdd_manager *mgr,
+  bdd_node *f,
+  bdd_node **vectorOn,
+  bdd_node **vectorOff)
+{
+  return((bdd_node *)Cudd_addGeneralVectorCompose((DdManager *)mgr,
+						  (DdNode *)f,
+						  (DdNode **)vectorOn,
+						  (DdNode **)vectorOff));
+
+} /* end of bdd_add_general_vector_compose */
+
+
+/**Function********************************************************************
+
+  Synopsis [Computes the boolean difference of f w.r.t to variable x.]
+
+  SideEffects []
+
+******************************************************************************/
+bdd_node *
+bdd_bdd_boolean_diff(bdd_manager *mgr, bdd_node *f, int x)
+{
+  return ((bdd_node *)Cudd_bddBooleanDiff((DdManager *)mgr,(DdNode *)f,x));
+
+} /* end of bdd_bdd_boolean_diff */
+
+
+/**Function********************************************************************
+
+  Synopsis [Check whether two BDDs intersect.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_bdd_leq(bdd_manager *mgr, bdd_node *f, bdd_node *g)
+{
+  return Cudd_bddLeq((DdManager *)mgr,(DdNode *)f,(DdNode *)g);
+
+} /* end of bdd_bdd_leq */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether two bdds are same.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_ptrcmp(bdd_t *f, bdd_t *g)
+{
+  if (f->node == g->node)
+    return(0);
+  else
+    return(1);
+
+} /* end of bdd_ptrcmp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the hash value of a bdd.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_ptrhash(bdd_t *f, int size)
+{
+  int hash;
+
+  hash = (int)((unsigned long)f->node >> 2) % size;
+  return(hash);
+
+} /* end of bdd_ptrhash */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the peak memory in use.]
+
+  SideEffects []
+
+******************************************************************************/
+long
+bdd_read_peak_memory(bdd_manager *mgr)
+{
+  return((long) Cudd_ReadMemoryInUse((DdManager *) mgr));
+
+} /* end of bdd_read_peak_memory */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the peak live node count.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+bdd_read_peak_live_node(bdd_manager *mgr)
+{
+  return(Cudd_ReadPeakLiveNodeCount((DdManager *) mgr));
+
+} /* end of bdd_read_peak_live_node */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable type to primary input.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_pi_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddSetPiVar((DdManager *) mgr, index);
+
+} /* bdd_set_pi_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable type to present state.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_ps_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddSetPsVar((DdManager *) mgr, index);
+
+} /* end of bdd_set_ps_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable type to next state.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_ns_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddSetNsVar((DdManager *) mgr, index);
+
+} /* end of bdd_set_ns_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a variable is primary input.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_pi_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddIsPiVar((DdManager *) mgr, index);
+
+} /* end of bdd_is_pi_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a variable is present state.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_ps_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddIsPsVar((DdManager *) mgr, index);
+
+} /* end of bdd_is_ps_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a variable is next state.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_ns_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddIsNsVar((DdManager *) mgr, index);
+
+} /* end of bdd_is_ns_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a corresponding pair index for a given index.]
+
+  Description [Sets a corresponding pair index for a given index.
+  These pair indices are present and next state variable.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_pair_index(bdd_manager *mgr, int index, int pairidx)
+{
+  return Cudd_bddSetPairIndex((DdManager *) mgr, index, pairidx);
+
+} /* end of bdd_set_pair_index */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reads a corresponding pair index for a given index.]
+
+  Description [Reads a corresponding pair index for a given index.
+  These pair indices are present and next state variable.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_read_pair_index(bdd_manager *mgr, int index)
+{
+  return Cudd_bddReadPairIndex((DdManager *) mgr, index);
+
+} /* end of bdd_read_pair_index */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable to be grouped.]
+
+  Description [Sets a variable to be grouped. This function is used for
+  lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_var_to_be_grouped(bdd_manager *mgr, int index)
+{
+  return Cudd_bddSetVarToBeGrouped((DdManager *) mgr, index);
+
+} /* end of bdd_set_var_to_be_grouped */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable to be a hard group.]
+
+  Description [Sets a variable to be a hard group. This function is used
+  for lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_var_hard_group(bdd_manager *mgr, int index)
+{
+  return Cudd_bddSetVarHardGroup((DdManager *) mgr, index);
+
+} /* end of bdd_set_var_hard_group */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Resets a variable not to be grouped.]
+
+  Description [Resets a variable not to be grouped. This function is
+  used for lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_reset_var_to_be_grouped(bdd_manager *mgr, int index)
+{
+  return Cudd_bddResetVarToBeGrouped((DdManager *) mgr, index);
+
+} /* end of bdd_reset_var_to_be_grouped */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a variable is set to be grouped.]
+
+  Description [Checks whether a variable is set to be grouped. This
+  function is used for lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_var_to_be_grouped(bdd_manager *mgr, int index)
+{
+  return Cudd_bddIsVarToBeGrouped((DdManager *) mgr, index);
+
+} /* end of bdd_is_var_to_be_grouped */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether a variable is set to be a hard group.]
+
+  Description [Checks whether a variable is set to be a hard group. This
+  function is used for lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_var_hard_group(bdd_manager *mgr, int index)
+{
+  return Cudd_bddIsVarHardGroup((DdManager *) mgr, index);
+
+} /* end of bdd_is_var_hard_group */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable to be ungrouped.]
+
+  Description [Sets a variable to be ungrouped. This function is used
+  for lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_var_to_be_ungrouped(bdd_manager *mgr, int index)
+{
+  return Cudd_bddIsVarToBeUngrouped((DdManager *) mgr, index);
+
+} /* end of bdd_is_var_to_be_ungrouped */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Sets a variable to be ungrouped.]
+
+  Description [Sets a variable to be ungrouped. This function is used
+  for lazy sifting.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_set_var_to_be_ungrouped(bdd_manager *mgr, int index)
+{
+  return Cudd_bddSetVarToBeUngrouped((DdManager *) mgr, index);
+
+} /* end of bdd_set_var_to_be_ungrouped */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prevents sifting of a variable.]
+
+  Description [This function sets a flag to prevent sifting of a
+  variable.  Returns 1 if successful; 0 otherwise (i.e., invalid
+  variable index).]
+
+  SideEffects [Changes the "bindVar" flag in DdSubtable.]
+
+******************************************************************************/
+int
+bdd_bind_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddBindVar((DdManager *) mgr, index);
+
+} /* end of bdd_bind_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Allows the sifting of a variable.]
+
+  Description [This function resets the flag that prevents the sifting
+  of a variable. In successive variable reorderings, the variable will
+  NOT be skipped, that is, sifted.  Initially all variables can be
+  sifted. It is necessary to call this function only to re-enable
+  sifting after a call to Cudd_bddBindVar. Returns 1 if successful; 0
+  otherwise (i.e., invalid variable index).]
+
+  SideEffects [Changes the "bindVar" flag in DdSubtable.]
+
+******************************************************************************/
+int
+bdd_unbind_var(bdd_manager *mgr, int index)
+{
+  return Cudd_bddUnbindVar((DdManager *) mgr, index);
+
+} /* end of bdd_unbind_var */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether lazy sifting is on.]
+
+  SideEffects [none]
+
+******************************************************************************/
+int
+bdd_is_lazy_sift(bdd_manager *mgr)
+{
+  Cudd_ReorderingType method;
+
+  Cudd_ReorderingStatus((DdManager *) mgr, &method);
+  if (method == CUDD_REORDER_LAZY_SIFT)
+    return(1);
+  return(0);
+
+} /* end of bdd_is_lazy_sift */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees the variable group tree of the manager.]
+
+  SideEffects [None]
+
+******************************************************************************/
+void
+bdd_discard_all_var_groups(bdd_manager *mgr)
+{
+  Cudd_FreeTree((DdManager *) mgr);
+
+} /* end of bdd_discard_all_var_groups */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis [Function to print a warning that an illegal value was read.]
+
+  SideEffects        []
+
+  SeeAlso            [bdd_set_parameters]
+
+******************************************************************************/
+static void
+InvalidType(FILE *file, char *field, char *expected)
+{
+  (void) fprintf(file, "Warning: In parameter \"%s\"\n", field);
+  (void) fprintf(file, "Illegal type detected. %s expected\n", expected);
+
+} /* end of InvalidType */
Index: /vis_dev/glu-2.1/src/cuPort/cuPort.make
===================================================================
--- /vis_dev/glu-2.1/src/cuPort/cuPort.make	(revision 6)
+++ /vis_dev/glu-2.1/src/cuPort/cuPort.make	(revision 6)
@@ -0,0 +1,4 @@
+CSRC_cu += cuPortIter.c cuPort.c
+HEADERS_cu += cuPortInt.h
+
+DEPENDENCYFILES = $(CSRC_cu)
Index: /vis_dev/glu-2.1/src/cuPort/cuPortInt.h
===================================================================
--- /vis_dev/glu-2.1/src/cuPort/cuPortInt.h	(revision 6)
+++ /vis_dev/glu-2.1/src/cuPort/cuPortInt.h	(revision 6)
@@ -0,0 +1,96 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [cuddPortInt.h]
+
+  PackageName [cu_port]
+
+  Synopsis    [Header file used by cu_port.]
+
+  Author      [Abelardo Pardo <abel@vlsi.colorado.edu>]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+  Revision    [$Id: cuPortInt.h,v 1.5 2004/08/13 18:39:31 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _CU_PORT_INT
+#define _CU_PORT_INT
+
+#include "util.h"
+#include "array.h"
+#include "st.h"
+
+#include "cuddInt.h"
+#include "bdd.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+struct bdd_t {
+  boolean free; /* TRUE if this is free, FALSE otherwise ... */
+  DdNode *node; /* ptr to the top node of the function */
+  DdManager *mgr; /* the manager */
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _CU_PORT_INT */
+
Index: /vis_dev/glu-2.1/src/cuPort/cuPortIter.c
===================================================================
--- /vis_dev/glu-2.1/src/cuPort/cuPortIter.c	(revision 6)
+++ /vis_dev/glu-2.1/src/cuPort/cuPortIter.c	(revision 6)
@@ -0,0 +1,399 @@
+/**CFile***********************************************************************
+
+  FileName    [cuPortIter.c]
+
+  PackageName [cu_port]
+
+  Synopsis    [Port routines for CU package.]
+
+  Description [optional]
+
+  SeeAlso     [optional]
+
+  Author      [Abelardo Pardo <abel@vlsi.colorado.edu> ]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "cuPortInt.h"
+
+#ifndef lint
+static char rcsid[] UNUSED = "$Id: cuPortIter.c,v 1.13 2004/08/13 18:39:31 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+typedef struct {
+    DdManager   *manager;
+    DdGen	*ddGen;
+    array_t	*cube;
+} cu_bdd_gen;
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the status of a bdd generator.]
+
+  SideEffects []
+
+  SeeAlso [bdd_first_cube bdd_next_cube bdd_gen_free]
+
+******************************************************************************/
+bdd_gen_status
+bdd_gen_read_status(bdd_gen *gen)
+{
+  if (Cudd_IsGenEmpty(((cu_bdd_gen *)gen)->ddGen)) {
+    return bdd_EMPTY;
+  }
+  else {
+    return bdd_NONEMPTY;
+  }
+
+} /* end of bdd_gen_read_status */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the first disjoint cube of the function.
+  A generator is also returned, which will iterate over the rest.]
+
+  Description [Defines an iterator on the onset of a BDD.  Two routines
+  are provided: bdd_first_cube, which extracts one cube from a BDD and
+  returns a bdd_gen structure containing the information necessary to
+  continue the enumeration; and bdd_next_disjoint_cube, which returns 1 if
+  another cube was found, and 0 otherwise. A cube is represented as an
+  array of bdd_literal (which are integers in {0, 1, 2}), where 0
+  represents negated literal, 1 for literal, and 2 for don't care.
+  Returns a disjoint cover.  A third routine is there to clean up.]
+
+  SideEffects []
+
+  SeeAlso [bdd_next_cube bdd_gen_free]
+
+******************************************************************************/
+bdd_gen *
+bdd_first_disjoint_cube(bdd_t *fn, array_t **cube /* of bdd_literal */)
+{
+    DdManager *manager;
+    cu_bdd_gen *gen;
+    int i;
+    int *icube;
+    CUDD_VALUE_TYPE value;
+
+    /* Make sure we receive a valid bdd_t. (So to speak.) */
+    assert(fn != 0);
+
+    manager = (DdManager *)fn->mgr;
+
+    /* Initialize the generator. */
+    gen = ALLOC(cu_bdd_gen,1);
+    if (gen == NULL) {
+      return(NIL(bdd_gen));
+    }
+    gen->manager = manager;
+
+    gen->cube = array_alloc(bdd_literal, manager->size);
+    if (gen->cube == NULL) {
+	fail("Bdd Package: Out of memory in bdd_first_cube");
+    }
+
+    gen->ddGen = Cudd_FirstCube(manager,(DdNode *)fn->node,&icube,&value);
+    if (gen->ddGen == NULL) {
+	fail("Cudd Package: Out of memory in bdd_first_cube");
+    }
+
+    if (!Cudd_IsGenEmpty(gen->ddGen)) {
+	/* Copy icube to the array_t cube. */
+	for (i = 0; i < manager->size; i++) {
+	    int myconst = icube[i];
+	    array_insert(bdd_literal, gen->cube, i, myconst);
+	}
+	*cube = gen->cube;
+    }
+
+    return(gen);
+
+} /* end of bdd_first_disjoint_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gets the next cube on the generator. Returns {TRUE,
+  FALSE} when {more, no more}.]
+
+  SideEffects []
+
+  SeeAlso     [bdd_first_cube bdd_gen_free]
+
+******************************************************************************/
+boolean
+bdd_next_disjoint_cube(bdd_gen *gen_, array_t **cube /* of bdd_literal */)
+{
+    cu_bdd_gen *gen;
+    int retval;
+    int *icube;
+    CUDD_VALUE_TYPE value;
+    int i;
+
+    gen = (cu_bdd_gen *)gen_;
+
+    retval = Cudd_NextCube(gen->ddGen,&icube,&value);
+    if (!Cudd_IsGenEmpty(gen->ddGen)) {
+	/* Copy icube to the array_t cube. */
+	for (i = 0; i < gen->manager->size; i++) {
+	    int myconst = icube[i];
+	    array_insert(bdd_literal, gen->cube, i, myconst);
+	}
+	*cube = gen->cube;
+    }
+
+    return(retval);
+
+} /* end of bdd_next_disjoint_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the first cube of the function.
+  A generator is also returned, which will iterate over the rest.]
+
+  Description [Defines an iterator on the onset of a BDD.  Two routines
+  are provided: bdd_first_cube, which extracts one cube from a BDD and
+  returns a bdd_gen structure containing the information necessary to
+  continue the enumeration; and bdd_next_cube, which returns 1 if
+  another cube was found, and 0 otherwise. A cube is represented as an
+  array of bdd_literal (which are integers in {0, 1, 2}), where 0
+  represents negated literal, 1 for literal, and 2 for don't care.
+  Returns a prime and irredundant cover.  A third routine is there to
+  clean up.]
+
+  SideEffects []
+
+  SeeAlso [bdd_next_cube bdd_gen_free]
+
+******************************************************************************/
+bdd_gen *
+bdd_first_cube(bdd_t *fn, array_t **cube /* of bdd_literal */)
+{
+    DdManager *manager;
+    cu_bdd_gen *gen;
+    int i;
+    int *icube;
+
+    /* Make sure we receive a valid bdd_t. (So to speak.) */
+    assert(fn != 0);
+
+    manager = (DdManager *)fn->mgr;
+
+    /* Initialize the generator. */
+    gen = ALLOC(cu_bdd_gen,1);
+    if (gen == NULL) {
+      return(NIL(bdd_gen));
+    }
+    gen->manager = manager;
+
+    gen->cube = array_alloc(bdd_literal, manager->size);
+    if (gen->cube == NULL) {
+	fail("Bdd Package: Out of memory in bdd_first_cube");
+    }
+
+    gen->ddGen = Cudd_FirstPrime(manager,(DdNode *)fn->node,
+				 (DdNode *)fn->node,&icube);
+    if (gen->ddGen == NULL) {
+	fail("Cudd Package: Out of memory in bdd_first_cube");
+    }
+
+    if (!Cudd_IsGenEmpty(gen->ddGen)) {
+	/* Copy icube to the array_t cube. */
+	for (i = 0; i < manager->size; i++) {
+	    int myconst = icube[i];
+	    array_insert(bdd_literal, gen->cube, i, myconst);
+	}
+	*cube = gen->cube;
+    }
+
+    return(gen);
+
+} /* end of bdd_first_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gets the next cube on the generator. Returns {TRUE,
+  FALSE} when {more, no more}.]
+
+  SideEffects []
+
+  SeeAlso     [bdd_first_prime bdd_gen_free]
+
+******************************************************************************/
+boolean
+bdd_next_cube(bdd_gen *gen_, array_t **cube /* of bdd_literal */)
+{
+    cu_bdd_gen *gen;
+    int retval;
+    int *icube;
+    int i;
+
+    gen = (cu_bdd_gen *)gen_;
+
+    retval = Cudd_NextPrime(gen->ddGen,&icube);
+    if (!Cudd_IsGenEmpty(gen->ddGen)) {
+	/* Copy icube to the array_t cube. */
+	for (i = 0; i < gen->manager->size; i++) {
+	    int myconst = icube[i];
+	    array_insert(bdd_literal, gen->cube, i, myconst);
+	}
+	*cube = gen->cube;
+    }
+
+    return(retval);
+
+} /* end of bdd_next_cube */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gets the first node in the BDD and returns a generator.]
+
+  SideEffects []
+
+  SeeAlso [bdd_next_node]
+
+******************************************************************************/
+bdd_gen *
+bdd_first_node(bdd_t *fn, bdd_node **node /* return */)
+{
+    bdd_manager *manager;
+    cu_bdd_gen *gen;
+
+    /* Make sure we receive a valid bdd_t. (So to speak.) */
+    assert(fn != 0);
+
+    manager = fn->mgr;
+
+    /* Initialize the generator. */
+    gen = ALLOC(cu_bdd_gen,1);
+    if (gen == NULL) return(NULL);
+    gen->manager = (DdManager *) manager;
+    gen->cube = NULL;
+
+    gen->ddGen = Cudd_FirstNode((DdManager *)manager,(DdNode *)fn->node,
+				(DdNode **)node);
+    if (gen->ddGen == NULL) {
+	fail("Cudd Package: Out of memory in bdd_first_node");
+    }
+
+    return(gen);
+
+} /* end of bdd_first_node */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Gets the next node in the BDD. Returns {TRUE, FALSE} when
+  {more, no more}.]
+
+  SideEffects []
+
+  SeeAlso [bdd_first_node]
+
+******************************************************************************/
+boolean
+bdd_next_node(bdd_gen *gen, bdd_node **node /* return */)
+{
+    return(Cudd_NextNode(((cu_bdd_gen *)gen)->ddGen,(DdNode **)node));
+
+} /* end of bdd_next_node */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees up the space used by the generator. Returns an int
+  so that it is easier to fit in a foreach macro. Returns 0 (to make it
+  easy to put in expressions).]
+
+  SideEffects []
+
+  SeeAlso []
+
+******************************************************************************/
+int
+bdd_gen_free(bdd_gen *gen_)
+{
+    cu_bdd_gen *gen;
+
+    gen = (cu_bdd_gen *)gen_;
+    if (gen->cube != NULL) array_free(gen->cube);
+    Cudd_GenFree(gen->ddGen);
+    FREE(gen);
+    return(0);
+
+} /* end of bdd_gen_free */
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
Index: /vis_dev/glu-2.1/src/epd/epd.c
===================================================================
--- /vis_dev/glu-2.1/src/epd/epd.c	(revision 6)
+++ /vis_dev/glu-2.1/src/epd/epd.c	(revision 6)
@@ -0,0 +1,1344 @@
+/**CFile***********************************************************************
+
+  FileName    [epd.c]
+
+  PackageName [epd]
+
+  Synopsis    [Arithmetic functions with extended double precision.]
+
+  Description []
+
+  SeeAlso     []
+
+  Author      [In-Ho Moon]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+  Revision    [$Id: epd.c,v 1.10 2004/08/13 18:20:30 fabio Exp $]
+
+******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "util.h"
+#include "epd.h"
+
+
+/**Function********************************************************************
+
+  Synopsis    [Allocates an EpDouble struct.]
+
+  Description [Allocates an EpDouble struct.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+EpDouble *
+EpdAlloc(void)
+{
+  EpDouble	*epd;
+
+  epd = ALLOC(EpDouble, 1);
+  return(epd);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Compares two EpDouble struct.]
+
+  Description [Compares two EpDouble struct.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdCmp(const char *key1, const char *key2)
+{
+  EpDouble *epd1 = (EpDouble *) key1;
+  EpDouble *epd2 = (EpDouble *) key2;
+  if (epd1->type.value != epd2->type.value ||
+      epd1->exponent != epd2->exponent) {
+    return(1);
+  }
+  return(0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees an EpDouble struct.]
+
+  Description [Frees an EpDouble struct.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdFree(EpDouble *epd)
+{
+  FREE(epd);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts an arbitrary precision double value to a string.]
+
+  Description [Converts an arbitrary precision double value to a string.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdGetString(EpDouble *epd, char *str)
+{
+  double	value;
+  int		exponent;
+  char		*pos;
+
+  if (IsNanDouble(epd->type.value)) {
+    sprintf(str, "NaN");
+    return;
+  } else if (IsInfDouble(epd->type.value)) {
+    if (epd->type.bits.sign == 1)
+      sprintf(str, "-Inf");
+    else
+      sprintf(str, "Inf");
+    return;
+  }
+
+  assert(epd->type.bits.exponent == EPD_MAX_BIN ||
+	 epd->type.bits.exponent == 0);
+
+  EpdGetValueAndDecimalExponent(epd, &value, &exponent);
+  sprintf(str, "%e", value);
+  pos = strstr(str, "e");
+  if (exponent >= 0) {
+    if (exponent < 10)
+      sprintf(pos + 1, "+0%d", exponent);
+    else
+      sprintf(pos + 1, "+%d", exponent);
+  } else {
+    exponent *= -1;
+    if (exponent < 10)
+      sprintf(pos + 1, "-0%d", exponent);
+    else
+      sprintf(pos + 1, "-%d", exponent);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Converts double to EpDouble struct.]
+
+  Description [Converts double to EpDouble struct.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdConvert(double value, EpDouble *epd)
+{
+  epd->type.value = value;
+  epd->exponent = 0;
+  EpdNormalize(epd);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Multiplies two arbitrary precision double values.]
+
+  Description [Multiplies two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMultiply(EpDouble *epd1, double value)
+{
+  EpDouble	epd2;
+  double	tmp;
+  int		exponent;
+
+  if (EpdIsNan(epd1) || IsNanDouble(value)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || IsInfDouble(value)) {
+    int	sign;
+
+    EpdConvert(value, &epd2);
+    sign = epd1->type.bits.sign ^ epd2.type.bits.sign;
+    EpdMakeInf(epd1, sign);
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+
+  EpdConvert(value, &epd2);
+  tmp = epd1->type.value * epd2.type.value;
+  exponent = epd1->exponent + epd2.exponent;
+  epd1->type.value = tmp;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Multiplies two arbitrary precision double values.]
+
+  Description [Multiplies two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMultiply2(EpDouble *epd1, EpDouble *epd2)
+{
+  double	value;
+  int		exponent;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+    EpdMakeInf(epd1, sign);
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  value = epd1->type.value * epd2->type.value;
+  exponent = epd1->exponent + epd2->exponent;
+  epd1->type.value = value;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Multiplies two arbitrary precision double values.]
+
+  Description [Multiplies two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMultiply2Decimal(EpDouble *epd1, EpDouble *epd2)
+{
+  double	value;
+  int		exponent;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+    EpdMakeInf(epd1, sign);
+    return;
+  }
+
+  value = epd1->type.value * epd2->type.value;
+  exponent = epd1->exponent + epd2->exponent;
+  epd1->type.value = value;
+  epd1->exponent = exponent;
+  EpdNormalizeDecimal(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Multiplies two arbitrary precision double values.]
+
+  Description [Multiplies two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMultiply3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3)
+{
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+    EpdMakeInf(epd3, sign);
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  epd3->type.value = epd1->type.value * epd2->type.value;
+  epd3->exponent = epd1->exponent + epd2->exponent;
+  EpdNormalize(epd3);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Multiplies two arbitrary precision double values.]
+
+  Description [Multiplies two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMultiply3Decimal(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3)
+{
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+    EpdMakeInf(epd3, sign);
+    return;
+  }
+
+  epd3->type.value = epd1->type.value * epd2->type.value;
+  epd3->exponent = epd1->exponent + epd2->exponent;
+  EpdNormalizeDecimal(epd3);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Divides two arbitrary precision double values.]
+
+  Description [Divides two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdDivide(EpDouble *epd1, double value)
+{
+  EpDouble	epd2;
+  double	tmp;
+  int		exponent;
+
+  if (EpdIsNan(epd1) || IsNanDouble(value)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || IsInfDouble(value)) {
+    int	sign;
+
+    EpdConvert(value, &epd2);
+    if (EpdIsInf(epd1) && IsInfDouble(value)) {
+      EpdMakeNan(epd1);
+    } else if (EpdIsInf(epd1)) {
+      sign = epd1->type.bits.sign ^ epd2.type.bits.sign;
+      EpdMakeInf(epd1, sign);
+    } else {
+      sign = epd1->type.bits.sign ^ epd2.type.bits.sign;
+      EpdMakeZero(epd1, sign);
+    }
+    return;
+  }
+
+  if (value == 0.0) {
+    EpdMakeNan(epd1);
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+
+  EpdConvert(value, &epd2);
+  tmp = epd1->type.value / epd2.type.value;
+  exponent = epd1->exponent - epd2.exponent;
+  epd1->type.value = tmp;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Divides two arbitrary precision double values.]
+
+  Description [Divides two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdDivide2(EpDouble *epd1, EpDouble *epd2)
+{
+  double	value;
+  int		exponent;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    if (EpdIsInf(epd1) && EpdIsInf(epd2)) {
+      EpdMakeNan(epd1);
+    } else if (EpdIsInf(epd1)) {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      EpdMakeInf(epd1, sign);
+    } else {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      EpdMakeZero(epd1, sign);
+    }
+    return;
+  }
+
+  if (epd2->type.value == 0.0) {
+    EpdMakeNan(epd1);
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  value = epd1->type.value / epd2->type.value;
+  exponent = epd1->exponent - epd2->exponent;
+  epd1->type.value = value;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Divides two arbitrary precision double values.]
+
+  Description [Divides two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdDivide3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3)
+{
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd3);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    if (EpdIsInf(epd1) && EpdIsInf(epd2)) {
+      EpdMakeNan(epd3);
+    } else if (EpdIsInf(epd1)) {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      EpdMakeInf(epd3, sign);
+    } else {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      EpdMakeZero(epd3, sign);
+    }
+    return;
+  }
+
+  if (epd2->type.value == 0.0) {
+    EpdMakeNan(epd3);
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  epd3->type.value = epd1->type.value / epd2->type.value;
+  epd3->exponent = epd1->exponent - epd2->exponent;
+  EpdNormalize(epd3);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adds two arbitrary precision double values.]
+
+  Description [Adds two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdAdd(EpDouble *epd1, double value)
+{
+  EpDouble	epd2;
+  double	tmp;
+  int		exponent, diff;
+
+  if (EpdIsNan(epd1) || IsNanDouble(value)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || IsInfDouble(value)) {
+    int	sign;
+
+    EpdConvert(value, &epd2);
+    if (EpdIsInf(epd1) && IsInfDouble(value)) {
+      sign = epd1->type.bits.sign ^ epd2.type.bits.sign;
+      if (sign == 1)
+	EpdMakeNan(epd1);
+    } else if (EpdIsInf(&epd2)) {
+      EpdCopy(&epd2, epd1);
+    }
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+
+  EpdConvert(value, &epd2);
+  if (epd1->exponent > epd2.exponent) {
+    diff = epd1->exponent - epd2.exponent;
+    if (diff <= EPD_MAX_BIN)
+      tmp = epd1->type.value + epd2.type.value / pow((double)2.0, (double)diff);
+    else
+      tmp = epd1->type.value;
+    exponent = epd1->exponent;
+  } else if (epd1->exponent < epd2.exponent) {
+    diff = epd2.exponent - epd1->exponent;
+    if (diff <= EPD_MAX_BIN)
+      tmp = epd1->type.value / pow((double)2.0, (double)diff) + epd2.type.value;
+    else
+      tmp = epd2.type.value;
+    exponent = epd2.exponent;
+  } else {
+    tmp = epd1->type.value + epd2.type.value;
+    exponent = epd1->exponent;
+  }
+  epd1->type.value = tmp;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adds two arbitrary precision double values.]
+
+  Description [Adds two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdAdd2(EpDouble *epd1, EpDouble *epd2)
+{
+  double	value;
+  int		exponent, diff;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    if (EpdIsInf(epd1) && EpdIsInf(epd2)) {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      if (sign == 1)
+	EpdMakeNan(epd1);
+    } else if (EpdIsInf(epd2)) {
+      EpdCopy(epd2, epd1);
+    }
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  if (epd1->exponent > epd2->exponent) {
+    diff = epd1->exponent - epd2->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value +
+		epd2->type.value / pow((double)2.0, (double)diff);
+    } else
+      value = epd1->type.value;
+    exponent = epd1->exponent;
+  } else if (epd1->exponent < epd2->exponent) {
+    diff = epd2->exponent - epd1->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value / pow((double)2.0, (double)diff) +
+		epd2->type.value;
+    } else
+      value = epd2->type.value;
+    exponent = epd2->exponent;
+  } else {
+    value = epd1->type.value + epd2->type.value;
+    exponent = epd1->exponent;
+  }
+  epd1->type.value = value;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adds two arbitrary precision double values.]
+
+  Description [Adds two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdAdd3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3)
+{
+  double	value;
+  int		exponent, diff;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd3);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    if (EpdIsInf(epd1) && EpdIsInf(epd2)) {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      if (sign == 1)
+	EpdMakeNan(epd3);
+      else
+	EpdCopy(epd1, epd3);
+    } else if (EpdIsInf(epd1)) {
+      EpdCopy(epd1, epd3);
+    } else {
+      EpdCopy(epd2, epd3);
+    }
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  if (epd1->exponent > epd2->exponent) {
+    diff = epd1->exponent - epd2->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value +
+		epd2->type.value / pow((double)2.0, (double)diff);
+    } else
+      value = epd1->type.value;
+    exponent = epd1->exponent;
+  } else if (epd1->exponent < epd2->exponent) {
+    diff = epd2->exponent - epd1->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value / pow((double)2.0, (double)diff) +
+		epd2->type.value;
+    } else
+      value = epd2->type.value;
+    exponent = epd2->exponent;
+  } else {
+    value = epd1->type.value + epd2->type.value;
+    exponent = epd1->exponent;
+  }
+  epd3->type.value = value;
+  epd3->exponent = exponent;
+  EpdNormalize(epd3);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subtracts two arbitrary precision double values.]
+
+  Description [Subtracts two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdSubtract(EpDouble *epd1, double value)
+{
+  EpDouble	epd2;
+  double	tmp;
+  int		exponent, diff;
+
+  if (EpdIsNan(epd1) || IsNanDouble(value)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || IsInfDouble(value)) {
+    int	sign;
+
+    EpdConvert(value, &epd2);
+    if (EpdIsInf(epd1) && IsInfDouble(value)) {
+      sign = epd1->type.bits.sign ^ epd2.type.bits.sign;
+      if (sign == 0)
+	EpdMakeNan(epd1);
+    } else if (EpdIsInf(&epd2)) {
+      EpdCopy(&epd2, epd1);
+    }
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+
+  EpdConvert(value, &epd2);
+  if (epd1->exponent > epd2.exponent) {
+    diff = epd1->exponent - epd2.exponent;
+    if (diff <= EPD_MAX_BIN)
+      tmp = epd1->type.value - epd2.type.value / pow((double)2.0, (double)diff);
+    else
+      tmp = epd1->type.value;
+    exponent = epd1->exponent;
+  } else if (epd1->exponent < epd2.exponent) {
+    diff = epd2.exponent - epd1->exponent;
+    if (diff <= EPD_MAX_BIN)
+      tmp = epd1->type.value / pow((double)2.0, (double)diff) - epd2.type.value;
+    else
+      tmp = epd2.type.value * (double)(-1.0);
+    exponent = epd2.exponent;
+  } else {
+    tmp = epd1->type.value - epd2.type.value;
+    exponent = epd1->exponent;
+  }
+  epd1->type.value = tmp;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subtracts two arbitrary precision double values.]
+
+  Description [Subtracts two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdSubtract2(EpDouble *epd1, EpDouble *epd2)
+{
+  double	value;
+  int		exponent, diff;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd1);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    if (EpdIsInf(epd1) && EpdIsInf(epd2)) {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      if (sign == 0)
+	EpdMakeNan(epd1);
+    } else if (EpdIsInf(epd2)) {
+      EpdCopy(epd2, epd1);
+    }
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  if (epd1->exponent > epd2->exponent) {
+    diff = epd1->exponent - epd2->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value -
+		epd2->type.value / pow((double)2.0, (double)diff);
+    } else
+      value = epd1->type.value;
+    exponent = epd1->exponent;
+  } else if (epd1->exponent < epd2->exponent) {
+    diff = epd2->exponent - epd1->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value / pow((double)2.0, (double)diff) -
+		epd2->type.value;
+    } else
+      value = epd2->type.value * (double)(-1.0);
+    exponent = epd2->exponent;
+  } else {
+    value = epd1->type.value - epd2->type.value;
+    exponent = epd1->exponent;
+  }
+  epd1->type.value = value;
+  epd1->exponent = exponent;
+  EpdNormalize(epd1);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Subtracts two arbitrary precision double values.]
+
+  Description [Subtracts two arbitrary precision double values.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdSubtract3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3)
+{
+  double	value;
+  int		exponent, diff;
+
+  if (EpdIsNan(epd1) || EpdIsNan(epd2)) {
+    EpdMakeNan(epd3);
+    return;
+  } else if (EpdIsInf(epd1) || EpdIsInf(epd2)) {
+    int	sign;
+
+    if (EpdIsInf(epd1) && EpdIsInf(epd2)) {
+      sign = epd1->type.bits.sign ^ epd2->type.bits.sign;
+      if (sign == 0)
+	EpdCopy(epd1, epd3);
+      else
+	EpdMakeNan(epd3);
+    } else if (EpdIsInf(epd1)) {
+      EpdCopy(epd1, epd1);
+    } else {
+      sign = epd2->type.bits.sign ^ 0x1;
+      EpdMakeInf(epd3, sign);
+    }
+    return;
+  }
+
+  assert(epd1->type.bits.exponent == EPD_MAX_BIN);
+  assert(epd2->type.bits.exponent == EPD_MAX_BIN);
+
+  if (epd1->exponent > epd2->exponent) {
+    diff = epd1->exponent - epd2->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value -
+		epd2->type.value / pow((double)2.0, (double)diff);
+    } else
+      value = epd1->type.value;
+    exponent = epd1->exponent;
+  } else if (epd1->exponent < epd2->exponent) {
+    diff = epd2->exponent - epd1->exponent;
+    if (diff <= EPD_MAX_BIN) {
+      value = epd1->type.value / pow((double)2.0, (double)diff) -
+		epd2->type.value;
+    } else
+      value = epd2->type.value * (double)(-1.0);
+    exponent = epd2->exponent;
+  } else {
+    value = epd1->type.value - epd2->type.value;
+    exponent = epd1->exponent;
+  }
+  epd3->type.value = value;
+  epd3->exponent = exponent;
+  EpdNormalize(epd3);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes arbitrary precision pow of base 2.]
+
+  Description [Computes arbitrary precision pow of base 2.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdPow2(int n, EpDouble *epd)
+{
+  if (n <= EPD_MAX_BIN) {
+    EpdConvert(pow((double)2.0, (double)n), epd);
+  } else {
+    EpDouble	epd1, epd2;
+    int		n1, n2;
+
+    n1 = n / 2;
+    n2 = n - n1;
+    EpdPow2(n1, &epd1);
+    EpdPow2(n2, &epd2);
+    EpdMultiply3(&epd1, &epd2, epd);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Computes arbitrary precision pow of base 2.]
+
+  Description [Computes arbitrary precision pow of base 2.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdPow2Decimal(int n, EpDouble *epd)
+{
+  if (n <= EPD_MAX_BIN) {
+    epd->type.value = pow((double)2.0, (double)n);
+    epd->exponent = 0;
+    EpdNormalizeDecimal(epd);
+  } else {
+    EpDouble	epd1, epd2;
+    int		n1, n2;
+
+    n1 = n / 2;
+    n2 = n - n1;
+    EpdPow2Decimal(n1, &epd1);
+    EpdPow2Decimal(n2, &epd2);
+    EpdMultiply3Decimal(&epd1, &epd2, epd);
+  }
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Normalize an arbitrary precision double value.]
+
+  Description [Normalize an arbitrary precision double value.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdNormalize(EpDouble *epd)
+{
+  int		exponent;
+
+  if (IsNanOrInfDouble(epd->type.value)) {
+    epd->exponent = 0;
+    return;
+  }
+
+  exponent = EpdGetExponent(epd->type.value);
+  if (exponent == EPD_MAX_BIN)
+    return;
+  exponent -= EPD_MAX_BIN;
+  epd->type.bits.exponent = EPD_MAX_BIN;
+  epd->exponent += exponent;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Normalize an arbitrary precision double value.]
+
+  Description [Normalize an arbitrary precision double value.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdNormalizeDecimal(EpDouble *epd)
+{
+  int		exponent;
+
+  if (IsNanOrInfDouble(epd->type.value)) {
+    epd->exponent = 0;
+    return;
+  }
+
+  exponent = EpdGetExponentDecimal(epd->type.value);
+  epd->type.value /= pow((double)10.0, (double)exponent);
+  epd->exponent += exponent;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns value and decimal exponent of EpDouble.]
+
+  Description [Returns value and decimal exponent of EpDouble.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdGetValueAndDecimalExponent(EpDouble *epd, double *value, int *exponent)
+{
+  EpDouble	epd1, epd2;
+
+  if (EpdIsNanOrInf(epd))
+    return;
+
+  if (EpdIsZero(epd)) {
+    *value = 0.0;
+    *exponent = 0;
+    return;
+  }
+
+  epd1.type.value = epd->type.value;
+  epd1.exponent = 0;
+  EpdPow2Decimal(epd->exponent, &epd2);
+  EpdMultiply2Decimal(&epd1, &epd2);
+
+  *value = epd1.type.value;
+  *exponent = epd1.exponent;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the exponent value of a double.]
+
+  Description [Returns the exponent value of a double.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdGetExponent(double value)
+{
+  int		exponent;
+  EpDouble	epd;
+
+  epd.type.value = value;
+  exponent = epd.type.bits.exponent;
+  return(exponent);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the decimal exponent value of a double.]
+
+  Description [Returns the decimal exponent value of a double.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdGetExponentDecimal(double value)
+{
+  char	*pos, str[24];
+  int	exponent;
+
+  sprintf(str, "%E", value);
+  pos = strstr(str, "E");
+  sscanf(pos, "E%d", &exponent);
+  return(exponent);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes EpDouble Inf.]
+
+  Description [Makes EpDouble Inf.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMakeInf(EpDouble *epd, int sign)
+{
+  epd->type.bits.mantissa1 = 0;
+  epd->type.bits.mantissa0 = 0;
+  epd->type.bits.exponent = EPD_EXP_INF;
+  epd->type.bits.sign = sign;
+  epd->exponent = 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes EpDouble Zero.]
+
+  Description [Makes EpDouble Zero.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMakeZero(EpDouble *epd, int sign)
+{
+  epd->type.bits.mantissa1 = 0;
+  epd->type.bits.mantissa0 = 0;
+  epd->type.bits.exponent = 0;
+  epd->type.bits.sign = sign;
+  epd->exponent = 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes EpDouble NaN.]
+
+  Description [Makes EpDouble NaN.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdMakeNan(EpDouble *epd)
+{
+  epd->type.nan.mantissa1 = 0;
+  epd->type.nan.mantissa0 = 0;
+  epd->type.nan.quiet_bit = 1;
+  epd->type.nan.exponent = EPD_EXP_INF;
+  epd->type.nan.sign = 1;
+  epd->exponent = 0;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Copies a EpDouble struct.]
+
+  Description [Copies a EpDouble struct.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+EpdCopy(EpDouble *from, EpDouble *to)
+{
+  to->type.value = from->type.value;
+  to->exponent = from->exponent;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is Inf.]
+
+  Description [Checks whether the value is Inf.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdIsInf(EpDouble *epd)
+{
+  return(IsInfDouble(epd->type.value));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is Zero.]
+
+  Description [Checks whether the value is Zero.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdIsZero(EpDouble *epd)
+{
+  if (epd->type.value == 0.0)
+    return(1);
+  else
+    return(0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is NaN.]
+
+  Description [Checks whether the value is NaN.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdIsNan(EpDouble *epd)
+{
+  return(IsNanDouble(epd->type.value));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is NaN or Inf.]
+
+  Description [Checks whether the value is NaN or Inf.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+EpdIsNanOrInf(EpDouble *epd)
+{
+  return(IsNanOrInfDouble(epd->type.value));
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is Inf.]
+
+  Description [Checks whether the value is Inf.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+IsInfDouble(double value)
+{
+  EpType val;
+
+  val.value = value;
+  if (val.bits.exponent == EPD_EXP_INF &&
+      val.bits.mantissa0 == 0 &&
+      val.bits.mantissa1 == 0) {
+    if (val.bits.sign == 0)
+      return(1);
+    else
+      return(-1);
+  }
+  return(0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is NaN.]
+
+  Description [Checks whether the value is NaN.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+IsNanDouble(double value)
+{
+  EpType	val;
+  
+  val.value = value;
+  if (val.nan.exponent == EPD_EXP_INF &&
+      val.nan.sign == 1 &&
+      val.nan.quiet_bit == 1 &&
+      val.nan.mantissa0 == 0 &&
+      val.nan.mantissa1 == 0) {
+    return(1);
+  }
+  return(0);
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Checks whether the value is NaN or Inf.]
+
+  Description [Checks whether the value is NaN or Inf.]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+IsNanOrInfDouble(double value)
+{
+  EpType	val;
+
+  val.value = value;
+  if (val.nan.exponent == EPD_EXP_INF &&
+      val.nan.mantissa0 == 0 &&
+      val.nan.mantissa1 == 0 &&
+      (val.nan.sign == 1 || val.nan.quiet_bit == 0)) {
+    return(1);
+  }
+  return(0);
+}
Index: /vis_dev/glu-2.1/src/epd/epd.h
===================================================================
--- /vis_dev/glu-2.1/src/epd/epd.h	(revision 6)
+++ /vis_dev/glu-2.1/src/epd/epd.h	(revision 6)
@@ -0,0 +1,200 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [epd.h]
+
+  PackageName [epd]
+
+  Synopsis    [The University of Colorado extended double precision package.]
+
+  Description [arithmetic functions with extended double precision.]
+
+  SeeAlso     []
+
+  Author      [In-Ho Moon]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+  Revision    [$Id: epd.h,v 1.9 2004/08/13 18:20:30 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _EPD
+#define _EPD
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#define	EPD_MAX_BIN	1023
+#define	EPD_MAX_DEC	308
+#define	EPD_EXP_INF	0x7ff
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+/**Struct**********************************************************************
+
+  Synopsis    [IEEE double struct.]
+
+  Description [IEEE double struct.]
+
+  SeeAlso     []
+
+******************************************************************************/
+#ifdef	EPD_BIG_ENDIAN
+struct IeeeDoubleStruct {	/* BIG_ENDIAN */
+  unsigned int sign: 1;
+  unsigned int exponent: 11;
+  unsigned int mantissa0: 20;
+  unsigned int mantissa1: 32;
+};
+#else
+struct IeeeDoubleStruct {	/* LITTLE_ENDIAN */
+  unsigned int mantissa1: 32;
+  unsigned int mantissa0: 20;
+  unsigned int exponent: 11;
+  unsigned int sign: 1;
+};
+#endif
+
+/**Struct**********************************************************************
+
+  Synopsis    [IEEE double NaN struct.]
+
+  Description [IEEE double NaN struct.]
+
+  SeeAlso     []
+
+******************************************************************************/
+#ifdef	EPD_BIG_ENDIAN
+struct IeeeNanStruct {	/* BIG_ENDIAN */
+  unsigned int sign: 1;
+  unsigned int exponent: 11;
+  unsigned int quiet_bit: 1;
+  unsigned int mantissa0: 19;
+  unsigned int mantissa1: 32;
+};
+#else
+struct IeeeNanStruct {	/* LITTLE_ENDIAN */
+  unsigned int mantissa1: 32;
+  unsigned int mantissa0: 19;
+  unsigned int quiet_bit: 1;
+  unsigned int exponent: 11;
+  unsigned int sign: 1;
+};
+#endif
+
+/**Struct**********************************************************************
+
+  Synopsis    [Extended precision double to keep very large value.]
+
+  Description [Extended precision double to keep very large value.]
+
+  SeeAlso     []
+
+******************************************************************************/
+union EpTypeUnion {
+  double			value;
+  struct IeeeDoubleStruct	bits;
+  struct IeeeNanStruct		nan;
+};
+
+struct EpDoubleStruct {
+  union EpTypeUnion		type;
+  int				exponent;
+};
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+typedef struct EpDoubleStruct EpDouble;
+typedef struct IeeeDoubleStruct IeeeDouble;
+typedef struct IeeeNanStruct IeeeNan;
+typedef union EpTypeUnion EpType;
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+extern EpDouble *EpdAlloc(void);
+extern int EpdCmp(const char *key1, const char *key2);
+extern void EpdFree(EpDouble *epd);
+extern void EpdGetString(EpDouble *epd, char *str);
+extern void EpdConvert(double value, EpDouble *epd);
+extern void EpdMultiply(EpDouble *epd1, double value);
+extern void EpdMultiply2(EpDouble *epd1, EpDouble *epd2);
+extern void EpdMultiply2Decimal(EpDouble *epd1, EpDouble *epd2);
+extern void EpdMultiply3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
+extern void EpdMultiply3Decimal(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
+extern void EpdDivide(EpDouble *epd1, double value);
+extern void EpdDivide2(EpDouble *epd1, EpDouble *epd2);
+extern void EpdDivide3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
+extern void EpdAdd(EpDouble *epd1, double value);
+extern void EpdAdd2(EpDouble *epd1, EpDouble *epd2);
+extern void EpdAdd3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
+extern void EpdSubtract(EpDouble *epd1, double value);
+extern void EpdSubtract2(EpDouble *epd1, EpDouble *epd2);
+extern void EpdSubtract3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
+extern void EpdPow2(int n, EpDouble *epd);
+extern void EpdPow2Decimal(int n, EpDouble *epd);
+extern void EpdNormalize(EpDouble *epd);
+extern void EpdNormalizeDecimal(EpDouble *epd);
+extern void EpdGetValueAndDecimalExponent(EpDouble *epd, double *value, int *exponent);
+extern int EpdGetExponent(double value);
+extern int EpdGetExponentDecimal(double value);
+extern void EpdMakeInf(EpDouble *epd, int sign);
+extern void EpdMakeZero(EpDouble *epd, int sign);
+extern void EpdMakeNan(EpDouble *epd);
+extern void EpdCopy(EpDouble *from, EpDouble *to);
+extern int EpdIsInf(EpDouble *epd);
+extern int EpdIsZero(EpDouble *epd);
+extern int EpdIsNan(EpDouble *epd);
+extern int EpdIsNanOrInf(EpDouble *epd);
+extern int IsInfDouble(double value);
+extern int IsNanDouble(double value);
+extern int IsNanOrInfDouble(double value);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EPD */
Index: /vis_dev/glu-2.1/src/epd/epd.make
===================================================================
--- /vis_dev/glu-2.1/src/epd/epd.make	(revision 6)
+++ /vis_dev/glu-2.1/src/epd/epd.make	(revision 6)
@@ -0,0 +1,4 @@
+CSRC += epd.c
+HEADERS += epd.h
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/error/error.c
===================================================================
--- /vis_dev/glu-2.1/src/error/error.c	(revision 6)
+++ /vis_dev/glu-2.1/src/error/error.c	(revision 6)
@@ -0,0 +1,54 @@
+/*
+ * $Id: error.c,v 1.4 2002/09/09 23:55:44 fabio Exp $
+ *
+ */
+#include "util.h"
+#include "error.h"
+
+static char *error_str = 0;
+static int error_str_len, error_str_maxlen;
+
+
+void
+error_init(void)
+{
+    if (error_str != 0) {
+	FREE(error_str);
+    }
+    error_str_len = 0;
+    error_str_maxlen = 100;
+    error_str = ALLOC(char, error_str_maxlen);
+    *error_str = '\0';
+}
+
+
+void
+error_append(char *s)
+{
+    int slen;
+
+    slen = strlen(s);
+    if (error_str_len + slen + 1 > error_str_maxlen) {
+	error_str_maxlen = (error_str_len + slen) * 2;	/* cstevens@ic */
+	error_str = REALLOC(char, error_str, error_str_maxlen);
+    }
+    (void) strcpy(error_str + error_str_len, s);
+    error_str_len += slen;
+}
+
+
+char *
+error_string(void)
+{
+    return error_str;
+}
+
+
+void
+error_cleanup(void)
+{
+    FREE(error_str);
+    error_str_len = 0;
+    error_str_maxlen = 0;
+    error_str = 0;
+}
Index: /vis_dev/glu-2.1/src/error/error.h
===================================================================
--- /vis_dev/glu-2.1/src/error/error.h	(revision 6)
+++ /vis_dev/glu-2.1/src/error/error.h	(revision 6)
@@ -0,0 +1,8 @@
+/*
+ * $Id: error.h,v 1.2 2002/08/26 05:47:09 fabio Exp $
+ *
+ */
+EXTERN void error_init ARGS((void));
+EXTERN void error_append ARGS((char *));
+EXTERN char *error_string ARGS((void));
+EXTERN void error_cleanup ARGS((void));
Index: /vis_dev/glu-2.1/src/error/error.make
===================================================================
--- /vis_dev/glu-2.1/src/error/error.make	(revision 6)
+++ /vis_dev/glu-2.1/src/error/error.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += error.c
+HEADERS += error.h
+MISC += error.doc
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/graph/com_graph.c
===================================================================
--- /vis_dev/glu-2.1/src/graph/com_graph.c	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/com_graph.c	(revision 6)
@@ -0,0 +1,236 @@
+#include "util.h"
+#include "list.h"
+#include "array.h"
+#include "graph.h"
+#include "graph_static.h"
+
+
+static char *month[] = {"Jan", "Feb", "March", "april", "may", "June",
+    "july", "Aug", "Sept", "Oct", "nov", "Dec"
+};
+
+#define voidNULL	(void (*)()) NULL
+#define gGenericNULL	(gGeneric (*)()) NULL
+
+static void
+strfree(thing)
+gGeneric thing;
+{
+    FREE(thing);
+}
+
+static int
+graph_test()
+{
+    graph_t *g1, *g2;
+    int i, j;
+    vertex_t *v[10];
+    lsGen gen, gen2;
+    vertex_t *vert;
+    edge_t *edge;
+
+    g1 = g_alloc();
+
+    for (i = 0; i < 10; i++) {
+        v[i] = g_add_vertex(g1);
+	v[i]->user_data = (gGeneric) i;
+    }
+    for (i = 0; i < 9; i++) {
+        for (j = i + 1; j < 10; j++) {
+	    (void) g_add_edge(v[i],v[j]);
+	}
+    }
+    (void) g_add_edge(v[5],v[5]);			/* self loop */
+
+    (void) lsFirstItem(g_get_out_edges(v[4]),(lsGeneric *) &edge,LS_NH);
+    g_delete_edge(edge,voidNULL);
+
+    g_delete_vertex(v[8],voidNULL,voidNULL);
+        
+    g_add_vertex(g1)->user_data = (gGeneric) 10;  /* unconnected vertex */
+
+    g2 = g_dup(g1,gGenericNULL,gGenericNULL,gGenericNULL);
+    foreach_vertex (g2,gen,vert) {
+        (void) fprintf(stdout,"\nCopy of %d\ngoes to:    ",vert->user_data);
+        foreach_out_edge (vert,gen2,edge) {
+	    (void) fprintf(stdout,"%d ",g_e_dest(edge)->user_data);
+	}
+	(void) fprintf(stdout,"\ncomes from: ");
+	foreach_in_edge (vert,gen2,edge) {
+	    (void) fprintf(stdout,"%d ",g_e_source(edge)->user_data);
+	}
+    }
+    (void) fputc('\n',stdout);
+    g_check(g1);
+    g_check(g2);
+    g_free(g1,voidNULL,voidNULL,voidNULL);
+    g_free(g2,voidNULL,voidNULL,voidNULL);
+
+    g1 = g_alloc();
+    for (i = 0; i < 12; i++) {
+        g_add_vertex(g1)->user_data = (gGeneric) month[i];
+    }
+    g2 = g_dup(g1,gGenericNULL,(gGeneric (*)()) util_strsav,gGenericNULL);
+    foreach_vertex (g1,gen,vert) {
+        ((char *) vert->user_data)[0] = '\0';
+    }
+    foreach_vertex (g2,gen,vert) {		/* strings copied by strsav */
+        (void) fprintf(stdout, "%s\n", (char *) vert->user_data);
+    }
+    g_free(g1, voidNULL, voidNULL, voidNULL); /* don't free static strings */
+    g_free(g2, voidNULL, strfree, voidNULL); /* free copies */
+    return(0);
+}
+
+static void
+edge_free(thing)
+gGeneric thing;
+{
+    FREE(((gGeneric *) thing)[2]);
+}
+
+static gGeneric
+edge_copy(thing)
+gGeneric thing;
+{
+    gGeneric *new = ALLOC(gGeneric,4);
+    gGeneric *old = (gGeneric *) thing;
+
+    new[0] = old[0];
+    new[1] = old[1];
+    new[2] = (gGeneric) util_strsav((char *) old[2]);
+    new[3] = old[3];
+    return((gGeneric) new);
+}
+
+
+static int
+graph_static_test()
+{
+    graph_t *g1, *g2;
+    int i,j,x;
+    vertex_t *v[10], *v1, *v2;
+    edge_t *e, *edge;
+    lsGen gen;
+
+    g1 = g_alloc_static(3,2,4);
+
+    for (i = 0; i < 10; i++) {
+        v[i] = g_add_vertex_static(g1);
+	g_set_v_slot_static(v[i],0,(gGeneric) i);
+	g_set_v_slot_static(v[i],1,(gGeneric) (2 * i));
+    }
+    x = 0;
+    for (i = 0; i < 9; i++) {
+        for (j = i + 1; j < 10; j++) {
+	    e = g_add_edge_static(v[i],v[j]);
+	    g_set_e_slot_static(e,2,(gGeneric) util_strsav(month[i]));
+	    g_set_e_slot_static(e,1,(gGeneric) x++);
+	}
+    }
+    g_delete_vertex_static(v[3],voidNULL,edge_free);	/* kill v[3] */
+    (void) lsLastItem(g_get_out_edges(v[6]),(lsGeneric *) &edge,LS_NH); 
+    g_delete_edge_static(edge,edge_free);	/* kill last edge of v[6] */
+
+    g_set_g_slot_static(g1,1,(gGeneric) 'f');
+    g2 = g_dup_static(g1,gGenericNULL,gGenericNULL,edge_copy);
+
+    v1 = g_add_vertex_static(g2);
+    g_copy_v_slots_static(v[2],v1,gGenericNULL);
+
+    foreach_edge (g2,gen,edge) {
+        v1 = g_e_source(edge);
+	v2 = g_e_dest(edge);
+        (void) fprintf(stdout,
+		"%d (%s) connects %d & %d\n",g_get_e_slot_static(edge,1),
+		g_get_e_slot_static(edge,2),g_get_v_slot_static(v1,0),
+		g_get_v_slot_static(v2,0));
+    }
+    g_free_static(g1,voidNULL,voidNULL,edge_free);
+    g_free_static(g2,voidNULL,voidNULL,edge_free);
+    return(0);
+}
+
+static int
+reverso(a,b)
+char *a,*b;
+{
+    return((int) ((vertex_t *) b)->user_data - (int) ((vertex_t *) a)->user_data);
+}
+
+static int
+graph_dfs_test()
+{
+    int i;
+    vertex_t *v[10];
+    array_t *arr;
+    graph_t *g;
+    vertex_t *x;
+    
+    g = g_alloc();
+    for (i = 0; i < 10; i++) {
+        v[i] = g_add_vertex(g);
+	v[i]->user_data = (gGeneric) i;
+    }
+    (void) g_add_edge(v[3],v[4]);
+    (void) g_add_edge(v[0],v[3]);
+    (void) g_add_edge(v[0],v[6]);
+    (void) g_add_edge(v[0],v[2]);
+    (void) g_add_edge(v[1],v[3]);
+    (void) g_add_edge(v[6],v[3]);
+    (void) g_add_edge(v[2],v[5]);
+    (void) g_add_edge(v[2],v[3]);
+    (void) g_add_edge(v[3],v[5]);
+    (void) g_add_edge(v[6],v[2]);
+
+    (void) g_add_edge(v[7],v[8]);
+    (void) g_add_edge(v[9],v[7]);
+    (void) g_add_edge(v[9],v[8]);
+    arr = g_dfs(g);
+    (void) fprintf(stdout,"Depth first sort\n");
+    for (i = 0; i < 10; i++) {
+        x = array_fetch(vertex_t *,arr,i);
+        (void) fprintf(stdout,"%d\n",x->user_data);
+    }
+    array_free(arr);
+    (void) fprintf(stdout,"\nReverse sort\n");
+    arr = g_graph_sort(g,reverso);
+    for (i = 0; i < 10; i++) {
+        x = array_fetch(vertex_t *,arr,i);
+        (void) fprintf(stdout,"%d\n",x->user_data);
+    }
+    array_free(arr);
+    g_free(g,voidNULL,voidNULL,voidNULL);
+    return(0);
+}
+
+init_graph()
+{
+    extern int g_unique_id;
+
+    g_unique_id = 0;
+    com_add_command("_graph_test",graph_test,0);
+    com_add_command("_graph_static_test",graph_static_test,0);
+    com_add_command("_graph_dfs_test",graph_dfs_test,0);
+}
+
+end_graph()
+{
+}
+
+/*
+
+       ______     1
+      /      \	 /
+     /	      v v 
+     |	0 ---> 3 ----> 4	9 --> 8
+     |	| \    ^\		|    ^
+     |	|  \   | \		|   /
+     |	|   \  |  \		|  /
+      \	|    \ |   \		| /
+       \v     v|    v		v/
+      	6 ---> 2 --> 5		7
+
+  This is the graph represented in test_graph_dfs
+*/
+
Index: /vis_dev/glu-2.1/src/graph/graph.c
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph.c	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph.c	(revision 6)
@@ -0,0 +1,390 @@
+/*
+ * $Id: graph.c,v 1.6 2005/04/15 23:24:21 fabio Exp $
+ */
+
+#include "graph_int.h"
+
+int g_unique_id;
+
+graph_t *
+g_alloc(void)
+{
+    graph_t_int *graph = ALLOC(graph_t_int,1);
+    
+    graph->user_data = (gGeneric) NULL;
+    graph->v_list = lsCreate();
+    graph->e_list = lsCreate();
+
+    return((graph_t *) graph);
+}
+
+void
+g_free(
+  graph_t *g,
+  void (*f_free_g)(gGeneric),
+  void (*f_free_v)(gGeneric),
+  void (*f_free_e)(gGeneric))
+{
+    lsGen gen;
+    vertex_t *v;
+    edge_t *e;
+
+    if (g == NIL(graph_t)) {
+        return;
+    }
+    if (f_free_g != (void (*)(gGeneric)) NULL) {
+        (*f_free_g)(g->user_data);
+    }
+    foreach_vertex (g,gen,v) {
+        if (f_free_v != (void (*)(gGeneric)) NULL) {
+	    (*f_free_v)(v->user_data);
+	}
+	(void) lsDestroy(g_get_in_edges(v),(void (*)(lsGeneric)) NULL);
+	(void) lsDestroy(g_get_out_edges(v),(void (*)(lsGeneric)) NULL);
+	FREE(v);
+    }
+    foreach_edge (g,gen,e) {
+        if (f_free_e != (void (*)(gGeneric)) NULL) {
+	    (*f_free_e)(e->user_data);
+	}
+	FREE(e);
+    }
+    (void) lsDestroy(g_get_vertices(g),(void (*)(lsGeneric)) NULL);
+    (void) lsDestroy(g_get_edges(g),(void (*)(lsGeneric)) NULL);
+    FREE(g);
+}
+
+void
+g_check(graph_t *g)
+{
+    vertex_t *v, *source, *dest;
+    edge_t *e, *test;
+    lsGen gen, gen2;
+    int found;
+
+    if (g == NIL(graph_t)) {
+        return;
+    }
+    foreach_edge (g,gen,e) {
+        source = g_e_source(e);
+	dest = g_e_dest(e);
+        if (source == NIL(vertex_t)) {
+	    fail("g_check: Edge has no source");
+	}
+	if (dest == NIL(vertex_t)) {
+	    fail("g_check: Edge has no destination");
+	}
+	if (g_vertex_graph(source) != g_vertex_graph(dest)) {
+	    fail("g_check: Edge connects different graphs");
+	}
+	found = FALSE;
+	foreach_out_edge (source,gen2,test) {
+	    if (test == e) {
+	        found = TRUE;
+		(void) lsFinish(gen2);
+		break;
+	    }
+	}
+	if (found == FALSE) {
+	    fail("g_check: Vertex does not point back to edge");
+	}
+	found = FALSE;
+	foreach_in_edge (dest,gen2,test) {
+	    if (test == e) {
+	        found = TRUE;
+		(void) lsFinish(gen2);
+		break;
+	    }
+	}
+	if (found == FALSE) {
+	    fail("g_check: Vertex does not point back to edge");
+	}
+    }
+    foreach_vertex (g,gen,v) {
+        if (g_vertex_graph(v) != g) {
+	    fail("g_check: Vertex not a member of graph");
+	}
+        if (lsLength(g_get_in_edges(v)) + lsLength(g_get_out_edges(v)) == 0) {
+	    (void) fprintf(stderr,"Warning: g_check: Unconnected vertex\n");
+	    continue;
+	}
+	foreach_in_edge(v,gen2,test) {
+	    if (g_e_dest(test) != v) {
+	        fail("g_check: Edge does not point back to vertex");
+	    }
+	}
+	foreach_out_edge(v,gen2,test) {
+	    if (g_e_source(test) != v) {
+	        fail("g_check: Edge does not point back to vertex");
+	    }
+	}
+    }
+}
+
+graph_t *
+g_dup(
+  graph_t *g,
+  gGeneric (*f_copy_g)(gGeneric),
+  gGeneric (*f_copy_v)(gGeneric),
+  gGeneric (*f_copy_e)(gGeneric))
+{
+    graph_t *newg;
+    vertex_t *v, *new_v, *from, *to;
+    edge_t *e, *new_e;
+    st_table *ptrtable = st_init_table(st_ptrcmp,st_ptrhash);
+    lsGen gen;
+
+    newg = g_alloc();
+    if (g == NIL(graph_t)) {
+        return(newg);
+    }
+
+    if (f_copy_g == (gGeneric (*)(gGeneric)) NULL) {
+        newg->user_data = g->user_data;
+    }
+    else {
+        newg->user_data = (*f_copy_g)(g->user_data);
+    }
+    foreach_vertex (g,gen,v) {
+        new_v = g_add_vertex(newg);
+	if (f_copy_v == (gGeneric (*)(gGeneric)) NULL) {
+	    new_v->user_data = v->user_data;
+	}
+	else {
+	    new_v->user_data = (*f_copy_v)(v->user_data);
+	}
+	(void) st_insert(ptrtable,(char *) v,(char *) new_v);
+    }
+    foreach_edge (g,gen,e) {
+        (void) st_lookup(ptrtable,g_e_source(e),&from);
+	(void) st_lookup(ptrtable,g_e_dest(e),&to);
+	new_e = g_add_edge(from,to);
+	if (f_copy_e == (gGeneric (*)(gGeneric)) NULL) {
+	    new_e->user_data = e->user_data;
+	}
+	else {
+	    new_e->user_data = (*f_copy_e)(e->user_data);
+	}
+    }
+    st_free_table(ptrtable);
+    return(newg);
+}
+
+array_t *
+g_graph_sort(graph_t *g, int (*cmp)(const void *, const void *))
+{
+    int i;
+    lsGen gen;
+    vertex_t *v;
+    array_t *v_array;
+
+    i = 0;
+    v_array = array_alloc(vertex_t *,0);
+
+    foreach_vertex (g,gen,v) {
+        array_insert(vertex_t *,v_array,i++,v);
+    }
+    array_sort(v_array,cmp);
+    return(v_array);
+}
+
+lsList
+g_get_edges(graph_t *g)
+{
+    if (g == NIL(graph_t)) {
+        fail("g_get_edges: Null graph");
+    }
+    return(((graph_t_int *) g)->e_list);
+}
+
+lsList
+g_get_in_edges(vertex_t *v)
+{
+    if (v == NIL(vertex_t)) {
+        fail("g_get_in_edges: Null vertex");
+    }
+    return(((vertex_t_int *) v)->in_list);
+}
+
+lsList
+g_get_out_edges(vertex_t *v)
+{
+    if (v == NIL(vertex_t)) {
+        fail("g_get_out_edges: Null vertex");
+    }
+    return(((vertex_t_int *) v)->out_list);
+}
+
+edge_t *
+g_add_edge(vertex_t *v1, vertex_t *v2)
+{
+    edge_t_int *edge;
+    lsHandle handle;
+    graph_t *g;
+
+    if (v1 == NIL(vertex_t) || v2 == NIL(vertex_t)) {
+        fail("g_add_edge: Null vertex");
+    }
+    g = g_vertex_graph(v1);
+    if (g != g_vertex_graph(v2)) {
+        fail("g_add_edge: Edge connects different graphs");
+    }
+    edge = ALLOC(edge_t_int,1);
+    (void) lsNewEnd(g_get_edges(g),(lsGeneric) edge,&handle);
+    edge->user_data = (gGeneric) NULL;
+    edge->from = (vertex_t_int *) v1;
+    edge->to = (vertex_t_int *) v2;
+    edge->id = g_unique_id++;
+    edge->handle = handle;
+    (void) lsNewEnd(g_get_out_edges(v1),(lsGeneric) edge,LS_NH);
+    (void) lsNewEnd(g_get_in_edges(v2),(lsGeneric) edge,LS_NH);
+
+    return((edge_t *) edge);
+}
+
+static void
+g_del_from_list(lsList list, lsGeneric item)
+{
+    lsGen gen;
+    lsGeneric looking,dummy;
+    lsHandle handle;
+
+    gen = lsStart(list);
+    while (lsNext(gen,&looking,&handle) != LS_NOMORE) {
+        if (item == looking) {
+	    if (lsRemoveItem(handle,&dummy) != LS_OK) {
+	        fail("g_del_from_list: Can't remove edge");
+	    }
+	    break;
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+void
+g_delete_edge(edge_t *e, void (*f_free_e)(gGeneric))
+{
+    lsGeneric junk;
+
+    if (e == NIL(edge_t)) {
+        fail("g_delete_edge: Null edge");
+    }
+    g_del_from_list(g_get_out_edges(g_e_source(e)),(lsGeneric) e);
+    g_del_from_list(g_get_in_edges(g_e_dest(e)),(lsGeneric) e);
+
+    (void) lsRemoveItem(((edge_t_int *) e)->handle,&junk);
+    if (f_free_e != (void (*)(gGeneric)) NULL) {
+        (*f_free_e)(e->user_data);
+    }
+    FREE(e);
+}
+
+graph_t *
+g_edge_graph(edge_t *e)
+{
+    if (e == NIL(edge_t)) {
+        fail("g_edge_graph: Null edge");
+    }
+    return((graph_t *) (((edge_t_int *) e)->to->g));
+}
+
+vertex_t *
+g_e_source(edge_t *e)
+{
+    if (e == NIL(edge_t)) {
+        fail("g_e_source: Null edge");
+    }
+    return((vertex_t *) (((edge_t_int *) e)->from));
+}
+
+vertex_t *
+g_e_dest(edge_t *e)
+{
+    if (e == NIL(edge_t)) {
+        fail("g_e_dest: Null edge");
+    }
+    return((vertex_t *) (((edge_t_int *) e)->to));
+}
+
+
+lsList
+g_get_vertices(graph_t *g)
+{
+    if (g == NIL(graph_t)) {
+        fail("g_get_vertices: Null graph");
+    }
+    return(((graph_t_int *) g)->v_list);
+}
+
+vertex_t *
+g_add_vertex(graph_t *g)
+{
+    lsHandle handle;
+    vertex_t_int *vert;
+
+    if (g == NIL(graph_t)) {
+        fail("g_add_vertex: Null graph");
+    }
+    vert = ALLOC(vertex_t_int,1);
+    if (lsNewEnd(g_get_vertices(g),(lsGeneric) vert,&handle) != LS_OK) {
+        fail("g_add_vertex: Can't add vertex");
+    }    
+    vert->user_data = (gGeneric) NULL;
+    vert->g = (graph_t_int *) g;
+    vert->in_list = lsCreate();
+    vert->out_list = lsCreate();
+    vert->id = g_unique_id++;
+    vert->handle = handle;
+    return((vertex_t *) vert);
+}
+
+void
+g_delete_vertex(
+  vertex_t *v,
+  void (*f_free_v)(gGeneric),
+  void (*f_free_e)(gGeneric))
+{
+    edge_t *e;
+    lsGeneric junk;
+    lsGen gen;
+
+    if (v == NIL(vertex_t)) {
+        fail("g_delete_vertex: Null vertex");
+    }
+    if (f_free_v != (void (*)(gGeneric)) NULL) {
+        (*f_free_v)(v->user_data);
+    }
+    foreach_in_edge (v,gen,e) {
+        g_del_from_list(g_get_out_edges(g_e_source(e)),(lsGeneric) e);
+	if (f_free_e != (void (*)(gGeneric)) NULL) {
+	    (*f_free_e)(e->user_data);
+	}
+	if (lsRemoveItem(((edge_t_int *) e)->handle,&junk) != LS_OK) {
+	    fail("g_delete_vertex: Can't remove edge from graph");
+	}
+	FREE(e);
+    }
+    foreach_out_edge (v,gen,e) {
+        g_del_from_list(g_get_in_edges(g_e_dest(e)),(lsGeneric) e);
+	if (f_free_e != (void (*)(gGeneric)) NULL) {
+	    (*f_free_e)(e->user_data);
+	}
+	if (lsRemoveItem(((edge_t_int *) e)->handle,&junk) != LS_OK) {
+	    fail("g_delete_vertex: Can't remove edge from graph");
+	}
+	FREE(e);
+    }
+    (void) lsDestroy(g_get_out_edges(v),(void (*)(lsGeneric)) NULL);
+    (void) lsDestroy(g_get_in_edges(v),(void (*)(lsGeneric)) NULL);
+    (void) lsRemoveItem(((vertex_t_int *) v)->handle,&junk);
+    FREE(v);
+}
+
+graph_t *
+g_vertex_graph(vertex_t *v)
+{
+    if (v == NIL(vertex_t)) {
+        fail("g_vertex_graph: Null vertex");
+    }
+    return((graph_t *) ((vertex_t_int *) v)->g);
+}
Index: /vis_dev/glu-2.1/src/graph/graph.h
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph.h	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph.h	(revision 6)
@@ -0,0 +1,70 @@
+#ifndef GRAPH_H
+#define GRAPH_H
+
+typedef char *gGeneric;
+
+typedef struct graph_struct {
+	gGeneric user_data;
+} graph_t;
+
+typedef struct vertex_struct {
+	gGeneric user_data;
+} vertex_t;
+
+typedef struct edge_struct {
+	gGeneric user_data;
+} edge_t;
+
+typedef void (*GRAPH_PFV)(gGeneric);
+typedef gGeneric (*GRAPH_PFG)(gGeneric);
+
+EXTERN graph_t *g_alloc ARGS((void));
+EXTERN void g_free ARGS((graph_t *, void(*)(gGeneric), void(*)(gGeneric), void(*)(gGeneric)));
+EXTERN void g_check ARGS((graph_t *));
+EXTERN graph_t *g_dup ARGS((graph_t *, gGeneric(*)(gGeneric), gGeneric(*)(gGeneric), gGeneric(*)(gGeneric)));
+
+EXTERN lsList g_get_vertices ARGS((graph_t *));
+
+#define foreach_vertex(g, lgen, v)				\
+	for (lgen = lsStart(g_get_vertices(g));			\
+		lsNext(lgen, &v, LS_NH) == LS_OK	\
+		   || ((void) lsFinish(lgen), 0); )
+
+#define foreach_edge(g, lgen, e)				\
+	for (lgen = lsStart(g_get_edges(g));			\
+		lsNext(lgen, &e, LS_NH) == LS_OK	\
+		   || ((void) lsFinish(lgen), 0); )
+
+EXTERN vertex_t *g_add_vertex ARGS((graph_t *));
+EXTERN void g_delete_vertex ARGS((vertex_t *, void (*)(gGeneric), void (*)(gGeneric)));
+EXTERN graph_t *g_vertex_graph ARGS((vertex_t *));
+
+EXTERN lsList g_get_edges ARGS((graph_t *));
+EXTERN lsList g_get_in_edges ARGS((vertex_t *));
+EXTERN lsList g_get_out_edges ARGS((vertex_t *));
+
+#define foreach_in_edge(v, lgen, e)				\
+	for (lgen = lsStart(g_get_in_edges(v));			\
+		lsNext(lgen, &e, LS_NH) == LS_OK	\
+		   || ((void) lsFinish(lgen), 0); )
+
+#define foreach_out_edge(v, lgen, e)				\
+	for (lgen = lsStart(g_get_out_edges(v));		\
+		lsNext(lgen, &e, LS_NH) == LS_OK	\
+		   ||  ((void) lsFinish(lgen), 0); )
+
+EXTERN edge_t *g_add_edge ARGS((vertex_t *, vertex_t *));
+EXTERN void g_delete_edge ARGS((edge_t *, void (*)(gGeneric)));
+EXTERN graph_t *g_edge_graph ARGS((edge_t *));
+EXTERN vertex_t *g_e_source ARGS((edge_t *));
+EXTERN vertex_t *g_e_dest ARGS((edge_t *));
+
+EXTERN array_t *g_dfs ARGS((graph_t *));
+EXTERN int g_is_acyclic ARGS((graph_t *));
+EXTERN array_t *g_graph_sort ARGS((graph_t *, int (*)(const void *, const void *)));
+
+EXTERN st_table *g_reachable ARGS((graph_t *, st_table *));
+EXTERN st_table *g_EF ARGS((graph_t *, st_table *));
+EXTERN st_table *g_SCC ARGS((graph_t *, st_table *));
+
+#endif
Index: /vis_dev/glu-2.1/src/graph/graph.make
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph.make	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += graph.c graph_dfs.c graph_s.c
+HEADERS += graph.h graph_int.h graph_static.h graph_static_int.h
+MISC += graph.doc graph_static.doc com_graph.c
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/graph/graph_dfs.c
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph_dfs.c	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph_dfs.c	(revision 6)
@@ -0,0 +1,264 @@
+/*
+ * $Id: graph_dfs.c,v 1.9 2005/04/15 23:24:21 fabio Exp $
+ */
+
+#include "graph_int.h"
+
+static vertex_t *
+find_an_end_vertex(vertex_t *v, st_table *visit_list)
+{
+    edge_t *e;
+    vertex_t *dest;
+    lsGen gen;
+
+    if (lsLength(g_get_out_edges(v)) == 0) {
+        return(v);
+    }
+    foreach_out_edge (v,gen,e) {
+	(void) lsFinish(gen);
+	dest = g_e_dest(e);
+        if (st_insert(visit_list,(char *) dest,(char *) 0) == 1) {
+	    return(NIL(vertex_t));
+	}
+	return(find_an_end_vertex(dest,visit_list));
+        /* NOTREACHED */
+    }
+    /* no free out_edges */
+    return(NIL(vertex_t));
+}
+
+static int
+dfs_recurr(vertex_t *v, st_table *dfs_list, array_t *dfs_array) 
+{
+    edge_t *e;
+    lsGen gen;
+    int val;
+
+    if (st_lookup_int(dfs_list,(char *) v, &val)) {
+        return(val == 0);
+    }
+    (void) st_insert(dfs_list,(char *) v,(char *) 1);
+
+    foreach_in_edge (v,gen,e) {
+        if (!dfs_recurr(g_e_source(e),dfs_list,dfs_array)) {
+	    return(0);
+	}
+    }
+    (void) st_insert(dfs_list,(char *) v,(char *) 0);
+    array_insert_last(vertex_t *,dfs_array,v);
+    return(1);
+}
+
+static array_t *
+g_dfs_int(graph_t *g)
+{
+    vertex_t *v;
+    lsGen gen;
+    array_t *dfs_array;
+    st_table *visit_list,*dfs_list;
+    int cycle = FALSE;
+
+    dfs_array = array_alloc(vertex_t *,0);
+    visit_list = st_init_table(st_ptrcmp,st_ptrhash);
+    dfs_list = st_init_table(st_ptrcmp,st_ptrhash);
+
+    foreach_vertex (g,gen,v) {
+        if (!st_is_member(dfs_list,(char *) v)) {
+	    (void) st_insert(visit_list,(char *) v,(char *) 0);
+	    v = find_an_end_vertex(v,visit_list);
+	    if (v == NIL(vertex_t) || !dfs_recurr(v,dfs_list,dfs_array)) {
+	        cycle = TRUE;
+		(void) lsFinish(gen);
+		break;
+	    }
+	}
+    }
+
+    st_free_table(visit_list);
+    st_free_table(dfs_list);
+    if (cycle == TRUE) {
+        array_free(dfs_array);
+        return(NIL(array_t));
+    }
+    return(dfs_array);
+}
+
+array_t *
+g_dfs(graph_t *g)
+{
+    array_t *x;
+
+    x = g_dfs_int(g);
+    if (x == NIL(array_t)) {
+        fail("g_dfs: Graph has cycle");
+    }
+    return(x);
+}
+
+int
+g_is_acyclic(graph_t *g)
+{
+    array_t *x;
+
+    x = g_dfs_int(g);
+    if (x) {
+        array_free(x);
+	return(TRUE);
+    }
+    return(FALSE);
+}
+
+
+static int
+reachable_recurr(vertex_t *v, st_table *dfs_list)
+{
+    edge_t *e;
+    lsGen gen;
+    int val;
+
+    if (st_lookup_int(dfs_list,(char *) v, &val)) {
+        return(val == 0);
+    }
+    (void) st_insert(dfs_list,(char *) v,(char *) 1);
+
+    foreach_out_edge (v,gen,e) {
+        reachable_recurr(g_e_dest(e),dfs_list);
+    }
+    (void) st_insert(dfs_list,(char *) v,(char *) 0);
+
+    return(1);
+}
+
+/* compute reachable states from the initial states */
+st_table *
+g_reachable(graph_t *g, st_table *init)
+{
+    vertex_t *v;
+    st_table *dfs_list;
+    st_generator *stgen;
+
+    dfs_list = st_init_table(st_ptrcmp, st_ptrhash);
+
+    st_foreach_item(init, stgen, &v, NIL(char *)) {
+	reachable_recurr(v,dfs_list);
+    }
+
+    return (dfs_list);
+}
+
+
+static int
+EF_recurr(vertex_t *v, st_table *EF_list)
+{
+    edge_t *e;
+    lsGen gen;
+    int val;
+
+    if (st_lookup_int(EF_list,(char *) v, &val)) {
+        return(val == 0);
+    }
+    (void) st_insert(EF_list,(char *) v,(char *) 1);
+
+    foreach_in_edge (v,gen,e) {
+        EF_recurr(g_e_source(e),EF_list);
+    }
+    (void) st_insert(EF_list,(char *) v,(char *) 0);
+
+    return(1);
+}
+
+/* compute EF(goal) of an automaton, might include unreachable states */
+st_table *
+g_EF(graph_t *g, st_table *goal)
+{
+    vertex_t *v;
+    st_table *EF_list;
+    st_generator *stgen;
+
+    EF_list = st_init_table(st_ptrcmp, st_ptrhash);
+
+    st_foreach_item(goal, stgen, &v, NIL(char *)) {
+	EF_recurr(v,EF_list);
+    }
+
+    return (EF_list);
+}
+
+static void
+searchSCC(
+  vertex_t *v,
+  st_table *scc,
+  st_table *old /*visited*/,
+  lsList   stack,
+  st_table *onstack,
+  int *countr)
+{
+    int lowlink_v, dfnumber_v, lowlink_w, dfnumber_w;
+    vertex_t *x, *w;
+    st_table *component;
+    lsGen gen;
+    edge_t *e;
+
+    lowlink_v = dfnumber_v = *countr;
+    (*countr)++;
+    st_insert(old, (char *)v, (char *)(long)dfnumber_v);
+    st_insert(onstack, (char *)v, (char *)(long)lowlink_v);
+    lsNewBegin(stack, (lsGeneric)v, NIL(lsHandle));
+
+    foreach_out_edge (v,gen,e) {
+	w = g_e_dest(e);
+	if (!st_is_member(old, (char *)w)) {
+	    searchSCC(w,scc,old,stack,onstack,countr);
+	    if(st_lookup_int(onstack, (char *)w, &lowlink_w) &&
+	       lowlink_w < lowlink_v) {
+		lowlink_v = lowlink_w;
+		st_insert(onstack, (char *)v, (char *)(long)lowlink_v);
+	    }
+	}else {
+	    st_lookup_int(old, (char *)w, &dfnumber_w);
+	    if (dfnumber_w < dfnumber_v && st_is_member(onstack, (char *)w)) {
+		if (dfnumber_w < lowlink_v) {
+		    lowlink_v = dfnumber_w;
+		    st_insert(onstack, (char *)v, (char *)(long)lowlink_v);
+		}
+	    }
+	}
+    }
+
+    /* put current SCC into st_table, and then insert into 'scc' */
+    if (dfnumber_v == lowlink_v) {
+	component = st_init_table(st_ptrcmp, st_ptrhash);
+	while (lsDelBegin(stack, &x) != LS_NOMORE) {
+	    st_insert(component, (char *)x, NIL(char)); 
+	    st_delete(onstack, &x, NIL(char *));
+	    if (v == x) break;
+	}
+	st_insert(scc, (char *)component, NIL(char)); /* is component fair? */
+    }
+}
+
+/* compute the strongly connected components of a graph (Tarjan's alg.) */
+st_table *
+g_SCC(graph_t *g, st_table *init)
+{
+    vertex_t *v;
+    lsList stack;
+    st_table *old, *onstack, *scc;
+    st_generator *stgen;
+    int countr = 0;
+
+    scc = st_init_table(st_ptrcmp, st_ptrhash);
+    
+    stack = lsCreate();
+    old = st_init_table(st_ptrcmp, st_ptrhash);
+    onstack = st_init_table(st_ptrcmp, st_ptrhash);
+    st_foreach_item(init, stgen, &v, NIL(char *)) {
+	if (!st_is_member(old, (char *)v))
+	    searchSCC(v,scc,old,stack,onstack,&countr);
+    }
+    lsDestroy(stack, (void (*)(lsGeneric))0 );
+    st_free_table(old);
+    st_free_table(onstack);
+
+    return scc;
+}
Index: /vis_dev/glu-2.1/src/graph/graph_int.h
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph_int.h	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph_int.h	(revision 6)
@@ -0,0 +1,31 @@
+#include "util.h"
+#include "list.h"
+#include "array.h"
+#include "st.h"
+#include "graph.h"
+
+typedef struct graph_struct_int {
+	gGeneric user_data;
+	lsList v_list;
+	lsList e_list;
+} graph_t_int;
+
+typedef struct vertex_struct_int {
+	gGeneric user_data;
+	graph_t_int *g;
+	lsList in_list;
+	lsList out_list;
+	int id;
+	lsHandle handle;	/* for quick deletion in the graph v_list */
+} vertex_t_int;
+
+typedef struct edge_struct_int {
+	gGeneric user_data;
+	vertex_t_int *from;
+	vertex_t_int *to;
+	int id;
+	lsHandle handle;	/* for quick deletion in the graph e_list */
+} edge_t_int;
+
+EXTERN void del_from_list(lsList, lsGeneric);
+extern int g_unique_id; 
Index: /vis_dev/glu-2.1/src/graph/graph_s.c
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph_s.c	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph_s.c	(revision 6)
@@ -0,0 +1,367 @@
+/*
+ * $Id: graph_s.c,v 1.4 2002/08/25 20:01:57 fabio Exp $
+ */
+
+#include "graph_int.h"
+#include "graph_static_int.h"
+
+#define g_field(graph)		((g_field_t *) (graph)->user_data)
+
+graph_t *
+g_alloc_static(int ng, int nv, int ne)
+{
+    graph_t *g;
+    g_field_t *gf;;
+
+    g = g_alloc();
+    gf = ALLOC(g_field_t,1);
+    gf->num_g_slots = ng;
+    gf->num_v_slots = nv;
+    gf->num_e_slots = ne;
+    gf->user_data = (gGeneric) ALLOC(gGeneric, ng);
+
+    g->user_data = (gGeneric) gf;
+    return(g);
+}
+
+void
+g_free_static(
+  graph_t *g,
+  void (*f_free_g)(gGeneric),
+  void (*f_free_v)(gGeneric),
+  void (*f_free_e)(gGeneric))
+{
+    vertex_t *v;
+    edge_t *e;
+    lsGen gen;
+    lsGeneric junk;
+
+    if (g == NIL(graph_t)) {
+        return;
+    }
+    if (f_free_g != (void (*)(gGeneric)) NULL) {
+        (*f_free_g)(g_field(g)->user_data);
+    }
+    FREE(g_field(g)->user_data);
+    FREE(g->user_data);
+
+    foreach_vertex(g,gen,v) {
+        if (f_free_v != (void (*)(gGeneric)) NULL) {
+	    (*f_free_v)(v->user_data);
+	}
+	FREE(v->user_data);
+	(void) lsDestroy(g_get_in_edges(v),(void (*)(lsGeneric)) NULL);
+	(void) lsDestroy(g_get_out_edges(v),(void (*)(lsGeneric)) NULL);
+	(void) lsRemoveItem(((vertex_t_int *) v)->handle,&junk);
+	FREE(v);
+    }
+    foreach_edge(g,gen,e) {
+        if (f_free_e != (void (*)(gGeneric)) NULL) {
+	    (*f_free_e)(e->user_data);
+	}
+	FREE(e->user_data);
+	(void) lsRemoveItem(((edge_t_int *) e)->handle,&junk);
+	FREE(e);
+    }
+    g_free(g,(void (*)(gGeneric)) NULL,(void (*)(gGeneric)) NULL,
+	   (void (*)(gGeneric)) NULL);
+}
+
+static graph_t *theGraph;
+
+static gGeneric
+copy_v_slots(gGeneric user_data)
+{
+    int i;
+    int num_v_slots = g_field(theGraph)->num_v_slots;
+    gGeneric *news = ALLOC(gGeneric,num_v_slots);
+
+    for (i = 0; i < num_v_slots; i++) {
+        news[i] = ((gGeneric *) user_data)[i];
+    }
+    return((gGeneric) news);
+}
+
+static gGeneric
+copy_e_slots(gGeneric user_data)
+{
+    int i;
+    int num_e_slots = g_field(theGraph)->num_e_slots;
+    gGeneric *news = ALLOC(gGeneric,num_e_slots);
+
+    for (i = 0; i < num_e_slots; i++) {
+        news[i] = ((gGeneric *) user_data)[i];
+    }
+    return((gGeneric) news);
+}    
+
+graph_t *
+g_dup_static(
+  graph_t *g,
+  gGeneric (*f_copy_g)(gGeneric),
+  gGeneric (*f_copy_v)(gGeneric),
+  gGeneric (*f_copy_e)(gGeneric))
+{
+    g_field_t *gf, *gf2;
+    graph_t *g2;
+    gGeneric *news;
+    int i;
+
+    if (f_copy_v == (gGeneric (*)(gGeneric)) NULL) {
+        theGraph = g;        
+        f_copy_v = copy_v_slots;
+    }
+    if (f_copy_e == (gGeneric (*)(gGeneric)) NULL) {
+        theGraph = g;
+	f_copy_e = copy_e_slots;
+    }
+    g2 = g_dup(g,(gGeneric (*)(gGeneric)) NULL,f_copy_v,f_copy_e);
+    if (g == NIL(graph_t)) {
+        return(g2);
+    }
+
+    gf = g_field(g);
+    gf2 = ALLOC(g_field_t,1);
+    gf2->num_g_slots = gf->num_g_slots;
+    gf2->num_v_slots = gf->num_v_slots;
+    gf2->num_e_slots = gf->num_e_slots;
+    if (f_copy_g == (gGeneric (*)(gGeneric)) NULL) {
+        news = ALLOC(gGeneric,gf->num_g_slots);
+	for (i = gf->num_g_slots - 1; i >= 0; i--) {
+	    news[i] = ((gGeneric *) gf->user_data)[i];
+	}
+	gf2->user_data = (gGeneric) news;
+    }
+    else {
+        gf2->user_data = (*f_copy_g)(gf->user_data);
+    }
+    g2->user_data = (gGeneric) gf2;        
+    return(g2);
+}
+
+
+void
+g_set_g_slot_static(graph_t *g, int i, gGeneric val)
+{
+    if (g == NIL(graph_t)) {
+        fail("g_set_g_slot_static: Null graph");
+    }
+    ((gGeneric *) g_field(g)->user_data)[i] = val;
+    return;
+}
+
+
+gGeneric
+g_get_g_slot_static(graph_t *g, int i)
+{
+    if (g == NIL(graph_t)) {
+        fail("g_get_g_slot_static: Null graph");
+    }
+    return ((gGeneric *) g_field(g)->user_data)[i];
+}
+
+void
+g_copy_g_slots_static(graph_t *g1, graph_t *g2, gGeneric (*f_copy_g)(gGeneric))
+{
+    g_field_t *gf1,*gf2;
+    gGeneric slots1,*slots2;
+    int n;
+
+    if (g1 == NIL(graph_t) || g2 == NIL(graph_t)) {
+        fail("g_copy_g_slots_static: Null graph");
+    }
+    gf1 = g_field(g1);
+    gf2 = g_field(g2);
+    n = gf1->num_g_slots;
+
+    if (n != gf2->num_g_slots) {
+        fail("g_copy_g_slots_static: Graphs have different numbers of slots");
+    }
+    slots1 = gf1->user_data;
+    slots2 = (gGeneric *) gf2->user_data;
+    if (f_copy_g == (gGeneric (*)(gGeneric)) NULL) {
+        for (n-- ; n >= 0; n--) {
+	    slots2[n] = ((gGeneric *) slots1)[n];
+	}
+    }
+    else {
+        FREE(slots2);
+        gf2->user_data = (*f_copy_g)(slots1);
+    }
+}
+
+
+edge_t * 
+g_add_edge_static(vertex_t *v1, vertex_t *v2)
+{
+    edge_t *e;
+    g_field_t *gf;
+
+    if (v1 == NIL(vertex_t) || v2 == NIL(vertex_t)) {
+        fail("g_add_edge_static: Null vertex");
+    }
+    e = g_add_edge(v1, v2);
+    gf = g_field(g_edge_graph(e));
+    e->user_data = (gGeneric) ALLOC(gGeneric, gf->num_e_slots);
+    return(e);
+}
+
+
+void
+g_delete_edge_static(edge_t *e, void (*f_free_e)(gGeneric))
+{
+    if (e == NIL(edge_t)) {
+        fail("g_delete_edge_static: Null edge");
+    }
+    if (f_free_e != (void (*)(gGeneric)) NULL) {
+        (*f_free_e)(e->user_data);
+    }
+    FREE(e->user_data);
+    g_delete_edge(e,(void (*)(gGeneric)) NULL);
+}
+
+
+void
+g_set_e_slot_static(edge_t *e, int i, gGeneric val)
+{
+    if (e == NIL(edge_t)) {
+        fail("g_set_e_slot_static: Null edge");
+    }
+    ((gGeneric *) e->user_data)[i] = val;
+}
+
+
+gGeneric 
+g_get_e_slot_static(edge_t *e, int i)
+{
+    if (e == NIL(edge_t)) {
+        fail("g_get_e_slot_static: Null edge");
+    }
+    return((gGeneric *) e->user_data)[i];
+}
+
+void
+g_copy_e_slots_static(edge_t *e1, edge_t *e2, gGeneric (*f_copy_e)(gGeneric))
+{
+    int n;
+    gGeneric slots1,*slots2;
+
+    if (e1 == NIL(edge_t) || e2 == NIL(edge_t)) {
+        fail("g_copy_e_slots_static: Null edge");
+    }
+    n = g_field(g_edge_graph(e1))->num_e_slots;
+
+    if (n != g_field(g_edge_graph(e2))->num_e_slots) {
+        fail("g_copy_e_slots_static: Edges have differing numbers of slots");
+    }
+    slots1 = e1->user_data;
+    slots2 = (gGeneric *) e2->user_data;
+    if (f_copy_e == (gGeneric (*)(gGeneric)) NULL) {
+        for (n--; n >= 0; n--) {
+	    slots2[n] = ((gGeneric *) slots1)[n];
+	}
+    }
+    else {
+        FREE(slots2);
+        e2->user_data = (*f_copy_e)(slots1);
+    }
+}
+
+
+vertex_t *
+g_add_vertex_static(graph_t *g)
+{
+    g_field_t *gf;
+    vertex_t *v;
+
+    if (g == NIL(graph_t)) {
+        fail("g_add_vertex_static: Null graph");
+    }
+    gf = g_field(g);
+    v = g_add_vertex(g);
+    v->user_data = (gGeneric) ALLOC(gGeneric, gf->num_v_slots);
+    return(v);
+}
+    
+
+void
+g_delete_vertex_static(
+  vertex_t *v,
+  void (*f_free_v)(gGeneric),
+  void (*f_free_e)(gGeneric))
+{
+    edge_t *e;
+    lsGen gen;
+
+    if (v == NIL(vertex_t)) {
+        fail("g_delete_vertex_static: Null vertex");
+    }
+    foreach_in_edge(v, gen, e) {
+        if (f_free_e != (void (*)(gGeneric)) NULL) {
+	    (*f_free_e)(e->user_data);
+	}
+	FREE(e->user_data);
+    }
+    foreach_out_edge(v, gen, e) {
+        if (f_free_e != (void (*)(gGeneric)) NULL) {
+	    (*f_free_e)(e->user_data);
+	}
+	FREE(e->user_data);
+    }
+    if (f_free_v != (void (*)(gGeneric)) NULL) {
+        (*f_free_v)(v->user_data);
+    }
+    FREE(v->user_data);
+    g_delete_vertex(v, (void (*)(gGeneric)) NULL, (void (*)(gGeneric)) NULL);
+}
+
+
+void
+g_set_v_slot_static(vertex_t *v, int i, gGeneric val)
+{
+    if (v == NIL(vertex_t)) {
+        fail("g_set_v_slot_static: Null vertex");
+    }
+    ((gGeneric *) v->user_data)[i] = val;
+}
+
+
+gGeneric
+g_get_v_slot_static(vertex_t *v, int i)
+{
+    if (v == NIL(vertex_t)) {
+        fail("g_get_v_slot_static: Null vertex");
+    }
+    return ((gGeneric *) v->user_data)[i]; 
+}
+
+void
+g_copy_v_slots_static(
+  vertex_t *v1,
+  vertex_t *v2,
+  gGeneric (*f_copy_v)(gGeneric))
+{
+    int n;
+    gGeneric slots1,*slots2;
+    
+    if (v1 == NIL(vertex_t) || v2 == NIL(vertex_t)) {
+        fail("g_copy_v_slots_static: Null vertex");
+    }
+    n = g_field(g_vertex_graph(v1))->num_v_slots;
+
+    if (n != g_field(g_vertex_graph(v2))->num_v_slots) {
+        fail("g_copy_v_slots_static: Vertices have differing numbers of slots");
+    }
+    slots1 = v1->user_data;
+    slots2 = (gGeneric *) v2->user_data;
+    if (f_copy_v == (gGeneric (*)(gGeneric)) NULL) {
+        for (n--; n >= 0; n--) {
+	    slots2[n] = ((gGeneric *) slots1)[n];
+	}
+    }
+    else {
+        FREE(slots2);
+        v2->user_data = (*f_copy_v)(slots1);
+    }
+}
+
Index: /vis_dev/glu-2.1/src/graph/graph_static.h
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph_static.h	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph_static.h	(revision 6)
@@ -0,0 +1,23 @@
+/*
+ * $Id: graph_static.h,v 1.3 2002/08/27 15:28:21 fabio Exp $
+ *
+ */
+
+/******************************* graph_static.h ************************/
+
+EXTERN graph_t *g_alloc_static ARGS((int, int, int));
+EXTERN void g_free_static ARGS((graph_t *, void (*)(gGeneric), void (*)(gGeneric), void (*)(gGeneric)));
+EXTERN graph_t *g_dup_static ARGS((graph_t *, char *(*)(gGeneric), char *(*)(gGeneric), char *(*)(gGeneric)));
+EXTERN void g_set_g_slot_static ARGS((graph_t *, int, char *));
+EXTERN char *g_get_g_slot_static ARGS((graph_t *, int));
+EXTERN void g_copy_g_slots_static ARGS((graph_t *, graph_t *, char *(*)(gGeneric)));
+EXTERN vertex_t *g_add_vertex_static ARGS((graph_t *));
+EXTERN void g_delete_vertex_static ARGS((vertex_t *, void (*)(gGeneric), void (*)(gGeneric)));
+EXTERN void g_set_v_slot_static ARGS((vertex_t *, int, char *));
+EXTERN char *g_get_v_slot_static ARGS((vertex_t *, int));
+EXTERN void g_copy_v_slots_static ARGS((vertex_t *, vertex_t *, char *(*)(gGeneric)));
+EXTERN edge_t *g_add_edge_static ARGS((vertex_t *, vertex_t *));
+EXTERN void g_delete_edge_static ARGS((edge_t *, void (*)(gGeneric)));
+EXTERN void g_set_e_slot_static ARGS((edge_t *, int, char *));
+EXTERN char *g_get_e_slot_static ARGS((edge_t *, int));
+EXTERN void g_copy_e_slots_static ARGS((edge_t *, edge_t *, char *(*)(gGeneric)));
Index: /vis_dev/glu-2.1/src/graph/graph_static_int.h
===================================================================
--- /vis_dev/glu-2.1/src/graph/graph_static_int.h	(revision 6)
+++ /vis_dev/glu-2.1/src/graph/graph_static_int.h	(revision 6)
@@ -0,0 +1,13 @@
+/*
+ * $Id: graph_static_int.h,v 1.2 2002/08/27 15:29:01 fabio Exp $
+ *
+ */
+
+#include "graph_static.h"
+
+typedef struct g_field_struct {
+    int num_g_slots;
+    int num_v_slots;
+    int num_e_slots;
+    gGeneric user_data;
+} g_field_t;
Index: /vis_dev/glu-2.1/src/heap/heap.c
===================================================================
--- /vis_dev/glu-2.1/src/heap/heap.c	(revision 6)
+++ /vis_dev/glu-2.1/src/heap/heap.c	(revision 6)
@@ -0,0 +1,545 @@
+/**CFile***********************************************************************
+
+  FileName    [heap.c]
+
+  PackageName [heap]
+
+  Synopsis    [Heap-based priority queue.]
+
+  Description [This file contains the functions to maintain a priority
+  queue implemented as a heap.]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [This file was created at the University of Colorado at
+  Boulder.  The University of Colorado at Boulder makes no warranty
+  about the suitability of this software for any purpose.  It is
+  presented on an AS IS basis.]
+
+******************************************************************************/
+
+#include "heapInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] UNUSED = "$Id: heap.c,v 1.18 2005/05/18 19:25:43 jinh Exp $";
+#endif
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static void HeapHeapify ARGS((Heap_t *heap));
+static void HeapHeapifyCompare ARGS((Heap_t *heap));
+static int HeapResize ARGS((Heap_t *heap));
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes a priority queue.]
+
+  Description [Initializes a priority queue. Returns a pointer to the
+  heap if successful; NULL otherwise.  The queue is implemented as a
+  heap.  The first element of the heap is the one with the smallest
+  key.]
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapFree]
+
+******************************************************************************/
+Heap_t *
+Heap_HeapInit(
+  int length)
+{
+  Heap_t *heap;
+
+  heap = ALLOC(Heap_t, 1);
+  if (heap == NIL(Heap_t)) return NIL(Heap_t);
+  heap->length = length;
+  heap->nitems = 0;
+  heap->compare = 0;
+  heap->slots = ALLOC(HeapSlot_t, length);
+  if (heap->slots == NIL(HeapSlot_t)) {
+    FREE(heap);
+    return NIL(Heap_t);
+  }
+  return heap;
+
+} /* Heap_HeapInit */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes a priority queue.]
+
+  Description [Initializes a priority queue. Returns a pointer to the
+  heap if successful; NULL otherwise.  The queue is implemented as a
+  heap.  The first element of the heap is the one with the smallest
+  key.]
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapFree]
+
+******************************************************************************/
+Heap_t *
+Heap_HeapInitCompare(
+  int length, int (*compare)(const void *, const void *))
+{
+  Heap_t *heap;
+
+  heap = ALLOC(Heap_t, 1);
+  if (heap == NIL(Heap_t)) return NIL(Heap_t);
+  heap->length = length;
+  heap->nitems = 0;
+  heap->compare = compare;
+  heap->slots = ALLOC(HeapSlot_t, length);
+  if (heap->slots == NIL(HeapSlot_t)) {
+    FREE(heap);
+    return NIL(Heap_t);
+  }
+  return heap;
+
+} /* Heap_HeapInitCompare */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Frees a priority queue.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapInit]
+
+******************************************************************************/
+void
+Heap_HeapFree(
+  Heap_t *heap)
+{
+  FREE(heap->slots);
+  FREE(heap);
+  return;
+
+} /* Heap_HeapFree */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts an item in a priority queue.]
+
+  Description [Inserts an item in a priority queue.  Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapExtractMin]
+
+******************************************************************************/
+int
+Heap_HeapInsert(
+  Heap_t *heap,
+  void *item,
+  long key)
+{
+  HeapSlot_t *slots;
+  int i = heap->nitems;
+
+  if (i == heap->length && !HeapResize(heap)) return 0;
+  slots = heap->slots;
+  heap->nitems++;
+  while (i > 0 && KEY(slots, PARENT(i)) > key) {
+    ITEM(slots, i) = ITEM(slots, PARENT(i));
+    KEY(slots, i) = KEY(slots, PARENT(i));
+    i = PARENT(i);
+  }
+  ITEM(slots, i) = item;
+  KEY(slots, i) = key;
+  return 1;
+
+} /* Heap_HeapInsert */
+
+/**Function********************************************************************
+
+  Synopsis    [Inserts an item in a priority queue.]
+
+  Description [Inserts an item in a priority queue.  Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapExtractMin]
+
+******************************************************************************/
+int
+Heap_HeapInsertCompare(
+  Heap_t *heap,
+  void *item,
+  long key)
+{
+  HeapSlot_t *slots;
+  int i = heap->nitems;
+
+  if (i == heap->length && !HeapResize(heap)) return 0;
+  slots = heap->slots;
+  heap->nitems++;
+  while (i > 0 && (*(heap->compare))((char *)(long)KEY(slots, PARENT(i)), (char *)(long)key)) {
+    ITEM(slots, i) = ITEM(slots, PARENT(i));
+    KEY(slots, i) = KEY(slots, PARENT(i));
+    i = PARENT(i);
+  }
+  ITEM(slots, i) = item;
+  KEY(slots, i) = key;
+  return 1;
+
+} /* Heap_HeapInsertCompare */
+
+
+
+/**Function********************************************************************
+
+  Synopsis    [Extracts the element with the minimum key from a priority
+  queue.]
+
+  Description [Extracts the element with the minimum key from a
+  priority queue.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [The minimum key and the associated item are returned as
+  side effects.]
+
+  SeeAlso     [Heap_HeapInsert]
+
+******************************************************************************/
+int
+Heap_HeapExtractMin(
+  Heap_t *heap,
+  void *item,
+  long *key)
+{
+  HeapSlot_t *slots = heap->slots;
+
+  if (heap->nitems == 0) return 0;
+  *(void **)item = ITEM(slots, 0);
+  *key = KEY(slots, 0);
+  heap->nitems--;
+  /* The next three lines are redundant if the queue is empty. */
+  ITEM(slots, 0) = ITEM(slots, heap->nitems);
+  KEY(slots, 0) = KEY(slots, heap->nitems);
+  if(heap->compare) HeapHeapifyCompare(heap);
+  else              HeapHeapify(heap);
+
+  return 1;
+
+} /* Heap_HeapExtractMin */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of items in a priority queue.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Heap_HeapCount(
+  Heap_t *heap)
+{
+  return(heap->nitems);
+
+} /* Heap_HeapCount */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Clones a priority queue.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapInit]
+
+******************************************************************************/
+Heap_t *
+Heap_HeapClone(
+  Heap_t *source)
+{
+  Heap_t *dest;
+  int i;
+  int nitems = source->nitems;
+  HeapSlot_t *sslots = source->slots;
+  HeapSlot_t *dslots;
+
+  dest = Heap_HeapInit(source->length);
+  if (dest == NULL) return(NULL);
+  dest->nitems = nitems;
+  dslots = dest->slots;
+  for (i = 0; i < nitems; i++) {
+    KEY(dslots, i) = KEY(sslots, i);
+    ITEM(dslots, i) = ITEM(sslots, i);
+  }
+  return(dest);
+
+} /* Heap_HeapClone */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Tests the heap property of a priority queue.]
+
+  Description [Tests the heap property of a priority queue.  Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Heap_HeapTest(
+  Heap_t *heap)
+{
+  HeapSlot_t *slots = heap->slots;
+  int nitems = heap->nitems;
+  int i;
+
+  for (i = 1; i < nitems; i++) {
+    if (KEY(slots,i) < KEY(slots, PARENT(i)))
+      return 0;
+  }
+  return 1;
+
+} /* Heap_HeapTest */
+
+/**Function********************************************************************
+
+  Synopsis    [Tests the heap property of a priority queue.]
+
+  Description [Tests the heap property of a priority queue.  Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Heap_HeapTestCompare(
+  Heap_t *heap)
+{
+  HeapSlot_t *slots = heap->slots;
+  int nitems = heap->nitems;
+  int i;
+
+  for (i = 1; i < nitems; i++) {
+    if ((*(heap->compare))((char *)(long)KEY(slots, PARENT(i)), (char *)(long)KEY(slots,i)))
+      return 0;
+  }
+  return 1;
+
+} /* Heap_HeapTest */
+
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Maintains the heap property of a priority queue.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapExtractMin]
+
+******************************************************************************/
+static void
+HeapHeapify(
+  Heap_t *heap)
+{
+  int nitems = heap->nitems;
+  HeapSlot_t *slots = heap->slots;
+  int i = 0;
+  int smallest = 0;
+  void *item = ITEM(slots, 0);
+  long key = KEY(slots, 0);
+
+  while (1) {
+    int left = LEFT(i);
+    int right = RIGHT(i);
+    int minkey;
+    if (left < nitems && (minkey = KEY(slots, left)) < key) {
+      smallest = left;
+    } else {
+      minkey = key;
+    }
+    if (right < nitems && KEY(slots, right) < minkey) {
+      smallest = right;
+    }
+    if (smallest == i) break;
+    KEY(slots, i) = KEY(slots, smallest);
+    ITEM(slots, i) = ITEM(slots, smallest);
+    i = smallest;
+  }
+  KEY(slots, i) = key;
+  ITEM(slots, i) = item;
+  return;
+
+} /* HeapHeapify */
+
+/**Function********************************************************************
+
+  Synopsis    [Tests the heap property of a priority queue.]
+
+  Description [Tests the heap property of a priority queue.  Returns 1 if
+  successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static void
+HeapHeapifyCompare(
+  Heap_t *heap)
+{
+  int nitems = heap->nitems;
+  HeapSlot_t *slots = heap->slots;
+  int i = 0;
+  int smallest = 0;
+  void *item = ITEM(slots, 0);
+  int key = KEY(slots, 0);
+  int minkey;
+
+
+  while (1) {
+    int left = LEFT(i);
+    int right = RIGHT(i);
+    if (left < nitems && (*(heap->compare))((char *)(long)key, (char *)(long)(minkey = KEY(slots, left)))) {
+      smallest = left;
+    } else {
+      minkey = key;
+    }
+    if (right < nitems && (*(heap->compare))((char *)(long)minkey, (char *)(long)KEY(slots, right))) {
+      smallest = right;
+    }
+    if (smallest == i) break;
+    KEY(slots, i) = KEY(slots, smallest);
+    ITEM(slots, i) = ITEM(slots, smallest);
+    i = smallest;
+  }
+  KEY(slots, i) = key;
+  ITEM(slots, i) = item;
+  return;
+
+} /* HeapHeapifyCompare */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Resizes a priority queue.]
+
+  Description [Resizes a priority queue by doubling the number of
+  available slots.  Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Heap_HeapInsert]
+
+******************************************************************************/
+static int
+HeapResize(
+  Heap_t *heap)
+{
+  int oldlength = heap->length;
+  int newlength = 2 * oldlength;
+  HeapSlot_t *oldslots = heap->slots;
+  HeapSlot_t *newslots = REALLOC(HeapSlot_t, oldslots, newlength);
+  if (newslots == NIL(HeapSlot_t)) return 0;
+  heap->length = newlength;
+  heap->slots = newslots;
+  if (heap->compare) {
+    assert(Heap_HeapTestCompare(heap));
+  }
+  else {
+    assert(Heap_HeapTest(heap));
+  }
+  return 1;
+
+} /* HeapResize */
+
+/**Function********************************************************************
+
+  Synopsis    [Apply function for each element of heap.]
+
+  Description [Apply function for each element of heap. 
+               Returns 1 if successful; 0 otherwise.]
+
+  SideEffects [ ]
+
+  SeeAlso     [ ]
+
+******************************************************************************/
+void
+Heap_HeapApplyForEachElement(Heap_t *heap, int (*compare)(const void *))
+{
+int i;
+
+  for(i=0; i<heap->nitems; i++) {
+    (*compare)(heap->slots[i].item);
+  }
+  return;
+}
Index: /vis_dev/glu-2.1/src/heap/heap.h
===================================================================
--- /vis_dev/glu-2.1/src/heap/heap.h	(revision 6)
+++ /vis_dev/glu-2.1/src/heap/heap.h	(revision 6)
@@ -0,0 +1,106 @@
+/**CFile***********************************************************************
+
+  FileName    [heap.h]
+
+  PackageName [heap]
+
+  Synopsis    [Heap-based priority queue.]
+
+  Description [This is the external header file for the heap-based
+  priority queue.  The priority of each item is determined by an
+  integer key.  The first element of the heap is the one with the
+  smallest key.  Multiple items with the same key can be inserted.
+  Refer to Chapter 7 of Cormen, Leiserson, and Rivest for the theory.
+  (The only significant difference is that the array indices start
+  from 0 in this implementation.)]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [This file was created at the University of Colorado at
+  Boulder.  The University of Colorado at Boulder makes no warranty
+  about the suitability of this software for any purpose.  It is
+  presented on an AS IS basis.]
+
+  Revision    [$Id: heap.h,v 1.13 2005/05/18 19:25:43 jinh Exp $]
+
+******************************************************************************/
+
+#ifndef _HEAP
+#define _HEAP
+
+/*---------------------------------------------------------------------------*/
+/* Nested includes                                                           */
+/*---------------------------------------------------------------------------*/
+#include "util.h"
+#undef MAX
+#undef MIN
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+typedef struct HeapSlot HeapSlot_t;
+
+typedef struct Heap Heap_t;
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**Macro***********************************************************************
+
+  Synopsis    [Iterates over the elements of a heap.]
+
+  SideEffects [none]
+
+******************************************************************************/
+#define Heap_HeapForEachItem(                                              \
+  /* Heap_t * */ heap /* heap whose element should be enumerated */,       \
+  /* int */      i    /* local variable for iterator */,                   \
+  /* void * */	 data /* heap item */                                      \
+)                                                                          \
+  for((i) = 0; (((i) < (heap)->nitems) && (data = (heap)->slots[i].item)); \
+      (i)++)
+
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+EXTERN Heap_t * Heap_HeapInit ARGS((int length));
+EXTERN Heap_t * Heap_HeapInitCompare ARGS((int length, int (*compare)(const void *, const void *)));
+EXTERN void Heap_HeapFree ARGS((Heap_t *heap));
+EXTERN int Heap_HeapInsert ARGS((Heap_t *heap, void *item, long key));
+EXTERN int Heap_HeapInsertCompare ARGS((Heap_t *heap, void *item, long key));
+EXTERN int Heap_HeapExtractMin ARGS((Heap_t *heap, void *item, long *key));
+EXTERN int Heap_HeapCount ARGS((Heap_t *heap));
+EXTERN Heap_t * Heap_HeapClone ARGS((Heap_t *source));
+EXTERN int Heap_HeapTest ARGS((Heap_t *heap));
+EXTERN int Heap_HeapTestCompare ARGS((Heap_t *heap));
+EXTERN void Heap_HeapApplyForEachElement(Heap_t *heap, int (*compare)(const void *));
+
+
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _HEAP */
Index: /vis_dev/glu-2.1/src/heap/heap.make
===================================================================
--- /vis_dev/glu-2.1/src/heap/heap.make	(revision 6)
+++ /vis_dev/glu-2.1/src/heap/heap.make	(revision 6)
@@ -0,0 +1,4 @@
+CSRC += heap.c
+HEADERS += heap.h heapInt.h
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/heap/heapInt.h
===================================================================
--- /vis_dev/glu-2.1/src/heap/heapInt.h	(revision 6)
+++ /vis_dev/glu-2.1/src/heap/heapInt.h	(revision 6)
@@ -0,0 +1,144 @@
+/**CFile***********************************************************************
+
+  FileName    [heapInt.h]
+
+  PackageName [heap]
+
+  Synopsis    [Heap-based priority queue.]
+
+  Description [This is the internal header file for the heap-based priority
+  queue.]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [This file was created at the University of Colorado at
+  Boulder.  The University of Colorado at Boulder makes no warranty
+  about the suitability of this software for any purpose.  It is
+  presented on an AS IS basis.]
+
+  Revision    [$Id: heapInt.h,v 1.7 2005/05/18 19:25:43 jinh Exp $]
+
+******************************************************************************/
+
+#ifndef _HEAPINT
+#define _HEAPINT
+
+/*---------------------------------------------------------------------------*/
+/* Nested includes                                                           */
+/*---------------------------------------------------------------------------*/
+#include "heap.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/**Struct**********************************************************************
+
+  Synopsis    [Slot of a heap.]
+
+  Description [Slot of a heap.  Each slots holds a generic object and an
+  integer key.]
+
+******************************************************************************/
+struct HeapSlot {
+  long key;
+  void *item;
+};
+
+
+/**Struct**********************************************************************
+
+  Synopsis    [Heap.]
+
+  Description []
+
+******************************************************************************/
+struct Heap {
+  int length;
+  int nitems;
+  struct HeapSlot *slots;
+  int (*compare)(const void *, const void *);
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**Macro***********************************************************************
+
+  Synopsis    [Returns the parent of the i-th element in a heap.]
+
+  Description [Returns the parent of the i-th element in a heap.
+  Argument <code>i</code> should be strictly positive, otherwise the
+  result is implementation dependent.]
+
+  SideEffects [none]
+
+******************************************************************************/
+#define PARENT(i)	(((i)-1)>>1)
+
+/**Macro***********************************************************************
+
+  Synopsis    [Returns the left child of the i-th element in a heap.]
+
+  SideEffects [none]
+
+******************************************************************************/
+#define LEFT(i)		(((i)<<1)+1)
+
+/**Macro***********************************************************************
+
+  Synopsis    [Returns the right child of the i-th element in a heap.]
+
+  SideEffects [none]
+
+******************************************************************************/
+#define RIGHT(i)	(((i)+1)<<1)
+
+/**Macro***********************************************************************
+
+  Synopsis    [Returns the item stored in the i-th element in a heap.]
+
+  SideEffects [none]
+
+******************************************************************************/
+#define ITEM(p,i)	((p)[i].item)
+
+/**Macro***********************************************************************
+
+  Synopsis    [Returns the key of the i-th element in a heap.]
+
+  SideEffects [none]
+
+******************************************************************************/
+#define KEY(p,i)	((p)[i].key)
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _HEAPINT */
Index: /vis_dev/glu-2.1/src/heap/semantic.cache
===================================================================
--- /vis_dev/glu-2.1/src/heap/semantic.cache	(revision 6)
+++ /vis_dev/glu-2.1/src/heap/semantic.cache	(revision 6)
@@ -0,0 +1,26 @@
+;; Object heap/
+;; SEMANTICDB Tags save file
+(semanticdb-project-database-file "heap/"
+  :tables (list 
+   (semanticdb-table "heap.h"
+    :major-mode 'c-mode
+    :tags '(("_HEAP" variable (:constant-flag t) nil [1057 1313]) ("util.h" include nil nil [1312 1329]) ("HeapSlot_t" type (:typedef ("HeapSlot" type (:type "struct") nil nil) :superclasses "HeapSlot" :type "typedef") nil [2078 2113]) ("Heap_t" type (:typedef ("Heap" type (:type "struct") nil nil) :superclasses "Heap" :type "typedef") nil [2115 2142]) ("Heap_HeapForEachItem" variable (:constant-flag t) nil [2865 3254]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapInit" type (:type "class") nil nil)) nil [3680 3713]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapInitCompare" type (:type "class") nil nil)) nil [3730 3814]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapFree" type (:type "class") nil nil)) nil [3827 3862]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapInsert" type (:type "class") nil nil)) nil [3874 3933]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapInsertCompare" type (:type "class") nil nil)) nil [3945 4011]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapExtractMin" type (:type "class") nil nil)) nil [4023 4087]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapCount" type (:type "class") nil nil)) nil [4099 4135]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapClone" type (:type "class") nil nil)) nil [4152 4190]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapTest" type (:type "class") nil nil)) nil [4202 4237]) ("ARGS" function (:prototype-flag t :type ("Heap_HeapTestCompare" type (:type "class") nil nil)) nil [4249 4291]) ("Heap_HeapApplyForEachElement" function (:prototype-flag t :arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4333 4346]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [4347 4361])) :type "void") nil [4299 4377]))
+    :file "heap.h"
+    :pointmax 4481
+    )
+   (semanticdb-table "heap.c"
+    :major-mode 'c-mode
+    :tags '(("heapInt.h" include nil nil [642 662]) ("UNUSED" variable (:default-value "\"$Id: heap.c,v 1.18 2005/05/18 19:25:43 jinh Exp $\"" :type "int") nil [1665 1726]) ("ARGS" function (:prototype-flag t :type ("HeapHeapify" type (:type "class") nil nil)) nil [2313 2346]) ("ARGS" function (:prototype-flag t :type ("HeapHeapifyCompare" type (:type "class") nil nil)) nil [2359 2399]) ("ARGS" function (:prototype-flag t :type ("HeapResize" type (:type "class") nil nil)) nil [2411 2443]) ("Heap_HeapInit" function (:pointer 1 :arguments (("length" variable (:type "int") (reparse-symbol arg-sub-list) [3272 3283])) :type ("Heap_t" type (:type "class") nil nil)) nil [3246 3587]) ("Heap_HeapInitCompare" function (:pointer 1 :arguments (("length" variable (:type "int") (reparse-symbol arg-sub-list) [4120 4131]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [4132 4146])) :type ("Heap_t" type (:type "class") nil nil)) nil [4087 4485]) ("Heap_HeapFree" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4810 4823])) :type "void") nil [4788 4873]) ("Heap_HeapInsert" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5288 5301]) ("item" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [5304 5315]) ("key" variable (:type "long") (reparse-symbol arg-sub-list) [5318 5327])) :type "int") nil [5265 5695]) ("Heap_HeapInsertCompare" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6118 6131]) ("item" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6134 6145]) ("key" variable (:type "long") (reparse-symbol arg-sub-list) [6148 6157])) :type "int") nil [6088 6572]) ("Heap_HeapExtractMin" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7122 7135]) ("item" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [7138 7149]) ("key" variable (:pointer 1 :type "long") (reparse-symbol arg-sub-list) [7152 7162])) :type "int") nil [7095 7569]) ("Heap_HeapCount" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7905 7918])) :type "int") nil [7883 7947]) ("Heap_HeapClone" function (:pointer 1 :arguments (("source" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8272 8287])) :type ("Heap_t" type (:type "class") nil nil)) nil [8245 8661]) ("Heap_HeapTest" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9072 9085])) :type "int") nil [9051 9275]) ("Heap_HeapTestCompare" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9691 9704])) :type "int") nil [9663 9941]) ("HeapHeapify" function (:typemodifiers ("static") :arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [10781 10794])) :type "void") nil [10754 11442]) ("HeapHeapifyCompare" function (:typemodifiers ("static") :arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11862 11875])) :type "void") nil [11828 12615]) ("HeapResize" function (:typemodifiers ("static") :arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13053 13066])) :type "int") nil [13028 13465]) ("Heap_HeapApplyForEachElement" function (:arguments (("heap" variable (:pointer 1 :type ("Heap_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13887 13900]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [13901 13915])) :type "void") nil [13853 14027]))
+    :file "heap.c"
+    :pointmax 14028
+    )
+   (semanticdb-table "heapInt.h"
+    :major-mode 'c-mode
+    :tags 'nil
+    :file "heapInt.h"
+    )
+   )
+  :file "semantic.cache"
+  :semantic-tag-version "2.0beta3"
+  :semanticdb-version "2.0beta3"
+  )
Index: /vis_dev/glu-2.1/src/list/list.c
===================================================================
--- /vis_dev/glu-2.1/src/list/list.c	(revision 6)
+++ /vis_dev/glu-2.1/src/list/list.c	(revision 6)
@@ -0,0 +1,904 @@
+/*
+ * $Id: list.c,v 1.10 2005/04/18 05:14:28 fabio Exp $
+ *
+ */
+/*
+ * List Management Package
+ * 
+ * David Harrison
+ * University of California, Berkeley, 1985
+ *
+ * This package implements a simple generic linked list data type.  It
+ * uses a doubly linked list structure and provides some standard operations
+ * for storing and retrieving data from the list.
+ */
+
+#include "util.h"
+#include "list.h"		/* Self declaration        */
+
+
+/*
+ * The list identifier is in reality a pointer to the following list
+ * descriptor structure.  Lists are doubly linked with both top and
+ * bottom pointers stored in the list descriptor.  The length
+ * of the list is also stored in the descriptor.
+ */
+
+typedef struct list_elem {	/* One list element  */
+    struct list_desc *mainList;	/* List descriptor   */
+    struct list_elem *prevPtr;	/* Previous element  */
+    struct list_elem *nextPtr;	/* Next list element */
+    lsGeneric userData;		/* User pointer      */
+} lsElem;
+
+typedef struct list_desc {	/* List descriptor record            */
+    lsElem *topPtr, *botPtr;	/* Pointer to top and bottom of list */
+    int length;			/* Length of list                    */
+} lsDesc;
+
+
+/*
+ * Generators are in reality pointers to the generation descriptor 
+ * defined below.  A generator has a current spot which is *between*
+ * two items.  Thus,  a generator consists of two pointers:  record
+ * before spot and record after spot.  A pointer to the main list
+ * is included so the top and bottom pointers of the list can be
+ * modified if needed.
+ */
+
+typedef struct gen_desc {	/* Generator Descriptor 	*/
+    lsDesc *mainList;		/* Pointer to list descriptor   */
+    lsElem *beforeSpot;		/* Item before the current spot */
+    lsElem *afterSpot;		/* Item after the current spot  */
+} lsGenInternal;
+
+/*
+ * Handles are in reality pointers to lsElem records.  They are
+ * cheap to generate and need not be disposed.
+ */
+
+
+
+
+/*
+ * List Creation and Deletion
+ */
+
+lsList lsCreate(void)
+/*
+ * Creates a new linked list and returns its handle.  The handle is used
+ * by all other list manipulation routines and should not be discarded.
+ */
+{
+    lsDesc *newList;
+
+    newList = ALLOC(lsDesc, 1);
+    newList->topPtr = newList->botPtr = NIL(lsElem);
+    newList->length = 0;
+    return( (lsList) newList );
+}
+
+lsStatus lsDestroy(
+  lsList list			/* List to destroy              */,
+  void (*delFunc)(lsGeneric)	/* Routine to release user data */)
+/*
+ * Frees all resources associated with the specified list.  It frees memory
+ * associated with all elements of the list and then deletes the list.
+ * User data is released by calling 'delFunc' with the pointer as the
+ * argument.  Accessing a list after its destruction is a no-no.
+ */
+{
+    lsDesc *realList;
+    lsElem *index, *temp;
+
+    realList = (lsDesc *) list;
+    /* Get rid of elements */
+    index = realList->topPtr;
+    while (index != NIL(lsElem)) {
+	temp = index;  index = index->nextPtr;
+	if (delFunc)
+	  (*delFunc)(temp->userData);
+	FREE(temp);
+    }
+    /* Get rid of descriptor */
+    FREE(realList);
+    return(LS_OK);
+}
+
+
+
+/*
+ * Copying lists
+ */
+
+static lsGeneric lsIdentity(lsGeneric data)
+/* Identity copy function */
+{
+    return data;
+}
+
+lsList lsCopy(
+  lsList list				/* List to be copied         */,
+  lsGeneric (*copyFunc)(lsGeneric)	/* Routine to copy user data */)
+/*
+ * Returns a copy of list `list'.  If `copyFunc' is non-zero,
+ * it will be called for each item in `list' and the pointer it 
+ * returns will be used in place of the original user data for the 
+ * item in the newly created list.  The form of `copyFunc' should be:
+ *   lsGeneric copyFunc(data)
+ *   lsGeneric data;
+ * This is normally used to make copies of the user data in the new list.
+ * If no `copyFunc' is provided,  an identity function is used.
+ */
+{
+    lsList newList;
+    lsGen gen;
+    lsGeneric data;
+
+    if (!copyFunc) copyFunc = lsIdentity;
+    newList = lsCreate();
+    gen = lsStart(list);
+    while (lsNext(gen, &data, LS_NH) == LS_OK) {
+	(void) lsNewEnd(newList, (*copyFunc)(data), LS_NH);
+    }
+    lsFinish(gen);
+    return newList;
+}
+
+/*
+ * Change data in a Handle 
+ */
+
+lsStatus lsChangeData(
+  lsHandle itemHandle		/* Handle to data (returned) */,
+  lsGeneric data		/* Arbitrary pointer to data */)
+{
+   lsElem *realItem = (lsElem *) itemHandle;
+   realItem->userData =data;
+  return(LS_OK);
+}
+
+
+/*
+ * Adding New Elements to the Beginning and End of a List
+ */
+
+lsStatus lsNewBegin(
+  lsList list			/* List to add element to    */,
+  lsGeneric data		/* Arbitrary pointer to data */,
+  lsHandle *itemHandle		/* Handle to data (returned) */)
+/*
+ * Adds a new item to the start of a previously created linked list.
+ * If 'itemHandle' is non-zero,  it will be filled with a handle
+ * which can be used to generate a generator positioned at the
+ * item without generating through the list.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsElem *newElem;
+
+    newElem = ALLOC(lsElem, 1);
+    newElem->userData = data;
+    newElem->nextPtr = realList->topPtr;
+    newElem->prevPtr = NIL(lsElem);
+    newElem->mainList = realList;
+    if (realList->topPtr == NIL(lsElem)) {
+	/* The new item is both the top and bottom element */
+	realList->botPtr = newElem;
+    } else {
+	/* There was a top element - make its prev correct */
+	realList->topPtr->prevPtr = newElem;
+    }
+    realList->topPtr = newElem;
+    realList->length += 1;
+    if (itemHandle) *itemHandle = (lsHandle) newElem;
+    return(LS_OK);
+}
+
+lsStatus lsNewEnd(
+  lsList list			/* List to append element to */,
+  lsGeneric data		/* Arbitrary pointer to data */,
+  lsHandle *itemHandle		/* Handle to data (returned) */)
+/*
+ * Adds a new item to the end of a previously created linked list.
+ * This routine appends the item in constant time and
+ * can be used freely without guilt.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsElem *newElem;
+
+    newElem = ALLOC(lsElem, 1);
+    newElem->userData = data;
+    newElem->prevPtr = realList->botPtr;
+    newElem->nextPtr = NIL(lsElem);
+    newElem->mainList = realList;
+    if (realList->topPtr == NIL(lsElem))
+      realList->topPtr = newElem;
+    if (realList->botPtr != NIL(lsElem))
+      realList->botPtr->nextPtr = newElem;
+    realList->botPtr = newElem;
+    realList->length += 1;
+    if (itemHandle) *itemHandle = (lsHandle) newElem;
+    return(LS_OK);
+}
+
+/*
+ * Retrieving the first and last items of a list
+ */
+
+lsStatus lsFirstItem(
+  lsList list			/* List to get item from */,
+  lsGeneric data		/* User data (returned)  */,
+  lsHandle *itemHandle		/* Handle to data (returned) */)
+/*
+ * Returns the first item in the list.  If the list is empty,
+ * it returns LS_NOMORE.  Otherwise,  it returns LS_OK.
+ * If 'itemHandle' is non-zero,  it will be filled with a
+ * handle which may be used to generate a generator.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+
+    if (realList->topPtr != NIL(lsElem)) {
+	*(void **)data = realList->topPtr->userData;
+	if (itemHandle) *itemHandle = (lsHandle) (realList->topPtr);
+	return(LS_OK);
+    } else {
+	*(void **)data = (lsGeneric) 0;
+	if (itemHandle) *itemHandle = (lsHandle) 0;
+	return(LS_NOMORE);
+    }
+}
+
+lsStatus lsLastItem(
+  lsList list			/* List to get item from */,
+  lsGeneric data		/* User data (returned)  */,
+  lsHandle *itemHandle		/* Handle to data (returned) */)
+/*
+ * Returns the last item of a list.  If the list is empty,
+ * the routine returns LS_NOMORE.  Otherwise,  'data' will
+ * be set to the last item and the routine will return LS_OK.
+ * If 'itemHandle' is non-zero,  it will be filled with a
+ * handle which can be used to generate a generator postioned
+ * at this item.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+
+    if (realList->botPtr != NIL(lsElem)) {
+	*(void **)data = realList->botPtr->userData;
+	if (itemHandle) *itemHandle = (lsHandle) (realList->botPtr);
+	return(LS_OK);
+    } else {
+	*(void **)data = (lsGeneric) 0;
+	if (itemHandle) *itemHandle = (lsHandle) 0;
+	return(LS_NOMORE);
+    }
+}
+
+
+/* Length of a list */
+
+int lsLength(
+  lsList list			/* List to get the length of */)
+/*
+ * Returns the length of the list.  The list must have been
+ * already created using lsCreate.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+
+    return(realList->length);
+}
+
+
+/*
+ * Deleting first and last items of a list
+ */
+
+lsStatus lsDelBegin(
+  lsList list			/* List to delete item from     */,
+  lsGeneric data		/* First item (returned)        */)
+/*
+ * This routine deletes the first item of a list.  The user
+ * data associated with the item is returned so the caller
+ * may dispose of it.  Returns LS_NOMORE if there is no
+ * item to delete.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsElem *temp;
+
+    if (realList->topPtr == NIL(lsElem)) {
+	/* Nothing to delete */
+	*(void **)data = (lsGeneric) 0;
+	return LS_NOMORE;
+    } else {
+	*(void **)data = realList->topPtr->userData;
+	temp = realList->topPtr;
+	realList->topPtr = realList->topPtr->nextPtr;
+	if (temp->nextPtr != NIL(lsElem)) {
+	    /* There is something after the first item */
+	    temp->nextPtr->prevPtr = NIL(lsElem);
+	} else {
+	    /* Nothing after it - bottom becomes null as well */
+	    realList->botPtr = NIL(lsElem);
+	}
+	FREE(temp);
+	realList->length -= 1;
+    }
+    return LS_OK;
+}
+
+
+lsStatus lsDelEnd(
+  lsList list			/* List to delete item from */,
+  lsGeneric data		/* Last item (returned)     */)
+/*
+ * This routine deletes the last item of a list.  The user
+ * data associated with the item is returned so the caller
+ * may dispose of it.  Returns LS_NOMORE if there is nothing
+ * to delete.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsElem *temp;
+
+    if (realList->botPtr == NIL(lsElem)) {
+	/* Nothing to delete */
+	*(void **)data = (lsGeneric) 0;
+	return LS_NOMORE;
+    } else {
+	*(void **)data = realList->botPtr->userData;
+	temp = realList->botPtr;
+	realList->botPtr = realList->botPtr->prevPtr;
+	if (temp->prevPtr != NIL(lsElem)) {
+	    /* There is something before the last item */
+	    temp->prevPtr->nextPtr = NIL(lsElem);
+	} else {
+	    /* Nothing before it - top becomes null as well */
+	    realList->topPtr = NIL(lsElem);
+	}
+	FREE(temp);
+	realList->length -= 1;
+    }
+    return LS_OK;
+}
+
+
+/*
+ * List Generation Routines
+ *
+ * nowPtr is the element just before the next one to be generated
+ */
+
+lsGen lsStart(
+  lsList list			/* List to generate items from */)
+/*
+ * This routine defines a generator which is used to step through
+ * each item of the list.  It returns a generator handle which should
+ * be used when calling lsNext, lsPrev, lsInBefore, lsInAfter, lsDelete,
+ * or lsFinish.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsGenInternal *newGen;
+
+    newGen = ALLOC(lsGenInternal, 1);
+    newGen->mainList = realList;
+    newGen->beforeSpot = NIL(lsElem);
+    newGen->afterSpot = realList->topPtr;
+    return ( (lsGen) newGen );
+}
+
+lsGen lsEnd(
+  lsList list			/* List to generate items from */)
+/*
+ * This routine defines a generator which is used to step through
+ * each item of a list.  The generator is initialized to the end 
+ * of the list.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsGenInternal *newGen;
+
+    newGen = ALLOC(lsGenInternal, 1);
+    newGen->mainList = realList;
+    newGen->beforeSpot = realList->botPtr;
+    newGen->afterSpot = NIL(lsElem);
+    return (lsGen) newGen;
+}
+
+lsGen lsGenHandle(
+  lsHandle itemHandle		/* Handle of an item         */,
+  lsGeneric data		/* Data associated with item */,
+  int option			/* LS_BEFORE or LS_AFTER     */)
+/*
+ * This routine produces a generator given a handle.  Handles
+ * are produced whenever an item is added to a list.  The generator
+ * produced by this routine may be used when calling any of 
+ * the standard generation routines.  NOTE:  the generator
+ * should be freed using lsFinish.  The 'option' parameter
+ * determines whether the generator spot is before or after
+ * the handle item.
+ */
+{
+    lsElem *realItem = (lsElem *) itemHandle;
+    lsGenInternal *newGen;
+
+    newGen = ALLOC(lsGenInternal, 1);
+    newGen->mainList = realItem->mainList;
+    *(void **)data = realItem->userData;
+    if (option & LS_BEFORE) {
+	newGen->beforeSpot = realItem->prevPtr;
+	newGen->afterSpot = realItem;
+    } else if (option & LS_AFTER) {
+	newGen->beforeSpot = realItem;
+	newGen->afterSpot = realItem->nextPtr;
+    } else {
+	FREE(newGen);
+	newGen = (lsGenInternal *) 0;
+    }
+    return ( (lsGen) newGen );
+}
+
+
+lsStatus lsNext(
+  lsGen generator		/* Generator handle        */,
+  lsGeneric data		/* User data (return)      */,
+  lsHandle *itemHandle		/* Handle to item (return) */)
+/*
+ * Generates the item after the item previously generated by lsNext
+ * or lsPrev.   It returns a pointer to the user data structure in 'data'.  
+ * 'itemHandle' may be used to get a generation handle without
+ * generating through the list to find the item.  If there are no more 
+ * elements to generate, the routine returns  LS_NOMORE (normally it 
+ * returns LS_OK).  lsNext DOES NOT automatically clean up after all 
+ * elements have been generated.  lsFinish must be called explicitly to do this.
+ */
+{
+    register lsGenInternal *realGen = (lsGenInternal *) generator;
+
+    if (realGen->afterSpot == NIL(lsElem)) {
+	/* No more stuff to generate */
+	*(void **) data = (lsGeneric) 0;
+	if (itemHandle) *itemHandle = (lsHandle) 0;
+	return LS_NOMORE;
+    } else {
+	*(void **) data = realGen->afterSpot->userData;
+	if (itemHandle) *itemHandle = (lsHandle) (realGen->afterSpot);
+	/* Move the pointers down one */
+	realGen->beforeSpot = realGen->afterSpot;
+	realGen->afterSpot = realGen->afterSpot->nextPtr;
+	return LS_OK;
+    }
+}
+
+
+lsStatus lsPrev(
+  lsGen generator		/* Generator handle        */,
+  lsGeneric data		/* User data (return)      */,
+  lsHandle *itemHandle		/* Handle to item (return) */)
+/*
+ * Generates the item before the item previously generated by lsNext
+ * or lsPrev.   It returns a pointer to the user data structure in 'data'.  
+ * 'itemHandle' may be used to get a generation handle without
+ * generating through the list to find the item.  If there are no more 
+ * elements to generate, the routine returns  LS_NOMORE (normally it 
+ * returns LS_OK).  lsPrev DOES NOT automatically clean up after all 
+ * elements have been generated.  lsFinish must be called explicitly to do this.
+ */
+{
+    register lsGenInternal *realGen = (lsGenInternal *) generator;
+
+    if (realGen->beforeSpot == NIL(lsElem)) {
+	/* No more stuff to generate */
+	*(void **) data = (lsGeneric) 0;
+	if (itemHandle) *itemHandle = (lsHandle) 0;
+	return LS_NOMORE;
+    } else {
+	*(void **) data = realGen->beforeSpot->userData;
+	if (itemHandle) *itemHandle = (lsHandle) (realGen->beforeSpot);
+	/* Move the pointers down one */
+	realGen->afterSpot = realGen->beforeSpot;
+	realGen->beforeSpot = realGen->beforeSpot->prevPtr;
+	return LS_OK;
+    }
+
+}
+
+lsStatus lsInBefore(
+  lsGen generator		/* Generator handle          */,
+  lsGeneric data		/* Arbitrary pointer to data */,
+  lsHandle *itemHandle		/* Handle to item (return) */)
+/*
+ * Inserts an element BEFORE the current spot.  The item generated
+ * by lsNext will be unchanged;  the inserted item will be generated
+ * by lsPrev.  This modifies the list.  'itemHandle' may be used at 
+ * a later time to produce a generation handle without generating 
+ * through the list.
+ */
+{
+    lsGenInternal *realGen = (lsGenInternal *) generator;
+    lsElem *newElem;
+
+    if (realGen->beforeSpot == NIL(lsElem)) {
+	/* Item added to the beginning of the list */
+	(void) lsNewBegin((lsList) realGen->mainList, data, itemHandle);
+	realGen->beforeSpot = realGen->mainList->topPtr;
+	return LS_OK;
+    } else if (realGen->afterSpot == NIL(lsElem)) {
+	/* Item added to the end of the list */
+	(void) lsNewEnd((lsList) realGen->mainList, data, itemHandle);
+	realGen->afterSpot = realGen->mainList->botPtr;
+	return LS_OK;
+    } else {
+	/* Item added in the middle of the list */
+	newElem = ALLOC(lsElem, 1);
+	newElem->mainList = realGen->mainList;
+	newElem->prevPtr = realGen->beforeSpot;
+	newElem->nextPtr = realGen->afterSpot;
+	newElem->userData = data;
+	realGen->beforeSpot->nextPtr = newElem;
+	realGen->afterSpot->prevPtr = newElem;
+	realGen->beforeSpot = newElem;
+	realGen->mainList->length += 1;
+	if (itemHandle) *itemHandle = (lsHandle) newElem;
+	return LS_OK;
+    }
+}
+
+lsStatus lsInAfter(
+  lsGen generator		/* Generator handle          */,
+  lsGeneric data		/* Arbitrary pointer to data */,
+  lsHandle *itemHandle		/* Handle to item (return)   */)
+/*
+ * Inserts an element AFTER the current spot.  The next item generated
+ * by lsNext will be the new element.  The next  item generated by
+ * lsPrev is unchanged.  This modifies the list.  'itemHandle' may
+ * be used at a later time to generate a generation handle without
+ * searching through the list to find the item.
+ */
+{
+    lsGenInternal *realGen = (lsGenInternal *) generator;
+    lsElem *newElem;
+
+    if (realGen->beforeSpot == NIL(lsElem)) {
+	/* Item added to the beginning of the list */
+	(void) lsNewBegin((lsList) realGen->mainList, data, itemHandle);
+	realGen->beforeSpot = realGen->mainList->topPtr;
+	return LS_OK;
+    } else if (realGen->afterSpot == NIL(lsElem)) {
+	/* Item added to the end of the list */
+	(void) lsNewEnd((lsList) realGen->mainList, data, itemHandle);
+	realGen->afterSpot = realGen->mainList->botPtr;
+	return LS_OK;
+    } else {
+	/* Item added in the middle of the list */
+	newElem = ALLOC(lsElem, 1);
+	newElem->mainList = realGen->mainList;
+	newElem->prevPtr = realGen->beforeSpot;
+	newElem->nextPtr = realGen->afterSpot;
+	newElem->userData = data;
+	realGen->beforeSpot->nextPtr = newElem;
+	realGen->afterSpot->prevPtr = newElem;
+	realGen->afterSpot = newElem;
+	realGen->mainList->length += 1;
+	if (itemHandle) *itemHandle = (lsHandle) newElem;
+	return LS_OK;
+    }
+}
+	
+
+lsStatus lsDelBefore(
+  lsGen generator		/* Generator handle        */,
+  lsGeneric data		/* Deleted item (returned) */)
+/*
+ * Removes the item before the current spot.  The next call to lsPrev
+ * will return the item before the deleted item.  The next call to lsNext
+ * will be uneffected.  This modifies the list.  The routine returns 
+ * LS_BADSTATE if the user tries to call the routine and there is
+ * no item before the current spot.  This routine returns the userData
+ * of the deleted item so it may be freed (if necessary).
+ */
+{
+    lsGenInternal *realGen = (lsGenInternal *) generator;
+    lsElem *doomedItem;
+
+    if (realGen->beforeSpot == NIL(lsElem)) {
+	/* No item to delete */
+	*(void **)data = (lsGeneric) 0;
+	return LS_BADSTATE;
+    } else if (realGen->beforeSpot == realGen->mainList->topPtr) {
+	/* Delete the first item of the list */
+	realGen->beforeSpot = realGen->beforeSpot->prevPtr;
+	return lsDelBegin((lsList) realGen->mainList, data);
+    } else if (realGen->beforeSpot == realGen->mainList->botPtr) {
+	/* Delete the last item of the list */
+	realGen->beforeSpot = realGen->beforeSpot->prevPtr;
+	return lsDelEnd((lsList) realGen->mainList, data);
+    } else {
+	/* Normal mid list deletion */
+	doomedItem = realGen->beforeSpot;
+	doomedItem->prevPtr->nextPtr = doomedItem->nextPtr;
+	doomedItem->nextPtr->prevPtr = doomedItem->prevPtr;
+	realGen->beforeSpot = doomedItem->prevPtr;
+	realGen->mainList->length -= 1;
+	*(void **)data = doomedItem->userData;
+	FREE(doomedItem);
+	return LS_OK;
+    }
+}
+
+
+lsStatus lsDelAfter(
+  lsGen generator		/* Generator handle        */,
+  lsGeneric data		/* Deleted item (returned) */)
+/*
+ * Removes the item after the current spot.  The next call to lsNext
+ * will return the item after the deleted item.  The next call to lsPrev
+ * will be uneffected.  This modifies the list.  The routine returns 
+ * LS_BADSTATE if the user tries to call the routine and there is
+ * no item after the current spot.  This routine returns the userData
+ * of the deleted item so it may be freed (if necessary).
+ */
+{
+    lsGenInternal *realGen = (lsGenInternal *) generator;
+    lsElem *doomedItem;
+
+    if (realGen->afterSpot == NIL(lsElem)) {
+	/* No item to delete */
+	*(void **)data = (lsGeneric) 0;
+	return LS_BADSTATE;
+    } else if (realGen->afterSpot == realGen->mainList->topPtr) {
+	/* Delete the first item of the list */
+	realGen->afterSpot = realGen->afterSpot->nextPtr;
+	return lsDelBegin((lsList) realGen->mainList, data);
+    } else if (realGen->afterSpot == realGen->mainList->botPtr) {
+	/* Delete the last item of the list */
+	realGen->afterSpot = realGen->afterSpot->nextPtr;
+	return lsDelEnd((lsList) realGen->mainList, data);
+    } else {
+	/* Normal mid list deletion */
+	doomedItem = realGen->afterSpot;
+	doomedItem->prevPtr->nextPtr = doomedItem->nextPtr;
+	doomedItem->nextPtr->prevPtr = doomedItem->prevPtr;
+	realGen->afterSpot = doomedItem->nextPtr;
+	realGen->mainList->length -= 1;
+	*(void **)data = doomedItem->userData;
+	FREE(doomedItem);
+	return LS_OK;
+    }
+}
+
+
+lsStatus lsFinish(
+  lsGen generator		/* Generator handle */)
+/*
+ * Marks the completion of a generation of list items.  This routine should
+ * be called after calls to lsNext to free resources used by the
+ * generator.  This rule applies even if all items of a list are
+ * generated by lsNext.
+ */
+{
+    lsGenInternal *realGen = (lsGenInternal *) generator;
+
+    FREE(realGen);
+    return(LS_OK);
+}
+
+
+
+/*
+ * Functional list generation
+ *
+ * An alternate form of generating through items of a list is provided.
+ * The routines below generatae through all items of a list in a given
+ * direction and call a user provided function for each one.
+ */
+
+static lsStatus lsGenForm(lsStatus (*userFunc)(lsGeneric, lsGeneric),
+			  lsGeneric arg, lsGen gen,
+			  lsStatus (*gen_func)(lsGen, lsGeneric, lsHandle *),
+			  lsStatus (*del_func)(lsGen, lsGeneric));
+
+lsStatus lsForeach(
+  lsList list			/* List to generate through */,
+  lsStatus (*userFunc)(lsGeneric, lsGeneric) /* User provided function   */,
+  lsGeneric arg			/* User provided data       */)
+/*
+ * This routine generates all items in `list' from the first item
+ * to the last calling `userFunc' for each item.  The function
+ * should have the following form:
+ *   lsStatus userFunc(data, arg)
+ *   lsGeneric data;
+ *   lsGeneric arg;
+ * `data' will be the user data associated with the item generated.
+ * `arg' will be the same pointer provided to lsForeach.  The
+ * routine should return LS_OK to continue the generation,  LS_STOP
+ * to stop generating items,  and LS_DELETE to delete the item
+ * from the list.  If the generation was stopped prematurely,
+ * the routine will return LS_STOP.  If the user provided function
+ * does not return an appropriate value,  the routine will return
+ * LS_BADPARAM.
+ */
+{
+    return lsGenForm(userFunc, arg, lsStart(list), lsNext, lsDelBefore);
+}
+
+
+lsStatus lsBackeach(
+  lsList list			/* List to generate through */,
+  lsStatus (*userFunc)(lsGeneric, lsGeneric) /* User provided function   */,
+  lsGeneric arg			/* User provided data       */)
+/*
+ * This routine is just like lsForeach except it generates
+ * all items in `list' from the last item to the first.
+ */
+{
+    return lsGenForm(userFunc, arg, lsEnd(list), lsPrev, lsDelAfter);
+}
+
+
+static lsStatus lsGenForm(
+  lsStatus (*userFunc)(lsGeneric, lsGeneric) /* User provided function */,
+  lsGeneric arg			/* Data to pass to function       */,
+  lsGen gen			/* Generator to use               */,
+  lsStatus (*gen_func)(lsGen, lsGeneric, lsHandle *)
+				/* Generator function to use      */,
+  lsStatus (*del_func)(lsGen, lsGeneric) /* Deletion function to use */)
+/*
+ * This is the function used to implement the two functional
+ * generation interfaces to lists.
+ */
+{
+    lsGeneric data;
+
+    while ((*gen_func)(gen, &data, LS_NH) == LS_OK) {
+	switch ((*userFunc)(data, arg)) {
+	case LS_OK:
+	    /* Nothing */
+	    break;
+	case LS_STOP:
+	    (void) lsFinish(gen);
+	    return LS_STOP;
+	case LS_DELETE:
+	    (*del_func)(gen, &data);
+	    break;
+	default:
+	    return LS_BADPARAM;
+	}
+    }
+    (void) lsFinish(gen);
+    return LS_OK;
+}
+
+
+lsList lsQueryHandle(
+  lsHandle itemHandle		/* Handle of an item  */)
+/*
+ * This routine returns the associated list of the specified
+ * handle.  Returns 0 if there were problems.
+ */
+{
+    lsElem *realHandle = (lsElem *) itemHandle;
+
+    if (realHandle) {
+	return (lsList) realHandle->mainList;
+    } else {
+	return (lsList) 0;
+    }
+}
+
+lsGeneric lsFetchHandle(lsHandle itemHandle)
+/*
+ * This routine returns the user data of the item associated with
+ * `itemHandle'.
+ */
+{
+    return ((lsElem *) itemHandle)->userData;
+}
+
+lsStatus lsRemoveItem(
+  lsHandle itemHandle		/* Handle of an item */,
+  lsGeneric userData		/* Returned data     */)
+/*
+ * This routine removes the item associated with `handle' from
+ * its list and returns the user data associated with the item
+ * for reclaimation purposes.  Note this modifies the list
+ * that originally contained `item'.
+ */
+{
+    lsElem *realItem = (lsElem *) itemHandle;
+    lsGenInternal gen;
+
+    gen.mainList = realItem->mainList;
+    gen.beforeSpot = realItem->prevPtr;
+    gen.afterSpot = realItem;
+    return lsDelAfter((lsGen) &gen, userData);
+}
+
+
+/* List sorting support */
+#define TYPE		lsElem
+#define SORT		lsSortItems
+#define NEXT		nextPtr
+#define FIELD		userData
+#include "lsort.h"		/* Merge sort by R. Rudell */
+
+lsStatus lsSort(
+  lsList list				/* List to sort        */,
+  int (*compare)(lsGeneric, lsGeneric)	/* Comparison function */)
+/*
+ * This routine sorts `list' using `compare' as the comparison
+ * function between items in the list.  `compare' has the following form:
+ *   int compare(item1, item2)
+ *   lsGeneric item1, item2;
+ * The routine should return -1 if item1 is less than item2, 0 if
+ * they are equal,  and 1 if item1 is greater than item2.
+ * The routine uses a generic merge sort written by Rick Rudell.
+ */
+{
+    lsDesc *realList = (lsDesc *) list;
+    lsElem *idx, *lastElem;
+
+    realList->topPtr = lsSortItems(realList->topPtr, compare,
+				  realList->length);
+
+    /* Forward pointers are correct - fix backward pointers */
+    lastElem = (lsElem *) 0;
+    for (idx = realList->topPtr;  idx != (lsElem *) 0;  idx = idx->nextPtr) {
+	idx->prevPtr = lastElem;
+	lastElem = idx;
+    }
+    /* lastElem is last item in list */
+    realList->botPtr = lastElem;
+    return LS_OK;
+}
+
+
+lsStatus lsUniq(
+  lsList list				/* List to remove duplicates from */,
+  int (*compare)(lsGeneric, lsGeneric)	/* Item comparison function       */,
+  void (*delFunc)(lsGeneric)		/* Function to release user data  */)
+/*
+ * This routine takes a sorted list and removes all duplicates
+ * from it.  `compare' has the following form:
+ *   int compare(item1, item2)
+ *   lsGeneric item1, item2;
+ * The routine should return -1 if item1 is less than item2, 0 if
+ * they are equal,  and 1 if item1 is greater than item2. `delFunc'
+ * will be called with a pointer to a user data item for each
+ * duplicate destroyed.  `delFunc' can be zero if no clean up
+ * is required.
+ */
+{
+    lsGeneric this_item, last_item;
+    lsGenInternal realGen;
+    lsDesc *realList = (lsDesc *) list;
+
+    if (realList->length > 1) {
+	last_item = realList->topPtr->userData;
+
+	/* Inline creation of generator */
+	realGen.mainList = realList;
+	realGen.beforeSpot = realList->topPtr;
+	realGen.afterSpot = realList->topPtr->nextPtr;
+
+	while (realGen.afterSpot) {
+	    this_item = realGen.afterSpot->userData;
+	    if ((*compare)(this_item, last_item) == 0) {
+		/* Duplicate -- eliminate */
+		(void) lsDelAfter((lsGen) &realGen, &this_item);
+		if (delFunc) (*delFunc)(this_item);
+	    } else {
+		/* Move generator forward */
+		realGen.beforeSpot = realGen.afterSpot;
+		realGen.afterSpot = realGen.afterSpot->nextPtr;
+		last_item = this_item;
+	    }
+	}
+    }
+    return LS_OK;
+}
Index: /vis_dev/glu-2.1/src/list/list.h
===================================================================
--- /vis_dev/glu-2.1/src/list/list.h	(revision 6)
+++ /vis_dev/glu-2.1/src/list/list.h	(revision 6)
@@ -0,0 +1,128 @@
+/*
+ * $Id: list.h,v 1.8 2005/04/18 05:14:28 fabio Exp $
+ *
+ */
+/*
+ * List Management Package Header File
+ *
+ * David Harrison
+ * University of California, 1985
+ *
+ * This file contains public type definitions for the List Managment
+ * package implemented in list.c.  This is stand alone package.
+ */
+
+#ifndef LS_DEFINED
+#define LS_DEFINED
+
+typedef void ls_dummy;
+
+typedef ls_dummy *lsList;	/* List handle           */
+typedef ls_dummy *lsGen;	/* List generator handle */
+typedef ls_dummy *lsHandle;	/* Handle to an item     */
+typedef int lsStatus;		/* Return codes          */
+typedef void *lsGeneric;	/* Generic pointer       */
+
+#define	LS_NIL		0	/* Nil for lsList       */
+
+#define LS_BADSTATE	-3	/* Bad generator state   */
+#define LS_BADPARAM	-2	/* Bad parameter value   */
+#define LS_NOMORE	-1	/* No more items         */
+
+#define	LS_OK		0
+
+#define LS_BEFORE	1	/* Set spot before object */
+#define LS_AFTER	2	/* Set spot after object  */
+#define LS_STOP		3	/* Stop generating items  */
+#define LS_DELETE	4	/* Delete generated item  */
+
+/*
+ * For all those routines that take a handle,  this macro can be
+ * used when no handle is required.
+ */
+
+#define LS_NH		(lsHandle *) 0
+
+typedef lsGeneric (*LS_PFLSG)(lsGeneric);
+
+EXTERN lsList lsCreate ARGS((void));
+  /* Create a new list */
+EXTERN lsStatus lsDestroy ARGS((lsList, void (*)(lsGeneric)));
+  /* Delete a previously created list */
+EXTERN lsList lsCopy ARGS((lsList, LS_PFLSG));
+   /* Copies the contents of a list    */
+
+EXTERN lsStatus lsFirstItem ARGS((lsList, lsGeneric, lsHandle *));
+  /* Gets the first item of a list */
+EXTERN lsStatus lsLastItem ARGS((lsList, lsGeneric, lsHandle *));
+  /* Gets the last item of a list */
+
+EXTERN lsStatus lsNewBegin ARGS((lsList, lsGeneric, lsHandle *));
+  /* Add item to start of list */
+EXTERN lsStatus lsNewEnd ARGS((lsList, lsGeneric, lsHandle *));
+  /* Add item to end of list */
+
+EXTERN lsStatus lsDelBegin ARGS((lsList, lsGeneric));
+  /* Delete first item of a list */
+EXTERN lsStatus lsDelEnd ARGS((lsList, lsGeneric));
+  /* Delete last item of a list */
+
+EXTERN int lsLength ARGS((lsList));
+  /* Returns the length of the list */
+
+EXTERN lsGen lsStart ARGS((lsList));
+  /* Begin generation of items in a list */
+EXTERN lsGen lsEnd ARGS((lsList));
+  /* Begin generation at end of list */
+EXTERN lsGen lsGenHandle ARGS((lsHandle, lsGeneric, int));
+  /* Produces a generator given a handle */
+EXTERN lsStatus lsNext ARGS((lsGen, lsGeneric, lsHandle *));
+  /* Generate next item in sequence */
+EXTERN lsStatus lsPrev ARGS((lsGen, lsGeneric, lsHandle *));
+  /* Generate previous item in sequence */
+EXTERN lsStatus lsInBefore ARGS((lsGen, lsGeneric, lsHandle *));
+  /* Insert an item before the most recently generated by lsNext */
+EXTERN lsStatus lsInAfter ARGS((lsGen, lsGeneric, lsHandle *));
+  /* Insert an item after the most recently generated by lsNext  */
+EXTERN lsStatus lsDelBefore ARGS((lsGen, lsGeneric));
+  /* Delete the item before the current spot */
+EXTERN lsStatus lsDelAfter ARGS((lsGen, lsGeneric));
+  /* Delete the item after the current spot */
+EXTERN lsStatus lsFinish ARGS((lsGen));
+  /* End generation of items in a list */
+EXTERN lsStatus lsForeach ARGS((lsList list, lsStatus (*userFunc)(lsGeneric, lsGeneric), lsGeneric arg));
+  /* Generation of all items of a list from the first */
+EXTERN lsStatus lsBackeach ARGS((lsList list, lsStatus (*userFunc)(lsGeneric, lsGeneric), lsGeneric arg));
+  /* Generation of all items of a list from the last */
+
+EXTERN lsList lsQueryHandle ARGS((lsHandle));
+  /* Returns the list of a handle */
+EXTERN lsGeneric lsFetchHandle ARGS((lsHandle));
+  /* Returns data associated with handle */
+EXTERN lsStatus lsRemoveItem ARGS((lsHandle, lsGeneric));
+  /* Removes item associated with handle from list */
+
+EXTERN lsStatus lsSort ARGS((lsList, int (*)(lsGeneric, lsGeneric)));
+
+  /* Sorts a list */
+EXTERN lsStatus lsUniq ARGS((lsList, int (*)(lsGeneric, lsGeneric), void (*)(lsGeneric) ));
+  /* Removes duplicates from a sorted list */
+/*
+ * Macro to iterate the items of a list.Note the following:
+ * 1) in a for loop, the test is evaluate before the first time through the body
+ * 2) the logical OR operator guarantees left to right evaluation, and the second
+ *    operand is not evaluated if first operand evaluates to non-zero
+ * 3) the comma operator returns the value of its second argument.
+ */
+#define lsForEachItem(                                         \
+  list,  /* lsList, list to iterate */                         \
+  gen,   /* lsGen, local variable for iterator */              \
+  data   /* lsGeneric, variable to return data */              \
+)				                               \
+  for(gen = lsStart(list); 				       \
+      (lsNext(gen, &data, LS_NH) == LS_OK)       \
+      || ((void) lsFinish(gen), 0);                            \
+      )
+
+
+#endif
Index: /vis_dev/glu-2.1/src/list/list.make
===================================================================
--- /vis_dev/glu-2.1/src/list/list.make	(revision 6)
+++ /vis_dev/glu-2.1/src/list/list.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += list.c
+HEADERS += list.h lsort.h
+MISC += list.doc
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/list/lsort.h
===================================================================
--- /vis_dev/glu-2.1/src/list/lsort.h	(revision 6)
+++ /vis_dev/glu-2.1/src/list/lsort.h	(revision 6)
@@ -0,0 +1,157 @@
+/*
+ * $Id: lsort.h,v 1.6 2005/04/15 23:23:47 fabio Exp $
+ *
+ */
+/*
+ *  Generic linked-list sorting package
+ *  Richard Rudell, UC Berkeley, 4/1/87
+ *
+ *  Use:
+ *	#define TYPE		the linked-list type (a struct or typedef)
+ *	#define SORT		sorting routine (see below)
+ *	#include "lsort.h"
+ *
+ *  Optional:
+ *	#define NEXT		'next' field name in the linked-list structure
+ *	#define DECL_SORT	'static' or undefined
+ *	#define DECL_SORT1	'static' or undefined
+ *	#define SORT1		optional sorting routine interface
+ *	#define FIELD		select subfield of the structure for compare
+ *	#define DIRECT_COMPARE	in-line expand the compare routine
+ *
+ *  This defines up to two routines:
+ *	DECL_SORT TYPE *
+ *	SORT1(list, compare)
+ *	TYPE *list;
+ *	int (*compare)(TYPE *x, TYPE *y);
+ *	    sort the linked list 'list' according to the compare function
+ *	    'compare'
+ *
+ *	DECL_SORT1 TYPE *
+ *	SORT(list, compare, length)
+ *	TYPE *list;
+ *	int (*compare)(TYPE *x, TYPE *y);
+ *	int length;
+ *	    sort the linked list 'list' according to the compare function
+ *	    'compare'.  length is the length of the linked list.
+ *
+ *  Both routines gracefully handle length == 0 (in which case, list == 0 
+ *  is also allowed).
+ *
+ *  NEXT defines the name of the next field in the linked list.  If not
+ *  given, 'next' is assumed.
+ *
+ *  By default, both routines are declared 'static'.  This can be changed
+ *  using '#define DECL_SORT' or '#define DECL_SORT1'.
+ *
+ *  If FIELD is used, then a pointer to the particular field is passed
+ *  to the comparison function (rather than a TYPE *).  In this case,
+ *  the compare function is called with:
+ *	
+ *		if ((*compare)(x->FIELD, y->FIELD)) {
+ *
+ *  If DIRECT_COMPARE is used, then the 'FIELD' items are compared using
+ *  a simple '>' (useful for scalars to save subroutine overhead)
+ */
+
+#ifndef NEXT
+#define NEXT next
+#endif
+
+#ifndef DECL_SORT1
+#define DECL_SORT1 static
+#endif
+
+#ifndef DECL_SORT
+#define DECL_SORT static
+#endif
+
+#ifdef FIELD
+#define COMPTYPE void *
+#else
+#define COMPTYPE TYPE
+#endif
+
+DECL_SORT TYPE *SORT(TYPE *list_in,
+		     int (*compare)(COMPTYPE, COMPTYPE), int cnt);
+
+
+#ifdef SORT1
+
+DECL_SORT1 TYPE *
+SORT1(TYPE *list_in, int (*compare)(COMPTYPE, COMPTYPE))
+{
+    register int cnt;
+    register TYPE *p;
+
+    /* Find the length of the list */
+    for(p = list_in, cnt = 0; p != 0; p = p->NEXT, cnt++)
+	;
+    return SORT(list_in, compare, cnt);
+}
+
+#endif
+
+
+DECL_SORT TYPE *
+SORT(TYPE *list_in, int (*compare)(COMPTYPE, COMPTYPE), int cnt)
+{
+    register TYPE *p, **plast, *list1, *list2;
+    register int i;
+
+    if (cnt > 1) {
+	/* break the list in half */
+	for(p = list_in, i = cnt/2-1; i > 0; p = p->NEXT, i--)
+	    ;
+	list1 = list_in;
+	list2 = p->NEXT;
+	p->NEXT = 0;
+
+	/* Recursively sort the sub-lists (unless only 1 element) */
+	if ((i = cnt/2) > 1) {
+	    list1 = SORT(list1, compare, i);
+	}
+	if ((i = cnt - i) > 1) {
+	    list2 = SORT(list2, compare, i);
+	}
+
+	/* Merge the two sorted sub-lists */
+	plast = &list_in;
+	for(;;) {
+#ifdef FIELD
+#ifdef DIRECT_COMPARE
+	    if (list1->FIELD < list2->FIELD) {
+#else
+	    if ((*compare)(list1->FIELD, list2->FIELD) <= 0) {
+#endif
+#else
+	    if ((*compare)(list1, list2) <= 0) {
+#endif
+		*plast = list1;
+		plast = &(list1->NEXT);
+		if ((list1 = list1->NEXT) == 0) {
+		    *plast = list2;
+		    break;
+		}
+	    } else {
+		*plast = list2;
+		plast = &(list2->NEXT);
+		if ((list2 = list2->NEXT) == 0) {
+		    *plast = list1;
+		    break;
+		}
+	    }
+	}
+    }
+
+    return list_in;
+}
+
+#undef TYPE
+#undef SORT
+#undef SORT1
+#undef DECL_SORT
+#undef DECL_SORT1
+#undef FIELD
+#undef DIRECT_COMPARE
+#undef NEXT
Index: /vis_dev/glu-2.1/src/list/semantic.cache
===================================================================
--- /vis_dev/glu-2.1/src/list/semantic.cache	(revision 6)
+++ /vis_dev/glu-2.1/src/list/semantic.cache	(revision 6)
@@ -0,0 +1,27 @@
+;; Object list/
+;; SEMANTICDB Tags save file
+(semanticdb-project-database-file "list/"
+  :tables (list 
+   (semanticdb-table "list.c"
+    :major-mode 'c-mode
+    :tags '(("util.h" include nil nil [367 384]) ("list.h" include nil nil [385 402]) ("lsElem" type (:typedef ("list_elem" type (:members (("mainList" variable (:pointer 1 :type ("list_desc" type (:type "struct") nil nil)) (reparse-symbol classsubparts) [747 774]) ("prevPtr" variable (:pointer 1 :type ("list_elem" type (:type "struct") nil nil)) (reparse-symbol classsubparts) [803 829]) ("nextPtr" variable (:pointer 1 :type ("list_elem" type (:type "struct") nil nil)) (reparse-symbol classsubparts) [858 884]) ("userData" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol classsubparts) [913 932])) :type "struct") nil nil) :superclasses "list_elem" :type "typedef") nil [692 967]) ("lsDesc" type (:typedef ("list_desc" type (:members (("topPtr" variable (:pointer 1 :type ("lsElem" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1040 1064]) ("botPtr" variable (:pointer 1 :type ("lsElem" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1040 1064]) ("length" variable (:type "int") (reparse-symbol classsubparts) [1109 1120])) :type "struct") nil nil) :superclasses "list_desc" :type "typedef") nil [969 1172]) ("lsGenInternal" type (:typedef ("gen_desc" type (:members (("mainList" variable (:pointer 1 :type ("lsDesc" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1600 1617]) ("beforeSpot" variable (:pointer 1 :type ("lsElem" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1658 1677]) ("afterSpot" variable (:pointer 1 :type ("lsElem" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1718 1736])) :type "struct") nil nil) :superclasses "gen_desc" :type "typedef") nil [1542 1789]) ("lsCreate" function (:arguments (("" variable (:type "void") (reparse-symbol arg-sub-list) [1967 1972])) :type ("lsList" type (:type "class") nil nil)) nil [1951 2292]) ("lsDestroy" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2316 2365]) ("" variable (:type "void") (reparse-symbol arg-sub-list) [2368 2383])) :type ("lsStatus" type (:type "class") nil nil)) nil [2294 3074]) ("lsIdentity" function (:typemodifiers ("static") :arguments (("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3131 3146])) :type ("lsGeneric" type (:type "class") nil nil)) nil [3103 3196]) ("lsCopy" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3215 3262]) ("" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3265 3286])) :type ("lsList" type (:type "class") nil nil)) nil [3198 4091]) ("lsChangeData" function (:arguments (("itemHandle" variable (:type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4154 4207]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4210 4258])) :type ("lsStatus" type (:type "class") nil nil)) nil [4129 4353]) ("lsNewBegin" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4445 4491]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4494 4542]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4545 4599])) :type ("lsStatus" type (:type "class") nil nil)) nil [4422 5458]) ("lsNewEnd" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5481 5527]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5530 5578]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5581 5635])) :type ("lsStatus" type (:type "class") nil nil)) nil [5460 6330]) ("lsFirstItem" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6413 6455]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6458 6502]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6505 6559])) :type ("lsStatus" type (:type "class") nil nil)) nil [6389 7124]) ("lsLastItem" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7149 7191]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7194 7238]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7241 7295])) :type ("lsStatus" type (:type "class") nil nil)) nil [7126 7948]) ("lsLength" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7991 8037])) :type "int") nil [7975 8214]) ("lsDelBegin" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8291 8340]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8343 8394])) :type ("lsStatus" type (:type "class") nil nil)) nil [8268 9210]) ("lsDelEnd" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9234 9279]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9282 9329])) :type ("lsStatus" type (:type "class") nil nil)) nil [9213 10142]) ("lsStart" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [10267 10315])) :type ("lsGen" type (:type "class") nil nil)) nil [10250 10801]) ("lsEnd" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [10818 10866])) :type ("lsGen" type (:type "class") nil nil)) nil [10803 11271]) ("lsGenHandle" function (:arguments (("itemHandle" variable (:type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11294 11347]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11350 11398]) ("option" variable (:type "int") (reparse-symbol arg-sub-list) [11401 11446])) :type ("lsGen" type (:type "class") nil nil)) nil [11273 12348]) ("lsNext" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12370 12417]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12420 12466]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12469 12521])) :type ("lsStatus" type (:type "class") nil nil)) nil [12351 13552]) ("lsPrev" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13574 13621]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13624 13670]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13673 13725])) :type ("lsStatus" type (:type "class") nil nil)) nil [13555 14763]) ("lsInBefore" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14788 14837]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14840 14888]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14891 14943])) :type ("lsStatus" type (:type "class") nil nil)) nil [14765 16224]) ("lsInAfter" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [16248 16297]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [16300 16348]) ("itemHandle" variable (:pointer 1 :type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [16351 16405])) :type ("lsStatus" type (:type "class") nil nil)) nil [16226 17712]) ("lsDelBefore" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [17740 17787]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [17790 17836])) :type ("lsStatus" type (:type "class") nil nil)) nil [17716 19234]) ("lsDelAfter" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [19260 19307]) ("data" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [19310 19356])) :type ("lsStatus" type (:type "class") nil nil)) nil [19237 20742]) ("lsFinish" function (:arguments (("generator" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20766 20806])) :type ("lsStatus" type (:type "class") nil nil)) nil [20745 21144]) ("lsGenForm" function (:prototype-flag t :typemodifiers ("static") :arguments (("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21419 21439]) ("arg" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21468 21482]) ("gen" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21483 21493]) ("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21499 21519]) ("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21556 21576])) :type ("lsStatus" type (:type "class") nil nil)) nil [21393 21596]) ("lsForeach" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21620 21665]) ("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21668 21688]) ("arg" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21745 21792])) :type ("lsStatus" type (:type "class") nil nil)) nil [21598 22587]) ("lsBackeach" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22613 22658]) ("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22661 22681]) ("arg" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22738 22785])) :type ("lsStatus" type (:type "class") nil nil)) nil [22590 22981]) ("lsGenForm" function (:typemodifiers ("static") :arguments (("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23013 23033]) ("arg" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23088 23141]) ("gen" variable (:type ("lsGen" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23144 23193]) ("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23196 23216]) ("" variable (:type ("lsStatus" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23291 23311])) :type ("lsStatus" type (:type "class") nil nil)) nil [22984 23832]) ("lsQueryHandle" function (:arguments (("itemHandle" variable (:type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23859 23905])) :type ("lsList" type (:type "class") nil nil)) nil [23835 24172]) ("lsFetchHandle" function (:arguments (("itemHandle" variable (:type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [24198 24218])) :type ("lsGeneric" type (:type "class") nil nil)) nil [24174 24358]) ("lsRemoveItem" function (:arguments (("itemHandle" variable (:type ("lsHandle" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [24385 24430]) ("userData" variable (:type ("lsGeneric" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [24433 24477])) :type ("lsStatus" type (:type "class") nil nil)) nil [24360 24936]) ("TYPE" variable (:constant-flag t :default-value (nil)) nil [24966 24988]) ("SORT" variable (:constant-flag t :default-value (nil)) nil [24987 25014]) ("NEXT" variable (:constant-flag t :default-value (nil)) nil [25013 25036]) ("FIELD" variable (:constant-flag t :default-value (nil)) nil [25035 25060]) ("lsort.h" include nil nil [25059 25077]) ("lsSort" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [25129 25170]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [25173 25187])) :type ("lsStatus" type (:type "class") nil nil)) nil [25110 26100]) ("lsUniq" function (:arguments (("list" variable (:type ("lsList" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [26122 26174]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [26177 26191]) ("" variable (:type "void") (reparse-symbol arg-sub-list) [26254 26269])) :type ("lsStatus" type (:type "class") nil nil)) nil [26103 27548]))
+    :file "list.c"
+    :pointmax 27549
+    :unmatched-syntax 'nil
+    )
+   (semanticdb-table "list.h"
+    :major-mode 'c-mode
+    :tags '(("LS_DEFINED" variable (:constant-flag t) nil [321 348]) ("ls_dummy" type (:typedef ("void") :superclasses "void" :type "typedef") nil [341 363]) ("lsList" type (:typedef ("ls_dummy" type (:type "class") nil nil) :pointer 1 :superclasses "ls_dummy" :type "typedef") nil [365 390]) ("lsGen" type (:typedef ("ls_dummy" type (:type "class") nil nil) :pointer 1 :superclasses "ls_dummy" :type "typedef") nil [419 443]) ("lsHandle" type (:typedef ("ls_dummy" type (:type "class") nil nil) :pointer 1 :superclasses "ls_dummy" :type "typedef") nil [472 499]) ("lsStatus" type (:typedef ("int") :superclasses "int" :type "typedef") nil [528 549]) ("lsGeneric" type (:typedef ("void") :pointer 1 :superclasses "void" :type "typedef") nil [579 603]) ("LS_NIL" variable (:constant-flag t :default-value (nil)) nil [633 650]) ("LS_BADSTATE" variable (:constant-flag t :default-value (nil)) nil [679 701]) ("LS_BADPARAM" variable (:constant-flag t :default-value (nil)) nil [730 752]) ("LS_NOMORE" variable (:constant-flag t :default-value (nil)) nil [781 801]) ("LS_OK" variable (:constant-flag t :default-value (nil)) nil [831 847]) ("LS_BEFORE" variable (:constant-flag t :default-value (nil)) nil [849 868]) ("LS_AFTER" variable (:constant-flag t :default-value (nil)) nil [898 916]) ("LS_STOP" variable (:constant-flag t :default-value (nil)) nil [946 964]) ("LS_DELETE" variable (:constant-flag t :default-value (nil)) nil [994 1013]) ("LS_NH" variable (:constant-flag t :default-value (nil)) nil [1153 1182]) ("LS_PFLSG" variable (:functionpointer-flag t :type ("lsGeneric" type (:type "class") nil nil)) nil [1192 1225]) ("ARGS" function (:prototype-flag t :type ("lsCreate" type (:type "class") nil nil)) nil [1241 1263]) ("ARGS" function (:prototype-flag t :type ("lsDestroy" type (:type "class") nil nil)) nil [1306 1352]) ("ARGS" function (:prototype-flag t :type ("lsCopy" type (:type "class") nil nil)) nil [1408 1440]) ("ARGS" function (:prototype-flag t :type ("lsFirstItem" type (:type "class") nil nil)) nil [1500 1550]) ("ARGS" function (:prototype-flag t :type ("lsLastItem" type (:type "class") nil nil)) nil [1605 1654]) ("ARGS" function (:prototype-flag t :type ("lsNewBegin" type (:type "class") nil nil)) nil [1709 1758]) ("ARGS" function (:prototype-flag t :type ("lsNewEnd" type (:type "class") nil nil)) nil [1809 1856]) ("ARGS" function (:prototype-flag t :type ("lsDelBegin" type (:type "class") nil nil)) nil [1906 1943]) ("ARGS" function (:prototype-flag t :type ("lsDelEnd" type (:type "class") nil nil)) nil [1996 2031]) ("ARGS" function (:prototype-flag t :type ("lsLength" type (:type "class") nil nil)) nil [2079 2103]) ("ARGS" function (:prototype-flag t :type ("lsStart" type (:type "class") nil nil)) nil [2157 2180]) ("ARGS" function (:prototype-flag t :type ("lsEnd" type (:type "class") nil nil)) nil [2238 2259]) ("ARGS" function (:prototype-flag t :type ("lsGenHandle" type (:type "class") nil nil)) nil [2313 2358]) ("ARGS" function (:prototype-flag t :type ("lsNext" type (:type "class") nil nil)) nil [2419 2463]) ("ARGS" function (:prototype-flag t :type ("lsPrev" type (:type "class") nil nil)) nil [2519 2563]) ("ARGS" function (:prototype-flag t :type ("lsInBefore" type (:type "class") nil nil)) nil [2623 2671]) ("ARGS" function (:prototype-flag t :type ("lsInAfter" type (:type "class") nil nil)) nil [2756 2803]) ("ARGS" function (:prototype-flag t :type ("lsDelBefore" type (:type "class") nil nil)) nil [2888 2925]) ("ARGS" function (:prototype-flag t :type ("lsDelAfter" type (:type "class") nil nil)) nil [2990 3026]) ("ARGS" function (:prototype-flag t :type ("lsFinish" type (:type "class") nil nil)) nil [3090 3113]) ("ARGS" function (:prototype-flag t :type ("lsForeach" type (:type "class") nil nil)) nil [3172 3261]) ("ARGS" function (:prototype-flag t :type ("lsBackeach" type (:type "class") nil nil)) nil [3335 3425]) ("ARGS" function (:prototype-flag t :type ("lsQueryHandle" type (:type "class") nil nil)) nil [3497 3528]) ("ARGS" function (:prototype-flag t :type ("lsFetchHandle" type (:type "class") nil nil)) nil [3583 3614]) ("ARGS" function (:prototype-flag t :type ("lsRemoveItem" type (:type "class") nil nil)) nil [3675 3716]) ("ARGS" function (:prototype-flag t :type ("lsSort" type (:type "class") nil nil)) nil [3788 3841]) ("ARGS" function (:prototype-flag t :type ("lsUniq" type (:type "class") nil nil)) nil [3880 3955]) ("lsForEachItem" variable (:constant-flag t) nil [4369 4672]))
+    :file "list.h"
+    :pointmax 4840
+    )
+   (semanticdb-table "lsort.h"
+    :major-mode 'c-mode
+    :tags 'nil
+    :file "lsort.h"
+    )
+   )
+  :file "semantic.cache"
+  :semantic-tag-version "2.0beta3"
+  :semanticdb-version "2.0beta3"
+  )
Index: /vis_dev/glu-2.1/src/mdd/mdd.h
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd.h	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd.h	(revision 6)
@@ -0,0 +1,345 @@
+/*
+ * $Id: mdd.h,v 1.29 2002/08/27 16:30:25 fabio Exp $
+ */
+
+#ifndef MDD_DEFINED
+#define MDD_DEFINED
+
+
+#include "util.h"
+#include "array.h"
+#include "st.h"
+#include "var_set.h"
+
+#include "bdd.h" 
+
+/*    #include "bdd_int.h"   */
+
+/************************************************************************/
+#define str_len         10
+#define MONITOR         0
+#define MDD_VERBOSE     0
+#define SOLUTION        0
+#define BDD_SIZE        1
+#define USE_ITE         1
+#define BYPASS          1
+/* code may not be fully debugged for interleaving */
+#define INTERLEAVE      0
+
+#define mdd_and bdd_and
+#define mdd_and_with_limit bdd_and_with_limit
+#define mdd_and_array bdd_and_array
+#define mdd_cofactor_minterm bdd_cofactor
+#define mdd_constant bdd_constant
+#define mdd_dup bdd_dup
+/* mdd_equal returns 1 if two MDD's are identical */
+/* mdd_eq is a totally different function */
+/* which returns an MDD instead */
+#define mdd_equal bdd_equal
+#define mdd_equal_mod_care_set bdd_equal_mod_care_set
+#define mdd_closest_cube bdd_closest_cube
+#define mdd_free bdd_free
+#define mdd_get_manager bdd_get_manager
+#define mdd_is_tautology bdd_is_tautology
+#define mdd_ite bdd_ite
+/* mdd_lequal checks for implication, */
+/* mdd_lequal(f,g,1,0) returns the value of (f => g') */
+/* mdd_leq is a totally different function */
+#define mdd_lequal bdd_leq
+#define mdd_lequal_mod_care_set bdd_lequal_mod_care_set
+#define mdd_lequal_array bdd_leq_array
+#define mdd_multiway_and bdd_multiway_and
+#define mdd_multiway_or bdd_multiway_or
+#define mdd_multiway_xor bdd_multiway_xor
+#define mdd_not bdd_not
+#define mdd_one bdd_one
+#define mdd_or bdd_or
+#define mdd_size bdd_size
+#define mdd_size_multiple bdd_size_multiple
+#define mdd_top_var_id bdd_top_var_id
+#define mdd_xor bdd_xor
+#define mdd_xnor bdd_xnor
+#define mdd_zero bdd_zero
+#define mdd_EMPTY bdd_EMPTY
+
+#define mdd_first_solution mdd_first_cube
+#define mdd_next_solution mdd_next_cube
+
+#define mdd_eq_c(m,a,b)  	mdd_func1c(m,a,b,eq2)
+#define mdd_geq_c(m,a,b) 	mdd_func1c(m,a,b,geq2)
+#define mdd_gt_c(m,a,b)  	mdd_func1c(m,a,b,gt2)
+#define mdd_leq_c(m,a,b) 	mdd_func1c(m,a,b,leq2)
+#define mdd_lt_c(m,a,b)  	mdd_func1c(m,a,b,lt2)
+#define mdd_neq_c(m,a,b) 	mdd_func1c(m,a,b,neq2)
+
+#define mdd_eq(m,a,b)  		mdd_func2(m,a,b,eq2)
+#define mdd_geq(m,a,b) 		mdd_func2(m,a,b,geq2)
+#define mdd_gt(m,a,b)  		mdd_func2(m,a,b,gt2)
+#define mdd_leq(m,a,b) 		mdd_func2(m,a,b,leq2)
+#define mdd_lt(m,a,b)  		mdd_func2(m,a,b,lt2)
+#define mdd_neq(m,a,b) 		mdd_func2(m,a,b,neq2)
+#define mdd_unary_minus(m,a,b) 	mdd_func2(m,a,b,unary_minus2)
+
+#define mdd_eq_plus(m,a,b,c)	mdd_func3(m,a,b,c,eq_plus3)
+#define mdd_geq_plus(m,a,b,c)	mdd_func3(m,a,b,c,geq_plus3)
+#define mdd_gt_plus(m,a,b,c)	mdd_func3(m,a,b,c,gt_plus3)
+#define mdd_leq_plus(m,a,b,c)	mdd_func3(m,a,b,c,leq_plus3)
+#define mdd_lt_plus(m,a,b,c)	mdd_func3(m,a,b,c,lt_plus3)
+#define mdd_neq_plus(m,a,b,c)	mdd_func3(m,a,b,c,neq_plus3)
+
+#define mdd_eq_minus(m,a,b,c)	mdd_func3(m,a,b,c,eq_minus3)
+#define mdd_geq_minus(m,a,b,c)	mdd_func3(m,a,b,c,geq_minus3)
+#define mdd_gt_minus(m,a,b,c)	mdd_func3(m,a,b,c,gt_minus3)
+#define mdd_leq_minus(m,a,b,c)	mdd_func3(m,a,b,c,leq_minus3)
+#define mdd_lt_minus(m,a,b,c)	mdd_func3(m,a,b,c,lt_minus3)
+#define mdd_neq_minus(m,a,b,c)	mdd_func3(m,a,b,c,neq_minus3)
+
+#define mdd_eq_plus_c(m,a,b,c)	mdd_func2c(m,a,b,c,eq_plus3)
+#define mdd_geq_plus_c(m,a,b,c)	mdd_func2c(m,a,b,c,geq_plus3)
+#define mdd_gt_plus_c(m,a,b,c)	mdd_func2c(m,a,b,c,gt_plus3)
+#define mdd_leq_plus_c(m,a,b,c)	mdd_func2c(m,a,b,c,leq_plus3)
+#define mdd_lt_plus_c(m,a,b,c)	mdd_func2c(m,a,b,c,lt_plus3)
+#define mdd_neq_plus_c(m,a,b,c)	mdd_func2c(m,a,b,c,neq_plus3)
+
+
+#define mdd_eq_plus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,eq_plus3mod)
+#define mdd_geq_plus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,geq_plus3mod)
+#define mdd_gt_plus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,gt_plus3mod)
+#define mdd_leq_plus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,leq_plus3mod)
+#define mdd_lt_plus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,lt_plus3mod)
+#define mdd_neq_plus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,neq_plus3mod)
+
+#define mdd_eq_minus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,eq_minus3mod)
+#define mdd_geq_minus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,geq_minus3mod)
+#define mdd_gt_minus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,gt_minus3mod)
+#define mdd_leq_minus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,leq_minus3mod)
+#define mdd_lt_minus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,lt_minus3mod)
+#define mdd_neq_minus_c_mod(m,a,b,c)	mdd_func2c_mod(m,a,b,c,neq_minus3mod)
+
+#define mdd_eq_s(m,a,b) 	mdd_ineq_template_s(m,a,b,0,0,1)
+#define mdd_geq_s(m,a,b) 	mdd_ineq_template_s(m,a,b,0,1,1)
+#define mdd_gt_s(m,a,b)		mdd_ineq_template_s(m,a,b,0,1,0)
+#define mdd_neq_s(m,a,b)	mdd_ineq_template_s(m,a,b,1,1,0)
+#define mdd_leq_s(m,a,b)	mdd_ineq_template_s(m,a,b,1,0,1)
+#define mdd_lt_s(m,a,b)		mdd_ineq_template_s(m,a,b,1,0,0)
+
+/**** for backward compatibility only ****/
+#define mdd_eq_g(m,a,b)  	mdd_func2(m,a,b,eq2)
+#define mdd_geq_g(m,a,b) 	mdd_func2(m,a,b,geq2)
+#define mdd_gt_g(m,a,b)  	mdd_func2(m,a,b,gt2)
+#define mdd_leq_g(m,a,b) 	mdd_func2(m,a,b,leq2)
+#define mdd_lt_g(m,a,b)  	mdd_func2(m,a,b,lt2)
+#define mdd_neq_g(m,a,b) 	mdd_func2(m,a,b,neq2)
+#define mdd_init_name(v,n,s) 	mdd_init(v,n,s)
+
+/* mdd_int.h */
+#define MDD_NOT(node)           ((bdd_node *) ((int) (node) ^ 01))
+#define MDD_REGULAR(node)       ((bdd_node *) ((int) (node) & ~01))
+#define MDD_IS_COMPLEMENT(node) ((int) (node) & 01)
+
+#define MDD_ONE(bdd)            (bdd)->one
+#define MDD_ZERO(bdd)           (MDD_NOT(MDD_ONE(bdd)))
+
+#ifndef MAX
+#define MAX(a,b) (a) > (b) ? (a) : (b)
+#endif
+
+#ifndef MIN
+#define MIN(a,b) (a) < (b) ? (a) : (b)
+#endif
+
+    typedef bdd_t mdd_t;
+    typedef bdd_manager mdd_manager;
+
+typedef enum {
+	MDD_ACTIVE,
+	MDD_BUNDLED
+} mvar_status;
+
+struct mvar_type {
+    int mvar_id;		/* mvar id */
+    mvar_status status;         /* Whether the mvar is currently being used or 
+                                   has been bundled into another mvar */
+    char *name;			/* name of mvar */
+    int values;			/* no. of values mvar can take */
+    int encode_length;		/* no. of binary variables, bvar's, */
+				/* needed to encode mvar */
+    array_t *bvars;             /* array of bvar_id's from most significant bit to least 
+				   significant bit, has size encode_length */
+    int *encoding;		/* internal use only */
+};
+typedef struct mvar_type mvar_type;
+
+struct bvar_type {
+    mdd_t *node;
+    int mvar_id;
+};
+typedef struct bvar_type bvar_type;
+
+struct mdd_hook_type {
+    array_t *mvar_list;
+    array_t *bvar_list;	
+};
+
+typedef struct mdd_hook_type mdd_hook_type;
+
+struct mdd_gen {
+    mdd_manager *manager;
+    bdd_gen *bdd_generator;
+    bdd_gen_status status;
+    array_t *cube;		/* array of literals {0,1,2} of all vars */
+    array_t *minterm;		/* current minterm */
+    array_t *var_list;		/* list of var id's */
+    boolean out_of_range;
+}; 
+
+typedef struct mdd_gen mdd_gen;
+
+#define foreach_mdd_minterm(fn, gen, minterm, var_list)\
+  for((gen) = mdd_first_minterm(fn, &minterm, var_list);\
+      ((gen)->status != bdd_EMPTY) ? TRUE: mdd_gen_free(gen);\
+      (void) mdd_next_minterm(gen, &minterm))
+                                                                      
+
+extern mdd_hook_type mdd_hook;
+
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+EXTERN mdd_manager *mdd_init ARGS((array_t *mvar_values, array_t *mvar_names, array_t *mvar_strides));
+EXTERN mdd_manager *mdd_init_empty ARGS((void));
+EXTERN unsigned int mdd_create_variables ARGS((mdd_manager *mgr, array_t *mvar_values, array_t *mvar_names, array_t *mvar_strides));
+EXTERN unsigned int mdd_create_variables_after ARGS((mdd_manager*, int, array_t*, array_t*, array_t* ));
+EXTERN unsigned int mdd_create_variables_interleaved ARGS((mdd_manager*, int, int, array_t*));
+EXTERN void mdd_quit ARGS((mdd_manager *mgr));
+EXTERN mdd_t *mdd_case ARGS((mdd_manager *mgr, int mvar, array_t *child_list));
+EXTERN mdd_t *mdd_consensus ARGS((mdd_manager *mgr, mdd_t *fn, array_t *mvars));
+EXTERN mdd_t *mdd_encode ARGS((mdd_manager *mgr, array_t *child_list, mvar_type *mv_ptr, int index));
+EXTERN mdd_t *mdd_literal ARGS((mdd_manager *mgr, int mddid, array_t *values));
+EXTERN void   mdd_search ARGS((mdd_manager *mgr, bdd_t *top, int phase, boolean minterms));
+EXTERN mdd_t *mdd_cofactor ARGS((mdd_manager *mgr, mdd_t *fn, mdd_t *cube));
+EXTERN mdd_t *mdd_smooth ARGS((mdd_manager *mgr, mdd_t *fn, array_t *mvars));
+EXTERN mdd_t *mdd_and_smooth ARGS((mdd_manager *mgr, mdd_t *f, mdd_t *g, array_t *mvars));
+EXTERN mdd_t *mdd_and_smooth_with_limit ARGS((mdd_manager *mgr, mdd_t *f, mdd_t *g, array_t *mvars, unsigned int limit));
+EXTERN mdd_t *mdd_substitute ARGS((mdd_manager *mgr, mdd_t *fn, array_t	*old_mvars, array_t *new_mvars));
+EXTERN array_t *mdd_substitute_array ARGS((mdd_manager *mgr, array_t *fn_array, array_t *old_mvars, array_t *new_mvars));
+EXTERN array_t *mdd_get_support ARGS((mdd_manager *mdd_mgr, mdd_t *f));
+EXTERN array_t *mdd_get_bdd_support_ids ARGS((mdd_manager *mdd_mgr, mdd_t *f));
+EXTERN array_t *mdd_get_bdd_support_vars ARGS((mdd_manager *mdd_mgr, mdd_t *f));
+EXTERN mdd_t *mdd_interval ARGS((mdd_manager *mgr, int mvar_id, int low, int high)); 
+EXTERN double mdd_count_onset ARGS((mdd_manager *mddMgr, mdd_t *aMdd, array_t *mddIdArr));
+EXTERN mdd_t *mdd_onset_bdd ARGS((mdd_manager *mddMgr, mdd_t *aMdd, array_t *mddIdArr));
+EXTERN int mdd_epd_count_onset ARGS((mdd_manager *mddMgr, mdd_t *aMdd, array_t *mddIdArr, EpDouble *epd));
+EXTERN array_t  * mdd_ret_bvars_of_mvar ARGS((mvar_type *mvar_ptr));
+EXTERN mdd_t *mdd_cproject ARGS((mdd_manager *mgr, mdd_t *T, array_t *mvars));
+EXTERN mdd_t *mdd_mod ARGS((mdd_manager *mgr, int a_mvar_id, int b_mvar_id, int M));
+EXTERN mdd_t *mdd_ineq_template_s ARGS((mdd_manager *mgr, int mvar1, int mvar2,	int zero_then_val, int one_else_val, int bottom_val));
+EXTERN mdd_t *mdd_add_s ARGS((mdd_manager *mgr, int sum_id, int mvar_id1, int mvar_id2 ));
+/* mdd_iter.c */
+EXTERN mdd_gen *mdd_first_minterm ARGS((mdd_t *f, array_t **minterm_p, array_t *var_list));
+EXTERN boolean mdd_next_minterm ARGS((mdd_gen *mgen, array_t **minterm_p));
+EXTERN void mdd_print_array ARGS((array_t *array));
+EXTERN int mdd_gen_free ARGS((mdd_gen *mgen));
+EXTERN mdd_t *mdd_func1c ARGS((mdd_manager *mgr, int mvar1, int mvar2, boolean (*func1c) (int, int)));
+EXTERN mdd_t *mdd_func2 ARGS((mdd_manager *mgr, int mvar1, int mvar2, boolean (*func2) (int, int)));
+/* functions of 2 variables used by mdd_func2 ARGS(()) */
+EXTERN boolean eq2 ARGS((int x, int y));
+EXTERN boolean geq2 ARGS((int x, int y));
+EXTERN boolean gt2 ARGS((int x, int y));
+EXTERN boolean leq2 ARGS((int x, int y));
+EXTERN boolean lt2 ARGS((int x, int y));
+EXTERN boolean neq2 ARGS((int x, int y));
+EXTERN boolean unary_minus2 ARGS((int x, int y));
+EXTERN mdd_t *mdd_func2c ARGS((mdd_manager *mgr,int mvar1, int mvar2, int constant, boolean (*func3)(int, int, int)));
+EXTERN mdd_t *mdd_func2c_mod ARGS((mdd_manager *mgr,int mvar1, int mvar2, int constant, boolean (*func4)(int, int, int, int)));
+
+/* should be in ../test */
+EXTERN mdd_t *mdd_func3 ARGS((mdd_manager *mgr, int mvar1, int mvar2, int mvar3, boolean (*func3)(int, int, int)));
+/* functions of 3 variables used by mdd_func3 ARGS(()) */
+EXTERN boolean eq_plus3 ARGS((int x, int y, int z));
+EXTERN boolean geq_plus3 ARGS((int x, int y, int z));
+EXTERN boolean gt_plus3 ARGS((int x, int y, int z));
+EXTERN boolean leq_plus3 ARGS((int x, int y, int z));
+EXTERN boolean lt_plus3 ARGS((int x, int y, int z));
+EXTERN boolean neq_plus3 ARGS((int x, int y, int z));
+/* actually functions below can be obtained from the set above */
+/* by just suppling the negation of the constant value */
+EXTERN boolean eq_minus3 ARGS((int x, int y, int z));
+EXTERN boolean geq_minus3 ARGS((int x, int y, int z));
+EXTERN boolean gt_minus3 ARGS((int x, int y, int z));
+EXTERN boolean leq_minus3 ARGS((int x, int y, int z));
+EXTERN boolean lt_minus3 ARGS((int x, int y, int z));
+EXTERN boolean neq_minus3 ARGS((int x, int y, int z));
+
+EXTERN array_t *mdd_id_to_bdd_id_array ARGS((mdd_manager *mddManager, int mddId));
+EXTERN array_t *mdd_id_to_bdd_array ARGS((mdd_manager *mddManager, int mddId));
+EXTERN array_t *mdd_id_array_to_bdd_array ARGS((mdd_manager *mddManager, array_t *mddIdArray));
+EXTERN array_t *mdd_id_array_to_bdd_id_array ARGS((mdd_manager *mddManager, array_t *mddIdArray));
+EXTERN mdd_t *mdd_id_array_to_bdd_cube ARGS((mdd_manager *mddManager, array_t *mddIdArray));
+EXTERN int mdd_get_number_of_bdd_vars ARGS((mdd_manager *mddManager, array_t *mddIdArray));
+EXTERN int mdd_get_number_of_bdd_support ARGS((mdd_manager *mddManager, mdd_t *f));
+EXTERN array_t *mdd_fn_array_to_bdd_rel_array ARGS((mdd_manager *mddManager, int mddId, array_t *mddFnArray));
+EXTERN array_t *mdd_fn_array_to_bdd_fn_array ARGS((mdd_manager *mddManager, int mddId, array_t *mddFnArray));
+EXTERN array_t *mdd_pick_arbitrary_minterms ARGS((mdd_manager *mgr, mdd_t *f, array_t *mddIdArr, int n));
+EXTERN mdd_t *mdd_subset_with_mask_vars ARGS((mdd_manager *mgr, mdd_t *f, array_t *mddIdArr, array_t *maskIdArr));
+EXTERN mvar_type mdd_get_var_by_id ARGS((mdd_manager *mddMgr, int id));
+EXTERN void mdd_print_support ARGS((mdd_t *f));
+EXTERN void mdd_print_support_to_file ARGS((FILE *fout, char *format, mdd_t *f));
+EXTERN char *mdd_read_var_name ARGS((mdd_t *f));
+EXTERN int mdd_read_mdd_id ARGS((mdd_t *f));
+EXTERN int mdd_check_support ARGS((mdd_manager *mddMgr, mdd_t *mdd, array_t *supportIdArray));
+EXTERN int mdd_equal_mod_care_set_array ARGS((mdd_t *aSet, mdd_t *bSet, array_t *CareSetArray));
+EXTERN int mdd_lequal_mod_care_set_array ARGS((mdd_t *aSet, mdd_t *bSet, boolean aPhase, boolean bPhase, array_t *CareSetArray));
+
+EXTERN boolean eq_plus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean geq_plus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean gt_plus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean leq_plus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean lt_plus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean neq_plus3mod ARGS((int x, int y, int z, int range));
+/* actually functions below can be obtained from the set above */
+/* by just suppling the negation of the constant value */
+EXTERN boolean eq_minus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean geq_minus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean gt_minus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean leq_minus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean lt_minus3mod ARGS((int x, int y, int z, int range));
+EXTERN boolean neq_minus3mod ARGS((int x, int y, int z, int range));
+
+/* should be in mdd_int.h */
+EXTERN int toggle ARGS((int x));
+EXTERN int no_bit_encode ARGS((int n));
+EXTERN void print_strides ARGS((array_t *mvar_strides));
+EXTERN void print_mvar_list ARGS((mdd_manager *mgr));
+EXTERN void print_bdd_list_id ARGS((array_t *bdd_list));
+EXTERN void print_bvar_list_id ARGS((mdd_manager *mgr));
+EXTERN void print_bdd ARGS((bdd_manager *mgr, bdd_t *top));
+EXTERN mvar_type find_mvar_id ARGS((mdd_manager *mgr, unsigned short id));
+EXTERN void clear_all_marks ARGS((mdd_manager *mgr));
+EXTERN void mdd_mark ARGS((mdd_manager *mgr, bdd_t *top, int phase));
+EXTERN void mdd_unmark ARGS((mdd_manager *mgr, bdd_t *top));
+EXTERN mvar_type find_mvar ARGS((mdd_manager *mgr, char *name));
+EXTERN array_t *mdd_ret_mvar_list ARGS((mdd_manager *mgr));
+EXTERN void mdd_set_mvar_list ARGS((mdd_manager *mgr, array_t *mvar_list));
+EXTERN array_t *mdd_ret_bvar_list ARGS((mdd_manager *mgr));
+EXTERN mdd_t *build_lt_c ARGS((mdd_manager *mgr, int mvar_id, int c));
+EXTERN mdd_t *build_leq_c ARGS((mdd_manager *mgr, int mvar_id, int c));
+EXTERN mdd_t *build_gt_c ARGS((mdd_manager *mgr, int mvar_id, int c));
+EXTERN mdd_t *build_geq_c ARGS((mdd_manager *mgr, int mvar_id, int c));
+EXTERN int getbit ARGS((int number, int position));
+EXTERN int integer_get_num_of_digits ARGS((int value));
+EXTERN int mdd_ret_bvar_id ARGS((mvar_type *mvar_ptr, int i));
+EXTERN bvar_type mdd_ret_bvar ARGS((mvar_type *mvar_ptr, int i, array_t *bvar_list));
+EXTERN void mdd_array_free ARGS((array_t *mddArray));
+EXTERN void mdd_array_array_free ARGS((array_t *arrayBddArray));
+EXTERN array_t *mdd_array_duplicate ARGS((array_t *mddArray));
+EXTERN boolean mdd_array_equal ARGS((array_t *array1, array_t *array2));
+EXTERN mdd_t *mdd_range_mdd ARGS((mdd_manager *mgr, array_t *support));
+
+/* unsupported */
+EXTERN int mdd_bundle_variables ARGS((mdd_manager *mgr, array_t *bundle_vars, char *mdd_var_name, int *mdd_id));
+EXTERN mdd_t * mdd_unary_minus_s ARGS((mdd_manager *mgr, int mvar1, int mvar2));
+EXTERN array_t * mvar2bdds ARGS((mdd_manager *mgr, array_t *mvars));
+#endif
Index: /vis_dev/glu-2.1/src/mdd/mdd.make
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd.make	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd.make	(revision 6)
@@ -0,0 +1,6 @@
+CSRC_mdd = mdd_add.c mdd_andsmoot.c mdd_bund.c mdd_case.c mdd_cofactor.c mdd_consensus.c mdd_func1c.c mdd_func2.c mdd_func2c.c mdd_func3.c mdd_ineq_s.c mdd_init.c mdd_intv.c mdd_iter.c mdd_literal.c mdd_mod.c mdd_quit.c mdd_search.c mdd_smooth.c mdd_substit.c mdd_support.c mdd_uminus.c mdd_util.c mvar2bdds.c mdd_func2cmod.c
+HEADERS_mdd = mdd.h
+MISC += mdd.doc
+
+
+DEPENDENCYFILES = $(CSRC_mdd)
Index: /vis_dev/glu-2.1/src/mdd/mdd_add.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_add.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_add.c	(revision 6)
@@ -0,0 +1,229 @@
+#include "mdd.h"
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+EXTERN void addition_block_build(mdd_manager *mgr, mdd_t **A, mdd_t **B, bvar_type *bx_ptr, bvar_type *by_ptr, bvar_type *bz_ptr);
+EXTERN void one_var_and_carry_add_block(mdd_manager *mgr, mdd_t **A, mdd_t **B, bvar_type *bz_ptr, bvar_type *blv_ptr);
+
+
+void
+addition_block_build(
+  mdd_manager *mgr,
+  mdd_t **A,
+  mdd_t **B,
+  bvar_type *bx_ptr,
+  bvar_type *by_ptr,
+  bvar_type *bz_ptr)
+{
+	mdd_t *zero;
+	mdd_t 	*C, *D, *E, *F,
+		*G, *H, *I;
+
+	zero = mdd_zero(mgr);	
+		
+	G = mdd_ite( by_ptr->node, zero , *A  ,  1, 1, 1 );
+	H = mdd_ite( by_ptr->node, *A   , *B  ,  1, 1, 1 );
+	I = mdd_ite( by_ptr->node, *B   , zero,  1, 1, 1 );
+
+	C = mdd_ite( bx_ptr->node, zero, G   ,  1, 1, 1 );
+	D = mdd_ite( bx_ptr->node, G   , H   ,  1, 1, 1 );
+	E = mdd_ite( bx_ptr->node, H   , I   ,  1, 1, 1 );
+	F = mdd_ite( bx_ptr->node, I   , zero,  1, 1, 1 );
+		
+	*A = mdd_ite( bz_ptr->node, D   , C   ,  1, 1, 1 );
+	*B = mdd_ite( bz_ptr->node, F   , E   ,  1, 1, 1 );
+
+	mdd_free(G);
+	mdd_free(H);
+	mdd_free(I);
+	mdd_free(C);
+	mdd_free(D);
+	mdd_free(E);
+	mdd_free(F);
+	mdd_free(zero);
+
+	return;
+}
+
+
+void
+one_var_and_carry_add_block(
+  mdd_manager *mgr,
+  mdd_t **A,
+  mdd_t **B,
+  bvar_type *bz_ptr,
+  bvar_type *blv_ptr)
+{
+	mdd_t *C, *D, *E;
+	mdd_t *zero;
+
+	zero = mdd_zero(mgr);	
+
+	C = mdd_ite( blv_ptr->node,  zero,   *A, 1, 1, 1);
+	D = mdd_ite( blv_ptr->node,    *A,   *B, 1, 1, 1);
+	E = mdd_ite( blv_ptr->node,    *B, zero, 1, 1, 1);
+
+	*A = mdd_ite( bz_ptr->node,    D, C, 1, 1, 1);
+	*B = mdd_ite( bz_ptr->node, zero, E, 1, 1, 1);
+
+	mdd_free(C);
+	mdd_free(D);
+	mdd_free(E);
+
+	mdd_free(zero);
+
+	return;
+}
+
+/* in1 + in2 = sum */
+mdd_t *
+mdd_add_s(
+  mdd_manager *mgr,
+  int sum_id,
+  int mvar_id1,
+  int mvar_id2)
+{
+	mdd_t *one, *zero;
+	array_t *mvar_list = mdd_ret_mvar_list(mgr);
+ 	array_t *bvar_list = mdd_ret_bvar_list(mgr);
+	int     config, 
+	    	no_common_to_all_bits, 
+	   	no_common_in_bits, i;
+
+	bvar_type bx, by, bz, z_carry, blv;
+	mvar_type x, y, z, long_var;
+	mdd_t 	*A, *B, *range_check;
+	mdd_t *result = NIL(mdd_t); /* initialize for lint */
+        
+
+	
+	x = array_fetch(mvar_type, mvar_list, mvar_id1);
+	y = array_fetch(mvar_type, mvar_list, mvar_id2);
+	z = array_fetch(mvar_type, mvar_list, sum_id);
+
+	/* Ensures that the i_th bit of x has smaller index
+	   than the i_th bit of y */
+
+	if  ( ( mdd_ret_bvar_id(&x,x.encode_length) ) >
+              ( mdd_ret_bvar_id(&y,y.encode_length) )  )  {
+			y = array_fetch(mvar_type, mvar_list, mvar_id1);
+			x = array_fetch(mvar_type, mvar_list, mvar_id2);
+			}
+
+	one = mdd_one(mgr);
+	zero = mdd_zero(mgr);	
+	
+	no_common_in_bits = MIN(x.encode_length,y.encode_length);
+	no_common_to_all_bits = MIN(no_common_in_bits, z.encode_length);
+
+	A = mdd_dup(one);
+	B = mdd_dup(zero);
+
+	for (i = 1; i <= no_common_to_all_bits; i++){
+
+		bx = mdd_ret_bvar(&x,x.encode_length-i,bvar_list); 
+		by = mdd_ret_bvar(&y,y.encode_length-i,bvar_list);
+		bz = mdd_ret_bvar(&z,z.encode_length-i,bvar_list);
+		addition_block_build( mgr, &A, &B, &bx, &by, &bz);
+	}
+
+
+	if ( z.encode_length > no_common_to_all_bits ){
+		if ( x.encode_length != y.encode_length ){
+			if ( x.encode_length == no_common_in_bits ){ 
+				long_var = y;   
+				/* short_var = x; */
+			}
+			else { 
+				long_var = x;   
+				/* short_var = y; */
+			}
+		
+			if ( z.encode_length > long_var.encode_length) {
+			config = 1;	 
+			}
+			else
+			{
+			config = 2;		
+			}
+		}
+		else 
+			config = 3;			
+	}
+	else 
+		config = 4;			
+
+
+	switch (config) {
+		
+		case 1: /* z > long_var , short_var */
+
+			for ( i = no_common_to_all_bits + 1; i <= long_var.encode_length; i++){
+
+				z_carry = mdd_ret_bvar(&z,z.encode_length-i,bvar_list);
+				blv = mdd_ret_bvar(&long_var,long_var.encode_length-i,bvar_list);
+
+				one_var_and_carry_add_block(mgr, &A, &B, &bz, &blv);
+			}
+			
+			z_carry = mdd_ret_bvar(&z,z.encode_length - long_var.encode_length - 1, bvar_list);
+
+			A = mdd_ite( z_carry.node, B, A, 1, 1, 1);
+
+			for ( i = long_var.encode_length + 2; i <= z.encode_length; i++){
+				z_carry = mdd_ret_bvar(&z,z.encode_length-i, bvar_list);
+				A = mdd_ite( z_carry.node, zero, A, 1, 1, 1);				
+			}
+			result = mdd_dup(A);
+			break;
+
+		case 2: /* short_var < z < long_var */
+
+			for ( i = no_common_to_all_bits + 1; i <= z.encode_length; i++){
+
+				z_carry = mdd_ret_bvar(&z,z.encode_length-i,bvar_list);
+				blv = mdd_ret_bvar(&long_var,long_var.encode_length-i,bvar_list);
+
+				one_var_and_carry_add_block(mgr, &A, &B, &bz, &blv);
+
+			}
+
+			result = mdd_or(A,B,1,1);
+			break;
+
+		case 3: /* z> long_var = short_var */ 
+
+			z_carry = mdd_ret_bvar(&z,z.encode_length - no_common_to_all_bits - 1,bvar_list);
+			A = mdd_ite( z_carry.node, B, A, 1, 1, 1);
+
+			for ( i = no_common_to_all_bits + 2; i <= z.encode_length; i++){
+				z_carry = mdd_ret_bvar(&z, z.encode_length - i, bvar_list);
+				A = mdd_ite( z_carry.node, zero, A, 1, 1, 1);
+			}	
+
+			result = mdd_dup(A);
+			break;
+
+		case 4: /* z <= long_var, z <= short_var */
+			result = mdd_or(A,B,1,1);
+			break;
+	}
+	
+	mdd_free(A);
+	mdd_free(B);
+
+
+	mdd_free(one);
+	mdd_free(zero);
+	
+	range_check = build_lt_c(mgr, sum_id, z.values);
+	result = mdd_and(result, range_check, 1, 1);
+
+	mdd_free(range_check);
+
+	return result;
+}
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_andsmoot.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_andsmoot.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_andsmoot.c	(revision 6)
@@ -0,0 +1,132 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_andsmoot.c,v 1.12 2002/08/27 00:55:23 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_and_smooth(
+  mdd_manager *mgr,
+  mdd_t *f,
+  mdd_t *g,
+  array_t *mvars)
+{
+    int i, j, mv_no;
+    mvar_type mv;
+    mdd_t *top;
+    bdd_t *temp;
+
+    array_t *bdd_vars = array_alloc(bdd_t *, 0);
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+
+    if ( mvars == NIL( array_t ) ) {
+	printf("\nWARNING: Empty Array of Smoothing Variables\n");
+	array_free(bdd_vars);
+	return ( bdd_and(f, g, 1, 1) ) ;
+    }
+    else if ( array_n(mvars) == 0)  {
+	printf("\nWARNING: Empty Array of Smoothing Variables\n");
+	array_free(bdd_vars);
+	return ( bdd_and(f, g, 1, 1) ) ;
+    }
+
+    for (i=0; i<array_n(mvars); i++) {
+	mv_no = array_fetch(int, mvars, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_no);
+	if (mv.status == MDD_BUNDLED) {
+	    (void) fprintf(stderr, 
+		"\nmdd_andsmooth: bundled variable %s used\n",mv.name);
+	    fail("");
+	}
+
+	for (j = 0; j < mv.encode_length; j++) {
+	    temp = bdd_get_variable(mgr, mdd_ret_bvar_id(&mv,j) );
+	    array_insert_last(bdd_t *, bdd_vars, temp);
+	}
+    }
+
+    assert( array_n(bdd_vars) != 0 );
+    top = bdd_and_smooth(f, g, bdd_vars);
+
+    for (i = 0; i < array_n(bdd_vars); i++) {
+	temp = array_fetch(bdd_t *, bdd_vars, i);
+	bdd_free(temp);
+    }
+    array_free(bdd_vars);
+
+    return top;
+}
+
+
+mdd_t *
+mdd_and_smooth_with_limit(
+  mdd_manager *mgr,
+  mdd_t *f,
+  mdd_t *g,
+  array_t *mvars,
+  unsigned int limit)
+{
+    int i, j, mv_no;
+    mvar_type mv;
+    mdd_t *top;
+    bdd_t *temp;
+
+    array_t *bdd_vars = array_alloc(bdd_t *, 0);
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+
+    if ( mvars == NIL( array_t ) ) {
+	printf("\nWARNING: Empty Array of Smoothing Variables\n");
+	array_free(bdd_vars);
+	return ( bdd_and_with_limit(f, g, 1, 1, limit) ) ;
+    }
+    else if ( array_n(mvars) == 0)  {
+	printf("\nWARNING: Empty Array of Smoothing Variables\n");
+	array_free(bdd_vars);
+	return ( bdd_and_with_limit(f, g, 1, 1, limit) ) ;
+    }
+
+    for (i=0; i<array_n(mvars); i++) {
+	mv_no = array_fetch(int, mvars, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_no);
+	if (mv.status == MDD_BUNDLED) {
+	    (void) fprintf(stderr, 
+		"\nmdd_andsmooth: bundled variable %s used\n",mv.name);
+	    fail("");
+	}
+
+	for (j = 0; j < mv.encode_length; j++) {
+	    temp = bdd_get_variable(mgr, mdd_ret_bvar_id(&mv,j) );
+	    array_insert_last(bdd_t *, bdd_vars, temp);
+	}
+    }
+
+    assert( array_n(bdd_vars) != 0 );
+    top = bdd_and_smooth_with_limit(f, g, bdd_vars, limit);
+
+    for (i = 0; i < array_n(bdd_vars); i++) {
+	temp = array_fetch(bdd_t *, bdd_vars, i);
+	bdd_free(temp);
+    }
+    array_free(bdd_vars);
+
+    return top;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_bund.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_bund.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_bund.c	(revision 6)
@@ -0,0 +1,68 @@
+/*
+ * $Id: mdd_bund.c,v 1.5 2002/08/27 03:24:30 fabio Exp $
+ */
+
+#include "mdd.h"
+
+int
+mdd_bundle_variables(
+  mdd_manager *mgr,
+  array_t *bundle_vars,
+  char *mdd_var_name,
+  int *mdd_id)
+{
+	array_t *mvar_list, *bvar_list;
+	mvar_type var_i, new_var;
+	int i, var_i_id;
+	bvar_type *bit_i_ptr;
+	
+	mvar_list = mdd_ret_mvar_list(mgr);
+	bvar_list = mdd_ret_bvar_list(mgr);
+
+	new_var.mvar_id = array_n(mvar_list);
+	*mdd_id = new_var.mvar_id;
+
+	new_var.name = ALLOC( char, MAX( (int) strlen(mdd_var_name),
+					 integer_get_num_of_digits(new_var.mvar_id) + 5 ) );
+
+	if ( strcmp(mdd_var_name,"") != 0)  
+		strcpy(new_var.name, mdd_var_name);
+	else {
+		strcpy(new_var.name,"");
+		sprintf(new_var.name,"mv_%d", new_var.mvar_id);
+	};
+
+	new_var.encode_length = array_n(bundle_vars);
+	new_var.status = MDD_ACTIVE;
+
+	new_var.encoding = ALLOC(int, new_var.encode_length);
+	
+	new_var.bvars = array_alloc(int, 0);
+	new_var.values = 1;
+
+	for(i=0; i<array_n(bundle_vars); i++){
+		var_i_id = array_fetch(int, bundle_vars, i);
+		var_i = array_fetch(mvar_type, mvar_list, var_i_id);
+		array_append(new_var.bvars, var_i.bvars);
+		new_var.values *= var_i.values;
+		if ( var_i.values != (int) pow(2.0, (double)var_i.encode_length) ) 
+			printf("WARNING: Variable %s has %d values which is not a power of 2 \nmdd_bundle_variables: Bundling is ambiguous \n",var_i.name, var_i.values);
+		var_i.status = MDD_BUNDLED;
+	}
+
+	array_insert_last( mvar_type, mvar_list, new_var);
+
+	for(i=0; i< array_n(new_var.bvars); i++) {
+		bit_i_ptr = array_fetch_p( bvar_type, bvar_list, mdd_ret_bvar_id(&new_var, i) );
+		bit_i_ptr->mvar_id = new_var.mvar_id;
+	}
+
+	return TRUE;
+
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_case.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_case.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_case.c	(revision 6)
@@ -0,0 +1,155 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_case.c,v 1.10 2002/08/24 20:44:27 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_case(
+  mdd_manager *mgr,
+  int mvar,
+  array_t *child_list)
+{
+    mvar_type mv;
+    mdd_t *mnode;
+    mdd_t *tmp;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+    mv = array_fetch(mvar_type, mvar_list, mvar);
+
+    if (mv.values != array_n(child_list)) 
+	fail("mdd_case: mvar.values different from length of child_list\n");
+
+    if (mv.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+	"\nmdd_andsmooth: bundled variable %s used\n",mv.name);
+	fail("");
+    }
+
+    if (mv.values == 1) {
+	tmp = array_fetch(mdd_t *, child_list, 0);
+	mnode = mdd_dup(tmp);
+    }
+    else {
+        mnode = mdd_encode(mgr, child_list, &mv, mv.encode_length-1);
+    }
+    return mnode;
+}
+
+
+mdd_t *
+mdd_encode(
+  mdd_manager *mgr,
+  array_t *child_list,
+  mvar_type *mv_ptr,
+  int index)
+{
+    array_t *new_child_list;
+    int i;
+    int child_count = 0;
+    int q = array_n(child_list);
+    bvar_type bv;
+    mdd_t *f, *g, *h, *t;
+    mdd_t *one, *zero;
+    array_t *bvar_list;
+
+    if (q == 1) {
+        f =  array_fetch(mdd_t *, child_list, 0);
+	h = mdd_dup(f);
+	if (!mdd_is_tautology(f,1) && !mdd_is_tautology(f,0)) mdd_free(f);
+        return h;
+    }
+    one = mdd_one(mgr);
+    zero = mdd_zero(mgr);
+    bvar_list = mdd_ret_bvar_list(mgr);
+
+    new_child_list = array_alloc(mdd_t *, 0);
+
+    bv = mdd_ret_bvar(mv_ptr, index, bvar_list);
+
+    for (i=0; i<(q/2); i++) {
+
+	f = mdd_dup(bv.node);
+        h = array_fetch(mdd_t *, child_list, child_count++);
+        g = array_fetch(mdd_t *, child_list, child_count++);
+#if USE_ITE
+#if BYPASS
+	/* bypasses cases 	*/
+	/* 1  = ite(F,1,1)	*/
+	/* 0  = ite(F,0,0)	*/
+	/* F  = ite(F,1,0)	*/
+	/* !F = ite(F,0,1)	*/
+	/* G  = ite(F,G,G)	*/
+    	if (mdd_is_tautology(g,0) && mdd_is_tautology(h,0)) {
+	    array_insert_last(mdd_t *, new_child_list, zero);
+	}
+    	else if (mdd_is_tautology(g,0) && mdd_is_tautology(h,1)) {
+	    t = mdd_not(f);
+	    array_insert_last(mdd_t *, new_child_list, t);
+	}
+	else if (mdd_is_tautology(g,1) && mdd_is_tautology(h,1)) {
+	    array_insert_last(mdd_t *, new_child_list, one);
+	}
+	else if (mdd_is_tautology(g,1) && mdd_is_tautology(h,0)) {
+	    t = mdd_dup(f);
+	    array_insert_last(mdd_t *, new_child_list, t);
+	}
+	else if (mdd_equal(f,g)) {
+	    t = mdd_dup(f);
+	    array_insert_last(mdd_t *, new_child_list, t);
+	}
+	else {
+    	    t = mdd_ite(f, g, h, 1, 1, 1);
+	    array_insert_last(mdd_t *, new_child_list, t);
+	}
+	if (!mdd_is_tautology(g,1) && !mdd_is_tautology(g,0)) mdd_free(g);
+	if (!mdd_is_tautology(h,1) && !mdd_is_tautology(h,0)) mdd_free(h);
+#else
+	t = mdd_ite(f, g, h, 1, 1, 1);
+	if (!mdd_is_tautology(g,1) && !mdd_is_tautology(g,0)) mdd_free(g);
+	if (!mdd_is_tautology(h,1) && !mdd_is_tautology(h,0)) mdd_free(h);
+	array_insert_last(mdd_t *, new_child_list, t);
+#endif
+#else
+	a1 = mdd_and(f,g,1,1);
+	if (!mdd_is_tautology(g,1) && !mdd_is_tautology(g,0)) mdd_free(g);
+	a2 = mdd_and(f,h,0,1);
+	if (!mdd_is_tautology(h,1) && !mdd_is_tautology(h,0)) mdd_free(h);
+	t = mdd_or(a1,a2,1,1);
+	/* t = mdd_or(mdd_and(f,g,1,1), mdd_and(f,h,0,1), 1, 1); */
+	if (!mdd_is_tautology(a1,1) && !mdd_is_tautology(a1,0)) mdd_free(a1);
+	if (!mdd_is_tautology(a2,1) && !mdd_is_tautology(a2,0)) mdd_free(a2);
+	array_insert_last(mdd_t *, new_child_list, t);
+#endif
+
+	mdd_free(f);
+    }
+
+    if (q & 1) { /* if q is odd */
+	t = array_fetch(mdd_t *, child_list, child_count);
+        array_insert_last(mdd_t *, new_child_list, t);
+    }
+    f =  mdd_encode(mgr, new_child_list, mv_ptr, index - 1);
+    array_free(new_child_list);
+    mdd_free(one);
+    mdd_free(zero);
+    return f;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_cofactor.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_cofactor.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_cofactor.c	(revision 6)
@@ -0,0 +1,115 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_cofactor.c,v 1.9 2002/08/27 16:30:26 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+static void
+mdd_traverse(
+  mdd_manager *mgr,
+  bdd_t *top,
+  boolean *mvar_present)
+{
+    bvar_type bv;
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+    int is_complemented;
+    bdd_t *uncomp_top, *child, *temp_child;
+
+    if (bdd_is_tautology(top,1)) {
+        return;
+    }
+    if (bdd_is_tautology(top,0)) {
+        return;
+    }
+
+    (void)bdd_get_node(top,&is_complemented);
+
+    bv = array_fetch(bvar_type, bvar_list, bdd_top_var_id(top));
+    mvar_present[bv.mvar_id] = 1;
+
+    if (is_complemented) uncomp_top = bdd_not(top);
+    else uncomp_top = mdd_dup(top);
+
+    child = bdd_then(uncomp_top);
+    (void) bdd_get_node(child,&is_complemented);
+    if (is_complemented) {
+        temp_child = child;
+        child = bdd_not(temp_child);
+        mdd_free(temp_child);
+    }
+    
+    mdd_traverse(mgr, child , mvar_present);
+    mdd_free(child);
+
+    child = bdd_else(uncomp_top);
+    (void) bdd_get_node(child,&is_complemented);
+    if (is_complemented) {
+        temp_child = child;
+        child = bdd_not(temp_child);
+        mdd_free(temp_child);
+    }
+
+    mdd_traverse(mgr, child, mvar_present);
+    
+ 
+    mdd_free(child);
+    mdd_free(uncomp_top);
+    return;    
+}
+
+
+static array_t *
+mvars_extract(
+  mdd_manager *mgr,
+  mdd_t *fn)
+{
+    int i, no_mvar;
+    boolean *mvar_present;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *mvars;
+                                                                          
+
+    mvars = array_alloc(int, 0);
+    no_mvar = array_n(mvar_list);
+    mvar_present = ALLOC(boolean, no_mvar);
+    for (i=0; i<no_mvar; i++) mvar_present[i] = 0;
+    mdd_traverse(mgr, fn, mvar_present);
+    for (i=0; i<no_mvar; i++) 
+	if (mvar_present[i] == 1) array_insert_last(int, mvars, i);
+    FREE(mvar_present);
+    return mvars;
+}
+
+mdd_t *
+mdd_cofactor(
+  mdd_manager *mgr,
+  mdd_t *fn,
+  mdd_t *cube)
+{
+    array_t *mvars;
+    mdd_t *top;
+
+    mvars = mvars_extract(mgr, cube);
+    top = mdd_and_smooth(mgr, fn, cube, mvars);
+    array_free(mvars);
+    return top;
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_consensus.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_consensus.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_consensus.c	(revision 6)
@@ -0,0 +1,75 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_consensus.c,v 1.9 2002/08/24 20:44:27 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_consensus(
+  mdd_manager *mgr,
+  mdd_t *fn,
+  array_t *mvars)
+{
+    array_t *bdd_vars;
+    int i, j, mv_no, num;
+    mvar_type mv;
+    mdd_t *top;
+	bdd_t *tmp;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+    bdd_vars = array_alloc(bdd_t *, 0);
+
+
+    if ( mvars == NIL( array_t ) ) {
+        printf("\nWARNING: Empty Array of Consensus Variables\n");
+        array_free(bdd_vars);
+        return ( mdd_dup(fn) ) ;
+    }
+
+    else if ( array_n(mvars) == 0)  {
+        printf("\nWARNING: Empty Array of Consensus Variables\n");
+        array_free(bdd_vars);
+        return ( mdd_dup(fn) ) ;
+    }
+
+
+    for (i=0; i<array_n(mvars); i++) {
+        mv_no = array_fetch(int, mvars, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_no);
+	if (mv.status == MDD_BUNDLED) {
+		(void) fprintf(stderr, 
+		"\nmdd_consensus: bundled variable %s used\n",mv.name);
+		fail("");
+	}
+
+        for (j = 0; j < mv.encode_length; j ++) {
+	    tmp = bdd_get_variable(mgr, (unsigned int) mdd_ret_bvar_id(&mv, j) );
+	    array_insert_last(bdd_t *, bdd_vars, tmp);
+	}
+    }
+    top = bdd_consensus(fn, bdd_vars);
+	num = array_n(bdd_vars);
+	for(i=0; i<num; i++){
+		bdd_free(array_fetch(bdd_t *, bdd_vars, i));
+	}
+    array_free(bdd_vars);
+    return top;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_func1c.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_func1c.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_func1c.c	(revision 6)
@@ -0,0 +1,59 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_func1c.c,v 1.11 2002/08/25 05:30:12 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_func1c(
+  mdd_manager *mgr,
+  int mvar1,
+  int constant,
+  boolean (*func2)(int, int))
+{
+    mvar_type x;
+    array_t *child_list_x;
+    int i;
+    mdd_t *tx;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    mdd_t *zero, *one;
+
+    zero = mdd_zero(mgr);
+    one = mdd_one(mgr);
+    x = array_fetch(mvar_type, mvar_list, mvar1);
+    if (x.status == MDD_BUNDLED) 
+	printf("\nWarning: mdd_func1c, bundled variable %s is used\n", x.name);
+
+    child_list_x = array_alloc(mdd_t *, x.values);
+    for (i=0; i<x.values; i++) {
+	if (func2(i,constant))
+	    array_insert_last(mdd_t *, child_list_x, one);
+        else
+            array_insert_last(mdd_t *, child_list_x, zero);
+    }
+    tx = mdd_case(mgr, mvar1, child_list_x);
+    array_free(child_list_x);
+
+    mdd_free(one);
+    mdd_free(zero);
+
+    return tx;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_func2.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_func2.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_func2.c	(revision 6)
@@ -0,0 +1,119 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_func2.c,v 1.11 2002/08/25 05:30:12 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_func2(
+  mdd_manager *mgr,
+  int mvar1,
+  int mvar2,
+  boolean (*func2)(int, int))
+{
+    mvar_type x, y;
+    array_t *child_list_x, *child_list_y;
+    int i, j;
+    mdd_t *tx, *ty;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    mdd_t *one, *zero;
+
+    one = mdd_one(mgr);
+    zero = mdd_zero(mgr);
+
+    x = array_fetch(mvar_type, mvar_list, mvar1);
+    y = array_fetch(mvar_type, mvar_list, mvar2);
+
+    if (x.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+		"\nWarning: mdd_func2, bundled variable %s is used\n", x.name);
+	fail("");
+    }
+
+    if (y.status == MDD_BUNDLED) {
+	(void) fprintf(stderr,
+		"\nWarning: mdd_func2 bundled variable %s is used\n", y.name);
+	fail("");
+    }
+
+    child_list_x = array_alloc(mdd_t *, 0);
+    for (i=0; i<x.values; i++) {
+	child_list_y = array_alloc(mdd_t *, 0);
+	for (j=0; j<y.values; j++) {
+	    if (func2(i,j))
+		array_insert_last(mdd_t *, child_list_y, one);
+            else
+                array_insert_last(mdd_t *, child_list_y, zero);
+	}
+	ty = mdd_case(mgr, mvar2, child_list_y);
+	array_insert_last(mdd_t *, child_list_x, ty);
+	array_free(child_list_y);
+    }
+    tx = mdd_case(mgr, mvar1, child_list_x);
+    array_free(child_list_x);
+    mdd_free(one);
+    mdd_free(zero);
+    return tx;
+}
+
+
+/***** internal functions *****/
+
+boolean
+eq2(int x, int y)
+{
+    return (x == y);
+}
+
+boolean
+geq2(int x, int y)
+{
+    return (x >= y);
+}
+
+boolean
+gt2(int x, int y)
+{
+    return (x > y);
+}
+
+boolean
+leq2(int x, int y)
+{
+    return (x <= y);
+}
+
+boolean
+lt2(int x, int y)
+{
+    return (x < y);
+}
+
+boolean
+neq2(int x, int y)
+{
+    return (x != y);
+}
+
+boolean
+unary_minus2(int x, int y)
+{
+    return (x+y == 0);
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_func2c.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_func2c.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_func2c.c	(revision 6)
@@ -0,0 +1,78 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_func2c.c,v 1.10 2002/08/25 05:30:12 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_func2c(
+  mdd_manager *mgr,
+  int mvar1,
+  int mvar2,
+  int constant,
+  boolean (*func3)(int, int, int))
+{
+    mvar_type x, y;
+    array_t *child_list_x, *child_list_y;
+    int i, j;
+    mdd_t *tx, *ty;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    mdd_t *one, *zero;
+
+    x = array_fetch(mvar_type, mvar_list, mvar1);
+    y = array_fetch(mvar_type, mvar_list, mvar2);
+
+    if (x.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+		"\nWarning: mdd_func2c, bundled variable %s is used\n", x.name);
+	fail("");
+    }
+
+    if (y.status == MDD_BUNDLED) {
+	(void) fprintf(stderr,
+		"\nWarning: mdd_func2c, bundled variable %s is used\n", y.name);
+	fail("");
+    }
+
+
+    one = mdd_one(mgr);
+    zero = mdd_zero(mgr);
+
+    child_list_x = array_alloc(mdd_t *, 0);
+    for (i=0; i<x.values; i++) {
+	child_list_y = array_alloc(mdd_t *, 0);
+	for (j=0; j<y.values; j++) {
+	    if (func3(i,j,constant))
+		array_insert_last(mdd_t *, child_list_y, one);
+            else
+                array_insert_last(mdd_t *, child_list_y, zero);
+	}
+	ty = mdd_case(mgr, mvar2, child_list_y);
+	array_insert_last(mdd_t *, child_list_x, ty);
+	array_free(child_list_y);
+    }
+    tx = mdd_case(mgr, mvar1, child_list_x);
+    array_free(child_list_x);
+
+    mdd_free(zero);
+    mdd_free(one);
+
+    return tx;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_func2cmod.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_func2cmod.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_func2cmod.c	(revision 6)
@@ -0,0 +1,159 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_func2cmod.c,v 1.4 2002/08/25 05:30:12 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_func2c_mod(
+  mdd_manager *mgr, 
+  int mvar1,
+  int mvar2,
+  int constant,
+  boolean (*func4)(int, int, int, int))
+{
+    mvar_type x, y;
+    array_t *child_list_x, *child_list_y;
+    int i, j;
+    mdd_t *tx, *ty;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    mdd_t *one, *zero;
+
+    x = array_fetch(mvar_type, mvar_list, mvar1);
+    y = array_fetch(mvar_type, mvar_list, mvar2);
+
+    if (x.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+		"\nWarning: mdd_func2c, bundled variable %s is used\n", x.name);
+	fail("");
+    }
+
+    if (y.status == MDD_BUNDLED) {
+	(void) fprintf(stderr,
+		"\nWarning: mdd_func2c, bundled variable %s is used\n", y.name);
+	fail("");
+    }
+
+    if((x.values   != y.values)  || ( constant < 0) || ( constant >= x.values) ) {
+      (void) fprintf(stderr, "\n mdd_func2c_mod: Cannot operate with two different ranges\n");
+      exit(1);
+    }
+    
+
+    one = mdd_one(mgr);
+    zero = mdd_zero(mgr);
+
+    child_list_x = array_alloc(mdd_t *, 0);
+    for (i=0; i<x.values; i++) {
+	child_list_y = array_alloc(mdd_t *, 0);
+	for (j=0; j<y.values; j++) {
+	    if (func4(i,j,constant,x.values))
+		array_insert_last(mdd_t *, child_list_y, one);
+            else
+                array_insert_last(mdd_t *, child_list_y, zero);
+	}
+	ty = mdd_case(mgr, mvar2, child_list_y);
+	array_insert_last(mdd_t *, child_list_x, ty);
+	array_free(child_list_y);
+    }
+    tx = mdd_case(mgr, mvar1, child_list_x);
+    array_free(child_list_x);
+
+    mdd_free(zero);
+    mdd_free(one);
+
+    return tx;
+}
+
+
+
+/***** internal functions *****/       
+
+boolean 
+eq_plus3mod(int x, int y, int z, int range)
+{
+    return (x == (y + z) % range);
+}
+
+boolean 
+geq_plus3mod(int x, int y, int z, int range)
+{
+    return (x >= (y + z) % range);
+}
+
+boolean 
+gt_plus3mod(int x, int y, int z, int range)
+{
+    return (x > (y + z) % range);
+}
+
+boolean 
+leq_plus3mod(int x, int y, int z, int range)
+{
+    return (x <= (y + z) % range);
+}
+
+boolean 
+lt_plus3mod(int x, int y, int z, int range)
+{
+    return (x < (y + z) % range);
+}
+
+boolean 
+neq_plus3mod(int x, int y, int z, int range)
+{
+    return (x != (y + z) % range);
+}
+
+boolean 
+eq_minus3mod(int x, int y, int z, int range)
+{
+    return (x == (y - z) % range);
+}
+
+boolean 
+geq_minus3mod(int x, int y, int z, int range)
+{
+    return (x >= (y - z) % range);
+}
+
+boolean 
+gt_minus3mod(int x, int y, int z, int range)
+{
+    return (x > (y - z) % range);
+}
+
+boolean 
+leq_minus3mod(int x, int y, int z, int range)
+{
+    return (x <= (y - z) % range);
+}
+
+boolean 
+lt_minus3mod(int x, int y, int z, int range)
+{
+    return (x < (y - z) % range);
+}
+
+boolean 
+neq_minus3mod(int x, int y, int z, int range)
+{
+    return (x != (y - z) % range);
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_func3.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_func3.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_func3.c	(revision 6)
@@ -0,0 +1,166 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_func3.c,v 1.10 2002/08/25 05:30:12 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_func3(
+  mdd_manager *mgr,
+  int mvar1,
+  int mvar2,
+  int mvar3,
+  boolean (*func3)(int, int, int))
+{
+    mvar_type x, y, z;
+    array_t *child_list_x, *child_list_y, *child_list_z;
+    int i, j, k;
+    mdd_t *tx, *ty, *tz;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    mdd_t *one, *zero;
+
+    one = mdd_one(mgr);
+    zero = mdd_zero(mgr);
+
+    x = array_fetch(mvar_type, mvar_list, mvar1);
+    y = array_fetch(mvar_type, mvar_list, mvar2);
+    z = array_fetch(mvar_type, mvar_list, mvar3);
+
+    if (x.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+		"\nWarning: mdd_func3, bundled variable %s is used\n", x.name);
+	fail("");
+    }
+
+    if (y.status == MDD_BUNDLED) {
+	(void) fprintf(stderr,
+		"\nWarning: mdd_func3, bundled variable %s is used\n", y.name);
+	fail("");
+    }
+
+    if (z.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+		"\nWarning: mdd_func3, bundled variable %s is used\n", z.name);
+	fail("");
+    }
+
+
+    child_list_x = array_alloc(mdd_t *, 0);
+    for (i=0; i<x.values; i++) {
+	child_list_y = array_alloc(mdd_t *, 0);
+	for (j=0; j<y.values; j++) {
+	    child_list_z = array_alloc(mdd_t *, 0);
+	    for (k=0; k<z.values; k++) {
+	        if (func3(i,j,k))
+		    array_insert_last(mdd_t *, child_list_z, one);
+                else
+                    array_insert_last(mdd_t *, child_list_z, zero);
+	    }
+	    tz = mdd_case(mgr, mvar3, child_list_z);
+	    array_insert_last(mdd_t *, child_list_y, tz);
+	    array_free(child_list_z);
+	}
+	ty = mdd_case(mgr, mvar2, child_list_y);
+	array_insert_last(mdd_t *, child_list_x, ty);
+	array_free(child_list_y);
+    }
+    tx = mdd_case(mgr, mvar1, child_list_x);
+    array_free(child_list_x);
+
+    mdd_free(one);
+    mdd_free(zero);
+
+    return tx;
+}
+
+/***** internal functions *****/       
+
+boolean 
+eq_plus3(int x, int y, int z)
+{
+    return (x == y + z);
+}
+
+boolean 
+geq_plus3(int x, int y, int z)
+{
+    return (x >= y + z);
+}
+
+boolean 
+gt_plus3(int x, int y, int z)
+{
+    return (x > y + z);
+}
+
+boolean 
+leq_plus3(int x, int y, int z)
+{
+    return (x <= y + z);
+}
+
+boolean 
+lt_plus3(int x, int y, int z)
+{
+    return (x < y + z);
+}
+
+boolean 
+neq_plus3(int x, int y, int z)
+{
+    return (x != y + z);
+}
+
+boolean 
+eq_minus3(int x, int y, int z)
+{
+    return (x == y - z);
+}
+
+boolean 
+geq_minus3(int x, int y, int z)
+{
+    return (x >= y - z);
+}
+
+boolean 
+gt_minus3(int x, int y, int z)
+{
+    return (x > y - z);
+}
+
+boolean 
+leq_minus3(int x, int y, int z)
+{
+    return (x <= y - z);
+}
+
+boolean 
+lt_minus3(int x, int y, int z)
+{
+    return (x < y - z);
+}
+
+boolean 
+neq_minus3(int x, int y, int z)
+{
+    return (x != y - z);
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_ineq_s.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_ineq_s.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_ineq_s.c	(revision 6)
@@ -0,0 +1,130 @@
+/*
+ * $Id: mdd_ineq_s.c,v 1.4 2002/08/27 16:30:26 fabio Exp $
+ *
+ */
+
+#include "mdd.h"
+
+static int
+mdd_is_care_bit(
+  mvar_type mvar,
+  int index)
+{
+    return ( getbit( ( (int) pow(2.0, (double)mvar.encode_length) ) - mvar.values, mvar.encode_length-index-1));
+}
+
+
+mdd_t *
+mdd_ineq_template_s(
+  mdd_manager *mgr,
+  int mvar1,
+  int mvar2,
+  int zero_then_val /* J in Tim's thesis */,
+  int one_else_val  /* K */,
+  int bottom_val    /* A and B */)
+{
+    mvar_type x, y;
+    bvar_type bx, by;
+    mdd_t *one_top, *zero_top, *zero_then, *one_else,
+          *one_top_else = mdd_one(mgr);
+    mdd_t *one_top_then = mdd_one(mgr);
+    mdd_t *zero_top_else = mdd_one(mgr);
+    mdd_t *zero_top_then = mdd_one(mgr);
+    mdd_t *compare;
+    int i;
+
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+
+    if (zero_then_val == 0) 
+	zero_then = mdd_zero(mgr);
+    else 
+	zero_then = mdd_one(mgr);
+
+
+     if (one_else_val == 0) 
+	 one_else = mdd_zero(mgr);
+     else 
+	 one_else = mdd_one(mgr);
+
+    if (bottom_val == 0) {
+	one_top = mdd_zero(mgr);
+	zero_top = mdd_zero(mgr);
+    }
+    else {
+	one_top = mdd_one(mgr);
+	zero_top = mdd_one(mgr);
+    }
+
+
+    x = array_fetch(mvar_type, mvar_list, mvar1);
+    y = array_fetch(mvar_type, mvar_list, mvar2);
+
+    if (x.values != y.values) 
+	fail("mdd_ineq: 2 mvars have incompatible value ranges\n");
+
+    if (x.status == MDD_BUNDLED) {
+	(void) fprintf(stderr, 
+		"\nWarning: mdd_ineq, bundled variable %s is used\n", x.name);
+	fail("");
+    }
+
+    if (y.status == MDD_BUNDLED) {
+	(void) fprintf(stderr,
+		"\nWarning: mdd_ineq, bundled variable %s is used\n", y.name);
+	fail("");
+    }
+
+
+    for (i=(x.encode_length-1); i>=0; i--) {
+
+	bx = mdd_ret_bvar(&x, i, bvar_list);
+	by = mdd_ret_bvar(&y, i, bvar_list);
+
+	mdd_free(zero_top_else);
+	zero_top_else = mdd_ite(by.node, zero_then, zero_top, 1, 1, 1);
+	mdd_free(zero_top_then);
+	zero_top_then = mdd_ite(by.node, zero_top,  one_else, 1, 1, 1);
+
+	if (mdd_is_care_bit(x,i) == 0) {
+
+		mdd_free(one_top_else);
+		one_top_else = mdd_ite(by.node, zero_then, zero_top, 1, 1, 1);
+		mdd_free(one_top_then);
+		one_top_then = mdd_ite(by.node, one_top, one_else, 1, 1, 1);
+
+		mdd_free(one_top);
+
+		one_top = mdd_ite(bx.node, one_top_then, one_top_else, 1, 1, 1);
+	}
+
+	mdd_free(zero_top);
+	zero_top = mdd_ite(bx.node, zero_top_then, zero_top_else, 1, 1, 1);
+
+    }
+
+    mdd_free(zero_then);
+    mdd_free(one_else);
+
+    mdd_free(zero_top_else);
+    mdd_free(zero_top_then);
+    mdd_free(one_top_else);
+    mdd_free(one_top_then);
+
+    mdd_free(zero_top);
+
+    compare = mdd_eq(mgr, mvar1, mvar2);
+
+    if  ( ( bdd_equal(compare, one_top) == 0) && (zero_then_val == 0) && (one_else_val == 0) && (bottom_val == 1) )
+      printf("Error \n"); 
+
+    mdd_free(compare);
+    
+    return one_top;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_init.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_init.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_init.c	(revision 6)
@@ -0,0 +1,551 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_init.c,v 1.18 2005/05/14 17:30:52 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+int
+integer_get_num_of_digits(int value)
+{
+    double x;
+    int num_of_digits;
+
+    if (value > 0) 	 x = log10((double) value); 
+    else if (value == 0) x = 0;
+    else 		 fail("mdd_init: internal error, value less than 0\n");
+      
+/*
+ * Notice that floor(x) return a double, 
+ * so it needs to be cast into an integer using
+ * this following expression.
+ */
+    num_of_digits = (int) floor(x) + 1;
+
+    return num_of_digits;
+}
+
+static void
+mdd_name_variables(
+  array_t *mvar_list,
+  int no_mvars,
+  array_t **mvar_names_ptr)
+{
+
+    char *istr;
+    int i;
+
+    if (*mvar_names_ptr == NIL(array_t)) {
+	/* if no variable names are given, use generic naming */
+	/* mv_0, mv_1, ... for variable 0, 1, ... */
+	*mvar_names_ptr = array_alloc(char *, 0);
+	for (i=0; i<no_mvars; i++) {
+            /* compose a name for the mvar */
+            istr = ALLOC(char, integer_get_num_of_digits(i + array_n(mvar_list)) + 4);
+            sprintf(istr, "mv_%d", (i + array_n(mvar_list)));
+            array_insert_last(char *, *mvar_names_ptr, istr);
+
+	}
+    }
+    else {
+        if (no_mvars != array_n(*mvar_names_ptr)) 
+	    fail("mdd_init: inconsistent size of mvar_names\n");
+    }
+}
+
+
+static void
+mdd_record_variables(
+  mdd_manager *mgr,
+  int current_vertex_before,
+  int start_mvar,
+  int no_mvars,
+  array_t *mvar_names,
+  array_t *mvar_values,
+  array_t *mvar_strides)
+{
+
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+    int stride_count = 1;
+    int prev_stride = -1;
+	int current_vertex = current_vertex_before;
+    int stride, i, j, 
+        bits, n_bytes;
+    mvar_type mv;
+    bvar_type bv;
+    char *name_str, *mv_name; 
+
+#if MDD_VERBOSE
+        printf("bdd variable insertion ordering: "); 
+#endif
+
+    /* mvar_values -> mvar_list */
+    for (i=0; i<no_mvars; i++) {
+	mv.mvar_id = start_mvar + i;
+
+	/* compose a name for the mvar */
+	name_str = array_fetch(char *, mvar_names, i);
+	n_bytes = strlen (name_str) + 1;
+        mv_name = ALLOC(char, n_bytes);
+	strcpy(mv_name, name_str);
+	mv.name = mv_name;
+
+	/* register no. of values for the mvar */
+	mv.values = array_fetch(int, mvar_values, i);
+
+	/* length of ecoding bits for mvar */
+        bits = no_bit_encode(mv.values);
+	mv.encode_length = bits;
+
+	/* register the starting bdd vertex no. for the mvar */
+	mv.bvars = array_alloc(int, 0);
+
+	if (bits > 0)
+	    stride = array_fetch(int, mvar_strides, i);
+	else
+	    stride = 1;
+	for(j=0; j<bits; j++) array_insert_last(int, mv.bvars, current_vertex + (j * stride) );
+
+
+	/* create place-holder for bit-encoding of the mvar */
+        mv.encoding = ALLOC(int, bits);
+
+	/* create bdd variables and put them in bvar_list */
+	for (j=0; j<bits; j++) {
+	    bv.node = bdd_get_variable(mgr, current_vertex + stride*j);
+	    bv.mvar_id = mv.mvar_id;
+
+#if MDD_VERBOSE 
+		printf("%d ", current_vertex + stride*j);
+#endif
+
+	    array_insert(bvar_type, bvar_list, current_vertex + stride*j, bv);
+	}
+	
+	/* insert the completed mvar_type element to mvar_list */
+	mv.status = MDD_ACTIVE;
+        array_insert_last(mvar_type, mvar_list, mv);
+
+	if ((prev_stride != -1 ) && (stride != prev_stride)) {
+	    printf("mdd_record_variables: processing %s\n", mv.name);
+	    fail("mdd_record_variables: inconsistency found in mvar_stride\n");
+	}
+
+        /* register the stride for mvar interleaving */
+        /* and update current bdd vertex count */
+        if (stride_count == stride) {
+            stride_count = 1;
+	    current_vertex = current_vertex + stride*(bits-1) + 1;
+	    prev_stride = -1;
+	}
+	else {
+	    stride_count++;
+	    current_vertex++;
+	    prev_stride = stride;
+	}
+    }
+
+#if MDD_VERBOSE
+	printf("\n");
+#endif
+
+    /* init all encodings to 2's */
+    clear_all_marks(mgr);
+
+#if MONITOR
+    print_mvar_list(mgr);
+    (void) printf("%d bdd variables created\n", array_n(bvar_list));
+    print_bvar_list_id(mgr); 
+#endif
+
+}
+
+
+mdd_manager *
+mdd_init(
+  array_t *mvar_values,
+  array_t *mvar_names,
+  array_t *mvar_strides)
+{
+    array_t *mvar_list;
+    array_t *bvar_list;
+    int i, no_mvars, current_vertex;
+    int vertex_sum;
+    mdd_manager *mgr;
+    mdd_hook_type *mdd_hook;
+    bdd_external_hooks *hook;
+    boolean free_mvar_strides_flag;
+    boolean free_mvar_names_flag;
+    
+    mdd_hook = ALLOC(mdd_hook_type, 1);
+
+    /* global information about all mvar for mdd_manager */
+    mvar_list = array_alloc(mvar_type, 0);
+
+    /* global information about all bvar for mdd_manager */
+    bvar_list = array_alloc(bvar_type, 0); 
+
+    /* create the hook to the bdd_manager */
+    mdd_hook->mvar_list = mvar_list;
+    mdd_hook->bvar_list = bvar_list;
+
+    /* if some array arguments are NIL */
+    no_mvars = array_n(mvar_values);
+
+    free_mvar_names_flag = (mvar_names == NIL(array_t));
+    mdd_name_variables(mvar_list, no_mvars, &mvar_names);
+
+    /* create mdd manager */      
+    vertex_sum = 0;
+    for (i=0; i<no_mvars; i++) {
+        vertex_sum = vertex_sum + no_bit_encode(array_fetch(int,mvar_values,i));
+    }
+    mgr = bdd_start(vertex_sum);
+
+    hook =  bdd_get_external_hooks(mgr);
+
+    hook->mdd = (char *) mdd_hook;
+
+    current_vertex = 0;
+
+    if (mvar_strides == NIL(array_t)) {
+	/* if no strides are specified, the variables are not interleaved */
+	/* i.e. mvar_strides = 1 */
+        /* must set a flag to know that this array needs to be freed */
+        free_mvar_strides_flag = TRUE;
+	mvar_strides = array_alloc(int, 0);
+	for (i=0; i<no_mvars; i++) {
+	    array_insert_last(int, mvar_strides, 1);
+        }
+    }
+    else {
+        free_mvar_strides_flag = FALSE;
+	if (no_mvars != array_n(mvar_strides))
+	    fail("mdd_init: inconsistent size of mvar_strides\n");
+    }
+
+
+    mdd_record_variables(mgr, current_vertex, 0, no_mvars, mvar_names, mvar_values, mvar_strides);
+
+    if (free_mvar_strides_flag) {
+      array_free(mvar_strides);
+    }
+
+    if (free_mvar_names_flag) {
+      for (i = 0; i < array_n(mvar_names); i++) {
+        char *name = array_fetch(char *, mvar_names, i);
+        FREE(name);
+      }
+      array_free(mvar_names);
+    }
+
+    return mgr;
+}
+
+
+unsigned int
+mdd_create_variables(
+  mdd_manager *mgr,
+  array_t *mvar_values,
+  array_t *mvar_names,
+  array_t *mvar_strides)
+{
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+    int i, no_mvars, current_vertex, start_mvar;
+    int vertex_sum;
+    bdd_t *temp;
+    boolean free_mvar_strides_flag;
+    boolean free_mvar_names_flag;
+
+ 
+    /* if some array arguments are NIL */
+    no_mvars = array_n(mvar_values);
+
+    free_mvar_names_flag = (mvar_names == NIL(array_t));
+    mdd_name_variables(mvar_list, no_mvars, &mvar_names);
+
+    if (mvar_strides == NIL(array_t)) {
+	/* if no strides are specified, the variables are not interleaved */
+	/* i.e. mvar_strides = 1 */
+        /* must set a flag to know that this array needs to be freed */
+        free_mvar_strides_flag = TRUE;
+	mvar_strides = array_alloc(int, 0);
+	for (i=0; i<no_mvars; i++) {
+	    array_insert_last(int, mvar_strides, 1);
+        }
+    }
+    else {
+        free_mvar_strides_flag = FALSE;
+	if (no_mvars != array_n(mvar_strides))
+	    fail("mdd_init: inconsistent size of mvar_strides\n");
+    }
+
+    vertex_sum = 0;
+    for (i=0; i<no_mvars; i++) {
+        vertex_sum = vertex_sum + no_bit_encode(array_fetch(int,mvar_values,i));
+    }
+    for (i=0; i<vertex_sum; i++) {
+	temp =  bdd_create_variable(mgr);
+	bdd_free(temp);
+    }
+
+    current_vertex = array_n(bvar_list);
+    start_mvar = array_n(mvar_list);
+
+    mdd_record_variables(mgr, current_vertex, start_mvar, no_mvars, mvar_names, mvar_values, mvar_strides);
+
+    if (free_mvar_strides_flag) {
+      array_free(mvar_strides);
+    }
+    
+    if (free_mvar_names_flag) {
+      for (i = 0; i < array_n(mvar_names); i++) {
+        char *name = array_fetch(char *, mvar_names, i);
+        FREE(name);
+      }
+      array_free(mvar_names);
+    }
+
+    return start_mvar;
+}
+
+
+unsigned int
+mdd_create_variables_after(
+  mdd_manager *mgr,
+  int	after_mvar_id,
+  array_t *mvar_values,
+  array_t *mvar_names,
+  array_t *mvar_strides)
+{
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+    mvar_type after_mv, fol_mv;
+    int i, no_mvars, current_vertex, start_mvar;
+    int vertex_sum;
+    int after_bv_id;
+    bdd_t *temp;
+    bvar_type sec_bit_of_mv;
+    int sec_bit_level, fol_id;
+    boolean free_mvar_strides_flag;
+    boolean free_mvar_names_flag;
+
+    after_mv = array_fetch( mvar_type, mvar_list, after_mvar_id );
+
+    if (after_mv.encode_length > 1) {
+				sec_bit_of_mv = mdd_ret_bvar(&after_mv, 1, bvar_list);
+				sec_bit_level = bdd_top_var_level( mgr, sec_bit_of_mv.node );
+				/* first_bit_of_last_interleaved_mvar */
+				fol_id = bdd_get_id_from_level( mgr, sec_bit_level - 1 );
+	}
+	else
+	fol_id = mdd_ret_bvar_id(&after_mv, 0);
+
+	fol_mv = array_fetch( mvar_type, mvar_list, fol_id );
+
+    after_bv_id = mdd_ret_bvar_id(&fol_mv, fol_mv.encode_length - 1);
+
+    /* if some array arguments are NIL */
+    no_mvars = array_n(mvar_values);
+
+    free_mvar_names_flag = (mvar_names == NIL(array_t));
+    mdd_name_variables(mvar_list, no_mvars, &mvar_names);
+
+    if (mvar_strides == NIL(array_t)) {
+	/* if no strides are specified, the variables are not interleaved */
+	/* i.e. mvar_strides = 1 */
+        /* must set a flag to know that this array needs to be freed */
+        free_mvar_strides_flag = TRUE;
+	mvar_strides = array_alloc(int, 0);
+	for (i=0; i<no_mvars; i++) {
+	    array_insert_last(int, mvar_strides, 1);
+        }
+    }
+    else {
+        free_mvar_strides_flag = FALSE;
+	if (no_mvars != array_n(mvar_strides))
+	    fail("mdd_init: inconsistent size of mvar_strides\n");
+    }
+
+    vertex_sum = 0;
+    for (i=0; i<no_mvars; i++) {
+        vertex_sum = vertex_sum + no_bit_encode(array_fetch(int,mvar_values,i));
+    }
+    for (i=0; i<vertex_sum; i++) {
+	temp =  bdd_create_variable_after(mgr, after_bv_id + i);
+	bdd_free(temp);
+    }
+
+    current_vertex = array_n(bvar_list);
+    start_mvar = array_n(mvar_list);
+
+    mdd_record_variables(mgr, current_vertex, start_mvar, no_mvars, mvar_names, mvar_values, mvar_strides);
+
+    if (free_mvar_strides_flag) {
+      array_free(mvar_strides);
+    }
+    
+    if (free_mvar_names_flag) {
+      for (i = 0; i < array_n(mvar_names); i++) {
+        char *name = array_fetch(char *, mvar_names, i);
+        FREE(name);
+      }
+      array_free(mvar_names);
+    }
+
+    return start_mvar;
+
+}
+
+
+unsigned int
+mdd_create_variables_interleaved(
+  mdd_manager *mgr,
+  int inter_var_id,
+  int no_mvars,
+  array_t *mvar_names)
+{
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+    mvar_type inter_var;
+    int i, j, current_vertex, start_mvar;
+    bdd_t *temp;
+    array_t *mvar_values;
+    array_t *mvar_strides;
+    boolean free_mvar_names_flag;
+
+    inter_var = array_fetch( mvar_type, mvar_list, inter_var_id );
+
+    /* if some array arguments are NIL */
+    free_mvar_names_flag = (mvar_names == NIL(array_t));
+    mdd_name_variables(mvar_list, no_mvars, &mvar_names);
+
+
+    for (j=0; j<inter_var.encode_length; j++) {
+       for (i=0; i<no_mvars; i++) {
+		temp = bdd_create_variable_after( mgr, mdd_ret_bvar_id(&inter_var, j) );
+		bdd_free( temp );
+       }
+    }
+
+    current_vertex = array_n(bvar_list);
+    start_mvar = array_n(mvar_list);
+
+    mvar_values = array_alloc(int, 0);
+    mvar_strides = array_alloc(int, 0);
+    for(i=0; i<no_mvars; i++) {
+	array_insert_last(int, mvar_values, inter_var.values);
+	array_insert_last(int, mvar_strides, no_mvars);
+    }
+
+    mdd_record_variables(mgr, current_vertex, start_mvar, no_mvars, mvar_names, mvar_values, mvar_strides);
+
+    array_free(mvar_values);
+    array_free(mvar_strides);
+    
+    if (free_mvar_names_flag) {
+      for (i = 0; i < array_n(mvar_names); i++) {
+        char *name = array_fetch(char *, mvar_names, i);
+        FREE(name);
+      }
+      array_free(mvar_names);
+    }
+
+    return start_mvar;
+}
+
+
+void
+mdd_array_free(array_t *mddArray)
+{
+  int i;
+
+  if (mddArray != NIL(array_t)) {
+    for (i = 0; i < array_n(mddArray); i++) {
+      mdd_t *tempMdd = array_fetch(mdd_t *, mddArray, i);
+      mdd_free(tempMdd);
+    }
+    array_free(mddArray);
+  }
+}
+
+void
+mdd_array_array_free(array_t *arrayBddArray)
+{
+  int		i;
+  array_t	*bddArray;
+
+  if (arrayBddArray != NIL(array_t)) {
+    for (i = 0; i < array_n(arrayBddArray); i++) {
+      bddArray = array_fetch(array_t *, arrayBddArray, i);
+      mdd_array_free(bddArray);
+    }
+    array_free(arrayBddArray);
+  }
+}
+
+array_t *
+mdd_array_duplicate(array_t *mddArray)
+{
+  int      i;
+  int      length = array_n(mddArray);
+  array_t *result = array_alloc(mdd_t *, length);
+  for (i = 0; i < length; i++) {
+    mdd_t *tempMdd = array_fetch(mdd_t *, mddArray, i);
+    array_insert(mdd_t *, result, i, mdd_dup(tempMdd));
+  }
+
+  return (result);
+}
+
+
+/* Return true iff two arrays of mdds are identical, i.e., they contain
+   identical mdds in the same order */
+boolean
+mdd_array_equal(array_t *array1, array_t *array2)
+{
+  int i;
+  
+  assert(array1 != NIL(array_t) && array2 != NIL(array_t));
+  
+  if(array_n(array1) != array_n(array2))
+    return FALSE;
+
+  for(i = 0; i < array_n(array1); i++) {
+    mdd_t *mdd1 = array_fetch(mdd_t *, array1, i);
+    mdd_t *mdd2 = array_fetch(mdd_t *, array2, i);
+    if(!mdd_equal(mdd1, mdd2)) 
+      return FALSE;
+  }
+
+  return TRUE;
+}
+
+/* wrapper for mdd_init, to create a manager with no variables */
+mdd_manager *
+mdd_init_empty(void)
+{
+  array_t     *empty_array = array_alloc(int, 0);
+  mdd_manager *mdd_mgr = mdd_init(empty_array, NIL(array_t), NIL(array_t));
+
+  array_free(empty_array);
+  return mdd_mgr;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_intv.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_intv.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_intv.c	(revision 6)
@@ -0,0 +1,162 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_intv.c,v 1.9 2002/08/24 21:48:15 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+/* var <= c */
+mdd_t *
+build_leq_c(
+  mdd_manager *mgr,
+  int mvar_id,
+  int c)
+{
+	return build_lt_c(mgr, mvar_id, c+1);
+}
+
+mdd_t *
+build_lt_c(
+  mdd_manager *mgr,
+  int mvar_id,
+  int c)
+{
+/*	mdd_t *A, *one, *zero;
+	array_t *mvar_list = mdd_ret_mvar_list(mgr);
+	array_t *bvar_list = mdd_ret_bvar_list(mgr);
+	mvar_type a_mv;
+	int i;
+	bvar_type bit_i;
+        mdd_t *temp_A;
+
+	one = mdd_one(mgr);
+	zero = mdd_zero(mgr);
+
+	a_mv = array_fetch( mvar_type, mvar_list, mvar_id);
+
+
+	if ( a_mv.values <= c ) {
+		mdd_free(zero);
+		return one;
+	}
+
+	A = mdd_zero(mgr);
+
+	for(i=1; i <= a_mv.encode_length; i++){
+		bit_i = mdd_ret_bvar(&a_mv, (a_mv.encode_length - i), bvar_list);
+                temp_A = A;
+		if ( getbit(c,i-1) == 0 ) {
+			A = mdd_ite(bit_i.node, zero, temp_A, 1, 1, 1);
+                }
+		else {
+			A = mdd_ite(bit_i.node, temp_A, one, 1, 1, 1);
+                }
+                bdd_free(temp_A);
+	}
+
+	mdd_free(one);
+	mdd_free(zero);
+		
+	return A;
+    */
+
+/* Temporary fix until the routines are rewritten taking care of don't cares. */    
+
+    return mdd_lt_c(mgr, mvar_id, c);
+} 
+
+
+mdd_t *
+build_geq_c(
+  mdd_manager *mgr,
+  int mvar_id,
+  int c)
+{
+/*
+  mdd_t *A, *one, *zero;
+	array_t *bvar_list = mdd_ret_bvar_list(mgr),
+	        *mvar_list = mdd_ret_mvar_list(mgr);
+	mvar_type a_mv;
+	int i;
+	bvar_type bit_i;
+        mdd_t *temp_A;
+
+	one = mdd_one(mgr);
+	zero = mdd_zero(mgr);
+
+	a_mv = array_fetch( mvar_type, mvar_list, mvar_id);
+
+	if ( a_mv.values <= c ) { 
+		mdd_free( one );
+		return zero;
+	}
+
+
+	A = mdd_one(mgr);
+
+	for(i=1; i <= a_mv.encode_length; i++){
+		bit_i = mdd_ret_bvar(&a_mv, (a_mv.encode_length - i), bvar_list );
+                temp_A = A;
+		if ( getbit(c,i-1) == 0 ) {
+			A = mdd_ite(bit_i.node, one, temp_A, 1, 1, 1);
+                }
+		else {
+			A = mdd_ite(bit_i.node, temp_A, zero, 1, 1, 1);
+                     }
+        	bdd_free(temp_A);	
+	}
+
+	mdd_free(one);
+	mdd_free(zero);
+		
+	return A;
+    */
+    return mdd_geq_c(mgr, mvar_id, c);
+}
+
+
+mdd_t *
+build_gt_c(
+  mdd_manager *mgr,
+  int mvar_id,
+  int c)
+{
+	return build_geq_c(mgr, mvar_id, c+1);
+}
+
+/* low <= var <= high */
+mdd_t *
+mdd_interval(
+  mdd_manager *mgr,
+  int mvar_id,
+  int low,
+  int high)
+{
+	mdd_t *HIGH_MDD, *LOW_MDD, *result;
+
+
+    LOW_MDD = build_geq_c(mgr,mvar_id,low);
+	HIGH_MDD = build_leq_c(mgr,mvar_id,high);
+
+	result = mdd_and(HIGH_MDD, LOW_MDD, 1, 1);
+
+	mdd_free(LOW_MDD);
+	mdd_free(HIGH_MDD);
+
+	return result;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_iter.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_iter.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_iter.c	(revision 6)
@@ -0,0 +1,332 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_iter.c,v 1.8 2002/08/27 16:30:26 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+/* this routine returns the first minterm (2's in cube becomes 0's), */
+/* given an mdd generator, containing a cube and a list of variables */
+/* to be included in the minterm */
+   
+static array_t *
+first_minterm(mdd_gen *mgen)
+{
+    array_t *minterm;
+    bdd_literal literal;
+    int i, j;
+
+    array_t *mvar_list = mdd_ret_mvar_list(mgen->manager);
+    int mv_id;
+    mvar_type mv;
+    boolean out_of_range;  /* a minterm is out of range if one variable is */
+    array_t *solution;
+    int value;
+
+    out_of_range = 0;
+                                                                                
+    minterm = array_alloc(bdd_literal, 0);
+    solution = array_alloc(int, 0);
+    /* loop once for each mvar */
+    for (i=0; i<array_n(mgen->var_list); i++) {
+	mv_id = array_fetch(int, mgen->var_list, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_id);
+	/* loop for each bvar */
+        value = 0;
+        for (j=0; j<mv.encode_length; j++) {
+	    literal = array_fetch(bdd_literal, mgen->cube, mdd_ret_bvar_id(&mv, j) ); 
+            if (literal == 0) {
+		array_insert_last(bdd_literal, minterm, 0);
+		value = value*2 + 0;
+	    }
+	    else if (literal == 1) {
+		array_insert_last(bdd_literal, minterm, 1);
+		value = value*2 + 1;
+	    }
+	    else { /*if (literal == 2) */
+		array_insert_last(bdd_literal, minterm, 0);
+		value = value*2 + 0;
+            }
+	}
+	(void) array_insert_last(int, solution, value);
+	if (value >= mv.values) out_of_range = 1;
+    }
+    mgen->minterm = minterm;
+    mgen->out_of_range = out_of_range;
+
+    return (solution);
+}
+
+
+/* this routine returns the next minterm, given a current minterm, */
+/* a cube and a list of variables to be included in the minterm */
+/* if no more, return NIL(array_t). */
+
+static array_t *
+next_minterm(mdd_gen *mgen)
+{
+    int carry;
+    int i, j, k;
+    array_t *minterm;
+    bdd_literal literal;
+    bdd_literal prev_literal;
+    array_t *mvar_list = mdd_ret_mvar_list(mgen->manager);
+    int mv_id;
+    mvar_type mv;
+    boolean out_of_range;
+    array_t *solution;
+    int value;
+
+    out_of_range = 0;
+
+    carry = 1;
+    k = 0;
+
+    minterm = array_alloc(bdd_literal, array_n(mgen->minterm)); 
+    solution = array_alloc(int, 0);
+    /* loop once for each mvar */
+    for (i=0; i<array_n(mgen->var_list); i++) {
+	mv_id = array_fetch(int, mgen->var_list, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_id);
+	value = 0;
+	/* loop for each bvar */
+        for (j=0; j<mv.encode_length; j++) {
+            literal = array_fetch(bdd_literal, mgen->cube, mdd_ret_bvar_id(&mv, j) );
+
+	    prev_literal = array_fetch(bdd_literal, mgen->minterm, k);
+            if ((literal == 2) && (carry == 1)) {
+		if (prev_literal == 0) {
+		    array_insert(bdd_literal, minterm, k, 1);
+		    carry = 0;
+		    value = value*2 + 1;
+		}
+		else if (prev_literal == 1) {
+		    array_insert(bdd_literal, minterm, k, 0);
+		    carry = 1;
+		    value = value*2 + 0;
+		}
+	    }
+	    else if ((literal == 2) && (carry == 0)) {
+		    array_insert(bdd_literal, minterm, k, prev_literal);
+		    value = value*2 + prev_literal;
+	    }
+	    else { /* if literal == 0 or 1 */
+                    array_insert(bdd_literal, minterm, k, literal);
+		    value = value*2 + literal;
+	    }
+	    k++;
+	}
+	array_insert_last(int, solution, value);
+	if (value >= mv.values) out_of_range = 1;
+    }
+
+    if (carry == 1) {
+	/* no more minterms */
+	array_free(minterm);
+	minterm = NIL(array_t);
+	array_free(solution);
+	solution = NIL(array_t);
+    }
+    array_free(mgen->minterm);
+    mgen->minterm = minterm;
+    mgen->out_of_range = out_of_range;
+
+    return (solution);
+}
+
+
+static array_t *
+next_valid_minterm(mdd_gen *mgen)
+{
+    array_t *solution;
+    array_t *cube;
+
+    solution = next_minterm(mgen);
+
+    /* check if done with current cube */
+    if (mgen->minterm == NIL(array_t)) {
+	(void) bdd_next_cube(mgen->bdd_generator, &cube);
+        mgen->status = bdd_gen_read_status(mgen->bdd_generator);
+	mgen->cube = cube;
+	if (mgen->status != bdd_EMPTY) {
+	    if (solution != NIL(array_t) ) array_free(solution);
+	    solution = first_minterm(mgen);
+	}
+	else {
+	    mgen->minterm = NIL(array_t);
+	    mgen->cube = NIL(array_t);
+	}
+    }
+    return (solution);
+}
+
+
+mdd_gen *
+mdd_first_minterm(
+  mdd_t *f,
+  array_t **solution_p   /* minterm = array of values */,
+  array_t *variable_list)
+{
+    mdd_gen *mgen;	/* mdd generator */
+    bdd_gen *bgen;	/* bdd generator for bdd_first_cube, bdd_next_cube */
+    array_t *cube;	/* array of literals {0,1,2} */
+    array_t *allvar_list; 
+    array_t *mvar_list;
+    array_t *smoothing_list;
+    int i, j, k;
+    array_t *solution = NIL(array_t); /* initialize for lint */
+    array_t *var_list;
+    boolean i_is_present;
+    mdd_t *mdd_tmp, *f_copy;
+    bdd_manager *mgr;
+
+    if ( f != NIL(mdd_t) ) {
+	/* new code added by Timothy */
+	/* f is first smoothed by all variables NOT present in var_list */
+
+	f_copy = mdd_dup(f); 
+
+	smoothing_list = array_alloc(int, 0);
+    
+    
+	mgr = bdd_get_manager(f_copy);
+	mvar_list = mdd_ret_mvar_list(mgr);                                                                           
+
+	for (i = 0; i < array_n(mvar_list); i++) {
+	    i_is_present = FALSE;
+	    for (j = 0; j < array_n(variable_list); j++) {
+		k = array_fetch(int, variable_list, j);
+		if (k == i) i_is_present = TRUE;
+	    }
+	    if (i_is_present == FALSE) array_insert_last(int, smoothing_list, i);
+	}
+	if (array_n(smoothing_list) > 0) {
+	    mdd_tmp = mdd_smooth(mgr, f_copy, smoothing_list);
+	    (void) mdd_free(f_copy);
+	    f_copy = mdd_dup(mdd_tmp);
+	    (void) mdd_free(mdd_tmp);
+    
+	}
+
+	(void) array_free(smoothing_list);
+
+	bgen = bdd_first_cube(f_copy, &cube);
+	(void) mdd_free(f_copy);
+    
+	mgen = ALLOC(mdd_gen, 1);
+	mgen->manager = mgr;
+	mgen->bdd_generator = bgen;
+	mgen->status = bdd_gen_read_status(mgen->bdd_generator);
+	mgen->cube = cube; 		/* store in mdd gen for later use */
+	mgen->out_of_range = 0;
+	if (mgen->status != bdd_EMPTY) {
+	    if (variable_list != NIL(array_t)) {
+		var_list = array_dup(variable_list);
+		mgen->var_list = var_list;
+	    }
+	    else {
+		allvar_list = array_alloc(int, 0);
+		for (i=0; i<array_n(mvar_list); i++) 
+		    array_insert_last(int, allvar_list, i);
+		mgen->var_list = allvar_list;
+	    }
+	    solution = first_minterm(mgen);
+	    while (mgen->out_of_range) {
+		array_free(solution);
+		solution = next_valid_minterm(mgen);
+	    }
+	}
+	else {
+
+	    /* mgen->status == bdd_EMPTY */
+	    if (variable_list != NIL(array_t)) {
+                var_list = array_dup(variable_list);
+                mgen->var_list = var_list;
+            }
+            else {
+                allvar_list = array_alloc(int, 0);
+                for (i=0; i<array_n(mvar_list); i++)
+                    array_insert_last(int, allvar_list, i);
+                mgen->var_list = allvar_list;
+            }
+
+	    mgen->minterm = NIL(array_t);
+	    mgen->cube = NIL(array_t);
+	    /* previous solution will not be freed here */
+	    /* but by the calling procedure */
+	}
+	*solution_p = solution;
+    }
+    else /* f = NIL */{
+      mgen = ALLOC(mdd_gen, 1);
+      mgen->manager = NIL(mdd_manager);
+      mgen->bdd_generator = NIL(bdd_gen);
+      mgen->status = bdd_EMPTY;
+      mgen->cube = NIL(array_t);
+      mgen->minterm = NIL(array_t);
+      mgen->out_of_range = 0;
+      mgen->var_list = NIL(array_t);
+    }
+
+    return (mgen);
+}
+
+
+boolean
+mdd_next_minterm(
+  mdd_gen *mgen,
+  array_t **solution_p 	/* minterm = array of values */)
+{
+    array_t *solution;
+    solution = next_valid_minterm(mgen);
+    while ((mgen->out_of_range) && (mgen->status != bdd_EMPTY)) {
+	array_free(solution);
+	solution = next_valid_minterm(mgen);
+    }
+    *solution_p = solution;
+    if (mgen->status != bdd_EMPTY)
+	return (1);
+    else
+	return (0);
+}
+
+
+void
+mdd_print_array(array_t *array)
+{
+    int i, value;
+    for (i=0; i<array_n(array); i++) {
+	value = array_fetch(int, array, i);
+        printf("%d ",value);
+    }
+    printf("\n");
+}
+
+
+int
+mdd_gen_free(mdd_gen *mgen)
+{
+    if (mgen->minterm != NIL(array_t)) array_free(mgen->minterm);
+/*  if (mgen->cube != NIL(array_t)) array_free(mgen->cube); */
+/*  mgen->cube gets freed in bdd_gen_free(mgen->bdd_generator) below */
+    if (mgen->var_list != NIL(array_t)) array_free(mgen->var_list);
+    bdd_gen_free(mgen->bdd_generator);
+    FREE(mgen);
+
+    return (0);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_literal.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_literal.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_literal.c	(revision 6)
@@ -0,0 +1,60 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_literal.c,v 1.10 2002/08/24 21:48:15 fabio Exp $
+ *
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+/* Returns \/_{i in values}(mddid == i) */
+/* Algorithm used to be quadratic.  Is linear now */
+mdd_t *
+mdd_literal(
+  mdd_manager *mgr,
+  int mddid,
+  array_t *values)
+{
+  mvar_type mvar;
+  mdd_t *one, *zero;
+  array_t *allValues;    /* Holds one in pos i iff value i is allowed */
+  int i;                 /* iterator                                  */   
+  int value;             /* iterates over values                      */
+  mdd_t *result;
+  
+  mvar = mdd_get_var_by_id(mgr, mddid);
+  one = mdd_one(mgr);
+  zero = mdd_zero(mgr);
+  allValues = array_alloc(mdd_t *, mvar.values);
+
+  /* first set every value to zero */
+  for(i = 0; i < mvar.values; i++)
+    array_insert(mdd_t *, allValues, i, zero);
+  
+  /* then set requested values to one */
+  arrayForEachItem(int, values, i, value)
+    array_insert(mdd_t *, allValues, value, one);
+  
+  result = mdd_case(mgr, mddid, allValues);
+  array_free(allValues);
+
+  mdd_free(one);
+  mdd_free(zero);
+  
+  return result;
+}
+
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_mod.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_mod.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_mod.c	(revision 6)
@@ -0,0 +1,130 @@
+/*
+ * $Id: mdd_mod.c,v 1.5 2002/08/27 16:30:26 fabio Exp $
+ *
+ */
+
+#include "mdd.h"
+
+static void mod_block_build (mdd_t ****, int, bvar_type *, bvar_type *);
+static void assert_zero (mdd_manager *, mdd_t **, bvar_type *);
+static void single_var_block_build (mdd_t ****, bvar_type *, int);
+
+int
+getbit(int number, int position)
+{
+return ( (number >> position) & 1);
+}
+
+static void
+assert_zero(
+  mdd_manager *mgr,
+  mdd_t **PINS_00_ptr,
+  bvar_type *a_bit_i_ptr)
+{
+	mdd_t *zero;
+
+	zero = mdd_zero(mgr);
+
+	(*PINS_00_ptr) = mdd_ite( a_bit_i_ptr->node,  zero, (*PINS_00_ptr) , 1, 1, 1);		
+
+	mdd_free(zero);
+
+	return;
+}
+
+static void
+single_var_block_build(
+  mdd_t ****PINS_ptr,
+  bvar_type *b_bit_i_ptr,
+  int M)
+{
+	int i;
+
+	for (i=0; i < M; i++)
+		(*PINS_ptr)[0][i] = mdd_ite( b_bit_i_ptr->node, (*PINS_ptr)[0][(2*i+1)%M], (*PINS_ptr)[0][(2*i)%M], 1, 1, 1);
+
+}
+
+/* a = b (mod M) */
+static void
+mod_block_build(
+  mdd_t ****PINS_ptr,
+  int M /* modulus */,
+  bvar_type *a_bit_i_ptr,
+  bvar_type *b_bit_i_ptr)  
+{
+	int i, j;
+	mdd_t *THEN, *ELSE;
+
+	for(i=0; i<M; i++)
+		for (j=0; j<M; j++){
+			THEN = mdd_ite(b_bit_i_ptr->node, (*PINS_ptr)[(2*i+1)%M][(2*j+1)%M], 
+							   (*PINS_ptr)[(2*i+1)%M][(2*j)%M],   1, 1, 1);
+			
+			ELSE = mdd_ite(b_bit_i_ptr->node, (*PINS_ptr)[(2*i)%M][(2*j+1)%M], 
+							   (*PINS_ptr)[(2*i)%M][(2*j)%M],     1, 1, 1);
+		
+			(*PINS_ptr)[i][j] = mdd_ite(a_bit_i_ptr->node, THEN, ELSE, 1, 1, 1);
+		}			
+}
+
+/* a = b (mod M) */
+mdd_t *
+mdd_mod(
+  mdd_manager *mgr,
+  int a_mvar_id,
+  int b_mvar_id,
+  int M /* Modulus */ )
+{
+	mdd_t ***PINS; 		/* Two dimensional array of mdd_t*'s used in forming the mdd */
+	int i, j;
+	mvar_type a, b;
+	array_t *mvar_list = mdd_ret_mvar_list(mgr);
+ 	array_t *bvar_list = mdd_ret_bvar_list(mgr);
+	bvar_type a_bit_i, b_bit_i;
+	mdd_t *result, *less_than;
+
+	a = array_fetch ( mvar_type, mvar_list, a_mvar_id);
+	b = array_fetch ( mvar_type, mvar_list, b_mvar_id);
+
+	/* Allocate two dimensional array PINS[0..M-1][0..M-1] of mdd_t *'s */
+	PINS = ALLOC(mdd_t **, M);		
+	for(i=0; i<M; i++) PINS[i] = ALLOC(mdd_t *, M);
+	
+	for(i=0; i< M; i++) 
+		for(j=0; j< M; j++) PINS[i][j] = mdd_zero(mgr);
+
+	for(i=0; i< M; i++) PINS[i][i] = mdd_one(mgr);
+
+	for( i = 1 ; i <= (MIN(a.encode_length, b.encode_length)); i++){ 
+		a_bit_i = mdd_ret_bvar( &a, (a.encode_length - i), bvar_list);
+		b_bit_i = mdd_ret_bvar( &b, (b.encode_length - i), bvar_list);
+
+		mod_block_build(&PINS, M,  &a_bit_i, &b_bit_i);	 
+	}
+
+	if ( a.encode_length > b.encode_length ) 
+		for ( i = MIN(a.encode_length, b.encode_length)+1; i <= a.encode_length; i++){
+			a_bit_i = mdd_ret_bvar( &a, (a.encode_length - i), bvar_list);
+			assert_zero( mgr, &(PINS[0][0]), &a_bit_i);
+		}
+
+	if ( b.encode_length > a.encode_length )
+		for ( i = MIN(a.encode_length, b.encode_length)+1; i <= b.encode_length; i++){
+			b_bit_i = mdd_ret_bvar( &b, (b.encode_length - i), bvar_list);
+			single_var_block_build( &PINS, &b_bit_i, M);
+		}
+
+	less_than = build_lt_c(mgr, a_mvar_id, M);
+
+	result = mdd_and(PINS[0][0], less_than, 1, 1);
+		
+	return result;	
+
+
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_quit.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_quit.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_quit.c	(revision 6)
@@ -0,0 +1,51 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_quit.c,v 1.10 2002/08/24 21:48:15 fabio Exp $
+ *
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+void
+mdd_quit(mdd_manager *mgr)
+{
+    int i;
+    mvar_type one_mvar_struct;
+    bvar_type one_bvar_struct;
+    bdd_external_hooks *hook;  
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+
+
+    for (i=0; i<array_n(mvar_list); i++) {
+	one_mvar_struct = array_fetch(mvar_type, mvar_list, i);
+        FREE(one_mvar_struct.name);
+        FREE(one_mvar_struct.encoding);
+	array_free(one_mvar_struct.bvars);
+    }
+    array_free(mvar_list); 
+    for (i=0; i<array_n(bvar_list); i++) {
+	one_bvar_struct = array_fetch(bvar_type, bvar_list, i);
+        mdd_free(one_bvar_struct.node);
+    }
+    array_free(bvar_list); 
+
+    hook = bdd_get_external_hooks(mgr);
+    FREE(hook->mdd);
+
+    bdd_end(mgr);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_search.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_search.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_search.c	(revision 6)
@@ -0,0 +1,107 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_search.c,v 1.10 2002/08/27 16:30:26 fabio Exp $
+ *
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+static void
+mdd_pr_cubes(mdd_manager *mgr)
+{
+    int i, j;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    mvar_type mv;
+
+    for (i=0; i<array_n(mvar_list); i++) {
+        mv = array_fetch(mvar_type, mvar_list, i);
+        (void) printf("\n%s = ", mv.name);
+        for (j=0; j<mv.encode_length; j++)
+            (void) printf("%d",mv.encoding[j]);
+    }
+    (void) printf("\n");
+}
+
+static void
+mdd_pr_minterms(mdd_manager *mgr)
+{
+	/* not implemented yet */
+
+    int i, j;
+    mvar_type mv;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+    for (i=0; i<array_n(mvar_list); i++) {
+        mv = array_fetch(mvar_type, mvar_list, i);
+        (void) printf("\n%s = ", mv.name);
+        for (j=0; j<mv.encode_length; j++)
+            (void) printf("%d",mv.encoding[j]);
+    }
+    (void) printf("\n");
+}
+
+void
+mdd_search(
+  mdd_manager *mgr,
+  bdd_t *top,
+  int phase,
+  boolean minterms)
+{
+    int is_complemented;
+    bdd_t *child, *top_uncomp;
+    
+    if (mdd_is_tautology(top,1)) {
+	if (phase == 1) {
+	    if (minterms == 1) mdd_pr_minterms(mgr);	
+	    else mdd_pr_cubes(mgr);	
+	}
+        return;
+    }
+    if (mdd_is_tautology(top,0)) {
+	if (phase == 0) {
+	    if (minterms == 1) mdd_pr_minterms(mgr);	
+	    else mdd_pr_cubes(mgr);	
+	}
+        return;
+    }
+
+    (void)bdd_get_node(top,&is_complemented);
+
+    if (is_complemented != 0) { 
+	phase = toggle(phase);
+    }
+
+    (void) mdd_mark(mgr, top, 1);
+
+    if (is_complemented) top_uncomp = bdd_not(top); 
+    else top_uncomp = mdd_dup(top);
+
+    child = bdd_then(top_uncomp);
+    mdd_search(mgr, child, phase, minterms);
+    mdd_free(child);
+
+
+    child = bdd_else(top_uncomp);
+    (void) mdd_mark(mgr, top, 0);
+    mdd_search(mgr, child, phase, minterms);
+    mdd_unmark(mgr, top);
+
+    mdd_free(top_uncomp);
+    mdd_free(child);
+    return;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_smooth.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_smooth.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_smooth.c	(revision 6)
@@ -0,0 +1,74 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_smooth.c,v 1.10 2002/08/27 03:17:38 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_smooth(
+  mdd_manager *mgr,
+  mdd_t *fn,
+  array_t *mvars)
+{
+    array_t *bdd_vars;
+    int i, j, mv_no;
+    mvar_type mv;
+    mdd_t *top;
+    bdd_t *temp;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+	
+	
+    if ( mvars == NIL(array_t) ) {
+	top = bdd_dup(fn);
+	printf("\nWARNING: Empty Array of Smoothing Variables\n");
+	return top;
+    }
+    else if ( array_n(mvars) == 0) {
+	top = bdd_dup(fn);
+	printf("\nWARNING: Empty Array of Smoothing Variables\n");
+	return top;
+    }
+		
+	
+    bdd_vars = array_alloc(bdd_t *, 0);	
+    for (i=0; i<array_n(mvars); i++) {
+	mv_no = array_fetch(int, mvars, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_no);
+	if (mv.status == MDD_BUNDLED) {
+	    (void) fprintf(stderr, 
+			"\nmdd_smooth: bundled variable %s used\n",mv.name);
+	    fail("");
+        }
+
+	for (j=0; j<mv.encode_length; j++) {
+	    temp = bdd_get_variable(mgr, mdd_ret_bvar_id(&mv,j) );
+	    array_insert_last(bdd_t *, bdd_vars, temp);
+	}
+    }
+	
+    top = bdd_smooth(fn, bdd_vars);
+  
+    for (i=0; i<array_n(bdd_vars); i++) {
+	temp = array_fetch(bdd_t *, bdd_vars, i);
+	bdd_free(temp);
+    }
+    array_free(bdd_vars);
+
+    return top;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_substit.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_substit.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_substit.c	(revision 6)
@@ -0,0 +1,106 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_substit.c,v 1.10 2002/08/24 21:48:15 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+array_t *
+mdd_substitute_array(
+  mdd_manager	*mgr,
+  array_t	*fn_array,
+  array_t	*old_mvars,
+  array_t	*new_mvars)
+{
+    array_t	*new_fn_array;
+    mdd_t	*new_fn, *fn;
+    int		i;
+
+    new_fn_array = array_alloc(mdd_t *, 0);
+    arrayForEachItem(mdd_t *, fn_array, i, fn) {
+	new_fn = mdd_substitute(mgr, fn, old_mvars, new_mvars);
+	array_insert(mdd_t *, new_fn_array, i, new_fn);
+    }
+
+    return(new_fn_array);
+}
+
+mdd_t *
+mdd_substitute(
+  mdd_manager	*mgr,
+  mdd_t		*fn,
+  array_t	*old_mvars,
+  array_t	*new_mvars)
+{
+    array_t 		*old_bdd_vars, *new_bdd_vars;
+    int 		i, j, old_mv_no, new_mv_no, no_mvar;
+    mvar_type 		old_mv, new_mv;
+    mdd_t 		*top;
+    array_t 		*mvar_list = mdd_ret_mvar_list(mgr);
+    bdd_t		*varBdd;
+
+    old_bdd_vars = array_alloc( bdd_t *, 0);
+    new_bdd_vars = array_alloc( bdd_t *, 0);
+
+    no_mvar = array_n(old_mvars);
+    if (no_mvar != array_n(new_mvars)) 
+        fail("mdd_substitute: arrays contains different no. of mvars.\n");
+
+    for (i=0; i<no_mvar; i++) {
+        old_mv_no = array_fetch(int, old_mvars, i);
+	old_mv = array_fetch(mvar_type, mvar_list, old_mv_no);
+	if (old_mv.status == MDD_BUNDLED) {
+		(void) fprintf(stderr, 
+		   "\nmdd_substitute: bundled variable %s used\n",old_mv.name);
+		fail("");
+	}
+
+        new_mv_no = array_fetch(int, new_mvars, i);
+	new_mv = array_fetch(mvar_type, mvar_list, new_mv_no);
+	if (new_mv.status == MDD_BUNDLED) {
+		(void) fprintf(stderr, 
+		   "\nmdd_substitute: bundled variable %s used\n",new_mv.name);
+		fail("");
+	}
+
+	if (old_mv.values != new_mv.values) 
+            fail("mdd_substitute: mvars have different no. of values\n");
+
+	for (j=0; j<old_mv.encode_length; j++) {	
+	    varBdd = bdd_get_variable( mgr, mdd_ret_bvar_id(&old_mv,j) );
+	    array_insert_last( bdd_t *, old_bdd_vars, varBdd );
+
+	    varBdd = bdd_get_variable( mgr, mdd_ret_bvar_id(&new_mv, j) );
+	    array_insert_last( bdd_t *, new_bdd_vars, varBdd);
+	}
+    }
+    top = bdd_substitute(fn, old_bdd_vars, new_bdd_vars);
+
+    for(j=0; j<array_n(old_bdd_vars); j++) {
+        varBdd = array_fetch(bdd_t*,old_bdd_vars,j);
+        bdd_free(varBdd);
+    }
+    array_free(old_bdd_vars);
+    for(j=0; j<array_n(new_bdd_vars); j++) {
+        varBdd = array_fetch(bdd_t*,new_bdd_vars,j);
+        bdd_free(varBdd);
+    }
+    array_free(new_bdd_vars);
+
+    return top;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_support.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_support.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_support.c	(revision 6)
@@ -0,0 +1,104 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_support.c,v 1.12 2002/08/24 21:48:15 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+array_t *
+mdd_get_support(mdd_manager *mdd_mgr, mdd_t *f)
+{
+    array_t *full_list, *support_list;
+    array_t *mvar_list = mdd_ret_mvar_list(mdd_mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mdd_mgr);
+    var_set_t *vset;
+    int i, list_length;
+    bvar_type bv;
+    boolean present;
+
+
+    /* initialize full list of mvar id's */
+    list_length = array_n(mvar_list);
+    full_list = array_alloc(boolean, list_length);
+    for (i = 0; i < array_n(mvar_list); i++) {
+	array_insert(boolean, full_list, i, 0);
+    }
+
+    vset = bdd_get_support(f);
+    for (i = 0; i < array_n(bvar_list); i++) {
+	if (var_set_get_elt(vset, i) == 1) {
+	    bv = array_fetch(bvar_type, bvar_list, i);
+	    (void) array_insert(boolean, full_list, bv.mvar_id, 1);
+	}
+    }
+
+    support_list = array_alloc(int, 0);
+    for (i = 0; i < array_n(mvar_list); i++) {
+	present = array_fetch(boolean, full_list, i);
+	if (present) array_insert_last(int, support_list, i);
+    }
+
+    (void) array_free(full_list);
+    (void) var_set_free(vset);
+
+    return support_list;
+}
+
+array_t *
+mdd_get_bdd_support_ids(mdd_manager *mdd_mgr, mdd_t *f)
+{
+    array_t *bdd_support_list;
+    array_t *bvar_list = mdd_ret_bvar_list(mdd_mgr);
+    var_set_t *vset;
+    int i;
+
+    bdd_support_list = array_alloc(int, 0);
+
+    vset = bdd_get_support(f);
+    for (i = 0; i < array_n(bvar_list); i++) {
+	if (var_set_get_elt(vset, i) == 1) {
+	    array_insert_last(int, bdd_support_list, i);
+	}
+    }
+
+    (void) var_set_free(vset);
+    return bdd_support_list;
+}
+
+array_t *
+mdd_get_bdd_support_vars(mdd_manager *mdd_mgr, mdd_t *f)
+{
+    array_t *bdd_support_list;
+    array_t *bvar_list = mdd_ret_bvar_list(mdd_mgr);
+    var_set_t *vset;
+    mdd_t *var;
+    int i;
+
+    bdd_support_list = array_alloc(mdd_t *, 0);
+    
+    vset = bdd_get_support(f);
+    for (i = 0; i < array_n(bvar_list); i++) {
+	if (var_set_get_elt(vset, i) == 1) {
+	    var = bdd_var_with_index(mdd_mgr, i);
+	    array_insert_last(mdd_t *, bdd_support_list, var);
+	}
+    }
+
+    (void) var_set_free(vset);
+    return bdd_support_list;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_uminus.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_uminus.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_uminus.c	(revision 6)
@@ -0,0 +1,30 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_uminus.c,v 1.9 2002/08/24 21:48:15 fabio Exp $
+ *
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+mdd_t *
+mdd_unary_minus_s(
+  mdd_manager *mgr,
+  int mvar1,
+  int mvar2)
+{
+    return (mdd_unary_minus(mgr, mvar1, mvar2));
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/mdd_util.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mdd_util.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mdd_util.c	(revision 6)
@@ -0,0 +1,1434 @@
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mdd_util.c,v 1.38 2002/09/21 20:41:33 fabio Exp $
+ *
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+static	bdd_t*	mddRetOnvalBdd(mdd_manager *mddMgr, int mddId);
+static	bdd_t*	mddIntRetOnvalBdd(mdd_manager *mddMgr, int valNum, int low, int hi, int level, array_t *bddVarArr);
+static	void	mddFreeBddArr(array_t *bddArr);
+	
+/************************************************************************/
+#define		mddGetVarById( mgr, id )	\
+    array_fetch(mvar_type, mdd_ret_mvar_list((mgr)),(id))
+
+
+int
+toggle(int x)
+{
+    if (x == 0) return 1;
+    else {
+	if (x == 1) return 0;
+	else {
+	    fail("toggle: invalid boolean value\n");
+	    return -1;
+	}
+    }
+}
+
+int
+no_bit_encode(int n)
+{
+    int i = 0;
+    int j = 1;
+
+    if (n < 2) return 1; /* Takes care of mv.values <= 1 */
+
+    while (j < n) {
+	j = j * 2;
+	i++;
+    }
+    return i;
+}
+
+void
+print_mvar_list(mdd_manager *mgr)
+{
+    mvar_type mv;
+    int i;
+    int no_mvar;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+    no_mvar = array_n(mvar_list);
+    printf("print_mvar_list:\n");
+    printf("id\tname\tvalues\tbits\tstride\tstart_vertex\n");
+    for (i=0; i<no_mvar; i++) {
+        mv = array_fetch(mvar_type, mvar_list, i);
+        (void) printf("%d\t%s\t%d\t%d\n", 
+		mv.mvar_id, mv.name, mv.values, 
+		mv.encode_length);
+    }
+}
+
+void
+print_strides(array_t *mvar_strides)
+{
+    int i, s;
+
+    (void) printf("mvar_strides: ");
+    for (i=0; i<array_n(mvar_strides); i++) {
+        s = array_fetch(int, mvar_strides, i);
+        (void) printf("%d ", s);
+    }
+    (void) printf("\n");
+}
+
+void
+print_bdd_list_id(array_t *bdd_list)
+{
+    bdd_t *b;
+    int i, is_complemented;
+
+    (void) printf("bdd_list id's: ");
+    for (i=0; i<array_n(bdd_list); i++) {
+        b = array_fetch(bdd_t *, bdd_list, i);
+        (void)bdd_get_node(b, &is_complemented);
+        if (is_complemented) (void) printf("!");
+        (void) printf("%d ", bdd_top_var_id(b));
+    }
+    (void) printf("\n");
+}
+
+void
+print_bvar_list_id(mdd_manager *mgr)
+{
+    bvar_type bv;
+    int i, is_complemented;
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+ 
+    (void) printf("bvar_list id's: ");
+    for (i=0; i<array_n(bvar_list); i++) {
+        bv = array_fetch(bvar_type, bvar_list, i);
+        (void)bdd_get_node(bv.node,&is_complemented);
+        if (is_complemented) (void) printf("!");
+	(void) printf("%d ", bdd_top_var_id(bv.node));
+    }
+    (void) printf("\n");
+}
+
+void
+print_bdd(bdd_manager *mgr, bdd_t *top)
+{
+
+    int is_complemented;
+    bdd_t *child, *top_uncomp;
+
+    if (bdd_is_tautology(top,1)) {
+	(void) printf("ONE ");
+        return;
+    }
+    if (bdd_is_tautology(top,0)) {
+	(void) printf("ZERO ");
+        return;
+    }
+    (void)bdd_get_node(top, &is_complemented);
+    if (is_complemented != 0) (void) printf("!");
+    (void) printf("%d ", bdd_top_var_id(top));
+    (void) printf("v ");
+    (void) printf("< ");
+
+    if (is_complemented) top_uncomp = bdd_not(top);
+    else top_uncomp = mdd_dup(top);
+
+    child = bdd_then(top);
+
+    print_bdd(mgr, child);
+    (void) printf("> ");
+
+    mdd_free(child);
+    child = bdd_else(top);
+
+    print_bdd(mgr, child);
+    (void) printf("^ ");
+    
+    mdd_free(top_uncomp);
+    mdd_free(child);
+
+    return;
+}
+
+
+
+mvar_type 
+find_mvar_id(mdd_manager *mgr, unsigned short id)
+{
+    mvar_type mv;
+    bvar_type bv;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    array_t *bvar_list = mdd_ret_bvar_list(mgr);
+
+    if (id >= array_n(bvar_list))
+    	fail("find_mvar_id: invalid parameter range for id\n");
+    bv = array_fetch(bvar_type, bvar_list, id);
+    if ((bv.mvar_id < 0) || (bv.mvar_id >= array_n(mvar_list)))
+    	fail("find_mvar_id: bvar contains invalid mvar_id\n");
+    mv = array_fetch(mvar_type, mvar_list, bv.mvar_id);
+    return mv;
+}
+
+void
+clear_all_marks(mdd_manager *mgr)
+{
+    int i, j;
+    mvar_type mv;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+
+    for (i=0; i<array_n(mvar_list); i++) {
+	mv = array_fetch(mvar_type, mvar_list, i);
+	for (j=0; j<mv.encode_length; j++)
+	    mv.encoding[j] = 2;
+    }
+}
+
+void
+mdd_mark(
+  mdd_manager *mgr,
+  bdd_t *top /**** was bdd_node *bnode; --- changed by Serdar ***/,
+  int phase)
+{
+    int i, top_id, found = 0;
+    int bit_position = 0; /* initialize for lint */
+    mvar_type mv;
+
+    top_id = bdd_top_var_id(top);
+    mv = find_mvar_id(mgr, top_id);
+
+    for (i=0; i<(mv.encode_length); i++){
+		if ( mdd_ret_bvar_id( &mv, i) == top_id ){
+			bit_position = i;
+			found = 1;
+			break;
+		};
+    };
+   
+    
+    if (found == 0)
+	fail("mdd_mark: interleaving error\n");
+
+    mv.encoding[bit_position] = phase;
+    
+}
+
+void
+mdd_unmark(mdd_manager *mgr, bdd_t *top)
+{
+    int i, top_id, found = 0;
+    int bit_position = 0; /* initialize for lint */
+    mvar_type mv;
+
+
+    top_id = bdd_top_var_id(top);
+    mv = find_mvar_id(mgr, top_id);
+
+    for (i=0; i<mv.encode_length; i++) 
+		if ( mdd_ret_bvar_id( &mv, i) == top_id ){
+			bit_position = i;
+			found = 1;
+			break;
+		};
+
+    if (found == 0)
+	fail("mdd_unmark: interleaving error\n");
+    mv.encoding[bit_position] = 2;
+}
+
+mvar_type 
+find_mvar(mdd_manager *mgr, char *name)
+{
+    int i;
+    mvar_type mv;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+    for (i=0; i<array_n(mvar_list); i++) {
+	mv = array_fetch(mvar_type, mvar_list, i);
+        if (strcmp(mv.name, name) == 0) return mv;
+    }
+    fail("find_mvar: cannot find name in mvar_list\n");
+    return mv;
+}
+
+array_t *
+mdd_ret_mvar_list(mdd_manager *mgr)
+{
+    bdd_external_hooks *hook;    
+    array_t *mvar_list;
+
+    hook =  bdd_get_external_hooks(mgr);
+    mvar_list = ((mdd_hook_type *)(hook->mdd))->mvar_list;
+
+    return mvar_list;
+}
+
+void
+mdd_set_mvar_list(mdd_manager *mgr, array_t *mvar_list)
+{
+    bdd_external_hooks *hook;    
+
+    hook =  bdd_get_external_hooks(mgr);
+    ((mdd_hook_type *)(hook->mdd))->mvar_list = mvar_list;
+}
+
+
+array_t *
+mdd_ret_bvar_list(mdd_manager *mgr)
+{
+    bdd_external_hooks *hook;    
+    array_t *bvar_list;
+
+    hook =  bdd_get_external_hooks(mgr);
+    bvar_list = ((mdd_hook_type *)(hook->mdd))->bvar_list;
+
+    return bvar_list;
+}
+
+
+int
+mdd_ret_bvar_id(mvar_type *mvar_ptr, int i)
+{
+	
+	return ( array_fetch(int, mvar_ptr->bvars, i) );
+}
+
+bvar_type
+mdd_ret_bvar(mvar_type *mvar_ptr, int i, array_t *bvar_list)
+{
+	int bvar_id;
+	
+	bvar_id = array_fetch(int, mvar_ptr->bvars, i);
+	
+	return array_fetch(bvar_type, bvar_list, bvar_id);
+}
+
+/************************************************************************/
+/* Given an Mdd, returns the num of onset points.  By construction of	*/
+/* Mdd's, some points not in the range of Mdd vars may be included 	*/
+/* in the onset. These fake points must first be removed.		*/
+/************************************************************************/
+
+double
+mdd_count_onset(
+  mdd_manager	*mddMgr,
+  mdd_t		*aMdd,
+  array_t	*mddIdArr)
+{
+	bdd_t		*onvalBdd, *aOnvalBdd, *onsetBdd, *tmpBdd;
+	double		onsetNum;
+	array_t		*bddVarArr;
+	int		i, arrSize, mddId;
+
+	arrSize = array_n( mddIdArr );
+	onvalBdd = bdd_one( mddMgr );
+
+	for ( i = 0 ; i < arrSize ; i++ ) {
+	    mddId = array_fetch( int, mddIdArr, i );
+	    aOnvalBdd = mddRetOnvalBdd( mddMgr, mddId );
+
+	    tmpBdd = bdd_and( onvalBdd, aOnvalBdd, 1, 1 );
+	    bdd_free( onvalBdd );
+	    bdd_free( aOnvalBdd );
+	    onvalBdd = tmpBdd;
+	}
+	onsetBdd = bdd_and( onvalBdd, aMdd, 1, 1 );
+	bdd_free( onvalBdd );
+
+	bddVarArr = mdd_id_array_to_bdd_array( mddMgr, mddIdArr );
+	onsetNum = bdd_count_onset( onsetBdd, bddVarArr );
+	bdd_free( onsetBdd );
+	mddFreeBddArr( bddVarArr );
+	return( onsetNum );
+}		/* mdd_count_onset */
+
+mdd_t *
+mdd_onset_bdd(
+  mdd_manager	*mddMgr,
+  mdd_t		*aMdd,
+  array_t	*mddIdArr)
+{
+	bdd_t		*onvalBdd, *aOnvalBdd, *onsetBdd, *tmpBdd;
+	int		i, arrSize, mddId;
+
+	arrSize = array_n( mddIdArr );
+	onvalBdd = bdd_one( mddMgr );
+
+	for ( i = 0 ; i < arrSize ; i++ ) {
+	    mddId = array_fetch( int, mddIdArr, i );
+	    aOnvalBdd = mddRetOnvalBdd( mddMgr, mddId );
+
+	    tmpBdd = bdd_and( onvalBdd, aOnvalBdd, 1, 1 );
+	    bdd_free( onvalBdd );
+	    bdd_free( aOnvalBdd );
+	    onvalBdd = tmpBdd;
+	}
+	onsetBdd = bdd_and( onvalBdd, aMdd, 1, 1 );
+	bdd_free( onvalBdd );
+	return( onsetBdd );
+}		/* mdd_onset_bdd */
+
+int
+mdd_epd_count_onset(
+  mdd_manager	*mddMgr,
+  mdd_t		*aMdd,
+  array_t	*mddIdArr,
+  EpDouble	*epd)
+{
+	bdd_t		*onvalBdd, *aOnvalBdd, *onsetBdd, *tmpBdd;
+	array_t		*bddVarArr;
+	int		i, arrSize, mddId;
+	int		status;
+
+	arrSize = array_n( mddIdArr );
+	onvalBdd = bdd_one( mddMgr );
+
+	for ( i = 0 ; i < arrSize ; i++ ) {
+	    mddId = array_fetch( int, mddIdArr, i );
+	    aOnvalBdd = mddRetOnvalBdd( mddMgr, mddId );
+
+	    tmpBdd = bdd_and( onvalBdd, aOnvalBdd, 1, 1 );
+	    bdd_free( onvalBdd );
+	    bdd_free( aOnvalBdd );
+	    onvalBdd = tmpBdd;
+	}
+	onsetBdd = bdd_and( onvalBdd, aMdd, 1, 1 );
+	bdd_free( onvalBdd );
+
+	bddVarArr = mdd_id_array_to_bdd_array( mddMgr, mddIdArr );
+	status = bdd_epd_count_onset( onsetBdd, bddVarArr, epd );
+	if (status)
+	    return(status);
+	bdd_free( onsetBdd );
+	mddFreeBddArr( bddVarArr );
+	return(0);
+}		/* mdd_epd_count_onset */
+
+/************************************************************************/
+static	bdd_t*
+mddRetOnvalBdd(
+  mdd_manager	*mddMgr,
+  int		mddId)
+{
+	bdd_t		*onvalBdd;
+	mvar_type	mVar;
+	int		valNum, high;
+	array_t		*bddVarArr;	
+	
+	mVar = mddGetVarById( mddMgr, mddId );
+	valNum = mVar.values;
+	high = (int) pow( (double) 2, (double) mVar.encode_length ); 
+	assert( (valNum == 1)  || ( (valNum <= high) && (valNum > high/2) ));
+	if ( valNum == high )
+	    onvalBdd = bdd_one( mddMgr );
+	else {
+	    bddVarArr = mdd_id_to_bdd_array( mddMgr, mddId );
+	    onvalBdd = mddIntRetOnvalBdd( mddMgr, valNum, 0, high, 
+					  0, bddVarArr );
+	    mddFreeBddArr( bddVarArr );
+	}
+	return( onvalBdd );
+}		/* mddRetOnvalBdd */	
+
+/************************************************************************/
+static	bdd_t*
+mddIntRetOnvalBdd(
+  mdd_manager *mddMgr,
+  int valNum,
+  int low,
+  int hi,
+  int level,
+  array_t *bddVarArr)
+{
+	int		mid;
+	bdd_t		*curVar, *recBdd;
+	bdd_t		*onvalBdd = NIL(bdd_t); /* initialized for lint */
+
+	mid = (low + hi) / 2;
+	curVar = array_fetch( bdd_t *, bddVarArr, level );
+
+	if 	( valNum > mid ) {
+	    recBdd = mddIntRetOnvalBdd( mddMgr, valNum, mid, hi, 
+					level+1, bddVarArr );
+	    onvalBdd = bdd_or( recBdd, curVar, 1, 0 );
+	    bdd_free( recBdd );
+	}
+	else if ( valNum < mid ) {
+	    recBdd = mddIntRetOnvalBdd( mddMgr, valNum, low, mid, 
+					level+1, bddVarArr );
+	    onvalBdd = bdd_and( recBdd, curVar, 1, 0 );
+	    bdd_free( recBdd );
+	}
+	else if ( valNum == mid ) 
+	    onvalBdd = bdd_not( curVar );
+	return( onvalBdd );
+}		/* mddIntRetOnvalBdd */
+
+/************************************************************************/
+/* Given an array of bdd nodes, frees the array.			*/
+
+static void
+mddFreeBddArr(array_t *bddArr)
+{
+	int	i, arrSize;
+
+	arrSize = array_n( bddArr );
+	for ( i = 0 ; i < arrSize ; i++ ) 
+	    bdd_free( array_fetch( bdd_t *, bddArr, i ) );
+	array_free( bddArr );
+}		/* mddFreeBddArr */
+
+array_t  *
+mdd_ret_bvars_of_mvar(mvar_type *mvar_ptr)
+{
+	return mvar_ptr->bvars;
+}
+
+/************************************************************************/
+/* mdd_get_care_set returns the care set of the mdd manager */ 
+
+static mdd_t *mdd_get_care_set(mdd_manager *mdd_mgr)
+{
+    mdd_t *temp;
+    mvar_type mv;
+    mdd_manager *bdd_mgr;
+
+    int mvar_id,i,j,val_j,value;
+    array_t *mvar_list;
+    bdd_t *care_set, *care_val, *care_cube,*bit_j;
+    
+    mvar_list = mdd_ret_mvar_list(mdd_mgr);
+    bdd_mgr = mdd_mgr;
+    
+    care_set = bdd_one(bdd_mgr);
+    
+    for (mvar_id =0; mvar_id < array_n(mvar_list); mvar_id++)
+        {
+            mv = array_fetch(mvar_type, mvar_list, mvar_id);
+            care_val = bdd_zero(bdd_mgr);
+                
+            for (i=0; i< (mv.values); i++)
+                {
+                    value = i;
+                    care_cube = bdd_one(bdd_mgr);
+                    for(j=0; j< mv.encode_length; j++ )
+                        {
+                            bit_j = bdd_get_variable(bdd_mgr,mdd_ret_bvar_id(&mv, j));
+                            val_j = value % 2;
+                            value = value/2;
+                            temp = care_cube;
+                            care_cube = bdd_and(temp,bit_j,1,val_j);
+                            bdd_free(temp);
+                        }
+                    temp = care_val;
+                    care_val = bdd_or(temp,care_cube,1,1);
+                    bdd_free(temp);
+                    bdd_free(care_cube);
+                }
+            temp = care_set;
+            care_set = bdd_and(temp,care_val,1,1);
+            bdd_free(care_val);
+            bdd_free(temp);
+        }
+    return care_set;
+}
+
+/* Corrected mdd_cproject */
+/* returns only valid carepoints */
+
+mdd_t *mdd_cproject(
+  mdd_manager *mgr,
+  mdd_t *T,
+  array_t *mvars)
+{
+    mdd_t *care_set, *new_T, *T_proj;
+     array_t *bdd_vars;
+    int i, j, mv_no;
+    mvar_type mv;
+    bdd_t *temp;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+
+    care_set = mdd_get_care_set(mgr);
+    new_T = bdd_and(T,care_set,1,1);
+    bdd_free(care_set);
+
+      if ( mvars == NIL(array_t) ) {
+        T_proj = bdd_dup(T);
+        printf("\nWARNING: Empty Array of Smoothing Variables\n");
+        return T_proj;
+    }
+    else if ( array_n(mvars) == 0) {
+        T_proj = bdd_dup(T);
+        printf("\nWARNING: Empty Array of Smoothing Variables\n");
+        return T_proj;
+    }
+                
+        
+    bdd_vars = array_alloc(bdd_t*, 0);     
+    for (i=0; i<array_n(mvars); i++) {
+        mv_no = array_fetch(int, mvars, i);
+        mv = array_fetch(mvar_type, mvar_list, mv_no);
+        if (mv.status == MDD_BUNDLED) {
+            (void) fprintf(stderr, 
+                        "\nmdd_smooth: bundled variable %s used\n",mv.name);
+            fail("");
+        }
+
+        for (j = 0;j < mv.encode_length; j ++) {
+            temp = bdd_get_variable(mgr, mdd_ret_bvar_id(&mv,j) );
+            array_insert_last(bdd_t *, bdd_vars, temp);
+        }
+    }
+        
+  
+    T_proj = bdd_cproject(new_T,bdd_vars);
+    bdd_free(new_T);
+
+    for (i=0; i<array_n(bdd_vars); i++) {
+        temp = array_fetch(bdd_t *, bdd_vars, i);
+        bdd_free(temp);
+    }
+    array_free(bdd_vars);
+
+    
+    return T_proj;
+}
+
+void
+mdd_print_support(mdd_t *f)
+{
+    mdd_manager *mgr = bdd_get_manager(f);
+    array_t *support_list = mdd_get_support(mgr, f);
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    int nSupports = array_n(support_list);
+    int i, j;
+    mvar_type mv;
+    int id;
+
+    for (i = 0; i < nSupports; i++) {
+	id = array_fetch(int, support_list, i);
+	mv = array_fetch(mvar_type, mvar_list, id);
+	if (id == mv.mvar_id)
+	    printf("[%d] = %s\n", i, mv.name);
+	else { /* needs to be checked */
+	    for (j = 0; j < array_n(mvar_list); j++) {
+		mv = array_fetch(mvar_type, mvar_list, j);
+		if (id == mv.mvar_id) {
+		    printf(" [%d] = %s\n", i, mv.name);
+		    break;
+		}
+	    }
+	}
+    }
+
+    array_free(support_list);
+}
+
+void
+mdd_print_support_to_file(FILE *fout, char *format, mdd_t *f)
+{
+    mdd_manager *mgr = bdd_get_manager(f);
+    array_t *support_list = mdd_get_support(mgr, f);
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+    int nSupports = array_n(support_list);
+    int i, j;
+    mvar_type mv;
+    int id;
+
+    for (i = 0; i < nSupports; i++) {
+	id = array_fetch(int, support_list, i);
+	mv = array_fetch(mvar_type, mvar_list, id);
+	if (id == mv.mvar_id)
+	    fprintf(fout, format, mv.name);
+	else { /* needs to be checked */
+	    for (j = 0; j < array_n(mvar_list); j++) {
+		mv = array_fetch(mvar_type, mvar_list, j);
+		if (id == mv.mvar_id) {
+		    fprintf(fout, format, mv.name);
+		    break;
+		}
+	    }
+	}
+    }
+
+    array_free(support_list);
+}
+
+char *
+mdd_read_var_name(mdd_t *f)
+{
+    mdd_manager *mgr;
+    array_t *support_list;
+    array_t *mvar_list;
+    int i, id;
+    mvar_type mv;
+
+    if (bdd_size(f) != 2) {
+	fprintf(stderr,
+	  "** mdd error: mdd_read_var_name can be called for a variable\n");
+	return(NIL(char));
+    }
+
+    mgr = bdd_get_manager(f);
+    support_list = mdd_get_support(mgr, f);
+    mvar_list = mdd_ret_mvar_list(mgr);
+
+    id = array_fetch(int, support_list, 0);
+    mv = array_fetch(mvar_type, mvar_list, id);
+    if (id == mv.mvar_id) {
+	array_free(support_list);
+	return(mv.name);
+    } else { /* needs to be checked */
+	for (i = 0; i < array_n(mvar_list); i++) {
+	    mv = array_fetch(mvar_type, mvar_list, i);
+	    if (id == mv.mvar_id) {
+		array_free(support_list);
+		return(mv.name);
+	    }
+	}
+    }
+
+    array_free(support_list);
+    return(NIL(char));
+}
+
+int
+mdd_read_mdd_id(mdd_t *f)
+{
+    mdd_manager *mgr;
+    array_t *support_list;
+    int id;
+
+    if (bdd_size(f) != 2) {
+	fprintf(stderr,
+	  "** mdd error: mdd_read_mdd_id can be called for a variable\n");
+	return(0);
+    }
+
+    mgr = bdd_get_manager(f);
+    support_list = mdd_get_support(mgr, f);
+    id = array_fetch(int, support_list, 0);
+    array_free(support_list);
+    return(id);
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of BDD ids corresponding to a MDD variable.]
+
+  Description [This function takes an MddId. It returns an array of BDD ids
+  corresponding to the bits.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+mdd_id_to_bdd_id_array(mdd_manager *mddManager, int mddId)
+{
+  array_t     *bddIdArray;
+  mvar_type   mddVar;
+  array_t     *mvar_list;
+  int         i, j;
+
+  mvar_list = mdd_ret_mvar_list(mddManager);
+  mddVar = array_fetch(mvar_type, mvar_list, mddId);
+  bddIdArray = array_alloc(int, mddVar.encode_length);
+  
+  for (i=0; i<mddVar.encode_length; i++){
+    j = mdd_ret_bvar_id(&mddVar, i);
+    array_insert_last(int, bddIdArray, j);
+  }
+  return bddIdArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of Bdd_t's corresponding to a Mdd variable.]
+
+  Description [This function takes an MddId. It returns an array of bdd_t's
+  corresponding to the bits.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+mdd_id_to_bdd_array(mdd_manager *mddManager, int mddId)
+{
+  array_t	*bddArray;
+  mvar_type	mddVar;
+  int		i, id;
+  
+  mddVar = mddGetVarById(mddManager, mddId);
+  bddArray = array_alloc(bdd_t*, mddVar.encode_length);
+  
+  for (i = 0; i < mddVar.encode_length; i++) {
+    id = mdd_ret_bvar_id(&mddVar, i);
+    array_insert_last(bdd_t*, bddArray, bdd_get_variable(mddManager, id));
+  }
+  return bddArray;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of binary vars(bdd_t *) for a given mdd
+  id array.]
+
+  Description []
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+mdd_id_array_to_bdd_array(mdd_manager *mddManager, array_t *mddIdArray)
+{
+  array_t	*bddArray;
+  int		i, j;
+  int		id, size;
+  mvar_type	mddVar;
+
+  bddArray = array_alloc(bdd_t*, 0);
+  size = array_n(mddIdArray);
+
+  for (i = 0; i < size; i++) {
+    id = array_fetch(int, mddIdArray, i);
+    mddVar = mddGetVarById(mddManager, id);
+    for (j = 0; j < mddVar.encode_length; j++) {
+      id = mdd_ret_bvar_id(&mddVar, j);
+      array_insert_last(bdd_t *, bddArray, bdd_get_variable(mddManager, id));
+    }
+  }
+  return bddArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns an array of bddId's corresponding to an array of Mdd
+  ids.] 
+
+  Description [This function takes an array of MddId's. For each MddId it
+  returns an array of bddId's corresponding to the bits. These arrays of bddId's
+  are concatenated together and returned.]
+
+  SideEffects []
+
+******************************************************************************/
+array_t *
+mdd_id_array_to_bdd_id_array(mdd_manager *mddManager, array_t *mddIdArray)
+{
+  array_t *bddIdArray;
+  int i;
+
+  bddIdArray = array_alloc(int, 0);
+  for (i=0; i<array_n(mddIdArray); i++){
+    int mddId;
+    array_t *tmpBddIdArray;
+    mddId = array_fetch(int, mddIdArray, i);
+    tmpBddIdArray = mdd_id_to_bdd_id_array(mddManager, mddId);
+    array_append(bddIdArray, tmpBddIdArray);
+    array_free(tmpBddIdArray);
+  }
+  return bddIdArray;
+}
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns a bdd cube from a given mdd id array.]
+
+  Description []
+
+  SideEffects []
+
+******************************************************************************/
+mdd_t *
+mdd_id_array_to_bdd_cube(mdd_manager *mddManager, array_t *mddIdArray)
+{
+  int		i, j;
+  int		id, size;
+  mvar_type	mddVar;
+  mdd_t		*cube, *var, *tmp;
+  int		nVars;
+  char		*vars;
+
+  size = array_n(mddIdArray);
+  nVars = bdd_num_vars(mddManager);
+  vars = ALLOC(char, sizeof(char) * nVars);
+  memset(vars, 0, sizeof(char) * nVars);
+
+  for (i = 0; i < size; i++) {
+    id = array_fetch(int, mddIdArray, i);
+    mddVar = mddGetVarById(mddManager, id);
+    for (j = 0; j < mddVar.encode_length; j++) {
+      id = mdd_ret_bvar_id(&mddVar, j);
+      vars[bdd_get_level_from_id(mddManager, id)] = 1;
+    }
+  }
+  cube = mdd_one(mddManager);
+  for (i = nVars - 1; i >= 0; i--) {
+    if (vars[i] == 0)
+      continue;
+    id = (int)bdd_get_id_from_level(mddManager, (long)i);
+    var = bdd_get_variable(mddManager, id);
+    tmp = mdd_and(cube, var, 1, 1);
+    mdd_free(cube);
+    mdd_free(var);
+    cube = tmp;
+  }
+  FREE(vars);
+  return cube;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of bdd variables from mdd id array.]
+
+  Description [Returns the number of bdd variables from mdd id array.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+mdd_get_number_of_bdd_vars(mdd_manager *mddManager, array_t *mddIdArray)
+{
+  int i, n;
+
+  n = 0;
+  for (i=0; i<array_n(mddIdArray); i++){
+    int mddId;
+    array_t *tmpBddIdArray;
+    mddId = array_fetch(int, mddIdArray, i);
+    tmpBddIdArray = mdd_id_to_bdd_id_array(mddManager, mddId);
+    n += array_n(tmpBddIdArray);
+    array_free(tmpBddIdArray);
+  }
+  return n;
+}
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the number of bdd support of a mdd.]
+
+  Description [Returns the number of bdd support of a mdd.]
+
+  SideEffects []
+
+******************************************************************************/
+int
+mdd_get_number_of_bdd_support(mdd_manager *mddManager, mdd_t *f)
+{
+    array_t *bvar_list = mdd_ret_bvar_list(mddManager);
+    var_set_t *vset;
+    int i, number = 0;
+
+    vset = bdd_get_support(f);
+    for (i = 0; i < array_n(bvar_list); i++) {
+	if (var_set_get_elt(vset, i) == 1) {
+	    number++;
+	}
+    }
+
+    (void) var_set_free(vset);
+    return number;
+}
+
+/**Function********************************************************************
+
+  Synopsis [Given an Mvf representing the functionality of a multi-valued
+  variable, it returns an array of Bdd's representing the characteristic
+  function of the relation of the various bits of the multi-valued variable.] 
+
+  Description [Suppose y is a k-valued variable and takes values
+              0,1,..,k-1. Then the input to this function is an array with k
+              Mdds each representing the onset of the respective value of the
+              variable (the ith Mdd representing the onset when y takes the
+              value (i-1). Suppose m bits are needed to encode the k values of
+              y. Then internally y is represented as y_0, y_1, ...,
+              y_(m-1). Now the functionality of each bit of y can be computed
+              by proper boolean operation on the functions representing the
+              onsets of various values of y. For instance if y is a 4-valued
+              variable. To achieve that we do the following:
+              For each bit b{
+                relation = 0;
+                For each value j of the variable{
+                  Ej = Encoding function of the jth value
+                  Fj = Onset function of the jth value
+                  If (b appears in the positive phase in Ej) then
+                     relation += b * Fj 
+                  else if (b appears in the negative phase in Ej) then
+                     relation += b'* Fj
+                  else if (b does not appear in Ej) then
+                     relation += Fj
+                }
+              }
+              Note that the above algorithm does not handle the case when a
+              bit appears in both phases in the encoding of any value of the
+              variable. Hence the assumption behind the above algorithm is that
+              the values are encoded as cubes.
+              The case when the encoding are functions can be handled by more
+              complex algorithm. In that case, we will not be able to build the
+              relation for each bit separately. Something to be dealt with in
+              the later work.
+              ]              
+  SideEffects []
+
+******************************************************************************/
+array_t *
+mdd_fn_array_to_bdd_rel_array(
+  mdd_manager *mddManager,
+  int mddId,
+  array_t *mddFnArray)
+{
+  array_t *bddRelationArray, *mddLiteralArray, *valueArray, *bddArray;
+  mvar_type mddVar;
+  int i, j, numValues, numEncodingBits;
+  bdd_t *bdd, *bddRelation, *bddNot;
+  bdd_t *mddFn, *posCofactor, *negCofactor, *tmpBddRelation;
+  mdd_t *mddLiteral, *literalRelation;
+  array_t *mvar_list;
+  
+  numValues = array_n(mddFnArray);
+  /* simple binary case */
+  if (numValues == 2) {
+    bdd_t *onRelation, *offRelation;
+
+    bddArray = mdd_id_to_bdd_array(mddManager, mddId);
+    bdd = array_fetch(bdd_t *, bddArray, 0);
+    array_free(bddArray);
+    mddFn = array_fetch(mdd_t *, mddFnArray, 0);
+    offRelation = bdd_and(bdd, mddFn, 0, 1);
+    mddFn = array_fetch(mdd_t *, mddFnArray, 1);
+    onRelation = bdd_and(bdd, mddFn, 1, 1);
+    bdd_free(bdd);
+    bddRelation = bdd_or(onRelation, offRelation, 1, 1);
+    bdd_free(onRelation);
+    bdd_free(offRelation);
+    bddRelationArray = array_alloc(bdd_t *, 0);
+    array_insert_last(bdd_t *, bddRelationArray, bddRelation);
+    return bddRelationArray;
+  }
+  mvar_list = mdd_ret_mvar_list(mddManager);
+  mddVar = array_fetch(mvar_type, mvar_list, mddId);
+  assert(mddVar.values == numValues);
+
+  /*
+   * The following is to check whether each encoding is cube or not.
+   * Since Berkeley MDD package always does the cube encoding this checking has
+   * been turned off currently.
+   */
+  
+  valueArray = array_alloc(int, 1);
+  mddLiteralArray = array_alloc(mdd_t*, 0);
+  for (i=0; i<numValues; i++){
+    array_insert(int, valueArray, 0, i);
+    /* Form the Mdd corresponding to this value */
+    mddLiteral = mdd_literal(mddManager, mddId, valueArray);
+    /* Check if this is a cube */
+    if (bdd_is_cube(mddLiteral) == FALSE){ 
+      fprintf(stderr,
+	"The encoding of the variable %s for the value %d isnot a cube.\n",
+	mddVar.name, i); 
+      fprintf(stderr, "It can result in wrong answers.\n");
+    } 
+    array_insert_last(mdd_t*, mddLiteralArray, mddLiteral);
+  }
+  array_free(valueArray);
+
+  bddRelationArray = array_alloc(bdd_t*, 0);
+  numEncodingBits = mddVar.encode_length;
+  bddArray = mdd_id_to_bdd_array(mddManager, mddId);
+  for (i=0; i<numEncodingBits; i++) {
+    bddRelation = bdd_zero((bdd_manager *)mddManager);
+    bdd = array_fetch(bdd_t*, bddArray, i);
+    bddNot = bdd_not(bdd);
+    for (j=0; j<numValues; j++){
+      mddLiteral = array_fetch(mdd_t*, mddLiteralArray, j);
+      mddFn = array_fetch(mdd_t*, mddFnArray, j);
+      posCofactor = bdd_cofactor(mddLiteral, bdd);
+      if (bdd_is_tautology(posCofactor, 0)) {
+	literalRelation = bdd_and(bddNot, mddFn, 1, 1);
+	bdd_free(posCofactor);
+      } else {
+	negCofactor = bdd_cofactor(mddLiteral, bddNot);
+	if (bdd_is_tautology(negCofactor, 0)) {
+	  literalRelation = bdd_and(bdd, mddFn, 1, 1);
+        } else {
+	  assert(bdd_equal(posCofactor, negCofactor));
+	  literalRelation = bdd_dup(mddFn);
+	}
+	bdd_free(posCofactor);
+	bdd_free(negCofactor);
+      }
+      tmpBddRelation = bdd_or(bddRelation, literalRelation, 1, 1);
+      bdd_free(literalRelation);
+      bdd_free(bddRelation);
+      bddRelation = tmpBddRelation;
+    }
+    array_insert_last(bdd_t*, bddRelationArray, bddRelation);
+    bdd_free(bdd);
+    bdd_free(bddNot);
+  }
+  /* Free stuff */
+  mdd_array_free(mddLiteralArray);
+  array_free(bddArray);
+  return bddRelationArray;
+}
+
+/**Function********************************************************************
+
+  Synopsis [Given an Mvf representing the functionality of a multi-valued
+  variable, it returns an array of Bdd's representing the characteristic
+  function of the relation of the various bits of the multi-valued variable.] 
+
+  Description [Suppose y is a k-valued variable and takes values
+              0,1,..,k-1. Then the input to this function is an array with k
+              Mdds each representing the onset of the respective value of the
+              variable (the ith Mdd representing the onset when y takes the
+              value (i-1). Suppose m bits are needed to encode the k values of
+              y. Then internally y is represented as y_0, y_1, ...,
+              y_(m-1). Now the functionality of each bit of y can be computed
+              by proper boolean operation on the functions representing the
+              onsets of various values of y. For instance if y is a 4-valued
+              variable. To achieve that we do the following:
+              For each bit b{
+                relation = 0;
+                For each value j of the variable{
+                  Ej = Encoding function of the jth value
+                  Fj = Onset function of the jth value
+                  If (b appears in the positive phase in Ej) then
+                     relation += b * Fj 
+                  else if (b appears in the negative phase in Ej) then
+                     relation += b'* Fj
+                  else if (b does not appear in Ej) then
+                     relation += Fj
+                }
+              }
+              Note that the above algorithm does not handle the case when a
+              bit appears in both phases in the encoding of any value of the
+              variable. Hence the assumption behind the above algorithm is that
+              the values are encoded as cubes.
+              The case when the encoding are functions can be handled by more
+              complex algorithm. In that case, we will not be able to build the
+              relation for each bit separately. Something to be dealt with in
+              the later work.
+              ]              
+  SideEffects []
+
+******************************************************************************/
+array_t *
+mdd_fn_array_to_bdd_fn_array(
+  mdd_manager *mddManager,
+  int mddId,
+  array_t *mddFnArray)
+{
+  array_t *bddFunctionArray, *mddLiteralArray, *valueArray, *bddArray;
+  mvar_type mddVar;
+  int i, j, numValues, numEncodingBits;
+  bdd_t *bdd, *bddFunction, *bddNot;
+  bdd_t *onSet, *offSet, *dcSet, *lower, *upper;
+  bdd_t *mddFn, *posCofactor, *negCofactor, *tmp;
+  mdd_t *mddLiteral;
+  array_t *mvar_list;
+  
+  numValues = array_n(mddFnArray);
+  /* simple binary case */
+  if (numValues == 2) {
+    bddFunctionArray = array_alloc(bdd_t *, 0);
+    mddFn = array_fetch(mdd_t *, mddFnArray, 1);
+    bddFunction = mdd_dup(mddFn);
+    array_insert_last(bdd_t *, bddFunctionArray, bddFunction);
+    return bddFunctionArray;
+  }
+  mvar_list = mdd_ret_mvar_list(mddManager);
+  mddVar = array_fetch(mvar_type, mvar_list, mddId);
+  assert(mddVar.values == numValues);
+
+  /*
+   * The following is to check whether each encoding is cube or not.
+   * Since Berkeley MDD package always does the cube encoding this checking has
+   * been turned off currently.
+   */
+  
+  valueArray = array_alloc(int, 1);
+  mddLiteralArray = array_alloc(mdd_t*, 0);
+  for (i=0; i<numValues; i++){
+    array_insert(int, valueArray, 0, i);
+    /* Form the Mdd corresponding to this value */
+    mddLiteral = mdd_literal(mddManager, mddId, valueArray);
+    /* Check if this is a cube */
+    if (bdd_is_cube(mddLiteral) == FALSE) {
+      fprintf(stderr,
+	"The encoding of the variable %s for the value %d isnot a cube.\n",
+	mddVar.name, i); 
+      fprintf(stderr, "It can result in wrong answers.\n");
+    } 
+    array_insert_last(mdd_t*, mddLiteralArray, mddLiteral);
+  }
+  array_free(valueArray);
+
+  bddFunctionArray = array_alloc(bdd_t*, 0);
+  numEncodingBits = mddVar.encode_length;
+  bddArray = mdd_id_to_bdd_array(mddManager, mddId);
+  for (i=0; i<numEncodingBits; i++) {
+    onSet = bdd_zero((bdd_manager *)mddManager);
+    offSet = bdd_zero((bdd_manager *)mddManager);
+    dcSet = bdd_zero((bdd_manager *)mddManager);
+    bdd = array_fetch(bdd_t*, bddArray, i);
+    bddNot = bdd_not(bdd);
+    for (j=0; j<numValues; j++) {
+      mddLiteral = array_fetch(mdd_t*, mddLiteralArray, j);
+      posCofactor = bdd_cofactor(mddLiteral, bdd);
+      mddFn = array_fetch(mdd_t*, mddFnArray, j);
+
+      if (bdd_is_tautology(posCofactor, 0)) {
+	tmp = bdd_or(offSet, mddFn, 1, 1);
+	bdd_free(offSet);
+	offSet = tmp;
+	bdd_free(posCofactor);
+	continue;
+      }
+
+      negCofactor = bdd_cofactor(mddLiteral, bddNot);
+      if (bdd_is_tautology(negCofactor, 0)) {
+	tmp = bdd_or(onSet, mddFn, 1, 1);
+	bdd_free(onSet);
+	onSet = tmp;
+	bdd_free(posCofactor);
+	bdd_free(negCofactor);
+	continue;
+      }
+
+      assert(bdd_equal(posCofactor, negCofactor));
+      bdd_free(posCofactor);
+      bdd_free(negCofactor);
+
+      tmp = bdd_or(dcSet, mddFn, 1, 1);
+      bdd_free(dcSet);
+      dcSet = tmp;
+    }
+    bdd_free(bdd);
+    bdd_free(bddNot);
+    lower = bdd_and(onSet, offSet, 1, 0);
+    bdd_free(offSet);
+    upper = bdd_or(onSet, dcSet, 1, 1);
+    bdd_free(onSet);
+    bdd_free(dcSet);
+    bddFunction = bdd_between(lower, upper);
+    bdd_free(lower);
+    bdd_free(upper);
+    array_insert_last(bdd_t*, bddFunctionArray, bddFunction);
+  }
+  /* Free stuff */
+  mdd_array_free(mddLiteralArray);
+  array_free(bddArray);
+  return bddFunctionArray;
+}
+
+
+array_t *
+mdd_pick_arbitrary_minterms(
+  mdd_manager	*mddMgr,
+  mdd_t		*aMdd,
+  array_t	*mddIdArr,
+  int		n)
+{
+    bdd_t	*onvalBdd, *aOnvalBdd, *onsetBdd, *tmpBdd;
+    array_t	*bddVarArr;
+    int		i, arrSize, mddId;
+    array_t	*mintermArray;
+
+    arrSize = array_n( mddIdArr );
+    onvalBdd = bdd_one( mddMgr );
+
+    for ( i = 0 ; i < arrSize ; i++ ) {
+	mddId = array_fetch( int, mddIdArr, i );
+	aOnvalBdd = mddRetOnvalBdd( mddMgr, mddId );
+
+	tmpBdd = bdd_and( onvalBdd, aOnvalBdd, 1, 1 );
+	bdd_free( onvalBdd );
+	bdd_free( aOnvalBdd );
+	onvalBdd = tmpBdd;
+    }
+    onsetBdd = bdd_and( onvalBdd, aMdd, 1, 1 );
+    bdd_free( onvalBdd );
+
+    bddVarArr = mdd_id_array_to_bdd_array(mddMgr, mddIdArr);
+    mintermArray = bdd_bdd_pick_arbitrary_minterms(onsetBdd, bddVarArr,
+	array_n(bddVarArr), n);
+    bdd_free(onsetBdd);
+    mddFreeBddArr(bddVarArr);
+    return(mintermArray);
+}
+
+
+mdd_t *
+mdd_subset_with_mask_vars(
+  mdd_manager	*mddMgr,
+  mdd_t		*aMdd,
+  array_t	*mddIdArr,
+  array_t	*maskIdArr)
+{
+    bdd_t	*onvalBdd, *aOnvalBdd, *onsetBdd, *tmpBdd;
+    array_t	*bddVarArr, *maskVarArr;
+    int		i, arrSize, mddId;
+    mdd_t	*subset;
+
+    arrSize = array_n( mddIdArr );
+    onvalBdd = bdd_one( mddMgr );
+
+    for ( i = 0 ; i < arrSize ; i++ ) {
+	mddId = array_fetch( int, mddIdArr, i );
+	aOnvalBdd = mddRetOnvalBdd( mddMgr, mddId );
+
+	tmpBdd = bdd_and( onvalBdd, aOnvalBdd, 1, 1 );
+	bdd_free( onvalBdd );
+	bdd_free( aOnvalBdd );
+	onvalBdd = tmpBdd;
+    }
+    onsetBdd = bdd_and( onvalBdd, aMdd, 1, 1 );
+    bdd_free( onvalBdd );
+
+    bddVarArr = mdd_id_array_to_bdd_array(mddMgr, mddIdArr);
+    maskVarArr = mdd_id_array_to_bdd_array(mddMgr, maskIdArr);
+
+    subset = bdd_subset_with_mask_vars(onsetBdd, bddVarArr, maskVarArr);
+    bdd_free(onsetBdd);
+    mddFreeBddArr(bddVarArr);
+    mddFreeBddArr(maskVarArr);
+    return(subset);
+}
+
+
+/* Internal macro to access the mvar_type structure for each MDD variable. */
+mvar_type
+mdd_get_var_by_id(mdd_manager *mddMgr, int id)
+{
+    return(mddGetVarById(mddMgr, id));
+}
+
+
+/* checks whether all support variables of mdd appear in supportIdArray. */
+int
+mdd_check_support(
+  mdd_manager	*mddMgr,
+  mdd_t		*mdd,
+  array_t	*supportIdArray)
+{
+  int		i, mddId;
+  st_table	*supportTable = st_init_table(st_numcmp, st_numhash);
+  array_t	*tmpIdArray;
+  int		allSupportFlag = 1;
+
+  for (i = 0; i < array_n(supportIdArray); i++) {
+    mddId = array_fetch(int, supportIdArray, i);
+    st_insert(supportTable, (char *)(long)mddId, NULL);
+  }
+
+  tmpIdArray = mdd_get_support(mddMgr, mdd);
+  for (i = 0; i < array_n(tmpIdArray); i++) {
+    mddId = array_fetch(int, tmpIdArray, i);
+    if (!st_lookup(supportTable, (char *)(long)mddId, NULL)) {
+      allSupportFlag = 0;
+      break;
+    }
+  }
+
+  st_free_table(supportTable);
+  array_free(tmpIdArray);
+  return(allSupportFlag);
+}
+
+
+boolean
+mdd_equal_mod_care_set_array(mdd_t *aSet, mdd_t *bSet, array_t *careSetArray)
+{
+  mdd_t	*tmpMdd1, *tmpMdd2;
+  mdd_t	*careSet;
+  int i;
+  boolean result;
+
+  if (mdd_equal(aSet, bSet))
+    return 1;
+
+  arrayForEachItem(mdd_t *, careSetArray, i, careSet) {
+    tmpMdd1 = mdd_and(aSet, careSet, 1, 1);
+    tmpMdd2 = mdd_and(bSet, careSet, 1, 1);
+
+    result = mdd_equal(tmpMdd1, tmpMdd2);
+    mdd_free(tmpMdd1);
+    mdd_free(tmpMdd2);
+    if (result == 1)
+      return 1;
+  }
+
+  return 0;
+}
+
+
+boolean
+mdd_lequal_mod_care_set_array(mdd_t *aSet, mdd_t *bSet,
+			      boolean aPhase, boolean bPhase,
+			      array_t *careSetArray)
+{
+  mdd_t	*tmpMdd, *careSet;
+  int	i, result;
+
+  if (mdd_lequal(aSet, bSet, aPhase, bPhase))
+    return 1;
+
+  arrayForEachItem(mdd_t *, careSetArray, i, careSet) {
+    tmpMdd = mdd_and(aSet, careSet, aPhase, 1);
+
+    result = mdd_lequal(tmpMdd, bSet, 1, bPhase);
+    mdd_free(tmpMdd);
+    if (result == 1)
+      return 1;
+  }
+
+  return 0;
+}
+
+
+/* Return the mdd that represents all valid assignments to the
+   variables in the support.  Support is an array of mdd_ids. */
+mdd_t *
+mdd_range_mdd(
+  mdd_manager *mgr,
+  array_t *support
+  )
+{
+  int var, varIndex;      /* iterates over support */
+  mdd_t *range;
+
+  range = mdd_one(mgr);
+  arrayForEachItem(int, support, varIndex, var){
+    mdd_t *rangeForVar;
+    mdd_t *tmp;
+
+    rangeForVar = mddRetOnvalBdd(mgr, var);
+    tmp = mdd_and( rangeForVar, range, 1, 1);
+    mdd_free(rangeForVar);
+    mdd_free(range);
+    range = tmp;
+  }
+  
+  return range;
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
Index: /vis_dev/glu-2.1/src/mdd/mvar2bdds.c
===================================================================
--- /vis_dev/glu-2.1/src/mdd/mvar2bdds.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/mvar2bdds.c	(revision 6)
@@ -0,0 +1,42 @@
+#include "mdd.h"
+
+/*
+ * MDD Package
+ *
+ * $Id: mvar2bdds.c,v 1.10 2002/08/27 03:16:56 fabio Exp $
+ * 
+ * Author: Timothy Kam
+ *
+ * Copyright 1992 by the Regents of the University of California.
+ *
+ * All rights reserved.  Permission to use, copy, modify and distribute
+ * this software is hereby granted, provided that the above copyright
+ * notice and this permission notice appear in all copies.  This software
+ * is made available as is, with no warranties.
+ */
+
+array_t *
+mvar2bdds(mdd_manager *mgr, array_t *mvars)
+{
+    array_t *bdd_vars;
+    int i, j, mv_no;
+    mvar_type mv;
+    bdd_t *temp;
+    array_t *mvar_list = mdd_ret_mvar_list(mgr);
+
+    bdd_vars = array_alloc(bdd_t *, 0);	
+    for (i=0; i<array_n(mvars); i++) {
+        mv_no = array_fetch(int, mvars, i);
+	mv = array_fetch(mvar_type, mvar_list, mv_no);
+        for (j = 0; j < mv.encode_length; j ++) {
+	    temp = bdd_get_variable(mgr, mdd_ret_bvar_id(&mv,j) );
+	    array_insert_last(bdd_t *, bdd_vars, temp);
+	}
+    }
+    return (bdd_vars);
+}
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mdd/semantic.cache
===================================================================
--- /vis_dev/glu-2.1/src/mdd/semantic.cache	(revision 6)
+++ /vis_dev/glu-2.1/src/mdd/semantic.cache	(revision 6)
@@ -0,0 +1,20 @@
+;; Object mdd/
+;; SEMANTICDB Tags save file
+(semanticdb-project-database-file "mdd/"
+  :tables (list 
+   (semanticdb-table "mdd_util.c"
+    :major-mode 'c-mode
+    :tags '(("stdio.h" include (:system-flag t) nil [1 19]) ("math.h" include (:system-flag t) nil [20 37]) ("util.h" include nil nil [38 55]) ("mdd.h" include nil nil [56 72]) ("mddRetOnvalBdd" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [549 569]) ("mddId" variable (:type "int") (reparse-symbol arg-sub-list) [570 580])) :type ("bdd_t" type (:type "class") nil nil)) nil [520 581]) ("mddIntRetOnvalBdd" function (:prototype-flag t :pointer 1 :typemodifiers ("static") :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [614 634]) ("valNum" variable (:type "int") (reparse-symbol arg-sub-list) [635 646]) ("low" variable (:type "int") (reparse-symbol arg-sub-list) [647 655]) ("hi" variable (:type "int") (reparse-symbol arg-sub-list) [656 663]) ("level" variable (:type "int") (reparse-symbol arg-sub-list) [664 674]) ("bddVarArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [675 694])) :type ("bdd_t" type (:type "class") nil nil)) nil [582 695]) ("mddFreeBddArr" function (:prototype-flag t :typemodifiers ("static") :arguments (("bddArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [722 738])) :type "void") nil [696 739]) ("mddGetVarById" variable (:constant-flag t :default-value (nil)) nil [817 910]) ("toggle" function (:arguments (("x" variable (:type "int") (reparse-symbol arg-sub-list) [924 930])) :type "int") nil [913 1073]) ("no_bit_encode" function (:arguments (("n" variable (:type "int") (reparse-symbol arg-sub-list) [1093 1099])) :type "int") nil [1075 1253]) ("print_mvar_list" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1276 1293])) :type "void") nil [1255 1711]) ("print_strides" function (:arguments (("mvar_strides" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1732 1754])) :type "void") nil [1713 1967]) ("print_bdd_list_id" function (:arguments (("bdd_list" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [1992 2010])) :type "void") nil [1969 2362]) ("print_bvar_list_id" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2388 2405])) :type "void") nil [2364 2821]) ("print_bdd" function (:arguments (("mgr" variable (:pointer 1 :type ("bdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2838 2855]) ("top" variable (:pointer 1 :type ("bdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [2856 2867])) :type "void") nil [2823 3623]) ("find_mvar_id" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3651 3668]) ("id" variable (:type "unsigned short") (reparse-symbol arg-sub-list) [3669 3687])) :type ("mvar_type" type (:type "class") nil nil)) nil [3627 4164]) ("clear_all_marks" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4187 4204])) :type "void") nil [4166 4445]) ("mdd_mark" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4464 4481]) ("top" variable (:pointer 1 :type ("bdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [4484 4549]) ("phase" variable (:type "int") (reparse-symbol arg-sub-list) [4552 4562])) :type "void") nil [4447 4997]) ("mdd_unmark" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5015 5032]) ("top" variable (:pointer 1 :type ("bdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5033 5044])) :type "void") nil [4999 5455]) ("find_mvar" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5478 5495]) ("name" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [5496 5507])) :type ("mvar_type" type (:type "class") nil nil)) nil [5457 5805]) ("mdd_ret_mvar_list" function (:pointer 1 :arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5835 5852])) :type ("array_t" type (:type "class") nil nil)) nil [5807 6038]) ("mdd_set_mvar_list" function (:arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6063 6080]) ("mvar_list" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6081 6100])) :type "void") nil [6040 6239]) ("mdd_ret_bvar_list" function (:pointer 1 :arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6270 6287])) :type ("array_t" type (:type "class") nil nil)) nil [6242 6473]) ("mdd_ret_bvar_id" function (:arguments (("mvar_ptr" variable (:pointer 1 :type ("mvar_type" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6496 6516]) ("i" variable (:type "int") (reparse-symbol arg-sub-list) [6517 6523])) :type "int") nil [6476 6579]) ("mdd_ret_bvar" function (:arguments (("mvar_ptr" variable (:pointer 1 :type ("mvar_type" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6604 6624]) ("i" variable (:type "int") (reparse-symbol arg-sub-list) [6625 6631]) ("bvar_list" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6632 6651])) :type ("bvar_type" type (:type "class") nil nil)) nil [6581 6774]) ("mdd_count_onset" function (:arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7159 7179]) ("aMdd" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7182 7195]) ("mddIdArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7198 7216])) :type "double") nil [7133 7924]) ("mdd_onset_bdd" function (:pointer 1 :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7974 7994]) ("aMdd" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [7997 8010]) ("mddIdArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8013 8031])) :type ("mdd_t" type (:type "class") nil nil)) nil [7949 8533]) ("mdd_epd_count_onset" function (:arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8583 8603]) ("aMdd" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8606 8619]) ("mddIdArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8622 8640]) ("epd" variable (:pointer 1 :type ("EpDouble" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8643 8657])) :type "int") nil [8556 9392]) ("mddRetOnvalBdd" function (:pointer 1 :typemodifiers ("static") :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9528 9548]) ("mddId" variable (:type "int") (reparse-symbol arg-sub-list) [9551 9562])) :type ("bdd_t" type (:type "class") nil nil)) nil [9496 10106]) ("mddIntRetOnvalBdd" function (:pointer 1 :typemodifiers ("static") :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [10241 10261]) ("valNum" variable (:type "int") (reparse-symbol arg-sub-list) [10264 10275]) ("low" variable (:type "int") (reparse-symbol arg-sub-list) [10278 10286]) ("hi" variable (:type "int") (reparse-symbol arg-sub-list) [10289 10296]) ("level" variable (:type "int") (reparse-symbol arg-sub-list) [10299 10309]) ("bddVarArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [10312 10331])) :type ("bdd_t" type (:type "class") nil nil)) nil [10206 10970]) ("mddFreeBddArr" function (:typemodifiers ("static") :arguments (("bddArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11153 11169])) :type "void") nil [11127 11332]) ("mdd_ret_bvars_of_mvar" function (:pointer 1 :arguments (("mvar_ptr" variable (:pointer 1 :type ("mvar_type" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11388 11408])) :type ("array_t" type (:type "class") nil nil)) nil [11355 11437]) ("mdd_get_care_set" function (:pointer 1 :typemodifiers ("static") :arguments (("mdd_mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [11610 11631])) :type ("mdd_t" type (:type "class") nil nil)) nil [11579 13062]) ("mdd_cproject" function (:pointer 1 :arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13153 13170]) ("T" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13173 13182]) ("mvars" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [13185 13200])) :type ("mdd_t" type (:type "class") nil nil)) nil [13130 14629]) ("mdd_print_support" function (:arguments (("f" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14654 14663])) :type "void") nil [14631 15346]) ("mdd_print_support_to_file" function (:arguments (("fout" variable (:pointer 1 :type ("FILE" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [15379 15390]) ("format" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [15391 15404]) ("f" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [15405 15414])) :type "void") nil [15348 16090]) ("mdd_read_var_name" function (:pointer 1 :arguments (("f" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [16117 16126])) :type "char") nil [16092 16936]) ("mdd_read_mdd_id" function (:arguments (("f" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [16958 16967])) :type "int") nil [16938 17329]) ("mdd_id_to_bdd_id_array" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [17728 17752]) ("mddId" variable (:type "int") (reparse-symbol arg-sub-list) [17753 17763])) :type ("array_t" type (:type "class") nil nil)) nil [17695 18166]) ("mdd_id_to_bdd_array" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [18562 18586]) ("mddId" variable (:type "int") (reparse-symbol arg-sub-list) [18587 18597])) :type ("array_t" type (:type "class") nil nil)) nil [18532 18946]) ("mdd_id_array_to_bdd_array" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [19268 19292]) ("mddIdArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [19293 19313])) :type ("array_t" type (:type "class") nil nil)) nil [19232 19770]) ("mdd_id_array_to_bdd_id_array" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20275 20299]) ("mddIdArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20300 20320])) :type ("array_t" type (:type "class") nil nil)) nil [20236 20686]) ("mdd_id_array_to_bdd_cube" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20982 21006]) ("mddIdArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [21007 21027])) :type ("mdd_t" type (:type "class") nil nil)) nil [20949 21893]) ("mdd_get_number_of_bdd_vars" function (:arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22249 22273]) ("mddIdArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22274 22294])) :type "int") nil [22218 22592]) ("mdd_get_number_of_bdd_support" function (:arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22929 22953]) ("f" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [22954 22963])) :type "int") nil [22895 23259]) ("mdd_fn_array_to_bdd_rel_array" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [25589 25613]) ("mddId" variable (:type "int") (reparse-symbol arg-sub-list) [25616 25626]) ("mddFnArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [25629 25649])) :type ("array_t" type (:type "class") nil nil)) nil [25546 28912]) ("mdd_fn_array_to_bdd_fn_array" function (:pointer 1 :arguments (("mddManager" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [31241 31265]) ("mddId" variable (:type "int") (reparse-symbol arg-sub-list) [31268 31278]) ("mddFnArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [31281 31301])) :type ("array_t" type (:type "class") nil nil)) nil [31199 34504]) ("mdd_pick_arbitrary_minterms" function (:pointer 1 :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [34548 34568]) ("aMdd" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [34571 34584]) ("mddIdArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [34587 34605]) ("n" variable (:type "int") (reparse-symbol arg-sub-list) [34608 34615])) :type ("array_t" type (:type "class") nil nil)) nil [34507 35385]) ("mdd_subset_with_mask_vars" function (:pointer 1 :arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [35425 35445]) ("aMdd" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [35448 35461]) ("mddIdArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [35464 35482]) ("maskIdArr" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [35485 35504])) :type ("mdd_t" type (:type "class") nil nil)) nil [35388 36344]) ("mdd_get_var_by_id" function (:arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [36453 36473]) ("id" variable (:type "int") (reparse-symbol arg-sub-list) [36474 36481])) :type ("mvar_type" type (:type "class") nil nil)) nil [36425 36524]) ("mdd_check_support" function (:arguments (("mddMgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [36628 36648]) ("mdd" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [36651 36663]) ("supportIdArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [36666 36690])) :type "int") nil [36603 37319]) ("mdd_equal_mod_care_set_array" function (:arguments (("aSet" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37359 37371]) ("bSet" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37372 37384]) ("careSetArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37385 37407])) :type ("boolean" type (:type "class") nil nil)) nil [37322 37816]) ("mdd_lequal_mod_care_set_array" function (:arguments (("aSet" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37857 37869]) ("bSet" variable (:pointer 1 :type ("mdd_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37870 37882]) ("aPhase" variable (:type ("boolean" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37892 37907]) ("bPhase" variable (:type ("boolean" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37908 37923]) ("careSetArray" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [37933 37955])) :type ("boolean" type (:type "class") nil nil)) nil [37819 38296]) ("mdd_range_mdd" function (:pointer 1 :arguments (("mgr" variable (:pointer 1 :type ("mdd_manager" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [38452 38469]) ("support" variable (:pointer 1 :type ("array_t" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [38472 38492])) :type ("mdd_t" type (:type "class") nil nil)) nil [38427 38859]))
+    :file "mdd_util.c"
+    :pointmax 39103
+    )
+   (semanticdb-table "mdd.h"
+    :major-mode 'c-mode
+    :tags 'nil
+    :file "mdd.h"
+    )
+   )
+  :file "semantic.cache"
+  :semantic-tag-version "2.0beta3"
+  :semanticdb-version "2.0beta3"
+  )
Index: /vis_dev/glu-2.1/src/mem/mem.3
===================================================================
--- /vis_dev/glu-2.1/src/mem/mem.3	(revision 6)
+++ /vis_dev/glu-2.1/src/mem/mem.3	(revision 6)
@@ -0,0 +1,174 @@
+.\" Storage management library man page
+.TH MEM 3 "16 November 1993"
+.SH NAME
+mem \- a memory management package
+.SH SYNOPSIS
+.B #include <memuser.h>
+.SH DESCRIPTION
+The
+.B libmem
+library provides a set of routines for allocating storage.  Programs
+designed to be used with the library should use the
+.B -lmem
+options to
+.B cc
+when linking.
+.SH "LIST OF FUNCTIONS"
+.nf
+.ta 3in
+\fIName\fP	\fIFunction\fP
+mem_get_block	Allocate a block of memory
+mem_free_block	Free a block of memory
+mem_resize_block	Resize a block of memory
+mem_copy	Copy a block of memory
+mem_zero	Initialize a block of memory to all zeros
+mem_allocation	Get total memory allocation
+mem_new_rec_mgr	Create a record manager
+mem_free_rec_mgr	Destroy a record manager
+mem_new_rec	Get a record from a record manager
+mem_free_rec	Return a record to a record manager
+.fi
+.SH "OVERVIEW"
+The library includes routines for handling blocks of memory and for
+dealing with fixed size records.  The block manipulation routines use
+a binary buddy scheme, so fragmentation generally is not a problem.
+The record manager routines are designed for handling many small,
+fixed size records.  There is essentially no storage overhead when
+using these routines, and allocation and deallocation are particularly
+fast.
+.SH "DETAILED DESCRIPTION"
+.B pointer
+.br
+.B mem_get_block(size)
+.br
+.B long size;
+.in +4
+Allocate a block of storage
+.B size
+bytes long.  The type
+.B pointer
+is defined to be either a character pointer or a void pointer,
+depending on whether the C compiler is ANSI-standard.
+.LP
+.B void
+.br
+.B mem_free_block(p)
+.br
+.B pointer p;
+.in +4
+Free the block of storage pointed to by \fBp\fR.
+.LP
+.B pointer
+.br
+.B mem_resize_block(p, size)
+.br
+.B pointer p;
+.br
+.B long size;
+.in +4
+Try to resize the block of memory pointed to by
+.B p
+to be
+.B size
+bytes long.  If this is not possible, a new block is allocated and the
+contents of the old block are copied.  A pointer to the expanded block
+is returned.
+.LP
+.B void
+.br
+.B mem_copy(p, q, size)
+.br
+.B pointer p;
+.br
+.B pointer q;
+.br
+.B long size;
+.in +4
+Copy
+.B size
+bytes from the location given by
+.B q
+to the location give by \fBp\fR.
+.LP
+.LP
+.B void
+.br
+.B mem_zero(p, size)
+.br
+.B pointer p;
+.br
+.B long size;
+.in +4
+Fill
+.B size
+bytes at the location given by
+.B p
+with zero.
+.LP
+.B long
+.br
+.B mem_allocation()
+.in +4
+Returns the total memory allocation in bytes.
+.LP
+.B rec_mgr
+.br
+.B mem_new_rec_mgr(size)
+.br
+.B int size;
+.in +4
+Returns a new record manager for handling record of
+.B size
+bytes.  The size is limited to approximately 4K, but is really
+intended to be smaller.
+.LP
+.B void
+.br
+.B mem_free_rec_mgr(m)
+.br
+.B rec_mgr m;
+.in +4
+Free the record manager given by
+.B m
+and all of its associated storage.
+.LP
+.B pointer
+.br
+.B mem_new_rec(m)
+.br
+.B rec_mgr m;
+.in +4
+Return a pointer to a new record.
+.LP
+.B void
+.br
+.B mem_free_rec(m, p)
+.br
+.B rec_mgr m;
+.br
+.B pointer p;
+.in +4
+Return the record pointed to by
+.B p
+to the record manager \fBm\fR.
+.SH "PORTABILITY NOTES"
+The library is fairly UNIX specific; it calls
+.B sbrk
+directly.  If you don't have something similar, you may have to
+rewrite parts of it.  The storage management routines need to be able
+to move and clear blocks of memory whose size is given by a long.  You
+may have to fiddle with these, especially if you have a machine where
+int and long are different.  If you encounter portability problems,
+let me know; maybe the next release will be able to accommodate your
+machine.  For non-UNIX people, or if you are using malloc elsewhere
+and it is unhappy about other routines calling sbrk, you can try
+defining the symbol USE_MALLOC_FREE in memint.h.  It turns calls to
+the memory management library routines into calls to malloc, free, and
+cousins.  This has not been tested extensively.
+.SH BUGS
+It's a feature.
+.SH AUTHOR
+David E. Long
+.br
+long@research.att.com
+
Index: /vis_dev/glu-2.1/src/mem/mem.make
===================================================================
--- /vis_dev/glu-2.1/src/mem/mem.make	(revision 6)
+++ /vis_dev/glu-2.1/src/mem/mem.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += memblock.c memrec.c
+HEADERS += memint.h memuser.h
+MISC += mem.3
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/mem/memblock.c
===================================================================
--- /vis_dev/glu-2.1/src/mem/memblock.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mem/memblock.c	(revision 6)
@@ -0,0 +1,487 @@
+/* Memory block management routines */
+
+
+#include "memint.h"
+
+
+#if STDC_HEADERS
+#  include <stdlib.h>
+#else
+#  if defined(__STDC__)
+extern void exit(int);
+#  else
+extern void exit();
+#  endif
+#endif
+
+
+/* Amount of memory allocated */
+
+static SIZE_T block_allocation;
+
+
+/* mem_copy(dest, src, size) copies a block of memory. */
+
+void
+#if defined(__STDC__)
+mem_copy(pointer dest, pointer src, SIZE_T size)
+#else
+mem_copy(dest, src, size)
+     pointer dest;
+     pointer src;
+     SIZE_T size;
+#endif
+{
+  MEM_COPY(dest, src, size);
+}
+
+
+/* mem_zero(ptr, size) zeros a block of memory. */
+
+void
+#if defined(__STDC__)
+mem_zero(pointer ptr, SIZE_T size)
+#else
+mem_zero(ptr, size)
+     pointer ptr;
+     SIZE_T size;
+#endif
+{
+  MEM_ZERO(ptr, size);
+}
+
+
+/* mem_fatal(message) prints an error message and exits. */
+
+void
+#if defined(__STDC__)
+mem_fatal(char *message)
+#else
+mem_fatal(message)
+     char *message;
+#endif
+{
+  fprintf(stderr, "Memory management library: error: %s\n", message);
+  exit(1);
+}
+
+
+SIZE_T
+#if defined(__STDC__)
+mem_allocation(void)
+#else
+mem_allocation()
+#endif
+{
+  /* This will always returns zero when we're using malloc and free, */
+  /* but you can maybe change it depending on your system. */
+  return (block_allocation);
+}
+
+
+/* This code used if we're going to do our own memory management. */
+
+#if !defined(USE_MALLOC_FREE)
+/* Free lists of various sizes */
+
+static block avail[MAX_SIZE_INDEX+1];
+
+
+/* Bogus segment for initialization */
+
+static struct segment_ dummy_seg={(pointer)0, (SIZE_T)0};
+
+
+/* Current segment */
+
+static segment curr_seg= &dummy_seg;
+
+
+static
+int
+#if defined(__STDC__)
+ceiling_log_2(SIZE_T i)
+#else
+ceiling_log_2(i)
+     SIZE_T i;
+#endif
+{
+  SIZE_T j;
+  int result;
+
+  for (result=0, j=1; j < i; ++result, j*=2);
+  return (result);
+}
+
+
+/* block_size_index(size) return the coded size for a block. */
+
+static
+int
+#if defined(__STDC__)
+block_size_index(SIZE_T size)
+#else
+block_size_index(size)
+     SIZE_T size;
+#endif
+{
+  if (size < 1)
+    return (-1);
+  if (size > MAX_SIZE)
+    mem_fatal("block_size_index: block size too large");
+  else
+    size+=HEADER_SIZE;
+  return (ceiling_log_2(size));
+}
+
+
+/* add_to_free_list(b) adds b to the appropriate free list. */
+
+static
+void
+#if defined(__STDC__)
+add_to_free_list(block b)
+#else
+add_to_free_list(b)
+     block b;
+#endif
+{
+  int i;
+
+  i=b->size_index;
+  if (!avail[i])
+    {
+      b->next=b;
+      b->prev=b;
+      avail[i]=b;
+    }
+  else
+    {
+      b->next=avail[i]->next;
+      avail[i]->next->prev=b;
+      avail[i]->next=b;
+      b->prev=avail[i];
+    }
+  b->used=0;
+}
+
+
+/* remove_from_free_list(b) removes b from the free list which it */
+/* is on. */
+
+static
+block
+#if defined(__STDC__)
+remove_from_free_list(block b)
+#else
+remove_from_free_list(b)
+     block b;
+#endif
+{
+  int i;
+
+  i=b->size_index;
+  if (b->next == b)
+    avail[i]=0;
+  else
+    {
+      b->next->prev=b->prev;
+      b->prev->next=b->next;
+      if (avail[i] == b)
+	avail[i]=b->next;
+    }
+  b->used=1;
+  return (b);
+}
+
+
+/* buddy(b) returns the buddy block of b, or null if there is no */
+/* buddy. */
+
+static
+block
+#if defined(__STDC__)
+buddy(block b)
+#else
+buddy(b)
+     block b;
+#endif
+{
+  SIZE_T buddy_offset;
+
+  buddy_offset=(SIZE_T)(((INT_PTR)b-(INT_PTR)b->seg->base_address) ^ ((SIZE_T)1 << b->size_index));
+  if (buddy_offset < b->seg->limit)
+    return ((block)((INT_PTR)b->seg->base_address+buddy_offset));
+  else
+    return ((block)0);
+}
+
+
+/* trim_to_size(b, size_index) repeatedly splits b until it has */
+/* the indicated size.  Blocks which are split off are added to the */
+/* appropriate free list. */
+
+static
+void
+#if defined(__STDC__)
+trim_to_size(block b, int size_index)
+#else
+trim_to_size(b, size_index)
+     block b;
+     int size_index;
+#endif
+{
+  block bb;
+
+  while (b->size_index > size_index)
+    {
+      b->size_index--;
+      bb=buddy(b);
+      bb->size_index=b->size_index;
+      bb->seg=b->seg;
+      add_to_free_list(bb);
+    }
+}
+
+
+/* merge_and_free(b) repeatedly merges b its buddy until b has no */
+/* buddy or the buddy isn't free, then adds the result to the */
+/* appropriate free list. */
+
+static
+void
+#if defined(__STDC__)
+merge_and_free(block b)
+#else
+merge_and_free(b)
+     block b;
+#endif
+{
+  block bb;
+
+  for (bb=buddy(b); bb && !bb->used && bb->size_index == b->size_index; bb=buddy(b))
+    {
+      remove_from_free_list(bb);
+      if ((INT_PTR)bb < (INT_PTR)b)
+	b=bb;
+      b->size_index++;
+    }
+  add_to_free_list(b);
+}
+
+
+/* mem_get_block(size) allocates a new block of the specified size. */
+
+pointer
+#if defined(__STDC__)
+mem_get_block(SIZE_T size)
+#else
+mem_get_block(size)
+     SIZE_T size;
+#endif
+{
+  int i;
+  int size_index;
+  int alloc_size_index;
+  int new_seg;
+  SIZE_T alloc_size;
+  pointer sbrk_ret;
+  block b;
+
+  if ((size_index=block_size_index(size)) < 0)
+    return ((pointer)0);
+  /* Find smallest free block which is large enough. */
+  for (i=size_index; i <= MAX_SIZE_INDEX && !avail[i]; ++i);
+  if (i > MAX_SIZE_INDEX)
+    {
+      /* We must get more storage; don't allocate less than */
+      /* 2^MIN_ALLOC_SIZE_INDEX. */
+      if (size_index < MIN_ALLOC_SIZE_INDEX)
+	alloc_size_index=MIN_ALLOC_SIZE_INDEX;
+      else
+	alloc_size_index=size_index;
+      alloc_size=((SIZE_T)1 << alloc_size_index);
+      /* Pad current segment to be a multiple of 2^alloc_size_index in */
+      /* length. */
+      alloc_size+=((curr_seg->limit+alloc_size-1) & ~(alloc_size-1))-curr_seg->limit;
+      if ((sbrk_ret=(pointer)SBRK(0)) != (pointer)((INT_PTR)curr_seg->base_address+curr_seg->limit) ||
+	  alloc_size+curr_seg->limit > MAX_SEG_SIZE)
+	{
+	  /* Segment is too large or someone else has moved the break. */
+	  /* Pad to get to appropriate boundary. */
+	  alloc_size=ROUNDUP((INT_PTR)sbrk_ret)-(INT_PTR)sbrk_ret;
+	  /* Pad allocation request with storage for new segment */
+	  /* information and indicate that a new segment must be */
+	  /* created. */
+	  alloc_size+=((SIZE_T)1 << alloc_size_index)+ROUNDUP(sizeof(struct segment_));
+	  new_seg=1;
+	}
+      else
+	new_seg=0;
+      sbrk_ret=(pointer)SBRK(alloc_size);
+      if (sbrk_ret == (pointer)-1)
+	mem_fatal("mem_get_block: allocation failed");
+      block_allocation+=alloc_size;
+      if (new_seg)
+	{
+	  curr_seg=(segment)ROUNDUP((INT_PTR)sbrk_ret);
+	  curr_seg->base_address=(pointer)((INT_PTR)curr_seg+ROUNDUP(sizeof(struct segment_)));
+	  curr_seg->limit=0;
+	  /* Readjust allocation size. */
+	  alloc_size=(1l << alloc_size_index);
+	}
+      /* Carve allocated space up into blocks and add to free lists. */
+      while (alloc_size)
+	{
+	  size=alloc_size-(alloc_size & (alloc_size-1));
+	  b=(block)((INT_PTR)curr_seg->base_address+curr_seg->limit);
+	  b->size_index=ceiling_log_2(size);
+	  b->seg=curr_seg;
+	  add_to_free_list(b);
+	  curr_seg->limit+=size;
+	  alloc_size-=size;
+	}
+      /* Find free block of appropriate size. */
+      for (i=size_index; i <= MAX_SIZE_INDEX && !avail[i]; ++i);
+    }
+  b=remove_from_free_list(avail[i]);
+  trim_to_size(b, size_index);
+  return ((pointer)((INT_PTR)b+HEADER_SIZE));
+}
+
+
+/* mem_free_block(p) frees the block indicated by p. */
+
+void
+#if defined(__STDC__)
+mem_free_block(pointer p)
+#else
+mem_free_block(p)
+     pointer p;
+#endif
+{
+  block b;
+
+  if (!p)
+    return;
+  b=(block)((INT_PTR)p-HEADER_SIZE);
+  if (!b->used)
+    mem_fatal("mem_free_block: block not in use");
+  if (b->size_index < 0 || b->size_index > MAX_SIZE_INDEX)
+    mem_fatal("mem_free_block: invalid block header");
+  merge_and_free(b);
+}
+
+
+/* mem_resize_block(p, new_size) expands or contracts the block */
+/* indicated by p to a new size.  We try to avoid moving the block if */
+/* possible. */
+
+pointer
+#if defined(__STDC__)
+mem_resize_block(pointer p, SIZE_T new_size)
+#else
+mem_resize_block(p, new_size)
+     pointer p;
+     SIZE_T new_size;
+#endif
+{
+  int new_size_index;
+  block b;
+  block bb;
+  pointer q;
+  SIZE_T old_size;
+
+  if (!p)
+    return (mem_get_block(new_size));
+  b=(block)((INT_PTR)p-HEADER_SIZE);
+  if (!b->used)
+    mem_fatal("mem_resize_block: block not in use");
+  if (b->size_index < 0 || b->size_index > MAX_SIZE_INDEX)
+    mem_fatal("mem_resize_block: invalid block header");
+  if ((new_size_index=block_size_index(new_size)) < 0)
+    {
+      mem_free_block(p);
+      return ((pointer)0);
+    }
+  if (b->size_index >= new_size_index)
+    {
+      /* Shrink block. */
+      trim_to_size(b, new_size_index);
+      return (p);
+    }
+  old_size=(1l << b->size_index)-HEADER_SIZE;
+  /* Try to expand by adding buddies at higher addresses. */
+  for (bb=buddy(b);
+       bb && (INT_PTR)b < (INT_PTR)bb && !bb->used && bb->size_index == b->size_index;
+       bb=buddy(b))
+    {
+      remove_from_free_list(bb);
+      if (++(b->size_index) == new_size_index)
+	return (p);
+    }
+  /* Couldn't expand all the way to needed size; allocate a new block */
+  /* and move the contents of the old one. */
+  q=mem_get_block(new_size);
+  mem_copy(q, p, old_size);
+  merge_and_free(b);
+  return (q);
+}
+#endif
+
+
+/* This code used if we're using malloc and free. */
+
+#if defined(USE_MALLOC_FREE)
+pointer
+#if defined(__STDC__)
+mem_get_block(SIZE_T size)
+#else
+mem_get_block(size)
+     SIZE_T size;
+#endif
+{
+  pointer result;
+
+  if (size <= 0)
+    return ((pointer)0);
+  result=MALLOC(size);
+  if (!result)
+    mem_fatal("mem_get_block: allocation failed");
+  return (result);
+}
+
+
+void
+#if defined(__STDC__)
+mem_free_block(pointer p)
+#else
+mem_free_block(p)
+     pointer p;
+#endif
+{
+  if (!p)
+    return;
+  FREE(p);
+}
+
+
+pointer
+#if defined(__STDC__)
+mem_resize_block(pointer p, SIZE_T new_size)
+#else
+mem_resize_block(p, new_size)
+     pointer p;
+     SIZE_T new_size;
+#endif
+{
+  if (!p)
+    return (mem_get_block(new_size));
+  if (new_size <= 0)
+    {
+      mem_free_block(p);
+      return ((pointer)0);
+    }
+  return (REALLOC(p, new_size));
+}
+#endif
Index: /vis_dev/glu-2.1/src/mem/memint.h
===================================================================
--- /vis_dev/glu-2.1/src/mem/memint.h	(revision 6)
+++ /vis_dev/glu-2.1/src/mem/memint.h	(revision 6)
@@ -0,0 +1,126 @@
+/* Memory management internal definitions */
+
+
+#if !defined(_MEMINTH)
+#define _MEMINTH
+
+
+/* All user-visible stuff */
+
+#include "memuser.h"
+
+
+/* >>> Potentially system dependent configuration stuff */
+/* See memuser.h as well. */
+
+/* The storage management library can either use system-provided */
+/* versions of malloc, free and friends, or it can implement a buddy */
+/* scheme based on something like sbrk.  If you want to do the former, */
+/* define USE_MALLOC_FREE. */
+
+/* #define USE_MALLOC_FREE */
+
+/* Now we need macros for routines to copy and zero-fill blocks of */
+/* memory, and to either do malloc/free/whatever or to do an sbrk.  Since */
+/* different systems have different types that these routines expect, we */
+/* wrap everything in macros. */
+
+#if defined(USE_MALLOC_FREE)
+#if defined(__STDC__)
+extern void *malloc(unsigned long);
+extern void free(void *);
+extern void *realloc(void *, unsigned long);
+#define MALLOC(size) ((pointer)malloc((unsigned long)(size)))
+#define FREE(p) (free((void *)(p)))
+#define REALLOC(p, size) ((pointer)realloc((void *)(p), (unsigned long)(size)))
+#else
+extern char *malloc();
+extern void free();
+extern char *realloc();
+#define MALLOC(size) ((pointer)malloc((int)(size)))
+#define FREE(p) (free((char *)(p)))
+#define REALLOC(p, size) ((pointer)realloc((char *)(p), (int)(size)))
+#endif
+#else
+#if defined(__STDC__)
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#else
+extern char *sbrk(int);
+#endif
+#define SBRK(size) ((pointer)sbrk((int)(size)))
+#else
+extern char *sbrk();
+#define SBRK(size) ((pointer)sbrk((int)(size)))
+#endif
+#endif
+
+/* You may need to muck with these depending on whether you have */
+/* bcopy or memcpy. */
+
+#if defined(__STDC__)
+#if STDC_HEADERS
+#include <string.h>
+#else
+extern void *memcpy(); /* TRS, 6/17/94: removed arg types to suppress warning on mips/gcc */
+/* extern void *memcpy(void *, const void *, unsigned long); */
+
+extern void *memset(); /* SPK 3/01/01: removed arg types to suppress
+			  warning on linux-rh-6.2/egcs-2.91/66 */
+/* extern void *memset(void *, int, unsigned long); */
+#endif
+#define MEM_COPY(dest, src, size) (void)memcpy((void *)(dest), (const void *)(src), (unsigned long)(size))
+#define MEM_ZERO(ptr, size) (void)memset((void *)(ptr), 0, (unsigned long)(size))
+#else
+extern void bcopy();
+extern void bzero();
+#define MEM_COPY(dest, src, size) bcopy((char *)(src), (char *)(dest), (int)(size))
+#define MEM_ZERO(ptr, size) bzero((char *)(ptr), (int)(size))
+#endif
+
+
+#if defined(__STDC__)
+#define ARGS(args) args
+#else
+#define ARGS(args) ()
+#endif
+
+
+/* >>> System independent stuff here. */
+
+struct segment_
+{
+  pointer base_address;
+  SIZE_T limit;
+};
+
+typedef struct segment_ *segment;
+
+
+struct block_
+{
+  int used;
+  int size_index;
+  struct block_ *next;
+  struct block_ *prev;
+  segment seg;
+};
+
+typedef struct block_ *block;
+
+
+#define HEADER_SIZE ((SIZE_T)ROUNDUP(sizeof(struct block_)))
+#define MAX_SIZE_INDEX (8*sizeof(SIZE_T)-2)
+#define MAX_SEG_SIZE ((SIZE_T)1 << MAX_SIZE_INDEX)
+#define MAX_SIZE ((SIZE_T)(MAX_SEG_SIZE-HEADER_SIZE))
+#define MIN_ALLOC_SIZE_INDEX 15
+
+#define NICE_BLOCK_SIZE ((SIZE_T)4096-ROUNDUP(sizeof(struct block_)))
+
+
+extern void mem_fatal ARGS((char *));
+
+
+#undef ARGS
+
+#endif
Index: /vis_dev/glu-2.1/src/mem/memrec.c
===================================================================
--- /vis_dev/glu-2.1/src/mem/memrec.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mem/memrec.c	(revision 6)
@@ -0,0 +1,156 @@
+/* Record manager routines */
+
+
+#include "memint.h"
+
+
+#define ALLOC_SIZE NICE_BLOCK_SIZE
+
+
+/* #define DEBUG_MEM */
+#define MAGIC_COOKIE 0x34f21ab3l
+#define MAGIC_COOKIE1 0x432fa13bl
+
+
+struct list_
+{
+  struct list_ *next;
+};
+
+typedef struct list_ *list;
+
+
+struct rec_mgr_
+{
+  int size;
+  int recs_per_block;
+  list free;
+  list blocks;
+};
+
+
+/* mem_new_rec(mgr) allocates a record from the specified record */
+/* manager. */
+
+pointer
+#if defined(__STDC__)
+mem_new_rec(rec_mgr mgr)
+#else
+mem_new_rec(mgr)
+     rec_mgr mgr;
+#endif
+{
+  int i;
+  pointer p;
+  list new_;
+
+  if (!mgr->free)
+    {
+      /* Allocate a new block. */
+      new_=(list)mem_get_block(ALLOC_SIZE);
+      new_->next=mgr->blocks;
+      mgr->blocks=new_;
+      mgr->free=(list)((INT_PTR)new_+ROUNDUP(sizeof(struct list_)));
+      p=(pointer)(mgr->free);
+      /* Carve the block into pieces. */
+      for (i=1; i < mgr->recs_per_block; ++i)
+	{
+	  ((list)p)->next=(list)((INT_PTR)p+mgr->size);
+#if defined(DEBUG_MEM)
+	  if (mgr->size >= sizeof(long)+sizeof(struct list_))
+	    *(long *)(sizeof(struct list_)+(INT_PTR)p)=MAGIC_COOKIE;
+#endif
+	  p=(pointer)((INT_PTR)p+mgr->size);
+	}
+      ((list)p)->next=0;
+#if defined(DEBUG_MEM)
+      if (mgr->size >= sizeof(long)+sizeof(struct list_))
+	*(long *)(sizeof(struct list_)+(INT_PTR)p)=MAGIC_COOKIE;
+#endif
+    }
+  new_=mgr->free;
+#if defined(DEBUG_MEM)
+  if (mgr->size >= sizeof(long)+sizeof(struct list_))
+    if (*(long *)(sizeof(struct list_)+(INT_PTR)new_) != MAGIC_COOKIE)
+      fprintf(stderr, "record at 0x%lx may be in use\n", (INT_PTR)new_);
+    else
+      *(long *)(sizeof(struct list_)+(INT_PTR)new_)=MAGIC_COOKIE1;
+#endif
+  mgr->free=mgr->free->next;
+  return ((pointer)new_);
+}
+
+
+/* mem_free_rec(mgr, rec) frees a record managed by the indicated */
+/* record manager. */
+
+void
+#if defined(__STDC__)
+mem_free_rec(rec_mgr mgr, pointer rec)
+#else
+mem_free_rec(mgr, rec)
+     rec_mgr mgr;
+     pointer rec;
+#endif
+{
+#if defined(DEBUG_MEM)
+  if (mgr->size >= sizeof(long)+sizeof(struct list_))
+    if (*(long *)(sizeof(struct list_)+(INT_PTR)rec) == MAGIC_COOKIE)
+      fprintf(stderr, "record at 0x%lx may already be freed\n", (INT_PTR)rec);
+#endif
+  ((list)rec)->next=mgr->free;
+#if defined(DEBUG_MEM)
+  if (mgr->size >= sizeof(long)+sizeof(struct list_))
+    *(long *)(sizeof(struct list_)+(INT_PTR)rec)=MAGIC_COOKIE;
+#endif
+  mgr->free=(list)rec;
+}
+
+
+/* mem_new_rec_mgr(size) creates a new record manager with the given */
+/* record size. */
+
+rec_mgr
+#if defined(__STDC__)
+mem_new_rec_mgr(int size)
+#else
+mem_new_rec_mgr(size)
+     int size;
+#endif
+{
+  rec_mgr mgr;
+
+  if (size < sizeof(struct list_))
+    size=sizeof(struct list_);
+  size=ROUNDUP(size);
+  if (size > ALLOC_SIZE-ROUNDUP(sizeof(struct list_)))
+    mem_fatal("mem_new_rec_mgr: record size too large");
+  mgr=(rec_mgr)mem_get_block((SIZE_T)sizeof(struct rec_mgr_));
+  mgr->size=size;
+  mgr->recs_per_block=(ALLOC_SIZE-ROUNDUP(sizeof(struct list_)))/size;
+  mgr->free=0;
+  mgr->blocks=0;
+  return (mgr);
+}
+
+
+/* mem_free_rec_mgr(mgr) frees all the storage associated with the */
+/* specified record manager. */
+
+void
+#if defined(__STDC__)
+mem_free_rec_mgr(rec_mgr mgr)
+#else
+mem_free_rec_mgr(mgr)
+     rec_mgr mgr;
+#endif
+{
+  list p, q;
+
+  for (p=mgr->blocks; p; p=q)
+    {
+      q=p->next;
+      mem_free_block((pointer)p);
+    }
+  mem_free_block((pointer)mgr);
+}
Index: /vis_dev/glu-2.1/src/mem/memuser.h
===================================================================
--- /vis_dev/glu-2.1/src/mem/memuser.h	(revision 6)
+++ /vis_dev/glu-2.1/src/mem/memuser.h	(revision 6)
@@ -0,0 +1,89 @@
+/*
+ * $Id: memuser.h,v 1.3 2002/08/27 15:47:48 fabio Exp $
+ *
+ */
+
+/* Memory management user-visible definitions */
+
+
+#if !defined(_MEMUSERH)
+#define _MEMUSERH
+
+#ifndef ARGS
+#  ifdef __STDC__
+#    define ARGS(args)	args
+#  else
+#    define ARGS(args)  ()
+#  endif
+#endif
+
+#ifdef __cplusplus
+#  define EXTERN	extern "C"
+#else
+#  define EXTERN	extern
+#endif
+
+#include <stdio.h>
+
+
+
+/* >>> Potentially machine dependent stuff */
+/* See memint.h as well. */
+
+typedef unsigned long INT_PTR;	/* Integral type that can hold a pointer */
+typedef unsigned long SIZE_T;	/* Integral type that can hold the maximum */
+				/* size of an object */
+
+/* REQUIRED_ALIGNMENT is the alignment required by the machine hardware; */
+/* it is provided for user use. */
+
+#define REQUIRED_ALIGNMENT 4
+
+
+/* Types */
+
+#if defined(__STDC__)
+typedef void *pointer;
+#else
+typedef char *pointer;
+#endif
+
+
+typedef struct rec_mgr_ *rec_mgr;
+
+
+/* ALLOC_ALIGNMENT is the alignment for all storage returned by the */
+/* storage allocation routines. */
+
+#define ALLOC_ALIGNMENT 8
+
+
+/* Round a size up for alignment */
+
+#define ROUNDUP(size) ((((size)+ALLOC_ALIGNMENT-1)/ALLOC_ALIGNMENT)*ALLOC_ALIGNMENT)
+#define ALIGN(size) ((((size)+REQUIRED_ALIGNMENT-1)/REQUIRED_ALIGNMENT)*REQUIRED_ALIGNMENT)
+
+
+/* Block storage management routines */
+
+EXTERN pointer mem_get_block ARGS((SIZE_T));
+EXTERN void mem_free_block ARGS((pointer));
+EXTERN pointer mem_resize_block ARGS((pointer, SIZE_T));
+EXTERN void mem_copy ARGS((pointer, pointer, SIZE_T));
+EXTERN void mem_zero ARGS((pointer, SIZE_T));
+EXTERN void mem_fatal ARGS((char *));
+EXTERN SIZE_T mem_allocation ARGS((void));
+
+
+/* Record manager routines */
+
+EXTERN pointer mem_new_rec ARGS((rec_mgr));
+EXTERN void mem_free_rec ARGS((rec_mgr, pointer));
+EXTERN rec_mgr mem_new_rec_mgr ARGS((int));
+EXTERN void mem_free_rec_mgr ARGS((rec_mgr));
+
+
+#undef ARGS
+#undef EXTERN
+
+#endif
Index: /vis_dev/glu-2.1/src/mtr/mtr.h
===================================================================
--- /vis_dev/glu-2.1/src/mtr/mtr.h	(revision 6)
+++ /vis_dev/glu-2.1/src/mtr/mtr.h	(revision 6)
@@ -0,0 +1,191 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [mtr.h]
+
+  PackageName [mtr]
+
+  Synopsis    [Multiway-branch tree manipulation]
+
+  Description [This package provides two layers of functions. Functions
+  of the lower level manipulate multiway-branch trees, implemented
+  according to the classical scheme whereby each node points to its
+  first child and its previous and next siblings. These functions are
+  collected in mtrBasic.c.<p>
+  Functions of the upper layer deal with group trees, that is the trees
+  used by group sifting to represent the grouping of variables. These
+  functions are collected in mtrGroup.c.]
+
+  SeeAlso     [The CUDD package documentation; specifically on group
+  sifting.]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+  Revision    [$Id: mtr.h,v 1.13 2004/08/13 18:15:11 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef __MTR
+#define __MTR
+
+/*---------------------------------------------------------------------------*/
+/* Nested includes                                                           */
+/*---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef SIZEOF_VOID_P
+#define SIZEOF_VOID_P 4
+#endif
+#ifndef SIZEOF_INT
+#define SIZEOF_INT 4
+#endif
+
+#undef CONST
+#if defined(__STDC__) || defined(__cplusplus)
+#define CONST           const
+#else /* !(__STDC__ || __cplusplus) */
+#define CONST
+#endif /* !(__STDC__ || __cplusplus) */
+
+#if defined(__GNUC__)
+#define MTR_INLINE __inline__
+# if (__GNUC__ >2 || __GNUC_MINOR__ >=7)
+#   define MTR_UNUSED __attribute__ ((unused))
+# else
+#   define MTR_UNUSED
+# endif
+#else
+#define MTR_INLINE
+#define MTR_UNUSED
+#endif
+ 
+/* Flag definitions */
+#define MTR_DEFAULT	0x00000000
+#define MTR_TERMINAL 	0x00000001
+#define MTR_SOFT	0x00000002
+#define MTR_FIXED	0x00000004
+#define MTR_NEWNODE	0x00000008
+
+/* MTR_MAXHIGH is defined in such a way that on 32-bit and 64-bit
+** machines one can cast a value to (int) without generating a negative
+** number.
+*/
+#if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
+#define MTR_MAXHIGH	(((MtrHalfWord) ~0) >> 1)
+#else
+#define MTR_MAXHIGH	((MtrHalfWord) ~0)
+#endif
+
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+#if SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
+typedef unsigned int   MtrHalfWord;
+#else
+typedef unsigned short MtrHalfWord;
+#endif
+
+typedef struct MtrNode {
+    MtrHalfWord flags;
+    MtrHalfWord low;
+    MtrHalfWord size;
+    MtrHalfWord index;
+    struct MtrNode *parent;
+    struct MtrNode *child;
+    struct MtrNode *elder;
+    struct MtrNode *younger;
+} MtrNode;
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/* Flag manipulation macros */
+#define MTR_SET(node, flag)		(node->flags |= (flag))
+#define MTR_RESET(node, flag)	(node->flags &= ~ (flag))
+#define MTR_TEST(node, flag)	(node->flags & (flag))
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+extern MtrNode * Mtr_AllocNode (void);
+extern void Mtr_DeallocNode (MtrNode *node);
+extern MtrNode * Mtr_InitTree (void);
+extern void Mtr_FreeTree (MtrNode *node);
+extern MtrNode * Mtr_CopyTree (MtrNode *node, int expansion);
+extern void Mtr_MakeFirstChild (MtrNode *parent, MtrNode *child);
+extern void Mtr_MakeLastChild (MtrNode *parent, MtrNode *child);
+extern MtrNode * Mtr_CreateFirstChild (MtrNode *parent);
+extern MtrNode * Mtr_CreateLastChild (MtrNode *parent);
+extern void Mtr_MakeNextSibling (MtrNode *first, MtrNode *second);
+extern void Mtr_PrintTree (MtrNode *node);
+extern MtrNode * Mtr_InitGroupTree (int lower, int size);
+extern MtrNode * Mtr_MakeGroup (MtrNode *root, unsigned int low, unsigned int high, unsigned int flags);
+extern MtrNode * Mtr_DissolveGroup (MtrNode *group);
+extern MtrNode * Mtr_FindGroup (MtrNode *root, unsigned int low, unsigned int high);
+extern int Mtr_SwapGroups (MtrNode *first, MtrNode *second);
+extern void Mtr_PrintGroups (MtrNode *root, int silent);
+extern MtrNode * Mtr_ReadGroups (FILE *fp, int nleaves);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MTR */
Index: /vis_dev/glu-2.1/src/mtr/mtr.make
===================================================================
--- /vis_dev/glu-2.1/src/mtr/mtr.make	(revision 6)
+++ /vis_dev/glu-2.1/src/mtr/mtr.make	(revision 6)
@@ -0,0 +1,4 @@
+CSRC += mtrBasic.c mtrGroup.c
+HEADERS += mtr.h mtrInt.h
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/mtr/mtrBasic.c
===================================================================
--- /vis_dev/glu-2.1/src/mtr/mtrBasic.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mtr/mtrBasic.c	(revision 6)
@@ -0,0 +1,451 @@
+/**CFile***********************************************************************
+
+  FileName    [mtrBasic.c]
+
+  PackageName [mtr]
+
+  Synopsis    [Basic manipulation of multiway branching trees.]
+
+  Description [External procedures included in this module:
+	    <ul>
+	    <li> Mtr_AllocNode()
+	    <li> Mtr_DeallocNode()
+	    <li> Mtr_InitTree()
+	    <li> Mtr_FreeTree()
+	    <li> Mtr_CopyTree()
+	    <li> Mtr_MakeFirstChild()
+	    <li> Mtr_MakeLastChild()
+	    <li> Mtr_CreateFirstChild()
+	    <li> Mtr_CreateLastChild()
+	    <li> Mtr_MakeNextSibling()
+	    <li> Mtr_PrintTree()
+	    </ul>
+	    ]
+
+  SeeAlso     [cudd package]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "mtrInt.h"
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] MTR_UNUSED = "$Id: mtrBasic.c,v 1.12 2004/08/13 18:15:11 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Allocates new tree node.]
+
+  Description [Allocates new tree node. Returns pointer to node.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_DeallocNode]
+
+******************************************************************************/
+MtrNode *
+Mtr_AllocNode(void)
+{
+    MtrNode *node;
+
+    node = ALLOC(MtrNode,1);
+    return node;
+
+} /* Mtr_AllocNode */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Deallocates tree node.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_AllocNode]
+
+******************************************************************************/
+void
+Mtr_DeallocNode(
+  MtrNode * node /* node to be deallocated */)
+{
+    FREE(node);
+    return;
+
+} /* end of Mtr_DeallocNode */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes tree with one node.]
+
+  Description [Initializes tree with one node. Returns pointer to node.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_FreeTree Mtr_InitGroupTree]
+
+******************************************************************************/
+MtrNode *
+Mtr_InitTree(void)
+{
+    MtrNode *node;
+
+    node = Mtr_AllocNode();
+    if (node == NULL) return(NULL);
+
+    node->parent = node->child = node->elder = node->younger = NULL;
+    node->flags = 0;
+
+    return(node);
+
+} /* end of Mtr_InitTree */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Disposes of tree rooted at node.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_InitTree]
+
+******************************************************************************/
+void
+Mtr_FreeTree(
+  MtrNode * node)
+{
+    if (node == NULL) return;
+    if (! MTR_TEST(node,MTR_TERMINAL)) Mtr_FreeTree(node->child);
+    Mtr_FreeTree(node->younger);
+    Mtr_DeallocNode(node);
+    return;
+
+} /* end of Mtr_FreeTree */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes a copy of tree.]
+
+  Description [Makes a copy of tree. If parameter expansion is greater
+  than 1, it will expand the tree by that factor. It is an error for
+  expansion to be less than 1. Returns a pointer to the copy if
+  successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_InitTree]
+
+******************************************************************************/
+MtrNode *
+Mtr_CopyTree(
+  MtrNode * node,
+  int  expansion)
+{
+    MtrNode *copy;
+
+    if (node == NULL) return(NULL);
+    if (expansion < 1) return(NULL);
+    copy = Mtr_AllocNode();
+    if (copy == NULL) return(NULL);
+    copy->parent = copy->elder = copy->child = copy->younger = NULL;
+    if (node->child != NULL) {
+	copy->child = Mtr_CopyTree(node->child, expansion);
+	if (copy->child == NULL) {
+	    Mtr_DeallocNode(copy);
+	    return(NULL);
+	}
+    }
+    if (node->younger != NULL) {
+	copy->younger = Mtr_CopyTree(node->younger, expansion);
+	if (copy->younger == NULL) {
+	    Mtr_FreeTree(copy);
+	    return(NULL);
+	}
+    }
+    copy->flags = node->flags;
+    copy->low = node->low * expansion;
+    copy->size = node->size * expansion;
+    copy->index = node->index * expansion;
+    if (copy->younger) copy->younger->elder = copy;
+    if (copy->child) {
+	MtrNode *auxnode = copy->child;
+	while (auxnode != NULL) {
+	    auxnode->parent = copy;
+	    auxnode = auxnode->younger;
+	}
+    }
+    return(copy);
+    
+} /* end of Mtr_CopyTree */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes child the first child of parent.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_MakeLastChild Mtr_CreateFirstChild]
+
+******************************************************************************/
+void
+Mtr_MakeFirstChild(
+  MtrNode * parent,
+  MtrNode * child)
+{
+    child->parent = parent;
+    child->younger = parent->child;
+    child->elder = NULL;
+    if (parent->child != NULL) {
+#ifdef MTR_DEBUG
+	assert(parent->child->elder == NULL);
+#endif
+	parent->child->elder = child;
+    }
+    parent->child = child;
+    return;
+
+} /* end of Mtr_MakeFirstChild */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes child the last child of parent.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_MakeFirstChild Mtr_CreateLastChild]
+
+******************************************************************************/
+void
+Mtr_MakeLastChild(
+  MtrNode * parent,
+  MtrNode * child)
+{
+    MtrNode *node;
+
+    child->younger = NULL;
+
+    if (parent->child == NULL) {
+	parent->child = child;
+	child->elder = NULL;
+    } else {
+	for (node = parent->child;
+	     node->younger != NULL;
+	     node = node->younger);
+	node->younger = child;
+	child->elder = node;
+    }
+    child->parent = parent;
+    return;
+
+} /* end of Mtr_MakeLastChild */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a new node and makes it the first child of parent.]
+
+  Description [Creates a new node and makes it the first child of
+  parent. Returns pointer to new child.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_MakeFirstChild Mtr_CreateLastChild]
+
+******************************************************************************/
+MtrNode *
+Mtr_CreateFirstChild(
+  MtrNode * parent)
+{
+    MtrNode *child;
+
+    child = Mtr_AllocNode();
+    if (child == NULL) return(NULL);
+
+    child->child = child->younger = child-> elder = NULL;
+    child->flags = 0;
+    Mtr_MakeFirstChild(parent,child);
+    return(child);
+
+} /* end of Mtr_CreateFirstChild */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Creates a new node and makes it the last child of parent.]
+
+  Description [Creates a new node and makes it the last child of parent.
+  Returns pointer to new child.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_MakeLastChild Mtr_CreateFirstChild]
+
+******************************************************************************/
+MtrNode *
+Mtr_CreateLastChild(
+  MtrNode * parent)
+{
+    MtrNode *child;
+
+    child = Mtr_AllocNode();
+    if (child == NULL) return(NULL);
+
+    child->child = child->younger = child->elder = NULL;
+    child->flags = 0;
+    Mtr_MakeLastChild(parent,child);
+    return(child);
+
+} /* end of Mtr_CreateLastChild */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes second the next sibling of first.]
+
+  Description [Makes second the next sibling of first. Second becomes a
+  child of the parent of first.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+void
+Mtr_MakeNextSibling(
+  MtrNode * first,
+  MtrNode * second)
+{
+    second->younger = first->younger;
+    if (first->younger != NULL) {
+	first->younger->elder = second;
+    }
+    second->parent = first->parent;
+    first->younger = second;
+    second->elder = first;
+    return;
+
+} /* end of Mtr_MakeNextSibling */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints a tree, one node per line.]
+
+  Description []
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_PrintGroups]
+
+******************************************************************************/
+void
+Mtr_PrintTree(
+  MtrNode * node)
+{
+    if (node == NULL) return;
+    (void) fprintf(stdout,
+#if SIZEOF_VOID_P == 8
+    "N=0x%-8lx C=0x%-8lx Y=0x%-8lx E=0x%-8lx P=0x%-8lx F=%x L=%d S=%d\n",
+    (unsigned long) node, (unsigned long) node->child,
+    (unsigned long) node->younger, (unsigned long) node->elder,
+    (unsigned long) node->parent, node->flags, node->low, node->size);
+#else
+    "N=0x%-8x C=0x%-8x Y=0x%-8x E=0x%-8x P=0x%-8x F=%x L=%d S=%d\n",
+    (unsigned) node, (unsigned) node->child,
+    (unsigned) node->younger, (unsigned) node->elder,
+    (unsigned) node->parent, node->flags, node->low, node->size);
+#endif
+    if (!MTR_TEST(node,MTR_TERMINAL)) Mtr_PrintTree(node->child);
+    Mtr_PrintTree(node->younger);
+    return;
+
+} /* end of Mtr_PrintTree */
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
Index: /vis_dev/glu-2.1/src/mtr/mtrGroup.c
===================================================================
--- /vis_dev/glu-2.1/src/mtr/mtrGroup.c	(revision 6)
+++ /vis_dev/glu-2.1/src/mtr/mtrGroup.c	(revision 6)
@@ -0,0 +1,716 @@
+/**CFile***********************************************************************
+
+  FileName    [mtrGroup.c]
+
+  PackageName [mtr]
+
+  Synopsis    [Functions to support group specification for reordering.]
+
+  Description [External procedures included in this module:
+	    <ul>
+	    <li> Mtr_InitGroupTree()
+	    <li> Mtr_MakeGroup()
+	    <li> Mtr_DissolveGroup()
+	    <li> Mtr_FindGroup()
+	    <li> Mtr_SwapGroups()
+	    <li> Mtr_PrintGroups()
+	    <li> Mtr_ReadGroups()
+	    </ul>
+	Static procedures included in this module:
+	    <ul>
+	    <li> mtrShiftHL
+	    </ul>
+	    ]
+
+  SeeAlso     [cudd package]
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+******************************************************************************/
+
+#include "util.h"
+#include "mtrInt.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] MTR_UNUSED = "$Id: mtrGroup.c,v 1.16 2004/08/13 18:15:11 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int mtrShiftHL (MtrNode *node, int shift);
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Allocate new tree.]
+
+  Description [Allocate new tree with one node, whose low and size
+  fields are specified by the lower and size parameters.
+  Returns pointer to tree root.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_InitTree Mtr_FreeTree]
+
+******************************************************************************/
+MtrNode *
+Mtr_InitGroupTree(
+  int  lower,
+  int  size)
+{
+    MtrNode *root;
+
+    root = Mtr_InitTree();
+    if (root == NULL) return(NULL);
+    root->flags = MTR_DEFAULT;
+    root->low = lower;
+    root->size = size;
+    return(root);
+
+} /* end of Mtr_InitGroupTree */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Makes a new group with size leaves starting at low.]
+
+  Description [Makes a new group with size leaves starting at low.
+  If the new group intersects an existing group, it must
+  either contain it or be contained by it.  This procedure relies on
+  the low and size fields of each node. It also assumes that the
+  children of each node are sorted in order of increasing low.  In
+  case of a valid request, the flags of the new group are set to the
+  value passed in `flags.' This can also be used to change the flags
+  of an existing group.  Returns the pointer to the root of the new
+  group upon successful termination; NULL otherwise. If the group
+  already exists, the pointer to its root is returned.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_DissolveGroup Mtr_ReadGroups Mtr_FindGroup]
+
+******************************************************************************/
+MtrNode *
+Mtr_MakeGroup(
+  MtrNode * root /* root of the group tree */,
+  unsigned int  low /* lower bound of the group */,
+  unsigned int  size /* upper bound of the group */,
+  unsigned int  flags /* flags for the new group */)
+{
+    MtrNode *node,
+	    *first,
+	    *last,
+	    *previous,
+	    *newn;
+
+    /* Sanity check. */
+    if (size == 0)
+	return(NULL);
+
+    /* Check whether current group includes new group.  This check is
+    ** necessary at the top-level call.  In the subsequent calls it is
+    ** redundant. */
+    if (low < (unsigned int) root->low ||
+	low + size > (unsigned int) (root->low + root->size))
+	return(NULL);
+
+    /* Trying to create an existing group has the effect of updating
+    ** the flags. */
+    if (root->size == size && root->low == low) {
+	root->flags = flags;
+	return(root);
+    }
+
+    /* At this point we know that the new group is properly contained
+    ** in the group of root. We have two possible cases here: - root
+    ** is a terminal node; - root has children. */
+
+    /* Root has no children: create a new group. */
+    if (root->child == NULL) {
+	newn = Mtr_AllocNode();
+	if (newn == NULL) return(NULL);	/* out of memory */
+	newn->low = low;
+	newn->size = size;
+	newn->flags = flags;
+	newn->parent = root;
+	newn->elder = newn->younger = newn->child = NULL;
+	root->child = newn;
+	return(newn);
+    }
+
+    /* Root has children: Find all chidren of root that are included
+    ** in the new group. If the group of any child entirely contains
+    ** the new group, call Mtr_MakeGroup recursively. */
+    previous = NULL;
+    first = root->child; /* guaranteed to be non-NULL */
+    while (first != NULL && low >= (unsigned int) (first->low + first->size)) {
+	previous = first;
+	first = first->younger;
+    }
+    if (first == NULL) {
+	/* We have scanned the entire list and we need to append a new
+	** child at the end of it.  Previous points to the last child
+	** of root. */
+	newn = Mtr_AllocNode();
+	if (newn == NULL) return(NULL);	/* out of memory */
+	newn->low = low;
+	newn->size = size;
+	newn->flags = flags;
+	newn->parent = root;
+	newn->elder = previous;
+	previous->younger = newn;
+	newn->younger = newn->child = NULL;
+	return(newn);
+    }
+    /* Here first is non-NULL and low < first->low + first->size. */
+    if (low >= (unsigned int) first->low &&
+	low + size <= (unsigned int) (first->low + first->size)) {
+	/* The new group is contained in the group of first. */
+	newn = Mtr_MakeGroup(first, low, size, flags);
+	return(newn);
+    } else if (low + size <= first->low) {
+	/* The new group is entirely contained in the gap between
+	** previous and first. */
+	newn = Mtr_AllocNode();
+	if (newn == NULL) return(NULL);	/* out of memory */
+	newn->low = low;
+	newn->size = size;
+	newn->flags = flags;
+	newn->child = NULL;
+	newn->parent = root;
+	newn->elder = previous;
+	newn->younger = first;
+	first->elder = newn;
+	if (previous != NULL) {
+	    previous->younger = newn;
+	} else {
+	    root->child = newn;
+	}
+	return(newn);
+    } else if (low < (unsigned int) first->low &&
+	       low + size < (unsigned int) (first->low + first->size)) {
+	/* Trying to cut an existing group: not allowed. */
+	return(NULL);
+    } else if (low > first->low) {
+	/* The new group neither is contained in the group of first
+	** (this was tested above) nor contains it. It is therefore
+	** trying to cut an existing group: not allowed. */
+	return(NULL);
+    }
+
+    /* First holds the pointer to the first child contained in the new
+    ** group. Here low <= first->low and low + size >= first->low +
+    ** first->size.  One of the two inequalities is strict. */
+    last = first->younger;
+    while (last != NULL &&
+	   (unsigned int) (last->low + last->size) < low + size) {
+	last = last->younger;
+    }
+    if (last == NULL) {
+	/* All the chilren of root from first onward become children
+	** of the new group. */
+	newn = Mtr_AllocNode();
+	if (newn == NULL) return(NULL);	/* out of memory */
+	newn->low = low;
+	newn->size = size;
+	newn->flags = flags;
+	newn->child = first;
+	newn->parent = root;
+	newn->elder = previous;
+	newn->younger = NULL;
+	first->elder = NULL;
+	if (previous != NULL) {
+	    previous->younger = newn;
+	} else {
+	    root->child = newn;
+	}
+	last = first;
+	while (last != NULL) {
+	    last->parent = newn;
+	    last = last->younger;
+	}
+	return(newn);
+    }
+
+    /* Here last != NULL and low + size <= last->low + last->size. */
+    if (low + size - 1 >= (unsigned int) last->low &&
+	low + size < (unsigned int) (last->low + last->size)) {
+	/* Trying to cut an existing group: not allowed. */
+	return(NULL);
+    }
+
+    /* First and last point to the first and last of the children of
+    ** root that are included in the new group. Allocate a new node
+    ** and make all children of root between first and last chidren of
+    ** the new node.  Previous points to the child of root immediately
+    ** preceeding first. If it is NULL, then first is the first child
+    ** of root. */
+    newn = Mtr_AllocNode();
+    if (newn == NULL) return(NULL);	/* out of memory */
+    newn->low = low;
+    newn->size = size;
+    newn->flags = flags;
+    newn->child = first;
+    newn->parent = root;
+    if (previous == NULL) {
+	root->child = newn;
+    } else {
+	previous->younger = newn;
+    }
+    newn->elder = previous;
+    newn->younger = last->younger;
+    if (last->younger != NULL) {
+	last->younger->elder = newn;
+    }
+    last->younger = NULL;
+    first->elder = NULL;
+    for (node = first; node != NULL; node = node->younger) {
+	node->parent = newn;
+    }
+
+    return(newn);
+
+} /* end of Mtr_MakeGroup */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Merges the children of `group' with the children of its
+  parent.]
+
+  Description [Merges the children of `group' with the children of its
+  parent. Disposes of the node pointed by group. If group is the
+  root of the group tree, this procedure leaves the tree unchanged.
+  Returns the pointer to the parent of `group' upon successful
+  termination; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_MakeGroup]
+
+******************************************************************************/
+MtrNode *
+Mtr_DissolveGroup(
+  MtrNode * group /* group to be dissolved */)
+{
+    MtrNode *parent;
+    MtrNode *last;
+
+    parent = group->parent;
+
+    if (parent == NULL) return(NULL);
+    if (MTR_TEST(group,MTR_TERMINAL) || group->child == NULL) return(NULL);
+
+    /* Make all children of group children of its parent, and make
+    ** last point to the last child of group. */
+    for (last = group->child; last->younger != NULL; last = last->younger) {
+	last->parent = parent;
+    }
+    last->parent = parent;
+
+    last->younger = group->younger;
+    if (group->younger != NULL) {
+	group->younger->elder = last;
+    }
+
+    group->child->elder = group->elder;
+    if (group == parent->child) {
+	parent->child = group->child;
+    } else {
+	group->elder->younger = group->child;
+    }
+
+    Mtr_DeallocNode(group);
+    return(parent);
+
+} /* end of Mtr_DissolveGroup */
+
+
+/**Function********************************************************************
+
+  Synopsis [Finds a group with size leaves starting at low, if it exists.]
+
+  Description [Finds a group with size leaves starting at low, if it
+  exists.  This procedure relies on the low and size fields of each
+  node. It also assumes that the children of each node are sorted in
+  order of increasing low.  Returns the pointer to the root of the
+  group upon successful termination; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+MtrNode *
+Mtr_FindGroup(
+  MtrNode * root /* root of the group tree */,
+  unsigned int  low /* lower bound of the group */,
+  unsigned int  size /* upper bound of the group */)
+{
+    MtrNode *node;
+
+#ifdef MTR_DEBUG
+    /* We cannot have a non-empty proper subgroup of a singleton set. */
+    assert(!MTR_TEST(root,MTR_TERMINAL));
+#endif
+
+    /* Sanity check. */
+    if (size < 1) return(NULL);
+
+    /* Check whether current group includes the group sought.  This
+    ** check is necessary at the top-level call.  In the subsequent
+    ** calls it is redundant. */
+    if (low < (unsigned int) root->low ||
+	low + size > (unsigned int) (root->low + root->size))
+	return(NULL);
+
+    if (root->size == size && root->low == low)
+	return(root);
+
+    if (root->child == NULL)
+	return(NULL);
+
+    /* Find all chidren of root that are included in the new group. If
+    ** the group of any child entirely contains the new group, call
+    ** Mtr_MakeGroup recursively.  */
+    node = root->child;
+    while (low >= (unsigned int) (node->low + node->size)) {
+	node = node->younger;
+    }
+    if (low + size <= (unsigned int) (node->low + node->size)) {
+	/* The group is contained in the group of node. */
+	node = Mtr_FindGroup(node, low, size);
+	return(node);
+    } else {
+	return(NULL);
+    }
+
+} /* end of Mtr_FindGroup */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Swaps two children of a tree node.]
+
+  Description [Swaps two children of a tree node. Adjusts the high and
+  low fields of the two nodes and their descendants.  The two children
+  must be adjacent. However, first may be the younger sibling of second.
+  Returns 1 in case of success; 0 otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+Mtr_SwapGroups(
+  MtrNode * first /* first node to be swapped */,
+  MtrNode * second /* second node to be swapped */)
+{
+    MtrNode *node;
+    MtrNode *parent;
+    int sizeFirst;
+    int sizeSecond;
+
+    if (second->younger == first) { /* make first first */
+	node = first;
+	first = second;
+	second = node;
+    } else if (first->younger != second) { /* non-adjacent */
+	return(0);
+    }
+
+    sizeFirst = first->size;
+    sizeSecond = second->size;
+
+    /* Swap the two nodes. */
+    parent = first->parent;
+    if (parent == NULL || second->parent != parent) return(0);
+    if (parent->child == first) {
+	parent->child = second;
+    } else { /* first->elder != NULL */
+	first->elder->younger = second;
+    }
+    if (second->younger != NULL) {
+	second->younger->elder = first;
+    }
+    first->younger = second->younger;
+    second->elder = first->elder;
+    first->elder = second;
+    second->younger = first;
+
+    /* Adjust the high and low fields. */
+    if (!mtrShiftHL(first,sizeSecond)) return(0);
+    if (!mtrShiftHL(second,-sizeFirst)) return(0);
+
+    return(1);
+
+} /* end of Mtr_SwapGroups */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Prints the groups as a parenthesized list.]
+
+  Description [Prints the groups as a parenthesized list. After each
+  group, the group's flag are printed, preceded by a `|'.  For each
+  flag (except MTR_TERMINAL) a character is printed.
+  <ul>
+  <li>F: MTR_FIXED
+  <li>N: MTR_NEWNODE
+  <li>S: MTR_SOFT
+  </ul>
+  The second argument, silent, if different from 0, causes
+  Mtr_PrintGroups to only check the syntax of the group tree.
+  ]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_PrintTree]
+
+******************************************************************************/
+void
+Mtr_PrintGroups(
+  MtrNode * root /* root of the group tree */,
+  int  silent /* flag to check tree syntax only */)
+{
+    MtrNode *node;
+
+    assert(root != NULL);
+    assert(root->younger == NULL || root->younger->elder == root);
+    assert(root->elder == NULL || root->elder->younger == root);
+    if (!silent) (void) printf("(%d",root->low);
+    if (MTR_TEST(root,MTR_TERMINAL) || root->child == NULL) {
+	if (!silent) (void) printf(",");
+    } else {
+	node = root->child;
+	while (node != NULL) {
+	    assert(node->low >= root->low && (int) (node->low + node->size) <= (int) (root->low + root->size));
+	    assert(node->parent == root);
+	    Mtr_PrintGroups(node,silent);
+	    node = node->younger;
+	}
+    }
+    if (!silent) {
+	(void) printf("%d", root->low + root->size - 1);
+	if (root->flags != MTR_DEFAULT) {
+	    (void) printf("|");
+	    if (MTR_TEST(root,MTR_FIXED)) (void) printf("F");
+	    if (MTR_TEST(root,MTR_NEWNODE)) (void) printf("N");
+	    if (MTR_TEST(root,MTR_SOFT)) (void) printf("S");
+	}
+	(void) printf(")");
+	if (root->parent == NULL) (void) printf("\n");
+    }
+    assert((root->flags &~(MTR_TERMINAL | MTR_SOFT | MTR_FIXED | MTR_NEWNODE)) == 0);
+    return;
+
+} /* end of Mtr_PrintGroups */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reads groups from a file and creates a group tree.]
+
+  Description [Reads groups from a file and creates a group tree.
+  Each group is specified by three fields:
+  <xmp>
+       low size flags.
+  </xmp>
+  Low and size are (short) integers. Flags is a string composed of the
+  following characters (with associated translation):
+  <ul>
+  <li>D: MTR_DEFAULT
+  <li>F: MTR_FIXED
+  <li>N: MTR_NEWNODE
+  <li>S: MTR_SOFT
+  <li>T: MTR_TERMINAL
+  </ul>
+  Normally, the only flags that are needed are D and F.  Groups and
+  fields are separated by white space (spaces, tabs, and newlines).
+  Returns a pointer to the group tree if successful; NULL otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [Mtr_InitGroupTree Mtr_MakeGroup]
+
+******************************************************************************/
+MtrNode *
+Mtr_ReadGroups(
+  FILE * fp /* file pointer */,
+  int  nleaves /* number of leaves of the new tree */)
+{
+    int low;
+    int size;
+    int err;
+    unsigned int flags;
+    MtrNode *root;
+    MtrNode *node;
+    char attrib[8*sizeof(unsigned int)+1];
+    char *c;
+
+    root = Mtr_InitGroupTree(0,nleaves);
+    if (root == NULL) return NULL;
+
+    while (! feof(fp)) {
+	/* Read a triple and check for consistency. */
+	err = fscanf(fp, "%d %d %s", &low, &size, attrib);
+	if (err == EOF) {
+	    break;
+	} else if (err != 3) {
+	    return(NULL);
+	} else if (low < 0 || low+size > nleaves || size < 1) {
+	    return(NULL);
+	} else if (strlen(attrib) > 8 * sizeof(MtrHalfWord)) {
+	    /* Not enough bits in the flags word to store these many
+	    ** attributes. */
+	    return(NULL);
+	}
+
+	/* Parse the flag string. Currently all flags are permitted,
+	** to make debugging easier. Normally, specifying NEWNODE
+	** wouldn't be allowed. */
+	flags = MTR_DEFAULT;
+	for (c=attrib; *c != 0; c++) {
+	    switch (*c) {
+	    case 'D':
+		break;
+	    case 'F':
+		flags |= MTR_FIXED;
+		break;
+	    case 'N':
+		flags |= MTR_NEWNODE;
+		break;
+	    case 'S':
+		flags |= MTR_SOFT;
+		break;
+	    case 'T':
+		flags |= MTR_TERMINAL;
+		break;
+	    default:
+		return NULL;
+	    }
+	}
+	node = Mtr_MakeGroup(root, (MtrHalfWord) low, (MtrHalfWord) size,
+			     flags);
+	if (node == NULL) return(NULL);
+    }
+
+    return(root);
+
+} /* end of Mtr_ReadGroups */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Adjusts the low fields of a node and its descendants.]
+
+  Description [Adjusts the low fields of a node and its
+  descendants. Adds shift to low of each node. Checks that no
+  out-of-bounds values result.  Returns 1 in case of success; 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+static int
+mtrShiftHL(
+  MtrNode * node /* group tree node */,
+  int  shift /* amount by which low should be changed */)
+{
+    MtrNode *auxnode;
+    int low;
+
+    low = (int) node->low;
+
+
+    low += shift;
+
+    if (low < 0 || low + (int) (node->size - 1) > (int) MTR_MAXHIGH) return(0);
+
+    node->low = (MtrHalfWord) low;
+
+    if (!MTR_TEST(node,MTR_TERMINAL) && node->child != NULL) {
+	auxnode = node->child;
+	do {
+	    if (!mtrShiftHL(auxnode,shift)) return(0);
+	    auxnode = auxnode->younger;
+	} while (auxnode != NULL);
+    }
+
+    return(1);
+
+} /* end of mtrShiftHL */
Index: /vis_dev/glu-2.1/src/mtr/mtrInt.h
===================================================================
--- /vis_dev/glu-2.1/src/mtr/mtrInt.h	(revision 6)
+++ /vis_dev/glu-2.1/src/mtr/mtrInt.h	(revision 6)
@@ -0,0 +1,92 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [mtrInt.h]
+
+  PackageName [mtr]
+
+  Synopsis    [Internal data structures of the mtr package]
+
+  Description [In this package all definitions are external.]
+
+  SeeAlso     []
+
+  Author      [Fabio Somenzi]
+
+  Copyright   [Copyright (c) 1995-2004, Regents of the University of Colorado
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of the University of Colorado nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.]
+
+  Revision    [$Id: mtrInt.h,v 1.2 2004/08/13 18:15:12 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _MTRINT
+#define _MTRINT
+
+#include "mtr.h"
+
+/*---------------------------------------------------------------------------*/
+/* Nested includes                                                           */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _MTRINT */
Index: /vis_dev/glu-2.1/src/sparse/cols.c
===================================================================
--- /vis_dev/glu-2.1/src/sparse/cols.c	(revision 6)
+++ /vis_dev/glu-2.1/src/sparse/cols.c	(revision 6)
@@ -0,0 +1,294 @@
+/*
+ * $Id: cols.c,v 1.3 2002/09/10 00:00:12 fabio Exp $
+ *
+ */
+#include <stdio.h>
+#include "sparse_int.h"
+
+
+/*
+ *  allocate a new col vector 
+ */
+sm_col *
+sm_col_alloc(void)
+{
+    register sm_col *pcol;
+
+#ifdef FAST_AND_LOOSE
+    if (sm_col_freelist == NIL(sm_col)) {
+	pcol = ALLOC(sm_col, 1);
+    } else {
+	pcol = sm_col_freelist;
+	sm_col_freelist = pcol->next_col;
+    }
+#else
+    pcol = ALLOC(sm_col, 1);
+#endif
+
+    pcol->col_num = 0;
+    pcol->length = 0;
+    pcol->first_row = pcol->last_row = NIL(sm_element);
+    pcol->next_col = pcol->prev_col = NIL(sm_col);
+    pcol->flag = 0;
+    pcol->user_word = NIL(char);		/* for our user ... */
+    return pcol;
+}
+
+
+/*
+ *  free a col vector -- for FAST_AND_LOOSE, this is real cheap for cols;
+ *  however, freeing a rowumn must still walk down the rowumn discarding
+ *  the elements one-by-one; that is the only use for the extra '-DCOLS'
+ *  compile flag ...
+ */
+void
+sm_col_free(sm_col *pcol)
+{
+#if defined(FAST_AND_LOOSE) && ! defined(COLS)
+    if (pcol->first_row != NIL(sm_element)) {
+	/* Add the linked list of col items to the free list */
+	pcol->last_row->next_row = sm_element_freelist;
+	sm_element_freelist = pcol->first_row;
+    }
+
+    /* Add the col to the free list of cols */
+    pcol->next_col = sm_col_freelist;
+    sm_col_freelist = pcol;
+#else
+    register sm_element *p, *pnext;
+
+    for(p = pcol->first_row; p != 0; p = pnext) {
+	pnext = p->next_row;
+	sm_element_free(p);
+    }
+    FREE(pcol);
+#endif
+}
+
+
+/*
+ *  duplicate an existing col
+ */
+sm_col *
+sm_col_dup(sm_col *pcol)
+{
+    register sm_col *pnew;
+    register sm_element *p;
+
+    pnew = sm_col_alloc();
+    for(p = pcol->first_row; p != 0; p = p->next_row) {
+	(void) sm_col_insert(pnew, p->row_num);
+    }
+    return pnew;
+}
+
+
+/*
+ *  insert an element into a col vector 
+ */
+sm_element *
+sm_col_insert(sm_col *pcol, int row)
+{
+    register sm_element *test, *element;
+
+    /* get a new item, save its address */
+    sm_element_alloc(element);
+    test = element;
+    sorted_insert(sm_element, pcol->first_row, pcol->last_row, pcol->length, 
+		    next_row, prev_row, row_num, row, test);
+
+    /* if item was not used, free it */
+    if (element != test) {
+	sm_element_free(element);
+    }
+
+    /* either way, return the current new value */
+    return test;
+}
+
+
+/*
+ *  remove an element from a col vector 
+ */
+void
+sm_col_remove(sm_col *pcol, int row)
+{
+    register sm_element *p;
+
+    for(p = pcol->first_row; p != 0 && p->row_num < row; p = p->next_row)
+	;
+    if (p != 0 && p->row_num == row) {
+	dll_unlink(p, pcol->first_row, pcol->last_row, 
+			    next_row, prev_row, pcol->length);
+	sm_element_free(p);
+    }
+}
+
+
+/*
+ *  find an element (if it is in the col vector)
+ */
+sm_element *
+sm_col_find(sm_col *pcol, int row)
+{
+    register sm_element *p;
+
+    for(p = pcol->first_row; p != 0 && p->row_num < row; p = p->next_row)
+	;
+    if (p != 0 && p->row_num == row) {
+	return p;
+    } else {
+	return NIL(sm_element);
+    }
+}
+
+
+/*
+ *  return 1 if col p2 contains col p1; 0 otherwise
+ */
+int 
+sm_col_contains(sm_col *p1, sm_col *p2)
+{
+    register sm_element *q1, *q2;
+
+    q1 = p1->first_row;
+    q2 = p2->first_row;
+    while (q1 != 0) {
+	if (q2 == 0 || q1->row_num < q2->row_num) {
+	    return 0;
+	} else if (q1->row_num == q2->row_num) {
+	    q1 = q1->next_row;
+	    q2 = q2->next_row;
+	} else {
+	    q2 = q2->next_row;
+	}
+    }
+    return 1;
+}
+
+
+/*
+ *  return 1 if col p1 and col p2 share an element in common
+ */
+int 
+sm_col_intersects(sm_col *p1, sm_col *p2)
+{
+    register sm_element *q1, *q2;
+
+    q1 = p1->first_row;
+    q2 = p2->first_row;
+    if (q1 == 0 || q2 == 0) return 0;
+    for(;;) {
+	if (q1->row_num < q2->row_num) {
+	    if ((q1 = q1->next_row) == 0) {
+		return 0;
+	    }
+	} else if (q1->row_num > q2->row_num) {
+	    if ((q2 = q2->next_row) == 0) {
+		return 0;
+	    }
+	} else {
+	    return 1;
+	}
+    }
+}
+
+
+/*
+ *  compare two cols, lexical ordering
+ */
+int 
+sm_col_compare(sm_col *p1, sm_col *p2)
+{
+    register sm_element *q1, *q2;
+
+    q1 = p1->first_row;
+    q2 = p2->first_row;
+    while(q1 != 0 && q2 != 0) {
+	if (q1->row_num != q2->row_num) {
+	    return q1->row_num - q2->row_num;
+	}
+	q1 = q1->next_row;
+	q2 = q2->next_row;
+    }
+
+    if (q1 != 0) {
+	return 1;
+    } else if (q2 != 0) {
+	return -1;
+    } else {
+	return 0;
+    }
+}
+
+
+/*
+ *  return the intersection
+ */
+sm_col *
+sm_col_and(sm_col *p1, sm_col *p2)
+{
+    register sm_element *q1, *q2;
+    register sm_col *result;
+
+    result = sm_col_alloc();
+    q1 = p1->first_row;
+    q2 = p2->first_row;
+    if (q1 == 0 || q2 == 0) return result;
+    for(;;) {
+	if (q1->row_num < q2->row_num) {
+	    if ((q1 = q1->next_row) == 0) {
+		return result;
+	    }
+	} else if (q1->row_num > q2->row_num) {
+	    if ((q2 = q2->next_row) == 0) {
+		return result;
+	    }
+	} else {
+	    (void) sm_col_insert(result, q1->row_num);
+	    if ((q1 = q1->next_row) == 0) {
+		return result;
+	    }
+	    if ((q2 = q2->next_row) == 0) {
+		return result;
+	    }
+	}
+    }
+}
+
+
+int 
+sm_col_hash(sm_col *pcol, int modulus)
+{
+    register int sum;
+    register sm_element *p;
+
+    sum = 0;
+    for(p = pcol->first_row; p != 0; p = p->next_row) {
+	sum = (sum*17 + p->row_num) % modulus;
+    }
+    return sum;
+}
+
+
+/*
+ *  remove an element from a col vector (given a pointer to the element) 
+ */
+void
+sm_col_remove_element(sm_col *pcol, sm_element *p)
+{
+    dll_unlink(p, pcol->first_row, pcol->last_row, 
+			next_row, prev_row, pcol->length);
+    sm_element_free(p);
+}
+
+
+void
+sm_col_print(FILE *fp, sm_col *pcol)
+{
+    sm_element *p;
+
+    for(p = pcol->first_row; p != 0; p = p->next_row) {
+	(void) fprintf(fp, " %d", p->row_num);
+    }
+}
Index: /vis_dev/glu-2.1/src/sparse/matrix.c
===================================================================
--- /vis_dev/glu-2.1/src/sparse/matrix.c	(revision 6)
+++ /vis_dev/glu-2.1/src/sparse/matrix.c	(revision 6)
@@ -0,0 +1,540 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: matrix.c,v 1.4 2002/09/10 00:01:02 fabio Exp $
+ *
+ */
+#include <stdio.h>
+#include "sparse_int.h"
+
+/*
+ *  free-lists are only used if 'FAST_AND_LOOSE' is set; this is because
+ *  we lose the debugging capability of libmm_t which trashes objects when
+ *  they are free'd.  However, FAST_AND_LOOSE is much faster if matrices
+ *  are created and freed frequently.
+ */
+
+#ifdef FAST_AND_LOOSE
+sm_element *sm_element_freelist;
+sm_row *sm_row_freelist;
+sm_col *sm_col_freelist;
+#endif
+
+sm_matrix *
+sm_allocate(void)
+{
+    register sm_matrix *A;
+
+    A = ALLOC(sm_matrix, 1);
+    A->rows = NIL(sm_row *);
+    A->cols = NIL(sm_col *);
+    A->nrows = A->ncols = 0;
+    A->rows_size = A->cols_size = 0;
+    A->first_row = A->last_row = NIL(sm_row);
+    A->first_col = A->last_col = NIL(sm_col);
+    A->user_word = NIL(char);		/* for our user ... */
+    return A;
+}
+
+
+sm_matrix *
+sm_alloc_size(int row, int col)
+{
+    register sm_matrix *A;
+
+    A = sm_alloc();
+    sm_resize(A, row, col);
+    return A;
+}
+
+
+void
+sm_free_space(sm_matrix *A)
+{
+#ifdef FAST_AND_LOOSE
+    register sm_row *prow;
+
+    if (A->first_row != 0) {
+	for(prow = A->first_row; prow != 0; prow = prow->next_row) {
+	    /* add the elements to the free list of elements */
+	    prow->last_col->next_col = sm_element_freelist;
+	    sm_element_freelist = prow->first_col;
+	}
+
+	/* Add the linked list of rows to the row-free-list */
+	A->last_row->next_row = sm_row_freelist;
+	sm_row_freelist = A->first_row;
+
+	/* Add the linked list of cols to the col-free-list */
+	A->last_col->next_col = sm_col_freelist;
+	sm_col_freelist = A->first_col;
+    }
+#else
+    register sm_row *prow, *pnext_row;
+    register sm_col *pcol, *pnext_col;
+
+    for(prow = A->first_row; prow != 0; prow = pnext_row) {
+	pnext_row = prow->next_row;
+	sm_row_free(prow);
+    }
+    for(pcol = A->first_col; pcol != 0; pcol = pnext_col) {
+	pnext_col = pcol->next_col;
+	pcol->first_row = pcol->last_row = NIL(sm_element);
+	sm_col_free(pcol);
+    }
+#endif
+
+    /* Free the arrays to map row/col numbers into pointers */
+    FREE(A->rows);
+    FREE(A->cols);
+    FREE(A);
+}
+
+
+sm_matrix *
+sm_dup(sm_matrix *A)
+{
+    register sm_row *prow;
+    register sm_element *p;
+    register sm_matrix *B;
+
+    B = sm_alloc();
+    if (A->last_row != 0) {
+	sm_resize(B, A->last_row->row_num, A->last_col->col_num);
+	for(prow = A->first_row; prow != 0; prow = prow->next_row) {
+	    for(p = prow->first_col; p != 0; p = p->next_col) {
+		(void) sm_insert(B, p->row_num, p->col_num);
+	    }
+	}
+    }
+    return B;
+}
+
+
+void 
+sm_resize(sm_matrix *A, int row, int col)
+{
+    register int i, new_size;
+
+    if (row >= A->rows_size) {
+	new_size = MAX(A->rows_size*2, row+1);
+	A->rows = REALLOC(sm_row *, A->rows, new_size);
+	for(i = A->rows_size; i < new_size; i++) {
+	    A->rows[i] = NIL(sm_row);
+	}
+	A->rows_size = new_size;
+    }
+
+    if (col >= A->cols_size) {
+	new_size = MAX(A->cols_size*2, col+1);
+	A->cols = REALLOC(sm_col *, A->cols, new_size);
+	for(i = A->cols_size; i < new_size; i++) {
+	    A->cols[i] = NIL(sm_col);
+	}
+	A->cols_size = new_size;
+    }
+}
+
+
+/*  
+ *  insert -- insert a value into the matrix
+ */
+sm_element *
+sm_insert(sm_matrix *A, int row, int col)
+{
+    register sm_row *prow;
+    register sm_col *pcol;
+    register sm_element *element;
+    sm_element *save_element;
+
+    if (row >= A->rows_size || col >= A->cols_size) {
+	sm_resize(A, row, col);
+    }
+
+    prow = A->rows[row];
+    if (prow == NIL(sm_row)) {
+	prow = A->rows[row] = sm_row_alloc();
+	prow->row_num = row;
+	sorted_insert(sm_row, A->first_row, A->last_row, A->nrows, 
+			next_row, prev_row, row_num, row, prow);
+    }
+
+    pcol = A->cols[col];
+    if (pcol == NIL(sm_col)) {
+	pcol = A->cols[col] = sm_col_alloc();
+	pcol->col_num = col;
+	sorted_insert(sm_col, A->first_col, A->last_col, A->ncols, 
+			next_col, prev_col, col_num, col, pcol);
+    }
+
+    /* get a new item, save its address */
+    sm_element_alloc(element);
+    save_element = element;
+
+    /* insert it into the row list */
+    sorted_insert(sm_element, prow->first_col, prow->last_col, 
+		prow->length, next_col, prev_col, col_num, col, element);
+
+    /* if it was used, also insert it into the column list */
+    if (element == save_element) {
+	sorted_insert(sm_element, pcol->first_row, pcol->last_row, 
+		pcol->length, next_row, prev_row, row_num, row, element);
+    } else {
+	/* otherwise, it was already in matrix -- free element we allocated */
+	sm_element_free(save_element);
+    }
+    return element;
+}
+
+
+sm_element *
+sm_find(sm_matrix *A, int rownum, int colnum)
+{
+    sm_row *prow;
+    sm_col *pcol;
+
+    prow = sm_get_row(A, rownum);
+    if (prow == NIL(sm_row)) {
+	return NIL(sm_element);
+    } else {
+	pcol = sm_get_col(A, colnum);
+	if (pcol == NIL(sm_col)) {
+	    return NIL(sm_element);
+	}
+	if (prow->length < pcol->length) {
+	    return sm_row_find(prow, colnum);
+	} else {
+	    return sm_col_find(pcol, rownum);
+	}
+    }
+}
+
+
+void
+sm_remove(sm_matrix *A, int rownum, int colnum)
+{
+    sm_remove_element(A, sm_find(A, rownum, colnum));
+}
+
+
+
+void
+sm_remove_element(sm_matrix *A, sm_element *p)
+{
+    register sm_row *prow;
+    register sm_col *pcol;
+
+    if (p == 0) return;
+
+    /* Unlink the element from its row */
+    prow = sm_get_row(A, p->row_num);
+    dll_unlink(p, prow->first_col, prow->last_col, 
+			next_col, prev_col, prow->length);
+
+    /* if no more elements in the row, discard the row header */
+    if (prow->first_col == NIL(sm_element)) {
+	sm_delrow(A, p->row_num);
+    }
+
+    /* Unlink the element from its column */
+    pcol = sm_get_col(A, p->col_num);
+    dll_unlink(p, pcol->first_row, pcol->last_row, 
+			next_row, prev_row, pcol->length);
+
+    /* if no more elements in the column, discard the column header */
+    if (pcol->first_row == NIL(sm_element)) {
+	sm_delcol(A, p->col_num);
+    }
+
+    sm_element_free(p);
+}
+
+
+void 
+sm_delrow(sm_matrix *A, int i)
+{
+    register sm_element *p, *pnext;
+    sm_col *pcol;
+    sm_row *prow;
+
+    prow = sm_get_row(A, i);
+    if (prow != NIL(sm_row)) {
+	/* walk across the row */
+	for(p = prow->first_col; p != 0; p = pnext) {
+	    pnext = p->next_col;
+
+	    /* unlink the item from the column (and delete it) */
+	    pcol = sm_get_col(A, p->col_num);
+	    sm_col_remove_element(pcol, p);
+
+	    /* discard the column if it is now empty */
+	    if (pcol->first_row == NIL(sm_element)) {
+		sm_delcol(A, pcol->col_num);
+	    }
+	}
+
+	/* discard the row -- we already threw away the elements */ 
+	A->rows[i] = NIL(sm_row);
+	dll_unlink(prow, A->first_row, A->last_row, 
+				next_row, prev_row, A->nrows);
+	prow->first_col = prow->last_col = NIL(sm_element);
+	sm_row_free(prow);
+    }
+}
+
+
+void 
+sm_delcol(sm_matrix *A, int i)
+{
+    register sm_element *p, *pnext;
+    sm_row *prow;
+    sm_col *pcol;
+
+    pcol = sm_get_col(A, i);
+    if (pcol != NIL(sm_col)) {
+	/* walk down the column */
+	for(p = pcol->first_row; p != 0; p = pnext) {
+	    pnext = p->next_row;
+
+	    /* unlink the element from the row (and delete it) */
+	    prow = sm_get_row(A, p->row_num);
+	    sm_row_remove_element(prow, p);
+
+	    /* discard the row if it is now empty */
+	    if (prow->first_col == NIL(sm_element)) {
+		sm_delrow(A, prow->row_num);
+	    }
+	}
+
+	/* discard the column -- we already threw away the elements */ 
+	A->cols[i] = NIL(sm_col);
+	dll_unlink(pcol, A->first_col, A->last_col, 
+			    next_col, prev_col, A->ncols);
+	pcol->first_row = pcol->last_row = NIL(sm_element);
+	sm_col_free(pcol);
+    }
+}
+
+
+void
+sm_copy_row(sm_matrix *dest, int dest_row, sm_row *prow)
+{
+    register sm_element *p;
+
+    for(p = prow->first_col; p != 0; p = p->next_col) {
+	(void) sm_insert(dest, dest_row, p->col_num);
+    }
+}
+
+
+void
+sm_copy_col(sm_matrix *dest, int dest_col, sm_col *pcol)
+{
+    register sm_element *p;
+
+    for(p = pcol->first_row; p != 0; p = p->next_row) {
+	(void) sm_insert(dest, dest_col, p->row_num);
+    }
+}
+
+
+sm_row *
+sm_longest_row(sm_matrix *A)
+{
+    register sm_row *large_row, *prow;
+    register int max_length;
+
+    max_length = 0;
+    large_row = NIL(sm_row);
+    for(prow = A->first_row; prow != 0; prow = prow->next_row) {
+	if (prow->length > max_length) {
+	    max_length = prow->length;
+	    large_row = prow;
+	}
+    }
+    return large_row;
+}
+
+
+sm_col *
+sm_longest_col(sm_matrix *A)
+{
+    register sm_col *large_col, *pcol;
+    register int max_length;
+
+    max_length = 0;
+    large_col = NIL(sm_col);
+    for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
+	if (pcol->length > max_length) {
+	    max_length = pcol->length;
+	    large_col = pcol;
+	}
+    }
+    return large_col;
+}
+
+
+int
+sm_num_elements(sm_matrix *A)
+{
+    register sm_row *prow;
+    register int num;
+
+    num = 0;
+    sm_foreach_row(A, prow) {
+	num += prow->length;
+    }
+    return num;
+}
+
+
+int 
+sm_read(FILE *fp, sm_matrix **A)
+{
+    int i, j, err;
+
+    *A = sm_alloc();
+    while (! feof(fp)) {
+	err = fscanf(fp, "%d %d", &i, &j);
+	if (err == EOF) {
+	    return 1;
+	} else if (err != 2) {
+	    return 0;
+	}
+	(void) sm_insert(*A, i, j);
+    }
+    return 1;
+}
+
+
+int 
+sm_read_compressed(FILE *fp, sm_matrix **A)
+{
+    int i, j, k, nrows, ncols;
+    unsigned long x;
+
+    *A = sm_alloc();
+    if (fscanf(fp, "%d %d", &nrows, &ncols) != 2) {
+	return 0;
+    }
+    sm_resize(*A, nrows, ncols);
+
+    for(i = 0; i < nrows; i++) {
+	if (fscanf(fp, "%lx", &x) != 1) {
+	    return 0;
+	}
+	for(j = 0; j < ncols; j += 32) {
+	    if (fscanf(fp, "%lx", &x) != 1) {
+		return 0;
+	    }
+	    for(k = j; x != 0; x >>= 1, k++) {
+		if (x & 1) {
+		    (void) sm_insert(*A, i, k);
+		}
+	    }
+	}
+    }
+    return 1;
+}
+
+
+void 
+sm_write(FILE *fp, sm_matrix *A)
+{
+    register sm_row *prow;
+    register sm_element *p;
+
+    for(prow = A->first_row; prow != 0; prow = prow->next_row) {
+	for(p = prow->first_col; p != 0; p = p->next_col) {
+	    (void) fprintf(fp, "%d %d\n", p->row_num, p->col_num);
+	}
+    }
+}
+
+
+void 
+sm_print(FILE *fp, sm_matrix *A)
+{
+    register sm_row *prow;
+    register sm_col *pcol;
+    int c;
+
+    if (A->last_col->col_num >= 100) {
+	(void) fprintf(fp, "    ");
+	for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
+	    (void) fprintf(fp, "%d", (pcol->col_num / 100)%10);
+	}
+	putc('\n', fp);
+    }
+
+    if (A->last_col->col_num >= 10) {
+	(void) fprintf(fp, "    ");
+	for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
+	    (void) fprintf(fp, "%d", (pcol->col_num / 10)%10);
+	}
+	putc('\n', fp);
+    }
+
+    (void) fprintf(fp, "    ");
+    for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
+	(void) fprintf(fp, "%d", pcol->col_num % 10);
+    }
+    putc('\n', fp);
+
+    (void) fprintf(fp, "    ");
+    for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
+	(void) fprintf(fp, "-");
+    }
+    putc('\n', fp);
+
+    for(prow = A->first_row; prow != 0; prow = prow->next_row) {
+	(void) fprintf(fp, "%3d:", prow->row_num);
+
+	for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col) {
+	    c = sm_row_find(prow, pcol->col_num) ? '1' : '.';
+	    putc(c, fp);
+	}
+	putc('\n', fp);
+    }
+}
+
+
+void 
+sm_dump(sm_matrix *A, char *s, int max)
+{
+    FILE *fp = stdout;
+
+    (void) fprintf(fp, "%s %d rows by %d cols\n", s, A->nrows, A->ncols);
+    if (A->nrows < max) {
+	sm_print(fp, A);
+    }
+}
+
+
+void
+sm_cleanup(void)
+{
+#ifdef FAST_AND_LOOSE
+    register sm_element *p, *pnext;
+    register sm_row *prow, *pnextrow;
+    register sm_col *pcol, *pnextcol;
+
+    for(p = sm_element_freelist; p != 0; p = pnext) {
+	pnext = p->next_col;
+	FREE(p);
+    }
+    sm_element_freelist = 0;
+
+    for(prow = sm_row_freelist; prow != 0; prow = pnextrow) {
+	pnextrow = prow->next_row;
+	FREE(prow);
+    }
+    sm_row_freelist = 0;
+
+    for(pcol = sm_col_freelist; pcol != 0; pcol = pnextcol) {
+	pnextcol = pcol->next_col;
+	FREE(pcol);
+    }
+    sm_col_freelist = 0;
+#endif
+}
Index: /vis_dev/glu-2.1/src/sparse/rows.c
===================================================================
--- /vis_dev/glu-2.1/src/sparse/rows.c	(revision 6)
+++ /vis_dev/glu-2.1/src/sparse/rows.c	(revision 6)
@@ -0,0 +1,294 @@
+/*
+ * $Id: rows.c,v 1.3 2002/09/10 00:02:02 fabio Exp $
+ *
+ */
+#include <stdio.h>
+#include "sparse_int.h"
+
+
+/*
+ *  allocate a new row vector 
+ */
+sm_row *
+sm_row_alloc(void)
+{
+    register sm_row *prow;
+
+#ifdef FAST_AND_LOOSE
+    if (sm_row_freelist == NIL(sm_row)) {
+	prow = ALLOC(sm_row, 1);
+    } else {
+	prow = sm_row_freelist;
+	sm_row_freelist = prow->next_row;
+    }
+#else
+    prow = ALLOC(sm_row, 1);
+#endif
+
+    prow->row_num = 0;
+    prow->length = 0;
+    prow->first_col = prow->last_col = NIL(sm_element);
+    prow->next_row = prow->prev_row = NIL(sm_row);
+    prow->flag = 0;
+    prow->user_word = NIL(char);		/* for our user ... */
+    return prow;
+}
+
+
+/*
+ *  free a row vector -- for FAST_AND_LOOSE, this is real cheap for rows;
+ *  however, freeing a column must still walk down the column discarding
+ *  the elements one-by-one; that is the only use for the extra '-DCOLS'
+ *  compile flag ...
+ */
+void
+sm_row_free(sm_row *prow)
+{
+#if defined(FAST_AND_LOOSE) && ! defined(COLS)
+    if (prow->first_col != NIL(sm_element)) {
+	/* Add the linked list of row items to the free list */
+	prow->last_col->next_col = sm_element_freelist;
+	sm_element_freelist = prow->first_col;
+    }
+
+    /* Add the row to the free list of rows */
+    prow->next_row = sm_row_freelist;
+    sm_row_freelist = prow;
+#else
+    register sm_element *p, *pnext;
+
+    for(p = prow->first_col; p != 0; p = pnext) {
+	pnext = p->next_col;
+	sm_element_free(p);
+    }
+    FREE(prow);
+#endif
+}
+
+
+/*
+ *  duplicate an existing row
+ */
+sm_row *
+sm_row_dup(sm_row *prow)
+{
+    register sm_row *pnew;
+    register sm_element *p;
+
+    pnew = sm_row_alloc();
+    for(p = prow->first_col; p != 0; p = p->next_col) {
+	(void) sm_row_insert(pnew, p->col_num);
+    }
+    return pnew;
+}
+
+
+/*
+ *  insert an element into a row vector 
+ */
+sm_element *
+sm_row_insert(sm_row *prow, int col)
+{
+    register sm_element *test, *element;
+
+    /* get a new item, save its address */
+    sm_element_alloc(element);
+    test = element;
+    sorted_insert(sm_element, prow->first_col, prow->last_col, prow->length, 
+		    next_col, prev_col, col_num, col, test);
+
+    /* if item was not used, free it */
+    if (element != test) {
+	sm_element_free(element);
+    }
+
+    /* either way, return the current new value */
+    return test;
+}
+
+
+/*
+ *  remove an element from a row vector 
+ */
+void
+sm_row_remove(sm_row *prow, int col)
+{
+    register sm_element *p;
+
+    for(p = prow->first_col; p != 0 && p->col_num < col; p = p->next_col)
+	;
+    if (p != 0 && p->col_num == col) {
+	dll_unlink(p, prow->first_col, prow->last_col, 
+			    next_col, prev_col, prow->length);
+	sm_element_free(p);
+    }
+}
+
+
+/*
+ *  find an element (if it is in the row vector)
+ */
+sm_element *
+sm_row_find(sm_row *prow, int col)
+{
+    register sm_element *p;
+
+    for(p = prow->first_col; p != 0 && p->col_num < col; p = p->next_col)
+	;
+    if (p != 0 && p->col_num == col) {
+	return p;
+    } else {
+	return NIL(sm_element);
+    }
+}
+
+
+/*
+ *  return 1 if row p2 contains row p1; 0 otherwise
+ */
+int 
+sm_row_contains(sm_row *p1, sm_row *p2)
+{
+    register sm_element *q1, *q2;
+
+    q1 = p1->first_col;
+    q2 = p2->first_col;
+    while (q1 != 0) {
+	if (q2 == 0 || q1->col_num < q2->col_num) {
+	    return 0;
+	} else if (q1->col_num == q2->col_num) {
+	    q1 = q1->next_col;
+	    q2 = q2->next_col;
+	} else {
+	    q2 = q2->next_col;
+	}
+    }
+    return 1;
+}
+
+
+/*
+ *  return 1 if row p1 and row p2 share an element in common
+ */
+int 
+sm_row_intersects(sm_row *p1, sm_row *p2)
+{
+    register sm_element *q1, *q2;
+
+    q1 = p1->first_col;
+    q2 = p2->first_col;
+    if (q1 == 0 || q2 == 0) return 0;
+    for(;;) {
+	if (q1->col_num < q2->col_num) {
+	    if ((q1 = q1->next_col) == 0) {
+		return 0;
+	    }
+	} else if (q1->col_num > q2->col_num) {
+	    if ((q2 = q2->next_col) == 0) {
+		return 0;
+	    }
+	} else {
+	    return 1;
+	}
+    }
+}
+
+
+/*
+ *  compare two rows, lexical ordering
+ */
+int 
+sm_row_compare(sm_row *p1, sm_row *p2)
+{
+    register sm_element *q1, *q2;
+
+    q1 = p1->first_col;
+    q2 = p2->first_col;
+    while(q1 != 0 && q2 != 0) {
+	if (q1->col_num != q2->col_num) {
+	    return q1->col_num - q2->col_num;
+	}
+	q1 = q1->next_col;
+	q2 = q2->next_col;
+    }
+
+    if (q1 != 0) {
+	return 1;
+    } else if (q2 != 0) {
+	return -1;
+    } else {
+	return 0;
+    }
+}
+
+
+/*
+ *  return the intersection
+ */
+sm_row *
+sm_row_and(sm_row *p1, sm_row *p2)
+{
+    register sm_element *q1, *q2;
+    register sm_row *result;
+
+    result = sm_row_alloc();
+    q1 = p1->first_col;
+    q2 = p2->first_col;
+    if (q1 == 0 || q2 == 0) return result;
+    for(;;) {
+	if (q1->col_num < q2->col_num) {
+	    if ((q1 = q1->next_col) == 0) {
+		return result;
+	    }
+	} else if (q1->col_num > q2->col_num) {
+	    if ((q2 = q2->next_col) == 0) {
+		return result;
+	    }
+	} else {
+	    (void) sm_row_insert(result, q1->col_num);
+	    if ((q1 = q1->next_col) == 0) {
+		return result;
+	    }
+	    if ((q2 = q2->next_col) == 0) {
+		return result;
+	    }
+	}
+    }
+}
+
+
+int 
+sm_row_hash(sm_row *prow, int modulus)
+{
+    register int sum;
+    register sm_element *p;
+
+    sum = 0;
+    for(p = prow->first_col; p != 0; p = p->next_col) {
+	sum = (sum*17 + p->col_num) % modulus;
+    }
+    return sum;
+}
+
+
+/*
+ *  remove an element from a row vector (given a pointer to the element) 
+ */
+void
+sm_row_remove_element(sm_row *prow, sm_element *p)
+{
+    dll_unlink(p, prow->first_col, prow->last_col, 
+			next_col, prev_col, prow->length);
+    sm_element_free(p);
+}
+
+
+void
+sm_row_print(FILE *fp, sm_row *prow)
+{
+    sm_element *p;
+
+    for(p = prow->first_col; p != 0; p = p->next_col) {
+	(void) fprintf(fp, " %d", p->col_num);
+    }
+}
Index: /vis_dev/glu-2.1/src/sparse/sparse.h
===================================================================
--- /vis_dev/glu-2.1/src/sparse/sparse.h	(revision 6)
+++ /vis_dev/glu-2.1/src/sparse/sparse.h	(revision 6)
@@ -0,0 +1,159 @@
+#ifndef SPARSE_H
+#define SPARSE_H
+
+#include "util.h"
+
+/* hack to fix conflict with libX11.a */
+#define sm_alloc sm_allocate
+#define sm_free sm_free_space
+
+/*
+ *  sparse.h -- sparse matrix package header file
+ */
+
+typedef struct sm_element_struct sm_element;
+typedef struct sm_row_struct sm_row;
+typedef struct sm_col_struct sm_col;
+typedef struct sm_matrix_struct sm_matrix;
+
+
+/*
+ *  sparse matrix element
+ */
+struct sm_element_struct {
+    int row_num;		/* row number of this element */
+    int col_num;		/* column number of this element */
+    sm_element *next_row;	/* next row in this column */
+    sm_element *prev_row;	/* previous row in this column */
+    sm_element *next_col;	/* next column in this row */
+    sm_element *prev_col;	/* previous column in this row */
+    char *user_word;		/* user-defined word */
+};
+
+
+/*
+ *  row header
+ */
+struct sm_row_struct {
+    int row_num;		/* the row number */
+    int length;			/* number of elements in this row */
+    int flag;			/* user-defined word */
+    sm_element *first_col;	/* first element in this row */
+    sm_element *last_col;	/* last element in this row */
+    sm_row *next_row;		/* next row (in sm_matrix linked list) */
+    sm_row *prev_row;		/* previous row (in sm_matrix linked list) */
+    char *user_word;		/* user-defined word */
+};
+
+
+/*
+ *  column header
+ */
+struct sm_col_struct {
+    int col_num;		/* the column number */
+    int length;			/* number of elements in this column */
+    int flag;			/* user-defined word */
+    sm_element *first_row;	/* first element in this column */
+    sm_element *last_row;	/* last element in this column */
+    sm_col *next_col;		/* next column (in sm_matrix linked list) */
+    sm_col *prev_col;		/* prev column (in sm_matrix linked list) */
+    char *user_word;		/* user-defined word */
+};
+
+
+/*
+ *  A sparse matrix
+ */
+struct sm_matrix_struct {
+    sm_row **rows;		/* pointer to row headers (by row #) */
+    int rows_size;		/* alloc'ed size of above array */
+    sm_col **cols;		/* pointer to column headers (by col #) */
+    int cols_size;		/* alloc'ed size of above array */
+    sm_row *first_row;		/* first row (linked list of all rows) */
+    sm_row *last_row;		/* last row (linked list of all rows) */
+    int nrows;			/* number of rows */
+    sm_col *first_col;		/* first column (linked list of columns) */
+    sm_col *last_col;		/* last column (linked list of columns) */
+    int ncols;			/* number of columns */
+    char *user_word;		/* user-defined word */
+};
+
+
+#define sm_get_col(A, colnum)	\
+    (((colnum) >= 0 && (colnum) < (A)->cols_size) ? \
+	(A)->cols[colnum] : (sm_col *) 0)
+
+#define sm_get_row(A, rownum)	\
+    (((rownum) >= 0 && (rownum) < (A)->rows_size) ? \
+	(A)->rows[rownum] : (sm_row *) 0)
+
+#define sm_foreach_row(A, prow)	\
+	for(prow = A->first_row; prow != 0; prow = prow->next_row)
+
+#define sm_foreach_col(A, pcol)	\
+	for(pcol = A->first_col; pcol != 0; pcol = pcol->next_col)
+
+#define sm_foreach_row_element(prow, p)	\
+	for(p = (prow == 0) ? 0 : prow->first_col; p != 0; p = p->next_col)
+
+#define sm_foreach_col_element(pcol, p) \
+	for(p = (pcol == 0) ? 0 : pcol->first_row; p != 0; p = p->next_row)
+
+#define sm_put(x, val) \
+	(x->user_word = (char *) val)
+
+#define sm_get(type, x) \
+	((type) (x->user_word))
+
+EXTERN sm_matrix *sm_allocate ARGS((void));
+EXTERN sm_matrix *sm_alloc_size ARGS((int, int));
+EXTERN void sm_free_space ARGS((sm_matrix *));
+EXTERN sm_matrix *sm_dup ARGS((sm_matrix *));
+EXTERN void sm_resize ARGS((sm_matrix *, int, int));
+EXTERN sm_element *sm_insert ARGS((sm_matrix *, int, int));
+EXTERN sm_element *sm_find ARGS((sm_matrix *, int, int));
+EXTERN void sm_remove ARGS((sm_matrix *, int, int));
+EXTERN void sm_remove_element ARGS((sm_matrix *, sm_element *));
+EXTERN void sm_delrow ARGS((sm_matrix *, int));
+EXTERN void sm_delcol ARGS((sm_matrix *, int));
+EXTERN void sm_copy_row ARGS((sm_matrix *, int, sm_row *));
+EXTERN void sm_copy_col ARGS((sm_matrix *, int, sm_col *));
+EXTERN sm_row *sm_longest_row ARGS((sm_matrix *));
+EXTERN sm_col *sm_longest_col ARGS((sm_matrix *));
+EXTERN int sm_num_elements ARGS((sm_matrix *));
+EXTERN int sm_read ARGS((FILE *, sm_matrix **));
+EXTERN int sm_read_compressed ARGS((FILE *, sm_matrix **));
+EXTERN void sm_write ARGS((FILE *, sm_matrix *));
+EXTERN void sm_print ARGS((FILE *, sm_matrix *));
+EXTERN void sm_dump ARGS((sm_matrix *, char *, int));
+EXTERN void sm_cleanup ARGS((void));
+
+EXTERN sm_col *sm_col_alloc ARGS((void));
+EXTERN void sm_col_free ARGS((sm_col *));
+EXTERN sm_col *sm_col_dup ARGS((sm_col *));
+EXTERN sm_element *sm_col_insert ARGS((sm_col *, int));
+EXTERN void sm_col_remove ARGS((sm_col *, int));
+EXTERN sm_element *sm_col_find ARGS((sm_col *, int));
+EXTERN int sm_col_contains ARGS((sm_col *, sm_col *));
+EXTERN int sm_col_intersects ARGS((sm_col *, sm_col *));
+EXTERN int sm_col_compare ARGS((sm_col *, sm_col *));
+EXTERN sm_col *sm_col_and ARGS((sm_col *, sm_col *));
+EXTERN int sm_col_hash ARGS((sm_col *, int));
+EXTERN void sm_col_remove_element ARGS((sm_col *, sm_element *));
+EXTERN void sm_col_print ARGS((FILE *, sm_col *));
+
+EXTERN sm_row *sm_row_alloc ARGS((void));
+EXTERN void sm_row_free ARGS((sm_row *));
+EXTERN sm_row *sm_row_dup ARGS((sm_row *));
+EXTERN sm_element *sm_row_insert ARGS((sm_row *, int));
+EXTERN void sm_row_remove ARGS((sm_row *, int));
+EXTERN sm_element *sm_row_find ARGS((sm_row *, int));
+EXTERN int sm_row_contains ARGS((sm_row *, sm_row *));
+EXTERN int sm_row_intersects ARGS((sm_row *, sm_row *));
+EXTERN int sm_row_compare ARGS((sm_row *, sm_row *));
+EXTERN sm_row *sm_row_and ARGS((sm_row *, sm_row *));
+EXTERN int sm_row_hash ARGS((sm_row *, int));
+EXTERN void sm_row_remove_element ARGS((sm_row *, sm_element *));
+EXTERN void sm_row_print ARGS((FILE *, sm_row *));
+
+#endif
Index: /vis_dev/glu-2.1/src/sparse/sparse.make
===================================================================
--- /vis_dev/glu-2.1/src/sparse/sparse.make	(revision 6)
+++ /vis_dev/glu-2.1/src/sparse/sparse.make	(revision 6)
@@ -0,0 +1,6 @@
+CSRC += cols.c matrix.c rows.c
+HEADERS += sparse.h sparse_int.h
+MISC += sparse.doc
+
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/sparse/sparse_int.h
===================================================================
--- /vis_dev/glu-2.1/src/sparse/sparse_int.h	(revision 6)
+++ /vis_dev/glu-2.1/src/sparse/sparse_int.h	(revision 6)
@@ -0,0 +1,108 @@
+#include "sparse.h"
+#include "util.h"
+
+
+/*
+ *  sorted, double-linked list insertion
+ *
+ *  type: object type
+ *
+ *  first, last: fields (in header) to head and tail of the list
+ *  count: field (in header) of length of the list
+ *
+ *  next, prev: fields (in object) to link next and previous objects
+ *  value: field (in object) which controls the order
+ *
+ *  newval: value field for new object
+ *  e: an object to use if insertion needed (set to actual value used)
+ */
+
+#define sorted_insert(type, first, last, count, next, prev, value, newval, e) \
+    if (last == 0) { \
+	e->value = newval; \
+	first = e; \
+	last = e; \
+	e->next = 0; \
+	e->prev = 0; \
+	count++; \
+    } else if (last->value < newval) { \
+	e->value = newval; \
+	last->next = e; \
+	e->prev = last; \
+	last = e; \
+	e->next = 0; \
+	count++; \
+    } else if (first->value > newval) { \
+	e->value = newval; \
+	first->prev = e; \
+	e->next = first; \
+	first = e; \
+	e->prev = 0; \
+	count++; \
+    } else { \
+	type *p; \
+	for(p = first; p->value < newval; p = p->next) \
+	    ; \
+	if (p->value > newval) { \
+	    e->value = newval; \
+	    p = p->prev; \
+	    p->next->prev = e; \
+	    e->next = p->next; \
+	    p->next = e; \
+	    e->prev = p; \
+	    count++; \
+	} else { \
+	    e = p; \
+	} \
+    }
+
+
+/*
+ *  double linked-list deletion
+ */
+#define dll_unlink(p, first, last, next, prev, count) { \
+    if (p->prev == 0) { \
+	first = p->next; \
+    } else { \
+	p->prev->next = p->next; \
+    } \
+    if (p->next == 0) { \
+	last = p->prev; \
+    } else { \
+	p->next->prev = p->prev; \
+    } \
+    count--; \
+}
+
+
+#ifdef FAST_AND_LOOSE
+extern sm_element *sm_element_freelist;
+extern sm_row *sm_row_freelist;
+extern sm_col *sm_col_freelist;
+
+#define sm_element_alloc(newobj) \
+    if (sm_element_freelist == NIL(sm_element)) { \
+	newobj = ALLOC(sm_element, 1); \
+    } else { \
+	newobj = sm_element_freelist; \
+	sm_element_freelist = sm_element_freelist->next_col; \
+    } \
+    newobj->user_word = NIL(char); \
+
+#define sm_element_free(e) \
+    (e->next_col = sm_element_freelist, sm_element_freelist = e)
+
+#else
+
+#define sm_element_alloc(newobj)	\
+    newobj = ALLOC(sm_element, 1);	\
+    newobj->user_word = NIL(char);
+#define sm_element_free(e)		\
+    FREE(e)
+#endif
+
+
+EXTERN void sm_row_remove_element(sm_row *, sm_element *);
+EXTERN void sm_col_remove_element(sm_col *, sm_element *);
+
+/* LINTLIBRARY */
Index: /vis_dev/glu-2.1/src/st/semantic.cache
===================================================================
--- /vis_dev/glu-2.1/src/st/semantic.cache	(revision 6)
+++ /vis_dev/glu-2.1/src/st/semantic.cache	(revision 6)
@@ -0,0 +1,22 @@
+;; Object st/
+;; SEMANTICDB Tags save file
+(semanticdb-project-database-file "st/"
+  :tables (list 
+   (semanticdb-table "st.h"
+    :major-mode 'c-mode
+    :tags '(("ST_INCLUDED" variable (:constant-flag t) nil [482 769]) ("st_free_gen" function (:type "void" :arguments (("" variable (:pointer 1 :type ("st_generator" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6955 6970])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6930 6971]) ("st_gen_int" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_generator" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6898 6913]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6914 6921]) ("" variable (:pointer 1 :type "int") (reparse-symbol arg-sub-list) [6922 6928])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6875 6929]) ("st_gen" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_generator" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6842 6857]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6858 6865]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6866 6873])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6823 6874]) ("st_init_gen" function (:type ("st_generator" type (:type "class") nil nil) :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6810 6821])) :typemodifiers ("extern" "\"C\"" "extern") :pointer 1 :prototype-flag t) (reparse-symbol extern-c-contents) [6776 6822]) ("st_ptrcmp" function (:type "int" :arguments (("" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [6747 6760]) ("" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [6761 6774])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6725 6775]) ("st_numcmp" function (:type "int" :arguments (("" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [6696 6709]) ("" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [6710 6723])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6674 6724]) ("st_ptrhash" function (:type "int" :arguments (("" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [6660 6667]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [6668 6672])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6637 6673]) ("st_numhash" function (:type "int" :arguments (("" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [6623 6630]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [6631 6635])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6600 6636]) ("st_strhash" function (:type "int" :arguments (("" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [6586 6593]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [6594 6598])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6563 6599]) ("st_foreach" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6533 6544]) ("" variable (:type ("ST_PFSR" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6545 6553]) ("" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [6554 6561])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6510 6562]) ("st_delete_int" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6482 6493]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6494 6501]) ("" variable (:pointer 1 :type "int") (reparse-symbol arg-sub-list) [6502 6508])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6456 6509]) ("st_delete" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6427 6438]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6439 6446]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6447 6454])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6405 6455]) ("st_copy" function (:type ("st_table" type (:type "class") nil nil) :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6392 6403])) :typemodifiers ("extern" "\"C\"" "extern") :pointer 1 :prototype-flag t) (reparse-symbol extern-c-contents) [6366 6404]) ("st_find" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6337 6348]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6349 6356]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6357 6364])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6317 6365]) ("st_find_or_add" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6288 6299]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6300 6307]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6308 6315])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6261 6316]) ("st_add_direct" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6232 6243]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6244 6251]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6252 6259])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6206 6260]) ("st_insert" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6177 6188]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6189 6196]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6197 6204])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6155 6205]) ("st_lookup_int" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6127 6138]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6139 6146]) ("" variable (:pointer 1 :type "int") (reparse-symbol arg-sub-list) [6147 6153])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6101 6154]) ("st_lookup" function (:type "int" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6072 6083]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6084 6091]) ("" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [6092 6099])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6050 6100]) ("st_free_table" function (:type "void" :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6037 6048])) :typemodifiers ("extern" "\"C\"" "extern") :prototype-flag t) (reparse-symbol extern-c-contents) [6010 6049]) ("st_init_table" function (:type ("st_table" type (:type "class") nil nil) :arguments (("" variable (:type ("ST_PFICPCP" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5985 5996]) ("" variable (:type ("ST_PFICPI" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5997 6007])) :typemodifiers ("extern" "\"C\"" "extern") :pointer 1 :prototype-flag t) (reparse-symbol extern-c-contents) [5953 6008]) ("st_init_table_with_params" function (:type ("st_table" type (:type "class") nil nil) :arguments (("" variable (:type ("ST_PFICPCP" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5906 5917]) ("" variable (:type ("ST_PFICPI" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5918 5928]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [5929 5933]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [5934 5938]) ("" variable (:type "double") (reparse-symbol arg-sub-list) [5939 5946]) ("" variable (:type "int") (reparse-symbol arg-sub-list) [5947 5951])) :typemodifiers ("extern" "\"C\"" "extern") :pointer 1 :prototype-flag t) (reparse-symbol extern-c-contents) [5862 5952]) ("st_foreach_item_int" variable (:typemodifiers ("extern" "\"C\"") :constant-flag t) (reparse-symbol extern-c-contents) [5401 5462]) ("st_foreach_item" variable (:typemodifiers ("extern" "\"C\"") :constant-flag t) (reparse-symbol extern-c-contents) [4484 4541]) ("st_count" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [3724 3770]) ("st_is_member" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [3318 3382]) ("ST_PFICPI" variable (:typemodifiers ("extern" "\"C\"") :type "int" :functionpointer-flag t) (reparse-symbol extern-c-contents) [2419 2449]) ("ST_PFICPCP" variable (:typemodifiers ("extern" "\"C\"") :type "int" :functionpointer-flag t) (reparse-symbol extern-c-contents) [2328 2374]) ("ST_PFSR" variable (:typemodifiers ("extern" "\"C\"") :type ("st_retval" type (:type "class") nil nil) :functionpointer-flag t) (reparse-symbol extern-c-contents) [2273 2318]) ("st_retval" type (:typemodifiers ("extern" "\"C\"") :type "enum" :members (("ST_CONTINUE" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2225 2237]) ("ST_STOP" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2238 2246]) ("ST_DELETE" variable (:constant-flag t :type "int") (reparse-symbol enumsubparts) [2247 2257]))) (reparse-symbol extern-c-contents) [2209 2258]) ("st_generator" type (:typemodifiers ("extern" "\"C\"") :type "struct" :members (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2146 2162]) ("entry" variable (:pointer 1 :type ("st_table_entry" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2167 2189]) ("index" variable (:type "int") (reparse-symbol classsubparts) [2194 2204]))) (reparse-symbol extern-c-contents) [2120 2207]) ("st_generator" type (:typemodifiers ("extern" "\"C\"") :type "typedef" :superclasses "st_generator" :typedef ("st_generator" type (:type "struct") nil nil)) (reparse-symbol extern-c-contents) [2078 2119]) ("st_table" type (:typemodifiers ("extern" "\"C\"") :type "struct" :members (("compare" variable (:functionpointer-flag t :type "int") (reparse-symbol classsubparts) [1867 1910]) ("hash" variable (:functionpointer-flag t :type "int") (reparse-symbol classsubparts) [1915 1940]) ("num_bins" variable (:type "int") (reparse-symbol classsubparts) [1945 1958]) ("num_entries" variable (:type "int") (reparse-symbol classsubparts) [1963 1979]) ("max_density" variable (:type "int") (reparse-symbol classsubparts) [1984 2000]) ("reorder_flag" variable (:type "int") (reparse-symbol classsubparts) [2005 2022]) ("grow_factor" variable (:type "double") (reparse-symbol classsubparts) [2027 2046]) ("bins" variable (:pointer 2 :type ("st_table_entry" type (:type "class") nil nil)) (reparse-symbol classsubparts) [2051 2073]))) (reparse-symbol extern-c-contents) [1845 2076]) ("st_table" type (:typemodifiers ("extern" "\"C\"") :type "typedef" :superclasses "st_table" :typedef ("st_table" type (:type "struct") nil nil)) (reparse-symbol extern-c-contents) [1811 1844]) ("st_table_entry" type (:typemodifiers ("extern" "\"C\"") :type "struct" :members (("key" variable (:pointer 1 :type "char") (reparse-symbol classsubparts) [1752 1762]) ("record" variable (:pointer 1 :type "char") (reparse-symbol classsubparts) [1767 1780]) ("next" variable (:pointer 1 :type ("st_table_entry" type (:type "class") nil nil)) (reparse-symbol classsubparts) [1785 1806]))) (reparse-symbol extern-c-contents) [1724 1809]) ("st_table_entry" type (:typemodifiers ("extern" "\"C\"") :type "typedef" :superclasses "st_table_entry" :typedef ("st_table_entry" type (:type "struct") nil nil)) (reparse-symbol extern-c-contents) [1678 1723]) ("ST_OUT_OF_MEM" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [1165 1193]) ("ST_DEFAULT_REORDER_FLAG" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [1131 1164]) ("ST_DEFAULT_GROW_FACTOR" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [1096 1130]) ("ST_DEFAULT_INIT_TABLE_SIZE" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [1058 1095]) ("ST_DEFAULT_MAX_DENSITY" variable (:typemodifiers ("extern" "\"C\"") :default-value (nil) :constant-flag t) (reparse-symbol extern-c-contents) [1025 1057]))
+    :file "st.h"
+    :pointmax 7132
+    :unmatched-syntax 'nil
+    )
+   (semanticdb-table "st.c"
+    :major-mode 'c-mode
+    :tags '(("util.h" include nil nil [397 414]) ("st.h" include nil nil [415 430]) ("UNUSED" variable (:default-value "\" $Id: st.c,v 1.8 2005/04/13 05:02:20 fabio Exp $\"" :type "int") nil [1429 1489]) ("ST_NUMCMP" variable (:constant-flag t :default-value (nil)) nil [1739 1774]) ("ST_NUMHASH" variable (:constant-flag t :default-value (nil)) nil [1776 1824]) ("st_shift" variable (:constant-flag t :default-value (nil)) nil [1849 1867]) ("st_shift" variable (:constant-flag t :default-value (nil)) nil [1874 1892]) ("ST_PTRHASH" variable (:constant-flag t :default-value (nil)) nil [1901 1979]) ("EQUAL" variable (:constant-flag t :default-value (nil)) nil [1981 2125]) ("do_hash" variable (:constant-flag t :default-value (nil)) nil [2127 2382]) ("PTR_NOT_EQUAL" variable (:constant-flag t :default-value (nil)) nil [2384 2513]) ("FIND_ENTRY" variable (:constant-flag t :default-value (nil)) nil [2515 2579]) ("bins" variable (:dereference 1 :type "int") nil [2592 2607]) ("ADD_DIRECT" variable (:constant-flag t :default-value (nil)) nil [2986 3381]) ("rehash" function (:prototype-flag t :typemodifiers ("static") :arguments (("" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [3724 3735])) :type "int") nil [3705 3736]) ("st_init_table" function (:pointer 1 :arguments (("compare" variable (:type ("ST_PFICPCP" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5591 5610]) ("hash" variable (:type ("ST_PFICPI" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [5611 5626])) :type ("st_table" type (:type "class") nil nil)) nil [5566 5812]) ("st_init_table_with_params" function (:pointer 1 :arguments (("compare" variable (:type ("ST_PFICPCP" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6867 6886]) ("hash" variable (:type ("ST_PFICPI" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [6889 6904]) ("size" variable (:type "int") (reparse-symbol arg-sub-list) [6907 6916]) ("density" variable (:type "int") (reparse-symbol arg-sub-list) [6919 6931]) ("grow_factor" variable (:type "double") (reparse-symbol arg-sub-list) [6934 6953]) ("reorder_flag" variable (:type "int") (reparse-symbol arg-sub-list) [6956 6973])) :type ("st_table" type (:type "class") nil nil)) nil [6827 7568]) ("st_free_table" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8104 8120])) :type "void") nil [8085 8379]) ("st_lookup" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [8936 8952]) ("key" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [8953 8963]) ("value" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [8964 8976])) :type "int") nil [8922 9265]) ("st_lookup_int" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [9827 9843]) ("key" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [9844 9854]) ("value" variable (:pointer 1 :type "int") (reparse-symbol arg-sub-list) [9855 9866])) :type "int") nil [9809 10162]) ("st_insert" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [10732 10748]) ("key" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [10749 10759]) ("value" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [10760 10772])) :type "int") nil [10718 11478]) ("st_add_direct" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [12136 12152]) ("key" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [12153 12163]) ("value" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [12164 12176])) :type "int") nil [12118 12729]) ("st_find_or_add" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [14035 14051]) ("key" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [14052 14062]) ("slot" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [14063 14074])) :type "int") nil [14016 14843]) ("st_find" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [15226 15242]) ("key" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [15243 15253]) ("slot" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [15254 15265])) :type "int") nil [15214 15554]) ("st_copy" function (:pointer 1 :arguments (("old_table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [16001 16021])) :type ("st_table" type (:type "class") nil nil)) nil [15982 17060]) ("st_delete" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [17744 17760]) ("keyp" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [17761 17772]) ("value" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [17773 17785])) :type "int") nil [17730 18189]) ("st_delete_int" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [18915 18931]) ("keyp" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [18932 18943]) ("value" variable (:pointer 1 :type "int") (reparse-symbol arg-sub-list) [18944 18955])) :type "int") nil [18897 19365]) ("st_foreach" function (:arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20401 20417]) ("func" variable (:type ("ST_PFSR" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [20418 20431]) ("arg" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [20432 20442])) :type "int") nil [20386 20951]) ("st_strhash" function (:arguments (("string" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [21278 21291]) ("modulus" variable (:type "int") (reparse-symbol arg-sub-list) [21292 21304])) :type "int") nil [21263 21452]) ("st_numhash" function (:arguments (("x" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [21797 21805]) ("size" variable (:type "int") (reparse-symbol arg-sub-list) [21806 21815])) :type "int") nil [21782 21852]) ("st_ptrhash" function (:arguments (("x" variable (:pointer 1 :type "char") (reparse-symbol arg-sub-list) [22191 22199]) ("size" variable (:type "int") (reparse-symbol arg-sub-list) [22200 22209])) :type "int") nil [22176 22246]) ("st_numcmp" function (:arguments (("x" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [22603 22617]) ("y" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [22618 22632])) :type "int") nil [22589 22665]) ("st_ptrcmp" function (:arguments (("x" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [23015 23029]) ("y" variable (:pointer 1 :constant-flag t :type "char") (reparse-symbol arg-sub-list) [23030 23044])) :type "int") nil [23001 23077]) ("st_init_gen" function (:pointer 1 :arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [23518 23534])) :type ("st_generator" type (:type "class") nil nil)) nil [23491 23764]) ("st_gen" function (:arguments (("gen" variable (:pointer 1 :type ("st_generator" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [24601 24619]) ("key_p" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [24620 24632]) ("value_p" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [24633 24647])) :type "int") nil [24590 25182]) ("st_gen_int" function (:arguments (("gen" variable (:pointer 1 :type ("st_generator" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [25850 25868]) ("key_p" variable (:pointer 1 :type "void") (reparse-symbol arg-sub-list) [25869 25881]) ("value_p" variable (:pointer 1 :type "int") (reparse-symbol arg-sub-list) [25882 25895])) :type "int") nil [25834 26436]) ("st_free_gen" function (:arguments (("gen" variable (:pointer 1 :type ("st_generator" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [26898 26916])) :type "void") nil [26881 26936]) ("rehash" function (:typemodifiers ("static") :arguments (("table" variable (:pointer 1 :type ("st_table" type (:type "class") nil nil)) (reparse-symbol arg-sub-list) [27751 27767])) :type "int") nil [27733 28867]))
+    :file "st.c"
+    :pointmax 28881
+    )
+   )
+  :file "semantic.cache"
+  :semantic-tag-version "2.0beta3"
+  :semanticdb-version "2.0beta3"
+  )
Index: /vis_dev/glu-2.1/src/st/st.c
===================================================================
--- /vis_dev/glu-2.1/src/st/st.c	(revision 6)
+++ /vis_dev/glu-2.1/src/st/st.c	(revision 6)
@@ -0,0 +1,1065 @@
+/**CFile***********************************************************************
+
+  FileName    [st.c]
+
+  PackageName [st]
+
+  Synopsis    [Symbol table package.]
+
+  Description [The st library provides functions to create, maintain,
+  and query symbol tables.]
+
+  SeeAlso     []
+
+  Author      []
+
+  Copyright   []
+
+******************************************************************************/
+
+#include "util.h"
+#include "st.h"
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#ifndef lint
+static char rcsid[] UNUSED = " $Id: st.c,v 1.8 2005/04/13 05:02:20 fabio Exp $";
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+#define ST_NUMCMP(x,y) ((x) != (y))
+
+#define ST_NUMHASH(x,size) (ABS((long)x)%(size))
+
+#if SIZEOF_VOID_P == 8
+#define st_shift 3
+#else
+#define st_shift 2
+#endif
+
+#define ST_PTRHASH(x,size) ((unsigned int)((unsigned long)(x)>>st_shift)%size)
+
+#define EQUAL(func, x, y) \
+    ((((func) == st_numcmp) || ((func) == st_ptrcmp)) ?\
+      (ST_NUMCMP((x),(y)) == 0) : ((*func)((x), (y)) == 0))
+
+#define do_hash(key, table)\
+    ((int)((table->hash == st_ptrhash) ? ST_PTRHASH((char *)(key),(table)->num_bins) :\
+     (table->hash == st_numhash) ? ST_NUMHASH((char *)(key), (table)->num_bins) :\
+     (*table->hash)((char *)(key), (table)->num_bins)))
+
+#define PTR_NOT_EQUAL(table, ptr, user_key)\
+(ptr != NIL(st_table_entry) && !EQUAL(table->compare, (char *)user_key, (ptr)->key))
+
+#define FIND_ENTRY(table, hash_val, key, ptr, last) \
+    (last) = &(table)->bins[hash_val];\
+    (ptr) = *(last);\
+    while (PTR_NOT_EQUAL((table), (ptr), (key))) {\
+	(last) = &(ptr)->next; (ptr) = *(last);\
+    }\
+    if ((ptr) != NIL(st_table_entry) && (table)->reorder_flag) {\
+	*(last) = (ptr)->next;\
+	(ptr)->next = (table)->bins[hash_val];\
+	(table)->bins[hash_val] = (ptr);\
+    }
+
+/* This macro does not check if memory allocation fails. Use at you own risk */
+#define ADD_DIRECT(table, key, value, hash_val, newt)\
+{\
+    if (table->num_entries/table->num_bins >= table->max_density) {\
+	rehash(table);\
+	hash_val = do_hash(key,table);\
+    }\
+    \
+    newt = ALLOC(st_table_entry, 1);\
+    \
+    newt->key = (char *)key;\
+    newt->record = value;\
+    newt->next = table->bins[hash_val];\
+    table->bins[hash_val] = newt;\
+    table->num_entries++;\
+}
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+static int rehash (st_table *);
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Create and initialize a table.]
+
+  Description [Create and initialize a table with the comparison function
+  compare_fn and hash function hash_fn. compare_fn is
+  <pre>
+	int compare_fn(const char *key1, const char *key2)
+  </pre>
+  It returns <,=,> 0 depending on whether key1 <,=,> key2 by some measure.<p>
+  hash_fn is
+  <pre>
+	int hash_fn(char *key, int modulus)
+  </pre>
+  It returns a integer between 0 and modulus-1 such that if
+  compare_fn(key1,key2) == 0 then hash_fn(key1) == hash_fn(key2).<p>
+  There are five predefined hash and comparison functions in st.
+  For keys as numbers:
+  <pre>
+	 st_numhash(key, modulus) { return (unsigned int) key % modulus; }
+  </pre>
+  <pre>
+	 st_numcmp(x,y) { return (int) x - (int) y; }
+  </pre>
+  For keys as pointers:
+  <pre>
+	 st_ptrhash(key, modulus) { return ((unsigned int) key/4) % modulus }
+  </pre>
+  <pre>
+	 st_ptrcmp(x,y) { return (int) x - (int) y; }
+  </pre>
+  For keys as strings:
+  <pre>
+         st_strhash(x,y) - a reasonable hashing function for strings
+  </pre>
+  <pre>
+	 strcmp(x,y) - the standard library function
+  </pre>
+  It is recommended to use these particular functions if they fit your 
+  needs, since st will recognize certain of them and run more quickly
+  because of it.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table_with_params st_free_table]
+
+******************************************************************************/
+st_table *
+st_init_table(ST_PFICPCP compare, ST_PFICPI hash)
+{
+    return st_init_table_with_params(compare, hash, ST_DEFAULT_INIT_TABLE_SIZE,
+				     ST_DEFAULT_MAX_DENSITY,
+				     ST_DEFAULT_GROW_FACTOR,
+				     ST_DEFAULT_REORDER_FLAG);
+
+} /* st_init_table */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Create a table with given parameters.]
+
+  Description [The full blown table initializer.  compare and hash are
+  the same as in st_init_table. density is the largest the average
+  number of entries per hash bin there should be before the table is
+  grown.  grow_factor is the factor the table is grown by when it
+  becomes too full. size is the initial number of bins to be allocated
+  for the hash table.  If reorder_flag is non-zero, then every time an
+  entry is found, it is moved to the top of the chain.<p>
+  st_init_table(compare, hash) is equivelent to
+  <pre>
+  st_init_table_with_params(compare, hash, ST_DEFAULT_INIT_TABLE_SIZE,
+			    ST_DEFAULT_MAX_DENSITY,
+			    ST_DEFAULT_GROW_FACTOR,
+			    ST_DEFAULT_REORDER_FLAG);
+  </pre>
+  ]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table st_free_table]
+
+******************************************************************************/
+st_table *
+st_init_table_with_params(
+  ST_PFICPCP compare,
+  ST_PFICPI hash,
+  int size,
+  int density,
+  double grow_factor,
+  int reorder_flag)
+{
+    int i;
+    st_table *newt;
+
+    newt = ALLOC(st_table, 1);
+    if (newt == NIL(st_table)) {
+	return NIL(st_table);
+    }
+    newt->compare = compare;
+    newt->hash = hash;
+    newt->num_entries = 0;
+    newt->max_density = density;
+    newt->grow_factor = grow_factor;
+    newt->reorder_flag = reorder_flag;
+    if (size <= 0) {
+	size = 1;
+    }
+    newt->num_bins = size;
+    newt->bins = ALLOC(st_table_entry *, size);
+    if (newt->bins == NIL(st_table_entry *)) {
+	FREE(newt);
+	return NIL(st_table);
+    }
+    for(i = 0; i < size; i++) {
+	newt->bins[i] = 0;
+    }
+    return newt;
+
+} /* st_init_table_with_params */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Free a table.]
+
+  Description [Any internal storage associated with table is freed.
+  It is the user's responsibility to free any storage associated
+  with the pointers he placed in the table (by perhaps using
+  st_foreach).]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table st_init_table_with_params]
+
+******************************************************************************/
+void
+st_free_table(st_table *table)
+{
+    st_table_entry *ptr, *next;
+    int i;
+
+    for(i = 0; i < table->num_bins ; i++) {
+	ptr = table->bins[i];
+	while (ptr != NIL(st_table_entry)) {
+	    next = ptr->next;
+	    FREE(ptr);
+	    ptr = next;
+	}
+    }
+    FREE(table->bins);
+    FREE(table);
+
+} /* st_free_table */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Lookup up `key' in `table'.]
+
+  Description [Lookup up `key' in `table'. If an entry is found, 1 is
+  returned and if `value' is not nil, the variable it points to is set
+  to the associated value.  If an entry is not found, 0 is returned
+  and the variable pointed by value is unchanged.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_lookup_int]
+
+******************************************************************************/
+int
+st_lookup(st_table *table, void *key, void *value)
+{
+    int hash_val;
+    st_table_entry *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr, last);
+
+    if (ptr == NIL(st_table_entry)) {
+	return 0;
+    } else {
+	if (value != NIL(void)) {
+	    *(char **)value = ptr->record;
+	}
+	return 1;
+    }
+
+} /* st_lookup */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Lookup up `key' in `table'.]
+
+  Description [Lookup up `key' in `table'.  If an entry is found, 1 is
+  returned and if `value' is not nil, the variable it points to is
+  set to the associated integer value.  If an entry is not found, 0 is
+  return and the variable pointed by `value' is unchanged.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_lookup]
+
+******************************************************************************/
+int
+st_lookup_int(st_table *table, void *key, int *value)
+{
+    int hash_val;
+    st_table_entry *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr, last);
+    
+    if (ptr == NIL(st_table_entry)) {
+	return 0;
+    } else {
+	if (value != NIL(int)) {
+	    *value = (int) (long) ptr->record;
+	}
+	return 1;
+    }
+
+} /* st_lookup_int */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Insert value in table under the key 'key'.]
+
+  Description [Insert value in table under the key 'key'.  Returns 1
+  if there was an entry already under the key; 0 if there was no entry
+  under the key and insertion was successful; ST_OUT_OF_MEM otherwise.
+  In either of the first two cases the new value is added.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+st_insert(st_table *table, void *key, void *value)
+{
+    int hash_val;
+    st_table_entry *newt;
+    st_table_entry *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr, last);
+
+    if (ptr == NIL(st_table_entry)) {
+	if (table->num_entries/table->num_bins >= table->max_density) {
+	    if (rehash(table) == ST_OUT_OF_MEM) {
+		return ST_OUT_OF_MEM;
+	    }
+	    hash_val = do_hash(key, table);
+	}
+	newt = ALLOC(st_table_entry, 1);
+	if (newt == NIL(st_table_entry)) {
+	    return ST_OUT_OF_MEM;
+	}
+	newt->key = (char *)key;
+	newt->record = (char *)value;
+	newt->next = table->bins[hash_val];
+	table->bins[hash_val] = newt;
+	table->num_entries++;
+	return 0;
+    } else {
+	ptr->record = (char *)value;
+	return 1;
+    }
+
+} /* st_insert */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Place 'value' in 'table' under the key 'key'.]
+
+  Description [Place 'value' in 'table' under the key 'key'.  This is
+  done without checking if 'key' is in 'table' already.  This should
+  only be used if you are sure there is not already an entry for
+  'key', since it is undefined which entry you would later get from
+  st_lookup or st_find_or_add. Returns 1 if successful; ST_OUT_OF_MEM
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+int
+st_add_direct(st_table *table, void *key, void *value)
+{
+    int hash_val;
+    st_table_entry *newt;
+    
+    hash_val = do_hash(key, table);
+    if (table->num_entries / table->num_bins >= table->max_density) {
+	if (rehash(table) == ST_OUT_OF_MEM) {
+	    return ST_OUT_OF_MEM;
+	}
+    }
+    hash_val = do_hash(key, table);
+    newt = ALLOC(st_table_entry, 1);
+    if (newt == NIL(st_table_entry)) {
+	return ST_OUT_OF_MEM;
+    }
+    newt->key = (char *)key;
+    newt->record = (char *)value;
+    newt->next = table->bins[hash_val];
+    table->bins[hash_val] = newt;
+    table->num_entries++;
+    return 1;
+
+} /* st_add_direct */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Lookup `key' in `table'.]
+
+  Description [Lookup `key' in `table'.  If not found, create an
+  entry.  In either case set slot to point to the field in the entry
+  where the value is stored.  The value associated with `key' may then
+  be changed by accessing directly through slot.  Returns 1 if an
+  entry already existed, 0 if it did not exist and creation was
+  successful; ST_OUT_OF_MEM otherwise.  As an example:
+  <pre>
+      char **slot;
+  </pre>
+  <pre>
+      char *key;
+  </pre>
+  <pre>
+      char *value = (char *) item_ptr <-- ptr to a malloc'd structure
+  </pre>
+  <pre>
+      if (st_find_or_add(table, key, &slot) == 1) {
+  </pre>
+  <pre>
+	 FREE(*slot); <-- free the old value of the record
+  </pre>
+  <pre>
+      }
+  </pre>
+  <pre>
+      *slot = value;  <-- attach the new value to the record
+  </pre>
+  This replaces the equivelent code:
+  <pre>
+      if (st_lookup(table, key, &ovalue) == 1) {
+  </pre>
+  <pre>
+         FREE(ovalue);
+  </pre>
+  <pre>
+      }
+  </pre>
+  <pre>
+      st_insert(table, key, value);
+  </pre>
+  ]
+
+  SideEffects [None]
+
+  SeeAlso     [st_find]
+
+******************************************************************************/
+int
+st_find_or_add(st_table *table, void *key, void *slot)
+{
+    int hash_val;
+    st_table_entry *newt, *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr, last);
+
+    if (ptr == NIL(st_table_entry)) {
+	if (table->num_entries / table->num_bins >= table->max_density) {
+	    if (rehash(table) == ST_OUT_OF_MEM) {
+		return ST_OUT_OF_MEM;
+	    }
+	    hash_val = do_hash(key, table);
+	}
+	newt = ALLOC(st_table_entry, 1);
+	if (newt == NIL(st_table_entry)) {
+	    return ST_OUT_OF_MEM;
+	}
+	newt->key = (char *)key;
+	newt->record = (char *) 0;
+	newt->next = table->bins[hash_val];
+	table->bins[hash_val] = newt;
+	table->num_entries++;
+	if (slot != NIL(void)) *(char ***)slot = &newt->record;
+	return 0;
+    } else {
+	if (slot != NIL(void)) *(char ***)slot = &ptr->record;
+	return 1;
+    }
+
+} /* st_find_or_add */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Lookup `key' in `table'.]
+
+  Description [Like st_find_or_add, but does not create an entry if
+  one is not found.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_find_or_add]
+
+******************************************************************************/
+int
+st_find(st_table *table, void *key, void *slot)
+{
+    int hash_val;
+    st_table_entry *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr, last);
+
+    if (ptr == NIL(st_table_entry)) {
+	return 0;
+    } else {
+	if (slot != NIL(void)) {
+	    *(char ***)slot = &ptr->record;
+	}
+	return 1;
+    }
+
+} /* st_find */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Return a copy of old_table and all its members.]
+
+  Description [Return a copy of old_table and all its members.
+  (st_table *) 0 is returned if there was insufficient memory to do
+  the copy.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+st_table *
+st_copy(st_table *old_table)
+{
+    st_table *new_table;
+    st_table_entry *ptr, *newptr, *next, *newt;
+    int i, j, num_bins = old_table->num_bins;
+
+    new_table = ALLOC(st_table, 1);
+    if (new_table == NIL(st_table)) {
+	return NIL(st_table);
+    }
+    
+    *new_table = *old_table;
+    new_table->bins = ALLOC(st_table_entry *, num_bins);
+    if (new_table->bins == NIL(st_table_entry *)) {
+	FREE(new_table);
+	return NIL(st_table);
+    }
+    for(i = 0; i < num_bins ; i++) {
+	new_table->bins[i] = NIL(st_table_entry);
+	ptr = old_table->bins[i];
+	while (ptr != NIL(st_table_entry)) {
+	    newt = ALLOC(st_table_entry, 1);
+	    if (newt == NIL(st_table_entry)) {
+		for (j = 0; j <= i; j++) {
+		    newptr = new_table->bins[j];
+		    while (newptr != NIL(st_table_entry)) {
+			next = newptr->next;
+			FREE(newptr);
+			newptr = next;
+		    }
+		}
+		FREE(new_table->bins);
+		FREE(new_table);
+		return NIL(st_table);
+	    }
+	    *newt = *ptr;
+	    newt->next = new_table->bins[i];
+	    new_table->bins[i] = newt;
+	    ptr = ptr->next;
+	}
+    }
+    return new_table;
+
+} /* st_copy */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Delete the entry with the key pointed to by `keyp'.]
+
+  Description [Delete the entry with the key pointed to by `keyp'.  If
+  the entry is found, 1 is returned, the variable pointed by `keyp' is
+  set to the actual key and the variable pointed by `value' is set to
+  the corresponding entry.  (This allows the freeing of the associated
+  storage.)  If the entry is not found, then 0 is returned and nothing
+  is changed.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_delete_int]
+
+******************************************************************************/
+int
+st_delete(st_table *table, void *keyp, void *value)
+{
+    int hash_val;
+    char *key = *(char **)keyp;
+    st_table_entry *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr ,last);
+    
+    if (ptr == NIL(st_table_entry)) {
+	return 0;
+    }
+
+    *last = ptr->next;
+    if (value != NIL(void)) *(char **)value = ptr->record;
+    *(char **)keyp = ptr->key;
+    FREE(ptr);
+    table->num_entries--;
+    return 1;
+
+} /* st_delete */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Delete the entry with the key pointed to by `keyp'.]
+
+  Description [Delete the entry with the key pointed to by `keyp'.
+  `value' must be a pointer to an integer.  If the entry is found, 1
+  is returned, the variable pointed by `keyp' is set to the actual key
+  and the variable pointed by `value' is set to the corresponding
+  entry.  (This allows the freeing of the associated storage.) If the
+  entry is not found, then 0 is returned and nothing is changed.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_delete]
+
+******************************************************************************/
+int
+st_delete_int(st_table *table, void *keyp, int *value)
+{
+    int hash_val;
+    char *key = *(char **)keyp;
+    st_table_entry *ptr, **last;
+
+    hash_val = do_hash(key, table);
+
+    FIND_ENTRY(table, hash_val, key, ptr ,last);
+
+    if (ptr == NIL(st_table_entry)) {
+        return 0;
+    }
+
+    *last = ptr->next;
+    if (value != NIL(int)) *value = (int) (long) ptr->record;
+    *(char **)keyp = ptr->key;
+    FREE(ptr);
+    table->num_entries--;
+    return 1;
+
+} /* st_delete_int */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Iterates over the elements of a table.]
+
+  Description [For each (key, value) record in `table', st_foreach
+  call func with the arguments
+  <pre>
+	  (*func)(key, value, arg)
+  </pre>
+  If func returns ST_CONTINUE, st_foreach continues processing
+  entries.  If func returns ST_STOP, st_foreach stops processing and
+  returns immediately. If func returns ST_DELETE, then the entry is
+  deleted from the symbol table and st_foreach continues.  In the case
+  of ST_DELETE, it is func's responsibility to free the key and value,
+  if necessary.<p>
+
+  The routine returns 1 if all items in the table were generated and 0
+  if the generation sequence was aborted using ST_STOP.  The order in
+  which the records are visited will be seemingly random.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_foreach_item st_foreach_item_int]
+
+******************************************************************************/
+int
+st_foreach(st_table *table, ST_PFSR func, char *arg)
+{
+    st_table_entry *ptr, **last;
+    enum st_retval retval;
+    int i;
+
+    for(i = 0; i < table->num_bins; i++) {
+	last = &table->bins[i]; ptr = *last;
+	while (ptr != NIL(st_table_entry)) {
+	    retval = (*func)(ptr->key, ptr->record, arg);
+	    switch (retval) {
+	    case ST_CONTINUE:
+		last = &ptr->next; ptr = *last;
+		break;
+	    case ST_STOP:
+		return 0;
+	    case ST_DELETE:
+		*last = ptr->next;
+		table->num_entries--;	/* cstevens@ic */
+		FREE(ptr);
+		ptr = *last;
+	    }
+	}
+    }
+    return 1;
+
+} /* st_foreach */
+
+
+/**Function********************************************************************
+
+  Synopsis    [String hash function.]
+
+  Description [String hash function.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table]
+
+******************************************************************************/
+int
+st_strhash(char *string, int modulus)
+{
+    int val = 0;
+    int c;
+    
+    while ((c = *string++) != '\0') {
+	val = val*997 + c;
+    }
+
+    return ((val < 0) ? -val : val)%modulus;
+
+} /* st_strhash */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Number hash function.]
+
+  Description [Integer number hash function.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table st_numcmp]
+
+******************************************************************************/
+int
+st_numhash(char *x, int size)
+{
+    return ST_NUMHASH(x, size);
+
+} /* st_numhash */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Pointer hash function.]
+
+  Description [Pointer hash function.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table st_ptrcmp]
+
+******************************************************************************/
+int
+st_ptrhash(char *x, int size)
+{
+    return ST_PTRHASH(x, size);
+
+} /* st_ptrhash */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Number comparison function.]
+
+  Description [integer number comparison function.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table st_numhash]
+
+******************************************************************************/
+int
+st_numcmp(const char *x, const char *y)
+{
+    return ST_NUMCMP(x, y);
+
+} /* st_numcmp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Pointer comparison function.]
+
+  Description [Pointer comparison function.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_table st_ptrhash]
+
+******************************************************************************/
+int
+st_ptrcmp(const char *x, const char *y)
+{
+    return ST_NUMCMP(x, y);
+
+} /* st_ptrcmp */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializes a generator.]
+
+  Description [Returns a generator handle which when used with
+  st_gen() will progressively return each (key, value) record in
+  `table'.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_free_gen]
+
+******************************************************************************/
+st_generator *
+st_init_gen(st_table *table)
+{
+    st_generator *gen;
+
+    gen = ALLOC(st_generator, 1);
+    if (gen == NIL(st_generator)) {
+	return NIL(st_generator);
+    }
+    gen->table = table;
+    gen->entry = NIL(st_table_entry);
+    gen->index = 0;
+    return gen;
+
+} /* st_init_gen */
+
+
+/**Function********************************************************************
+
+  Synopsis [returns the next (key, value) pair in the generation
+  sequence. ]
+
+  Description [Given a generator returned by st_init_gen(), this
+  routine returns the next (key, value) pair in the generation
+  sequence.  The pointer `value_p' can be zero which means no value
+  will be returned.  When there are no more items in the generation
+  sequence, the routine returns 0.
+
+  While using a generation sequence, deleting any (key, value) pair
+  other than the one just generated may cause a fatal error when
+  st_gen() is called later in the sequence and is therefore not
+  recommended.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_gen_int]
+
+******************************************************************************/
+int
+st_gen(st_generator *gen, void *key_p, void *value_p)
+{
+    int i;
+
+    if (gen->entry == NIL(st_table_entry)) {
+	/* try to find next entry */
+	for(i = gen->index; i < gen->table->num_bins; i++) {
+	    if (gen->table->bins[i] != NIL(st_table_entry)) {
+		gen->index = i+1;
+		gen->entry = gen->table->bins[i];
+		break;
+	    }
+	}
+	if (gen->entry == NIL(st_table_entry)) {
+	    return 0;		/* that's all folks ! */
+	}
+    }
+    *(char **)key_p = gen->entry->key;
+    if (value_p != NIL(void)) {
+	*(char **)value_p = gen->entry->record;
+    }
+    gen->entry = gen->entry->next;
+    return 1;
+
+} /* st_gen */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Returns the next (key, value) pair in the generation
+  sequence.]
+
+  Description [Given a generator returned by st_init_gen(), this
+  routine returns the next (key, value) pair in the generation
+  sequence.  `value_p' must be a pointer to an integer.  The pointer
+  `value_p' can be zero which means no value will be returned.  When
+  there are no more items in the generation sequence, the routine
+  returns 0.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_gen]
+
+******************************************************************************/
+int 
+st_gen_int(st_generator *gen, void *key_p, int *value_p)
+{
+    int i;
+
+    if (gen->entry == NIL(st_table_entry)) {
+	/* try to find next entry */
+	for(i = gen->index; i < gen->table->num_bins; i++) {
+	    if (gen->table->bins[i] != NIL(st_table_entry)) {
+		gen->index = i+1;
+		gen->entry = gen->table->bins[i];
+		break;
+	    }
+	}
+	if (gen->entry == NIL(st_table_entry)) {
+	    return 0;		/* that's all folks ! */
+	}
+    }
+    *(char **)key_p = gen->entry->key;
+    if (value_p != NIL(int)) {
+   	*value_p = (int) (long) gen->entry->record;
+    }
+    gen->entry = gen->entry->next;
+    return 1;
+
+} /* st_gen_int */
+
+
+/**Function********************************************************************
+
+  Synopsis    [Reclaims the resources associated with `gen'.]
+
+  Description [After generating all items in a generation sequence,
+  this routine must be called to reclaim the resources associated with
+  `gen'.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_init_gen]
+
+******************************************************************************/
+void
+st_free_gen(st_generator *gen)
+{
+    FREE(gen);
+
+} /* st_free_gen */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis    [Rehashes a symbol table.]
+
+  Description [Rehashes a symbol table.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_insert]
+
+******************************************************************************/
+static int
+rehash(st_table *table)
+{
+    st_table_entry *ptr, *next, **old_bins;
+    int             i, old_num_bins, hash_val, old_num_entries;
+
+    /* save old values */
+    old_bins = table->bins;
+    old_num_bins = table->num_bins;
+    old_num_entries = table->num_entries;
+
+    /* rehash */
+    table->num_bins = (int) (table->grow_factor * old_num_bins);
+    if (table->num_bins % 2 == 0) {
+	table->num_bins += 1;
+    }
+    table->num_entries = 0;
+    table->bins = ALLOC(st_table_entry *, table->num_bins);
+    if (table->bins == NIL(st_table_entry *)) {
+	table->bins = old_bins;
+	table->num_bins = old_num_bins;
+	table->num_entries = old_num_entries;
+	return ST_OUT_OF_MEM;
+    }
+    /* initialize */
+    for (i = 0; i < table->num_bins; i++) {
+	table->bins[i] = 0;
+    }
+
+    /* copy data over */
+    for (i = 0; i < old_num_bins; i++) {
+	ptr = old_bins[i];
+	while (ptr != NIL(st_table_entry)) {
+	    next = ptr->next;
+	    hash_val = do_hash(ptr->key, table);
+	    ptr->next = table->bins[hash_val];
+	    table->bins[hash_val] = ptr;
+	    table->num_entries++;
+	    ptr = next;
+	}
+    }
+    FREE(old_bins);
+
+    return 1;
+
+} /* rehash */
Index: /vis_dev/glu-2.1/src/st/st.h
===================================================================
--- /vis_dev/glu-2.1/src/st/st.h	(revision 6)
+++ /vis_dev/glu-2.1/src/st/st.h	(revision 6)
@@ -0,0 +1,232 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [st.h]
+
+  PackageName [st]
+
+  Synopsis    [Symbol table package.]
+
+  Description [The st library provides functions to create, maintain,
+  and query symbol tables.]
+
+  SeeAlso     []
+
+  Author      []
+
+  Copyright   []
+
+  Revision    [$Id: st.h,v 1.4 2005/04/13 05:02:20 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef ST_INCLUDED
+#define ST_INCLUDED
+
+/*---------------------------------------------------------------------------*/
+/* Nested includes                                                           */
+/*---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+#define ST_DEFAULT_MAX_DENSITY 5
+#define ST_DEFAULT_INIT_TABLE_SIZE 11
+#define ST_DEFAULT_GROW_FACTOR 2.0
+#define ST_DEFAULT_REORDER_FLAG 0
+#define ST_OUT_OF_MEM -10000
+
+/*---------------------------------------------------------------------------*/
+/* Stucture declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+typedef struct st_table_entry st_table_entry;
+struct st_table_entry {
+    char *key;
+    char *record;
+    st_table_entry *next;
+};
+
+typedef struct st_table st_table;
+struct st_table {
+    int (*compare)(const char *, const char *);
+    int (*hash)(char *, int);
+    int num_bins;
+    int num_entries;
+    int max_density;
+    int reorder_flag;
+    double grow_factor;
+    st_table_entry **bins;
+};
+
+typedef struct st_generator st_generator;
+struct st_generator {
+    st_table *table;
+    st_table_entry *entry;
+    int index;
+};
+
+enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
+
+typedef enum st_retval (*ST_PFSR)(char *, char *, char *);
+
+typedef int (*ST_PFICPCP)(const char *, const char *); /* type for comparison function */
+
+typedef int (*ST_PFICPI)(char *, int);     /* type for hash function */
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+/**Macro***********************************************************************
+
+  Synopsis    [Checks whethere `key' is in `table'.]
+
+  Description [Returns 1 if there is an entry under `key' in `table', 0
+  otherwise.]
+
+  SideEffects [None]
+
+  SeeAlso     [st_lookup]
+
+******************************************************************************/
+#define st_is_member(table,key) st_lookup(table,key,(char **) 0)
+
+
+/**Macro***********************************************************************
+
+  Synopsis    [Returns the number of entries in the table `table'.]
+
+  Description [Returns the number of entries in the table `table'.]
+
+  SideEffects [None]
+
+  SeeAlso     []
+
+******************************************************************************/
+#define st_count(table) ((table)->num_entries)
+
+
+/**Macro***********************************************************************
+
+  Synopsis    [Iteration macro.]
+
+  Description [An iteration macro which loops over all the entries in
+  `table', setting `key' to point to the key and `value' to the
+  associated value (if it is not nil). `gen' is a generator variable
+  used internally. Sample usage:
+  <pre>
+     	char *key, *value;
+  </pre>
+  <pre>
+	st_generator *gen;
+  </pre>
+  <pre>
+
+	st_foreach_item(table, gen, &key, &value) {
+  </pre>
+  <pre>
+	    process_item(value);
+  </pre>
+  <pre>
+	}
+  </pre>
+  ]
+
+  SideEffects [None]
+
+  SeeAlso     [st_foreach_item_int st_foreach]
+
+******************************************************************************/
+#define st_foreach_item(table, gen, key, value) \
+    for(gen=st_init_gen(table); st_gen(gen,key,value) || (st_free_gen(gen),0);)
+
+
+/**Macro***********************************************************************
+
+  Synopsis    [Iteration macro.]
+
+  Description [An iteration macro which loops over all the entries in
+  `table', setting `key' to point to the key and `value' to the
+  associated value (if it is not nil). `value' is assumed to be a
+  pointer to an integer.  `gen' is a generator variable used
+  internally. Sample usage:
+  <pre>
+     	char *key;
+  </pre>
+  <pre>
+	int value;
+  </pre>
+  <pre>
+	st_generator *gen;
+  </pre>
+  <pre>
+
+	st_foreach_item_int(table, gen, &key, &value) {
+  </pre>
+  <pre>
+	    process_item(value);
+  </pre>
+  <pre>
+	}
+  </pre>
+  ]
+
+  SideEffects [None]
+
+  SeeAlso     [st_foreach_item st_foreach]
+
+******************************************************************************/
+#define st_foreach_item_int(table, gen, key, value) \
+    for(gen=st_init_gen(table); st_gen_int(gen,key,value) || (st_free_gen(gen),0);)
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+extern st_table *st_init_table_with_params (ST_PFICPCP, ST_PFICPI, int, int, double, int);
+extern st_table *st_init_table (ST_PFICPCP, ST_PFICPI); 
+extern void st_free_table (st_table *);
+extern int st_lookup (st_table *, void *, void *);
+extern int st_lookup_int (st_table *, void *, int *);
+extern int st_insert (st_table *, void *, void *);
+extern int st_add_direct (st_table *, void *, void *);
+extern int st_find_or_add (st_table *, void *, void *);
+extern int st_find (st_table *, void *, void *);
+extern st_table *st_copy (st_table *);
+extern int st_delete (st_table *, void *, void *);
+extern int st_delete_int (st_table *, void *, int *);
+extern int st_foreach (st_table *, ST_PFSR, char *);
+extern int st_strhash (char *, int);
+extern int st_numhash (char *, int);
+extern int st_ptrhash (char *, int);
+extern int st_numcmp (const char *, const char *);
+extern int st_ptrcmp (const char *, const char *);
+extern st_generator *st_init_gen (st_table *);
+extern int st_gen (st_generator *, void *, void *);
+extern int st_gen_int (st_generator *, void *, int *);
+extern void st_free_gen (st_generator *);
+
+/**AutomaticEnd***************************************************************/
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
+#endif /* ST_INCLUDED */
Index: /vis_dev/glu-2.1/src/st/st.make
===================================================================
--- /vis_dev/glu-2.1/src/st/st.make	(revision 6)
+++ /vis_dev/glu-2.1/src/st/st.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += st.c
+HEADERS += st.h
+MISC += st.doc
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/util/cpu_stats.c
===================================================================
--- /vis_dev/glu-2.1/src/util/cpu_stats.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/cpu_stats.c	(revision 6)
@@ -0,0 +1,105 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: cpu_stats.c,v 1.12 2005/05/16 16:25:24 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+#include <stdio.h>
+#include "util.h"
+
+
+#include <sys/types.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#  include <sys/resource.h>
+#endif
+
+#if defined(_IBMR2)
+#define etext _etext
+#define edata _edata
+#define end _end
+#endif
+
+#ifndef __CYGWIN32__
+extern int end, etext, edata;
+#endif
+
+void
+util_print_cpu_stats(FILE *fp)
+{
+#if HAVE_SYS_RESOURCE_H && !defined(__CYGWIN32__)
+    struct rusage rusage;
+#ifdef RLIMIT_DATA
+    struct rlimit rlp;
+    long vm_limit, vm_soft_limit;
+#endif
+    long text, data;
+    double user, system, scale;
+    char hostname[257];
+    long vm_text, vm_init_data, vm_uninit_data, vm_sbrk_data;
+
+    /* Get the hostname */
+    (void) gethostname(hostname, 256);
+    hostname[256] = '\0';		/* just in case */
+
+    /* Get the virtual memory sizes */
+    vm_text = (long) (((long) (&etext)) / 1024.0 + 0.5);
+    vm_init_data = (long) (((&edata) - (&etext)) / 1024.0 + 0.5);
+    vm_uninit_data = (long) (((&end) - (&edata)) / 1024.0 + 0.5);
+    vm_sbrk_data = (long) ((sizeof(char) * ((char *) sbrk(0) - (char *) (&end))) / 1024.0 + 0.5); 
+
+    /* Get virtual memory limits */
+#ifdef RLIMIT_DATA /* In HP-UX, with cc, this constant does not exist */
+    (void) getrlimit(RLIMIT_DATA, &rlp);
+    vm_limit = (long) (rlp.rlim_max / 1024.0 + 0.5);
+    vm_soft_limit = (long) (rlp.rlim_cur / 1024.0 + 0.5);
+#endif
+
+    /* Get usage stats */
+    (void) getrusage(RUSAGE_SELF, &rusage);
+    user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec/1.0e6;
+    system = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec/1.0e6;
+    scale = (user + system)*100.0;
+    if (scale == 0.0) scale = 0.001;
+
+    (void) fprintf(fp, "Runtime Statistics\n");
+    (void) fprintf(fp, "------------------\n");
+    (void) fprintf(fp, "Machine name: %s\n", hostname);
+    (void) fprintf(fp, "User time   %6.1f seconds\n", user);
+    (void) fprintf(fp, "System time %6.1f seconds\n\n", system);
+
+    text = (long) (rusage.ru_ixrss / scale + 0.5);
+    data = (long) ((rusage.ru_idrss + rusage.ru_isrss) / scale + 0.5);
+    (void) fprintf(fp, "Average resident text size       = %5ldK\n", text);
+    (void) fprintf(fp, "Average resident data+stack size = %5ldK\n", data);
+    (void) fprintf(fp, "Maximum resident size            = %5ldK\n\n", 
+	rusage.ru_maxrss/2);
+    (void) fprintf(fp, "Virtual text size                = %5ldK\n", 
+	vm_text);
+    (void) fprintf(fp, "Virtual data size                = %5ldK\n", 
+	vm_init_data + vm_uninit_data + vm_sbrk_data);
+    (void) fprintf(fp, "    data size initialized        = %5ldK\n", 
+	vm_init_data);
+    (void) fprintf(fp, "    data size uninitialized      = %5ldK\n", 
+	vm_uninit_data);
+    (void) fprintf(fp, "    data size sbrk               = %5ldK\n", 
+	vm_sbrk_data);
+    /* In some platforms, this constant does not exist */
+#ifdef RLIMIT_DATA 
+    (void) fprintf(fp, "Virtual memory limit             = %5ldK (%ldK)\n\n", 
+	vm_soft_limit, vm_limit);
+#endif
+    (void) fprintf(fp, "Major page faults = %ld\n", rusage.ru_majflt);
+    (void) fprintf(fp, "Minor page faults = %ld\n", rusage.ru_minflt);
+    (void) fprintf(fp, "Swaps = %ld\n", rusage.ru_nswap);
+    (void) fprintf(fp, "Input blocks = %ld\n", rusage.ru_inblock);
+    (void) fprintf(fp, "Output blocks = %ld\n", rusage.ru_oublock);
+    (void) fprintf(fp, "Context switch (voluntary) = %ld\n", rusage.ru_nvcsw);
+    (void) fprintf(fp, "Context switch (involuntary) = %ld\n", rusage.ru_nivcsw);
+#else /* Do not have sys/resource.h */
+    (void) fprintf(fp, "Usage statistics not available\n");
+#endif
+}
+
Index: /vis_dev/glu-2.1/src/util/cpu_time.c
===================================================================
--- /vis_dev/glu-2.1/src/util/cpu_time.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/cpu_time.c	(revision 6)
@@ -0,0 +1,189 @@
+/**CFile***********************************************************************
+
+  FileName    [ cpu_time.c ]
+
+  PackageName [ util ]
+
+  Synopsis    [ System time calls ]
+
+  Description [ The problem is that all unix systems have a different notion
+		of how fast time goes (i.e., the units returned by).  This
+		returns a consistent result. ]
+
+  Author      [ Stephen Edwards <sedwards@eecs.berkeley.edu> and others ]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+******************************************************************************/
+
+#include "util.h"
+
+#if HAVE_SYS_TYPES_H
+#  include<sys/types.h>
+#endif
+
+#if HAVE_SYS_TIMES_H
+#  include<sys/times.h>
+#endif
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+/**Function********************************************************************
+
+  Synopsis           [ Return elapsed time in milliseconds ]
+
+  Description        [ Return a long which represents the elapsed time in
+		       milliseconds since some constant reference. <P>
+
+		       There are two possibilities:
+		       <OL>
+		       <LI> The system is non-POSIX compliant, so unistd.h
+		            and hence sysconf() can't tell us the clock tick
+			    speed.  At this point, we have to resort to
+			    using the user-settable CLOCK_RESOLUTION definition
+			    to get the right speed
+		       <LI> The system is POSIX-compliant.  unistd.h gives
+		            us sysconf(), which tells us the clock rate.
+		       </OL>
+ ]
+
+  SideEffects        [ none ]
+
+******************************************************************************/
+long 
+util_cpu_time(void)
+{
+    long t = 0;
+
+#if HAVE_SYSCONF == 1
+
+    /* Code for POSIX systems */
+
+    struct tms buffer;
+    long nticks;                /* number of clock ticks per second */
+
+    nticks = sysconf(_SC_CLK_TCK);
+    times(&buffer);
+    t = (long) (buffer.tms_utime * (1000.0/nticks));
+
+#else
+#  ifndef vms
+
+    /* Code for non-POSIX systems */
+
+    struct tms buffer;
+
+    time(&buffer);
+    t = buffer.tms_utime * 1000.0 / CLOCK_RESOLUTION;
+
+#  else
+
+    /* Code for VMS (?) */
+
+    struct {int p1, p2, p3, p4;} buffer;
+    static long ref_time;
+    times(&buffer);
+    t = buffer.p1 * 10;
+    if (ref_time == 0)
+      ref_time = t;
+    t = t - ref_time;
+
+#  endif /* vms */
+#endif /* _POSIX_VERSION */
+
+    return t;
+}
+
+/**Function********************************************************************
+
+  Synopsis           [ Return elapsed time in milliseconds. It includes waited-
+                       for terminated children. ]
+
+  Description        [ Return a long which represents the elapsed time in
+		       milliseconds since some constant reference. This time
+                       includes the CPU time spent executing instructions of
+		       the calling process and the time this process waited
+		       for its children to be terminated<P>
+
+		       There are two possibilities:
+		       <OL>
+		       <LI> The system is non-POSIX compliant, so unistd.h
+		            and hence sysconf() can't tell us the clock tick
+			    speed.  At this point, we have to resort to
+			    using the user-settable CLOCK_RESOLUTION definition
+			    to get the right speed
+		       <LI> The system is POSIX-compliant.  unistd.h gives
+		            us sysconf(), which tells us the clock rate.
+		       </OL>
+ ]
+
+  SideEffects        [ none ]
+
+******************************************************************************/
+long 
+util_cpu_ctime(void)
+{
+    long t = 0;
+
+#if HAVE_SYSCONF == 1
+
+    /* Code for POSIX systems */
+
+    struct tms buffer;
+    long nticks;                /* number of clock ticks per second */
+
+    nticks = sysconf(_SC_CLK_TCK);
+    times(&buffer);
+    t = (long) ((buffer.tms_utime + buffer.tms_cutime) * (1000.0/nticks));
+
+#else
+#  ifndef vms
+
+    /* Code for non-POSIX systems */
+
+    struct tms buffer;
+
+    time(&buffer);
+    t = (buffer.tms_utime + buffer.tms_cutime) * 1000.0 / CLOCK_RESOLUTION;
+
+#  else
+
+    /* Code for VMS (?) */
+
+    struct {int p1, p2, p3, p4;} buffer;
+    static long ref_time;
+    times(&buffer);
+    t = (buffer.p1 + buffer.p3) * 10;
+    if (ref_time == 0)
+      ref_time = t;
+    t = t - ref_time;
+
+#  endif /* vms */
+#endif /* _POSIX_VERSION */
+
+    return t;
+}
+
Index: /vis_dev/glu-2.1/src/util/datalimit.c
===================================================================
--- /vis_dev/glu-2.1/src/util/datalimit.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/datalimit.c	(revision 6)
@@ -0,0 +1,95 @@
+/**CFile************************************************************************
+
+  FileName    [datalimit.c]
+
+  PackageName [util]
+
+  Synopsis [Routine to obtain the maximum data size available to a program. The
+  routine is based on "getrlimit". If the system does not have this function,
+  the default value RLIMIT_DATA_DEFAULT is assumed. This function provides an
+  informative value, it does not restrict the size of the program in any way.]
+
+  Author      [Fabio Somenzi <fabio@colorado.edu>]
+
+  Copyright   [This file was created at the University of Colorado at
+  Boulder.  The University of Colorado at Boulder makes no warranty
+  about the suitability of this software for any purpose.  It is
+  presented on an AS IS basis.]
+
+******************************************************************************/
+
+#include "util.h"
+
+static char rcsid[] UNUSED = "$Id: datalimit.c,v 1.5 2003/08/01 15:42:30 fabio Exp $";
+
+#if HAVE_SYS_RESOURCE_H
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+#ifndef RLIMIT_DATA_DEFAULT
+#define RLIMIT_DATA_DEFAULT 67108864	/* assume 64MB by default */
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis           [Function that computes the data limit of the process.]
+
+  SideEffects        []
+
+******************************************************************************/
+long
+getSoftDataLimit(void)
+{
+#if HAVE_SYS_RESOURCE_H && HAVE_GETRLIMIT && defined(RLIMIT_DATA)
+    struct rlimit rl;
+    int result;
+
+    result = getrlimit(RLIMIT_DATA, &rl);
+    if (result != 0 || rl.rlim_cur == RLIM_INFINITY)
+	return((long) RLIMIT_DATA_DEFAULT);
+    else
+	return((long) rl.rlim_cur);
+#else
+    return((long) RLIMIT_DATA_DEFAULT);
+#endif
+
+} /* end of getSoftDataLimit */
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
Index: /vis_dev/glu-2.1/src/util/getopt.c
===================================================================
--- /vis_dev/glu-2.1/src/util/getopt.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/getopt.c	(revision 6)
@@ -0,0 +1,78 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: getopt.c,v 1.4 2002/09/10 00:04:35 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+#include <stdio.h>
+#include "util.h"
+
+
+/*  File   : getopt.c
+ *  Author : Henry Spencer, University of Toronto
+ *  Updated: 28 April 1984
+ *
+ *  Changes: (R Rudell)
+ *	changed index() to strchr();
+ *	added getopt_reset() to reset the getopt argument parsing
+ *
+ *  Purpose: get option letter from argv.
+ */
+
+char *util_optarg;	/* Global argument pointer. */
+int util_optind = 0;	/* Global argv index. */
+static char *scan;
+
+
+void
+util_getopt_reset(void)
+{
+    util_optarg = 0;
+    util_optind = 0;
+    scan = 0;
+}
+
+
+
+int 
+util_getopt(int argc, char *argv[], char *optstring)
+{
+    register int c;
+    register char *place;
+
+    util_optarg = NIL(char);
+
+    if (scan == NIL(char) || *scan == '\0') {
+	if (util_optind == 0) util_optind++;
+	if (util_optind >= argc) return EOF;
+	place = argv[util_optind];
+	if (place[0] != '-' || place[1] == '\0') return EOF;
+	util_optind++;
+	if (place[1] == '-' && place[2] == '\0') return EOF;
+	scan = place+1;
+    }
+
+    c = *scan++;
+    place = strchr(optstring, c);
+    if (place == NIL(char) || c == ':') {
+	(void) fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
+	return '?';
+    }
+    if (*++place == ':') {
+	if (*scan != '\0') {
+	    util_optarg = scan;
+	    scan = NIL(char);
+	} else {
+	    if (util_optind >= argc) {
+		(void) fprintf(stderr, "%s: %c requires an argument\n", 
+		    argv[0], c);
+		return '?';
+	    }
+	    util_optarg = argv[util_optind];
+	    util_optind++;
+	}
+    }
+    return c;
+}
Index: /vis_dev/glu-2.1/src/util/pathsearch.c
===================================================================
--- /vis_dev/glu-2.1/src/util/pathsearch.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/pathsearch.c	(revision 6)
@@ -0,0 +1,124 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: pathsearch.c,v 1.7 2005/04/30 22:38:11 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+#if HAVE_SYS_FILE_H
+#  include <sys/file.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+#  include <sys/stat.h>
+#endif
+
+#include "util.h"
+
+/**Function********************************************************************
+
+  Synopsis           [ Check that a given file is present and accessible ]
+
+  SideEffects        [none]
+******************************************************************************/
+int
+util_check_file(char *filename, char *mode)
+{
+#if defined(HAVE_SYS_STAT_H)
+    struct stat stat_rec;
+    int access_char = mode[0];
+    int access_mode = R_OK;
+
+    /* First check that the file is a regular file. */
+
+    if (stat(filename,&stat_rec) == 0 && S_ISREG(stat_rec.st_mode)) {
+	if (access_char == 'w') {
+	    access_mode = W_OK;
+	} else if (access_char == 'x') {
+	    access_mode = X_OK;
+	}
+	return access(filename,access_mode) == 0;
+    }
+    return 0;
+
+#else
+
+    FILE *fp;
+    int got_file;
+
+    if (strcmp(mode, "x") == 0) {
+	mode = "r";
+    }
+    fp = fopen(filename, mode);
+    got_file = (fp != 0);
+    if (fp != 0) {
+	(void) fclose(fp);
+    }
+    return got_file;
+
+#endif
+}
+
+/**Function********************************************************************
+
+  Synopsis           [ Search for a program in all possible paths ]
+
+  SideEffects        [none]
+
+******************************************************************************/
+char *
+util_path_search(char *prog)
+{
+#ifdef HAVE_GETENV
+    return util_file_search(prog, getenv("PATH"), "x");
+#else
+    return util_file_search(prog, NIL(char), "x");
+#endif
+}
+
+char *
+util_file_search(
+  char *file	/* file we're looking for */,
+  char *path	/* search path, colon separated */,
+  char *mode	/* "r", "w", or "x" */)
+{
+    int quit;
+    char *buffer, *filename, *save_path, *cp;
+
+    if (path == 0 || strcmp(path, "") == 0) {
+	path = ".";		/* just look in the current directory */
+    }
+
+    save_path = path = util_strsav(path);
+    quit = 0;
+    do {
+	cp = strchr(path, ':');
+	if (cp != 0) {
+	    *cp = '\0';
+	} else {
+	    quit = 1;
+	}
+
+	/* cons up the filename out of the path and file name */
+	if (strcmp(path, ".") == 0) {
+	    buffer = util_strsav(file);
+	} else {
+	    buffer = ALLOC(char, strlen(path) + strlen(file) + 4);
+	    (void) sprintf(buffer, "%s/%s", path, file);
+	}
+	filename = util_tilde_expand(buffer);
+	FREE(buffer);
+
+	/* see if we can access it */
+	if (util_check_file(filename, mode)) {
+	    FREE(save_path);
+	    return filename;
+	}
+	FREE(filename);
+	path = ++cp;
+    } while (! quit); 
+
+    FREE(save_path);
+    return 0;
+}
Index: /vis_dev/glu-2.1/src/util/prtime.c
===================================================================
--- /vis_dev/glu-2.1/src/util/prtime.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/prtime.c	(revision 6)
@@ -0,0 +1,27 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: prtime.c,v 1.3 2002/08/25 02:37:11 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+#include <stdio.h>
+#include "util.h"
+
+
+/*
+ *  util_print_time -- massage a long which represents a time interval in
+ *  milliseconds, into a string suitable for output 
+ *
+ *  Hack for IBM/PC -- avoids using floating point
+ */
+
+char *
+util_print_time(long t)
+{
+    static char s[40];
+
+    (void) sprintf(s, "%ld.%02ld sec", t/1000, (t%1000)/10);
+    return s;
+}
Index: /vis_dev/glu-2.1/src/util/qsort.c
===================================================================
--- /vis_dev/glu-2.1/src/util/qsort.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/qsort.c	(revision 6)
@@ -0,0 +1,251 @@
+/**CFile***********************************************************************
+
+  FileName    [qsort.c]
+
+  PackageName [util]
+
+  Synopsis    [Our own qsort routine.]
+
+  Author      []
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+******************************************************************************/
+
+#include "util.h"
+
+#ifndef lint
+static char rcsid[] UNUSED = "$Id: qsort.c,v 1.5 2002/08/25 05:30:13 fabio Exp $";
+#endif
+
+#define		THRESH		4		/* threshold for insertion */
+#define		MTHRESH		6		/* threshold for median */
+
+static  int		(*qcmp)(const void *, const void *);
+						/* the comparison routine */
+static  int		qsz;			/* size of each record */
+static  int		thresh;			/* THRESHold in chars */
+static  int		mthresh;		/* MTHRESHold in chars */
+static	void		qst ARGS((char *base, char *max));
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+#undef min
+#undef max
+/**Function********************************************************************
+
+  Synopsis           [Own version of the system qsort routine.]
+
+  Description [The THRESHold below is the insertion sort threshold, and has
+  been adjusted for records of size 48 bytes.  The MTHREShold is where we stop
+  finding a better median. First, set up some global parameters for qst to
+  share.  Then, quicksort with qst(), and then a cleanup insertion sort
+  ourselves.  Sound simple?  It's not...]
+
+  SideEffects        []
+
+  SeeAlso            [qst]
+
+******************************************************************************/
+void
+qsort(
+  void *vbase,
+  size_t n,
+  size_t size,
+  int (*compar)(const void *, const void *))
+{
+	register char c, *i, *j, *lo, *hi;
+	char *min, *max, *base;
+
+	if (n <= 1)
+		return;
+	base = (char *) vbase;
+	qsz = size;
+	qcmp = compar;
+	thresh = qsz * THRESH;
+	mthresh = qsz * MTHRESH;
+	max = base + n * qsz;
+	if (n >= THRESH) {
+		qst(base, max);
+		hi = base + thresh;
+	} else {
+		hi = max;
+	}
+	/*
+	 * First put smallest element, which must be in the first THRESH, in
+	 * the first position as a sentinel.  This is done just by searching
+	 * the first THRESH elements (or the first n if n < THRESH), finding
+	 * the min, and swapping it into the first position.
+	 */
+	for (j = lo = base; (lo += qsz) < hi; )
+		if ((*qcmp)(j, lo) > 0)
+			j = lo;
+	if (j != base) {
+		/* swap j into place */
+		for (i = base, hi = base + qsz; i < hi; ) {
+			c = *j;
+			*j++ = *i;
+			*i++ = c;
+		}
+	}
+	/*
+	 * With our sentinel in place, we now run the following hyper-fast
+	 * insertion sort. For each remaining element, min, from [1] to [n-1],
+	 * set hi to the index of the element AFTER which this one goes.
+	 * Then, do the standard insertion sort shift on a character at a time
+	 * basis for each element in the frob.
+	 */
+	for (min = base; (hi = min += qsz) < max; ) {
+		while ((*qcmp)(hi -= qsz, min) > 0)
+			/* void */;
+		if ((hi += qsz) != min) {
+			for (lo = min + qsz; --lo >= min; ) {
+				c = *lo;
+				for (i = j = lo; (j -= qsz) >= hi; i = j)
+					*i = *j;
+				*i = c;
+			}
+		}
+	}
+}
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+/**Function********************************************************************
+
+  Synopsis           [Effectively perform qsort]
+
+  Description [First, find the median element, and put that one in the first
+  place as the discriminator.  (This "median" is just the median of the first,
+  last and middle elements).  (Using this median instead of the first element
+  is a big win).  Then, the usual partitioning/swapping, followed by moving the
+  discriminator into the right place.  Then, figure out the sizes of the two
+  partions, do the smaller one recursively and the larger one via a repeat of
+  this code.  Stopping when there are less than THRESH elements in a partition
+  and cleaning up with an insertion sort (in our caller) is a huge win.  All
+  data swaps are done in-line, which is space-losing but time-saving.  (And
+  there are only three places where this is done).]
+
+  SideEffects        []
+
+  SeeAlso            [qsort]
+
+******************************************************************************/
+static void
+qst(char *base, char *max)
+{
+	register char c, *i, *j, *jj;
+	register int ii;
+	char *mid, *tmp;
+	int lo, hi;
+
+	/*
+	 * At the top here, lo is the number of characters of elements in the
+	 * current partition.  (Which should be max - base).
+	 * Find the median of the first, last, and middle element and make
+	 * that the middle element.  Set j to largest of first and middle.
+	 * If max is larger than that guy, then it's that guy, else compare
+	 * max with loser of first and take larger.  Things are set up to
+	 * prefer the middle, then the first in case of ties.
+	 */
+	lo = max - base;		/* number of elements as chars */
+	do	{
+		mid = i = base + qsz * ((lo / qsz) >> 1);
+		if (lo >= mthresh) {
+			j = ((*qcmp)((jj = base), i) > 0 ? jj : i);
+			if ((*qcmp)(j, (tmp = max - qsz)) > 0) {
+				/* switch to first loser */
+				j = (j == jj ? i : jj);
+				if ((*qcmp)(j, tmp) < 0)
+					j = tmp;
+			}
+			if (j != i) {
+				ii = qsz;
+				do	{
+					c = *i;
+					*i++ = *j;
+					*j++ = c;
+				} while (--ii);
+			}
+		}
+		/*
+		 * Semi-standard quicksort partitioning/swapping
+		 */
+		for (i = base, j = max - qsz; ; ) {
+			while (i < mid && (*qcmp)(i, mid) <= 0)
+				i += qsz;
+			while (j > mid) {
+				if ((*qcmp)(mid, j) <= 0) {
+					j -= qsz;
+					continue;
+				}
+				tmp = i + qsz;	/* value of i after swap */
+				if (i == mid) {
+					/* j <-> mid, new mid is j */
+					mid = jj = j;
+				} else {
+					/* i <-> j */
+					jj = j;
+					j -= qsz;
+				}
+				goto swap;
+			}
+			if (i == mid) {
+				break;
+			} else {
+				/* i <-> mid, new mid is i */
+				jj = mid;
+				tmp = mid = i;	/* value of i after swap */
+				j -= qsz;
+			}
+		swap:
+			ii = qsz;
+			do	{
+				c = *i;
+				*i++ = *jj;
+				*jj++ = c;
+			} while (--ii);
+			i = tmp;
+		}
+		/*
+		 * Look at sizes of the two partitions, do the smaller
+		 * one first by recursion, then do the larger one by
+		 * making sure lo is its size, base and max are update
+		 * correctly, and branching back.  But only repeat
+		 * (recursively or by branching) if the partition is
+		 * of at least size THRESH.
+		 */
+		i = (j = mid) + qsz;
+		if ((lo = j - base) <= (hi = max - i)) {
+			if (lo >= thresh)
+				qst(base, j);
+			base = i;
+			lo = hi;
+		} else {
+			if (hi >= thresh)
+				qst(i, max);
+			max = j;
+		}
+	} while (lo >= thresh);
+}
Index: /vis_dev/glu-2.1/src/util/random.c
===================================================================
--- /vis_dev/glu-2.1/src/util/random.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/random.c	(revision 6)
@@ -0,0 +1,198 @@
+/**CFile***********************************************************************
+
+  FileName    [random.c]
+
+  PackageName [util]
+
+  Synopsis    [Our own portable random number generator.]
+
+  Author      [Fabio Somenzi <Fabio@Colorado.EDU>]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  \"AS IS\" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+******************************************************************************/
+
+#include "util.h" 
+
+static char rcsid[] UNUSED = "$Id: random.c,v 1.4 2002/09/10 00:05:33 fabio Exp $";
+
+/*---------------------------------------------------------------------------*/
+/* Constant declarations                                                     */
+/*---------------------------------------------------------------------------*/
+
+/* Random generator constants. */
+#define MODULUS1 2147483563
+#define LEQA1 40014
+#define LEQQ1 53668
+#define LEQR1 12211
+#define MODULUS2 2147483399
+#define LEQA2 40692
+#define LEQQ2 52774
+#define LEQR2 3791
+#define STAB_SIZE 64
+#define STAB_DIV (1 + (MODULUS1 - 1) / STAB_SIZE)
+
+/*---------------------------------------------------------------------------*/
+/* Type declarations                                                         */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Structure declarations                                                    */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Variable declarations                                                     */
+/*---------------------------------------------------------------------------*/
+static long utilRand = 0;
+static long utilRand2;
+static long shuffleSelect;
+static long shuffleTable[STAB_SIZE];
+
+/*---------------------------------------------------------------------------*/
+/* Macro declarations                                                        */
+/*---------------------------------------------------------------------------*/
+
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Static function prototypes                                                */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of exported functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/**Function********************************************************************
+
+  Synopsis    [Initializer for the portable random number generator.]
+
+  Description [Initializer for the portable number generator based on
+  ran2 in "Numerical Recipes in C." The input is the seed for the
+  generator. If it is negative, its absolute value is taken as seed.
+  If it is 0, then 1 is taken as seed. The initialized sets up the two
+  recurrences used to generate a long-period stream, and sets up the
+  shuffle table.]
+
+  SideEffects [None]
+
+  SeeAlso     [util_random]
+
+******************************************************************************/
+void
+util_srandom(long seed)
+{
+    int i;
+
+    if (seed < 0)       utilRand = -seed;
+    else if (seed == 0) utilRand = 1;
+    else                utilRand = seed;
+    utilRand2 = utilRand;
+    /* Load the shuffle table (after 11 warm-ups). */
+    for (i = 0; i < STAB_SIZE + 11; i++) {
+	long int w;
+	w = utilRand / LEQQ1;
+	utilRand = LEQA1 * (utilRand - w * LEQQ1) - w * LEQR1;
+	utilRand += (utilRand < 0) * MODULUS1;
+	shuffleTable[i % STAB_SIZE] = utilRand;
+    }
+    shuffleSelect = shuffleTable[1 % STAB_SIZE];
+} /* end of util_srandom */
+
+/**Function********************************************************************
+
+  Synopsis    [Portable random number generator.]
+
+  Description [Portable number generator based on ran2 from "Numerical
+  Recipes in C." It is a long period (> 2 * 10^18) random number generator
+  of L'Ecuyer with Bays-Durham shuffle. Returns a long integer uniformly
+  distributed between 0 and 2147483561 (inclusive of the endpoint values).
+  The random generator can be explicitly initialized by calling
+  util_srandom. If no explicit initialization is performed, then the
+  seed 1 is assumed.]
+
+  SideEffects []
+
+  SeeAlso     [util_srandom]
+
+******************************************************************************/
+long
+util_random(void)
+{
+    int i;	/* index in the shuffle table */
+    long int w; /* work variable */
+
+    /* utilRand == 0 if the geneartor has not been initialized yet. */
+    if (utilRand == 0) util_srandom(1);
+
+    /* Compute utilRand = (utilRand * LEQA1) % MODULUS1 avoiding
+    ** overflows by Schrage's method.
+    */
+    w          = utilRand / LEQQ1;
+    utilRand   = LEQA1 * (utilRand - w * LEQQ1) - w * LEQR1;
+    utilRand  += (utilRand < 0) * MODULUS1;
+
+    /* Compute utilRand2 = (utilRand2 * LEQA2) % MODULUS2 avoiding
+    ** overflows by Schrage's method.
+    */
+    w          = utilRand2 / LEQQ2;
+    utilRand2  = LEQA2 * (utilRand2 - w * LEQQ2) - w * LEQR2;
+    utilRand2 += (utilRand2 < 0) * MODULUS2;
+
+    /* utilRand is shuffled with the Bays-Durham algorithm.
+    ** shuffleSelect and utilRand2 are combined to generate the output.
+    */
+
+    /* Pick one element from the shuffle table; "i" will be in the range
+    ** from 0 to STAB_SIZE-1.
+    */
+    i = shuffleSelect / STAB_DIV;
+    /* Mix the element of the shuffle table with the current iterate of
+    ** the second sub-generator, and replace the chosen element of the
+    ** shuffle table with the current iterate of the first sub-generator.
+    */
+    shuffleSelect   = shuffleTable[i] - utilRand2;
+    shuffleTable[i] = utilRand;
+    shuffleSelect  += (shuffleSelect < 1) * (MODULUS1 - 1);
+    /* Since shuffleSelect != 0, and we want to be able to return 0,
+    ** here we subtract 1 before returning.
+    */
+    return(shuffleSelect - 1);
+
+} /* end of util_random */
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of internal functions                                          */
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+/* Definition of static functions                                            */
+/*---------------------------------------------------------------------------*/
+
+
+
Index: /vis_dev/glu-2.1/src/util/safe_mem.c
===================================================================
--- /vis_dev/glu-2.1/src/util/safe_mem.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/safe_mem.c	(revision 6)
@@ -0,0 +1,89 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: safe_mem.c,v 1.7 2002/09/14 22:59:31 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+#include "util.h"
+
+/*
+ *  These are interface routines to be placed between a program and the
+ *  system memory allocator.  
+ *
+ *  It forces well-defined semantics for several 'borderline' cases:
+ *
+ *	malloc() of a 0 size object is guaranteed to return something
+ *	    which is not 0, and can safely be freed (but not dereferenced)
+ *	free() accepts (silently) an 0 pointer
+ *	realloc of a 0 pointer is allowed, and is equiv. to malloc()
+ *	For the IBM/PC it forces no object > 64K; note that the size argument
+ *	    to malloc/realloc is a 'long' to catch this condition
+ *
+ *  The function pointer MMoutOfMemory() contains a vector to handle a
+ *  'out-of-memory' error (which, by default, points at a simple wrap-up 
+ *  and exit routine).
+ */
+
+void (*MMoutOfMemory)(unsigned long) = MMout_of_memory;
+
+
+/* MMout_of_memory -- out of memory for lazy people, flush and exit */
+void
+MMout_of_memory(unsigned long size)
+{
+  (void) fflush(stdout);
+  (void) fprintf(stderr, "\nout of memory allocating %lu bytes\n", size);
+  exit(1);
+}
+
+
+void *
+MMalloc(unsigned long size)
+{
+  void *p;
+
+#ifdef IBMPC
+  if (size > 65000L) {
+    if (MMoutOfMemory != (void (*)(unsigned long)) 0) (*MMoutOfMemory)(size);
+    return NIL(void);
+  }
+#endif
+  if (size == 0) size = sizeof(long);
+  if ((p = malloc(size)) == NIL(void)) {
+    if (MMoutOfMemory != (void (*)(unsigned long)) 0) (*MMoutOfMemory)(size);
+    return NIL(void);
+  }
+  return p;
+}
+
+
+void *
+MMrealloc(void *obj, unsigned long size)
+{
+  void *p;
+
+#ifdef IBMPC
+  if (size > 65000L) {
+    if (MMoutOfMemory != (void (*)(unsigned long)) 0) (*MMoutOfMemory)(size);
+    return NIL(void);
+  }
+#endif
+  if (obj == NIL(void)) return MMalloc(size);
+  if (size <= 0) size = sizeof(long);
+  if ((p = realloc(obj, size)) == NIL(void)) {
+    if (MMoutOfMemory != (void (*)(unsigned long)) 0) (*MMoutOfMemory)(size);
+    return NIL(void);
+  }
+  return p;
+}
+
+
+void
+MMfree(void *obj)
+{
+  if (obj != 0) {
+    free(obj);
+  }
+}
Index: /vis_dev/glu-2.1/src/util/strsav.c
===================================================================
--- /vis_dev/glu-2.1/src/util/strsav.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/strsav.c	(revision 6)
@@ -0,0 +1,151 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: strsav.c,v 1.6 2002/08/27 07:47:03 fabio Exp $
+ *
+ */
+/* LINTLIBRARY */
+
+#include <stdio.h>
+#include "util.h"
+
+
+/*
+ *  util_strsav -- save a copy of a string
+ */
+char *
+util_strsav(char *s)
+{
+    if(s == NIL(char)) {  /* added 7/95, for robustness */
+       return s;
+    }
+    else {
+       return strcpy(ALLOC(char, strlen(s)+1), s);
+    }
+}
+
+/*
+ * util_inttostr -- converts an integer into a string
+ */
+char *
+util_inttostr(int i)
+{
+  unsigned int mod, len;
+  char *s;
+  
+  if (i == 0)
+    len = 1;
+  else {
+    if (i < 0) {
+      len = 1;
+      mod = -i;
+    }
+    else {
+      len = 0;
+      mod = i;
+    }
+    len += (unsigned) floor(log10(mod)) + 1;
+  }
+
+  s = ALLOC(char, len + 1);
+  sprintf(s, "%d", i);
+  
+  return s;
+}
+
+/*
+ * util_strcat3 -- Creates a new string which is the concatenation of 3
+ *    strings. It is the responsibility of the caller to free this string
+ *    using FREE.
+ */
+char *
+util_strcat3(
+  char * str1,
+  char * str2,
+  char * str3)
+{
+  char *str = ALLOC(char, strlen(str1) + strlen(str2) + strlen(str3) + 1);
+  
+  (void) strcpy(str, str1);
+  (void) strcat(str, str2);
+  (void) strcat(str, str3);
+
+  return (str);
+}
+
+/*
+ * util_strcat4 -- Creates a new string which is the concatenation of 4
+ *    strings. It is the responsibility of the caller to free this string
+ *    using FREE.
+ */
+char *
+util_strcat4(
+  char * str1,
+  char * str2,
+  char * str3,
+  char * str4)
+{
+  char *str = ALLOC(char, strlen(str1) + strlen(str2) + strlen(str3) +
+                    strlen(str4) + 1);
+  
+  (void) strcpy(str, str1);
+  (void) strcat(str, str2);
+  (void) strcat(str, str3);
+  (void) strcat(str, str4);
+
+  return (str);
+}
+
+
+#if !HAVE_STRSTR
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+char *
+strstr(
+  const char * s,
+  const char * pat)
+{
+  int len;
+
+  len = strlen(pat);
+  for (; *s != '\0'; ++s)
+    if (*s == *pat && memcmp(s, pat, len) ==  0) {
+      return (char *)s; /* UGH */
+    }
+  return NULL;
+}
+#endif /* !HAVE_STRSTR */
+
+#if !HAVE_STRCHR
+/**Function********************************************************************
+
+  Synopsis    [required]
+
+  Description [optional]
+
+  SideEffects [required]
+
+  SeeAlso     [optional]
+
+******************************************************************************/
+char *
+strchr(const char * s, int c)
+{
+   for (; *s != '\0'; s++) {
+     if (*s == c) {
+       return (char *)s;
+     }
+   }
+   return NULL;
+   
+}
+#endif /* !HAVE_STRCHR */
Index: /vis_dev/glu-2.1/src/util/texpand.c
===================================================================
--- /vis_dev/glu-2.1/src/util/texpand.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/texpand.c	(revision 6)
@@ -0,0 +1,62 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: texpand.c,v 1.3 2002/08/25 02:37:11 fabio Exp $
+ *
+ */
+
+#include "util.h"
+
+#if HAVE_PWD_H
+#  include <pwd.h>
+#endif
+
+
+char *
+util_tilde_expand(char *fname)
+{
+#if HAVE_PWD_H
+    struct passwd *userRecord;
+    char username[256], *filename, *dir;
+    register int i, j;
+
+    filename = ALLOC(char, strlen(fname) + 256);
+
+    /* Clear the return string */
+    i = 0;
+    filename[0] = '\0';
+
+    /* Tilde? */
+    if (fname[0] == '~') {
+	j = 0;
+	i = 1;
+	while ((fname[i] != '\0') && (fname[i] != '/')) {
+	    username[j++] = fname[i++];
+	}
+	username[j] = '\0';
+	dir = (char *)0;
+	if (username[0] == '\0') {
+	    /* ~/ resolves to home directory of current user */
+	    userRecord = getpwuid(getuid());
+	    if (userRecord) dir = userRecord->pw_dir;
+	} else {
+	    /* Special check for ~octtools */
+	    if (!strcmp(username,"octtools"))
+	        dir = getenv("OCTTOOLS");
+	    /* ~user/ resolves to home directory of 'user' */
+	    if (!dir) {
+	        userRecord = getpwnam(username);
+		if (userRecord) dir = userRecord->pw_dir;
+	    }
+	}
+	if (dir) (void) strcat(filename, dir);
+	else i = 0;	/* leave fname as-is */
+    } /* if tilde */
+
+    /* Concantenate remaining portion of file name */
+    (void) strcat(filename, fname + i);
+    return filename;
+#else
+    return util_strsav(fname);
+#endif
+}
Index: /vis_dev/glu-2.1/src/util/tmpfile.c
===================================================================
--- /vis_dev/glu-2.1/src/util/tmpfile.c	(revision 6)
+++ /vis_dev/glu-2.1/src/util/tmpfile.c	(revision 6)
@@ -0,0 +1,151 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: tmpfile.c,v 1.11 2005/04/30 22:38:11 fabio Exp $
+ *
+ */
+
+/*
+ *  util_tmpfile -- open an unnamed temporary file
+ *
+ *  Many compilers/systems do not have this, or have buggy versions.
+ *
+ */
+
+/* LINTLIBRARY */
+
+/* util_tempnam and check_directory are from
+   Jonathan I. Kamens          <jik@pit-manager.mit.edu> */
+
+/* modified slightly by Ellen Sentovich ellen@ic.berkeley.edu */
+
+#include <sys/types.h>
+#if HAVE_SYS_STAT_H
+#  include <sys/stat.h>
+#endif
+#if HAVE_SYS_FILE_H
+#  include <sys/file.h>
+#endif
+
+#include "util.h"
+
+static char check_directory(char *dir)
+{
+     struct stat statbuf;
+
+     if (! dir)
+         return 0;
+     else if (stat(dir, &statbuf) < 0)
+         return 0;
+     else if (S_ISDIR(statbuf.st_mode))
+         return 0;
+     else if (access(dir, W_OK | X_OK) < 0)
+         return 0;
+     else
+         return 1;
+}
+
+/* function for creating temporary filenames */
+char *util_tempnam(char *dir, char *pfx)
+{
+     extern char *getenv(const char *);
+     char *tmpdir = NULL, *env, *filename;
+     static char unique_letters[4] = "AAA";
+     char addslash = 0;
+
+     /*
+      * If a directory is passed in, verify that it exists and is a
+      * directory and is writeable by this process.  If no directory
+      * is passed in, or if the directory that is passed in does not
+      * exist, check the environment variable TMPDIR.  If it isn't
+      * set, check the predefined constant P_tmpdir.  If that isn't
+      * set, use "/tmp/".
+      */
+
+     if ((env = getenv ("TMPDIR")) && check_directory(env))
+         tmpdir = env;
+     else if (dir && check_directory(dir))
+         tmpdir = dir;
+#ifdef P_tmpdir
+     else if (check_directory(P_tmpdir))
+         tmpdir = P_tmpdir;
+#endif
+     else
+         tmpdir = "/tmp/";
+
+     /*
+      * OK, now that we've got a directory, figure out whether or not
+      * there's a slash at the end of it.
+      */
+     if (tmpdir[strlen(tmpdir) - 1] != '/')
+         addslash = 1;
+
+     /*
+      * Now figure out the set of unique letters.
+      */
+     unique_letters[0]++;
+     if (unique_letters[0] > 'Z') {
+         unique_letters[0] = 'A';
+         unique_letters[1]++;
+         if (unique_letters[1] > 'Z') {
+             unique_letters[1] = 'A';
+             unique_letters[2]++;
+             if (unique_letters[2] > 'Z') {
+                 unique_letters[2]++;
+             }
+         }
+     }
+
+     /*
+      * Allocate a string of sufficient length.
+      */
+     if (pfx) {
+         filename = (char *) malloc(strlen(tmpdir) + addslash + strlen(pfx) + 10
+);
+     } else {
+         filename = (char *) malloc(strlen(tmpdir) + addslash + 10);
+     }
+
+     /*
+      * And create the string.
+      */
+     (void) sprintf(filename, "%s%s%s%sa%05d", tmpdir, addslash ? "/" : "",
+                    pfx ? pfx : "", unique_letters, (int)getpid());
+
+     return filename;
+}
+
+
+#ifdef UNIX
+
+FILE *
+util_tmpfile(void)
+{
+    FILE *fp;
+    char *filename;
+
+    filename = util_tempnam(NIL(char), "VIS");
+    if ((fp = fopen(filename, "w+")) == NULL) {
+	FREE(filename);
+	return NULL;
+    }
+    (void) unlink(filename); 
+    FREE(filename);
+    return fp;
+}
+
+#else
+
+FILE *
+util_tmpfile(void)
+{
+    FILE *fp;
+
+    if ((fp = fopen("utiltmp", "w+")) == NULL) {
+	return NULL;
+    }
+    (void) unlink("utiltmp");
+    return fp;
+}
+
+#endif
Index: /vis_dev/glu-2.1/src/util/util.h
===================================================================
--- /vis_dev/glu-2.1/src/util/util.h	(revision 6)
+++ /vis_dev/glu-2.1/src/util/util.h	(revision 6)
@@ -0,0 +1,263 @@
+/**CHeaderFile*****************************************************************
+
+  FileName    [ util.h ]
+
+  PackageName [ util ]
+
+  Synopsis    [ Very low-level utilities ]
+
+  Description [ Includes file access, pipes, forks, time, and temporary file
+  		access. ]
+
+  Author      [ Stephen Edwards <sedwards@eecs.berkeley.edu> and many others]
+
+  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
+  All rights reserved.
+
+  Permission is hereby granted, without written agreement and without license
+  or royalty fees, to use, copy, modify, and distribute this software and its
+  documentation for any purpose, provided that the above copyright notice and
+  the following two paragraphs appear in all copies of this software.
+
+  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
+
+  Revision    [$Id: util.h,v 1.16 2003/08/01 15:41:37 fabio Exp $]
+
+******************************************************************************/
+
+#ifndef _UTIL
+#define _UTIL
+
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+#endif
+
+#if HAVE_VARARGS_H
+#  include <varargs.h>
+#endif
+
+#if STDC_HEADERS
+#  include <stdlib.h>
+#  include <string.h>
+#else
+#  ifdef HAVE_STRCHR
+char * strchr(const char *, int);
+int strcmp(const char *, const char *);
+#  else
+#    define strchr index
+#  endif
+#  ifdef HAVE_GETENV
+char * getenv(const char *);
+#  endif
+#endif /* STDC_HEADERS */
+
+#if HAVE_ERRNO_H
+#  include <errno.h>
+#endif
+
+/*
+ * Ensure we have reasonable assert() and fail() functions
+ */
+
+#if HAVE_ASSERT_H
+#  include <assert.h>
+#else
+#  ifdef NDEBUG
+#    define assert(ex) ;
+#  else
+#    define assert(ex) {\
+    if (! (ex)) {\
+	(void) fprintf(stderr,\
+	    "Assertion failed: file %s, line %d\n\"%s\"\n",\
+	    __FILE__, __LINE__, "ex");\
+	(void) fflush(stdout);\
+	abort();\
+    }\
+}
+#  endif
+#endif
+
+#define fail(why) {\
+    (void) fprintf(stderr, "Fatal error: file %s, line %d\n%s\n",\
+	__FILE__, __LINE__, why);\
+    (void) fflush(stdout);\
+    abort();\
+}
+
+/*
+ * Support for ANSI function prototypes in non-ANSI compilers
+ *
+ * Usage:
+ *   extern int foo ARGS((char *, double))
+ */
+
+#ifndef ARGS
+#  ifdef __STDC__
+#     define ARGS(args)	args
+#  else
+#     define ARGS(args) ()
+# endif
+#endif
+
+#ifndef NULLARGS
+#  ifdef __STDC__
+#    define NULLARGS	(void)
+#  else
+#    define NULLARGS	()
+#  endif
+#endif
+
+/*
+ * A little support for C++ compilers
+ */
+
+#ifdef __cplusplus
+#  define EXTERN	extern "C"
+#else
+#  define EXTERN	extern
+#endif
+
+/* 
+ * Support to define unused varibles
+ */
+#if defined (__GNUC__)
+#if (__GNUC__ >2 || __GNUC_MINOR__ >=7) && !defined(UNUSED)
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif
+#else
+#define UNUSED
+#endif
+
+/*
+ * A neater way to define zero pointers
+ *
+ * Usage:
+ *  int * fred;
+ *  fred = NIL(int);
+ */
+
+#define NIL(type)		((type *) 0)
+
+/* #define USE_MM */
+
+#ifdef USE_MM
+/*
+ *  assumes the memory manager is libmm.a (a deprecated (?) Octtools library)
+ *	- allows malloc(0) or realloc(obj, 0)
+ *	- catches out of memory (and calls MMout_of_memory())
+ *	- catch free(0) and realloc(0, size) in the macros
+ */
+#  define ALLOC(type, num)	\
+    ((type *) malloc(sizeof(type) * (num)))
+#  define REALLOC(type, obj, num)	\
+    (obj) ? ((type *) realloc((void *) obj, sizeof(type) * (num))) : \
+	    ((type *) malloc(sizeof(type) * (num)))
+#  define FREE(obj)		\
+    ((obj) ? (free((void *) (obj)), (obj) = 0) : 0)
+#else
+/*
+ *  enforce strict semantics on the memory allocator
+ */
+#  define ALLOC(type, num)	\
+    ((type *) MMalloc(sizeof(type) * (unsigned long) (num)))
+#  define REALLOC(type, obj, num)	\
+    ((type *) MMrealloc((void *) (obj), sizeof(type) * (unsigned long) (num)))
+#  define FREE(obj)		\
+    ((obj) ? (free((void *) (obj)), (obj) = 0) : 0)
+#endif
+
+#ifndef TRUE
+#  define TRUE 1
+#endif
+
+#ifndef FALSE
+#  define FALSE 0
+#endif
+
+#ifndef ABS
+#  define ABS(a)			((a) < 0 ? -(a) : (a))
+#endif
+
+#ifndef MAX
+#  define MAX(a,b)		((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#  define MIN(a,b)		((a) < (b) ? (a) : (b))
+#endif
+
+#define ptime()         util_cpu_time()
+#define print_time(t)   util_print_time(t)
+
+#ifndef HUGE_VAL
+#  ifndef HUGE
+#    define HUGE  8.9884656743115790e+307
+#  endif
+#  define HUGE_VAL HUGE
+#endif
+
+#ifndef MAXINT
+#  define MAXINT (1 << 30)
+#endif
+
+EXTERN void util_print_cpu_stats ARGS((FILE *));
+EXTERN long util_cpu_time ARGS((void));
+EXTERN long util_cpu_ctime ARGS((void));
+EXTERN void util_getopt_reset ARGS((void));
+EXTERN int util_getopt ARGS((int, char **, char *));
+EXTERN int util_check_file ARGS((char *, char *));
+EXTERN char *util_path_search ARGS((char *));
+EXTERN char *util_file_search ARGS((char *, char *, char *));
+EXTERN char *util_print_time ARGS((long));
+EXTERN int util_save_image ARGS((char *, char *));
+EXTERN char *util_strsav ARGS((char *));
+EXTERN char *util_inttostr ARGS((int));
+EXTERN char *util_strcat3 ARGS((char *, char *, char *));
+EXTERN char *util_strcat4 ARGS((char *, char *, char *, char *));
+EXTERN int util_do_nothing ARGS((void));
+EXTERN char *util_tilde_expand ARGS((char *));
+EXTERN char *util_tempnam ARGS((char *, char *));
+EXTERN FILE *util_tmpfile ARGS((void));
+EXTERN void util_srandom ARGS((long));
+EXTERN long util_random ARGS((void));
+EXTERN long getSoftDataLimit ARGS((void));
+EXTERN void MMout_of_memory ARGS((unsigned long));
+EXTERN void *MMalloc ARGS((unsigned long));
+EXTERN void *MMrealloc ARGS((void *, unsigned long));
+EXTERN void MMfree ARGS((void *));
+
+/*
+ * Global variables for util_getopt()
+ */
+
+extern int util_optind;
+extern char *util_optarg;
+
+/**AutomaticStart*************************************************************/
+
+/*---------------------------------------------------------------------------*/
+/* Function prototypes                                                       */
+/*---------------------------------------------------------------------------*/
+
+/**AutomaticEnd***************************************************************/
+
+#endif /* _UTIL */
Index: /vis_dev/glu-2.1/src/util/util.make
===================================================================
--- /vis_dev/glu-2.1/src/util/util.make	(revision 6)
+++ /vis_dev/glu-2.1/src/util/util.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += cpu_stats.c cpu_time.c datalimit.c getopt.c pathsearch.c prtime.c qsort.c random.c safe_mem.c strsav.c texpand.c tmpfile.c
+HEADERS += util.h
+MISC += util.doc 
+
+DEPENDENCYFILES = $(CSRC)
Index: /vis_dev/glu-2.1/src/var_set/var_set.c
===================================================================
--- /vis_dev/glu-2.1/src/var_set/var_set.c	(revision 6)
+++ /vis_dev/glu-2.1/src/var_set/var_set.c	(revision 6)
@@ -0,0 +1,218 @@
+/*
+ * Revision Control Information
+ *
+ * $Id: var_set.c,v 1.3 2002/08/25 05:30:13 fabio Exp $
+ *
+ */
+#include "util.h"
+#include "var_set.h"
+
+var_set_t *var_set_new(int size)
+{
+  var_set_t *result = ALLOC(var_set_t, 1);
+
+  result->n_elts = size;
+  result->n_words = size / VAR_SET_WORD_SIZE + ((size % VAR_SET_WORD_SIZE == 0) ? 0 : 1);
+  result->data = ALLOC(unsigned int, result->n_words);
+  (void) var_set_clear(result);
+  return result;
+}
+
+var_set_t *var_set_copy(var_set_t *set)
+{
+  int i;
+  var_set_t *result = ALLOC(var_set_t, 1);
+
+  *result = *set;
+  result->data = ALLOC(unsigned int, result->n_words);
+  for (i = 0; i < result->n_words; i++)
+    result->data[i] = set->data[i];
+  return result;
+}
+
+var_set_t *var_set_assign(var_set_t *result, var_set_t *set)
+{
+  int i;
+
+  assert(result->n_elts == set->n_elts);
+  for (i = 0; i < result->n_words; i++)
+    result->data[i] = set->data[i];
+  return result;
+}
+
+void var_set_free(var_set_t *set)
+{
+  FREE(set->data);
+  FREE(set);
+}
+
+static int size_array[256];
+
+static void init_size_array(void)
+{
+  int i;
+  unsigned j;
+  int count;
+
+  for (i = 0; i < 256; i++) {
+    count = 0;
+    for (j = 0; j < VAR_SET_WORD_SIZE; j++) {
+      count += VAR_SET_EXTRACT_BIT(i, j);
+    }
+    size_array[i] = count;
+  }
+}
+
+int var_set_n_elts(var_set_t *set)
+{
+  register int i, j;
+  register unsigned int value;
+  int n_bytes = VAR_SET_WORD_SIZE / VAR_SET_BYTE_SIZE;
+  int count = 0;
+
+  if (size_array[1] == 0) init_size_array();
+  for (i = 0; i < set->n_words; i++) {
+    value = set->data[i];
+    for (j = 0; j < n_bytes; j++) {
+      count += size_array[value & 0xff];
+      value >>= VAR_SET_BYTE_SIZE;
+    }
+  }
+  return count;
+}
+
+var_set_t *var_set_or(var_set_t *result, var_set_t *a, var_set_t *b)
+{
+  int i;
+  assert(result->n_elts == a->n_elts);
+  assert(result->n_elts == b->n_elts);
+  for (i = 0; i < result->n_words; i++)
+    result->data[i] = a->data[i] | b->data[i];
+  return result;
+}
+
+var_set_t *var_set_and(var_set_t *result, var_set_t *a, var_set_t *b)
+{
+  int i;
+  assert(result->n_elts == a->n_elts);
+  assert(result->n_elts == b->n_elts);
+  for (i = 0; i < result->n_words; i++)
+    result->data[i] = a->data[i] & b->data[i];
+  return result;
+}
+
+var_set_t *var_set_not(var_set_t *result, var_set_t *a)
+{
+  int i;
+  unsigned int mask;
+
+  assert(result->n_elts == a->n_elts);
+  for (i = 0; i < a->n_words; i++)
+    result->data[i] = ~a->data[i];
+  mask = (unsigned int) VAR_SET_ALL_ONES >> (a->n_words * VAR_SET_WORD_SIZE - a->n_elts);
+  result->data[a->n_words - 1] &= mask;
+  return result;
+}
+
+int var_set_get_elt(var_set_t *set, int index)
+{
+  assert(index >= 0 && index < set->n_elts);
+  return VAR_SET_EXTRACT_BIT(set->data[index / VAR_SET_WORD_SIZE], index % VAR_SET_WORD_SIZE);
+}
+
+void var_set_set_elt(var_set_t *set, int index)
+{
+  unsigned int *value;
+  assert(index >= 0 && index < set->n_elts);
+  value = &(set->data[index / VAR_SET_WORD_SIZE]);
+  *value = *value | (1 << (index % VAR_SET_WORD_SIZE));
+}
+
+void var_set_clear_elt(var_set_t *set, int index)
+{
+  unsigned int *value;
+  assert(index >= 0 && index < set->n_elts);
+  value = &(set->data[index / VAR_SET_WORD_SIZE]);
+  *value = *value & ~(1 << (index % VAR_SET_WORD_SIZE));
+}
+
+void var_set_clear(var_set_t *set)
+{
+  int i;
+
+  for (i = 0; i < set->n_words; i++)
+    set->data[i] = 0;
+}
+
+int var_set_intersect(var_set_t *a, var_set_t *b)
+{
+  int i;
+  assert(a->n_elts == b->n_elts);
+  for (i = 0; i < a->n_words; i++)
+    if (a->data[i] & b->data[i]) return 1;
+  return 0;
+}
+
+int var_set_is_empty(var_set_t *a)
+{
+  int i;
+  for (i = 0; i < a->n_words; i++)
+    if (a->data[i]) return 0;
+  return 1;
+}
+
+int var_set_is_full(var_set_t *a)
+{
+  int i;
+  unsigned value;
+  for (i = 0; i < a->n_words - 1; i++)
+    if (a->data[i] != VAR_SET_ALL_ONES) return 0;
+  value = VAR_SET_ALL_ONES >> (a->n_words * VAR_SET_WORD_SIZE - a->n_elts);
+  return (a->data[a->n_words - 1] == value);
+}
+
+void var_set_print(FILE *fp, var_set_t *set)
+{
+  int i;
+  for (i = 0; i < set->n_elts; i++) {
+    fprintf(fp, "%d ", var_set_get_elt(set, i));
+  }
+  fprintf(fp, "\n");
+}
+
+ /* returns 1 if equal, 0 otherwise */
+
+int var_set_equal(var_set_t *a, var_set_t *b)
+{
+  int i;
+
+  assert(a->n_elts == b->n_elts);
+  for (i = 0; i < a->n_words; i++)
+    if (a->data[i] != b->data[i]) return 0;
+  return 1;
+}
+
+ /* returns 0 if equal, 1 otherwise */
+
+int var_set_cmp(char *obj1, char *obj2)
+{
+  int i;
+  var_set_t *a = (var_set_t *) obj1;
+  var_set_t *b = (var_set_t *) obj2;
+
+  assert(a->n_elts == b->n_elts);
+  for (i = 0; i < a->n_words; i++)
+    if (a->data[i] != b->data[i]) return 1;
+  return 0;
+}
+
+ /* to be used when sets are used as keys in hash tables */
+unsigned int var_set_hash(var_set_t *set)
+{
+  int i;
+  unsigned int result = 0;
+
+  for (i = 0; i < set->n_words; i++)
+    result += (unsigned int) set->data[i];
+  return result;
+}
Index: /vis_dev/glu-2.1/src/var_set/var_set.h
===================================================================
--- /vis_dev/glu-2.1/src/var_set/var_set.h	(revision 6)
+++ /vis_dev/glu-2.1/src/var_set/var_set.h	(revision 6)
@@ -0,0 +1,76 @@
+#ifndef VAR_SET_H /* { */
+#define VAR_SET_H
+
+/*
+ * Revision Control Information
+ *
+ * /projects/hsis/CVS/utilities/var_set/var_set.h,v
+ * rajeev
+ * 1.3
+ * 1995/08/08 22:41:47
+ * var_set.h,v
+ * Revision 1.3  1995/08/08 22:41:47  rajeev
+ * Changes made by shazqadeer.420 as of 8/8/95
+ *
+ * Revision 1.1  1993/07/29  00:44:35  serdar
+ * Imported from /projects/classes/sis. Makefile changed for use in
+ *  /projects/hsis-util/hsis-util-1.0/common/src.
+ *
+ * Revision 1.3  1993/05/28  23:49:29  sis
+ * Aesthetic changes to prototypes.
+ *
+ * Revision 1.2  1993/05/11  19:49:14  sis
+ * Changes for ANSI C compatibility.
+ *
+ * Revision 1.1  1993/03/01  16:24:39  sis
+ * Initial revision
+ *
+ * Revision 1.1  1993/03/01  16:23:57  sis
+ * Initial revision
+ *
+ * Revision 1.3  1993/02/25  02:04:41  shiple
+ *  Added file pointer argument to declaration of var_set_print.
+ *
+ * Revision 1.2  1993/02/24  23:35:16  shiple
+ * Add VAR_SET_BYTE_SIZE macro. Fix newly introduced bug in
+ * definition of VAR_SET_WORD_SIZE.
+ *
+ * Revision 1.1  1993/02/23  22:58:28  shiple
+ * Initial revision
+ *
+ *
+ */
+
+#define VAR_SET_BYTE_SIZE 8
+#define VAR_SET_WORD_SIZE ((sizeof(unsigned int))*(VAR_SET_BYTE_SIZE))
+#define VAR_SET_ALL_ZEROS 0
+#define VAR_SET_ALL_ONES  ((unsigned int) ~0)
+#define VAR_SET_EXTRACT_BIT(word,pos) (((word) & (1 << (pos))) != 0)
+
+typedef struct var_set_struct {
+  int n_elts;
+  int n_words;
+  unsigned int *data;
+} var_set_t;
+
+EXTERN var_set_t *var_set_new ARGS((int));
+EXTERN var_set_t *var_set_copy ARGS((var_set_t *));
+EXTERN var_set_t *var_set_assign ARGS((var_set_t *, var_set_t *));
+EXTERN void       var_set_free ARGS((var_set_t *));
+EXTERN int        var_set_n_elts ARGS((var_set_t *));
+EXTERN var_set_t *var_set_or ARGS((var_set_t *, var_set_t *, var_set_t *));
+EXTERN var_set_t *var_set_and ARGS((var_set_t *, var_set_t *, var_set_t *));
+EXTERN var_set_t *var_set_not ARGS((var_set_t *, var_set_t *));
+EXTERN int        var_set_get_elt ARGS((var_set_t *, int));
+EXTERN void       var_set_set_elt ARGS((var_set_t *, int));
+EXTERN void       var_set_clear_elt ARGS((var_set_t *, int));
+EXTERN void       var_set_clear ARGS((var_set_t *));
+EXTERN int        var_set_intersect ARGS((var_set_t *, var_set_t *));
+EXTERN int        var_set_is_empty ARGS((var_set_t *));
+EXTERN int        var_set_is_full ARGS((var_set_t *));
+EXTERN void       var_set_print ARGS((FILE *, var_set_t *));
+EXTERN int        var_set_equal ARGS((var_set_t *, var_set_t *));
+EXTERN int        var_set_cmp ARGS((char *, char *));
+EXTERN unsigned int var_set_hash ARGS((var_set_t *));
+
+#endif /* } */
Index: /vis_dev/glu-2.1/src/var_set/var_set.make
===================================================================
--- /vis_dev/glu-2.1/src/var_set/var_set.make	(revision 6)
+++ /vis_dev/glu-2.1/src/var_set/var_set.make	(revision 6)
@@ -0,0 +1,5 @@
+CSRC += var_set.c
+HEADERS += var_set.h
+MISC += var_set.doc
+
+DEPENDENCYFILES = $(CSRC)
