Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision b4cd03b740cf2cfe5905750f3587883e5a51a654)
+++ src/libcfa/Makefile.am	(revision bd8540001c298d12d68dabcd274a24ed5a4dfb7a)
@@ -11,6 +11,6 @@
 ## Created On       : Sun May 31 08:54:01 2015
 ## Last Modified By : Peter A. Buhr
-## Last Modified On : Sat Jan 30 18:56:45 2016
-## Update Count     : 110
+## Last Modified On : Wed Feb  3 11:19:35 2016
+## Update Count     : 117
 ###############################################################################
 
@@ -54,8 +54,11 @@
 
 # extension-less header files are overridden by default make rules => explicitly override rule
-% : %.c ${abs_top_srcdir}/src/driver/cfa-cpp
+% : %.c
 	true
 
-libs = algorithm iostream fstream iterator
+.c.o : ${abs_top_srcdir}/src/driver/cfa-cpp
+	${CC} ${CFLAGS} -c -o $@ $<
+
+libs = stdlib iostream fstream iterator
 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
 
Index: src/libcfa/Makefile.in
===================================================================
--- src/libcfa/Makefile.in	(revision b4cd03b740cf2cfe5905750f3587883e5a51a654)
+++ src/libcfa/Makefile.in	(revision bd8540001c298d12d68dabcd274a24ed5a4dfb7a)
@@ -83,6 +83,6 @@
 libcfa_a_AR = $(AR) $(ARFLAGS)
 libcfa_a_LIBADD =
-am__objects_1 = algorithm.$(OBJEXT) iostream.$(OBJEXT) \
-	fstream.$(OBJEXT) iterator.$(OBJEXT)
+am__objects_1 = stdlib.$(OBJEXT) iostream.$(OBJEXT) fstream.$(OBJEXT) \
+	iterator.$(OBJEXT)
 am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1)
 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
@@ -213,5 +213,5 @@
 MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} \
 	${addprefix ${libdir}/,${lib_LIBRARIES}} ${includedir}/*
-libs = algorithm iostream fstream iterator
+libs = stdlib iostream fstream iterator
 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
 cheaders = bfd bfdlink demangle dialog evdns evhttp evrpc expat fcntl form gcrypt math
@@ -293,16 +293,9 @@
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algorithm.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iostream.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa-prelude.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@
 
 .c.obj:
@@ -585,6 +578,9 @@
 
 # extension-less header files are overridden by default make rules => explicitly override rule
-% : %.c ${abs_top_srcdir}/src/driver/cfa-cpp
+% : %.c
 	true
+
+.c.o : ${abs_top_srcdir}/src/driver/cfa-cpp
+	${CC} ${CFLAGS} -c -o $@ $<
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: src/libcfa/algorithm
===================================================================
--- src/libcfa/algorithm	(revision b4cd03b740cf2cfe5905750f3587883e5a51a654)
+++ 	(revision )
@@ -1,61 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// alorgithm --
-//
-// Author           : Peter A. Buhr
-// Created On       : Thu Jan 28 17:12:35 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Feb  1 13:41:51 2016
-// Update Count     : 26
-//
-
-//---------------------------------------
-
-forall( type T | { int ?<?( const T, const T ); } )
-T min( const T t1, const T t2 );
-
-forall( type T | { int ?>?( const T, const T ); } )
-T max( const T t1, const T t2 );
-
-//---------------------------------------
-
-forall( type T )
-void swap( T * t1, T * t2 );
-
-//---------------------------------------
-
-char abs( char );
-extern "C" {
-int abs( int );
-} // extern
-long int abs( long int );
-long long int abs( long long int );
-float abs( float );
-double abs( double );
-long double abs( long double );
-float _Complex abs( float _Complex );
-double _Complex abs( double _Complex );
-long double _Complex abs( long double _Complex );
-
-//---------------------------------------
-
-void randseed( long int s );
-char random();
-int random();
-unsigned int random();
-long int random();
-unsigned long int random();
-float random();
-double random();
-float _Complex random();
-double _Complex random();
-long double _Complex random();
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: src/libcfa/algorithm.c
===================================================================
--- src/libcfa/algorithm.c	(revision b4cd03b740cf2cfe5905750f3587883e5a51a654)
+++ 	(revision )
@@ -1,73 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// algorithm.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Thu Jan 28 17:10:29 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Thu Feb 04 17:19:12 2016
-// Update Count     : 54
-//
-
-#include "algorithm"
-
-forall( type T | { int ?<?( const T, const T ); } )
-T min( const T t1, const T t2 ) {
-	return t1 < t2 ? t1 : t2;
-} // min
-
-forall( type T | { int ?>?( const T, const T ); } )
-T max( const T t1, const T t2 ) {
-	return t1 > t2 ? t1 : t2;
-} // max
-
-//---------------------------------------
-
-forall( type T )
-void swap( T * t1, T * t2 ) {
-	T temp = *t1;
-	*t1 = *t2;
-	*t2 = temp;
-} // swap
-
-//---------------------------------------
-
-extern "C" {
-#define _XOPEN_SOURCE									// required to access "rand48" routines
-#include <stdlib.h>										// abs, labs, llabs
-#include <math.h>										// fabsf, fabs, fabsl
-#include <complex.h>									// cabsf, cabs, cabsl
-#undef I												// free name
-} // extern
-
-char abs( char v ) { return abs( (int)v ); }
-long int abs( long int v ) { return labs( v ); }
-long long int abs( long long int v ) { return llabs( v ); }
-float abs( float v ) { return fabsf( v ); }
-double abs( double v ) { return fabs( v ); }
-long double abs( long double v ) { return fabsl( v ); }
-float _Complex abs( float _Complex v ) { return cabsf( v ); }
-double _Complex abs( double _Complex v ) { return cabs( v ); }
-long double _Complex abs( long double _Complex v ) { return cabsl( v ); }
-
-//---------------------------------------
-
-void randseed( long int s ) { srand48( s ); }
-char random() { return lrand48(); }
-int random() { return mrand48(); }
-unsigned int random() { return lrand48(); }
-long int random() { return mrand48(); }
-unsigned long int random() { return lrand48(); }
-float random() { return (float)drand48(); }				// otherwise float uses lrand48
-double random() { return drand48(); }
-float _Complex random() { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
-double _Complex random() { return drand48() + (double _Complex)(drand48() * _Complex_I); }
-long double _Complex random() { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: src/libcfa/stdlib
===================================================================
--- src/libcfa/stdlib	(revision bd8540001c298d12d68dabcd274a24ed5a4dfb7a)
+++ src/libcfa/stdlib	(revision bd8540001c298d12d68dabcd274a24ed5a4dfb7a)
@@ -0,0 +1,122 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// stdlib -- 
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu Jan 28 17:12:35 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Feb  5 15:21:18 2016
+// Update Count     : 61
+//
+
+//---------------------------------------
+
+extern "C" {
+#include <stddef.h>										// size_t
+} // extern "C"
+
+forall( type T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
+forall( type T ) T * memset( T * ptr );					// remove when default value available
+
+forall( type T ) T * malloc( void );
+forall( type T ) T * malloc( char fill );
+forall( type T ) T * malloc( size_t size );
+forall( type T ) T * malloc( T * ptr, size_t size );
+forall( type T ) T * malloc( T * ptr, size_t size, unsigned char fill );
+forall( type T ) T * calloc( size_t size );
+forall( type T ) T * realloc( T * ptr, size_t size );
+forall( type T ) T * realloc( T * ptr, size_t size, unsigned char fill );
+
+forall( type T ) T * aligned_alloc( size_t alignment );
+forall( type T ) T * memalign( size_t alignment );		// deprecated
+forall( type T ) int posix_memalign( T ** ptr, size_t alignment );
+
+//---------------------------------------
+
+int ato( const char * ptr );
+unsigned int ato( const char * ptr );
+long int ato( const char * ptr );
+unsigned long int ato( const char * ptr );
+long long int ato( const char * ptr );
+unsigned long long int ato( const char * ptr );
+float ato( const char * ptr );
+double ato( const char * ptr );
+long double ato( const char * ptr );
+float _Complex ato( const char * ptr );
+double _Complex ato( const char * ptr );
+long double _Complex ato( const char * ptr );
+
+int strto( const char * sptr, char ** eptr, int base );
+unsigned int strto( const char * sptr, char ** eptr, int base );
+long int strto( const char * sptr, char ** eptr, int base );
+unsigned long int strto( const char * sptr, char ** eptr, int base );
+long long int strto( const char * sptr, char ** eptr, int base );
+unsigned long long int strto( const char * sptr, char ** eptr, int base );
+float strto( const char * sptr, char ** eptr );
+double strto( const char * sptr, char ** eptr );
+long double strto( const char * sptr, char ** eptr );
+float _Complex strto( const char * sptr, char ** eptr );
+double _Complex strto( const char * sptr, char ** eptr );
+long double _Complex strto( const char * sptr, char ** eptr );
+
+//---------------------------------------
+
+forall( type T | { int ?<?( T, T ); } )
+T * bsearch( const T key, const T * arr, size_t dimension );
+
+forall( type T | { int ?<?( T, T ); } )
+void qsort( const T * arr, size_t dimension );
+
+//---------------------------------------
+
+forall( type T | { T ?/?( T, T ); T ?%?( T, T ); } )
+[ T, T ] div( T t1, T t2 );
+
+//---------------------------------------
+
+char abs( char );
+extern "C" {
+int abs( int );		// use default C routine for int
+} // extern
+long int abs( long int );
+long long int abs( long long int );
+float abs( float );
+double abs( double );
+long double abs( long double );
+float _Complex abs( float _Complex );
+double _Complex abs( double _Complex );
+long double _Complex abs( long double _Complex );
+
+//---------------------------------------
+
+void randseed( long int s );
+char random();
+int random();
+unsigned int random();
+long int random();
+unsigned long int random();
+float random();
+double random();
+float _Complex random();
+double _Complex random();
+long double _Complex random();
+
+//---------------------------------------
+
+forall( type T | { int ?<?( T, T ); } )
+T min( const T t1, const T t2 );
+
+forall( type T | { int ?>?( T, T ); } )
+T max( const T t1, const T t2 );
+
+forall( type T )
+void swap( T * t1, T * t2 );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/stdlib.c
===================================================================
--- src/libcfa/stdlib.c	(revision bd8540001c298d12d68dabcd274a24ed5a4dfb7a)
+++ src/libcfa/stdlib.c	(revision bd8540001c298d12d68dabcd274a24ed5a4dfb7a)
@@ -0,0 +1,276 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// algorithm.c -- 
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu Jan 28 17:10:29 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Feb  5 15:41:24 2016
+// Update Count     : 128
+//
+
+#include "stdlib"
+
+//---------------------------------------
+
+extern "C" {
+#define _XOPEN_SOURCE 600								// posix_memalign, *rand48
+#include <stdlib.h>										// malloc, free, calloc, realloc, memalign, posix_memalign, bsearch
+#include <string.h>										// memset
+#include <malloc.h>										// malloc_usable_size
+#include <stdio.h>
+#include <math.h>										// fabsf, fabs, fabsl
+#include <complex.h>									// _Complex_I, cabsf, cabs, cabsl
+} // extern "C"
+
+forall( type T ) T * memset( T * ptr, unsigned char fill ) { // use default value '\0' for fill
+	printf( "memset1\n" );
+    return (T *)memset( ptr, (int)fill, malloc_usable_size( ptr ) );
+} // memset
+forall( type T ) T * memset( T * ptr ) {				// remove when default value available
+	printf( "memset2\n" );
+    return (T *)memset( ptr, 0, malloc_usable_size( ptr ) );
+} // memset
+
+forall( type T ) T * malloc( void ) {
+	printf( "malloc1\n" );
+    return (T *)malloc( sizeof(T) );
+} // malloc
+forall( type T ) T * malloc( size_t size ) {
+	printf( "malloc2\n" );
+    return (T *)(void *)malloc( size );
+} // malloc
+forall( type T ) T * malloc( char fill ) {
+	printf( "malloc3\n" );
+	T * ptr = (T *)malloc( sizeof(T) );
+    return memset( ptr );
+} // malloc
+
+forall( type T ) T * calloc( size_t size ) {
+	printf( "calloc\n" );
+    return (T *)calloc( size, sizeof(T) );
+} // calloc
+
+forall( type T ) T * realloc( T * ptr, size_t size ) {
+	printf( "realloc1\n" );
+    return (T *)(void *)realloc( (void *)ptr, size );
+} // realloc
+forall( type T ) T * realloc( T * ptr, size_t size, unsigned char fill ) {
+	printf( "realloc2\n" );
+    char * nptr = (T *)(void *)realloc( (void *)ptr, size );
+    size_t unused = malloc_usable_size( nptr );
+    memset( nptr + size - unused, (int)fill, unused );	// initialize any new storage
+    return nptr;
+} // realloc
+
+forall( type T ) T * malloc( T * ptr, size_t size ) {
+	printf( "malloc4\n" );
+    return (T *)realloc( ptr, size );
+} // malloc
+forall( type T ) T * malloc( T * ptr, size_t size, unsigned char fill ) {
+	printf( "malloc5\n" );
+    return (T *)realloc( ptr, size, fill );
+} // malloc
+
+forall( type T ) T * aligned_alloc( size_t alignment ) {
+	printf( "aligned_alloc\n" );
+    return (T *)memalign( alignment, sizeof(T) );
+} // aligned_alloc
+
+forall( type T ) T * memalign( size_t alignment ) {
+	printf( "memalign\n" );
+    return (T *)memalign( alignment, sizeof(T) );
+} // memalign
+
+forall( type T ) int posix_memalign( T ** ptr, size_t alignment ) {
+	printf( "posix_memalign\n" );
+    return posix_memalign( (void **)ptr, alignment, sizeof(T) );
+} // posix_memalign
+
+//---------------------------------------
+
+int ato( const char * ptr ) {
+	int i;
+	if ( sscanf( ptr, "%d", &i ) == EOF ) {}			// check return code
+	return i;
+}
+unsigned int ato( const char * ptr ) {
+	unsigned int ui;
+	if ( sscanf( ptr, "%u", &ui ) == EOF ) {}			// check return code
+	return ui;
+}
+long int ato( const char * ptr ) {
+	long int li;
+	if ( sscanf( ptr, "%ld", &li ) == EOF ) {};			// check return code
+	return li;
+}
+unsigned long int ato( const char * ptr ) {
+	unsigned long int uli;
+	if ( sscanf( ptr, "%lu", &uli ) == EOF ) {};		// check return code
+	return uli;
+}
+long long int ato( const char * ptr ) {
+	long long int lli;
+	if ( sscanf( ptr, "%lld", &lli ) == EOF ) {};		// check return code
+	return lli;
+}
+unsigned long long int ato( const char * ptr ) {
+	unsigned long long int ulli;
+	if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {};		// check return code
+	return ulli;
+}
+float ato( const char * ptr ) {
+	float f;
+	if ( sscanf( ptr, "%f", &f ) == EOF ) {};			// check return code
+	return f;
+}
+double ato( const char * ptr ) {
+	double d;
+	if ( sscanf( ptr, "%lf", &d ) == EOF ) {};			// check return code
+	return d;
+}
+long double ato( const char * ptr ) {
+	long double ld;
+	printf( "FRED " );
+	if ( sscanf( ptr, "%.32Lf", &ld ) == EOF ) {};		// check return code
+	return ld;
+}
+float _Complex ato( const char * ptr ) {
+	float re, im;
+	if ( sscanf( ptr, "%g%g", &re, &im ) == EOF ) {};	// check return code
+	return re + im * _Complex_I;
+}
+double _Complex ato( const char * ptr ) {
+	double re, im;
+	if ( sscanf( ptr, "%.16lg%.16lg", &re, &im ) == EOF ) {}; // check return code
+	return re + im * _Complex_I;
+}
+long double _Complex ato( const char * ptr ) {
+	long double re, im;
+	if ( sscanf( ptr, "%.32Lg%.32Lg", &re, &im ) == EOF ) {}; // check return code
+	return re + im * _Complex_I;
+}	
+
+int strto( const char * sptr, char ** eptr, int base ) {
+	return (int)strtol( sptr, eptr, base );
+}
+unsigned int strto( const char * sptr, char ** eptr, int base ) {
+	return (unsigned int)strtoul( sptr, eptr, base );
+}
+long int strto( const char * sptr, char ** eptr, int base ) {
+	return strtol( sptr, eptr, base );
+}
+unsigned long int strto( const char * sptr, char ** eptr, int base ) {
+	return strtoul( sptr, eptr, base );
+}
+long long int strto( const char * sptr, char ** eptr, int base ) {
+	return strtoll( sptr, eptr, base );
+}
+unsigned long long int strto( const char * sptr, char ** eptr, int base ) {
+	return strtoull( sptr, eptr, base );
+}
+float strto( const char * sptr, char ** eptr ) {
+	return strtof( sptr, eptr );
+}
+double strto( const char * sptr, char ** eptr ) {
+	return strtod( sptr, eptr );
+}
+long double strto( const char * sptr, char ** eptr ) {
+	return strtold( sptr, eptr );
+}
+float _Complex strto( const char * sptr, char ** eptr ) {
+	float re, im;
+	re = strtof( sptr, eptr );
+	if ( sptr == *eptr ) return 0.0;
+	im = strtof( sptr, eptr );
+	if ( sptr == *eptr ) return 0.0;
+	return re + im * _Complex_I;
+}
+double _Complex strto( const char * sptr, char ** eptr ) {
+	double re, im;
+	re = strtod( sptr, eptr );
+	if ( sptr == *eptr ) return 0.0;
+	im = strtod( sptr, eptr );
+	if ( sptr == *eptr ) return 0.0;
+	return re + im * _Complex_I;
+}
+long double _Complex strto( const char * sptr, char ** eptr ) {
+	long double re, im;
+	re = strtold( sptr, eptr );
+	if ( sptr == *eptr ) return 0.0;
+	im = strtold( sptr, eptr );
+	if ( sptr == *eptr ) return 0.0;
+	return re + im * _Complex_I;
+}
+
+//---------------------------------------
+
+forall( type T | { int ?<?( T, T ); } )
+T * bsearch( const T key, const T * arr, size_t dimension ) {
+	int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
+	return (T *)bsearch( &key, arr, dimension, sizeof(T), comp );
+} // bsearch
+
+forall( type T | { int ?<?( T, T ); } )
+void qsort( const T * arr, size_t dimension ) {
+	int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
+	qsort( arr, dimension, sizeof(T), comp );
+} // qsort
+
+//---------------------------------------
+
+forall( type T | { T ?/?( T, T ); T ?%?( T, T ); } )
+[ T, T ] div( T t1, T t2 ) { /* return [ t1 / t2, t1 % t2 ]; */ }
+
+//---------------------------------------
+
+char abs( char v ) { return abs( (int)v ); }
+long int abs( long int v ) { return labs( v ); }
+long long int abs( long long int v ) { return llabs( v ); }
+float abs( float v ) { return fabsf( v ); }
+double abs( double v ) { return fabs( v ); }
+long double abs( long double v ) { return fabsl( v ); }
+float _Complex abs( float _Complex v ) { return cabsf( v ); }
+double _Complex abs( double _Complex v ) { return cabs( v ); }
+long double _Complex abs( long double _Complex v ) { return cabsl( v ); }
+
+//---------------------------------------
+
+void randseed( long int s ) { srand48( s ); }
+char random() { return lrand48(); }
+int random() { return mrand48(); }
+unsigned int random() { return lrand48(); }
+long int random() { return mrand48(); }
+unsigned long int random() { return lrand48(); }
+float random() { return (float)drand48(); }				// otherwise float uses lrand48
+double random() { return drand48(); }
+float _Complex random() { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
+double _Complex random() { return drand48() + (double _Complex)(drand48() * _Complex_I); }
+long double _Complex random() { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
+
+//---------------------------------------
+
+forall( type T | { int ?<?( T, T ); } )
+T min( const T t1, const T t2 ) {
+	return t1 < t2 ? t1 : t2;
+} // min
+
+forall( type T | { int ?>?( T, T ); } )
+T max( const T t1, const T t2 ) {
+	return t1 > t2 ? t1 : t2;
+} // max
+
+forall( type T )
+void swap( T * t1, T * t2 ) {
+	T temp = *t1;
+	*t1 = *t2;
+	*t2 = temp;
+} // swap
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
