aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
committerblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
commitca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch)
tree50a139db8e2ac51c6ff41f3790ff72aa417ed3be
parent43668d9109b1f36329646fd07324d435be6f0050 (diff)
downloadcompcert-kvx-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.tar.gz
compcert-kvx-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.zip
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.) rapportCompcert_all.txt liste les erreurs produites par ccomp. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
-rw-r--r--test/ccured_olden/COPYRIGHT23
-rw-r--r--test/ccured_olden/CVS/Entries13
-rw-r--r--test/ccured_olden/CVS/Repository1
-rw-r--r--test/ccured_olden/CVS/Root1
-rw-r--r--test/ccured_olden/README19
-rw-r--r--test/ccured_olden/bh/.cvsignore39
-rw-r--r--test/ccured_olden/bh/.gdbinit3
-rw-r--r--test/ccured_olden/bh/CVS/Entries23
-rw-r--r--test/ccured_olden/bh/CVS/Repository1
-rw-r--r--test/ccured_olden/bh/CVS/Root1
-rw-r--r--test/ccured_olden/bh/Makefile84
-rw-r--r--test/ccured_olden/bh/Readme62
-rw-r--r--test/ccured_olden/bh/allcfiles7
-rw-r--r--test/ccured_olden/bh/code.c200
-rw-r--r--test/ccured_olden/bh/code.h60
-rw-r--r--test/ccured_olden/bh/data.in12
-rw-r--r--test/ccured_olden/bh/data.orig.out462
-rw-r--r--test/ccured_olden/bh/data.out462
-rw-r--r--test/ccured_olden/bh/defs.h196
-rw-r--r--test/ccured_olden/bh/getparam.c142
-rw-r--r--test/ccured_olden/bh/grav.c123
-rw-r--r--test/ccured_olden/bh/input12
-rw-r--r--test/ccured_olden/bh/io.c252
-rw-r--r--test/ccured_olden/bh/load.c287
-rwxr-xr-xtest/ccured_olden/bh/normalize.pl19
-rw-r--r--test/ccured_olden/bh/real.h106
-rw-r--r--test/ccured_olden/bh/stdinc.h97
-rw-r--r--test/ccured_olden/bh/t.out462
-rwxr-xr-xtest/ccured_olden/bh/testit21
-rw-r--r--test/ccured_olden/bh/trusted_bh.c92
-rw-r--r--test/ccured_olden/bh/util.c152
-rw-r--r--test/ccured_olden/bh/vectmath.h371
-rw-r--r--test/ccured_olden/bisort/.cvsignore25
-rw-r--r--test/ccured_olden/bisort/CVS/Entries12
-rw-r--r--test/ccured_olden/bisort/CVS/Repository1
-rw-r--r--test/ccured_olden/bisort/CVS/Root1
-rw-r--r--test/ccured_olden/bisort/HOWTO1
-rw-r--r--test/ccured_olden/bisort/Makefile67
-rw-r--r--test/ccured_olden/bisort/README22
-rw-r--r--test/ccured_olden/bisort/args.c32
-rw-r--r--test/ccured_olden/bisort/bitonic.c267
-rw-r--r--test/ccured_olden/bisort/node.h18
-rw-r--r--test/ccured_olden/bisort/proc.h25
-rw-r--r--test/ccured_olden/bisort/ssplain.c69
-rw-r--r--test/ccured_olden/bisort/ssplain.h128
-rw-r--r--test/ccured_olden/bisort/swap.c145
-rw-r--r--test/ccured_olden/em3d/.cvsignore29
-rw-r--r--test/ccured_olden/em3d/CVS/Entries17
-rw-r--r--test/ccured_olden/em3d/CVS/Repository1
-rw-r--r--test/ccured_olden/em3d/CVS/Root1
-rw-r--r--test/ccured_olden/em3d/HOWTO1
-rw-r--r--test/ccured_olden/em3d/MY_HOWTO2
-rw-r--r--test/ccured_olden/em3d/Makefile64
-rw-r--r--test/ccured_olden/em3d/Makefile.plain7
-rw-r--r--test/ccured_olden/em3d/Makefile.ss8
-rw-r--r--test/ccured_olden/em3d/args.c21
-rw-r--r--test/ccured_olden/em3d/em3d.c16
-rw-r--r--test/ccured_olden/em3d/em3d.h38
-rw-r--r--test/ccured_olden/em3d/main.c45
-rw-r--r--test/ccured_olden/em3d/make_graph.c173
-rw-r--r--test/ccured_olden/em3d/make_graph.h13
-rw-r--r--test/ccured_olden/em3d/ssplain.c70
-rw-r--r--test/ccured_olden/em3d/ssplain.h128
-rw-r--r--test/ccured_olden/em3d/util.c34
-rw-r--r--test/ccured_olden/em3d/util.h23
-rw-r--r--test/ccured_olden/health/.cvsignore30
-rw-r--r--test/ccured_olden/health/.gdbinit6
-rw-r--r--test/ccured_olden/health/CVS/Entries16
-rw-r--r--test/ccured_olden/health/CVS/Repository1
-rw-r--r--test/ccured_olden/health/CVS/Root1
-rw-r--r--test/ccured_olden/health/HOWTO1
-rw-r--r--test/ccured_olden/health/Makefile72
-rw-r--r--test/ccured_olden/health/README20
-rw-r--r--test/ccured_olden/health/args.c34
-rw-r--r--test/ccured_olden/health/health.c309
-rw-r--r--test/ccured_olden/health/health.h76
-rw-r--r--test/ccured_olden/health/list.c55
-rw-r--r--test/ccured_olden/health/out.orig64
-rw-r--r--test/ccured_olden/health/out.orig.msvc64
-rw-r--r--test/ccured_olden/health/output64
-rw-r--r--test/ccured_olden/health/poisson.c35
-rw-r--r--test/ccured_olden/health/ssplain.c70
-rw-r--r--test/ccured_olden/health/ssplain.h130
-rwxr-xr-xtest/ccured_olden/health/testit25
-rw-r--r--test/ccured_olden/mst/.cvsignore26
-rw-r--r--test/ccured_olden/mst/CVS/Entries16
-rw-r--r--test/ccured_olden/mst/CVS/Repository1
-rw-r--r--test/ccured_olden/mst/CVS/Root1
-rw-r--r--test/ccured_olden/mst/HOWTO1
-rw-r--r--test/ccured_olden/mst/Makefile62
-rw-r--r--test/ccured_olden/mst/Makefile.plain7
-rw-r--r--test/ccured_olden/mst/Makefile.ss7
-rw-r--r--test/ccured_olden/mst/args.c20
-rw-r--r--test/ccured_olden/mst/args.s37
-rw-r--r--test/ccured_olden/mst/hash.c105
-rw-r--r--test/ccured_olden/mst/hash.h23
-rw-r--r--test/ccured_olden/mst/hash.s354
-rw-r--r--test/ccured_olden/mst/main.c142
-rw-r--r--test/ccured_olden/mst/makegraph.c93
-rw-r--r--test/ccured_olden/mst/mst.h33
-rw-r--r--test/ccured_olden/mst/out.orig13
-rw-r--r--test/ccured_olden/mst/output13
-rw-r--r--test/ccured_olden/mst/ssplain.c38
-rw-r--r--test/ccured_olden/mst/ssplain.h128
-rwxr-xr-xtest/ccured_olden/mst/testit25
-rw-r--r--test/ccured_olden/newbisort/.cvsignore1
-rw-r--r--test/ccured_olden/newbisort/CVS/Entries13
-rw-r--r--test/ccured_olden/newbisort/CVS/Repository1
-rw-r--r--test/ccured_olden/newbisort/CVS/Root1
-rw-r--r--test/ccured_olden/newbisort/HOWTO1
-rw-r--r--test/ccured_olden/newbisort/Makefile49
-rw-r--r--test/ccured_olden/newbisort/Makefile.orig33
-rw-r--r--test/ccured_olden/newbisort/Makefile.plain7
-rw-r--r--test/ccured_olden/newbisort/Makefile.ss7
-rw-r--r--test/ccured_olden/newbisort/args.c32
-rw-r--r--test/ccured_olden/newbisort/bitonic.c267
-rw-r--r--test/ccured_olden/newbisort/node.h18
-rw-r--r--test/ccured_olden/newbisort/proc.h25
-rw-r--r--test/ccured_olden/newbisort/ssplain.c75
-rw-r--r--test/ccured_olden/newbisort/ssplain.h128
-rw-r--r--test/ccured_olden/newbisort/swap.c145
-rw-r--r--test/ccured_olden/perimeter/.cvsignore32
-rw-r--r--test/ccured_olden/perimeter/CVS/Entries9
-rw-r--r--test/ccured_olden/perimeter/CVS/Repository1
-rw-r--r--test/ccured_olden/perimeter/CVS/Root1
-rw-r--r--test/ccured_olden/perimeter/Makefile99
-rw-r--r--test/ccured_olden/perimeter/README20
-rw-r--r--test/ccured_olden/perimeter/main.c221
-rw-r--r--test/ccured_olden/perimeter/maketree.c120
-rw-r--r--test/ccured_olden/perimeter/out.orig3
-rw-r--r--test/ccured_olden/perimeter/output4
-rw-r--r--test/ccured_olden/perimeter/perimeter.h54
-rwxr-xr-xtest/ccured_olden/perimeter/testit25
-rw-r--r--test/ccured_olden/power/.cvsignore21
-rw-r--r--test/ccured_olden/power/.gdbinit5
-rw-r--r--test/ccured_olden/power/CVS/Entries11
-rw-r--r--test/ccured_olden/power/CVS/Repository1
-rw-r--r--test/ccured_olden/power/CVS/Root1
-rw-r--r--test/ccured_olden/power/Makefile41
-rw-r--r--test/ccured_olden/power/README21
-rw-r--r--test/ccured_olden/power/build.c154
-rw-r--r--test/ccured_olden/power/compute.c379
-rw-r--r--test/ccured_olden/power/main.c116
-rw-r--r--test/ccured_olden/power/out.orig37
-rw-r--r--test/ccured_olden/power/output38
-rw-r--r--test/ccured_olden/power/power.h114
-rwxr-xr-xtest/ccured_olden/power/testit26
-rw-r--r--test/ccured_olden/rapportCompcert_all.txt90
-rw-r--r--test/ccured_olden/treeadd/.cvsignore27
-rw-r--r--test/ccured_olden/treeadd/CVS/Entries27
-rw-r--r--test/ccured_olden/treeadd/CVS/Repository1
-rw-r--r--test/ccured_olden/treeadd/CVS/Root1
-rw-r--r--test/ccured_olden/treeadd/HOWTO1
-rw-r--r--test/ccured_olden/treeadd/HOWTO.bak1
-rw-r--r--test/ccured_olden/treeadd/Makefile38
-rw-r--r--test/ccured_olden/treeadd/Makefile.plain8
-rw-r--r--test/ccured_olden/treeadd/Makefile.ss10
-rw-r--r--test/ccured_olden/treeadd/args.c47
-rw-r--r--test/ccured_olden/treeadd/node.c74
-rw-r--r--test/ccured_olden/treeadd/old-exe/CVS/Entries1
-rw-r--r--test/ccured_olden/treeadd/old-exe/CVS/Repository1
-rw-r--r--test/ccured_olden/treeadd/old-exe/CVS/Root1
-rw-r--r--test/ccured_olden/treeadd/out.diff0
-rw-r--r--test/ccured_olden/treeadd/out.orig5
-rw-r--r--test/ccured_olden/treeadd/out_20_110
-rw-r--r--test/ccured_olden/treeadd/out_20_1.mac_cnt28
-rw-r--r--test/ccured_olden/treeadd/out_20_1.mac_cnt_sil22
-rw-r--r--test/ccured_olden/treeadd/out_20_1.mac_nocnt_sil15
-rw-r--r--test/ccured_olden/treeadd/out_20_1.nm_nocnt17
-rw-r--r--test/ccured_olden/treeadd/out_20_1.nwm_nocnt6
-rw-r--r--test/ccured_olden/treeadd/out_22_110
-rw-r--r--test/ccured_olden/treeadd/out_22_1.mac_nocnt_sil15
-rw-r--r--test/ccured_olden/treeadd/out_23_110
-rw-r--r--test/ccured_olden/treeadd/out_23_1.mac_nocnt_sil15
-rw-r--r--test/ccured_olden/treeadd/out_25_18
-rw-r--r--test/ccured_olden/treeadd/out_25_1.mac_nocnt_sil7
-rw-r--r--test/ccured_olden/treeadd/output5
-rw-r--r--test/ccured_olden/treeadd/par-alloc.c33
-rw-r--r--test/ccured_olden/treeadd/ssplain.c70
-rw-r--r--test/ccured_olden/treeadd/ssplain.h128
-rwxr-xr-xtest/ccured_olden/treeadd/testit22
-rw-r--r--test/ccured_olden/treeadd/tree.h18
-rw-r--r--test/ccured_olden/tsp/.cvsignore28
-rw-r--r--test/ccured_olden/tsp/CVS/Entries8
-rw-r--r--test/ccured_olden/tsp/CVS/Repository1
-rw-r--r--test/ccured_olden/tsp/CVS/Root1
-rw-r--r--test/ccured_olden/tsp/Makefile44
-rw-r--r--test/ccured_olden/tsp/README22
-rw-r--r--test/ccured_olden/tsp/build.c124
-rw-r--r--test/ccured_olden/tsp/main.c101
-rw-r--r--test/ccured_olden/tsp/tsp.c308
-rw-r--r--test/ccured_olden/tsp/tsp.h32
-rw-r--r--test/ccured_olden/voronoi/.cvsignore14
-rw-r--r--test/ccured_olden/voronoi/CVS/Entries8
-rw-r--r--test/ccured_olden/voronoi/CVS/Repository1
-rw-r--r--test/ccured_olden/voronoi/CVS/Root1
-rw-r--r--test/ccured_olden/voronoi/Makefile72
-rw-r--r--test/ccured_olden/voronoi/README22
-rw-r--r--test/ccured_olden/voronoi/defines.h186
-rw-r--r--test/ccured_olden/voronoi/newvor.c711
-rw-r--r--test/ccured_olden/voronoi/output.c173
-rw-r--r--test/ccured_olden/voronoi/vector.c80
202 files changed, 12593 insertions, 0 deletions
diff --git a/test/ccured_olden/COPYRIGHT b/test/ccured_olden/COPYRIGHT
new file mode 100644
index 00000000..3a53304a
--- /dev/null
+++ b/test/ccured_olden/COPYRIGHT
@@ -0,0 +1,23 @@
+/* OLDEN parallel C for dynamic structures: compiler, runtime system
+ and benchmarks
+
+ Copyright (C) 1994-1996 by Anne Rogers (amr@cs.princeton.edu) and
+ Martin Carlisle (mcc@cs.princeton.edu)
+ ALL RIGHTS RESERVED.
+
+ OLDEN is distributed under the following conditions:
+
+ You may make copies of OLDEN for your own use and modify those copies.
+
+ All copies of OLDEN must retain our names and copyright notice.
+
+ You may not sell OLDEN or distribute OLDEN in conjunction with a
+ commercial product or service without the expressed written consent of
+ Anne Rogers and Martin Carlisle.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
+*/
+
diff --git a/test/ccured_olden/CVS/Entries b/test/ccured_olden/CVS/Entries
new file mode 100644
index 00000000..a8e10c79
--- /dev/null
+++ b/test/ccured_olden/CVS/Entries
@@ -0,0 +1,13 @@
+/COPYRIGHT/1.1/Mon Jun 11 21:20:00 2001//
+/README/1.1/Mon Jun 11 21:20:00 2001//
+D/bh////
+D/bisort////
+D/em3d////
+D/health////
+D/mst////
+D/perimeter////
+D/power////
+D/treeadd////
+D/tsp////
+D/voronoi////
+D/newbisort////
diff --git a/test/ccured_olden/CVS/Repository b/test/ccured_olden/CVS/Repository
new file mode 100644
index 00000000..d65135b7
--- /dev/null
+++ b/test/ccured_olden/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden
diff --git a/test/ccured_olden/CVS/Root b/test/ccured_olden/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/README b/test/ccured_olden/README
new file mode 100644
index 00000000..48157ffa
--- /dev/null
+++ b/test/ccured_olden/README
@@ -0,0 +1,19 @@
+Olden v1.0 benchmark suite
+January 3, 1995
+
+Martin C. Carlisle
+
+see COPYRIGHT for copyright information
+
+Contains plain versions of the 10 benchmarks used in the PPoPP paper.
+
+KNOWN BUGS: (updated June 10, 1996)
+
+line 66 of health/health.c should read:
+ new->hosp.personnel = (int)pow(2.0, (double) (level - 1));
+instead of:
+ new->hosp.personnel = (int)pow(2, level - 1);
+
+This patch has not been applied and is not reflected in the data in the
+PPoPP submission.
+
diff --git a/test/ccured_olden/bh/.cvsignore b/test/ccured_olden/bh/.cvsignore
new file mode 100644
index 00000000..94c933eb
--- /dev/null
+++ b/test/ccured_olden/bh/.cvsignore
@@ -0,0 +1,39 @@
+*.i
+*_all.c
+*cil.c
+*box.c
+code
+data.in
+data.out
+*.origi
+*_allinfer.c
+*_ppp.c
+code.cil
+code.box
+code.wildbox
+
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+changes.out
+*_comb.c
+*cured.c
+*.optim.c
+ope.m
+dat.out
+changes
+*.browser
+*optimcured* \ No newline at end of file
diff --git a/test/ccured_olden/bh/.gdbinit b/test/ccured_olden/bh/.gdbinit
new file mode 100644
index 00000000..123e0ab7
--- /dev/null
+++ b/test/ccured_olden/bh/.gdbinit
@@ -0,0 +1,3 @@
+file code.exe
+b main
+r
diff --git a/test/ccured_olden/bh/CVS/Entries b/test/ccured_olden/bh/CVS/Entries
new file mode 100644
index 00000000..acce0666
--- /dev/null
+++ b/test/ccured_olden/bh/CVS/Entries
@@ -0,0 +1,23 @@
+/Readme/1.1/Thu Apr 26 07:13:27 2001//
+/allcfiles/1.1/Thu Oct 18 05:30:18 2001//
+/code.h/1.1/Thu Apr 26 07:13:27 2001//
+/data.cil.out/1.1/Wed Jun 13 16:19:10 2001//
+/grav.c/1.2/Sun Apr 29 05:21:42 2001//
+/input/1.1/Thu Apr 26 07:13:27 2001//
+/io.c/1.4/Tue Oct 9 00:17:00 2001//
+/load.c/1.3/Thu Jul 12 19:57:18 2001//
+/real.h/1.1/Thu Apr 26 07:13:27 2001//
+/stdinc.h/1.6/Tue Oct 9 00:17:00 2001//
+/vectmath.h/1.4/Mon Jul 23 19:46:26 2001//
+/data.in/1.1/Fri Nov 9 00:51:18 2001//
+/data.orig.out/1.1/Mon Nov 12 08:08:28 2001//
+/normalize.pl/1.2/Mon Nov 12 15:44:12 2001//
+/.cvsignore/1.14/Sat Jul 27 06:13:42 2002//
+/testit/1.1/Wed Dec 25 17:27:31 2002//
+/defs.h/1.12/Mon Jan 6 22:43:21 2003//
+/code.c/1.5/Wed Jan 8 06:10:33 2003//
+/Makefile/1.11/Sat Jan 11 05:01:09 2003//
+/getparam.c/1.5/Sat Jan 11 04:58:14 2003//
+/trusted_bh.c/1.2/Sat Jan 11 05:01:58 2003//
+/util.c/1.11/Sat Jan 11 04:59:49 2003//
+D
diff --git a/test/ccured_olden/bh/CVS/Repository b/test/ccured_olden/bh/CVS/Repository
new file mode 100644
index 00000000..ebfd8c04
--- /dev/null
+++ b/test/ccured_olden/bh/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/bh
diff --git a/test/ccured_olden/bh/CVS/Root b/test/ccured_olden/bh/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/bh/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/bh/Makefile b/test/ccured_olden/bh/Makefile
new file mode 100644
index 00000000..bd281429
--- /dev/null
+++ b/test/ccured_olden/bh/Makefile
@@ -0,0 +1,84 @@
+##############################################################################
+# MAKEFILE: compile tree-code program. #
+# #
+# Copyright (c) 1993, Joshua E. Barnes, Honolulu, HI. #
+# It's free because it's yours. #
+##############################################################################
+
+# Compiler flags for development on SGI; not used on other systems.
+# single version: CFLAGS = -fullwarn -woff 269,302 -prototypes -O -float
+# double version: CFLAGS = -DDOUBLEPREC -fullwarn -woff 269,302 -prototypes -O
+
+# Standard compiler flags. Double precision is the default because not
+# all available systems seem to have single-precision square root.
+#sm: orig: CFLAGS = -DDOUBLEPREC -O
+CFLAGS = -DDOUBLEPREC -O3
+LDFLAGS = -O3
+
+# CompCert
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+CC=gcc -arch ppc # MacOS X
+#CC=gcc # other systems
+
+CFLAGS=-O1 -Wall
+
+LIBS= # MacOS X
+
+# Build a treecode.
+code.exe.compcert: code.compcert io.compcert load.compcert grav.compcert util.compcert getparam.compcert trusted_bh.compcert
+ $(CCOMP) $(LDFLAGS) -o code.exe.compcert code.compcert io.compcert load.compcert grav.compcert\
+ util.o getparam.compcert trusted_bh.compcert $(EXTRA_LIBS)
+
+code.compcert: code.c defs.h code.h stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) code.c
+
+io.compcert: io.c defs.h stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) io.c
+
+load.compcert: load.c defs.h stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) load.c
+
+grav.compcert: grav.c defs.h stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) -grav.c
+
+code.exe: code.o io.o load.o grav.o util.o getparam.o trusted_bh.o
+ $(CC) $(LDFLAGS) -o code.exe code.o io.o load.o grav.o\
+ util.o getparam.o trusted_bh.o -lm $(EXTRA_LIBS)
+
+code.o: code.c defs.h code.h stdinc.h
+ $(CC) $(CFLAGS) -c code.c
+
+io.o: io.c defs.h stdinc.h
+ $(CC) $(CFLAGS) -c io.c
+
+load.o: load.c defs.h stdinc.h
+ $(CC) $(CFLAGS) -c load.c
+
+grav.o: grav.c defs.h stdinc.h
+ $(CC) $(CFLAGS) -c grav.c
+
+# Utility routines etc.
+
+util.o: util.c stdinc.h
+ $(CC) $(CFLAGS) util.c
+
+util.compcert: util.c stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) util.c
+
+# Added to help boxing
+trusted_bh.o: trusted_bh.c stdinc.h
+ $(CC) $(CFLAGS) -c trusted_bh.c
+
+getparam.o: getparam.c stdinc.h
+ $(CC) $(CFLAGS) -c getparam.c
+
+trusted_bh.compcert: trusted_bh.c stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) trusted_bh.c
+
+getparam.compcert: getparam.c stdinc.h
+ $(CCOMP) $(CCOMPFLAGS) getparam.c
+
+clean:
+ rm -f *.o *.lib *.exe *.obj *~ *cil.c *_comb.c *infer.c *cured.c *.i *cured*optim.c \ No newline at end of file
diff --git a/test/ccured_olden/bh/Readme b/test/ccured_olden/bh/Readme
new file mode 100644
index 00000000..5034f519
--- /dev/null
+++ b/test/ccured_olden/bh/Readme
@@ -0,0 +1,62 @@
+README README README README README README README README README README
+
+ 22 June 1993
+
+ This is the fourth release of the hierarchical N-body program. The
+algorithm used to compute gravitational forces has asymptotic complexity of
+O(N log N). This is achieved by building a tree structure to represent the
+mass distribution and estimating forces by a partial recursive descent of this
+tree. See "A Hierarchical O(N log N) Force Calculation Algorithm", by Joshua
+Barnes and Piet Hut, Nature, 324, 446, and "Error Analysis of a Tree Code", by
+Joshua Barnes and Piet Hut, Astrophysical Journal Supplement, 70, 389, for
+more information.
+
+ The code has been rewritten in ANSI C for greater portability. Prototypes
+have been provided for all functions. Several functions associated with tree
+construction have been simplified; the resulting code should be easier to
+mantain. Force calculation has been made more accurate by incorporating a new
+opening-angle criterion, and faster by adding additional pointers to the tree
+structure. Quadrupole corrections for body-cell interactions are now included
+as a run-time option; see "Performance Characteristics of Tree Codes", by Lars
+Hernquist, Astrophysical Journal Supplement, 64, 715.
+
+ The source files for the tree code have been bundled together for ease of
+distribution. On a UNIX system, you can split this file simply by invoking
+the Bourne shell on it (use the sh command). On other systems, you may have
+to edit this file and split it up by hand; note that file X is delimited by
+lines containing the message End of X. Once you have split this file, you can
+compile it by running make on a UNIX system. On other systems, you are on
+your own; take a look at the Makefile for hints. Running the program with the
+default input parameters (type a <CR> to all prompts) will start a short
+calculation with a few particles to test things out.
+
+ These sources include a few files which you may find generally useful:
+"stdinc.h", a standard include file with common definitions, "vectmath.h", a
+set of macros for elementary vector and matrix operations, "real.h", a set of
+definitions for floating-point code, "getparam.c", a simple, standardized user
+interface, and "util.c", some miscellaneous utilities. These are part of a
+larger collection of software for numerical experiments with gravitating
+systems.
+
+ NO WARRANTY is offered on the software supplied here -- use it at your own
+risk. NO RESTRICTIONS are imposed on use and distribution of the code -- you
+are free to use this software for any application, modify it in any way, use
+pieces in other programs, and give it away to anyone else. You are encouraged
+to extend these rights to others who receive this software from you, following
+the philosophy and intentions of the Free Software Foundation.
+
+ You are asked to include a brief acknowledgement in any scientific papers
+you write using this code; I would appreciate receiving preprints or reprints
+of such papers. I would also appreciate receiving reports of bugs and/or
+problems encountered in porting this code to other machines.
+
+ Have fun and stay in touch.
+
+ Joshua E. Barnes barnes@zeno.ifa.hawaii.edu
+
+ Institute for Astronomy (808) 956-8138
+ University of Hawaii
+ 2680 Woodlawn Drive
+ Honolulu, Hawaii 96822
+
+README README README README README README README README README README
diff --git a/test/ccured_olden/bh/allcfiles b/test/ccured_olden/bh/allcfiles
new file mode 100644
index 00000000..6a04d2ac
--- /dev/null
+++ b/test/ccured_olden/bh/allcfiles
@@ -0,0 +1,7 @@
+bhbox.c
+code.c
+getparam.c
+grav.c
+io.c
+load.c
+util.c
diff --git a/test/ccured_olden/bh/code.c b/test/ccured_olden/bh/code.c
new file mode 100644
index 00000000..ee3c0894
--- /dev/null
+++ b/test/ccured_olden/bh/code.c
@@ -0,0 +1,200 @@
+/****************************************************************************/
+/* CODE.C: hierarchical N-body code. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#define global /* nada */
+
+#include <stdlib.h>
+#include "code.h"
+
+/*
+ * Default values for input parameters.
+ */
+
+string defv[] = {
+
+ /* file names for input/output */
+ "in=", /* Input file with initial conditions */
+ "out=", /* Output file of N-body frames */
+
+ /* params to control N-body integration */
+ "dtime=0.03125", /* Integration time-step */
+ "eps=0.025", /* Potential softening parameter */
+ "theta=1.0", /* Cell subdivision tolerence */
+ "usequad=false", /* If true, use quad moments */
+ "rsize=4.0", /* Size of initial root cell */
+ "options=", /* Various control options */
+ "tstop=2.0", /* Time to stop integration */
+ "dtout=0.25", /* Data output interval */
+
+ /* params used if no input specified to make a Plummer model */
+ "nbody=1024", /* Number of particles for test run */
+ "seed=123", /* Random number seed for test run */
+
+ NULL,
+};
+
+string headline = "Hierarchical N-body Code"; /* default id for run */
+
+local void startrun(void); /* initialize system state */
+local void stepsystem(void); /* advance by one time-step */
+local void testdata(void); /* generate test data */
+local void pickshell(vector, real); /* pick point on shell */
+
+/*
+ * MAIN: toplevel routine for hierarchical N-body code.
+ */
+
+int main(int argc, string argv[])
+{
+ initparam(argv, defv); /* setup parameter access */
+ startrun(); /* set params, input data */
+ initoutput(); /* begin system output */
+ while (tnow < tstop - 1.0/(1024*freq)) /* while not past tstop */
+ stepsystem(); /* advance N-body system */
+ stopoutput(); /* finish up output */
+ return 0; // Change this to zero when the running time is 3.8s again
+}
+
+/*
+ * STARTRUN: startup hierarchical N-body code.
+ */
+
+local void startrun(void)
+{
+ infile = getparam("in"); /* set I/O file names */
+ outfile = getparam("out");
+ freq = 1.0 / getrparam("dtime"); /* inverse timestep */
+ eps = getrparam("eps"); /* softening length */
+ theta = getrparam("theta"); /* force accuracy parameter */
+ usequad = getbparam("usequad"); /* flag for quad moments */
+ rsize = getrparam("rsize"); /* initial size of root */
+ options = getparam("options"); /* and control options */
+ tstop = getrparam("tstop"); /* time to stop integration */
+ freqout = 1.0 / getrparam("dtout"); /* inverse output interval */
+ if (! streq(infile, "")) { /* was data file given? */
+
+ inputdata(); /* read inital data */
+ } else { /* make initial conds? */
+ nbody = getiparam("nbody"); /* get nbody parameter */
+ if (nbody < 1) /* check input value */
+ error("startrun: nbody = %d is absurd\n", nbody);
+ srand((long) getiparam("seed")); /* set random generator */
+ testdata(); /* make test model */
+ }
+ nstep = 0; /* start counting steps */
+ tout = tnow; /* schedule first output */
+}
+
+/*
+ * TESTDATA: generate Plummer model initial conditions for test runs,
+ * scaled to units such that M = -4E = G = 1 (Henon, Hegge, etc).
+ * See Aarseth, SJ, Henon, M, & Wielen, R (1974) Astr & Ap, 37, 183.
+ */
+
+#define MFRAC 0.999 /* cut off 1-MFRAC of mass */
+
+local void testdata(void)
+{
+ real rsc, vsc, r, v, x, y;
+ vector cmr, cmv;
+ bodyptr p;
+
+ headline = "Hierarchical code: Plummer model";
+ /* supply default headline */
+ tnow = 0.0; /* reset elapsed model time */
+ bodytab = (bodyptr) allocate(nbody * sizeof(body));
+ /* alloc space for bodies */
+ rsc = 3 * PI / 16; /* set length scale factor */
+ vsc = rsqrt(1.0 / rsc); /* and recip. speed scale */
+ CLRV(cmr); /* init cm pos, vel */
+ CLRV(cmv);
+ for (p = bodytab; p < bodytab+nbody; p++) { /* loop over particles */
+ Type(p) = BODY; /* tag as a body */
+ Mass(p) = 1.0 / nbody; /* set masses equal */
+ r = 1 / rsqrt(rpow(xrandom(0.0, MFRAC), /* pick r in struct units */
+ -2.0/3.0) - 1);
+ pickshell(Pos(p), rsc * r); /* pick scaled position */
+ ADDV(cmr, cmr, Pos(p)); /* add to running sum */
+ do { /* select from fn g(x) */
+ x = xrandom(0.0, 1.0); /* for x in range 0:1 */
+ y = xrandom(0.0, 0.1); /* max of g(x) is 0.092 */
+ } while (y > x*x * rpow(1 - x*x, 3.5)); /* using von Neumann tech */
+ v = rsqrt(2.0) * x/rpow(1 + r*r, 0.25); /* find v in struct units */
+ pickshell(Vel(p), vsc * v); /* pick scaled velocity */
+ ADDV(cmv, cmv, Vel(p)); /* add to running sum */
+ }
+ DIVVS(cmr, cmr, (real) nbody); /* normalize cm coords */
+ DIVVS(cmv, cmv, (real) nbody);
+ for (p = bodytab; p < bodytab+nbody; p++) { /* loop over particles */
+ SUBV(Pos(p), Pos(p), cmr); /* offset by cm coords */
+ SUBV(Vel(p), Vel(p), cmv);
+ }
+}
+
+/*
+ * PICKSHELL: pick a random point on a sphere of specified radius.
+ */
+
+local void pickshell(vector vec, real rad)
+{
+ int k;
+ real rsq, rsc;
+
+ do { /* pick point in NDIM-space */
+ for (k = 0; k < NDIM; k++) /* loop over dimensions */
+ vec[k] = xrandom(-1.0, 1.0); /* pick from unit cube */
+ DOTVP(rsq, vec, vec); /* compute radius squared */
+ } while (rsq > 1.0); /* reject if outside sphere */
+ rsc = rad / rsqrt(rsq); /* compute scaling factor */
+ MULVS(vec, vec, rsc); /* rescale to radius given */
+}
+
+/*
+ * STEPSYSTEM: advance N-body system one time-step.
+ */
+
+local void stepsystem(void)
+{
+ bodyptr p;
+ real dt;
+ vector dvel, dpos;
+
+ if (nstep == 0) { /* about to take 1st step? */
+ maketree(bodytab, nbody); /* build tree structure */
+ nfcalc = n2bcalc = nbccalc = 0; /* zero counters */
+ for (p = bodytab; p < bodytab+nbody; p++) {
+ /* loop over all bodies */
+ hackgrav(p, Mass(p) > 0.0); /* get force on each */
+ nfcalc++; /* count force calcs */
+ n2bcalc += n2bterm; /* and 2-body terms */
+ nbccalc += nbcterm; /* and body-cell terms */
+ }
+ output(); /* do initial output */
+ }
+ dt = 1.0 / freq; /* set basic time-step */
+ for (p = bodytab; p < bodytab+nbody; p++) { /* loop over all bodies */
+ MULVS(dvel, Acc(p), 0.5 * dt); /* get velocity increment */
+ ADDV(Vel(p), Vel(p), dvel); /* advance v by 1/2 step */
+ MULVS(dpos, Vel(p), dt); /* get positon increment */
+ ADDV(Pos(p), Pos(p), dpos); /* advance r by 1 step */
+ }
+ maketree(bodytab, nbody); /* build tree structure */
+ nfcalc = n2bcalc = nbccalc = 0; /* zero counters */
+ for (p = bodytab; p < bodytab+nbody; p++) { /* loop over bodies */
+ hackgrav(p, Mass(p) > 0.0); /* get force on each */
+ nfcalc++; /* count force calcs */
+ n2bcalc += n2bterm; /* and 2-body terms */
+ nbccalc += nbcterm; /* and body-cell terms */
+ }
+ for (p = bodytab; p < bodytab+nbody; p++) { /* loop over all bodies */
+ MULVS(dvel, Acc(p), 0.5 * dt); /* get velocity increment */
+ ADDV(Vel(p), Vel(p), dvel); /* advance v by 1/2 step */
+ }
+ nstep++; /* count another time step */
+ tnow = tnow + dt; /* finally, advance time */
+ output(); /* do major or minor output */
+}
diff --git a/test/ccured_olden/bh/code.h b/test/ccured_olden/bh/code.h
new file mode 100644
index 00000000..89b8a098
--- /dev/null
+++ b/test/ccured_olden/bh/code.h
@@ -0,0 +1,60 @@
+/****************************************************************************/
+/* CODE.H: define various global things for code.c and io.c. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "defs.h"
+
+global string infile; /* file name for snapshot input */
+
+global string outfile; /* file name for snapshot output */
+
+global real freq; /* inverse of integration timestep */
+
+global real freqout; /* output frequency */
+
+global real tstop; /* time to stop calculation */
+
+extern string headline; /* message describing calculation */
+
+global real tnow; /* current value of time */
+
+global real tout; /* time of next output */
+
+global int nstep; /* number of time-steps */
+
+global int nfcalc; /* count force calculations */
+
+global int n2bcalc; /* count body-body interactions */
+
+global int nbccalc; /* count body-cell interactions */
+
+global int nbody; /* number of bodies in system */
+
+global bodyptr bodytab; /* points to array of bodies */
+
+/*
+ * Global function prototypes.
+ */
+
+void initoutput(void); /* open files for output */
+void stopoutput(void); /* close output files */
+void inputdata(void); /* read initial data file */
+void maketree(bodyptr, int); /* construct tree structure */
+void hackgrav(bodyptr, bool); /* compute force on body */
+void output(void); /* perform output operation */
+
+/*
+ * Utility routines used in code.c and io.c. These are defined in util.c
+ * and getparam.c, which must be compiled with same choice of precision.
+ */
+
+bool streq(string, string); /* test string equality */
+real xrandom(real, real); /* generate a random number */
+void initparam(string *, string *); /* initialize parameter pkg */
+string getparam(string); /* get parameter as string */
+int getiparam(string); /* get parameter as integer */
+bool getbparam(string); /* get parameter as bool */
+real getrparam(string); /* get parameter as real */
diff --git a/test/ccured_olden/bh/data.in b/test/ccured_olden/bh/data.in
new file mode 100644
index 00000000..1901ba93
--- /dev/null
+++ b/test/ccured_olden/bh/data.in
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/ccured_olden/bh/data.orig.out b/test/ccured_olden/bh/data.orig.out
new file mode 100644
index 00000000..895eecb6
--- /dev/null
+++ b/test/ccured_olden/bh/data.orig.out
@@ -0,0 +1,462 @@
+
+Hierarchical code: Plummer model
+
+ nbody dtime eps theta usequad dtout
+ 1024 0.03125 0.0250 1.00 false 0.2500
+
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.000 -0.2605 -0.4941 208234 85 118
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 0.0000 0.0000
+ am vec 0.0040 0.0111 0.0039
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.031 -0.2605 -0.4945 211569 89 116
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 0.0000 0.0000
+ am vec 0.0040 0.0111 0.0039
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.062 -0.2606 -0.4949 213299 90 117
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0040 0.0111 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.094 -0.2606 -0.4954 213209 91 116
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0040 0.0111 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.125 -0.2606 -0.4957 214475 90 118
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.156 -0.2606 -0.4959 212360 87 119
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.188 -0.2606 -0.4961 215638 90 120
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.219 -0.2607 -0.4962 213907 90 118
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.250 -0.2606 -0.4966 211413 88 118
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.281 -0.2607 -0.4968 212516 90 116
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.312 -0.2606 -0.4971 212043 91 115
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.344 -0.2606 -0.4974 210500 90 115
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.375 -0.2605 -0.4976 210875 90 115
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.406 -0.2605 -0.4976 211891 91 115
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.438 -0.2606 -0.4975 212886 92 115
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel 0.0000 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.469 -0.2606 -0.4975 214848 93 115
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel 0.0000 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.500 -0.2604 -0.4976 212165 90 116
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.531 -0.2605 -0.4974 212366 90 117
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.562 -0.2606 -0.4971 212423 92 115
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.594 -0.2606 -0.4969 212283 93 113
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.625 -0.2604 -0.4969 211770 93 113
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.656 -0.2604 -0.4966 213017 94 113
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.688 -0.2605 -0.4964 211250 93 113
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.719 -0.2604 -0.4964 211170 92 113
+
+ cm pos 0.0000 -0.0001 0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.750 -0.2604 -0.4962 210947 92 113
+
+ cm pos 0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.781 -0.2604 -0.4959 210270 92 112
+
+ cm pos 0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.812 -0.2604 -0.4957 210869 92 112
+
+ cm pos 0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.844 -0.2603 -0.4954 210822 93 112
+
+ cm pos 0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.875 -0.2602 -0.4951 212697 95 112
+
+ cm pos 0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.906 -0.2602 -0.4948 210581 93 112
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.938 -0.2603 -0.4943 209929 93 111
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 0.969 -0.2603 -0.4939 212661 95 112
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.000 -0.2603 -0.4935 212223 94 112
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.031 -0.2602 -0.4932 211476 92 113
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.062 -0.2601 -0.4930 212513 95 112
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.094 -0.2602 -0.4926 212473 96 111
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0002 -0.0003 -0.0001
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.125 -0.2601 -0.4924 212418 94 112
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0002 -0.0003 -0.0001
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.156 -0.2601 -0.4921 211307 94 111
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0003 -0.0001
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.188 -0.2601 -0.4919 212029 96 110
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.219 -0.2600 -0.4916 211871 95 111
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.250 -0.2602 -0.4912 212729 93 113
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.281 -0.2603 -0.4908 211198 91 115
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.312 -0.2603 -0.4906 213544 93 115
+
+ cm pos -0.0002 -0.0003 -0.0001
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.344 -0.2602 -0.4906 212351 92 114
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.375 -0.2603 -0.4903 211854 91 115
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.406 -0.2603 -0.4902 211998 91 115
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.438 -0.2604 -0.4900 210887 89 116
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.469 -0.2604 -0.4899 210486 88 117
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0001 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.500 -0.2604 -0.4897 210373 87 117
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0004 -0.0001 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.531 -0.2604 -0.4896 210691 88 117
+
+ cm pos -0.0002 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.562 -0.2603 -0.4895 211982 89 117
+
+ cm pos -0.0002 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 0.0000
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.594 -0.2602 -0.4894 213499 93 115
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 0.0000
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.625 -0.2602 -0.4892 214135 93 115
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 0.0000
+ am vec 0.0040 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.656 -0.2600 -0.4891 212530 93 113
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 0.0000
+ am vec 0.0040 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.688 -0.2601 -0.4889 212150 93 113
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.719 -0.2600 -0.4886 212527 94 113
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.750 -0.2599 -0.4882 214475 95 113
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.781 -0.2600 -0.4877 211398 91 114
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.812 -0.2601 -0.4874 212928 92 115
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.844 -0.2600 -0.4872 209464 86 117
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.875 -0.2600 -0.4871 207897 83 119
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.906 -0.2599 -0.4871 209291 84 119
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.938 -0.2599 -0.4870 208078 85 118
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0006 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 1.969 -0.2599 -0.4866 209032 86 117
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0006 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg
+ 2.000 -0.2600 -0.4864 208927 85 118
+
+ cm pos -0.0005 -0.0004 -0.0002
+ cm vel -0.0006 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
diff --git a/test/ccured_olden/bh/data.out b/test/ccured_olden/bh/data.out
new file mode 100644
index 00000000..501f205e
--- /dev/null
+++ b/test/ccured_olden/bh/data.out
@@ -0,0 +1,462 @@
+
+Hierarchical code: Plummer model
+
+ nbody dtime eps theta usequad dtout tstop
+ 1024 0.03125 0.0250 1.00 false 0.2500 2.0000
+
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.000 -0.2605 -0.4941 208234 85 118 0.00
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0000 0.0000
+ am vec 0.0040 0.0111 0.0039
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.031 -0.2605 -0.4945 211569 89 116 0.00
+
+ cm pos 0.0000 -0.0000 0.0000
+ cm vel 0.0000 -0.0000 -0.0000
+ am vec 0.0040 0.0111 0.0039
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.062 -0.2606 -0.4949 213299 90 117 0.00
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel 0.0000 -0.0001 0.0000
+ am vec 0.0040 0.0111 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.094 -0.2606 -0.4954 213209 91 116 0.00
+
+ cm pos 0.0000 -0.0000 0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0040 0.0111 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.125 -0.2606 -0.4957 214475 90 118 0.00
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.156 -0.2606 -0.4959 212360 87 119 0.00
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.188 -0.2606 -0.4961 215638 90 120 0.00
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.219 -0.2607 -0.4962 213907 90 118 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.250 -0.2606 -0.4966 211413 88 118 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.281 -0.2607 -0.4968 212516 90 116 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0000
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.312 -0.2606 -0.4971 212043 91 115 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.344 -0.2606 -0.4974 210500 90 115 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.375 -0.2605 -0.4976 210875 90 115 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.406 -0.2605 -0.4976 211891 91 115 0.01
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel -0.0000 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.438 -0.2606 -0.4975 212886 92 115 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0000 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.469 -0.2606 -0.4975 214848 93 115 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0000 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.500 -0.2604 -0.4976 212165 90 116 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.531 -0.2605 -0.4974 212366 90 117 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0040
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.562 -0.2606 -0.4971 212423 92 115 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.594 -0.2606 -0.4969 212283 93 113 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.625 -0.2604 -0.4969 211770 93 113 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.656 -0.2604 -0.4966 213017 94 113 0.01
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.688 -0.2605 -0.4964 211250 93 113 0.02
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.719 -0.2604 -0.4964 211170 92 113 0.02
+
+ cm pos -0.0000 -0.0001 -0.0000
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.750 -0.2604 -0.4962 210947 92 113 0.02
+
+ cm pos -0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.781 -0.2604 -0.4959 210270 92 112 0.02
+
+ cm pos -0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.812 -0.2604 -0.4957 210869 92 112 0.02
+
+ cm pos -0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.844 -0.2603 -0.4954 210822 93 112 0.02
+
+ cm pos -0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.875 -0.2602 -0.4951 212697 95 112 0.02
+
+ cm pos -0.0000 -0.0002 -0.0001
+ cm vel -0.0001 -0.0003 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.906 -0.2602 -0.4948 210581 93 112 0.02
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.938 -0.2603 -0.4943 209929 93 111 0.02
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 0.969 -0.2603 -0.4939 212661 95 112 0.02
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.000 -0.2603 -0.4935 212223 94 112 0.02
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.031 -0.2602 -0.4932 211476 92 113 0.02
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.062 -0.2601 -0.4930 212513 95 112 0.02
+
+ cm pos -0.0001 -0.0002 -0.0001
+ cm vel -0.0002 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.094 -0.2602 -0.4926 212473 96 111 0.02
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0002 -0.0003 -0.0001
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.125 -0.2601 -0.4924 212418 94 112 0.03
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0002 -0.0003 -0.0001
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.156 -0.2601 -0.4921 211307 94 111 0.03
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0003 -0.0001
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.188 -0.2601 -0.4919 212029 96 110 0.03
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.219 -0.2600 -0.4916 211871 95 111 0.03
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0003 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.250 -0.2602 -0.4912 212729 93 113 0.03
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.281 -0.2603 -0.4908 211198 91 115 0.03
+
+ cm pos -0.0001 -0.0003 -0.0001
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.312 -0.2603 -0.4906 213544 93 115 0.03
+
+ cm pos -0.0002 -0.0003 -0.0001
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0039 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.344 -0.2602 -0.4906 212351 92 114 0.03
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0002
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.375 -0.2603 -0.4903 211854 91 115 0.03
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.406 -0.2603 -0.4902 211998 91 115 0.03
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.438 -0.2604 -0.4900 210887 89 116 0.03
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.469 -0.2604 -0.4899 210486 88 117 0.03
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0003 -0.0001 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.500 -0.2604 -0.4897 210373 87 117 0.03
+
+ cm pos -0.0002 -0.0003 -0.0002
+ cm vel -0.0004 -0.0001 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.531 -0.2604 -0.4896 210691 88 117 0.03
+
+ cm pos -0.0002 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 -0.0001
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.562 -0.2603 -0.4895 211982 89 117 0.03
+
+ cm pos -0.0002 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 -0.0000
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.594 -0.2602 -0.4894 213499 93 115 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 -0.0000
+ am vec 0.0040 0.0110 0.0041
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.625 -0.2602 -0.4892 214135 93 115 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 -0.0000
+ am vec 0.0040 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.656 -0.2600 -0.4891 212530 93 113 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0004 -0.0002 -0.0000
+ am vec 0.0040 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.688 -0.2601 -0.4889 212150 93 113 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.719 -0.2600 -0.4886 212527 94 113 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.750 -0.2599 -0.4882 214475 95 113 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.781 -0.2600 -0.4877 211398 91 114 0.04
+
+ cm pos -0.0003 -0.0004 -0.0002
+ cm vel -0.0005 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.812 -0.2601 -0.4874 212928 92 115 0.04
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.844 -0.2600 -0.4872 209464 86 117 0.04
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.875 -0.2600 -0.4871 207897 83 119 0.04
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0002 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.906 -0.2599 -0.4871 209291 84 119 0.04
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0005 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.938 -0.2599 -0.4870 208078 85 118 0.04
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0006 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 1.969 -0.2599 -0.4866 209032 86 117 0.04
+
+ cm pos -0.0004 -0.0004 -0.0002
+ cm vel -0.0006 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
+ tnow T+U T/U nttot nbavg ncavg cputime
+ 2.000 -0.2600 -0.4864 208927 85 118 0.04
+
+ cm pos -0.0005 -0.0004 -0.0002
+ cm vel -0.0006 -0.0001 -0.0001
+ am vec 0.0039 0.0110 0.0042
+
diff --git a/test/ccured_olden/bh/defs.h b/test/ccured_olden/bh/defs.h
new file mode 100644
index 00000000..d8b46432
--- /dev/null
+++ b/test/ccured_olden/bh/defs.h
@@ -0,0 +1,196 @@
+/****************************************************************************/
+/* DEFS.H: include file for hierarchical force calculation routines. The */
+/* definitions in this file are needed for load.c and grav.c; this file */
+/* does not provide definitions for other parts of the N-body code. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "stdinc.h"
+#include "real.h"
+#include "vectmath.h"
+
+/*
+ * Body and cell data structures are used to represent the tree. During
+ * tree construction, descendent pointers are stored in the subp arrays:
+ *
+ * +-------------------------------------------------------------+
+ * root --> | CELL: mass, pos, next, rcrit2, more, subp:[/,o,/,/,/,/,o,/] |
+ * +----------------------------------------------|---------|----+
+ * | |
+ * +---------------------------------------------------+ |
+ * | |
+ * | +--------------------------------------+ |
+ * +--> | BODY: mass, pos, next, vel, acc, phi | |
+ * +--------------------------------------+ |
+ * |
+ * +-------------------------------------------------------------+
+ * |
+ * | +-------------------------------------------------------------+
+ * +--> | CELL: mass, pos, next, rcrit2, more, subp:[o,/,/,o,/,/,o,/] |
+ * +--------------------------------------------|-----|-----|----+
+ * etc etc etc
+ *
+ * After the tree is complete, it is threaded to permit linear force
+ * calculation, using the next and more pointers. The storage used for
+ * the subp arrays may be reused to store quadrupole moments.
+ *
+ * +-----------------------------------------------+
+ * root --> | CELL: mass, pos, next:/, rcrit2, more:o, quad |
+ * +---------------------------------------|-------+
+ * |
+ * +--------------------------------------------+
+ * |
+ * | +----------------------------------------+
+ * +--> | BODY: mass, pos, next:o, vel, acc, phi |
+ * +-----------------------|----------------+
+ * |
+ * +----------------------------+
+ * |
+ * | +-----------------------------------------------+
+ * +--> | CELL: mass, pos, next:/, rcrit2, more:o, quad |
+ * +---------------------------------------|-------+
+ * etc
+ */
+
+/*
+ * NODE: data common to BODY and CELL structures.
+ */
+
+typedef struct _node {
+ short type; /* code for node type */
+ real mass; /* total mass of node */
+ vector pos; /* position of node */
+ struct _node *next; /* link to next force-calc */
+} node, *nodeptr;
+
+#define Type(x) (((nodeptr) (x))->type)
+#define Mass(x) (((nodeptr) (x))->mass)
+#define Pos(x) (((nodeptr) (x))->pos)
+#define Next(x) (((nodeptr) (x))->next)
+
+/*
+ * BODY: data structure used to represent particles.
+ */
+
+#define BODY 01 /* type code for bodies */
+
+typedef struct {
+ node bodynode; /* data common to all nodes */
+ vector vel; /* velocity of body */
+ vector acc; /* acceleration of body */
+ real phi; /* potential at body */
+} body, *bodyptr;
+
+
+#define Body body
+
+#if defined(CCURED) && !defined(NO_PERF_CHANGES)
+ extern bodyptr node2body(nodeptr x);
+#else
+ // when not in box mode, or when we want to measure the original program's
+ // performance, use an ordinary cast
+ #define node2body(x) ((bodyptr)(x))
+#endif
+
+#define Vel(x) (((x))->vel)
+#define Acc(x) (((x))->acc)
+#define Phi(x) (((x))->phi)
+
+// Field accessor functions from nodeptr
+#define VelN(x) ((node2body(x))->vel)
+#define AccN(x) ((node2body(x))->acc)
+#define PhiN(x) ((node2body(x))->phi)
+
+/*
+ * CELL: structure used to represent internal nodes of tree.
+ */
+
+#define CELL 02 /* type code for cells */
+
+#define NSUB (1 << NDIM) /* subcells per cell */
+
+#ifndef __SAFEUNION
+#define __SAFEUNION
+#endif
+
+typedef struct {
+ node cellnode; /* data common to all nodes */
+ real rcrit2; /* critical c-of-m radius^2 */
+ nodeptr more; /* link to first descendent */
+ union { /* shared storage for... */
+ nodeptr subp[NSUB]; /* descendents of cell */
+ matrix quad; /* quad. moment of cell */
+ } __SAFEUNION stuff;
+} cell, *cellptr;
+
+#if defined(CCURED) && !defined(NO_PERF_CHANGES)
+ extern cellptr node2cell(nodeptr x);
+#else
+ #define node2cell(x) ((cellptr)(x))
+#endif
+
+#define Rcrit2(x) ((x)->rcrit2)
+#define More(x) ((x)->more)
+#define Subp(x) ((x)->stuff.subp)
+#define Quad(x) ((x)->stuff.quad)
+
+#define Rcrit2N(x) ((node2cell(x))->rcrit2)
+#define MoreN(x) ((node2cell(x))->more)
+#define SubpN(x) ((node2cell(x))->stuff.subp)
+#define QuadN(x) ((node2cell(x))->stuff.quad)
+
+/*
+ * Variables used in tree construction.
+ */
+
+global cellptr root; /* pointer to root cell */
+
+global real rsize; /* side-length of root cell */
+
+global int cellused; /* count of cells in tree */
+
+global int maxlevel; /* count of levels in tree */
+
+/*
+ * Parameters and results for gravitational calculation.
+ */
+
+global string options; /* various option keywords */
+
+global real theta; /* accuracy parameter: 0.0 => exact */
+
+global bool usequad; /* use quadrupole corrections */
+
+global real eps; /* potential softening parameter */
+
+global int n2bterm; /* number 2-body of terms evaluated */
+
+global int nbcterm; /* num of body-cell terms evaluated */
+
+/*
+ * Utility routines used in load.c and grav.c. These are defined in
+ * util.c, which must be compiled with the same choice of precision.
+ */
+
+bool scanopt(string, string); /* find option in string */
+real cputime(void); /* return elapsed CPU time */
+
+#ifdef CCURED
+ #pragma ccuredvararg("error", printf(1))
+ #pragma ccuredvararg("eprintf", printf(1))
+ #ifndef NO_PERF_CHANGES
+ #pragma ccuredalloc("allocate", zero, sizein(1))
+ #endif
+#endif
+void *allocate(int); /* allocate and zero memory */
+
+real distv(vector, vector); /* distance between vectors */
+
+void error(string, ...); /* report error and exit */
+
+void eprintf(string, ...); /* printf to error stream */
+
+
+
diff --git a/test/ccured_olden/bh/getparam.c b/test/ccured_olden/bh/getparam.c
new file mode 100644
index 00000000..9f3d1cf2
--- /dev/null
+++ b/test/ccured_olden/bh/getparam.c
@@ -0,0 +1,142 @@
+/****************************************************************************/
+/* GETPARAM.C: export version prompts user for values. Public routines: */
+/* initparam(), getparam(), getiparam(), getbparam(), getrparam(). */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "stdinc.h"
+#include "real.h"
+#include <string.h>
+#include <stdlib.h>
+
+void *allocate(int);
+void error(string, ...);
+
+local string *defaults = NULL; /* "name=value" strings */
+
+/*
+ * INITPARAM: ignore arg vector, remember defaults.
+ */
+
+void initparam(string *argv, string *defv)
+{
+ defaults = defv;
+}
+
+/*
+ * GETPARAM: export version prompts user for value of name.
+ */
+
+local int scanbind(string *, string);
+local string extrvalue(string);
+
+string getparam(string name)
+{
+ int i, len;
+ string def;
+ char buf[128];
+
+ if (defaults == NULL) /* check initialization */
+ error("getparam: called before initparam\n");
+ i = scanbind(defaults, name); /* find name in defaults */
+ if (i < 0)
+ error("getparam: %s unknown\n", name);
+ def = extrvalue(defaults[i]); /* extract default value */
+ if (*def == NULLCHR)
+ fprintf(stderr, "enter %s: ", name); /* prompt user for value */
+ else
+ fprintf(stderr, "enter %s [%s]: ", name, def);
+ gets(buf); /* read users response */
+ len = strlen(buf);
+ if (len > 0) /* if user gave a value... */
+ return (strcpy((string) allocate(len+1), buf));
+ else /* else return default */
+ return (def);
+}
+
+/*
+ * GETIPARAM, ..., GETDPARAM: get int, long, bool, or double parameters.
+ */
+
+int getiparam(string name)
+{
+ string val;
+
+ for (val = ""; *val == NULLCHR; ) /* while nothing input */
+ val = getparam(name); /* obtain value from user */
+ return (atoi(val)); /* convert to an integer */
+}
+
+bool getbparam(string name)
+{
+ string val;
+
+ for (val = ""; *val == NULLCHR; )
+ val = getparam(name);
+ if (strchr("tTyY1", *val) != NULLCHR) /* is value true? */
+ return (TRUE);
+ if (strchr("fFnN0", *val) != NULLCHR) /* is value false? */
+ return (FALSE);
+ error("getbparam: %s=%s not bool\n", name, val);
+ return (FALSE);
+}
+
+real getrparam(string name)
+{
+ string val;
+
+ for (val = ""; *val == NULLCHR; )
+ val = getparam(name);
+ return ((real) atof(val)); /* convert & return real */
+}
+
+/*
+ * SCANBIND: scan binding vector for name, return index.
+ */
+
+local bool matchname(string, string);
+
+local int scanbind(string bvec[], string name)
+{
+ int i;
+
+ for (i = 0; bvec[i] != NULL; i++)
+ if (matchname(bvec[i], name))
+ return (i);
+ return (-1);
+}
+
+/*
+ * MATCHNAME: determine if "name=value" matches "name".
+ */
+
+local bool matchname(string bind, string name)
+{
+ char *bp, *np;
+
+ bp = bind;
+ np = name;
+ while (*bp == *np) {
+ bp++;
+ np++;
+ }
+ return (*bp == '=' && *np == NULLCHR);
+}
+
+/*
+ * EXTRVALUE: extract value from name=value string.
+ */
+
+local string extrvalue(string arg)
+{
+ char *ap;
+
+ ap = (char *) arg;
+ while (*ap != NULLCHR)
+ if (*ap++ == '=')
+ return ((string) ap);
+ return (NULL);
+}
+
diff --git a/test/ccured_olden/bh/grav.c b/test/ccured_olden/bh/grav.c
new file mode 100644
index 00000000..06009df1
--- /dev/null
+++ b/test/ccured_olden/bh/grav.c
@@ -0,0 +1,123 @@
+/****************************************************************************/
+/* GRAV.C: routines to compute gravity. Public routines: hackgrav(). */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "defs.h"
+
+local void treescan(nodeptr); /* does force calculation */
+local bool subdivp(cellptr); /* can cell be accepted? */
+local void gravsub(nodeptr); /* compute grav interaction */
+
+/*
+ * HACKGRAV: evaluate gravitational field on body p; checks to be
+ * sure self-interaction was handled correctly if intree is true.
+ */
+
+local bodyptr pskip; /* skip in force evaluation */
+local vector pos0; /* point to evaluate field */
+local real phi0; /* resulting potential */
+local vector acc0; /* resulting acceleration */
+local bool skipself; /* self-interaction skipped */
+local bool treeincest = FALSE; /* tree-incest occured */
+
+void hackgrav(bodyptr p, bool intree)
+{
+ pskip = p; /* exclude p from f.c. */
+ SETV(pos0, Pos(p)); /* set field point */
+ phi0 = 0.0; /* init total potential */
+ CLRV(acc0); /* and total acceleration */
+ n2bterm = nbcterm = 0; /* count body & cell terms */
+ skipself = FALSE; /* watch for tree-incest */
+ treescan((nodeptr) root); /* scan tree from root */
+ if (intree && ! skipself) { /* did tree-incest occur? */
+ if (! scanopt(options, "allow-incest")) /* treat as catastrophic? */
+ error("hackgrav: tree-incest detected\n");
+ if (! treeincest) /* for the first time? */
+ eprintf("\n[hackgrav: tree-incest detected]\n");
+ treeincest = TRUE; /* don't repeat warning */
+ }
+ Phi(p) = phi0; /* store total potential */
+ SETV(Acc(p), acc0); /* and acceleration */
+}
+
+/*
+ * TREESCAN: iterative routine to do force calculation, starting
+ * with node q, which is typically the root cell.
+ */
+
+local void treescan(nodeptr q)
+{
+ while (q != NULL) { /* while not at end of scan */
+ if (Type(q) == CELL && /* is node a cell and... */
+ subdivp(node2cell(q))) /* too close to accept? */
+ q = MoreN(q); /* follow to next level */
+ else { /* else accept this term */
+ if (q == (nodeptr) pskip) /* self-interaction? */
+ skipself = TRUE; /* then just skip it */
+ else { /* not self-interaction */
+ gravsub(q); /* so compute gravity */
+ if (Type(q) == BODY)
+ n2bterm++; /* count body-body */
+ else
+ nbcterm++; /* count body-cell */
+ }
+ q = Next(q); /* follow next link */
+ }
+ }
+}
+
+/*
+ * SUBDIVP: decide if cell q is too close to accept as a single
+ * term. Also sets qmem, dr, and drsq for use by gravsub.
+ */
+
+local cellptr qmem; /* data shared with gravsub */
+local vector dr; /* vector from q to pos0 */
+local real drsq; /* squared distance to pos0 */
+
+local bool subdivp(cellptr q)
+{
+ SUBV(dr, Pos(q), pos0); /* compute displacement */
+ DOTVP(drsq, dr, dr); /* and find dist squared */
+ qmem = q; /* remember we know them */
+ return (drsq < Rcrit2(q)); /* apply standard rule */
+}
+
+/*
+ * GRAVSUB: compute contribution of node q to gravitational field at
+ * point pos0, and add to running totals phi0 and acc0.
+ */
+
+local void gravsub(nodeptr q)
+{
+ real drab, phii, mor3;
+ vector ai, quaddr;
+ real dr5inv, phiquad, drquaddr;
+
+ if (q != (nodeptr) qmem) { /* cant use memorized data? */
+ SUBV(dr, Pos(q), pos0); /* then compute sep. */
+ DOTVP(drsq, dr, dr); /* and sep. squared */
+ }
+ drsq += eps*eps; /* use standard softening */
+ drab = rsqrt(drsq);
+ phii = Mass(q) / drab;
+ mor3 = phii / drsq;
+ MULVS(ai, dr, mor3);
+ phi0 -= phii; /* add to total grav. pot. */
+ ADDV(acc0, acc0, ai); /* ... and to total accel. */
+ if (usequad && Type(q) == CELL) { /* if cell, add quad term */
+ dr5inv = 1.0/(drsq * drsq * drab); /* form dr^-5 */
+ MULMV(quaddr, QuadN(q), dr); /* form Q * dr */
+ DOTVP(drquaddr, dr, quaddr); /* form dr * Q * dr */
+ phiquad = -0.5 * dr5inv * drquaddr; /* get quad. part of phi */
+ phi0 = phi0 + phiquad; /* increment potential */
+ phiquad = 5.0 * phiquad / drsq; /* save for acceleration */
+ MULVS(ai, dr, phiquad); /* components of acc. */
+ SUBV(acc0, acc0, ai); /* increment */
+ MULVS(quaddr, quaddr, dr5inv);
+ SUBV(acc0, acc0, quaddr); /* acceleration */
+ }
+}
diff --git a/test/ccured_olden/bh/input b/test/ccured_olden/bh/input
new file mode 100644
index 00000000..a72ad2d0
--- /dev/null
+++ b/test/ccured_olden/bh/input
@@ -0,0 +1,12 @@
+
+16384
+123
+
+0.025
+0.05
+1.0
+2.0
+5.0
+0.075
+0.25
+1
diff --git a/test/ccured_olden/bh/io.c b/test/ccured_olden/bh/io.c
new file mode 100644
index 00000000..cf2dbb9a
--- /dev/null
+++ b/test/ccured_olden/bh/io.c
@@ -0,0 +1,252 @@
+/****************************************************************************/
+/* IO.C: I/O routines for export version of hierarchical N-body code. */
+/* Public routines: inputdata(), initoutput(), stopoutput(), output(). */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "code.h"
+
+local void diagnostics(void);
+local void in_int(stream, int *);
+local void in_real(stream, real *);
+local void in_vector(stream, vector);
+local void out_int(stream, int);
+local void out_real(stream, real);
+local void out_vector(stream, vector);
+local void printvec(string, vector);
+
+/*
+ * INPUTDATA: read initial conditions from input file.
+ */
+
+void inputdata(void)
+{
+ stream instr;
+ permanent char headbuf[128];
+ int ndim;
+ bodyptr p;
+
+ instr = fopen(infile, "r"); /* open input stream */
+ if (instr == NULL)
+ error("inputdata: cannot find file %s\n", infile);
+ sprintf(headbuf, "Hierarchical code: input file %s", infile);
+ headline = headbuf;
+ in_int(instr, &nbody);
+ if (nbody < 1)
+ error("inputdata: nbody = %d is absurd\n", nbody);
+ in_int(instr, &ndim);
+ if (ndim != NDIM)
+ error("inputdata: ndim = %d is absurd\n", ndim);
+ in_real(instr, &tnow);
+ bodytab = (bodyptr) allocate(nbody * sizeof(body));
+ for (p = bodytab; p < bodytab+nbody; p++) /* loop over new bodies */
+ Type(p) = BODY; /* init body type */
+ for (p = bodytab; p < bodytab+nbody; p++)
+ in_real(instr, &Mass(p));
+ for (p = bodytab; p < bodytab+nbody; p++)
+ in_vector(instr, Pos(p));
+ for (p = bodytab; p < bodytab+nbody; p++)
+ in_vector(instr, Vel(p));
+ fclose(instr); /* close input stream */
+}
+
+/*
+ * INITOUTPUT: initialize output routines.
+ */
+
+local stream outstr; /* output stream pointer */
+
+void initoutput(void)
+{
+ printf("\n%s\n\n", headline); /* print headline, params */
+ printf("%10s%10s%10s%10s%10s%10s%10s\n", "nbody", "dtime", "eps",
+ "theta", "usequad", "dtout", "tstop");
+ printf("%10d%10.5f%10.4f%10.2f%10s%10.4f%10.4f\n\n", nbody, 1/freq, eps,
+ theta, usequad ? "true" : "false", 1/freqout, tstop);
+ if (*options != NULLCHR) /* print options, if any */
+ printf("\tOptions: %s\n\n", options);
+ printf("\n");
+ if (*outfile != NULLCHR) { /* output file specified? */
+ outstr = fopen(outfile, "w"); /* setup output stream */
+ if (outstr == NULL)
+ error("initoutput: cannot open file %s\n", outfile);
+ } else
+ outstr = NULL; /* turn off data output */
+}
+
+/*
+ * STOPOUTPUT: finish up after a run.
+ */
+
+void stopoutput(void)
+{
+ if (outstr != NULL)
+ fclose(outstr);
+}
+
+/*
+ * Counters and accumulators for output routines.
+ */
+
+local real mtot; /* total mass of N-body system */
+local real etot[3]; /* binding, kinetic, potential energy */
+local matrix keten; /* kinetic energy tensor */
+local matrix peten; /* potential energy tensor */
+local vector cmphase[2]; /* center of mass coordinates */
+local vector amvec; /* angular momentum vector */
+
+/*
+ * OUTPUT: compute diagnostics and output data.
+ */
+
+void output(void)
+{
+ int nttot, nbavg, ncavg;
+ bodyptr p;
+
+ diagnostics(); /* compute std diagnostics */
+ nttot = n2bcalc + nbccalc;
+ nbavg = (int) ((real) n2bcalc / (real) nbody);
+ ncavg = (int) ((real) nbccalc / (real) nbody);
+ printf("%10s%10s%10s%10s%10s%10s%10s\n", "tnow", "T+U",
+ "T/U", "nttot", "nbavg", "ncavg", "cputime");
+ printf("%10.3f%10.4f%10.4f%10d%10d%10d%10.2f\n\n", tnow, etot[0],
+ etot[1]/etot[2], nttot, nbavg, ncavg, cputime());
+ if (scanopt(options, "tree-report")) { /* report on tree structure */
+ printf("\t %20s%20s%20s\n", "rsize", "cellused", "maxlevel");
+ printf("\t %20.2f%20d%20d\n\n", rsize, cellused, maxlevel);
+ }
+ printvec("cm pos", cmphase[0]);
+ printvec("cm vel", cmphase[1]);
+ printvec("am vec", amvec);
+ printf("\n");
+ if (outstr != NULL && /* output stream open and */
+ (tout - 0.01 / freq) <= tnow) { /* ...time for next output? */
+ out_int(outstr, nbody); /* write particle data */
+ out_int(outstr, NDIM);
+ out_real(outstr, tnow);
+ for (p = bodytab; p < bodytab+nbody; p++)
+ out_real(outstr, Mass(p));
+ for (p = bodytab; p < bodytab+nbody; p++)
+ out_vector(outstr, Pos(p));
+ for (p = bodytab; p < bodytab+nbody; p++)
+ out_vector(outstr, Vel(p));
+ fflush(outstr); /* drain output buffer */
+ printf("\tParticle data written to file %s\n\n", outfile);
+ tout += 1 / freqout; /* schedule next data out */
+ }
+}
+
+/*
+ * DIAGNOSTICS: compute various dynamical diagnostics.
+ */
+
+local void diagnostics(void)
+{
+ register bodyptr p;
+ real velsq;
+ vector tmpv;
+ matrix tmpt;
+
+ mtot = 0.0; /* zero total mass */
+ etot[1] = etot[2] = 0.0; /* zero total KE and PE */
+ CLRM(keten); /* zero ke tensor */
+ CLRM(peten); /* zero pe tensor */
+ CLRV(cmphase[0]); /* zero c. of m. position */
+ CLRV(cmphase[1]); /* zero c. of m. velocity */
+ CLRV(amvec); /* zero am vector */
+ for (p = bodytab; p < bodytab+nbody; p++) { /* loop over all particles */
+ mtot += Mass(p); /* sum particle masses */
+ DOTVP(velsq, Vel(p), Vel(p)); /* square vel vector */
+ etot[1] += 0.5 * Mass(p) * velsq; /* sum current KE */
+ etot[2] += 0.5 * Mass(p) * Phi(p); /* and current PE */
+ MULVS(tmpv, Vel(p), 0.5 * Mass(p)); /* sum 0.5 m v_i v_j */
+ OUTVP(tmpt, tmpv, Vel(p));
+ ADDM(keten, keten, tmpt);
+ MULVS(tmpv, Pos(p), Mass(p)); /* sum m r_i a_j */
+ OUTVP(tmpt, tmpv, Acc(p));
+ ADDM(peten, peten, tmpt);
+ MULVS(tmpv, Pos(p), Mass(p)); /* sum cm position */
+ ADDV(cmphase[0], cmphase[0], tmpv);
+ MULVS(tmpv, Vel(p), Mass(p)); /* sum cm momentum */
+ ADDV(cmphase[1], cmphase[1], tmpv);
+ CROSSVP(tmpv, Pos(p), Vel(p)); /* sum angular momentum */
+ MULVS(tmpv, tmpv, Mass(p));
+ ADDV(amvec, amvec, tmpv);
+ }
+ etot[0] = etot[1] + etot[2]; /* sum KE and PE */
+ DIVVS(cmphase[0], cmphase[0], mtot); /* normalize cm coords */
+ DIVVS(cmphase[1], cmphase[1], mtot);
+}
+
+/*
+ * Low-level input and output operations.
+ */
+
+local void in_int(stream str, int *iptr)
+{
+#ifdef CCURED
+ if((resetScanfCount(),
+ *iptr = ccured_fscanf_int(str, "%d"),
+ getScanfCount()) != 1)
+ error("in_int: input conversion error\n");
+#else
+ if (fscanf(str, "%d", iptr) != 1)
+ error("in_int: input conversion error\n");
+#endif
+}
+
+local void in_real(stream str, real *rptr)
+{
+ double tmp;
+
+#ifdef CCURED
+ if((resetScanfCount(),
+ tmp = ccured_fscanf_double(str, "%lf"),
+ getScanfCount()) != 1)
+#else
+ if (fscanf(str, "%lf", &tmp) != 1)
+#endif
+ error("in_real: input conversion error\n");
+ *rptr = tmp;
+}
+
+local void in_vector(stream str, vector vec)
+{
+ double tmpx, tmpy, tmpz;
+#ifdef CCURED
+ if((resetScanfCount(),
+ tmpx = ccured_fscanf_double(str, "%lf"),
+ tmpx = ccured_fscanf_double(str, "%lf"),
+ tmpx = ccured_fscanf_double(str, "%lf"),
+ getScanfCount()) != 3)
+#else
+ if (fscanf(str, "%lf%lf%lf", &tmpx, &tmpy, &tmpz) != 3)
+#endif
+ error("in_vector: input conversion error\n");
+
+ vec[0] = tmpx; vec[1] = tmpy; vec[2] = tmpz;
+}
+
+local void out_int(stream str, int ival)
+{
+ fprintf(str, " %d\n", ival);
+}
+
+local void out_real(stream str, real rval)
+{
+ fprintf(str, " %21.14E\n", rval);
+}
+
+local void out_vector(stream str, vector vec)
+{
+ fprintf(str, " %21.14E %21.14E %21.14E\n", vec[0], vec[1], vec[2]);
+}
+
+local void printvec(string name, vector vec)
+{
+ printf(" %10s%10.4f%10.4f%10.4f\n",
+ name, vec[0], vec[1], vec[2]);
+}
diff --git a/test/ccured_olden/bh/load.c b/test/ccured_olden/bh/load.c
new file mode 100644
index 00000000..ef1155fb
--- /dev/null
+++ b/test/ccured_olden/bh/load.c
@@ -0,0 +1,287 @@
+/****************************************************************************/
+/* LOAD.C: routines to create tree. Public routines: maketree(). */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "defs.h"
+
+local void newtree(void); /* flush existing tree */
+local cellptr makecell(void); /* create an empty cell */
+local void expandbox(bodyptr, int); /* set size of root cell */
+local void loadbody(bodyptr); /* load body into tree */
+local int subindex(bodyptr, cellptr); /* compute subcell index */
+local void hackcofm(cellptr, real); /* find centers of mass */
+local void setrcrit(cellptr, vector, real); /* set cell's crit. radius */
+local void threadtree(nodeptr, nodeptr); /* set next and more links */
+local void hackquad(cellptr); /* compute quad moments */
+
+/*
+ * MAKETREE: initialize tree structure for hierarchical force calculation
+ * from body array btab, which contains nbody bodies.
+ */
+
+local bool bh86, sw93; /* use alternate criteria */
+
+void maketree(bodyptr btab, int nbody)
+{
+ bodyptr p;
+
+ newtree(); /* flush existing tree, etc */
+ root = makecell(); /* allocate the root cell */
+ CLRV(Pos(root)); /* initialize the midpoint */
+ expandbox(btab, nbody); /* and expand cell to fit */
+ maxlevel = 0; /* init count of levels */
+ for (p = btab; p < btab+nbody; p++) /* loop over bodies... */
+ if (Mass(p) != 0.0) /* exclude test particles */
+ loadbody(p); /* and insert into tree */
+ bh86 = scanopt(options, "bh86"); /* set flags for alternate */
+ sw93 = scanopt(options, "sw93"); /* ...cell opening criteria */
+ if (bh86 && sw93) /* can't have both at once */
+ error("maketree: options bh86 and sw93 are incompatible\n");
+ hackcofm(root, rsize); /* find c-of-m coordinates */
+ threadtree((nodeptr) root, NULL); /* add Next and More links */
+ if (usequad) /* including quad moments? */
+ hackquad(root); /* assign Quad moments */
+}
+
+/*
+ * NEWTREE: reclaim cells in tree, prepare to build new one.
+ */
+
+local nodeptr freecell = NULL; /* list of free cells */
+
+local void newtree(void)
+{
+ permanent bool firstcall = TRUE;
+ nodeptr p;
+
+ if (! firstcall) { /* tree data to reclaim? */
+ p = (nodeptr) root; /* start with the root */
+ while (p != NULL) /* loop scanning tree */
+ if (Type(p) == CELL) { /* found cell to free? */
+ Next(p) = freecell; /* link to front of */
+ freecell = p; /* ...existing list */
+ p = MoreN(p); /* scan down tree */
+ } else /* skip over bodies */
+ p = Next(p); /* go on to next */
+ } else /* first time through */
+ firstcall = FALSE; /* so just note it */
+ root = NULL; /* flush existing tree */
+ cellused = 0; /* reset cell count */
+}
+
+/*
+ * MAKECELL: return pointer to free cell.
+ */
+
+local cellptr makecell(void)
+{
+ cellptr c;
+ int i;
+
+ if (freecell == NULL) { /* no free cells left? */
+ c = (cellptr) allocate(sizeof(cell)); /* allocate a new one */
+ #ifndef NO_PERF_CHANGES
+ Type(c) = CELL; /* initialize cell type */
+ #endif
+ } else { /* use existing free cell */
+ Type(freecell) = CELL; /* initialize cell type */
+ c = node2cell (freecell); /* take one on front */
+ freecell = Next(c); /* go on to next one */
+ }
+ #ifdef NO_PERF_CHANGES
+ Type(c) = CELL; /* initialize cell type */
+ #endif
+ for (i = 0; i < NSUB; i++) /* loop over subcells */
+ Subp(c)[i] = NULL; /* and empty each one */
+ cellused++; /* count one more cell */
+ return (c);
+}
+
+/*
+ * EXPANDBOX: find range of coordinate values (with respect to root)
+ * and expand root cell to fit. The size is doubled at each step to
+ * take advantage of exact representation of powers of two.
+ */
+
+local void expandbox(bodyptr btab, int nbody)
+{
+ real xyzmax;
+ bodyptr p;
+ int k;
+
+ xyzmax = 0.0;
+ for (p = btab; p < btab+nbody; p++)
+ for (k = 0; k < NDIM; k++)
+ xyzmax = MAX(xyzmax, rabs(Pos(p)[k] - Pos(root)[k]));
+ while (rsize < 2 * xyzmax)
+ rsize = 2 * rsize;
+}
+
+/*
+ * LOADBODY: descend tree and insert body p in appropriate place.
+ */
+
+local void loadbody(bodyptr p)
+{
+ cellptr q, c;
+ int qind, lev, k;
+ real qsize;
+
+ q = root; /* start with tree root */
+ qind = subindex(p, q); /* get index of subcell */
+ qsize = rsize; /* keep track of cell size */
+ lev = 0; /* count levels descended */
+ while (Subp(q)[qind] != NULL) { /* loop descending tree */
+ if (Type(Subp(q)[qind]) == BODY) { /* reached a "leaf"? */
+ c = makecell(); /* allocate new cell */
+ for (k = 0; k < NDIM; k++) /* initialize midpoint */
+ Pos(c)[k] = Pos(q)[k] + /* offset from parent */
+ (Pos(p)[k] < Pos(q)[k] ? - qsize : qsize) / 4;
+ Subp(c)[subindex(node2body(Subp(q)[qind]), c)] = Subp(q)[qind];
+ /* put body in cell */
+ Subp(q)[qind] = (nodeptr) c; /* link cell in tree */
+ }
+ q = node2cell(Subp(q)[qind]); /* advance to next level */
+ qind = subindex(p, q); /* get index to examine */
+ qsize = qsize / 2; /* shrink current cell */
+ lev++; /* count another level */
+ }
+ Subp(q)[qind] = (nodeptr) p; /* found place, store p */
+ maxlevel = MAX(maxlevel, lev); /* remember maximum level */
+}
+
+/*
+ * SUBINDEX: compute subcell index for body p in cell q.
+ */
+
+local int subindex(bodyptr p, cellptr q)
+{
+ int ind, k;
+
+ ind = 0; /* accumulate subcell index */
+ for (k = 0; k < NDIM; k++) /* loop over dimensions */
+ if (Pos(q)[k] <= Pos(p)[k]) /* if beyond midpoint */
+ ind += NSUB >> (k + 1); /* skip over subcells */
+ return (ind);
+}
+
+/*
+ * HACKCOFM: descend tree finding center-of-mass coordinates and
+ * setting critical cell radii.
+ */
+
+local void hackcofm(cellptr p, real psize)
+{
+ vector cmpos, tmpv;
+ int i, k;
+ nodeptr q;
+
+ Mass(p) = 0.0; /* init total mass... */
+ CLRV(cmpos); /* and center of mass */
+ for (i = 0; i < NSUB; i++) /* loop over subnodes */
+ if ((q = Subp(p)[i]) != NULL) { /* does subnode exist? */
+ if (Type(q) == CELL) /* and is it a cell? */
+ hackcofm(node2cell(q), psize/2); /* find subcell cm */
+ Mass(p) += Mass(q); /* sum total mass */
+ MULVS(tmpv, Pos(q), Mass(q)); /* weight pos by mass */
+ ADDV(cmpos, cmpos, tmpv); /* sum c-of-m position */
+ }
+ DIVVS(cmpos, cmpos, Mass(p)); /* rescale cms position */
+ for (k = 0; k < NDIM; k++) /* check tree structure... */
+ if (cmpos[k] < Pos(p)[k] - psize/2 || /* if out of bounds */
+ Pos(p)[k] + psize/2 <= cmpos[k]) /* in either direction */
+ error("hackcofm: tree structure error\n");
+ setrcrit(p, cmpos, psize); /* set critical radius */
+ SETV(Pos(p), cmpos); /* and center-of-mass pos */
+}
+
+/*
+ * SETRCRIT: assign critical radius for cell p, using center-of-mass
+ * position cmpos and cell size psize.
+ */
+
+local void setrcrit(cellptr p, vector cmpos, real psize)
+{
+ real rc, bmax2, dmin;
+ int k;
+
+ if (theta == 0.0) /* exact force calculation? */
+ rc = 2 * rsize; /* always open cells */
+ else if (bh86) /* use old BH criterion? */
+ rc = psize / theta; /* using size of cell */
+ else if (sw93) { /* use S&W's criterion? */
+ bmax2 = 0.0; /* compute max distance^2 */
+ for (k = 0; k < NDIM; k++) { /* loop over dimensions */
+ dmin = cmpos[k] - (Pos(p)[k] - psize/2);
+ /* dist from 1st corner */
+ bmax2 += rsqr(MAX(dmin, psize - dmin));
+ /* sum max distance^2 */
+ }
+ rc = rsqrt(bmax2) / theta; /* using max dist from cm */
+ } else { /* use new criterion? */
+ rc = psize / theta + distv(cmpos, Pos(p));
+ /* use size plus offset */
+ }
+ Rcrit2(p) = rsqr(rc); /* store square of radius */
+}
+
+/*
+ * THREADTREE: do a recursive treewalk starting from node p,
+ * with next stop n, installing Next and More links.
+ */
+
+local void threadtree(nodeptr p, nodeptr n)
+{
+ int ndesc, i;
+ nodeptr desc[NSUB+1];
+
+ Next(p) = n; /* link to next node */
+ if (Type(p) == CELL) { /* any children to thread? */
+ ndesc = 0; /* count extant children */
+ for (i = 0; i < NSUB; i++) /* loop over subnodes */
+ if (SubpN(p)[i] != NULL) /* found a live one? */
+ desc[ndesc++] = SubpN(p)[i]; /* store in table */
+ MoreN(p) = desc[0]; /* link to first child */
+ desc[ndesc] = n; /* end table with next */
+ for (i = 0; i < ndesc; i++) /* loop over children */
+ threadtree(desc[i], desc[i+1]); /* thread each w/ next */
+ }
+}
+
+/*
+ * HACKQUAD: descend tree, evaluating quadrupole moments. Note that this
+ * routine is coded so that the Subp() and Quad() components of a cell can
+ * share the same memory locations.
+ */
+
+local void hackquad(cellptr p)
+{
+ int i;
+ nodeptr psub[NSUB], q;
+ vector dr;
+ real drsq;
+ matrix drdr, Idrsq, tmpm;
+
+ for (i = 0; i < NSUB; i++) /* loop over subnodes */
+ psub[i] = Subp(p)[i]; /* copy each to safety */
+ CLRM(Quad(p)); /* init quadrupole moment */
+ for (i = 0; i < NSUB; i++) /* loop over subnodes */
+ if ((q = psub[i]) != NULL) { /* does subnode exist? */
+ if (Type(q) == CELL) /* and is it a call? */
+ hackquad(node2cell(q)); /* process it first */
+ SUBV(dr, Pos(q), Pos(p)); /* displacement vect. */
+ OUTVP(drdr, dr, dr); /* outer prod. of dr */
+ DOTVP(drsq, dr, dr); /* dot prod. dr * dr */
+ SETMI(Idrsq); /* init unit matrix */
+ MULMS(Idrsq, Idrsq, drsq); /* scale by dr * dr */
+ MULMS(tmpm, drdr, 3.0); /* scale drdr by 3 */
+ SUBM(tmpm, tmpm, Idrsq); /* form quad. moment */
+ MULMS(tmpm, tmpm, Mass(q)); /* from cm of subnode */
+ if (Type(q) == CELL) /* if subnode is cell */
+ ADDM(tmpm, tmpm, QuadN(q)); /* add its moment */
+ ADDM(Quad(p), Quad(p), tmpm); /* add to qm of cell */
+ }
+}
diff --git a/test/ccured_olden/bh/normalize.pl b/test/ccured_olden/bh/normalize.pl
new file mode 100755
index 00000000..102d372f
--- /dev/null
+++ b/test/ccured_olden/bh/normalize.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+# strip wallclock times from output so we can compare
+
+while ($line = <STDIN>) {
+ # I don't know if it's a problem, but we seem to get some difference
+ # about whether the 0's are positive or negative.. so let's change
+ # all occurrances of "-0.0000" to simply " 0.0000"
+ $line =~ s/-0\.0000/ 0.0000/g;
+
+ ($firstSix) = ($line =~ /^(\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+)\s+\S+$/);
+ if ($firstSix) {
+ # only output the first 6 columns
+ print ("$firstSix\n");
+ }
+ else {
+ # no match; print whole line
+ print ($line);
+ }
+}
diff --git a/test/ccured_olden/bh/real.h b/test/ccured_olden/bh/real.h
new file mode 100644
index 00000000..75e58d69
--- /dev/null
+++ b/test/ccured_olden/bh/real.h
@@ -0,0 +1,106 @@
+/****************************************************************************/
+/* REAL.H: include file to support compile-time specification of precision */
+/* in floating-point calculations. If the DOUBLEPREC symbol is defined to */
+/* the preprocessor, calculations are done in double precision; otherwise, */
+/* they may be done in single precision. */
+/* */
+/* Rationale: ANSI C enables programmers to write single-precision code, */
+/* but does not make it easy to change the precision of code at compile */
+/* time, since different functions names are used for floating and double */
+/* calculations. This package introduces the keyword "real", which may be */
+/* either float or double, and defines functions which compute with */
+/* real-valued numbers. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+/*
+ * REAL, REALPTR: real-valued number, and pointer to same.
+ */
+
+#ifndef DOUBLEPREC
+
+typedef float real, *realptr;
+
+#else
+
+typedef double real, *realptr;
+
+#endif
+
+/*
+ * RPROC: pointer to a real-valued function. This prototype does
+ * not specify the types of any arguments.
+ */
+
+typedef real (*rproc)();
+
+/*
+ * Include math.h to get prototypes for standard C math functions.
+ */
+
+#include <math.h>
+
+/*
+ * Real-valued library functions. Most of these are actually supplied
+ * by the standard C libraries.
+ */
+
+#ifndef DOUBLEPREC
+
+# define rsqrt sqrtf
+# define rsqr fsqr
+# define rsin sinf
+# define rcos cosf
+# define rtan tanf
+# define rasin asinf
+# define racos acosf
+# define ratan atanf
+# define ratan2 atan2f
+# define rlog logf
+# define rexp expf
+# define rlog10 log10f
+# define rsinh sinhf
+# define rcosh coshf
+# define rtanh tanhf
+# define rpow powf
+# define rabs fabsf
+# define rfloor floorf
+# define rceil ceilf
+
+/*
+ * These functions are not part of the standard C libraries.
+ */
+
+float fsqr(float); /* square function */
+
+#else
+
+# define rsqrt sqrt
+# define rsqr sqr
+# define rsin sin
+# define rcos cos
+# define rtan tan
+# define rasin asin
+# define racos acos
+# define ratan atan
+# define ratan2 atan2
+# define rlog log
+# define rexp exp
+# define rlog10 log10
+# define rsinh sinh
+# define rcosh cosh
+# define rtanh tanh
+# define rpow pow
+# define rabs fabs
+# define rfloor floor
+# define rceil ceil
+
+/*
+ * These functions are not part of the standard C libraries.
+ */
+
+double sqr(double); /* square function */
+
+#endif
diff --git a/test/ccured_olden/bh/stdinc.h b/test/ccured_olden/bh/stdinc.h
new file mode 100644
index 00000000..7d0d99f4
--- /dev/null
+++ b/test/ccured_olden/bh/stdinc.h
@@ -0,0 +1,97 @@
+/****************************************************************************/
+/* STDINC.H: standard include file for C programs. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+/*
+ * If not already loaded, include stdio.h.
+ */
+
+#ifndef FILE
+# include <stdio.h>
+#endif
+
+/*
+ * STREAM: a tasteful replacement for FILE *.
+ */
+
+typedef FILE *stream;
+
+/*
+ * NULL: denotes a pointer to nothing.
+ */
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * GLOBAL: make something global when declared at file level; a workaround
+ * for the Strict-Ref/Def-initialization model in ANSI C. Predefine with
+ * something innocuous (like a comment) to actually allocate the data.
+ */
+
+#ifndef global
+# define global extern
+#endif
+
+/*
+ * LOCAL: make something local when declared at file level.
+ */
+
+#define local static
+
+/*
+ * PERMANENT: make data declared within a function static.
+ */
+
+#define permanent static
+
+/*
+ * BOOL, TRUE and FALSE: standard names for logical values.
+ */
+
+#ifndef TRUE
+ typedef short int bool;
+# define FALSE 0
+# define TRUE 1
+#endif
+
+/*
+ * STRING: for null-terminated character strings.
+ */
+
+typedef char *string;
+// sm: this isn't a performance change, it's a boxing crankiness change
+#define NULLCHR 0
+
+/*
+ * PROC, IPROC: pointers to procedures and integer-valued functions.
+ */
+
+typedef void (*proc)();
+typedef int (*iproc)();
+
+/*
+ * PI, etc. -- mathematical constants
+ */
+
+#define PI 3.14159265358979323846
+#define TWO_PI 6.28318530717958647693
+#define FOUR_PI 12.56637061435917295385
+#define HALF_PI 1.57079632679489661923
+#define FRTHRD_PI 4.18879020478639098462
+
+/*
+ * ABS: returns the absolute value of its argument
+ * MAX: returns the argument with the highest value
+ * MIN: returns the argument with the lowest value
+ */
+
+#define ABS(x) (((x) < 0) ? -(x) : (x))
+#define MAX(x,y) (((x) > (y)) ? (x) : (y))
+#define MIN(x,y) (((x) < (y)) ? (x) : (y))
+
+
diff --git a/test/ccured_olden/bh/t.out b/test/ccured_olden/bh/t.out
new file mode 100644
index 00000000..fb9d37d0
--- /dev/null
+++ b/test/ccured_olden/bh/t.out
@@ -0,0 +1,462 @@
+
+Hierarchical code: Plummer model
+
+ nbody nbody dtime dtime eps eps theta
+ 1024 0.03125 0.0250 1.00 false 0.0000 0.0000
+
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.000 -0.2605 -0.4941 208234 85 118 0.00
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 0.0000 0.0000
+ am vec389878422291490397703532363838372957298630836310583829481040641106834769576818099195699704101879631937750115697603016463285311330468738817905192360225013760.0000-20133801167155037325873435901952.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.031 -0.2605 -0.4945 211569 89 116 0.00
+
+ cm pos48767523418596704838523946240732817085722217120112445882955090940174783491954759580198817590747865525311087993955204647833281515592585841124673085889618013847552.0000 -0.0000 -0.0000
+ cm vel 0.0000 -0.0000 0.0000
+ am vec1559236002703774781021278153871856315038382557752792736683869239689689036392574782890254419095632625220214596570955325121650716821745262456633791107947124940398935007346099179645105137569424172018554827397930584451172298405685470573741803483135862466270638747854944830385951648776192.0000-2440213101955252164764871308604279706618905144693668439643070676519663768507696241138708085832026275121811611967136537777542436519701974614016.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.062 -0.2606 -0.4949 213299 90 117 0.01
+
+ cm pos 0.0000 -0.0000 0.0000
+ cm vel 0.0000-59895636067774350999802060694796748793832479178531276624501570931901147191978903998797094450874790314219459403379011595168279797604476932033300509092028858118249159129140068208362592551338686730024901419420884197145543791729844646848781005668704382099371294815839075222644724858880.0000-34304238178392950207535507133362209821902207889607483682089075151755707595496927664474092813783398015223065446303850270623229965194082751029829057245842250731094016.0000
+ am vec -0.0000 0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.094 -0.2606 -0.4954 213209 91 116 0.01
+
+ cm pos993351373657076610062312278610554488534848731779782051627008.0000 0.0000-1118429463701675004166438727081989400588012830642169445393367040.0000
+ cm vel -0.00001585488814076009121115235303854341157810423314372413222796102290009989368447283916006261266276278410773098926643004648243979996411223785702280162904634372242876872108434991304556939983997976894184226482289262496438803898943600119361274014595750417965118622564688757121215375186329600.000019081946387294468538983897080928707648685678081325571021978053292334133644518624518107413086208.0000
+ am vec 0.0000-1052177637002965011136512.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.125 -0.2606 -0.4957 214475 90 118 0.01
+
+ cm pos -0.0000 0.0000-2302699907111971357846485514152419491468807814108223906017032377374227981869015717886039696953247825910868765310976.0000
+ cm vel-15507023057431145584565206457665247866817949289667375154357635978154825289910164352381842258913727693829009709173430125334544217761458477764531171623672700685829938676620090702262248564363444092928.00001229858773826100404973380226814223889095307742350714935231516126060487709192395267739090579310853010481524182411640591646460762296357852990674110125002654917720972780950718889540664250010801546101240516252270592.0000 -0.0000
+ am vec 0.0000 0.0022346444089834345117428848079358572499482380273334106571722441585638578168266752.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.156 -0.2606 -0.4959 212360 87 119 0.01
+
+ cm pos315921480765813379089838780091228970007395801379080371735261734862731027216739443148219556090994157732966814789913461059703725772528759757672071285717336064.0000-141259921440297382698655734668343831625855342291566246901055488.000082593600281560438693094027403777947973968116005409601641297845784918959006160639746528136088554574683678221271040.0000
+ cm vel-4633822142057183858197369124544939560116510065121526501724042717035591477898487686152006247597188881958265726378706767535675305089429388411932175731349037063598448888583815168.0000 0.0000 0.0000
+ am vec-3986756325765554751178454067643019324664159843216872557177762016988286941764021137382434923953830640315188084610358347806277632.0000-473363046102399837125588658668705710424574587720697404562895807652025236969343698054745390760567196189116864184986178458052959250756111857922780635472048854457811495568474457760813153893501852178505007104.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.188 -0.2606 -0.4961 215638 90 120 0.01
+
+ cm pos 0.0000 0.0000 0.0000
+ cm vel 0.0000 0.0000-715402636198797069701822383327363708052875939146530282568918901271078556048028349820618460494773931288880317520285883627978755879496318976.0000
+ am vec-13240639590929336102736471851418567661077666965175740458314592350710026001932396745522968121539503492339335306307686658086998950117663248149989180110225302093824.0000-4794368498948739564077828211221176487838842148215254315752251028576322570107431802779970902357249241757358193089742748237257425705341825318912.000015181075527895958806204102198713781288132931207305370313588684089996542314275071087747648185925542104706401467105280.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.219 -0.2607 -0.4962 213907 90 118 0.02
+
+ cm pos358304390221261030736494761262053873660818104605297471591777894910417593068265034855970239229512879832172748484651053980740868777455823682265763784091719812371261401648209163827194656525896630860429610269318442939702758948732928.0000353895558253845751255480850176210835386783235723651047855262247300602546428580449972907194718561432416957328592586525713713543738288710263101372734729893544445334077064984994004331842447814794113414869286912.0000 -0.0000
+ cm vel 0.000051478538076260147609324661887119700695360463938271445206883256722393008705007960879990682351577196189942401520994524698703970322516498232387577598885819083662497103847677801529344.0000 -0.0000
+ am vec-2623136701653195585794141396966373988766431089320327325512851627951458911761685020848908852791993066747540922418249024231102800628933611617991255288583884211595261667627200034514219164331431632516633984209102807608072009350581701268326711698539104549017223168.0000 0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.250 -0.2606 -0.4966 211413 88 118 0.02
+
+ cm pos32715052170377176594144725452710740791518547863861068996544730670845835402420285664334223583903115815470293942793507050350314662384000024692879342744314576896.0000 -0.0000-1559078566300162717897624445844426298177825521814863628001995701650865276586616064838724715736735303976513235205622778647748834406008785464562399987654831628091392.0000
+ cm vel -0.0000222211318481829860678065401797560246642410464069412484897981019091358610186742724957661876450484048016953147300859823541994042469704025130967227963711523127296.0000 -0.0000
+ am vec-7173881670514734427194339338834689155953107117676251548042953916401736462513284053275335345910655176557449450234347893935181468515192285319928422038080816945336365875200.0000 0.0000-1222427404997770496.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.281 -0.2607 -0.4968 212516 90 116 0.02
+
+ cm pos-190029402056222696118782436139960735564162265781213373117275130186929497395388587607668177533553689346918346401915950264223165522544402414138961194593170087811052328760227189147310043968527191429996144591575166383403894695118992117872760167267138791212597602584916305084723576700928.0000-763061469521186.6250 -0.0000
+ cm vel 0.0000 0.0000-29372985744500523738562497950096264916629543960484823952841942898144712689601378691847509486023812811600048904492537924588527545221120.0000
+ am vec -0.0000 -0.0000888146957076605102712107714052858211248176709741229376596680386667010953515136398978201012036207720967899486504353792.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.312 -0.2606 -0.4971 212043 91 115 0.02
+
+ cm pos-56546462200310022635210794849254085278148558263149032795056990675297068685400113023412567467653873022679640642441778815215756300360936002823501503987858536860205783938986022755823716644370605113412881909177909248.0000 -0.00006518995959258198466527212648524087444843462826259134659770362685670292204873719409889266784459025898514815407271806118295106582441292528586198089728.0000
+ cm vel113365132101979339298439168.000040837337821099740386253318931908230731427261783763678138675485347459456111784318155839335620698390205295125871651830430986261004342955090998671682525483274951913682547834250659812343705387748174144975643495990151120314006555112110438708684777881958753970494322615580058102853310995234816.0000-8271750520762773995180801771142763397805276936763268243366875234304.0000
+ am vec2922994468943541006620166639828598784.0000 0.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.344 -0.2606 -0.4974 210500 90 115 0.02
+
+ cm pos -0.0000 -124.6407 -0.0000
+ cm vel6001819926036494290396528636023431924287041337318797951557538297274228215829326924370269899804458218267917746898252635012800710793236406634913564339412057263219685601441695035486388235884363930423570447393211424627537416506878060179127121863581958913436680192.0000 -0.0000 0.0001
+ am vec-3616773584374425841520239327954730268919795568642617746685502830801977654140787702108258304.0000-17386008495170032302230932870364231267158793823681212144426257156810689781776193319519682095527647564732216296385580162351104.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.375 -0.2605 -0.4976 210875 90 115 0.03
+
+ cm pos2484951936182915939417650167293582724522865089712214449518269978333360855952949864882409235751676682406952510210730300793260417254407361992406406486142649929988112884851321153109027287875188929070190872093523968.000089096239.684914519619128271487631551311402708094746386123370103629738911006697714366936369692802519082946346894333470654118828400119095834784700536924158005148682390368039961302568130281231160037675013437675226927240766657046133401953992212792190784134853982776668574142958099065021364722313179432046219684074695426048.0000
+ cm vel 0.00001321925753339103592200945594347848231593167993063395553238947539443752334911885331741651426889625115526987976265724384000081879538984241927075766446857244064164042371884723962221993978458485897078667818306837091429577570210296639782912.000019214147284816494530652208901903192512506453848938485916535163999675637217361920.0000
+ am vec 0.000026832853489418133022093533133522353356202036261107217342778065459939669750884069516715770433592392699731518550215226919980327876361046418999421970629047837287469088742572910055363612365837799612605821616128.0000944627768013246909517781238529406765616539506746837900828021751330179475535898434725081997673045276300669862172626963198915512379436416658464981617980674719101713706751604134951190603514917356104919176721907463432779275866353962324941576536239408672250375602585290166423662948719263744.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.406 -0.2605 -0.4976 211891 91 115 0.03
+
+ cm pos-145575734455450364390472888281562841702172131216353354919018758144.0000 -0.0000622760459361952476629674378378173396657941815856958669448454635169078311463552565140269950167526938971978437845038045518301699163977219264421650572721628742539452357495116145285267480298592424001860163305251716124585640173420163960194680116183616414810112.0000
+ cm vel -0.0000923700119237036720235647948747547839435585794791057287852300742220346349609020501063401987420995638060982960145300145070678322694056049460091003514912768.0000-18294819220685837696386822316717600220831646794078562039109252334423737867032859209016289840028348211245766683355146370761638079889408.0000
+ am vec84347896327438881900052766466094709687673292339452185986411625762302043149371797140992412050233672879430002654873176331135417133230456832.0000-439341592299408492625434987462656.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.438 -0.2606 -0.4975 212886 92 115 0.03
+
+ cm pos 0.0000 0.00003089595385953746065442452617603829264784115340557570073893083220019746389601923125306099819014408928728460261413130286448599337970230360374606287697704899476917078776610552358951359457963065142322839697971172830347264.0000
+ cm vel-329754580980891486875747407375417575549365006054651412541380858093092833236753232182935608982610086547059580161161764354540732778152662735873363150284541204465529022054400.0000 0.0000-103908830512218744660734417026510660636683529613176344879145339835827789821477605598862081173816880993536011703299222197177873706756423950260081212376475576962630395223674613279398128768210447066198305316554712659809736067804825356611937484447016276170358144475141767168.0000
+ am vec-31866279385416210773197142884352.0000 0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.469 -0.2606 -0.4975 214848 93 115 0.03
+
+ cm pos7224111724422352714706235080250833347141246886409821722436692968139213874949223839424959914086834197560825502689656832.0000 -0.0000-61004628683756041022000656218347090928915513690597207830009953393258936961112967336602035687760415488747545844167404088156866605169963816519057052476477663168951437148726187534070660568166733161264522997276683412674977858869901069662585161501785708032394022658214325125120.0000
+ cm vel 0.0000 0.00001954954516231289424576512.0000
+ am vec-273419625010818823566465413951660052879423655285233148219008706695468924252535459513871368804581393274781985851066578743489288276074747789949731114227911219402877728777528125588263110507291847793943656156506115918925662257152.0000 0.0000-1419446172356323986265259071534187198843349828649060229773435121435455683497202587656473703437101381860968430194523179331770880587120234391104573589785262145733125536681200041556668823907422175232.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.500 -0.2604 -0.4976 212165 90 116 0.03
+
+ cm pos -0.0000164831660687959733322187964384399317580615495122205387064395991022895132439839585050034176.0000 0.0000
+ cm vel -0.0000 0.0000 0.0000
+ am vec 0.0000 -0.0000-4326436889443077377991583136081893394707706993321142780323953279764799793203977581628386726378402151236658116644301492989625244742716065013750500503568215320334217162769253120206559104041576948072025084561757995792804087152835886106907275067291754174099832685197353455703818240.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.531 -0.2605 -0.4974 212366 90 117 0.04
+
+ cm pos-5193655565329048664186489695833408905410542795749977352019413639742264802079070467861701581047278790017197708622277812436534317797960080267601019267814992026942272468677267778799849039391345508605107568407095595352487970040793540836282005483196673171051481706401574114270759498797424261075403014144.0000 -0.00002245171591305709517270312065310942262311464955758713693770069707995536528478576423585354757863318392276576881182944084886553432461025326177341089384784301639560974165087558350940546846860459689382716782850359415304093503821844837256275357871481509573167487194595754796198682510003263540319320276992.0000
+ cm vel 0.0000-20480988340732831768688924713361652143823980336974905474272608050801331518846861208535451802632401768666690617509984848014475264.0000 -0.0000
+ am vec-13085257721087411874583299039155978240.000028218186104472249195448653391568103714894530797884471996153495462735308208602978677778134005106387951319375323996257085554688.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.562 -0.2606 -0.4971 212423 92 115 0.04
+
+ cm pos1237944920454925237806384815732575008781172737613407986615582720.0000 0.0000-3631909347976786029364103215641341758871692200141574411717313145054141828711550533320831994042892088522420936078370939982084507622032624998344170562001489677099640615779734152245660797122182643712.0000
+ cm vel-48415551309695701869275528936262100829732248746471718912.0000-45947345104457839174024441671867282844378394525894107202340067245400328964000989745081832824886382098464888706900980825121129989659817981032869841265322577918018239596078533208488496070656.0000 -0.0000
+ am vec -0.00004129892291571269031986152478601425957049434438530552949959045368530568985117032191588330424859486246287473919309054155039478644736.00001081892199566021437263454574179525904867591578918243907745180876668332189806064484098191745459060349141250355762012871711844982852117271723067099041727818489118636904524943046060579810234971736623808512.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.594 -0.2606 -0.4969 212283 93 113 0.04
+
+ cm pos-1905025499151980034274534469510169958183059726500390841066136964584857044595008769483832775855757328868765739951565412159263311805689378283822856776293361039664752566992896.0000-18513680079660101951614321723674450322087698153924574957787525369758710122880996463101277685092974592.0000-34668040130561827018028167481500511513173163893890814855804555544421044200301242613014729079885399568859168737854867235643450768762682660956178060745389500292195388606373919512804742090441767635283717878972416.0000
+ cm vel 0.000015196951813461841521486836701756956444224784853043472160684046690647345415258299606291181347180308664850570968817091314870783992977099570040345054092861926102818687180028861911716827199242418377219961620622109576309460896548766071974088591420837080289752944580953196135514790168625152.000073554904292334743059715730810303602435661306680354774229327446824869118773461089173702460071928588404979370313608541723509082525406656287643985300302649540648731481451251740266150249905893364060668324763505203491298413935555574550679062173518529617194487345327992464715672028159465999727033844768964608.0000
+ am vec-684197197245369380398698148637883055842570268576757364617298949449267921781171801975276829201855225528320.0000-101744418212194207272053357245629914515538029536942357335986220181249137161741167925112262217088664669032302481415162247186608761084695649663825827839191677270482323076073977140992774265312718186910950787052359436270235436365878711934550292538851328.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.625 -0.2604 -0.4969 211770 93 113 0.04
+
+ cm pos 0.0000477331350524916948053883772533839128147297411143853893076742726311758736792767174763256895458672495066463879183880747854582352839947965489037557840421389341612462045821594521556459536974348288.0000 -0.0000
+ cm vel-2858268226850200346502218383360.0000 0.0000-2907011599666720609852821602358022994135563500065076026248411292895751132492574529244655633249813397504.0000
+ am vec 0.0000-6531189342130129070000606521798601487918648691487720724594371643455948782894424711116425641185310518667203477884735480097030217328391130496538172147552148206137835283709270612273699664117397375383197648578713395658650373702578796921425494016.0000-68667070982252915723296702559193038560287981944082791399757306142237668333667034347778320748130935054072547814251025111934915682925339040550628950325566279759769915211704604078479980904811981684055542081132630501814512996647644042941678205978129496143621587001442857564241920.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.656 -0.2604 -0.4966 213017 94 113 0.04
+
+ cm pos -0.0000 -0.0000 -0.0000
+ cm vel 0.0000 -0.0000750590408672451273437300408836574839027921292052670349195709767494793619393454218523365641587041784622753423705585876767321892764964924163371587839599634649299654248543362077075142218505781248.0000
+ am vec -0.0000-13723471631533968294277467902175311036416.00001483758922498238013885805186613205816736559669268686995754441163775919388535175792833681310410619463417637317680574765383078543996818093787967728736890272570506895503083446918402517893756334261234953860792458609848630254067934258081421275875940666980649450958118218366976.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.688 -0.2605 -0.4964 211250 93 113 0.05
+
+ cm pos -0.0000198174628871799517542138597507510961620835701551283799098466077037228119215914968513405186723670892610408156771537536223387415406585739079755883116708009272694747820311183360.0000-131324276297875931264929471087299892847514892244626681282688551648691616888001457114016177119227008467708400249163901084212992038296428336859749707148174328998330709756320508948310180026343874550108307712889137762960733682472664844214972149441046375946663939539494681513165526439468119799877706186752.0000
+ cm vel124034099279727094654203020633441177035091783218463709800993364625044003959514490457768757657726074391096296807294941918385930240.00003659564859968775261092082239720636556249203956012581449105408.000076241262963115679898798988812839344826385170285935382413786461902228635394912538601201241714092174577819370601331114548713789162841440256.0000
+ am vec-179674443543109063378572009866384474121168792461839681103739438547174628457367728363144452845382658219414837980312560310995123291864300818192462580437808178192575021246363489617810535917232689115815673860633034015933202432.0000 -0.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.719 -0.2604 -0.4964 211170 92 113 0.05
+
+ cm pos145181572433379571777139946417325705919906499813137239162026588627570142377672704.0000 0.0000 0.0000
+ cm vel-14699411899733106689748807015162959158928574151927680508283408582610553651996271049668200329027069014474383340647890531969702835931813294041310400068088607643420501257001311114625024.0000-9521153043431234469315064285137440158695082669030622056319028334025512244630488595266122214451398817990054436067606528.0000 -0.0000
+ am vec-12045879150450533245385545559568586746363904.0000 -0.0000282370292201227098153047249690389638229877729824366991622295073783734645635477603339207504681661661280265855802808138464704624240728435159978684445067601007176778669674535023631286380807247004502997493334363881735695800196660870713966592.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.750 -0.2604 -0.4962 210947 92 113 0.05
+
+ cm pos 0.00004016150150127866080115702772697064343311599368161510930366079707739755527702397349223712354183244031626000751060270526274828774967655549975664954845997684685101945345426985074177099767327076598845399690291969151723560978972620821288546335293145907562122021799087395967262474788208158390393595184524820480.0000 -0.0000
+ cm vel1623189956441278890339236934590139261744004405015153945450634855413269570561470320887698089531442018085140098312501085601792.000039614144650989338516600720234197699261284939531927656808969818614988261754401233520680503491425535440871903308118818892451938910743213451645617276982956705919381497071532482391941976057150696547496879359093165331853237281185630670459238489668986583272840060850842221795403059025249361970855936.000019953842142340906105848235594528849920.0000
+ am vec -0.0000101020281520834370545282970034795196376647900805355916366570812334772584448.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.781 -0.2604 -0.4959 210270 92 112 0.05
+
+ cm pos183216982574229823237929135776530763138372743348947347847026123070316598326169552160156796080224372210078933304712113237936839361582251484913999522092189287920693811526827844777238394731292944111275086008511741418370272922046088137072969984249954304.00004542087181785447321837764608.0000 -0.0000
+ cm vel -0.0000 -0.0000-31389825249711979418716765108862686175677335591130706700028969363859640627826770203814328510285646950663891739634364801403484790013768484673669254271581293757402632498440338281667791145469165721764370850192277306809766477227059966738999644301095448274307186749670227019777301380514726088487563159404544.0000
+ am vec -0.000047261817541080303488270043079981915504463622506656891202599058486139865388841418916956824506728448.0000-1288919023974797694999492118209282202558885036231325367462064947274027872132933953918428957658462369874349504167565234741960793244693243531359562674296471905720890227637767943591331742727452311439175983089013751808.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.812 -0.2604 -0.4957 210869 92 112 0.05
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel 0.0000-125363259473055671997958481619760307697368431794277880196569756912553936311224492964687569714221449790105838943734880632212773343123762005566579673883000863683772416.0000-1993462524.7853
+ am vec-443473364127565922047863933948357433712444532126085085956266669375488.0000-11713846823645734.000040470663841389663140511168328625478295313993293916996211176312269992282671807520592456708047757531392063952577053136105135635736447146994174442347093059106198404785907061019413148924469559573450659463168.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.844 -0.2603 -0.4954 210822 93 112 0.06
+
+ cm pos-452830899921176980625258599874812581697407939791561300037248272083638882389536192638724097049870575558046905964216985306497728560281436158111544920302200243413808997976456564051352410165130960347123112420688265162793846704202738036632758225910943242566376620032.0000 -0.0000-247511551281747162911845622313133480945357510273788577407812528727874976532452267474747118830624855354826667900188835672150381755289635005635704818441915912019357393169444994670613704924042705783897473165551845591667246506817135575040.0000
+ cm vel-1614028238200568527225314018603691985082252555144765878547514977979183585991442048962735855006715178879941287426527095903896541289105883967727431925130110731116120428733928127228600955970340777000695607583019739051316355576870198624932331520.0000-2601782495214573201114218113189376022825707404027140790035993004190098787307709002135351360492659029673200698993994305539388077270377680283551657607722909371116523437933800933356646162735615921228457871774803825172407225579946901504.0000 0.0000
+ am vec 0.0000 -0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.875 -0.2602 -0.4951 212697 95 112 0.06
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel-19306661078617178572224813626024776810283247475658843957761955076648689450881868930119045198143300505031129624938927233912212011985853796459698205029703609690121029440877560352624804919152470801348425013005673612234551401268513147028321410519535382177078103244800.0000143692216243397104163039105913045535485765615616.0000-1576070982493234714555901213991383788026837513132711553659830272.0000
+ am vec 0.00001660143119630844461519604255393637825986158357748963861762983166230499084409832766705060288154216208265287014277989390098829036785072853526199379928128242321538046142824029298509043571893903239026120647268112223540710376892492388665539137529010204825095987753249813001404416.0000-35347515084456870874061659067740772364112036557987124746872056727607627972778271378707235362132772643254059070743702210677691440983551764157998676574208.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.906 -0.2602 -0.4948 210581 93 112 0.06
+
+ cm pos -0.0000 0.0000 -0.0000
+ cm vel -0.0000-15247983296560167778211932486244175892736743727315918995683864287940855201792.0000-2042115773287014409525195569174679107691145344266070067382924354266339546800861614316835983554118203040470648672251757898394844818929420302672771570196283392.0000
+ am vec 0.0000 0.0000-5566552186488478500528006169116694511119799672381501876947652390499892715784927199341987602890752.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.938 -0.2603 -0.4943 209929 93 111 0.06
+
+ cm pos 0.0000641205551613691206880303639445048366115608121902868990187146794379122326538620092652091641681582240467759787189987370818689717364112598421028018358598922488416452376441067598800030393883453317684973257496012437585920.0000 -0.0000
+ cm vel-24724659289366587858294886602115186074016934183324274803344506056653279780018234227723166095291868765029101687505518039060589202196688699213144962341303524523032320482483137744760319247857050439346238205550816181354496.0000-1119539020855603051504330137968398282241153721107890093671038417468094790807690867702688539579545090159083432565236956306906287139789201512641872499354908014526820893089245805637467743427359508941484622391083272323057329448997102164667698953132049547624689845189578110855430228917178430002600869888.0000-454864934728744038083034251920848382049822504127291308337963210625178898542033120895153030023650330623712798830119522040115257281012213740349486183105180447180083791228300972089694437601864071547328641953014014906106676480169762610778463039815380288008022632682935020197732193870700589185284056251629568.0000
+ am vec27573568503517059612360030070320201203712.0000 -0.000022559461730324852197697168407153972405887776561437623314537676993837897947060384071216824610286001472386192283366731464737261503413164239163750532003693737298453769688210004869946971945051357184.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 0.969 -0.2603 -0.4939 212661 95 112 0.06
+
+ cm pos -0.0000-36072800456023979874988372895794798295976563261308928.0000 0.0000
+ cm vel-317601098528199476059069237855858684610872686976871767562721824287458184753783230640344668875149619938207619414727194450446640648804920659592264069916583590157316395904822085974127074449470660473017863617544723233239924793926828345779081600206650752276365312.0000 0.000034616983.9001
+ am vec-11873884539013573106688102081826956595495800772419848370340636494041758194447527612770538906281643421466624.0000-415573802432.6354 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.000 -0.2603 -0.4935 212223 94 112 0.07
+
+ cm pos-361349128.0290-180489240100535258692298298120580773637905896082720313266266035855500783144171592328663292694721485960782812352747157594259640844588824073220048866957476675814000489792350424037698361645665131063670976273972283165983525886926782464.0000-588284731426293800619387605200382877092778077833328494710470549796433579280747265196208062363899211266732521376930633482575188822102952962180133287335040742960510011909379385423155974170681301767013805600201564802308366139392.0000
+ cm vel-792348.0157 -0.000017276507867718913437973844405822559527936453572152956134533302493055014236859612269710280825892871802274901185962242732740801293707629252292784522485256435159128733404285307624612006848444873310208.0000
+ am vec -0.0000-211652718723195536133000463032621902998210238809916675034348243402279770537493182421902819328.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.031 -0.2602 -0.4932 211476 92 113 0.07
+
+ cm pos-40087524642354090177162277031779457754073858728524598212520900057000059718284318199972113410724016694017298307045434288302823422621896183743360904404979981899552555156330832451429990863531838725366022825401782993683338193002299392.0000-298361428424471336261568991321431171435208152318134458095066986543349181497290163584519803872491924676559858733652720317985013834748824577104739959651582856921088.0000 0.0000
+ cm vel 0.000039189313548520790111915155914815724226508096196157475815406514085043663410920491698918112609902455726474793014038334471819505653528309199655731845808083045960242270810300252900663754752.000031144847919189000.0000
+ am vec26970646631640567331310833479720917986653581565660843532315901690656368322918751533647592626739302873823172484389608571700382481765787667411138352822432434090341073472177209143725904610801927558528960775936308676731739381272546712892043193020424967848464577822807705070203285992648454691582027650899640320.000046738133919390499223561289862785435166572544.000024698848102251647841885312369614341628099684826013193458362979217437566747443306213017948712523578670080531014982128383520762362587973738028200519756275691552768.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.062 -0.2601 -0.4930 212513 95 112 0.07
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel7829004378509742740511201308831780786082047696482112982523869303137284076259681821487178674759694106945713393750023034383258037754503896656879192442684266798038478897793585905664.0000 -0.0000 0.0000
+ am vec 0.0000-398527518772044354721235707163681011104543258433165687083334248937031321304243226085982030141146645903040964485965719703950206948379370949627035558250362717770407154426597086377936502609822850620522783909313778431737632612513195878143492096.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.094 -0.2602 -0.4926 212473 96 111 0.07
+
+ cm pos-16241367798983889928342349697986462773700791589569878873119200334994408340840578865679601922351600412056695702512788486839737390001553408.0000 0.0000-5701981805246544340338493134313287476078307829232888376230201540209850478758766188011280230840358461462671132243001344.0000
+ cm vel66464063855427411598727294799838619468506496323432346489202933760.0000 -0.0000 0.0000
+ am vec -0.0000-37417900726557283051207837633825548022252641850827692164603303264768592850197226404776379926381525678998338597981087024390602752.00001492017855644381087980486176414782596806339684881920655203567761620992.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.125 -0.2601 -0.4924 212418 94 112 0.07
+
+ cm pos 0.0000-711820219261389002484083103518768000301683639186447940017119095003311272366543708744939575901072447673459822910034728318489773581764224585217153590961090283595820398858105722543085108253031913037015131991785988446669896493624021704540383213682693642603381558861756401006411776.00004683213089645237545539045399467265044027898253730019963078979383578052041222051926796589570077417948896732982410855041085164437800747008.0000
+ cm vel77513150682505029279103790970169343667701805875384195717014678133760291158822242486081400335994452583038528915116699834526606667181808276937445211887255579958286037842701315111972929924685529388446078111580160.0000 0.0000 -0.0000
+ am vec9059263110707568578116497975265644723676831585418624934771103766307015726810385337112561881634723102974654718100188493043660592688376631528302962769405658369193435359931078418230365420910633418004410737455655981292535053748065309945508787666368339516652162289428819474632704986550632448.00001143192904791952881014942925806970147119788558873372533569273678384853347926697505158141548564171206388323330905973176677101053053751620972964408710306326267965921195655590013300145488289564499615338723228516352.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.156 -0.2601 -0.4921 211307 94 111 0.08
+
+ cm pos46106792064030743980379413467179399668360544256.0000281295444016688699612918967705434093373162474641330499477105393684832366013265335376148639086493538841387157610470935813907382321506611625984.00009666517315509855716454739897669650270466078043503403206862105887915163665506802394218805863268327248294464047677884185386996866564882183999449870602261960210875183887243400031117284391263831851008.0000
+ cm vel54483249131201038533930473660635342738292736.000042980177895297377877502516865771765835744492885168030125650081947981240314053086066585773277184.0000 -0.0000
+ am vec-82289380027828886803819444844586043553295727463710427849410310072734958145577816754585430580037201759165483006525865319660881941871732719114753814328137388485088556194004506627854322782799380501409703222751141785461539159909589656478182014976.0000-726871714679445778173842567769245425023633446948028327361345672396639700828573012077971834771949486080.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.188 -0.2601 -0.4919 212029 96 110 0.08
+
+ cm pos1173952957709304029590898011596930729396102538056360773552057094915010373355989028375226875745267969723652622036914592501355018593257345504755067378001178111927966771445760.0000 -0.0000 0.0000
+ cm vel 0.000012186243317740609276404195489043283244467804926033971742984147954866408288950849306860246852118091060094444732867068830629362621831536705536.0000411625571163601.7500
+ am vec-635527994611094978402897787090918059797079752254911007374148601942359499949809925599953582266407866530488581074179512991378723937669962210969595063204437679538853175466771960964858528804582956348735488.0000141817699951243368228015948539755474907523085940521885692233263485261908509133659649720138179170237633715832664983728318757789781765486006712604213718994986339867038623787021972412282092344461471916249215905227828087810129841329573952391085060879748885051863805350324092487551170143193931148275663895107993600.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.219 -0.2600 -0.4916 211871 95 111 0.08
+
+ cm pos-120985436684330252264306434868021595142782550358351884824405228636331343470148887056832333804437210663697102098494040878623318130623475617337602852662867510372795897081745857471976555719416736434666602496.0000 0.0000-20024624269744565835179983237339164844817835131113178253451788001425028636652594227484360553228147260268669190746931200.0000
+ cm vel2011544566099649492048188597367058649199398113220349325532967374908254249724850543535600345675771997492938397036854347756681567704953638131023113331965998136143100834771646322866913280.0000251057729491665618972134555619496650866688.0000 -0.0000
+ am vec-6139049881771361014128301191904934535254493516299161416962253368222981211547715922415924983305625289358590882112203958869616692873767504933409840832451513942016.0000-88490438247454588592935039357726767452907794081541320262041509868748906391533595544388850087500096845902034797027175828160979203499841356338370751785794895980137278470909370374896915096900553727447093343131354871845608542480234941775872.0000-11810496874220612736909567086361690581163030733939317339782125233037888389926957133607177314205702239388674638666092641481288742904241549862433552808124420051397737375108575445959059727912721917978320064181436416.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.250 -0.2602 -0.4912 212729 93 113 0.08
+
+ cm pos1273435642992046424015604690932350824385579109700695775975310098298877739965830181769851460221753187451704625877772608257264622241162737726340988928.0000 -0.0000 -0.0000
+ cm vel 0.000081060712903431677612554564458042283076944989144070513214166401360296099559887826136146844312319309727175246851421018786049945172519984821769550879003762491392.0000 -0.0000
+ am vec14360477624155394185460570705344263839262659796327399723668122673092935650850943305308906552544214351736273370717352858888893591806647914594173096663670930837901188010461542958382541370903183194518942006385751762732433204219665924682627726342639105718935327798464211269971301381632425984.0000-462084768610954317182059675648.00009050058522339333588012706522864839983418904746538012955631953361524486110611351145396009056371728309085644996721887597318306764125478357933014123320804947192929875203875154479805701002074066426240602970067642944477744966385606437803356409189482585489581738901440036864.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.281 -0.2603 -0.4908 211198 91 115 0.08
+
+ cm pos 0.0000 -0.0000 -0.0000
+ cm vel 0.0000 -0.0000 0.0000
+ am vec-48498627658717163227016770141411545767562400375846123389116808828335983427584.0000-429760820705290235732805020479556150727558251621364111716012784101957340934333844903051458787857563947440436214697995593832406166643186117505775499250687675399902202072937011139217955731806924662796439626646177117561743378144889309864364179349162231639148855296.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.312 -0.2603 -0.4906 213544 93 115 0.09
+
+ cm pos-1310791951328902450962864801029672735925979813883184244239154751586586268557811988765934952938105334281660866812898909191842362087581056547512845303123846203703296.0000 -0.0000-1104912413265488.1250
+ cm vel-496140930645809553769392202647710502359571452556424972271517309661349855244249760533254282565100951737127472858492118761472.00002863847416899913766897408939450562123675266235497641053288621457129399587503348796473028441823971336221992098306051557742499699290286191542272.00002118819716729291538408868965489305002764552458818124819844833476608.0000
+ am vec-2767913261879495921154709700944301687352292175936086776336282226299577725522519443045240792923997597076632906622817295434327836891541743162204657341343213157276305832103154647183219837900641884698204319820653307451068809076531003392.0000 -0.0000331617118667140670569724590061211734618669056.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.344 -0.2602 -0.4906 212351 92 114 0.09
+
+ cm pos-2952230708914117461506679284584935233586489704176421136824254457562482032894084717253250524907219453272768081113858036447894916017965130316756834704354201393319917977860279044669440.0000886583622295715713705011893009567037044429263168844549318258480789887293711139580157372426878976.0000408142908406317387072609295578735954860105510377760916649676201459066078961079747545502740905439685250952971181299438498091223944689389490119836846556893249038535048151855654216509653504001666675290728370783272340330556921788320490089264977869238793791349066825728.0000
+ cm vel -0.0000 0.0000 -0.0000
+ am vec420626916235524775431397044859305902851734784067780201503987246343239383324282393884515461236086338864821660986089887430912237893901340524433373871208905023681122533358446140785814958631695144918906258124795681887927141447077568392704583660835612655616.0000-58241194026643089040554064644562583618088695352096309147172709730047005663746428866293277359182446348089090699385101400540415430492160.0000-474782950883144755455664860666399228933423692301612056581485821323740949279046485769931509310862974602478211197745044499085156346945863031986216469946718150400812237337285203501489564277703209624298478742475494506413162496.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.375 -0.2603 -0.4903 211854 91 115 0.09
+
+ cm pos 0.0000-149387766096574070026946462232401144057041135910815116199622323556540006390831292497608813805131998121800041471523182745361870732436850857698180699346948799013055040379727743637450038732873549798497202193397166549244579168990609234134151016095446485434368.0000 0.0000
+ cm vel 0.0000 0.0000 0.0000
+ am vec6483276144632959707142260210586001314762733906222826094011793505888633997780105007486483693272519671808.00004465327215326859545300225761942351511790133828270557228519747603655800389632.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.406 -0.2603 -0.4902 211998 91 115 0.09
+
+ cm pos -0.0000 0.0000 0.0000
+ cm vel574849778902932162667465850843028909967879540182192353443177471001849129580699303542784.0000 0.0000 -0.0000
+ am vec-1951760531337000174128688401473641675921595829988367435616348542454645433134706519096875752761721233163831873649852156701588030004267613799625785344.0000 0.00008337409578392775611401276811274841623984098736517680015191302255782196585952100398758985746807094936584991396739729576645988689518054190514041504515881296020278043708146963522663773051841051111311012064060220000931592696166788391045787587063330779749958809449321090323857774074959634965565901111296.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.438 -0.2604 -0.4900 210887 89 116 0.09
+
+ cm pos-1979304811692934348767704848639541416171171640639955935381111190324846855635818407156655871210390445913050854545311527227305866723181120287199506183659177747867024879099203225657015760992179624253304922360002184873087465611530097515466846477264169482972250109008893759071025819181967542145964310528.0000 -0.0000 0.0000
+ cm vel-152487974370892820518557674941954836184158044485993567317412029400462039617759762361699166879725435702422679528382865060057024376463957392541098047948677027044870507866197352812785408092426910431956477373579264.0000 0.0000 -0.0000
+ am vec1105168042386423777583519450879841917449956703937836276810521982286218395648.0000 -0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.469 -0.2604 -0.4899 210486 88 117 0.10
+
+ cm pos -0.0000 0.0000 0.0000
+ cm vel 0.0000 -0.0000 0.0000
+ am vec1351344885406422904868937054414736050693973460643962476160972548024709426274289029948163561575347800770268946641962093751144342232204572533709340985908379296727040.0000 0.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.500 -0.2604 -0.4897 210373 87 117 0.10
+
+ cm pos-2725280.0627 -0.0000283783563129400597350243800094820644500356220799942656.0000
+ cm vel -0.0000 0.0000 0.0000
+ am vec -0.000043896014770123912245841280976286021021600546969027443962003061554034738913220371373160602057945146602528226743743037578978632396919083765175039383481898291923935869181081953902500495661881847820968184531703181761854488514535163566870180237225415308626834156573583554379776.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.531 -0.2604 -0.4896 210691 88 117 0.10
+
+ cm pos10355310058783655135085586629928935950190888351966426203034475932945843379786654748797949191854729206009306596939733239151349155898348349417586056494634388821160839165463505700240650500606053752768669818601847444465224852593531819568006059940917925117983767263614883498481571825797688901763072.0000-3230235918674462511519796443928569731105704905339428723014429033637796452047295231414797139242719288094305089670382289276241428664501255842909864840022020796690310863821952348314197063793991187185578674656894293187863964558587080076989473658241688708689730009878637235740831053702884878165656656150528.0000-438403697707222419332951258955776.0000
+ cm vel 0.0000 0.0000-183750650419507818712961900347392.0000
+ am vec -0.0000 -0.0000-148833928483867088340060668267068801970966232686508882951812355679334669982170822817362399474814900416378768492691073781391461831854996996166639464529737469039470376640639799801759183503145284688619543572310772857695825827549789088626752193798953148135513844967218442409907180822211854336.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.562 -0.2603 -0.4895 211982 89 117 0.10
+
+ cm pos 0.00005684314831021164005739860443008135719517508714669595652103230062005424951694693293923421995646546827804809929186436351610867956780833042988788559346507194540747470128086515712.0000-8602197758631784112444631628921878990661862919844298846291062764552350235107600355780196738030096218648173645188094441993976459133470004771532223293526634913014278340715028648165784709167636312752128.0000
+ cm vel-1677115480490552137693753385714865930225808070229945668410008714127261971497400242890653597063751610784478459934525537610986975925204739019368923607087315061819860962497188709044410553927574144687387793050757965971128827477542190079541248.0000-1990974969502340762287064037769248518848173682664173595165164014673108223225786049030893280513146682593720440485397687824700962124138961164159203761652616867682713404509131518593762962037134640584162972946194222410893293556389809356663656803220487929856.0000-765983291793779229909275775196136993127268413204213982178997490589245531437603610227988517061730198090536381971088476226018892567643629943945264123546769150313328346983070520683195089420479794906760122688007206410122619613896022461124286368447096493927723922620416.0000
+ am vec11222722812604683071432374349855445824410622906488739583247633626923679879141840253177261685626948819724671880204215192038799619156411728118163701760.0000-20721296133684398824473624300333312854433571954856671330589620572967760582447498485487820609008216439685698591760722778329363378980510034762802483151605815439360077783602028683812697561669488438793640738686548461447307466550723283080099907641572930612118002148063995494400.0000131201676459368643345162059782646870277468970969112735584315467606306837003584256819994561216990187931171997604791994745240568634165765426198957382587825695973797573713514675708444703013446121417443127624543688560723357716931750856143774040280819691697686511787798957941877584725306335297536.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.594 -0.2602 -0.4894 213499 93 115 0.10
+
+ cm pos 0.0000 0.000060841271415260356419719197703369402391201850721933956656505535193776294698498126345382933333478341742767082206769500244630198184852783047131270462264003785624274337792.0000
+ cm vel 0.00002988289027997682802693983497751848374759464011395388493715503291889250668375404034786777329217118437365011920371230849645601103000134271894791446901050921490720855825203207522697438493901527828811325393933463185340888887921678060957375073571162831679438004985386492230975356928.0000 0.0000
+ am vec -0.000089678487447784630535911721631433827311764825159952537231832093551065171855032510222217984633427839467904278870962666597930982256223630049361285038151203819142836564770524067628027199296714196058952346837390072556161114795929882883518256528471185424384.000025932200433322053982192952106770811199263256861309132113964652146401362788488305797914716666117351861970284087561158656.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.625 -0.2602 -0.4892 214135 93 115 0.11
+
+ cm pos 0.0000 0.00007056187426054677493924467331418854824134159380228222538254402369341376679000430350937449706059256747929550390153556622978181448508607075631748689148266679893210927487859991568232827355043513036462620672.0000
+ cm vel9455060674212031355581578771901879604125962553448307097600.0000 -0.0000905195160386234450740183558978604172199329792.0000
+ am vec-423141848135701272406023541467931437765674988468612873501954086457315580459366065951211148150216363060684673068843401216.0000125443642165140234698752.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.656 -0.2600 -0.4891 212530 93 113 0.11
+
+ cm pos-386273933468065619173985927804919147162497699559454583073956195626200141480431296462331784685832260331541946668649339092828557868365025285470331254654019146977640448.0000 0.0000 -0.0000
+ cm vel 0.0000-4743632426372061158511341209478427049984.0000 -0.0000
+ am vec 0.0000-239671508137325590634863843622155833814981285994835032601270614092658842291431684040953083543400211671223431241893256294795585728275833182457304790693217990730311496158756774405546243960233591674835800011741111645345153024.0000-49006483581136799791641888765814459878578389959132951085056.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.688 -0.2601 -0.4889 212150 93 113 0.11
+
+ cm pos-1487877691353051346813520336017885540717350200296943508643073805990714385716229283691650362523040265199312029531821608704020321139945030962963163134541471336463841208991353543530388041219235849358604243269187075829952583083412936687997595390131332549137399808.000040431607191786761427104280235990972267707427172122822410294439962386301812790286105750215820881849925130162115777206193116849495846358291714289820468973224841672266675554448106613374976.0000 -13.2929
+ cm vel 0.0000-11643251192651135742202374015453695540762798882149109098056725959688116354151628798102358944813718655277288382536360031944704.000012214127581259127926085825924987929167959258823571338100692129269283544063459288458864672341430185836854168023394227560937501291047368584484892000666079498089560737607549155698544459847334549094863664733777468082618368.0000
+ am vec -0.0000 -0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.719 -0.2600 -0.4886 212527 94 113 0.11
+
+ cm pos 0.0000 0.0000 -0.0000
+ cm vel 0.0000-3740937435991330069141514183491046417018724477946895454742107797489367777651503363566961278124056778866179715697966013576194403899237985489979803333540796727857673818941610261164804175120928880995351628255464015896807598848228836431639275231370254795600210205941245916684764056020582400.0000-1496375143483907907202549691919803677796316676246757056763836145805924583914704210627705140289198718001323725056146519199218637170162712517048569896173780970119785070021058008587680219337631265573225593616508441974463349118760084145210014072326362943633595430732406036357386404506894336.0000
+ am vec 0.0000-506299477813233561955550035855612263891948926396244145840929646082785280.0000-2684.9614
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.750 -0.2599 -0.4882 214475 95 113 0.11
+
+ cm pos 0.0000570847744204721723776232849408.0000 -0.0000
+ cm vel 0.00009303607028694346891264.000021843041568780036096522682587664510881616848279258075297722038326617290297922028252001711372388398988242004113159931608364256454785453845998318603445295919123531750863561293824.0000
+ am vec-700071569435402216638880302142017276395802762833015640618709164542800072312688106229248106059986522595859399212024995928633470497187216698955866116508470781436116811431924583306537348690067597667317555776145055312004449953924960057820272526737333775511010924855369057378236567058532416561738678272.0000-243456541315596890445264715776.0000513257732687017105626118865708907316318212506516191568959281071650953163681544723234410311036750630144125272089295090772098918921862630415546013508832518229169275813676454317317868366413577531877798248124850876435237226083329977779649022787584.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.781 -0.2600 -0.4877 211398 91 114 0.12
+
+ cm pos 0.00002538767724261615285475428033880680745792006663422018224505287822966819943819333990035342023814910659520289606932673252852631492890355067269168256419129146222607384729988471012995209998647132004151371030385506262594086904318799071623748634288324608.0000 0.0000
+ cm vel -0.0000 0.0000268422787389278285271797801631966585676267684972192725911204560992505586897553306560563286382962671483260864624210919316562369601477625228271486094738593784420517225704744562865436386463903278971969808758943219470938662287088591831040.0000
+ am vec837892062621074121031680.0000-132651279428511567728320929138659552334884047864190970907987079738416890249908717681017771033859318913957888.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.812 -0.2601 -0.4874 212928 92 115 0.12
+
+ cm pos-23586053241842823245135748944728488268082619255211287698013802893306567539200322049913195098064694329682755230335454508989279460782795390976.0000 -0.000070241440506970972450347016211701085578921687019780308992.0000
+ cm vel91169676794840547328.0000 0.0000-312485246178787499574531571855500319353058166133757521121229774733759219541233886788987530449641599447143484297448632828066529280.0000
+ am vec550232859802479646353259776081220260536098562860406935542491773061360505706269193462888787400969095542198385491880413046180563628988464777570521854407192482773386701088342530776506535354974876767728366277722149418465140042290765040127300423723795199567519062541409814871944288389824512000.0000 -0.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.844 -0.2600 -0.4872 209464 86 117 0.12
+
+ cm pos -0.0000861707301861909157906082304171714659075465173542154683532334113325731026448459584625937939655005720799303189459229959264408324640317687966456790286446917991932177093416002625497464101695147794492865941398880256.0000252666357010502975621462733565699411846362936271402100906174394592957904290370055642541212933501991580773285441505073994549836783929041879040.0000
+ cm vel -0.0000 -0.0000 -0.0000
+ am vec-68490608628676523224720856037532446715355599902134806937953332627552826123427487958097226812935634441238287857672166554780652706213996011313215089657401764117079558838555354107722541273189961062652583734464235992056162569682944.000050456618611297886829757354662160239172340530892665167675282029350961536444081111603413846550938515835667024684958982650979252154412918582473548105930921184941240745984.0000-120410843834118465704508216705794312168686915722200368269626879150755912090314435502783930575303895989357367614664167186658206319076710106403318550304104380714027837600765589377793316349151402363932422582541971661783040.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.875 -0.2600 -0.4871 207897 83 119 0.12
+
+ cm pos -0.0000 0.0000 0.0000
+ cm vel-66162802194851512475163350965597860351791525983944182333141413076927899249282161844394703978496.0000 -0.0000 0.0000
+ am vec11728483527803680454149351588444369675886633479622192345377930537664319668078524032122394797090467856602221462554615236757693276373803464453850095590841455151417594286053991557048074315726107994886213012948800287237491790170924852578465945723095510069441227108775747918659444262567936.00006582488281356740775580741453573930863167553481592182449429463571380844369219358044538685193793404725407286121289479508977708874840016945614322852797958836589119901047151097491372353129411510272.0000 55.5065
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.906 -0.2599 -0.4871 209291 84 119 0.12
+
+ cm pos-6385407501542423356344755806443061288270744245271733424263391144172174415569762012748184697079435521029609866400382808289470873191676170913571324939072982848473856751012074292708062394740535433385954246656.0000-644869229673901272406156825127923652332469225409703600584491151210108331287504937876181340192947630284835925570132146913280.0000-437668470614432896856264312069700291181983845628797688075868840875753777929389526518230980868592805843229623026837241918909335524940739117863686355452748922059575422451777510660296836423288852539144758507851012664840256497425686700400193743706206982105132609568768.0000
+ cm vel91738830422806813664480961997610673203605020789679260166918736755863713592580010368522647064518273177534427837963926429695193972295091693219854824951171329605908614895111815547825621544646356421422716734241892684707921920.0000 -0.0000-121243859867853206740646684895908078250471680915696676398905280833144119433693665607520902571821648315567518233518535689457025036703426743927676786809940669086813177513589928090177251229303204492507220689006984235908654867421622446393976284930574252011503484928.0000
+ am vec1730582.0314 -0.0000 0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.938 -0.2599 -0.4870 208078 85 118 0.13
+
+ cm pos -0.0000 0.000033395408529609668545900087356741858626434687930018017154439459965780325063224136005981384682966837503201613185024.0000
+ cm vel 0.0000 -0.0000 -0.0000
+ am vec -0.0000 -0.000027389789144495919449353820222436523639840246996854991721274763678689626460095830498736729629319683568713072640.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 1.969 -0.2599 -0.4866 209032 86 117 0.13
+
+ cm pos2111126978254212190896032110963505517223209986732864848944365090759632121978562470532728892131013766535744886868300497309522872821223266685425227527010331702576239218982835496030604650047787545596755887684191381441436712960.0000 0.0000 -0.0000
+ cm vel -0.0000 -0.00006104709079556268540863807959478225927762031564494065094919212127507518028144940147284465673258377308288760565424364149004424205658263108939439948970025853793338794903375769680650550757274736944078163976294004356798080264175616.0000
+ am vec488557743030398575148588878336285926971136613741538351720650706714165379575801120920205589038035377801011584056505567547239551809464492359680.0000-57697119730310729279552069842804905030114276571601040109621109713774995878340556166888163327606900708361060685934377038941483270633441513572880889869444249990292808502969114770120113558694264365951053959505364172061258257620919380388284989440.0000 -0.0000
+
+ tnow tnow T+U T+U T/U T/U nttot
+ 2.000 -0.2600 -0.4864 208927 85 118 0.13
+
+ cm pos -0.0000-7367171723037541795094124434151519831792112034691840854356613346938449759299255409681446804939826068923097543887086184194872084937290308755997140123240935810488290471873347584000.0000 -0.0000
+ cm vel1006425721044856206000950062318392931898789353280274728983606558081433802045802861222818251758628458130325450533798649833034385272614630675871168760915286373163131622823786325277511140221770339768338481152.0000 0.0000-3144606464799229038263042987182620982102812047995738848406011579833110289130714648195731710966795169629551135090130652751542070025361201103838722768428417950975157384354212310551007046512936849306202144768.0000
+ am vec -0.0000-310585348040367212540466107933093981683394433536104796407776575005538885413170465336561984232650364092881885733701424906648778163815612342027107172352.0000187499318643495772928899061436600658023508244482639265792.0000
+
diff --git a/test/ccured_olden/bh/testit b/test/ccured_olden/bh/testit
new file mode 100755
index 00000000..8c758c7e
--- /dev/null
+++ b/test/ccured_olden/bh/testit
@@ -0,0 +1,21 @@
+#!/bin/sh
+# test a bh binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./code.exe"
+ exit 0
+fi
+
+echo "running: $1 <data.in >data.out 2>/dev/null"
+if ! $1 <data.in >data.out 2>/dev/null; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+if ! perl ./normalize.pl <data.out | diff - data.orig.out >/dev/null; then
+ echo "$1 got the wrong answer"
+ exit 4
+else
+ echo "$1 seems to work"
+fi
+
diff --git a/test/ccured_olden/bh/trusted_bh.c b/test/ccured_olden/bh/trusted_bh.c
new file mode 100644
index 00000000..6c76f8c2
--- /dev/null
+++ b/test/ccured_olden/bh/trusted_bh.c
@@ -0,0 +1,92 @@
+#include "defs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef _MSVC
+#include <sys/times.h>
+#include <sys/param.h>
+#endif
+
+
+#ifndef NO_PERF_CHANGES
+///*
+// * ALLOCATE: memory allocation with error checking.
+// */
+//void *allocate(int nb)
+//{
+// void *mem;
+//
+// mem = (void *) calloc(nb, 1); /* calloc zeros memory */
+// if (mem == NULL) {
+// fprintf(stderr, "allocate: not enuf memory (%d bytes)\n", nb);
+// exit(1);
+// }
+// return (mem);
+//}
+#endif // NO_PERF_CHANGES
+
+
+
+// Now some wrappers
+typedef struct {
+ void *_p;
+ void *_b;
+} fatp_void;
+
+//fatp_void strcpy_fss(char *dest, char *src) {
+// fatp_void res;
+// strcpy(dest, src);
+// res._p = (void*)dest;
+// res._b = (void*)(dest + strlen(dest));
+// return res;
+//}
+
+#ifndef NO_PERF_CHANGES
+ #ifdef node2body
+ #undef node2body
+ #endif
+ bodyptr node2body(nodeptr x) {
+ return (bodyptr)x;
+ }
+#endif
+
+// And the wild version. I'm being lazy about types
+fatp_void node2body_ww(fatp_void x) {
+ return x;
+}
+
+typedef struct {
+ nodeptr *_p;
+ void *_b;
+ void *_e;
+} seqp_node;
+bodyptr node2body_sq(seqp_node x) {
+ if((void*)x._p < x._b || (void*)((char*)x._p + sizeof(body)) > x._e) {
+ fprintf(stderr, "Bounds check failed in node2body_sq\n");
+ exit(1);
+ }
+ return (bodyptr)x._p;
+}
+
+#ifndef NO_PERF_CHANGES
+ #ifdef node2cell
+ #undef node2cell
+ #endif
+ cellptr node2cell(nodeptr x) {
+ return (cellptr)x;
+ }
+#endif
+
+// And the wild version.. I'm being lazy about types
+fatp_void node2cell_ww(fatp_void x) {
+ return x;
+}
+
+cellptr node2cell_sq(seqp_node x) {
+ // if((void*)x._p < x._b || (void*)((char*)x._p + sizeof(cell)) > x._e) {
+ // fprintf(stderr, "Bounds check failed in node2cell_sq\n");
+ // exit(1);
+ // }
+ return (cellptr)x._p;
+}
diff --git a/test/ccured_olden/bh/util.c b/test/ccured_olden/bh/util.c
new file mode 100644
index 00000000..b7e3347d
--- /dev/null
+++ b/test/ccured_olden/bh/util.c
@@ -0,0 +1,152 @@
+/****************************************************************************/
+/* UTIL: various useful routines and functions. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#include "stdinc.h"
+#include "real.h"
+#include "vectmath.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#ifndef _MSVC
+#include <sys/times.h>
+#include <sys/param.h>
+#endif
+
+
+#ifndef HZ
+# include <time.h>
+# define HZ CLK_TCK
+#endif
+
+/*
+ * ERROR: print error message and exit.
+ */
+
+void error(string msg, ...)
+{
+ va_list args;
+
+ va_start(args, msg);
+ vfprintf(stderr, msg, args);
+ va_end(args);
+ exit(-1); /* quit with error status */
+}
+
+/*
+ * EPRINTF: print error message, but don't exit.
+ */
+
+void eprintf(string msg, ...)
+{
+ va_list args;
+
+ va_start(args, msg);
+ vfprintf(stderr, msg, args);
+ va_end(args);
+}
+
+
+extern double drand48(void); /* should be in math.h */
+
+/*
+ * XRANDOM: generate floating-point random number.
+ */
+
+real xrandom(real xl, real xh)
+{
+ real r = (real)rand() / (real)RAND_MAX;
+ return (xl + (xh - xl) * r);
+}
+
+/*
+ * RSQR: compute x*x.
+ */
+
+real rsqr(real x)
+{
+ return (x * x);
+}
+
+/*
+ * DISTV: subtract vectors and return distance between.
+ */
+
+real distv(vector v, vector u)
+{
+ real s, d;
+ int n = NDIM;
+
+ s = 0.0;
+ while (--n >= 0) {
+ d = (*v++) - (*u++);
+ s += d * d;
+ }
+ return (rsqrt(s));
+}
+
+/*
+ * STREQ: test for equality of strings.
+ */
+
+bool streq(string a, string b)
+{
+ return (strcmp(a, b) == 0);
+}
+
+/*
+ * SCANOPT: scan string of the form "word1,word2,..." for match. Warning:
+ * words must be separated by exactly one comma -- no spaces allowed!
+ */
+
+bool scanopt(string opt, string key)
+{
+ char *op, *kp;
+
+ op = (char *) opt; /* start scan of options */
+ while (*op != NULLCHR) { /* loop over words in opt */
+ kp = (char *) key; /* start at front of key */
+ while ((*op != ',' ? *op : NULLCHR) /* loop while this word */
+ == *kp) { /* ...matches text of key */
+ if (*kp++ == NULLCHR) /* at end of key word? */
+ return (TRUE); /* keyword found */
+ op++; /* else advance ptrs */
+ }
+ while (*op != NULLCHR && *op++ != ',') /* loop till end of word, */
+ continue; /* passing "," at end */
+ }
+ return (FALSE); /* keyword not found */
+}
+
+/*
+ * CPUTIME: compute CPU time in minutes.
+ */
+
+real cputime()
+{
+#ifdef _MSVC
+ return 1.0;
+#else
+ struct tms buffer;
+
+ if (times(&buffer) == -1)
+ error("times() call failed\n");
+ return (buffer.tms_utime / (60.0 * HZ));
+#endif
+}
+
+
+void *allocate(nb)
+int nb;
+{
+ void *mem;
+
+ mem = (void *) calloc(nb, 1); /* calloc zeros memory */
+ if (mem == NULL)
+ error("allocate: not enuf memory (%d bytes)\n", nb);
+ return (mem);
+}
diff --git a/test/ccured_olden/bh/vectmath.h b/test/ccured_olden/bh/vectmath.h
new file mode 100644
index 00000000..7d1b503a
--- /dev/null
+++ b/test/ccured_olden/bh/vectmath.h
@@ -0,0 +1,371 @@
+/****************************************************************************/
+/* VECTMATH.H: include file for vector/matrix operations. */
+/* */
+/* Copyright (c) 1993 by Joshua E. Barnes, Honolulu, HI. */
+/* It's free because it's yours. */
+/****************************************************************************/
+
+#ifndef THREEDIM
+# ifndef TWODIM
+# ifndef NDIM
+# define THREEDIM
+# endif
+# endif
+#endif
+
+#ifdef TWODIM
+# define NDIM 2
+#endif
+
+#ifdef THREEDIM
+# define NDIM 3
+#endif
+
+typedef real vector[NDIM], matrix[NDIM][NDIM];
+
+/*
+ * Vector operations.
+ */
+
+#define CLRV(v) /* CLeaR Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = 0.0; \
+}
+
+#define UNITV(v,j) /* UNIT Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (_i == (j) ? 1.0 : 0.0); \
+}
+
+#define SETV(v,u) /* SET Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (u)[_i]; \
+}
+
+#ifdef THREEDIM
+
+#ifdef NO_PERF_CHANGES
+
+#define ADDV(v,u,w) /* ADD Vector */ \
+{ \
+ real *_vp = (v), *_up = (u), *_wp = (w); \
+ *_vp++ = (*_up++) + (*_wp++); \
+ *_vp++ = (*_up++) + (*_wp++); \
+ *_vp = (*_up ) + (*_wp ); \
+}
+
+#define SUBV(v,u,w) /* SUBtract Vector */ \
+{ \
+ real *_vp = (v), *_up = (u), *_wp = (w); \
+ *_vp++ = (*_up++) - (*_wp++); \
+ *_vp++ = (*_up++) - (*_wp++); \
+ *_vp = (*_up ) - (*_wp ); \
+}
+
+#define MULVS(v,u,s) /* MULtiply Vector by Scalar */ \
+{ \
+ real *_vp = (v), *_up = (u); \
+ *_vp++ = (*_up++) * (s); \
+ *_vp++ = (*_up++) * (s); \
+ *_vp = (*_up ) * (s); \
+}
+
+#else // NO_PERF_CHANGES
+
+#define ADDV(v,u,w) /* ADD Vector */ \
+{ \
+ real *_vp = (v), *_up = (u), *_wp = (w); \
+ _vp[2] = _up[2] + _wp[2]; \
+ _vp[1] = _up[1] + _wp[1]; \
+ _vp[0] = _up[0] + _wp[0]; \
+}
+
+#define SUBV(v,u,w) /* SUBtract Vector */ \
+{ \
+ real *_vp = (v), *_up = (u), *_wp = (w); \
+ _vp[2] = _up[2] - _wp[2]; \
+ _vp[1] = _up[1] - _wp[1]; \
+ _vp[0] = _up[0] - _wp[0]; \
+}
+
+#define MULVS(v,u,s) /* MULtiply Vector by Scalar */ \
+{ \
+ real *_vp = (v), *_up = (u); \
+ _vp[2] = (_up[2]) * (s); \
+ _vp[1] = (_up[1]) * (s); \
+ _vp[0] = (_up[0]) * (s); \
+}
+#endif // NO_PERF_CHANGES
+
+#else
+
+#define ADDV(v,u,w) /* ADD Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (u)[_i] + (w)[_i]; \
+}
+
+#define SUBV(v,u,w) /* SUBtract Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (u)[_i] - (w)[_i]; \
+}
+
+#define MULVS(v,u,s) /* MULtiply Vector by Scalar */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (u)[_i] * (s); \
+}
+
+#endif
+
+#define DIVVS(v,u,s) /* DIVide Vector by Scalar */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (u)[_i] / (s); \
+}
+
+#ifdef THREEDIM
+
+#ifdef NO_PERF_CHANGES
+
+#define DOTVP(s,v,u) /* DOT Vector Product */ \
+{ \
+ real *_vp = (v), *_up = (u); \
+ (s) = (*_vp++) * (*_up++); \
+ (s) += (*_vp++) * (*_up++); \
+ (s) += (*_vp ) * (*_up ); \
+}
+
+#else // NO_PERF_CHANGES
+
+#define DOTVP(s,v,u) /* DOT Vector Product */ \
+{ \
+ real *_vp = (v), *_up = (u); \
+ (s) = (_vp[2]) * (_up[2]); \
+ (s) += (_vp[1]) * (_up[1]); \
+ (s) += (_vp[0]) * (_up[0]); \
+}
+
+#endif // NO_PERF_CHANGES
+
+#else
+
+#define DOTVP(s,v,u) /* DOT Vector Product */ \
+{ \
+ int _i; \
+ (s) = 0.0; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (s) += (v)[_i] * (u)[_i]; \
+}
+
+#endif
+
+#define ABSV(s,v) /* ABSolute value of a Vector */ \
+{ \
+ real _tmp; \
+ int _i; \
+ _tmp = 0.0; \
+ for (_i = 0; _i < NDIM; _i++) \
+ _tmp += (v)[_i] * (v)[_i]; \
+ (s) = rsqrt(_tmp); \
+}
+
+#define DISTV(s,u,v) /* DISTance between Vectors */ \
+{ \
+ real _tmp; \
+ int _i; \
+ _tmp = 0.0; \
+ for (_i = 0; _i < NDIM; _i++) \
+ _tmp += ((u)[_i]-(v)[_i]) * ((u)[_i]-(v)[_i]); \
+ (s) = rsqrt(_tmp); \
+}
+
+#ifdef TWODIM
+
+#define CROSSVP(s,v,u) /* CROSS Vector Product */ \
+{ \
+ (s) = (v)[0]*(u)[1] - (v)[1]*(u)[0]; \
+}
+
+#endif
+
+#ifdef THREEDIM
+
+#define CROSSVP(v,u,w) /* CROSS Vector Product */ \
+{ \
+ (v)[0] = (u)[1]*(w)[2] - (u)[2]*(w)[1]; \
+ (v)[1] = (u)[2]*(w)[0] - (u)[0]*(w)[2]; \
+ (v)[2] = (u)[0]*(w)[1] - (u)[1]*(w)[0]; \
+}
+
+#endif
+
+#define INCADDV(v,u) /* INCrementally ADD Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] += (u)[_i]; \
+}
+
+#define INCSUBV(v,u) /* INCrementally SUBtract Vector */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] -= (u)[_i]; \
+}
+
+#define INCMULVS(v,s) /* INCrementally MULtiply Vector by Scalar */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] *= (s); \
+}
+
+#define INCDIVVS(v,s) /* INCrementally DIVide Vector by Scalar */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] /= (s); \
+}
+
+/*
+ * Matrix operations.
+ */
+
+#define CLRM(p) /* CLeaR Matrix */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = 0.0; \
+}
+
+#define SETMI(p) /* SET Matrix to Identity */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (_i == _j ? 1.0 : 0.0); \
+}
+
+#define SETM(p,q) /* SET Matrix */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (q)[_i][_j]; \
+}
+
+#define TRANM(p,q) /* TRANspose Matrix */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (q)[_j][_i]; \
+}
+
+#define ADDM(p,q,r) /* ADD Matrix */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (q)[_i][_j] + (r)[_i][_j]; \
+}
+
+#define SUBM(p,q,r) /* SUBtract Matrix */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (q)[_i][_j] - (r)[_i][_j]; \
+}
+
+#define MULM(p,q,r) /* Multiply Matrix */ \
+{ \
+ int _i, _j, _k; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) { \
+ (p)[_i][_j] = 0.0; \
+ for (_k = 0; _k < NDIM; _k++) \
+ (p)[_i][_j] += (q)[_i][_k] * (r)[_k][_j]; \
+ } \
+}
+
+#define MULMS(p,q,s) /* MULtiply Matrix by Scalar */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (q)[_i][_j] * (s); \
+}
+
+#define DIVMS(p,q,s) /* DIVide Matrix by Scalar */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (q)[_i][_j] / (s); \
+}
+
+#define MULMV(v,p,u) /* MULtiply Matrix by Vector */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) { \
+ (v)[_i] = 0.0; \
+ for (_j = 0; _j < NDIM; _j++) \
+ (v)[_i] += (p)[_i][_j] * (u)[_j]; \
+ } \
+}
+
+#define OUTVP(p,v,u) /* OUTer Vector Product */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (v)[_i] * (u)[_j]; \
+}
+
+#define TRACEM(s,p) /* TRACE of Matrix */ \
+{ \
+ int _i; \
+ (s) = 0.0; \
+ for (_i = 0.0; _i < NDIM; _i++) \
+ (s) += (p)[_i][_i]; \
+}
+
+/*
+ * Misc. impure operations.
+ */
+
+#define SETVS(v,s) /* SET Vector to Scalar */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (s); \
+}
+
+#define ADDVS(v,u,s) /* ADD Vector and Scalar */ \
+{ \
+ int _i; \
+ for (_i = 0; _i < NDIM; _i++) \
+ (v)[_i] = (u)[_i] + (s); \
+}
+
+#define SETMS(p,s) /* SET Matrix to Scalar */ \
+{ \
+ int _i, _j; \
+ for (_i = 0; _i < NDIM; _i++) \
+ for (_j = 0; _j < NDIM; _j++) \
+ (p)[_i][_j] = (s); \
+}
diff --git a/test/ccured_olden/bisort/.cvsignore b/test/ccured_olden/bisort/.cvsignore
new file mode 100644
index 00000000..14e4fb3b
--- /dev/null
+++ b/test/ccured_olden/bisort/.cvsignore
@@ -0,0 +1,25 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+allcfiles
+ope.m
+*_comb.c
+*cured.c
+*.optim.c
+changes
+*.browser
+*optimcured*
diff --git a/test/ccured_olden/bisort/CVS/Entries b/test/ccured_olden/bisort/CVS/Entries
new file mode 100644
index 00000000..6bd4f26b
--- /dev/null
+++ b/test/ccured_olden/bisort/CVS/Entries
@@ -0,0 +1,12 @@
+/HOWTO/1.1/Thu Jul 5 20:05:08 2001//
+/Makefile/1.4/Wed Oct 3 00:09:43 2001//
+/README/1.1/Tue Jun 12 16:43:34 2001//
+/args.c/1.1/Thu Jul 5 20:05:08 2001//
+/bitonic.c/1.3/Wed Oct 3 00:09:43 2001//
+/node.h/1.2/Thu Jul 5 20:05:08 2001//
+/proc.h/1.1/Tue Jun 12 16:43:34 2001//
+/swap.c/1.2/Thu Jul 5 20:05:08 2001//
+/ssplain.c/1.4/Fri Nov 9 00:51:25 2001//
+/.cvsignore/1.7/Wed Aug 7 01:48:34 2002//
+/ssplain.h/1.6/Mon Jan 6 23:28:32 2003//
+D
diff --git a/test/ccured_olden/bisort/CVS/Repository b/test/ccured_olden/bisort/CVS/Repository
new file mode 100644
index 00000000..08d61689
--- /dev/null
+++ b/test/ccured_olden/bisort/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/bisort
diff --git a/test/ccured_olden/bisort/CVS/Root b/test/ccured_olden/bisort/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/bisort/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/bisort/HOWTO b/test/ccured_olden/bisort/HOWTO
new file mode 100644
index 00000000..170ad73c
--- /dev/null
+++ b/test/ccured_olden/bisort/HOWTO
@@ -0,0 +1 @@
+250000 0 \ No newline at end of file
diff --git a/test/ccured_olden/bisort/Makefile b/test/ccured_olden/bisort/Makefile
new file mode 100644
index 00000000..b620fafb
--- /dev/null
+++ b/test/ccured_olden/bisort/Makefile
@@ -0,0 +1,67 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = bisort.exe
+PROGS = bitonic args ssplain
+
+ifdef _MSVC
+CC = cl
+
+SRC = .c
+OBJ = .obj
+ASM = .s
+
+EXTRA_CDEFS = /DI_TIME /DI_SYS_TIME /DULTRIX
+CDEFS = /DPLAIN /DSS_PLAIN
+OPTFLAGS = /Ox
+
+LIBS =
+LIBPATH =
+else
+CC = gcc -arch ppc # MacOS X
+#CC=gcc # other systems
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+SRC = .c
+OBJ = .o
+ASM = .s
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN
+OPTFLAGS = -g -Wall -O3
+
+LIBS = # MacOS X
+# LIBS = -lm
+LIBPATH =
+endif
+
+SRCS = $(addsuffix $(SRC),$(PROGS))
+OBJS = $(addsuffix $(OBJ),$(PROGS))
+ASMS = $(addsuffix $(ASM),$(PROGS))
+
+#defaulttarget: $(BINARY)
+
+#$(BINARY): $(OBJS)
+# $(CC) $(LDFALGS) $(OPTFLAGS) -o $@ $(OBJS) $(LIBPATH) $(LIBS)
+
+#$(SRC)$(OBJ):
+# $(CC) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) -c $<
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+clean:
+ rm -f $(BINARY) $(OBJS) $(ASMS) *~ *.light.c *.cil.*
+
diff --git a/test/ccured_olden/bisort/README b/test/ccured_olden/bisort/README
new file mode 100644
index 00000000..7b12c4bb
--- /dev/null
+++ b/test/ccured_olden/bisort/README
@@ -0,0 +1,22 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+******************
+olden_v1.0/benchmarks/bisort/README
+January 3, 1995
+Martin C. Carlisle
+
+this directory contains the Bitonic Sort benchmark:
+G. Bilardi and A. Nicolau. "Adaptive Bitonic Sorting: An optimal
+parallel algorithm for shared-memory machines." SIAM J. Comput.
+18(2):216-228, 1989.
+
+as implemented for Olden by Martin C. Carlisle
+******************
+
+Makefile - "make bisort" makes executable
+
+args.c - handle command line arguments
+bitonic.c - main routines
+swap.c - used to swap subtrees
+node.h - declarations
+code.h - prototypes
+
diff --git a/test/ccured_olden/bisort/args.c b/test/ccured_olden/bisort/args.c
new file mode 100644
index 00000000..12591026
--- /dev/null
+++ b/test/ccured_olden/bisort/args.c
@@ -0,0 +1,32 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+int mylog(int num)
+{
+ int j=0,k=1;
+
+ while(k<num) { k*=2; j++; }
+ return j;
+}
+
+extern int flag;
+int dealwithargs(int argc, char *argv[])
+{
+ int size;
+
+ if (argc > 2)
+ flag = atoi(argv[2]);
+ else
+ flag = 0;
+
+ if (argc > 1)
+ size = atoi(argv[1]);
+ else
+ size = 16;
+
+ return size;
+}
+
diff --git a/test/ccured_olden/bisort/bitonic.c b/test/ccured_olden/bisort/bitonic.c
new file mode 100644
index 00000000..72ff8611
--- /dev/null
+++ b/test/ccured_olden/bisort/bitonic.c
@@ -0,0 +1,267 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* =================== PROGRAM bitonic===================== */
+/* UP - 0, DOWN - 1 */
+
+#include "node.h" /* Node Definition */
+#include "proc.h" /* Procedure Types/Nums */
+
+#define CONST_m1 10000
+#define CONST_b 31415821
+#define RANGE 100
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+#define put(a) chatting("%d",a)
+#define puts(a) chatting(a)
+
+
+int flag=0,foo=0;
+
+#define NewNode(h,v) \
+ \
+{ \
+ h = (HANDLE *) malloc(sizeof(struct node)); \
+ h->value = v; \
+ h->left = NIL; \
+ h->right = NIL; \
+ };
+
+
+void InOrder(h)
+ HANDLE *h;
+{
+ HANDLE *l, *r;
+ if ((h != NIL))
+ {
+ l = h->left;
+ r = h->right;
+ InOrder(l);
+ chatting("%d @ 0x%x\n", h->value, (long)h);
+ InOrder(r);
+ }
+}
+
+int mult(int p, int q)
+{
+ int p1, p0, q1, q0;
+
+ p1=p/CONST_m1; p0=p%CONST_m1;
+ q1=q/CONST_m1; q0=q%CONST_m1;
+ return (((p0*q1+p1*q0) % CONST_m1)*CONST_m1+p0*q0);
+}
+
+int skiprand(int seed, int n)
+{
+#ifdef SS_PLAIN
+ for (; n; n--) seed=mult(seed,CONST_b)+1;
+#else SS_PLAIN
+ for (; n; n--) seed=random(seed);
+#endif SS_PLAIN
+ return seed;
+}
+
+#ifndef SS_PLAIN
+int random(int seed)
+{
+ int tmp;
+ tmp = (mult(seed,CONST_b)+1);
+ return tmp;
+}
+#endif SS_PLAIN
+
+HANDLE* RandTree(n,seed,level)
+ int n,seed,level;
+
+{
+ int next_val,my_name;
+ HANDLE *h;
+ my_name=foo++;
+
+ if (n > 1)
+ {
+#ifdef SS_PLAIN
+ seed = mult(seed,CONST_b)+1;
+#else SS_PLAIN
+ seed = random(seed);
+#endif SS_PLAIN
+ next_val=seed % RANGE;
+ NewNode(h,next_val);
+
+ h->left = RandTree((n/2),seed,level+1);
+ h->right = RandTree((n/2),skiprand(seed,(n)+1),level+1);
+ }
+ else
+ h = NIL;
+ return(h);
+}
+
+void SwapVal(l,r)
+ HANDLE *l, *r;
+{
+ int temp;
+
+ temp = l->value; /* MISS PROBLEM */
+ l->value = r->value;
+ r->value = temp;
+}
+
+void SwapLeft(l,r)
+ HANDLE *l, *r;
+{
+ HANDLE *h;
+
+ h = r->left;
+ r->left = l->left;
+ l->left = h;
+}
+
+void SwapRight(l,r)
+ HANDLE *l, *r;
+{
+ HANDLE *h;
+
+ h = r->right;
+ r->right = l->right; /* MISS PROBLEM */
+ l->right = h;
+}
+
+int Bimerge(root,spr_val,dir)
+ HANDLE *root;
+ int spr_val,dir;
+{
+ int rightexchange, elementexchange;
+ HANDLE *pl, *pr;
+
+ /*chatting("enter bimerge %x\n", root);*/
+ rightexchange = ((root->value > spr_val) ^ dir);
+ if (rightexchange)
+ {
+ int temp;
+ temp = root->value;
+ root->value = spr_val;
+ spr_val = temp;
+ }
+
+ pl = root->left;
+ pr = root->right;
+
+ while (pl != NIL)
+ {
+ elementexchange = ((pl->value > /* MISS PROBLEM */pr->value) ^ dir);
+ if (rightexchange)
+ {
+ if (elementexchange)
+ {
+ SwapVal(pl,pr);
+ SwapRight(pl,pr);
+ pl = pl->left;
+ pr = pr->left;
+ }
+ else
+ {
+ pl = pl->right;
+ pr = pr->right;
+ }
+ }
+ else
+ {
+ if (elementexchange)
+ {
+ SwapVal(pl,pr);
+ SwapLeft(pl,pr);
+ pl = pl->right;
+ pr = pr->right;
+ }
+ else
+ {
+ pl = pl->left;
+ pr = pr->left; /* MISS PROBLEM */
+ }
+ }
+ }
+
+ if (root->left != NIL)
+ {
+ root->value=Bimerge(root->left,root->value,dir);
+ spr_val=Bimerge(root->right,spr_val,dir);
+ }
+ /*chatting("exit bimerge %x\n", root);*/
+ return spr_val;
+}
+
+int Bisort(root,spr_val,dir)
+ HANDLE *root;
+ int spr_val,dir;
+{
+ /*chatting("bisort %x\n", root);*/
+ if (root->left == NIL)
+ {
+ if ((root->value > spr_val) ^ dir)
+ {
+ int val;
+ val = spr_val;
+ spr_val = root->value;
+ root->value =val;
+ }
+ }
+ else
+ {
+ /* Bisort both halves of the tree and merge */
+ root->value=Bisort(root->left,root->value,dir);
+ spr_val=Bisort(root->right,spr_val,!dir);
+ spr_val=Bimerge(root,spr_val,dir);
+ }
+ /*chatting("exit bisort %x\n", root);*/
+ return spr_val;
+}
+
+void main(argc,argv)
+ int argc;
+ char *argv[];
+
+
+{
+ HANDLE *h;
+ int sval;
+ int n;
+
+ n = dealwithargs(argc,argv);
+
+ chatting("Bisort with %d size\n", n);
+ h = RandTree(n,12345768,0);
+#ifdef SS_PLAIN
+ sval = (mult(245867,CONST_b)+1) % RANGE;
+#else SS_PLAIN
+ sval = random(245867) % RANGE;
+#endif SS_PLAIN
+ if (flag) {
+ InOrder(h);
+ chatting("%d\n",sval);
+ }
+ chatting("**************************************\n");
+ chatting("BEGINNING BITONIC SORT ALGORITHM HERE\n");
+ chatting("**************************************\n");
+
+ chatting("Sorting forward...");
+ sval=Bisort(h,sval,0);
+ if (flag) {
+ chatting("Sorted Tree:\n");
+ InOrder(h);
+ chatting("%d\n",sval);
+ }
+ chatting("done\n");
+
+ chatting("sorting backward...");
+ sval=Bisort(h,sval,1);
+ if (flag) {
+ chatting("Sorted Tree:\n");
+ InOrder(h);
+ chatting("%d\n",sval);
+ }
+ chatting("done\n");
+ exit(0);
+}
+
diff --git a/test/ccured_olden/bisort/node.h b/test/ccured_olden/bisort/node.h
new file mode 100644
index 00000000..c1b81c6d
--- /dev/null
+++ b/test/ccured_olden/bisort/node.h
@@ -0,0 +1,18 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* =============== NODE STRUCTURE =================== */
+
+struct node {
+ int value;
+ struct node *left;
+ struct node *right;
+ };
+
+typedef struct node HANDLE;
+
+#define NIL ((HANDLE *) 0)
+#ifdef FUTURES
+#define makenode(procid) ALLOC(procid,sizeof(struct node))
+#else
+#define makenode(procid) mymalloc(sizeof(struct node))
+#endif
diff --git a/test/ccured_olden/bisort/proc.h b/test/ccured_olden/bisort/proc.h
new file mode 100644
index 00000000..eadb80aa
--- /dev/null
+++ b/test/ccured_olden/bisort/proc.h
@@ -0,0 +1,25 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* ========== PROCEDURE TYPES/NUMS ================== */
+
+
+HANDLE *RandTree();
+
+void SwapValue();
+void SwapValLeft();
+void SwapValRight();
+int Bimerge();
+int Bisort();
+#define DD_EXIT 0
+
+
+/* ================= PROC NAMES ==============*/
+
+#ifdef EXTERN
+ extern char *procnames[];
+#else
+ static char *procnames[] =
+ {
+ "EXIT"
+ };
+#endif
diff --git a/test/ccured_olden/bisort/ssplain.c b/test/ccured_olden/bisort/ssplain.c
new file mode 100644
index 00000000..43d3f9db
--- /dev/null
+++ b/test/ccured_olden/bisort/ssplain.c
@@ -0,0 +1,69 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+void chatting(char *s, ...)
+{
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
+
+#ifndef BEFOREBOX
+static unsigned long bytes_allocated = 0;
+static unsigned long allocations = 0;
+
+void*
+ssplain_malloc(int size)
+{
+ allocations++;
+ bytes_allocated+=size;
+ return malloc(size);
+}
+
+void*
+ssplain_calloc(int nelems, int size)
+{
+ void *p;
+ allocations++;
+ bytes_allocated+= nelems * size;
+ p = calloc(nelems, size);
+ if(! p) { printf("Allocation failed\n"); exit(3); }
+ return p;
+}
+
+void
+ssplain_alloc_stats()
+{
+ chatting("Allocation stats: %d bytes allocated in %d allocations\n",
+ bytes_allocated, allocations);
+}
+#endif
diff --git a/test/ccured_olden/bisort/ssplain.h b/test/ccured_olden/bisort/ssplain.h
new file mode 100644
index 00000000..54f3a3ed
--- /dev/null
+++ b/test/ccured_olden/bisort/ssplain.h
@@ -0,0 +1,128 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+#pragma ccuredvararg("chatting", printf(1));
+void chatting(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/bisort/swap.c b/test/ccured_olden/bisort/swap.c
new file mode 100644
index 00000000..e1e98749
--- /dev/null
+++ b/test/ccured_olden/bisort/swap.c
@@ -0,0 +1,145 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#define COLLECT_SIZE 256
+#define DFS_SIZE 20
+#include "node.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+
+typedef struct {
+ int top;
+ HANDLE *handles[DFS_SIZE];
+} stack;
+
+#define push(s,v) (s)->handles[++((s)->top)] = v
+#define pop(s) (s)->handles[((s)->top)--]
+#define stackempty(s) ((s)->top < 0)
+void VisitCollect(HANDLE *t, local int *collect)
+{
+ register int val;
+ val = t->value;
+ *collect = val;
+}
+
+void VisitCollectReplace(HANDLE *t, local int *collect)
+{
+ register int temp = *collect;
+ register int val = t->value;
+ *collect = val;
+ t->value = temp;
+}
+
+void VisitReplace(HANDLE *t, local int *collect)
+{
+ register int val = *collect;
+ t->value = val;
+}
+
+void swapDFS(local stack *s, local int collection[], void visit())
+{
+ int num=0;
+
+ while (!stackempty(s) && num < COLLECT_SIZE)
+ {
+ HANDLE *v = pop(s);
+ visit(v,&collection[num]);
+ num++;
+ if (v->left != NULL)
+ {
+ HANDLE *child;
+ child = v->right;
+ push(s,child);
+ child = v->left;
+ push(s,child);
+ }
+ }
+}
+
+void NewSwapSubTree(HANDLE *t1, HANDLE *t2)
+{
+ local stack c1, r1, s2;
+ int collection[COLLECT_SIZE];
+
+ /*chatting("starting swapping\n");*/
+
+ if (t1!=NULL)
+ {
+ c1.top = -1;
+ r1.top = -1;
+ s2.top = -1;
+ push(&c1,t1);
+ push(&r1,t1);
+ push(&s2,t2);
+ while (!stackempty(&c1))
+ {
+ MLOCAL(t1);
+ swapDFS(&c1,collection,VisitCollect);
+ MLOCAL(t2);
+ swapDFS(&s2,collection,VisitCollectReplace);
+ MLOCAL(t1);
+ swapDFS(&r1,collection,VisitReplace);
+ }
+ }
+ /*chatting("ending swapping\n");*/
+
+}
+
+
+int *Collect(HANDLE *t1, local int collection[])
+{
+ register int val;
+ if (t1==NULL) return collection;
+ MLOCAL(t1);
+ val = t1->value;
+ *collection = val;
+ collection += 1;
+ collection = Collect(t1->left,collection);
+ collection = Collect(t1->right,collection);
+ return collection;
+}
+
+int *Collect_Replace(HANDLE *t1, local int collection[])
+{
+ register int temp,val;
+ if (t1==NULL) return collection;
+ MLOCAL(t1);
+ temp = *collection;
+ val = t1->value;
+ *collection = val;
+ t1->value = temp;
+ collection += 1;
+ collection = Collect_Replace(t1->left,collection);
+ collection = Collect_Replace(t1->right,collection);
+ return collection;
+}
+
+int *Replace(HANDLE *t1, local int collection[])
+{
+ register int val;
+ if (t1==NULL) return collection;
+ MLOCAL(t1);
+ val = *collection;
+ t1->value = val;
+ collection +=1;
+ collection = Replace(t1->left,collection);
+ collection = Replace(t1->right,collection);
+ return collection;
+}
+
+
+void SwapSubTree(HANDLE *t1, HANDLE *t2)
+{
+ int collection[COLLECT_SIZE];
+ HANDLE *t1loc, *t2loc;
+
+ MLOCAL(t1);
+ Collect(t1,collection);
+ MLOCAL(t2);
+ Collect_Replace(t2,collection);
+ MLOCAL(t1);
+ Replace(t1,collection);
+}
+
diff --git a/test/ccured_olden/em3d/.cvsignore b/test/ccured_olden/em3d/.cvsignore
new file mode 100644
index 00000000..7601f0ad
--- /dev/null
+++ b/test/ccured_olden/em3d/.cvsignore
@@ -0,0 +1,29 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+em3d
+em3d.*box
+
+allcfiles
+ope.m
+*cured.c
+*optimcured*
+*_comb.c
+changes
+*.browser
+*optimcured*
+*.out
diff --git a/test/ccured_olden/em3d/CVS/Entries b/test/ccured_olden/em3d/CVS/Entries
new file mode 100644
index 00000000..32532e6f
--- /dev/null
+++ b/test/ccured_olden/em3d/CVS/Entries
@@ -0,0 +1,17 @@
+/HOWTO/1.1/Fri Jun 29 11:36:12 2001//
+/MY_HOWTO/1.1/Fri Jun 29 11:36:12 2001//
+/Makefile.plain/1.1/Fri Jun 29 11:36:12 2001//
+/Makefile.ss/1.1/Fri Jun 29 11:36:12 2001//
+/em3d.c/1.1/Fri Jun 29 11:36:12 2001//
+/main.c/1.2/Mon Jul 9 19:38:57 2001//
+/make_graph.h/1.1/Fri Jun 29 11:36:12 2001//
+/util.c/1.1/Fri Jun 29 11:36:12 2001//
+/util.h/1.1/Fri Jun 29 11:36:12 2001//
+/ssplain.c/1.5/Sat Nov 3 05:27:15 2001//
+/Makefile/1.7/Fri Nov 9 01:27:01 2001//
+/args.c/1.2/Mon Mar 18 00:14:04 2002//
+/make_graph.c/1.2/Wed May 29 03:29:06 2002//
+/.cvsignore/1.9/Sat Aug 10 01:19:31 2002//
+/em3d.h/1.2/Sat Aug 10 01:19:31 2002//
+/ssplain.h/1.6/Mon Jan 6 23:28:11 2003//
+D
diff --git a/test/ccured_olden/em3d/CVS/Repository b/test/ccured_olden/em3d/CVS/Repository
new file mode 100644
index 00000000..cb6d74d1
--- /dev/null
+++ b/test/ccured_olden/em3d/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/em3d
diff --git a/test/ccured_olden/em3d/CVS/Root b/test/ccured_olden/em3d/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/em3d/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/em3d/HOWTO b/test/ccured_olden/em3d/HOWTO
new file mode 100644
index 00000000..061698dd
--- /dev/null
+++ b/test/ccured_olden/em3d/HOWTO
@@ -0,0 +1 @@
+2000 100 1
diff --git a/test/ccured_olden/em3d/MY_HOWTO b/test/ccured_olden/em3d/MY_HOWTO
new file mode 100644
index 00000000..fe67f7a8
--- /dev/null
+++ b/test/ccured_olden/em3d/MY_HOWTO
@@ -0,0 +1,2 @@
+2000 100 1?
+(These should be Mowry's arguments.)
diff --git a/test/ccured_olden/em3d/Makefile b/test/ccured_olden/em3d/Makefile
new file mode 100644
index 00000000..b7e1d60c
--- /dev/null
+++ b/test/ccured_olden/em3d/Makefile
@@ -0,0 +1,64 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = em3d.exe
+BINARYCCOMP = em3d.exe.compcert
+PROGS = main em3d make_graph util args ssplain
+
+
+OLDENHOME = /tmp/olden
+
+CC = gcc -arch ppc
+CCOMP = ../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+SRC = .c
+OBJ = .o
+ASM = .s
+SRCS = $(addsuffix $(SRC),$(PROGS))
+OBJS = $(addsuffix $(OBJ),$(PROGS))
+ASMS = $(addsuffix $(ASM),$(PROGS))
+INCDIRS = /usr/include
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN -DSS_RAND #-I$(OLDENHOME)/common
+OPTFLAGS = -g -Wall -O3
+
+LIBS =
+LIBPATH =
+
+#$(BINARY): $(OBJS)
+# $(CC) $(LDFALGS) $(OPTFLAGS) -o $@ $(OBJS) $(LIBPATH) $(LIBS)
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+
+
+#$(BINARYCCOMP): $(OBJSCCOMP)
+# $(CC) $(LDFALGS) $(OPTFLAGS) -o $@ $(OBJSCCOMP) $(LIBPATH) $(LIBS)
+
+#$(OBJCCOMP):
+# $(CCOMP) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) -c $<
+
+$(SRC)$(OBJ):
+ $(CC) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) -c $<
+
+clean:
+ rm -f $(BINARY) $(BINARYCCOMP) $(OBJS) $(ASMS) *~ *.light.c *.cil.*
+
+links:
+ /bin/rm -f ssplain.[hc]
+ ln -s $(OLDENHOME)/common/ssplain.h
+ ln -s $(OLDENHOME)/common/ssplain.c
diff --git a/test/ccured_olden/em3d/Makefile.plain b/test/ccured_olden/em3d/Makefile.plain
new file mode 100644
index 00000000..b87f77b1
--- /dev/null
+++ b/test/ccured_olden/em3d/Makefile.plain
@@ -0,0 +1,7 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = em3d
+FILES = main em3d make_graph util args ssplain
+
+include ../Makefile.plain
+
diff --git a/test/ccured_olden/em3d/Makefile.ss b/test/ccured_olden/em3d/Makefile.ss
new file mode 100644
index 00000000..f07d9395
--- /dev/null
+++ b/test/ccured_olden/em3d/Makefile.ss
@@ -0,0 +1,8 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = em3d
+FILES = main em3d make_graph util args ssplain
+
+MY_CDEFS = -DAMIR
+include ../Makefile.ss
+
diff --git a/test/ccured_olden/em3d/args.c b/test/ccured_olden/em3d/args.c
new file mode 100644
index 00000000..f48638e6
--- /dev/null
+++ b/test/ccured_olden/em3d/args.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "em3d.h"
+
+void dealwithargs(int argc, char *argv[])
+{
+ if (argc > 1)
+ n_nodes = atoi(argv[1]);
+ else
+ n_nodes = 10;
+
+ if (argc > 2)
+ d_nodes = atoi(argv[2]);
+ else
+ d_nodes = 3;
+
+ if (argc > 3)
+ iters = atoi(argv[3]);
+ else
+ iters = 100;
+}
diff --git a/test/ccured_olden/em3d/em3d.c b/test/ccured_olden/em3d/em3d.c
new file mode 100644
index 00000000..760dd1a0
--- /dev/null
+++ b/test/ccured_olden/em3d/em3d.c
@@ -0,0 +1,16 @@
+#include "em3d.h"
+
+void compute_nodes(node_t *nodelist)
+{
+ int i;
+
+ for (; nodelist; nodelist = nodelist->next)
+ for (i=0; i < nodelist->from_count; i++) /* bad load */
+ {
+ node_t *other_node = nodelist->from_nodes[i]; /* bad load */
+ double coeff = nodelist->coeffs[i]; /* bad load */
+ double value = other_node->value; /* bad load: 50% */
+
+ nodelist->value -= coeff * value;
+ }
+}
diff --git a/test/ccured_olden/em3d/em3d.h b/test/ccured_olden/em3d/em3d.h
new file mode 100644
index 00000000..ba1eac22
--- /dev/null
+++ b/test/ccured_olden/em3d/em3d.h
@@ -0,0 +1,38 @@
+/* em3d.h - Header file for the electromagnetic problem in 3 dimensions
+ *
+ * By: Martin C. Carlisle
+ * Date: Feb. 23, 1994
+ *
+ */
+
+#ifndef EM3D
+#define EM3D
+
+extern int n_nodes; /* number of nodes (E and H) */
+extern int d_nodes; /* degree of nodes */
+extern int iters; /* number of iterations */
+
+#define ALLOC malloc
+#define DIST_SPAN 6
+
+#define assert(a) if (!a) {printf("Assertion failure\n"); exit(-1);}
+
+
+typedef struct node_t {
+ double value;
+ struct node_t *next;
+ struct node_t ** to_nodes; /* array of nodes pointed to */
+ struct node_t ** from_nodes; /* array of nodes data comes from */
+ double * coeffs; /* array of coeffs on edges */
+ int from_count;
+} node_t;
+
+typedef struct graph_t {
+ node_t *e_nodes;
+ node_t *h_nodes;
+} graph_t;
+
+/* Perform 1 step for a nodelist */
+void compute_nodes(node_t *nodelist);
+#endif
+
diff --git a/test/ccured_olden/em3d/main.c b/test/ccured_olden/em3d/main.c
new file mode 100644
index 00000000..61a3af4f
--- /dev/null
+++ b/test/ccured_olden/em3d/main.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+
+#include "em3d.h"
+#include "make_graph.h"
+
+#define chatting(A)
+
+void print_graph(graph_t graph)
+{
+#ifdef GET_OUT
+ node_t *cur_node;
+
+ for(cur_node=graph.e_nodes; cur_node; cur_node=cur_node->next)
+ {
+ chatting(("E: value %f, from_count %d\n",cur_node->value,
+ cur_node->from_count));
+ }
+ for(cur_node=graph.h_nodes; cur_node; cur_node=cur_node->next)
+ {
+ chatting(("H: value %f, from_count %d\n",cur_node->value,
+ cur_node->from_count));
+ }
+#endif GET_OUT
+}
+
+int iters;
+
+int main(int argc, char *argv[])
+{
+ int i;
+ graph_t graph;
+
+ dealwithargs(argc,argv);
+ graph=initialize_graph();
+ print_graph(graph);
+
+ for (i = 0; i < iters; i++)
+ {
+ compute_nodes(graph.e_nodes);
+ compute_nodes(graph.h_nodes);
+ fprintf(stderr, "Completed a computation phase: %d\n", i);
+ print_graph(graph);
+ }
+ return 0;
+}
diff --git a/test/ccured_olden/em3d/make_graph.c b/test/ccured_olden/em3d/make_graph.c
new file mode 100644
index 00000000..6bec340d
--- /dev/null
+++ b/test/ccured_olden/em3d/make_graph.c
@@ -0,0 +1,173 @@
+/* make_graph.c - Create a graph to be solved for the electromagnetic
+ * problem in 3 dimensions.
+ *
+ * By: Martin C. Carlisle
+ * Date: Feb 23, 1994
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "em3d.h"
+#include "util.h"
+
+#define NUM_H_NODES n_nodes
+#define H_NODE_DEGREE d_nodes
+
+#define NUM_E_NODES n_nodes
+#define E_NODE_DEGREE d_nodes
+
+int n_nodes;
+int d_nodes;
+
+node_t **make_table(int size)
+{
+ node_t **retval;
+
+ retval = (node_t **) ALLOC(size*sizeof(node_t *));
+ assert(retval);
+ return retval;
+}
+
+// post:
+// all 'next' fields valid or null
+// to_nodes, from_nodes, coefs are dead
+void fill_table(node_t **table, int size)
+{
+ int i;
+
+ /* Now we fill the table with allocated nodes */
+ for (i=0; i<size; i++)
+ {
+ table[i] = (node_t *) ALLOC(sizeof(node_t));
+ table[i]->value = gen_uniform_double();
+ table[i]->from_count = 0;
+
+ if (i > 0)
+ table[i-1]->next = table[i];
+ }
+ table[size-1]->next = NULL;
+}
+
+// post:
+// nodes in 'nodelist' have their 'to_nodes' array created, of
+// size 'degree'; then this array is filled with pointers to
+// randomly-chosen nodes (no duplicates); 'from_count' in the
+// pointed-to node keeps track of its in-degree
+void make_neighbors(node_t *nodelist, node_t **table, int tablesz,
+ int degree)
+{
+ node_t *cur_node;
+
+ for(cur_node = nodelist; cur_node; cur_node=cur_node->next)
+ {
+ node_t *other_node;
+ int j,k;
+
+ cur_node->to_nodes = (node_t **) ALLOC(degree*(sizeof(node_t *)));
+ for (j=0; j<degree; j++)
+ {
+ /* Make sure no duplicates are generated */
+ do
+ {
+ other_node = table[gen_number(tablesz)];
+ for (k=0; k<j; k++)
+ if (other_node == cur_node->to_nodes[k]) break;
+ }
+ while (k<j);
+ cur_node->to_nodes[j]=other_node;
+ other_node->from_count++; /* bad load: 50% */
+ }
+ }
+}
+
+// post:
+// from_nodes and coeffs get allocated, size specified by 'from_count',
+// which is the 'degree' from above; coeff's entries are set randomly,
+// from_nodes' entries left dead; from_count then set to 0
+void update_from_coeffs(node_t *nodelist)
+{
+ node_t *cur_node;
+
+ /* Setup coefficient and from_nodes vectors for h nodes */
+ for (cur_node = nodelist; cur_node; cur_node=cur_node->next)
+ {
+ int from_count = cur_node->from_count;
+ int k;
+
+ cur_node->from_nodes = (node_t **) ALLOC(from_count * sizeof(node_t *));
+ cur_node->coeffs = (double *) ALLOC(from_count * sizeof(double));
+ for (k=0; k<from_count; k++)
+ cur_node->coeffs[k] = gen_uniform_double();
+
+ cur_node->from_count = 0;
+ }
+}
+
+// post:
+// nodes pointed-to by those on 'nodelist' have their from_nodes'
+// entries filled with back-edges; from_count is used to add
+// information contiguously; global algorithm structure keeps the
+// array access in bounds (we counted in-degree before, and that
+// count was used to allocate, and now we one again enumerate the
+// pointers to a node); perhaps a runtime check is in order here
+void fill_from_fields(node_t *nodelist, int degree)
+{
+ node_t *cur_node;
+ for(cur_node = nodelist; cur_node; cur_node = cur_node->next)
+ {
+ int j;
+
+ for (j=0; j<degree; j++)
+ {
+ node_t *other_node = cur_node->to_nodes[j];
+ other_node->from_nodes[other_node->from_count] = cur_node;
+ other_node->from_count++;
+ }
+ }
+}
+
+// post:
+// two arrays of nodes are created; all 'h' nodes are then pointed to
+// H_NODE_DEGREE 'e' nodes, and vice-versa for 'e' nodes; backedge
+// information is also computed; pointers to the first nodes of each
+// set are stashed in a graph_t and returned (sets are linked together
+// as a linked list)
+graph_t initialize_graph()
+{
+ node_t **h_table;
+ node_t **e_table;
+ graph_t retval;
+
+ /* We start by creating a table of pointers to the h nodes */
+ h_table = make_table(NUM_H_NODES);
+ fill_table(h_table,NUM_H_NODES);
+
+ /* We repeat the same for the e nodes */
+ e_table = make_table(NUM_E_NODES);
+ fill_table(e_table,NUM_E_NODES);
+
+ /* At this point, for each h node, we give it the appropriate number
+ of neighbors as defined by the degree */
+ make_neighbors(h_table[0],e_table,NUM_E_NODES,H_NODE_DEGREE);
+ make_neighbors(e_table[0],h_table,NUM_H_NODES,E_NODE_DEGREE);
+
+ /* We now create from count and initialize coefficients */
+ update_from_coeffs(h_table[0]);
+ update_from_coeffs(e_table[0]);
+
+ /* Fill the from fields in the nodes */
+ fill_from_fields(h_table[0],H_NODE_DEGREE);
+ fill_from_fields(e_table[0],E_NODE_DEGREE);
+
+ retval.e_nodes=e_table[0];
+ retval.h_nodes=h_table[0];
+
+ free(h_table);
+ free(e_table);
+
+ return retval;
+}
+
+
+
diff --git a/test/ccured_olden/em3d/make_graph.h b/test/ccured_olden/em3d/make_graph.h
new file mode 100644
index 00000000..2433c018
--- /dev/null
+++ b/test/ccured_olden/em3d/make_graph.h
@@ -0,0 +1,13 @@
+/* make_graph.h
+ *
+ * By: Martin C. Carlisle
+ * Date: Feb 23, 1994
+ *
+ */
+
+#include "em3d.h"
+
+/* initialize graph returns a structure with pointers to lists of e and h
+ * nodes.
+ */
+graph_t initialize_graph();
diff --git a/test/ccured_olden/em3d/ssplain.c b/test/ccured_olden/em3d/ssplain.c
new file mode 100644
index 00000000..346c5ed2
--- /dev/null
+++ b/test/ccured_olden/em3d/ssplain.c
@@ -0,0 +1,70 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+
+void chatting(char *s, ...)
+{
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
+
+#ifndef BEFOREBOX
+static unsigned long bytes_allocated = 0;
+static unsigned long allocations = 0;
+
+void*
+ssplain_malloc(int size)
+{
+ allocations++;
+ bytes_allocated+=size;
+ return malloc(size);
+}
+
+void*
+ssplain_calloc(int nelems, int size)
+{
+ void *p;
+ allocations++;
+ bytes_allocated+= nelems * size;
+ p = calloc(nelems, size);
+ if(!p) { printf("Cannot allocate\n"); exit(3); }
+ return p;
+}
+
+void
+ssplain_alloc_stats()
+{
+ chatting("Allocation stats: %d bytes allocated in %d allocations\n",
+ bytes_allocated, allocations);
+}
+#endif
diff --git a/test/ccured_olden/em3d/ssplain.h b/test/ccured_olden/em3d/ssplain.h
new file mode 100644
index 00000000..54f3a3ed
--- /dev/null
+++ b/test/ccured_olden/em3d/ssplain.h
@@ -0,0 +1,128 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+#pragma ccuredvararg("chatting", printf(1));
+void chatting(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/em3d/util.c b/test/ccured_olden/em3d/util.c
new file mode 100644
index 00000000..3dc5592d
--- /dev/null
+++ b/test/ccured_olden/em3d/util.c
@@ -0,0 +1,34 @@
+#define CONST_seed 45
+#include <stdlib.h>
+
+/* initialize the random number generator for a particular processor */
+void init_random(int myid)
+{
+ srand48(myid*CONST_seed);
+}
+
+/* return a random number from 0 to range-1 */
+int gen_number(int range)
+{
+ return lrand48() % range;
+}
+
+/* return a random number in [-range+1,range-1] */
+int gen_signed_number(int range)
+{
+ int temp;
+
+ temp = lrand48() % (2*range-1); /* 0..2*range-2 */
+ return temp-(range-1);
+}
+
+/* Generate a double from 0.0 to 1.0 */
+double gen_uniform_double()
+{
+ return drand48();
+}
+
+int check_percent(int percent)
+{
+ return (drand48() < (double) (percent/100.0));
+}
diff --git a/test/ccured_olden/em3d/util.h b/test/ccured_olden/em3d/util.h
new file mode 100644
index 00000000..a6b09f28
--- /dev/null
+++ b/test/ccured_olden/em3d/util.h
@@ -0,0 +1,23 @@
+/* util.h
+ *
+ * headers for randomizing utilities
+ *
+ * By: Martin C. Carlisle
+ * Date: Feb 23, 1994
+ *
+ */
+
+/* initialize the random number generator for a particular processor */
+void init_random(int myid);
+
+/* return a random number from 0 to range-1 */
+int gen_number(int range);
+
+/* return a random number in [-range+1,range-1] */
+int gen_signed_number(int range);
+
+/* Generate a double from 0.0 to 1.0 */
+double gen_uniform_double();
+
+/* Return 1, percent percent of the time and 0 otherwise */
+int check_percent(int percent);
diff --git a/test/ccured_olden/health/.cvsignore b/test/ccured_olden/health/.cvsignore
new file mode 100644
index 00000000..4d714a14
--- /dev/null
+++ b/test/ccured_olden/health/.cvsignore
@@ -0,0 +1,30 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+changes.out
+health.cil
+health.*box
+health.exe_comb.browser
+health
+allcfiles
+ope.m
+*cured.c
+*.optim.c
+*_comb.c
+changes
+output
+out.diff
diff --git a/test/ccured_olden/health/.gdbinit b/test/ccured_olden/health/.gdbinit
new file mode 100644
index 00000000..ce03cd23
--- /dev/null
+++ b/test/ccured_olden/health/.gdbinit
@@ -0,0 +1,6 @@
+# .gdbinit
+
+file health
+set args 2 5 1
+break main
+run
diff --git a/test/ccured_olden/health/CVS/Entries b/test/ccured_olden/health/CVS/Entries
new file mode 100644
index 00000000..87bb1a82
--- /dev/null
+++ b/test/ccured_olden/health/CVS/Entries
@@ -0,0 +1,16 @@
+/.gdbinit/1.1/Sat Jul 21 16:09:41 2001//
+/HOWTO/1.1/Sat Jul 14 22:53:03 2001//
+/README/1.1/Mon Jun 11 22:47:26 2001//
+/health.h/1.3/Sat Jul 21 16:09:41 2001//
+/list.c/1.3/Sat Jul 21 16:09:41 2001//
+/poisson.c/1.2/Mon Jul 9 16:14:59 2001//
+/ssplain.c/1.5/Fri Nov 9 01:27:01 2001//
+/args.c/1.5/Mon Nov 12 15:44:12 2001//
+/health.c/1.7/Mon Nov 12 15:44:12 2001//
+/out.orig/1.2/Mon Nov 12 15:44:12 2001//
+/out.orig.msvc/1.1/Tue Dec 4 04:57:46 2001//
+/testit/1.2/Tue Dec 4 05:07:50 2001//
+/Makefile/1.11/Tue Dec 18 06:56:15 2001//
+/.cvsignore/1.14/Fri Oct 4 16:28:44 2002//
+/ssplain.h/1.5/Mon Jan 6 23:28:55 2003//
+D
diff --git a/test/ccured_olden/health/CVS/Repository b/test/ccured_olden/health/CVS/Repository
new file mode 100644
index 00000000..8167847a
--- /dev/null
+++ b/test/ccured_olden/health/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/health
diff --git a/test/ccured_olden/health/CVS/Root b/test/ccured_olden/health/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/health/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/health/HOWTO b/test/ccured_olden/health/HOWTO
new file mode 100644
index 00000000..8f57aa46
--- /dev/null
+++ b/test/ccured_olden/health/HOWTO
@@ -0,0 +1 @@
+5 500 1 1
diff --git a/test/ccured_olden/health/Makefile b/test/ccured_olden/health/Makefile
new file mode 100644
index 00000000..d9c5c767
--- /dev/null
+++ b/test/ccured_olden/health/Makefile
@@ -0,0 +1,72 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = health.exe
+PROGS = health poisson list args ssplain
+
+# ------- msvc ------
+ifdef _MSVC
+CC = cl
+
+CFLAGS =
+CONLY = /c
+SRC = .c
+OBJ = .obj
+ASM = .s
+EXEOUT = /Fe
+
+EXTRA_CDEFS = /DI_TIME /DI_SYS_TIME /DULTRIX
+CDEFS = /DPLAIN /DSS_PLAIN
+ifdef _DEBUG
+OPTFLAGS = /Zi /MLd
+else
+OPTFLAGS = /Ox
+endif
+
+LIBS =
+LIBPATH =
+
+# ------- gcc ------
+else
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+CFLAGS = -O3
+CONLY = -c
+SRC = .c
+OBJ = .gcc
+OBJCCOMP = .compcert
+ASM = .s
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN
+OPTFLAGS = -g -Wall -O3
+EXEOUT = -gcc
+
+LIBS =
+LIBPATH =
+endif
+
+# ------- common --------
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+
+clean:
+ rm -f $(BINARY) *.o *~ *.s *.light.c *.cil.* *.compcert
+
+
+
diff --git a/test/ccured_olden/health/README b/test/ccured_olden/health/README
new file mode 100644
index 00000000..aff90729
--- /dev/null
+++ b/test/ccured_olden/health/README
@@ -0,0 +1,20 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+**********************
+olden_v1.0/benchmarks/health/README
+January 3, 1995
+Martin C. Carlisle
+
+this directory contains the health benchmark:
+
+G. Lomow, J. Cleary, B. Unger and D. West. "A Performance Study of Time Warp"
+In SCS Multiconference on Distributed Simulation, pages 50-55, Feb. 1988.
+
+as implemented for Olden by Gordon C. Mackenzie
+**********************
+
+Makefile - use "make health" to create executable
+
+args.c - process command line args
+health.[ch] - health routines
+list.c - list routines
+poisson.c - random routines
diff --git a/test/ccured_olden/health/args.c b/test/ccured_olden/health/args.c
new file mode 100644
index 00000000..f8e7a8cc
--- /dev/null
+++ b/test/ccured_olden/health/args.c
@@ -0,0 +1,34 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/*****************************************************************
+ * args.c: Handles arguments to command line. *
+ * To be used with health.c. *
+ *****************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "health.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+void dealwithargs(int argc, char *argv[]) {
+
+ if (argc < 4)
+ {
+ fprintf(stderr, "usage: health <# levels> <time> <seed>\n");
+ exit(1);
+ }
+
+ max_level = atoi(argv[1]);
+ fprintf(stderr, "This is max_level : %d\n", max_level);
+ max_time = atol(argv[2]);
+ fprintf(stderr, "This is max_time : %ld\n", max_time); // sm: "%d" -> "%ld"
+ seed = atol(argv[3]);
+}
+
+
+
+
+
diff --git a/test/ccured_olden/health/health.c b/test/ccured_olden/health/health.c
new file mode 100644
index 00000000..6de1d0d7
--- /dev/null
+++ b/test/ccured_olden/health/health.c
@@ -0,0 +1,309 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/*******************************************************************
+ * Health.c : Model of the Colombian Health Care System *
+ *******************************************************************/
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "health.h"
+#include <assert.h>
+
+struct Village *alloc_tree(int level, int label, struct Village *back)
+{
+ if (level == 0)
+ {
+ return NULL;
+ }
+ else
+ {
+ int i;
+ struct Village *new;
+
+ new = (struct Village *)malloc(sizeof(struct Village));
+
+ new->back = back;
+ new->label = label;
+ new->seed = label * (IQ + seed);
+ new->hosp.personnel = (int)pow(2, level - 1);
+ new->hosp.free_personnel = new->hosp.personnel;
+ new->hosp.num_waiting_patients = 0;
+ new->hosp.assess.forward = NULL;
+ new->hosp.assess.back = NULL;
+ new->hosp.waiting.forward = NULL;
+ new->hosp.waiting.back = NULL;
+ new->hosp.inside.forward = NULL;
+ new->hosp.inside.back = NULL;
+ new->returned.back = NULL;
+ new->returned.forward = NULL;
+
+ for (i = 0; i < 4; i++)
+ new->forward[i] =
+ alloc_tree(level - 1, (label * 4) + i + 1, new);
+
+ return new;
+ }
+}
+
+
+struct Results get_results(struct Village *village)
+{
+ int i;
+ struct List *list;
+ struct Patient *p;
+ struct Village *v;
+ struct Results r1;
+
+ r1.total_hosps = 0.0;
+ r1.total_patients = 0.0;
+ r1.total_time = 0.0;
+
+ if (village == NULL) return r1;
+
+ for (i = 0; i < 4; i++ ) {
+ struct Results res;
+
+ v = village->forward[i];
+ res = get_results(v);
+
+ r1.total_hosps += res.total_hosps;
+ r1.total_patients += res.total_patients;
+ r1.total_time += res.total_time;
+ }
+
+ list = village->returned.forward;
+ while (list != NULL) {
+ p = list->patient;
+ r1.total_hosps += (float)(p->hosps_visited);
+ r1.total_time += (float)(p->time);
+ r1.total_patients += 1.0;
+ list = list->forward;
+ }
+
+ return r1;
+}
+
+
+void check_patients_inside(struct Village *village, struct List *list)
+{
+ struct Patient *p;
+
+ while (list != NULL)
+ {
+
+ p = list->patient;
+ p->time_left--;
+
+ if (p->time_left == 0)
+ {
+ village->hosp.free_personnel++;
+ removeList(&(village->hosp.inside), p);
+ addList(&(village->returned), p);
+ }
+ list = list->forward;
+ }
+}
+
+
+struct List *check_patients_assess(struct Village *village, struct List *list)
+{
+ float rand;
+ struct Patient *p;
+ int label;
+
+ while (list != NULL)
+ {
+ p = list->patient;
+ p->time_left--;
+ label = village->label;
+
+ if (p->time_left == 0)
+ {
+ rand = my_rand(village->seed);
+ village->seed = (long)(rand * IM);
+ label = village->label;
+
+ if (rand > 0.1 || label == 0)
+ {
+ removeList(&(village->hosp.assess), p);
+ addList(&(village->hosp.inside), p);
+ p->time_left = 10;
+ p->time += p->time_left;
+ }
+ else
+ {
+ village->hosp.free_personnel++;
+ removeList(&(village->hosp.assess), p);
+ addList(&(village->hosp.up), p);
+ }
+ }
+
+ list = list->forward;
+ }
+ return &(village->hosp.up);
+}
+
+
+void check_patients_waiting(struct Village *village, struct List *list)
+{
+ int i;
+ struct Patient *p;
+
+ while (list != NULL)
+ {
+ i = village->hosp.free_personnel;
+ p = list->patient; /* This is a bad load */
+
+ if (i > 0)
+ {
+ village->hosp.free_personnel--;
+ p->time_left = 3;
+ p->time += p->time_left;
+ removeList(&(village->hosp.waiting), p);
+ addList(&(village->hosp.assess), p);
+ }
+ else
+ {
+ p->time++; /* so is this */
+ }
+ list = list->forward;
+ }
+}
+
+
+void put_in_hosp(struct Hosp *hosp, struct Patient *patient)
+{
+ patient->hosps_visited++;
+
+ if (hosp->free_personnel > 0)
+ {
+ hosp->free_personnel--;
+ addList(&(hosp->assess), patient);
+ patient->time_left = 3;
+ patient->time += patient->time_left;
+ }
+ else
+ {
+ addList(&(hosp->waiting), patient);
+ }
+}
+
+
+struct Patient *generate_patient(struct Village *village)
+{
+ struct Patient *patient = NULL;
+ float rand;
+
+ rand = my_rand(village->seed);
+ village->seed = (long)(rand * IM);
+
+ if (rand > 0.666)
+ {
+ patient = (struct Patient *)mymalloc(sizeof(struct Patient));
+ patient->hosps_visited = 0;
+ patient->time = 0;
+ patient->time_left = 0;
+ patient->home_village = village;
+ }
+
+ return patient;
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct Results results;
+ struct Village *top;
+ long i;
+ float total_time,
+ total_patients,
+ total_hosps;
+
+ dealwithargs(argc, argv);
+
+ top = alloc_tree(max_level, 0, NULL);
+
+ chatting("\n\n Colombian Health Care Simulator\n\n");
+ chatting("Working...\n");
+
+ // sm: changed "%d" to "%ld" to silence gcc warning
+ fprintf(stderr, "This is max_time right before the loop: %ld\n", max_time);
+ for (i = 0; i < max_time; i++)
+ {
+ //printf("This is i with each iteration: %d\n", i);
+ if ((i % 10) == 0)
+ chatting("iteration %d\n", i);
+ sim(top);
+ }
+
+ results = get_results(top);
+ total_patients = results.total_patients;
+ total_time = results.total_time;
+ total_hosps = results.total_hosps;
+
+ chatting("Done.\n\n");
+ chatting("# of people treated: %f people\n",
+ total_patients);
+ chatting("Average length of stay: %f time units\n",
+ total_time / total_patients);
+ chatting("Average # of hospitals visited: %f hospitals\n\n",
+ total_hosps / total_patients);
+ return 0;
+}
+
+
+struct List *sim(struct Village *village)
+{
+ int i;
+ struct Patient *patient, *p;
+ struct List *l, *vl, *up;
+
+ if (village == NULL)
+ return NULL;
+
+ for (i = 0; i < 4; i++)
+ {
+ l = vl = sim(village->forward[i]);
+
+ if (l != NULL)
+ {
+ l = l->forward;
+ while (l != NULL)
+ {
+ p = l->patient;
+ put_in_hosp(&(village->hosp), p);
+ removeList(vl, p);
+ l = l->forward;
+ }
+ }
+ }
+
+
+ /* Uses lists inside, and return */
+ check_patients_inside(village, village->hosp.inside.forward);
+
+ /* Uses lists assess, inside, and up */
+ up = check_patients_assess(village, village->hosp.assess.forward);
+
+ /* Uses lists waiting, and assess */
+ check_patients_waiting(village, village->hosp.waiting.forward);
+
+ if ((patient = generate_patient(village)) != NULL)
+ {
+ put_in_hosp(&(village->hosp), patient);
+ }
+
+ return up;
+}
+
+
+
+
+
+
+
+
diff --git a/test/ccured_olden/health/health.h b/test/ccured_olden/health/health.h
new file mode 100644
index 00000000..4d3c4fd8
--- /dev/null
+++ b/test/ccured_olden/health/health.h
@@ -0,0 +1,76 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/****************************************************************
+ * health.h: header file for health.c *
+ *************************************************************** */
+
+
+#ifndef _HEALTH
+#define _HEALTH
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define IA 16807
+#define IM 2147483647
+#define AM (1.0 / IM)
+#define IQ 127773
+#define IR 2836
+#define MASK 123459876
+
+int max_level;
+long max_time,
+ seed;
+
+struct Results {
+ float total_patients;
+ float total_time;
+ float total_hosps; };
+
+struct Patient {
+ int hosps_visited;
+ int time;
+ int time_left;
+ struct Village *home_village; };
+
+struct List {
+ struct Patient *patient;
+ struct List *back;
+ struct List *forward; };
+
+struct Hosp {
+ int personnel;
+ int free_personnel;
+ int num_waiting_patients;
+ struct List waiting;
+ struct List assess;
+ struct List inside;
+ struct List up; };
+
+struct Village {
+ struct Village *forward[4],
+ *back;
+ struct List returned;
+ struct Hosp hosp;
+ int label;
+ long seed; };
+
+void dealwithargs(int argc, char *argv[]);
+float my_rand(long idum);
+struct Patient *generate_patient(struct Village *village);
+void put_in_hosp(struct Hosp *hosp, struct Patient *patient);
+void addList(struct List *list, struct Patient *patient);
+void removeList(struct List *list, struct Patient *patient);
+struct List *sim(struct Village *village);
+void check_patients_inside(struct Village *village, struct List *list);
+struct List *check_patients_assess(struct Village *village, struct List *list);
+void check_patients_waiting(struct Village *village, struct List *list);
+float get_num_people(struct Village *village);
+float get_total_time(struct Village *village);
+float get_total_hosps(struct Village *village);
+struct Results get_results(struct Village *village);
+
+#endif
+
+
+
diff --git a/test/ccured_olden/health/list.c b/test/ccured_olden/health/list.c
new file mode 100644
index 00000000..dcd268cc
--- /dev/null
+++ b/test/ccured_olden/health/list.c
@@ -0,0 +1,55 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/********************************************************************
+ * List.c: Handles lists. *
+ * To be used with health.c *
+ ******************************************************************* */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "health.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+void addList(struct List *list, struct Patient *patient) {
+ struct List *b;
+
+ while (list != NULL)
+ {
+ b = list;
+ list = list->forward;
+ }
+
+ list = (struct List *)mymalloc(sizeof(struct List));
+ list->patient = patient;
+ list->forward = NULL;
+ list->back = b;
+ b->forward = list;
+}
+
+
+void removeList(struct List *list, struct Patient *patient)
+{
+ struct List *l1,*l2;
+ struct Patient *p;
+
+ p = list->patient;
+ while(p != patient)
+ {
+ list = list->forward;
+ p = list->patient;
+ }
+
+ l1 = list->back;
+ l2 = list->forward;
+ l1->forward = l2;
+ if (list->forward != NULL)
+ {
+ l1 = list->forward;
+ l2 = list->back;
+ l1->back = l2;
+ }
+}
+
diff --git a/test/ccured_olden/health/out.orig b/test/ccured_olden/health/out.orig
new file mode 100644
index 00000000..42fd5748
--- /dev/null
+++ b/test/ccured_olden/health/out.orig
@@ -0,0 +1,64 @@
+This is max_level : 5
+This is max_time : 500
+
+
+ Colombian Health Care Simulator
+
+Working...
+This is max_time right before the loop: 500
+iteration 0
+iteration 10
+iteration 20
+iteration 30
+iteration 40
+iteration 50
+iteration 60
+iteration 70
+iteration 80
+iteration 90
+iteration 100
+iteration 110
+iteration 120
+iteration 130
+iteration 140
+iteration 150
+iteration 160
+iteration 170
+iteration 180
+iteration 190
+iteration 200
+iteration 210
+iteration 220
+iteration 230
+iteration 240
+iteration 250
+iteration 260
+iteration 270
+iteration 280
+iteration 290
+iteration 300
+iteration 310
+iteration 320
+iteration 330
+iteration 340
+iteration 350
+iteration 360
+iteration 370
+iteration 380
+iteration 390
+iteration 400
+iteration 410
+iteration 420
+iteration 430
+iteration 440
+iteration 450
+iteration 460
+iteration 470
+iteration 480
+iteration 490
+Done.
+
+# of people treated: 17508.000000 people
+Average length of stay: 155.341615 time units
+Average # of hospitals visited: 1.074195 hospitals
+
diff --git a/test/ccured_olden/health/out.orig.msvc b/test/ccured_olden/health/out.orig.msvc
new file mode 100644
index 00000000..6de26a47
--- /dev/null
+++ b/test/ccured_olden/health/out.orig.msvc
@@ -0,0 +1,64 @@
+This is max_level : 5
+This is max_time : 500
+
+
+ Colombian Health Care Simulator
+
+Working...
+This is max_time right before the loop: 500
+iteration 0
+iteration 10
+iteration 20
+iteration 30
+iteration 40
+iteration 50
+iteration 60
+iteration 70
+iteration 80
+iteration 90
+iteration 100
+iteration 110
+iteration 120
+iteration 130
+iteration 140
+iteration 150
+iteration 160
+iteration 170
+iteration 180
+iteration 190
+iteration 200
+iteration 210
+iteration 220
+iteration 230
+iteration 240
+iteration 250
+iteration 260
+iteration 270
+iteration 280
+iteration 290
+iteration 300
+iteration 310
+iteration 320
+iteration 330
+iteration 340
+iteration 350
+iteration 360
+iteration 370
+iteration 380
+iteration 390
+iteration 400
+iteration 410
+iteration 420
+iteration 430
+iteration 440
+iteration 450
+iteration 460
+iteration 470
+iteration 480
+iteration 490
+Done.
+
+# of people treated: 17510.000000 people
+Average length of stay: 153.627927 time units
+Average # of hospitals visited: 1.068646 hospitals
+
diff --git a/test/ccured_olden/health/output b/test/ccured_olden/health/output
new file mode 100644
index 00000000..42fd5748
--- /dev/null
+++ b/test/ccured_olden/health/output
@@ -0,0 +1,64 @@
+This is max_level : 5
+This is max_time : 500
+
+
+ Colombian Health Care Simulator
+
+Working...
+This is max_time right before the loop: 500
+iteration 0
+iteration 10
+iteration 20
+iteration 30
+iteration 40
+iteration 50
+iteration 60
+iteration 70
+iteration 80
+iteration 90
+iteration 100
+iteration 110
+iteration 120
+iteration 130
+iteration 140
+iteration 150
+iteration 160
+iteration 170
+iteration 180
+iteration 190
+iteration 200
+iteration 210
+iteration 220
+iteration 230
+iteration 240
+iteration 250
+iteration 260
+iteration 270
+iteration 280
+iteration 290
+iteration 300
+iteration 310
+iteration 320
+iteration 330
+iteration 340
+iteration 350
+iteration 360
+iteration 370
+iteration 380
+iteration 390
+iteration 400
+iteration 410
+iteration 420
+iteration 430
+iteration 440
+iteration 450
+iteration 460
+iteration 470
+iteration 480
+iteration 490
+Done.
+
+# of people treated: 17508.000000 people
+Average length of stay: 155.341615 time units
+Average # of hospitals visited: 1.074195 hospitals
+
diff --git a/test/ccured_olden/health/poisson.c b/test/ccured_olden/health/poisson.c
new file mode 100644
index 00000000..c3ff696f
--- /dev/null
+++ b/test/ccured_olden/health/poisson.c
@@ -0,0 +1,35 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/**********************************************************
+ * poisson.c: handles math routines for health.c *
+ **********************************************************/
+
+#include <stdio.h>
+#include <math.h>
+#include "health.h"
+
+
+float my_rand(long idum)
+{
+ long k;
+ float answer;
+
+ idum ^= MASK;
+ k = idum / IQ;
+ idum = IA * (idum - k * IQ) - IR * k;
+ idum ^= MASK;
+ if (idum < 0)
+ idum += IM;
+ answer = AM * idum;
+#ifdef GET_OUT
+ fprintf(stderr, "my_rand: idum = %d, AM = %e, answer = %4.3f\n",
+ idum, AM, answer);
+#endif GET_OUT
+ return answer;
+}
+
+
+
+
+
+
diff --git a/test/ccured_olden/health/ssplain.c b/test/ccured_olden/health/ssplain.c
new file mode 100644
index 00000000..04a150fb
--- /dev/null
+++ b/test/ccured_olden/health/ssplain.c
@@ -0,0 +1,70 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+void chatting(char *s, ...)
+{
+ //printf("Here is a character: %c", *s);
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
+#ifndef BEFOREBOX
+static unsigned long bytes_allocated = 0;
+static unsigned long allocations = 0;
+
+void*
+ssplain_malloc(int size)
+{
+ allocations++;
+ bytes_allocated+=size;
+ return malloc(size);
+}
+
+void*
+ssplain_calloc(int nelems, int size)
+{
+ void *p;
+ allocations++;
+ bytes_allocated+= nelems * size;
+ p = calloc(nelems, size);
+ if(!p) { printf("Cannot allocate\n"); exit(3); }
+ return p;
+}
+
+void
+ssplain_alloc_stats()
+{
+ chatting("Allocation stats: %d bytes allocated in %d allocations\n",
+ bytes_allocated, allocations);
+}
+#endif
diff --git a/test/ccured_olden/health/ssplain.h b/test/ccured_olden/health/ssplain.h
new file mode 100644
index 00000000..157c1cbe
--- /dev/null
+++ b/test/ccured_olden/health/ssplain.h
@@ -0,0 +1,130 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+#ifdef CCURED
+ #pragma ccuredvararg("chatting", printf(1))
+#endif
+void chatting(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/health/testit b/test/ccured_olden/health/testit
new file mode 100755
index 00000000..6b943eac
--- /dev/null
+++ b/test/ccured_olden/health/testit
@@ -0,0 +1,25 @@
+#!/bin/sh
+# test a health binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./health.exe"
+ exit
+fi
+
+# all of health's output is to stderr
+echo "running: $1 5 500 1 1 2>output"
+if ! $1 5 500 1 1 2>output; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+if ! diff out.orig output >out.diff 2>&1 ; then
+ if ! diff out.orig.msvc output >/dev/null ; then
+ echo "$1 got the wrong answer. See out.diff"
+ exit 4
+ fi
+fi
+
+echo "$1 seems to work"
+rm -f out.diff
+ \ No newline at end of file
diff --git a/test/ccured_olden/mst/.cvsignore b/test/ccured_olden/mst/.cvsignore
new file mode 100644
index 00000000..0b0377b1
--- /dev/null
+++ b/test/ccured_olden/mst/.cvsignore
@@ -0,0 +1,26 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+allcfiles
+ope.m
+*cured.c
+*.optim.c
+*_comb.c
+*.exe_comb.browser
+changes
+output
+out.diff
diff --git a/test/ccured_olden/mst/CVS/Entries b/test/ccured_olden/mst/CVS/Entries
new file mode 100644
index 00000000..862ae447
--- /dev/null
+++ b/test/ccured_olden/mst/CVS/Entries
@@ -0,0 +1,16 @@
+/HOWTO/1.1/Fri Jun 29 11:07:28 2001//
+/Makefile/1.6/Fri Oct 12 01:25:10 2001//
+/Makefile.plain/1.1/Fri Jun 29 11:07:28 2001//
+/Makefile.ss/1.1/Fri Jun 29 11:07:28 2001//
+/args.c/1.1/Fri Jun 29 11:07:28 2001//
+/hash.h/1.1/Fri Jun 29 11:07:28 2001//
+/main.c/1.1/Fri Jun 29 11:07:28 2001//
+/makegraph.c/1.1/Fri Jun 29 11:07:28 2001//
+/mst.h/1.1/Fri Jun 29 11:07:28 2001//
+/ssplain.c/1.6/Wed Oct 31 04:00:37 2001//
+/out.orig/1.1/Mon Nov 12 08:08:28 2001//
+/testit/1.2/Tue Dec 4 05:07:50 2001//
+/.cvsignore/1.8/Fri Oct 4 16:28:44 2002//
+/hash.c/1.8/Tue Jan 7 00:17:16 2003//
+/ssplain.h/1.6/Mon Jan 6 23:29:27 2003//
+D
diff --git a/test/ccured_olden/mst/CVS/Repository b/test/ccured_olden/mst/CVS/Repository
new file mode 100644
index 00000000..8ebc6045
--- /dev/null
+++ b/test/ccured_olden/mst/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/mst
diff --git a/test/ccured_olden/mst/CVS/Root b/test/ccured_olden/mst/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/mst/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/mst/HOWTO b/test/ccured_olden/mst/HOWTO
new file mode 100644
index 00000000..1058d0f1
--- /dev/null
+++ b/test/ccured_olden/mst/HOWTO
@@ -0,0 +1 @@
+1024 1
diff --git a/test/ccured_olden/mst/Makefile b/test/ccured_olden/mst/Makefile
new file mode 100644
index 00000000..d3f950b6
--- /dev/null
+++ b/test/ccured_olden/mst/Makefile
@@ -0,0 +1,62 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = mst.exe
+PROGS = main makegraph hash args ssplain
+
+OLDENHOME = /tmp/olden
+
+ifdef _MSVC
+CC = cl
+DEF = /D
+CONLY = /c
+OBJOUT = /Fo
+EXEOUT = /Fe
+OBJ = .obj
+
+OPTFLAGS = /Ox
+LIBS =
+
+else
+
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+DEF = -D
+CONLY = -c
+OBJOUT= -o
+EXEOUT= -o
+
+OBJ = .o
+
+OPTFLAGS = -g -Wall -O3
+
+LIBS =
+LIBPATH =
+endif
+
+SRC = .c
+ASM = .s
+EXTRA_CDEFS = $(DEF)I_TIME $(DEF)I_SYS_TIME $(DEF)ULTRIX
+CDEFS = $(DEF)PLAIN $(DEF)SS_PLAIN
+SRCS = $(addsuffix $(SRC),$(PROGS))
+OBJS = $(addsuffix $(OBJ),$(PROGS))
+ASMS = $(addsuffix $(ASM),$(PROGS))
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+clean:
+ rm -f $(BINARY) $(OBJS) $(OBJS) *~ *infer.c *cured.c *cil.c *_comb.c *.i *.light.c
+
diff --git a/test/ccured_olden/mst/Makefile.plain b/test/ccured_olden/mst/Makefile.plain
new file mode 100644
index 00000000..7e4450ac
--- /dev/null
+++ b/test/ccured_olden/mst/Makefile.plain
@@ -0,0 +1,7 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = mst
+FILES = main makegraph hash args ssplain
+
+include ../Makefile.plain
+
diff --git a/test/ccured_olden/mst/Makefile.ss b/test/ccured_olden/mst/Makefile.ss
new file mode 100644
index 00000000..92ac11a1
--- /dev/null
+++ b/test/ccured_olden/mst/Makefile.ss
@@ -0,0 +1,7 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = mst
+FILES = main makegraph hash args ssplain
+
+include ../Makefile.ss
+
diff --git a/test/ccured_olden/mst/args.c b/test/ccured_olden/mst/args.c
new file mode 100644
index 00000000..169d87ab
--- /dev/null
+++ b/test/ccured_olden/mst/args.c
@@ -0,0 +1,20 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#include "mst.h"
+#endif SS_PLAIN
+
+
+int dealwithargs(int argc, char *argv[])
+{
+ int level;
+
+ if (argc > 1)
+ level = atoi(argv[1]);
+ else
+ level = 1024;
+
+ return level;
+}
+
diff --git a/test/ccured_olden/mst/args.s b/test/ccured_olden/mst/args.s
new file mode 100644
index 00000000..a397dc72
--- /dev/null
+++ b/test/ccured_olden/mst/args.s
@@ -0,0 +1,37 @@
+ .text
+ .align 2
+Latoi$i$stub:
+ mflr r0
+ stwu r1, -56(r1)
+ stw r0, 60(r1)
+ addis r11, 0, ha16(Latoi$i$ptr)
+ lwz r11, lo16(Latoi$i$ptr)(r11)
+ mtctr r11
+ bctrl
+ lwz r0, 60(r1)
+ mtlr r0
+ addi r1, r1, 56
+ blr
+ .non_lazy_symbol_pointer
+Latoi$i$ptr:
+ .indirect_symbol _atoi
+ .long 0
+ .text
+ .align 2
+ .globl _dealwithargs
+_dealwithargs:
+ stwu r1, -32(r1)
+ mflr r2
+ stw r2, 12(r1)
+ cmpwi cr0, r3, 1
+ bt 1, L100
+ addi r3, 0, 1024
+ b L101
+L100:
+ lwz r3, 4(r4)
+ bl Latoi$i$stub
+L101:
+ lwz r2, 12(r1)
+ mtlr r2
+ lwz r1, 0(r1)
+ blr
diff --git a/test/ccured_olden/mst/hash.c b/test/ccured_olden/mst/hash.c
new file mode 100644
index 00000000..67e460dd
--- /dev/null
+++ b/test/ccured_olden/mst/hash.c
@@ -0,0 +1,105 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#include "ssplain.h"
+#ifdef SS_PLAIN
+#include "mst.h"
+#else SS_PLAIN
+#include "hash.h"
+#endif SS_PLAIN
+#include <string.h>
+
+#define assert(num,a) if (!(a)) {chatting("Assertion failure:%d in hash\n",num); exit(-1);}
+#undef assert
+#define assert(num,a)
+
+#ifndef CCURED
+ #define __NOCUREBLOCK
+#endif
+
+#ifdef CCURED
+ #pragma ccuredalloc("localmalloc", nozero, sizein(1))
+#endif
+static char *localmalloc(int size);
+
+static int remaining = 0;
+static char *temp;
+static char *localmalloc(int size) {
+ char *blah;
+
+ if (size>remaining)
+ {
+ temp = (char *) malloc(32768);
+ if (!temp) chatting("Error! malloc returns null\n");
+ remaining = 32768;
+ }
+ blah = temp;
+ temp += size;
+ remaining -= size;
+ return blah;
+}
+
+#define localfree(sz)
+
+Hash MakeHash(int size, int (*map)(unsigned int))
+{
+ Hash retval;
+
+ retval = (Hash) localmalloc(sizeof(*retval));
+ retval->array = (HashEntry *) localmalloc(size*sizeof(retval->array[0]));
+ { __NOCUREBLOCK
+ memset((char*)retval->array, 0, size * sizeof(retval->array[0]));
+ }
+ retval->mapfunc = map;
+ retval->size = size;
+ retval->padding = 0;
+ return retval;
+}
+
+void *HashLookup(unsigned int key, Hash hash)
+{
+ int j;
+ HashEntry ent;
+
+ j = (hash->mapfunc)(key);
+ assert(1,j>=0);
+ assert(2,j<hash->size);
+
+ for (ent = hash->array[j]; ent && ent->key!=key; ent=ent->next) ;
+
+ if (ent) return ent->entry;
+ return NULL;
+}
+
+void HashInsert(void *entry,unsigned int key,Hash hash)
+{
+ HashEntry ent;
+ int j;
+
+ assert(3,!HashLookup(key,hash));
+
+ j = (hash->mapfunc)(key);
+
+ ent = (HashEntry) localmalloc(sizeof(*ent));
+ ent->next = hash->array[j];
+ hash->array[j]=ent;
+ ent->key = key;
+ ent->entry = entry;
+}
+
+void HashDelete(unsigned int key,Hash hash)
+{
+ HashEntry *ent;
+ HashEntry tmp;
+ int j;
+
+ j = (hash->mapfunc)(key);
+ for (ent=&(hash->array[j]); (*ent) && (*ent)->key!=key; ent=&((*ent)->next));
+ assert(4,*ent);
+ tmp = *ent;
+ *ent = (*ent)->next;
+ localfree(tmp);
+}
+
+
+
+
diff --git a/test/ccured_olden/mst/hash.h b/test/ccured_olden/mst/hash.h
new file mode 100644
index 00000000..99475263
--- /dev/null
+++ b/test/ccured_olden/mst/hash.h
@@ -0,0 +1,23 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#include "stdio.h"
+
+typedef struct hash_entry {
+ unsigned int key;
+ void *entry;
+ struct hash_entry *next;
+ unsigned int padding;
+} *HashEntry;
+
+typedef struct hash {
+ HashEntry *array;
+ int (*mapfunc)(unsigned int);
+ int size;
+ unsigned int padding;
+} *Hash;
+
+Hash MakeHash(int size, int map(unsigned int));
+void *HashLookup(unsigned int key, Hash hash);
+void HashInsert(void *entry,unsigned int key, Hash hash);
+void HashDelete(unsigned int key, Hash hash);
+
diff --git a/test/ccured_olden/mst/hash.s b/test/ccured_olden/mst/hash.s
new file mode 100644
index 00000000..f418b39d
--- /dev/null
+++ b/test/ccured_olden/mst/hash.s
@@ -0,0 +1,354 @@
+ .data
+ .globl __hash__stringlit_1
+__hash__stringlit_1:
+ .byte 69
+ .byte 114
+ .byte 114
+ .byte 111
+ .byte 114
+ .byte 33
+ .byte 32
+ .byte 109
+ .byte 97
+ .byte 108
+ .byte 108
+ .byte 111
+ .byte 99
+ .byte 32
+ .byte 114
+ .byte 101
+ .byte 116
+ .byte 117
+ .byte 114
+ .byte 110
+ .byte 115
+ .byte 32
+ .byte 110
+ .byte 117
+ .byte 108
+ .byte 108
+ .byte 10
+ .byte 0
+ .data
+ .globl _remaining
+_remaining:
+ .long 0
+ .data
+ .globl _temp
+_temp:
+ .space 4
+ .text
+ .align 2
+Lchatting$i$stub:
+ mflr r0
+ stwu r1, -56(r1)
+ stw r0, 60(r1)
+ addis r11, 0, ha16(Lchatting$i$ptr)
+ lwz r11, lo16(Lchatting$i$ptr)(r11)
+ mtctr r11
+ bctrl
+ lwz r0, 60(r1)
+ mtlr r0
+ addi r1, r1, 56
+ blr
+ .non_lazy_symbol_pointer
+Lchatting$i$ptr:
+ .indirect_symbol _chatting
+ .long 0
+ .text
+ .align 2
+Lmalloc$stub:
+ addis r11, 0, ha16(Lmalloc$ptr)
+ lwz r11, lo16(Lmalloc$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+Lmalloc$ptr:
+ .indirect_symbol _malloc
+ .long 0
+ .text
+ .align 2
+LMakeHash$stub:
+ addis r11, 0, ha16(LMakeHash$ptr)
+ lwz r11, lo16(LMakeHash$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+LMakeHash$ptr:
+ .indirect_symbol _MakeHash
+ .long 0
+ .text
+ .align 2
+LHashLookup$stub:
+ addis r11, 0, ha16(LHashLookup$ptr)
+ lwz r11, lo16(LHashLookup$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+LHashLookup$ptr:
+ .indirect_symbol _HashLookup
+ .long 0
+ .text
+ .align 2
+LHashInsert$stub:
+ addis r11, 0, ha16(LHashInsert$ptr)
+ lwz r11, lo16(LHashInsert$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+LHashInsert$ptr:
+ .indirect_symbol _HashInsert
+ .long 0
+ .text
+ .align 2
+LHashDelete$stub:
+ addis r11, 0, ha16(LHashDelete$ptr)
+ lwz r11, lo16(LHashDelete$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+LHashDelete$ptr:
+ .indirect_symbol _HashDelete
+ .long 0
+ .text
+ .align 2
+Lmemset$stub:
+ addis r11, 0, ha16(Lmemset$ptr)
+ lwz r11, lo16(Lmemset$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+Lmemset$ptr:
+ .indirect_symbol _memset
+ .long 0
+ .text
+ .align 2
+Llocalmalloc$stub:
+ addis r11, 0, ha16(Llocalmalloc$ptr)
+ lwz r11, lo16(Llocalmalloc$ptr)(r11)
+ mtctr r11
+ bctr
+ .non_lazy_symbol_pointer
+Llocalmalloc$ptr:
+ .indirect_symbol _localmalloc
+ .long 0
+ .text
+ .align 2
+ .globl Llocalmalloc$stub
+Llocalmalloc$stub:
+ stwu r1, -32(r1)
+ mflr r2
+ stw r2, 12(r1)
+ stw r13, 28(r1)
+ mr r13, r3
+ addis r2, 0, ha16(_remaining)
+ lwz r6, lo16(_remaining)(r2)
+ cmpw cr0, r13, r6
+ bf 1, L100
+ addis r3, 0, 0
+ ori r3, r3, 32768
+ bl Lmalloc$stub
+ addis r2, 0, ha16(_temp)
+ stw r3, lo16(_temp)(r2)
+ addis r2, 0, ha16(_temp)
+ lwz r3, lo16(_temp)(r2)
+ cmplwi cr0, r3, 0
+ bf 2, L101
+ addis r3, 0, hi16(__hash__stringlit_1)
+ ori r3, r3, lo16(__hash__stringlit_1)
+ bl Lchatting$i$stub
+L101:
+ addis r8, 0, 0
+ ori r8, r8, 32768
+ addis r2, 0, ha16(_remaining)
+ stw r8, lo16(_remaining)(r2)
+L100:
+ addis r2, 0, ha16(_temp)
+ lwz r3, lo16(_temp)(r2)
+ add r4, r3, r13
+ addis r2, 0, ha16(_temp)
+ stw r4, lo16(_temp)(r2)
+ addis r2, 0, ha16(_remaining)
+ lwz r5, lo16(_remaining)(r2)
+ subfc r7, r13, r5
+ addis r2, 0, ha16(_remaining)
+ stw r7, lo16(_remaining)(r2)
+ lwz r13, 28(r1)
+ lwz r2, 12(r1)
+ mtlr r2
+ lwz r1, 0(r1)
+ blr
+ .text
+ .align 2
+ .globl LMakeHash$stub
+LMakeHash$stub:
+ stwu r1, -48(r1)
+ mflr r2
+ stw r2, 12(r1)
+ stw r13, 36(r1)
+ stw r14, 40(r1)
+ stw r15, 44(r1)
+ mr r14, r3
+ mr r13, r4
+ addi r3, 0, 16
+ bl Llocalmalloc$stub
+ mr r15, r3
+ rlwinm r3, r14, 2, 0xfffffffc
+ bl Llocalmalloc$stub
+ stw r3, 0(r15)
+ lwz r3, 0(r15)
+ addi r4, 0, 0
+ rlwinm r5, r14, 2, 0xfffffffc
+ bl Lmemset$stub
+ stw r13, 4(r15)
+ stw r14, 8(r15)
+ addi r3, 0, 0
+ stw r3, 12(r15)
+ mr r3, r15
+ lwz r13, 36(r1)
+ lwz r14, 40(r1)
+ lwz r15, 44(r1)
+ lwz r2, 12(r1)
+ mtlr r2
+ lwz r1, 0(r1)
+ blr
+ .text
+ .align 2
+ .globl LHashLookup$stub
+LHashLookup$stub:
+ stwu r1, -48(r1)
+ mflr r2
+ stw r2, 12(r1)
+ stw r13, 28(r1)
+ stw r14, 32(r1)
+ mr r14, r3
+ mr r13, r4
+ lwz r8, 4(r13)
+ mr r0, r8
+ mr r3, r14
+ mtctr r0
+ bctrl
+ lwz r4, 0(r13)
+ rlwinm r5, r3, 2, 0xfffffffc
+ lwzx r3, r4, r5
+L102:
+ cmplwi cr0, r3, 0
+ bt 2, L103
+ lwz r7, 0(r3)
+ cmplw cr0, r7, r14
+ bt 2, L104
+ addi r6, 0, 1
+ b L105
+L104:
+ addi r6, 0, 0
+ b L105
+L103:
+ addi r6, 0, 0
+L105:
+ cmpwi cr0, r6, 0
+ bt 2, L106
+ lwz r3, 8(r3)
+ b L102
+L106:
+ cmplwi cr0, r3, 0
+ bt 2, L107
+ lwz r3, 4(r3)
+ b L108
+L107:
+ addi r3, 0, 0
+L108:
+ lwz r13, 28(r1)
+ lwz r14, 32(r1)
+ lwz r2, 12(r1)
+ mtlr r2
+ lwz r1, 0(r1)
+ blr
+ .text
+ .align 2
+ .globl LHashInsert$stub
+LHashInsert$stub:
+ stwu r1, -48(r1)
+ mflr r2
+ stw r2, 12(r1)
+ stw r13, 28(r1)
+ stw r14, 32(r1)
+ stw r15, 36(r1)
+ stw r16, 40(r1)
+ mr r14, r3
+ mr r13, r4
+ mr r16, r5
+ lwz r6, 4(r16)
+ mr r0, r6
+ mr r3, r13
+ mtctr r0
+ bctrl
+ mr r15, r3
+ addi r3, 0, 16
+ bl Llocalmalloc$stub
+ lwz r7, 0(r16)
+ rlwinm r4, r15, 2, 0xfffffffc
+ lwzx r5, r7, r4
+ stw r5, 8(r3)
+ lwz r5, 0(r16)
+ stwx r3, r5, r4
+ stw r13, 0(r3)
+ stw r14, 4(r3)
+ # undef r3
+ lwz r13, 28(r1)
+ lwz r14, 32(r1)
+ lwz r15, 36(r1)
+ lwz r16, 40(r1)
+ lwz r2, 12(r1)
+ mtlr r2
+ lwz r1, 0(r1)
+ blr
+ .text
+ .align 2
+ .globl LHashDelete$stub
+LHashDelete$stub:
+ stwu r1, -48(r1)
+ mflr r2
+ stw r2, 12(r1)
+ stw r13, 28(r1)
+ stw r14, 32(r1)
+ mr r14, r3
+ mr r13, r4
+ lwz r9, 4(r13)
+ mr r0, r9
+ mr r3, r14
+ mtctr r0
+ bctrl
+ lwz r4, 0(r13)
+ rlwinm r8, r3, 2, 0xfffffffc
+ add r3, r4, r8
+L109:
+ lwz r5, 0(r3)
+ cmplwi cr0, r5, 0
+ bt 2, L110
+ lwz r4, 0(r5)
+ cmplw cr0, r4, r14
+ bt 2, L111
+ addi r7, 0, 1
+ b L112
+L111:
+ addi r7, 0, 0
+ b L112
+L110:
+ addi r7, 0, 0
+L112:
+ cmpwi cr0, r7, 0
+ bt 2, L113
+ lwz r10, 0(r3)
+ addi r3, r10, 8
+ b L109
+L113:
+ lwz r4, 0(r3)
+ lwz r6, 8(r4)
+ stw r6, 0(r3)
+ # undef r3
+ lwz r13, 28(r1)
+ lwz r14, 32(r1)
+ lwz r2, 12(r1)
+ mtlr r2
+ lwz r1, 0(r1)
+ blr
diff --git a/test/ccured_olden/mst/main.c b/test/ccured_olden/mst/main.c
new file mode 100644
index 00000000..0e464d7c
--- /dev/null
+++ b/test/ccured_olden/mst/main.c
@@ -0,0 +1,142 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#include <string.h>
+#include "mst.h"
+#include "ssplain.h"
+
+typedef struct blue_return {
+ Vertex vert;
+ int dist;
+} BlueReturn;
+
+static BlueReturn BlueRule(Vertex inserted, Vertex vlist)
+{
+ BlueReturn retval;
+ Vertex tmp,prev;
+ Hash hash;
+ int dist,dist2;
+ int count;
+
+ if (!vlist) {
+ retval.dist = 999999;
+ return retval;
+ }
+ prev = vlist;
+ retval.vert = vlist;
+ retval.dist = vlist->mindist;
+ hash = vlist->edgehash;
+ dist = (int) HashLookup((unsigned int) inserted, hash);
+ /*chatting("Found %d at 0x%x for 0x%x\n",dist,inserted,vlist);*/
+ if (dist)
+ {
+ if (dist<retval.dist)
+ {
+ vlist->mindist = dist;
+ retval.dist = dist;
+ }
+ }
+ else chatting("Not found\n");
+
+ count = 0;
+
+ /* We are guaranteed that inserted is not first in list */
+ for (tmp=vlist->next; tmp; prev=tmp,tmp=tmp->next)
+ {
+ count++;
+
+ /* Splice chosen vertex out of the list */
+ if (tmp==inserted)
+ {
+ Vertex next;
+ next = tmp->next;
+ prev->next = next;
+ }
+ /* Find the shortest distance to any other vertex not in the list */
+ else
+ {
+ hash = tmp->edgehash;
+ dist2 = tmp->mindist;
+ dist = (int) HashLookup((unsigned int) inserted, hash);
+ /*chatting("Found %d at 0x%x for 0x%x\n",dist,inserted,tmp);*/
+ if (dist)
+ {
+ if (dist<dist2)
+ {
+ tmp->mindist = dist;
+ dist2 = dist;
+ }
+ }
+ else chatting("Not found\n");
+ if (dist2<retval.dist)
+ {
+ retval.vert = tmp;
+ retval.dist = dist2;
+ }
+ } /* else */
+
+ } /* for */
+ /*chatting("Count was %d\n",count);*/
+ return retval;
+}
+
+
+
+static Vertex MyVertexList = NULL;
+
+static int ComputeMst(Graph graph,int numvert)
+{
+ Vertex inserted,tmp;
+ int cost=0,dist;
+
+ /* make copy of graph */
+ chatting("Compute phase 1\n");
+
+ /* Insert first node */
+ inserted = graph->vlist;
+ tmp = inserted->next;
+ graph->vlist = tmp;
+ MyVertexList = tmp;
+ numvert--;
+
+ /* Announce insertion and find next one */
+ chatting("Compute phase 2\n");
+ while (numvert)
+ {
+ BlueReturn br;
+
+ if (inserted == MyVertexList)
+ MyVertexList = MyVertexList->next;
+ br = BlueRule(inserted, MyVertexList);
+ inserted = br.vert;
+ dist = br.dist;
+ numvert--;
+ cost = cost+dist;
+ }
+ return cost;
+}
+
+extern int dealwithargs(int argc, char *argv[]);
+
+int main(int argc, char *argv[])
+{
+ Graph graph;
+ int dist;
+ int size;
+
+ chatting("Hash entry size = %d\n", sizeof(struct hash_entry));
+ chatting("Hash size = %d\n", sizeof(struct hash));
+ chatting("Vertex size = %d\n", sizeof(struct vert_st));
+
+ size = dealwithargs(argc,argv);
+
+ chatting("Making graph of size %d\n",size);
+ graph = MakeGraph(size);
+ chatting("Graph completed\n");
+
+ chatting("About to compute mst \n");
+ dist = ComputeMst(graph,size);
+
+ chatting("MST has cost %d\n",dist);
+ exit(0);
+}
+
diff --git a/test/ccured_olden/mst/makegraph.c b/test/ccured_olden/mst/makegraph.c
new file mode 100644
index 00000000..c99fad96
--- /dev/null
+++ b/test/ccured_olden/mst/makegraph.c
@@ -0,0 +1,93 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#include "mst.h"
+#include "ssplain.h"
+
+#define CONST_m1 10000
+#define CONST_b 31415821
+#define RANGE 2048
+static int HashRange;
+
+static int mult(int p, int q)
+{
+ int p1, p0, q1, q0;
+
+ p1=p/CONST_m1; p0=p%CONST_m1;
+ q1=q/CONST_m1; q0=q%CONST_m1;
+ return (((p0*q1+p1*q0) % CONST_m1)*CONST_m1+p0*q0);
+}
+
+static int mst_random(int seed)
+{
+ int tmp;
+ tmp = (mult(seed,CONST_b)+1);
+ return tmp;
+}
+
+static int compute_dist(int i,int j, int numvert)
+{
+ int less, gt;
+ if (i<j) {less = i; gt = j;} else {less = j; gt = i;}
+ return (mst_random(less*numvert+gt) % RANGE)+1;
+}
+
+static int hashfunc(unsigned int key)
+{
+ return ((key>>4) % HashRange);
+}
+
+static void AddEdges(Graph retval, int numvert)
+{
+ Vertex src, dest;
+ Hash hash;
+ int i, j, dist, num_inserted = 0;
+
+ for (j = 0; j < numvert; j++)
+ {
+ src = &(retval->vlist[j]);
+ hash = src->edgehash;
+
+ for (i=0; i<numvert; i++)
+ {
+ if (i!=j)
+ {
+ dist = compute_dist(i,j,numvert);
+ dest = &(retval->vlist[i]);
+ HashInsert((void *) dist,(unsigned int) dest,hash);
+ num_inserted++;
+ }
+ } /* for i */
+ } /* for j */
+
+ chatting("%d edges inserted\n", num_inserted);
+}
+
+Graph MakeGraph(int numvert)
+{
+ int i;
+ Vertex vf, vt;
+ Graph retval;
+
+ retval = (Graph) malloc (sizeof(*retval));
+
+ chatting("Make phase 1: Creating hash tables\n");
+ retval->vlist = (Vertex) malloc (numvert*(sizeof(*vf)));
+ vt = NULL;
+
+ for (i = numvert - 1; i >= 0; i--)
+ {
+ vf = &(retval->vlist[i]);
+ HashRange = numvert/4;
+ vf->mindist = 9999999;
+ vf->edgehash = MakeHash(HashRange,hashfunc);
+ vf->next = vt;
+ vt=vf;
+ }
+
+ chatting("Make phase 3: Creating graph\n");
+ AddEdges(retval, numvert);
+ chatting("Make returning\n");
+ return retval;
+}
+
+
diff --git a/test/ccured_olden/mst/mst.h b/test/ccured_olden/mst/mst.h
new file mode 100644
index 00000000..4af1e346
--- /dev/null
+++ b/test/ccured_olden/mst/mst.h
@@ -0,0 +1,33 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#ifdef SS_PLAIN
+#include <stdlib.h>
+#endif SS_PLAIN
+
+#include "hash.h"
+#define MAXPROC 1
+
+#ifndef SS_PLAIN
+/* Amir: Get these out of here for SS, piggyback on the PLAIN definition */
+#include "mem-ref.h"
+#define NULL 0
+#endif SS_PLAIN
+
+typedef struct vert_st {
+ int mindist;
+ struct vert_st *next;
+ Hash edgehash;
+ unsigned int padding;
+} *Vertex;
+
+typedef struct graph_st {
+ Vertex vlist;
+} *Graph;
+
+Graph MakeGraph(int numvert);
+
+#ifdef SS_PLAIN
+#include <stdarg.h>
+void chatting(char *s, ...);
+#endif SS_PLAIN
+
diff --git a/test/ccured_olden/mst/out.orig b/test/ccured_olden/mst/out.orig
new file mode 100644
index 00000000..a50096d7
--- /dev/null
+++ b/test/ccured_olden/mst/out.orig
@@ -0,0 +1,13 @@
+Hash entry size = xx
+Hash size = xx
+Vertex size = xx
+Making graph of size 2048
+Make phase 1: Creating hash tables
+Make phase 3: Creating graph
+4192256 edges inserted
+Make returning
+Graph completed
+About to compute mst
+Compute phase 1
+Compute phase 2
+MST has cost 13615
diff --git a/test/ccured_olden/mst/output b/test/ccured_olden/mst/output
new file mode 100644
index 00000000..d2677157
--- /dev/null
+++ b/test/ccured_olden/mst/output
@@ -0,0 +1,13 @@
+Hash entry size = 16
+Hash size = 20
+Vertex size = 20
+Making graph of size 2048
+Make phase 1: Creating hash tables
+Make phase 3: Creating graph
+4192256 edges inserted
+Make returning
+Graph completed
+About to compute mst
+Compute phase 1
+Compute phase 2
+MST has cost 13615
diff --git a/test/ccured_olden/mst/ssplain.c b/test/ccured_olden/mst/ssplain.c
new file mode 100644
index 00000000..645d3a1e
--- /dev/null
+++ b/test/ccured_olden/mst/ssplain.c
@@ -0,0 +1,38 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+void chatting(char *s, ...)
+{
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
diff --git a/test/ccured_olden/mst/ssplain.h b/test/ccured_olden/mst/ssplain.h
new file mode 100644
index 00000000..865fbf47
--- /dev/null
+++ b/test/ccured_olden/mst/ssplain.h
@@ -0,0 +1,128 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+#pragma ccuredvararg("chatting", printf(1))
+void chatting(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/mst/testit b/test/ccured_olden/mst/testit
new file mode 100755
index 00000000..2ef87d18
--- /dev/null
+++ b/test/ccured_olden/mst/testit
@@ -0,0 +1,25 @@
+#!/bin/sh
+# test an mst binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./mst.exe"
+ exit
+fi
+
+# all of mst's output is to stderr
+echo "running: $1 2048 1 2>output"
+if ! $1 2048 1 2>output; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+# mst prints sizes of its structures, which increase after boxing
+if ! sed 's/size = [0-9][0-9]/size = xx/' <output | diff out.orig - >out.diff; then
+ if test -s out.diff; then
+ echo "$1 got the wrong answer. See out.diff"
+ exit 4
+ fi
+fi
+echo "$1 seems to work"
+rm -f out.diff
+ \ No newline at end of file
diff --git a/test/ccured_olden/newbisort/.cvsignore b/test/ccured_olden/newbisort/.cvsignore
new file mode 100644
index 00000000..5c56af15
--- /dev/null
+++ b/test/ccured_olden/newbisort/.cvsignore
@@ -0,0 +1 @@
+changes
diff --git a/test/ccured_olden/newbisort/CVS/Entries b/test/ccured_olden/newbisort/CVS/Entries
new file mode 100644
index 00000000..cb3bbed9
--- /dev/null
+++ b/test/ccured_olden/newbisort/CVS/Entries
@@ -0,0 +1,13 @@
+/HOWTO/1.1/Fri Jul 6 09:37:30 2001//
+/Makefile/1.2/Sat Jul 21 16:09:41 2001//
+/Makefile.plain/1.1/Fri Jul 6 09:37:30 2001//
+/Makefile.ss/1.1/Fri Jul 6 09:37:30 2001//
+/args.c/1.1/Fri Jul 6 09:37:30 2001//
+/bitonic.c/1.1/Fri Jul 6 09:37:30 2001//
+/node.h/1.1/Fri Jul 6 09:37:30 2001//
+/proc.h/1.1/Fri Jul 6 09:37:30 2001//
+/ssplain.c/1.1/Fri Jul 6 09:37:30 2001//
+/ssplain.h/1.1/Fri Jul 6 09:37:30 2001//
+/swap.c/1.1/Fri Jul 6 09:37:30 2001//
+/.cvsignore/1.1/Thu Nov 8 23:31:03 2001//
+D
diff --git a/test/ccured_olden/newbisort/CVS/Repository b/test/ccured_olden/newbisort/CVS/Repository
new file mode 100644
index 00000000..9cf3bd6a
--- /dev/null
+++ b/test/ccured_olden/newbisort/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/newbisort
diff --git a/test/ccured_olden/newbisort/CVS/Root b/test/ccured_olden/newbisort/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/newbisort/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/newbisort/HOWTO b/test/ccured_olden/newbisort/HOWTO
new file mode 100644
index 00000000..dd53dde0
--- /dev/null
+++ b/test/ccured_olden/newbisort/HOWTO
@@ -0,0 +1 @@
+250000 0
diff --git a/test/ccured_olden/newbisort/Makefile b/test/ccured_olden/newbisort/Makefile
new file mode 100644
index 00000000..c08a8967
--- /dev/null
+++ b/test/ccured_olden/newbisort/Makefile
@@ -0,0 +1,49 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = bisort
+PROGS = bitonic args ssplain
+
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+SRC = .c
+OBJ = .o
+ASM = .s
+SRCS = $(addsuffix $(SRC),$(PROGS))
+OBJS = $(addsuffix $(OBJ),$(PROGS))
+ASMS = $(addsuffix $(ASM),$(PROGS))
+INCDIRS = /usr/include
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN #-I$(OLDENHOME)/common
+OPTFLAGS = -g -Wall -O3
+
+LIBS = -lc -lgcc -lm
+LIBPATH =
+
+#$(BINARY): $(OBJS)
+# $(CC) $(LDFALGS) $(OPTFLAGS) -o $@ $(OBJS) $(LIBPATH) $(LIBS)
+
+#$(SRC)$(OBJ):
+# $(CC) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) -c $<
+
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $(CDEFS) $(EXTRA_CDEFS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+clean:
+ rm -f $(BINARY) $(OBJS) *~ $(ASMS) *.light.c
+
diff --git a/test/ccured_olden/newbisort/Makefile.orig b/test/ccured_olden/newbisort/Makefile.orig
new file mode 100644
index 00000000..81e77568
--- /dev/null
+++ b/test/ccured_olden/newbisort/Makefile.orig
@@ -0,0 +1,33 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = bisort
+FILES = bitonic args ssplain
+
+
+
+CC = gcc
+
+SRC = .c
+OBJ = .o
+ASM = .s
+SRCS = $(addsuffix $(SRC),$(FILES))
+OBJS = $(addsuffix $(OBJ),$(FILES))
+ASMS = $(addsuffix $(ASM),$(FILES))
+INCDIRS = /usr/include
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN #-I$(OLDENHOME)/common
+OPTFLAGS = -g -Wall -O3
+
+LIBS = -lc -lgcc -lm
+LIBPATH =
+
+$(BINARY): $(OBJS)
+ $(CC) $(LDFALGS) $(OPTFLAGS) -o $@ $(OBJS) $(LIBPATH) $(LIBS)
+
+$(SRC)$(OBJ):
+ $(CC) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) -c $<
+
+clean:
+ rm -f $(BINARY) $(OBJS) *~
+
diff --git a/test/ccured_olden/newbisort/Makefile.plain b/test/ccured_olden/newbisort/Makefile.plain
new file mode 100644
index 00000000..b1240250
--- /dev/null
+++ b/test/ccured_olden/newbisort/Makefile.plain
@@ -0,0 +1,7 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = bisort
+FILES = bitonic args ssplain
+
+include ../Makefile.plain
+
diff --git a/test/ccured_olden/newbisort/Makefile.ss b/test/ccured_olden/newbisort/Makefile.ss
new file mode 100644
index 00000000..00028730
--- /dev/null
+++ b/test/ccured_olden/newbisort/Makefile.ss
@@ -0,0 +1,7 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = bisort
+FILES = bitonic args ssplain
+
+include ../Makefile.ss
+
diff --git a/test/ccured_olden/newbisort/args.c b/test/ccured_olden/newbisort/args.c
new file mode 100644
index 00000000..12591026
--- /dev/null
+++ b/test/ccured_olden/newbisort/args.c
@@ -0,0 +1,32 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+int mylog(int num)
+{
+ int j=0,k=1;
+
+ while(k<num) { k*=2; j++; }
+ return j;
+}
+
+extern int flag;
+int dealwithargs(int argc, char *argv[])
+{
+ int size;
+
+ if (argc > 2)
+ flag = atoi(argv[2]);
+ else
+ flag = 0;
+
+ if (argc > 1)
+ size = atoi(argv[1]);
+ else
+ size = 16;
+
+ return size;
+}
+
diff --git a/test/ccured_olden/newbisort/bitonic.c b/test/ccured_olden/newbisort/bitonic.c
new file mode 100644
index 00000000..7b08a0a2
--- /dev/null
+++ b/test/ccured_olden/newbisort/bitonic.c
@@ -0,0 +1,267 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* =================== PROGRAM bitonic===================== */
+/* UP - 0, DOWN - 1 */
+
+#include "node.h" /* Node Definition */
+#include "proc.h" /* Procedure Types/Nums */
+
+#define CONST_m1 10000
+#define CONST_b 31415821
+#define RANGE 100
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+#define put(a) chatting("%d",a)
+#define puts(a) chatting(a)
+
+
+int flag=0,foo=0;
+
+#define NewNode(h,v) \
+ \
+{ \
+ h = (HANDLE *) malloc(sizeof(struct node)); \
+ h->value = v; \
+ h->left = NIL; \
+ h->right = NIL; \
+ };
+
+
+void InOrder(h)
+ HANDLE *h;
+{
+ HANDLE *l, *r;
+ if ((h != NIL))
+ {
+ l = h->left;
+ r = h->right;
+ InOrder(l);
+ chatting("%d @ 0x%x\n",h->value,h);
+ InOrder(r);
+ }
+}
+
+int mult(int p, int q)
+{
+ int p1, p0, q1, q0;
+
+ p1=p/CONST_m1; p0=p%CONST_m1;
+ q1=q/CONST_m1; q0=q%CONST_m1;
+ return (((p0*q1+p1*q0) % CONST_m1)*CONST_m1+p0*q0);
+}
+
+int skiprand(int seed, int n)
+{
+#ifdef SS_PLAIN
+ for (; n; n--) seed=mult(seed,CONST_b)+1;
+#else SS_PLAIN
+ for (; n; n--) seed=random(seed);
+#endif SS_PLAIN
+ return seed;
+}
+
+#ifndef SS_PLAIN
+int random(int seed)
+{
+ int tmp;
+ tmp = (mult(seed,CONST_b)+1);
+ return tmp;
+}
+#endif SS_PLAIN
+
+HANDLE* RandTree(n,seed,level)
+ int n,seed,level;
+
+{
+ int next_val,my_name;
+ HANDLE *h;
+ my_name=foo++;
+
+ if (n > 1)
+ {
+#ifdef SS_PLAIN
+ seed = mult(seed,CONST_b)+1;
+#else SS_PLAIN
+ seed = random(seed);
+#endif SS_PLAIN
+ next_val=seed % RANGE;
+ NewNode(h,next_val);
+
+ h->left = RandTree((n/2),seed,level+1);
+ h->right = RandTree((n/2),skiprand(seed,(n)+1),level+1);
+ }
+ else
+ h = NIL;
+ return(h);
+}
+
+void SwapVal(l,r)
+ HANDLE *l, *r;
+{
+ int temp;
+
+ temp = l->value; /* MISS PROBLEM */
+ l->value = r->value;
+ r->value = temp;
+}
+
+void SwapLeft(l,r)
+ HANDLE *l, *r;
+{
+ HANDLE *h;
+
+ h = r->left;
+ r->left = l->left;
+ l->left = h;
+}
+
+void SwapRight(l,r)
+ HANDLE *l, *r;
+{
+ HANDLE *h;
+
+ h = r->right;
+ r->right = l->right; /* MISS PROBLEM */
+ l->right = h;
+}
+
+int Bimerge(root,spr_val,dir)
+ HANDLE *root;
+ int spr_val,dir;
+{
+ int rightexchange, elementexchange;
+ HANDLE *pl, *pr;
+
+ /*chatting("enter bimerge %x\n", root);*/
+ rightexchange = ((root->value > spr_val) ^ dir);
+ if (rightexchange)
+ {
+ int temp;
+ temp = root->value;
+ root->value = spr_val;
+ spr_val = temp;
+ }
+
+ pl = root->left;
+ pr = root->right;
+
+ while (pl != NIL)
+ {
+ elementexchange = ((pl->value > /* MISS PROBLEM */pr->value) ^ dir);
+ if (rightexchange)
+ {
+ if (elementexchange)
+ {
+ SwapVal(pl,pr);
+ SwapRight(pl,pr);
+ pl = pl->left;
+ pr = pr->left;
+ }
+ else
+ {
+ pl = pl->right;
+ pr = pr->right;
+ }
+ }
+ else
+ {
+ if (elementexchange)
+ {
+ SwapVal(pl,pr);
+ SwapLeft(pl,pr);
+ pl = pl->right;
+ pr = pr->right;
+ }
+ else
+ {
+ pl = pl->left;
+ pr = pr->left; /* MISS PROBLEM */
+ }
+ }
+ }
+
+ if (root->left != NIL)
+ {
+ root->value=Bimerge(root->left,root->value,dir);
+ spr_val=Bimerge(root->right,spr_val,dir);
+ }
+ /*chatting("exit bimerge %x\n", root);*/
+ return spr_val;
+}
+
+int Bisort(root,spr_val,dir)
+ HANDLE *root;
+ int spr_val,dir;
+{
+ /*chatting("bisort %x\n", root);*/
+ if (root->left == NIL)
+ {
+ if ((root->value > spr_val) ^ dir)
+ {
+ int val;
+ val = spr_val;
+ spr_val = root->value;
+ root->value =val;
+ }
+ }
+ else
+ {
+ /* Bisort both halves of the tree and merge */
+ root->value=Bisort(root->left,root->value,dir);
+ spr_val=Bisort(root->right,spr_val,!dir);
+ spr_val=Bimerge(root,spr_val,dir);
+ }
+ /*chatting("exit bisort %x\n", root);*/
+ return spr_val;
+}
+
+void main(argc,argv)
+ int argc;
+ char *argv[];
+
+
+{
+ HANDLE *h;
+ int sval;
+ int n;
+
+ n = dealwithargs(argc,argv);
+
+ chatting("Bisort with %d size\n", n);
+ h = RandTree(n,12345768,0);
+#ifdef SS_PLAIN
+ sval = (mult(245867,CONST_b)+1) % RANGE;
+#else SS_PLAIN
+ sval = random(245867) % RANGE;
+#endif SS_PLAIN
+ if (flag) {
+ InOrder(h);
+ chatting("%d\n",sval);
+ }
+ chatting("**************************************\n");
+ chatting("BEGINNING BITONIC SORT ALGORITHM HERE\n");
+ chatting("**************************************\n");
+
+ chatting("Sorting forward...");
+ sval=Bisort(h,sval,0);
+ if (flag) {
+ chatting("Sorted Tree:\n");
+ InOrder(h);
+ chatting("%d\n",sval);
+ }
+ chatting("done\n");
+
+ chatting("sorting backward...");
+ sval=Bisort(h,sval,1);
+ if (flag) {
+ chatting("Sorted Tree:\n");
+ InOrder(h);
+ chatting("%d\n",sval);
+ }
+ chatting("done\n");
+ exit(0);
+}
+
diff --git a/test/ccured_olden/newbisort/node.h b/test/ccured_olden/newbisort/node.h
new file mode 100644
index 00000000..c1b81c6d
--- /dev/null
+++ b/test/ccured_olden/newbisort/node.h
@@ -0,0 +1,18 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* =============== NODE STRUCTURE =================== */
+
+struct node {
+ int value;
+ struct node *left;
+ struct node *right;
+ };
+
+typedef struct node HANDLE;
+
+#define NIL ((HANDLE *) 0)
+#ifdef FUTURES
+#define makenode(procid) ALLOC(procid,sizeof(struct node))
+#else
+#define makenode(procid) mymalloc(sizeof(struct node))
+#endif
diff --git a/test/ccured_olden/newbisort/proc.h b/test/ccured_olden/newbisort/proc.h
new file mode 100644
index 00000000..eadb80aa
--- /dev/null
+++ b/test/ccured_olden/newbisort/proc.h
@@ -0,0 +1,25 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* ========== PROCEDURE TYPES/NUMS ================== */
+
+
+HANDLE *RandTree();
+
+void SwapValue();
+void SwapValLeft();
+void SwapValRight();
+int Bimerge();
+int Bisort();
+#define DD_EXIT 0
+
+
+/* ================= PROC NAMES ==============*/
+
+#ifdef EXTERN
+ extern char *procnames[];
+#else
+ static char *procnames[] =
+ {
+ "EXIT"
+ };
+#endif
diff --git a/test/ccured_olden/newbisort/ssplain.c b/test/ccured_olden/newbisort/ssplain.c
new file mode 100644
index 00000000..b178e5f5
--- /dev/null
+++ b/test/ccured_olden/newbisort/ssplain.c
@@ -0,0 +1,75 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+void chatting(char *s, ...)
+{
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+void __Olden_panic(char *s, ...)
+{
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+ exit(-1);
+}
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
+
+static unsigned long bytes_allocated = 0;
+static unsigned long allocations = 0;
+
+void*
+ssplain_malloc(int size)
+{
+ allocations++;
+ bytes_allocated+=size;
+ return malloc(size);
+}
+
+void*
+ssplain_calloc(int nelems, int size)
+{
+ void *p;
+ allocations++;
+ bytes_allocated+= nelems * size;
+ p = calloc(nelems, size);
+ assert (p);
+ return p;
+}
+
+void
+ssplain_alloc_stats()
+{
+ chatting("Allocation stats: %d bytes allocated in %d allocations\n",
+ bytes_allocated, allocations);
+}
diff --git a/test/ccured_olden/newbisort/ssplain.h b/test/ccured_olden/newbisort/ssplain.h
new file mode 100644
index 00000000..cb9b3eed
--- /dev/null
+++ b/test/ccured_olden/newbisort/ssplain.h
@@ -0,0 +1,128 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc ssplain_malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+void chatting(char *s, ...);
+void __Olden_panic(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/newbisort/swap.c b/test/ccured_olden/newbisort/swap.c
new file mode 100644
index 00000000..e1e98749
--- /dev/null
+++ b/test/ccured_olden/newbisort/swap.c
@@ -0,0 +1,145 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#define COLLECT_SIZE 256
+#define DFS_SIZE 20
+#include "node.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+
+typedef struct {
+ int top;
+ HANDLE *handles[DFS_SIZE];
+} stack;
+
+#define push(s,v) (s)->handles[++((s)->top)] = v
+#define pop(s) (s)->handles[((s)->top)--]
+#define stackempty(s) ((s)->top < 0)
+void VisitCollect(HANDLE *t, local int *collect)
+{
+ register int val;
+ val = t->value;
+ *collect = val;
+}
+
+void VisitCollectReplace(HANDLE *t, local int *collect)
+{
+ register int temp = *collect;
+ register int val = t->value;
+ *collect = val;
+ t->value = temp;
+}
+
+void VisitReplace(HANDLE *t, local int *collect)
+{
+ register int val = *collect;
+ t->value = val;
+}
+
+void swapDFS(local stack *s, local int collection[], void visit())
+{
+ int num=0;
+
+ while (!stackempty(s) && num < COLLECT_SIZE)
+ {
+ HANDLE *v = pop(s);
+ visit(v,&collection[num]);
+ num++;
+ if (v->left != NULL)
+ {
+ HANDLE *child;
+ child = v->right;
+ push(s,child);
+ child = v->left;
+ push(s,child);
+ }
+ }
+}
+
+void NewSwapSubTree(HANDLE *t1, HANDLE *t2)
+{
+ local stack c1, r1, s2;
+ int collection[COLLECT_SIZE];
+
+ /*chatting("starting swapping\n");*/
+
+ if (t1!=NULL)
+ {
+ c1.top = -1;
+ r1.top = -1;
+ s2.top = -1;
+ push(&c1,t1);
+ push(&r1,t1);
+ push(&s2,t2);
+ while (!stackempty(&c1))
+ {
+ MLOCAL(t1);
+ swapDFS(&c1,collection,VisitCollect);
+ MLOCAL(t2);
+ swapDFS(&s2,collection,VisitCollectReplace);
+ MLOCAL(t1);
+ swapDFS(&r1,collection,VisitReplace);
+ }
+ }
+ /*chatting("ending swapping\n");*/
+
+}
+
+
+int *Collect(HANDLE *t1, local int collection[])
+{
+ register int val;
+ if (t1==NULL) return collection;
+ MLOCAL(t1);
+ val = t1->value;
+ *collection = val;
+ collection += 1;
+ collection = Collect(t1->left,collection);
+ collection = Collect(t1->right,collection);
+ return collection;
+}
+
+int *Collect_Replace(HANDLE *t1, local int collection[])
+{
+ register int temp,val;
+ if (t1==NULL) return collection;
+ MLOCAL(t1);
+ temp = *collection;
+ val = t1->value;
+ *collection = val;
+ t1->value = temp;
+ collection += 1;
+ collection = Collect_Replace(t1->left,collection);
+ collection = Collect_Replace(t1->right,collection);
+ return collection;
+}
+
+int *Replace(HANDLE *t1, local int collection[])
+{
+ register int val;
+ if (t1==NULL) return collection;
+ MLOCAL(t1);
+ val = *collection;
+ t1->value = val;
+ collection +=1;
+ collection = Replace(t1->left,collection);
+ collection = Replace(t1->right,collection);
+ return collection;
+}
+
+
+void SwapSubTree(HANDLE *t1, HANDLE *t2)
+{
+ int collection[COLLECT_SIZE];
+ HANDLE *t1loc, *t2loc;
+
+ MLOCAL(t1);
+ Collect(t1,collection);
+ MLOCAL(t2);
+ Collect_Replace(t2,collection);
+ MLOCAL(t1);
+ Replace(t1,collection);
+}
+
diff --git a/test/ccured_olden/perimeter/.cvsignore b/test/ccured_olden/perimeter/.cvsignore
new file mode 100644
index 00000000..9cd22bfd
--- /dev/null
+++ b/test/ccured_olden/perimeter/.cvsignore
@@ -0,0 +1,32 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+changes.out
+perimeter.cil
+perimeter.*box
+allcfiles
+ope.m
+ope.m
+*cured.c
+*.optim.c
+*_comb.c
+changes
+output
+out.diff
+*.browser
+*optimcured*
+
diff --git a/test/ccured_olden/perimeter/CVS/Entries b/test/ccured_olden/perimeter/CVS/Entries
new file mode 100644
index 00000000..4d821ece
--- /dev/null
+++ b/test/ccured_olden/perimeter/CVS/Entries
@@ -0,0 +1,9 @@
+/Makefile/1.3/Sun Jul 8 14:10:47 2001//
+/README/1.1/Tue Jun 12 04:17:59 2001//
+/main.c/1.1/Tue Jun 12 04:17:59 2001//
+/maketree.c/1.1/Tue Jun 12 04:17:59 2001//
+/out.orig/1.1/Mon Nov 12 08:08:28 2001//
+/testit/1.2/Tue Dec 4 05:07:50 2001//
+/.cvsignore/1.14/Wed Aug 7 01:48:13 2002//
+/perimeter.h/1.4/Sat Jan 11 20:38:42 2003//
+D
diff --git a/test/ccured_olden/perimeter/CVS/Repository b/test/ccured_olden/perimeter/CVS/Repository
new file mode 100644
index 00000000..63138464
--- /dev/null
+++ b/test/ccured_olden/perimeter/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/perimeter
diff --git a/test/ccured_olden/perimeter/CVS/Root b/test/ccured_olden/perimeter/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/perimeter/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/perimeter/Makefile b/test/ccured_olden/perimeter/Makefile
new file mode 100644
index 00000000..47675db0
--- /dev/null
+++ b/test/ccured_olden/perimeter/Makefile
@@ -0,0 +1,99 @@
+# /* For copyright information, see olden_v1.01/COPYRIGHT */
+.KEEP_STATE:
+SRCS = main.c maketree.c
+
+OLDEN_DIR=/u/ac/carlisle/olden_v1.01
+RCC = $(OLDEN_DIR)/mcc/sparc/backend/mcc
+CPP = gcc -E -U__GNUC__ -D_NO_LONGLONG
+#CPPFLAGS = -DVERIFY_AFFINITIES
+CPPFLAGS =
+#LIBFLAGS = "CPPFLAGS=-DPROF"
+#LIBFLAGS = "CPPFLAGS=-DVISUALIZE" "VFLAG=-v"
+LIBFLAGS =
+#PFLAG = -p
+PFLAG =
+PLIBOBJS = plain.o plain2.o
+LIBOBJS = libolden.a
+OBJS = $(SRCS:%.c=%.o) args.o
+ROBJS = $(SRCS:%.c=%.r.o) args.o
+LIBLINK = $(LIBOBJS:%=$(OLDEN_DIR)/runtime/%)
+RLIBLINK = $(PLIBOBJS:%=$(OLDEN_DIR)/runtime/%)
+INCDIRS = /usr/include $(OLDEN_DIR)/runtime
+NODELIBS =
+LIBDIRS =
+
+CC = cc
+#sm: CFLAGS =
+CFLAGS = -O2
+
+
+# sm:
+PLAIN=1
+all: defaulttarget
+
+ifdef PLAIN
+ifdef _MSVC
+EXTOBJ = .obj
+OBJOUT = /Fo
+EXEOUT = /Fe
+CFLAGS = /DPLAIN
+CONLY = /c
+CC = cl
+else
+EXTOBJ = .o
+OBJOUT = -o
+EXEOUT = -o
+CFLAGS += -DPLAIN
+CONLY = -c
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+endif
+
+OBJS = maketree$(EXTOBJ) main$(EXTOBJ)
+
+%.obj : %.c
+ $(CC) $(CONLY) $(CFLAGS) $< $(OBJOUT)$@
+
+
+defaulttarget: $(OBJS)
+ $(CC) $(CFLAGS) $(OBJS) $(EXEOUT)perimeter.exe
+endif
+
+perm: $(OBJS) target
+ /usr/bin/cmmd-ld \
+ -comp $(CC) $(OBJS) $(LIBLINK) -v -o /scratch1/carlisle/perm \
+ $(LIBDIRS:%=-L%) $(NODELIBS:%=-l%)
+
+plain: $(ROBJS) target
+ /usr/bin/cmmd-ld \
+ -comp $(CC) $(ROBJS) $(RLIBLINK) -v -o /scratch1/carlisle/plainperm \
+ $(LIBDIRS:%=-L%) $(NODELIBS:%=-l%)
+
+ifndef PLAIN
+args.s: args.c
+ /lib/cpp $(CPPFLAGS) $(INCDIRS:%=-I%) args.c | $(RCC) > args.s
+endif
+
+%.s: %.c
+ $(CPP) -DFUTURES $(CPPFLAGS) $(INCDIRS:%=-I%) $< | $(RCC) $(PFLAG) -n -m -k > $*.s
+
+
+%.p.s: %.c
+ /lib/cpp -DPLAIN $(CPPFLAGS) $(INCDIRS:%=-I%) $< | $(RCC) -f > $*.p.s
+
+%.o: %.s
+ $(CC) $(CFLAGS) -c $<
+
+
+%.r.o: %.p.s
+ $(CC) $(CFLAGS) -c $< -o $*.r.o
+
+target:
+ cd $(OLDEN_DIR)/runtime; make $(LIBFLAGS)
+
+clean:
+ rm -f $(TARGET) $(OBJS) *.exe *.o *.obj *~ .make.state .nse_depinfo *.s *.light.c
+
+
diff --git a/test/ccured_olden/perimeter/README b/test/ccured_olden/perimeter/README
new file mode 100644
index 00000000..c8f557c9
--- /dev/null
+++ b/test/ccured_olden/perimeter/README
@@ -0,0 +1,20 @@
+/* For copyright information, see olden_v1.01/COPYRIGHT */
+**********************
+olden_v1.01/benchmarks/perimeter/README
+June 1996
+Martin C. Carlisle
+
+this directory contains the Perimeter benchmark:
+
+H. Samet. "Computing Perimeters of Regions in Images Represented by Quad-
+Trees". IEEE Trans. on Pattern Analysis and Machine Intelligence
+PAMI-3(6), Nov. 1981
+
+as implemented for Olden by Martin C. Carlisle
+**********************
+
+Makefile - use "make perm" to create executable
+
+args.c - process command line args
+main.c,perimeter.h - main routines
+maketree.c - creates random quad-tree
diff --git a/test/ccured_olden/perimeter/main.c b/test/ccured_olden/perimeter/main.c
new file mode 100644
index 00000000..ff58925a
--- /dev/null
+++ b/test/ccured_olden/perimeter/main.c
@@ -0,0 +1,221 @@
+#include "perimeter.h"
+#ifdef MIGRONLY
+#define BLAH MIGRPH()
+#else
+#define BLAH
+#endif
+
+#ifdef VERIFY_AFFINITIES
+#include "affinity.h"
+CHECK4(QuadTree,nw,ne,sw,se,tree)
+#endif
+
+static int adj(Direction d, ChildType ct)
+{
+ BLAH;
+ switch (d)
+ {
+ case north:
+ return ((ct==northeast) || (ct==northwest));
+ case south:
+ return ((ct==southeast) || (ct==southwest));
+ case east:
+ return ((ct==northeast) || (ct==southeast));
+ case west:
+ return ((ct==southwest) || (ct==northwest));
+ }
+}
+
+static ChildType reflect(Direction d, ChildType ct)
+{
+ BLAH;
+ if ((d==west) || (d==east))
+ {
+ switch(ct)
+ {
+ case northwest:
+ return northeast;
+ case northeast:
+ return northwest;
+ case southeast:
+ return southwest;
+ case southwest:
+ return southeast;
+ }
+ }
+ switch(ct)
+ {
+ case northwest:
+ return southwest;
+ case northeast:
+ return southeast;
+ case southeast:
+ return northeast;
+ case southwest:
+ return northwest;
+ }
+}
+
+int CountTree(QuadTree tree)
+{
+ QuadTree nw,ne,sw,se;
+
+ BLAH;
+ nw = tree->nw; ne = tree->ne; sw = tree->sw; se = tree->se;
+ if (nw==NULL && ne==NULL && sw==NULL && se==NULL)
+ return 1;
+ else
+ return CountTree(nw) + CountTree(ne) + CountTree(sw) +
+ CountTree(se);
+}
+
+static QuadTree child(QuadTree tree, ChildType ct)
+{
+ BLAH;
+ switch(ct)
+ {
+ case northeast:
+ return tree->ne;
+ case northwest:
+ return tree->nw;
+ case southeast:
+ return tree->se;
+ case southwest:
+ return tree->sw;
+ }
+}
+
+static QuadTree gtequal_adj_neighbor(QuadTree tree, Direction d)
+{
+ QuadTree q,parent;
+ ChildType ct;
+
+ BLAH;
+ parent=tree->parent;
+ ct=tree->childtype;
+ if ((parent!=NULL) && adj(d,ct))
+ q=gtequal_adj_neighbor(parent,d);
+ else q=parent;
+ if (q && q->color==grey) {
+ return child(q,reflect(d,ct));
+ }
+ else return q;
+}
+
+static int sum_adjacent(QuadTree p, ChildType q1, ChildType q2, int size)
+{
+ BLAH;
+ if (p->color==grey)
+ {
+ return sum_adjacent(child(p,q1),q1,q2,size/2) +
+ sum_adjacent(child(p,q2),q1,q2,size/2);
+ }
+ else if (p->color==white)
+ {
+ return size;
+ }
+ else return 0;
+}
+
+int perimeter(QuadTree tree, int size)
+{
+ int retval = 0;
+ QuadTree neighbor;
+
+ BLAH;
+ if (tree->color==grey)
+ {
+ QuadTree child;
+#ifdef FUTURES
+ future_cell_int fc_sw,fc_se,fc_ne;
+#endif
+
+#ifndef FUTURES
+ child = tree->sw;
+ retval += perimeter(child,size/2);
+ child = tree->se;
+ retval += perimeter(child,size/2);
+ child = tree->ne;
+ retval += perimeter(child,size/2);
+ child = tree->nw;
+ retval += perimeter(child,size/2);
+#else
+ child = tree->sw;
+ FUTURE(child,size/2,perimeter,&fc_sw);
+ child = tree->se;
+ FUTURE(child,size/2,perimeter,&fc_se);
+ child = tree->ne;
+ FUTURE(child,size/2,perimeter,&fc_ne);
+ child = tree->nw;
+ retval = perimeter(child,size/2);
+ TOUCH(&fc_sw);
+ TOUCH(&fc_se);
+ TOUCH(&fc_ne);
+ retval += fc_sw.value + fc_se.value + fc_ne.value;
+#endif
+ }
+ else if (tree->color==black)
+ {
+ /* North */
+ neighbor=gtequal_adj_neighbor(tree,north);
+ if ((neighbor==NULL) || (neighbor->color==white)) retval+=size;
+ else if (neighbor->color==grey)
+ retval+=sum_adjacent(neighbor,southeast,southwest,size);
+ /* East */
+ neighbor=gtequal_adj_neighbor(tree,east);
+ if ((neighbor==NULL) || (neighbor->color==white)) retval+=size;
+ else if (neighbor->color==grey)
+ retval+=sum_adjacent(neighbor,southwest,northwest,size);
+ /* South */
+ neighbor=gtequal_adj_neighbor(tree,south);
+ if ((neighbor==NULL) || (neighbor->color==white)) retval+=size;
+ else if (neighbor->color==grey)
+ retval+=sum_adjacent(neighbor,northwest,northeast,size);
+ /* West */
+ neighbor=gtequal_adj_neighbor(tree,west);
+ if ((neighbor==NULL) || (neighbor->color==white)) retval+=size;
+ else if (neighbor->color==grey)
+ retval+=sum_adjacent(neighbor,northeast,southeast,size);
+ }
+ return retval;
+}
+
+#ifdef PLAIN
+double wallclock;
+int __NumNodes;
+#endif
+
+int main()
+{
+ QuadTree tree;
+ int count;
+ int level;
+ int i;
+
+ BLAH;
+ level = 12;
+ __NumNodes = 1;
+
+ chatting("Perimeter with %d levels on %d processors\n",level,__NumNodes);
+ tree=MakeTree(2048,0,0,0,__NumNodes-1,NULL,southeast,level);
+#ifdef VERIFY_AFFINITIES
+ Docheck_tree(tree);
+#endif
+ count=CountTree(tree);
+ chatting("# of leaves is %d\n",count);
+
+
+ timer_start(0);
+ for(i=0;i<100;i++) {
+ count=perimeter(tree,4096);
+ }
+ timer_stop(0);
+
+ chatting("perimeter is %d\n",count);
+ chatting("Time elapsed = %f milliseconds\n", timer_elapsed(0));
+#ifdef FUTURES
+ __ShutDown();
+#endif
+ exit(0);
+}
+
diff --git a/test/ccured_olden/perimeter/maketree.c b/test/ccured_olden/perimeter/maketree.c
new file mode 100644
index 00000000..294ff028
--- /dev/null
+++ b/test/ccured_olden/perimeter/maketree.c
@@ -0,0 +1,120 @@
+#include "perimeter.h"
+
+static int CheckOutside(int x, int y)
+{
+ int euclid = x*x+y*y;
+
+ if (euclid > 4194304) return 1;
+ if (euclid < 1048576) return -1;
+ return 0;
+}
+
+static int CheckIntersect(int center_x, int center_y, int size)
+{
+ int sum;
+
+ if (!CheckOutside(center_x+size,center_y+size) &&
+ !CheckOutside(center_x+size,center_y-size) &&
+ !CheckOutside(center_x-size,center_y-size) &&
+ !CheckOutside(center_x-size,center_y+size)) return 2;
+ sum=CheckOutside(center_x+size,center_y+size) +
+ CheckOutside(center_x+size,center_y-size) +
+ CheckOutside(center_x-size,center_y-size) +
+ CheckOutside(center_x-size,center_y+size);
+ if ((sum==4) || (sum==-4)) return 0;
+ return 1;
+}
+
+QuadTree MakeTree(int size, int center_x, int center_y, int lo_proc,
+ int hi_proc, QuadTree parent, ChildType ct, int level)
+{
+ int intersect=0;
+ QuadTree retval;
+
+#ifdef FUTURES
+ retval = (QuadTree) ALLOC(lo_proc,sizeof(*retval));
+#else
+ retval = (QuadTree) mymalloc(sizeof(*retval));
+#endif
+ retval->parent = parent;
+ retval->childtype = ct;
+
+ intersect = CheckIntersect(center_x,center_y,size);
+ size = size/2;
+ if ((intersect==0) && (size<512))
+ {
+ retval->color = white;
+ retval->nw = NULL;
+ retval->ne = NULL;
+ retval->sw = NULL;
+ retval->se = NULL;
+ }
+ else if (intersect==2)
+ {
+ retval->color=black;
+ retval->nw = NULL;
+ retval->ne = NULL;
+ retval->sw = NULL;
+ retval->se = NULL;
+ }
+ else
+ {
+ if (!level)
+ {
+ retval->color = black;
+ retval->nw = NULL;
+ retval->ne = NULL;
+ retval->sw = NULL;
+ retval->se = NULL;
+ }
+ else
+ {
+ int mid1,mid2;
+#ifdef FUTURES
+ future_cell_int fc_sw,fc_se,fc_ne;
+#endif
+
+ mid1 = (lo_proc+hi_proc)/2;
+ mid2 = (lo_proc+hi_proc+1)/2;
+
+#ifndef FUTURES
+ retval->sw = MakeTree(size,center_x-size,center_y-size,
+ (mid2+hi_proc+1)/2,hi_proc,retval,
+ southwest,level-1);
+ retval->se = MakeTree(size,center_x+size,center_y-size,
+ mid2,(mid2+hi_proc)/2,retval,
+ southeast,level-1);
+ retval->ne = MakeTree(size,center_x+size,center_y+size,
+ (lo_proc+mid1+1)/2,mid1,retval,
+ northeast,level-1);
+ retval->nw = MakeTree(size,center_x-size,center_y+size,
+ lo_proc,(lo_proc+mid1)/2,retval,
+ northwest,level-1);
+#else
+ FUTURE(size,center_x-size,center_y-size,
+ (mid2+hi_proc+1)/2,hi_proc,retval,
+ southwest,level-1,MakeTree,&fc_sw);
+ FUTURE(size,center_x+size,center_y-size,
+ mid2,(mid2+hi_proc)/2,retval,
+ southeast,level-1,MakeTree,&fc_se);
+ FUTURE(size,center_x+size,center_y+size,
+ (lo_proc+mid1+1)/2,mid1,retval,
+ northeast,level-1,MakeTree,&fc_ne);
+ retval->nw = MakeTree(size,center_x-size,center_y+size,
+ lo_proc,(lo_proc+mid1)/2,retval,
+ northwest,level-1);
+ TOUCH(&fc_sw);
+ retval->sw = (QuadTree) fc_sw.value;
+ TOUCH(&fc_se);
+ retval->se = (QuadTree) fc_se.value;
+ TOUCH(&fc_ne);
+ retval->ne = (QuadTree) fc_ne.value;
+#endif
+ retval->color = grey;
+ }
+ }
+ return retval;
+}
+
+
+
diff --git a/test/ccured_olden/perimeter/out.orig b/test/ccured_olden/perimeter/out.orig
new file mode 100644
index 00000000..98edab51
--- /dev/null
+++ b/test/ccured_olden/perimeter/out.orig
@@ -0,0 +1,3 @@
+Perimeter with 12 levels on 1 processors
+# of leaves is 73432
+perimeter is 24576
diff --git a/test/ccured_olden/perimeter/output b/test/ccured_olden/perimeter/output
new file mode 100644
index 00000000..5906be43
--- /dev/null
+++ b/test/ccured_olden/perimeter/output
@@ -0,0 +1,4 @@
+Perimeter with 12 levels on 1 processors
+# of leaves is 73432
+perimeter is 24576
+Time elapsed = 2970.000000 milliseconds
diff --git a/test/ccured_olden/perimeter/perimeter.h b/test/ccured_olden/perimeter/perimeter.h
new file mode 100644
index 00000000..e5cc086b
--- /dev/null
+++ b/test/ccured_olden/perimeter/perimeter.h
@@ -0,0 +1,54 @@
+#define NULL 0
+
+#ifndef PLAIN
+#include <cm/cmmd.h>
+
+#ifdef FUTURES
+#include "future-cell.h"
+#endif
+#include "mem-ref.h"
+#endif
+
+typedef enum {black, white, grey} Color;
+typedef enum {northwest, northeast, southwest, southeast} ChildType;
+typedef enum {north, east, south, west} Direction;
+
+typedef struct quad_struct {
+ Color color;
+ ChildType childtype;
+ struct quad_struct *nw ; // {50};
+ struct quad_struct *ne ; //{50};
+ struct quad_struct *sw ; // {50};
+ struct quad_struct *se ; //{50};
+ struct quad_struct *parent; // {50};
+} *QuadTree;
+
+QuadTree MakeTree(int size, int center_x, int center_y, int lo_proc,
+ int hi_proc, QuadTree parent, ChildType ct, int level);
+
+
+#include <stdlib.h> //malloc
+#include <stdio.h> // printf
+
+extern void exit(int);
+
+extern int __NumNodes;
+
+#ifdef PLAIN
+#include <time.h>
+#define local
+#define mymalloc malloc
+#define CMMD_node_timer_clear(x) (void)0
+#define TIMESTART(clk) {clk=(double)clock();}
+#define TIMESTOP(clk) {clk=1000000.0 * ((double)clock()-(clk))/CLOCKS_PER_SEC;}
+extern double wallclock;
+#define timer_start(x) TIMESTART(wallclock)
+#define timer_stop(x) TIMESTOP(wallclock)
+#define timer_elapsed(x) (wallclock / 1000.0)
+#define chatting printf
+#define NOTEST() (void)0
+#define RETEST() (void)0
+#define mymalloc malloc
+#endif
+
+
diff --git a/test/ccured_olden/perimeter/testit b/test/ccured_olden/perimeter/testit
new file mode 100755
index 00000000..35723c5f
--- /dev/null
+++ b/test/ccured_olden/perimeter/testit
@@ -0,0 +1,25 @@
+#!/bin/sh
+# test a perimeter binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./perimeter.exe"
+ exit
+fi
+
+# all of perimeter's output is to stdout
+echo "running: $1 >output"
+if ! $1 >output; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+if ! grep -v "Time elapsed" <output | diff out.orig - >out.diff 2>&1 ; then
+ # For some reason diff returns error code but an empty diff !
+ if test -s out.diff; then
+ echo "$1 got the wrong answer. See out.diff."
+ exit 4
+ fi
+fi
+echo "$1 seems to work"
+rm -f out.diff
+ \ No newline at end of file
diff --git a/test/ccured_olden/power/.cvsignore b/test/ccured_olden/power/.cvsignore
new file mode 100644
index 00000000..c4eadcc3
--- /dev/null
+++ b/test/ccured_olden/power/.cvsignore
@@ -0,0 +1,21 @@
+*.i
+*_all*.c
+*cil.c
+*box.c
+code
+data.in
+data.out
+*.origi
+*_ppp.c
+power.cil
+power.*box
+*infer.c
+changes.out
+allcfiles
+ope.m
+*cured.c
+*.optim.c
+*_comb.c
+*.exe_comb.browser
+changes
+output
diff --git a/test/ccured_olden/power/.gdbinit b/test/ccured_olden/power/.gdbinit
new file mode 100644
index 00000000..81003d62
--- /dev/null
+++ b/test/ccured_olden/power/.gdbinit
@@ -0,0 +1,5 @@
+# .gdbinit
+
+file power.exe.orig
+break main
+run
diff --git a/test/ccured_olden/power/CVS/Entries b/test/ccured_olden/power/CVS/Entries
new file mode 100644
index 00000000..fccdd5e3
--- /dev/null
+++ b/test/ccured_olden/power/CVS/Entries
@@ -0,0 +1,11 @@
+/README/1.1/Mon Jun 11 21:20:00 2001//
+/build.c/1.1/Mon Jun 11 21:20:00 2001//
+/compute.c/1.2/Wed Jun 13 18:16:23 2001//
+/main.c/1.2/Mon Jun 11 22:47:26 2001//
+/.gdbinit/1.1/Mon Nov 12 08:08:28 2001//
+/Makefile/1.5/Mon Nov 12 15:44:12 2001//
+/out.orig/1.1/Mon Nov 12 08:08:28 2001//
+/testit/1.1/Mon Nov 12 08:08:28 2001//
+/.cvsignore/1.10/Fri Oct 4 16:28:44 2002//
+/power.h/1.6/Sat Jan 11 20:33:38 2003//
+D
diff --git a/test/ccured_olden/power/CVS/Repository b/test/ccured_olden/power/CVS/Repository
new file mode 100644
index 00000000..edf93de9
--- /dev/null
+++ b/test/ccured_olden/power/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/power
diff --git a/test/ccured_olden/power/CVS/Root b/test/ccured_olden/power/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/power/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/power/Makefile b/test/ccured_olden/power/Makefile
new file mode 100644
index 00000000..e982f5b5
--- /dev/null
+++ b/test/ccured_olden/power/Makefile
@@ -0,0 +1,41 @@
+
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+CFLAGS = $(EXTRA_CFLAGS)
+#CFLAGS = -O2
+LDFLAGS = $(EXTRA_LDFLAGS)
+
+CFLAGS += -DPLAIN
+
+ifdef _MSVC
+ # ...
+else
+ MATH = -lm
+ CFLAGS += -g -ffloat-store
+ LDFLAGS += -g -ffloat-store
+endif
+
+PROGS = compute build main
+
+#defaulttarget: $(OBJS)
+# $(CC) $(LDFLAGS) $(OBJS) $(EXTRA_LIBS) -o power.exe $(MATH)
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(LDFALGS) -o $*.compcert $*.s
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c
+
+clean:
+ rm -f $(TARGET) $(OBJS) *~ *.obj *.o *.exe .make.state .nse_depinfo *.light.c *.s *.compcert
diff --git a/test/ccured_olden/power/README b/test/ccured_olden/power/README
new file mode 100644
index 00000000..478692e8
--- /dev/null
+++ b/test/ccured_olden/power/README
@@ -0,0 +1,21 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+**********************
+olden_v1.0/benchmarks/power/README
+January 3, 1995
+Martin C. Carlisle
+
+this directory contains the Power Pricing benchmark:
+
+S. Lumetta, L. Murphy, X. Li, D. Culler, and I. Khalil. "Decentralized
+optimal power pricing: The development of a parallel program."
+Supercomputing '93, 243-249
+
+as implemented for Olden by Martin C. Carlisle
+**********************
+
+Makefile - use "make power" to create executable
+
+args.c - process command line args
+main.c,power.h - main routines
+build.c - build tree
+compute.c - compute prices
diff --git a/test/ccured_olden/power/build.c b/test/ccured_olden/power/build.c
new file mode 100644
index 00000000..881b8e60
--- /dev/null
+++ b/test/ccured_olden/power/build.c
@@ -0,0 +1,154 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* build.c
+ *
+ * By: Martin C. Carlisle
+ * 6/15/94
+ * builds the tree for the Power Pricing problem
+ *
+ * based on code by: Steve Lumetta, Sherry Li, and Ismail Khalil
+ * University of California at Berkeley
+ */
+
+#include "power.h"
+
+Root build_tree()
+{
+ register int i;
+ register Root t;
+#ifdef FUTURES
+ int j;
+ future_cell_int fc[NUM_FEEDERS];
+#else
+ register Lateral l;
+#endif
+
+ t = (Root) ALLOC(0,sizeof(*t));
+#ifdef FUTURES
+ for (i=0,j=0; i<NUM_FEEDERS; i++,j+=LATERALS_PER_FEEDER) {
+ FUTURE(j,LATERALS_PER_FEEDER,build_lateral,&fc[i]);
+ }
+ for (i=0; i<NUM_FEEDERS; i++) {
+ TOUCH(&fc[i]);
+ t->feeders[i]=(Lateral) fc[i].value;
+ }
+#else
+ for (i=0; i<NUM_FEEDERS; i++) {
+ /* Insert future here, split into two loops */
+ l = build_lateral(i*LATERALS_PER_FEEDER,LATERALS_PER_FEEDER);
+ t->feeders[i]=l;
+ }
+#endif
+ t->theta_R = 0.8;
+ t->theta_I = 0.16;
+ return t;
+}
+
+Lateral build_lateral(int i, int num)
+{
+ register int j,k;
+ register Lateral l;
+ register Branch b;
+#ifdef FUTURES
+ future_cell_int fc;
+#else
+ register Lateral next;
+#endif
+
+ if (num == 0) return NULL;
+
+#ifndef PLAIN
+ { int x,m,q,proc;
+ x = (i+num-1)*BRANCHES_PER_LATERAL+BRANCHES_PER_LATERAL-1;
+ m = 1000%__NumNodes;
+ q = 1000/__NumNodes;
+ if (x<m*(q+1)) proc = x/(q+1);
+ else proc = (x-m)/q;
+ l = (Lateral) ALLOC(__NumNodes-1-proc,sizeof(*l));
+ }
+#else
+ l = (Lateral) ALLOC(0,sizeof(*l));
+#endif
+
+#ifdef FUTURES
+ FUTURE(i,num-1,build_lateral,&fc);
+ b = build_branch(i*BRANCHES_PER_LATERAL,(num-1)*BRANCHES_PER_LATERAL,
+ BRANCHES_PER_LATERAL);
+#else
+ next = build_lateral(i,num-1);
+ b = build_branch(i*BRANCHES_PER_LATERAL,(num-1)*BRANCHES_PER_LATERAL,
+ BRANCHES_PER_LATERAL);
+#endif
+
+#ifdef FUTURES
+ TOUCH(&fc);
+ l->next_lateral = (Lateral) fc.value;
+#else
+ l->next_lateral = next;
+#endif
+ l->branch = b;
+ l->R = 1/300000.0;
+ l->X = 0.000001;
+ l->alpha = 0.0;
+ l->beta = 0.0;
+ return l;
+}
+
+Branch build_branch(int i, int j, int num)
+{
+ register Leaf l;
+ register Branch b;
+#ifdef FUTURES
+ future_cell_int fc;
+#endif
+
+ if (num == 0) return NULL;
+ /* allocate branch */
+#ifndef PLAIN
+ { int x,m,q,proc;
+ x = i+j+num-1;
+ m = 1000%__NumNodes;
+ q = 1000/__NumNodes;
+ if (x<m*(q+1)) proc = x/(q+1);
+ else proc = (x-m)/q;
+ b = (Branch) ALLOC(__NumNodes-1-proc,sizeof(*b));
+ }
+#else
+ b = (Branch) ALLOC(0,sizeof(*b));
+#endif
+
+ /* fill in children */
+#ifndef FUTURES
+ b->next_branch= build_branch(i,j,num-1);
+#else
+ FUTURE(i,j,num-1,build_branch,&fc);
+#endif
+
+ for (i=0; i<LEAVES_PER_BRANCH; i++) {
+ l = build_leaf();
+ b->leaves[i] = l;
+ }
+
+
+#ifdef FUTURES
+ TOUCH(&fc);
+ b->next_branch = (Branch) fc.value;
+#endif
+
+ /* fill in values */
+ b->R = 0.0001;
+ b->X = 0.00002;
+ b->alpha = 0.0;
+ b->beta = 0.0;
+ return b;
+}
+
+Leaf build_leaf()
+{
+ register Leaf l;
+
+ l = (Leaf) mymalloc(sizeof(*l));
+ l->D.P = 1.0;
+ l->D.Q = 1.0;
+ return l;
+}
diff --git a/test/ccured_olden/power/compute.c b/test/ccured_olden/power/compute.c
new file mode 100644
index 00000000..83d47b59
--- /dev/null
+++ b/test/ccured_olden/power/compute.c
@@ -0,0 +1,379 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* compute.c
+ *
+ * By: Martin C. Carlisle
+ * 6/15/94
+ *
+ * Implements computation phase of the Power Pricing problem
+ * based on code by: Steve Lumetta, Sherry Li, and Ismail Khalil
+ * University of California at Berkeley
+ *
+ */
+
+#include "power.h"
+#include <math.h>
+
+/*----------------------------------------------------------------------*/
+/* Leaf optimization 'global' variables */
+
+ static double P=1.0;
+ static double Q=1.0;
+
+
+/*----------------------------------------------------------------------*/
+/* Leaf optimization procedures */
+
+void optimize_node (double pi_R, double pi_I);
+double find_g ();
+double find_h ();
+double find_gradient_f (double pi_R, double pi_I, local double* gradient);
+double find_gradient_g (local double* gradient);
+double find_gradient_h (local double* gradient);
+void find_dd_grad_f (double pi_R, double pi_I, local double* dd_grad);
+double make_orthogonal (local double* v_mod, local double* v_static);
+
+
+void Compute_Tree(Root r) {
+ register int i;
+ Lateral l;
+#ifndef FUTURES
+ Demand a;
+#else
+ future_cell_demand fc[NUM_FEEDERS];
+#endif
+ Demand tmp;
+ double theta_R,theta_I;
+
+ tmp.P = 0.0;
+ tmp.Q = 0.0;
+#ifndef FUTURES
+ for (i=0; i<NUM_FEEDERS; i++) {
+ l = r->feeders[i];
+ theta_R = r->theta_R;
+ theta_I = r->theta_I;
+ a = Compute_Lateral(l,theta_R,theta_I,theta_R,theta_I);
+ tmp.P += a.P;
+ tmp.Q += a.Q;
+
+ }
+#else
+ for (i=0; i<NUM_FEEDERS; i++) {
+ l = r->feeders[i];
+ theta_R = r->theta_R;
+ theta_I = r->theta_I;
+ FUTURE(l,theta_R,theta_I,theta_R,theta_I,Compute_Lateral,&fc[i]);
+ }
+ for (i=NUM_FEEDERS-1; i>=0; i--) {
+ TOUCH(&fc[i]);
+ tmp.P += fc[i].value.P;
+ tmp.Q += fc[i].value.Q;
+ }
+#endif
+ r->D.P = tmp.P;
+ r->D.Q = tmp.Q;
+}
+
+Demand Compute_Lateral(Lateral l, double theta_R, double theta_I,
+ double pi_R, double pi_I) {
+#ifndef FUTURES
+ Demand a1;
+#else
+ future_cell_demand fc;
+#endif
+ Demand a2;
+ double new_pi_R, new_pi_I;
+ double a,b,c,root;
+ Lateral next;
+ Branch br;
+
+ new_pi_R = pi_R + l->alpha*(theta_R+(theta_I*l->X)/l->R);
+ new_pi_I = pi_I + l->beta*(theta_I+(theta_R*l->R)/l->X);
+
+ next = l->next_lateral;
+ if (next != NULL)
+#ifndef FUTURES
+ a1 = Compute_Lateral(next,theta_R,theta_I,new_pi_R,new_pi_I);
+#else
+ FUTURE(next,theta_R,theta_I,new_pi_R,new_pi_I,Compute_Lateral,&fc);
+#endif
+
+ br = l->branch;
+ a2 = Compute_Branch(br,theta_R,theta_I,new_pi_R,new_pi_I);
+
+ if (next != NULL) {
+#ifndef FUTURES
+ l->D.P = a1.P + a2.P;
+ l->D.Q = a1.Q + a2.Q;
+#else
+ TOUCH(&fc);
+ l->D.P = a2.P + fc.value.P;
+ l->D.Q = a2.Q + fc.value.Q;
+#endif
+ } else {
+ l->D.P = a2.P;
+ l->D.Q = a2.Q;
+ }
+
+ /* compute P,Q */
+ a = l->R*l->R + l->X*l->X;
+ b = 2*l->R*l->X*l->D.Q - 2*l->X*l->X*l->D.P - l->R;
+ c = l->R*l->D.Q - l->X*l->D.P;
+ c = c*c + l->R*l->D.P;
+ root = (-b-sqrt(b*b-4*a*c))/(2*a);
+ l->D.Q = l->D.Q + ((root-l->D.P)*l->X)/l->R;
+ l->D.P = root;
+
+ /* compute alpha, beta */
+ a = 2*l->R*l->D.P;
+ b = 2*l->X*l->D.Q;
+ l->alpha = a/(1-a-b);
+ l->beta = b/(1-a-b);
+ return l->D;
+}
+
+Demand Compute_Branch(Branch br, double theta_R, double theta_I,
+ double pi_R, double pi_I) {
+ Demand a2,tmp;
+ double new_pi_R, new_pi_I;
+ double a,b,c,root;
+ Leaf l;
+ Branch next;
+ int i;
+#ifdef FUTURES
+ future_cell_demand fc;
+#else
+ Demand a1;
+#endif
+
+ new_pi_R = pi_R + br->alpha*(theta_R+(theta_I*br->X)/br->R);
+ new_pi_I = pi_I + br->beta*(theta_I+(theta_R*br->R)/br->X);
+
+ next = br->next_branch;
+ if (next != NULL) {
+#ifndef FUTURES
+ a1 = Compute_Branch(next,theta_R,theta_I,new_pi_R,new_pi_I);
+#else
+ FUTURE(next,theta_R,theta_I,new_pi_R,new_pi_I,Compute_Branch,&fc);
+#endif
+ }
+
+ /* Initialize tmp */
+ tmp.P = 0.0; tmp.Q = 0.0;
+
+ for (i=0; i<LEAVES_PER_BRANCH; i++) {
+ l = br->leaves[i];
+ a2 = Compute_Leaf(l,new_pi_R,new_pi_I);
+ tmp.P += a2.P;
+ tmp.Q += a2.Q;
+ }
+ if (next != NULL) {
+#ifndef FUTURES
+ br->D.P = a1.P + tmp.P;
+ br->D.Q = a1.Q + tmp.Q;
+#else
+ TOUCH(&fc);
+ br->D.P = fc.value.P + tmp.P;
+ br->D.Q = fc.value.Q + tmp.Q;
+#endif
+ } else {
+ br->D.P = tmp.P;
+ br->D.Q = tmp.Q;
+ }
+
+ /* compute P,Q */
+ a = br->R*br->R + br->X*br->X;
+ b = 2*br->R*br->X*br->D.Q - 2*br->X*br->X*br->D.P - br->R;
+ c = br->R*br->D.Q - br->X*br->D.P;
+ c = c*c + br->R*br->D.P;
+ root = (-b-sqrt(b*b-4*a*c))/(2*a);
+ br->D.Q = br->D.Q + ((root-br->D.P)*br->X)/br->R;
+ br->D.P = root;
+ /* compute alpha, beta */
+ a = 2*br->R*br->D.P;
+ b = 2*br->X*br->D.Q;
+ br->alpha = a/(1-a-b);
+ br->beta = b/(1-a-b);
+
+ return br->D;
+}
+
+Demand Compute_Leaf(Leaf l, double pi_R, double pi_I) {
+ P = l->D.P;
+ Q = l->D.Q;
+
+ optimize_node(pi_R,pi_I);
+
+ if (P<0.0) {
+ P = 0.0;
+ Q = 0.0;
+ }
+ l->D.P = P;
+ l->D.Q = Q;
+ return l->D;
+}
+
+/*----------------------------------------------------------------------*/
+
+void optimize_node (double pi_R, double pi_I)
+{
+ double g;
+ double h;
+
+ double grad_f[2];
+ double grad_g[2];
+ double grad_h[2];
+ double dd_grad_f[2];
+ double magnitude;
+
+ int i;
+ double total;
+ double max_dist;
+
+ do {
+ /* Move onto h=0 line */
+ h=find_h ();
+ if (fabs (h)>H_EPSILON) {
+ magnitude=find_gradient_h (grad_h);
+ total=h/magnitude;
+ P-=total*grad_h[0];
+ Q-=total*grad_h[1];
+ }
+
+ /* Check that g is still valid */
+ g=find_g ();
+ if (g>G_EPSILON) {
+ magnitude=find_gradient_g (grad_g);
+ find_gradient_h (grad_h);
+ magnitude*=make_orthogonal (grad_g,grad_h);
+ total=g/magnitude;
+ P-=total*grad_g[0];
+ Q-=total*grad_g[1];
+ }
+
+ /* Maximize benefit */
+ magnitude=find_gradient_f (pi_R,pi_I,grad_f);
+ find_dd_grad_f (pi_R,pi_I,dd_grad_f);
+ total=0.0;
+ for (i=0; i<2; i++)
+ total+=grad_f[i]*dd_grad_f[i];
+ magnitude/=fabs (total);
+ find_gradient_h (grad_h);
+ magnitude*=make_orthogonal (grad_f,grad_h);
+ find_gradient_g (grad_g);
+ total=0.0;
+ for (i=0; i<2; i++)
+ total+=grad_f[i]*grad_g[i];
+ if (total>0) {
+ max_dist=-find_g ()/total;
+ if (magnitude>max_dist)
+ magnitude=max_dist;
+ }
+ P+=magnitude*grad_f[0];
+ Q+=magnitude*grad_f[1];
+
+ h=find_h ();
+ g=find_g ();
+ find_gradient_f (pi_R,pi_I,grad_f);
+ find_gradient_h (grad_h);
+
+ } while (fabs (h)>H_EPSILON || g>G_EPSILON ||
+ (fabs (g)>G_EPSILON &&
+ fabs (grad_f[0]*grad_h[1]-grad_f[1]*grad_h[0])>F_EPSILON));
+}
+
+double find_g ()
+{
+ return (P*P+Q*Q-0.8);
+}
+
+double find_h ()
+{
+ return (P-5*Q);
+}
+
+double find_gradient_f (double pi_R, double pi_I, local double* gradient)
+{
+ int i;
+ double magnitude=0.0;
+
+ gradient[0]=1/(1+P)-pi_R;
+ gradient[1]=1/(1+Q)-pi_I;
+ for (i=0; i<2; i++)
+ magnitude+=gradient[i]*gradient[i];
+ magnitude=sqrt (magnitude);
+ for (i=0; i<2; i++)
+ gradient[i]/=magnitude;
+
+ return magnitude;
+}
+
+double find_gradient_g (local double* gradient)
+{
+ int i;
+ double magnitude=0.0;
+
+ gradient[0]=2*P;
+ gradient[1]=2*Q;
+ for (i=0; i<2; i++)
+ magnitude+=gradient[i]*gradient[i];
+ magnitude=sqrt (magnitude);
+ for (i=0; i<2; i++)
+ gradient[i]/=magnitude;
+
+ return magnitude;
+}
+
+double find_gradient_h (local double* gradient)
+{
+ int i;
+ double magnitude=0.0;
+
+ gradient[0]=1.0;
+ gradient[1]=-5.0;
+ for (i=0; i<2; i++)
+ magnitude+=gradient[i]*gradient[i];
+ magnitude=sqrt (magnitude);
+ for (i=0; i<2; i++)
+ gradient[i]/=magnitude;
+
+ return magnitude;
+}
+
+void find_dd_grad_f (double pi_R, double pi_I, local double* dd_grad)
+{
+ double P_plus_1_inv=1/(P+1);
+ double Q_plus_1_inv=1/(Q+1);
+ double P_grad_term=P_plus_1_inv-pi_R;
+ double Q_grad_term=Q_plus_1_inv-pi_I;
+ double grad_mag;
+
+ grad_mag=sqrt (P_grad_term*P_grad_term+Q_grad_term*Q_grad_term);
+
+ dd_grad[0]=-P_plus_1_inv*P_plus_1_inv*P_grad_term/grad_mag;
+ dd_grad[1]=-Q_plus_1_inv*Q_plus_1_inv*Q_grad_term/grad_mag;
+}
+
+double make_orthogonal (local double* v_mod, local double* v_static)
+{
+ int i;
+ double total=0.0;
+ double length=0.0;
+
+ for (i=0; i<2; i++)
+ total+=v_mod[i]*v_static[i];
+ for (i=0; i<2; i++) {
+ v_mod[i]-=total*v_static[i];
+ length+=v_mod[i]*v_mod[i];
+ }
+ length=sqrt (length);
+ for (i=0; i<2; i++)
+ v_mod[i]/=length;
+
+ if (1-total*total<0) /* Roundoff error--vectors are parallel */
+ return 0;
+
+ return sqrt (1-total*total);
+}
+
+/*----------------------------------------------------------------------*/
diff --git a/test/ccured_olden/power/main.c b/test/ccured_olden/power/main.c
new file mode 100644
index 00000000..0fb87c0f
--- /dev/null
+++ b/test/ccured_olden/power/main.c
@@ -0,0 +1,116 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* main.c
+ *
+ * By: Martin C. Carlisle
+ * 6/16/94
+ *
+ * main routine for the Power Pricing problem
+ * adapted from code by: Steve Lumetta, Sherry Li, and Ismail Khalil
+ * University of California at Berkeley
+ *
+ * Cleaned up the CM stuff. George Necula
+ */
+
+#include "power.h"
+
+/* Domain of thetaR->P map is 0.65 to 1.00 [index*0.01+0.65] */
+double map_P[36] =
+{8752.218091048, 8446.106670416, 8107.990680283,
+ 7776.191574285, 7455.920518777, 7146.602181352,
+ 6847.709026813, 6558.734204024, 6279.213382291,
+ 6008.702199986, 5746.786181029, 5493.078256495,
+ 5247.206333097, 5008.828069358, 4777.615815166,
+ 4553.258735900, 4335.470002316, 4123.971545694,
+ 3918.501939675, 3718.817618538, 3524.683625800,
+ 3335.876573044, 3152.188635673, 2973.421417103,
+ 2799.382330486, 2629.892542617, 2464.782829705,
+ 2303.889031418, 2147.054385395, 1994.132771399,
+ 1844.985347313, 1699.475053321, 1557.474019598,
+ 1418.860479043, 1283.520126656, 1151.338004216};
+
+#define MIN_THETA_R 0.65
+#define PER_INDEX_R 0.01
+#define MAX_THETA_R 0.995
+
+/* Domain of thetaI->Q map is 0.130 to 0.200 [index*0.002+0.130] */
+double map_Q[36] =
+{1768.846590190, 1706.229490046, 1637.253873079,
+ 1569.637451623, 1504.419525242, 1441.477913810,
+ 1380.700660446, 1321.980440476, 1265.218982201,
+ 1210.322424636, 1157.203306183, 1105.780028163,
+ 1055.974296746, 1007.714103979, 960.930643875,
+ 915.558722782, 871.538200178, 828.810882006,
+ 787.322098340, 747.020941334, 707.858376214,
+ 669.787829741, 632.765987756, 596.751545633,
+ 561.704466609, 527.587580585, 494.365739051,
+ 462.004890691, 430.472546686, 399.738429196,
+ 369.773787595, 340.550287137, 312.041496095,
+ 284.222260660, 257.068973074, 230.557938283};
+
+#define MIN_THETA_I 0.13
+#define PER_INDEX_I 0.002
+#define MAX_THETA_I 0.199
+
+#ifdef PLAIN
+double wallclock;
+#endif
+
+main(int argc,char *argv[])
+{
+ Root r;
+ int i,finished=0;
+ double d_theta_R,d_theta_I;
+
+ chatting("Past initialization\n");
+
+ timer_start(0);
+
+ /* initial pass */
+ r = build_tree();
+ chatting("Built tree\n");
+ Compute_Tree(r);
+ r->last.P = r->D.P;
+ r->last.Q = r->D.Q;
+ r->last_theta_R = r->theta_R;
+ r->last_theta_I = r->theta_I;
+ r->theta_R = 0.7;
+ r->theta_I = 0.14;
+
+ while (!finished) {
+ Compute_Tree(r);
+ chatting("TR=%13.9f, TI=%13.9f, P0=%13.9f, Q0=%13.9f\n",
+ r->theta_R,r->theta_I,r->D.P,r->D.Q);
+ if (fabs(r->D.P/10000.0 - r->theta_R) < ROOT_EPSILON &&
+ fabs(r->D.Q/10000.0 - r->theta_I) < ROOT_EPSILON) {
+ finished = 1;
+ } else {
+ i = (int)((r->theta_R - MIN_THETA_R) / PER_INDEX_R);
+ if (i<0) i=0;
+ if (i>35) i=35;
+ d_theta_R = -(r->theta_R - r->D.P/10000.0) /
+ (1 - (map_P[i+1] - map_P[i]) / (PER_INDEX_R * 10000.0));
+
+ i = (int)((r->theta_I - MIN_THETA_I) / PER_INDEX_I);
+ if (i<0) i=0;
+ if (i>35) i=35;
+ d_theta_I = -(r->theta_I - r->D.Q/10000.0) /
+ (1 - (map_Q[i+1] - map_Q[i]) / (PER_INDEX_I * 10000.0));
+
+ chatting("D TR-%13.9f, TI=%13.9f\n", d_theta_R,d_theta_I);
+ r->last.P = r->D.P;
+ r->last.Q = r->D.Q;
+ r->last_theta_R = r->theta_R;
+ r->last_theta_I = r->theta_I;
+ r->theta_R = r->theta_R + d_theta_R;
+ r->theta_I = r->theta_I + d_theta_I;
+ }
+ } /* while */
+ timer_stop(0);
+ chatting("Elapsed time %f\n", timer_elapsed(0));
+
+#ifdef FUTURES
+ __ShutDown(0);
+#endif
+ return 0;
+}
diff --git a/test/ccured_olden/power/out.orig b/test/ccured_olden/power/out.orig
new file mode 100644
index 00000000..ce4ccae8
--- /dev/null
+++ b/test/ccured_olden/power/out.orig
@@ -0,0 +1,37 @@
+Past initialization
+Built tree
+TR= 0.70000, TI= 0.14000, P0=7368.11283, Q0=1486.61206
+D TR- 0.00899, TI= 0.00214
+TR= 0.70899, TI= 0.14214, P0=6825.69077, Q0=1376.20403
+D TR- -0.00662, TI= -0.00114
+TR= 0.70236, TI= 0.14099, P0=7102.87981, Q0=1432.59759
+D TR- 0.00198, TI= 0.00056
+TR= 0.70435, TI= 0.14155, P0=7000.94922, Q0=1411.85085
+D TR- -0.00106, TI= -0.00009
+TR= 0.70328, TI= 0.14146, P0=7047.52523, Q0=1421.32891
+D TR- 0.00036, TI= 0.00016
+TR= 0.70365, TI= 0.14162, P0=7029.01641, Q0=1417.56197
+D TR- -0.00018, TI= 0.00003
+TR= 0.70346, TI= 0.14166, P0=7037.01709, Q0=1419.19017
+D TR- 0.00005, TI= 0.00006
+TR= 0.70352, TI= 0.14172, P0=7033.77002, Q0=1418.52933
+D TR- -0.00003, TI= 0.00003
+TR= 0.70348, TI= 0.14175, P0=7035.10974, Q0=1418.80198
+D TR- 0.00000, TI= 0.00003
+TR= 0.70349, TI= 0.14178, P0=7034.59229, Q0=1418.69667
+D TR- -0.00000, TI= 0.00002
+TR= 0.70348, TI= 0.14180, P0=7034.76550, Q0=1418.73192
+D TR- -0.00000, TI= 0.00001
+TR= 0.70348, TI= 0.14182, P0=7034.73206, Q0=1418.72511
+D TR- -0.00000, TI= 0.00001
+TR= 0.70348, TI= 0.14183, P0=7034.72701, Q0=1418.72409
+D TR- -0.00000, TI= 0.00000
+TR= 0.70347, TI= 0.14184, P0=7034.72601, Q0=1418.72388
+D TR- -0.00000, TI= 0.00000
+TR= 0.70347, TI= 0.14185, P0=7034.72675, Q0=1418.72403
+D TR- -0.00000, TI= 0.00000
+TR= 0.70347, TI= 0.14185, P0=7034.72767, Q0=1418.72422
+D TR- -0.00000, TI= 0.00000
+TR= 0.70347, TI= 0.14186, P0=7034.72812, Q0=1418.72431
+D TR- -0.00000, TI= 0.00000
+TR= 0.70347, TI= 0.14186, P0=7034.72817, Q0=1418.72432
diff --git a/test/ccured_olden/power/output b/test/ccured_olden/power/output
new file mode 100644
index 00000000..5d8d9f14
--- /dev/null
+++ b/test/ccured_olden/power/output
@@ -0,0 +1,38 @@
+Past initialization
+Built tree
+TR= 0.700000000, TI= 0.140000000, P0=7368.112832298, Q0=1486.612062522
+D TR- 0.008993314, TI= 0.002144467
+TR= 0.708993314, TI= 0.142144467, P0=6825.690778967, Q0=1376.204035288
+D TR- -0.006624389, TI= -0.001149403
+TR= 0.702368925, TI= 0.140995064, P0=7102.879810214, Q0=1432.597592989
+D TR- 0.001985258, TI= 0.000560726
+TR= 0.704354182, TI= 0.141555790, P0=7000.949225527, Q0=1411.850856419
+D TR- -0.001067770, TI= -0.000091784
+TR= 0.703286413, TI= 0.141464005, P0=7047.525235387, Q0=1421.328911557
+D TR- 0.000367545, TI= 0.000165612
+TR= 0.703653957, TI= 0.141629618, P0=7029.016413235, Q0=1417.561973965
+D TR- -0.000188601, TI= 0.000031340
+TR= 0.703465356, TI= 0.141660958, P0=7037.017091019, Q0=1419.190170854
+D TR- 0.000059252, TI= 0.000063894
+TR= 0.703524609, TI= 0.141724852, P0=7033.770028540, Q0=1418.529337079
+D TR- -0.000037004, TI= 0.000031712
+TR= 0.703487605, TI= 0.141756564, P0=7035.109740779, Q0=1418.801987979
+D TR- 0.000005859, TI= 0.000030611
+TR= 0.703493463, TI= 0.141787176, P0=7034.592291756, Q0=1418.696672935
+D TR- -0.000008582, TI= 0.000020424
+TR= 0.703484881, TI= 0.141807600, P0=7034.765506561, Q0=1418.731929644
+D TR- -0.000002088, TI= 0.000016240
+TR= 0.703482793, TI= 0.141823841, P0=7034.732061514, Q0=1418.725114927
+D TR- -0.000002403, TI= 0.000012051
+TR= 0.703480389, TI= 0.141835891, P0=7034.727015389, Q0=1418.724090079
+D TR- -0.000001927, TI= 0.000009042
+TR= 0.703478462, TI= 0.141844933, P0=7034.726010052, Q0=1418.723886296
+D TR- -0.000001469, TI= 0.000006798
+TR= 0.703476993, TI= 0.141851731, P0=7034.726755730, Q0=1418.724038175
+D TR- -0.000001082, TI= 0.000005119
+TR= 0.703475910, TI= 0.141856849, P0=7034.727670658, Q0=1418.724224195
+D TR- -0.000000788, TI= 0.000003856
+TR= 0.703475122, TI= 0.141860705, P0=7034.728128768, Q0=1418.724317198
+D TR- -0.000000579, TI= 0.000002903
+TR= 0.703474543, TI= 0.141863609, P0=7034.728179600, Q0=1418.724327425
+Elapsed time 5130.000000
diff --git a/test/ccured_olden/power/power.h b/test/ccured_olden/power/power.h
new file mode 100644
index 00000000..b8fbd2dd
--- /dev/null
+++ b/test/ccured_olden/power/power.h
@@ -0,0 +1,114 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/*
+ * power.h
+ *
+ * By: Martin C. Carlisle
+ * 6/15/94
+ *
+ * Header file for the Power Pricing problem
+ * adapted from code by Steve Lumetta, Sherry Li, and Ismail Khalil
+ * University of California at Berkeley
+ *
+ */
+
+typedef struct demand {
+ double P;
+ double Q;
+} Demand;
+
+#ifndef PLAIN
+#include "future-cell.h"
+#include "mem-ref.h"
+typedef struct fc_demand {
+ future_cell_impl impl;
+ Demand value; /* cell's value */
+ } future_cell_demand;
+#endif
+
+#ifdef PLAIN
+#include <time.h>
+#define local
+#define mymalloc malloc
+#define CMMD_node_timer_clear(x) (void)0
+#define TIMESTART(clk) {clk=(double)clock();}
+#define TIMESTOP(clk) {clk=1000000.0 * ((double)clock()-(clk))/CLOCKS_PER_SEC;}
+extern double wallclock;
+#define timer_start(x) TIMESTART(wallclock)
+#define timer_stop(x) TIMESTOP(wallclock)
+#define timer_elapsed(x) (wallclock / 1000.0)
+#endif
+
+#include "math.h"
+#include <stdlib.h> // malloc
+#include <stdio.h> // printf
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#define NUM_FEEDERS 10
+#define LATERALS_PER_FEEDER 20
+#define BRANCHES_PER_LATERAL 5
+#define LEAVES_PER_BRANCH 10
+
+#define F_EPSILON 0.000001
+#define G_EPSILON 0.000001
+#define H_EPSILON 0.000001
+#define ROOT_EPSILON 0.00001
+
+typedef struct root {
+ Demand D;
+ double theta_R;
+ double theta_I;
+ Demand last;
+ double last_theta_R;
+ double last_theta_I;
+ struct lateral *feeders[NUM_FEEDERS];
+} *Root;
+
+typedef struct lateral {
+ Demand D;
+ double alpha;
+ double beta;
+ double R;
+ double X;
+ struct lateral *next_lateral;
+ struct branch *branch;
+} *Lateral;
+
+typedef struct branch {
+ Demand D;
+ double alpha;
+ double beta;
+ double R;
+ double X;
+ struct branch *next_branch;
+ struct leaf *leaves[LEAVES_PER_BRANCH];
+} *Branch;
+
+typedef struct leaf {
+ Demand D;
+ double pi_R;
+ double pi_I;
+} *Leaf;
+
+#ifdef PLAIN
+#define ALLOC(pn,sz) malloc(sz)
+#define chatting printf
+#define __NumNodes 1
+#define __MyNodeId 0
+#endif
+
+/* Prototypes */
+Root build_tree();
+Lateral build_lateral(int i, int num);
+Branch build_branch(int i, int j, int num);
+Leaf build_leaf();
+
+void Compute_Tree(Root r);
+Demand Compute_Lateral(Lateral l, double theta_R, double theta_I,
+ double pi_R, double pi_I);
+Demand Compute_Branch(Branch b, double theta_R, double theta_I,
+ double pi_R, double pi_I);
+Demand Compute_Leaf(Leaf l, double pi_R, double pi_I);
diff --git a/test/ccured_olden/power/testit b/test/ccured_olden/power/testit
new file mode 100755
index 00000000..b5132dd7
--- /dev/null
+++ b/test/ccured_olden/power/testit
@@ -0,0 +1,26 @@
+#!/bin/sh
+# test a power binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./power.exe"
+ exit
+fi
+
+# all of power's output is to stdout
+echo "running: $1 >output"
+if ! $1 >output; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+# must strip elapsed time
+# must truncate precision to only 5 decimal places, because gcc's optimizer
+# (even with -ffloat-store) seems to change the answer under boxing
+if ! grep -v "Elapsed time" <output | \
+ sed 's/\(\.[0-9]\{5\}\)[0-9]*/\1/g' | diff out.orig - >/dev/null; then
+ echo "$1 got the wrong answer"
+ exit 4
+else
+ echo "$1 seems to work"
+fi
+ \ No newline at end of file
diff --git a/test/ccured_olden/rapportCompcert_all.txt b/test/ccured_olden/rapportCompcert_all.txt
new file mode 100644
index 00000000..18f07057
--- /dev/null
+++ b/test/ccured_olden/rapportCompcert_all.txt
@@ -0,0 +1,90 @@
+********** Répertoire bh ************************
+*************************************************
+
+../../../../ccomp -dump-c io.c
+/usr/include/stdio.h:250: Unsupported C feature: integer type specifier
+-> int fclose(FILE *); ?????
+make: *** [io.compcert] Error 2
+
+../../../../ccomp -dump-c util.c
+In file included from /usr/include/machine/param.h:30,
+ from /usr/include/sys/param.h:104,
+ from util.c:17:
+/usr/include/ppc/param.h:111:2: error: #error code not ported to little endian targets yet
+Error during preprocessing.
+make: *** [util.compcert] Error 2
+
+../../../../ccomp -dump-c getparam.c
+/usr/include/stdio.h:171: Warning: array type of unspecified size
+/usr/include/stdio.h:171: Unsupported C feature: integer type specifier
+-> extern FILE __sF[];
+make: *** [getparam.compcert] Error 2
+
+********** Répertoire bisort ********************
+*************************************************
+../../../../ccomp -dump-c bitonic.c
+bitonic.c:42: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:91: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:231: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:233: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:242: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:244: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:245: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:246: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:248: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:251: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:253: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:255: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:257: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:260: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:262: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:264: Warning: working around a call to a variadic or non-prototyped function
+bitonic.c:265: Warning: working around a call to a variadic or non-prototyped function
+Error in translation Csyntax -> PPC
+
+********** Répertoire bisort ********************
+*************************************************
+../../../../ccomp -dump-c bitonic.c
+
+même problème que pour bitonic.c du répertoire bisort.
+
+********** Répertoire health ********************
+*************************************************
+../../../../ccomp -dump-c poisson.c
+
+../../../../ccomp -dump-c list.c
+list.c:16: Unsupported C feature: ill-formed recursive structure or union
+--> void addList(struct List *list, struct Patient *patient) {
+make: *** [list.s] Error 2
+
+********** Répertoire em3d **********************
+*************************************************
+../../../../ccomp -dump-c make_graph.c
+make_graph.c:28: Warning: working around a call to a variadic or non-prototyped function
+make_graph.c:43: Warning: working around a call to a variadic or non-prototyped function
+make_graph.c:101: Warning: working around a call to a variadic or non-prototyped function
+make_graph.c:136: Unsupported C feature: return value of struct or union type
+-> graph_t initialize_graph()
+{
+ node_t **h_table;
+ node_t **e_table;
+ graph_t retval;
+................
+make: *** [make_graph.s] Error 2
+
+********** Répertoire treeadd *********************
+*************************************************
+
+node.c:38: Error: Cannot resolve variable stderr.
+-> fprintf(stderr, "Iteration %d...", i);
+
+error in doExp (Errormsg.Error)
+
+error in doExp (Errormsg.Error)
+node.c:27: Warning: working around a call to a variadic or non-prototyped function
+node.c:30: Warning: working around a call to a variadic or non-prototyped function
+node.c:32: Warning: working around a call to a variadic or non-prototyped function
+node.c:33: Warning: working around a call to a variadic or non-prototyped function
+node.c:34: Warning: working around a call to a variadic or non-prototyped function
+node.c:38: Unsupported C feature: inline assembly
+-> fprintf(stderr, "Iteration %d...", i);
diff --git a/test/ccured_olden/treeadd/.cvsignore b/test/ccured_olden/treeadd/.cvsignore
new file mode 100644
index 00000000..ea04e03d
--- /dev/null
+++ b/test/ccured_olden/treeadd/.cvsignore
@@ -0,0 +1,27 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+treeadd
+allcfiles
+ope.m
+*_comb.c
+*.exe_comb.browser
+*cured.c
+*.optim.c
+changes
+output
+out.diff
diff --git a/test/ccured_olden/treeadd/CVS/Entries b/test/ccured_olden/treeadd/CVS/Entries
new file mode 100644
index 00000000..c689f04f
--- /dev/null
+++ b/test/ccured_olden/treeadd/CVS/Entries
@@ -0,0 +1,27 @@
+/HOWTO/1.1/Fri Jun 29 11:24:14 2001//
+/HOWTO.bak/1.1/Fri Jun 29 11:24:14 2001//
+/Makefile.plain/1.1/Fri Jun 29 11:24:14 2001//
+/Makefile.ss/1.1/Fri Jun 29 11:24:14 2001//
+/args.c/1.1/Fri Jun 29 11:24:14 2001//
+/node.c/1.1/Fri Jun 29 11:24:14 2001//
+/out_20_1/1.1/Fri Jun 29 11:24:14 2001//
+/out_20_1.mac_cnt/1.1/Fri Jun 29 11:24:14 2001//
+/out_20_1.mac_cnt_sil/1.1/Fri Jun 29 11:24:14 2001//
+/out_20_1.mac_nocnt_sil/1.1/Fri Jun 29 11:24:14 2001//
+/out_20_1.nm_nocnt/1.1/Fri Jun 29 11:24:14 2001//
+/out_20_1.nwm_nocnt/1.1/Fri Jun 29 11:24:14 2001//
+/out_22_1/1.1/Fri Jun 29 11:24:14 2001//
+/out_22_1.mac_nocnt_sil/1.1/Fri Jun 29 11:24:14 2001//
+/out_23_1/1.1/Fri Jun 29 11:24:14 2001//
+/out_23_1.mac_nocnt_sil/1.1/Fri Jun 29 11:24:14 2001//
+/out_25_1/1.1/Fri Jun 29 11:24:14 2001//
+/out_25_1.mac_nocnt_sil/1.1/Fri Jun 29 11:24:14 2001//
+/par-alloc.c/1.1/Fri Jun 29 11:24:14 2001//
+/tree.h/1.1/Fri Jun 29 11:24:14 2001//
+/ssplain.c/1.5/Sat Nov 3 05:33:28 2001//
+/Makefile/1.6/Fri Nov 9 01:27:01 2001//
+/out.orig/1.1/Mon Nov 12 08:08:28 2001//
+/testit/1.2/Tue Dec 4 05:07:50 2001//
+/.cvsignore/1.9/Fri Oct 4 16:28:44 2002//
+/ssplain.h/1.6/Mon Jan 6 23:29:45 2003//
+D/old-exe////
diff --git a/test/ccured_olden/treeadd/CVS/Repository b/test/ccured_olden/treeadd/CVS/Repository
new file mode 100644
index 00000000..6d2ed236
--- /dev/null
+++ b/test/ccured_olden/treeadd/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/treeadd
diff --git a/test/ccured_olden/treeadd/CVS/Root b/test/ccured_olden/treeadd/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/treeadd/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/treeadd/HOWTO b/test/ccured_olden/treeadd/HOWTO
new file mode 100644
index 00000000..d456a9ee
--- /dev/null
+++ b/test/ccured_olden/treeadd/HOWTO
@@ -0,0 +1 @@
+21 1
diff --git a/test/ccured_olden/treeadd/HOWTO.bak b/test/ccured_olden/treeadd/HOWTO.bak
new file mode 100644
index 00000000..bfd056e3
--- /dev/null
+++ b/test/ccured_olden/treeadd/HOWTO.bak
@@ -0,0 +1 @@
+20 1
diff --git a/test/ccured_olden/treeadd/Makefile b/test/ccured_olden/treeadd/Makefile
new file mode 100644
index 00000000..f17f1155
--- /dev/null
+++ b/test/ccured_olden/treeadd/Makefile
@@ -0,0 +1,38 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = treeadd.exe
+FILES = par-alloc node args ssplain
+
+
+OLDENHOME = /tmp/olden
+
+CC = gcc
+
+SRC = .c
+OBJ = .o
+ASM = .s
+SRCS = $(addsuffix $(SRC),$(FILES))
+OBJS = $(addsuffix $(OBJ),$(FILES))
+ASMS = $(addsuffix $(ASM),$(FILES))
+INCDIRS = /usr/include
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN #-I$(OLDENHOME)/common
+OPTFLAGS = -g -Wall -O3
+
+LIBS = -lm
+LIBPATH =
+
+$(BINARY): $(OBJS)
+ $(CC) $(LDFALGS) $(OPTFLAGS) -o $@ $(OBJS) $(LIBPATH) $(LIBS)
+
+$(SRC)$(OBJ):
+ $(CC) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) -c $<
+
+clean:
+ rm -f $(BINARY) $(OBJS) $(ASMS) *~ *.light.c
+
+links:
+ /bin/rm -f ssplain.[hc]
+ ln -s $(OLDENHOME)/common/ssplain.h
+ ln -s $(OLDENHOME)/common/ssplain.c
diff --git a/test/ccured_olden/treeadd/Makefile.plain b/test/ccured_olden/treeadd/Makefile.plain
new file mode 100644
index 00000000..5083bd76
--- /dev/null
+++ b/test/ccured_olden/treeadd/Makefile.plain
@@ -0,0 +1,8 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = treeadd
+FILES = par-alloc node args ssplain
+
+include ../Makefile.plain
+
+
diff --git a/test/ccured_olden/treeadd/Makefile.ss b/test/ccured_olden/treeadd/Makefile.ss
new file mode 100644
index 00000000..7d3b7d23
--- /dev/null
+++ b/test/ccured_olden/treeadd/Makefile.ss
@@ -0,0 +1,10 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = treeadd
+FILES = par-alloc node args ssplain
+
+MY_CDEFS = -DOLDEN
+
+include ../Makefile.ss
+
+
diff --git a/test/ccured_olden/treeadd/args.c b/test/ccured_olden/treeadd/args.c
new file mode 100644
index 00000000..279f2d12
--- /dev/null
+++ b/test/ccured_olden/treeadd/args.c
@@ -0,0 +1,47 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#else SS_PLAIN
+#include <cm/cmmd.h>
+#include <fcntl.h>
+
+extern int __NumNodes;
+#endif SS_PLAIN
+
+#include "tree.h"
+
+void filestuff()
+{
+#ifndef SS_PLAIN
+ CMMD_fset_io_mode(stdout, CMMD_independent);
+ fcntl(fileno(stdout), F_SETFL, O_APPEND);
+ if (CMMD_self_address()) exit(0);
+ __InitRegs(0);
+#endif SS_PLAIN
+}
+
+int level;
+int iters;
+
+int dealwithargs(int argc, char *argv[])
+{
+#ifndef SS_PLAIN
+ if (argc > 3)
+ __NumNodes = atoi(argv[2]);
+ else
+ __NumNodes = 4;
+#endif SS_PLAIN
+
+ if (argc > 2)
+ iters = atoi(argv[2]);
+ else
+ iters = 1;
+
+ if (argc > 1)
+ level = atoi(argv[1]);
+ else
+ level = 5;
+
+ return level;
+}
diff --git a/test/ccured_olden/treeadd/node.c b/test/ccured_olden/treeadd/node.c
new file mode 100644
index 00000000..1e609132
--- /dev/null
+++ b/test/ccured_olden/treeadd/node.c
@@ -0,0 +1,74 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* node.c
+ */
+#include <stdio.h>
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+#include "tree.h"
+
+
+int dealwithargs(int argc, char *argv[]);
+
+typedef struct {
+ long level;
+} startmsg_t;
+
+int TreeAdd (/* tree_t *t */);
+extern tree_t *TreeAlloc (/* int level */);
+
+main (int argc, char *argv[])
+{
+ tree_t *root;
+ int i, result = 0;
+
+ filestuff();
+ (void)dealwithargs(argc, argv);
+
+ chatting("Treeadd with %d levels\n", level);
+
+ chatting("About to enter TreeAlloc\n");
+ root = TreeAlloc (level);
+ chatting("About to enter TreeAdd\n");
+
+ for (i = 0; i < iters; i++)
+ {
+ fprintf(stderr, "Iteration %d...", i);
+ result = TreeAdd (root);
+ fprintf(stderr, "done\n");
+ }
+
+ chatting("Received result of %d\n",result);
+ exit(0);
+}
+
+/* TreeAdd:
+ */
+int TreeAdd (t)
+ register tree_t *t;
+{
+ if (t == NULL)
+ {
+ return 0;
+ }
+ else
+ {
+ int leftval;
+ int rightval;
+ tree_t *tleft, *tright;
+ int value;
+
+ tleft = t->left;
+ leftval = TreeAdd(tleft);
+ tright = t->right;
+ rightval = TreeAdd(tright);
+
+ value = t->val;
+ return leftval + rightval + value;
+ }
+} /* end of TreeAdd */
+
+
+
diff --git a/test/ccured_olden/treeadd/old-exe/CVS/Entries b/test/ccured_olden/treeadd/old-exe/CVS/Entries
new file mode 100644
index 00000000..17848105
--- /dev/null
+++ b/test/ccured_olden/treeadd/old-exe/CVS/Entries
@@ -0,0 +1 @@
+D
diff --git a/test/ccured_olden/treeadd/old-exe/CVS/Repository b/test/ccured_olden/treeadd/old-exe/CVS/Repository
new file mode 100644
index 00000000..9518434e
--- /dev/null
+++ b/test/ccured_olden/treeadd/old-exe/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/treeadd/old-exe
diff --git a/test/ccured_olden/treeadd/old-exe/CVS/Root b/test/ccured_olden/treeadd/old-exe/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/treeadd/old-exe/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/treeadd/out.diff b/test/ccured_olden/treeadd/out.diff
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ccured_olden/treeadd/out.diff
diff --git a/test/ccured_olden/treeadd/out.orig b/test/ccured_olden/treeadd/out.orig
new file mode 100644
index 00000000..fde5b808
--- /dev/null
+++ b/test/ccured_olden/treeadd/out.orig
@@ -0,0 +1,5 @@
+Treeadd with 21 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 2097151
diff --git a/test/ccured_olden/treeadd/out_20_1 b/test/ccured_olden/treeadd/out_20_1
new file mode 100644
index 00000000..3ece101b
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_20_1
@@ -0,0 +1,10 @@
+1.83u 0.32s 0:02.28 94.2%
+
+Treeadd with 20 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 1048575
+
+1.83u 0.32s 0:02.28 94.2%
+
diff --git a/test/ccured_olden/treeadd/out_20_1.mac_cnt b/test/ccured_olden/treeadd/out_20_1.mac_cnt
new file mode 100644
index 00000000..c71bf72b
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_20_1.mac_cnt
@@ -0,0 +1,28 @@
+58.54u 1.33s 1:00.23 99.4%
+
+[/usr/include/stdio.h:201.1] WARNING: extern with incomplete type not initialized
+[/usr/include/stdio.h:230.1] WARNING: extern with incomplete type not initialized
+[/usr/include/stdlib.h:119.1] WARNING: extern with incomplete type not initialized
+[/usr/include/stdio.h:201.1] WARNING: extern with incomplete type not initialized
+Note: strictPointer mode is OFF
+Note: stack grows decreasingly!
+Treeadd with 20 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 1048575
+Total time: 58.540 u, 1.310 s
+Call init functions: 0.000 u, 0.000 s
+Process externs: 0.000 u, 0.010 s
+Prog_main: 58.530 u, 1.300 s
+processReturns : tot 5242883, empty 5242878, common 5
+Macro counts (function counts):
+verifyPtr : char 0(0), aggr 0(0), etc 6291452(3145725)
+verifyTag : char 0(0), aggr 0(0), etc 19922937(0)
+ copyTag : char 0(0), aggr 0(0), etc 16777218(3145725)
+ setScalarTag : char 0(0), etc 11534344(0)
+setScalarUninitTag : char 0(0), etc 8388607(0)
+processArgTag : scalar 5242883(0) (promo 0), aggr 0(0)
+
+58.54u 1.33s 1:00.23 99.4%
+
diff --git a/test/ccured_olden/treeadd/out_20_1.mac_cnt_sil b/test/ccured_olden/treeadd/out_20_1.mac_cnt_sil
new file mode 100644
index 00000000..6cc96e0d
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_20_1.mac_cnt_sil
@@ -0,0 +1,22 @@
+58.02u 1.24s 0:59.66 99.3%
+
+Treeadd with 20 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 1048575
+Total time: 58.010 u, 1.230 s
+Call init functions: 0.000 u, 0.000 s
+Process externs: 0.000 u, 0.000 s
+Prog_main: 58.000 u, 1.230 s
+processReturns : tot 5242883, empty 5242878, common 5
+Macro counts (function counts):
+verifyPtr : char 0(0), aggr 0(0), etc 6291452(3145725)
+verifyTag : char 0(0), aggr 0(0), etc 19922937(0)
+ copyTag : char 0(0), aggr 0(0), etc 16777218(3145725)
+ setScalarTag : char 0(0), etc 11534344(0)
+setScalarUninitTag : char 0(0), etc 8388607(0)
+processArgTag : scalar 5242883(0) (promo 0), aggr 0(0)
+
+58.02u 1.24s 0:59.66 99.3%
+
diff --git a/test/ccured_olden/treeadd/out_20_1.mac_nocnt_sil b/test/ccured_olden/treeadd/out_20_1.mac_nocnt_sil
new file mode 100644
index 00000000..66ea6134
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_20_1.mac_nocnt_sil
@@ -0,0 +1,15 @@
+51.89u 1.42s 0:53.59 99.4%
+
+Treeadd with 20 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 1048575
+Total time: 51.890 u, 1.390 s
+Call init functions: 0.000 u, 0.000 s
+Process externs: 0.000 u, 0.000 s
+Prog_main: 51.880 u, 1.390 s
+processReturns : tot 5242883, empty 5242878, common 5
+
+51.89u 1.42s 0:53.59 99.4%
+
diff --git a/test/ccured_olden/treeadd/out_20_1.nm_nocnt b/test/ccured_olden/treeadd/out_20_1.nm_nocnt
new file mode 100644
index 00000000..6de580b0
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_20_1.nm_nocnt
@@ -0,0 +1,17 @@
+3[/usr/include/stdio.h:201.1]
+3[/usr/include/stdio.h:230.1]
+3[/usr/include/stdlib.h:119.1]
+3[/usr/include/stdio.h:201.1]
+Note: strictPointer mode is OFF
+Note: stack grows decreasingly!
+Treeadd with 20 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 1048575
+Total time: 47.640 u, 1.080 s
+Call init functions: 0.000 u, 0.000 s
+Process externs: 0.000 u, 0.010 s
+Prog_main: 47.640 u, 1.060 s
+processReturns : tot 5242883, empty 5242878, common 5
+47.64u 1.10s 0:52.27 93.2%
diff --git a/test/ccured_olden/treeadd/out_20_1.nwm_nocnt b/test/ccured_olden/treeadd/out_20_1.nwm_nocnt
new file mode 100644
index 00000000..c68935f6
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_20_1.nwm_nocnt
@@ -0,0 +1,6 @@
+Treeadd with 20 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 1048575
+48.41u 1.28s 0:49.87 99.6%
diff --git a/test/ccured_olden/treeadd/out_22_1 b/test/ccured_olden/treeadd/out_22_1
new file mode 100644
index 00000000..8a7794dd
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_22_1
@@ -0,0 +1,10 @@
+7.00u 3.06s 0:10.29 97.7%
+
+Treeadd with 22 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 4194303
+
+7.00u 3.06s 0:10.29 97.7%
+
diff --git a/test/ccured_olden/treeadd/out_22_1.mac_nocnt_sil b/test/ccured_olden/treeadd/out_22_1.mac_nocnt_sil
new file mode 100644
index 00000000..614d3acb
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_22_1.mac_nocnt_sil
@@ -0,0 +1,15 @@
+208.87u 14.48s 13:01.91 28.5%
+
+Treeadd with 22 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 4194303
+Total time: 208.870 u, 14.430 s
+Call init functions: 0.000 u, 0.000 s
+Process externs: 0.000 u, 0.000 s
+Prog_main: 208.850 u, 14.430 s
+processReturns : tot 20971523, empty 20971518, common 5
+
+208.87u 14.48s 13:01.91 28.5%
+
diff --git a/test/ccured_olden/treeadd/out_23_1 b/test/ccured_olden/treeadd/out_23_1
new file mode 100644
index 00000000..bba776e0
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_23_1
@@ -0,0 +1,10 @@
+13.85u 9.47s 0:23.97 97.2%
+
+Treeadd with 23 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 8388607
+
+13.85u 9.47s 0:23.97 97.2%
+
diff --git a/test/ccured_olden/treeadd/out_23_1.mac_nocnt_sil b/test/ccured_olden/treeadd/out_23_1.mac_nocnt_sil
new file mode 100644
index 00000000..378b40cc
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_23_1.mac_nocnt_sil
@@ -0,0 +1,15 @@
+415.79u 41.59s 25:49.99 29.5%
+
+Treeadd with 23 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 8388607
+Total time: 415.790 u, 41.570 s
+Call init functions: 0.000 u, 0.000 s
+Process externs: 0.000 u, 0.000 s
+Prog_main: 415.780 u, 41.570 s
+processReturns : tot 41943043, empty 41943038, common 5
+
+415.79u 41.59s 25:49.99 29.5%
+
diff --git a/test/ccured_olden/treeadd/out_25_1 b/test/ccured_olden/treeadd/out_25_1
new file mode 100644
index 00000000..03a8d49f
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_25_1
@@ -0,0 +1,8 @@
+Treeadd with 25 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 33554431
+
+out_25_1: about 5-6 minutes (lost the exact timing)
+
diff --git a/test/ccured_olden/treeadd/out_25_1.mac_nocnt_sil b/test/ccured_olden/treeadd/out_25_1.mac_nocnt_sil
new file mode 100644
index 00000000..a688a081
--- /dev/null
+++ b/test/ccured_olden/treeadd/out_25_1.mac_nocnt_sil
@@ -0,0 +1,7 @@
+Some output (through starting TreeAlloc), then:
+
+[1] Segmentation fault treeadd-mac_nocnt_sil.instr 25 1 >& out_25_1.mac_nocnt_sil
+656.30u 109.95s 12:55.55 98.8%
+
+out_25_1: about 5-6 minutes (lost the output)
+
diff --git a/test/ccured_olden/treeadd/output b/test/ccured_olden/treeadd/output
new file mode 100644
index 00000000..fde5b808
--- /dev/null
+++ b/test/ccured_olden/treeadd/output
@@ -0,0 +1,5 @@
+Treeadd with 21 levels
+About to enter TreeAlloc
+About to enter TreeAdd
+Iteration 0...done
+Received result of 2097151
diff --git a/test/ccured_olden/treeadd/par-alloc.c b/test/ccured_olden/treeadd/par-alloc.c
new file mode 100644
index 00000000..4749e195
--- /dev/null
+++ b/test/ccured_olden/treeadd/par-alloc.c
@@ -0,0 +1,33 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* tree-alloc.c
+ */
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+#include "tree.h"
+
+
+tree_t *TreeAlloc (level)
+ int level;
+{
+
+ if (level == 0)
+ {
+ return NULL;
+ }
+ else
+ {
+ struct tree *new, *right, *left;
+
+ new = (struct tree *) mymalloc(sizeof(tree_t));
+ left = TreeAlloc(level-1);
+ right=TreeAlloc(level-1);
+ new->val = 1;
+ new->left = (struct tree *) left;
+ new->right = (struct tree *) right;
+ return new;
+ }
+}
diff --git a/test/ccured_olden/treeadd/ssplain.c b/test/ccured_olden/treeadd/ssplain.c
new file mode 100644
index 00000000..18c8a721
--- /dev/null
+++ b/test/ccured_olden/treeadd/ssplain.c
@@ -0,0 +1,70 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+
+void chatting(char *s, ...)
+{
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
+
+#ifndef BEFOREBOX
+static unsigned long bytes_allocated = 0;
+static unsigned long allocations = 0;
+
+void*
+ssplain_malloc(int size)
+{
+ allocations++;
+ bytes_allocated+=size;
+ return malloc(size);
+}
+
+void*
+ssplain_calloc(int nelems, int size)
+{
+ void *p;
+ allocations++;
+ bytes_allocated+= nelems * size;
+ p = calloc(nelems, size);
+ if(! p) { printf("Cannot allocate\n"); exit(3); }
+ return p;
+}
+
+void
+ssplain_alloc_stats()
+{
+ chatting("Allocation stats: %d bytes allocated in %d allocations\n",
+ bytes_allocated, allocations);
+}
+#endif
diff --git a/test/ccured_olden/treeadd/ssplain.h b/test/ccured_olden/treeadd/ssplain.h
new file mode 100644
index 00000000..865fbf47
--- /dev/null
+++ b/test/ccured_olden/treeadd/ssplain.h
@@ -0,0 +1,128 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+#pragma ccuredvararg("chatting", printf(1))
+void chatting(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/treeadd/testit b/test/ccured_olden/treeadd/testit
new file mode 100755
index 00000000..031c54bd
--- /dev/null
+++ b/test/ccured_olden/treeadd/testit
@@ -0,0 +1,22 @@
+#!/bin/sh
+# test a treeadd binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./treeadd.exe"
+ exit
+fi
+
+# all of treeadd's output is to stderr
+echo "running: $1 21 1 2>output"
+if ! $1 21 1 2>output; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+if ! diff out.orig output >out.diff; then
+ echo "$1 got the wrong answer. See out.diff"
+ exit 4
+else
+ echo "$1 seems to work"
+fi
+ \ No newline at end of file
diff --git a/test/ccured_olden/treeadd/tree.h b/test/ccured_olden/treeadd/tree.h
new file mode 100644
index 00000000..39b141dc
--- /dev/null
+++ b/test/ccured_olden/treeadd/tree.h
@@ -0,0 +1,18 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/* tree.h
+ */
+
+typedef struct tree {
+ int val;
+ struct tree *left, *right;
+} tree_t;
+
+#ifndef SS_PLAIN
+#define NULL 0
+#endif SS_PLAIN
+
+extern tree_t *TreeAlloc (/*int level*/);
+
+extern int level;
+extern int iters;
diff --git a/test/ccured_olden/tsp/.cvsignore b/test/ccured_olden/tsp/.cvsignore
new file mode 100644
index 00000000..83a0e7b9
--- /dev/null
+++ b/test/ccured_olden/tsp/.cvsignore
@@ -0,0 +1,28 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+changes.out
+tsp.cil
+tsp.*box
+allcfiles
+ope.m
+ope.m
+*cured.c
+*.optim.c
+*_comb.c
+changes
+*.browser
diff --git a/test/ccured_olden/tsp/CVS/Entries b/test/ccured_olden/tsp/CVS/Entries
new file mode 100644
index 00000000..92dedef2
--- /dev/null
+++ b/test/ccured_olden/tsp/CVS/Entries
@@ -0,0 +1,8 @@
+/Makefile/1.4/Sun Jul 8 14:10:47 2001//
+/README/1.1/Tue Jun 12 04:31:21 2001//
+/tsp.c/1.1/Tue Jun 12 04:31:21 2001//
+/tsp.h/1.1/Tue Jun 12 04:31:21 2001//
+/main.c/1.5/Mon Mar 18 23:18:46 2002//
+/build.c/1.3/Wed May 29 03:29:06 2002//
+/.cvsignore/1.11/Wed Jul 31 19:35:08 2002//
+D
diff --git a/test/ccured_olden/tsp/CVS/Repository b/test/ccured_olden/tsp/CVS/Repository
new file mode 100644
index 00000000..feb9fc46
--- /dev/null
+++ b/test/ccured_olden/tsp/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/tsp
diff --git a/test/ccured_olden/tsp/CVS/Root b/test/ccured_olden/tsp/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/tsp/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/tsp/Makefile b/test/ccured_olden/tsp/Makefile
new file mode 100644
index 00000000..a27d6db9
--- /dev/null
+++ b/test/ccured_olden/tsp/Makefile
@@ -0,0 +1,44 @@
+CC = gcc
+
+#CFLAGS =
+CFLAGS = -O2
+
+# sm
+PLAIN=1
+all: defaulttarget
+
+ifdef PLAIN
+ifdef _MSVC
+EXTOBJ = .obj
+OBJOUT = /Fo
+EXEOUT = /Fe
+CFLAGS = /DPLAIN
+CONLY = /c
+CC = cl
+else
+EXTOBJ = .o
+OBJOUT = -o
+EXEOUT = -o
+CFLAGS += -DPLAIN
+CONLY = -c
+CC = gcc
+MATH = -lm
+endif
+
+MYOBJS = tsp$(EXTOBJ) build$(EXTOBJ) main$(EXTOBJ)
+
+%$(EXTOBJ) : %.c
+ $(CC) $(CONLY) $(CFLAGS) $< $(OBJOUT)$@
+
+
+defaulttarget: $(MYOBJS)
+ $(CC) $(CFLAGS) $(MYOBJS) $(EXTRA_LIBS) $(EXEOUT)tsp.exe $(MATH)
+endif
+
+
+
+clean:
+ rm -f $(TARGET) $(OBJS) *.o *.obj *.exe *~ .make.state .nse_depinfo
+
+
+
diff --git a/test/ccured_olden/tsp/README b/test/ccured_olden/tsp/README
new file mode 100644
index 00000000..29e34d88
--- /dev/null
+++ b/test/ccured_olden/tsp/README
@@ -0,0 +1,22 @@
+/* For copyright information, see olden_v1.01/COPYRIGHT */
+**********************
+olden_v1.01/benchmarks/tsp/README
+June 1996
+Martin C. Carlisle
+
+this directory contains the Traveling Salesman benchmark:
+
+Adapted for Olden from code by J. Muller using algorithm by:
+
+R. Karp, "Probabilistic analysis of partitioning algorithms for the traveling-
+salesman problem in the plane." Mathematics of Operations Research
+2(3):209-224, August 1977
+
+**********************
+
+Makefile - use "make tsp" to create executable
+
+args.c - process command line args
+build.c - build cities tree
+tsp.[ch] - compute tsp
+main.c - main routine
diff --git a/test/ccured_olden/tsp/build.c b/test/ccured_olden/tsp/build.c
new file mode 100644
index 00000000..090439bc
--- /dev/null
+++ b/test/ccured_olden/tsp/build.c
@@ -0,0 +1,124 @@
+/* build.c
+ *
+ * By: Martin C. Carlisle
+ * Princeton University
+ * 6/24/94
+ *
+ * builds a two-dimensional tree for TSP
+ *
+ * distribution of median is given by modification of exponential to
+ * be [-1,1]
+ */
+
+#include <stdio.h>
+
+extern double drand48();
+extern void srand48(long seedval);
+extern double exp(double x);
+extern double log(double x);
+#define M_E 2.7182818284590452354
+#define M_E2 7.3890560989306502274
+#define M_E3 20.08553692318766774179
+#define M_E6 403.42879349273512264299
+#define M_E12 162754.79141900392083592475
+#ifndef NULL
+#define NULL 0
+#endif
+
+#include "tsp.h"
+#include <stdlib.h>
+
+#ifndef PLAIN
+#include "mem-ref.h"
+#ifdef FUTURES
+#include "future-cell.h"
+#endif
+#endif
+
+static double median(double min,double max,int n);
+static double uniform(double min, double max);
+
+double drand48(void) {
+ return (double)rand() / (double)RAND_MAX;
+}
+
+/* Return an estimate of median of n values distributed in [min,max) */
+static double median(double min,double max,int n) {
+ double t;
+ double retval;
+
+ t = drand48(); /* in [0.0,1.0) */
+ if (t>0.5) {
+ retval=log(1.0-(2.0*(M_E12-1)*(t-0.5)/M_E12))/12.0;
+ }
+ else {
+ retval=-log(1.0-(2.0*(M_E12-1)*t/M_E12))/12.0;
+ }
+ /* We now have something distributed on (-1.0,1.0) */
+ retval = (retval+1.0) * (max-min)/2.0;
+ retval = retval + min;
+ return retval;
+}
+
+/* Get double uniformly distributed over [min,max) */
+static double uniform(double min, double max) {
+ double retval;
+
+ retval = drand48(); /* in [0.0,1.0) */
+ retval = retval * (max-min);
+ return retval + min;
+}
+
+/* Builds a 2D tree of n nodes in specified range with dir as primary
+ axis (0 for x, 1 for y) */
+// post:
+// if n!=0, make a node, set its left & right to valid or null,
+// set next/prev to null; if n==0 return null
+Tree build_tree(int n,int dir,int lo,int num_proc,double min_x,
+ double max_x,double min_y,double max_y) {
+ double med;
+ Tree t;
+#ifdef FUTURES
+ future_cell_int fc;
+#endif
+
+ if (n==0) return NULL;
+
+ t = (Tree) malloc(sizeof(*t));
+ if (dir) {
+ dir = !dir;
+ med = median(min_x,max_x,n);
+#ifndef FUTURES
+ t->left=build_tree(n/2,dir,lo+num_proc/2,num_proc/2,min_x,med,min_y,max_y);
+ t->right=build_tree(n/2,dir,lo,num_proc/2,med,max_x,min_y,max_y);
+#else
+ FUTURE(n/2,dir,lo+num_proc/2,num_proc/2,min_x,med,min_y,max_y,
+ build_tree,&fc);
+ t->right=build_tree(n/2,dir,lo,num_proc/2,med,max_x,min_y,max_y);
+#endif
+ t->x = med;
+ t->y = uniform(min_y,max_y);
+ }
+ else {
+ dir = !dir;
+ med = median(min_y,max_y,n);
+#ifndef FUTURES
+ t->left=build_tree(n/2,dir,lo+num_proc/2,num_proc/2,min_x,max_x,min_y,med);
+ t->right=build_tree(n/2,dir,lo,num_proc/2,min_x,max_x,med,max_y);
+#else
+ FUTURE(n/2,dir,lo+num_proc/2,num_proc/2,min_x,max_x,min_y,med,
+ build_tree,&fc);
+ t->right=build_tree(n/2,dir,lo,num_proc/2,min_x,max_x,med,max_y);
+#endif
+ t->y = med;
+ t->x = uniform(min_x,max_x);
+ }
+ t->sz = n;
+ t->next = NULL;
+ t->prev = NULL;
+#ifdef FUTURES
+ TOUCH(&fc);
+ t->left = (Tree) fc.value;
+#endif
+ return t;
+}
diff --git a/test/ccured_olden/tsp/main.c b/test/ccured_olden/tsp/main.c
new file mode 100644
index 00000000..3bd5679a
--- /dev/null
+++ b/test/ccured_olden/tsp/main.c
@@ -0,0 +1,101 @@
+#include "tsp.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef PLAIN
+#include <cm/cmmd.h>
+#include "mem-ref.h"
+#endif
+
+#ifdef VERIFY_AFFINITIES
+#include "affinity.h"
+CHECK2(Tree,left,right,tree)
+#endif
+
+int flag;
+int __NumNodes, __NDim;
+
+int mylog(int num)
+{
+ int j=0,k=1;
+
+ while(k<num) { k*=2; j++; }
+ return j;
+}
+
+int dealwithargs(void)
+{
+ int num;
+
+ flag = 0;
+ __NumNodes = 4;
+
+ __NDim = mylog(__NumNodes);
+
+ num = 150000;
+
+ return num;
+}
+
+void print_tree(Tree t)
+{
+ Tree left,right;
+ double x,y;
+
+ if (!t) return;
+ x = t->x; y = t->y;
+ chatting("x=%f,y=%f\n",x,y);
+ left = t->left; right=t->right;
+ print_tree(left);
+ print_tree(right);
+}
+
+void print_list(Tree t)
+{
+ Tree tmp;
+ double x,y;
+
+ if (!t) return;
+ x = t->x; y = t->y;
+ chatting("%f %f\n",x,y);
+ for (tmp=t->next; tmp!=t; tmp=tmp->next)
+ {
+ x = tmp->x; y = tmp->y;
+ chatting("%f %f\n",x,y);
+ }
+}
+
+double wallclock;
+
+int main()
+{
+ Tree t;
+ int num;
+
+ num = dealwithargs();
+
+ chatting("Building tree of size %d\n",num);
+ t=build_tree(num,0,0,__NumNodes,0.0,1.0,0.0,1.0);
+#ifdef VERIFY_AFFINITIES
+ Docheck_tree(t);
+#endif
+ if (!flag) chatting("Past build\n");
+ if (flag) chatting("newgraph\n");
+ if (flag) chatting("newcurve pts\n");
+
+
+ timer_start(0);
+ tsp(t,150,__NumNodes);
+ timer_stop(0);
+ if (flag) print_list(t);
+ if (flag) chatting("linetype solid\n");
+ chatting("Time for TSP = %f\n", timer_elapsed(0));
+#ifdef VERIFY_AFFINITIES
+ Print_Accumulated_list();
+#endif
+
+#ifdef FUTURES
+ __ShutDown(0);
+#endif
+ exit(0);
+}
diff --git a/test/ccured_olden/tsp/tsp.c b/test/ccured_olden/tsp/tsp.c
new file mode 100644
index 00000000..5f371c86
--- /dev/null
+++ b/test/ccured_olden/tsp/tsp.c
@@ -0,0 +1,308 @@
+#include "tsp.h"
+
+#ifndef PLAIN
+#include "mem-ref.h"
+#ifdef FUTURES
+#include "future-cell.h"
+#endif
+#endif
+
+#ifndef PLAIN
+#define NULL 0
+#endif
+
+#ifdef VERIFY_AFFINITIES
+#include "affinity.h"
+CHECK1_ACCUM(Tree,next,list)
+#endif
+
+static Tree conquer(Tree t);
+static Tree merge(Tree a, Tree b, Tree t, int nproc);
+static Tree makelist(Tree t);
+static void reverse(Tree t);
+static double distance(Tree a, Tree b);
+extern double sqrt(double a);
+
+/* Find Euclidean distance from a to b */
+static double distance(Tree a, Tree b) {
+ double ax,ay,bx,by;
+
+ ax = a->x; ay = a->y;
+ bx = b->x; by = b->y;
+ return (sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)));
+}
+
+/* sling tree nodes into a list -- requires root to be tail of list */
+/* only fills in next field, not prev */
+static Tree makelist(Tree t) {
+ Tree left, right;
+ Tree tleft,tright;
+ Tree retval = t;
+
+ if (!t) return NULL;
+
+ /*chatting("makelist\n");*/
+ left = makelist(t->left); /* head of left list */
+ right = makelist(t->right); /* head of right list */
+
+ if (right) { retval = right; tright = t->right; tright->next = t; }
+ if (left) { retval=left; tleft=t->left; tleft->next = (right) ? right : t; }
+ t->next = NULL;
+ /*chatting("end makelist\n");*/
+
+ return retval;
+}
+
+/* reverse orientation of list */
+static void reverse(Tree t) {
+ Tree prev,back,next,tmp;
+
+ if (!t) return;
+ /*chatting("REVERSE\n");*/
+ /*print_list(t);*/
+ prev = t->prev;
+ prev->next = NULL;
+ t->prev = NULL;
+ back = t;
+ tmp = t;
+ for (t=t->next; t; back=t,t=next) {
+ next = t->next;
+ t->next = back;
+ back->prev = t;
+ }
+ tmp->next = prev;
+ prev->prev = tmp;
+ /*printf("REVERSE result\n");*/
+ /*print_list(tmp);*/
+ /*printf("End REVERSE\n");*/
+}
+
+/* Use closest-point heuristic from Cormen Leiserson and Rivest */
+static Tree conquer(Tree t) {
+ Tree cycle,tmp,min,prev,next,donext;
+ double mindist,test;
+ double mintonext, mintoprev, ttonext, ttoprev;
+
+ if (!t) return NULL;
+ t=makelist(t);
+
+ /*printf("CONQUER\n");*/
+ /* Create initial cycle */
+ cycle = t;
+ t = t->next;
+ cycle->next = cycle;
+ cycle->prev = cycle;
+
+ for (; t; t=donext) { /* loop over remaining points */
+ donext = t->next; /* value won't be around later */
+ min = cycle;
+ mindist = distance(t,cycle);
+ for (tmp=cycle->next; tmp!=cycle; tmp=tmp->next) {
+ test = distance(tmp,t);
+ if (test < mindist) {
+ mindist = test;
+ min = tmp;
+ } /* if */
+ } /* for tmp... */
+ next = min->next;
+ prev = min->prev;
+ mintonext = distance(min,next);
+ mintoprev = distance(min,prev);
+ ttonext = distance(t,next);
+ ttoprev = distance(t,prev);
+ if ((ttoprev - mintoprev) < (ttonext - mintonext)) {
+ /* insert between min and prev */
+ prev->next = t;
+ t->next = min;
+ t->prev = prev;
+ min->prev = t;
+ }
+ else {
+ next->prev = t;
+ t->next = next;
+ min->next = t;
+ t->prev = min;
+ }
+ } /* for t... */
+ /*print_list(cycle);*/
+ /*printf("End CONQUER\n");*/
+ return cycle;
+}
+
+/* Merge two cycles as per Karp */
+static Tree merge(Tree a, Tree b, Tree t, int nproc) {
+ Tree min,next,prev,tmp;
+ double mindist,test,mintonext,mintoprev,ttonext,ttoprev;
+ Tree n1,p1,n2,p2;
+ double tton1,ttop1,tton2,ttop2;
+ double n1ton2,n1top2,p1ton2,p1top2;
+ int choice;
+ int i;
+
+ /* Compute location for first cycle */
+ min = a;
+ mindist = distance(t,a);
+ tmp = a;
+#ifdef VERIFY_AFFINITIES
+ Accumulate_list(a,a);
+ Accumulate_list(b,b);
+#endif
+ for (a=a->next; a!=tmp; a=a->next) {
+ test = distance(a,t);
+ if (test < mindist) {
+ mindist = test;
+ min = a;
+ } /* if */
+ } /* for a... */
+ next = min->next;
+ prev = min->prev;
+ mintonext = distance(min,next);
+ mintoprev = distance(min,prev);
+ ttonext = distance(t,next);
+ ttoprev = distance(t,prev);
+ if ((ttoprev - mintoprev) < (ttonext - mintonext)) {
+ /* would insert between min and prev */
+ p1 = prev;
+ n1 = min;
+ tton1 = mindist;
+ ttop1 = ttoprev;
+ }
+ else { /* would insert between min and next */
+ p1 = min;
+ n1 = next;
+ ttop1 = mindist;
+ tton1 = ttonext;
+ }
+
+ /* Compute location for second cycle */
+ min = b;
+ mindist = distance(t,b);
+ tmp = b;
+ for (b=b->next; b!=tmp; b=b->next) {
+ test = distance(b,t);
+ if (test < mindist) {
+ mindist = test;
+ min = b;
+ } /* if */
+ } /* for tmp... */
+ next = min->next;
+ prev = min->prev;
+ mintonext = distance(min,next);
+ mintoprev = distance(min,prev);
+ ttonext = distance(t,next);
+ ttoprev = distance(t,prev);
+ if ((ttoprev - mintoprev) < (ttonext - mintonext)) {
+ /* would insert between min and prev */
+ p2 = prev;
+ n2 = min;
+ tton2 = mindist;
+ ttop2 = ttoprev;
+ }
+ else { /* would insert between min and next */
+ p2 = min;
+ n2 = next;
+ ttop2 = mindist;
+ tton2 = ttonext;
+ }
+
+ /* Now we have 4 choices to complete:
+ 1:t,p1 t,p2 n1,n2
+ 2:t,p1 t,n2 n1,p2
+ 3:t,n1 t,p2 p1,n2
+ 4:t,n1 t,n2 p1,p2 */
+ n1ton2 = distance(n1,n2);
+ n1top2 = distance(n1,p2);
+ p1ton2 = distance(p1,n2);
+ p1top2 = distance(p1,p2);
+
+ mindist = ttop1+ttop2+n1ton2;
+ choice = 1;
+
+ test = ttop1+tton2+n1top2;
+ if (test<mindist) {
+ choice = 2;
+ mindist = test;
+ }
+
+ test = tton1+ttop2+p1ton2;
+ if (test<mindist) {
+ choice = 3;
+ mindist = test;
+ }
+
+ test = tton1+tton2+p1top2;
+ if (test<mindist) choice = 4;
+
+/*chatting("p1,n1,t,p2,n2 0x%x,0x%x,0x%x,0x%x,0x%x\n",p1,n1,t,p2,n2);*/
+ switch (choice) {
+ case 1:
+ /* 1:p1,t t,p2 n2,n1 -- reverse 2!*/
+ /*reverse(b);*/
+ reverse(n2);
+ p1->next = t;
+ t->prev = p1;
+ t->next = p2;
+ p2->prev = t;
+ n2->next = n1;
+ n1->prev = n2;
+ break;
+ case 2:
+ /* 2:p1,t t,n2 p2,n1 -- OK*/
+ p1->next = t;
+ t->prev = p1;
+ t->next = n2;
+ n2->prev = t;
+ p2->next = n1;
+ n1->prev = p2;
+ break;
+ case 3:
+ /* 3:p2,t t,n1 p1,n2 -- OK*/
+ p2->next = t;
+ t->prev = p2;
+ t->next = n1;
+ n1->prev = t;
+ p1->next = n2;
+ n2->prev = p1;
+ break;
+ case 4:
+ /* 4:n1,t t,n2 p2,p1 -- reverse 1!*/
+ /*reverse(a);*/
+ reverse(n1);
+ n1->next = t;
+ t->prev = n1;
+ t->next = n2;
+ n2->prev = t;
+ p2->next = p1;
+ p1->prev = p2;
+ break;
+ }
+ return t;
+}
+
+/* Compute TSP for the tree t -- use conquer for problems <= sz */
+Tree tsp(Tree t,int sz,int nproc) {
+ Tree left,right;
+ Tree leftval;
+#ifdef FUTURES
+ future_cell_pointer fc;
+#endif
+ Tree rightval;
+ int nproc_2 = nproc/2;
+
+ if (t->sz <= sz) return conquer(t);
+
+ left = t->left; right = t->right;
+#ifndef FUTURES
+ leftval = tsp(left,sz,nproc_2);
+#else
+ FUTURE(left,sz,nproc_2,tsp,&fc);
+#endif
+ rightval = tsp(right,sz,nproc_2);
+#ifdef FUTURES
+ leftval = (Tree) TOUCH(&fc);
+ leftval = (Tree) fc.value;
+ return merge(leftval,rightval,t,nproc);
+#else
+ return merge(leftval,rightval,t,nproc);
+#endif
+}
diff --git a/test/ccured_olden/tsp/tsp.h b/test/ccured_olden/tsp/tsp.h
new file mode 100644
index 00000000..8d928891
--- /dev/null
+++ b/test/ccured_olden/tsp/tsp.h
@@ -0,0 +1,32 @@
+typedef struct tree {
+ int sz;
+ double x,y;
+ struct tree *left, *right;
+ /*struct tree *next, *prev;*/
+ struct tree *next /*{95}*/, *prev /*{95}*/;
+} *Tree;
+
+/* Builds a 2D tree of n nodes in specified range with dir as primary
+ axis (0 for x, 1 for y) */
+Tree build_tree(int n,int dir,int lo,int num_proc,double min_x,
+ double max_x,double min_y,double max_y);
+/* Compute TSP for the tree t -- use conquer for problems <= sz */
+Tree tsp(Tree t, int sz, int nproc);
+
+#ifdef PLAIN
+#include <time.h>
+#define local
+#define mymalloc malloc
+#define CMMD_node_timer_clear(x) (void)0
+#define TIMESTART(clk) {clk=(double)clock();}
+#define TIMESTOP(clk) {clk=1000000.0 * ((double)clock()-(clk))/CLOCKS_PER_SEC;}
+extern double wallclock;
+#define timer_start(x) TIMESTART(wallclock)
+#define timer_stop(x) TIMESTOP(wallclock)
+#define timer_elapsed(x) (wallclock / 1000.0)
+#define chatting printf
+#define NOTEST() (void)0
+#define RETEST() (void)0
+#define LOCAL(x) x
+#define mymalloc malloc
+#endif
diff --git a/test/ccured_olden/voronoi/.cvsignore b/test/ccured_olden/voronoi/.cvsignore
new file mode 100644
index 00000000..3923b56f
--- /dev/null
+++ b/test/ccured_olden/voronoi/.cvsignore
@@ -0,0 +1,14 @@
+*.i
+*_all.c
+*cil.c
+*box.c
+code
+data.in
+data.out
+allcfiles
+ope.m
+ope.m
+*_comb.c
+*cured.c
+*.optim.c
+changes
diff --git a/test/ccured_olden/voronoi/CVS/Entries b/test/ccured_olden/voronoi/CVS/Entries
new file mode 100644
index 00000000..0d7c09d8
--- /dev/null
+++ b/test/ccured_olden/voronoi/CVS/Entries
@@ -0,0 +1,8 @@
+/Makefile/1.3/Sat Jul 21 16:09:41 2001//
+/README/1.1/Tue Jun 12 04:17:59 2001//
+/defines.h/1.2/Mon Jul 9 21:12:42 2001//
+/newvor.c/1.2/Mon Jul 9 21:12:42 2001//
+/output.c/1.2/Mon Jul 9 21:12:42 2001//
+/vector.c/1.2/Mon Jul 9 21:12:42 2001//
+/.cvsignore/1.5/Thu Nov 8 23:35:28 2001//
+D
diff --git a/test/ccured_olden/voronoi/CVS/Repository b/test/ccured_olden/voronoi/CVS/Repository
new file mode 100644
index 00000000..8d79f068
--- /dev/null
+++ b/test/ccured_olden/voronoi/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/voronoi
diff --git a/test/ccured_olden/voronoi/CVS/Root b/test/ccured_olden/voronoi/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/voronoi/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/voronoi/Makefile b/test/ccured_olden/voronoi/Makefile
new file mode 100644
index 00000000..2822178d
--- /dev/null
+++ b/test/ccured_olden/voronoi/Makefile
@@ -0,0 +1,72 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = voronoi.exe
+PROGS = newvor vector output args ssplain trusted_voronoi
+
+ifdef _MSVC
+CC = cl
+DEF = /D
+CONLY = /c
+OBJOUT = /Fo
+EXEOUT = /Fe
+OBJ = .obj
+
+OPTFLAGS = /Ox
+LIBS =
+
+else
+
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+DEF = -D
+CONLY = -c
+OBJOUT= -o
+EXEOUT= -o
+
+OBJ = .o
+
+OPTFLAGS = -g -Wall -O3
+
+LIBS =
+LIBPATH =
+endif
+
+SRC = .c
+ASM = .s
+EXTRA_CDEFS = $(DEF)I_TIME $(DEF)I_SYS_TIME $(DEF)ULTRIX
+# sm: ??
+ifdef _MSVC
+CDEFS = $(DEF)PLAIN $(DEF)SS_PLAIN $(DEF)OLDEN
+else
+CDEFS = $(DEF)PLAIN $(DEF)OLDEN
+endif
+SRCS = $(addsuffix $(SRC),$(FILES))
+OBJS = $(addsuffix $(OBJ),$(FILES))
+ASMS = $(addsuffix $(ASM),$(FILES))
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+#$(BINARY): $(OBJS)
+# $(CC) $(LDFALGS) $(OPTFLAGS) $(EXEOUT)$@ $(OBJS) $(LIBPATH) $(LIBS)
+
+#%$(OBJ) : %$(SRC)
+# $(CC) $(CDEFS) $(EXTRA_CDEFS) $(MY_CDEFS) $(OPTFLAGS) $(CONLY) $<
+
+clean:
+ rm -f $(BINARY) $(OBJS) *~
+
diff --git a/test/ccured_olden/voronoi/README b/test/ccured_olden/voronoi/README
new file mode 100644
index 00000000..701a0134
--- /dev/null
+++ b/test/ccured_olden/voronoi/README
@@ -0,0 +1,22 @@
+/* For copyright information, see olden_v1.01/COPYRIGHT */
+**********************
+olden_v1.01/benchmarks/voronoi/README
+June 1996
+Martin C. Carlisle
+
+this directory contains the Voronoi Diagram benchmark:
+
+L. Guibas and J. Stolfi. "General Subdivisions and Voronoi Diagrams"
+ACM Trans. on Graphics 4(2):74-123, 1985.
+
+Adapted for Olden by Martin C. Carlisle
+
+**********************
+
+Makefile - use "make voronoi" to create executable
+
+args.c - process command line args
+vector.c - vector math stuff
+newvor.c - main routine
+defines.h - definitions
+output.c - used for outputting results.
diff --git a/test/ccured_olden/voronoi/defines.h b/test/ccured_olden/voronoi/defines.h
new file mode 100644
index 00000000..651336db
--- /dev/null
+++ b/test/ccured_olden/voronoi/defines.h
@@ -0,0 +1,186 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+extern double sqrt();
+extern double exp();
+extern double log();
+extern double drand();
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef SS_PLAIN
+#include "mem-ref.h"
+#include "future-cell.h"
+
+#define NULL 0
+#endif SS_PLAIN
+
+#define NEW 1
+#define EPSILON (1.0e-6)
+
+#define BOOLEAN int
+#ifndef TRUE
+#define TRUE 1
+#endif TRUE
+#define FALSE 0
+
+struct edge_rec
+{
+ struct VERTEX *v;
+ struct edge_rec *next;
+ int wasseen;
+ int more_data; /* 16 byte align this thing */
+};
+
+struct get_point
+{
+ struct VERTEX *v;
+ double curmax;
+ int seed;
+};
+
+#ifdef NEW
+typedef struct edge_rec *EDGE_PTR;
+typedef struct VERTEX *VERTEX_PTR;
+typedef EDGE_PTR QUAD_EDGE;
+#else
+typedef int EDGE_PTR;
+typedef int VERTEX_PTR;
+#endif
+
+struct VEC2 {
+ double x,y;
+ double norm;
+};
+
+struct VERTEX {
+ struct VEC2 v;
+ struct VERTEX *left, *right;
+};
+
+typedef struct
+{
+ QUAD_EDGE left, right;
+} EDGE_PAIR;
+
+#ifdef NEW
+#define onext(a) (a)->next
+#else
+#define onext(a) next[a]
+#endif
+#define oprev(a) rot(onext(rot(a)))
+#define lnext(a) rot(onext(rotinv(a)))
+#define lprev(a) sym(onext(a))
+#define rnext(a) rotinv(onext(rot(a)))
+#define rprev(a) onext(sym(a))
+#define dnext(a) sym(onext(sym(a)))
+#define dprev(a) rotinv(onext(rotinv(a)))
+
+#ifdef NEW
+#define X(r) r->v.x
+#define Y(r) r->v.y
+#define NORM(r) r->v.norm
+#else
+#define X(a) va[a].v.x
+#define Y(a) va[a].v.y
+#define NORM(a) va[a].norm
+#endif
+#ifdef NEW
+#define orig(a) (a)->v
+#define dest(a) orig(sym(a))
+#define seen(a) (a)->wasseen
+#else
+#define orig(a) org[a]
+#define dest(a) orig(sym(a))
+#define seen(a) see[a]
+#endif
+
+#ifndef NEW
+#define origv(a) va[orig(a)].v
+#define destv(a) va[dest(a)].v
+#else
+#define origv(a) orig(a)->v
+#define destv(a) dest(a)->v
+#endif
+
+#define ALLOC_SIZE (sizeof(struct edge_rec))
+#ifndef PLAIN
+#define SIZE (sizeof(struct edge_rec) << PN_BITS)
+#define ANDF ((4*sizeof(struct edge_rec) - 1) << PN_BITS)
+#else
+#define SIZE sizeof(struct edge_rec)
+#define ANDF (4*sizeof(struct edge_rec) - 1)
+#endif
+
+#define sym(a) ((QUAD_EDGE) (((unsigned int) (a)) ^ 2*SIZE))
+#define rot(a) ((QUAD_EDGE) ( (((unsigned int) (a) + 1*SIZE) & ANDF) | ((unsigned int) (a) & ~ANDF) ))
+#define rotinv(a) ((QUAD_EDGE) ( (((unsigned int) (a) + 3*SIZE) & ANDF) | ((unsigned int) (a) & ~ANDF) ))
+#define base(a) ((QUAD_EDGE) ((unsigned int a) & ~ANDF))
+
+struct EDGE_STACK {
+ int ptr;
+ QUAD_EDGE *elts ;
+ int stack_size;
+};
+
+extern QUAD_EDGE alloc_edge();
+extern QUAD_EDGE makeedge();
+extern void splice();
+extern void swapedge();
+extern void deleteedge();
+extern QUAD_EDGE build_delaunay_triangulation();
+extern EDGE_PAIR build_delaunay();
+extern EDGE_PAIR do_merge();
+extern QUAD_EDGE connect_left();
+extern QUAD_EDGE connect_right();
+
+extern void zero_seen();
+extern QUAD_EDGE pop_edge();
+
+#ifdef SS_PLAIN
+#define drand(seed) (((double) (seed=olden_random(seed))) / (double) 2147483647)
+#else SS_PLAIN
+#define drand(seed) (((double) (seed=random(seed))) / (double) 2147483647)
+#endif SS_PLAIN
+
+#ifdef DEFINE_GLOBALS
+#define EXTERN
+#else
+#define EXTERN extern
+#endif
+
+EXTERN VERTEX_PTR *vp ;
+EXTERN struct VERTEX *va ;
+EXTERN EDGE_PTR *next ;
+EXTERN VERTEX_PTR *org ;
+EXTERN int num_vertices, num_edgeparts, stack_size ;
+EXTERN int to_lincoln , to_off, to_3d_out, to_color , voronoi , delaunay , interactive , ahost ;
+EXTERN char *see;
+
+#ifdef ODEFINE_GLOBALS
+#define OEXTERN
+#else
+#define OEXTERN extern
+#endif
+
+#define my_alloc(str_name, str_type, str_cnt) \
+ if (NULL == (str_name = (str_type *) \
+ mymalloc((unsigned) (str_cnt ) * (unsigned) (sizeof(str_type)))))\
+ exit(printf(" cannot malloc (str_name) \n"))
+
+#define VERTEX_ALLOC 1000
+
+#define RED 123
+#define GREEN (RED + 1)
+
+#define CY_SOLID 1
+#define CY_DOTTED 2
+
+
+int ccw(VERTEX_PTR a , VERTEX_PTR b , VERTEX_PTR c );
+int olden_random(int seed );
+void filestuff(void);
+int dealwithargs(int argc , char * argv[] );
+void output_voronoi_diagram(QUAD_EDGE edge , int nv , struct EDGE_STACK *
+ my_stack );
+
diff --git a/test/ccured_olden/voronoi/newvor.c b/test/ccured_olden/voronoi/newvor.c
new file mode 100644
index 00000000..9b5a4408
--- /dev/null
+++ b/test/ccured_olden/voronoi/newvor.c
@@ -0,0 +1,711 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#else SS_PLAIN
+#include <cm/cmmd.h>
+#include <fcntl.h>
+#endif SS_PLAIN
+
+#define DEFINE_GLOBALS
+#include "defines.h"
+/* WARNING! Don't use LOCAL on QUAD_EDGE as cache addresses are not aligned */
+
+int flag;
+
+QUAD_EDGE connect_left(a, b)
+QUAD_EDGE a,b;
+{
+ VERTEX_PTR t1,t2;
+ QUAD_EDGE ans,lnexta;
+
+ t1=dest(a);
+ lnexta=lnext(a);
+ t2=orig(b);
+ ans = makeedge(t1,t2/*dest(a), orig(b)*/);
+ splice(ans, lnexta);
+ splice(sym(ans), b);
+ return(ans);
+}
+
+QUAD_EDGE connect_right(a, b)
+ QUAD_EDGE a,b;
+{
+ VERTEX_PTR t1,t2;
+ QUAD_EDGE ans, oprevb;
+
+ t1=dest(a);
+ t2=orig(b);
+
+ oprevb=oprev(b);
+ ans = makeedge(t1,t2);
+ splice(ans, sym(a));
+ splice(sym(ans), oprevb);
+ return(ans);
+}
+
+/****************************************************************/
+/* Top-level Delaunay Triangulation Procedure */
+/****************************************************************/
+
+QUAD_EDGE build_delaunay_triangulation(tree,extra)
+ /* builds delaunay triangulation.
+ va is an array of vertices, from 0 to size. Each vertex consists of
+ a vector and a data pointer. edge is a pointer to an
+ edge on the convex hull of the constructed delaunay triangulation. */
+
+ VERTEX_PTR tree,extra;
+{
+ EDGE_PAIR retval;
+
+ retval=build_delaunay(tree,extra);
+ return retval.left;
+}
+
+VERTEX_PTR get_low(tree)
+ VERTEX_PTR tree;
+{
+ VERTEX_PTR temp;
+ while((temp=tree->left)) tree=temp;
+ return tree;
+}
+
+/****************************************************************/
+/* Recursive Delaunay Triangulation Procedure */
+/* Contains modifications for axis-switching division. */
+/****************************************************************/
+
+EDGE_PAIR build_delaunay(tree,extra)
+ VERTEX_PTR tree,extra;
+{
+ QUAD_EDGE a,b,c,ldo,rdi,ldi,rdo;
+ EDGE_PAIR retval;
+ VERTEX_PTR maxx, minx;
+ VERTEX_PTR s1, s2, s3;
+
+ EDGE_PAIR delleft, delright;
+
+ if (tree && tree->right && tree->left)
+ {
+ /* more than three elements; do recursion */
+ minx = get_low(tree); maxx = extra;
+
+ delright = build_delaunay(tree->right,extra);
+ delleft = build_delaunay(tree->left, tree);
+ ldo = delleft.left; ldi=delleft.right;
+ rdi=delright.left; rdo=delright.right;
+
+ retval=do_merge(ldo, ldi, rdi, rdo);
+ ldo = retval.left;
+ rdo = retval.right;
+ while (orig(ldo) != minx) { ldo = rprev(ldo); }
+ while (orig(rdo) != maxx) { rdo = lprev(rdo); }
+ retval.left = ldo;
+ retval.right = rdo;
+ }
+ else if (!tree)
+ {
+ printf("ERROR: Only 1 point!\n");
+ exit(-1);
+ }
+ else if (!tree->left)
+ {
+ /* two points */
+ a = makeedge(tree, extra);
+ retval.left = a;
+ retval.right = sym(a);
+ }
+ else
+ { /* tree->left, !tree->right */ /* three points */
+ /* 3 cases: triangles of 2 orientations, and 3 points on a line. */
+ s1 = tree->left;
+ s2 = tree;
+ s3 = extra;
+ a = makeedge(s1, s2);
+ b = makeedge(s2, s3);
+ splice(sym(a), b);
+ c = connect_left(b, a);
+ if (ccw(s1, s3, s2))
+ {
+ retval.left = sym(c);
+ retval.right = c;
+ }
+ else
+ {
+ retval.left = a;
+ retval.right = sym(b);
+ if (!ccw(s1, s2, s3)) deleteedge(c); /* colinear */
+ }
+ }
+ return retval;
+}
+
+/****************************************************************/
+/* Quad-edge storage allocation */
+/****************************************************************/
+QUAD_EDGE next_edge, avail_edge;
+#ifndef NEW
+#define NYL -1
+#else
+#define NYL NULL
+#endif
+
+void
+free_edge(e)
+ QUAD_EDGE e;
+{
+ e = (QUAD_EDGE) ((int) e ^ ((int) e & ANDF));
+ onext(e) = avail_edge;
+ avail_edge = e;
+}
+
+void
+deleteedge(e)
+ /*disconnects e from the rest of the structure and destroys it. */
+ QUAD_EDGE e;
+{
+ QUAD_EDGE f;
+ f=oprev(e);
+ splice(e, f);
+ f=oprev(sym(e));
+ splice(sym(e),f);
+ free_edge(e);
+}
+
+void
+delete_all_edges()
+{
+ next_edge= 0;
+ avail_edge = NYL;
+}
+
+QUAD_EDGE alloc_edge()
+{
+ QUAD_EDGE ans;
+
+ if (avail_edge == NYL)
+ {
+ ans = (QUAD_EDGE) malloc(4*ALLOC_SIZE);
+#ifdef OUT
+ if ((int) ans & ANDF)
+#else !OUT
+ if (!(int) ans & 0xF)
+#endif OUT
+ {
+ printf("Aborting in alloc_edge, ans = 0x%x\n",(unsigned)ans);
+ exit(-1);
+ }
+ }
+ else ans = (QUAD_EDGE) avail_edge, avail_edge = onext(avail_edge);
+ return ans;
+}
+
+/****************************************************************/
+/* Geometric primitives */
+/****************************************************************/
+
+BOOLEAN incircle(a,b,c,d)
+ /* incircle, as in the Guibas-Stolfi paper. */
+ VERTEX_PTR a,b,c,d;
+{
+ double adx, ady, bdx, bdy, cdx, cdy, dx, dy, anorm, bnorm, cnorm, dnorm;
+ double dret ;
+
+ dx = X(d); dy = Y(d); dnorm = NORM(d);
+ adx = X(a) - dx; ady = Y(a) - dy; anorm = NORM(a);
+ bdx = X(b) - dx; bdy = Y(b) - dy; bnorm = NORM(b);
+ cdx = X(c) - dx; cdy = Y(c) - dy; cnorm = NORM(c);
+ dret = (anorm - dnorm) * (bdx * cdy - bdy * cdx);
+ dret += (bnorm - dnorm) * (cdx * ady - cdy * adx);
+ dret += (cnorm - dnorm) * (adx * bdy - ady * bdx);
+ return( (0.0 < dret) ? TRUE : FALSE );
+}
+
+BOOLEAN ccw(a,b,c)
+ /* TRUE iff A, B, C form a counterclockwise oriented triangle */
+ VERTEX_PTR a,b,c;
+{
+ double dret ;
+ double xa,ya,xb,yb,xc,yc;
+
+ xa=X(a); ya=Y(a);
+ xb=X(b); yb=Y(b);
+ xc=X(c); yc=Y(c);
+
+ dret = (xa-xc)*(yb-yc) - (xb-xc)*(ya-yc);
+ return( (dret > 0.0)? TRUE : FALSE);
+}
+
+/****************************************************************/
+/* Quad-edge manipulation primitives */
+/****************************************************************/
+QUAD_EDGE makeedge(origin, destination)
+ VERTEX_PTR origin, destination;
+{
+ QUAD_EDGE temp, ans;
+ temp = alloc_edge();
+ ans = temp;
+
+ onext(temp) = ans;
+ orig(temp) = origin;
+ temp = (QUAD_EDGE) ((int) temp+SIZE);
+ onext(temp) = (QUAD_EDGE) ((int) ans + 3*SIZE);
+ temp = (QUAD_EDGE) ((int) temp+SIZE);
+ onext(temp) = (QUAD_EDGE) ((int) ans + 2*SIZE);
+ orig(temp) = destination;
+ temp = (QUAD_EDGE) ((int) temp+SIZE);
+ onext(temp) = (QUAD_EDGE) ((int) ans + 1*SIZE);
+ return(ans);
+}
+
+void
+splice(a,b)
+ QUAD_EDGE a, b;
+{
+ QUAD_EDGE alpha, beta, temp;
+ QUAD_EDGE t1;
+
+ alpha = rot(onext(a));
+ beta = rot(onext(b));
+
+ t1 = onext(beta);
+ temp = onext(alpha);
+
+ onext(alpha) = t1;
+ onext(beta) = temp;
+
+ temp = onext(a);
+ t1 = onext(b);
+ onext(b) = temp;
+ onext(a) = t1;
+}
+
+void
+swapedge(e)
+ QUAD_EDGE e;
+{
+ QUAD_EDGE a,b,syme,lnexttmp;
+ VERTEX_PTR a1,b1;
+
+ a = oprev(e);
+ syme = sym(e);
+ b = oprev(syme);
+ splice(e, a);
+ splice(syme, b);
+ lnexttmp = lnext(a);
+ splice(e, lnexttmp);
+ lnexttmp = lnext(b);
+ splice(syme, lnexttmp);
+ a1 = dest(a);
+ b1 = dest(b);
+ orig(e) = a1;
+ dest(e) = b1;
+}
+
+/****************************************************************/
+/* The Merge Procedure. */
+/****************************************************************/
+
+int valid(l,basel)
+ QUAD_EDGE l,basel;
+{
+ VERTEX_PTR t1,t2,t3;
+
+ t1=orig(basel);
+ t3=dest(basel);
+
+ t2=dest(l);
+ return ccw(t1,t2,t3);
+}
+
+void dump_quad(ptr)
+ QUAD_EDGE ptr;
+{
+ int i;
+ QUAD_EDGE j;
+ VERTEX_PTR v;
+
+ ptr = (QUAD_EDGE) ((int) ptr & ~ANDF);
+ chatting("Entered DUMP_QUAD: ptr=0x%x\n",ptr);
+ for (i=0; i<4; i++)
+ {
+ j=onext(((QUAD_EDGE) (ptr+i)));
+ v = orig(j);
+ chatting("DUMP_QUAD: ptr=0x%x onext=0x%x,v=0x%x\n",ptr+i,j,v);
+ }
+}
+
+
+EDGE_PAIR do_merge(ldo, ldi, rdi, rdo)
+ QUAD_EDGE ldi, rdi, ldo, rdo;
+{
+ int rvalid, lvalid;
+ QUAD_EDGE basel,lcand,rcand,t;
+ VERTEX_PTR t1,t2,t3;
+
+ while (TRUE)
+ {
+ t3=orig(rdi);
+
+ t1=orig(ldi);
+ t2=dest(ldi);
+
+ while (ccw(t1,t2,t3/*orig(ldi), dest(ldi), orig(rdi)*/))
+ {
+ ldi = lnext(ldi);
+
+ t1=orig(ldi);
+ t2=dest(ldi);
+ }
+
+ t2=dest(rdi);
+
+ if (ccw(t2,t3,t1/*dest(rdi), orig(rdi), orig(ldi)*/))
+ {
+ rdi = rprev(rdi);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ basel = connect_left(sym(rdi), ldi);
+
+ lcand = rprev(basel);
+ rcand = oprev(basel);
+ t1 = orig(basel);
+ t2 = dest(basel);
+
+ if (t1/*orig(basel)*/ == orig(rdo)) rdo = basel;
+ if (t2/*dest(basel)*/ == orig(ldo)) ldo = sym(basel);
+
+ while (TRUE)
+ {
+ VERTEX_PTR v1,v2,v3,v4;
+
+ /*chatting("valid site 1,lcand=0x%x,basel=0x%x\n",lcand,basel);*/
+ /*dump_quad(lcand);*/
+ t=onext(lcand);
+ if (valid(t,basel))
+ {
+ v4=orig(basel);
+
+ v1=dest(lcand);
+ v3=orig(lcand);
+
+ v2=dest(t);
+ while (incircle(v1,v2,v3,v4
+ /*dest(lcand), dest(t), orig(lcand), orig(basel)*/))
+ {
+ deleteedge(lcand);
+ lcand = t;
+
+ t = onext(lcand);
+ v1=dest(lcand);
+ v3=orig(lcand);
+
+ v2=dest(t);
+ }
+ }
+
+ /*chatting("valid site 2\n");*/
+ t=oprev(rcand);
+ if (valid(t,basel)) {
+ v4=dest(basel);
+ v1=dest(t);
+ v2=dest(rcand);
+ v3=orig(rcand);
+ while (incircle(v1,v2,v3,v4
+ /*dest(t), dest(rcand), orig(rcand), dest(basel)*/))
+ {
+ deleteedge(rcand);
+ rcand = t;
+ t = oprev(rcand);
+ v2=dest(rcand);
+ v3=orig(rcand);
+ v1=dest(t);
+ }
+ }
+ /*chatting("Valid sites 3,4\n");*/
+ lvalid = valid(lcand,basel);
+ /*chatting("Valid sites 3,4\n");*/
+ rvalid = valid(rcand,basel);
+ if ((! lvalid) && (! rvalid))
+ {
+ EDGE_PAIR retval;
+ retval.left = ldo; retval.right = rdo; return retval;
+ }
+ v1=dest(lcand);
+ v2=orig(lcand);
+ v3=orig(rcand);
+ v4=dest(rcand);
+ if (!lvalid ||
+ (rvalid && incircle(v1,v2,v3,v4
+ /*dest(lcand), orig(lcand),
+ orig(rcand), dest(rcand)*/)))
+ {
+ basel = connect_left(rcand, sym(basel));
+ rcand = lnext(sym(basel));
+ }
+ else
+ {
+ basel = sym(connect_right(lcand, basel));
+ lcand = rprev(basel);
+ }
+ }
+}
+
+
+
+#define DEFINE_GLOBALS
+#define CONST_m1 10000
+#define CONST_b 31415821
+#define RANGE 100
+
+struct EDGE_STACK *allocate_stack();
+struct get_point get_points();
+int loop = 0, randum = 1, filein = 0 , fileout = 1, statistics = 0;
+
+void in_order(tree)
+ VERTEX_PTR tree;
+{
+ VERTEX_PTR tleft, tright;
+ double x, y;
+
+ if (!tree) {
+ return;
+ }
+
+ x = X(tree);
+ y = Y(tree);
+ chatting("X=%f, Y=%f\n",x, y);
+ tleft = tree->left;
+ in_order(tleft);
+ tright = tree->right;
+ in_order(tright);
+}
+
+int mult(int p, int q)
+{
+ int p1, p0, q1, q0;
+
+ p1=p/CONST_m1; p0=p%CONST_m1;
+ q1=q/CONST_m1; q0=q%CONST_m1;
+ return (((p0*q1+p1*q0) % CONST_m1)*CONST_m1+p0*q0);
+}
+
+int skiprand(int seed, int n)
+/* Generate the nth random # */
+{
+ for (; n; n--)
+#ifdef SS_PLAIN
+ seed = olden_random(seed);
+#else SS_PLAIN
+ seed=random(seed);
+#endif SS_PLAIN
+ return seed;
+}
+
+
+#ifdef SS_PLAIN
+int olden_random(int seed)
+#else SS_PLAIN
+int random(int seed)
+#endif SS_PLAIN
+{
+ seed = (mult(seed,CONST_b)+1);
+ return seed;
+}
+
+
+void
+print_extra(extra)
+ VERTEX_PTR extra;
+{
+
+ double x, y;
+ x = X(extra);
+ y = Y(extra);
+ chatting("X=%f, Y=%f\n",x, y);
+}
+
+
+void
+main(argc,argv)
+ int argc;
+ char *argv[];
+{
+ struct EDGE_STACK *my_stack;
+ struct get_point point, extra;
+ QUAD_EDGE edge;
+ int n, retained;
+ to_lincoln = to_off = to_3d_out = to_color = 0;
+ voronoi = delaunay = 1; interactive = ahost = 0 ;
+ retained = 0;
+
+ filestuff();
+ chatting("argc = %d\n",argc);
+ n = dealwithargs(argc, argv);
+
+ chatting("getting %d points\n", n);
+ extra=get_points(1,1.0,n,1023);
+ point=get_points(n-1,extra.curmax,n-1,extra.seed);
+ chatting("Done getting points\n");
+ num_vertices = n + 1;
+ my_stack=allocate_stack(num_vertices);
+
+//#ifdef SS_PLAIN
+// ssplain_alloc_stats();
+//#endif SS_PLAIN
+
+ if (flag) in_order(point.v);
+ if (flag) print_extra(extra.v);
+ chatting("Doing voronoi on %d nodes\n", n);
+
+ edge=build_delaunay_triangulation(point.v,extra.v);
+
+ chatting("Elapsed time %f\n", CMMD_node_timer_elapsed(0));
+ if (flag) output_voronoi_diagram(edge,n,my_stack);
+
+ exit(0);
+}
+
+struct EDGE_STACK *allocate_stack(num_vertices)
+ int num_vertices;
+{
+ struct EDGE_STACK *my_stack;
+
+ num_edgeparts = 12*num_vertices;
+ my_alloc(my_stack, struct EDGE_STACK, 1);
+ my_alloc(my_stack->elts, QUAD_EDGE , num_edgeparts);
+ my_stack->stack_size = num_edgeparts/2;
+ return my_stack;
+}
+
+void
+free_all(cont,my_stack)
+ int cont;
+ struct EDGE_STACK *my_stack;
+{
+ free(my_stack->elts);
+ free(my_stack);
+}
+
+struct get_point get_points(n,curmax,i,seed)
+ int n;
+ double curmax;
+ int i,seed;
+{
+ VERTEX_PTR node;
+
+ struct get_point point;
+
+ if (n<1 || i<=n/2) {
+ point.v = NULL;
+ point.curmax=curmax;
+ point.seed = seed;
+ return point;
+ }
+#ifdef OUT
+ chatting("Get points: %d, %f, %d\n",n,curmax,i);
+#endif OUT
+
+ point = get_points(n/2,curmax,i,seed);
+ /*chatting("rec call n=%d\n",n);*/
+ i -= n/2;
+
+ node = (VERTEX_PTR) mymalloc(sizeof(struct VERTEX));
+
+ /*chatting("Get points past alloc,n=%d\n",n);*/
+ X(node) = point.curmax * exp(log(drand(point.seed))/i);
+ Y(node) = drand(point.seed);
+ NORM(node) = X(node)*X(node) + Y(node)*Y(node);
+ node->right = point.v;
+ /*chatting("node = 0x%x\n",node);*/
+ point = get_points(n/2,X(node),i-1,point.seed);
+
+ node->left = point.v;
+ point.v = node;
+ return point;
+}
+
+
+/****************************************************************/
+/* Voronoi Diagram Routines. */
+/****************************************************************/
+
+/****************************************************************/
+/* Graph Traversal Routines */
+/****************************************************************/
+
+QUAD_EDGE pop_edge(x)
+ struct EDGE_STACK *x;
+{
+ int a=x->ptr--;
+ return (x)->elts[a];
+}
+
+void
+push_edge(stack,edge)
+ struct EDGE_STACK *stack;
+ QUAD_EDGE edge;
+{
+ int a;
+ /*chatting("pushing edge \n");*/
+ if (stack->ptr == stack->stack_size) {
+ printf("cannot push onto stack: stack is too large\n");
+ }
+ else {
+ a = stack->ptr;
+ a++;
+ stack->ptr = a;
+ stack->elts[a] = edge;
+ }
+}
+
+void
+push_ring(stack, edge)
+ struct EDGE_STACK *stack;
+ QUAD_EDGE edge;
+{
+ QUAD_EDGE nex;
+ nex = onext(edge);
+ while (nex != edge) {
+ if (seen(nex) == 0) {
+ seen(nex) = 1;
+ push_edge(stack, nex);
+ }
+ nex = onext(nex);
+ }
+}
+
+void
+push_nonzero_ring(stack, edge)
+ struct EDGE_STACK *stack;
+ QUAD_EDGE edge;
+{
+ QUAD_EDGE nex;
+ nex = onext(edge);
+ while (nex != edge) {
+ if (seen(nex) != 0) {
+ seen(nex) = 0;
+ push_edge(stack, nex);
+ }
+ nex = onext(nex);
+ }
+}
+
+void
+zero_seen(my_stack,edge)
+ QUAD_EDGE edge;
+ struct EDGE_STACK *my_stack;
+{
+ my_stack->ptr = 0;
+ push_nonzero_ring(my_stack, edge);
+ while (my_stack->ptr != 0) {
+ edge = pop_edge(my_stack);
+ push_nonzero_ring(my_stack, sym(edge));
+ }
+}
+
diff --git a/test/ccured_olden/voronoi/output.c b/test/ccured_olden/voronoi/output.c
new file mode 100644
index 00000000..a9331f99
--- /dev/null
+++ b/test/ccured_olden/voronoi/output.c
@@ -0,0 +1,173 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#define ODEFINE_GLOBALS
+#include "defines.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+extern struct VEC2 V2_sum();
+extern struct VEC2 V2_sub();
+extern struct VEC2 V2_times();
+extern double V2_cprod();
+extern struct VEC2 V2_cross();
+extern double V2_dot();
+extern double V2_magn();
+
+/****************************************************************/
+/* Voronoi Output Routines */
+/****************************************************************/
+
+void
+plot_dedge(p1, p2)
+VERTEX_PTR p1, p2;
+{
+ double x1,x2,y1,y2;
+
+ x1=X(p1);
+ y1=Y(p1);
+ x2=X(p2);
+ y2=Y(p2);
+ /* plots a Delaunay-triangulation edge on your favorite device. */
+ chatting("Dedge %g %g %g %g \n",(float) x1, (float) y1,
+ (float) x2, (float) y2);
+}
+
+void
+plot_vedge(p1, p2)
+ struct VEC2 p1, p2;
+{
+ /* plots a Voronoi-diagram edge on your favorite device. */
+ chatting("Vedge %g %g %g %g \n",(float) p1.x, (float) p1.y, (float) p2.x,
+ (float) p2.y);
+}
+
+struct VEC2 circle_center(a,b,c)
+ /* returns the center of the circle passing through A, B & C. */
+ struct VEC2 a,b,c;
+{
+ struct VEC2 p;
+ double d1,d2,d3,d4;
+ struct VEC2 vv1, vv2, vv3, vv4, vv5, vv6, vv7 ;
+ vv1 = V2_sub(b,c);
+ d1 = V2_magn( vv1 );
+ vv1 = V2_sum(a,b);
+ vv2 = V2_times(0.5, vv1);
+ if (d1 < 0.0) /*there is no intersection point, the bisectors coincide. */
+ return(vv2);
+ else {
+ vv3 = V2_sub(b,a);
+ vv4 = V2_sub(c,a);
+ d3 = V2_cprod(vv3, vv4) ;
+ d2 = -2.0 * d3 ;
+ vv5 = V2_sub(c,b);
+ d4 = V2_dot(vv5, vv4);
+ vv6 = V2_cross(vv3);
+ vv7 = V2_times(d4/ d2 , vv6);
+ p = V2_sum(vv2, vv7);
+ return(p);
+ }
+}
+
+int *earray;
+
+void
+output_voronoi_diagram(edge,nv,my_stack)
+ QUAD_EDGE edge;
+ int nv;
+ struct EDGE_STACK *my_stack;
+{
+ QUAD_EDGE nex, prev, snex, sprev;
+ struct VEC2 cvxvec, center;
+ double ln;
+ double d1;
+ struct VEC2 vv1, vv2, vv3;
+
+ if (voronoi) {
+ zero_seen(my_stack,edge);
+ nex = edge;
+ /* Plot VD edges with one endpoint at infinity. */
+ do {
+ struct VEC2 v21,v22,v23;
+ QUAD_EDGE tmp;
+
+ v21=destv(nex);
+ v22=origv(nex);
+ tmp=onext(nex);
+ v23=destv(tmp);
+ cvxvec = V2_sub(v21,v22/*destv(nex), origv(nex)*/);
+ center = circle_center(v22,v21,v23
+ /*origv(nex), destv(nex), destv(onext(nex))*/);
+ vv1 = V2_sum(v22,v21/*origv(nex), destv(nex)*/) ;
+ vv2 = V2_times(0.5, vv1);
+ vv3 = V2_sub(center, vv2) ;
+ ln = 1.0 + V2_magn(vv3);
+ d1 = ln/V2_magn(cvxvec);
+ vv1 = V2_cross(cvxvec);
+ vv2 = V2_times(d1, vv1) ;
+ vv3 = V2_sum(center, vv2);
+ plot_vedge( center, vv3 ) ;
+ nex = rnext(nex);
+ } while (nex != edge);
+ }
+
+ /* Plot DT edges and finite VD edges. */
+
+ my_stack->ptr = 0;
+ push_ring(my_stack, edge);
+ chatting("mystack_ptr = %d\n",my_stack->ptr);
+ while (my_stack->ptr != 0) {
+ VERTEX_PTR v1,v2,v3,v4;
+ double d1,d2;
+
+
+ edge = pop_edge(my_stack);
+ if (seen(edge) == 1)
+ {
+ {
+ prev = edge;
+ nex = onext(edge);
+ do {
+ v1=orig(prev);
+ d1=X(v1);
+ v2=dest(prev);
+ d2=X(v2);
+ if (d1 >= d2 /*X(orig(prev)) >= X(dest(prev))*/)
+ {
+ /*plot_dedge(orig(prev), dest(prev));*/
+ plot_dedge(v1,v2);
+ sprev = sym(prev);
+ snex = onext(sprev);
+ v1=orig(prev);
+ v2=dest(prev);
+ v3=dest(nex);
+ v4=dest(snex);
+ if (ccw(v1,v2,v3/*orig(prev), dest(prev), dest(nex)*/)
+ != ccw(v1,v2,v4/*orig(prev),dest(prev),dest(snex)*/))
+ {
+ struct VEC2 v21, v22, v23;
+ v21 = origv(prev);
+ v22 = destv(prev);
+ v23 = destv(nex);
+ vv1 = circle_center(v21,v22,v23/*origv(prev),
+ destv(prev),destv(nex)*/);
+ v21 = origv(sprev);
+ v22 = destv(sprev);
+ v23 = destv(snex);
+ vv2 = circle_center(v21,v22,v23/*origv(sprev),
+ destv(sprev),destv(snex)*/);
+ plot_vedge( vv1 , vv2 );
+ }
+ }
+ seen(prev) = 2;
+ prev = nex;
+ nex = onext(nex);
+ } while (prev != edge);
+ }
+ }
+ push_ring(my_stack, sym(edge));
+ }
+ zero_seen(my_stack, edge);
+}
+
diff --git a/test/ccured_olden/voronoi/vector.c b/test/ccured_olden/voronoi/vector.c
new file mode 100644
index 00000000..1a288d7b
--- /dev/null
+++ b/test/ccured_olden/voronoi/vector.c
@@ -0,0 +1,80 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+#include "defines.h"
+
+/****************************************************************/
+/* Vector Routines. */
+/* From CMU vision library. */
+/* They are used only for the VD, not the DT. */
+/* They are slow because of large call-by-value parameters.*/
+/****************************************************************/
+
+/* V2_cprod: forms triple scalar product of [u,v,k], where k = u cross v */
+/* (returns the magnitude of u cross v in space)*/
+
+double V2_cprod(u,v)
+ struct VEC2 u,v;
+{
+ return(u.x * v.y - u.y * v.x);
+}
+
+
+/* V2_dot: vector dot product */
+
+double V2_dot(u,v)
+struct VEC2 u,v;
+{
+ return(u.x * v.x + u.y * v.y);
+}
+
+/* V2_times: multiply a vector by a scalar */
+
+struct VEC2 V2_times(c,v)
+ double c;
+ struct VEC2 v;
+{
+ struct VEC2 ans;
+ ans.x = c * v.x;
+ ans.y = c * v.y;
+ return(ans);
+}
+
+/* V2_sum, V2_sub: Vector addition and subtraction */
+
+struct VEC2 V2_sum(u,v)
+ struct VEC2 u,v;
+{
+ struct VEC2 ans;
+
+ ans.x = u.x + v.x;
+ ans.y = u.y + v.y;
+ return(ans);
+}
+
+struct VEC2 V2_sub(u,v)
+ struct VEC2 u,v;
+{
+ struct VEC2 ans;
+ ans.x = u.x - v.x;
+ ans.y = u.y - v.y;
+ return(ans);
+}
+
+/* V2_magn: magnitude of vector */
+
+double V2_magn(u)
+ struct VEC2 u;
+{
+ return(sqrt(u.x*u.x+u.y*u.y));
+}
+
+/* returns k X v (cross product). this is a vector perpendicular to v */
+
+struct VEC2 V2_cross(v)
+ struct VEC2 v;
+{
+ struct VEC2 ans;
+ ans.x = v.y;
+ ans.y = -v.x;
+ return(ans);
+}