diff --git a/.monadid b/.monadid
index a32bb922b284b273414431fa2159d2dca084a340..605d7b63ac17960dcf5bb39328700851377ce56b 100644
--- a/.monadid
+++ b/.monadid
@@ -1,4 +1,4 @@
-monad identification file
-This file is used for monad directory identification
+pure-monad identification file
+This file is used for pure-monad directory identification
 Built by toole1 on linux1.ews.illinois.edu
-Build Date: Wed Jan 25 01:07:42 CST 2012
+Build Date: Thu Jan 26 17:09:06 CST 2012
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 6b2a61a7f25a21926f12fdb5fdfd57867b8859b8..0000000000000000000000000000000000000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-monad is released under the University of Illinois/NCSA Open Source License,
-reproduced below:
-
-Copyright (c) 2011 Jack Toole.  All rights reserved.
-
-Developed by: Jack Toole <jack@toole1.com>
-              University of Illinois at Urbana-Champaign
-              http://code.autograder.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal with the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-  1. Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimers.
-  2. Redistributions in binary form must reproduce the above copyright
-     notice, this list of conditions and the following disclaimers in the
-     documentation and/or other materials provided with the distribution.
-  3. Neither the names of Jack Toole, CS 225, the University of Illinois at
-     Urbana-Champaign, nor the names of its contributors may be used to
-     endorse or promote products derived from this Software without specific
-     prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-WITH THE SOFTWARE.
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 5045194ccf4beca0892c637c4033a11dd2b0579d..0000000000000000000000000000000000000000
--- a/Makefile
+++ /dev/null
@@ -1,63 +0,0 @@
-CC = g++
-CFLAGS = -Wall -Wshadow
-EXENAME = monad
-CCMONAD = ccmonad
-OBJS = $(EXENAME).o help.o util.o monad_shared.o
-CCOBJS = $(CCMONAD).o util.o monad_shared.o
-IDFILE = .monadid
-OPTIMIZE = off
-
-ifeq ($(strip $(OPTIMIZE)),on)
-CFLAGS += -O2 -DOPTIMIZE
-else ifeq ($(strip $(OPTIMIZE)),off)
-CFLAGS += -g -O0
-else
-$(warning Invalid value specified for OPTIMIZE. Should be on or off)
-CFLAGS += -g -O0
-endif
-
-LIBS:=
-IS_LIBRT:=$(shell echo "int main(){}" | g++ -o /dev/null -x c++ - -lrt &>/dev/null ; echo $$?)
-IS_LIBPNG:=$(shell echo "int main(){}" | g++ -o /dev/null -x c++ - -lpng &>/dev/null ; echo $$?)
-ifeq ($(IS_LIBRT),0)
-LIBS+= -lrt
-endif
-ifeq ($(IS_LIBPNG),0)
-LIBS+= -lpng 
-endif
-
-all: $(EXENAME) $(CCMONAD) $(IDFILE)
-
-$(IDFILE): $(OBJS)
-	echo -e '$(EXENAME) identification file\n'\
-'This file is used for $(EXENAME) directory identification\n'\
-'Built by' `whoami` 'on' `hostname`'\n'\
-'Build Date:' `date`> $(IDFILE)
-
-$(EXENAME): $(OBJS) $(IDFILE)
-	$(CC) $(LIBS) $(CFLAGS) $(OBJS) -o $@
-
-$(CCMONAD): $(CCOBJS) $(IDFILE)
-	$(CC) $(LIBS) $(CFLAGS) $(CCOBJS) -o $@
-
-help.o: help.cpp $(wildcard *.h) README.cgo README_config.cgo README_tests.cgo LICENSE.cgo quotes.cga
-
-CONVERT_TXT_TO_CGO=sed -e 's/"/\\"/g' -e 's/^/    << "/' -e 's/$$/" << endl/'
-CONVERT_TXT_TO_CGA=sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/",/'
-
-%.cgo: %.txt
-	$(CONVERT_TXT_TO_CGO) $(@:.cgo=.txt) > $@
-
-%.cga: %.txt
-	$(CONVERT_TXT_TO_CGA) $(@:.cga=.txt) > $@
-
-%.o : %.cpp $(wildcard *.h)
-	$(CC) $(CFLAGS) -c $(@:.o=.cpp) -o $@
-
-.PHONY: clean
-clean:
-	rm -f $(wildcard *.o) $(wildcard *.cgo) $(wildcard *.cga) $(EXENAME) $(CCMONAD) $(IDFILE) $(wildcard $(EXENAME)$(EXENAME)*)
-
-.PHONY: clean.sh
-clean.sh: $(EXENAME)
-	./clean.sh
diff --git a/Makefile.proxy b/Makefile.proxy
deleted file mode 100644
index f4dfb11c76ba21f803969e7578cac79e173aa567..0000000000000000000000000000000000000000
--- a/Makefile.proxy
+++ /dev/null
@@ -1,48 +0,0 @@
-CC = g++
-WARNINGS := -Wchar-subscripts -Wparentheses -Wreturn-type -Wmissing-braces -Wundef -Wshadow
-CFLAGS += $(WARNINGS)
-TESTEXE := proxy
-# This order is necessary for security. Always include student code last!
-# TODO (toole1): I wish I knew why this was; doing unit_tests first is slow if the student code doesn't compile
-TESTOBJS := $(TESTEXE).o util.o unit_tests.o monad_shared.o $(TESTOBJS)
-OPTIMIZE := off
-
-ifeq ($(strip $(OPTIMIZE)),on)
-CFLAGS += -O2 -DOPTIMIZE
-else ifeq ($(strip $(OPTIMIZE)),off)
-CFLAGS += -g -O0
-else
-$(warning Invalid value specified for OPTIMIZE. Should be on or off)
-CFLAGS += -g -O0
-endif
-
-ifndef ALL_TARGET
-ALL_TARGET = all
-all: $(TESTEXE)
-endif
-
-LIBS:=
-IS_LIBRT:=$(shell echo "int main(){}" | g++ -o /dev/null -x c++ - -lrt &>/dev/null ; echo $$?)
-IS_LIBPNG:=$(shell echo "int main(){}" | g++ -o /dev/null -x c++ - -lpng &>/dev/null ; echo $$?)
-ifeq ($(IS_LIBRT),0)
-LIBS+= -lrt
-endif
-ifeq ($(IS_LIBPNG),0)
-LIBS+= -lpng 
-endif
-
-$(TESTEXE): $(TESTOBJS)
-	$(CC) $(TESTOBJS) $(LIBS) -o $@
-
-unit_tests.o : unit_tests.cpp $(wildcard *.h)
-	../ccmonad $(CC) $(CFLAGS) -c $(@:.o=.cpp) -o $@
-
-%.o : %.cpp $(wildcard *.h)
-	$(CC) $(CFLAGS) -c $(@:.o=.cpp) -o $@
-
-ifndef CLEAN_TARGET
-CLEAN_TARGET = clean
-.PHONY: clean
-clean:
-	-rm -f *.o $(TESTEXE)
-endif
diff --git a/README.txt b/README.txt
deleted file mode 100644
index f0b77e12102685a667e02c8a296d7f0100028a96..0000000000000000000000000000000000000000
--- a/README.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-OVERVIEW: Monad Autograder (c) Jack Toole
-  Monad is a system for grading students' C/C++ code with point-weighted unit
-  tests.
-
-USAGE: monad <assignment> [options]
-  Runs the tests for <assignment> (mp1, lab01, ...)
-  '../<assignment>/' must exist
-  If '../<assignment>_tests/' or any necessary library directories do not exist,
-  they will be downloaded from SVN
-
-GENERAL OPTIONS:
-  Note: Any option may be negated with --no<option> or --<option>=false
-  Options which default to true are shown negated below
-
-  --noclean               Do not re-copy test cases into sandbox. This improves
-                          performance at the cost of safety
-  --provided              Use <assignment>_provided/ instead of
-                          <assignment>_tests/ for test cases
-  --noupdate              Do not call 'svn update' on the tests and library
-                          directories
-  --verbose               Display detailed test output information for passing
-                          tests
-  --parallel              Compiles code in parallel if possible
-
-INFORMATION OPTIONS:
-  --help                  Display this dialog
-  --help config           Help for writing config files
-  --help tests            Help for writing test cases
-  --info, --version       Display version information
-  --license               Display the license
-
-STAFF OPTIONS:
-  --staff                 Use the staff SVN repository to download test cases.
-                          This allows monad to be run by staff without
-                          releasing the test cases to students
-  --solution              Grade <assignment>_solution/ instead of
-                          <assignment>/
-  --newtests              Use <assignment>_newtests/ instead of
-                          <assignment>_tests/ for test cases. This allows new
-                          test cases to be developed without replacing the old
-                          ones for release tests
diff --git a/README_config.txt b/README_config.txt
deleted file mode 100644
index 52e7cdd60f7a8787d0cde495869d4b25dd25e7e0..0000000000000000000000000000000000000000
--- a/README_config.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-monad settings and individual test settings are stored in config.ini files
-The following options are available for monad's ./config.ini:
-[SVN Root]
-; svn base url here (http://.../cs225/)
-[Monad Files]
-; Any files to be copied from monad ./ to ./ASSIGNMENT/ testing directory
-; By default, proxy.cpp is used to run test cases:
-proxy.cpp
-
-The following options are available for individual tests' ../ASSIGNMENT_tests/config.ini:
-[Required Files]
-; Any files that must be copied from the ../ASSIGNMENT directory
-main.cpp
-[Testing Files]
-; Any files that must be copied from ../ASSIGNMENT_tests
-; By default, unit_tests.cpp contains the test cases
-unit_tests.cpp
-[Libraries]
-; Any external library folders to be present in the same directory as the
-; testing directory. These should be mirrored in [SVN Root]/_shared/
-; The 'testutil' library in this directory is also available
-EasyBMP
diff --git a/README_tests.txt b/README_tests.txt
deleted file mode 100644
index 8d09c354791e09c2078f3ef4dc412b4763936c75..0000000000000000000000000000000000000000
--- a/README_tests.txt
+++ /dev/null
@@ -1 +0,0 @@
-[not finished yet]
diff --git a/ccmonad b/ccmonad
deleted file mode 100755
index e0bc62275472a765481334fc990367f4363eba35..0000000000000000000000000000000000000000
Binary files a/ccmonad and /dev/null differ
diff --git a/ccmonad.cpp b/ccmonad.cpp
deleted file mode 100644
index 91836bdf7671f0361f93da6db1c7bf319e0088fc..0000000000000000000000000000000000000000
--- a/ccmonad.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include "util.h"
-
-using namespace std;
-using namespace util;
-
-int main(int argc, const char * const * argv)
-{
-	if (argc < 4)
-	{
-		cerr << "ccmonad: usage error" << endl;
-		exit(1);
-	}
-	string compiler = argv[1];
-	string inputFile;
-	vector<string> options;
-	string outputFile;
-	bool isNextOutput = false;
-	for (int32_t i = 2; i < argc; i++)
-	{
-		if (strlen(argv[i]) > 0)
-		{
-			if (argv[i][0] == '-')
-			{
-				if (strlen(argv[i]) > 1 && argv[i][1] == 'o')
-					isNextOutput = true;
-				else if (strcmp(argv[i], "-c") != 0)
-					options.push_back(argv[i]);
-			}
-			else
-			{
-				if (isNextOutput)
-					outputFile = argv[i];
-				else
-				{
-					if (inputFile == "")
-						inputFile = argv[i];
-					else
-					{
-						cerr << "ccmonad: error: ccmonad can only take one input file" << endl;
-						exit(1);
-					}
-				}
-			}
-		}
-	}
-	if (outputFile == "")
-	{
-		cerr << "ccmonad: usage error" << endl;
-		exit(1);
-	}
-#if 0
-	cout << "Compiler: " << compiler << endl;
-	cout << "Input: " << inputFile << endl;
-	cout << "Output: " << outputFile << endl;
-#endif
-
-	if (!exists(inputFile))
-	{
-		cerr << "ccmonad: error: file not found: " << inputFile << endl;
-		exit(1);
-	}
-
-	vector<string> args1 = options;
-	args1.push_back("-c");
-	args1.push_back(inputFile);
-	args1.push_back("-o");
-	args1.push_back(outputFile);
-	int8_t result1 = exec(compiler, args1);
-	if (result1 != 0)
-	{
-		vector<size_t> splits;
-		splits.push_back(0); // for compiling something always (should be empty)
-
-		ifstream input(inputFile.c_str());
-		for (size_t line_i = 1; input.good(); line_i++)
-		{
-			string line;
-			getline(input, line);
-			vector<string> tokens = tokenize(line, " \t");
-			if (tokens.size() >= 2 && tokens[0] == "#if" && tokens[1] == "MONAD_SPLIT")
-				splits.push_back(line_i);
-		}
-
-		vector<string> intermediate_outputs; // = options;
-		//intermediate_outputs.push_back("-shared");
-		intermediate_outputs.push_back("-r");
-		for (size_t split_i = 0; split_i < splits.size(); split_i++)
-		{
-			vector<string> args = options;
-			args.push_back("-c");
-			args.push_back(inputFile);
-			args.push_back("-DMONAD_SPLIT_LINE_NUMBER=" + lexical_cast<string>(splits[split_i]));
-			args.push_back("-o");
-			args.push_back(outputFile + "." + split_i);
-		
-#if 0
-			cout << "\tmonacc: " << compiler;
-			for (size_t i = 0; i < args.size(); i++)
-				cout << ' ' << args[i];
-			cout << endl;
-#endif
-
-			int8_t result2 = exec(compiler, args);
-			if (result2 == 0)
-				intermediate_outputs.push_back(outputFile + "." + split_i);
-		}
-		intermediate_outputs.push_back("-o");
-		intermediate_outputs.push_back(outputFile);
-
-		return exec("ld", intermediate_outputs);
-		//return exec("mv", intermediate_outputs[2], outputFile);
-	}
-	else
-		return 0;
-}
diff --git a/config.ini b/config.ini
deleted file mode 100644
index 7454c9aad3643f563cef6d1bc0c19f85cf446247..0000000000000000000000000000000000000000
--- a/config.ini
+++ /dev/null
@@ -1,24 +0,0 @@
-[SVN Root]
-:https://subversion.ews.illinois.edu/svn/sp12-cs225/
-
-[SVN Public Dir]
-:_shared
-
-[Staff SVN]
-:https://subversion.cs.illinois.edu/svn/cs225/
-
-[Staff SVN Dir]
-:_current
-
-[Monad Files]
-Makefile.proxy
-memcheck.h
-monad_shared.h
-monad_shared.cpp
-proxy.h
-proxy.cpp
-valgrind.h
-
-[Libraries]
-util
-
diff --git a/help.cpp b/help.cpp
deleted file mode 100644
index 9fbbb4115f38974093d2df0fd6b3d4644b238996..0000000000000000000000000000000000000000
--- a/help.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "monad.h"
-
-namespace monad
-{
-
-void printHelp()
-{
-	cout
-#include "README.cgo"
-	;
-}
-
-void printHelpConfig()
-{
-	cout
-#include "README_config.cgo"
-	;
-}
-
-void printHelpTests()
-{
-	cout
-#include "README_tests.cgo"
-	;
-}
-
-void printLicense()
-{
-	cout
-#include "LICENSE.cgo"
-	;
-}
-
-const char * getRandomQuote()
-{
-	const char * quotes[] = {
-#include "quotes.cga"
-	};
-	size_t quotes_size = (sizeof quotes) / (sizeof quotes[0]);
-	return quotes[urandn(quotes_size)];
-}
-
-} // namespace monad
diff --git a/memcheck.h b/memcheck.h
deleted file mode 100644
index 0e002702b2789ef3f7715cbf37f6af40fb753c39..0000000000000000000000000000000000000000
--- a/memcheck.h
+++ /dev/null
@@ -1,277 +0,0 @@
-
-/*
-   ----------------------------------------------------------------
-
-   Notice that the following BSD-style license applies to this one
-   file (memcheck.h) only.  The rest of Valgrind is licensed under the
-   terms of the GNU General Public License, version 2, unless
-   otherwise indicated.  See the COPYING file in the source
-   distribution for details.
-
-   ----------------------------------------------------------------
-
-   This file is part of MemCheck, a heavyweight Valgrind tool for
-   detecting memory errors.
-
-   Copyright (C) 2000-2010 Julian Seward.  All rights reserved.
-
-   redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions
-   are met:
-
-   1. redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-   2. The origin of this software must not be misrepresented; you must 
-      not claim that you wrote the original software.  If you use this 
-      software in a product, an acknowledgment in the product 
-      documentation would be appreciated but is not required.
-
-   3. Altered source versions must be plainly marked as such, and must
-      not be misrepresented as being the original software.
-
-   4. The name of the author may not be used to endorse or promote 
-      products derived from this software without specific prior written 
-      permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-   ----------------------------------------------------------------
-
-   Notice that the above BSD-style license applies to this one file
-   (memcheck.h) only.  The entire rest of Valgrind is licensed under
-   the terms of the GNU General Public License, version 2.  See the
-   COPYING file in the source distribution for details.
-
-   ---------------------------------------------------------------- 
-*/
-
-
-#ifndef __MEMCHECK_H
-#define __MEMCHECK_H
-
-
-/* This file is for inclusion into client (your!) code.
-
-   You can use these macros to manipulate and query memory permissions
-   inside your own programs.
-
-   See comment near the top of valgrind.h on how to use them.
-*/
-
-#include "valgrind.h"
-
-/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! 
-   This enum comprises an ABI exported by Valgrind to programs
-   which use client requests.  DO NOT CHANGE THE ORDER OF THESE
-   ENTRIES, NOR DELETE ANY -- add new ones at the end. */
-typedef
-   enum { 
-      VG_USERREQ__MAKE_MEM_NOACCESS = VG_USERREQ_TOOL_BASE('M','C'),
-      VG_USERREQ__MAKE_MEM_UNDEFINED,
-      VG_USERREQ__MAKE_MEM_DEFINED,
-      VG_USERREQ__DISCARD,
-      VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,
-      VG_USERREQ__CHECK_MEM_IS_DEFINED,
-      VG_USERREQ__DO_LEAK_CHECK,
-      VG_USERREQ__COUNT_LEAKS,
-
-      VG_USERREQ__GET_VBITS,
-      VG_USERREQ__SET_VBITS,
-
-      VG_USERREQ__CREATE_BLOCK,
-
-      VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE,
-
-      /* Not next to VG_USERREQ__COUNT_LEAKS because it was added later. */
-      VG_USERREQ__COUNT_LEAK_BLOCKS,
-
-      /* This is just for memcheck's internal use - don't use it */
-      _VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR 
-         = VG_USERREQ_TOOL_BASE('M','C') + 256
-   } Vg_MemCheckClientRequest;
-
-
-
-/* Client-code macros to manipulate the state of memory. */
-
-/* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */
-#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len)           \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
-                            VG_USERREQ__MAKE_MEM_NOACCESS,       \
-                            (_qzz_addr), (_qzz_len), 0, 0, 0)
-      
-/* Similarly, mark memory at _qzz_addr as addressable but undefined
-   for _qzz_len bytes. */
-#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len)          \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
-                            VG_USERREQ__MAKE_MEM_UNDEFINED,      \
-                            (_qzz_addr), (_qzz_len), 0, 0, 0)
-
-/* Similarly, mark memory at _qzz_addr as addressable and defined
-   for _qzz_len bytes. */
-#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len)            \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
-                            VG_USERREQ__MAKE_MEM_DEFINED,        \
-                            (_qzz_addr), (_qzz_len), 0, 0, 0)
-
-/* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is
-   not altered: bytes which are addressable are marked as defined,
-   but those which are not addressable are left unchanged. */
-#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len)     \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,              \
-                            VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \
-                            (_qzz_addr), (_qzz_len), 0, 0, 0)
-
-/* Create a block-description handle.  The description is an ascii
-   string which is included in any messages pertaining to addresses
-   within the specified memory range.  Has no other effect on the
-   properties of the memory range. */
-#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc)	   \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,        \
-                            VG_USERREQ__CREATE_BLOCK,              \
-                            (_qzz_addr), (_qzz_len), (_qzz_desc),  \
-                            0, 0)
-
-/* Discard a block-description-handle. Returns 1 for an
-   invalid handle, 0 for a valid handle. */
-#define VALGRIND_DISCARD(_qzz_blkindex)                          \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \
-                            VG_USERREQ__DISCARD,                 \
-                            0, (_qzz_blkindex), 0, 0, 0)
-
-
-/* Client-code macros to check the state of memory. */
-
-/* Check that memory at _qzz_addr is addressable for _qzz_len bytes.
-   If suitable addressibility is not established, Valgrind prints an
-   error message and returns the address of the first offending byte.
-   Otherwise it returns zero. */
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len)      \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                             \
-                            VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,  \
-                            (_qzz_addr), (_qzz_len), 0, 0, 0)
-
-/* Check that memory at _qzz_addr is addressable and defined for
-   _qzz_len bytes.  If suitable addressibility and definedness are not
-   established, Valgrind prints an error message and returns the
-   address of the first offending byte.  Otherwise it returns zero. */
-#define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len)        \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                           \
-                            VG_USERREQ__CHECK_MEM_IS_DEFINED,    \
-                            (_qzz_addr), (_qzz_len), 0, 0, 0);
-
-/* Use this macro to force the definedness and addressibility of an
-   lvalue to be checked.  If suitable addressibility and definedness
-   are not established, Valgrind prints an error message and returns
-   the address of the first offending byte.  Otherwise it returns
-   zero. */
-#define VALGRIND_CHECK_VALUE_IS_DEFINED(__lvalue)                \
-   VALGRIND_CHECK_MEM_IS_DEFINED(                                \
-      (volatile unsigned char *)&(__lvalue),                     \
-                      (unsigned long)(sizeof (__lvalue)))
-
-
-/* Do a full memory leak check (like --leak-check=full) mid-execution. */
-#define VALGRIND_DO_LEAK_CHECK                                   \
-   {unsigned long _qzz_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__DO_LEAK_CHECK,           \
-                            0, 0, 0, 0, 0);                      \
-   }
-
-/* Do a summary memory leak check (like --leak-check=summary) mid-execution. */
-#define VALGRIND_DO_QUICK_LEAK_CHECK				 \
-   {unsigned long _qzz_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
-                            VG_USERREQ__DO_LEAK_CHECK,           \
-                            1, 0, 0, 0, 0);                      \
-   }
-
-/* Return number of leaked, dubious, reachable and suppressed bytes found by
-   all previous leak checks.  They must be lvalues.  */
-#define VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed)     \
-   /* For safety on 64-bit platforms we assign the results to private
-      unsigned long variables, then assign these to the lvalues the user
-      specified, which works no matter what type 'leaked', 'dubious', etc
-      are.  We also initialise '_qzz_leaked', etc because
-      VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
-      defined. */                                                        \
-   {unsigned long _qzz_res;                                              \
-    unsigned long _qzz_leaked    = 0, _qzz_dubious    = 0;               \
-    unsigned long _qzz_reachable = 0, _qzz_suppressed = 0;               \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                              \
-                               VG_USERREQ__COUNT_LEAKS,                  \
-                               &_qzz_leaked, &_qzz_dubious,              \
-                               &_qzz_reachable, &_qzz_suppressed, 0);    \
-    leaked     = _qzz_leaked;                                            \
-    dubious    = _qzz_dubious;                                           \
-    reachable  = _qzz_reachable;                                         \
-    suppressed = _qzz_suppressed;                                        \
-   }
-
-/* Return number of leaked, dubious, reachable and suppressed bytes found by
-   all previous leak checks.  They must be lvalues.  */
-#define VALGRIND_COUNT_LEAK_BLOCKS(leaked, dubious, reachable, suppressed) \
-   /* For safety on 64-bit platforms we assign the results to private
-      unsigned long variables, then assign these to the lvalues the user
-      specified, which works no matter what type 'leaked', 'dubious', etc
-      are.  We also initialise '_qzz_leaked', etc because
-      VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as
-      defined. */                                                        \
-   {unsigned long _qzz_res;                                              \
-    unsigned long _qzz_leaked    = 0, _qzz_dubious    = 0;               \
-    unsigned long _qzz_reachable = 0, _qzz_suppressed = 0;               \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                              \
-                               VG_USERREQ__COUNT_LEAK_BLOCKS,            \
-                               &_qzz_leaked, &_qzz_dubious,              \
-                               &_qzz_reachable, &_qzz_suppressed, 0);    \
-    leaked     = _qzz_leaked;                                            \
-    dubious    = _qzz_dubious;                                           \
-    reachable  = _qzz_reachable;                                         \
-    suppressed = _qzz_suppressed;                                        \
-   }
-
-
-/* Get the validity data for addresses [zza..zza+zznbytes-1] and copy it
-   into the provided zzvbits array.  Return values:
-      0   if not running on valgrind
-      1   success
-      2   [previously indicated unaligned arrays;  these are now allowed]
-      3   if any parts of zzsrc/zzvbits are not addressable.
-   The metadata is not copied in cases 0, 2 or 3 so it should be
-   impossible to segfault your system by using this call.
-*/
-#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes)                     \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                               \
-                                    VG_USERREQ__GET_VBITS,           \
-                                    (char*)(zza), (char*)(zzvbits),  \
-                                    (zznbytes), 0, 0)
-
-/* Set the validity data for addresses [zza..zza+zznbytes-1], copying it
-   from the provided zzvbits array.  Return values:
-      0   if not running on valgrind
-      1   success
-      2   [previously indicated unaligned arrays;  these are now allowed]
-      3   if any parts of zza/zzvbits are not addressable.
-   The metadata is not copied in cases 0, 2 or 3 so it should be
-   impossible to segfault your system by using this call.
-*/
-#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes)                     \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                               \
-                                    VG_USERREQ__SET_VBITS,           \
-                                    (char*)(zza), (char*)(zzvbits),  \
-                                    (zznbytes), 0, 0 )
-
-#endif
-
diff --git a/monad b/monad
deleted file mode 100755
index 2d043f1c18e3ea1126401c3f22af96475f8eb878..0000000000000000000000000000000000000000
Binary files a/monad and /dev/null differ
diff --git a/monad.cpp b/monad.cpp
deleted file mode 100644
index 16bf9837fc8287e585ccd092dac4eee273f45f02..0000000000000000000000000000000000000000
--- a/monad.cpp
+++ /dev/null
@@ -1,507 +0,0 @@
-// monad
-// For illinois.edu CS 225 spring 2011
-// By Jack Toole
-
-#include "monad.h"
-
-namespace monad
-{
-void find_base_dir(const char * argv0);
-void create_mp_part_file();
-void processArgs(int argc, const char * const * argv);
-void copyRequiredFiles();
-void getLibs(const vector<string> & libs);
-string updateFolder(const string & folder, bool link);
-string tryGetFolder(string dirAndFolder, const string & target, bool link);
-string getFolder(const string & folder, const string & searchDir = "", bool link = false);
-void importFiles(const string & preservedFolder, const string & theSourceFolder,
-                 const string & destFolder, const vector<string> & files);
-void exec_command(const string & command);
-
-string assignment_base;
-int8_t mp_part;
-const int8_t no_mp_part = -1;
-
-string testsFolder;
-string sourceFolder;
-string gradeFolder;
-string tempFolder;
-
-FileMap config;
-
-namespace opts
-{
-bool solution = false;
-bool clean    = true;
-bool update   = true;
-bool staff    = false;
-bool newtests = false;
-bool provided = false;
-
-bool verbose  = false;
-bool buffer   = true;
-bool valgrind = false;
-bool parallel = false;
-
-bool help     = false;
-bool info     = false;
-bool license  = false;
-#if OPTIMIZE
-bool optimize = true;
-#else
-bool optimize = false;
-#endif
-}
-
-}
-
-
-int main(int argc, const char * const * argv)
-{
-	using namespace monad;
-
-	output::set_error_message();
-	
-	// Find monad/ directory
-	find_base_dir(argv[0]);
-
-	// Read in local config settings.
-	// Necessary to do this early for [SVN Root] url
-	readConfig("./", config);
-	processArgs(argc, argv);
-
-	cout << versioninfo::official_name << endl;
-	cout << "Testing " << assignment_base;
-	if (mp_part != no_mp_part) cout << '.' << (int)mp_part;
-	cout << "..." << endl;
-	cout << getRandomQuote() << endl;
-	cout << endl;
-
-	cout << "Setting up test environment..." << endl;
-
-	// Read in test-specific config settings
-	if (mp_part == no_mp_part)
-		readConfig(testsFolder, config);
-	else
-		readConfig(testsFolder, config, to_string((int)mp_part));
-
-	copyRequiredFiles();
-
-	// Sleep for a second to avoid clock skew warnings
-	// This cummulatively adds about 5 minutes to grade each mp,
-	// but with the benefit of avoiding newsgroup posts
-	// CHANGED: Judging by previous emails, the time needed for
-	// this would vary significantly. not sure about solution
-	//	sleep(1);
-
-	output::header("Compiling");
-	chdir(gradeFolder.c_str());
-
-	// #define MP_PART_NUMBER in proxy
-	create_mp_part_file();
-	// Change inclusion guards in proxy.h
-	exec("sed", "-i", "-e", "s/PROXY_H/PROXY_" + lexical_cast<string>(urand()) + "_H/g", "./proxy.h");
-
-	// run [Pre-Make Commands] config header
-	const vector<string> & processing_commands = config["Pre-Make Commands"];
-	for (size_t i = 0; i < processing_commands.size(); i++)
-		exec_command(processing_commands[i]);
-
-	string makestr = "/usr/bin/make --warn-undefined-variables -Wfatal-errors";
-	if (opts::parallel)
-		makestr += " --jobs=4";
-	if (!opts::verbose)
-		makestr += " --quiet";
-	if (opts::optimize)
-		makestr += " OPTIMIZE=on";
-	if (!config["Make Options"].empty())
-		makestr += " " + config["Make Options"][0];
-	if (opts::verbose)
-		cout << makestr <<endl;
-
-	// Compile with make
-	system(makestr.c_str()); // yes, system is insecure if the user has control
-	                         // over config.ini. But students don't.
-							 // TODO (toole1): Yeah but this leaves us open to
-							 // aliasing issues, or forces us to specify make's
-							 // path. Ugly either way.
-	// TODO exec("make", "--quiet", "--warn-undefined-variables", 
-
-	cout << endl << endl;
-	vector<string> args;
-	if (opts::verbose) args.push_back("--verbose");
-	if (opts::valgrind) args.push_back("--valgrind");
-	if (!opts::buffer) args.push_back("--noredirect");
-	int score = exec("./proxy", args);
-
-	// TODO (toole1): this causes weird output when scores are like 200
-	if (score < 0)
-	{
-		output::header("Running tests");
-		cout << "Could not execute test cases" << endl << endl;
-		score = 0;
-
-		cout << endl;
-		output::total_score(score, -1);
-	}
-
-	return score;
-}
-
-void monad::create_mp_part_file()
-{
-	ofstream mp_part_file("mp_part.h");
-	mp_part_file << "#ifndef MONAD_SPLIT_LINE_NUMBER" << endl;
-	mp_part_file << "#define MONAD_SPLIT_LINE_NUMBER -1" << endl;
-	mp_part_file << "#endif" << endl;
-	mp_part_file << "#define MONAD_SPLIT (MONAD_SPLIT_LINE_NUMBER == __LINE__ || MONAD_SPLIT_LINE_NUMBER == -1)" << endl;
-	mp_part_file << "#define NO_MP_PART " << static_cast<int>(no_mp_part) << endl;
-	mp_part_file << "#define MP_PART_NUMBER ";
-	if (mp_part == no_mp_part) mp_part_file << "NO_MP_PART"; else mp_part_file << static_cast<int>(mp_part);
-	mp_part_file << endl;
-	mp_part_file << "#define MP_PART(x) (MP_PART_NUMBER == (x) || MP_PART_NUMBER == NO_MP_PART)" << endl;
-	mp_part_file.close();
-}
-
-void monad::processArgs(int argc, const char * const * argv)
-{
-    // Create OptionsMap for options and vector for positional arguments:
-	OptionsParser options;
-
-	// Add our possible options to our map
-	options.addOption("solution", opts::solution);
-	options.addOption("newtests", opts::newtests);
-	options.addOption("provided", opts::provided);
-	options.addOption("clean",    opts::clean);
-	options.addOption("update",   opts::update);
-	options.addOption("staff",    opts::staff);
-	
-	options.addOption("optimize", opts::optimize);
-	options.addOption("verbose",  opts::verbose);
-	options.addOption("buffer",   opts::buffer);
-	options.addOption("valgrind", opts::valgrind);
-	options.addOption("parallel", opts::parallel);
-
-	options.addOption("help",     opts::help);
-	options.addOption("h",        opts::help);
-	options.addOption("info",     opts::info);
-	options.addOption("version",  opts::info);
-	options.addOption("v",        opts::info);
-	options.addOption("license",  opts::license);
-
-	// Add arguments
-	string assignment = "";
-	options.addArg(assignment);
-
-	// Read in options and arguments
-	vector<string> posargs = options.parse(argc, argv);
-	
-	// Help
-	if (opts::help || toLower(assignment) == "help")
-	{
-		if (toLower(assignment) == "config")
-			printHelpConfig();
-		else if (toLower(assignment) == "tests")
-			printHelpTests();
-		else
-			printHelp();
-		exit(0);
-	}
-
-	// Info
-	if (opts::info)
-	{
-		printInfo();
-		exit(0);
-	}
-	
-	// License
-	if (opts::license)
-	{
-		printLicense();
-		exit(0);
-	}
-	
-	// Clean
-	if (toLower(assignment) == "clean")
-	{
-		system("/bin/rm -rf *_grade/ *_tests/ *_newtests/ *_providedtests *_solution/");
-		exit(0);
-	}
-
-	// Check argument list length
-	if (assignment == "")
-	{
-		cout << "Usage: " << argv[0] << " mp1" << endl;
-		cout << "Run \'" << argv[0] << " --help\' for more information" << endl;
-		exit(0);
-	}
-
-	// Find mp/lab name and tests folder
-	if (assignment[assignment.length() - 1] == '/')
-		assignment = assignment.substr(0, assignment.length() - 1);
-	size_t slash_i = assignment.find_last_of('/');
-	string assignment_name = (slash_i == string::npos) ? assignment : assignment.substr(slash_i + 1);
-	string assignment_dir  = (slash_i == string::npos) ? "" : assignment.substr(0, slash_i);
-
-	// TODO (toole1): All this stuff is ugly!
-	vector<string> splitname = tokenize(assignment_name, '.');
-	assignment_base = splitname[0];
-	if (splitname.size() == 1)
-		mp_part = no_mp_part;
-	else
-		mp_part = lexical_cast<int>(splitname[1].c_str());
-	
-	gradeFolder = "./" + assignment_base + "_grade/";
-	if (!exists(gradeFolder)) opts::clean = true;
-
-	if (opts::clean)
-		tempFolder = "";
-	else
-		tempFolder  = "./" + assignment_base + "_temp/";
-
-	// Find source folder (i.e. ../mp1)
-	if (opts::solution)
-		sourceFolder = updateFolder(assignment_base + "_solution/", false);
-	else
-		sourceFolder = getFolder(assignment_base + '/', assignment_dir, false);
-
-	// tests folder
-	if (opts::provided)
-		testsFolder = updateFolder(assignment_base + "_provided/", false);
-	else if (opts::newtests)
-		testsFolder = updateFolder(assignment_base + "_newtests/", false);
-	else
-		testsFolder = updateFolder(assignment_base + "_tests/", false);
-}
-
-
-void monad::find_base_dir(const char * argv0)
-{
-	EXIT_IF_ERROR(argv0 == NULL);
-	size_t argv0len = strlen(argv0);
-	char * dir = new char[argv0len + 1];
-	strncpy(dir, argv0, argv0len);
-	dir[argv0len] = '\0';
-
-	size_t i = argv0len + 1;
-	do
-	{
-		i--;
-		if (argv0[i] == '/') break;
-	} while (i != 0);
-
-	// Change directory
-	if (i != 0)
-	{
-		dir[i] = '\0';
-		EXIT_IF_ERROR(chdir(dir));
-	}
-	delete [] dir;
-
-	// Ensure the dir is correct
-	if (!exists("./.monadid"))
-	{
-		cerr << "Could not find monad directory. "
-		        "Please run ./monad from the directory it is located in."
-		     << endl;
-		exit(-1);
-	}
-}
-
-
-void monad::copyRequiredFiles()
-{
-	// Clear out the temp testing folder
-	if (opts::clean)
-		forceRemoveDir(gradeFolder);
-	else
-	{
-		forceRemoveDir(tempFolder);
-		EXIT_IF_ERROR(rename(gradeFolder.c_str(), tempFolder.c_str())); 
-	}
-
-	exec("/bin/mkdir", gradeFolder);
-
-	// Copy and link appropriate files - parsed from config.ini
-	importFiles(tempFolder, "./",         gradeFolder, config["Monad Files"]);
-	importFiles(tempFolder, testsFolder,  gradeFolder, config["Testing Files"]);
-	importFiles("",         sourceFolder, gradeFolder, config["Required Files"]);
-	importFiles(tempFolder, "",           gradeFolder, config["Preserved Files"]);
-
-	forceRemoveDir(tempFolder);
-
-	getLibs(config["Libraries"]);
-}
-
-
-void monad::importFiles(const string & preservedFolder, const string & theSourceFolder,
-                 const string & destFolder, const vector<string> & files)
-{
-	// 0 for student errors for missing Required Files dir
-	int student_error_code = ((preservedFolder == "") ? 0 : -1);
-
-	assertExists(destFolder);
-	if (preservedFolder != "") assertExists(preservedFolder);
-	if (theSourceFolder    != "") assertExists(theSourceFolder, student_error_code);
-
-	for (size_t i = 0; i < files.size(); i++)
-	{
-		string preservedFile = preservedFolder + files[i];
-		string destFile      = destFolder      + files[i];
-
-		// Move the file from it's preservation instance
-		if (preservedFolder != "" && exists(preservedFile) &&
-		    (theSourceFolder == "" || (permissions(preservedFile) & S_IWUSR) == 0))
-		{
-//!!			cout << "mv " << preservedFile << ' ' << destFile << endl;
-			EXIT_IF_ERROR(rename(preservedFile.c_str(), destFile.c_str()));
-		}
-		else if (theSourceFolder != "")
-		{
-			// copy the file from it's source
-			string sourceFile = theSourceFolder + files[i];
-			assertExists(sourceFile, student_error_code);
-
-			// Remove hacky call to exec here...
-			EXIT_IF_ERROR(exec("cp", "-RL", sourceFile.c_str(), destFile.c_str()) != 0,
-				"cp " + sourceFile + " " + destFile + " failed");
-		}
-		else continue;
-
-		// TODO (toole1) Protect files. This is hacky and should be in util
-		// TODO (toole1) this should also be AFTER Pre-Make Commands
-		// EXIT_IF_ERROR(chmod(destFile.c_str(),
-		//	S_IRUSR | (permissions(destFile) & S_IXUSR)) != 0);
-	}
-}
-
-
-void monad::getLibs(const vector<string> & libs)
-{
-	for (size_t lib_i = 0; lib_i < libs.size(); lib_i++)
-	{
-		string folder = updateFolder(libs[lib_i], false);
-		protectDir(folder);
-		chdir(gradeFolder.c_str());
-		system(("/bin/ln -s ../"+folder+"* ./").c_str());
-		chdir("..");
-	}
-}
-
-string monad::updateFolder(const string & folder, bool link)
-{
-	string get = getFolder(folder, "", link);
-	if (opts::update)
-		exec("svn", "up", get /*, NULL*/);
-	return get;
-}
-
-string monad::tryGetFolder(string dirAndFolder, const string & target, bool link)
-{
-	if (dirAndFolder[dirAndFolder.length() - 1] == '/')
-		dirAndFolder = dirAndFolder.substr(0, dirAndFolder.size() - 1);
-	
-	if (exists(dirAndFolder + "/"))
-	{
-		if (!link) return dirAndFolder + "/";
-		EXIT_IF_ERROR(symlink(dirAndFolder.c_str(), target.c_str()) != 0);
-		return target + "/";
-	}
-
-	return "";
-}
-
-string monad::getFolder(const string & folder, const string & searchDir /* = "" */, bool link /* = false */)
-{
-	// TODO (toole1): All this stuff is ugly!
-	string target = "./" + folder;
-	string result;
-
-	// Look in the searchDir folder
-	if (searchDir != "")
-	{
-		result = tryGetFolder(searchDir + "/" + folder, target, link);
-		if (result != "") return result;
-		
-		// Try SVN
-		// Clear out our cache first
-		if (exists(target + "/"))
-			exec("rm", "-rf", target + "/");
-
-		EXIT_IF_ERROR(config["SVN Root"].size() != 1);
-		string svndir = config["SVN Root"][0] + "/" + searchDir + "/" + folder;
-
-		int svnstatus = exec("svn", "co", svndir /*, NULL*/);
-		if (svnstatus == 0) return target + "/";
-
-		cerr << "Error: " << folder << " not found." << endl;
-		exit(-1);
-	}
-
-	// Look in the parent folder
-	result = tryGetFolder("../" + folder, target, link);
-	if (result != "") return result;
-
-	// Look in the current folder
-	if (exists(target + "/"))
-		return target + "/";
-
-	// Look two directories up and over - why not? If the parent folder is
-	// the target source folder for the mp/lab, then the tests or libs
-	// may be two up and over
-	// This also covers the case where it is our parent folder
-	result = tryGetFolder("../../" + folder, target, link);
-	if (result != "") return result;
-
-	// Check Subversion
-
-	string svn_config_name;
-	string svn_config_subdir;
-	if (!opts::staff)
-	{
-		svn_config_name = "SVN Root";
-		svn_config_subdir = "SVN Public Dir";
-	}
-	else
-	{
-		svn_config_name = "Staff SVN";
-		svn_config_subdir = "Staff SVN Dir";
-	}
-	if (!config[svn_config_name].empty())
-	{
-		EXIT_IF_ERROR(config[svn_config_name].size()   != 1);
-		EXIT_IF_ERROR(config[svn_config_subdir].size() != 1);
-		string svndir = config[svn_config_name][0] + "/" + config[svn_config_subdir][0] + "/" + folder;
-
-		// TODO (toole1): Won't work if user needs to type password
-		int svnstatus = exec("svn", "co", svndir /*, NULL*/);
-		if (svnstatus == 0) return target + "/";
-	}
-
-	cerr << "Error: " << folder << " not found." << endl;
-	exit(-1);
-}
-
-
-// Execute a monad or command line command
-void monad::exec_command(const string & command)
-{
-	vector<string> args = tokenize(command, ' ');
-
-	// Allow processing of special internals
-	if (args[0] == "rename_main")
-	{
-		EXIT_IF_ERROR(args.size() != 3, "rename_main must take 2 arguments: a file and a new name");
-		rename_main(args[1], args[2]);
-		return;
-	}
-
-#if DEBUG
-	cout << "Pre-Make Command: " << command << endl;
-#endif
-	system(command.c_str());
-}
-
-
-
diff --git a/monad.h b/monad.h
deleted file mode 100644
index 1a7e0368758ebbd8c51bac6b34acfef052aed3b6..0000000000000000000000000000000000000000
--- a/monad.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef MONAD_H
-#define MONAD_H
-
-#include <iostream>
-#include <fstream>
-#include <map>
-#include <sstream>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-#include <vector>
-
-#include "monad_shared.h"
-#include "random.h"
-#include "util.h"
-
-using namespace std;
-using namespace util;
-using namespace monad_shared;
-
-namespace monad
-{
-
-void printHelp();
-void printHelpConfig();
-void printHelpTests();
-void printLicense();
-const char * getRandomQuote();
-
-}
-
-#endif // MONAD_H
diff --git a/monad_shared.cpp b/monad_shared.cpp
deleted file mode 100644
index fb6f846b1373cac21cf1f6f187e7074a350fd500..0000000000000000000000000000000000000000
--- a/monad_shared.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-#include <iostream>
-#include "monad_shared.h"
-#include "util.h"
-
-using namespace monad_shared;
-using namespace util;
-using std::cout;
-using std::cerr;
-using std::endl;
-
-namespace monad_shared
-{
-
-namespace versioninfo
-{
-const char * official_name = "Monad Autograder";
-const char * version_name  = "confession";
-const Version version_num  = Version(2, 1, 4, 3);
-const char * date          = "18 Jan 2012";
-}
-
-const char * unit_test_result::pass_string = "~~PASSED~~";
-const size_t header_length = 64;
-
-void printInfo()
-{
-	cout << endl
-	     << versioninfo::official_name << endl
-	     << "Version " << versioninfo::version_num << ": " << versioninfo::version_name << endl
-		 << "Released " << versioninfo::date << endl
-	     << "Developed by Jack Toole 2011-2012" << endl
-	     << "Copyright 2011-2012 Jack Toole" << endl
-	     << "Run monad --license to see licensing information" << endl
-		 << endl;
-}
-
-namespace output
-{
-
-// Set EXIT_IF_ERROR message
-void set_error_message()
-{
-	SET_ERROR_MESSAGE("Oops! Something went wrong inside of me.\n"
-		"Please contact course staff with the following error details, and they'll figure it out:\n");
-}
-
-void header(const string & title)
-{
-	cout << title << "..." << endl
-	     << string(header_length, '=') << endl;
-}
-
-void warning(const string & message)
-{
-	cerr << endl
-	     << string(header_length, '*') << endl
-		 << "WARNING!" << endl
-		 << message << endl
-	     << string(header_length, '*') << endl << endl;
-}
-
-
-void total_score(int32_t score, int32_t outof)
-{
-	if (outof < 0)
-		output::header("Total score");
-	else
-		output::header("Total score (out of " + to_string(outof) + ")");
-	
-	cout << "TOTAL SCORE: " << score << endl << endl;
-}
-
-void testname(const unit_test_input & curr_test, int32_t max_testname_len, int32_t max_points_len)
-{
-	// Output test name
-	int32_t pos = 0; // keep track of cursor position
-	std::cout << curr_test.name() << ' ';
-	pos += strlen(curr_test.name()) + 1;
-
-	if (curr_test.is_valgrind())
-	{
-		cout << "(valgrind) ";
-		pos += 11;
-	}
-
-	if (pos % 2 == max_testname_len % 2)
-	{
-		cout << ' ';
-		pos++;
-	}
-
-	while (pos < max_testname_len + 1)
-	{
-		cout << ". ";
-		pos += 2;
-	}
-	pos = 0; // reset column
-
-	std::cout << "[" << curr_test.points() << " pts] ";
-	pos += intlen(curr_test.points()) + 7;
-
-	while (pos < max_points_len + 7)
-	{
-		cout << ' ';
-		pos++;
-	}
-
-	cout << "- ";
-}
-
-
-void detailed_info(const unit_test_result & curr_test)
-{
-	std::cout << string(header_length, '-') << endl
-			  << curr_test.name();
-	if (curr_test.is_valgrind()) std::cout << " (run under valgrind)";
-	std::cout << " [" << curr_test.points() << " points]" << endl;
-
-	const string & error = curr_test.errormsg();
-	const string & output = curr_test.output();
-
-	if (curr_test.passed())
-		std::cout << "Result: " << passed_string() << endl;
-	else
-		std::cout << "Result: " << failed_string() << ": " << error << endl;
-
-	if (curr_test.time() < 0)
-		cout << "Took unknown time (";
-	else
-		cout << "Took " << curr_test.time() << "ms (";
-	cout << curr_test.timeout() << "ms timeout)" << endl;
-
-	std::cout << "Output:" << endl
-			  << string(header_length, '-') << endl;
-
-	// Tab the output over to distinguish it from the test case
-	if (output != "")
-	{
-		//std::cout << "    ";
-		//replaceAllInternal(output,"\n","\n    ");
-		std::cout << output;
-		if (output[output.length() - 1] != '\n') std::cout << endl;
-	}
-
-	cout << endl;
-}
-
-string passed_string()
-{
-	return colorize::make_color(colorize::GREEN, "passed");
-}
-
-string failed_string()
-{
-	return colorize::make_color(colorize::RED  , "FAILED");
-}
-
-} // namespace output
-} // namespace monad_shared
-
diff --git a/monad_shared.h b/monad_shared.h
deleted file mode 100644
index be64ec40f0c1ad0bb108757a33040dc37af6d0b5..0000000000000000000000000000000000000000
--- a/monad_shared.h
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef MONAD_SHARED
-#define MONAD_SHARED
-
-#include "util.h"
-#include "pipestream.h"
-
-namespace monad_shared
-{
-	struct Version
-	{
-		int32_t major_;
-		int32_t minor_;
-		int32_t patch_;
-		int32_t build_;
-
-		Version(int32_t maj, int32_t min, int32_t pat, int32_t bld)
-			: major_(maj), minor_(min), patch_(pat), build_(bld)
-		{ }
-
-#if 0
-		Version(const std::string & s)
-		{
-			size_t i = 0;
-			
-		}
-#endif
-
-		void print(std::ostream & out) const
-		{
-			out << major_ << '.' << minor_ << '.' << patch_ << '.' << build_;
-		}
-	};
-
-	inline std::ostream & operator<<(std::ostream & out, const Version & v)
-	{
-		v.print(out);
-		return out;
-	}
-
-	namespace versioninfo
-	{
-		extern const char * official_name;
-		extern const char * version_name;
-		extern const Version version_num;
-		extern const char * date;
-	}
-
-	void printInfo();
-
-	struct unit_test_input
-	{
-		typedef void (*function)(util::pipestream &);
-		
-		private:
-		function func_;
-		const char * name_;
-		long timeout_;
-		int32_t points_;
-		bool is_valgrind_;
-
-		public:
-		unit_test_input(const char * _name,
-		          unit_test_input::function _func,
-		          int32_t _points,
-		          long _timeout,
-		          bool _is_valgrind)
-			: func_(_func),
-			  name_(_name),
-			  timeout_(_timeout),
-			  points_(_points),
-			  is_valgrind_(_is_valgrind) { }
-		
-		void execute(util::pipestream & checkstream) const { func_(checkstream); }
-		const char * name()        const { return name_;        }
-		long         timeout()     const { return timeout_;     }
-		int32_t      points()      const { return points_;      }
-		bool         is_valgrind() const { return is_valgrind_; }
-	};
-
-	struct unit_test_result : public unit_test_input
-	{
-		private:
-		std::string errormsg_;
-		std::string output_;
-		long time_;
-		int32_t valgrind_flags_;
-
-		public:
-		unit_test_result(const unit_test_input & _input,
-		                 const std::string & _errormsg,
-		                 const std::string & _output,
-		                 const long _time,
-		                 const int32_t _valgrind_flags)
-			: unit_test_input(_input),
-			  errormsg_((_errormsg != "") ? _errormsg : "Unexpectedly Aborted"),
-			  output_(_output),
-			  time_(_time),
-			  valgrind_flags_(_valgrind_flags) { }
-
-		const std::string & errormsg()      const { return errormsg_;       }
-		const std::string & output()        const { return output_;         }
-		long               time()           const { return time_;           }
-		int32_t            valgrind_flags() const { return valgrind_flags_; }
-
-		bool passed() const { return errormsg_ == pass_string; }
-		bool failed() const { return !passed(); }
-		int32_t points_scored() const { return passed() ? points() : 0; }
-
-		// Static class data
-		static const char * pass_string;
-		static bool _failed(const unit_test_result & obj) { return obj.failed(); }
-	};
-
-	namespace output
-	{
-		void set_error_message();
-		void header(const std::string & title);
-		void total_score(int32_t score, int32_t outof);
-		void warning(const std::string & message);
-		void testname(const unit_test_input & curr_test, int32_t max_testname_len, int32_t max_points_len);
-		void detailed_info(const unit_test_result & curr_test);
-		std::string passed_string();
-		std::string failed_string();
-	} // namespace output
-
-}
-
-#endif // MONAD_SHARED
diff --git a/pipestream.cpp b/pipestream.cpp
deleted file mode 100644
index ea6db277c77d542cfb748c0af8da87e631699de5..0000000000000000000000000000000000000000
--- a/pipestream.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-
-template <size_t buffersize>
-sizedpipestream<buffersize>::sizedpipestream()
-	: wbufferpos(0), rbufferpos(buffersize), rbuffersize(buffersize),
-	  maxopsize(-1), is_eof(false), enable_multiline_strings(true)
-{
-	// Give a compile time error if an invalid buffsize is specified
-	// This is necessary for much easier primitive reading/writing
-	// The buffer must be either 0 or at least large enough to hold any
-	// primitive (probably 8 or 16 bytes)
-	char buffer_size_must_be_0_or_over_16
-		[(buffersize != 0 && buffersize < sizeof(intmax_t)) ? -1 : 1];
-	buffer_size_must_be_0_or_over_16[0] = '\0';
-
-	// Create the pipe
-	pipe(fds);
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize>::~sizedpipestream()
-{
-	close();
-}
-
-template <size_t buffersize>
-void sizedpipestream<buffersize>::close()
-{
-	close_write();
-	close_read();
-}
-
-template <size_t buffersize>
-void sizedpipestream<buffersize>::close_read()
-{
-	if (fds[READ_END] == -1) return;
-	::close(fds[READ_END]);
-	fds[READ_END] = -1;
-}
-
-template <size_t buffersize>
-void sizedpipestream<buffersize>::close_write()
-{
-	if (fds[WRITE_END] == -1) return;
-	flush();
-	::close(fds[WRITE_END]);
-	fds[WRITE_END] = -1;
-}
-
-template <size_t buffersize>
-int sizedpipestream<buffersize>::steal_output(int fd)
-{
-	::close(fd);
-	dup2(fds[WRITE_END], fd);
-	return 0;
-}
-
-template <size_t buffersize>
-int sizedpipestream<buffersize>::steal_input(int fd)
-{
-	::close(fd);
-	dup2(fds[READ_END], fd);
-	return 0;
-}
-
-template <size_t buffersize>
-int sizedpipestream<buffersize>::get_read_fd()
-{
-	return fds[READ_END];
-}
-
-template <size_t buffersize>
-int sizedpipestream<buffersize>::get_write_fd()
-{
-	return fds[WRITE_END];
-}
-
-
-template <size_t buffersize>
-void sizedpipestream<buffersize>::flush()
-{
-	if (buffersize == 0 || wbufferpos == 0 || fds[WRITE_END] == -1)
-		return;
-
-	writen(fds[WRITE_END], &wbuffer[0], wbufferpos);
-	wbufferpos = 0;
-}
-
-template <size_t buffersize>
-int sizedpipestream<buffersize>::fill(size_t byte_count)
-{
-	if (buffersize == 0 || rbufferpos == 0 || fds[READ_END] == -1)
-		return -1;
-
-	if (buffersize - rbufferpos < byte_count)
-	{
-		memmove(&rbuffer[0], &rbuffer[rbufferpos], rbuffersize - rbufferpos);
-		rbuffersize -= rbufferpos;
-		rbufferpos = 0;
-	}
-
-	while (rbuffersize - rbufferpos < byte_count)
-	{
-		ssize_t read_count = ::read(fds[READ_END],
-		                            &rbuffer[rbuffersize],
-		                            buffersize - rbuffersize);
-		if (read_count == 0) return 0;
-		if (read_count == -1)
-		{
-			if (errno == EINTR) continue;
-			return -1;
-		}
-		rbuffersize += read_count;
-	}
-
-	return rbuffersize - rbufferpos;
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const string & str)
-{
-	if (buffersize == 0)
-	{
-		writen(fds[WRITE_END], str.c_str(), str.length()+1);
-		return *this;
-	}
-
-	size_t len = str.length();
-	for (size_t i = 0; i < len; i++)
-	{
-		if (wbufferpos == buffersize) flush();
-		wbuffer[wbufferpos++] = str[i];
-	}
-	if (wbufferpos == buffersize) flush();
-	wbuffer[wbufferpos++] = '\0';
-	return *this;
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const char * str)
-{
-	if (buffersize == 0)
-	{
-		writen(fds[WRITE_END], str, strlen(str)+1);
-		return *this;
-	}
-
-	for (size_t i = 0; str[i] != '\0'; i++)
-	{
-		if (wbufferpos == buffersize) flush();
-		wbuffer[wbufferpos++] = str[i];
-	}
-	if (wbufferpos == buffersize) flush();
-	wbuffer[wbufferpos++] = '\0';
-	return *this;
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(char * & str)
-{
-	size_t capacity = 4;
-	str = new char[capacity];
-	size_t len = 0;
-
-	int error = 0;
-	char c = '\0';
-	do
-	{
-		error = read_primitive<char>(c);
-		if (len == maxopsize) continue;
-		
-		if (len == capacity)
-		{
-			char * temp = str;
-			str  = new char[capacity*2];
-			memcpy(str, temp, capacity);
-			capacity *= 2;
-			delete [] temp;
-		}
-		str[len++] = c;
-
-	} while (error > 0 && c != '\0' && (enable_multiline_strings || c != '\n'));
-	
-	str[len-1] = '\0';
-
-	if (!enable_multiline_strings && len > 2 && str[len-2] == '\r')
-		str[len-2] = '\0';
-
-	maxopsize = -1;
-	return *this;
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(string & str)
-{
-	char * cstr = NULL;
-	operator>>(cstr);
-	str = cstr;
-	delete [] cstr;
-	return *this;
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<
-	(pipestream_manip::enable_multiline_strings_t value)
-{
-	enable_multiline_strings = value.value;
-	return *this;
-}
-
-template <size_t buffersize>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>
-	(pipestream_manip::setmax_t max)
-{
-	maxopsize = max.max;
-	return *this;
-}
-
-template <size_t buffersize>
-inline bool sizedpipestream<buffersize>::eof()
-{ return is_eof; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const signed char & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const signed short & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const signed int & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const signed long & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const unsigned char & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const unsigned short & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const unsigned int & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator<<(const unsigned long & value)
-{ return write_primitive(value); }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(signed char & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(signed short & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(signed int & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(signed long & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(unsigned char & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(unsigned short & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(unsigned int & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-inline sizedpipestream<buffersize> & sizedpipestream<buffersize>::operator>>(unsigned long & value)
-{ read_primitive(value); return *this; }
-
-template <size_t buffersize>
-template <typename T>
-sizedpipestream<buffersize> & sizedpipestream<buffersize>::write_primitive(T value)
-{
-	if (fds[WRITE_END] == -1) return *this;
-
-	if (buffersize == 0)
-	{
-		writen(fds[WRITE_END], &value, sizeof value);
-		return *this;
-	}
-
-	if (buffersize - wbufferpos < sizeof value)
-		flush();
-
-	*reinterpret_cast<T*>(&wbuffer[wbufferpos]) = value;
-	wbufferpos += sizeof value;
-	return *this;
-}
-
-template <size_t buffersize>
-template <typename T>
-int sizedpipestream<buffersize>::read_primitive(T & value)
-{
-	if (fds[READ_END] == -1) return -1;
-
-	if (buffersize == 0)
-		return readn(fds[READ_END], &value, sizeof value);
-
-	if (rbuffersize - rbufferpos < sizeof value)
-	{
-		int error = fill(sizeof value);
-		if (error == 0) is_eof = true;
-		if (error <= 0) return error;
-	}
-
-	value = *reinterpret_cast<T*>(&rbuffer[rbufferpos]);
-	rbufferpos += sizeof value;
-	return sizeof value;
-}
-
-
diff --git a/pipestream.h b/pipestream.h
deleted file mode 100644
index 4657ebe8e095d7c91016c6d0bda59db13118ec1d..0000000000000000000000000000000000000000
--- a/pipestream.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef UTIL_PIPESTREAM_H
-#define UTIL_PIPESTREAM_H
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include "util.h"
-
-namespace util
-{
-
-namespace pipestream_manip {
-	struct setmax_t {
-		size_t max;
-	};
-
-	struct enable_multiline_strings_t {
-		bool value;
-	};
-}
-inline pipestream_manip::setmax_t setmax(size_t max)
-{
-	pipestream_manip::setmax_t retval = { max };
-	return retval;
-}
-
-const pipestream_manip::enable_multiline_strings_t enable_multiline_strings  = { true };
-const pipestream_manip::enable_multiline_strings_t disable_multiline_strings = { false };
-
-template <size_t buffersize>
-class sizedpipestream
-{
-	protected:
-	uint8_t wbuffer[buffersize+1]; // +1 to avoid 0 sized arrays
-	uint8_t rbuffer[buffersize+1];
-	size_t wbufferpos;
-	size_t rbufferpos;
-	size_t rbuffersize;
-	size_t maxopsize;
-	int fds[2];
-	bool is_eof;
-	bool enable_multiline_strings;
-	static const int READ_END  = 0;
-	static const int WRITE_END = 1;
-
-	public:
-	sizedpipestream();
-	
-	~sizedpipestream();
-	void close();
-	void close_read();
-	void close_write();
-	
-	bool eof();
-
-	void flush();
-	int fill(size_t byte_count);
-
-	int steal_output(int fd);
-	int steal_input(int fd);
-	
-	int get_read_fd();
-	int get_write_fd();
-
-	sizedpipestream<buffersize> & operator<<(const string & str);
-	sizedpipestream<buffersize> & operator<<(const char * str);
-	sizedpipestream<buffersize> & operator<<(const   signed char  & value);
-	sizedpipestream<buffersize> & operator<<(const   signed short & value);
-	sizedpipestream<buffersize> & operator<<(const   signed int   & value);
-	sizedpipestream<buffersize> & operator<<(const   signed long  & value);
-	sizedpipestream<buffersize> & operator<<(const unsigned char  & value);
-	sizedpipestream<buffersize> & operator<<(const unsigned short & value);
-	sizedpipestream<buffersize> & operator<<(const unsigned int   & value);
-	sizedpipestream<buffersize> & operator<<(const unsigned long  & value);
-
-	sizedpipestream<buffersize> & operator>>(string & str);
-	sizedpipestream<buffersize> & operator>>(char * & str);
-	sizedpipestream<buffersize> & operator>>(  signed char  & value);
-	sizedpipestream<buffersize> & operator>>(  signed short & value);
-	sizedpipestream<buffersize> & operator>>(  signed int   & value);
-	sizedpipestream<buffersize> & operator>>(  signed long  & value);
-	sizedpipestream<buffersize> & operator>>(unsigned char  & value);
-	sizedpipestream<buffersize> & operator>>(unsigned short & value);
-	sizedpipestream<buffersize> & operator>>(unsigned int   & value);
-	sizedpipestream<buffersize> & operator>>(unsigned long  & value);
-
-	sizedpipestream<buffersize> & operator<<(pipestream_manip::enable_multiline_strings_t value);
-	sizedpipestream<buffersize> & operator>>(pipestream_manip::setmax_t max);
-
-	protected:
-	template <typename T>
-	sizedpipestream<buffersize> & write_primitive(T value);
-	template <typename T>
-	int read_primitive(T & value);
-
-	private:
-	sizedpipestream(sizedpipestream<buffersize> & other);
-	sizedpipestream<buffersize> & operator=(sizedpipestream<buffersize> & other);
-};
-
-typedef sizedpipestream<512> pipestream;
-
-#include "pipestream.cpp"
-
-} // namespace util
-#endif
diff --git a/proxy.cpp b/proxy.cpp
deleted file mode 100644
index 576300c119163845d23b2bc058698b567540531c..0000000000000000000000000000000000000000
--- a/proxy.cpp
+++ /dev/null
@@ -1,726 +0,0 @@
-// proxy.cpp
-// NOTE: This is a generic file. Actual unit tests are located in
-//       unit_tests.cpp.
-// By Jack Toole for CS 225 spring 2011
-
-// For strsignal:
-#ifndef _GNU_SOURCE
-	#define _GNU_SOURCE
-#endif
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-
-#include <algorithm>
-#include <iomanip>
-#include <numeric>
-
-#include "memcheck.h"
-#include "monad_shared.h"
-#include "pipestream.h"
-#include "proxy.h"
-#include "util.h"
-#include "valgrind.h"
-
-using namespace std;
-using namespace util;
-using namespace monad_shared;
-
-
-OUTPUT_CHECK(equals)
-{
-	return output == expected;
-}
-
-
-OUTPUT_CHECK(contains)
-{
-	return output.find(expected) != string::npos;
-}
-
-
-OUTPUT_CHECK(not_contains)
-{
-	return output.find(expected) == string::npos;
-}
-
-
-namespace proxy
-{
-	vector<unit_test_input> * global_tests = NULL;
-	output_check_map * global_output_checks = NULL;
-
-	double time_constant(size_t smaller, size_t larger) { return 1.0; }
-	double time_logn    (size_t smaller, size_t larger) { return log(larger) / log(smaller); }
-	double time_linear  (size_t smaller, size_t larger) { return (double)larger / smaller; }
-	double time_nlogn   (size_t smaller, size_t larger) { return (larger*log(larger)) / (smaller*log(smaller)); }
-	double time_nsquared(size_t smaller, size_t larger) { return ((double)larger*larger) / ((double)smaller*smaller); }
-	double time_cubed   (size_t smaller, size_t larger) { return ((double)larger*larger*larger) / ((double)smaller*smaller*smaller); }
-	double time_infinity(size_t smaller, size_t larger) { return std::numeric_limits<double>::max(); }
-
-	runtime_ratio_func runtime_ratio[TIME_COUNT] =
-	{
-		time_constant,
-		time_logn,
-		time_linear,
-		time_nlogn,
-		time_nsquared,
-		time_cubed,
-		time_infinity
-	};
-	const char * runtime_str[TIME_COUNT] =
-	{
-		"O(1)",
-		"O(logn)",
-		"O(n)",
-		"O(nlogn)",
-//		"O(nrootn)",
-		"O(n^2)",
-		"O(n^3)",
-		"O(infinity)"
-	};
-}
-
-
-
-int main(int argc, char ** argv)
-{
-	using namespace proxy;
-	
-	// set up EXIT_IF_ERROR messages
-	output::set_error_message();
-
-	RunTimeEnvironment::Options opts;
-	const char * testname = parse_options(argc, argv, opts);
-
-	// Set up run-time environment
-	RunTimeEnvironment env(global_tests, global_output_checks, opts, testname);
-
-	// Set up the tests
-	RunTests runner(env);
-
-	// Execute
-	return runner.execute();
-}
-
-
-namespace proxy {
-
-// class add_unit_test
-add_unit_test::add_unit_test(const char * name, unit_test_input::function func,
-                             int32_t points_in_part, int32_t points_in_total, long timeout,
-                             bool is_valgrind)
-{
-	lazy_init_global_tests();
-	int32_t points = get_points(points_in_total, points_in_part);
-	// Add to global tests vector
-	global_tests->push_back(unit_test_input(name, func, points, timeout, is_valgrind));
-}
-
-
-// Check to make global tests vector
-void add_unit_test::lazy_init_global_tests()
-{
-	if (global_tests == NULL)
-		global_tests = new std::vector<unit_test_input>;
-}
-
-// Discriminate which points value to add
-int32_t add_unit_test::get_points(int32_t points_in_total, int32_t points_in_part)
-{
-	#if MP_PART(NO_MP_PART)
-		return points_in_total;
-	#else
-		return points_in_part;
-	#endif
-}
-
-
-const char * parse_options(int argc, const char * const * const argv, RunTimeEnvironment::Options & opts)
-{
-	string getTestName = "all";
-
-	OptionsParser parseopts;
-	parseopts.addOption("verbose",  opts.verbose);
-	parseopts.addOption("redirect", opts.redirect_test_output);
-	parseopts.addOption("valgrind", opts.valgrind);
-	parseopts.addArg(getTestName);
-	parseopts.parse(argc, argv);
-
-	const char * testname = "all";
-	for (int32_t i = 0; i < argc; i++)
-		if (getTestName == argv[i])
-			testname = argv[i];
-	return testname;
-}
-
-
-// class add_output_check
-add_output_check::add_output_check(const char * name, output_check func)
-{
-	if (global_output_checks == NULL)
-		global_output_checks = new output_check_map;
-	(*global_output_checks)[name] = func;
-}
-
-
-
-// class Run_Time_Environment
-RunTimeEnvironment::RunTimeEnvironment(vector<unit_test_input> *& init_tests,
-                                       output_check_map *& init_output_checks,
-                                       const Options & init_opts, const char * testname)
-	: max_output_length(8*1024), //arbitrary
-	  single_test_passed_string("Result: passed"),
-	  heap_tests(init_tests),
-	  output_checks(init_output_checks != NULL ? init_output_checks : new output_check_map),
-	  opts(init_opts),
-	  mode(strcasecmp(testname, "all") == 0 ? ALL_TESTS : SINGLE_TEST),
-	  test_arg(testname)
-{
-	// Copy globals to the RunTimeEnvironment space
-	// And remove them from the global scope
-	static int8_t singleton = 0;
-	EXIT_IF_ERROR(singleton++ != 0, "There may only be one runtime environment");
-	EXIT_IF_ERROR(heap_tests == NULL, "No test cases found");
-	
-	init_tests = NULL;
-	init_output_checks = NULL;
-}
-
-
-void RunTimeEnvironment::cleanup_globals()
-{
-	static bool called_already = false;
-	if (!called_already)
-	{
-		if (heap_tests    != NULL) delete heap_tests;
-		if (output_checks != NULL) delete output_checks;
-		called_already = true;
-	}
-}
-
-
-
-// class RunTests
-RunTests::RunTests(RunTimeEnvironment & env)
-	: environment(env)
-{ }
-
-
-int32_t RunTests::execute()
-{
-	int32_t return_code = execute_by_mode();
-	environment.cleanup_globals();
-	return return_code;
-}
-
-
-int32_t RunTests::execute_by_mode()
-{
-	if (environment.mode == SINGLE_TEST)
-		return run_single_test(environment.test_arg);
-	else if (environment.mode == ALL_TESTS)
-		return run_all_tests();
-	
-	EXIT_IF_ERROR(true, string("Failed to implement case for mode ") + environment.mode);
-	exit(-1);
-}
-
-
-int32_t RunTests::run_single_test(const char * testname)
-{
-	const vector<unit_test_input> & tests = *environment.heap_tests;
-
-	for (size_t test_i = 0; test_i < tests.size(); test_i++)
-		if (strcmp(tests[test_i].name(), testname) == 0)
-			return run_single_test(tests[test_i]);
-
-	cout << "Test not found" << endl;
-	exit(-1);
-}
-
-
-int32_t RunTests::run_single_test(const unit_test_input & curr_test)
-{
-	cout << "Running " << curr_test.name() << " [worth "
-		 << curr_test.points() << " points, output below]" << endl;
-
-	unit_test_result result = execute_test(curr_test, false);
-
-	const string & error  = result.errormsg();
-
-	handle_single_test_output(result.output());
-
-	if (result.passed())
-		cout << environment.single_test_passed_string << endl;
-	else
-		cout << "Result: FAILED:" << endl << error << endl;
-
-	return result.valgrind_flags();
-}
-
-
-void RunTests::handle_single_test_output(const string & output)
-{
-	if (output != "")
-	{
-		cout << output;
-		if (output[output.size()-1] != '\n')
-			cout << endl;
-	}
-}
-
-int32_t foldTestScore (int score,  const unit_test_result & test) { return score  + test.points_scored(); }
-int32_t foldTestPoints(int points, const unit_test_input  & test) { return points + test.points(); }
-
-int RunTests::run_all_tests()
-{
-	const vector<unit_test_input> & tests = *environment.heap_tests;
-
-	output::header("Running tests");
-
-	int32_t points_sum = get_sum_points();
-	int32_t max_testname_len = get_max_testname_length();
-	int32_t max_points_len   = get_max_points_length();
-
-#if 0 // removed due to partial compilation lowering this number artificially
-	if (points_sum != 0 && points_sum < 100)
-		output::warning("Unit test scores sum to " + to_string(points_sum) +
-		                ", should be at least 100");
-#endif
-	if (points_sum > 125)
-		output::warning("Unit test scores sum to " + to_string(points_sum) +
-		                ", this will overflow the return value. Should be <= 125");
-
-	vector<unit_test_result> results;
-	for (size_t test_i = 0; test_i < tests.size(); test_i++)
-	{
-		output::testname(tests[test_i], max_testname_len, max_points_len);
-		results.push_back(execute_test(tests[test_i], true));
-		output_single_test_passfail(results.back());
-	}
-
-	const int32_t score = accumulate(results.begin(), results.end(), 0, foldTestScore);
-
-	cout << endl << endl;
-	output_detailed_info_if_any_failed(results, score);
-	output::total_score(score, -1);
-	
-	return score;
-}
-
-int32_t RunTests::get_sum_points()
-{
-	static int32_t cached_sum = INT_MIN;
-	if (cached_sum == INT_MIN)
-		cached_sum = accumulate(environment.heap_tests->begin(), environment.heap_tests->end(), 0, foldTestPoints);
-	return cached_sum;
-}
-
-int32_t RunTests::get_max_testname_length()
-{
-	const vector<unit_test_input> & tests = *environment.heap_tests;
-	int32_t max_testname_len = 0;
-	for (size_t test_i = 0; test_i < tests.size(); test_i++)
-	{
-		// TODO (toole1): This is horrible style!
-		int32_t currlen = strlen(tests[test_i].name()) + (int)tests[test_i].is_valgrind() * 11; // strlen(" (valgrind)");
-
-		if (currlen > max_testname_len)
-			max_testname_len = currlen;
-	}
-	return max_testname_len;
-}
-
-int32_t RunTests::get_max_points_length()
-{
-	const vector<unit_test_input> & tests = *environment.heap_tests;
-	uint32_t max_points_len = 0;
-	for (size_t test_i = 0; test_i < tests.size(); test_i++)
-		max_points_len = max(max_points_len, intlen(tests[test_i].points()));
-	return max_points_len;
-}
-
-void RunTests::output_detailed_info_if_any_failed(const vector<unit_test_result> & results, int32_t score)
-{
-	if (count_if(results.begin(), results.end(), unit_test_result::_failed) ||
-			environment.opts.verbose)
-		output_detailed_tests_info(results, score);
-}
-	
-	
-void RunTests::output_detailed_tests_info(const vector<unit_test_result> & results, int32_t score)
-{
-	output::total_score(score, -1);
-	cout << endl << endl;
-	
-	output::header("Detailed test output");
-	
-	for (size_t test_i = 0; test_i < results.size(); test_i++)
-		if (results[test_i].failed() || environment.opts.verbose)
-			output::detailed_info(results[test_i]);
-	
-	cout << endl << string(64, '-') << endl; // TODO (toole1): poor style, should be refactored to monad_shared::output
-}
-
-
-void RunTests::output_single_test_passfail(const unit_test_result & curr_test)
-{
-	if (curr_test.passed())
-		std::cout << output::passed_string() << endl;
-	else
-		std::cout << output::failed_string() << ": " << curr_test.errormsg() << endl;
-}
-
-test_execution::test_execution(const unit_test_input & _test, RunTimeEnvironment & env, bool enable_valgrind_call)
-	: test(_test), environment(env)
-{
-	do_valgrind = enable_valgrind_call && (test.is_valgrind() || env.opts.valgrind);
-//!!	if (!do_valgrind)
-//!!		test.checkstream = new pipestream; // TODO (reimplement)
-}
-
-void test_execution::child()
-{
-	fmsg_pipe.close_read();
-	cout_pipe.close_read();
-	nums_pipe.close_read();
-
-	// redirect stdout/stderr to pipe
-	if (environment.opts.redirect_test_output)
-	{
-		cout_pipe.steal_output(STDOUT_FILENO);
-		cout_pipe.steal_output(STDERR_FILENO);
-	}
-
-	if (do_valgrind)
-	{
-		child_valgrind();
-	}
-	else // if (!test.is_valgrind)
-	{
-		child_test();
-	}
-}
-
-void test_execution::parent()
-{
-	fmsg_pipe.close_write();
-	cout_pipe.close_write();
-	nums_pipe.close_write();
-//!!	if (test.checkstream != NULL)
-	checkstream.close_write();
-
-	// Read stdout/stderr pipe while process is running
-	if (environment.opts.redirect_test_output)
-		cout_pipe >> setmax(environment.max_output_length) >> output;
-	else
-		output = "Test output was displayed above instead of being buffered\n";
-	
-	cout_pipe.close_read();
-}
-
-unit_test_result test_execution::result(int8_t return_code)
-{
-	if (do_valgrind)
-		return after_valgrind_success(return_code);
-	else
-		return after_test_success();
-}
-
-unit_test_result test_execution::result(const Signal & s)
-{
-	string errormsg;
-	long time;
-	int32_t valgrind_flags = get_valgrind_flags(true);
-
-	fmsg_pipe.close();
-	nums_pipe.close();
-	if (environment.is_timeout_signal(s))
-	{
-		errormsg = string("Timed out") + " (" + to_string(test.timeout()) + "ms)";
-		time = test.timeout();
-	}
-	else
-		errormsg = s.what();
-	
-	return unit_test_result(test, errormsg, output, time, valgrind_flags);
-}
-
-
-unit_test_result RunTests::execute_test(const unit_test_input & test, bool enable_valgrind_call)
-{
-	cout << std::flush;
-	test_execution executor(test, environment, enable_valgrind_call);
-	try
-	{
-		int32_t return_code = fork_execute(executor);
-		return executor.result(return_code);
-	}
-	catch (Signal & s)
-	{
-		return executor.result(s);
-	}
-}
-
-template <typename F>
-int32_t fork_execute(F & executor)
-{
-	// Fork
-	pid_t process_id;
-	process_id = fork();
-	EXIT_IF_ERROR(process_id < 0, "Could not fork application");
-
-	if (process_id == 0)
-	{
-		executor.child();
-		exit(0);
-	}
-	else // if (process_id > 0)
-	{
-		executor.parent();
-
-		int child_status;
-		pid_t ws = waitpid(process_id, &child_status, 0); //should return immediately because it's after parent()
-		EXIT_IF_ERROR(ws == -1);
-
-		if (WIFEXITED(child_status))
-			return WEXITSTATUS(child_status);
-		else if (WIFSIGNALED(child_status))
-			throw Signal(WTERMSIG(child_status));
-		else
-			throw Signal(SIGSTOP);
-	}
-}
-
-void test_execution::child_valgrind()
-{
-	// We're giving up control to valgrind, so we can't
-	// Use anything but the cout pipe now
-	fmsg_pipe.close_write();
-	nums_pipe.close_write();
-	
-	start_timeout();
-	exec("valgrind", "--dsymutil=yes", "--trace-children=yes", /*"--log-fd=-1",*/ "-q", "./proxy", test.name());
-}
-
-
-void test_execution::child_test()
-{
-	checkstream.close_read();
-	// Execute test
-	bool test_failed = false;
-	long test_time = -1;
-	start_timeout();
-	try
-	{
-		test.execute(checkstream); // execute function
-		test_time = end_timeout();
-		fmsg_pipe << unit_test_result::pass_string;
-	}
-	catch (Failure & failure)
-	{
-		test_time = end_timeout();
-		test_failed = true;
-		// Write failure message to pipe
-		fmsg_pipe << failure.message();
-	}
-	fmsg_pipe.close();
-
-	// write time and valgrind flags to pipe
-//!!	delete test.checkstream;
-	checkstream.close();
-	environment.cleanup_globals();
-	int32_t valgrind_flags = get_valgrind_flags(test_failed);
-	nums_pipe << test_time;
-	nums_pipe << valgrind_flags;
-	nums_pipe.close();
-}
-
-
-unit_test_result test_execution::after_valgrind_success(int8_t return_code)
-{
-	fmsg_pipe.close_read();
-	nums_pipe.close_read();
-
-	string errormsg;
-
-	size_t last_endl = findNthLast(output, '\n', 2);
-	int32_t valgrind_flags = return_code;
-
-	if (last_endl == string::npos)
-	{
-		if (environment.opts.redirect_test_output)
-			errormsg = "Valgrind test did not complete";
-		else
-			errormsg = "Valgrind test output was not redirected to pipe because --redirect was set.";
-	}
-	else
-	{
-		errormsg = output.substr(last_endl + 1,
-				output.length() - last_endl - 2);
-
-		if (errormsg == environment.single_test_passed_string)
-			errormsg = get_valgrind_string(valgrind_flags);
-			// This will always be unit_test::pass_string unless someone tried to hack monad, in which case
-			// basing our passing on the return code (valgrind flags) rather than string parsing is the
-			// right thing to do
-	}
-
-	return unit_test_result(test, errormsg, output, -1, valgrind_flags);
-}
-
-
-unit_test_result test_execution::after_test_success()
-{
-	string errormsg;
-	long time;
-	int32_t valgrind_flags;
-
-	fmsg_pipe >> errormsg;
-	fmsg_pipe.close();
-	nums_pipe >> time;
-	nums_pipe >> valgrind_flags;
-	nums_pipe.close();
-	
-	// Check for output's correctness, if that was a condition of passing
-	if (errormsg == unit_test_result::pass_string)
-	{
-		while (!checkstream.eof())
-		{
-			string checkname;
-			string checkstr;
-			checkstream >> checkname;
-			if (checkstream.eof()) break;
-			checkstream >> checkstr;
-			if (checkstream.eof()) break;
-
-			output_check check_function = (*environment.output_checks).find(checkname)->second;
-			if (check_function == NULL)
-			{
-				cerr << "Internal Error: in test " << test.name() << ": "
-				     << checkname << " is not a registered OUTPUT_CHECK function" << endl;
-				exit(-2);
-			}
-
-			if (!check_function(output, checkstr))
-				errormsg = "Incorrect Terminal Output";
-		}
-	}
-	
-	if (errormsg == unit_test_result::pass_string)
-		errormsg = get_valgrind_string(valgrind_flags);
-
-//!!	delete test.checkstream;
-	checkstream.close();
-	
-	return unit_test_result(test, errormsg, output, time, valgrind_flags);
-}
-
-
-int32_t get_valgrind_flags(bool test_failed)
-{
-	// Check for valgrind errors or leaks (if running under valgrind)
-	unsigned long errors     = 0;
-	unsigned long leaked     = 0;
-	unsigned long dubious    = 0;
-	unsigned long reachable  = 0;
-	unsigned long suppressed = 0;
-
-	errors = VALGRIND_COUNT_ERRORS;
-	VALGRIND_DO_LEAK_CHECK; //QUICK
-	VALGRIND_COUNT_LEAK_BLOCKS(leaked, dubious, reachable, suppressed);
-
-	return bitflags(test_failed, errors, leaked, dubious, reachable);
-}
-
-
-const char * get_valgrind_string(int32_t flags)
-{
-	if (flags == 0) return unit_test_result::pass_string;
-
-	bool test_failed = bitflag(flags, 0);
-	bool errors      = bitflag(flags, 1);
-	bool leaked      = bitflag(flags, 2);
-	bool dubious     = bitflag(flags, 3);
-	bool reachable   = bitflag(flags, 4);
-
-	if (test_failed) return "Test failed (see output)";
-	if (errors)      return "Invalid read/write errors";
-	if (leaked)      return "Directly lost memory leaks";
-	if (dubious)     return "Possibly lost memory leaks";
-	// For now we will ignore reachable errors, as they are always present on Mac
-	// TODO (toole1): Refactor. Still reachable should still hit "unknown" below, not be a free pass
-	// (this doesn't impact current code paths, but is inelegant)
-	if (reachable)   return unit_test_result::pass_string; //"Still-reachable memory leaks";
-	return "Unknown memory errors";
-}
-
-bool test_execution::prof_timeout_enabled()
-{
-	struct itimerval temp;
-	errno = 0;
-	if (getitimer(ITIMER_PROF, &temp) == 0)
-		return true;
-	if (errno == EINVAL)
-		return false;
-	cerr << __FILE__ << ":" << __LINE__ << ": ERROR: getitimer failed" << endl;
-	exit(-1);
-}
-
-void test_execution::start_timeout()
-{
-	static const bool prof_enabled = prof_timeout_enabled();
-
-	struct itimerval timeout;
-	timeout.it_interval.tv_sec  = 0;
-	timeout.it_interval.tv_usec = 0;
-	timeout.it_value.tv_sec  = test.timeout()/1000;
-	timeout.it_value.tv_usec = (test.timeout()%1000) * 1000;
-
-	if (prof_enabled)
-	{
-		EXIT_IF_ERROR(setitimer(ITIMER_PROF, &timeout, NULL));
-		// second real time signal in case the student calls a blocking call
-		timeout.it_value.tv_sec *= 10;
-		EXIT_IF_ERROR(setitimer(ITIMER_REAL, &timeout, NULL));
-	}
-	else
-	{
-		EXIT_IF_ERROR(setitimer(ITIMER_REAL, &timeout, NULL));
-	}
-}
-
-
-long test_execution::end_timeout()
-{
-	static const bool prof_enabled = prof_timeout_enabled();
-
-	struct itimerval timeout;
-	timeout.it_interval.tv_sec  = 0;
-	timeout.it_interval.tv_usec = 0;
-	timeout.it_value.tv_sec  = 0;
-	timeout.it_value.tv_usec = 0;
-	struct itimerval remaining;
-
-	if (prof_enabled)
-	{
-		EXIT_IF_ERROR(setitimer(ITIMER_PROF, &timeout, &remaining));
-		EXIT_IF_ERROR(setitimer(ITIMER_REAL, &timeout, NULL));
-	}
-	else
-	{
-		EXIT_IF_ERROR(setitimer(ITIMER_REAL, &timeout, &remaining));
-	}
-
-	// There seems to be a strange -1 error here. I may just be tired,
-	// but I can't figure out why right now
-	long time = test.timeout() - remaining.it_value.tv_sec*1000 - remaining.it_value.tv_usec/1000;
-	return (time < 0) ? 0 : time;
-}
-
-
-
-} // namespace proxy
-
diff --git a/proxy.h b/proxy.h
deleted file mode 100644
index 47f47bba78662b712c279329405f16064f13d194..0000000000000000000000000000000000000000
--- a/proxy.h
+++ /dev/null
@@ -1,488 +0,0 @@
-// proxy.h
-// NOTE: This is a generic file. Actual unit tests are located in
-//       unit_tests.cpp.
-// By Jack Toole for CS 225 2011
-
-// Randomized inclusion guards so that students can't hotswap the proxy
-#ifndef PROXY_H
-#define PROXY_H
-
-#include <math.h>
-#include <signal.h>
-#include <string.h>
-
-#include <iostream>
-#include <functional>
-#include <limits>
-#include <map>
-#include <string>
-#include <vector>
-#include <utility>
-
-#include "pipestream.h"
-#include "monad_shared.h"
-#include "mp_part.h"
-
-namespace proxy
-{
-	using namespace std;
-	using namespace monad_shared;
-
-	class RunTests;
-	typedef bool (*output_check)(const std::string &, const std::string &);
-
-	extern std::vector<unit_test_input> * global_tests;
-	typedef std::map<std::string, output_check> output_check_map;
-	extern output_check_map * global_output_checks;
-
-	class add_unit_test
-	{
-		public:
-		add_unit_test(const char * name, unit_test_input::function func,
-		              int32_t points_in_part, int32_t points_in_total, long timeout,
-		              bool is_valgrind);
-
-		private:
-		void lazy_init_global_tests();
-		int32_t get_points(int32_t points_in_total, int32_t points_in_part);
-	};
-
-	class add_output_check
-	{
-		public:
-		add_output_check(const char * name, output_check func);
-	};
-
-	enum mode_t
-	{
-		SINGLE_TEST,
-		MP_PART_TESTS,
-		ALL_TESTS
-	};
-
-
-	struct RunTimeEnvironment
-	{
-		public:
-		// Types
-		struct Options
-		{
-			bool verbose;
-			bool redirect_test_output;
-			bool valgrind;
-
-			Options()
-				: verbose(false),
-				  redirect_test_output(true),
-				  valgrind(false)
-			{ }
-		};
-
-		// Variables
-		public:
-		const size_t max_output_length;
-		const char * const single_test_passed_string;
-		const std::vector<unit_test_input> * const heap_tests;
-		const output_check_map * const output_checks;
-		const Options opts;
-		const mode_t mode;
-		const char * const test_arg;
-
-		// Methods
-		public:
-		RunTimeEnvironment(std::vector<unit_test_input> *& init_tests,
-		                   output_check_map *& init_output_checks,
-		                   const Options & init_opts, const char * testname);
-		
-		bool is_timeout_signal(const util::Signal & s)
-		{
-			return s.number() == SIGPROF || s.number() == SIGALRM;
-		}
-		
-		void cleanup_globals();
-
-		private:
-		// Non-copyable
-		RunTimeEnvironment(const RunTimeEnvironment & other);
-		RunTimeEnvironment & operator=(RunTimeEnvironment & other);
-	};
-
-	class Failure
-	{
-		private:
-		const char * const myFile;
-		const size_t myLine;
-		const string myCause;
-		
-		public:
-		Failure(const char * file, size_t line, const string & cause)
-			: myFile(file), myLine(line), myCause(cause) { }
-
-		string message() const
-		{
-			stringstream ss;
-			ss << myFile << ":" << myLine << ": " << myCause;
-			return ss.str();
-		}
-	};
-
-	class RunTests
-	{
-		private:
-		RunTimeEnvironment & environment;
-
-		public:
-		RunTests(RunTimeEnvironment & env);
-		int execute();
-		private:
-		void process_args(int argc, char ** argv);
-
-		protected:
-		int32_t execute_by_mode();
-		int32_t run_single_test(const char * testname);
-		int32_t run_single_test(const unit_test_input & curr_test);
-		void    handle_single_test_output(const std::string & output);
-		void    output_single_test_passfail(const unit_test_result & curr_test);
-		
-		int32_t run_all_tests();
-		int32_t get_sum_points();
-		int32_t get_max_testname_length();
-		int32_t get_max_points_length();
-		void output_detailed_info_if_any_failed(const vector<unit_test_result> & results, int32_t score);
-		void output_detailed_tests_info(const vector<unit_test_result> & results, int32_t score);
-
-		unit_test_result execute_test(const unit_test_input & test, bool enable_valgrind_call);
-
-		private:
-		RunTests(const RunTests & other);
-		RunTests & operator=(const RunTests & other);
-	};
-
-	template <typename F>
-	int32_t fork_execute(F & executor);
-	
-	class test_execution
-	{
-		private:
-		util::pipestream fmsg_pipe; // For error messages
-		util::pipestream cout_pipe; // For stdout/stderr
-		util::pipestream nums_pipe; // for numbers: time, valgrind
-		const unit_test_input & test;
-		RunTimeEnvironment & environment;
-		bool do_valgrind;
-		util::pipestream checkstream;
-		string output;
-
-		public:
-		test_execution(const unit_test_input & _test, RunTimeEnvironment & env, bool enable_valgrind_call);
-		void parent();
-		void child();
-		unit_test_result result(int8_t return_code);
-		unit_test_result result(const util::Signal & s);
-
-		private:
-		void child_test();
-		void child_valgrind();
-		unit_test_result after_test_success();
-		unit_test_result after_valgrind_success(int8_t return_code);
-		void start_timeout();
-		long end_timeout();
-		static bool prof_timeout_enabled();
-		
-		private:
-		test_execution(const test_execution & other);
-		test_execution & operator=(const test_execution & other);
-	};
-
-
-	const char * get_valgrind_string(int32_t flags);
-	int32_t get_valgrind_flags(bool test_failed);
-	int32_t bitflags(unsigned long a,     unsigned long b = 0, unsigned long c = 0,
-					 unsigned long d = 0, unsigned long e = 0);
-	bool bitflag(int32_t flags, int32_t num);
-
-	const char * parse_options(int argc, const char * const * const argv, RunTimeEnvironment::Options & opts);
-
-} // namespace proxy
-
-using std::cout;
-using std::cerr;
-using std::endl;
-
-#define UNIT_TEST(func,pointsInPart,pointsInTotal,timeout)               \
-	namespace proxy_test {                                               \
-	void func(util::pipestream & ___monad_checkstream___);               \
-	proxy::add_unit_test                                                 \
-		func##_adder(#func, func, pointsInPart,                          \
-		             pointsInTotal, timeout, false);                     \
-	}                                                                    \
-	void proxy_test::func(util::pipestream & ___monad_checkstream___)
-
-#define VALGRIND_TEST(func,pointsInPart,pointsInTotal,timeout)           \
-	namespace proxy_test {                                               \
-	void func(util::pipestream & ___monad_checkstream___);               \
-	proxy::add_unit_test                                                 \
-		func##_adder(#func, func, pointsInPart,                          \
-		             pointsInTotal, timeout, true);                      \
-	}                                                                    \
-	void proxy_test::func(util::pipestream & ___monad_checkstream___)
-
-#define HELPER_TEST(func, ...)                                           \
-	namespace proxy_test {                                               \
-	void func(util::pipestream & ___monad_checkstream___, __VA_ARGS__);  \
-	}                                                                    \
-	void proxy_test::func(util::pipestream & ___monad_checkstream___, __VA_ARGS__)
-
-#define CALL_HELPER(func, ...)                                           \
-	do {                                                                 \
-		func(___monad_checkstream___, __VA_ARGS__);                      \
-	} while (0)
-
-#define DECLARE_OUTPUT_CHECK(func)  \
-	bool ___monad_output_check_##func(const std::string & output, const std::string & expected);
-
-#define OUTPUT_CHECK(func)                                                                       \
-	bool ___monad_output_check_##func(const std::string & output, const std::string & expected); \
-	proxy::add_output_check                                                                      \
-		___monad_output_check_##func##_adder(#func, ___monad_output_check_##func);               \
-	bool ___monad_output_check_##func(const std::string & output, const std::string & expected)
-
-#define STRINGIFY1(p)   #p
-#define STR(p)          STRINGIFY1(p)
-
-#define FAIL(error)     throw proxy::Failure(__FILE__, __LINE__, (error))
-
-#define PASS            return;
-
-#define ASSERT(expr)                               \
-	do {                                           \
-		if (!(expr))                               \
-			FAIL("Assertion (" #expr ") failed");  \
-	} while (0)
-
-namespace proxy {
-template <typename T, typename K>
-inline std::string assert_equals_help(const T & expected, const K & actual, const char * expstr, const char * actstr)
-{
-	std::stringstream ss;
-	if (actual != expected)
-	{
-		ss << "[" << actstr << " => " << actual << "] != [" << expstr << " => " << expected << "]";
-		return ss.str();
-	}
-	return monad_shared::unit_test_result::pass_string;
-}
-}
-
-#define ASSERT_EQUALS(expected, actual)                                                     \
-	do {                                                                                    \
-		string errormsg = proxy::assert_equals_help(expected, actual, #expected, #actual);  \
-		if (errormsg != monad_shared::unit_test_result::pass_string)                        \
-			FAIL(errormsg);                                                                 \
-	} while (0)
-
-namespace proxy {
-template <typename S>
-inline void assert_output_impl(util::pipestream & checkstream, output_check checkFunc, const char * checkFuncName, const S & str)
-{
-	if (checkFuncName == NULL) checkFunc("", ""); // Should never occur. Used to avoid unused variable warnings
-	checkstream << checkFuncName << str;
-}
-}
-
-#define ASSERT_OUTPUT(checkFunc, str)  \
-	proxy::assert_output_impl(___monad_checkstream___, ___monad_output_check_##checkFunc, #checkFunc, str)
-
-enum proxy_runtime_t
-{
-	CONSTANT_TIME = 0,
-	LOGN_TIME,
-	N_TIME,
-	NLOGN_TIME,
-//	NROOTN_TIME,
-	N2_TIME,
-	N3_TIME,
-	INFINITE_TIME,
-	TIME_COUNT
-};
-
-namespace proxy
-{
-	typedef double (*runtime_ratio_func)(size_t, size_t);
-	extern runtime_ratio_func runtime_ratio[TIME_COUNT];
-	extern const char * runtime_str[TIME_COUNT];
-
-	struct TimeIterationsData
-	{
-		double timePerCall;
-		size_t iterations;
-		uint64_t totalTime;
-	};
-
-	template <typename Generator, typename Timer, typename Cleaner>                  TimeIterationsData timeIterationsImpl(Generator gen,            Timer timeFunctor, Cleaner cleanupFunc, size_t input_size);
-	template <typename Generator, typename Timer, typename Cleaner>                  TimeIterationsData timeIterations    (Generator gen,            Timer timeFunctor, Cleaner cleanupFunc, size_t input_size);
-	template <typename GenResult, typename GenArg, typename Timer, typename Cleaner> TimeIterationsData timeIterations    (GenResult (*gen)(GenArg), Timer timeFunctor, Cleaner cleanupFunc, size_t input_size);
-	
-	template <typename Generator, typename Timer, typename Cleaner>
-	bool assert_time_impl(Generator gen, Timer functor, Cleaner cleanupFunc, proxy_runtime_t expectedTime, size_t size1 = 100, size_t size2 = 400);
-	
-	struct nop
-	{
-		template <typename T>
-		void operator()(const T & t) { }
-	};
-}
-
-#define ASSERT_TIME3(gen, functor, expectedTime)                                             \
-	do {                                                                                     \
-		if (proxy::assert_time_impl(gen, functor, proxy::nop(), expectedTime))                 \
-			FAIL(string("Runtime was larger than ") + proxy::runtime_str[expectedTime]);     \
-	} while(0)
-
-#define ASSERT_TIME4(gen, functor, cleanupFunc, expectedTime)                                \
-	do {                                                                                     \
-		if (proxy::assert_time_impl(gen, functor, cleanupFunc, expectedTime))                \
-			FAIL(string("Runtime was larger than ") + proxy::runtime_str[expectedTime]);     \
-	} while(0)
-
-#define ASSERT_TIME5(gen, functor, expectedTime, size1, size2)                               \
-	do {                                                                                     \
-		if (proxy::assert_time_impl(gen, functor, proxy::nop(), expectedTime, size1, size2))   \
-			FAIL(string("Runtime was larger than ") + proxy::runtime_str[expectedTime]);     \
-	} while(0)
-
-#define ASSERT_TIME6(gen, functor, cleanupFunc, expectedTime, size1, size2)                  \
-	do {                                                                                     \
-		if (proxy::assert_time_impl(gen, functor, cleanupFunc, expectedTime, size1, size2))  \
-			FAIL(string("Runtime was larger than ") + proxy::runtime_str[expectedTime]);     \
-	} while(0)
-
-// Crazy hack for overloading!
-// Arg counting from:
-// http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/
-// Overloading tips:
-// http://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros
-#define ASSERT_TIME_SEVENTH_ARG(a, b, c, d, e, f, g, ...) g
-
-#define ASSERT_TIME(...)  \
-	ASSERT_TIME_SEVENTH_ARG(__VA_ARGS__, ASSERT_TIME6, ASSERT_TIME5, ASSERT_TIME4, ASSERT_TIME3, 0, 0) (__VA_ARGS__)
-
-namespace proxy {
-
-template <typename Generator, typename Timer, typename Cleaner>
-TimeIterationsData timeIterations(Generator gen, Timer timeFunctor, Cleaner cleanupFunc, size_t input_size)
-{
-	return timeIterationsImpl(
-			bind1st(mem_fun(&Generator::operator()), &gen),
-			timeFunctor,
-			cleanupFunc,
-			input_size);
-}
-
-template <typename GenResult, typename GenArg, typename Timer, typename Cleaner>
-TimeIterationsData timeIterations(GenResult (*gen)(GenArg), Timer timeFunctor, Cleaner cleanupFunc, size_t input_size)
-{
-	return timeIterationsImpl(ptr_fun(gen), timeFunctor, cleanupFunc, input_size);
-}
-
-template <typename Generator, typename Timer, typename Cleaner>
-TimeIterationsData timeIterationsImpl(Generator gen, Timer timeFunctor, Cleaner cleanupFunc, size_t input_size)
-{
-	const uint64_t min_time = 1000000; // in microseconds
-	const size_t max_gen_iterations = 1000000;
-	std::vector<typename Generator::result_type *> inputs;
-	inputs.reserve(2000); // arbitrary, guess at how big it will be
-
-	// Using pointers here allows us to avoid copying if the compiler supports copy elision
-	// Since we're intentionally using large inputs, this could potentially have a significant effect on speed
-	// We're also going to do something else weird here. Instead of generating a fixed number of inputs, we're
-	// going to generate inputs for a fixed time.
-	size_t max_iterations = 0;
-	for (uint64_t genstart = util::process_clock(); max_iterations < max_gen_iterations && util::process_clock() - genstart < min_time; max_iterations++)
-		inputs.push_back(new typename Generator::result_type(gen(input_size)));
-
-	typename Generator::result_type warmup_temp = gen(1);
-	timeFunctor(warmup_temp); // Warm up time functor (i.e. initialize statics)
-
-	size_t succeeded_iterations;
-	uint64_t starttime = util::process_clock();
-	for (succeeded_iterations = 0; succeeded_iterations < max_iterations && util::process_clock() - starttime < min_time;)
-		for (uint32_t i = 0; i < 10 && succeeded_iterations < max_iterations; i++, succeeded_iterations++)
-			timeFunctor(*inputs[succeeded_iterations]);
-	uint64_t endtime = util::process_clock();
-
-	for (size_t i = 0; i < max_iterations; i++)
-	{
-		cleanupFunc(*inputs[i]);
-		delete inputs[i];
-	}
-	cleanupFunc(warmup_temp);
-
-	TimeIterationsData result;
-	result.timePerCall = static_cast<double>(endtime - starttime) / succeeded_iterations;
-	result.iterations  = succeeded_iterations;
-	result.totalTime   = endtime - starttime;
-	return result;
-}
-
-inline void timeIterationsOutput(size_t size, const TimeIterationsData & data)
-{
-	std::cout << "Input size " << size << ": "
-	          << data.iterations << " iterations in " << data.totalTime/1000 << " ms "
-			  << "for an average of " << data.timePerCall << " us per call" << endl;
-}
-
-template <typename Generator, typename Timer, typename Cleaner>
-bool assert_time_impl(Generator gen, Timer functor, Cleaner cleanupMem, proxy_runtime_t expectedTime, size_t size1, size_t size2)
-{
-	TimeIterationsData diff0 = timeIterations(gen, functor, cleanupMem, 1);
-	TimeIterationsData diff1 = timeIterations(gen, functor, cleanupMem, size1);
-	TimeIterationsData diff2 = timeIterations(gen, functor, cleanupMem, size2);
-	timeIterationsOutput(    1, diff0);
-	timeIterationsOutput(size1, diff1);
-	timeIterationsOutput(size2, diff2);
-	double ratio = (diff2.timePerCall - diff0.timePerCall) / (diff1.timePerCall - diff0.timePerCall);
-	
-	double expected_ratio = proxy::runtime_ratio[expectedTime](size1, size2);
-	double toohigh_ratio  = proxy::runtime_ratio[expectedTime + 1](size1, size2);
-	double diffFromExpected = fabs(ratio - expected_ratio);
-	double diffFromWrong    = fabs(ratio - toohigh_ratio);
-	
-	std::cout << "Actual ratio:     " << ratio << std::endl;
-	std::cout << "Expected ratio:   " << expected_ratio << std::endl;
-	std::cout << "Wrong/high ratio: " << toohigh_ratio  << std::endl;
-	std::cout << "Diff from expected: " << diffFromExpected  << std::endl;
-	std::cout << "Diff from wrong:    " << diffFromWrong  << std::endl;
-
-#if 0 // This does not seem to be important. A sample of two iterations seems to work.
-	const size_t min_iters = 100;
-	if (diff0.iterations < min_iters || diff1.iterations < min_iters || diff2.iterations < min_iters)
-	{
-		std::cout << "Too few iterations: Code was too slow to be able to judge runtime accurately" << std::endl;
-		return true;
-	}
-#endif
-
-	return (diffFromWrong < diffFromExpected);
-}
-
-inline int32_t bitflags(unsigned long a, unsigned long b, unsigned long c,
-                        unsigned long d, unsigned long e)
-{
-	return ((int)(a != 0))        | (((int)(b != 0)) << 1) |
-           (((int)(c != 0)) << 2) | (((int)(d != 0)) << 3) |
-           (((int)(e != 0)) << 4) ;
-}
-
-inline bool bitflag(int32_t flags, int32_t num)
-{
-	return (flags & (1 << num)) != 0;
-}
-
-}
-
-DECLARE_OUTPUT_CHECK(equals);
-DECLARE_OUTPUT_CHECK(contains);
-DECLARE_OUTPUT_CHECK(not_contains);
-
-#endif
diff --git a/quotes.txt b/quotes.txt
deleted file mode 100644
index 68589e4127fb8e47abab8a116d324a0759c1f640..0000000000000000000000000000000000000000
--- a/quotes.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-"That's legit as shit." ~ Rick Barber
-"The cheating sheet is key to success in CS 412 course." ~ CS 412 TA
-"Your job is not just what you're doing; it should be preparing you for what you want to do." ~ Michael Lopp
-"One day I will shoot you with this bullet. Can you still say that you love me?" ~ Re-l Mayer
-"I didn't say I wanted to die in a blender! I said I wanted to be in a blender!" ~ Kyle Johnson
-"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." ~ Edsger Dijkstra
-"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Code for readability." ~ John Woods
-"The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change." ~ FORTRAN manual for Xerox computers
-"Any sufficiently advanced bug is indistinguishable from a feature." ~ Rich Kulawiec
-"Worry loudly now or scream louder later." ~ Michael Lopp
-"If you think you can do it all, you're thinking too small." ~ Michael Lopp
-"When you say 'You suck', I think 'I win'." ~ Michael Lopp
-"Honestly, if you don't fit in, then you're probably doing the right thing." ~ LIGHTS
-"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." ~ Nathaniel Borenstein
-"Simplicity and elegance are unpopular because thy require hard work and discipline to achieve and education to be appreciated." ~ Edsger Dijkstra
-"I love deadlines. I like the whooshing sound they make as they fly by." ~ Douglas Adams
-"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." ~ Brian Kernighan
-"The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time." ~ Tom Cargill
-"It always takes longer than you expect, even when you take into account Hofstadter's Law." ~ Hofstadter's Law
-"The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents." ~ Nathaniel Borenstein
-"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." ~ Antoine de Saint-Exupery
-"Even if by chance this world should end tomorrow, if it's together with you, would 'I'm okay with that too' be the cool attitude you'd take?" ~ Makino Yui
-"I just don't trust easily, and for good reasons... which are my own." ~ Carth Onasi
-"You think the sky is like a big big plate." ~ Prof. Jiawei Han
-"You look at their elbows, they actually have many good theoretical elbows." ~ Prof. Jiawei Han
-"If you don't hand in the next homework, you might miss some points" ~ Prof. Jiawei Han
-"I would build pyramids, if I were Pharoah" ~ Kyle Johnson
-"Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves." ~ Alan Kay
-"Microsoft has a new version out, Windows XP, which according to everybody is the 'most reliable Windows ever.' To me, this is like saying that asparagus is 'the most articulate vegetable ever.'" ~ Dave Barry
-"The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry." ~ Henry Petroski
-"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies." ~ C.A.R. Hoare
-"There's an old story about the person who wished his computer were as easy to use as his telephone. That wish has come true, since I no longer know how to use my telephone." ~ Bjarne Stroustrup
-"The trouble with programmers is that you can never tell what a programmer is doing until it's too late." ~ Seymour Cray
-"Measuring programming progress by lines of code is like measuring aircraft building progress by weight." ~ Bill Gates
-"First, solve the problem. Then, write the code." ~ John Johnson
-"Optimism is an occupational hazard of programming; feedback is the treatment." ~ Kent Beck
-"To iterate is human, to recurse divine." ~ L. Peter Deutsch
-"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." ~ Stan Kelly-Bootle
-"I think Microsoft named .Net so it wouldn't show up in a Unix directory listing." ~ Oktal
-"C++ : Where friends have access to your private members." ~ Gavin Russell Baker
-"Java is, in many ways, C++–." ~ Michael Feldman
-"If debugging is the process of removing bugs, then programming must be the process of putting them in." ~ Edsger W. Dijkstra
-"A computer lets you make more mistakes faster than any invention in human history–with the possible exceptions of handguns and tequila." ~ Mitch Radcliffe
-"A computer will do what you tell it to do, but that may be much different from what you had in mind" ~ Joseph Weizenbaum
-"Computers are like Old Testament gods; lots of rules and no mercy." ~ Joseph Campbell
-"Programs must be written for people to read, and only incidentally for machines to execute." ~ Abelson and Sussman
-"If you just rely on one model, you tend to amputate reality to make it fit your model." ~ David Brooks
-"Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats." ~ Howard H. Aiken
-"Eighty percent of success is showing up." ~ Woody Allen
-"If you're not failing every now and again, it's a sign you're not doing anything very innovative." ~ Woody Allen
-"We are what we repeatedly do. Excellence, then, is not an act, but a habit." ~ Aristotle
-"The most exciting phrase to hear in science - the one that heralds new discoveries - is not 'Eureka!' but 'That's funny....'" ~ Isaac Asimov
-"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." ~ Charles Babbage
-"The cheapest, fastest, and most reliable components of a computer system are those that aren't there." ~ Gordon Bell
-"More than the act of testing, the act of designing tests is one of the best bug preventers known. The thinking that must be done to create a useful test can discover and eliminate bugs before they are coded - indeed, test-design thinking can discover and eliminate bugs at every stage in the creation of software, from conception to specification, to design, coding and the rest." ~ Boris Bezier
-"We don't have time to stop for gas, we're already late." ~ Mike Cleron
-"I hear and I forget; I see and I remember; I do and I understand." ~ Confucius
-"Doing more things faster is no substitute for doing the right things." ~ Stephen R. Covey
diff --git a/random.h b/random.h
deleted file mode 100644
index be927fd7c575be7f62b049b701d46e55a6c75211..0000000000000000000000000000000000000000
--- a/random.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef UTIL_RANDOM_H
-#define UTIL_RANDOM_H
-
-#include <stdint.h>
-#include <sys/time.h>
-#include <time.h>
-
-// Taken from
-// http://software.intel.com/en-us/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor/
-
-namespace util
-{
-
-namespace internal
-{
-
-inline uint32_t time_seed()
-{
-	timeval tv;
-	gettimeofday(&tv, NULL);
-	return tv.tv_sec ^ tv.tv_usec;
-}
-
-inline int_fast16_t rand(uint32_t setseed)
-{
-	static uint32_t mySeed = (uint32_t)(-1);
-	if (setseed != (uint32_t)(-2))
-		mySeed = setseed;
-	if (mySeed == (uint32_t)(-1))
-		mySeed = time_seed();
-	mySeed = 214013 * mySeed + 2531011;
-	return (mySeed >> 16) & 0x7FFF;
-}
-
-}
-
-inline int_fast16_t urand()
-{
-	return internal::rand(-2);
-}
-
-inline int_fast16_t urandn(int32_t n)
-{
-	return urand() % n;
-}
-
-inline void usrand(uint64_t seed)
-{
-	internal::rand(seed);
-}
-
-class Random
-{
-	private:
-	static uint32_t auto_seed(uint32_t setSeed);
-	uint32_t mySeed;
-
-	public:
-	Random();
-	Random(uint64_t seed);
-
-	int_fast16_t rand();
-	int_fast16_t rand(int32_t n);
-	int_fast16_t operator()();
-	int_fast16_t operator()(int32_t n);
-	void         srand(uint64_t seed);
-};
-
-inline uint32_t Random::auto_seed(uint32_t setSeed)
-{
-	static uint32_t internalSeed = 0;
-	if (setSeed == 0)
-		return internalSeed;
-	
-	uint32_t result = internalSeed;
-	internalSeed = setSeed;
-	return result;
-}
-
-inline Random::Random()
-{
-	if (auto_seed(0) == 0)
-		auto_seed(internal::time_seed());
-	mySeed = auto_seed(0);
-	auto_seed((rand() << 16) ^ (rand()) ^ internal::time_seed());
-}
-
-inline Random::Random(uint64_t seed)
-	: mySeed(seed) { }
-
-inline void Random::srand(uint64_t seed)
-{
-	mySeed = seed;
-}
-
-inline int_fast16_t Random::rand()
-{
-	mySeed = 214013 * mySeed + 2531011;
-	return (mySeed >> 16) & 0x7FFF;
-}
-
-inline int_fast16_t Random::rand(int32_t n)
-{
-	return rand() % n;
-}
-
-inline int_fast16_t Random::operator()()
-{
-	return rand();
-}
-
-inline int_fast16_t Random::operator()(int32_t n)
-{
-	return rand(n);
-}
-
-} // namespace util
-
-#endif // UTIL_RANDOM_H
diff --git a/update.sh b/update.sh
index 55391d1db1bd4fb097d666f0c8fbe651cddb10fe..747f6c94b4570e48fa2aedc32f33416732d665b0 100755
--- a/update.sh
+++ b/update.sh
@@ -1,38 +1,32 @@
 #!/bin/bash
 # Clean monad_dev
-cd ../monad_dev
-make clean
-make
-cd ../monad
+mkdir source
 
 # Monad Binary
 cp ../monad_dev/monad .
-cp ../monad_dev/ccmonad .
-cp ../monad_dev/.monadid .
-cp ../monad_dev/valgrind.h .
-cp ../monad_dev/memcheck.h .
-cp ../monad_dev/Makefile.proxy .
-cp ../monad_dev/config.ini .
-cp ../monad_dev/memcheck.h .
-cp ../monad_dev/monad_shared.cpp .
-cp ../monad_dev/monad_shared.h .
-cp ../monad_dev/pipestream.cpp .
-cp ../monad_dev/pipestream.h .
-cp ../monad_dev/proxy.cpp .
-cp ../monad_dev/proxy.h .
-cp ../monad_dev/util.cpp .
-cp ../monad_dev/util.h .
-cp ../monad_dev/valgrind.h .
+cp ../monad_dev/source/memcheck.h .
+cp ../monad_dev/source/Makefile.proxy .
+cp ../monad_dev/source/config.ini .
+cp ../monad_dev/source/memcheck.h .
+cp ../monad_dev/source/monad_shared.cpp .
+cp ../monad_dev/source/monad_shared.h .
+cp ../monad_dev/source/pipestream.cpp .
+cp ../monad_dev/source/pipestream.h .
+cp ../monad_dev/source/proxy.cpp .
+cp ../monad_dev/source/proxy.h .
+cp ../monad_dev/source/util.cpp .
+cp ../monad_dev/source/util.h .
+cp ../monad_dev/source/valgrind.h .
 
 # Monad Source
-cp ../monad_dev/Makefile .
-cp ../monad_dev/LICENSE.txt .
-cp ../monad_dev/monad.h .
-cp ../monad_dev/monad.cpp .
-cp ../monad_dev/quotes.txt .
-cp ../monad_dev/random.h .
-cp ../monad_dev/README.txt .
-cp ../monad_dev/README_config.txt .
-cp ../monad_dev/README_tests.txt .
-cp ../monad_dev/help.cpp .
-cp ../monad_dev/ccmonad.cpp .
+cp ../monad_dev/source/Makefile .
+cp ../monad_dev/source/LICENSE.txt .
+cp ../monad_dev/source/monad.h .
+cp ../monad_dev/source/monad.cpp .
+cp ../monad_dev/source/quotes.txt .
+cp ../monad_dev/source/random.h .
+cp ../monad_dev/source/README.txt .
+cp ../monad_dev/source/README_config.txt .
+cp ../monad_dev/source/README_tests.txt .
+cp ../monad_dev/source/help.cpp .
+cp ../monad_dev/source/ccmonad.cpp .
diff --git a/util.cpp b/util.cpp
deleted file mode 100644
index c7887ddc5d82565f385a89a79d12709d96be2755..0000000000000000000000000000000000000000
--- a/util.cpp
+++ /dev/null
@@ -1,1268 +0,0 @@
-// CS 225 util.h
-// Created Spring 2011 by Jack Toole
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <iostream>
-#include "util.h"
-
-extern char ** environ; // man 7 environ
-
-namespace util
-{
-
-namespace internal
-{
-const char * error_prefix = "";
-
-template<typename StrType>
-void exit_if_error_output(const char * file, int32_t line, StrType message)
-{
-	if (util::internal::error_prefix != NULL)
-		cerr << util::internal::error_prefix;
-	cerr << file << ":" << line << ": " << message;
-	if (errno != 0)
-		cerr << ": " << strerror(errno);
-	cerr << endl;
-	exit(-1);
-}
-
-}
-
-void SET_ERROR_MESSAGE(const char * message)
-{
-	internal::error_prefix = message;
-}
-
-namespace internal
-{
-namespace exec
-{
-
-char * allocateCstr(const string & str)
-{
-	char * cstr = new char[str.size() + 1];
-	str.copy(cstr, str.size());
-	cstr[str.size()] = '\0';
-	return cstr;
-}
-
-pair<int, int> getFdsFromStream(const ostream * stream)
-{
-	int redirect_fd;
-	int outpipe_fd = -1;
-
-	if (stream == NULL)
-		redirect_fd = -1;
-	else if (stream == &cout || stream == &cerr) // we don't handle cerr right now; it is just left unpiped
-		redirect_fd = STDOUT_FILENO;
-	else
-	{
-		int pipe_fds[2];
-		EXIT_IF_ERROR(pipe(pipe_fds) != 0);
-		redirect_fd = pipe_fds[1];
-		outpipe_fd = pipe_fds[0];
-	}
-
-	return make_pair(redirect_fd, outpipe_fd);
-}
-
-struct exec_timers
-{
-	struct itimerval remaining_real;
-	struct itimerval remaining_virtual;
-	struct itimerval remaining_prof;
-	bool supports_virtual;
-	bool supports_prof;
-	exec_timers() : supports_virtual(true), supports_prof(true) { }
-};
-
-exec_timers get_exec_timers()
-{
-	exec_timers result;
-	
-	EXIT_IF_ERROR(getitimer(ITIMER_REAL, &result.remaining_real));
-	
-	if (getitimer(ITIMER_VIRTUAL, &result.remaining_virtual) != 0)
-	{
-		if (errno == EINVAL)
-		{
-			result.supports_virtual = false;
-			errno = 0;
-		}
-		else
-			exit_if_error_output(__FILE__, __LINE__, "getitimer(ITIMER_VIRTUAL) failed");
-	}
-	
-	if (getitimer(ITIMER_PROF, &result.remaining_prof) != 0)
-	{
-		if (errno == EINVAL)
-		{
-			result.supports_prof = false;
-			errno = 0;
-		}
-		else
-			exit_if_error_output(__FILE__, __LINE__, "getitimer(ITIMER_PROF) failed");
-	}
-
-	return result;
-}
-
-void set_exec_timers(const exec_timers & timers)
-{
-	EXIT_IF_ERROR(setitimer(ITIMER_REAL, &timers.remaining_real, NULL));
-	if (timers.supports_virtual) EXIT_IF_ERROR(setitimer(ITIMER_VIRTUAL, &timers.remaining_virtual, NULL));
-	if (timers.supports_prof)    EXIT_IF_ERROR(setitimer(ITIMER_PROF,    &timers.remaining_prof, NULL));
-}
-
-void redirect_to_fd(const int redirect_fd)
-{
-	if (redirect_fd == -1)
-	{
-		int devnull_fd = open("/dev/null", O_WRONLY | O_NONBLOCK);
-		close(STDOUT_FILENO);
-		close(STDERR_FILENO);
-		dup2(devnull_fd, STDOUT_FILENO);
-		dup2(devnull_fd, STDERR_FILENO);
-		close(devnull_fd);
-	}
-	else if (redirect_fd != STDOUT_FILENO)
-	{
-		close(STDOUT_FILENO);
-		close(STDERR_FILENO);
-		dup2(redirect_fd, STDOUT_FILENO);
-		dup2(redirect_fd, STDERR_FILENO);
-		close(redirect_fd);
-	}
-}
-
-char ** cstr_array_from_vector_string(const string & command, const vector<string> & args)
-{
-	// TODO (toole1): check this doesn't cause a memleak
-	char ** args_cstr = new char*[args.size() + 2];
-	args_cstr[0] = allocateCstr(command);
-	for (size_t i = 0; i < args.size(); i++)
-		args_cstr[i + 1] = allocateCstr(args[i]);
-	args_cstr[args.size() + 1] = NULL;
-	return args_cstr;
-}
-
-} // namespace exec
-} // namespace internal
-
-// heavily refactored, but originally from:
-// http://stackoverflow.com/questions/2180079/how-can-i-copy-a-file-on-unix-using-c
-int8_t exec(const string & command, const vector<string> & args, ostream * output)
-{
-	using namespace internal;
-	using namespace internal::exec;
-
-	pair<int, int> fds = getFdsFromStream(output);
-	int redirect_fd = fds.first;
-	int outpipe_fd  = fds.second;
-
-	exec_timers timers = get_exec_timers();
-	
-	pid_t pid = fork();
-	EXIT_IF_ERROR(pid < 0);
-	if (pid == 0)
-	{
-		set_exec_timers(timers);
-		redirect_to_fd(redirect_fd);
-		if (outpipe_fd != -1)
-			close(outpipe_fd);
-
-		// Sanitize environment
-		char path[] = "PATH=/bin/:/usr/bin:/usr/local/bin";
-		// Turn off glibc errors default write-to-terminal behaviour, because
-		// it does not get caught by stderr. This instead results in an abort.
-		char redirect_glibc[] = "LIBC_FATAL_STDERR_=1";
-		char * newenv[] = { path, redirect_glibc, NULL };
-		environ = newenv;
-
-		char ** args_cstr = cstr_array_from_vector_string(command, args);
-
-		// Swap out child process image with the command, searching
-		// in the specified path
-		execvp(command.c_str(), args_cstr);
-		
-        // An error occured
-		cerr << "exec(" << '\"' << command << '\"';
-		for (size_t i = 0; i < args.size(); i++)
-			cerr << ", \"" << args[i] << "\"";
-		cerr << ") failed: " << strerror(errno) << endl;
-		exit(-1);
-	}
-	else
-	{
-		// Take the output of the pipe and put it into the *output stream
-		if (outpipe_fd != -1)
-		{
-			EXIT_IF_ERROR(output == NULL);
-			close(redirect_fd);
-
-			vector<char> buffer(1024);
-			ssize_t char_read_count;
-			do
-			{
-				errno = 0;
-				char_read_count = ::read(outpipe_fd, &buffer[0], buffer.size() - 1);
-				
-				if (char_read_count < 0 && errno == EINTR) continue;
-				EXIT_IF_ERROR(char_read_count < 0);
-				EXIT_IF_ERROR(static_cast<size_t>(char_read_count) + 1 > buffer.size());
-				
-				buffer[char_read_count] = '\0';
-				*output << &buffer[0];
-
-			} while (char_read_count > 0);
-		}
-
-		int childExitStatus;
-		/* parent - wait for child - this has all error handling, you
-		 * could just call wait() as long as you are only expecting to
-		 * have one child process at a time.
-		 */
-		pid_t ws = waitpid( pid, &childExitStatus, 0);
-		EXIT_IF_ERROR(ws == -1);
-
-		if (WIFEXITED(childExitStatus)) /* exit code in childExitStatus */
-		{
-			int8_t status = WEXITSTATUS(childExitStatus); /* zero is normal exit */
-			/* handle non-zero as you wish */
-			return status;
-		}
-		else if (WIFSIGNALED(childExitStatus)) /* killed */
-		{
-			// No idea why I'm doing this anymore... if it segfaults, you do too??
-			kill(getpid(), WTERMSIG(childExitStatus));
-			return -1;
-		}
-		else if (WIFSTOPPED(childExitStatus)) /* stopped */
-		{
-			//cout << "exec error: " << __LINE__ << endl;
-			return -1;
-		}
-		else
-			EXIT_IF_ERROR(true);
-		exit(-1);
-	}
-}
-
-// TODO (toole1) this is a total hack, should use execvp like exec() below
-// originally from:
-// http://stackoverflow.com/questions/2180079/how-can-i-copy-a-file-on-unix-using-c
-int8_t exec(int redirect_fd, const string & command, const vector<string> & args)
-{
-	using namespace internal::exec;
-
-	// For debugging:
-#if 0
-	cerr << "exec(" << '\"' << command << '\"';
-	for (size_t i = 0; i < args.size(); i++)
-		cerr << ", \"" << args[i] << "\"";
-	cerr << ")" << endl;
-#endif
-
-	// avoid self destruction errors from closing then trying to duplicate output
-	// you can't redirect to what's already there
-	if (redirect_fd == STDOUT_FILENO || redirect_fd == STDERR_FILENO)
-		redirect_fd = STDOUT_FILENO;
-
-	// Save timer values :)
-	// These are preserved across the parent, but not inherited by the child
-	// let's change that
-	struct itimerval remaining_real;
-	struct itimerval remaining_virtual;
-	struct itimerval remaining_prof;
-	bool supports_virtual = true;
-	bool supports_prof    = true;
-	EXIT_IF_ERROR(getitimer(ITIMER_REAL,    &remaining_real));
-	if (getitimer(ITIMER_VIRTUAL, &remaining_virtual) != 0)
-	{
-		if (errno == EINVAL)
-		{
-			supports_virtual = false;
-			errno = 0;
-		}
-		else
-			internal::exit_if_error_output(__FILE__, __LINE__, "getitimer(ITIMER_VIRTUAL) failed");
-	}
-	if (getitimer(ITIMER_PROF, &remaining_prof) != 0)
-	{
-		if (errno == EINVAL)
-		{
-			supports_prof = false;
-			errno = 0;
-		}
-		else
-			internal::exit_if_error_output(__FILE__, __LINE__, "getitimer(ITIMER_PROF) failed");
-	}
-
-	pid_t pid = fork();
-
-	if (pid == 0) /* child */
-	{
-
-		// Restore timers
-		EXIT_IF_ERROR(setitimer(ITIMER_REAL, &remaining_real, NULL));
-		if (supports_virtual) EXIT_IF_ERROR(setitimer(ITIMER_VIRTUAL, &remaining_virtual, NULL));
-		if (supports_prof)    EXIT_IF_ERROR(setitimer(ITIMER_PROF,    &remaining_prof, NULL));
-
-		if (redirect_fd == -1)
-		{
-			int devnull_fd = open("/dev/null", O_WRONLY | O_NONBLOCK);
-			close(STDOUT_FILENO);
-			close(STDERR_FILENO);
-			dup2(devnull_fd, STDOUT_FILENO);
-			dup2(devnull_fd, STDERR_FILENO);
-			close(devnull_fd);
-		}
-		else if (redirect_fd != STDOUT_FILENO)
-		{
-			close(STDOUT_FILENO);
-			close(STDERR_FILENO);
-			dup2(redirect_fd, STDOUT_FILENO);
-			dup2(redirect_fd, STDERR_FILENO);
-		}
-
-		// Sanitize the environment
-#if 1 //!! hack!
-		char path[] = "PATH=/bin/:/usr/bin:/usr/local/bin";
-		// Turn off glibc errors default write-to-terminal behaviour, because
-		// it does not get caught by stderr. This instead results in an abort.
-		char redirect_glibc[] = "LIBC_FATAL_STDERR_=1";
-		char * newenv[] = { path, redirect_glibc, NULL };
-		//char * newenv[] = { path, NULL };
-		environ = newenv;
-#endif
-
-		// TODO (toole1): check this doesn't cause a memleak
-		char ** args_cstr = new char*[args.size() + 2];
-		args_cstr[0] = allocateCstr(command);
-		for (size_t i = 0; i < args.size(); i++)
-			args_cstr[i + 1] = allocateCstr(args[i]);
-		args_cstr[args.size() + 1] = NULL;
-		
-		// Swap out child process image with the command, searching
-		// in the specified path
-		execvp(command.c_str(), args_cstr);
-		
-        // An error occured
-		cerr << "exec(" << '\"' << command << '\"';
-		for (size_t i = 0; i < args.size(); i++)
-			cerr << ", \"" << args[i] << "\"";
-		cerr << ") failed: " << strerror(errno) << endl;
-		exit(-1);
-	}
-	else if (pid < 0)
-	{
-		/* error - couldn't start process - you decide how to handle */
-		return -1;
-	}
-	else
-	{
-		int childExitStatus;
-		/* parent - wait for child - this has all error handling, you
-		 * could just call wait() as long as you are only expecting to
-		 * have one child process at a time.
-		 */
-		pid_t ws = waitpid( pid, &childExitStatus, 0);
-		if (ws == -1)
-		{ /* error - handle as you wish */
-			//cout << "exec error: " << __LINE__ << endl;
-			return -1;
-		}
-
-		if (WIFEXITED(childExitStatus)) /* exit code in childExitStatus */
-		{
-			int8_t status = WEXITSTATUS(childExitStatus); /* zero is normal exit */
-			/* handle non-zero as you wish */
-			return status;
-		}
-		else if (WIFSIGNALED(childExitStatus)) /* killed */
-		{
-			kill(getpid(), WTERMSIG(childExitStatus));
-			return -1;
-		}
-		else if (WIFSTOPPED(childExitStatus)) /* stopped */
-		{
-			//cout << "exec error: " << __LINE__ << endl;
-			return -1;
-		}
-		else
-			return -1;
-	}
-}
-
-
-// originally from stackoverflow.com user plinth
-// http://stackoverflow.com/questions/2180079/how-can-i-copy-a-file-on-unix-using-c
-// Modified by Jack Toole
-int8_t exec(int redirect_fd, const char * command,
-            const char * arg1,
-            const char * arg2,
-            const char * arg3,
-            const char * arg4,
-            const char * arg5,
-            const char * arg6)
-{
-	int childExitStatus;
-	pid_t pid;
-
-	const char * args[] = {arg1, arg2, arg3, arg4, arg5, arg6};
-	const size_t args_count = (sizeof args) / (sizeof args[0]);
-
-	// shift all nulls to end
-	size_t first_null = 0;
-	for (size_t i = 0; i < args_count; i++)
-		if (args[i] != NULL)
-			swap(args[i], args[first_null++]);
-
-	// For debugging:
-#if 0
-	cerr << "exec(" << '\"' << command << '\"';
-	for (size_t i = 0; i < args_count; i++)
-		if (args[i] != NULL) cerr << ", \"" << args[i] << "\"";
-	cerr << ")" << endl;
-#endif
-
-	// avoid self destruction errors from closing then trying to duplicate output
-	// you can't redirect to what's already there
-	if (redirect_fd == STDOUT_FILENO || redirect_fd == STDERR_FILENO)
-		redirect_fd = STDOUT_FILENO;
-
-	// Save timer values :)
-	// These are preserved across the parent, but not inherited by the child
-	// let's change that
-	struct itimerval remaining_real;
-	struct itimerval remaining_virtual;
-	struct itimerval remaining_prof;
-	bool supports_virtual = true;
-	bool supports_prof    = true;
-	EXIT_IF_ERROR(getitimer(ITIMER_REAL,    &remaining_real));
-	if (getitimer(ITIMER_VIRTUAL, &remaining_virtual) != 0)
-	{
-		if (errno == EINVAL)
-		{
-			supports_virtual = false;
-			errno = 0;
-		}
-		else
-			internal::exit_if_error_output(__FILE__, __LINE__, "getitimer(ITIMER_VIRTUAL) failed");
-	}
-	if (getitimer(ITIMER_PROF, &remaining_prof) != 0)
-	{
-		if (errno == EINVAL)
-		{
-			supports_prof = false;
-			errno = 0;
-		}
-		else
-			internal::exit_if_error_output(__FILE__, __LINE__, "getitimer(ITIMER_PROF) failed");
-	}
-
-	pid = fork();
-
-	if (pid == 0) /* child */
-	{
-
-		// Restore timers
-		EXIT_IF_ERROR(setitimer(ITIMER_REAL, &remaining_real, NULL));
-		if (supports_virtual) EXIT_IF_ERROR(setitimer(ITIMER_VIRTUAL, &remaining_virtual, NULL));
-		if (supports_prof)    EXIT_IF_ERROR(setitimer(ITIMER_PROF,    &remaining_prof, NULL));
-
-		if (redirect_fd == -1)
-		{
-			int devnull_fd = open("/dev/null", O_WRONLY | O_NONBLOCK);
-			close(STDOUT_FILENO);
-			close(STDERR_FILENO);
-			dup2(devnull_fd, STDOUT_FILENO);
-			dup2(devnull_fd, STDERR_FILENO);
-			close(devnull_fd);
-		}
-		else if (redirect_fd != STDOUT_FILENO)
-		{
-			close(STDOUT_FILENO);
-			close(STDERR_FILENO);
-			dup2(redirect_fd, STDOUT_FILENO);
-			dup2(redirect_fd, STDERR_FILENO);
-		}
-
-		// Sanitize the environment
-#if 1 //!! hack!
-		char path[] = "PATH=/bin/:/usr/bin:/usr/local/bin";
-		// Turn off glibc errors default write-to-terminal behaviour, because
-		// it does not get caught by stderr. This instead results in an abort.
-		char redirect_glibc[] = "LIBC_FATAL_STDERR_=1";
-		char * newenv[] = { path, redirect_glibc, NULL };
-		//char * newenv[] = { path, NULL };
-		environ = newenv;
-#endif
-
-		// Swap out child process image with the command, searching
-		// in the specified path
-		execlp(command, command, args[0], args[1], args[2], args[3], args[4], args[5], NULL);
-		
-        // An error occured
-		cerr << "exec(" << '\"' << command << '\"';
-		for (size_t i = 0; i < args_count; i++)
-			if (args[i] != NULL) cerr << ", \"" << args[i] << "\"";
-		cerr << ") failed: " << strerror(errno) << endl;
-		exit(-1);
-	}
-	else if (pid < 0)
-	{
-		/* error - couldn't start process - you decide how to handle */
-		return -1;
-	}
-	else
-	{
-		/* parent - wait for child - this has all error handling, you
-		 * could just call wait() as long as you are only expecting to
-		 * have one child process at a time.
-		 */
-		pid_t ws = waitpid( pid, &childExitStatus, 0);
-		if (ws == -1)
-		{ /* error - handle as you wish */
-			//cout << "exec error: " << __LINE__ << endl;
-			return -1;
-		}
-
-		if (WIFEXITED(childExitStatus)) /* exit code in childExitStatus */
-		{
-			int8_t status = WEXITSTATUS(childExitStatus); /* zero is normal exit */
-			/* handle non-zero as you wish */
-			return status;
-		}
-		else if (WIFSIGNALED(childExitStatus)) /* killed */
-		{
-			kill(getpid(), WTERMSIG(childExitStatus));
-			return -1;
-		}
-		else if (WIFSTOPPED(childExitStatus)) /* stopped */
-		{
-			//cout << "exec error: " << __LINE__ << endl;
-			return -1;
-		}
-		else
-			return -1;
-	}
-}
-
-const char * Signal::what() const
-{
-	const char * desc = strsignal(signum);
-	return (desc == NULL) ? "Unknown Signal" : desc;
-}
-
-
-int chdir(const string & dir)
-{
-	return ::chdir(dir.c_str());
-}
-
-void assertExists(const string & path, int exit_code /* = -1 */)
-{
-	if (!exists(path))
-	{
-		cerr << "Error: " << path << " does not exist." << endl;
-		exit(exit_code);
-	}
-}
-
-bool exists(const string & path)
-{
-	// Try stat-ing it
-	struct stat st;
-	if (stat(path.c_str(), &st) != 0) return false;
-	// Check for read permission
-	if ((st.st_mode & S_IRUSR) == 0) return false;
-
-	// Check for correct file/directory nature
-	if (path[path.length()-1] != '/') return S_ISREG(st.st_mode);
-
-	// Otherwise we want a directory
-	if ((st.st_mode & S_IXUSR) == 0) return false;
-	return S_ISDIR(st.st_mode);
-}
-
-
-mode_t permissions(const string & path)
-{
-	// Try stat-ing it
-	struct stat st;
-	if (stat(path.c_str(), &st) != 0) return -1;
-	// Check for read permission
-	if ((st.st_mode & S_IRUSR) == 0) return -1;
-
-	return (st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
-}
-
-
-void forceRemoveDir(string dir)
-{
-	size_t len = dir.length();
-	if (dir[len-1] == '/') dir[len-1] = '\0';
-	EXIT_IF_ERROR(exec("rm","-rf",dir.c_str()) != 0);
-	if (dir[len-1] == '\0') dir[len-1] = '/';
-}
-
-
-string getcwdstr()
-{
-	int len = 256;
-	char * buffer = new char[len];
-
-	char * ret = getcwd(&buffer[0], len - 1);
-	while (ret == NULL && errno == ERANGE)
-	{
-		len *= 2;
-
-		delete buffer;
-		buffer = new char[len];
-
-		ret = getcwd(&buffer[0], len - 1);
-	}
-
-	EXIT_IF_ERROR(ret == NULL);
-
-	string cwdstr(buffer);
-	delete buffer;
-
-	return cwdstr;
-}
-
-
-void copyFile(const string & source, const string & dest)
-{
-	assertExists(source);
-	vector<string> folders = tokenize(dest, '/');
-	string currdir = "";
-	for (size_t i = 0; i < folders.size() - 1; i++)
-	{
-		currdir += folders[i] + '/';
-		if (!exists(currdir))
-			exec("mkdir", currdir.c_str());
-	}
-	exec("cp", source.c_str(), dest.c_str());
-}
-
-void copyFiles(const string & sourceFolder, const string & destFolder, const vector<string> & files)
-{
-	assertExists(destFolder);
-	for (size_t i = 0; i < files.size(); i++)
-	{
-		string sourceFile = sourceFolder + files[i];
-		assertExists(sourceFile);
-		copyFile(sourceFile, destFolder);
-	}
-}
-
-
-void protectFiles(const string & folder, const vector<string> & files)
-{
-#if 0 // (debug)
-	for (size_t i = 0; i < files.size(); i++)
-	{
-		string file = folder + files[i];
-		assertExists(file);
-
-		if (chmod(file.c_str(), S_IRUSR) != 0)
-		{
-			perror("chmod failed");
-			exit(-1);
-		}
-	}
-#endif
-}
-
-void protectDir(const string & dir)
-{
-	// (debug) EXIT_IF_ERROR(exec("/bin/chmod", "-R", "ugoa-w", dir.c_str()) != 0);
-}
-
-// Originally from Simon Biber
-// http://bytes.com/topic/c/answers/545614-list-files-current-directory
-vector<string> get_files_in_dir(const string & dir, bool concatdir /* = true */)
-{
-	EXIT_IF_ERROR(dir == "" || dir[dir.length()-1] != '/', "Directory name must end in a '/'");
-	
-	vector<string> files;
-	DIR * dirp = opendir(dir.c_str());
-	if (dirp == NULL) return files;
-	
-	struct dirent * ent = readdir(dirp);
-	while (ent != NULL)
-	{
-		string file = ent->d_name;
-		if (file != "." && file != "..")
-			files.push_back(concatdir ? dir + file : file);
-		ent = readdir(dirp);
-	}
-
-	closedir(dirp);
-	return files;
-}
-
-bool is_symlink(const string & file)
-{
-	// Try lstat-ing it
-	struct stat st;
-	if (lstat(file.c_str(), &st) != 0) return -1;
-	// Check for read permission
-	if ((st.st_mode & S_IRUSR) == 0) return false;
-
-	// & with symlink bit
-	return (S_ISLNK(st.st_mode)) != 0;
-}
-
-string get_symlink_target(const string & symlink)
-{
-	const size_t buf_size = 4096;
-	char buf[buf_size+1]; // TODO (toole1): hack-y value
-	ssize_t len = readlink(symlink.c_str(), buf, buf_size);
-	EXIT_IF_ERROR(len < 0 || static_cast<size_t>(len) == buf_size, "Error getting target of symlink " + symlink);
-	buf[len] = '\0';
-	return string(buf);
-}
-
-void linkDirs(const string & sourceFolder, const string & destFolder, const vector<string> & dirs)
-{
-	assertExists(destFolder);
-	for (size_t i = 0; i < dirs.size(); i++)
-	{
-		string source = sourceFolder + dirs[i];
-		string target = destFolder   + dirs[i];
-
-		// Check for redundant monad/ directory
-		// This allows the monad/ dir to be safely renamed
-		if (replaceFirst(source, "/../monad/","/"))
-			replaceFirst(target, "/monad/","/");
-
-		assertExists(destFolder + source + '/');
-
-		if (symlink(source.c_str(), target.c_str()) != 0)
-		{
-			cerr << "symlink failed: " << target << ": ";
-			perror(NULL);
-			exit(-1);
-		}
-	}
-}
-
-
-bool replaceFirst(string & str, const string & toreplace, const string & with)
-{
-	size_t i = str.find(toreplace);
-	if (i != string::npos)
-	{
-		str.replace(i,toreplace.length(),with);
-		return true;
-	}
-	return false;
-}
-
-size_t replaceAll(string & str, const string & toreplace, const string & with)
-{
-	size_t i = str.find(toreplace);
-	size_t count = 0;
-
-	while (i != string::npos)
-	{
-		str.replace(i,toreplace.length(),with);
-		i = str.find(toreplace, i + with.length());
-		count++;
-	}
-
-	return count;
-}
-
-size_t replaceAllInternal(string & str, const string & toreplace, const string & with)
-{
-	size_t i = str.find(toreplace);
-	size_t count = 0;
-
-	while ((i != string::npos) && (i != str.length() - toreplace.length()))
-	{
-		str.replace(i,toreplace.length(),with);
-		i = str.find(toreplace, i + with.length());
-		count++;
-	}
-
-	return count;
-}
-
-
-size_t findNthLast(const string & str, char c, size_t n)
-{
-	if (str.length() == 0) return string::npos;
-	size_t i = str.length() - 1;
-
-	do
-	{
-		if (str[i] == c) n--;
-		if (n == 0) return i;
-	} while (i-- != 0);
-
-	return string::npos;
-}
-
-
-string read_string_from_FILE(FILE * file, size_t max_length /* = -1 */)
-{
-	vector<char> v;
-	v.reserve(256);
-
-	while (true) 
-	{
-		int nextchar = fgetc(file);
-		if (nextchar == '\0' || nextchar == EOF)
-			break;
-		if (v.size() < max_length)
-			v.push_back(nextchar);
-	}
-
-	if (v.size() == max_length)
-	{
-		v.push_back('.');
-		v.push_back('.');
-		v.push_back('.');
-	}
-
-	v.push_back('\0');
-
-	return string(&v[0]);
-}
-
-void write_string_to_FILE(FILE * file, const char * str)
-{
-	fflush(file);
-	size_t i = 0;
-	do
-	{
-//		cout << (int)str[i] << ' ';
-		fputc(str[i], file);
-
-		// We use a do-while because we want the \0 to be written to the stream
-		// for sending multiple strings
-	} while (str[i++] != 0);
-
-//	cout << endl;
-
-	fflush(file);
-}
-
-
-
-/**
-*
-*
-**/
-
-string readFile(const string & filename)
-{
-	ifstream file;
-	file.open(filename.c_str());
-	if (!file.good())
-		return "";
-	
-	stringbuf linebuf;
-	file.get(linebuf, '\0');
-	linebuf.pubsync();
-	return linebuf.str();
-}
-
-
-void readConfig(const string & testsFolder, FileMap & map, const string & discriminator /* = "" */)
-{
-	string file;
-	if (testsFolder == "" || testsFolder[testsFolder.length()-1] == '/')
-		file = testsFolder + "config.ini";
-	else
-		file = testsFolder;
-	readFileGeneric(file, &map, NULL, discriminator);
-}
-
-void readFile(const string & file, vector<string> & lines)
-{
-	readFileGeneric(file, NULL, &lines);
-}
-
-void readFileGeneric(const string & filename, FileMap * map, vector<string> * lines, const string & discriminator /* = "" */)
-{
-	ifstream infile;
-	istream * fileptr;
-	if (filename == "/dev/stdin")
-		fileptr = &cin;
-	else
-	{
-		fileptr = &infile;
-		infile.open(filename.c_str(), fstream::in);
-	}
-	istream & file = *fileptr;
-
-	vector<string> * section = NULL;
-	if (map != NULL) section = &(*map)[""];
-	else section = lines;
-
-	while ((file.good() && file.peek() == '\n') || file.peek() == '\r')
-		file.get(); // get '\n'
-
-	while (file.good())
-	{
-		// Read a line - A lot of code, I know, right?
-		stringbuf linebuf;
-		file.get(linebuf);
-		while ((file.good() && file.peek() == '\n') || file.peek() == '\r')
-			file.get(); // get '\n'
-		linebuf.pubsync();
-		string line = linebuf.str();
-		int len = line.length();
-		if (len == 0) continue;
-
-        if (line[len-1] == '\r')
-            line.replace(--len,1,"");
-
-		if (len == 0 || line[0] == ';') continue; // skip comments
-		
-		if (map != NULL)
-		{
-			// Update the section
-			if (line[0] == '[' && line[len-1] == ']')
-			{
-				section = &(*map)[line.substr(1, len - 2)];
-				continue;
-			}
-			else if (line[0] == '[' || line[len-1] == ']')
-			{
-				cout << "config.ini: Format error: " << line << endl;
-				exit(-1);
-			}
-		}
-
-		// Or add the line/file to the section
-		size_t delim_pos = line.find_first_of("?:");
-		if (delim_pos == string::npos || map == NULL)
-			section->push_back(line);
-		else if ((line[delim_pos] == ':' && (delim_pos == 0 || discriminator == "")) ||
-		         line.compare(0, delim_pos, discriminator) == 0)
-			section->push_back(line.substr(delim_pos+1, line.size()-delim_pos-1));
-	}
-
-	if (filename != "/dev/stdin")
-		infile.close();
-}
-
-
-OptionsParser::OptionsParser()
-{
-	valueMap[""]      = true;
-
-	valueMap["yes"]   = true;
-	valueMap["no"]    = false;
-
-	valueMap["on"]    = true;
-	valueMap["off"]   = false;
-
-	valueMap["true"]  = true;
-	valueMap["false"] = false;
-
-	valueMap["1"]     = true;
-	valueMap["0"]     = false;
-}
-
-vector<string> OptionsParser::parse(int argc, const char * const * argv)
-{
-	vector<string> unprocessedArgs;
-	size_t out_arg_i = 0;
-
-	for (int arg_i = 1; arg_i < argc; arg_i++)
-	{
-		string originalCaseArg = argv[arg_i];
-		string currarg = toLower(originalCaseArg);
-
-		if (currarg.compare(0, 2, "--") == 0) //long option
-		{
-			bool invert = (currarg.compare(2, 2, "no") == 0);
-			size_t name_i = (invert ? 4 : 2);
-			size_t equalspos = currarg.find_first_of("=-", name_i);
-			
-			string name = currarg.substr(name_i, equalspos - name_i);
-			string value = (equalspos >= currarg.length()) ? "" : currarg.substr(equalspos);
-
-			optsMap_t::iterator option = optsMap.find(name);
-			if (option == optsMap.end())
-			{
-				cerr << "Unknown option: " << currarg << endl;
-				exit(-1);
-			}
-
-			valueMap_t::iterator valueIt = valueMap.find(value);
-			if (valueIt == valueMap.end())
-			{
-				cerr << "Unknown value: " << currarg << endl;
-				exit(-1);
-			}
-
-			*option->second = valueIt->second ^ invert;
-		} // "--"
-
-		else if (currarg[0] == '-') //string of single char options
-		{
-			for (size_t c = 1; currarg[c] != '\0'; c++)
-			{
-				optsMap_t::iterator option = optsMap.find(string(1,currarg[c]));
-				if (option == optsMap.end())
-				{
-					cerr << "Unknown option: -" << currarg[c] << endl;
-					exit(-1);
-				}
-				*option->second = true;
-			}
-		}
-
-		else //positional argument
-		{
-			if (out_arg_i < args.size())
-				*args[out_arg_i] = originalCaseArg;
-			else
-				unprocessedArgs.push_back(originalCaseArg);
-			out_arg_i++;
-		}
-	}
-	
-	return unprocessedArgs;
-}
-
-char * processOptions(int argc, char ** argv, OptionsMap & opts, vector<string> & args)
-{
-	for (int arg_i = 1; arg_i < argc; arg_i++)
-	{
-		char * currarg = argv[arg_i];
-
-		if (strncmp(currarg, "--", 2) == 0) //long option
-		{
-			bool value, invert;
-			size_t string_i;
-
-			if (strncasecmp(currarg+2, "no", 2) == 0)
-			{
-				invert = true;
-				string_i = 4;
-			}
-			else
-			{
-				invert = false;
-				string_i = 2;
-			}
-			
-			size_t equals_i = string_i;
-			while (currarg[equals_i] != '\0' && currarg[equals_i] != '=')
-				equals_i++;
-			if (currarg[equals_i] == '=')
-				currarg[equals_i++] = '\0';
-
-			OptionsMap::iterator option = opts.find(currarg+string_i);
-
-			if (option == opts.end())
-			{
-				cerr << "Unknown option: " << currarg << endl;
-				return currarg;
-			}
-
-			char valuechar = tolower(currarg[equals_i]);
-			if (valuechar == 'o') valuechar = tolower(currarg[equals_i+1]) + 1;
-			switch (valuechar)
-			{
-				case '\0'  : value = true;  break;
-				case 'f'+1 : value = false; break; //off: see 'o' above
-				case 'n'   : value = false; break;
-				case 'n'+1 : value = true;  break; //on: contrast 'n': see 'o' above
-				case 't'   : value = true;  break;
-				case 'y'   : value = true;  break;
-				default:
-					cerr << "Unknown option value: " << currarg << endl;
-					return currarg;
-			}
-
-			(*option).second = value ^ invert;
-		} // "--"
-
-		else if (currarg[0] == '-') //string of single char options
-		{
-			for (size_t c = 1; currarg[c] != '\0'; c++)
-			{
-				OptionsMap::iterator option = opts.find(string(1,currarg[c]));
-				if (option == opts.end())
-				{
-					cerr << "Unknown option: -" << currarg[c] << endl;
-					currarg[1] = currarg[c];
-					currarg[2] = '\0';
-					return currarg;
-				}
-				(*option).second = true;
-			}
-		}
-
-		else //positional argument
-			args.push_back(currarg);
-	}
-	
-	return NULL;
-}
-
-
-
-void makeLower(string & str)
-{
-	for (size_t i = 0; i < str.length(); i++)
-	{
-		str[i] = tolower(str[i]);
-	}
-}
-
-string toLower(const string & str)
-{
-	string s(str);
-	makeLower(s);
-	return s;
-}
-
-
-
-/**
-*  A wrapper function which writes a buffer to a file.
-**/
-ssize_t writeBytesToFile(signed int fileDescriptor, const char * buffer, unsigned int bufferLength) {
-	return writen(fileDescriptor, buffer, bufferLength);
-}
-
-
-// From Steven's Unix Net Programming
-// http://www.kohala.com/start/
-/* Write "n" bytes to a descriptor. */
-ssize_t writen(int fd, const void *vptr, size_t n)
-{
-	size_t         nleft;
-	ssize_t        nwritten;
-	const int8_t * ptr;
-
-	ptr = static_cast<const int8_t*>(vptr);
-	nleft = n;
-	while (nleft > 0) {
-		if ( (nwritten = ::write(fd, ptr, nleft)) <= 0) {
-			if (errno == EINTR)
-				nwritten = 0; /* and call write() again */
-			else
-				return -1; /* error */
-		}
-
-		nleft -= nwritten;
-		ptr   += nwritten;
-	}
-	return n;
-}
-
-
-
-
-// From Steven's Unix Net Programming
-// http://www.kohala.com/start/
-/* Read "n" bytes from a descriptor. */
-ssize_t readn(int fd, void *vptr, size_t n)
-{
-	size_t   nleft;
-	ssize_t  nread;
-	int8_t * ptr;
-
-	ptr = static_cast<int8_t*>(vptr);
-	nleft = n;
-	while (nleft > 0) {
-		if ( (nread = ::read(fd, ptr, nleft)) < 0) {
-			if (errno == EINTR)
-				nread = 0; /* and call read() again */
-			else
-				return -1;
-		}
-		else if (nread == 0)
-			break; /* EOF */
-
-		nleft -= nread;
-		ptr   += nread;
-	}
-	return n - nleft; /* return >= 0 */
-}
-
-
-void rename_main(const string & file, const string & newname)
-{
-	if (newname[0] != '_')
-	{
-		cerr << "INTERNAL ERROR: " __FILE__ << ":" << __LINE__
-		     << "newname argument to rename_main must begin with an underscore to ensure replacement safety" << endl;
-		exit(-2);
-	}
-	assertExists(file);
-	exec( "sed", "-i", "-e",
-	      ( "s/int[\\r\\n \\t][\\r\\n \\t]*main(.*)/int " + newname +
-		    "(int argc, char ** argv)/" ).c_str(),
-	      file.c_str() );
-}
-
-vector<string> tokenize(const string & str, char delim)
-{
-	vector<string> args;
-	
-	size_t start = 0;
-	size_t end;
-	for (end = str.find(delim); end != string::npos; end = str.find(delim, start))
-	{
-		args.push_back(str.substr(start, end - start));
-		start = end+1;
-	}
-	args.push_back(str.substr(start, str.size() - start));
-	
-	return args;
-}
-
-vector<string> tokenize(const string & str, const string & delims)
-{
-	vector<string> args;
-	
-	size_t start = 0;
-	while (start < str.length() && delims.find(str[start]) != string::npos) start++;
-	size_t end;
-	for (end = str.find_first_of(delims); end != string::npos; end = str.find_first_of(delims, start))
-	{
-		args.push_back(str.substr(start, end - start));
-		start = end+1;
-		while (start < str.length() && delims.find(str[start]) != string::npos) start++;
-	}
-	if (start < str.length())
-		args.push_back(str.substr(start, str.length() - start));
-	
-	return args;
-}
-
-namespace colorize
-{
-const char * BLACK = "\033[39m";
-const char * GREEN = "\033[32m";
-const char * RED   = "\033[31m";
-const bool is_color_enabled = isatty(STDOUT_FILENO);
-
-
-}
-
-} // namespace util
-
diff --git a/util.h b/util.h
deleted file mode 100644
index 9da2b7218b8280e5a7d07854bd5c095412b82a2b..0000000000000000000000000000000000000000
--- a/util.h
+++ /dev/null
@@ -1,403 +0,0 @@
-/* CS 225 Util Library
- * 
- * @author Jack Toole
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#define __STDC_LIMIT_MACROS
-
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-#include <fstream>
-#include <iostream>
-#include <map>
-#include <sstream>
-#include <string>
-#include <vector>
-
-namespace util
-{
-using namespace std;
-
-namespace internal
-{
-extern const char * error_prefix;
-}
-
-/************************************************************************/
-/* Comparator for case-insensitive comparison in STL assos. containers  */
-/* From Abhay:                                                          */
-/* http://stackoverflow.com/questions/1801892/making-mapfind-operation-case-insensitive */
-/************************************************************************/
-struct ci_less : std::binary_function<std::string, std::string, bool>
-{
-	// case-independent (ci) compare_less binary function
-	struct nocase_compare : public std::binary_function<unsigned char,unsigned char,bool> 
-	{
-		bool operator() (const unsigned char& c1, const unsigned char& c2) const
-		{
-			return tolower (c1) < tolower (c2);
-		}
-	};
-	bool operator() (const std::string & s1, const std::string & s2) const
-	{
-		return std::lexicographical_compare
-			(s1.begin (), s1.end (),   // source range
-			s2.begin (), s2.end (),   // dest range
-			nocase_compare ());  // comparison
-	}
-};
-
-// http://stackoverflow.com/questions/5300602/template-return-type-with-default-value
-template <typename T>
-struct Initializer
-{
-	T value;
-	Initializer()
-		:value() // ====> default construction, works for classes _and_ built-in
-	{ }
-};
-
-class Signal
-{
-	private:
-	const int signum;
-	public:
-	Signal(int signal_number) : signum(signal_number) { }
-	int number() const { return signum; }
-	const char * what() const;
-};
-
-
-
-/**
-*  Here we create a useful and easily understanable alias for the map.
-**/
-typedef map<string, vector<string>, ci_less> FileMap;
-typedef map<string, bool, ci_less> OptionsMap;
-
-class OptionsParser
-{
-	private:
-	typedef map<string, bool*> optsMap_t;
-	typedef map<string, bool>  valueMap_t;
-	valueMap_t valueMap; // not static to prevent still reachable memory
-	
-	optsMap_t  optsMap;
-	vector<string *> args;
-
-	public:
-	OptionsParser();
-	void addOption(const string & name, bool & setValue) { optsMap[name] = &setValue; }
-	void addArg(string & setValue) { args.push_back(&setValue); }
-	vector<string> parse(int argc, const char * const * argv);
-};
-
-// EXEC()
-int8_t exec(int redirect_fd, const char * command,
-            const char * arg1 = NULL,
-            const char * arg2 = NULL,
-            const char * arg3 = NULL,
-            const char * arg4 = NULL,
-            const char * arg5 = NULL,
-            const char * arg6 = NULL);
-
-inline
-int8_t exec(const char * command,
-            const char * arg1 = NULL,
-            const char * arg2 = NULL,
-            const char * arg3 = NULL,
-            const char * arg4 = NULL,
-            const char * arg5 = NULL,
-            const char * arg6 = NULL)
-{ return exec(STDOUT_FILENO, command, arg1, arg2, arg3, arg4, arg5, arg6); }
-
-inline int8_t exec(const string & command) { return exec(command.c_str()); }
-inline int8_t exec(const string & command, const string & arg1) { return exec(command.c_str(), arg1.c_str()); }
-inline int8_t exec(const string & command, const string & arg1, const string & arg2) { return exec(command.c_str(), arg1.c_str(), arg2.c_str()); }
-inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str()); }
-inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str()); }
-inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str()); }
-inline int8_t exec(const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5, const string & arg6) { return exec(command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str(), arg6.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command) { return exec(redirect_fd, command.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command, const string & arg1) { return exec(redirect_fd, command.c_str(), arg1.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str()); }
-inline int8_t exec(int redirect_fd, const string & command, const string & arg1, const string & arg2, const string & arg3, const string & arg4, const string & arg5, const string & arg6) { return exec(redirect_fd, command.c_str(), arg1.c_str(), arg2.c_str(), arg3.c_str(), arg4.c_str(), arg5.c_str(), arg6.c_str()); }
-int8_t exec(int redirect_fd, const string & command, const vector<string> & args);
-int8_t exec(const string & command, const vector<string> & args, ostream * output);
-inline int8_t exec(const string & command, const vector<string> & args) { return exec(command, args, &std::cout); }
-
-// FILESYSTEM FUNCTIONS
-void assertExists(const string & path, int exit_code = -1);
-bool exists(const string & path);
-mode_t permissions(const string & path);
-void forceRemoveDir(string dir);
-string getcwdstr();
-
-int  chdir(const string & dir);
-void copyFile(const string & source, const string & dest);
-void copyFiles(const string & sourceFolder, const string & destFolder, const vector<string> & files);
-void protectFiles(const string & folder, const vector<string> & files);
-void protectDir(const string & dir);
-void linkDirs(const string & sourceFolder, const string & destFolder, const vector<string> & dirs);
-vector<string> get_files_in_dir(const string & dir, bool concatdir = true);
-bool is_symlink(const string & file);
-string get_symlink_target(const string & symlink);
-
-// STRING REPLACEMENT
-bool   replaceFirst(string & str, const string & toreplace, const string & with);
-size_t replaceAll  (string & str, const string & toreplace, const string & with);
-size_t replaceAllInternal(string & str, const string & toreplace, const string & with);
-size_t findNthLast(const string & str, char c, size_t n);
-vector<string> tokenize(const string & str, char delim);
-vector<string> tokenize(const string & str, const string & delims);
-
-
-// IO OPERATIONS
-string read_string_from_FILE(FILE * file, size_t max_length = -1);
-void write_string_to_FILE(FILE * file, const char * str);
-ssize_t writeBytesToFile(signed int fileDescriptor, const char * buffer, unsigned int bufferLength);
-ssize_t writen(int fd, const void *vptr, size_t n);
-ssize_t write(int fd, const string & str);
-ssize_t write(int fd, int  val);
-ssize_t write(int fd, long val);
-ssize_t readn(int fd, void *vptr, size_t n);
-ssize_t read(int fd, int  & val);
-ssize_t read(int fd, long & val);
-
-
-// STRING TYPE OPERATIONS
-uint32_t intlen(uint32_t a);
-void makeLower(string & str);
-string toLower(const string & str);
-
-// String concatenation
-template <typename T>
-string to_string(const T & value);
-template <typename T>
-T from_string(const string & s);
-template <typename T, typename F>
-T lexical_cast(const F & from);
-string operator+(const string & lhs, const string & rhs); // These 5 functions are to disambiguate
-string operator+(const string & lhs, const char * rhs);        // operator+ so that the following
-string operator+(const string & lhs, char rhs);                // templates may exist
-string operator+(const char * lhs, const string & rhs);
-string operator+(char lhs, const string & rhs);
-template <typename T>
-string & operator+=(string & str, const T & value);
-template <typename T>
-string operator+(const string & str, const T & value);
-
-
-// CLOCK / TIMING
-uint64_t process_clock();
-uint64_t system_clock();
-
-// CONFIGURATION
-void readConfig(const string & testsFolder, FileMap & map, const string & discriminator = "");
-void readFile(const string & file, vector<string> & lines);
-string readFile(const string & filename);
-void readFileGeneric(const string & file, FileMap * map, vector<string> * lines, const string & discriminator = "");
-char * processOptions(int argc, char ** argv, OptionsMap & opts, vector<string> & args);
-
-
-// AUTOGRADER
-
-
-// STUDENT CODE COMPILATION FUNCTIONS
-void rename_main(const string & file, const string & newname);
-
-
-// MACROS
-void SET_ERROR_MESSAGE(const char * message);
-
-#define STRINGIFY1(p)   #p
-#define STR(p)          STRINGIFY1(p)
-
-namespace internal
-{
-template<typename StrType>
-void exit_if_error_output(const char * file, int32_t line, StrType message);
-}
-
-#define EXIT_IF_ERROR2(statement_check, message)                       \
-	do {                                                               \
-		errno = 0;                                                     \
-		if ((statement_check) || errno != 0)                                         \
-			util::internal::exit_if_error_output(__FILE__, __LINE__, message); \
-	} while (0)
-
-#define EXIT_IF_ERROR1(statement_check)                                \
-	EXIT_IF_ERROR2(statement_check, #statement_check)
-
-// Crazy hack for overloading!
-// Arg counting from:
-// http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/
-// Overloading tips:
-// http://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros
-#define EXIT_IF_ERROR_THIRD_ARG(a, b, c, ...) c
-
-#define EXIT_IF_ERROR(...)                                    \
-	EXIT_IF_ERROR_THIRD_ARG(__VA_ARGS__,                      \
-	                        EXIT_IF_ERROR2,                   \
-							EXIT_IF_ERROR1, 0) (__VA_ARGS__)
-
-// Colorization
-namespace colorize
-{
-	extern const char * BLACK;
-	extern const char * GREEN;
-	extern const char * RED;
-
-	extern const bool is_color_enabled;
-
-	inline string make_color(const char * color, const string & str)
-	{
-		return (is_color_enabled ? color + str + BLACK : str);
-	}
-} // namespace colorize
-
-
-// INLINE IMPLEMENTATIONS
-// Originally by radu
-// http://notfaq.wordpress.com/2006/08/30/c-convert-int-to-string/
-template <typename T>
-inline string to_string(const T & value)
-{
-	stringstream ss;
-	ss << value;
-	return ss.str();
-}
-
-// http://stackoverflow.com/questions/5017001/like-atoi-but-to-float
-template <typename T>
-inline T from_string(const string & s)
-{
-	stringstream ss(s);
-	T value;
-	ss >> value;
-	return value;
-}
-
-template <typename T, typename F>
-inline T lexical_cast(const F & from)
-{
-	Initializer<T> to;
-	stringstream ss;
-	if (!(ss << from))
-	{
-		cerr << "ERROR: Could not convert types" << endl;
-		return to.value;
-	}
-	if (!(ss >> to.value))
-	{
-		cerr << "ERROR: Could not convert types" << endl;
-		return to.value;
-	}
-	return to.value; // TODO (toole1): Not sure if this forces a copy
-}
-
-inline uint32_t intlen(uint32_t a)
-{
-	uint32_t len = 1;
-	a /= 10;
-
-	while (a != 0)
-	{
-		a = a/10;
-		len++;
-	}
-	return len;
-}
-
-inline ssize_t write(int fd, const string & str)
-{
-	return writen(fd, str.c_str(), str.length()+1);
-}
-
-inline ssize_t write(int fd, int val)
-{
-	return writen(fd, &val, sizeof val);
-}
-
-inline ssize_t write(int fd, long val)
-{
-	return writen(fd, &val, sizeof val);
-}
-
-inline ssize_t read(int fd, int & val)
-{
-	return readn(fd, &val, sizeof val);
-}
-
-inline ssize_t read(int fd, long & val)
-{
-	return readn(fd, &val, sizeof val);
-}
-
-template <typename T, typename C, typename BinaryOp>
-T accumulate(const C & collect, BinaryOp op, T init)
-{
-	typename C::const_iterator it = collect.begin();
-	typename C::const_iterator end = collect.end();
-	while (it != end)
-		init = init + *it++;
-	return init;
-}
-
-inline string operator+(const string & lhs, const string & rhs)      { return std::operator+(lhs, rhs); }
-inline string operator+(const string & lhs, const char * rhs)        { return std::operator+(lhs, rhs); }
-inline string operator+(const string & lhs, char rhs)                { return std::operator+(lhs, rhs); }
-inline string operator+(char lhs, const string & rhs)                { return std::operator+(lhs, rhs); }
-inline string operator+(const char * lhs, const string & rhs)        { return std::operator+(lhs, rhs); }
-
-template <typename T>
-inline std::string & operator+=(std::string & str, const T & value)
-{
-	str += util::to_string(value);
-	return str;
-}
-
-template <typename T>
-inline std::string operator+(const std::string & str, const T & value)
-{
-	std::stringstream ss;
-	ss << str << value;
-	return ss.str();
-}
-
-inline uint64_t process_clock()
-{
-#ifdef CLOCK_PROCESS_CPUTIME_ID
-	timespec ts;
-	clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
-	return ts.tv_sec * 1000000 + (ts.tv_nsec + 500) / 1000;
-#else
-	return clock();
-#endif
-}
-
-inline uint64_t system_clock()
-{
-	timeval tv;
-	gettimeofday(&tv, NULL);
-	return tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-} // namespace util
-
-#endif // UTIL_H
diff --git a/valgrind.h b/valgrind.h
deleted file mode 100644
index 3e66a95d6ea79e6985b7b633c3b3c81c9c0b690b..0000000000000000000000000000000000000000
--- a/valgrind.h
+++ /dev/null
@@ -1,4792 +0,0 @@
-/* -*- c -*-
-   ----------------------------------------------------------------
-
-   Notice that the following BSD-style license applies to this one
-   file (valgrind.h) only.  The rest of Valgrind is licensed under the
-   terms of the GNU General Public License, version 2, unless
-   otherwise indicated.  See the COPYING file in the source
-   distribution for details.
-
-   ----------------------------------------------------------------
-
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2000-2010 Julian Seward.  All rights reserved.
-
-   redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions
-   are met:
-
-   1. redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-   2. The origin of this software must not be misrepresented; you must 
-      not claim that you wrote the original software.  If you use this 
-      software in a product, an acknowledgment in the product 
-      documentation would be appreciated but is not required.
-
-   3. Altered source versions must be plainly marked as such, and must
-      not be misrepresented as being the original software.
-
-   4. The name of the author may not be used to endorse or promote 
-      products derived from this software without specific prior written 
-      permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-   ----------------------------------------------------------------
-
-   Notice that the above BSD-style license applies to this one file
-   (valgrind.h) only.  The entire rest of Valgrind is licensed under
-   the terms of the GNU General Public License, version 2.  See the
-   COPYING file in the source distribution for details.
-
-   ---------------------------------------------------------------- 
-*/
-
-
-/* This file is for inclusion into client (your!) code.
-
-   You can use these macros to manipulate and query Valgrind's 
-   execution inside your own programs.
-
-   The resulting executables will still run without Valgrind, just a
-   little bit more slowly than they otherwise would, but otherwise
-   unchanged.  When not running on valgrind, each client request
-   consumes very few (eg. 7) instructions, so the resulting performance
-   loss is negligible unless you plan to execute client requests
-   millions of times per second.  Nevertheless, if that is still a
-   problem, you can compile with the NVALGRIND symbol defined (gcc
-   -DNVALGRIND) so that client requests are not even compiled in.  */
-
-#ifndef __VALGRIND_H
-#define __VALGRIND_H
-
-
-/* ------------------------------------------------------------------ */
-/* VERSION NUMBER OF VALGRIND                                         */
-/* ------------------------------------------------------------------ */
-
-/* Specify Valgrind's version number, so that user code can
-   conditionally compile based on our version number.  Note that these
-   were introduced at version 3.6 and so do not exist in version 3.5
-   or earlier.  The recommended way to use them to check for "version
-   X.Y or later" is (eg)
-
-#if defined(__VALGRIND_MAJOR__) && defined(__VALGRIND_MINOR__)   \
-    && (__VALGRIND_MAJOR__ > 3                                   \
-        || (__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 6))
-*/
-#define __VALGRIND_MAJOR__    3
-#define __VALGRIND_MINOR__    6
-
-
-#include <stdarg.h>
-
-/* Nb: this file might be included in a file compiled with -ansi.  So
-   we can't use C++ style "//" comments nor the "asm" keyword (instead
-   use "__asm__"). */
-
-/* Derive some tags indicating what the target platform is.  Note
-   that in this file we're using the compiler's CPP symbols for
-   identifying architectures, which are different to the ones we use
-   within the rest of Valgrind.  Note, __powerpc__ is active for both
-   32 and 64-bit PPC, whereas __powerpc64__ is only active for the
-   latter (on Linux, that is).
-
-   Misc note: how to find out what's predefined in gcc by default:
-   gcc -Wp,-dM somefile.c
-*/
-#undef PLAT_ppc64_aix5
-#undef PLAT_ppc32_aix5
-#undef PLAT_x86_darwin
-#undef PLAT_amd64_darwin
-#undef PLAT_x86_win32
-#undef PLAT_x86_linux
-#undef PLAT_amd64_linux
-#undef PLAT_ppc32_linux
-#undef PLAT_ppc64_linux
-#undef PLAT_arm_linux
-
-#if defined(_AIX) && defined(__64BIT__)
-#  define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-#  define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
-#  define PLAT_x86_darwin 1
-#elif defined(__APPLE__) && defined(__x86_64__)
-#  define PLAT_amd64_darwin 1
-#elif defined(__MINGW32__) || defined(__CYGWIN32__) || defined(_WIN32) && defined(_M_IX86)
-#  define PLAT_x86_win32 1
-#elif defined(__linux__) && defined(__i386__)
-#  define PLAT_x86_linux 1
-#elif defined(__linux__) && defined(__x86_64__)
-#  define PLAT_amd64_linux 1
-#elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)
-#  define PLAT_ppc32_linux 1
-#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
-#  define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
-#  define PLAT_arm_linux 1
-#else
-/* If we're not compiling for our target platform, don't generate
-   any inline asms.  */
-#  if !defined(NVALGRIND)
-#    define NVALGRIND 1
-#  endif
-#endif
-
-
-/* ------------------------------------------------------------------ */
-/* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS.  There is nothing */
-/* in here of use to end-users -- skip to the next section.           */
-/* ------------------------------------------------------------------ */
-
-#if defined(NVALGRIND)
-
-/* Define NVALGRIND to completely remove the Valgrind magic sequence
-   from the compiled code (analogous to NDEBUG's effects on
-   assert()) */
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-   {                                                              \
-      (_zzq_rlval) = (_zzq_default);                              \
-   }
-
-#else  /* ! NVALGRIND */
-
-/* The following defines the magic code sequences which the JITter
-   spots and handles magically.  Don't look too closely at them as
-   they will rot your brain.
-
-   The assembly code sequences for all architectures is in this one
-   file.  This is because this file must be stand-alone, and we don't
-   want to have multiple files.
-
-   For VALGRIND_DO_CLIENT_REQUEST, we must ensure that the default
-   value gets put in the return slot, so that everything works when
-   this is executed not under Valgrind.  Args are passed in a memory
-   block, and so there's no intrinsic limit to the number that could
-   be passed, but it's currently five.
-   
-   The macro args are: 
-      _zzq_rlval    result lvalue
-      _zzq_default  default value (result returned when running on real CPU)
-      _zzq_request  request code
-      _zzq_arg1..5  request params
-
-   The other two macros are used to support function wrapping, and are
-   a lot simpler.  VALGRIND_GET_NR_CONTEXT returns the value of the
-   guest's NRADDR pseudo-register and whatever other information is
-   needed to safely run the call original from the wrapper: on
-   ppc64-linux, the R2 value at the divert point is also needed.  This
-   information is abstracted into a user-visible type, OrigFn.
-
-   VALGRIND_CALL_NOREDIR_* behaves the same as the following on the
-   guest, but guarantees that the branch instruction will not be
-   redirected: x86: call *%eax, amd64: call *%rax, ppc32/ppc64:
-   branch-and-link-to-r11.  VALGRIND_CALL_NOREDIR is just text, not a
-   complete inline asm, since it needs to be combined with more magic
-   inline asm stuff to be useful.
-*/
-
-/* ------------------------- x86-{linux,darwin} ---------------- */
-
-#if defined(PLAT_x86_linux)  ||  defined(PLAT_x86_darwin)  \
-    ||  (defined(PLAT_x86_win32) && defined(__GNUC__))
-
-typedef
-   struct { 
-      unsigned int nraddr; /* where's the code? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "roll $3,  %%edi ; roll $13, %%edi\n\t"      \
-                     "roll $29, %%edi ; roll $19, %%edi\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-  { volatile unsigned int _zzq_args[6];                           \
-    volatile unsigned int _zzq_result;                            \
-    _zzq_args[0] = (unsigned int)(_zzq_request);                  \
-    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
-    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
-    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
-    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
-    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %EDX = client_request ( %EAX ) */         \
-                     "xchgl %%ebx,%%ebx"                          \
-                     : "=d" (_zzq_result)                         \
-                     : "a" (&_zzq_args[0]), "0" (_zzq_default)    \
-                     : "cc", "memory"                             \
-                    );                                            \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    volatile unsigned int __addr;                                 \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %EAX = guest_NRADDR */                    \
-                     "xchgl %%ecx,%%ecx"                          \
-                     : "=a" (__addr)                              \
-                     :                                            \
-                     : "cc", "memory"                             \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-  }
-
-#define VALGRIND_CALL_NOREDIR_EAX                                 \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* call-noredir *%EAX */                     \
-                     "xchgl %%edx,%%edx\n\t"
-#endif /* PLAT_x86_linux || PLAT_x86_darwin || (PLAT_x86_win32 && __GNUC__) */
-
-/* ------------------------- x86-Win32 ------------------------- */
-
-#if defined(PLAT_x86_win32) && !defined(__GNUC__)
-
-typedef
-   struct { 
-      unsigned int nraddr; /* where's the code? */
-   }
-   OrigFn;
-
-#if defined(_MSC_VER)
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     __asm rol edi, 3  __asm rol edi, 13          \
-                     __asm rol edi, 29 __asm rol edi, 19
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-  { volatile uintptr_t _zzq_args[6];                              \
-    volatile unsigned int _zzq_result;                            \
-    _zzq_args[0] = (uintptr_t)(_zzq_request);                     \
-    _zzq_args[1] = (uintptr_t)(_zzq_arg1);                        \
-    _zzq_args[2] = (uintptr_t)(_zzq_arg2);                        \
-    _zzq_args[3] = (uintptr_t)(_zzq_arg3);                        \
-    _zzq_args[4] = (uintptr_t)(_zzq_arg4);                        \
-    _zzq_args[5] = (uintptr_t)(_zzq_arg5);                        \
-    __asm { __asm lea eax, _zzq_args __asm mov edx, _zzq_default  \
-            __SPECIAL_INSTRUCTION_PREAMBLE                        \
-            /* %EDX = client_request ( %EAX ) */                  \
-            __asm xchg ebx,ebx                                    \
-            __asm mov _zzq_result, edx                            \
-    }                                                             \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    volatile unsigned int __addr;                                 \
-    __asm { __SPECIAL_INSTRUCTION_PREAMBLE                        \
-            /* %EAX = guest_NRADDR */                             \
-            __asm xchg ecx,ecx                                    \
-            __asm mov __addr, eax                                 \
-    }                                                             \
-    _zzq_orig->nraddr = __addr;                                   \
-  }
-
-#define VALGRIND_CALL_NOREDIR_EAX ERROR
-
-#else
-#error Unsupported compiler.
-#endif
-
-#endif /* PLAT_x86_win32 */
-
-/* ------------------------ amd64-{linux,darwin} --------------- */
-
-#if defined(PLAT_amd64_linux)  ||  defined(PLAT_amd64_darwin)
-
-typedef
-   struct { 
-      unsigned long long int nraddr; /* where's the code? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rolq $3,  %%rdi ; rolq $13, %%rdi\n\t"      \
-                     "rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-  { volatile unsigned long long int _zzq_args[6];                 \
-    volatile unsigned long long int _zzq_result;                  \
-    _zzq_args[0] = (unsigned long long int)(_zzq_request);        \
-    _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \
-    _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \
-    _zzq_args[3] = (unsigned long long int)(_zzq_arg3);           \
-    _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \
-    _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %RDX = client_request ( %RAX ) */         \
-                     "xchgq %%rbx,%%rbx"                          \
-                     : "=d" (_zzq_result)                         \
-                     : "a" (&_zzq_args[0]), "0" (_zzq_default)    \
-                     : "cc", "memory"                             \
-                    );                                            \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    volatile unsigned long long int __addr;                       \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %RAX = guest_NRADDR */                    \
-                     "xchgq %%rcx,%%rcx"                          \
-                     : "=a" (__addr)                              \
-                     :                                            \
-                     : "cc", "memory"                             \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-  }
-
-#define VALGRIND_CALL_NOREDIR_RAX                                 \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* call-noredir *%RAX */                     \
-                     "xchgq %%rdx,%%rdx\n\t"
-#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
-
-/* ------------------------ ppc32-linux ------------------------ */
-
-#if defined(PLAT_ppc32_linux)
-
-typedef
-   struct { 
-      unsigned int nraddr; /* where's the code? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\n\t"  \
-                     "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  {          unsigned int  _zzq_args[6];                          \
-             unsigned int  _zzq_result;                           \
-             unsigned int* _zzq_ptr;                              \
-    _zzq_args[0] = (unsigned int)(_zzq_request);                  \
-    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
-    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
-    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
-    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
-    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 3,%1\n\t" /*default*/                    \
-                     "mr 4,%2\n\t" /*ptr*/                        \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"     /*result*/                     \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_default), "b" (_zzq_ptr)         \
-                     : "cc", "memory", "r3", "r4");               \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    unsigned int __addr;                                          \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "cc", "memory", "r3"                       \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
-#endif /* PLAT_ppc32_linux */
-
-/* ------------------------ ppc64-linux ------------------------ */
-
-#if defined(PLAT_ppc64_linux)
-
-typedef
-   struct { 
-      unsigned long long int nraddr; /* where's the code? */
-      unsigned long long int r2;  /* what tocptr do we need? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rotldi 0,0,3  ; rotldi 0,0,13\n\t"          \
-                     "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  {          unsigned long long int  _zzq_args[6];                \
-    register unsigned long long int  _zzq_result __asm__("r3");   \
-    register unsigned long long int* _zzq_ptr __asm__("r4");      \
-    _zzq_args[0] = (unsigned long long int)(_zzq_request);        \
-    _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \
-    _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \
-    _zzq_args[3] = (unsigned long long int)(_zzq_arg3);           \
-    _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \
-    _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1"                                   \
-                     : "=r" (_zzq_result)                         \
-                     : "0" (_zzq_default), "r" (_zzq_ptr)         \
-                     : "cc", "memory");                           \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned long long int __addr __asm__("r3");         \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2"                                   \
-                     : "=r" (__addr)                              \
-                     :                                            \
-                     : "cc", "memory"                             \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4"                                   \
-                     : "=r" (__addr)                              \
-                     :                                            \
-                     : "cc", "memory"                             \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
-
-#endif /* PLAT_ppc64_linux */
-
-/* ------------------------- arm-linux ------------------------- */
-
-#if defined(PLAT_arm_linux)
-
-typedef
-   struct { 
-      unsigned int nraddr; /* where's the code? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-            "mov r12, r12, ror #3  ; mov r12, r12, ror #13 \n\t"  \
-            "mov r12, r12, ror #29 ; mov r12, r12, ror #19 \n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  { volatile unsigned int  _zzq_args[6];                          \
-    volatile unsigned int  _zzq_result;                           \
-    _zzq_args[0] = (unsigned int)(_zzq_request);                  \
-    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
-    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
-    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
-    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
-    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
-    __asm__ volatile("mov r3, %1\n\t" /*default*/                 \
-                     "mov r4, %2\n\t" /*ptr*/                     \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* R3 = client_request ( R4 ) */             \
-                     "orr r10, r10, r10\n\t"                      \
-                     "mov %0, r3"     /*result*/                  \
-                     : "=r" (_zzq_result)                         \
-                     : "r" (_zzq_default), "r" (&_zzq_args[0])    \
-                     : "cc","memory", "r3", "r4");                \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    unsigned int __addr;                                          \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* R3 = guest_NRADDR */                      \
-                     "orr r11, r11, r11\n\t"                      \
-                     "mov %0, r3"                                 \
-                     : "=r" (__addr)                              \
-                     :                                            \
-                     : "cc", "memory", "r3"                       \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                    \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R4 */        \
-                     "orr r12, r12, r12\n\t"
-
-#endif /* PLAT_arm_linux */
-
-/* ------------------------ ppc32-aix5 ------------------------- */
-
-#if defined(PLAT_ppc32_aix5)
-
-typedef
-   struct { 
-      unsigned int nraddr; /* where's the code? */
-      unsigned int r2;  /* what tocptr do we need? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\n\t"  \
-                     "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  {          unsigned int  _zzq_args[7];                          \
-    register unsigned int  _zzq_result;                           \
-    register unsigned int* _zzq_ptr;                              \
-    _zzq_args[0] = (unsigned int)(_zzq_request);                  \
-    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
-    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
-    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
-    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
-    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
-    _zzq_args[6] = (unsigned int)(_zzq_default);                  \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 4,%1\n\t"                                \
-                     "lwz 3, 24(4)\n\t"                           \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_ptr)                             \
-                     : "r3", "r4", "cc", "memory");               \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned int __addr;                                 \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
-
-#endif /* PLAT_ppc32_aix5 */
-
-/* ------------------------ ppc64-aix5 ------------------------- */
-
-#if defined(PLAT_ppc64_aix5)
-
-typedef
-   struct { 
-      unsigned long long int nraddr; /* where's the code? */
-      unsigned long long int r2;  /* what tocptr do we need? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rotldi 0,0,3  ; rotldi 0,0,13\n\t"          \
-                     "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST(                               \
-        _zzq_rlval, _zzq_default, _zzq_request,                   \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  {          unsigned long long int  _zzq_args[7];                \
-    register unsigned long long int  _zzq_result;                 \
-    register unsigned long long int* _zzq_ptr;                    \
-    _zzq_args[0] = (unsigned int long long)(_zzq_request);        \
-    _zzq_args[1] = (unsigned int long long)(_zzq_arg1);           \
-    _zzq_args[2] = (unsigned int long long)(_zzq_arg2);           \
-    _zzq_args[3] = (unsigned int long long)(_zzq_arg3);           \
-    _zzq_args[4] = (unsigned int long long)(_zzq_arg4);           \
-    _zzq_args[5] = (unsigned int long long)(_zzq_arg5);           \
-    _zzq_args[6] = (unsigned int long long)(_zzq_default);        \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 4,%1\n\t"                                \
-                     "ld 3, 48(4)\n\t"                            \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_ptr)                             \
-                     : "r3", "r4", "cc", "memory");               \
-    _zzq_rlval = _zzq_result;                                     \
-  }
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned long long int __addr;                       \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
-
-#endif /* PLAT_ppc64_aix5 */
-
-/* Insert assembly code for other platforms here... */
-
-#endif /* NVALGRIND */
-
-
-/* ------------------------------------------------------------------ */
-/* PLATFORM SPECIFICS for FUNCTION WRAPPING.  This is all very        */
-/* ugly.  It's the least-worst tradeoff I can think of.               */
-/* ------------------------------------------------------------------ */
-
-/* This section defines magic (a.k.a appalling-hack) macros for doing
-   guaranteed-no-redirection macros, so as to get from function
-   wrappers to the functions they are wrapping.  The whole point is to
-   construct standard call sequences, but to do the call itself with a
-   special no-redirect call pseudo-instruction that the JIT
-   understands and handles specially.  This section is long and
-   repetitious, and I can't see a way to make it shorter.
-
-   The naming scheme is as follows:
-
-      CALL_FN_{W,v}_{v,W,WW,WWW,WWWW,5W,6W,7W,etc}
-
-   'W' stands for "word" and 'v' for "void".  Hence there are
-   different macros for calling arity 0, 1, 2, 3, 4, etc, functions,
-   and for each, the possibility of returning a word-typed result, or
-   no result.
-*/
-
-/* Use these to write the name of your wrapper.  NOTE: duplicates
-   VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
-
-/* Use an extra level of macroisation so as to ensure the soname/fnname
-   args are fully macro-expanded before pasting them together. */
-#define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
-
-#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname)                    \
-   VG_CONCAT4(_vgwZU_,soname,_,fnname)
-
-#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname)                    \
-   VG_CONCAT4(_vgwZZ_,soname,_,fnname)
-
-/* Use this macro from within a wrapper function to collect the
-   context (address and possibly other info) of the original function.
-   Once you have that you can then use it in one of the CALL_FN_
-   macros.  The type of the argument _lval is OrigFn. */
-#define VALGRIND_GET_ORIG_FN(_lval)  VALGRIND_GET_NR_CONTEXT(_lval)
-
-/* Derivatives of the main macros below, for calling functions
-   returning void. */
-
-#define CALL_FN_v_v(fnptr)                                        \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_v(_junk,fnptr); } while (0)
-
-#define CALL_FN_v_W(fnptr, arg1)                                  \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_W(_junk,fnptr,arg1); } while (0)
-
-#define CALL_FN_v_WW(fnptr, arg1,arg2)                            \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0)
-
-#define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3)                      \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)
-
-#define CALL_FN_v_WWWW(fnptr, arg1,arg2,arg3,arg4)                \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_WWWW(_junk,fnptr,arg1,arg2,arg3,arg4); } while (0)
-
-#define CALL_FN_v_5W(fnptr, arg1,arg2,arg3,arg4,arg5)             \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_5W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5); } while (0)
-
-#define CALL_FN_v_6W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6)        \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_6W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6); } while (0)
-
-#define CALL_FN_v_7W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6,arg7)   \
-   do { volatile unsigned long _junk;                             \
-        CALL_FN_W_7W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6,arg7); } while (0)
-
-/* ------------------------- x86-{linux,darwin} ---------------- */
-
-#if defined(PLAT_x86_linux)  ||  defined(PLAT_x86_darwin)
-
-/* These regs are trashed by the hidden call.  No need to mention eax
-   as gcc can already see that, plus causes gcc to bomb. */
-#define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx"
-
-/* These CALL_FN_ macros assume that on x86-linux, sizeof(unsigned
-   long) == 4. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[1];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[2];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      __asm__ volatile(                                           \
-         "subl $12, %%esp\n\t"                                    \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $16, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      __asm__ volatile(                                           \
-         "subl $8, %%esp\n\t"                                     \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $16, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[4];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      __asm__ volatile(                                           \
-         "subl $4, %%esp\n\t"                                     \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $16, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[5];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      __asm__ volatile(                                           \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $16, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[6];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      __asm__ volatile(                                           \
-         "subl $12, %%esp\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $32, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[7];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      __asm__ volatile(                                           \
-         "subl $8, %%esp\n\t"                                     \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $32, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[8];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      __asm__ volatile(                                           \
-         "subl $4, %%esp\n\t"                                     \
-         "pushl 28(%%eax)\n\t"                                    \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $32, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[9];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      __asm__ volatile(                                           \
-         "pushl 32(%%eax)\n\t"                                    \
-         "pushl 28(%%eax)\n\t"                                    \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $32, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[10];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      __asm__ volatile(                                           \
-         "subl $12, %%esp\n\t"                                    \
-         "pushl 36(%%eax)\n\t"                                    \
-         "pushl 32(%%eax)\n\t"                                    \
-         "pushl 28(%%eax)\n\t"                                    \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $48, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[11];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      __asm__ volatile(                                           \
-         "subl $8, %%esp\n\t"                                     \
-         "pushl 40(%%eax)\n\t"                                    \
-         "pushl 36(%%eax)\n\t"                                    \
-         "pushl 32(%%eax)\n\t"                                    \
-         "pushl 28(%%eax)\n\t"                                    \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $48, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
-                                  arg6,arg7,arg8,arg9,arg10,      \
-                                  arg11)                          \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[12];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      __asm__ volatile(                                           \
-         "subl $4, %%esp\n\t"                                     \
-         "pushl 44(%%eax)\n\t"                                    \
-         "pushl 40(%%eax)\n\t"                                    \
-         "pushl 36(%%eax)\n\t"                                    \
-         "pushl 32(%%eax)\n\t"                                    \
-         "pushl 28(%%eax)\n\t"                                    \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $48, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
-                                  arg6,arg7,arg8,arg9,arg10,      \
-                                  arg11,arg12)                    \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[13];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      _argvec[12] = (unsigned long)(arg12);                       \
-      __asm__ volatile(                                           \
-         "pushl 48(%%eax)\n\t"                                    \
-         "pushl 44(%%eax)\n\t"                                    \
-         "pushl 40(%%eax)\n\t"                                    \
-         "pushl 36(%%eax)\n\t"                                    \
-         "pushl 32(%%eax)\n\t"                                    \
-         "pushl 28(%%eax)\n\t"                                    \
-         "pushl 24(%%eax)\n\t"                                    \
-         "pushl 20(%%eax)\n\t"                                    \
-         "pushl 16(%%eax)\n\t"                                    \
-         "pushl 12(%%eax)\n\t"                                    \
-         "pushl 8(%%eax)\n\t"                                     \
-         "pushl 4(%%eax)\n\t"                                     \
-         "movl (%%eax), %%eax\n\t"  /* target->%eax */            \
-         VALGRIND_CALL_NOREDIR_EAX                                \
-         "addl $48, %%esp\n"                                      \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_x86_linux || PLAT_x86_darwin */
-
-/* ------------------------ amd64-{linux,darwin} --------------- */
-
-#if defined(PLAT_amd64_linux)  ||  defined(PLAT_amd64_darwin)
-
-/* ARGREGS: rdi rsi rdx rcx r8 r9 (the rest on stack in R-to-L order) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS /*"rax",*/ "rcx", "rdx", "rsi",       \
-                            "rdi", "r8", "r9", "r10", "r11"
-
-/* This is all pretty complex.  It's so as to make stack unwinding
-   work reliably.  See bug 243270.  The basic problem is the sub and
-   add of 128 of %rsp in all of the following macros.  If gcc believes
-   the CFA is in %rsp, then unwinding may fail, because what's at the
-   CFA is not what gcc "expected" when it constructs the CFIs for the
-   places where the macros are instantiated.
-
-   But we can't just add a CFI annotation to increase the CFA offset
-   by 128, to match the sub of 128 from %rsp, because we don't know
-   whether gcc has chosen %rsp as the CFA at that point, or whether it
-   has chosen some other register (eg, %rbp).  In the latter case,
-   adding a CFI annotation to change the CFA offset is simply wrong.
-
-   So the solution is to get hold of the CFA using
-   __builtin_dwarf_cfa(), put it in a known register, and add a
-   CFI annotation to say what the register is.  We choose %rbp for
-   this (perhaps perversely), because:
-
-   (1) %rbp is already subject to unwinding.  If a new register was
-       chosen then the unwinder would have to unwind it in all stack
-       traces, which is expensive, and
-
-   (2) %rbp is already subject to precise exception updates in the
-       JIT.  If a new register was chosen, we'd have to have precise
-       exceptions for it too, which reduces performance of the
-       generated code.
-
-   However .. one extra complication.  We can't just whack the result
-   of __builtin_dwarf_cfa() into %rbp and then add %rbp to the
-   list of trashed registers at the end of the inline assembly
-   fragments; gcc won't allow %rbp to appear in that list.  Hence
-   instead we need to stash %rbp in %r15 for the duration of the asm,
-   and say that %r15 is trashed instead.  gcc seems happy to go with
-   that.
-
-   Oh .. and this all needs to be conditionalised so that it is
-   unchanged from before this commit, when compiled with older gccs
-   that don't support __builtin_dwarf_cfa.  Furthermore, since
-   this header file is freestanding, it has to be independent of
-   config.h, and so the following conditionalisation cannot depend on
-   configure time checks.
-
-   Although it's not clear from
-   'defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)',
-   this expression excludes Darwin.
-   .cfi directives in Darwin assembly appear to be completely
-   different and I haven't investigated how they work.
-
-   For even more entertainment value, note we have to use the
-   completely undocumented __builtin_dwarf_cfa(), which appears to
-   really compute the CFA, whereas __builtin_frame_address(0) claims
-   to but actually doesn't.  See
-   https://bugs.kde.org/show_bug.cgi?id=243270#c47
-*/
-#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
-#  define __FRAME_POINTER                                         \
-      ,"r"(__builtin_dwarf_cfa())
-#  define VALGRIND_CFI_PROLOGUE                                   \
-      "movq %%rbp, %%r15\n\t"                                     \
-      "movq %2, %%rbp\n\t"                                        \
-      ".cfi_remember_state\n\t"                                   \
-      ".cfi_def_cfa rbp, 0\n\t"
-#  define VALGRIND_CFI_EPILOGUE                                   \
-      "movq %%r15, %%rbp\n\t"                                     \
-      ".cfi_restore_state\n\t"
-#else
-#  define __FRAME_POINTER
-#  define VALGRIND_CFI_PROLOGUE
-#  define VALGRIND_CFI_EPILOGUE
-#endif
-
-
-/* These CALL_FN_ macros assume that on amd64-linux, sizeof(unsigned
-   long) == 8. */
-
-/* NB 9 Sept 07.  There is a nasty kludge here in all these CALL_FN_
-   macros.  In order not to trash the stack redzone, we need to drop
-   %rsp by 128 before the hidden call, and restore afterwards.  The
-   nastyness is that it is only by luck that the stack still appears
-   to be unwindable during the hidden call - since then the behaviour
-   of any routine using this macro does not match what the CFI data
-   says.  Sigh.
-
-   Why is this important?  Imagine that a wrapper has a stack
-   allocated local, and passes to the hidden call, a pointer to it.
-   Because gcc does not know about the hidden call, it may allocate
-   that local in the redzone.  Unfortunately the hidden call may then
-   trash it before it comes to use it.  So we must step clear of the
-   redzone, for the duration of the hidden call, to make it safe.
-
-   Probably the same problem afflicts the other redzone-style ABIs too
-   (ppc64-linux, ppc32-aix5, ppc64-aix5); but for those, the stack is
-   self describing (none of this CFI nonsense) so at least messing
-   with the stack pointer doesn't give a danger of non-unwindable
-   stack. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[1];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[2];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[4];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[5];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[6];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[7];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[8];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $136,%%rsp\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $8, %%rsp\n"                                       \
-         "addq $136,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[9];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $16, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[10];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $136,%%rsp\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $24, %%rsp\n"                                      \
-         "addq $136,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[11];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 80(%%rax)\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $32, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[12];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $136,%%rsp\n\t"                                    \
-         "pushq 88(%%rax)\n\t"                                    \
-         "pushq 80(%%rax)\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $40, %%rsp\n"                                      \
-         "addq $136,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[13];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      _argvec[12] = (unsigned long)(arg12);                       \
-      __asm__ volatile(                                           \
-         VALGRIND_CFI_PROLOGUE                                    \
-         "subq $128,%%rsp\n\t"                                    \
-         "pushq 96(%%rax)\n\t"                                    \
-         "pushq 88(%%rax)\n\t"                                    \
-         "pushq 80(%%rax)\n\t"                                    \
-         "pushq 72(%%rax)\n\t"                                    \
-         "pushq 64(%%rax)\n\t"                                    \
-         "pushq 56(%%rax)\n\t"                                    \
-         "movq 48(%%rax), %%r9\n\t"                               \
-         "movq 40(%%rax), %%r8\n\t"                               \
-         "movq 32(%%rax), %%rcx\n\t"                              \
-         "movq 24(%%rax), %%rdx\n\t"                              \
-         "movq 16(%%rax), %%rsi\n\t"                              \
-         "movq 8(%%rax), %%rdi\n\t"                               \
-         "movq (%%rax), %%rax\n\t"  /* target->%rax */            \
-         VALGRIND_CALL_NOREDIR_RAX                                \
-         "addq $48, %%rsp\n"                                      \
-         "addq $128,%%rsp\n\t"                                    \
-         VALGRIND_CFI_EPILOGUE                                    \
-         : /*out*/   "=a" (_res)                                  \
-         : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS, "r15"   \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */
-
-/* ------------------------ ppc32-linux ------------------------ */
-
-#if defined(PLAT_ppc32_linux)
-
-/* This is useful for finding out about the on-stack stuff:
-
-   extern int f9  ( int,int,int,int,int,int,int,int,int );
-   extern int f10 ( int,int,int,int,int,int,int,int,int,int );
-   extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );
-   extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );
-
-   int g9 ( void ) {
-      return f9(11,22,33,44,55,66,77,88,99);
-   }
-   int g10 ( void ) {
-      return f10(11,22,33,44,55,66,77,88,99,110);
-   }
-   int g11 ( void ) {
-      return f11(11,22,33,44,55,66,77,88,99,110,121);
-   }
-   int g12 ( void ) {
-      return f12(11,22,33,44,55,66,77,88,99,110,121,132);
-   }
-*/
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* These CALL_FN_ macros assume that on ppc32-linux, 
-   sizeof(unsigned long) == 4. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[1];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[2];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[4];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[5];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[6];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[7];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[8];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[9];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[10];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "addi 1,1,-16\n\t"                                       \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
-         /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,16\n\t"                                        \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[11];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      _argvec[10] = (unsigned long)arg10;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "addi 1,1,-16\n\t"                                       \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,12(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
-         /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,16\n\t"                                        \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[12];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      _argvec[10] = (unsigned long)arg10;                         \
-      _argvec[11] = (unsigned long)arg11;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "addi 1,1,-32\n\t"                                       \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,16(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,12(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
-         /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,32\n\t"                                        \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[13];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)arg1;                           \
-      _argvec[2] = (unsigned long)arg2;                           \
-      _argvec[3] = (unsigned long)arg3;                           \
-      _argvec[4] = (unsigned long)arg4;                           \
-      _argvec[5] = (unsigned long)arg5;                           \
-      _argvec[6] = (unsigned long)arg6;                           \
-      _argvec[7] = (unsigned long)arg7;                           \
-      _argvec[8] = (unsigned long)arg8;                           \
-      _argvec[9] = (unsigned long)arg9;                           \
-      _argvec[10] = (unsigned long)arg10;                         \
-      _argvec[11] = (unsigned long)arg11;                         \
-      _argvec[12] = (unsigned long)arg12;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "addi 1,1,-32\n\t"                                       \
-         /* arg12 */                                              \
-         "lwz 3,48(11)\n\t"                                       \
-         "stw 3,20(1)\n\t"                                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,16(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,12(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,8(1)\n\t"                                         \
-         /* args1-8 */                                            \
-         "lwz 3,4(11)\n\t"   /* arg1->r3 */                       \
-         "lwz 4,8(11)\n\t"                                        \
-         "lwz 5,12(11)\n\t"                                       \
-         "lwz 6,16(11)\n\t"  /* arg4->r6 */                       \
-         "lwz 7,20(11)\n\t"                                       \
-         "lwz 8,24(11)\n\t"                                       \
-         "lwz 9,28(11)\n\t"                                       \
-         "lwz 10,32(11)\n\t" /* arg8->r10 */                      \
-         "lwz 11,0(11)\n\t"  /* target->r11 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "addi 1,1,32\n\t"                                        \
-         "mr %0,3"                                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc32_linux */
-
-/* ------------------------ ppc64-linux ------------------------ */
-
-#if defined(PLAT_ppc64_linux)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned
-   long) == 8. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)" /* restore tocptr */                      \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-128\n\t"  /* expand stack frame */            \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,128"     /* restore frame */                   \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-128\n\t"  /* expand stack frame */            \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,128"     /* restore frame */                   \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-144\n\t"  /* expand stack frame */            \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,144"     /* restore frame */                   \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         "std 2,-16(11)\n\t"  /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "addi 1,1,-144\n\t"  /* expand stack frame */            \
-         /* arg12 */                                              \
-         "ld  3,96(11)\n\t"                                       \
-         "std 3,136(1)\n\t"                                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         "addi 1,1,144"     /* restore frame */                   \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc64_linux */
-
-/* ------------------------- arm-linux ------------------------- */
-
-#if defined(PLAT_arm_linux)
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS "r0", "r1", "r2", "r3","r4","r14"
-
-/* These CALL_FN_ macros assume that on arm-linux, sizeof(unsigned
-   long) == 4. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[1];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "mov %0, r0\n"                                           \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[2];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "mov %0, r0\n"                                           \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory",  __CALLER_SAVED_REGS         \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "mov %0, r0\n"                                           \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[4];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "mov %0, r0\n"                                           \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[5];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[6];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "push {r0} \n\t"                                         \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #4 \n\t"                                    \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[7];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "push {r0, r1} \n\t"                                     \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #8 \n\t"                                    \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[8];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "ldr r2, [%1, #28] \n\t"                                 \
-         "push {r0, r1, r2} \n\t"                                 \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #12 \n\t"                                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[9];                          \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "ldr r2, [%1, #28] \n\t"                                 \
-         "ldr r3, [%1, #32] \n\t"                                 \
-         "push {r0, r1, r2, r3} \n\t"                             \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #16 \n\t"                                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[10];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "ldr r2, [%1, #28] \n\t"                                 \
-         "ldr r3, [%1, #32] \n\t"                                 \
-         "ldr r4, [%1, #36] \n\t"                                 \
-         "push {r0, r1, r2, r3, r4} \n\t"                         \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #20 \n\t"                                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[11];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #40] \n\t"                                 \
-         "push {r0} \n\t"                                         \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "ldr r2, [%1, #28] \n\t"                                 \
-         "ldr r3, [%1, #32] \n\t"                                 \
-         "ldr r4, [%1, #36] \n\t"                                 \
-         "push {r0, r1, r2, r3, r4} \n\t"                         \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #24 \n\t"                                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
-                                  arg6,arg7,arg8,arg9,arg10,      \
-                                  arg11)                          \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[12];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #40] \n\t"                                 \
-         "ldr r1, [%1, #44] \n\t"                                 \
-         "push {r0, r1} \n\t"                                     \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "ldr r2, [%1, #28] \n\t"                                 \
-         "ldr r3, [%1, #32] \n\t"                                 \
-         "ldr r4, [%1, #36] \n\t"                                 \
-         "push {r0, r1, r2, r3, r4} \n\t"                         \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #28 \n\t"                                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory",__CALLER_SAVED_REGS           \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \
-                                  arg6,arg7,arg8,arg9,arg10,      \
-                                  arg11,arg12)                    \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[13];                         \
-      volatile unsigned long _res;                                \
-      _argvec[0] = (unsigned long)_orig.nraddr;                   \
-      _argvec[1] = (unsigned long)(arg1);                         \
-      _argvec[2] = (unsigned long)(arg2);                         \
-      _argvec[3] = (unsigned long)(arg3);                         \
-      _argvec[4] = (unsigned long)(arg4);                         \
-      _argvec[5] = (unsigned long)(arg5);                         \
-      _argvec[6] = (unsigned long)(arg6);                         \
-      _argvec[7] = (unsigned long)(arg7);                         \
-      _argvec[8] = (unsigned long)(arg8);                         \
-      _argvec[9] = (unsigned long)(arg9);                         \
-      _argvec[10] = (unsigned long)(arg10);                       \
-      _argvec[11] = (unsigned long)(arg11);                       \
-      _argvec[12] = (unsigned long)(arg12);                       \
-      __asm__ volatile(                                           \
-         "ldr r0, [%1, #40] \n\t"                                 \
-         "ldr r1, [%1, #44] \n\t"                                 \
-         "ldr r2, [%1, #48] \n\t"                                 \
-         "push {r0, r1, r2} \n\t"                                 \
-         "ldr r0, [%1, #20] \n\t"                                 \
-         "ldr r1, [%1, #24] \n\t"                                 \
-         "ldr r2, [%1, #28] \n\t"                                 \
-         "ldr r3, [%1, #32] \n\t"                                 \
-         "ldr r4, [%1, #36] \n\t"                                 \
-         "push {r0, r1, r2, r3, r4} \n\t"                         \
-         "ldr r0, [%1, #4] \n\t"                                  \
-         "ldr r1, [%1, #8] \n\t"                                  \
-         "ldr r2, [%1, #12] \n\t"                                 \
-         "ldr r3, [%1, #16] \n\t"                                 \
-         "ldr r4, [%1] \n\t"  /* target->r4 */                    \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \
-         "add sp, sp, #32 \n\t"                                   \
-         "mov %0, r0"                                             \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "0" (&_argvec[0])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_arm_linux */
-
-/* ------------------------ ppc32-aix5 ------------------------- */
-
-#if defined(PLAT_ppc32_aix5)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* Expand the stack frame, copying enough info that unwinding
-   still works.  Trashes r3. */
-
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr)                      \
-         "addi 1,1,-" #_n_fr "\n\t"                               \
-         "lwz  3," #_n_fr "(1)\n\t"                               \
-         "stw  3,0(1)\n\t"
-
-#define VG_CONTRACT_FRAME_BY(_n_fr)                               \
-         "addi 1,1," #_n_fr "\n\t"
-
-/* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned
-   long) == 4. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t" /* arg2->r4 */                       \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(64)                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(64)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(64)                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(64)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(72)                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,64(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(72)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(72)                        \
-         /* arg12 */                                              \
-         "lwz 3,48(11)\n\t"                                       \
-         "stw 3,68(1)\n\t"                                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,64(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(72)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc32_aix5 */
-
-/* ------------------------ ppc64-aix5 ------------------------- */
-
-#if defined(PLAT_ppc64_aix5)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* Expand the stack frame, copying enough info that unwinding
-   still works.  Trashes r3. */
-
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr)                      \
-         "addi 1,1,-" #_n_fr "\n\t"                               \
-         "ld   3," #_n_fr "(1)\n\t"                               \
-         "std  3,0(1)\n\t"
-
-#define VG_CONTRACT_FRAME_BY(_n_fr)                               \
-         "addi 1,1," #_n_fr "\n\t"
-
-/* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned
-   long) == 8. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(128)                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(128)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(128)                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(128)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(144)                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(144)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(144)                       \
-         /* arg12 */                                              \
-         "ld  3,96(11)\n\t"                                       \
-         "std 3,136(1)\n\t"                                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(144)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc64_aix5 */
-
-
-/* ------------------------------------------------------------------ */
-/* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS.               */
-/*                                                                    */
-/* ------------------------------------------------------------------ */
-
-/* Some request codes.  There are many more of these, but most are not
-   exposed to end-user view.  These are the public ones, all of the
-   form 0x1000 + small_number.
-
-   Core ones are in the range 0x00000000--0x0000ffff.  The non-public
-   ones start at 0x2000.
-*/
-
-/* These macros are used by tools -- they must be public, but don't
-   embed them into other programs. */
-#define VG_USERREQ_TOOL_BASE(a,b) \
-   ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))
-#define VG_IS_TOOL_USERREQ(a, b, v) \
-   (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
-
-/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! 
-   This enum comprises an ABI exported by Valgrind to programs
-   which use client requests.  DO NOT CHANGE THE ORDER OF THESE
-   ENTRIES, NOR DELETE ANY -- add new ones at the end. */
-typedef
-   enum { VG_USERREQ__RUNNING_ON_VALGRIND  = 0x1001,
-          VG_USERREQ__DISCARD_TRANSLATIONS = 0x1002,
-
-          /* These allow any function to be called from the simulated
-             CPU but run on the real CPU.  Nb: the first arg passed to
-             the function is always the ThreadId of the running
-             thread!  So CLIENT_CALL0 actually requires a 1 arg
-             function, etc. */
-          VG_USERREQ__CLIENT_CALL0 = 0x1101,
-          VG_USERREQ__CLIENT_CALL1 = 0x1102,
-          VG_USERREQ__CLIENT_CALL2 = 0x1103,
-          VG_USERREQ__CLIENT_CALL3 = 0x1104,
-
-          /* Can be useful in regression testing suites -- eg. can
-             send Valgrind's output to /dev/null and still count
-             errors. */
-          VG_USERREQ__COUNT_ERRORS = 0x1201,
-
-          /* These are useful and can be interpreted by any tool that
-             tracks malloc() et al, by using vg_replace_malloc.c. */
-          VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
-          VG_USERREQ__FREELIKE_BLOCK   = 0x1302,
-          /* Memory pool support. */
-          VG_USERREQ__CREATE_MEMPOOL   = 0x1303,
-          VG_USERREQ__DESTROY_MEMPOOL  = 0x1304,
-          VG_USERREQ__MEMPOOL_ALLOC    = 0x1305,
-          VG_USERREQ__MEMPOOL_FREE     = 0x1306,
-          VG_USERREQ__MEMPOOL_TRIM     = 0x1307,
-          VG_USERREQ__MOVE_MEMPOOL     = 0x1308,
-          VG_USERREQ__MEMPOOL_CHANGE   = 0x1309,
-          VG_USERREQ__MEMPOOL_EXISTS   = 0x130a,
-
-          /* Allow printfs to valgrind log. */
-          /* The first two pass the va_list argument by value, which
-             assumes it is the same size as or smaller than a UWord,
-             which generally isn't the case.  Hence are deprecated.
-             The second two pass the vargs by reference and so are
-             immune to this problem. */
-          /* both :: char* fmt, va_list vargs (DEPRECATED) */
-          VG_USERREQ__PRINTF           = 0x1401,
-          VG_USERREQ__PRINTF_BACKTRACE = 0x1402,
-          /* both :: char* fmt, va_list* vargs */
-          VG_USERREQ__PRINTF_VALIST_BY_REF = 0x1403,
-          VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 0x1404,
-
-          /* Stack support. */
-          VG_USERREQ__STACK_REGISTER   = 0x1501,
-          VG_USERREQ__STACK_DEREGISTER = 0x1502,
-          VG_USERREQ__STACK_CHANGE     = 0x1503,
-
-          /* Wine support */
-          VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601,
-
-          /* Querying of debug info. */
-          VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701
-   } Vg_ClientRequest;
-
-#if !defined(__GNUC__)
-#  define __extension__ /* */
-#endif
-
-
-/*
- * VALGRIND_DO_CLIENT_REQUEST_EXPR(): a C expression that invokes a Valgrind
- * client request and whose value equals the client request result.
- */
-
-#if defined(NVALGRIND)
-
-#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                               \
-        _zzq_default, _zzq_request,                                    \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)         \
-   (_zzq_default)
-
-#else /*defined(NVALGRIND)*/
-
-#if defined(_MSC_VER)
-
-#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                                \
-        _zzq_default, _zzq_request,                                     \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)          \
-   (vg_VALGRIND_DO_CLIENT_REQUEST_EXPR((uintptr_t)(_zzq_default),       \
-        (_zzq_request), (uintptr_t)(_zzq_arg1), (uintptr_t)(_zzq_arg2), \
-        (uintptr_t)(_zzq_arg3), (uintptr_t)(_zzq_arg4),                 \
-        (uintptr_t)(_zzq_arg5)))
-
-static __inline unsigned
-vg_VALGRIND_DO_CLIENT_REQUEST_EXPR(uintptr_t _zzq_default,
-                                   unsigned _zzq_request, uintptr_t _zzq_arg1,
-                                   uintptr_t _zzq_arg2, uintptr_t _zzq_arg3,
-                                   uintptr_t _zzq_arg4, uintptr_t _zzq_arg5)
-{
-    unsigned _zzq_rlval;
-    VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default, _zzq_request,
-                      _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5);
-    return _zzq_rlval;
-}
-
-#else /*defined(_MSC_VER)*/
-
-#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                               \
-        _zzq_default, _zzq_request,                                    \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)         \
-   (__extension__({unsigned int _zzq_rlval;                            \
-    VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default, _zzq_request, \
-                _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
-    _zzq_rlval;                                                        \
-   }))
-
-#endif /*defined(_MSC_VER)*/
-
-#endif /*defined(NVALGRIND)*/
-
-
-/* Returns the number of Valgrinds this code is running under.  That
-   is, 0 if running natively, 1 if running under Valgrind, 2 if
-   running under Valgrind which is running under another Valgrind,
-   etc. */
-#define RUNNING_ON_VALGRIND                                           \
-    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* if not */,                   \
-                                    VG_USERREQ__RUNNING_ON_VALGRIND,  \
-                                    0, 0, 0, 0, 0)                    \
-
-
-/* Discard translation of code in the range [_qzz_addr .. _qzz_addr +
-   _qzz_len - 1].  Useful if you are debugging a JITter or some such,
-   since it provides a way to make sure valgrind will retranslate the
-   invalidated area.  Returns no value. */
-#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len)         \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__DISCARD_TRANSLATIONS,  \
-                               _qzz_addr, _qzz_len, 0, 0, 0);     \
-   }
-
-
-/* These requests are for getting Valgrind itself to print something.
-   Possibly with a backtrace.  This is a really ugly hack.  The return value
-   is the number of characters printed, excluding the "**<pid>** " part at the
-   start and the backtrace (if present). */
-
-#if defined(NVALGRIND)
-
-#  define VALGRIND_PRINTF(...)
-#  define VALGRIND_PRINTF_BACKTRACE(...)
-
-#else /* NVALGRIND */
-
-#if !defined(_MSC_VER)
-/* Modern GCC will optimize the static routine out if unused,
-   and unused attribute will shut down warnings about it.  */
-static int VALGRIND_PRINTF(const char *format, ...)
-   __attribute__((format(__printf__, 1, 2), __unused__));
-#endif
-static int
-#if defined(_MSC_VER)
-__inline
-#endif
-VALGRIND_PRINTF(const char *format, ...)
-{
-   unsigned long _qzz_res;
-   va_list vargs;
-   va_start(vargs, format);
-#if defined(_MSC_VER)
-   VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,
-                              VG_USERREQ__PRINTF_VALIST_BY_REF,
-                              (uintptr_t)format,
-                              (uintptr_t)&vargs,
-                              0, 0, 0);
-#else
-   VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,
-                              VG_USERREQ__PRINTF_VALIST_BY_REF,
-                              (unsigned long)format,
-                              (unsigned long)&vargs, 
-                              0, 0, 0);
-#endif
-   va_end(vargs);
-   return (int)_qzz_res;
-}
-
-#if !defined(_MSC_VER)
-static int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
-   __attribute__((format(__printf__, 1, 2), __unused__));
-#endif
-static int
-#if defined(_MSC_VER)
-__inline
-#endif
-VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
-{
-   unsigned long _qzz_res;
-   va_list vargs;
-   va_start(vargs, format);
-#if defined(_MSC_VER)
-   VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,
-                              VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
-                              (uintptr_t)format,
-                              (uintptr_t)&vargs,
-                              0, 0, 0);
-#else
-   VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,
-                              VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
-                              (unsigned long)format,
-                              (unsigned long)&vargs, 
-                              0, 0, 0);
-#endif
-   va_end(vargs);
-   return (int)_qzz_res;
-}
-
-#endif /* NVALGRIND */
-
-
-/* These requests allow control to move from the simulated CPU to the
-   real CPU, calling an arbitary function.
-   
-   Note that the current ThreadId is inserted as the first argument.
-   So this call:
-
-     VALGRIND_NON_SIMD_CALL2(f, arg1, arg2)
-
-   requires f to have this signature:
-
-     Word f(Word tid, Word arg1, Word arg2)
-
-   where "Word" is a word-sized type.
-
-   Note that these client requests are not entirely reliable.  For example,
-   if you call a function with them that subsequently calls printf(),
-   there's a high chance Valgrind will crash.  Generally, your prospects of
-   these working are made higher if the called function does not refer to
-   any global variables, and does not refer to any libc or other functions
-   (printf et al).  Any kind of entanglement with libc or dynamic linking is
-   likely to have a bad outcome, for tricky reasons which we've grappled
-   with a lot in the past.
-*/
-#define VALGRIND_NON_SIMD_CALL0(_qyy_fn)                          \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL0,          \
-                               _qyy_fn,                           \
-                               0, 0, 0, 0);                       \
-    _qyy_res;                                                     \
-   })
-
-#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1)               \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL1,          \
-                               _qyy_fn,                           \
-                               _qyy_arg1, 0, 0, 0);               \
-    _qyy_res;                                                     \
-   })
-
-#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2)    \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL2,          \
-                               _qyy_fn,                           \
-                               _qyy_arg1, _qyy_arg2, 0, 0);       \
-    _qyy_res;                                                     \
-   })
-
-#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
-   __extension__                                                  \
-   ({unsigned long _qyy_res;                                      \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__CLIENT_CALL3,          \
-                               _qyy_fn,                           \
-                               _qyy_arg1, _qyy_arg2,              \
-                               _qyy_arg3, 0);                     \
-    _qyy_res;                                                     \
-   })
-
-
-/* Counts the number of errors that have been recorded by a tool.  Nb:
-   the tool must record the errors with VG_(maybe_record_error)() or
-   VG_(unique_error)() for them to be counted. */
-#define VALGRIND_COUNT_ERRORS                                     \
-   __extension__                                                  \
-   ({unsigned int _qyy_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */,  \
-                               VG_USERREQ__COUNT_ERRORS,          \
-                               0, 0, 0, 0, 0);                    \
-    _qyy_res;                                                     \
-   })
-
-/* Several Valgrind tools (Memcheck, Massif, Helgrind, DRD) rely on knowing
-   when heap blocks are allocated in order to give accurate results.  This
-   happens automatically for the standard allocator functions such as
-   malloc(), calloc(), realloc(), memalign(), new, new[], free(), delete,
-   delete[], etc.
-
-   But if your program uses a custom allocator, this doesn't automatically
-   happen, and Valgrind will not do as well.  For example, if you allocate
-   superblocks with mmap() and then allocates chunks of the superblocks, all
-   Valgrind's observations will be at the mmap() level and it won't know that
-   the chunks should be considered separate entities.  In Memcheck's case,
-   that means you probably won't get heap block overrun detection (because
-   there won't be redzones marked as unaddressable) and you definitely won't
-   get any leak detection.
-
-   The following client requests allow a custom allocator to be annotated so
-   that it can be handled accurately by Valgrind.
-
-   VALGRIND_MALLOCLIKE_BLOCK marks a region of memory as having been allocated
-   by a malloc()-like function.  For Memcheck (an illustrative case), this
-   does two things:
-
-   - It records that the block has been allocated.  This means any addresses
-     within the block mentioned in error messages will be
-     identified as belonging to the block.  It also means that if the block
-     isn't freed it will be detected by the leak checker.
-
-   - It marks the block as being addressable and undefined (if 'is_zeroed' is
-     not set), or addressable and defined (if 'is_zeroed' is set).  This
-     controls how accesses to the block by the program are handled.
-   
-   'addr' is the start of the usable block (ie. after any
-   redzone), 'sizeB' is its size.  'rzB' is the redzone size if the allocator
-   can apply redzones -- these are blocks of padding at the start and end of
-   each block.  Adding redzones is recommended as it makes it much more likely
-   Valgrind will spot block overruns.  `is_zeroed' indicates if the memory is
-   zeroed (or filled with another predictable value), as is the case for
-   calloc().
-   
-   VALGRIND_MALLOCLIKE_BLOCK should be put immediately after the point where a
-   heap block -- that will be used by the client program -- is allocated.
-   It's best to put it at the outermost level of the allocator if possible;
-   for example, if you have a function my_alloc() which calls
-   internal_alloc(), and the client request is put inside internal_alloc(),
-   stack traces relating to the heap block will contain entries for both
-   my_alloc() and internal_alloc(), which is probably not what you want.
-
-   For Memcheck users: if you use VALGRIND_MALLOCLIKE_BLOCK to carve out
-   custom blocks from within a heap block, B, that has been allocated with
-   malloc/calloc/new/etc, then block B will be *ignored* during leak-checking
-   -- the custom blocks will take precedence.
-
-   VALGRIND_FREELIKE_BLOCK is the partner to VALGRIND_MALLOCLIKE_BLOCK.  For
-   Memcheck, it does two things:
-
-   - It records that the block has been deallocated.  This assumes that the
-     block was annotated as having been allocated via
-     VALGRIND_MALLOCLIKE_BLOCK.  Otherwise, an error will be issued.
-
-   - It marks the block as being unaddressable.
-
-   VALGRIND_FREELIKE_BLOCK should be put immediately after the point where a
-   heap block is deallocated.
-
-   In many cases, these two client requests will not be enough to get your
-   allocator working well with Memcheck.  More specifically, if your allocator
-   writes to freed blocks in any way then a VALGRIND_MAKE_MEM_UNDEFINED call
-   will be necessary to mark the memory as addressable just before the zeroing
-   occurs, otherwise you'll get a lot of invalid write errors.  For example,
-   you'll need to do this if your allocator recycles freed blocks, but it
-   zeroes them before handing them back out (via VALGRIND_MALLOCLIKE_BLOCK).
-   Alternatively, if your allocator reuses freed blocks for allocator-internal
-   data structures, VALGRIND_MAKE_MEM_UNDEFINED calls will also be necessary.
-
-   Really, what's happening is a blurring of the lines between the client
-   program and the allocator... after VALGRIND_FREELIKE_BLOCK is called, the
-   memory should be considered unaddressable to the client program, but the
-   allocator knows more than the rest of the client program and so may be able
-   to safely access it.  Extra client requests are necessary for Valgrind to
-   understand the distinction between the allocator and the rest of the
-   program.
-
-   Note: there is currently no VALGRIND_REALLOCLIKE_BLOCK client request;  it
-   has to be emulated with MALLOCLIKE/FREELIKE and memory copying.
-   
-   Ignored if addr == 0.
-*/
-#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)    \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MALLOCLIKE_BLOCK,      \
-                               addr, sizeB, rzB, is_zeroed, 0);   \
-   }
-
-/* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.
-   Ignored if addr == 0.
-*/
-#define VALGRIND_FREELIKE_BLOCK(addr, rzB)                        \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__FREELIKE_BLOCK,        \
-                               addr, rzB, 0, 0, 0);               \
-   }
-
-/* Create a memory pool. */
-#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed)             \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__CREATE_MEMPOOL,        \
-                               pool, rzB, is_zeroed, 0, 0);       \
-   }
-
-/* Destroy a memory pool. */
-#define VALGRIND_DESTROY_MEMPOOL(pool)                            \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__DESTROY_MEMPOOL,       \
-                               pool, 0, 0, 0, 0);                 \
-   }
-
-/* Associate a piece of memory with a memory pool. */
-#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size)                  \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_ALLOC,         \
-                               pool, addr, size, 0, 0);           \
-   }
-
-/* Disassociate a piece of memory from a memory pool. */
-#define VALGRIND_MEMPOOL_FREE(pool, addr)                         \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_FREE,          \
-                               pool, addr, 0, 0, 0);              \
-   }
-
-/* Disassociate any pieces outside a particular range. */
-#define VALGRIND_MEMPOOL_TRIM(pool, addr, size)                   \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_TRIM,          \
-                               pool, addr, size, 0, 0);           \
-   }
-
-/* Resize and/or move a piece associated with a memory pool. */
-#define VALGRIND_MOVE_MEMPOOL(poolA, poolB)                       \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MOVE_MEMPOOL,          \
-                               poolA, poolB, 0, 0, 0);            \
-   }
-
-/* Resize and/or move a piece associated with a memory pool. */
-#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size)         \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_CHANGE,        \
-                               pool, addrA, addrB, size, 0);      \
-   }
-
-/* Return 1 if a mempool exists, else 0. */
-#define VALGRIND_MEMPOOL_EXISTS(pool)                             \
-   __extension__                                                  \
-   ({unsigned int _qzz_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MEMPOOL_EXISTS,        \
-                               pool, 0, 0, 0, 0);                 \
-    _qzz_res;                                                     \
-   })
-
-/* Mark a piece of memory as being a stack. Returns a stack id. */
-#define VALGRIND_STACK_REGISTER(start, end)                       \
-   __extension__                                                  \
-   ({unsigned int _qzz_res;                                       \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__STACK_REGISTER,        \
-                               start, end, 0, 0, 0);              \
-    _qzz_res;                                                     \
-   })
-
-/* Unmark the piece of memory associated with a stack id as being a
-   stack. */
-#define VALGRIND_STACK_DEREGISTER(id)                             \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__STACK_DEREGISTER,      \
-                               id, 0, 0, 0, 0);                   \
-   }
-
-/* Change the start and end address of the stack id. */
-#define VALGRIND_STACK_CHANGE(id, start, end)                     \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__STACK_CHANGE,          \
-                               id, start, end, 0, 0);             \
-   }
-
-/* Load PDB debug info for Wine PE image_map. */
-#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta)   \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__LOAD_PDB_DEBUGINFO,    \
-                               fd, ptr, total_size, delta, 0);    \
-   }
-
-/* Map a code address to a source file name and line number.  buf64
-   must point to a 64-byte buffer in the caller's address space.  The
-   result will be dumped in there and is guaranteed to be zero
-   terminated.  If no info is found, the first byte is set to zero. */
-#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64)                    \
-   {unsigned int _qzz_res;                                        \
-    VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                       \
-                               VG_USERREQ__MAP_IP_TO_SRCLOC,      \
-                               addr, buf64, 0, 0, 0);             \
-   }
-
-
-#undef PLAT_x86_linux
-#undef PLAT_amd64_linux
-#undef PLAT_ppc32_linux
-#undef PLAT_ppc64_linux
-#undef PLAT_arm_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
-
-#endif   /* __VALGRIND_H */