Index: Makefile.in
===================================================================
--- Makefile.in	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ Makefile.in	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -124,4 +124,7 @@
 BACKEND_CC = @BACKEND_CC@		# C compiler used to compile Cforall programs, versus C++ compiler used to build cfa command
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
Index: aclocal.m4
===================================================================
--- aclocal.m4	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ aclocal.m4	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -59,4 +59,26 @@
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# Figure out how to run the assembler.                      -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_PROG_AS
+# ----------
+AC_DEFUN([AM_PROG_AS],
+[# By default we simply use the C compiler to build assembly code.
+AC_REQUIRE([AC_PROG_CC])
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
+AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
+])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
Index: configure
===================================================================
--- configure	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ configure	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -616,4 +616,9 @@
 YFLAGS
 YACC
+am__fastdepCCAS_FALSE
+am__fastdepCCAS_TRUE
+CCASDEPMODE
+CCASFLAGS
+CCAS
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
@@ -733,4 +738,6 @@
 CC
 CFLAGS
+CCAS
+CCASFLAGS
 YACC
 YFLAGS
@@ -1374,4 +1381,6 @@
   CC          C compiler command
   CFLAGS      C compiler flags
+  CCAS        assembler compiler command (defaults to CC)
+  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
   YACC        The `Yet Another Compiler Compiler' implementation to use.
               Defaults to the first program found out of: `bison -y', `byacc',
@@ -4503,4 +4512,137 @@
   am__fastdepCC_TRUE='#'
   am__fastdepCC_FALSE=
+fi
+
+
+# By default we simply use the C compiler to build assembly code.
+
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+
+
+
+depcc="$CCAS"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CCAS_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CCAS_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CCAS_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CCAS_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; }
+CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then
+  am__fastdepCCAS_TRUE=
+  am__fastdepCCAS_FALSE='#'
+else
+  am__fastdepCCAS_TRUE='#'
+  am__fastdepCCAS_FALSE=
 fi
 
@@ -5990,4 +6132,8 @@
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
Index: configure.ac
===================================================================
--- configure.ac	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ configure.ac	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -91,4 +91,5 @@
 AC_PROG_CXX
 AC_PROG_CC
+AM_PROG_AS
 AM_PROG_CC_C_O	# deprecated
 # These are often not installed and people miss seeing the "no", so stop the configure.
Index: src/Makefile.in
===================================================================
--- src/Makefile.in	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ src/Makefile.in	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -259,4 +259,7 @@
 BACKEND_CC = @BACKEND_CC@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
Index: src/driver/Makefile.in
===================================================================
--- src/driver/Makefile.in	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ src/driver/Makefile.in	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -92,4 +92,7 @@
 BACKEND_CC = @BACKEND_CC@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
Index: src/examples/Makefile.in
===================================================================
--- src/examples/Makefile.in	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ src/examples/Makefile.in	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -101,4 +101,7 @@
 BACKEND_CC = @BACKEND_CC@
 CC = @CFA_BINDIR@/cfa
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ src/libcfa/Makefile.am	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -53,5 +53,17 @@
 	 ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -c -o $@ $<
 
-CFLAGS = -quiet -no-include-stdhdr -g -Wall -Wno-unused-function @CFA_FLAGS@ -B${abs_top_srcdir}/src/driver -XCFA -t # TEMPORARY: does not build with -O2
+CFLAGS = \
+	-quiet \
+	-no-include-stdhdr \
+	-g \
+	-Wall \
+	-Wno-unused-function \
+	@CFA_FLAGS@ \
+	-B${abs_top_srcdir}/src/driver \
+	-XCFA \
+	-t \
+	-D__CFA_DEBUG__ \
+	-I${abs_top_srcdir}/src/libcfa/libhdr \
+	# TEMPORARY: does not build with -O2
 CC = ${abs_top_srcdir}/src/driver/cfa
 
@@ -66,5 +78,5 @@
 ${libobjs} : ${abs_top_srcdir}/src/driver/cfa-cpp ${cfalib_DATA} # add dependency to cfa-cpp so all libraries are rebuilt with new translator
 
-libcfa_a_SOURCES = libcfa-prelude.c ${headers:=.c}
+libcfa_a_SOURCES = libcfa-prelude.c ${headers:=.c} concurrency/CtxSwitch-x86_64.S
 
 stdhdr = ${shell echo stdhdr/*}
Index: src/libcfa/Makefile.in
===================================================================
--- src/libcfa/Makefile.in	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ src/libcfa/Makefile.in	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -94,5 +94,6 @@
 	rational.$(OBJEXT) assert.$(OBJEXT) \
 	containers/vector.$(OBJEXT) concurrency/threads.$(OBJEXT)
-am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1)
+am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1) \
+	concurrency/CtxSwitch-x86_64.$(OBJEXT)
 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
@@ -100,4 +101,9 @@
 am__depfiles_maybe = depfiles
 am__mv = mv -f
+CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
+am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
+am__v_CPPAS_0 = @echo "  CPPAS " $@;
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -130,4 +136,7 @@
 BACKEND_CC = @BACKEND_CC@
 CC = ${abs_top_srcdir}/src/driver/cfa
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
@@ -137,5 +146,18 @@
 CFA_LIBDIR = @CFA_LIBDIR@
 CFA_PREFIX = @CFA_PREFIX@
-CFLAGS = -quiet -no-include-stdhdr -g -Wall -Wno-unused-function @CFA_FLAGS@ -B${abs_top_srcdir}/src/driver -XCFA -t # TEMPORARY: does not build with -O2
+CFLAGS = \
+	-quiet \
+	-no-include-stdhdr \
+	-g \
+	-Wall \
+	-Wno-unused-function \
+	@CFA_FLAGS@ \
+	-B${abs_top_srcdir}/src/driver \
+	-XCFA \
+	-t \
+	-D__CFA_DEBUG__ \
+	-I${abs_top_srcdir}/src/libcfa/libhdr \
+	# TEMPORARY: does not build with -O2
+
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -238,5 +260,5 @@
 runtimehdrs = concurrency
 libobjs = ${headers:=.o}
-libcfa_a_SOURCES = libcfa-prelude.c ${headers:=.c}
+libcfa_a_SOURCES = libcfa-prelude.c ${headers:=.c} concurrency/CtxSwitch-x86_64.S
 stdhdr = ${shell echo stdhdr/*}
 nobase_include_HEADERS = ${headers} ${stdhdr}
@@ -245,5 +267,5 @@
 
 .SUFFIXES:
-.SUFFIXES: .c .o .obj
+.SUFFIXES: .S .c .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
@@ -322,4 +344,6 @@
 concurrency/threads.$(OBJEXT): concurrency/$(am__dirstamp) \
 	concurrency/$(DEPDIR)/$(am__dirstamp)
+concurrency/CtxSwitch-x86_64.$(OBJEXT): concurrency/$(am__dirstamp) \
+	concurrency/$(DEPDIR)/$(am__dirstamp)
 libcfa.a: $(libcfa_a_OBJECTS) $(libcfa_a_DEPENDENCIES) $(EXTRA_libcfa_a_DEPENDENCIES) 
 	$(AM_V_at)-rm -f libcfa.a
@@ -329,4 +353,5 @@
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
+	-rm -f concurrency/CtxSwitch-x86_64.$(OBJEXT)
 	-rm -f concurrency/threads.$(OBJEXT)
 	-rm -f containers/vector.$(OBJEXT)
@@ -344,6 +369,23 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rational.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-x86_64.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/threads.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/vector.Po@am__quote@
+
+.S.o:
+@am__fastdepCCAS_TRUE@	$(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCCAS_TRUE@	$(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCCAS_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	$(AM_V_CPPAS)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@	$(AM_V_CPPAS@am__nodep@)$(CPPASCOMPILE) -c -o $@ $<
+
+.S.obj:
+@am__fastdepCCAS_TRUE@	$(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCCAS_TRUE@	$(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCCAS_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	$(AM_V_CPPAS)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@	DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@	$(AM_V_CPPAS@am__nodep@)$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .c.o:
Index: src/tests/Makefile.in
===================================================================
--- src/tests/Makefile.in	(revision 1f44196dc72fd060b6183fe2bdc10f7b30f955d6)
+++ src/tests/Makefile.in	(revision 8e5724eb6690c6626d637781fe0055e8dde51853)
@@ -111,4 +111,7 @@
 BACKEND_CC = @BACKEND_CC@
 CC = @CFA_BINDIR@/cfa
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFA_BACKEND_CC = @CFA_BACKEND_CC@
