fixup commit for branch 'Accessible_042401_Branch2' Accessible_042401_Branch2 Accessible_042401_Base2 Accessible_042501_Base3 MOZILLA_0_9_2001042510_BASE MOZILLA_0_9_RELEASE Style_20010509_Base XPCDOM_20010329_BASE XPCDOM_20010420_BASE
authorcvs2hg
Thu, 12 Apr 2001 20:23:45 +0000
branchAccessible_042401_Branch2
changeset 1396 4d75747933494fffead0b07e5c7f1a3d7718fec8
parent 1297 0436c1469ca03f2445d4957df6fcd1bcdb4569a9
child 1397 854c64b88c97f3c2bd96fa3c3a299fe9d3f87353
child 1398 cfe66b47a9f128234bc0a89239b09b5f86dd5e5c
child 1399 cc75e0985d38d5e03d75b15c3b3b76e8273bd078
child 1400 dc351bf9aab79a4788bc65beb1e197ab850657a8
child 1452 f13e9ad91272b5a0c29bfb3705064b417dc1ed87
child 10675 6744f2d40b64eb7f3040b62379fca56865a76786
push idunknown
push userunknown
push dateunknown
fixup commit for branch 'Accessible_042401_Branch2'
security/coreconf/SunOS5.9.mk
security/coreconf/SunOS5.9_i86pc.mk
security/coreconf/WIN32.mk
security/coreconf/headers.mk
security/coreconf/source.mk
security/dbm/Makefile
security/dbm/include/Makefile
security/dbm/include/manifest.mn
security/dbm/manifest.mn
security/dbm/src/Makefile
security/dbm/src/config.mk
security/dbm/src/manifest.mn
security/dbm/tests/Makefile
security/nss/cmd/pk12util/pk12util.c
security/nss/lib/certdb/cert.h
security/nss/lib/certdb/certdb.c
security/nss/lib/certdb/pcertdb.c
security/nss/lib/certhigh/certread.c
security/nss/lib/freebl/mpi/mpv_sparc32.S
security/nss/lib/freebl/rsa.c
security/nss/lib/nss/nss.def
security/nss/lib/nss/nss.h
security/nss/lib/pk11wrap/pk11cert.c
security/nss/lib/pk11wrap/pk11slot.c
security/nss/lib/pk11wrap/secmodt.h
security/nss/lib/pkcs12/p12d.c
security/nss/lib/smime/smime.def
security/nss/lib/smime/smimeutil.c
security/nss/lib/ssl/ssl.def
security/nss/lib/ssl/sslcon.c
security/nss/lib/ssl/sslsocks.c
security/nss/lib/util/secport.c
security/nss/macbuild/NSS.mcp
security/nss/makefile.win
security/nss/manifest.mn
security/nss/tests/cert/cert.sh
security/nss/tests/common/init.sh
security/nss/tests/header
security/nss/tests/nssqa
security/nss/tests/qa_stat
security/nss/tests/set_environment
security/nss/tests/ssl/ssl.sh
security/nss/tests/ssl/ssl_dist_stress.sh
security/nss/tests/tools/tools.sh
new file mode 100755
--- /dev/null
+++ b/security/coreconf/SunOS5.9.mk
@@ -0,0 +1,44 @@
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+# 
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+# 
+# The Original Code is the Netscape security libraries.
+# 
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation.  Portions created by Netscape are 
+# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
+# Rights Reserved.
+# 
+# Contributor(s):
+# 
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable 
+# instead of those above.  If you wish to allow use of your 
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL.  If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+# Config stuff for SunOS5.9
+#
+
+SOL_CFLAGS += -D_SVID_GETTOD
+
+include $(CORE_DEPTH)/coreconf/SunOS5.mk
+
+ifeq ($(OS_RELEASE),5.9)
+	OS_DEFINES += -DSOLARIS2_9
+endif
+
+OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc 
new file mode 100755
--- /dev/null
+++ b/security/coreconf/SunOS5.9_i86pc.mk
@@ -0,0 +1,47 @@
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+# 
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+# 
+# The Original Code is the Netscape security libraries.
+# 
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation.  Portions created by Netscape are 
+# Copyright (C) 2000 Netscape Communications Corporation.  All
+# Rights Reserved.
+# 
+# Contributor(s):
+# 
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable 
+# instead of those above.  If you wish to allow use of your 
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL.  If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+# Config stuff for Solaris 9 on x86
+# 
+
+SOL_CFLAGS	= -D_SVID_GETTOD
+
+include $(CORE_DEPTH)/coreconf/SunOS5.mk
+
+CPU_ARCH		= x86
+OS_DEFINES		+= -Di386
+
+ifeq ($(OS_RELEASE),5.9_i86pc)
+	OS_DEFINES += -DSOLARIS2_9
+endif
+
+OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc
--- a/security/coreconf/WIN32.mk
+++ b/security/coreconf/WIN32.mk
@@ -88,16 +88,13 @@ endif
 
 DEFINES += -DWIN32
 
 #
 #  The following is NOT needed for the NSPR 2.0 library.
 #
 
 DEFINES += -D_WINDOWS
-ifdef MOZILLA_CLIENT
-INCLUDES += -I$(SOURCE_XP_DIR)/include
-endif
 
 # override default, which is ASFLAGS = CFLAGS
 AS	= ml.exe
 ASFLAGS = -Cp -Sn -Zi -coff $(INCLUDES)
 
--- a/security/coreconf/headers.mk
+++ b/security/coreconf/headers.mk
@@ -47,8 +47,12 @@ INCLUDES  += -I$(SOURCE_XPHEADERS_DIR)
 endif
 
 #
 #  Only append source-side private cross-platform include paths for
 #  sectools
 #
 
 INCLUDES += -I$(SOURCE_XPPRIVATE_DIR)
+
+ifdef MOZILLA_CLIENT
+INCLUDES += -I$(SOURCE_XP_DIR)/include
+endif
--- a/security/coreconf/source.mk
+++ b/security/coreconf/source.mk
@@ -34,23 +34,27 @@
 #######################################################################
 # Master <component>-specific source import/export directories        #
 #######################################################################
 
 #
 # <user_source_tree> master import/export directory prefix
 #
 
+ifndef SOURCE_PREFIX
 SOURCE_PREFIX = $(CORE_DEPTH)/../dist
+endif
 
 #
 # <user_source_tree> cross-platform (xp) master import/export directory
 #
 
+ifndef SOURCE_XP_DIR
 SOURCE_XP_DIR        = $(SOURCE_PREFIX)
+endif
 
 #
 # <user_source_tree> cross-platform (xp) import/export directories
 #
 
 SOURCE_CLASSES_DIR     = $(SOURCE_XP_DIR)/classes
 SOURCE_CLASSES_DBG_DIR = $(SOURCE_XP_DIR)/classes_DBG
 SOURCE_XPHEADERS_DIR   = $(SOURCE_XP_DIR)/public/$(MODULE)
@@ -61,25 +65,38 @@ ifdef BUILD_OPT
 else
 	IMPORT_XPCLASS_DIR = $(SOURCE_CLASSES_DBG_DIR)
 endif
 
 #
 # <user_source_tree> machine-dependent (md) master import/export directory
 #
 
+ifndef SOURCE_MD_DIR
 SOURCE_MD_DIR        = $(SOURCE_PREFIX)/$(PLATFORM)
+endif
 
 #
 # <user_source_tree> machine-dependent (md) import/export directories
 #
 
+#This is where we install built executables and (for Windows only) DLLs.
+ifndef SOURCE_BIN_DIR
 SOURCE_BIN_DIR       = $(SOURCE_MD_DIR)/bin
+endif
+
+#This is where we install build libraries (.a, .so, .lib).
+ifndef SOURCE_LIB_DIR
 SOURCE_LIB_DIR       = $(SOURCE_MD_DIR)/lib
+endif
+
+# This is where NSPR header files are found.
+ifndef SOURCE_MDHEADERS_DIR
 SOURCE_MDHEADERS_DIR = $(SOURCE_MD_DIR)/include
+endif
 
 #######################################################################
 # Master <component>-specific source release directories and files    #
 #######################################################################
 
 #
 # <user_source_tree> source-side master release directory prefix
 # NOTE:  export control policy enforced for XP and MD files released to
deleted file mode 100644
--- a/security/dbm/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY).   #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL)          #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL)       #
-#######################################################################
-
-
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL).      #
-#######################################################################
-
-
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL)                              #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL)                           #
-#######################################################################
-
-
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL).                              #
-#######################################################################
-
-coreconf_hack:
-	cd ../coreconf; gmake
-	gmake import
-
-RelEng_bld: coreconf_hack
-	gmake
deleted file mode 100644
--- a/security/dbm/include/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY).   #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL)          #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL)       #
-#######################################################################
-
-
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL).      #
-#######################################################################
-
-
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL)                              #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL)                           #
-#######################################################################
-
-
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL).                              #
-#######################################################################
-
-CPORLN = ln -s
-ifeq ($(OS_ARCH),WINNT)
-CPORLN = cp
-endif
-
-DBM_SRCS = $(EXPORTS) $(PRIVATE_EXPORTS) watcomfx.h
-
-ALL_TRASH += $(DBM_SRCS)
-
-$(DBM_SRCS) : % : $(CORE_DEPTH)/../dbm/include/%
-	-$(CPORLN) $< .
-
-export:: $(DBM_SRCS)
-
-libs:: $(DBM_SRCS)
-
-program:: $(DBM_SRCS)
-
-private_export:: $(DBM_SRCS)
-
-echo::
-	echo "$(DBM_SRCS)"
deleted file mode 100644
--- a/security/dbm/include/manifest.mn
+++ /dev/null
@@ -1,55 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-CORE_DEPTH = ../..
-
-MODULE = dbm
-
-EXPORTS =	nsres.h   \
-		cdefs.h   \
-		mcom_db.h \
-		ncompat.h \
-		winfile.h \
-		$(NULL)
-
-PRIVATE_EXPORTS =	hsearch.h \
-			page.h    \
-			extern.h  \
-			ndbm.h    \
-			queue.h   \
-			hash.h    \
-			mpool.h   \
-			search.h  \
-			$(NULL)
-
deleted file mode 100644
--- a/security/dbm/manifest.mn
+++ /dev/null
@@ -1,46 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-CORE_DEPTH = ..
-
-MODULE = dbm
-
-#IMPORTS = nspr20/v3.5
-IMPORTS = nspr20/v4.0
-
-RELEASE = dbm
-
-DIRS =  include \
-        src     \
-	$(NULL)
deleted file mode 100644
--- a/security/dbm/src/Makefile
+++ /dev/null
@@ -1,99 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY).   #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL)          #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL)       #
-#######################################################################
-
-
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL).      #
-#######################################################################
-
-include config.mk
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL)                              #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL)                           #
-#######################################################################
-
-ifeq ($(OS_CONFIG),OSF1V4.0D)
-INCLUDES	+= -I/usr/sys/include/arch/alpha
-endif
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL).                              #
-#######################################################################
-
-
-CPORLN = ln -s
-ifeq ($(OS_ARCH),WINNT)
-CPORLN = cp
-endif
-
-DBM_SRCS = $(CSRCS)
-
-ALL_TRASH += $(DBM_SRCS)
-
-$(DBM_SRCS) : % : $(CORE_DEPTH)/../dbm/src/%
-	-$(CPORLN) $< .
-
-export:: $(DBM_SRCS)
-
-libs:: $(DBM_SRCS)
-
-program:: $(DBM_SRCS)
-
-private_export:: $(DBM_SRCS)
-
-echo::
-	echo "$(DBM_SRCS)"
deleted file mode 100644
--- a/security/dbm/src/config.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-DEFINES += -DMEMMOVE -D__DBINTERFACE_PRIVATE $(SECURITY_FLAG) -DNSPR20=1
-
-INCLUDES += -I../include
-
-#
-#  Currently, override TARGETS variable so that only static libraries
-#  are specifed as dependencies within rules.mk.
-#
-
-TARGETS        = $(LIBRARY)
-SHARED_LIBRARY =
-IMPORT_LIBRARY =
-PURE_LIBRARY   =
-PROGRAM        =
-
-ifdef SHARED_LIBRARY
-	ifeq ($(OS_ARCH),WINNT)
-		ifneq ($(OS_TARGET),WIN16)
-			DLLBASE=/BASE:0x30000000
-			RES=$(OBJDIR)/dbm.res
-			RESNAME=../include/dbm.rc
-		endif
-	endif
-	ifeq ($(DLL_SUFFIX),dll)
-		DEFINES += -D_DLL
-	endif
-endif
-
-ifeq ($(OS_ARCH),AIX)
-	OS_LIBS += -lc_r
-endif
deleted file mode 100644
--- a/security/dbm/src/manifest.mn
+++ /dev/null
@@ -1,55 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-
-CORE_DEPTH = ../..
-
-MODULE = dbm
-
-CSRCS = db.c	   \
-	h_bigkey.c \
-	h_func.c   \
-	h_log2.c   \
-	h_page.c   \
-	hash.c	   \
-	hash_buf.c \
-	hsearch.c  \
-	memmove.c  \
-	mktemp.c   \
-	ndbm.c	   \
-#	snprintf.c \
-	strerror.c \
-	nsres.c	   \
-	$(NULL)
-
-LIBRARY_NAME = dbm
deleted file mode 100644
--- a/security/dbm/tests/Makefile
+++ /dev/null
@@ -1,131 +0,0 @@
-#! gmake
-#
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-# 
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-# 
-# The Original Code is the Netscape security libraries.
-# 
-# The Initial Developer of the Original Code is Netscape
-# Communications Corporation.  Portions created by Netscape are 
-# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-# Rights Reserved.
-# 
-# Contributor(s):
-# 
-# Alternatively, the contents of this file may be used under the
-# terms of the GNU General Public License Version 2 or later (the
-# "GPL"), in which case the provisions of the GPL are applicable 
-# instead of those above.  If you wish to allow use of your 
-# version of this file only under the terms of the GPL and not to
-# allow others to use your version of this file under the MPL,
-# indicate your decision by deleting the provisions above and
-# replace them with the notice and other provisions required by
-# the GPL.  If you do not delete the provisions above, a recipient
-# may use your version of this file under either the MPL or the
-# GPL.
-#
-DEPTH		= ../..
-CORE_DEPTH	= ../..
-
-MODULE		= dbm
-
-CSRCS		= lots.c
-
-PROGRAM		= lots
-
-include $(DEPTH)/coreconf/config.mk
-
-ifeq ($(OS_ARCH),WINNT)
-DEFINES		+= -DSTDARG
-LIBDBM		= ../src/$(PLATFORM)/dbm$(STATIC_LIB_SUFFIX)
-else
-LIBDBM		= ../src/$(PLATFORM)/libdbm$(STATIC_LIB_SUFFIX)
-endif
-
-ifeq ($(OS_ARCH),AIX)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),BSD_386)
-CFLAGS		+= -g -I../../../include -DXP_UNIX -g -DBSDI -DHAVE_STRERROR -D__386BSD__ -DDEBUG -DMEMMOVE -D__DBINTERFACE_PRIVATE 
-endif
-
-ifeq ($(OS_ARCH),FreeBSD)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),HP-UX)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),IRIX)
-CFLAGS		+= -g -I../../../include -DDEBUG -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),OSF1)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),Linux)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),NCR)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),SCO_SV)
-CFLAGS		+= -DSTDARG
-endif
-
-ifeq ($(OS_ARCH),SunOS)
-CFLAGS		+= -g -I../../../include -D_sun_
-endif
-
-ifeq ($(OS_ARCH),UNIXWARE)
-CFLAGS		+= -DSTDARG
-endif
-
-INCLUDES	+= -I../include
-
-LDFLAGS		= $(LDOPTS) $(LIBDBM)
-
-include $(DEPTH)/coreconf/rules.mk
-
-lots.pure: lots
-	purify $(CC) -o lots.pure $(CFLAGS) $(OBJS) $(MYLIBS)
-
-crash: crash.o $(MYLIBS)
-	$(CC) -o crash $(CFLAGS) crash.o $(MYLIBS)
-
-crash.pure: crash.o $(MYLIBS)
-	purify $(CC) -o crash.pure $(CFLAGS) crash.o $(MYLIBS)
-
-
-CPORLN = ln -s
-ifeq ($(OS_ARCH),WINNT)
-CPORLN = cp
-endif
-
-DBM_SRCS = $(CSRCS)
-
-ALL_TRASH += $(DBM_SRCS)
-
-$(DBM_SRCS) : % : $(CORE_DEPTH)/../dbm/tests/%
-	-$(CPORLN) $< .
-
-export:: $(DBM_SRCS)
-
-libs:: $(DBM_SRCS)
-
-program:: $(DBM_SRCS)
-
-private_export:: $(DBM_SRCS)
-
--- a/security/nss/cmd/pk12util/pk12util.c
+++ b/security/nss/cmd/pk12util/pk12util.c
@@ -37,16 +37,17 @@
 #include "pkcs12.h"
 #include "p12plcy.h"
 #include "pk12util.h"
 #include "nss.h"
 
 #define PKCS12_IN_BUFFER_SIZE	200
 
 static char *progName;
+PRBool pk12_debugging = PR_FALSE;
 
 PRIntn pk12uErrno = 0;
 
 static void
 Usage(char *progName)
 {
 #define FPS PR_fprintf(PR_STDERR,
     FPS "Usage:	 %s -i importfile [-d certdir] [-P dbprefix] [-h tokenname]\n",
@@ -182,22 +183,16 @@ p12u_CreateTemporaryDigestFile(void)
 #endif
 
     if (!p12cxt->filename) {
 	PR_SetError(SEC_ERROR_NO_MEMORY, 0);
 	p12u_DestroyExportFileInfo(&p12cxt, PR_FALSE);
 	return NULL;
     }
 
-    p12cxt->file = PR_Open(p12cxt->filename, PR_RDONLY, 0400);
-    if (!p12cxt->filename) {
-	p12u_DestroyExportFileInfo(&p12cxt, PR_FALSE);
-	return NULL;
-    }
-
     return p12cxt;
 }
 
 static SECStatus
 p12u_DigestOpen(void *arg, PRBool readData)
 {
     p12uContext *p12cxt = arg;
 
@@ -342,27 +337,25 @@ p12u_ucs2_ascii_conversion_function(PRBo
 				    PRBool	   swapBytes)
 {
     SECItem it = { 0 };
     SECItem *dup = NULL;
     PRBool ret;
     /* If converting Unicode to ASCII, swap bytes before conversion
      * as neccessary.
      */
-#ifdef DEBUG
-    {
+    if (pk12_debugging) {
 	int i;
 	printf("Converted from:\n");
 	for (i=0; i<inBufLen; i++) {
 	    printf("%2x ", inBuf[i]);
 	    /*if (i%60 == 0) printf("\n");*/
 	}
 	printf("\n");
     }
-#endif
     it.data = inBuf;
     it.len = inBufLen;
     dup = SECITEM_DupItem(&it);
     if (!toUnicode && swapBytes) {
 	if (p12u_SwapUnicodeBytes(dup) != SECSuccess) {
 	    SECITEM_ZfreeItem(dup, PR_TRUE);
 	    return PR_FALSE;
 	}
@@ -383,27 +376,25 @@ p12u_ucs2_ascii_conversion_function(PRBo
 	if (p12u_SwapUnicodeBytes(dup) != SECSuccess) {
 	    SECITEM_ZfreeItem(dup, PR_TRUE);
 	    return PR_FALSE;
 	}
 	memcpy(outBuf, dup->data, *outBufLen);
 	SECITEM_ZfreeItem(dup, PR_TRUE);
     }
 #endif
-#ifdef DEBUG
-    {
+    if (pk12_debugging) {
 	int i;
 	printf("Converted to:\n");
 	for (i=0; i<*outBufLen; i++) {
 	    printf("%2x ", outBuf[i]);
 	    /*if (i%60 == 0) printf("\n");*/
 	}
 	printf("\n");
     }
-#endif
     return ret;
 }
 
 SECStatus
 P12U_UnicodeConversion(PRArenaPool *arena, SECItem *dest, SECItem *src,
 		       PRBool toUnicode, PRBool swapBytes)
 {
     unsigned int allocLen;
@@ -471,25 +462,25 @@ P12U_InitSlot(PK11SlotInfo *slot, secuPW
     SECStatus rv;
 
     /*	New databases, initialize keydb password. */
     if (PK11_NeedUserInit(slot)) {
 	rv = SECU_ChangePW(slot,
 			   (slotPw->source == PW_PLAINTEXT) ? slotPw->data : 0,
 			   (slotPw->source == PW_FROMFILE) ? slotPw->data : 0);
 	if (rv != SECSuccess) {
-	    PR_fprintf(PR_STDERR, "%s: Failed to initialize slot \"%s\".\n",
-				   progName, PK11_GetSlotName(slot));
+	    SECU_PrintError(progName, "Failed to initialize slot \"%s\"",
+				    PK11_GetSlotName(slot));
 	    return SECFailure;
 	}
     }
 
     if (PK11_Authenticate(slot, PR_TRUE, slotPw) != SECSuccess) {
-	PR_fprintf(PR_STDERR, "%s: Failed to authenticate to PKCS11 slot.\n",
-			       progName);
+	SECU_PrintError(progName,
+			 "Failed to authenticate to PKCS11 slot");
 	PORT_SetError(SEC_ERROR_USER_CANCELLED);
 	pk12uErrno = PK12UERR_USER_CANCELLED;
 	return SECFailure;
     }
 
     return SECSuccess;
 }
 
@@ -515,65 +506,65 @@ P12U_ImportPKCS12Object(char *in_file, P
     int error;
 
 #ifdef IS_LITTLE_ENDIAN
     swapUnicode = PR_TRUE;
 #endif
 
     rv = P12U_InitSlot(slot, slotPw);
     if (rv != SECSuccess) {
-	PR_fprintf(PR_STDERR, "%s: Failed to authenticate to \"%s\".\n",
-			       progName, PK11_GetSlotName(slot));
+	SECU_PrintError(progName, "Failed to authenticate to \"%s\"",
+			       			 PK11_GetSlotName(slot));
 	pk12uErrno = PK12UERR_PK11GETSLOT;
 	goto loser;
     }
 
     p12cxt = p12u_InitFile(PR_TRUE, in_file);
     if(!p12cxt) {
-	printf("%s: Initialization failed: %s\n", progName, in_file);
+	SECU_PrintError(progName,"Initialization failed: %s", in_file);
 	pk12uErrno = PK12UERR_INIT_FILE;
 	goto loser;
     }
 
     /* get the password */
     pwitem = P12U_GetP12FilePassword(PR_FALSE, p12FilePw);
     if (!pwitem) {
 	pk12uErrno = PK12UERR_USER_CANCELLED;
 	goto loser;
     }
 
     if(P12U_UnicodeConversion(NULL, &uniPwitem, pwitem, PR_TRUE,
 			      swapUnicode) != SECSuccess) {
-	printf("%s: Unicode conversion failed \n", progName);
+	SECU_PrintError(progName,"Unicode conversion failed");
 	pk12uErrno = PK12UERR_UNICODECONV;
 	goto loser;
     }
 
     tmpcxt = p12u_CreateTemporaryDigestFile();
     if(!tmpcxt) {
-	printf("%s: Create Temporary digest file failed.\n", progName);
+	SECU_PrintError(progName,"Create Temporary digest file failed");
 	pk12uErrno = PK12UERR_TMPDIGCREATE;
 	goto loser;
     }
 
     /* init the decoder context */
     p12dcx = SEC_PKCS12DecoderStart(&uniPwitem, slot, NULL,
 				    p12u_DigestOpen, p12u_DigestClose,
 				    p12u_DigestRead, p12u_DigestWrite,
 				    tmpcxt);
     if(!p12dcx) {
-	printf("%s: PKCS12 decoder start failed.\n", progName);
+	SECU_PrintError(progName,"PKCS12 decoder start failed");
 	pk12uErrno = PK12UERR_PK12DECODESTART;
 	goto loser;
     }
 
     /* decode the item */
     rv = SECU_FileToItem(&p12file, p12cxt->file);
     if (rv != SECSuccess) {
-	fprintf(stderr, "%s: Failed to read from import file.\n", progName);
+	SECU_PrintError(progName,"Failed to read from import file");
 	goto loser;
     }
     rv = SEC_PKCS12DecoderUpdate(p12dcx, p12file.data, p12file.len);
 
     if(rv != SECSuccess) {
 	error = PR_GetError();
 	if(error == SEC_ERROR_DECRYPTION_DISALLOWED) {
 	    PR_SetError(error, 0);
@@ -582,52 +573,53 @@ P12U_ImportPKCS12Object(char *in_file, P
 #ifdef EXTRA
 	/* unable to import as a new blob, it might be an old one */
 	if(p12u_TryToImportOldPDU(p12cxt, pwitem, slot, import_arg->nickCb,
 				  import_arg->proto_win) != SECSuccess) {
 	    goto loser;
 	}
 	goto tried_pdu_import;
 #endif /* EXTRA */
-	printf("%s: PKCS12 decoding failed.\n", progName);
+	SECU_PrintError(progName,"PKCS12 decoding failed");
 	pk12uErrno = PK12UERR_DECODE;
     }
 
     rv = SECFailure;
 
     /* does the blob authenticate properly? */
     if(SEC_PKCS12DecoderVerify(p12dcx) != SECSuccess) {
-	printf("%s: PKCS12 decode not verified\n", progName);
+	SECU_PrintError(progName,"PKCS12 decode not verified");
 	pk12uErrno = PK12UERR_DECODEVERIFY;
 	goto loser;
     }
 
     /* make sure the bags are okey dokey -- nicknames correct, etc. */
     if (SEC_PKCS12DecoderValidateBags(p12dcx, P12U_NicknameCollisionCallback)
 	 != SECSuccess) {
 	if (PORT_GetError() == SEC_ERROR_PKCS12_DUPLICATE_DATA) {
 	    pk12uErrno = PK12UERR_CERTALREADYEXISTS;
+	} else {
+	    pk12uErrno = PK12UERR_DECODEVALIBAGS;
 	}
-	printf("%s: PKCS12 decode validate bags failed.\n", progName);
-	pk12uErrno = PK12UERR_DECODEVALIBAGS;
+	SECU_PrintError(progName,"PKCS12 decode validate bags failed");
 	goto loser;
     }
 
     /* stuff 'em in */
     if(SEC_PKCS12DecoderImportBags(p12dcx) != SECSuccess) {
-	printf("%s: PKCS12 decode import bags failed.\n", progName);
+	SECU_PrintError(progName,"PKCS12 decode import bags failed");
 	pk12uErrno = PK12UERR_DECODEIMPTBAGS;
 	goto loser;
     }
 
 #if 0
     /* important - to add the password hash into the key database */
     rv = PK11_CheckUserPassword(slot, pw_string);
     if( rv != SECSuccess ) {
-	printf("Failed to CheckUserPassword\n");
+	SECU_PrintError(progName,"Failed to CheckUserPassword");
 	exit(-1);
     }
 #endif
 
     PR_Close(p12cxt->file);
     p12cxt->file = NULL;
     PK11_FreeSlot(slot);
 
@@ -710,86 +702,86 @@ P12U_ExportPKCS12Object(char *nn, char *
     SEC_PKCS12SafeInfo *keySafe = NULL, *certSafe = NULL;
     SECItem *pwitem = NULL;
     PK11SlotInfo *slot = NULL;
     p12uContext *p12cxt = NULL;
     CERTCertificate *cert;
 
     cert = PK11_FindCertFromNickname(nn, NULL);
     if(!cert) {
-	printf("%s: find cert by nickname failed.\n", progName);
+	SECU_PrintError(progName,"find cert by nickname failed");
 	pk12uErrno = PK12UERR_FINDCERTBYNN;
 	return;
     }
 
     if (!cert->slot) {
-	fprintf(stderr, "%s: cert does not have a slot.\n", progName);
+	SECU_PrintError(progName,"cert does not have a slot");
 	pk12uErrno = PK12UERR_FINDCERTBYNN;
 	goto loser;
     }
     if (P12U_InitSlot(cert->slot, slotPw) != SECSuccess) {
-	fprintf(stderr, "%s: Failed to authenticate to \"%s\".\n",
-			 progName, PK11_GetSlotName(cert->slot));
+	SECU_PrintError(progName,"Failed to authenticate to \"%s\"",
+			  PK11_GetSlotName(cert->slot));
 	pk12uErrno = PK12UERR_PK11GETSLOT;
 	goto loser;
     }
 
     /*	Password to use for PKCS12 file.  */
     pwitem = P12U_GetP12FilePassword(PR_TRUE, p12FilePw);
     if(!pwitem) {
 	goto loser;
     }
 
     p12ecx = SEC_PKCS12CreateExportContext(NULL, NULL, cert->slot, NULL);
     if(!p12ecx) {
-	printf("%s: export context creation failed.\n", progName);
+	SECU_PrintError(progName,"export context creation failed");
 	pk12uErrno = PK12UERR_EXPORTCXCREATE;
 	goto loser;
     }
 
     if(SEC_PKCS12AddPasswordIntegrity(p12ecx, pwitem, SEC_OID_SHA1)
        != SECSuccess) {
-	printf("%s: PKCS12 add password integrity failed.\n", progName);
+	SECU_PrintError(progName,"PKCS12 add password integrity failed");
 	pk12uErrno = PK12UERR_PK12ADDPWDINTEG;
 	goto loser;
     }
 
     keySafe = SEC_PKCS12CreateUnencryptedSafe(p12ecx);
     if(/*!SEC_PKCS12IsEncryptionAllowed() || */ PK11_IsFIPS()) {
 	certSafe = keySafe;
     } else {
 	certSafe = SEC_PKCS12CreatePasswordPrivSafe(p12ecx, pwitem,
 			SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC);
     }
 
     if(!certSafe || !keySafe) {
-	printf("%s: key or cert safe creation failed.\n", progName);
+	SECU_PrintError(progName,"key or cert safe creation failed");
 	pk12uErrno = PK12UERR_CERTKEYSAFE;
 	goto loser;
     }
 
     if(SEC_PKCS12AddCertAndKey(p12ecx, certSafe, NULL, cert,
 			CERT_GetDefaultCertDB(), keySafe, NULL, PR_TRUE, pwitem,
 			SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC)
 			!= SECSuccess) {
-	printf("%s: add cert and key failed.\n", progName);
+	SECU_PrintError(progName,"add cert and key failed");
 	pk12uErrno = PK12UERR_ADDCERTKEY;
 	goto loser;
     }
 
-    p12cxt = p12u_InitFile(PR_FALSE, outfile);
+    p12cxt = p12u_InitFile(PR_FALSE, outfile); 
     if(!p12cxt) {
-	printf("%s: Initialization failed: %s\n", progName, outfile);
+	SECU_PrintError(progName,"Initialization failed: %s", outfile);
 	pk12uErrno = PK12UERR_INIT_FILE;
 	goto loser;
     }
 
     if(SEC_PKCS12Encode(p12ecx, p12u_WriteToExportFile, p12cxt)
 			!= SECSuccess) {
-	printf("%s: PKCS12 encode failed.\n", progName);
+	SECU_PrintError(progName,"PKCS12 encode failed");
 	pk12uErrno = PK12UERR_ENCODE;
 	goto loser;
     }
 
     p12u_DestroyExportFileInfo(&p12cxt, PR_FALSE);
     SECITEM_ZfreeItem(pwitem, PR_TRUE);
     CERT_DestroyCertificate(cert);
     if(slot) {
@@ -864,32 +856,34 @@ enum {
     opt_Import,
     opt_SlotPWFile,
     opt_SlotPW,
     opt_Mode,
     opt_Nickname,
     opt_Export,
     opt_P12FilePWFile,
     opt_P12FilePW,
-    opt_DBPrefix
+    opt_DBPrefix,
+    opt_Debug
 };
 
 static secuCommandFlag pk12util_options[] =
 {
     { /* opt_CertDir	       */ 'd', PR_TRUE,	 0, PR_FALSE },
     { /* opt_TokenName	       */ 'h', PR_TRUE,	 0, PR_FALSE },
     { /* opt_Import	       */ 'i', PR_TRUE,	 0, PR_FALSE },
     { /* opt_SlotPWFile	       */ 'k', PR_TRUE,	 0, PR_FALSE },
     { /* opt_SlotPW	       */ 'K', PR_TRUE,	 0, PR_FALSE },
     { /* opt_Mode	       */ 'm', PR_TRUE,	 0, PR_FALSE },
     { /* opt_Nickname	       */ 'n', PR_TRUE,	 0, PR_FALSE },
     { /* opt_Export	       */ 'o', PR_TRUE,	 0, PR_FALSE },
     { /* opt_P12FilePWFile     */ 'w', PR_TRUE,	 0, PR_FALSE },
     { /* opt_P12FilePW	       */ 'W', PR_TRUE,	 0, PR_FALSE },
-    { /* opt_DBPrefix	       */ 'P', PR_TRUE,	 0, PR_FALSE }
+    { /* opt_DBPrefix	       */ 'P', PR_TRUE,	 0, PR_FALSE },
+    { /* opt_Debug	       */ 'v', PR_FALSE, 0, PR_FALSE }
 };
 
 int
 main(int argc, char **argv)
 {
     PRIntn ret = 0;
     secuPWData slotPw = { PW_NONE, NULL };
     secuPWData p12FilePw = { PW_NONE, NULL };
@@ -909,16 +903,18 @@ main(int argc, char **argv)
     progName = strrchr(argv[0], '/');
     progName = progName ? progName+1 : argv[0];
 
     rv = SECU_ParseCommandLine(argc, argv, progName, &pk12util);
 
     if (rv != SECSuccess)
 	Usage(progName);
 
+    pk12_debugging = pk12util.options[opt_Debug].activated;
+
     if (pk12util.options[opt_Import].activated &&
 	pk12util.options[opt_Export].activated) {
 	Usage(progName);
     }
 
     if (pk12util.options[opt_Export].activated &&
        !pk12util.options[opt_Nickname].activated) {
 	Usage(progName);
@@ -959,18 +955,17 @@ main(int argc, char **argv)
     if (pk12util.options[opt_Import].activated) {
 
 	if (!slotname || PL_strcmp(slotname, "internal") == 0)
 	    slot = PK11_GetInternalKeySlot();
 	else
 	    slot = PK11_FindSlotByName(slotname);
 
 	if (!slot) {
-	    PR_fprintf(PR_STDERR, "%s: Invalid slot \"%s\".\n",
-				   progName, slotname);
+	    SECU_PrintError(progName,"Invalid slot \"%s\"", slotname);
 	    goto done;
 	}
 
 	if ((ret = P12U_ImportPKCS12Object(import_file, slot, &slotPw,
 					   &p12FilePw)) != 0)
 	    goto done;
 
     } else if (pk12util.options[opt_Export].activated) {
--- a/security/nss/lib/certdb/cert.h
+++ b/security/nss/lib/certdb/cert.h
@@ -1071,16 +1071,24 @@ void
 CERT_RemoveCertListNode(CERTCertListNode *node);
 
 SECStatus
 CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert);
 
 SECStatus
 CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert);
 
+SECStatus
+CERT_AddCertToListTailWithData(CERTCertList *certs, CERTCertificate *cert,
+							 void *appData);
+
+SECStatus
+CERT_AddCertToListHeadWithData(CERTCertList *certs, CERTCertificate *cert,
+							 void *appData);
+
 typedef PRBool (* CERTSortCallback)(CERTCertificate *certa,
 				    CERTCertificate *certb,
 				    void *arg);
 SECStatus
 CERT_AddCertToListSorted(CERTCertList *certs, CERTCertificate *cert,
 			 CERTSortCallback f, void *arg);
 
 /* callback for CERT_AddCertToListSorted that sorts based on validity
--- a/security/nss/lib/certdb/certdb.c
+++ b/security/nss/lib/certdb/certdb.c
@@ -2014,38 +2014,48 @@ CERT_DestroyCertList(CERTCertList *certs
 void
 CERT_RemoveCertListNode(CERTCertListNode *node)
 {
     CERT_DestroyCertificate(node->cert);
     PR_REMOVE_LINK(&node->links);
     return;
 }
 
+
 SECStatus
-CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert)
+CERT_AddCertToListTailWithData(CERTCertList *certs, 
+				CERTCertificate *cert, void *appData)
 {
     CERTCertListNode *node;
     
     node = (CERTCertListNode *)PORT_ArenaZAlloc(certs->arena,
 						sizeof(CERTCertListNode));
     if ( node == NULL ) {
 	goto loser;
     }
     
     PR_INSERT_BEFORE(&node->links, &certs->list);
     /* certs->count++; */
     node->cert = cert;
+    node->appData = appData;
     return(SECSuccess);
     
 loser:
     return(SECFailure);
 }
 
 SECStatus
-CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert)
+CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert)
+{
+    CERT_AddCertToListTailWithData(certs, cert, NULL);
+}
+
+SECStatus
+CERT_AddCertToListHeadWithData(CERTCertList *certs, 
+					CERTCertificate *cert, void *appData)
 {
     CERTCertListNode *node;
     CERTCertListNode *head;
     
     head = CERT_LIST_HEAD(certs);
 
     if (head == NULL) return CERT_AddCertToListTail(certs,cert);
 
@@ -2053,22 +2063,29 @@ CERT_AddCertToListHead(CERTCertList *cer
 						sizeof(CERTCertListNode));
     if ( node == NULL ) {
 	goto loser;
     }
     
     PR_INSERT_BEFORE(&node->links, &head->links);
     /* certs->count++; */
     node->cert = cert;
+    node->appData = appData;
     return(SECSuccess);
     
 loser:
     return(SECFailure);
 }
 
+SECStatus
+CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert)
+{
+    return CERT_AddCertToListHeadWithData(certs, cert, NULL);
+}
+
 /*
  * Sort callback function to determine if cert a is newer than cert b.
  * Not valid certs are considered older than valid certs.
  */
 PRBool
 CERT_SortCBValidity(CERTCertificate *certa,
 		    CERTCertificate *certb,
 		    void *arg)
--- a/security/nss/lib/certdb/pcertdb.c
+++ b/security/nss/lib/certdb/pcertdb.c
@@ -3983,18 +3983,16 @@ UpdateV5DB(CERTCertDBHandle *handle, DB 
     
     rv = SEC_TraversePermCerts(&updatehandle, updateV5Callback,
 			       (void *)handle);
     
     PZ_DestroyMonitor(updatehandle.dbMon);
 
     (* updatedb->close)(updatedb);
     return(SECSuccess);
-    
-    return(rv);
 }
 
 static PRBool
 isV4DB(DB *db) {
     DBT key,data;
     int ret;
 
     key.data = "Version";
@@ -4715,17 +4713,17 @@ CERT_GetCertTrust(CERTCertificate *cert,
 
 static char *
 cert_parseNickname(char *nickname)
 {
 	char *cp;
 
 	for (cp=nickname; *cp && *cp != ':'; cp++);
 
-	if (*cp == ':') return cp++;
+	if (*cp == ':') return cp+1;
 	return nickname;
 }
 
 /*
  * Change the trust attributes of a certificate and make them permanent
  * in the database.
  */
 SECStatus
new file mode 100644
--- /dev/null
+++ b/security/nss/lib/certhigh/certread.c
@@ -0,0 +1,535 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is the Netscape security libraries.
+ * 
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation.  Portions created by Netscape are 
+ * Copyright (C) 1994-2000 Netscape Communications Corporation.  All
+ * Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable 
+ * instead of those above.  If you wish to allow use of your 
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL.  If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ */
+
+#include "cert.h"
+#include "secpkcs7.h"
+#include "base64.h"
+#include "secitem.h"
+#include "secder.h"
+#include "secasn1.h"
+#include "secoid.h"
+
+SECStatus
+SEC_ReadPKCS7Certs(SECItem *pkcs7Item, CERTImportCertificateFunc f, void *arg)
+{
+    SEC_PKCS7ContentInfo *contentInfo = NULL;
+    SECStatus rv;
+    SECItem **certs;
+    int count;
+
+    contentInfo = SEC_PKCS7DecodeItem(pkcs7Item, NULL, NULL, NULL, NULL, NULL, 
+				      NULL, NULL);
+    if ( contentInfo == NULL ) {
+	goto loser;
+    }
+
+    if ( SEC_PKCS7ContentType (contentInfo) != SEC_OID_PKCS7_SIGNED_DATA ) {
+	goto loser;
+    }
+
+    certs = contentInfo->content.signedData->rawCerts;
+    if ( certs ) {
+	count = 0;
+	
+	while ( *certs ) {
+	    count++;
+	    certs++;
+	}
+	rv = (* f)(arg, contentInfo->content.signedData->rawCerts, count);
+    }
+    
+    rv = SECSuccess;
+    
+    goto done;
+loser:
+    rv = SECFailure;
+    
+done:
+    if ( contentInfo ) {
+	SEC_PKCS7DestroyContentInfo(contentInfo);
+    }
+
+    return(rv);
+}
+
+const SEC_ASN1Template SEC_CertSequenceTemplate[] = {
+    { SEC_ASN1_SEQUENCE_OF,
+	  0, SECAnyTemplate }
+};
+
+SECStatus
+SEC_ReadCertSequence(SECItem *certsItem, CERTImportCertificateFunc f, void *arg)
+{
+    SECStatus rv;
+    SECItem **certs;
+    int count;
+    SECItem **rawCerts = NULL;
+    PRArenaPool *arena;
+    SEC_PKCS7ContentInfo *contentInfo = NULL;
+
+    arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+    if (arena == NULL) {
+	return SECFailure;
+    }
+
+    contentInfo = SEC_PKCS7DecodeItem(certsItem, NULL, NULL, NULL, NULL, NULL, 
+				      NULL, NULL);
+    if ( contentInfo == NULL ) {
+	goto loser;
+    }
+
+    if ( SEC_PKCS7ContentType (contentInfo) != SEC_OID_NS_TYPE_CERT_SEQUENCE ) {
+	goto loser;
+    }
+
+
+    rv = SEC_ASN1DecodeItem(arena, &rawCerts, SEC_CertSequenceTemplate,
+		    contentInfo->content.data);
+
+    if (rv != SECSuccess) {
+	goto loser;
+    }
+
+    certs = rawCerts;
+    if ( certs ) {
+	count = 0;
+	
+	while ( *certs ) {
+	    count++;
+	    certs++;
+	}
+	rv = (* f)(arg, rawCerts, count);
+    }
+    
+    rv = SECSuccess;
+    
+    goto done;
+loser:
+    rv = SECFailure;
+    
+done:
+    if ( contentInfo ) {
+	SEC_PKCS7DestroyContentInfo(contentInfo);
+    }
+
+    if ( arena ) {
+	PORT_FreeArena(arena, PR_FALSE);
+    }
+    
+    return(rv);
+}
+
+CERTCertificate *
+CERT_ConvertAndDecodeCertificate(char *certstr)
+{
+    CERTCertificate *cert;
+    SECStatus rv;
+    SECItem der;
+
+    rv = ATOB_ConvertAsciiToItem(&der, certstr);
+    if (rv != SECSuccess)
+	return NULL;
+
+    cert = CERT_DecodeDERCertificate(&der, PR_TRUE, NULL);
+
+    PORT_Free(der.data);
+    return cert;
+}
+
+#define NS_CERT_HEADER "-----BEGIN CERTIFICATE-----"
+#define NS_CERT_TRAILER "-----END CERTIFICATE-----"
+
+#define CERTIFICATE_TYPE_STRING "certificate"
+#define CERTIFICATE_TYPE_LEN (sizeof(CERTIFICATE_TYPE_STRING)-1)
+
+CERTPackageType
+CERT_CertPackageType(SECItem *package, SECItem *certitem)
+{
+    unsigned char *cp;
+    int seqLen, seqLenLen;
+    SECItem oiditem;
+    SECOidData *oiddata;
+    CERTPackageType type = certPackageNone;
+    
+    cp = package->data;
+
+    /* is a DER encoded certificate of some type? */
+    if ( ( *cp  & 0x1f ) == SEC_ASN1_SEQUENCE ) {
+	cp++;
+	
+	if ( *cp & 0x80) {
+	    /* Multibyte length */
+	    seqLenLen = cp[0] & 0x7f;
+	    
+	    switch (seqLenLen) {
+	      case 4:
+		seqLen = ((unsigned long)cp[1]<<24) |
+		    ((unsigned long)cp[2]<<16) | (cp[3]<<8) | cp[4];
+		break;
+	      case 3:
+		seqLen = ((unsigned long)cp[1]<<16) | (cp[2]<<8) | cp[3];
+		break;
+	      case 2:
+		seqLen = (cp[1]<<8) | cp[2];
+		break;
+	      case 1:
+		seqLen = cp[1];
+		break;
+	      default:
+		/* indefinite length */
+		seqLen = 0;
+	    }
+	    cp += ( seqLenLen + 1 );
+
+	} else {
+	    seqLenLen = 0;
+	    seqLen = *cp;
+	    cp++;
+	}
+
+	/* check entire length if definite length */
+	if ( seqLen || seqLenLen ) {
+	    if ( package->len != ( seqLen + seqLenLen + 2 ) ) {
+		/* not a DER package */
+		return(type);
+	    }
+	}
+	
+	/* check the type string */
+	/* netscape wrapped DER cert */
+	if ( ( cp[0] == SEC_ASN1_OCTET_STRING ) &&
+	    ( cp[1] == CERTIFICATE_TYPE_LEN ) &&
+	    ( PORT_Strcmp((char *)&cp[2], CERTIFICATE_TYPE_STRING) ) ) {
+	    
+	    cp += ( CERTIFICATE_TYPE_LEN + 2 );
+
+	    /* it had better be a certificate by now!! */
+	    if ( certitem ) {
+		certitem->data = cp;
+		certitem->len = package->len -
+		    ( cp - (unsigned char *)package->data );
+	    }
+	    type = certPackageNSCertWrap;
+	    
+	} else if ( cp[0] == SEC_ASN1_OBJECT_ID ) {
+	    /* XXX - assume DER encoding of OID len!! */
+	    oiditem.len = cp[1];
+	    oiditem.data = (unsigned char *)&cp[2];
+	    oiddata = SECOID_FindOID(&oiditem);
+	    if ( oiddata == NULL ) {
+		/* failure */
+		return(type);
+	    }
+
+	    if ( certitem ) {
+		certitem->data = package->data;
+		certitem->len = package->len;
+	    }
+	    
+	    switch ( oiddata->offset ) {
+	      case SEC_OID_PKCS7_SIGNED_DATA:
+		type = certPackagePKCS7;
+		break;
+	      case SEC_OID_NS_TYPE_CERT_SEQUENCE:
+		type = certPackageNSCertSeq;
+		break;
+	      default:
+		break;
+	    }
+	    
+	} else {
+	    /* it had better be a certificate by now!! */
+	    if ( certitem ) {
+		certitem->data = package->data;
+		certitem->len = package->len;
+	    }
+	    
+	    type = certPackageCert;
+	}
+    }
+
+    return(type);
+}
+
+/*
+ * read an old style ascii or binary certificate chain
+ */
+SECStatus
+CERT_DecodeCertPackage(char *certbuf,
+		       int certlen,
+		       CERTImportCertificateFunc f,
+		       void *arg)
+{
+    unsigned char *cp;
+    int seqLen, seqLenLen;
+    int cl;
+    unsigned char *bincert = NULL, *certbegin = NULL, *certend = NULL;
+    unsigned int binLen;
+    char *ascCert = NULL;
+    int asciilen;
+    CERTCertificate *cert;
+    SECItem certitem, oiditem;
+    SECStatus rv;
+    SECOidData *oiddata;
+    SECItem *pcertitem = &certitem;
+    
+    if ( certbuf == NULL ) {
+	return(SECFailure);
+    }
+    
+    cert = 0;
+    cp = (unsigned char *)certbuf;
+
+    /* is a DER encoded certificate of some type? */
+    if ( ( *cp  & 0x1f ) == SEC_ASN1_SEQUENCE ) {
+	cp++;
+	
+	if ( *cp & 0x80) {
+	    /* Multibyte length */
+	    seqLenLen = cp[0] & 0x7f;
+	    
+	    switch (seqLenLen) {
+	      case 4:
+		seqLen = ((unsigned long)cp[1]<<24) |
+		    ((unsigned long)cp[2]<<16) | (cp[3]<<8) | cp[4];
+		break;
+	      case 3:
+		seqLen = ((unsigned long)cp[1]<<16) | (cp[2]<<8) | cp[3];
+		break;
+	      case 2:
+		seqLen = (cp[1]<<8) | cp[2];
+		break;
+	      case 1:
+		seqLen = cp[1];
+		break;
+	      default:
+		/* indefinite length */
+		seqLen = 0;
+	    }
+	    cp += ( seqLenLen + 1 );
+
+	} else {
+	    seqLenLen = 0;
+	    seqLen = *cp;
+	    cp++;
+	}
+
+	/* check entire length if definite length */
+	if ( seqLen || seqLenLen ) {
+	    if ( certlen != ( seqLen + seqLenLen + 2 ) ) {
+		goto notder;
+	    }
+	}
+	
+	/* check the type string */
+	/* netscape wrapped DER cert */
+	if ( ( cp[0] == SEC_ASN1_OCTET_STRING ) &&
+	    ( cp[1] == CERTIFICATE_TYPE_LEN ) &&
+	    ( PORT_Strcmp((char *)&cp[2], CERTIFICATE_TYPE_STRING) ) ) {
+	    
+	    cp += ( CERTIFICATE_TYPE_LEN + 2 );
+
+	    /* it had better be a certificate by now!! */
+	    certitem.data = cp;
+	    certitem.len = certlen - ( cp - (unsigned char *)certbuf );
+	    
+	    rv = (* f)(arg, &pcertitem, 1);
+	    
+	    return(rv);
+	} else if ( cp[0] == SEC_ASN1_OBJECT_ID ) {
+	    /* XXX - assume DER encoding of OID len!! */
+	    oiditem.len = cp[1];
+	    oiditem.data = (unsigned char *)&cp[2];
+	    oiddata = SECOID_FindOID(&oiditem);
+	    if ( oiddata == NULL ) {
+		return(SECFailure);
+	    }
+
+	    certitem.data = (unsigned char*)certbuf;
+	    certitem.len = certlen;
+	    
+	    switch ( oiddata->offset ) {
+	      case SEC_OID_PKCS7_SIGNED_DATA:
+		return(SEC_ReadPKCS7Certs(&certitem, f, arg));
+		break;
+	      case SEC_OID_NS_TYPE_CERT_SEQUENCE:
+		return(SEC_ReadCertSequence(&certitem, f, arg));
+		break;
+	      default:
+		break;
+	    }
+	    
+	} else {
+	    /* it had better be a certificate by now!! */
+	    certitem.data = (unsigned char*)certbuf;
+	    certitem.len = certlen;
+	    
+	    rv = (* f)(arg, &pcertitem, 1);
+	    return(rv);
+	}
+    }
+
+    /* now look for a netscape base64 ascii encoded cert */
+notder:
+    cp = (unsigned char *)certbuf;
+    cl = certlen;
+    certbegin = 0;
+    certend = 0;
+
+    /* find the beginning marker */
+    while ( cl > sizeof(NS_CERT_HEADER) ) {
+	if ( !PORT_Strncasecmp((char *)cp, NS_CERT_HEADER,
+			     sizeof(NS_CERT_HEADER)-1) ) {
+	    cp = cp + sizeof(NS_CERT_HEADER);
+	    certbegin = cp;
+	    break;
+	}
+	
+	/* skip to next eol */
+	do {
+	    cp++;
+	    cl--;
+	} while ( ( *cp != '\n') && cl );
+
+	/* skip all blank lines */
+	while ( ( *cp == '\n') && cl ) {
+	    cp++;
+	    cl--;
+	}
+    }
+
+    if ( certbegin ) {
+
+	/* find the ending marker */
+	while ( cl > sizeof(NS_CERT_TRAILER) ) {
+	    if ( !PORT_Strncasecmp((char *)cp, NS_CERT_TRAILER,
+				 sizeof(NS_CERT_TRAILER)-1) ) {
+		certend = (unsigned char *)cp;
+		break;
+	    }
+
+	    /* skip to next eol */
+	    do {
+		cp++;
+		cl--;
+	    } while ( ( *cp != '\n') && cl );
+
+	    /* skip all blank lines */
+	    while ( ( *cp == '\n') && cl ) {
+		cp++;
+		cl--;
+	    }
+	}
+    }
+
+    if ( certbegin && certend ) {
+
+	/* Convert the ASCII data into a nul-terminated string */
+	asciilen = certend - certbegin;
+	ascCert = (char *)PORT_Alloc(asciilen+1);
+	if (!ascCert) {
+	    rv = SECFailure;
+	    goto loser;
+	}
+
+	PORT_Memcpy(ascCert, certbegin, asciilen);
+	ascCert[asciilen] = '\0';
+	
+	/* convert to binary */
+	bincert = ATOB_AsciiToData(ascCert, &binLen);
+	if (!bincert) {
+	    rv = SECFailure;
+	    goto loser;
+	}
+
+	/* now recurse to decode the binary */
+	rv = CERT_DecodeCertPackage((char *)bincert, binLen, f, arg);
+	
+    } else {
+	rv = SECFailure;
+    }
+
+loser:
+
+    if ( bincert ) {
+	PORT_Free(bincert);
+    }
+
+    if ( ascCert ) {
+	PORT_Free(ascCert);
+    }
+
+    return(rv);
+}
+
+typedef struct {
+    PRArenaPool *arena;
+    SECItem cert;
+} collect_args;
+
+static SECStatus
+collect_certs(void *arg, SECItem **certs, int numcerts)
+{
+    SECStatus rv;
+    collect_args *collectArgs;
+    
+    collectArgs = (collect_args *)arg;
+    
+    rv = SECITEM_CopyItem(collectArgs->arena, &collectArgs->cert, *certs);
+
+    return(rv);
+}
+
+
+/*
+ * read an old style ascii or binary certificate
+ */
+CERTCertificate *
+CERT_DecodeCertFromPackage(char *certbuf, int certlen)
+{
+    collect_args collectArgs;
+    SECStatus rv;
+    CERTCertificate *cert = NULL;
+    
+    collectArgs.arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+    
+    rv = CERT_DecodeCertPackage(certbuf, certlen, collect_certs,
+				(void *)&collectArgs);
+    if ( rv == SECSuccess ) {
+	cert = CERT_DecodeDERCertificate(&collectArgs.cert, PR_TRUE, NULL);
+    }
+    
+    PORT_FreeArena(collectArgs.arena, PR_FALSE);
+    
+    return(cert);
+}
new file mode 100644
--- /dev/null
+++ b/security/nss/lib/freebl/mpi/mpv_sparc32.S
@@ -0,0 +1,2690 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is an asm version of SPARC/VIS multiply and add function
+ *
+ * The Initial Developer of the Original Code is Sun Microsystems Inc.
+ * Portions created by Sun Microsystems Inc. are 
+ * Copyright (C) 1999-2000 Sun Microsystems Inc.  All Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable 
+ * instead of those above.	If you wish to allow use of your 
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL.  If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ *  $Id$
+ */
+
+	.section	".text",#alloc,#execinstr
+	.file	"mul_add.c"
+
+	.section	".data",#alloc,#write
+	.align	8
+mask_cnst:
+	.word	-2147483648
+	.word	-2147483648
+	.type	mask_cnst,#object
+	.size	mask_cnst,8
+
+	.section	".text",#alloc,#execinstr
+/* 000000	   0 */		.align	8
+!
+! CONSTANT POOL
+!
+                       .L_const_seg_900000106:
+/* 000000	   0 */		.word	1127219200,0
+/* 0x0008	     */		.word	1105199103,-4194304
+/* 0x0010	     */		.word	-1008730112,0
+/* 0x0018	   0 */		.align	4
+!
+! SUBROUTINE mul_add
+!
+! OFFSET    SOURCE LINE	LABEL	INSTRUCTION
+
+                       	.global mul_add
+                       mul_add:
+/* 000000	     */		sethi	%hi(0x2c00),%g1
+/* 0x0004	     */		sethi	%hi(mask_cnst),%g2
+/* 0x0008	     */		xor	%g1,-584,%g1
+/* 0x000c	     */		add	%g2,%lo(mask_cnst),%g2
+/* 0x0010	     */		save	%sp,%g1,%sp
+                       .L900000190:
+/* 0x0014	     */		call	.+8
+/* 0x0018	     */		sethi	/*X*/%hi(_GLOBAL_OFFSET_TABLE_-(.L900000190-.)),%g5
+! FILE mul_add.c
+
+!    1		      !/* Copyright (C) 1999, Sun Microsystems, Inc. */
+!    3		      !#include "vis_proto.h"
+!    5		      !/***************************************************************/
+!    7		      !typedef  int                t_s32;
+!    8		      !typedef  unsigned int       t_u32;
+!    9		      !#if defined(__sparcv9)
+!   10		      !typedef  long               t_s64;
+!   11		      !typedef  unsigned long      t_u64;
+!   12		      !#else
+!   13		      !typedef  long long          t_s64;
+!   14		      !typedef  unsigned long long t_u64;
+!   15		      !#endif
+!   16		      !typedef  double             t_d64;
+!   18		      !/***************************************************************/
+!   20		      !typedef union {
+!   21		      !  t_d64 d64;
+!   22		      !  struct {
+!   23		      !    t_s32 i0;
+!   24		      !    t_s32 i1;
+!   25		      !  } i32s;
+!   26		      !} d64_2_i32;
+!   28		      !/***************************************************************/
+!   30		      !#define BUFF_SIZE  256
+!   32		      !#define A_BITS  21
+!   33		      !#define A_MASK  ((1 << A_BITS) - 1)
+!   35		      !/***************************************************************/
+!   37		      !static t_u64 mask_cnst[] = {
+!   38		      !  0x8000000080000000ull
+!   39		      !};
+!   41		      !/***************************************************************/
+!   43		      !#define DEF_VARS(N)                     \
+!   44		      !  t_d64 *py = (t_d64*)y;                \
+!   45		      !  t_d64 mask = *((t_d64*)mask_cnst);    \
+!   46		      !  t_d64 ca = (1u << 31) - 1;            \
+!   47		      !  t_d64 da = (t_d64)a;                  \
+!   48		      !  t_s64 buff[N], s;                     \
+!   49		      !  d64_2_i32 dy
+!   51		      !/***************************************************************/
+!   53		      !#define MUL_U32_S64_1(i)                                        \
+!   54		      !  dy.f32s.i0 = vis_fxnors(vis_read_hi(mask), ((t_f32*)y)[0]);   \
+!   55		      !  buff[0] = (ca - (t_d64)dy.i32s.i0) * da
+!   57		      !#define MUL_U32_S64_1_D()                                       \
+!   58		      !  dy.f32s.i0 = vis_fxnors(vis_read_hi(mask), ((t_f32*)y)[0]);   \
+!   59		      !  d0 = ca - (t_d64)dy.i32s.i0;                                  \
+!   60		      !  buff[0] = (t_s64)(d0 * da);                                   \
+!   61		      !  buff[1] = (t_s64)(d0 * db);                                   \
+!   63		      !#define MUL_U32_S64_1_E(i)                                      \
+!   64		      !  dy.f32s.i0 = vis_fxnors(vis_read_hi(mask), ((t_f32*)y)[0]);   \
+!   65		      !  d0 = ca - (t_d64)dy.i32s.i0;                                  \
+!   66		      !  buff[0] = (t_s64)(d0 * da);                                   \
+!   67		      !  buff[1] = (t_s64)(d0 * db - (1ULL << 63))
+!   69		      !/************ ***************************************************/
+!   71		      !#define MUL_U32_S64_2(i)                                \
+!   72		      !  dy.d64 = vis_fxnor(mask, py[i]);                      \
+!   73		      !  buff[2*(i)  ] = (ca - (t_d64)dy.i32s.i0) * da;        \
+!   74		      !  buff[2*(i)+1] = (ca - (t_d64)dy.i32s.i1) * da
+!   76		      !#define MUL_U32_S64_2_D(i)              \
+!   77		      !  dy.d64 = vis_fxnor(mask, py[i]);      \
+!   78		      !  d0 = ca - (t_d64)dy.i32s.i0;          \
+!   79		      !  d1 = ca - (t_d64)dy.i32s.i1;          \
+!   80		      !  buff[4*(i)  ] = (t_s64)(d0 * da);     \
+!   81		      !  buff[4*(i)+1] = (t_s64)(d0 * db);     \
+!   82		      !  buff[4*(i)+2] = (t_s64)(d1 * da);     \
+!   83		      !  buff[4*(i)+3] = (t_s64)(d1 * db)
+!   85		      !#define MUL_U32_S64_2_E(i)                              \
+!   86		      !  dy.d64 = vis_fxnor(mask, py[i]);                      \
+!   87		      !  d0 = ca - (t_d64)dy.i32s.i0;                          \
+!   88		      !  d1 = ca - (t_d64)dy.i32s.i1;                          \
+!   89		      !  buff[4*(i)  ] = (t_s64)(d0 * da);                     \
+!   90		      !  buff[4*(i)+1] = (t_s64)(d0 * db - (1ULL << 63));      \
+!   91		      !  buff[4*(i)+2] = (t_s64)(d1 * da);                     \
+!   92		      !  buff[4*(i)+3] = (t_s64)(d1 * db - (1ULL << 63))
+!   94		      !/***************************************************************/
+!   96		      !#define ADD_S64_U32(i)          \
+!   97		      !  s = buff[i] + x[i] + c;       \
+!   98		      !  z[i] = s;                     \
+!   99		      !  c = (s >> 32)
+!  101		      !#define ADD_S64_U32_D(i)                        \
+!  102		      !  s = buff[2*(i)] + buff[2*(i)+1] + x[i] + c;   \
+!  103		      !  z[i] = s;                                     \
+!  104		      !  c = (s >> 32)
+!  106		      !#define ADD_S64_U32_E(i)                                        \
+!  107		      !  s =  buff[2*(i)] + buff[2*(i)+1] + x[i] + uc + (1ULL << 63);  \
+!  108		      !  z[i] = s;                                                     \
+!  109		      !  uc = ((t_u64)s >> 32)
+!  111		      !/***************************************************************/
+!  113		      !#define MUL_U32_S64_8(i)        \
+!  114		      !  MUL_U32_S64_2(i);             \
+!  115		      !  MUL_U32_S64_2(i+1);           \
+!  116		      !  MUL_U32_S64_2(i+2);           \
+!  117		      !  MUL_U32_S64_2(i+3)
+!  119		      !#define MUL_U32_S64_D_8(i)      \
+!  120		      !  MUL_U32_S64_2_D(i);           \
+!  121		      !  MUL_U32_S64_2_D(i+1);         \
+!  122		      !  MUL_U32_S64_2_D(i+2);         \
+!  123		      !  MUL_U32_S64_2_D(i+3)
+!  125		      !#define MUL_U32_S64_E_8(i)      \
+!  126		      !  MUL_U32_S64_2_E(i);           \
+!  127		      !  MUL_U32_S64_2_E(i+1);         \
+!  128		      !  MUL_U32_S64_2_E(i+2);         \
+!  129		      !  MUL_U32_S64_2_E(i+3)
+!  131		      !/***************************************************************/
+!  133		      !#define ADD_S64_U32_8(i)        \
+!  134		      !  ADD_S64_U32(i);               \
+!  135		      !  ADD_S64_U32(i+1);             \
+!  136		      !  ADD_S64_U32(i+2);             \
+!  137		      !  ADD_S64_U32(i+3);             \
+!  138		      !  ADD_S64_U32(i+4);             \
+!  139		      !  ADD_S64_U32(i+5);             \
+!  140		      !  ADD_S64_U32(i+6);             \
+!  141		      !  ADD_S64_U32(i+7)
+!  143		      !#define ADD_S64_U32_D_8(i)      \
+!  144		      !  ADD_S64_U32_D(i);             \
+!  145		      !  ADD_S64_U32_D(i+1);           \
+!  146		      !  ADD_S64_U32_D(i+2);           \
+!  147		      !  ADD_S64_U32_D(i+3);           \
+!  148		      !  ADD_S64_U32_D(i+4);           \
+!  149		      !  ADD_S64_U32_D(i+5);           \
+!  150		      !  ADD_S64_U32_D(i+6);           \
+!  151		      !  ADD_S64_U32_D(i+7)
+!  153		      !#define ADD_S64_U32_E_8(i)      \
+!  154		      !  ADD_S64_U32_E(i);             \
+!  155		      !  ADD_S64_U32_E(i+1);           \
+!  156		      !  ADD_S64_U32_E(i+2);           \
+!  157		      !  ADD_S64_U32_E(i+3);           \
+!  158		      !  ADD_S64_U32_E(i+4);           \
+!  159		      !  ADD_S64_U32_E(i+5);           \
+!  160		      !  ADD_S64_U32_E(i+6);           \
+!  161		      !  ADD_S64_U32_E(i+7)
+!  163		      !/***************************************************************/
+!  165		      !t_u32 mul_add(t_u32 *z, t_u32 *x, t_u32 *y, int n, t_u32 a)
+!  166		      !{
+!  167		      !  if (a < (1 << A_BITS)) {
+!  169		      !    if (n == 8) {
+!  170		      !      DEF_VARS(8);
+!  171		      !      t_s32 c = 0;
+!  173		      !      MUL_U32_S64_8(0);
+
+/* 0x001c	 173 */		sethi	%hi(.L_const_seg_900000106),%g3
+/* 0x0020	 166 */		add	%g5,/*X*/%lo(_GLOBAL_OFFSET_TABLE_-(.L900000190-.)),%g5
+/* 0x0024	     */		or	%g0,%i4,%o0
+/* 0x0028	     */		st	%o0,[%fp+84]
+/* 0x002c	     */		add	%g5,%o7,%o1
+/* 0x0030	     */		or	%g0,%i3,%o2
+/* 0x0034	     */		ld	[%o1+%g2],%g2
+/* 0x0038	 173 */		add	%g3,%lo(.L_const_seg_900000106),%g3
+/* 0x003c	 167 */		sethi	%hi(0x200000),%g4
+/* 0x0040	 173 */		ld	[%o1+%g3],%o1
+/* 0x0044	 166 */		or	%g0,%i0,%i4
+/* 0x0048	     */		or	%g0,%i2,%o7
+/* 0x004c	     */		ldd	[%g2],%f30
+/* 0x0050	     */		or	%g0,%i1,%o4
+/* 0x0054	 167 */		cmp	%o0,%g4
+/* 0x0058	 166 */		or	%g0,%o2,%o3
+/* 0x005c	 167 */		bcc,pn	%icc,.L77000062
+/* 0x0060	     */		or	%g0,%i4,%o5
+/* 0x0064	 169 */		cmp	%o2,8
+/* 0x0068	     */		bne,pn	%icc,.L77000051
+/* 0x006c	     */		ld	[%fp+84],%f7
+/* 0x0070	     */		ldd	[%o7],%f4
+/* 0x0074	 170 */		ldd	[%o1],%f8
+/* 0x0078	     */		fxnor	%f30,%f4,%f4
+/* 0x007c	 173 */		ldd	[%o1+8],%f14
+/* 0x0080	     */		ldd	[%o7+8],%f10
+/* 0x0084	     */		fitod	%f4,%f12
+/* 0x0088	     */		ldd	[%o7+16],%f16
+/* 0x008c	     */		fitod	%f5,%f4
+/* 0x0090	     */		ldd	[%o7+24],%f18
+/* 0x0094	     */		fxnor	%f30,%f10,%f10
+
+!  174		      !      ADD_S64_U32_8(0);
+
+/* 0x0098	 174 */		ld	[%i1],%g2
+/* 0x009c	     */		ld	[%i1+4],%g3
+/* 0x00a0	     */		fxnor	%f30,%f16,%f16
+/* 0x00a4	 173 */		fsubd	%f14,%f4,%f4
+/* 0x00a8	 174 */		ld	[%i1+8],%g4
+/* 0x00ac	     */		ld	[%i1+16],%o0
+/* 0x00b0	 173 */		fitod	%f16,%f20
+/* 0x00b4	 174 */		ld	[%i1+12],%g5
+/* 0x00b8	     */		ld	[%i1+20],%o1
+/* 0x00bc	     */		ld	[%i1+24],%o2
+/* 0x00c0	 170 */		fmovs	%f8,%f6
+/* 0x00c4	 174 */		ld	[%i1+28],%o3
+/* 0x00c8	 170 */		fsubd	%f6,%f8,%f6
+/* 0x00cc	 173 */		fsubd	%f14,%f12,%f8
+/* 0x00d0	     */		fitod	%f10,%f12
+/* 0x00d4	     */		fmuld	%f4,%f6,%f4
+/* 0x00d8	     */		fitod	%f11,%f10
+/* 0x00dc	     */		fmuld	%f8,%f6,%f8
+/* 0x00e0	     */		fsubd	%f14,%f12,%f12
+/* 0x00e4	     */		fdtox	%f4,%f4
+/* 0x00e8	     */		std	%f4,[%sp+360]
+/* 0x00ec	     */		fdtox	%f8,%f8
+/* 0x00f0	     */		std	%f8,[%sp+368]
+/* 0x00f4	     */		fmuld	%f12,%f6,%f12
+/* 0x00f8	     */		fsubd	%f14,%f10,%f10
+/* 0x00fc	     */		fsubd	%f14,%f20,%f4
+/* 0x0100	     */		fitod	%f17,%f8
+/* 0x0104	 174 */		ldx	[%sp+368],%o4
+/* 0x0108	     */		fxnor	%f30,%f18,%f16
+/* 0x010c	 173 */		fmuld	%f10,%f6,%f10
+/* 0x0110	     */		fdtox	%f12,%f12
+/* 0x0114	     */		std	%f12,[%sp+352]
+/* 0x0118	     */		fmuld	%f4,%f6,%f4
+/* 0x011c	     */		fitod	%f16,%f18
+/* 0x0120	 174 */		add	%o4,%g2,%g2
+/* 0x0124	     */		st	%g2,[%i4]
+/* 0x0128	     */		ldx	[%sp+360],%o4
+/* 0x012c	 173 */		fsubd	%f14,%f8,%f8
+/* 0x0130	 174 */		srax	%g2,32,%o5
+/* 0x0134	 173 */		fdtox	%f10,%f10
+/* 0x0138	     */		std	%f10,[%sp+344]
+/* 0x013c	     */		fdtox	%f4,%f4
+/* 0x0140	     */		std	%f4,[%sp+336]
+/* 0x0144	 174 */		add	%o4,%g3,%o4
+/* 0x0148	 173 */		fitod	%f17,%f12
+/* 0x014c	 174 */		ldx	[%sp+352],%g2
+/* 0x0150	     */		add	%o4,%o5,%g3
+/* 0x0154	 173 */		fmuld	%f8,%f6,%f8
+/* 0x0158	     */		fsubd	%f14,%f18,%f10
+/* 0x015c	 174 */		st	%g3,[%i4+4]
+/* 0x0160	     */		srax	%g3,32,%g3
+/* 0x0164	     */		add	%g2,%g4,%g4
+/* 0x0168	     */		ldx	[%sp+344],%g2
+/* 0x016c	 173 */		fsubd	%f14,%f12,%f4
+/* 0x0170	 174 */		add	%g4,%g3,%g3
+/* 0x0174	     */		ldx	[%sp+336],%g4
+/* 0x0178	 173 */		fmuld	%f10,%f6,%f10
+/* 0x017c	     */		fdtox	%f8,%f8
+/* 0x0180	     */		std	%f8,[%sp+328]
+/* 0x0184	 174 */		add	%g4,%o0,%g4
+/* 0x0188	     */		add	%g2,%g5,%g2
+/* 0x018c	     */		st	%g3,[%i4+8]
+/* 0x0190	 173 */		fmuld	%f4,%f6,%f4
+/* 0x0194	 174 */		srax	%g3,32,%o0
+/* 0x0198	     */		ldx	[%sp+328],%g5
+/* 0x019c	 173 */		fdtox	%f10,%f6
+/* 0x01a0	     */		std	%f6,[%sp+320]
+/* 0x01a4	 174 */		add	%g2,%o0,%g2
+/* 0x01a8	     */		srax	%g2,32,%g3
+/* 0x01ac	     */		st	%g2,[%i4+12]
+/* 0x01b0	     */		add	%g5,%o1,%o1
+/* 0x01b4	 173 */		fdtox	%f4,%f4
+/* 0x01b8	     */		std	%f4,[%sp+312]
+/* 0x01bc	 174 */		add	%g4,%g3,%g3
+/* 0x01c0	     */		srax	%g3,32,%g4
+/* 0x01c4	     */		st	%g3,[%i4+16]
+/* 0x01c8	     */		ldx	[%sp+320],%o0
+/* 0x01cc	     */		add	%o1,%g4,%g4
+/* 0x01d0	     */		ldx	[%sp+312],%g5
+/* 0x01d4	     */		srax	%g4,32,%g2
+/* 0x01d8	     */		add	%o0,%o2,%o2
+/* 0x01dc	     */		st	%g4,[%i4+20]
+/* 0x01e0	     */		add	%o2,%g2,%g2
+/* 0x01e4	     */		add	%g5,%o3,%g5
+/* 0x01e8	     */		st	%g2,[%i4+24]
+/* 0x01ec	     */		srax	%g2,32,%g3
+/* 0x01f0	     */		add	%g5,%g3,%g2
+/* 0x01f4	     */		st	%g2,[%i4+28]
+
+!  176		      !      return c;
+
+/* 0x01f8	 176 */		srax	%g2,32,%i0
+/* 0x01fc	     */		ret	! Result =  %i0
+/* 0x0200	     */		restore	%g0,%g0,%g0
+                       .L77000051:
+
+!  178		      !    } else if (n == 16) {
+
+/* 0x0204	 178 */		cmp	%o2,16
+/* 0x0208	     */		bne,pn	%icc,.L77000112
+/* 0x020c	     */		ld	[%fp+84],%f7
+/* 0x0210	     */		ldd	[%o7],%f4
+
+!  179		      !      DEF_VARS(16);
+
+/* 0x0214	 179 */		ldd	[%o1],%f8
+
+!  180		      !      t_s32 c = 0;
+!  182		      !      MUL_U32_S64_8(0);
+
+/* 0x0218	 182 */		ldd	[%o1+8],%f14
+/* 0x021c	     */		fxnor	%f30,%f4,%f4
+/* 0x0220	     */		ldd	[%o7+8],%f10
+/* 0x0224	     */		ldd	[%o7+16],%f16
+/* 0x0228	     */		fitod	%f4,%f12
+/* 0x022c	     */		ldd	[%o7+24],%f18
+/* 0x0230	     */		fitod	%f5,%f4
+/* 0x0234	     */		ldd	[%o7+32],%f20
+/* 0x0238	     */		fxnor	%f30,%f10,%f10
+/* 0x023c	     */		ldd	[%o7+40],%f22
+/* 0x0240	     */		fxnor	%f30,%f16,%f16
+/* 0x0244	     */		ldd	[%o7+48],%f0
+/* 0x0248	     */		fitod	%f10,%f24
+/* 0x024c	     */		ldd	[%o7+56],%f26
+/* 0x0250	     */		fsubd	%f14,%f4,%f4
+
+!  183		      !      MUL_U32_S64_8(4);
+!  184		      !      ADD_S64_U32_8(0);
+!  185		      !      ADD_S64_U32_8(8);
+
+/* 0x0254	 185 */		ld	[%i1+36],%o5
+/* 0x0258	 182 */		fitod	%f11,%f10
+/* 0x025c	 184 */		ld	[%i1],%g2
+/* 0x0260	 182 */		fsubd	%f14,%f24,%f24
+/* 0x0264	 185 */		stx	%o5,[%sp+312]
+/* 0x0268	 182 */		fitod	%f16,%f28
+/* 0x026c	 184 */		ld	[%i1+4],%g3
+/* 0x0270	 182 */		fsubd	%f14,%f10,%f10
+/* 0x0274	 185 */		ld	[%i1+40],%o5
+/* 0x0278	     */		fxnor	%f30,%f20,%f20
+/* 0x027c	 184 */		ld	[%i1+8],%g4
+/* 0x0280	     */		stx	%o5,[%sp+320]
+/* 0x0284	     */		ld	[%i1+12],%g5
+/* 0x0288	     */		ld	[%i1+16],%o0
+/* 0x028c	 179 */		fmovs	%f8,%f6
+/* 0x0290	 184 */		ld	[%i1+20],%o1
+/* 0x0294	 185 */		ld	[%i1+32],%o4
+/* 0x0298	 179 */		fsubd	%f6,%f8,%f6
+/* 0x029c	 184 */		ld	[%i1+24],%o2
+/* 0x02a0	 182 */		fsubd	%f14,%f12,%f8
+/* 0x02a4	 185 */		stx	%o4,[%sp+328]
+/* 0x02a8	     */		fxnor	%f30,%f0,%f12
+/* 0x02ac	 184 */		ld	[%i1+28],%o3
+/* 0x02b0	 182 */		fmuld	%f4,%f6,%f4
+/* 0x02b4	 185 */		ld	[%i1+44],%o4
+/* 0x02b8	 182 */		fmuld	%f8,%f6,%f8
+/* 0x02bc	     */		fmuld	%f24,%f6,%f24
+/* 0x02c0	 185 */		stx	%o4,[%sp+360]
+/* 0x02c4	 182 */		fdtox	%f4,%f4
+/* 0x02c8	     */		fmuld	%f10,%f6,%f10
+/* 0x02cc	     */		std	%f4,[%sp+496]
+/* 0x02d0	     */		fdtox	%f8,%f8
+/* 0x02d4	     */		std	%f8,[%sp+504]
+/* 0x02d8	     */		fitod	%f17,%f8
+/* 0x02dc	 185 */		ld	[%i1+60],%o4
+/* 0x02e0	     */		fxnor	%f30,%f18,%f16
+/* 0x02e4	 182 */		fdtox	%f24,%f24
+/* 0x02e8	     */		std	%f24,[%sp+488]
+/* 0x02ec	 184 */		ldx	[%sp+504],%o7
+/* 0x02f0	 182 */		fsubd	%f14,%f28,%f4
+/* 0x02f4	     */		fitod	%f16,%f18
+/* 0x02f8	     */		fsubd	%f14,%f8,%f8
+/* 0x02fc	 184 */		add	%o7,%g2,%g2
+/* 0x0300	     */		st	%g2,[%i4]
+/* 0x0304	     */		ldx	[%sp+496],%o7
+/* 0x0308	 182 */		fitod	%f17,%f16
+/* 0x030c	 184 */		srax	%g2,32,%o5
+/* 0x0310	 182 */		fmuld	%f4,%f6,%f4
+/* 0x0314	     */		fsubd	%f14,%f18,%f18
+/* 0x0318	     */		fdtox	%f10,%f10
+/* 0x031c	     */		std	%f10,[%sp+480]
+/* 0x0320	 184 */		add	%o7,%g3,%g3
+/* 0x0324	 182 */		fmuld	%f8,%f6,%f24
+/* 0x0328	 183 */		fitod	%f20,%f8
+/* 0x032c	 184 */		add	%g3,%o5,%g3
+/* 0x0330	 185 */		ld	[%i1+48],%o5
+/* 0x0334	 184 */		st	%g3,[%i4+4]
+/* 0x0338	 182 */		fdtox	%f4,%f4
+/* 0x033c	     */		fmuld	%f18,%f6,%f10
+/* 0x0340	 184 */		ldx	[%sp+488],%o7
+/* 0x0344	     */		fxnor	%f30,%f22,%f18
+/* 0x0348	 182 */		std	%f4,[%sp+472]
+/* 0x034c	     */		fsubd	%f14,%f16,%f4
+/* 0x0350	 184 */		stx	%o5,[%sp+344]
+/* 0x0354	 183 */		fitod	%f21,%f16
+/* 0x0358	 184 */		srax	%g3,32,%o5
+/* 0x035c	 183 */		fsubd	%f14,%f8,%f8
+/* 0x0360	 184 */		add	%o7,%g4,%g4
+/* 0x0364	 185 */		ld	[%i1+52],%o7
+/* 0x0368	 182 */		fdtox	%f24,%f20
+/* 0x036c	     */		std	%f20,[%sp+464]
+/* 0x0370	 184 */		add	%g4,%o5,%g4
+/* 0x0374	 182 */		fmuld	%f4,%f6,%f4
+/* 0x0378	 184 */		stx	%o7,[%sp+336]
+/* 0x037c	 182 */		fdtox	%f10,%f10
+/* 0x0380	 184 */		ldx	[%sp+480],%o7
+/* 0x0384	 183 */		fitod	%f18,%f20
+/* 0x0388	     */		fmuld	%f8,%f6,%f8
+/* 0x038c	 182 */		std	%f10,[%sp+456]
+/* 0x0390	 183 */		fsubd	%f14,%f16,%f10
+/* 0x0394	 185 */		ld	[%i1+56],%o5
+/* 0x0398	 183 */		fitod	%f19,%f16
+/* 0x039c	 184 */		add	%o7,%g5,%g5
+/* 0x03a0	     */		ldx	[%sp+472],%o7
+/* 0x03a4	 182 */		fdtox	%f4,%f4
+/* 0x03a8	 184 */		stx	%o5,[%sp+352]
+/* 0x03ac	     */		srax	%g4,32,%o5
+/* 0x03b0	 183 */		fdtox	%f8,%f8
+/* 0x03b4	 182 */		std	%f4,[%sp+448]
+/* 0x03b8	 183 */		fitod	%f12,%f18
+/* 0x03bc	 184 */		add	%g5,%o5,%g5
+/* 0x03c0	 183 */		fmuld	%f10,%f6,%f4
+/* 0x03c4	 184 */		ldx	[%sp+464],%o5
+/* 0x03c8	 183 */		fsubd	%f14,%f20,%f10
+/* 0x03cc	 184 */		add	%o7,%o0,%o0
+/* 0x03d0	 183 */		std	%f8,[%sp+440]
+/* 0x03d4	 184 */		srax	%g5,32,%o7
+/* 0x03d8	 183 */		fsubd	%f14,%f16,%f8
+/* 0x03dc	 184 */		ldx	[%sp+456],%g2
+/* 0x03e0	 183 */		fdtox	%f4,%f4
+/* 0x03e4	 184 */		add	%o0,%o7,%o0
+/* 0x03e8	 183 */		std	%f4,[%sp+432]
+/* 0x03ec	     */		fxnor	%f30,%f26,%f16
+/* 0x03f0	 184 */		add	%o5,%o1,%o1
+/* 0x03f4	 183 */		fmuld	%f10,%f6,%f10
+/* 0x03f8	 184 */		ldx	[%sp+448],%o7
+/* 0x03fc	     */		srax	%o0,32,%o5
+/* 0x0400	 183 */		fitod	%f13,%f12
+/* 0x0404	     */		fmuld	%f8,%f6,%f4
+/* 0x0408	 184 */		st	%g4,[%i4+8]
+/* 0x040c	 183 */		fsubd	%f14,%f18,%f8
+/* 0x0410	 184 */		add	%o1,%o5,%g3
+/* 0x0414	 185 */		ldx	[%sp+440],%o1
+/* 0x0418	 183 */		fitod	%f16,%f18
+/* 0x041c	 184 */		add	%g2,%o2,%g2
+/* 0x0420	     */		st	%g5,[%i4+12]
+/* 0x0424	     */		srax	%g3,32,%o2
+/* 0x0428	 183 */		fdtox	%f10,%f10
+/* 0x042c	     */		std	%f10,[%sp+424]
+/* 0x0430	     */		fsubd	%f14,%f12,%f10
+/* 0x0434	 184 */		add	%g2,%o2,%o2
+/* 0x0438	 183 */		fmuld	%f8,%f6,%f8
+/* 0x043c	 185 */		ldx	[%sp+328],%g2
+/* 0x0440	 183 */		fdtox	%f4,%f4
+/* 0x0444	 184 */		add	%o7,%o3,%g4
+/* 0x0448	 183 */		std	%f4,[%sp+416]
+/* 0x044c	 184 */		srax	%o2,32,%o3
+/* 0x0450	 183 */		fitod	%f17,%f12
+/* 0x0454	 185 */		ldx	[%sp+432],%g5
+/* 0x0458	 184 */		add	%g4,%o3,%o3
+/* 0x045c	 185 */		add	%o1,%g2,%o1
+/* 0x0460	 183 */		fsubd	%f14,%f18,%f4
+/* 0x0464	 185 */		ldx	[%sp+312],%o5
+/* 0x0468	     */		srax	%o3,32,%g4
+/* 0x046c	 183 */		fdtox	%f8,%f8
+/* 0x0470	     */		fmuld	%f10,%f6,%f10
+/* 0x0474	     */		std	%f8,[%sp+408]
+/* 0x0478	 185 */		add	%o1,%g4,%o1
+/* 0x047c	 183 */		fsubd	%f14,%f12,%f8
+/* 0x0480	 185 */		ldx	[%sp+424],%o7
+/* 0x0484	     */		add	%g5,%o5,%g2
+/* 0x0488	 183 */		fmuld	%f4,%f6,%f4
+/* 0x048c	 185 */		ldx	[%sp+320],%g4
+/* 0x0490	     */		srax	%o1,32,%g5
+/* 0x0494	 183 */		fdtox	%f10,%f10
+/* 0x0498	 184 */		st	%g3,[%i4+20]
+/* 0x049c	 185 */		add	%g2,%g5,%g2
+/* 0x04a0	 183 */		fmuld	%f8,%f6,%f6
+/* 0x04a4	 185 */		ldx	[%sp+360],%o5
+/* 0x04a8	     */		srax	%g2,32,%g5
+/* 0x04ac	     */		add	%o7,%g4,%g4
+/* 0x04b0	     */		ldx	[%sp+416],%g3
+/* 0x04b4	     */		add	%g4,%g5,%g4
+/* 0x04b8	 183 */		fdtox	%f4,%f4
+/* 0x04bc	     */		std	%f10,[%sp+400]
+/* 0x04c0	 184 */		st	%o0,[%i4+16]
+/* 0x04c4	 185 */		add	%g3,%o5,%g3
+/* 0x04c8	 183 */		std	%f4,[%sp+392]
+/* 0x04cc	 185 */		srax	%g4,32,%o5
+/* 0x04d0	 183 */		fdtox	%f6,%f4
+/* 0x04d4	 185 */		ldx	[%sp+344],%o7
+/* 0x04d8	     */		add	%g3,%o5,%g3
+/* 0x04dc	     */		stx	%g3,[%sp+368]
+/* 0x04e0	     */		srax	%g3,32,%o5
+/* 0x04e4	     */		ldx	[%sp+408],%o0
+/* 0x04e8	     */		ldx	[%sp+400],%g5
+/* 0x04ec	     */		ldx	[%sp+336],%g3
+/* 0x04f0	     */		add	%o0,%o7,%o0
+/* 0x04f4	 183 */		std	%f4,[%sp+384]
+/* 0x04f8	 185 */		add	%g5,%g3,%g3
+/* 0x04fc	     */		add	%o0,%o5,%g5
+/* 0x0500	     */		stx	%g5,[%sp+376]
+/* 0x0504	     */		ldx	[%sp+392],%o7
+/* 0x0508	     */		srax	%g5,32,%o0
+/* 0x050c	     */		ldx	[%sp+352],%g5
+/* 0x0510	     */		add	%g3,%o0,%g3
+/* 0x0514	     */		ldx	[%sp+384],%o5
+/* 0x0518	     */		add	%o7,%g5,%g5
+/* 0x051c	 184 */		st	%o2,[%i4+24]
+/* 0x0520	 185 */		srax	%g3,32,%o2
+/* 0x0524	     */		st	%o1,[%i4+32]
+/* 0x0528	     */		add	%g5,%o2,%g5
+/* 0x052c	     */		add	%o5,%o4,%o0
+/* 0x0530	     */		st	%g2,[%i4+36]
+/* 0x0534	     */		srax	%g5,32,%g2
+/* 0x0538	     */		ldx	[%sp+368],%o1
+/* 0x053c	     */		ldx	[%sp+376],%o2
+/* 0x0540	     */		st	%g4,[%i4+40]
+/* 0x0544	     */		add	%o0,%g2,%g4
+/* 0x0548	 184 */		st	%o3,[%i4+28]
+
+!  187		      !      return c;
+
+/* 0x054c	 187 */		srax	%g4,32,%i0
+/* 0x0550	 185 */		st	%o1,[%i4+44]
+/* 0x0554	     */		st	%o2,[%i4+48]
+/* 0x0558	     */		st	%g3,[%i4+52]
+/* 0x055c	     */		st	%g5,[%i4+56]
+/* 0x0560	     */		st	%g4,[%i4+60]
+/* 0x0564	     */		ret	! Result =  %i0
+/* 0x0568	     */		restore	%g0,%g0,%g0
+                       .L77000112:
+
+!  189		      !    } else {
+!  190		      !      DEF_VARS(BUFF_SIZE);
+
+/* 0x056c	 190 */		ldd	[%o1],%f8
+
+!  191		      !      t_s32 i, c = 0;
+!  193		      !#pragma pipeloop(0)
+!  194		      !      for (i = 0; i < (n+1)/2; i ++) {
+
+/* 0x0570	 194 */		add	%o2,1,%g2
+/* 0x0574	 191 */		or	%g0,0,%i0
+/* 0x0578	 194 */		srl	%g2,31,%g3
+/* 0x057c	 190 */		ldd	[%o1+8],%f18
+/* 0x0580	 187 */		or	%g0,%o7,%g4
+/* 0x0584	 190 */		fmovs	%f8,%f6
+/* 0x0588	 194 */		add	%g2,%g3,%g2
+/* 0x058c	 187 */		add	%fp,-2264,%g3
+/* 0x0590	 194 */		sra	%g2,1,%o0
+/* 0x0594	 187 */		add	%fp,-2256,%o7
+/* 0x0598	 190 */		fsubd	%f6,%f8,%f16
+/* 0x059c	 194 */		cmp	%o0,0
+/* 0x05a0	     */		ble,pt	%icc,.L900000199
+/* 0x05a4	     */		cmp	%o3,0
+/* 0x05a8	 187 */		sub	%o0,1,%g2
+/* 0x05ac	     */		add	%g2,1,%o1
+/* 0x05b0	 194 */		or	%g0,0,%o0
+/* 0x05b4	     */		cmp	%o1,8
+/* 0x05b8	     */		bl,pn	%icc,.L77000113
+/* 0x05bc	     */		sub	%g2,2,%o2
+/* 0x05c0	     */		ldd	[%g4],%f2
+
+!  195		      !        MUL_U32_S64_2(i);
+
+/* 0x05c4	 195 */		or	%g0,5,%o0
+/* 0x05c8	     */		ldd	[%g4+8],%f0
+/* 0x05cc	     */		add	%g4,24,%o1
+/* 0x05d0	     */		add	%g4,16,%g4
+/* 0x05d4	     */		fxnor	%f30,%f2,%f4
+/* 0x05d8	     */		ldd	[%g4],%f2
+/* 0x05dc	     */		fxnor	%f30,%f0,%f6
+/* 0x05e0	     */		ldd	[%g4+8],%f10
+/* 0x05e4	     */		add	%g4,16,%o1
+/* 0x05e8	     */		fitod	%f5,%f0
+/* 0x05ec	     */		ldd	[%g4+16],%f12
+/* 0x05f0	     */		fitod	%f4,%f4
+/* 0x05f4	     */		fxnor	%f30,%f2,%f8
+/* 0x05f8	     */		fitod	%f7,%f2
+/* 0x05fc	     */		fsubd	%f18,%f0,%f0
+/* 0x0600	     */		fsubd	%f18,%f4,%f4
+/* 0x0604	     */		fxnor	%f30,%f10,%f10
+                       .L900000177:
+/* 0x0608	 195 */		fitod	%f9,%f22
+/* 0x060c	     */		add	%o0,3,%o0
+/* 0x0610	     */		add	%o7,48,%o7
+/* 0x0614	     */		fmuld	%f0,%f16,%f0
+/* 0x0618	     */		fmuld	%f4,%f16,%f24
+/* 0x061c	     */		cmp	%o0,%o2
+/* 0x0620	     */		add	%g3,48,%g3
+/* 0x0624	     */		fsubd	%f18,%f2,%f2
+/* 0x0628	     */		fitod	%f6,%f4
+/* 0x062c	     */		fdtox	%f0,%f0
+/* 0x0630	     */		ldd	[%o1+8],%f20
+/* 0x0634	     */		fdtox	%f24,%f6
+/* 0x0638	     */		fsubd	%f18,%f4,%f4
+/* 0x063c	     */		std	%f6,[%g3-48]
+/* 0x0640	     */		fxnor	%f30,%f12,%f6
+/* 0x0644	     */		std	%f0,[%o7-48]
+/* 0x0648	     */		fitod	%f11,%f0
+/* 0x064c	     */		fmuld	%f2,%f16,%f2
+/* 0x0650	     */		fmuld	%f4,%f16,%f24
+/* 0x0654	     */		fsubd	%f18,%f22,%f12
+/* 0x0658	     */		fitod	%f8,%f4
+/* 0x065c	     */		fdtox	%f2,%f2
+/* 0x0660	     */		add	%o1,16,%o1
+/* 0x0664	     */		ldd	[%o1],%f22
+/* 0x0668	     */		fdtox	%f24,%f8
+/* 0x066c	     */		fsubd	%f18,%f4,%f4
+/* 0x0670	     */		std	%f8,[%g3-32]
+/* 0x0674	     */		fxnor	%f30,%f20,%f8
+/* 0x0678	     */		std	%f2,[%o7-32]
+/* 0x067c	     */		fitod	%f7,%f2
+/* 0x0680	     */		fmuld	%f12,%f16,%f12
+/* 0x0684	     */		fmuld	%f4,%f16,%f24
+/* 0x0688	     */		fsubd	%f18,%f0,%f0
+/* 0x068c	     */		fitod	%f10,%f4
+/* 0x0690	     */		fdtox	%f12,%f20
+/* 0x0694	     */		add	%o1,8,%o1
+/* 0x0698	     */		ldd	[%o1],%f12
+/* 0x069c	     */		fdtox	%f24,%f10
+/* 0x06a0	     */		fsubd	%f18,%f4,%f4
+/* 0x06a4	     */		std	%f10,[%g3-16]
+/* 0x06a8	     */		fxnor	%f30,%f22,%f10
+/* 0x06ac	     */		ble,pt	%icc,.L900000177
+/* 0x06b0	     */		std	%f20,[%o7-16]
+                       .L900000180:
+/* 0x06b4	 195 */		fitod	%f6,%f6
+/* 0x06b8	     */		fmuld	%f4,%f16,%f24
+/* 0x06bc	     */		add	%g3,80,%g3
+/* 0x06c0	     */		fsubd	%f18,%f2,%f2
+/* 0x06c4	     */		fmuld	%f0,%f16,%f22
+/* 0x06c8	     */		add	%o7,80,%o7
+/* 0x06cc	     */		fitod	%f8,%f26
+/* 0x06d0	     */		cmp	%o0,%g2
+/* 0x06d4	     */		add	%o1,8,%g4
+/* 0x06d8	     */		fsubd	%f18,%f6,%f4
+/* 0x06dc	     */		fitod	%f9,%f8
+/* 0x06e0	     */		fxnor	%f30,%f12,%f0
+/* 0x06e4	     */		fmuld	%f2,%f16,%f12
+/* 0x06e8	     */		fitod	%f10,%f6
+/* 0x06ec	     */		fmuld	%f4,%f16,%f20
+/* 0x06f0	     */		fitod	%f11,%f4
+/* 0x06f4	     */		fsubd	%f18,%f26,%f10
+/* 0x06f8	     */		fitod	%f0,%f2
+/* 0x06fc	     */		fsubd	%f18,%f8,%f8
+/* 0x0700	     */		fitod	%f1,%f0
+/* 0x0704	     */		fmuld	%f10,%f16,%f10
+/* 0x0708	     */		fdtox	%f24,%f24
+/* 0x070c	     */		std	%f24,[%g3-80]
+/* 0x0710	     */		fsubd	%f18,%f6,%f6
+/* 0x0714	     */		fmuld	%f8,%f16,%f8
+/* 0x0718	     */		fdtox	%f22,%f22
+/* 0x071c	     */		std	%f22,[%o7-80]
+/* 0x0720	     */		fsubd	%f18,%f4,%f4
+/* 0x0724	     */		fdtox	%f20,%f20
+/* 0x0728	     */		std	%f20,[%g3-64]
+/* 0x072c	     */		fmuld	%f6,%f16,%f6
+/* 0x0730	     */		fsubd	%f18,%f2,%f2
+/* 0x0734	     */		fsubd	%f18,%f0,%f0
+/* 0x0738	     */		fmuld	%f4,%f16,%f4
+/* 0x073c	     */		fdtox	%f12,%f12
+/* 0x0740	     */		std	%f12,[%o7-64]
+/* 0x0744	     */		fdtox	%f10,%f10
+/* 0x0748	     */		std	%f10,[%g3-48]
+/* 0x074c	     */		fmuld	%f2,%f16,%f2
+/* 0x0750	     */		fdtox	%f8,%f8
+/* 0x0754	     */		std	%f8,[%o7-48]
+/* 0x0758	     */		fmuld	%f0,%f16,%f0
+/* 0x075c	     */		fdtox	%f6,%f6
+/* 0x0760	     */		std	%f6,[%g3-32]
+/* 0x0764	     */		fdtox	%f4,%f4
+/* 0x0768	     */		std	%f4,[%o7-32]
+/* 0x076c	     */		fdtox	%f2,%f2
+/* 0x0770	     */		std	%f2,[%g3-16]
+/* 0x0774	     */		fdtox	%f0,%f0
+/* 0x0778	     */		bg,pn	%icc,.L77000057
+/* 0x077c	     */		std	%f0,[%o7-16]
+                       .L77000113:
+/* 0x0780	     */		ldd	[%g4],%f0
+                       .L900000198:
+/* 0x0784	     */		fxnor	%f30,%f0,%f0
+/* 0x0788	 195 */		add	%o0,1,%o0
+/* 0x078c	     */		add	%g4,8,%g4
+/* 0x0790	     */		cmp	%o0,%g2
+/* 0x0794	     */		fitod	%f0,%f2
+/* 0x0798	     */		fitod	%f1,%f0
+/* 0x079c	     */		fsubd	%f18,%f2,%f2
+/* 0x07a0	     */		fsubd	%f18,%f0,%f0
+/* 0x07a4	     */		fmuld	%f2,%f16,%f2
+/* 0x07a8	     */		fmuld	%f0,%f16,%f0
+/* 0x07ac	     */		fdtox	%f2,%f2
+/* 0x07b0	     */		std	%f2,[%g3]
+/* 0x07b4	     */		add	%g3,16,%g3
+/* 0x07b8	     */		fdtox	%f0,%f0
+/* 0x07bc	     */		std	%f0,[%o7]
+/* 0x07c0	     */		add	%o7,16,%o7
+/* 0x07c4	     */		ble,a,pt	%icc,.L900000198
+/* 0x07c8	     */		ldd	[%g4],%f0
+                       .L77000057:
+
+!  196		      !      }
+!  198		      !#pragma pipeloop(0)
+!  199		      !      for (i = 0; i < n; i ++) {
+
+/* 0x07cc	 199 */		cmp	%o3,0
+                       .L900000199:
+/* 0x07d0	 199 */		ble,pt	%icc,.L77000089
+/* 0x07d4	     */		nop
+/* 0x07d8	     */		or	%g0,%o4,%g2
+/* 0x07dc	     */		or	%g0,%o5,%o4
+/* 0x07e0	     */		sub	%o3,1,%o7
+/* 0x07e4	     */		or	%g0,0,%g4
+/* 0x07e8	     */		add	%fp,-2264,%g3
+/* 0x07ec	 195 */		cmp	%o3,5
+/* 0x07f0	     */		sub	%o3,3,%o3
+/* 0x07f4	     */		bl,pn	%icc,.L77000114
+/* 0x07f8	     */		ldx	[%fp-2264],%o0
+
+!  200		      !        ADD_S64_U32(i);
+
+/* 0x07fc	 200 */		add	%o5,4,%o4
+/* 0x0800	   0 */		add	%fp,-2248,%g3
+/* 0x0804	 200 */		ld	[%g2],%o1
+/* 0x0808	     */		sra	%i0,0,%o5
+/* 0x080c	     */		or	%g0,2,%g4
+/* 0x0810	     */		ld	[%g2+4],%o2
+/* 0x0814	     */		add	%g2,8,%g2
+/* 0x0818	     */		add	%o0,%o1,%o0
+/* 0x081c	     */		ldx	[%fp-2256],%o1
+/* 0x0820	     */		add	%o0,%o5,%o0
+/* 0x0824	     */		st	%o0,[%o4-4]
+/* 0x0828	     */		srax	%o0,32,%o0
+                       .L900000173:
+/* 0x082c	 200 */		ldx	[%g3],%g5
+/* 0x0830	     */		sra	%o0,0,%o5
+/* 0x0834	     */		add	%o1,%o2,%o0
+/* 0x0838	     */		ld	[%g2],%o1
+/* 0x083c	     */		add	%o0,%o5,%o0
+/* 0x0840	     */		add	%g4,3,%g4
+/* 0x0844	     */		st	%o0,[%o4]
+/* 0x0848	     */		srax	%o0,32,%i0
+/* 0x084c	     */		cmp	%g4,%o3
+/* 0x0850	     */		ldx	[%g3+8],%o0
+/* 0x0854	     */		sra	%i0,0,%o5
+/* 0x0858	     */		add	%g5,%o1,%o1
+/* 0x085c	     */		ld	[%g2+4],%o2
+/* 0x0860	     */		add	%o1,%o5,%o1
+/* 0x0864	     */		add	%o4,12,%o4
+/* 0x0868	     */		st	%o1,[%o4-8]
+/* 0x086c	     */		srax	%o1,32,%o5
+/* 0x0870	     */		add	%g2,12,%g2
+/* 0x0874	     */		ldx	[%g3+16],%o1
+/* 0x0878	     */		add	%o0,%o2,%o0
+/* 0x087c	     */		ld	[%g2-4],%o2
+/* 0x0880	     */		add	%o0,%o5,%o0
+/* 0x0884	     */		add	%g3,24,%g3
+/* 0x0888	     */		st	%o0,[%o4-4]
+/* 0x088c	     */		ble,pt	%icc,.L900000173
+/* 0x0890	     */		srax	%o0,32,%o0
+                       .L900000176:
+/* 0x0894	 200 */		sra	%o0,0,%o3
+/* 0x0898	     */		add	%o1,%o2,%o0
+/* 0x089c	     */		add	%o0,%o3,%o0
+/* 0x08a0	     */		add	%o4,4,%o4
+/* 0x08a4	     */		st	%o0,[%o4-4]
+/* 0x08a8	     */		cmp	%g4,%o7
+/* 0x08ac	     */		bg,pn	%icc,.L77000089
+/* 0x08b0	     */		srax	%o0,32,%i0
+                       .L77000114:
+/* 0x08b4	 200 */		ld	[%g2],%o2
+                       .L900000197:
+/* 0x08b8	 200 */		ldx	[%g3],%o0
+/* 0x08bc	     */		sra	%i0,0,%o1
+/* 0x08c0	     */		add	%g4,1,%g4
+/* 0x08c4	     */		add	%g2,4,%g2
+/* 0x08c8	     */		add	%g3,8,%g3
+/* 0x08cc	     */		add	%o0,%o2,%o0
+/* 0x08d0	     */		cmp	%g4,%o7
+/* 0x08d4	     */		add	%o0,%o1,%o0
+/* 0x08d8	     */		st	%o0,[%o4]
+/* 0x08dc	     */		add	%o4,4,%o4
+/* 0x08e0	     */		srax	%o0,32,%i0
+/* 0x08e4	     */		ble,a,pt	%icc,.L900000197
+/* 0x08e8	     */		ld	[%g2],%o2
+                       .L77000061:
+/* 0x08ec	     */		ret	! Result =  %i0
+/* 0x08f0	     */		restore	%g0,%g0,%g0
+                       .L77000062:
+/* 0x08f4	     */		sethi	%hi(0x80000000),%g2
+
+!  201		      !      }
+!  203		      !      return c;
+!  205		      !    }
+!  206		      !  } else if (a < (1u << 31)) {
+!  208		      !    if (n == 8) {
+!  209		      !      DEF_VARS(2*8);
+!  210		      !      t_d64 d0, d1, db;
+!  211		      !      t_s32 c = 0;
+!  213		      !      da = (t_d64)(a &  A_MASK);
+
+/* 0x08f8	 213 */		ldd	[%o1],%f6
+/* 0x08fc	 206 */		cmp	%o0,%g2
+/* 0x0900	     */		bcc,pn	%icc,.L77000076
+/* 0x0904	     */		cmp	%o2,8
+/* 0x0908	 208 */		bne,pn	%icc,.L77000065
+/* 0x090c	     */		sethi	%hi(0xffe00000),%g2
+/* 0x0910	 213 */		fmovs	%f6,%f10
+/* 0x0914	     */		ldd	[%o7],%f4
+
+!  214		      !      db = (t_d64)(a &~ A_MASK);
+
+/* 0x0918	 214 */		fmovs	%f6,%f12
+/* 0x091c	     */		or	%g0,%g2,%g3
+/* 0x0920	     */		ldd	[%o7+8],%f14
+/* 0x0924	 213 */		andn	%o0,%g2,%g2
+/* 0x0928	 214 */		and	%o0,%g3,%g3
+/* 0x092c	 213 */		st	%g2,[%sp+460]
+/* 0x0930	     */		fxnor	%f30,%f4,%f4
+/* 0x0934	 214 */		st	%g3,[%sp+456]
+/* 0x0938	     */		fxnor	%f30,%f14,%f14
+
+!  216		      !      MUL_U32_S64_D_8(0);
+
+/* 0x093c	 216 */		ldd	[%o1+8],%f16
+/* 0x0940	     */		fitod	%f4,%f8
+/* 0x0944	     */		ldd	[%o7+16],%f18
+/* 0x0948	     */		fitod	%f5,%f4
+/* 0x094c	     */		ldd	[%o7+24],%f20
+/* 0x0950	 213 */		ld	[%sp+460],%f11
+/* 0x0954	 216 */		fsubd	%f16,%f8,%f8
+/* 0x0958	 214 */		ld	[%sp+456],%f13
+/* 0x095c	 216 */		fsubd	%f16,%f4,%f4
+
+!  217		      !      ADD_S64_U32_D_8(0);
+
+/* 0x0960	 217 */		ld	[%i1],%g2
+/* 0x0964	 213 */		fsubd	%f10,%f6,%f10
+/* 0x0968	 217 */		ld	[%i1+28],%o3
+/* 0x096c	 214 */		fsubd	%f12,%f6,%f6
+/* 0x0970	 217 */		ld	[%i1+4],%g3
+/* 0x0974	 216 */		fitod	%f14,%f12
+/* 0x0978	 217 */		stx	%o3,[%sp+312]
+/* 0x097c	 216 */		fitod	%f15,%f14
+/* 0x0980	     */		fmuld	%f4,%f10,%f24
+/* 0x0984	 217 */		ld	[%i1+8],%g4
+/* 0x0988	     */		fxnor	%f30,%f18,%f18
+/* 0x098c	 216 */		fmuld	%f8,%f10,%f22
+/* 0x0990	 217 */		ld	[%i1+12],%g5
+/* 0x0994	 216 */		fsubd	%f16,%f12,%f12
+/* 0x0998	     */		fmuld	%f4,%f6,%f4
+/* 0x099c	 217 */		ld	[%i1+16],%o0
+/* 0x09a0	 216 */		fitod	%f18,%f26
+/* 0x09a4	     */		fmuld	%f8,%f6,%f8
+/* 0x09a8	 217 */		ld	[%i1+20],%o1
+/* 0x09ac	 216 */		fsubd	%f16,%f14,%f14
+/* 0x09b0	 217 */		ld	[%i1+24],%o2
+/* 0x09b4	 216 */		fdtox	%f4,%f4
+/* 0x09b8	     */		fmuld	%f12,%f10,%f28
+/* 0x09bc	     */		std	%f4,[%sp+424]
+/* 0x09c0	     */		fdtox	%f8,%f8
+/* 0x09c4	     */		fmuld	%f12,%f6,%f12
+/* 0x09c8	     */		std	%f8,[%sp+440]
+/* 0x09cc	     */		fsubd	%f16,%f26,%f4
+/* 0x09d0	     */		fitod	%f19,%f8
+/* 0x09d4	     */		fmuld	%f14,%f10,%f18
+/* 0x09d8	     */		fdtox	%f12,%f12
+/* 0x09dc	     */		std	%f12,[%sp+408]
+/* 0x09e0	     */		fmuld	%f14,%f6,%f14
+/* 0x09e4	 217 */		ldx	[%sp+440],%o5
+/* 0x09e8	 216 */		fdtox	%f22,%f22
+/* 0x09ec	     */		fmuld	%f4,%f10,%f12
+/* 0x09f0	     */		std	%f22,[%sp+448]
+/* 0x09f4	     */		fxnor	%f30,%f20,%f20
+/* 0x09f8	     */		fmuld	%f4,%f6,%f4
+/* 0x09fc	     */		fdtox	%f24,%f22
+/* 0x0a00	     */		std	%f22,[%sp+432]
+/* 0x0a04	 217 */		ldx	[%sp+448],%o4
+/* 0x0a08	 216 */		fsubd	%f16,%f8,%f8
+/* 0x0a0c	     */		fitod	%f20,%f22
+/* 0x0a10	     */		fdtox	%f14,%f14
+/* 0x0a14	     */		std	%f14,[%sp+392]
+/* 0x0a18	 217 */		add	%o4,%o5,%o4
+/* 0x0a1c	     */		ldx	[%sp+432],%o5
+/* 0x0a20	 216 */		fdtox	%f28,%f24
+/* 0x0a24	 217 */		add	%o4,%g2,%o4
+/* 0x0a28	 216 */		fmuld	%f8,%f10,%f14
+/* 0x0a2c	     */		std	%f24,[%sp+416]
+/* 0x0a30	 217 */		srax	%o4,32,%o7
+/* 0x0a34	 216 */		fitod	%f21,%f20
+/* 0x0a38	     */		fmuld	%f8,%f6,%f8
+/* 0x0a3c	 217 */		stx	%o4,[%sp+320]
+/* 0x0a40	 216 */		fdtox	%f4,%f4
+/* 0x0a44	     */		std	%f4,[%sp+376]
+/* 0x0a48	     */		fdtox	%f18,%f18
+/* 0x0a4c	     */		std	%f18,[%sp+400]
+/* 0x0a50	     */		fsubd	%f16,%f20,%f4
+/* 0x0a54	 217 */		ldx	[%sp+424],%g2
+/* 0x0a58	 216 */		fsubd	%f16,%f22,%f18
+/* 0x0a5c	 217 */		ldx	[%sp+416],%o3
+/* 0x0a60	 216 */		fdtox	%f12,%f12
+/* 0x0a64	     */		std	%f12,[%sp+384]
+/* 0x0a68	 217 */		add	%o5,%g2,%g2
+/* 0x0a6c	 216 */		fdtox	%f14,%f14
+/* 0x0a70	 217 */		ldx	[%sp+408],%o4
+/* 0x0a74	     */		add	%g2,%g3,%g2
+/* 0x0a78	 216 */		fdtox	%f8,%f8
+/* 0x0a7c	     */		fmuld	%f18,%f10,%f12
+/* 0x0a80	     */		std	%f14,[%sp+368]
+/* 0x0a84	 217 */		add	%g2,%o7,%g2
+/* 0x0a88	 216 */		fmuld	%f4,%f10,%f14
+/* 0x0a8c	     */		std	%f8,[%sp+360]
+/* 0x0a90	 217 */		srax	%g2,32,%o5
+/* 0x0a94	     */		add	%o3,%o4,%o3
+/* 0x0a98	 216 */		fmuld	%f18,%f6,%f16
+/* 0x0a9c	 217 */		ldx	[%sp+392],%o4
+/* 0x0aa0	     */		add	%o3,%g4,%g4
+/* 0x0aa4	 216 */		fmuld	%f4,%f6,%f4
+/* 0x0aa8	 217 */		ldx	[%sp+400],%g3
+/* 0x0aac	     */		add	%g4,%o5,%g4
+/* 0x0ab0	 216 */		fdtox	%f12,%f6
+/* 0x0ab4	 217 */		ldx	[%sp+384],%o7
+/* 0x0ab8	     */		ldx	[%sp+376],%o3
+/* 0x0abc	     */		add	%g3,%o4,%g3
+/* 0x0ac0	 216 */		fdtox	%f4,%f4
+/* 0x0ac4	     */		std	%f6,[%sp+352]
+/* 0x0ac8	 217 */		srax	%g4,32,%o4
+/* 0x0acc	     */		add	%g3,%g5,%g3
+/* 0x0ad0	     */		ldx	[%sp+368],%g5
+/* 0x0ad4	     */		add	%o7,%o3,%o3
+/* 0x0ad8	     */		add	%g3,%o4,%g3
+/* 0x0adc	 216 */		std	%f4,[%sp+328]
+/* 0x0ae0	 217 */		srax	%g3,32,%o4
+/* 0x0ae4	     */		add	%o3,%o0,%o0
+/* 0x0ae8	     */		ldx	[%sp+360],%o3
+/* 0x0aec	     */		add	%o0,%o4,%o4
+/* 0x0af0	 216 */		fdtox	%f16,%f6
+/* 0x0af4	     */		std	%f6,[%sp+344]
+/* 0x0af8	     */		fdtox	%f14,%f6
+/* 0x0afc	     */		std	%f6,[%sp+336]
+/* 0x0b00	 217 */		add	%g5,%o3,%o3
+/* 0x0b04	     */		ldx	[%sp+352],%o5
+/* 0x0b08	     */		srax	%o4,32,%g5
+/* 0x0b0c	     */		add	%o3,%o1,%o1
+/* 0x0b10	     */		st	%g2,[%i4+4]
+/* 0x0b14	     */		add	%o1,%g5,%o1
+/* 0x0b18	     */		ldx	[%sp+344],%o7
+/* 0x0b1c	     */		ldx	[%sp+320],%g5
+/* 0x0b20	     */		ldx	[%sp+336],%o3
+/* 0x0b24	     */		add	%o5,%o7,%o0
+/* 0x0b28	     */		ldx	[%sp+328],%o5
+/* 0x0b2c	     */		add	%o0,%o2,%o2
+/* 0x0b30	     */		st	%g5,[%i4]
+/* 0x0b34	     */		srax	%o1,32,%g5
+/* 0x0b38	     */		ldx	[%sp+312],%o7
+/* 0x0b3c	     */		add	%o2,%g5,%o2
+/* 0x0b40	     */		add	%o3,%o5,%o3
+/* 0x0b44	     */		st	%o4,[%i4+16]
+/* 0x0b48	     */		srax	%o2,32,%g2
+/* 0x0b4c	     */		st	%o1,[%i4+20]
+/* 0x0b50	     */		add	%o3,%o7,%o3
+/* 0x0b54	     */		st	%o2,[%i4+24]
+/* 0x0b58	     */		add	%o3,%g2,%g2
+/* 0x0b5c	     */		st	%g4,[%i4+8]
+
+!  219		      !      return c;
+
+/* 0x0b60	 219 */		srax	%g2,32,%i0
+/* 0x0b64	 217 */		st	%g3,[%i4+12]
+/* 0x0b68	     */		st	%g2,[%i4+28]
+/* 0x0b6c	     */		ret	! Result =  %i0
+/* 0x0b70	     */		restore	%g0,%g0,%g0
+                       .L77000065:
+
+!  221		      !    } else if (n == 16) {
+
+/* 0x0b74	 221 */		cmp	%o2,16
+/* 0x0b78	     */		bne,pn	%icc,.L77000109
+/* 0x0b7c	     */		sethi	%hi(0xffe00000),%g2
+/* 0x0b80	     */		ldd	[%o7],%f4
+
+!  222		      !      DEF_VARS(2*16);
+!  223		      !      t_d64 d0, d1, db;
+!  224		      !      t_s32 c = 0;
+!  226		      !      da = (t_d64)(a &  A_MASK);
+!  227		      !      db = (t_d64)(a &~ A_MASK);
+
+/* 0x0b84	 227 */		or	%g0,%g2,%g3
+/* 0x0b88	 226 */		andn	%o0,%g2,%g2
+/* 0x0b8c	     */		st	%g2,[%sp+572]
+/* 0x0b90	 227 */		and	%o0,%g3,%g3
+/* 0x0b94	     */		fxnor	%f30,%f4,%f4
+/* 0x0b98	 226 */		ldd	[%o1],%f8
+/* 0x0b9c	 227 */		st	%g3,[%sp+568]
+
+!  229		      !      MUL_U32_S64_D_8(0);
+
+/* 0x0ba0	 229 */		fitod	%f4,%f10
+/* 0x0ba4	     */		ldd	[%o1+8],%f16
+/* 0x0ba8	     */		ldd	[%o7+8],%f14
+/* 0x0bac	     */		fitod	%f5,%f4
+/* 0x0bb0	 226 */		ld	[%sp+572],%f7
+/* 0x0bb4	 229 */		fsubd	%f16,%f10,%f10
+/* 0x0bb8	 227 */		ld	[%sp+568],%f13
+/* 0x0bbc	     */		fxnor	%f30,%f14,%f14
+/* 0x0bc0	 229 */		fsubd	%f16,%f4,%f4
+/* 0x0bc4	 226 */		fmovs	%f8,%f6
+/* 0x0bc8	 227 */		fmovs	%f8,%f12
+/* 0x0bcc	 226 */		fsubd	%f6,%f8,%f6
+/* 0x0bd0	 227 */		fsubd	%f12,%f8,%f8
+/* 0x0bd4	 229 */		fitod	%f14,%f12
+/* 0x0bd8	     */		fmuld	%f10,%f6,%f18
+/* 0x0bdc	     */		fitod	%f15,%f14
+/* 0x0be0	     */		fmuld	%f10,%f8,%f10
+/* 0x0be4	     */		fsubd	%f16,%f12,%f12
+/* 0x0be8	     */		fmuld	%f4,%f6,%f20
+/* 0x0bec	     */		fmuld	%f4,%f8,%f4
+/* 0x0bf0	     */		fsubd	%f16,%f14,%f14
+/* 0x0bf4	     */		fdtox	%f10,%f10
+/* 0x0bf8	     */		std	%f10,[%sp+552]
+/* 0x0bfc	     */		fmuld	%f12,%f6,%f10
+/* 0x0c00	     */		fdtox	%f18,%f18
+/* 0x0c04	     */		std	%f18,[%sp+560]
+/* 0x0c08	     */		fmuld	%f12,%f8,%f12
+/* 0x0c0c	     */		fdtox	%f4,%f4
+/* 0x0c10	     */		std	%f4,[%sp+536]
+/* 0x0c14	     */		fmuld	%f14,%f6,%f4
+/* 0x0c18	     */		fdtox	%f20,%f18
+/* 0x0c1c	     */		std	%f18,[%sp+544]
+/* 0x0c20	     */		fdtox	%f10,%f10
+/* 0x0c24	     */		std	%f10,[%sp+528]
+/* 0x0c28	     */		fmuld	%f14,%f8,%f14
+/* 0x0c2c	     */		fdtox	%f12,%f12
+/* 0x0c30	     */		std	%f12,[%sp+520]
+/* 0x0c34	     */		ldd	[%o7+16],%f10
+/* 0x0c38	     */		fdtox	%f4,%f4
+/* 0x0c3c	     */		ldd	[%o7+24],%f12
+/* 0x0c40	     */		fdtox	%f14,%f14
+/* 0x0c44	     */		std	%f4,[%sp+512]
+/* 0x0c48	     */		fxnor	%f30,%f10,%f10
+/* 0x0c4c	     */		fxnor	%f30,%f12,%f4
+/* 0x0c50	     */		std	%f14,[%sp+504]
+/* 0x0c54	     */		fitod	%f10,%f12
+/* 0x0c58	     */		fitod	%f11,%f10
+/* 0x0c5c	     */		fitod	%f4,%f14
+/* 0x0c60	     */		fsubd	%f16,%f12,%f12
+/* 0x0c64	     */		fsubd	%f16,%f10,%f10
+/* 0x0c68	     */		fitod	%f5,%f4
+/* 0x0c6c	     */		fmuld	%f12,%f6,%f18
+/* 0x0c70	     */		fsubd	%f16,%f14,%f14
+/* 0x0c74	     */		fmuld	%f10,%f6,%f20
+/* 0x0c78	     */		fmuld	%f12,%f8,%f12
+/* 0x0c7c	     */		fsubd	%f16,%f4,%f4
+/* 0x0c80	     */		fmuld	%f10,%f8,%f10
+/* 0x0c84	     */		fdtox	%f18,%f18
+/* 0x0c88	     */		std	%f18,[%sp+496]
+/* 0x0c8c	     */		fdtox	%f20,%f18
+/* 0x0c90	     */		std	%f18,[%sp+480]
+/* 0x0c94	     */		fdtox	%f12,%f12
+/* 0x0c98	     */		std	%f12,[%sp+488]
+/* 0x0c9c	     */		fmuld	%f14,%f6,%f12
+/* 0x0ca0	     */		fdtox	%f10,%f10
+/* 0x0ca4	     */		std	%f10,[%sp+472]
+/* 0x0ca8	     */		fmuld	%f4,%f6,%f10
+/* 0x0cac	     */		fmuld	%f4,%f8,%f4
+/* 0x0cb0	     */		fdtox	%f12,%f12
+/* 0x0cb4	     */		std	%f12,[%sp+464]
+/* 0x0cb8	     */		fmuld	%f14,%f8,%f14
+/* 0x0cbc	     */		fdtox	%f10,%f10
+/* 0x0cc0	     */		std	%f10,[%sp+448]
+/* 0x0cc4	     */		ldd	[%o7+32],%f12
+/* 0x0cc8	     */		fdtox	%f4,%f4
+/* 0x0ccc	     */		std	%f4,[%sp+440]
+/* 0x0cd0	     */		fdtox	%f14,%f14
+/* 0x0cd4	     */		fxnor	%f30,%f12,%f12
+/* 0x0cd8	     */		std	%f14,[%sp+456]
+/* 0x0cdc	     */		ldd	[%o7+40],%f14
+
+!  230		      !      MUL_U32_S64_D_8(4);
+
+/* 0x0ce0	 230 */		fitod	%f12,%f4
+/* 0x0ce4	     */		fitod	%f13,%f12
+/* 0x0ce8	     */		fxnor	%f30,%f14,%f10
+/* 0x0cec	     */		fsubd	%f16,%f4,%f4
+/* 0x0cf0	     */		fsubd	%f16,%f12,%f12
+/* 0x0cf4	     */		fitod	%f10,%f14
+/* 0x0cf8	     */		fitod	%f11,%f10
+/* 0x0cfc	     */		fmuld	%f4,%f6,%f18
+/* 0x0d00	     */		fmuld	%f12,%f6,%f20
+/* 0x0d04	     */		fsubd	%f16,%f14,%f14
+/* 0x0d08	     */		fmuld	%f4,%f8,%f4
+/* 0x0d0c	     */		fsubd	%f16,%f10,%f10
+/* 0x0d10	     */		fmuld	%f12,%f8,%f12
+/* 0x0d14	     */		fdtox	%f18,%f18
+/* 0x0d18	     */		std	%f18,[%sp+432]
+/* 0x0d1c	     */		fdtox	%f4,%f4
+/* 0x0d20	     */		std	%f4,[%sp+424]
+/* 0x0d24	     */		fdtox	%f12,%f12
+/* 0x0d28	     */		std	%f12,[%sp+408]
+/* 0x0d2c	     */		fmuld	%f14,%f6,%f4
+/* 0x0d30	     */		fdtox	%f20,%f18
+/* 0x0d34	     */		std	%f18,[%sp+416]
+/* 0x0d38	     */		fmuld	%f10,%f6,%f12
+/* 0x0d3c	     */		fmuld	%f10,%f8,%f10
+/* 0x0d40	     */		fdtox	%f4,%f4
+/* 0x0d44	     */		std	%f4,[%sp+400]
+/* 0x0d48	     */		fmuld	%f14,%f8,%f14
+/* 0x0d4c	     */		fdtox	%f12,%f12
+/* 0x0d50	     */		std	%f12,[%sp+384]
+/* 0x0d54	     */		ldd	[%o7+48],%f4
+/* 0x0d58	     */		fdtox	%f10,%f10
+/* 0x0d5c	     */		std	%f10,[%sp+376]
+/* 0x0d60	     */		fdtox	%f14,%f14
+/* 0x0d64	     */		std	%f14,[%sp+392]
+/* 0x0d68	     */		fxnor	%f30,%f4,%f4
+/* 0x0d6c	     */		ldd	[%o7+56],%f14
+/* 0x0d70	     */		fitod	%f4,%f10
+/* 0x0d74	     */		fitod	%f5,%f4
+/* 0x0d78	     */		fxnor	%f30,%f14,%f12
+/* 0x0d7c	     */		fsubd	%f16,%f10,%f10
+/* 0x0d80	     */		fsubd	%f16,%f4,%f4
+/* 0x0d84	     */		fitod	%f12,%f14
+/* 0x0d88	     */		fitod	%f13,%f12
+/* 0x0d8c	     */		fmuld	%f10,%f6,%f18
+/* 0x0d90	     */		fmuld	%f4,%f6,%f20
+/* 0x0d94	     */		fsubd	%f16,%f14,%f14
+/* 0x0d98	     */		fmuld	%f10,%f8,%f10
+/* 0x0d9c	     */		fdtox	%f18,%f18
+/* 0x0da0	     */		std	%f18,[%sp+368]
+/* 0x0da4	     */		fmuld	%f4,%f8,%f4
+/* 0x0da8	     */		fdtox	%f10,%f10
+/* 0x0dac	     */		std	%f10,[%sp+360]
+/* 0x0db0	     */		fdtox	%f20,%f10
+/* 0x0db4	     */		std	%f10,[%sp+352]
+/* 0x0db8	     */		fdtox	%f4,%f4
+/* 0x0dbc	     */		std	%f4,[%sp+344]
+/* 0x0dc0	     */		fmuld	%f14,%f6,%f10
+/* 0x0dc4	     */		fmuld	%f14,%f8,%f4
+/* 0x0dc8	     */		fdtox	%f10,%f10
+/* 0x0dcc	     */		std	%f10,[%sp+336]
+/* 0x0dd0	     */		fdtox	%f4,%f4
+/* 0x0dd4	     */		std	%f4,[%sp+328]
+
+!  231		      !      ADD_S64_U32_D_8(0);
+
+/* 0x0dd8	 231 */		ldx	[%sp+552],%g3
+/* 0x0ddc	 230 */		fsubd	%f16,%f12,%f4
+/* 0x0de0	 231 */		ldx	[%sp+560],%g2
+/* 0x0de4	     */		ld	[%i1],%g4
+/* 0x0de8	     */		ldx	[%sp+544],%g5
+/* 0x0dec	     */		add	%g2,%g3,%g2
+/* 0x0df0	 230 */		fmuld	%f4,%f6,%f6
+/* 0x0df4	 231 */		ldx	[%sp+536],%g3
+/* 0x0df8	     */		add	%g2,%g4,%g4
+/* 0x0dfc	 230 */		fmuld	%f4,%f8,%f4
+/* 0x0e00	 231 */		ld	[%i1+4],%g2
+/* 0x0e04	     */		ldx	[%sp+520],%o0
+/* 0x0e08	     */		add	%g5,%g3,%g3
+/* 0x0e0c	 230 */		fdtox	%f6,%f6
+/* 0x0e10	 231 */		ldx	[%sp+528],%g5
+/* 0x0e14	     */		add	%g3,%g2,%g2
+/* 0x0e18	 230 */		fdtox	%f4,%f4
+/* 0x0e1c	 231 */		st	%g4,[%i4]
+/* 0x0e20	     */		srax	%g4,32,%g4
+/* 0x0e24	     */		ld	[%i1+8],%g3
+/* 0x0e28	     */		add	%g2,%g4,%g2
+/* 0x0e2c	     */		add	%g5,%o0,%g4
+/* 0x0e30	     */		ldx	[%sp+512],%o0
+/* 0x0e34	     */		srax	%g2,32,%g5
+/* 0x0e38	     */		ldx	[%sp+504],%o1
+/* 0x0e3c	     */		add	%g4,%g3,%g3
+/* 0x0e40	     */		ld	[%i1+12],%g4
+/* 0x0e44	     */		add	%g3,%g5,%g3
+/* 0x0e48	     */		ldx	[%sp+488],%o2
+/* 0x0e4c	     */		add	%o0,%o1,%g5
+/* 0x0e50	     */		ldx	[%sp+496],%o1
+/* 0x0e54	     */		srax	%g3,32,%o0
+/* 0x0e58	     */		add	%g5,%g4,%g4
+/* 0x0e5c	     */		st	%g2,[%i4+4]
+/* 0x0e60	     */		add	%g4,%o0,%g4
+/* 0x0e64	     */		ld	[%i1+16],%g2
+/* 0x0e68	     */		srax	%g4,32,%o0
+/* 0x0e6c	     */		add	%o1,%o2,%g5
+/* 0x0e70	     */		ldx	[%sp+480],%o1
+/* 0x0e74	     */		ldx	[%sp+472],%o2
+/* 0x0e78	     */		add	%g5,%g2,%g2
+/* 0x0e7c	     */		st	%g3,[%i4+8]
+/* 0x0e80	     */		add	%g2,%o0,%g2
+/* 0x0e84	     */		ld	[%i1+20],%g3
+/* 0x0e88	     */		srax	%g2,32,%o0
+/* 0x0e8c	     */		add	%o1,%o2,%g5
+/* 0x0e90	     */		ldx	[%sp+464],%o1
+/* 0x0e94	     */		ldx	[%sp+456],%o2
+/* 0x0e98	     */		add	%g5,%g3,%g3
+/* 0x0e9c	     */		st	%g4,[%i4+12]
+/* 0x0ea0	     */		add	%g3,%o0,%g3
+/* 0x0ea4	     */		ld	[%i1+24],%g4
+/* 0x0ea8	     */		srax	%g3,32,%o0
+/* 0x0eac	     */		add	%o1,%o2,%g5
+/* 0x0eb0	     */		ldx	[%sp+448],%o1
+/* 0x0eb4	     */		ldx	[%sp+440],%o2
+/* 0x0eb8	     */		add	%g5,%g4,%g4
+/* 0x0ebc	     */		st	%g2,[%i4+16]
+/* 0x0ec0	     */		add	%g4,%o0,%g4
+/* 0x0ec4	     */		ld	[%i1+28],%g2
+/* 0x0ec8	     */		srax	%g4,32,%o0
+/* 0x0ecc	     */		add	%o1,%o2,%g5
+
+!  232		      !      ADD_S64_U32_D_8(8);
+
+/* 0x0ed0	 232 */		ldx	[%sp+432],%o1
+/* 0x0ed4	     */		ldx	[%sp+424],%o2
+/* 0x0ed8	 231 */		add	%g5,%g2,%g2
+/* 0x0edc	     */		st	%g3,[%i4+20]
+/* 0x0ee0	     */		add	%g2,%o0,%g2
+/* 0x0ee4	 232 */		ld	[%i1+32],%g3
+/* 0x0ee8	     */		srax	%g2,32,%o0
+/* 0x0eec	     */		add	%o1,%o2,%g5
+/* 0x0ef0	     */		ldx	[%sp+416],%o1
+/* 0x0ef4	     */		ldx	[%sp+408],%o2
+/* 0x0ef8	     */		add	%g5,%g3,%g3
+/* 0x0efc	 231 */		st	%g4,[%i4+24]
+/* 0x0f00	 232 */		add	%g3,%o0,%g3
+/* 0x0f04	     */		ld	[%i1+36],%g4
+/* 0x0f08	     */		srax	%g3,32,%o0
+/* 0x0f0c	     */		add	%o1,%o2,%g5
+/* 0x0f10	     */		ldx	[%sp+400],%o1
+/* 0x0f14	     */		ldx	[%sp+392],%o2
+/* 0x0f18	     */		add	%g5,%g4,%g4
+/* 0x0f1c	 231 */		st	%g2,[%i4+28]
+/* 0x0f20	 232 */		add	%g4,%o0,%g4
+/* 0x0f24	     */		ld	[%i1+40],%g2
+/* 0x0f28	     */		srax	%g4,32,%o0
+/* 0x0f2c	     */		add	%o1,%o2,%g5
+/* 0x0f30	     */		ldx	[%sp+384],%o1
+/* 0x0f34	     */		ldx	[%sp+376],%o2
+/* 0x0f38	     */		add	%g5,%g2,%g2
+/* 0x0f3c	     */		st	%g3,[%i4+32]
+/* 0x0f40	     */		add	%g2,%o0,%g2
+/* 0x0f44	     */		ld	[%i1+44],%g3
+/* 0x0f48	     */		srax	%g2,32,%o0
+/* 0x0f4c	     */		add	%o1,%o2,%g5
+/* 0x0f50	     */		ldx	[%sp+368],%o1
+/* 0x0f54	     */		ldx	[%sp+360],%o2
+/* 0x0f58	     */		add	%g5,%g3,%g3
+/* 0x0f5c	     */		st	%g4,[%i4+36]
+/* 0x0f60	     */		add	%g3,%o0,%g3
+/* 0x0f64	     */		ld	[%i1+48],%g4
+/* 0x0f68	     */		srax	%g3,32,%o0
+/* 0x0f6c	     */		add	%o1,%o2,%g5
+/* 0x0f70	     */		ldx	[%sp+352],%o1
+/* 0x0f74	     */		ldx	[%sp+344],%o2
+/* 0x0f78	     */		add	%g5,%g4,%g4
+/* 0x0f7c	 230 */		std	%f6,[%sp+320]
+/* 0x0f80	 232 */		add	%g4,%o0,%g4
+/* 0x0f84	 230 */		std	%f4,[%sp+312]
+/* 0x0f88	 232 */		srax	%g4,32,%o0
+/* 0x0f8c	     */		add	%o1,%o2,%g5
+/* 0x0f90	     */		st	%g2,[%i4+40]
+/* 0x0f94	     */		ld	[%i1+52],%g2
+/* 0x0f98	     */		ldx	[%sp+336],%o1
+/* 0x0f9c	     */		ldx	[%sp+328],%o2
+/* 0x0fa0	     */		add	%g5,%g2,%g2
+/* 0x0fa4	     */		st	%g3,[%i4+44]
+/* 0x0fa8	     */		add	%g2,%o0,%g2
+/* 0x0fac	     */		ld	[%i1+56],%g3
+/* 0x0fb0	     */		add	%o1,%o2,%g5
+/* 0x0fb4	     */		ldx	[%sp+320],%o1
+/* 0x0fb8	     */		srax	%g2,32,%o0
+/* 0x0fbc	     */		ldx	[%sp+312],%o2
+/* 0x0fc0	     */		add	%g5,%g3,%g3
+/* 0x0fc4	     */		st	%g4,[%i4+48]
+/* 0x0fc8	     */		add	%g3,%o0,%g3
+/* 0x0fcc	     */		ld	[%i1+60],%g4
+/* 0x0fd0	     */		add	%o1,%o2,%g5
+/* 0x0fd4	     */		st	%g2,[%i4+52]
+/* 0x0fd8	     */		srax	%g3,32,%o0
+/* 0x0fdc	     */		add	%g5,%g4,%g2
+/* 0x0fe0	     */		st	%g3,[%i4+56]
+/* 0x0fe4	     */		add	%g2,%o0,%g2
+/* 0x0fe8	     */		st	%g2,[%i4+60]
+
+!  234		      !      return c;
+
+/* 0x0fec	 234 */		srax	%g2,32,%i0
+/* 0x0ff0	     */		ret	! Result =  %i0
+/* 0x0ff4	     */		restore	%g0,%g0,%g0
+                       .L77000109:
+
+!  236		      !    } else {
+!  237		      !      DEF_VARS(2*BUFF_SIZE);
+!  238		      !      t_d64 d0, d1, db;
+!  239		      !      t_s32 i, c = 0;
+!  241		      !      da = (t_d64)(a &  A_MASK);
+!  242		      !      db = (t_d64)(a &~ A_MASK);
+
+/* 0x0ff8	 242 */		or	%g0,%g2,%g3
+/* 0x0ffc	 241 */		andn	%o0,%g2,%g2
+/* 0x1000	     */		st	%g2,[%sp+316]
+/* 0x1004	 242 */		and	%o0,%g3,%g2
+/* 0x1008	     */		st	%g2,[%sp+312]
+/* 0x100c	 239 */		or	%g0,0,%g4
+
+!  244		      !#pragma pipeloop(0)
+!  245		      !      for (i = 0; i < (n+1)/2; i ++) {
+
+/* 0x1010	 245 */		add	%o2,1,%g2
+/* 0x1014	 241 */		ldd	[%o1],%f6
+/* 0x1018	 234 */		sethi	%hi(0x1800),%g1
+/* 0x101c	 245 */		srl	%g2,31,%g3
+/* 0x1020	 234 */		xor	%g1,-624,%g1
+/* 0x1024	 237 */		ldd	[%o1+8],%f20
+/* 0x1028	 245 */		add	%g2,%g3,%g2
+/* 0x102c	 241 */		fmovs	%f6,%f8
+/* 0x1030	 234 */		add	%g1,%fp,%g5
+/* 0x1034	 242 */		fmovs	%f6,%f10
+/* 0x1038	 241 */		ld	[%sp+316],%f9
+/* 0x103c	 245 */		sra	%g2,1,%o0
+/* 0x1040	 242 */		ld	[%sp+312],%f11
+/* 0x1044	 245 */		cmp	%o0,0
+/* 0x1048	 234 */		sethi	%hi(0x1800),%g1
+/* 0x104c	 241 */		fsubd	%f8,%f6,%f18
+/* 0x1050	 234 */		xor	%g1,-616,%g1
+/* 0x1054	     */		or	%g0,%o7,%o1
+/* 0x1058	 242 */		fsubd	%f10,%f6,%f16
+/* 0x105c	 245 */		ble,pt	%icc,.L900000196
+/* 0x1060	     */		cmp	%o3,0
+/* 0x1064	 234 */		add	%g1,%fp,%g3
+/* 0x1068	     */		sethi	%hi(0x1800),%g1
+/* 0x106c	     */		xor	%g1,-608,%g1
+/* 0x1070	     */		sub	%o0,1,%o2
+/* 0x1074	     */		add	%g1,%fp,%g2
+/* 0x1078	     */		sethi	%hi(0x1800),%g1
+/* 0x107c	     */		xor	%g1,-600,%g1
+/* 0x1080	 245 */		cmp	%o0,7
+/* 0x1084	     */		or	%g0,0,%i0
+/* 0x1088	 234 */		add	%g1,%fp,%o7
+/* 0x108c	 245 */		bl,pn	%icc,.L77000110
+/* 0x1090	     */		sub	%o0,3,%o0
+/* 0x1094	     */		ldd	[%o1],%f2
+
+!  246		      !        MUL_U32_S64_2_D(i);
+
+/* 0x1098	 246 */		add	%i2,16,%i1
+/* 0x109c	     */		ldd	[%o1+8],%f0
+/* 0x10a0	     */		add	%o1,8,%o1
+/* 0x10a4	     */		or	%g0,4,%i0
+/* 0x10a8	     */		fxnor	%f30,%f2,%f6
+/* 0x10ac	     */		ldd	[%i2+16],%f4
+/* 0x10b0	     */		add	%i1,16,%o1
+/* 0x10b4	     */		fxnor	%f30,%f0,%f12
+/* 0x10b8	     */		ldd	[%i2+24],%f0
+/* 0x10bc	     */		fitod	%f7,%f2
+/* 0x10c0	     */		fitod	%f6,%f6
+/* 0x10c4	     */		fxnor	%f30,%f4,%f10
+/* 0x10c8	     */		fsubd	%f20,%f2,%f2
+/* 0x10cc	     */		fxnor	%f30,%f0,%f8
+/* 0x10d0	     */		fitod	%f13,%f4
+/* 0x10d4	     */		fsubd	%f20,%f6,%f6
+/* 0x10d8	     */		fmuld	%f2,%f16,%f0
+                       .L900000181:
+/* 0x10dc	     */		ldd	[%o1],%f24
+/* 0x10e0	 246 */		add	%i0,3,%i0
+/* 0x10e4	     */		add	%o7,96,%o7
+/* 0x10e8	     */		fitod	%f11,%f22
+/* 0x10ec	     */		fsubd	%f20,%f4,%f26
+/* 0x10f0	     */		cmp	%i0,%o0
+/* 0x10f4	     */		add	%g2,96,%g2
+/* 0x10f8	     */		fmuld	%f6,%f18,%f28
+/* 0x10fc	     */		fmuld	%f6,%f16,%f6
+/* 0x1100	     */		add	%g3,96,%g3
+/* 0x1104	     */		add	%g5,96,%g5
+/* 0x1108	     */		fdtox	%f0,%f0
+/* 0x110c	     */		fitod	%f12,%f4
+/* 0x1110	     */		fmuld	%f2,%f18,%f2
+/* 0x1114	     */		fdtox	%f28,%f12
+/* 0x1118	     */		fdtox	%f6,%f6
+/* 0x111c	     */		std	%f12,[%g5-96]
+/* 0x1120	     */		std	%f6,[%g3-96]
+/* 0x1124	     */		fdtox	%f2,%f2
+/* 0x1128	     */		fsubd	%f20,%f4,%f6
+/* 0x112c	     */		std	%f2,[%g2-96]
+/* 0x1130	     */		add	%o1,8,%o1
+/* 0x1134	     */		fxnor	%f30,%f24,%f12
+/* 0x1138	     */		fmuld	%f26,%f16,%f4
+/* 0x113c	     */		std	%f0,[%o7-96]
+/* 0x1140	     */		ldd	[%o1],%f0
+/* 0x1144	     */		fitod	%f9,%f2
+/* 0x1148	     */		fsubd	%f20,%f22,%f28
+/* 0x114c	     */		fmuld	%f6,%f18,%f24
+/* 0x1150	     */		fmuld	%f6,%f16,%f22
+/* 0x1154	     */		fdtox	%f4,%f4
+/* 0x1158	     */		fitod	%f10,%f6
+/* 0x115c	     */		fmuld	%f26,%f18,%f10
+/* 0x1160	     */		fdtox	%f24,%f24
+/* 0x1164	     */		fdtox	%f22,%f22
+/* 0x1168	     */		std	%f24,[%g5-64]
+/* 0x116c	     */		std	%f22,[%g3-64]
+/* 0x1170	     */		fdtox	%f10,%f10
+/* 0x1174	     */		fsubd	%f20,%f6,%f6
+/* 0x1178	     */		std	%f10,[%g2-64]
+/* 0x117c	     */		add	%o1,8,%o1
+/* 0x1180	     */		fxnor	%f30,%f0,%f10
+/* 0x1184	     */		fmuld	%f28,%f16,%f0
+/* 0x1188	     */		std	%f4,[%o7-64]
+/* 0x118c	     */		ldd	[%o1],%f22
+/* 0x1190	     */		fitod	%f13,%f4
+/* 0x1194	     */		fsubd	%f20,%f2,%f2
+/* 0x1198	     */		fmuld	%f6,%f18,%f26
+/* 0x119c	     */		fmuld	%f6,%f16,%f24
+/* 0x11a0	     */		fdtox	%f0,%f0
+/* 0x11a4	     */		fitod	%f8,%f6
+/* 0x11a8	     */		fmuld	%f28,%f18,%f8
+/* 0x11ac	     */		fdtox	%f26,%f26
+/* 0x11b0	     */		fdtox	%f24,%f24
+/* 0x11b4	     */		std	%f26,[%g5-32]
+/* 0x11b8	     */		std	%f24,[%g3-32]
+/* 0x11bc	     */		fdtox	%f8,%f8
+/* 0x11c0	     */		fsubd	%f20,%f6,%f6
+/* 0x11c4	     */		std	%f8,[%g2-32]
+/* 0x11c8	     */		add	%o1,8,%o1
+/* 0x11cc	     */		fxnor	%f30,%f22,%f8
+/* 0x11d0	     */		std	%f0,[%o7-32]
+/* 0x11d4	     */		ble,pt	%icc,.L900000181
+/* 0x11d8	     */		fmuld	%f2,%f16,%f0
+                       .L900000184:
+/* 0x11dc	 246 */		fitod	%f12,%f28
+/* 0x11e0	     */		fmuld	%f6,%f18,%f24
+/* 0x11e4	     */		add	%g5,128,%g5
+/* 0x11e8	     */		fitod	%f10,%f12
+/* 0x11ec	     */		fmuld	%f6,%f16,%f26
+/* 0x11f0	     */		add	%g3,128,%g3
+/* 0x11f4	     */		fsubd	%f20,%f4,%f4
+/* 0x11f8	     */		fmuld	%f2,%f18,%f22
+/* 0x11fc	     */		add	%g2,128,%g2
+/* 0x1200	     */		fdtox	%f24,%f6
+/* 0x1204	     */		std	%f6,[%g5-128]
+/* 0x1208	     */		add	%o7,128,%o7
+/* 0x120c	     */		fsubd	%f20,%f28,%f2
+/* 0x1210	     */		cmp	%i0,%o2
+/* 0x1214	     */		fitod	%f11,%f6
+/* 0x1218	     */		fmuld	%f4,%f18,%f24
+/* 0x121c	     */		fdtox	%f26,%f10
+/* 0x1220	     */		std	%f10,[%g3-128]
+/* 0x1224	     */		fdtox	%f22,%f10
+/* 0x1228	     */		std	%f10,[%g2-128]
+/* 0x122c	     */		fmuld	%f2,%f18,%f26
+/* 0x1230	     */		fsubd	%f20,%f12,%f10
+/* 0x1234	     */		fmuld	%f2,%f16,%f2
+/* 0x1238	     */		fsubd	%f20,%f6,%f22
+/* 0x123c	     */		fmuld	%f4,%f16,%f12
+/* 0x1240	     */		fdtox	%f0,%f0
+/* 0x1244	     */		std	%f0,[%o7-128]
+/* 0x1248	     */		fitod	%f8,%f4
+/* 0x124c	     */		fmuld	%f10,%f18,%f6
+/* 0x1250	     */		fdtox	%f26,%f0
+/* 0x1254	     */		std	%f0,[%g5-96]
+/* 0x1258	     */		fmuld	%f10,%f16,%f10
+/* 0x125c	     */		fdtox	%f2,%f2
+/* 0x1260	     */		std	%f2,[%g3-96]
+/* 0x1264	     */		fitod	%f9,%f0
+/* 0x1268	     */		fmuld	%f22,%f18,%f2
+/* 0x126c	     */		fdtox	%f24,%f8
+/* 0x1270	     */		std	%f8,[%g2-96]
+/* 0x1274	     */		fsubd	%f20,%f4,%f4
+/* 0x1278	     */		fmuld	%f22,%f16,%f8
+/* 0x127c	     */		fdtox	%f12,%f12
+/* 0x1280	     */		std	%f12,[%o7-96]
+/* 0x1284	     */		fsubd	%f20,%f0,%f0
+/* 0x1288	     */		fdtox	%f6,%f6
+/* 0x128c	     */		std	%f6,[%g5-64]
+/* 0x1290	     */		fdtox	%f10,%f10
+/* 0x1294	     */		std	%f10,[%g3-64]
+/* 0x1298	     */		fmuld	%f4,%f18,%f6
+/* 0x129c	     */		fdtox	%f2,%f2
+/* 0x12a0	     */		std	%f2,[%g2-64]
+/* 0x12a4	     */		fmuld	%f4,%f16,%f4
+/* 0x12a8	     */		fmuld	%f0,%f18,%f2
+/* 0x12ac	     */		fdtox	%f8,%f8
+/* 0x12b0	     */		std	%f8,[%o7-64]
+/* 0x12b4	     */		fdtox	%f6,%f6
+/* 0x12b8	     */		std	%f6,[%g5-32]
+/* 0x12bc	     */		fmuld	%f0,%f16,%f0
+/* 0x12c0	     */		fdtox	%f4,%f4
+/* 0x12c4	     */		std	%f4,[%g3-32]
+/* 0x12c8	     */		fdtox	%f2,%f2
+/* 0x12cc	     */		std	%f2,[%g2-32]
+/* 0x12d0	     */		fdtox	%f0,%f0
+/* 0x12d4	     */		bg,pn	%icc,.L77000071
+/* 0x12d8	     */		std	%f0,[%o7-32]
+                       .L77000110:
+/* 0x12dc	     */		ldd	[%o1],%f0
+                       .L900000195:
+/* 0x12e0	     */		fxnor	%f30,%f0,%f0
+/* 0x12e4	 246 */		add	%i0,1,%i0
+/* 0x12e8	     */		add	%o1,8,%o1
+/* 0x12ec	     */		cmp	%i0,%o2
+/* 0x12f0	     */		fitod	%f0,%f2
+/* 0x12f4	     */		fitod	%f1,%f0
+/* 0x12f8	     */		fsubd	%f20,%f2,%f2
+/* 0x12fc	     */		fsubd	%f20,%f0,%f0
+/* 0x1300	     */		fmuld	%f2,%f18,%f6
+/* 0x1304	     */		fmuld	%f2,%f16,%f4
+/* 0x1308	     */		fmuld	%f0,%f18,%f2
+/* 0x130c	     */		fdtox	%f6,%f6
+/* 0x1310	     */		std	%f6,[%g5]
+/* 0x1314	     */		fmuld	%f0,%f16,%f0
+/* 0x1318	     */		fdtox	%f4,%f4
+/* 0x131c	     */		std	%f4,[%g3]
+/* 0x1320	     */		add	%g3,32,%g3
+/* 0x1324	     */		fdtox	%f2,%f2
+/* 0x1328	     */		std	%f2,[%g2]
+/* 0x132c	     */		add	%g2,32,%g2
+/* 0x1330	     */		fdtox	%f0,%f0
+/* 0x1334	     */		std	%f0,[%o7]
+/* 0x1338	     */		add	%o7,32,%o7
+/* 0x133c	     */		add	%g5,32,%g5
+/* 0x1340	     */		ble,a,pt	%icc,.L900000195
+/* 0x1344	     */		ldd	[%o1],%f0
+                       .L77000071:
+
+!  247		      !      }
+!  249		      !#pragma pipeloop(0)
+!  250		      !      for (i = 0; i < n; i ++) {
+
+/* 0x1348	 250 */		cmp	%o3,0
+                       .L900000196:
+/* 0x134c	 250 */		ble,a,pt	%icc,.L77000089
+/* 0x1350	     */		or	%g0,%g4,%i0
+/* 0x1354	     */		sethi	%hi(0x1800),%g1
+/* 0x1358	     */		xor	%g1,-624,%g1
+/* 0x135c	     */		or	%g0,%o5,%g5
+/* 0x1360	     */		add	%g1,%fp,%g3
+/* 0x1364	     */		sethi	%hi(0x1800),%g1
+/* 0x1368	     */		xor	%g1,-616,%g1
+/* 0x136c	     */		or	%g0,%o4,%i0
+/* 0x1370	     */		add	%g1,%fp,%o5
+/* 0x1374	     */		or	%g0,0,%i1
+/* 0x1378	     */		sub	%o3,1,%o7
+/* 0x137c	 246 */		cmp	%o3,5
+/* 0x1380	     */		bl,pn	%icc,.L77000111
+/* 0x1384	     */		sethi	%hi(0x1800),%g1
+
+!  251		      !        ADD_S64_U32_D(i);
+
+/* 0x1388	 251 */		ld	[%i0],%o2
+/* 0x138c	 246 */		sub	%o3,3,%o4
+/* 0x1390	 251 */		xor	%g1,-624,%g1
+/* 0x1394	     */		add	%g5,4,%g5
+/* 0x1398	     */		add	%g1,%fp,%g1
+/* 0x139c	     */		or	%g0,2,%i1
+/* 0x13a0	     */		ldx	[%g1+8],%o1
+/* 0x13a4	     */		ldx	[%g1],%o0
+/* 0x13a8	     */		ldx	[%g1+16],%o3
+/* 0x13ac	     */		sethi	%hi(0x1800),%g1
+/* 0x13b0	     */		xor	%g1,-592,%g1
+/* 0x13b4	     */		add	%o0,%o1,%o0
+/* 0x13b8	     */		ld	[%i0+4],%o1
+/* 0x13bc	     */		add	%g1,%fp,%g3
+/* 0x13c0	     */		sethi	%hi(0x1800),%g1
+/* 0x13c4	     */		xor	%g1,-600,%g1
+/* 0x13c8	     */		add	%o0,%o2,%o0
+/* 0x13cc	     */		add	%g1,%fp,%g1
+/* 0x13d0	     */		add	%i0,8,%i0
+/* 0x13d4	     */		ldx	[%g1],%o2
+/* 0x13d8	     */		sethi	%hi(0x1800),%g1
+/* 0x13dc	     */		st	%o0,[%g5-4]
+/* 0x13e0	     */		srax	%o0,32,%o0
+/* 0x13e4	     */		xor	%g1,-584,%g1
+/* 0x13e8	     */		add	%g1,%fp,%o5
+                       .L900000169:
+/* 0x13ec	 251 */		add	%o3,%o2,%g4
+/* 0x13f0	     */		ld	[%i0],%o3
+/* 0x13f4	     */		add	%i1,3,%i1
+/* 0x13f8	     */		ldx	[%g3],%o2
+/* 0x13fc	     */		sra	%o0,0,%g2
+/* 0x1400	     */		add	%g4,%o1,%o1
+/* 0x1404	     */		ldx	[%o5],%o0
+/* 0x1408	     */		add	%o1,%g2,%o1
+/* 0x140c	     */		cmp	%i1,%o4
+/* 0x1410	     */		st	%o1,[%g5]
+/* 0x1414	     */		srax	%o1,32,%g4
+/* 0x1418	     */		add	%g5,12,%g5
+/* 0x141c	     */		add	%o2,%o0,%o1
+/* 0x1420	     */		ld	[%i0+4],%o2
+/* 0x1424	     */		add	%i0,12,%i0
+/* 0x1428	     */		ldx	[%g3+16],%o0
+/* 0x142c	     */		add	%o1,%o3,%o3
+/* 0x1430	     */		ldx	[%o5+16],%o1
+/* 0x1434	     */		add	%o3,%g4,%o3
+/* 0x1438	     */		add	%o5,48,%o5
+/* 0x143c	     */		st	%o3,[%g5-8]
+/* 0x1440	     */		srax	%o3,32,%g2
+/* 0x1444	     */		add	%g3,48,%g3
+/* 0x1448	     */		add	%o0,%o1,%o0
+/* 0x144c	     */		ld	[%i0-4],%o1
+/* 0x1450	     */		ldx	[%g3-16],%o3
+/* 0x1454	     */		add	%o0,%o2,%o0
+/* 0x1458	     */		ldx	[%o5-16],%o2
+/* 0x145c	     */		add	%o0,%g2,%o0
+/* 0x1460	     */		st	%o0,[%g5-4]
+/* 0x1464	     */		ble,pt	%icc,.L900000169
+/* 0x1468	     */		srax	%o0,32,%o0
+                       .L900000172:
+/* 0x146c	 251 */		add	%o3,%o2,%o3
+/* 0x1470	     */		add	%g5,4,%g5
+/* 0x1474	     */		sra	%o0,0,%o2
+/* 0x1478	     */		add	%o3,%o1,%o0
+/* 0x147c	     */		add	%o0,%o2,%o0
+/* 0x1480	     */		st	%o0,[%g5-4]
+/* 0x1484	     */		cmp	%i1,%o7
+/* 0x1488	     */		srax	%o0,32,%g4
+/* 0x148c	     */		bg,a,pn	%icc,.L77000089
+/* 0x1490	     */		or	%g0,%g4,%i0
+                       .L77000111:
+/* 0x1494	 251 */		ldx	[%g3],%o0
+                       .L900000194:
+/* 0x1498	 251 */		ldx	[%o5],%o3
+/* 0x149c	     */		sra	%g4,0,%o1
+/* 0x14a0	     */		add	%i1,1,%i1
+/* 0x14a4	     */		ld	[%i0],%o2
+/* 0x14a8	     */		add	%g3,16,%g3
+/* 0x14ac	     */		add	%o5,16,%o5
+/* 0x14b0	     */		add	%o0,%o3,%o0
+/* 0x14b4	     */		add	%i0,4,%i0
+/* 0x14b8	     */		add	%o0,%o2,%o0
+/* 0x14bc	     */		cmp	%i1,%o7
+/* 0x14c0	     */		add	%o0,%o1,%o0
+/* 0x14c4	     */		st	%o0,[%g5]
+/* 0x14c8	     */		add	%g5,4,%g5
+/* 0x14cc	     */		srax	%o0,32,%g4
+/* 0x14d0	     */		ble,a,pt	%icc,.L900000194
+/* 0x14d4	     */		ldx	[%g3],%o0
+                       .L77000075:
+/* 0x14d8	     */		ret	! Result =  %i0
+/* 0x14dc	     */		restore	%g0,%g4,%o0
+                       .L77000076:
+
+!  252		      !      }
+!  254		      !      return c;
+!  255		      !    }
+!  257		      !  } else {
+!  259		      !    if (n == 8) {
+
+/* 0x14e0	 259 */		bne,pn	%icc,.L77000078
+/* 0x14e4	     */		sethi	%hi(0xffe00000),%g2
+/* 0x14e8	     */		ldd	[%o7],%f4
+
+!  260		      !      DEF_VARS(2*8);
+!  261		      !      t_d64 d0, d1, db;
+!  262		      !      t_u32 uc = 0;
+!  264		      !      da = (t_d64)(a &  A_MASK);
+
+/* 0x14ec	 264 */		ldd	[%o1],%f6
+/* 0x14f0	     */		or	%g0,%g2,%g3
+
+!  265		      !      db = (t_d64)(a &~ A_MASK);
+
+/* 0x14f4	 265 */		and	%o0,%g2,%g2
+/* 0x14f8	     */		st	%g2,[%sp+456]
+/* 0x14fc	     */		fxnor	%f30,%f4,%f4
+/* 0x1500	 264 */		andn	%o0,%g3,%g2
+/* 0x1504	     */		st	%g2,[%sp+460]
+
+!  267		      !      MUL_U32_S64_E_8(0);
+
+/* 0x1508	 267 */		ldd	[%o1+8],%f12
+/* 0x150c	     */		fitod	%f4,%f10
+/* 0x1510	     */		ldd	[%o7+8],%f14
+/* 0x1514	     */		fitod	%f5,%f4
+/* 0x1518	     */		ldd	[%o1+16],%f18
+/* 0x151c	 265 */		ld	[%sp+456],%f9
+/* 0x1520	 267 */		fsubd	%f12,%f10,%f10
+/* 0x1524	 264 */		ld	[%sp+460],%f17
+/* 0x1528	 267 */		fsubd	%f12,%f4,%f4
+
+!  268		      !      ADD_S64_U32_E_8(0);
+
+/* 0x152c	 268 */		sethi	%hi(0x80000000),%g3
+/* 0x1530	     */		ldd	[%o7+16],%f20
+/* 0x1534	     */		fxnor	%f30,%f14,%f14
+/* 0x1538	     */		sllx	%g3,32,%g3
+/* 0x153c	     */		ldd	[%o7+24],%f22
+/* 0x1540	     */		ld	[%i1+24],%o3
+/* 0x1544	 267 */		fitod	%f14,%f26
+/* 0x1548	 268 */		ld	[%i1+28],%o4
+/* 0x154c	 267 */		fitod	%f15,%f14
+/* 0x1550	 268 */		stx	%o3,[%sp+320]
+/* 0x1554	     */		fxnor	%f30,%f20,%f20
+/* 0x1558	     */		stx	%o4,[%sp+312]
+/* 0x155c	 267 */		fsubd	%f12,%f26,%f26
+/* 0x1560	 268 */		ld	[%i1],%g2
+/* 0x1564	 267 */		fsubd	%f12,%f14,%f14
+/* 0x1568	 268 */		ld	[%i1+4],%g4
+/* 0x156c	     */		ld	[%i1+8],%g5
+/* 0x1570	     */		ld	[%i1+12],%o0
+/* 0x1574	 265 */		fmovs	%f6,%f8
+/* 0x1578	 268 */		ld	[%i1+16],%o1
+/* 0x157c	 264 */		fmovs	%f6,%f16
+/* 0x1580	 268 */		ld	[%i1+20],%o2
+/* 0x1584	 265 */		fsubd	%f8,%f6,%f8
+/* 0x1588	 264 */		fsubd	%f16,%f6,%f6
+/* 0x158c	 267 */		fmuld	%f10,%f8,%f24
+/* 0x1590	     */		fmuld	%f4,%f8,%f16
+/* 0x1594	     */		fmuld	%f4,%f6,%f4
+/* 0x1598	     */		faddd	%f24,%f18,%f24
+/* 0x159c	     */		fmuld	%f10,%f6,%f10
+/* 0x15a0	     */		faddd	%f16,%f18,%f16
+/* 0x15a4	     */		fmuld	%f26,%f8,%f28
+/* 0x15a8	     */		fdtox	%f4,%f4
+/* 0x15ac	     */		std	%f4,[%sp+432]
+/* 0x15b0	     */		fmuld	%f26,%f6,%f26
+/* 0x15b4	     */		fdtox	%f24,%f24
+/* 0x15b8	     */		std	%f24,[%sp+440]
+/* 0x15bc	     */		fmuld	%f14,%f6,%f4
+/* 0x15c0	     */		fdtox	%f10,%f10
+/* 0x15c4	     */		std	%f10,[%sp+448]
+/* 0x15c8	     */		fmuld	%f14,%f8,%f24
+/* 0x15cc	 268 */		ldx	[%sp+432],%o4
+/* 0x15d0	 267 */		fdtox	%f16,%f14
+/* 0x15d4	     */		std	%f14,[%sp+424]
+/* 0x15d8	     */		fitod	%f20,%f10
+/* 0x15dc	 268 */		ldx	[%sp+440],%o7
+/* 0x15e0	 267 */		faddd	%f28,%f18,%f14
+/* 0x15e4	 268 */		ldx	[%sp+448],%o5
+/* 0x15e8	 267 */		fitod	%f21,%f16
+/* 0x15ec	     */		fsubd	%f12,%f10,%f10
+/* 0x15f0	 268 */		ldx	[%sp+424],%o3
+/* 0x15f4	 267 */		fdtox	%f14,%f14
+/* 0x15f8	 268 */		add	%o5,%o7,%o5
+/* 0x15fc	 267 */		std	%f14,[%sp+408]
+/* 0x1600	     */		fxnor	%f30,%f22,%f20
+/* 0x1604	 268 */		add	%o5,%g2,%g2
+/* 0x1608	 267 */		faddd	%f24,%f18,%f14
+/* 0x160c	 268 */		add	%o4,%o3,%o3
+/* 0x1610	     */		sub	%g2,%g3,%g2
+/* 0x1614	     */		st	%g2,[%i4]
+/* 0x1618	 267 */		fdtox	%f26,%f22
+/* 0x161c	 268 */		srlx	%g2,32,%o5
+/* 0x1620	 267 */		fmuld	%f10,%f8,%f26
+/* 0x1624	     */		std	%f22,[%sp+416]
+/* 0x1628	     */		fsubd	%f12,%f16,%f16
+/* 0x162c	 268 */		add	%o3,%g4,%g4
+/* 0x1630	 267 */		fmuld	%f10,%f6,%f10
+/* 0x1634	     */		fdtox	%f4,%f4
+/* 0x1638	     */		std	%f4,[%sp+400]
+/* 0x163c	 268 */		add	%g4,%o5,%g4
+/* 0x1640	     */		ldx	[%sp+416],%o7
+/* 0x1644	 267 */		fdtox	%f14,%f4
+/* 0x1648	 268 */		sub	%g4,%g3,%g4
+/* 0x164c	 267 */		std	%f4,[%sp+392]
+/* 0x1650	     */		fitod	%f20,%f22
+/* 0x1654	     */		fmuld	%f16,%f8,%f14
+/* 0x1658	 268 */		ldx	[%sp+408],%o3
+/* 0x165c	 267 */		faddd	%f26,%f18,%f4
+/* 0x1660	     */		fmuld	%f16,%f6,%f16
+/* 0x1664	 268 */		st	%g4,[%i4+4]
+/* 0x1668	 267 */		fitod	%f21,%f20
+/* 0x166c	 268 */		ldx	[%sp+392],%o5
+/* 0x1670	 267 */		fsubd	%f12,%f22,%f22
+/* 0x1674	 268 */		add	%o7,%o3,%o3
+/* 0x1678	     */		ldx	[%sp+400],%o4
+/* 0x167c	 267 */		fdtox	%f4,%f4
+/* 0x1680	 268 */		add	%o3,%g5,%o3
+/* 0x1684	 267 */		std	%f4,[%sp+376]
+/* 0x1688	     */		fdtox	%f10,%f10
+/* 0x168c	 268 */		srlx	%g4,32,%g5
+/* 0x1690	 267 */		faddd	%f14,%f18,%f4
+/* 0x1694	     */		std	%f10,[%sp+384]
+/* 0x1698	     */		fmuld	%f22,%f8,%f10
+/* 0x169c	 268 */		ldx	[%sp+312],%g4
+/* 0x16a0	 267 */		fsubd	%f12,%f20,%f12
+/* 0x16a4	 268 */		add	%o4,%o5,%o4
+/* 0x16a8	 267 */		fmuld	%f22,%f6,%f14
+/* 0x16ac	     */		fdtox	%f16,%f16
+/* 0x16b0	     */		std	%f16,[%sp+368]
+/* 0x16b4	 268 */		add	%o3,%g5,%o3
+/* 0x16b8	 267 */		fdtox	%f4,%f4
+/* 0x16bc	     */		std	%f4,[%sp+360]
+/* 0x16c0	 268 */		add	%o4,%o0,%o0
+/* 0x16c4	 267 */		faddd	%f10,%f18,%f4
+/* 0x16c8	 268 */		ldx	[%sp+376],%o4
+/* 0x16cc	     */		sub	%o3,%g3,%o3
+/* 0x16d0	 267 */		fmuld	%f12,%f8,%f16
+/* 0x16d4	 268 */		ldx	[%sp+384],%g5
+/* 0x16d8	     */		srlx	%o3,32,%o5
+/* 0x16dc	 267 */		fdtox	%f14,%f14
+/* 0x16e0	     */		fmuld	%f12,%f6,%f6
+/* 0x16e4	     */		std	%f14,[%sp+352]
+/* 0x16e8	 268 */		add	%o0,%o5,%o0
+/* 0x16ec	     */		add	%g5,%o4,%g5
+/* 0x16f0	 267 */		fdtox	%f4,%f4
+/* 0x16f4	     */		std	%f4,[%sp+344]
+/* 0x16f8	 268 */		ldx	[%sp+368],%o7
+/* 0x16fc	     */		sub	%o0,%g3,%o0
+/* 0x1700	     */		add	%g5,%o1,%o1
+/* 0x1704	 267 */		faddd	%f16,%f18,%f4
+/* 0x1708	 268 */		ldx	[%sp+360],%o4
+/* 0x170c	     */		srlx	%o0,32,%g5
+/* 0x1710	 267 */		fdtox	%f6,%f6
+/* 0x1714	 268 */		add	%o1,%g5,%o1
+/* 0x1718	 267 */		std	%f6,[%sp+336]
+/* 0x171c	 268 */		add	%o7,%o4,%o4
+/* 0x1720	     */		sub	%o1,%g3,%o1
+/* 0x1724	     */		ldx	[%sp+352],%o5
+/* 0x1728	     */		add	%o4,%o2,%o2
+/* 0x172c	 267 */		fdtox	%f4,%f4
+/* 0x1730	     */		std	%f4,[%sp+328]
+/* 0x1734	 268 */		ldx	[%sp+344],%o4
+/* 0x1738	     */		srlx	%o1,32,%g5
+/* 0x173c	     */		add	%o2,%g5,%o2
+/* 0x1740	     */		st	%o3,[%i4+8]
+/* 0x1744	     */		add	%o5,%o4,%g5
+/* 0x1748	     */		ldx	[%sp+320],%o5
+/* 0x174c	     */		sub	%o2,%g3,%o2
+/* 0x1750	     */		ldx	[%sp+336],%o7
+/* 0x1754	     */		srlx	%o2,32,%g2
+/* 0x1758	     */		ldx	[%sp+328],%o4
+/* 0x175c	     */		add	%g5,%o5,%g5
+/* 0x1760	     */		add	%g5,%g2,%g2
+/* 0x1764	     */		st	%o0,[%i4+12]
+/* 0x1768	     */		add	%o7,%o4,%o4
+/* 0x176c	     */		sub	%g2,%g3,%g2
+/* 0x1770	     */		st	%o1,[%i4+16]
+/* 0x1774	     */		srlx	%g2,32,%g5
+/* 0x1778	     */		add	%o4,%g4,%g4
+/* 0x177c	     */		st	%o2,[%i4+20]
+/* 0x1780	     */		add	%g4,%g5,%g4
+/* 0x1784	     */		st	%g2,[%i4+24]
+/* 0x1788	     */		sub	%g4,%g3,%g3
+/* 0x178c	     */		st	%g3,[%i4+28]
+
+!  270		      !      return uc;
+
+/* 0x1790	 270 */		srlx	%g3,32,%i0
+/* 0x1794	     */		ret	! Result =  %i0
+/* 0x1798	     */		restore	%g0,%g0,%g0
+                       .L77000078:
+
+!  272		      !    } else if (n == 16) {
+
+/* 0x179c	 272 */		cmp	%o2,16
+/* 0x17a0	     */		bne,pn	%icc,.L77000106
+/* 0x17a4	     */		sethi	%hi(0xffe00000),%g2
+/* 0x17a8	     */		ldd	[%o7],%f6
+
+!  273		      !      DEF_VARS(2*16);
+!  274		      !      t_d64 d0, d1, db;
+!  275		      !      t_u32 uc = 0;
+!  277		      !      da = (t_d64)(a &  A_MASK);
+
+/* 0x17ac	 277 */		or	%g0,%g2,%g3
+
+!  278		      !      db = (t_d64)(a &~ A_MASK);
+
+/* 0x17b0	 278 */		and	%o0,%g2,%g2
+/* 0x17b4	     */		st	%g2,[%sp+312]
+/* 0x17b8	 277 */		andn	%o0,%g3,%g2
+/* 0x17bc	     */		sethi	%hi(0x80000000),%g3
+/* 0x17c0	     */		fxnor	%f30,%f6,%f6
+/* 0x17c4	     */		ldd	[%o1],%f8
+/* 0x17c8	     */		sllx	%g3,32,%o0
+/* 0x17cc	     */		st	%g2,[%sp+316]
+
+!  280		      !      MUL_U32_S64_E_8(0);
+
+/* 0x17d0	 280 */		fitod	%f6,%f12
+/* 0x17d4	     */		ldd	[%o1+8],%f4
+/* 0x17d8	     */		fitod	%f7,%f6
+/* 0x17dc	     */		ldd	[%o1+16],%f2
+
+!  281		      !      MUL_U32_S64_E_8(4);
+!  282		      !      ADD_S64_U32_E_8(0);
+
+/* 0x17e0	 282 */		stx	%o0,[%sp+96]
+/* 0x17e4	 278 */		ld	[%sp+312],%f11
+/* 0x17e8	 280 */		fsubd	%f4,%f6,%f6
+/* 0x17ec	 277 */		ld	[%sp+316],%f15
+/* 0x17f0	 282 */		ldx	[%sp+96],%o3
+/* 0x17f4	 278 */		fmovs	%f8,%f10
+/* 0x17f8	 277 */		fmovs	%f8,%f14
+/* 0x17fc	 278 */		fsubd	%f10,%f8,%f16
+/* 0x1800	 280 */		fsubd	%f4,%f12,%f10
+/* 0x1804	 277 */		fsubd	%f14,%f8,%f14
+/* 0x1808	 280 */		fmuld	%f6,%f16,%f12
+/* 0x180c	     */		fmuld	%f10,%f16,%f8
+/* 0x1810	     */		fmuld	%f6,%f14,%f6
+/* 0x1814	     */		faddd	%f12,%f2,%f12
+/* 0x1818	     */		fmuld	%f10,%f14,%f10
+/* 0x181c	     */		faddd	%f8,%f2,%f8
+/* 0x1820	     */		fdtox	%f6,%f6
+/* 0x1824	     */		std	%f6,[%sp+288]
+/* 0x1828	     */		fdtox	%f12,%f6
+/* 0x182c	     */		std	%f6,[%sp+280]
+/* 0x1830	     */		fdtox	%f10,%f10
+/* 0x1834	     */		std	%f10,[%sp+304]
+/* 0x1838	     */		fdtox	%f8,%f8
+/* 0x183c	     */		std	%f8,[%sp+296]
+/* 0x1840	     */		ldd	[%o7+8],%f0
+/* 0x1844	     */		fxnor	%f30,%f0,%f6
+/* 0x1848	     */		ldx	[%sp+296],%g3
+/* 0x184c	     */		fitod	%f6,%f8
+/* 0x1850	     */		ldx	[%sp+304],%g2
+/* 0x1854	     */		fitod	%f7,%f6
+/* 0x1858	     */		add	%g2,%g3,%g2
+/* 0x185c	     */		fsubd	%f4,%f8,%f8
+/* 0x1860	     */		fsubd	%f4,%f6,%f6
+/* 0x1864	     */		fmuld	%f8,%f16,%f10
+/* 0x1868	     */		fmuld	%f6,%f16,%f12
+/* 0x186c	     */		fmuld	%f8,%f14,%f8
+/* 0x1870	     */		fmuld	%f6,%f14,%f6
+/* 0x1874	     */		faddd	%f10,%f2,%f10
+/* 0x1878	     */		faddd	%f12,%f2,%f12
+/* 0x187c	     */		fdtox	%f8,%f8
+/* 0x1880	     */		std	%f8,[%sp+272]
+/* 0x1884	     */		fdtox	%f6,%f6
+/* 0x1888	     */		std	%f6,[%sp+256]
+/* 0x188c	     */		fdtox	%f10,%f8
+/* 0x1890	     */		std	%f8,[%sp+264]
+/* 0x1894	     */		fdtox	%f12,%f6
+/* 0x1898	     */		std	%f6,[%sp+248]
+/* 0x189c	     */		ldd	[%o7+16],%f0
+/* 0x18a0	     */		fxnor	%f30,%f0,%f6
+/* 0x18a4	     */		fitod	%f6,%f8
+/* 0x18a8	     */		fitod	%f7,%f6
+/* 0x18ac	     */		fsubd	%f4,%f8,%f8
+/* 0x18b0	     */		fsubd	%f4,%f6,%f6
+/* 0x18b4	     */		fmuld	%f8,%f16,%f10
+/* 0x18b8	     */		fmuld	%f6,%f16,%f12
+/* 0x18bc	     */		fmuld	%f8,%f14,%f8
+/* 0x18c0	     */		fmuld	%f6,%f14,%f6
+/* 0x18c4	     */		faddd	%f10,%f2,%f10
+/* 0x18c8	     */		faddd	%f12,%f2,%f12
+/* 0x18cc	     */		fdtox	%f8,%f8
+/* 0x18d0	     */		std	%f8,[%sp+240]
+/* 0x18d4	     */		fdtox	%f6,%f6
+/* 0x18d8	     */		std	%f6,[%sp+224]
+/* 0x18dc	     */		fdtox	%f10,%f8
+/* 0x18e0	     */		std	%f8,[%sp+232]
+/* 0x18e4	     */		fdtox	%f12,%f6
+/* 0x18e8	     */		std	%f6,[%sp+216]
+/* 0x18ec	     */		ldd	[%o7+24],%f0
+/* 0x18f0	     */		fxnor	%f30,%f0,%f6
+/* 0x18f4	     */		fitod	%f6,%f8
+/* 0x18f8	     */		fitod	%f7,%f6
+/* 0x18fc	     */		fsubd	%f4,%f8,%f8
+/* 0x1900	     */		fsubd	%f4,%f6,%f6
+/* 0x1904	     */		fmuld	%f8,%f16,%f10
+/* 0x1908	     */		fmuld	%f6,%f16,%f12
+/* 0x190c	     */		fmuld	%f8,%f14,%f8
+/* 0x1910	     */		fmuld	%f6,%f14,%f6
+/* 0x1914	     */		faddd	%f10,%f2,%f10
+/* 0x1918	     */		faddd	%f12,%f2,%f12
+/* 0x191c	     */		fdtox	%f8,%f8
+/* 0x1920	     */		std	%f8,[%sp+208]
+/* 0x1924	     */		fdtox	%f6,%f6
+/* 0x1928	     */		std	%f6,[%sp+192]
+/* 0x192c	     */		fdtox	%f10,%f8
+/* 0x1930	     */		std	%f8,[%sp+200]
+/* 0x1934	     */		fdtox	%f12,%f6
+/* 0x1938	     */		std	%f6,[%sp+184]
+/* 0x193c	     */		ldd	[%o7+32],%f0
+/* 0x1940	     */		fxnor	%f30,%f0,%f6
+/* 0x1944	 281 */		fitod	%f6,%f8
+/* 0x1948	     */		fitod	%f7,%f6
+/* 0x194c	     */		fsubd	%f4,%f8,%f8
+/* 0x1950	     */		fsubd	%f4,%f6,%f6
+/* 0x1954	     */		fmuld	%f8,%f16,%f10
+/* 0x1958	     */		fmuld	%f6,%f16,%f12
+/* 0x195c	     */		fmuld	%f8,%f14,%f8
+/* 0x1960	     */		fmuld	%f6,%f14,%f6
+/* 0x1964	     */		faddd	%f10,%f2,%f10
+/* 0x1968	     */		faddd	%f12,%f2,%f12
+/* 0x196c	     */		fdtox	%f8,%f8
+/* 0x1970	     */		std	%f8,[%sp+176]
+/* 0x1974	     */		fdtox	%f6,%f6
+/* 0x1978	     */		std	%f6,[%sp+160]
+/* 0x197c	     */		fdtox	%f10,%f8
+/* 0x1980	     */		std	%f8,[%sp+168]
+/* 0x1984	     */		fdtox	%f12,%f6
+/* 0x1988	     */		std	%f6,[%sp+152]
+/* 0x198c	     */		ldd	[%o7+40],%f0
+/* 0x1990	     */		fxnor	%f30,%f0,%f6
+/* 0x1994	     */		fitod	%f6,%f8
+/* 0x1998	     */		fitod	%f7,%f6
+/* 0x199c	     */		fsubd	%f4,%f8,%f8
+/* 0x19a0	     */		fsubd	%f4,%f6,%f6
+/* 0x19a4	     */		fmuld	%f8,%f16,%f10
+/* 0x19a8	     */		fmuld	%f6,%f16,%f12
+/* 0x19ac	     */		fmuld	%f8,%f14,%f8
+/* 0x19b0	     */		fmuld	%f6,%f14,%f6
+/* 0x19b4	     */		faddd	%f10,%f2,%f10
+/* 0x19b8	     */		faddd	%f12,%f2,%f12
+/* 0x19bc	     */		fdtox	%f8,%f8
+/* 0x19c0	     */		std	%f8,[%sp+144]
+/* 0x19c4	     */		fdtox	%f6,%f6
+/* 0x19c8	     */		std	%f6,[%sp+128]
+/* 0x19cc	     */		fdtox	%f10,%f8
+/* 0x19d0	     */		std	%f8,[%sp+136]
+/* 0x19d4	     */		fdtox	%f12,%f6
+/* 0x19d8	     */		std	%f6,[%sp+120]
+/* 0x19dc	     */		ldd	[%o7+48],%f0
+/* 0x19e0	     */		fxnor	%f30,%f0,%f6
+/* 0x19e4	     */		fitod	%f6,%f8
+/* 0x19e8	     */		fitod	%f7,%f6
+/* 0x19ec	     */		fsubd	%f4,%f8,%f8
+/* 0x19f0	     */		fsubd	%f4,%f6,%f12
+/* 0x19f4	     */		fmuld	%f8,%f16,%f6
+/* 0x19f8	     */		fmuld	%f8,%f14,%f8
+/* 0x19fc	     */		fmuld	%f12,%f14,%f10
+/* 0x1a00	     */		faddd	%f6,%f2,%f6
+/* 0x1a04	     */		fdtox	%f8,%f8
+/* 0x1a08	     */		std	%f8,[%sp+112]
+/* 0x1a0c	     */		fdtox	%f10,%f0
+/* 0x1a10	     */		fdtox	%f6,%f6
+/* 0x1a14	     */		std	%f6,[%sp+104]
+/* 0x1a18	     */		ld	[%i1],%g3
+/* 0x1a1c	     */		fmuld	%f12,%f16,%f6
+/* 0x1a20	 282 */		ld	[%i1+4],%g5
+/* 0x1a24	     */		add	%g2,%g3,%g2
+/* 0x1a28	     */		ld	[%i1+8],%o4
+/* 0x1a2c	     */		sub	%g2,%o0,%o0
+/* 0x1a30	     */		st	%o0,[%i4]
+/* 0x1a34	 281 */		faddd	%f6,%f2,%f6
+/* 0x1a38	 282 */		ldx	[%sp+280],%g4
+/* 0x1a3c	     */		srlx	%o0,32,%g2
+/* 0x1a40	     */		ldx	[%sp+288],%g3
+/* 0x1a44	     */		ld	[%i1+20],%o2
+/* 0x1a48	 281 */		fdtox	%f6,%f6
+/* 0x1a4c	 282 */		add	%g3,%g4,%g3
+/* 0x1a50	     */		add	%g3,%g5,%g3
+/* 0x1a54	     */		ld	[%i1+12],%g5
+/* 0x1a58	     */		add	%g3,%g2,%g2
+/* 0x1a5c	     */		ld	[%i1+16],%g3
+/* 0x1a60	     */		sub	%g2,%o3,%g2
+/* 0x1a64	     */		st	%g2,[%i4+4]
+/* 0x1a68	     */		ldx	[%sp+264],%o1
+/* 0x1a6c	     */		srlx	%g2,32,%g2
+/* 0x1a70	     */		ldx	[%sp+272],%o0
+/* 0x1a74	     */		add	%o0,%o1,%o0
+/* 0x1a78	     */		ld	[%i1+24],%o1
+/* 0x1a7c	     */		add	%o0,%o4,%g4
+/* 0x1a80	     */		ld	[%i1+28],%o0
+/* 0x1a84	     */		add	%g4,%g2,%g4
+
+!  283		      !      ADD_S64_U32_E_8(8);
+
+/* 0x1a88	 283 */		ld	[%i1+32],%g2
+/* 0x1a8c	 282 */		sub	%g4,%o3,%g4
+/* 0x1a90	     */		st	%g4,[%i4+8]
+/* 0x1a94	     */		ldx	[%sp+248],%o4
+/* 0x1a98	     */		srlx	%g4,32,%g4
+/* 0x1a9c	     */		ldx	[%sp+256],%o3
+/* 0x1aa0	     */		ldd	[%o7+56],%f8
+/* 0x1aa4	     */		add	%o3,%o4,%o3
+/* 0x1aa8	     */		ldx	[%sp+96],%o7
+/* 0x1aac	     */		add	%o3,%g5,%g5
+/* 0x1ab0	     */		fxnor	%f30,%f8,%f8
+/* 0x1ab4	 281 */		std	%f6,[%sp+360]
+/* 0x1ab8	 282 */		add	%g5,%g4,%o4
+/* 0x1abc	 281 */		std	%f0,[%sp+368]
+/* 0x1ac0	 282 */		sub	%o4,%o7,%o4
+/* 0x1ac4	     */		st	%o4,[%i4+12]
+/* 0x1ac8	 281 */		fitod	%f8,%f10
+/* 0x1acc	 282 */		ldx	[%sp+232],%o7
+/* 0x1ad0	     */		srlx	%o4,32,%o4
+/* 0x1ad4	 281 */		fitod	%f9,%f8
+/* 0x1ad8	 282 */		ldx	[%sp+240],%g5
+/* 0x1adc	 281 */		fsubd	%f4,%f10,%f10
+/* 0x1ae0	 283 */		ld	[%i1+44],%g4
+/* 0x1ae4	 282 */		add	%g5,%o7,%g5
+/* 0x1ae8	     */		ldx	[%sp+96],%o7
+/* 0x1aec	 281 */		fsubd	%f4,%f8,%f6
+/* 0x1af0	 282 */		add	%g5,%g3,%g3
+/* 0x1af4	 283 */		ld	[%i1+48],%g5
+/* 0x1af8	 282 */		add	%g3,%o4,%g3
+/* 0x1afc	 281 */		fmuld	%f10,%f16,%f8
+/* 0x1b00	 283 */		stx	%g4,[%sp+320]
+/* 0x1b04	 282 */		sub	%g3,%o7,%g3
+/* 0x1b08	     */		st	%g3,[%i4+16]
+/* 0x1b0c	 281 */		fmuld	%f10,%f14,%f10
+/* 0x1b10	 282 */		stx	%g5,[%sp+312]
+/* 0x1b14	     */		srlx	%g3,32,%g3
+/* 0x1b18	 281 */		fmuld	%f6,%f16,%f12
+/* 0x1b1c	 282 */		ldx	[%sp+224],%o7
+/* 0x1b20	 281 */		faddd	%f8,%f2,%f8
+/* 0x1b24	     */		fmuld	%f6,%f14,%f6
+/* 0x1b28	 282 */		ldx	[%sp+216],%g5
+/* 0x1b2c	 281 */		fdtox	%f10,%f10
+/* 0x1b30	 283 */		ldx	[%sp+368],%o4
+/* 0x1b34	 282 */		add	%o7,%g5,%g5
+/* 0x1b38	 283 */		ldx	[%sp+360],%g4
+/* 0x1b3c	 281 */		fdtox	%f8,%f8
+/* 0x1b40	 282 */		add	%g5,%o2,%o2
+/* 0x1b44	 283 */		ld	[%i1+52],%g5
+/* 0x1b48	 281 */		fdtox	%f6,%f6
+/* 0x1b4c	 282 */		add	%o2,%g3,%g3
+/* 0x1b50	     */		ldx	[%sp+96],%o2
+/* 0x1b54	 283 */		add	%o4,%g4,%g4
+/* 0x1b58	 281 */		std	%f10,[%sp+352]
+/* 0x1b5c	 283 */		add	%g4,%g5,%o4
+/* 0x1b60	 281 */		faddd	%f12,%f2,%f10
+/* 0x1b64	 282 */		sub	%g3,%o2,%g3
+/* 0x1b68	     */		st	%g3,[%i4+20]
+/* 0x1b6c	     */		ldx	[%sp+200],%o7
+/* 0x1b70	     */		srlx	%g3,32,%g3
+/* 0x1b74	     */		ldx	[%sp+208],%o2
+/* 0x1b78	 281 */		std	%f8,[%sp+344]
+/* 0x1b7c	     */		fdtox	%f10,%f8
+/* 0x1b80	 282 */		add	%o2,%o7,%o2
+/* 0x1b84	 281 */		std	%f6,[%sp+336]
+/* 0x1b88	 282 */		add	%o2,%o1,%g4
+/* 0x1b8c	     */		ldx	[%sp+96],%o1
+/* 0x1b90	     */		add	%g4,%g3,%g3
+/* 0x1b94	 283 */		ldx	[%sp+352],%g5
+/* 0x1b98	 282 */		sub	%g3,%o1,%g3
+/* 0x1b9c	     */		st	%g3,[%i4+24]
+/* 0x1ba0	 283 */		ldx	[%sp+344],%o7
+/* 0x1ba4	 282 */		srlx	%g3,32,%g3
+/* 0x1ba8	 281 */		std	%f8,[%sp+328]
+/* 0x1bac	 282 */		ldx	[%sp+192],%o1
+/* 0x1bb0	 283 */		add	%g5,%o7,%o2
+/* 0x1bb4	 282 */		ldx	[%sp+184],%g4
+/* 0x1bb8	 283 */		ld	[%i1+56],%g5
+/* 0x1bbc	 282 */		add	%o1,%g4,%g4
+/* 0x1bc0	     */		ldx	[%sp+96],%o7
+/* 0x1bc4	 283 */		add	%o2,%g5,%o2
+/* 0x1bc8	 282 */		add	%g4,%o0,%g4
+/* 0x1bcc	 283 */		ldx	[%sp+336],%o1
+/* 0x1bd0	     */		ldx	[%sp+328],%g5
+/* 0x1bd4	 282 */		add	%g4,%g3,%g3
+/* 0x1bd8	 283 */		ld	[%i1+60],%g4
+/* 0x1bdc	 282 */		sub	%g3,%o7,%g3
+/* 0x1be0	 283 */		add	%o1,%g5,%g5
+/* 0x1be4	 282 */		st	%g3,[%i4+28]
+/* 0x1be8	 283 */		add	%g5,%g4,%o1
+/* 0x1bec	     */		ldx	[%sp+176],%o0
+/* 0x1bf0	     */		ldx	[%sp+168],%g4
+/* 0x1bf4	     */		srlx	%g3,32,%g3
+/* 0x1bf8	     */		ld	[%i1+36],%o5
+/* 0x1bfc	     */		add	%o0,%g4,%g4
+/* 0x1c00	     */		ld	[%i1+40],%o3
+/* 0x1c04	     */		add	%g4,%g2,%g2
+/* 0x1c08	     */		add	%g2,%g3,%g2
+/* 0x1c0c	     */		sub	%g2,%o7,%g2
+/* 0x1c10	     */		st	%g2,[%i4+32]
+/* 0x1c14	     */		ldx	[%sp+160],%g5
+/* 0x1c18	     */		srlx	%g2,32,%g2
+/* 0x1c1c	     */		ldx	[%sp+152],%g4
+/* 0x1c20	     */		add	%g5,%g4,%g3
+/* 0x1c24	     */		add	%g3,%o5,%g3
+/* 0x1c28	     */		add	%g3,%g2,%g2
+/* 0x1c2c	     */		sub	%g2,%o7,%g2
+/* 0x1c30	     */		st	%g2,[%i4+36]
+/* 0x1c34	     */		ldx	[%sp+144],%g5
+/* 0x1c38	     */		srlx	%g2,32,%g2
+/* 0x1c3c	     */		ldx	[%sp+136],%g4
+/* 0x1c40	     */		add	%g5,%g4,%g3
+/* 0x1c44	     */		ldx	[%sp+320],%g5
+/* 0x1c48	     */		add	%g3,%o3,%o3
+/* 0x1c4c	     */		add	%o3,%g2,%o3
+/* 0x1c50	     */		sub	%o3,%o7,%o3
+/* 0x1c54	     */		st	%o3,[%i4+40]
+/* 0x1c58	     */		ldx	[%sp+128],%g4
+/* 0x1c5c	     */		srlx	%o3,32,%o3
+/* 0x1c60	     */		ldx	[%sp+120],%g3
+/* 0x1c64	     */		add	%g4,%g3,%g2
+/* 0x1c68	     */		add	%g2,%g5,%g2
+/* 0x1c6c	     */		ldx	[%sp+312],%g5
+/* 0x1c70	     */		add	%g2,%o3,%o3
+/* 0x1c74	     */		sub	%o3,%o7,%o3
+/* 0x1c78	     */		st	%o3,[%i4+44]
+/* 0x1c7c	     */		ldx	[%sp+112],%g4
+/* 0x1c80	     */		srlx	%o3,32,%o3
+/* 0x1c84	     */		ldx	[%sp+104],%g3
+/* 0x1c88	     */		add	%g4,%g3,%g2
+/* 0x1c8c	     */		add	%g2,%g5,%g2
+/* 0x1c90	     */		add	%g2,%o3,%o3
+/* 0x1c94	     */		sub	%o3,%o7,%o3
+/* 0x1c98	     */		st	%o3,[%i4+48]
+/* 0x1c9c	     */		srlx	%o3,32,%o3
+/* 0x1ca0	     */		add	%o4,%o3,%g2
+/* 0x1ca4	     */		sub	%g2,%o7,%g2
+/* 0x1ca8	     */		st	%g2,[%i4+52]
+/* 0x1cac	     */		srlx	%g2,32,%g2
+/* 0x1cb0	     */		add	%o2,%g2,%g2
+/* 0x1cb4	     */		sub	%g2,%o7,%g2
+/* 0x1cb8	     */		st	%g2,[%i4+56]
+/* 0x1cbc	     */		srlx	%g2,32,%g2
+/* 0x1cc0	     */		add	%o1,%g2,%g2
+/* 0x1cc4	     */		sub	%g2,%o7,%g2
+/* 0x1cc8	     */		st	%g2,[%i4+60]
+
+!  285		      !      return uc;
+
+/* 0x1ccc	 285 */		srlx	%g2,32,%i0
+/* 0x1cd0	     */		ret	! Result =  %i0
+/* 0x1cd4	     */		restore	%g0,%g0,%g0
+                       .L77000106:
+
+!  287		      !    } else {
+!  288		      !      DEF_VARS(2*BUFF_SIZE);
+!  289		      !      t_d64 d0, d1, db;
+!  290		      !      t_u32 uc = 0;
+!  291		      !      t_s32 i;
+!  293		      !      da = (t_d64)(a &  A_MASK);
+!  294		      !      db = (t_d64)(a &~ A_MASK);
+
+/* 0x1cd8	 294 */		or	%g0,%g2,%g3
+/* 0x1cdc	 293 */		andn	%o0,%g2,%g2
+/* 0x1ce0	     */		st	%g2,[%sp+316]
+/* 0x1ce4	 288 */		fmovd	%f30,%f14
+/* 0x1ce8	 294 */		and	%o0,%g3,%g2
+/* 0x1cec	     */		st	%g2,[%sp+312]
+/* 0x1cf0	 290 */		or	%g0,0,%g4
+
+!  296		      !#pragma pipeloop(0)
+!  297		      !      for (i = 0; i < (n+1)/2; i ++) {
+
+/* 0x1cf4	 297 */		add	%o2,1,%g2
+/* 0x1cf8	 293 */		ldd	[%o1],%f6
+/* 0x1cfc	 285 */		sethi	%hi(0x2c00),%g1
+/* 0x1d00	 297 */		srl	%g2,31,%g3
+/* 0x1d04	 285 */		xor	%g1,-8,%g1
+/* 0x1d08	 288 */		ldd	[%o1+8],%f22
+/* 0x1d0c	 297 */		add	%g2,%g3,%g2
+/* 0x1d10	 293 */		fmovs	%f6,%f8
+/* 0x1d14	 285 */		add	%g1,%fp,%g5
+/* 0x1d18	 294 */		fmovs	%f6,%f10
+/* 0x1d1c	 293 */		ld	[%sp+316],%f9
+/* 0x1d20	 297 */		sra	%g2,1,%o0
+/* 0x1d24	 294 */		ld	[%sp+312],%f11
+/* 0x1d28	 297 */		cmp	%o0,0
+/* 0x1d2c	 285 */		sethi	%hi(0x2800),%g1
+/* 0x1d30	 293 */		fsubd	%f8,%f6,%f20
+/* 0x1d34	 285 */		xor	%g1,-1024,%g1
+/* 0x1d38	     */		ldd	[%o1+16],%f16
+/* 0x1d3c	 294 */		fsubd	%f10,%f6,%f18
+/* 0x1d40	 297 */		ble,pt	%icc,.L900000193
+/* 0x1d44	     */		cmp	%o3,0
+/* 0x1d48	 285 */		add	%g1,%fp,%g3
+/* 0x1d4c	     */		sethi	%hi(0x2800),%g1
+/* 0x1d50	     */		xor	%g1,-1016,%g1
+/* 0x1d54	     */		or	%g0,%o7,%o1
+/* 0x1d58	     */		add	%g1,%fp,%g2
+/* 0x1d5c	     */		sethi	%hi(0x2800),%g1
+/* 0x1d60	     */		xor	%g1,-1008,%g1
+/* 0x1d64	     */		sub	%o0,1,%o2
+/* 0x1d68	 297 */		cmp	%o0,7
+/* 0x1d6c	     */		or	%g0,0,%i0
+/* 0x1d70	 285 */		add	%g1,%fp,%o7
+/* 0x1d74	 297 */		bl,pn	%icc,.L77000107
+/* 0x1d78	     */		add	%o1,8,%o0
+/* 0x1d7c	     */		ldd	[%o1],%f2
+
+!  298		      !        MUL_U32_S64_2_E(i);
+
+/* 0x1d80	 298 */		add	%i2,16,%i1
+/* 0x1d84	 297 */		sub	%o2,2,%o1
+/* 0x1d88	     */		ldd	[%o0],%f0
+/* 0x1d8c	 298 */		or	%g0,4,%i0
+/* 0x1d90	     */		add	%i1,8,%o0
+/* 0x1d94	     */		fxnor	%f30,%f2,%f6
+/* 0x1d98	     */		ldd	[%i2+16],%f4
+/* 0x1d9c	     */		fxnor	%f30,%f0,%f12
+/* 0x1da0	     */		ldd	[%i2+24],%f0
+/* 0x1da4	     */		fitod	%f7,%f2
+/* 0x1da8	     */		fitod	%f6,%f6
+/* 0x1dac	     */		fxnor	%f30,%f4,%f10
+/* 0x1db0	     */		fsubd	%f22,%f2,%f2
+/* 0x1db4	     */		fxnor	%f30,%f0,%f8
+/* 0x1db8	     */		fitod	%f13,%f4
+/* 0x1dbc	     */		fsubd	%f22,%f6,%f6
+/* 0x1dc0	     */		fmuld	%f2,%f20,%f0
+                       .L900000185:
+/* 0x1dc4	 298 */		fitod	%f11,%f26
+/* 0x1dc8	     */		add	%i0,3,%i0
+/* 0x1dcc	     */		add	%o7,96,%o7
+/* 0x1dd0	     */		fmuld	%f2,%f18,%f32
+/* 0x1dd4	     */		fsubd	%f22,%f4,%f4
+/* 0x1dd8	     */		add	%o0,8,%o0
+/* 0x1ddc	     */		cmp	%i0,%o1
+/* 0x1de0	     */		fmuld	%f6,%f18,%f30
+/* 0x1de4	     */		ldd	[%o0],%f2
+/* 0x1de8	     */		add	%g2,96,%g2
+/* 0x1dec	     */		add	%g3,96,%g3
+/* 0x1df0	     */		fdtox	%f0,%f24
+/* 0x1df4	     */		fmuld	%f6,%f20,%f28
+/* 0x1df8	     */		faddd	%f32,%f16,%f0
+/* 0x1dfc	     */		add	%g5,96,%g5
+/* 0x1e00	     */		faddd	%f30,%f16,%f30
+/* 0x1e04	     */		fitod	%f12,%f6
+/* 0x1e08	     */		fdtox	%f28,%f28
+/* 0x1e0c	     */		fdtox	%f30,%f12
+/* 0x1e10	     */		std	%f28,[%g5-96]
+/* 0x1e14	     */		std	%f12,[%g3-96]
+/* 0x1e18	     */		fdtox	%f0,%f0
+/* 0x1e1c	     */		fsubd	%f22,%f6,%f28
+/* 0x1e20	     */		std	%f24,[%g2-96]
+/* 0x1e24	     */		fxnor	%f14,%f2,%f12
+/* 0x1e28	     */		fmuld	%f4,%f20,%f24
+/* 0x1e2c	     */		std	%f0,[%o7-96]
+/* 0x1e30	     */		fitod	%f9,%f2
+/* 0x1e34	     */		fmuld	%f4,%f18,%f4
+/* 0x1e38	     */		fsubd	%f22,%f26,%f0
+/* 0x1e3c	     */		fmuld	%f28,%f18,%f26
+/* 0x1e40	     */		add	%o0,8,%o0
+/* 0x1e44	     */		ldd	[%o0],%f6
+/* 0x1e48	     */		fdtox	%f24,%f24
+/* 0x1e4c	     */		faddd	%f4,%f16,%f4
+/* 0x1e50	     */		fmuld	%f28,%f20,%f28
+/* 0x1e54	     */		faddd	%f26,%f16,%f26
+/* 0x1e58	     */		fitod	%f10,%f10
+/* 0x1e5c	     */		fdtox	%f28,%f28
+/* 0x1e60	     */		fdtox	%f26,%f26
+/* 0x1e64	     */		std	%f28,[%g5-64]
+/* 0x1e68	     */		std	%f26,[%g3-64]
+/* 0x1e6c	     */		fdtox	%f4,%f4
+/* 0x1e70	     */		fsubd	%f22,%f10,%f28
+/* 0x1e74	     */		std	%f24,[%g2-64]
+/* 0x1e78	     */		fxnor	%f14,%f6,%f10
+/* 0x1e7c	     */		fmuld	%f0,%f20,%f26
+/* 0x1e80	     */		std	%f4,[%o7-64]
+/* 0x1e84	     */		fitod	%f13,%f4
+/* 0x1e88	     */		fmuld	%f0,%f18,%f0
+/* 0x1e8c	     */		fsubd	%f22,%f2,%f2
+/* 0x1e90	     */		fmuld	%f28,%f18,%f6
+/* 0x1e94	     */		add	%o0,8,%o0
+/* 0x1e98	     */		ldd	[%o0],%f24
+/* 0x1e9c	     */		fdtox	%f26,%f26
+/* 0x1ea0	     */		faddd	%f0,%f16,%f0
+/* 0x1ea4	     */		fmuld	%f28,%f20,%f28
+/* 0x1ea8	     */		faddd	%f6,%f16,%f30
+/* 0x1eac	     */		fitod	%f8,%f6
+/* 0x1eb0	     */		fdtox	%f28,%f28
+/* 0x1eb4	     */		fdtox	%f30,%f8
+/* 0x1eb8	     */		std	%f28,[%g5-32]
+/* 0x1ebc	     */		std	%f8,[%g3-32]
+/* 0x1ec0	     */		fdtox	%f0,%f0
+/* 0x1ec4	     */		fsubd	%f22,%f6,%f6
+/* 0x1ec8	     */		std	%f26,[%g2-32]
+/* 0x1ecc	     */		fxnor	%f14,%f24,%f8
+/* 0x1ed0	     */		std	%f0,[%o7-32]
+/* 0x1ed4	     */		ble,pt	%icc,.L900000185
+/* 0x1ed8	     */		fmuld	%f2,%f20,%f0
+                       .L900000188:
+/* 0x1edc	 298 */		fitod	%f12,%f24
+/* 0x1ee0	     */		fmuld	%f6,%f18,%f26
+/* 0x1ee4	     */		add	%g5,128,%g5
+/* 0x1ee8	     */		fitod	%f10,%f12
+/* 0x1eec	     */		fmuld	%f6,%f20,%f28
+/* 0x1ef0	     */		add	%g3,128,%g3
+/* 0x1ef4	     */		fsubd	%f22,%f4,%f4
+/* 0x1ef8	     */		fmuld	%f2,%f18,%f2
+/* 0x1efc	     */		add	%g2,128,%g2
+/* 0x1f00	     */		fsubd	%f22,%f24,%f24
+/* 0x1f04	     */		add	%o7,128,%o7
+/* 0x1f08	     */		cmp	%i0,%o2
+/* 0x1f0c	     */		faddd	%f26,%f16,%f6
+/* 0x1f10	     */		add	%o0,8,%o1
+/* 0x1f14	     */		fdtox	%f28,%f28
+/* 0x1f18	     */		std	%f28,[%g5-128]
+/* 0x1f1c	     */		fmuld	%f4,%f18,%f30
+/* 0x1f20	     */		faddd	%f2,%f16,%f2
+/* 0x1f24	     */		fmuld	%f24,%f18,%f26
+/* 0x1f28	     */		fitod	%f11,%f10
+/* 0x1f2c	     */		fmuld	%f24,%f20,%f28
+/* 0x1f30	     */		fsubd	%f22,%f12,%f24
+/* 0x1f34	     */		fmuld	%f4,%f20,%f4
+/* 0x1f38	     */		fdtox	%f6,%f6
+/* 0x1f3c	     */		std	%f6,[%g3-128]
+/* 0x1f40	     */		fdtox	%f0,%f0
+/* 0x1f44	     */		std	%f0,[%g2-128]
+/* 0x1f48	     */		fitod	%f8,%f6
+/* 0x1f4c	     */		fmuld	%f24,%f18,%f12
+/* 0x1f50	     */		fdtox	%f2,%f0
+/* 0x1f54	     */		std	%f0,[%o7-128]
+/* 0x1f58	     */		fmuld	%f24,%f20,%f24
+/* 0x1f5c	     */		fsubd	%f22,%f10,%f10
+/* 0x1f60	     */		faddd	%f26,%f16,%f26
+/* 0x1f64	     */		fitod	%f9,%f2
+/* 0x1f68	     */		fsubd	%f22,%f6,%f6
+/* 0x1f6c	     */		fmuld	%f10,%f18,%f0
+/* 0x1f70	     */		fdtox	%f28,%f28
+/* 0x1f74	     */		std	%f28,[%g5-96]
+/* 0x1f78	     */		fmuld	%f10,%f20,%f10
+/* 0x1f7c	     */		faddd	%f30,%f16,%f8
+/* 0x1f80	     */		fdtox	%f26,%f26
+/* 0x1f84	     */		std	%f26,[%g3-96]
+/* 0x1f88	     */		fdtox	%f4,%f4
+/* 0x1f8c	     */		std	%f4,[%g2-96]
+/* 0x1f90	     */		fsubd	%f22,%f2,%f2
+/* 0x1f94	     */		fmuld	%f6,%f18,%f4
+/* 0x1f98	     */		faddd	%f12,%f16,%f12
+/* 0x1f9c	     */		fmuld	%f6,%f20,%f6
+/* 0x1fa0	     */		fdtox	%f8,%f8
+/* 0x1fa4	     */		std	%f8,[%o7-96]
+/* 0x1fa8	     */		faddd	%f0,%f16,%f8
+/* 0x1fac	     */		fmuld	%f2,%f18,%f0
+/* 0x1fb0	     */		fdtox	%f24,%f24
+/* 0x1fb4	     */		std	%f24,[%g5-64]
+/* 0x1fb8	     */		fmuld	%f2,%f20,%f2
+/* 0x1fbc	     */		fdtox	%f12,%f12
+/* 0x1fc0	     */		std	%f12,[%g3-64]
+/* 0x1fc4	     */		fdtox	%f10,%f10
+/* 0x1fc8	     */		std	%f10,[%g2-64]
+/* 0x1fcc	     */		faddd	%f4,%f16,%f4
+/* 0x1fd0	     */		fdtox	%f8,%f8
+/* 0x1fd4	     */		std	%f8,[%o7-64]
+/* 0x1fd8	     */		faddd	%f0,%f16,%f0
+/* 0x1fdc	     */		fdtox	%f6,%f6
+/* 0x1fe0	     */		std	%f6,[%g5-32]
+/* 0x1fe4	     */		fdtox	%f4,%f4
+/* 0x1fe8	     */		std	%f4,[%g3-32]
+/* 0x1fec	     */		fdtox	%f2,%f2
+/* 0x1ff0	     */		std	%f2,[%g2-32]
+/* 0x1ff4	     */		fdtox	%f0,%f0
+/* 0x1ff8	     */		bg,pn	%icc,.L77000084
+/* 0x1ffc	     */		std	%f0,[%o7-32]
+                       .L77000107:
+/* 0x2000	     */		ldd	[%o1],%f0
+                       .L900000192:
+/* 0x2004	     */		fxnor	%f14,%f0,%f2
+/* 0x2008	 298 */		add	%i0,1,%i0
+/* 0x200c	     */		add	%o1,8,%o1
+/* 0x2010	     */		cmp	%i0,%o2
+/* 0x2014	     */		fitod	%f2,%f0
+/* 0x2018	     */		fitod	%f3,%f2
+/* 0x201c	     */		fsubd	%f22,%f0,%f0
+/* 0x2020	     */		fsubd	%f22,%f2,%f2
+/* 0x2024	     */		fmuld	%f0,%f18,%f4
+/* 0x2028	     */		fmuld	%f0,%f20,%f6
+/* 0x202c	     */		fmuld	%f2,%f18,%f0
+/* 0x2030	     */		faddd	%f4,%f16,%f4
+/* 0x2034	     */		fmuld	%f2,%f20,%f2
+/* 0x2038	     */		fdtox	%f6,%f6
+/* 0x203c	     */		std	%f6,[%g5]
+/* 0x2040	     */		add	%g5,32,%g5
+/* 0x2044	     */		faddd	%f0,%f16,%f0
+/* 0x2048	     */		fdtox	%f4,%f4
+/* 0x204c	     */		std	%f4,[%g3]
+/* 0x2050	     */		add	%g3,32,%g3
+/* 0x2054	     */		fdtox	%f2,%f2
+/* 0x2058	     */		std	%f2,[%g2]
+/* 0x205c	     */		add	%g2,32,%g2
+/* 0x2060	     */		fdtox	%f0,%f0
+/* 0x2064	     */		std	%f0,[%o7]
+/* 0x2068	     */		add	%o7,32,%o7
+/* 0x206c	     */		ble,a,pt	%icc,.L900000192
+/* 0x2070	     */		ldd	[%o1],%f0
+                       .L77000084:
+
+!  299		      !      }
+!  301		      !#pragma pipeloop(0)
+!  302		      !      for (i = 0; i < n; i ++) {
+
+/* 0x2074	 302 */		cmp	%o3,0
+                       .L900000193:
+/* 0x2078	 302 */		ble,pt	%icc,.L77000089
+/* 0x207c	     */		or	%g0,%g4,%i0
+/* 0x2080	     */		sethi	%hi(0x2c00),%g1
+/* 0x2084	     */		xor	%g1,-8,%g1
+/* 0x2088	     */		or	%g0,%o4,%i1
+/* 0x208c	     */		add	%g1,%fp,%g5
+/* 0x2090	     */		sethi	%hi(0x2800),%g1
+/* 0x2094	     */		xor	%g1,-1024,%g1
+/* 0x2098	     */		or	%g0,0,%i2
+/* 0x209c	     */		add	%g1,%fp,%g3
+/* 0x20a0	     */		sub	%o3,1,%o7
+/* 0x20a4	     */		or	%g0,%i4,%i0
+/* 0x20a8	 298 */		cmp	%o3,7
+/* 0x20ac	     */		bl,pn	%icc,.L77000108
+/* 0x20b0	     */		sethi	%hi(0x2c00),%g1
+/* 0x20b4	     */		sub	%o3,4,%o4
+
+!  303		      !        ADD_S64_U32_E(i);
+
+/* 0x20b8	 303 */		ld	[%i1],%o3
+/* 0x20bc	     */		xor	%g1,-8,%g1
+/* 0x20c0	     */		ld	[%i1+4],%o1
+/* 0x20c4	     */		sethi	%hi(0x80000000),%o5
+/* 0x20c8	     */		add	%g1,%fp,%g1
+/* 0x20cc	     */		add	%i4,4,%i0
+/* 0x20d0	     */		ldx	[%g1+8],%o2
+/* 0x20d4	     */		sllx	%o5,32,%o5
+/* 0x20d8	     */		add	%i1,8,%i1
+/* 0x20dc	     */		ldx	[%g1],%o0
+/* 0x20e0	     */		or	%g0,3,%i2
+/* 0x20e4	     */		ldx	[%g1+24],%g2
+/* 0x20e8	     */		add	%o0,%o2,%o0
+/* 0x20ec	     */		ldx	[%g1+16],%o2
+/* 0x20f0	     */		sethi	%hi(0x2800),%g1
+/* 0x20f4	     */		xor	%g1,-992,%g1
+/* 0x20f8	     */		add	%o0,%o3,%o0
+/* 0x20fc	     */		add	%g1,%fp,%g3
+/* 0x2100	     */		sethi	%hi(0x2800),%g1
+/* 0x2104	     */		xor	%g1,-1000,%g1
+/* 0x2108	     */		sub	%o0,%o5,%o0
+/* 0x210c	     */		add	%g1,%fp,%g1
+/* 0x2110	     */		add	%o2,%g2,%o2
+/* 0x2114	     */		ldx	[%g1],%o3
+/* 0x2118	     */		sethi	%hi(0x2800),%g1
+/* 0x211c	     */		st	%o0,[%i4]
+/* 0x2120	     */		srlx	%o0,32,%o0
+/* 0x2124	     */		xor	%g1,-984,%g1
+/* 0x2128	     */		add	%g1,%fp,%g5
+                       .L900000165:
+/* 0x212c	 303 */		ldx	[%g3],%g4
+/* 0x2130	     */		srl	%o0,0,%g2
+/* 0x2134	     */		add	%o2,%o1,%o0
+/* 0x2138	     */		ld	[%i1],%o2
+/* 0x213c	     */		add	%o0,%g2,%g2
+/* 0x2140	     */		add	%i2,4,%i2
+/* 0x2144	     */		ldx	[%g5],%o1
+/* 0x2148	     */		add	%o3,%g4,%o0
+/* 0x214c	     */		sub	%g2,%o5,%o3
+/* 0x2150	     */		st	%o3,[%i0]
+/* 0x2154	     */		srlx	%o3,32,%o3
+/* 0x2158	     */		cmp	%i2,%o4
+/* 0x215c	     */		ldx	[%g3+16],%g2
+/* 0x2160	     */		add	%o0,%o2,%o0
+/* 0x2164	     */		ld	[%i1+4],%o2
+/* 0x2168	     */		add	%o0,%o3,%o3
+/* 0x216c	     */		add	%i0,16,%i0
+/* 0x2170	     */		ldx	[%g5+16],%o0
+/* 0x2174	     */		add	%o1,%g2,%o1
+/* 0x2178	     */		sub	%o3,%o5,%o3
+/* 0x217c	     */		st	%o3,[%i0-12]
+/* 0x2180	     */		srlx	%o3,32,%g4
+/* 0x2184	     */		add	%i1,16,%i1
+/* 0x2188	     */		ldx	[%g3+32],%g2
+/* 0x218c	     */		add	%o1,%o2,%o2
+/* 0x2190	     */		ld	[%i1-8],%o1
+/* 0x2194	     */		add	%o2,%g4,%o3
+/* 0x2198	     */		add	%g3,64,%g3
+/* 0x219c	     */		ldx	[%g5+32],%o2
+/* 0x21a0	     */		add	%o0,%g2,%o0
+/* 0x21a4	     */		sub	%o3,%o5,%o3
+/* 0x21a8	     */		st	%o3,[%i0-8]
+/* 0x21ac	     */		srlx	%o3,32,%o3
+/* 0x21b0	     */		add	%g5,64,%g5
+/* 0x21b4	     */		ldx	[%g3-16],%g2
+/* 0x21b8	     */		add	%o0,%o1,%o0
+/* 0x21bc	     */		ld	[%i1-4],%o1
+/* 0x21c0	     */		add	%o0,%o3,%o0
+/* 0x21c4	     */		ldx	[%g5-16],%o3
+/* 0x21c8	     */		add	%o2,%g2,%o2
+/* 0x21cc	     */		sub	%o0,%o5,%o0
+/* 0x21d0	     */		st	%o0,[%i0-4]
+/* 0x21d4	     */		ble,pt	%icc,.L900000165
+/* 0x21d8	     */		srlx	%o0,32,%o0
+                       .L900000168:
+/* 0x21dc	 303 */		srl	%o0,0,%o4
+/* 0x21e0	     */		ldx	[%g3],%o0
+/* 0x21e4	     */		add	%o2,%o1,%o1
+/* 0x21e8	     */		ld	[%i1],%o2
+/* 0x21ec	     */		add	%o1,%o4,%o1
+/* 0x21f0	     */		add	%i0,8,%i0
+/* 0x21f4	     */		sub	%o1,%o5,%o1
+/* 0x21f8	     */		add	%o3,%o0,%o0
+/* 0x21fc	     */		st	%o1,[%i0-8]
+/* 0x2200	     */		srlx	%o1,32,%o1
+/* 0x2204	     */		add	%o0,%o2,%o0
+/* 0x2208	     */		add	%o0,%o1,%o0
+/* 0x220c	     */		cmp	%i2,%o7
+/* 0x2210	     */		sub	%o0,%o5,%o0
+/* 0x2214	     */		st	%o0,[%i0-4]
+/* 0x2218	     */		bg,pn	%icc,.L77000088
+/* 0x221c	     */		srlx	%o0,32,%g4
+/* 0x2220	     */		add	%i1,4,%i1
+/* 0x2224	     */		add	%g3,16,%g3
+                       .L77000108:
+/* 0x2228	 303 */		ldx	[%g5],%o0
+                       .L900000191:
+/* 0x222c	 303 */		sethi	%hi(0x80000000),%o2
+/* 0x2230	     */		ldx	[%g3],%o3
+/* 0x2234	     */		add	%i2,1,%i2
+/* 0x2238	     */		sllx	%o2,32,%o5
+/* 0x223c	     */		ld	[%i1],%o2
+/* 0x2240	     */		add	%g5,16,%g5
+/* 0x2244	     */		srl	%g4,0,%o1
+/* 0x2248	     */		add	%o0,%o3,%o0
+/* 0x224c	     */		add	%o0,%o2,%o0
+/* 0x2250	     */		add	%i1,4,%i1
+/* 0x2254	     */		add	%o0,%o1,%o0
+/* 0x2258	     */		add	%g3,16,%g3
+/* 0x225c	     */		sub	%o0,%o5,%o0
+/* 0x2260	     */		st	%o0,[%i0]
+/* 0x2264	     */		cmp	%i2,%o7
+/* 0x2268	     */		srlx	%o0,32,%g4
+/* 0x226c	     */		add	%i0,4,%i0
+/* 0x2270	     */		ble,a,pt	%icc,.L900000191
+/* 0x2274	     */		ldx	[%g5],%o0
+                       .L77000088:
+
+!  304		      !      }
+!  306		      !      return uc;
+
+/* 0x2278	 306 */		or	%g0,%g4,%i0
+                       .L77000089:
+/* 0x227c	     */		ret	! Result =  %i0
+/* 0x2280	     */		restore	%g0,%g0,%g0
+/* 0x2284	   0 */		.type	mul_add,2
+/* 0x2284	     */		.size	mul_add,(.-mul_add)
+
+	.section	".text",#alloc,#execinstr
+/* 000000	   0 */		.align	4
+!
+! SUBROUTINE mul_add_inp
+!
+! OFFSET    SOURCE LINE	LABEL	INSTRUCTION
+
+                       	.global mul_add_inp
+                       mul_add_inp:
+/* 000000	     */		or	%g0,%o2,%g1
+/* 0x0004	     */		or	%g0,%o0,%g3
+/* 0x0008	     */		or	%g0,%o1,%g2
+/* 0x000c	     */		or	%g0,%o3,%o4
+
+!  307		      !    }
+!  308		      !  }
+!  309		      !}
+!  311		      !/***************************************************************/
+!  313		      !t_u32 mul_add_inp(t_u32 *x, t_u32 *y, int n, t_u32 a)
+!  314		      !{
+!  315		      !  return mul_add(x, x, y, n, a);
+
+/* 0x0010	 315 */		or	%g0,%g1,%o3
+/* 0x0014	     */		or	%g0,%g3,%o1
+/* 0x0018	     */		or	%g0,%g2,%o2
+/* 0x001c	     */		or	%g0,%o7,%g1
+/* 0x0020	     */		call	mul_add	! params =  %o0 %o1 %o2 %o3 %o4	! Result = 	! (tail call)
+/* 0x0024	     */		or	%g0,%g1,%o7
+/* 0x0028	   0 */		.type	mul_add_inp,2
+/* 0x0028	     */		.size	mul_add_inp,(.-mul_add_inp)
+
+! Begin Disassembling Stabs
+	.xstabs	".stab.index","Xa ; O ; P ; V=3.1 ; R=WorkShop Compilers 5.0 98/12/15 C 5.0",60,0,0,0	! (/usr/tmp/acompAAA52aaHc:1)
+	.xstabs	".stab.index","/h/interzone/d3/nelsonb/nss_28x/ns/security/lib/crypto; /tools/ns/workshop-5.0/bin/../SC5.0/bin/cc -fast -xO5 -xrestrict=%%all -xdepend -xchip=ultra -xarch=v8plusa -KPIC -mt -S vis_32.il  mul_add.c -W0,-xp",52,0,0,0	! (/usr/tmp/acompAAA52aaHc:2)
+! End Disassembling Stabs
+
+! Begin Disassembling Ident
+	.ident	"cg: WorkShop Compilers 5.0 99/08/12 Compiler Common 5.0 Patch 107357-05"	! (NO SOURCE LINE)
+	.ident	"@(#)vis_proto.h\t1.3\t97/03/30 SMI"	! (/usr/tmp/acompAAA52aaHc:4)
+	.ident	"acomp: WorkShop Compilers 5.0 98/12/15 C 5.0"	! (/usr/tmp/acompAAA52aaHc:12)
+! End Disassembling Ident
--- a/security/nss/lib/freebl/rsa.c
+++ b/security/nss/lib/freebl/rsa.c
@@ -254,16 +254,17 @@ RSA_NewKey(int keySizeInBits, SECItem *p
     /* 2.  Set the version number (PKCS1 v1.5 says it should be zero) */
     SECITEM_AllocItem(arena, &key->version, 1);
     key->version.data[0] = 0;
     /* 3.  Set the public exponent */
     SECITEM_CopyItem(arena, &key->publicExponent, publicExponent);
     SECITEM_TO_MPINT(*publicExponent, &e);
     kiter = 0;
     do {
+	prerr = 0;
 	PORT_SetError(0);
 	CHECK_SEC_OK( generate_prime(&p, primeLen) );
 	CHECK_SEC_OK( generate_prime(&q, primeLen) );
 	/* Assure q < p */
 	if (mp_cmp(&p, &q) < 0)
 	    mp_exch(&p, &q);
 	/* Attempt to use these primes to generate a key */
 	rv = rsa_keygen_from_primes(&p, &q, &e, key, keySizeInBits);
--- a/security/nss/lib/nss/nss.def
+++ b/security/nss/lib/nss/nss.def
@@ -442,8 +442,17 @@ NSSBase64Encoder_Destroy;
 NSSBase64Encoder_Update;
 ;+#PK11_DoPassword;
 ;+#PK11_FindKeyByKeyID;
 PK11_InitPin;
 PK11_NeedUserInit;
 ;+    local:
 ;+       *;
 ;+};
+;+NSS_3.2.1 {       # NSS 3.2 release
+;+    global:
+CERT_AddRDN;
+CERT_CreateRDN;
+CERT_CreateAVA;
+CERT_CreateName;
+;+    local:
+;+       *;
+;+};
--- a/security/nss/lib/nss/nss.h
+++ b/security/nss/lib/nss/nss.h
@@ -44,20 +44,20 @@ SEC_BEGIN_PROTOS
 
 /*
  * NSS's major version, minor version, patch level, and whether
  * this is a beta release.
  *
  * The format of the version string should be
  *     "<major version>.<minor version>[.<patch level>] [<Beta>]"
  */
-#define NSS_VERSION  "3.2"
+#define NSS_VERSION  "3.2.1"
 #define NSS_VMAJOR   3
 #define NSS_VMINOR   2
-#define NSS_VPATCH   0
+#define NSS_VPATCH   1
 #define NSS_BETA     PR_FALSE
 
 
 /*
  * Return a boolean that indicates whether the underlying library
  * will perform as the caller expects.
  *
  * The only argument is a string, which should be the verson
--- a/security/nss/lib/pk11wrap/pk11cert.c
+++ b/security/nss/lib/pk11wrap/pk11cert.c
@@ -2565,65 +2565,84 @@ isOnList(CERTCertList *certList,CERTCert
 static SECStatus
 pk11ListCertCallback(CERTCertificate *cert, SECItem *derCert, void *arg)
 {
     struct listCertsStr *listCertP = (struct listCertsStr *)arg;
     CERTCertificate *newCert = NULL;
     PK11CertListType type = listCertP->type;
     CERTCertList *certList = listCertP->certList;
     CERTCertTrust *trust;
+    PRBool isUnique = PR_FALSE;
+    char *nickname = NULL;
 
+
+    if ((type == PK11CertListUnique) || (type == PK11CertListRootUnique)) {
+	isUnique = PR_TRUE;
+    }
+    /* at this point the nickname is correct for the cert. save it for later */
+    if (!isUnique) {
+         nickname = PORT_ArenaStrdup(listCertP->certList->arena,cert->nickname);
+    }
     if (derCert == NULL) {
 	newCert=CERT_DupCertificate(cert);
     } else {
 	newCert=CERT_FindCertByDERCert(CERT_GetDefaultCertDB(),&cert->derCert);
     }
 
     if (newCert == NULL) return SECSuccess;
 
     trust = newCert->trust;
 
     /* if we want user certs and we don't have one skip this cert */
     if ((type == PK11CertListUser) && 
-	( (cert->slot == NULL) || 
-	  (trust == NULL) || (((trust->sslFlags & CERTDB_USER == 0)  && 
-				((trust->emailFlags & CERTDB_USER) == 0))) ) ) {
+	  ((trust == NULL) || 
+		( ((trust->sslFlags & CERTDB_USER) == 0)  && 
+			((trust->emailFlags & CERTDB_USER) == 0) )) ) {
+	CERT_DestroyCertificate(newCert);
+	return SECSuccess;
+    }
+
+    /* if we want root certs, skip the user certs */
+    if ((type == PK11CertListRootUnique) && 
+	  ((trust) && (((trust->sslFlags & CERTDB_USER )  || 
+				(trust->emailFlags & CERTDB_USER))) ) ) {
 	CERT_DestroyCertificate(newCert);
 	return SECSuccess;
     }
 
 
     /* if we want Unique certs and we already have it on our list, skip it */
-    if ((type == PK11CertListUnique) && (isOnList(certList,newCert))) {
+    if ( isUnique && isOnList(certList,newCert) ) {
 	CERT_DestroyCertificate(newCert);
 	return SECSuccess;
     }
 
 
     /* put slot certs at the end */
     if (newCert->slot && !PK11_IsInternal(newCert->slot)) {
-    	CERT_AddCertToListTail(certList,newCert);
+    	CERT_AddCertToListTailWithData(certList,newCert,nickname);
     } else {
-    	CERT_AddCertToListHead(certList,newCert);
+    	CERT_AddCertToListHeadWithData(certList,newCert,nickname);
     }
     return SECSuccess;
 }
 
 
 CERTCertList *
 PK11_ListCerts(PK11CertListType type, void *pwarg)
 {
     CERTCertList *certList = NULL;
     struct listCertsStr listCerts;
     
     certList= CERT_NewCertList();
     listCerts.type = type;
     listCerts.certList = certList;
 
-    SEC_TraversePermCerts(CERT_GetDefaultCertDB(),pk11ListCertCallback,&listCerts);
+    SEC_TraversePermCerts(CERT_GetDefaultCertDB(),pk11ListCertCallback,
+								&listCerts);
 
     PK11_TraverseSlotCerts(pk11ListCertCallback,&listCerts,pwarg);
 
     if (CERT_LIST_HEAD(certList) == NULL) {
 	CERT_DestroyCertList(certList);
 	certList = NULL;
     }
     return certList;
--- a/security/nss/lib/pk11wrap/pk11slot.c
+++ b/security/nss/lib/pk11wrap/pk11slot.c
@@ -1661,17 +1661,17 @@ PK11_InitToken(PK11SlotInfo *slot, PRBoo
     rv = PK11_ReadMechanismList(slot);
     if (rv != SECSuccess) return rv;
 
     slot->hasRSAInfo = PR_FALSE;
     slot->RSAInfoFlags = 0;
 
     /* initialize the maxKeyCount value */
     if (tokenInfo.ulMaxSessionCount == 0) {
-	slot->maxKeyCount = 300; /* should be #define or a config param */
+	slot->maxKeyCount = 800; /* should be #define or a config param */
     } else if (tokenInfo.ulMaxSessionCount < 20) {
 	/* don't have enough sessions to keep that many keys around */
 	slot->maxKeyCount = 0;
     } else {
 	slot->maxKeyCount = tokenInfo.ulMaxSessionCount/2;
     }
 
     /* Make sure our session handle is valid */
--- a/security/nss/lib/pk11wrap/secmodt.h
+++ b/security/nss/lib/pk11wrap/secmodt.h
@@ -92,18 +92,19 @@ struct PK11SlotListElementStr {
 };
 
 struct PK11RSAGenParamsStr {
     int keySizeInBits;
     unsigned long pe;
 };
 
 typedef enum {
-	PK11CertListUnique = 0,
-	PK11CertListUser = 1
+     PK11CertListUnique = 0,
+     PK11CertListUser = 1,
+     PK11CertListRootUnique = 2
 } PK11CertListType;
 
 /*
  * Entry into the Array which lists all the legal bits for the default flags
  * in the slot, their definition, and the PKCS #11 mechanism the represent
  * Always Statically allocated. 
  */
 struct PK11DefaultArrayEntryStr {
--- a/security/nss/lib/pkcs12/p12d.c
+++ b/security/nss/lib/pkcs12/p12d.c
@@ -698,16 +698,19 @@ sec_pkcs12_decoder_safe_contents_callbac
 		|| safeContentsCtx->p12dcx->error) {
 	return;
     }
     p12dcx = safeContentsCtx->p12dcx;
 
     /* update the decoder */
     rv = SEC_ASN1DecoderUpdate(safeContentsCtx->safeContentsDcx, buf, len);
     if(rv != SECSuccess) {
+	/* if we fail while trying to decode a 'safe', it's probably because
+	 * we didn't have the correct password. */
+	PORT_SetError(SEC_ERROR_BAD_PASSWORD);
 	p12dcx->errorValue = SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE;
 	goto loser;
     }
 
     return;
 
 loser:
     /* set the error and finish the context */
--- a/security/nss/lib/smime/smime.def
+++ b/security/nss/lib/smime/smime.def
@@ -164,8 +164,14 @@ SEC_PKCS12DecoderUpdate;
 SEC_PKCS12DecoderValidateBags;
 SEC_PKCS12DecoderVerify;
 SEC_PKCS12DestroyExportContext;
 SEC_PKCS12IsEncryptionAllowed;
 SEC_PKCS12SetPreferredCipher;
 ;+    local:
 ;+        *;
 ;+};
+;+NSS_3.2.1 {               # NSS 3.2.1 release
+;+    global:
+NSSSMIME_VersionCheck;
+;+    local:
+;+        *;
+;+};
--- a/security/nss/lib/smime/smimeutil.c
+++ b/security/nss/lib/smime/smimeutil.c
@@ -710,8 +710,33 @@ NSS_SMIMEUtil_GetCertFromEncryptionKeyPr
     default:
 	PORT_Assert(0);
     }
 loser:
     if (tmppoolp) PORT_FreeArena(tmppoolp, PR_FALSE);
 
     return cert;
 }
+
+extern const char __nss_smime_rcsid[];
+extern const char __nss_smime_sccsid[];
+
+PRBool
+NSSSMIME_VersionCheck(const char *importedVersion)
+{
+    /*
+     * This is the secret handshake algorithm.
+     *
+     * This release has a simple version compatibility
+     * check algorithm.  This release is not backward
+     * compatible with previous major releases.  It is
+     * not compatible with future major, minor, or
+     * patch releases.
+     */
+    int vmajor = 0, vminor = 0, vpatch = 0;
+    const char *ptr = importedVersion;
+    volatile char c; /* force a reference that won't get optimized away */
+
+    c = __nss_smime_rcsid[0] + __nss_smime_sccsid[0]; 
+
+    return NSS_VersionCheck(importedVersion);
+}
+
--- a/security/nss/lib/ssl/ssl.def
+++ b/security/nss/lib/ssl/ssl.def
@@ -94,8 +94,14 @@ SSL_RevealPinArg;
 SSL_RevealURL;
 SSL_SecurityStatus;
 SSL_SetPKCS11PinArg;
 SSL_SetSockPeerID;
 SSL_SetURL;
 ;+    local:
 ;+*;
 ;+};
+;+NSS_3.2.1 {       # NSS 3.2.1 release
+;+    global:
+NSSSSL_VersionCheck;
+;+    local:
+;+*;
+;+};
--- a/security/nss/lib/ssl/sslcon.c
+++ b/security/nss/lib/ssl/sslcon.c
@@ -3679,8 +3679,30 @@ ssl2_BeginServerHandshake(sslSocket *ss)
     ss->handshake     = ssl_GatherRecord1stHandshake;
     ss->nextHandshake = ssl2_HandleClientHelloMessage;
     return SECSuccess;
 
 loser:
     return SECFailure;
 }
 
+extern const char __nss_ssl_rcsid[];
+extern const char __nss_ssl_sccsid[];
+
+PRBool
+NSSSSL_VersionCheck(const char *importedVersion)
+{
+    /*
+     * This is the secret handshake algorithm.
+     *
+     * This release has a simple version compatibility
+     * check algorithm.  This release is not backward
+     * compatible with previous major releases.  It is
+     * not compatible with future major, minor, or
+     * patch releases.
+     */
+    int vmajor = 0, vminor = 0, vpatch = 0;
+    const char *ptr = importedVersion;
+    volatile char c; /* force a reference that won't get optimized away */
+
+    c = __nss_ssl_rcsid[0] + __nss_ssl_sccsid[0]; 
+    return NSS_VersionCheck(importedVersion);
+}
new file mode 100644
--- /dev/null
+++ b/security/nss/lib/ssl/sslsocks.c
@@ -0,0 +1,1157 @@
+/*
+ * Implementation of Socks protocol.
+ * None of this code is supported any longer.
+ * NSS officially does NOT support Socks.
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ * 
+ * The Original Code is the Netscape security libraries.
+ * 
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation.  Portions created by Netscape are 
+ * Copyright (C) 1994-2000 Netscape Communications Corporation.  All
+ * Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable 
+ * instead of those above.  If you wish to allow use of your 
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL.  If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ *
+ * $Id$
+ */
+#include "prtypes.h"
+#include "prnetdb.h"
+#include "cert.h"
+#include "ssl.h"
+#include "sslimpl.h"
+#include "prsystem.h"
+#include <stdio.h>
+#include "nspr.h"
+
+#ifdef XP_UNIX
+#include "prprf.h"
+#endif
+
+#ifdef XP_UNIX
+#define SOCKS_FILE	"/etc/socks.conf"
+#endif
+#ifdef XP_MAC
+#define SOCKS_FILE NULL
+#endif
+#ifdef XP_WIN
+#define SOCKS_FILE  NULL
+#endif
+#ifdef XP_OS2
+#define SOCKS_FILE  NULL
+#endif 
+
+#define SOCKS_VERSION	4
+
+#define DEF_SOCKD_PORT	1080
+
+#define SOCKS_CONNECT	1
+#define SOCKS_BIND	2
+
+#define SOCKS_RESULT	90
+#define SOCKS_FAIL	91
+#define SOCKS_NO_IDENTD	92 /* Failed to connect to Identd on client machine */
+#define SOCKS_BAD_ID	93 /* Client's Identd reported a different user-id */
+
+#define MAKE_IN_ADDR(a,b,c,d) \
+    PR_htonl(((PRUint32)(a) << 24) | ((PRUint32)(b) << 16) | ((c) << 8) | (d))
+
+struct sslSocksInfoStr {
+    PRUint32  	sockdHost;
+    PRUint16  	sockdPort;
+
+    char       	direct;
+    char       	didBind;
+
+    PRNetAddr 	bindAddr;
+
+    /* Data returned by sockd.  */
+    PRUint32  	destHost;
+    PRUint16  	destPort;
+};
+
+typedef enum {
+    OP_LESS	= 1,
+    OP_EQUAL	= 2,
+    OP_LEQUAL	= 3,
+    OP_GREATER	= 4,
+    OP_NOTEQUAL	= 5,
+    OP_GEQUAL	= 6,
+    OP_ALWAYS	= 7
+} SocksOp;
+
+typedef struct SocksConfItemStr SocksConfItem;
+
+struct SocksConfItemStr {
+    SocksConfItem *next;
+    PRUint32       daddr;	/* host IP addr, in network byte order. */
+    PRUint32       dmask;	/* mask for IP,  in network byte order. */
+    PRUint16       port;	/* port number,  in host    byte order. */
+    SocksOp        op;
+    char           direct;
+};
+
+static PRUint32 ourHost;		/* network byte order. */
+static SocksConfItem *ssl_socks_confs;
+
+SECStatus
+ssl_CreateSocksInfo(sslSocket *ss)
+{
+    sslSocksInfo *si;
+
+    if (ss->socks) {
+	/* Already been done */
+	return SECSuccess;
+    }
+
+    si = (sslSocksInfo*) PORT_ZAlloc(sizeof(sslSocksInfo));
+    if (si) {
+	ss->socks = si;
+	if (!ss->gather) {
+	    ss->gather = ssl_NewGather();
+	    if (!ss->gather) {
+		return SECFailure;
+	    }
+	}
+	return SECSuccess;
+    }
+    return SECFailure;
+}
+
+SECStatus
+ssl_CopySocksInfo(sslSocket *ss, sslSocket *os)
+{
+    SECStatus rv;
+
+#ifdef __cplusplus
+    os = os;
+#endif
+    rv = ssl_CreateSocksInfo(ss);
+    return rv;
+}
+
+void
+ssl_DestroySocksInfo(sslSocksInfo *si)
+{
+    if (si) {
+	PORT_Memset(si, 0x2f, sizeof *si);
+	PORT_Free(si);
+    }
+}
+
+/* Sets the global variable ourHost to the IP address returned from 
+ *    calling GetHostByName on our system's name.
+ * Called from SSL_ReadSocksConfFile().
+ */
+static SECStatus
+GetOurHost(void)
+{
+    PRStatus   rv;
+    PRHostEnt  hpbuf;
+    char       name[100];
+    char       dbbuf[PR_NETDB_BUF_SIZE];
+
+    PR_GetSystemInfo(PR_SI_HOSTNAME, name, sizeof name);
+
+    rv = PR_GetHostByName(name, dbbuf, sizeof dbbuf, &hpbuf);
+    if (rv != PR_SUCCESS)
+	return SECFailure;
+
+#undef  h_addr
+#define h_addr  h_addr_list[0]  /* address, in network byte order. */
+
+    PORT_Memcpy(&ourHost, hpbuf.h_addr, hpbuf.h_length);
+    return SECSuccess;
+}
+
+/*
+** Setup default SocksConfItem list so that loopback is direct, things to the
+** same subnet (?) address are direct, everything else uses sockd
+*/
+static void
+BuildDefaultConfList(void)
+{
+    SocksConfItem *ci;
+    SocksConfItem **lp;
+
+    /* Put loopback onto direct list */
+    lp = &ssl_socks_confs;
+    ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem));
+    if (!ci) {
+	return;
+    }
+    ci->direct = 1;
+    ci->daddr  = MAKE_IN_ADDR(127,0,0,1);
+    ci->dmask  = MAKE_IN_ADDR(255,255,255,255);
+    ci->op     = OP_ALWAYS;
+    *lp = ci;
+    lp = &ci->next;
+
+    /* Put our hosts's subnet onto direct list */
+    ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem));
+    if (!ci) {
+	return;
+    }
+    ci->direct = 1;
+    ci->daddr  = ourHost;
+    ci->dmask  = MAKE_IN_ADDR(255,255,255,0);
+    ci->op     = OP_ALWAYS;
+    *lp = ci;
+    lp = &ci->next;
+
+    /* Everything else goes to sockd */
+    ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem));
+    if (!ci) {
+	return;
+    }
+    ci->daddr = MAKE_IN_ADDR(255,255,255,255);
+    ci->op    = OP_ALWAYS;
+    *lp = ci;
+}
+
+static int
+FragmentLine(char *cp, char **argv, int maxargc)
+{
+    int argc = 0;
+    char *save;
+    char ch;
+
+    save = cp;
+    for (; (ch = *cp) != 0; cp++) {
+	if ((ch == '#') || (ch == '\n')) {
+	    /* Done */
+	    break;
+	}
+	if (ch == ':') {
+	    break;
+	}
+	if ((ch == ' ') || (ch == '\t')) {
+	    /* Seperator. see if it seperated anything */
+	    if (cp - save > 0) {
+		/* Put a null at the end of the word */
+		*cp = 0;
+		argc++;
+		*argv++ = save;
+		SSL_TRC(20, ("%d: SSL: argc=%d word=\"%s\"",
+			     SSL_GETPID(), argc, save));
+		if (argc == maxargc) {
+		    return argc;
+		}
+	    }
+	    save = cp + 1;
+	}
+    }
+    if (cp - save > 0) {
+	*cp = 0;
+	argc++;
+	*argv = save;
+	SSL_TRC(20, ("%d: SSL: argc=%d word=\"%s\"",
+		     SSL_GETPID(), argc, save));
+    }
+    return argc;
+}
+
+/* XXX inet_addr? */
+static char *
+ConvertOne(char *cp, unsigned char *rvp)
+{
+    char *s = PORT_Strchr(cp, '.');
+    if (s) {
+	*s = 0;
+    }
+    *rvp = PORT_Atoi(cp) & 0xff;
+    return s ? s+1 : cp;
+}
+
+/* returns host address in network byte order. */
+static PRUint32
+ConvertAddr(char *buf)
+{
+    unsigned char b0, b1, b2, b3;
+    PRUint32 addr;
+
+    buf = ConvertOne(buf, &b0);
+    buf = ConvertOne(buf, &b1);
+    buf = ConvertOne(buf, &b2);
+    buf = ConvertOne(buf, &b3);
+    addr = ((PRUint32)b0 << 24) |
+	   ((PRUint32)b1 << 16) |
+	   ((PRUint32)b2 << 8) |
+	    (PRUint32)b3;		/* host byte order. */
+
+    return PR_htonl(addr);		/* network byte order. */
+}
+
+static char *
+ReadLine(char *buf, int len, PRFileDesc *fd)
+{
+    char c, *p = buf;
+    PRInt32 n;
+
+    while(len > 0) {
+	n = PR_Read(fd, &c, 1);
+	if (n < 0)
+	    return NULL;
+	if (n == 0) {
+	    if (p == buf) {
+		return NULL;
+	    }
+	    *p = '\0';
+	    return buf;
+	}
+	if (c == '\n') {
+	    *p = '\0';
+	    return buf;
+	}
+	*p++ = c;
+	len--;
+    }
+    *p = '\0';
+    return buf;
+}
+
+int
+SSL_ReadSocksConfFile(PRFileDesc *fp)
+{
+    SocksConfItem * ci;
+    SocksConfItem **lp;
+    char *          file       = "socks file"; /* XXX Move to nav */
+    SocksOp         op;
+    int             direct;
+    int             port       = 0;
+    int             lineNumber = 0;
+    int             rv         = GetOurHost();
+
+    if (rv < 0) {
+	/* If we can't figure out our host id, use socks. Loser! */
+	return SECFailure;
+    }
+
+#if 0 /* XXX Move to nav */
+    fp = XP_FileOpen(file, xpSocksConfig, XP_FILE_READ);
+#endif
+    if (!fp) {
+	BuildDefaultConfList();
+	return SECSuccess;
+    }
+
+    /* Parse config file and generate config item list */
+    lp = &ssl_socks_confs;
+    for (;;) {
+	char *    s;
+	char *    argv[10];
+	int       argc;
+	PRUint32  daddr;
+	PRUint32  dmask;
+	char      buf[1000];
+
+	s = ReadLine(buf, sizeof buf, fp);
+	if (!s) {
+	    break;
+	}
+	lineNumber++;
+	argc = FragmentLine(buf, argv, 10);
+	if (argc < 3) {
+	    if (argc == 0) {
+		/* must be a comment/empty line */
+		continue;
+	    }
+#ifdef XP_UNIX
+	    PR_fprintf(PR_STDERR, "%s:%d: bad config line\n",
+		       file, lineNumber);
+#endif
+	    continue;
+	}
+	if (PORT_Strcmp(argv[0], "direct") == 0) {
+	    direct = 1;
+	} else if (PORT_Strcmp(argv[0], "sockd") == 0) {
+	    direct = 0;
+	} else {
+#ifdef XP_UNIX
+	    PR_fprintf(PR_STDERR, "%s:%d: bad command: \"%s\"\n",
+		       file, lineNumber, argv[0]);
+#endif
+	    continue;
+	}
+
+	/* Look for port spec */
+	op = OP_ALWAYS;
+	if (argc > 4) {
+	    if (PORT_Strcmp(argv[3], "lt") == 0) {
+		op = OP_LESS;
+	    } else if (PORT_Strcmp(argv[3], "eq") == 0) {
+		op = OP_EQUAL;
+	    } else if (PORT_Strcmp(argv[3], "le") == 0) {
+		op = OP_LEQUAL;
+	    } else if (PORT_Strcmp(argv[3], "gt") == 0) {
+		op = OP_GREATER;
+	    } else if (PORT_Strcmp(argv[3], "neq") == 0) {
+		op = OP_NOTEQUAL;
+	    } else if (PORT_Strcmp(argv[3], "ge") == 0) {
+		op = OP_GEQUAL;
+	    } else {
+#ifdef XP_UNIX
+		PR_fprintf(PR_STDERR, "%s:%d: bad comparison op: \"%s\"\n",
+			   file, lineNumber, argv[3]);
+#endif
+		continue;
+	    }
+	    port = PORT_Atoi(argv[4]);
+	}
+
+	ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem));
+	if (!ci) {
+	    break;
+	}
+	daddr      = ConvertAddr(argv[1]);	/* net byte order. */
+	dmask      = ConvertAddr(argv[2]);	/* net byte order. */
+	ci->daddr  = daddr;			/* net byte order. */
+	ci->dmask  = dmask;			/* net byte order. */
+	ci->direct = direct;
+	ci->op     = op;
+	ci->port   = port;			/* host byte order. */
+	daddr      = PR_ntohl(daddr);		/* host byte order. */
+	dmask      = PR_ntohl(dmask);		/* host byte order. */
+	SSL_TRC(10, (
+"%d: SSL: line=%d direct=%d addr=%d.%d.%d.%d mask=%d.%d.%d.%d op=%d port=%d",
+		     SSL_GETPID(), lineNumber, ci->direct,
+		     (daddr >> 24) & 0xff,
+		     (daddr >> 16) & 0xff,
+		     (daddr >>  8) & 0xff,
+		     (daddr >>  0) & 0xff,
+		     (dmask >> 24) & 0xff,
+		     (dmask >> 16) & 0xff,
+		     (dmask >>  8) & 0xff,
+		     (dmask >>  0) & 0xff,
+		     ci->op, ci->port));
+	*lp = ci;
+	lp = &ci->next;
+    }
+
+
+    if (!ssl_socks_confs) {
+	/* Empty file. Fix it for the user */
+	BuildDefaultConfList();
+    }
+    return SECSuccess;
+}
+
+static int
+ChooseAddress(sslSocket *ss, const PRNetAddr *direct)
+{
+    PRUint32 dstAddr;
+    PRUint16 dstPort;
+    SocksConfItem *ci;
+    int rv;
+
+    if (!ssl_socks_confs) {
+	rv = SSL_ReadSocksConfFile(NULL);
+	if (rv) {
+	    return rv;
+	}
+    }
+
+    /*
+    ** Scan socks config info and look for a direct match or a force to
+    ** use the sockd. Bail on first hit.
+    */
+    dstAddr = direct->inet.ip;
+    dstPort = PR_ntohs(direct->inet.port);
+    ci = ssl_socks_confs;
+    while (ci) {
+	SSL_TRC(10, (
+	"%d: SSL[%d]: match, direct=%d daddr=0x%x mask=0x%x op=%d port=%d",
+		 SSL_GETPID(), ss->fd, ci->direct, PR_ntohl(ci->daddr),
+		 PR_ntohl(ci->dmask), ci->op, ci->port));
+	if ((ci->daddr & ci->dmask)  == (dstAddr & ci->dmask)) {
+	    int portMatch = 0;
+	    switch (ci->op) {
+	      case OP_LESS:	portMatch = dstPort <  ci->port; break;
+	      case OP_EQUAL:	portMatch = dstPort == ci->port; break;
+	      case OP_LEQUAL:	portMatch = dstPort <= ci->port; break;
+	      case OP_GREATER:	portMatch = dstPort >  ci->port; break;
+	      case OP_NOTEQUAL:	portMatch = dstPort != ci->port; break;
+	      case OP_GEQUAL:	portMatch = dstPort >= ci->port; break;
+	      case OP_ALWAYS:	portMatch = 1;                   break;
+	    }
+	    if (portMatch) {
+		SSL_TRC(10, ("%d: SSL[%d]: socks config match",
+			     SSL_GETPID(), ss->fd));
+		return ci->direct;
+	    }
+	}
+	ci = ci->next;
+    }
+    SSL_TRC(10, ("%d: SSL[%d]: socks config: no match",
+		 SSL_GETPID(), ss->fd));
+    return 0;
+}
+
+/*
+** Find port # and host # of socks daemon. Use info in ss->socks struct
+** when valid. If not valid, try to figure it all out.
+*/
+static int
+FindDaemon(sslSocket *ss, PRNetAddr *out)
+{
+    sslSocksInfo *si;
+    PRUint32 host;		/* network byte order. */
+    PRUint16 port;		/* host    byte order. */
+
+    PORT_Assert(ss->socks != 0);
+    si = ss->socks;
+
+    /* For now, assume we are using the socks daemon */
+    host = si->sockdHost;
+    port = si->sockdPort;
+#ifdef XP_UNIX
+    if (!port) {
+	static char firstTime = 1;
+	static PRUint16 sockdPort;
+
+	if (firstTime) {
+	    struct servent *sp;
+
+	    firstTime = 0;
+	    sp = getservbyname("socks", "tcp");
+	    if (sp) {
+		sockdPort = sp->s_port;
+	    } else {
+		SSL_TRC(10, ("%d: SSL[%d]: getservbyname of (socks,tcp) fails",
+			     SSL_GETPID(), ss->fd));
+	    }
+	}
+	port = sockdPort;
+    }
+#endif
+    if (!port) {
+	port = DEF_SOCKD_PORT;
+    }
+    if (host == 0) {
+	SSL_TRC(10, ("%d: SSL[%d]: no socks server found",
+		     SSL_GETPID(), ss->fd));
+	PORT_SetError(PR_INVALID_ARGUMENT_ERROR);
+	return SECFailure;
+    }
+
+    /* We know the ip addr of the socks server */
+    out->inet.family = PR_AF_INET;
+    out->inet.port   = PR_htons(port);
+    out->inet.ip     = host;
+    host             = PR_ntohl(host);	/* now host byte order. */
+    SSL_TRC(10, ("%d: SSL[%d]: socks server at %d.%d.%d.%d:%d",
+		 SSL_GETPID(), ss->fd,
+		 (host >> 24) & 0xff,
+		 (host >> 16) & 0xff,
+		 (host >>  8) & 0xff,
+		 (host >>  0) & 0xff,
+		 port));
+    return SECSuccess;
+}
+
+/*
+** Send our desired address and our user name to the socks daemon.
+** cmd is either SOCKS_CONNECT (client) or SOCKS_BIND (server).
+*/
+static int
+SayHello(sslSocket *ss, int cmd, const PRNetAddr *sa, char *user)
+{
+    int rv, len;
+    unsigned char msg[8];
+    PRUint16 port;
+    PRUint32 host;
+
+    /* Send dst message to sockd */
+    port = sa->inet.port;
+    host = sa->inet.ip;
+    msg[0] = SOCKS_VERSION;
+    msg[1] = cmd;
+    PORT_Memcpy(msg+2, &port, 2);
+    PORT_Memcpy(msg+4, &host, 4);
+    SSL_TRC(10, ("%d: SSL[%d]: socks real dest=%d.%d.%d.%d:%d",
+		 SSL_GETPID(), ss->fd, msg[4], msg[5], msg[6], msg[7],
+		 port));
+
+    rv = ssl_DefSend(ss, msg, sizeof(msg), 0);
+    if (rv < 0) {
+	goto io_error;
+    }
+    /* XXX Deal with short write !! */
+
+    /* Send src-user message to sockd */
+    len = strlen(user)+1;
+    rv = ssl_DefSend(ss, (unsigned char *)user, len, 0);
+    if (rv < 0) {
+	goto io_error;
+    }
+    /* XXX Deal with short write !! */
+
+    return SECSuccess;
+
+  io_error:
+    SSL_TRC(10, ("%d: SSL[%d]: socks, io error saying hello to sockd errno=%d",
+		 SSL_GETPID(), ss->fd, PORT_GetError()));
+    return SECFailure;
+}
+
+/* Handle the reply from the socks proxy/daemon. 
+** Called from ssl_Do1stHandshake().
+*/
+static SECStatus
+SocksHandleReply(sslSocket *ss)
+{
+    unsigned char *msg;
+    unsigned char  cmd;
+
+    PORT_Assert( ssl_Have1stHandshakeLock(ss) );
+
+    ssl_GetRecvBufLock(ss);
+    PORT_Assert(ss->gather != 0);
+
+    msg = ss->gather->buf.buf;
+    cmd = msg[1];
+    SSL_TRC(10, ("%d: SSL[%d]: socks result: cmd=%d",
+		 SSL_GETPID(), ss->fd, cmd));
+
+    /* This is Bogus.  The socks spec says these fields are undefined in 
+     * the reply from the socks daemon/proxy.  No point in saving garbage.
+     */
+    PORT_Memcpy(&ss->socks->destPort, msg+2, 2);
+    PORT_Memcpy(&ss->socks->destHost, msg+4, 4);
+
+    ss->gather->recordLen = 0;
+    ssl_ReleaseRecvBufLock(ss);
+
+    /* Check status back from sockd */
+    switch (cmd) {
+      case SOCKS_FAIL:
+      case SOCKS_NO_IDENTD:
+      case SOCKS_BAD_ID:
+	SSL_DBG(("%d: SSL[%d]: sockd returns an error: %d",
+		 SSL_GETPID(), ss->fd, cmd));
+	PORT_SetError(PR_CONNECT_REFUSED_ERROR);
+	return SECFailure;
+
+      default:
+	break;
+    }
+
+    /* All done */
+    SSL_TRC(1, ("%d: SSL[%d]: using sockd at %d.%d.%d.%d",
+		SSL_GETPID(), ss->fd,
+		(PR_ntohl(ss->socks->sockdHost) >> 24) & 0xff,
+		(PR_ntohl(ss->socks->sockdHost) >> 16) & 0xff,
+		(PR_ntohl(ss->socks->sockdHost) >> 8) & 0xff,
+		(PR_ntohl(ss->socks->sockdHost) >> 0) & 0xff));
+    ss->handshake         = 0;
+    ss->nextHandshake     = 0;
+    return SECSuccess;
+}
+
+static SECStatus
+SocksGatherRecord(sslSocket *ss)
+{
+    int rv;
+
+    PORT_Assert( ssl_Have1stHandshakeLock(ss) );
+    ssl_GetRecvBufLock(ss);
+    rv = ssl2_GatherRecord(ss, 0);
+    ssl_ReleaseRecvBufLock(ss);
+    if (rv <= 0) {
+	if (rv == 0)
+	    /* Unexpected EOF */
+	    PORT_SetError(PR_END_OF_FILE_ERROR);
+	return SECFailure;
+    }
+    ss->handshake = 0;
+    return SECSuccess;
+}
+
+static SECStatus
+SocksStartGather(sslSocket *ss)
+{
+    int rv;
+
+    ss->handshake     = SocksGatherRecord;
+    ss->nextHandshake = SocksHandleReply;
+    rv = ssl2_StartGatherBytes(ss, ss->gather, 8);
+    if (rv <= 0) {
+	if (rv == 0) {
+	    /* Unexpected EOF */
+	    PORT_SetError(PR_END_OF_FILE_ERROR);
+	    return SECFailure;
+	}
+	return (SECStatus)rv;
+    }
+    ss->handshake = 0;
+    return SECSuccess;
+}
+
+/************************************************************************/
+
+
+/* BSDI etc. ain't got no cuserid() */
+#if defined(__386BSD__) || defined(FREEBSD)
+#define NEED_CUSERID 1
+#endif
+
+#ifdef NEED_CUSERID
+#include <pwd.h>
+static char *
+my_cuserid(char *b)
+{
+    struct passwd *pw = getpwuid(getuid());
+
+    if (!b) 
+    	return pw ? pw->pw_name : NULL;
+
+    if (!pw || !pw->pw_name)
+	b[0] = '\0';
+    else
+	strcpy(b, pw->pw_name);
+    return b;
+}
+#endif
+
+
+/* sa identifies the server to which we want to connect.
+ * First determine whether or not to use socks.
+ * If not, connect directly to server.
+ * If so,  connect to socks proxy, and send SOCKS_CONNECT cmd, but 
+ *	Does NOT wait for reply from socks proxy.
+ */
+int
+ssl_SocksConnect(sslSocket *ss, const PRNetAddr *sa)
+{
+    int rv, err, direct;
+    PRNetAddr daemon;
+    const PRNetAddr *sip;
+    char *user;
+    PRFileDesc *osfd = ss->fd->lower;
+
+    /* Figure out where to connect to */
+    rv = FindDaemon(ss, &daemon);
+    if (rv) {
+	return SECFailure;
+    }
+    direct = ChooseAddress(ss, sa);
+    if (direct) {
+	sip = sa;
+	ss->socks->direct = 1;
+    } else {
+	sip = &daemon;
+	ss->socks->direct = 0;
+    }
+    SSL_TRC(10, ("%d: SSL[%d]: socks %s connect to %d.%d.%d.%d:%d",
+		 SSL_GETPID(), ss->fd,
+		 direct ? "direct" : "sockd",
+		 (PR_ntohl(sip->inet.ip) >> 24) & 0xff,
+		 (PR_ntohl(sip->inet.ip) >> 16) & 0xff,
+		 (PR_ntohl(sip->inet.ip) >> 8) & 0xff,
+		 PR_ntohl(sip->inet.ip) & 0xff,
+		 PR_ntohs(sip->inet.port)));
+
+    /* Attempt first connection */
+    rv = osfd->methods->connect(osfd, sip, ss->cTimeout);
+    err = PORT_GetError();
+#ifdef _WIN32
+    PR_Sleep(PR_INTERVAL_NO_WAIT);     /* workaround NT winsock connect bug. */
+#endif
+    if (rv < 0) {
+	if (err != PR_IS_CONNECTED_ERROR) {
+	    return rv;
+	}
+	/* Async connect finished */
+    }
+
+    /* If talking to sockd, do handshake */
+    if (!direct) {
+	/* Find user */
+#ifdef XP_UNIX
+#ifdef NEED_CUSERID
+	user = my_cuserid(NULL);
+#else
+	user = cuserid(NULL);
+#endif
+	if (!user) {
+	    PORT_SetError(PR_UNKNOWN_ERROR);
+	    SSL_DBG(("%d: SSL[%d]: cuserid fails, errno=%d",
+		     SSL_GETPID(), ss->fd, PORT_GetError()));
+	    return SECFailure;
+	}
+#else
+	user = "SSL";
+#endif
+
+	/* Send our message to it */
+	rv = SayHello(ss, SOCKS_CONNECT, sa, user);
+	if (rv) {
+	    return rv;
+	}
+
+	ss->handshake     = SocksStartGather;
+	ss->nextHandshake = 0;
+
+	/* save up who we're really talking to so we can index the cache */
+	if ((sa->inet.family & 0xff) == PR_AF_INET) {
+	     PR_ConvertIPv4AddrToIPv6(sa->inet.ip, &ss->peer);
+	     ss->port = sa->inet.port;
+	} else {
+	     PORT_Assert(sa->ipv6.family == PR_AF_INET6);
+	     ss->peer = sa->ipv6.ip;
+	     ss->port = sa->ipv6.port;
+	}
+    }
+    return 0;
+}
+
+/* Called from ssl_SocksBind(), SSL_BindForSockd(), and ssl_SocksAccept().
+ * NOT called from ssl_SocksConnect().
+ */
+static int
+SocksWaitForResponse(sslSocket *ss)
+{
+    int rv;
+
+    ss->handshake = SocksStartGather;
+    ss->nextHandshake = 0;
+
+    /* Get response. Do it now, spinning if necessary (!) */
+    for (;;) {
+	ssl_Get1stHandshakeLock(ss);
+	rv = ssl_Do1stHandshake(ss);
+	ssl_Release1stHandshakeLock(ss);
+	if (rv == SECWouldBlock || 
+	   (rv == SECFailure && PORT_GetError() == PR_WOULD_BLOCK_ERROR)) {
+#ifdef XP_UNIX
+	    /*
+	    ** Spinning is really evil under unix. Call select and
+	    ** continue when a read select returns true. We only get
+	    ** here if the socket was marked async before the bind
+	    ** call.
+	    */
+	    PRPollDesc spin;
+	    spin.fd       = ss->fd->lower;
+	    spin.in_flags = PR_POLL_READ;
+	    rv = PR_Poll(&spin, 1, PR_INTERVAL_NO_TIMEOUT);
+	    if (rv < 0) {
+		return rv;
+	    }
+#else
+	    PRIntervalTime ticks = PR_MillisecondsToInterval(1);
+	    PR_Sleep(ticks);
+#endif
+	    continue;
+	}
+	break;
+    }
+    return rv;
+}
+
+/* sa identifies the server address we want to bind to.
+ * First, determine if we need to register with a socks proxy.
+ * If socks, then Connect to Socks proxy daemon, send SOCKS_BIND message,
+ *    wait for response from socks proxy. 
+ */
+int
+ssl_SocksBind(sslSocket *ss, const PRNetAddr *sa)
+{
+    sslSocksInfo * si;
+    PRFileDesc *   osfd 	= ss->fd->lower;
+    char *         user;
+    int            rv;
+    int            direct;
+    PRNetAddr      daemon;
+
+    PORT_Assert(ss->socks != 0);
+    si = ss->socks;
+
+    /* Figure out where to connect to */
+    rv = FindDaemon(ss, &daemon);
+    if (rv) {
+	return SECFailure;
+    }
+    direct = ChooseAddress(ss, sa);
+    if (direct) {
+	ss->socks->direct = 1;
+	rv = osfd->methods->bind(osfd, sa);
+	PORT_Memcpy(&ss->socks->bindAddr, sa, sizeof(PRNetAddr));
+    } else {
+	ss->socks->direct = 0;
+	SSL_TRC(10, ("%d: SSL[%d]: socks sockd bind to %d.%d.%d.%d:%d",
+		     SSL_GETPID(), ss->fd,
+		     (PR_ntohl(daemon.inet.ip) >> 24) & 0xff,
+		     (PR_ntohl(daemon.inet.ip) >> 16) & 0xff,
+		     (PR_ntohl(daemon.inet.ip) >> 8) & 0xff,
+		     PR_ntohl(daemon.inet.ip) & 0xff,
+		     PR_ntohs(daemon.inet.port)));
+
+	/* First connect to socks daemon. ASYNC connects must be disabled! */
+	rv = osfd->methods->connect(osfd, &daemon, ss->cTimeout);
+	if (rv < 0) {
+	    return rv;
+	}
+
+	/* Find user */
+#ifdef XP_UNIX
+#ifdef NEED_CUSERID
+	user = my_cuserid(NULL);
+#else
+	user = cuserid(NULL);
+#endif
+	if (!user) {
+	    SSL_DBG(("%d: SSL[%d]: cuserid fails, errno=%d",
+		     SSL_GETPID(), ss->fd, PORT_GetError()));
+	    PORT_SetError(PR_UNKNOWN_ERROR);
+	    return SECFailure;
+	}
+#else
+	user = "SSL";
+#endif
+	/* Send message to sockd */
+	rv = SayHello(ss, SOCKS_BIND, sa, user);
+	if (rv) {
+	    return rv;
+	}
+
+	/* SocksGatherRecord up bind response from sockd */
+	rv = SocksWaitForResponse(ss);
+	if (rv == 0) {
+	    /* Done */
+	    si->bindAddr.inet.family = PR_AF_INET;
+	    si->bindAddr.inet.port   = si->destPort;
+	    if (PR_ntohl(si->destHost) == PR_INADDR_ANY) {
+		si->bindAddr.inet.ip = daemon.inet.ip;
+	    } else {
+		si->bindAddr.inet.ip = si->destHost;
+	    }
+	}
+    }
+    si->didBind = 1;
+    return rv;
+}
+
+
+PRFileDesc *
+ssl_SocksAccept(sslSocket *ss, PRNetAddr *addr)
+{
+    PORT_Assert(0);
+#if 0 /* XXX This doesn't work. */
+    sslSocket *ns;
+    sslSocksInfo *si;
+    PRFileDesc *fd, *osfd = ss->fd->lower;
+    int rv;
+
+    PORT_Assert(ss->socks != 0);
+    si = ss->socks;
+
+    if (!si->didBind || si->direct) {
+	/*
+	** If we didn't do the bind yet this call will generate an error
+	** from the OS. If we did do the bind then we must be direct and
+	** let the OS do the accept.
+	*/
+	fd = osfd->methods->accept(osfd, addr, ss->cTimeout);
+	return NULL;
+    }
+
+    /* Get next accept response from server */
+    rv = SocksWaitForResponse(ss);
+    if (rv) {
+	return NULL;
+    }
+
+    /* Handshake finished. Give dest address back to caller */
+    addr->inet.family = PR_AF_INET;
+    addr->inet.port   = si->destPort;
+    addr->inet.ip     = si->destHost;
+
+    /* Dup the descriptor and return it */
+    fd = osfd->methods->dup(osfd);
+    if (fd == NULL) {
+	return NULL;
+    }
+
+    /* Dup the socket structure */
+    ns = ssl_DupSocket(ss, fd);
+    if (ns == NULL) {
+	PR_Close(fd);
+	return NULL;
+    }
+
+    return fd;
+#else
+    return NULL;
+#endif /* 0 */
+}
+
+int
+ssl_SocksListen(sslSocket *ss, int backlog)
+{
+    PRFileDesc *osfd = ss->fd->lower;
+    int rv;
+
+    PORT_Assert(ss->socks != 0);
+
+    if (ss->socks->direct) {
+	rv = osfd->methods->listen(osfd, backlog);
+	return rv;
+    }
+    return 0;
+}
+
+int
+ssl_SocksGetsockname(sslSocket *ss, PRNetAddr *name)
+{
+    PRFileDesc *osfd = ss->fd->lower;
+    int rv;
+
+    PORT_Assert(ss->socks != 0);
+    if (!ss->socks->didBind || ss->socks->direct) {
+	rv = osfd->methods->getsockname(osfd, name);
+	return rv;
+    }
+
+    PORT_Memcpy(name, &ss->socks->bindAddr, sizeof(PRNetAddr));
+    return 0;
+}
+
+int
+ssl_SocksRecv(sslSocket *ss, unsigned char *buf, int len, int flags)
+{
+    int rv;
+
+    PORT_Assert(ss->socks != 0);
+
+    if (ss->handshake) {
+	ssl_Get1stHandshakeLock(ss);
+	rv = ssl_Do1stHandshake(ss);
+	ssl_Release1stHandshakeLock(ss);
+	if (rv < 0) {
+	    return rv;
+	}
+	rv = ssl_SendSavedWriteData(ss, &ss->saveBuf, ssl_DefSend);
+	if (rv < 0) {
+	    return SECFailure;
+	}
+	/* XXX Deal with short write !! */
+    }
+
+    rv = ssl_DefRecv(ss, buf, len, flags);
+    SSL_TRC(2, ("%d: SSL[%d]: recving %d bytes from sockd",
+		SSL_GETPID(), ss->fd, rv));
+    return rv;
+}
+
+int
+ssl_SocksRead(sslSocket *ss, unsigned char *buf, int len)
+{
+    return ssl_SocksRecv(ss, buf, len, 0);
+}
+
+int
+ssl_SocksSend(sslSocket *ss, const unsigned char *buf, int len, int flags)
+{
+    int rv;
+
+    PORT_Assert(ss->socks != 0);
+
+    if (len == 0) 
+    	return 0;
+    if (ss->handshake) {
+	ssl_Get1stHandshakeLock(ss);
+	rv = ssl_Do1stHandshake(ss);
+	ssl_Release1stHandshakeLock(ss);
+	if (rv < 0) {
+	    if (rv == SECWouldBlock) {
+		return len;		/* ????? XXX */
+	    }
+	    return rv;
+	}
+	rv = ssl_SendSavedWriteData(ss, &ss->saveBuf, ssl_DefSend);
+	if (rv < 0) {
+	    return SECFailure;
+	}
+	/* XXX Deal with short write !! */
+    }
+
+    SSL_TRC(2, ("%d: SSL[%d]: sending %d bytes using socks",
+		SSL_GETPID(), ss->fd, len));
+
+    /* Send out the data */
+    rv = ssl_DefSend(ss, buf, len, flags);
+    /* XXX Deal with short write !! */
+    return rv;
+}
+
+int
+ssl_SocksWrite(sslSocket *ss, const unsigned char *buf, int len)
+{
+    return ssl_SocksSend(ss, buf, len, 0);
+}
+
+/* returns  > 0 if direct
+ * returns == 0 if socks
+ * returns  < 0 if error.
+ */
+int
+SSL_CheckDirectSock(PRFileDesc *s)
+{
+    sslSocket *ss;
+
+    ss = ssl_FindSocket(s);
+    if (!ss) {
+	SSL_DBG(("%d: SSL[%d]: bad socket in CheckDirectSock", SSL_GETPID(), s));
+	return SECFailure;
+    }
+
+    if (ss->socks != NULL) {
+	return ss->socks->direct;
+    }
+    return SECFailure;
+}
+
+
+SECStatus
+SSL_ConfigSockd(PRFileDesc *s, PRUint32 host, PRUint16 port)
+{
+    sslSocket *ss;
+    SECStatus rv;
+
+    ss = ssl_FindSocket(s);
+    if (!ss) {
+	SSL_DBG(("%d: SSL[%d]: bad socket in ConfigSocks", SSL_GETPID(), s));
+	return SECFailure;
+    }
+
+    /* Create socks info if not already done */
+    rv = ssl_CreateSocksInfo(ss);
+    if (rv) {
+	return rv;
+    }
+    ss->socks->sockdHost = host;
+    ss->socks->sockdPort = port;
+    return SECSuccess;
+}
+
--- a/security/nss/lib/util/secport.c
+++ b/security/nss/lib/util/secport.c
@@ -44,16 +44,17 @@
 #include "seccomon.h"
 #include "prmem.h"
 #include "prerror.h"
 #include "plarena.h"
 #include "secerr.h"
 #include "prmon.h"
 #include "nsslocks.h"
 #include "secport.h"
+#include "prvrsion.h"
 
 #ifdef DEBUG
 #define THREADMARK
 #endif /* DEBUG */
 
 #ifdef THREADMARK
 #include "prthread.h"
 #endif /* THREADMARK */
@@ -67,25 +68,31 @@
 #define SET_ERROR_CODE	/* place holder for code to set PR error code. */
 
 #ifdef THREADMARK
 typedef struct threadmark_mark_str {
   struct threadmark_mark_str *next;
   void *mark;
 } threadmark_mark;
 
-typedef struct threadmark_arena_str {
+#endif /* THREADMARK */
+
+/* The value of this magic must change each time PORTArenaPool changes. */
+#define ARENAPOOL_MAGIC 0xB8AC9BDF 
+
+typedef struct PORTArenaPool_str {
   PLArenaPool arena;
-  PRUint32 magic;
+  PRUint32    magic;
+  PRLock *    lock;
+#ifdef THREADMARK
   PRThread *marking_thread;
   threadmark_mark *first_mark;
-} threadmark_arena;
+#endif
+} PORTArenaPool;
 
-#define THREADMARK_MAGIC 0xB8AC9BDD /* In honor of nelsonb */
-#endif /* THREADMARK */
 
 /* count of allocation failures. */
 unsigned long port_allocFailures;
 
 /* locations for registering Unicode conversion functions.  
  * XXX is this the appropriate location?  or should they be
  *     moved to client/server specific locations?
  */
@@ -177,319 +184,284 @@ PORT_SetError(int value)
 int
 PORT_GetError(void)
 {
     return(PR_GetError());
 }
 
 /********************* Arena code follows *****************************/
 
-PZMonitor * arenaMonitor;
-
-static void
-getArenaLock(void)
-{
-    if (!arenaMonitor) {
-	nss_InitMonitor(&arenaMonitor, nssILockArena);
-    }
-    if (arenaMonitor) 
-	PZ_EnterMonitor(arenaMonitor);
-}
-
-static void
-releaseArenaLock(void)
-{
-    if (arenaMonitor) 
-	PZ_ExitMonitor(arenaMonitor);
-}
-
 PLArenaPool *
 PORT_NewArena(unsigned long chunksize)
 {
-    PLArenaPool *arena;
+    PORTArenaPool *pool;
     
-    getArenaLock();
-#ifdef THREADMARK
-    {
-      threadmark_arena *tarena = (threadmark_arena *)
-        PORT_ZAlloc(sizeof(threadmark_arena));
-      if( (threadmark_arena *)NULL != tarena ) {
-       arena = &tarena->arena;
-       tarena->magic = THREADMARK_MAGIC;
-      } else {
-        arena = (PLArenaPool *)NULL;
-      }
+    pool = PORT_ZNew(PORTArenaPool);
+    if (!pool) {
+	return NULL;
     }
-#else /* THREADMARK */
-    arena = (PLArenaPool*)PORT_ZAlloc(sizeof(PLArenaPool));
-#endif /* THREADMARK */
-    if ( arena != NULL ) {
-	PL_InitArenaPool(arena, "security", chunksize, sizeof(double));
+    pool->magic = ARENAPOOL_MAGIC;
+    pool->lock = PZ_NewLock(nssILockArena);
+    if (!pool->lock) {
+	++port_allocFailures;
+	PORT_Free(pool);
+	return NULL;
     }
-    releaseArenaLock();
-    return(arena);
+    PL_InitArenaPool(&pool->arena, "security", chunksize, sizeof(double));
+    return(&pool->arena);
 }
 
 void *
 PORT_ArenaAlloc(PLArenaPool *arena, size_t size)
 {
     void *p;
 
-    getArenaLock();
+    PORTArenaPool *pool = (PORTArenaPool *)arena;
+
+    /* Is it one of ours?  Assume so and check the magic */
+    if (ARENAPOOL_MAGIC == pool->magic ) {
+	PZ_Lock(pool->lock);
 #ifdef THREADMARK
-    {
-      /* Is it one of ours?  Assume so and check the magic */
-      threadmark_arena *tarena = (threadmark_arena *)arena;
-      if( THREADMARK_MAGIC == tarena->magic ) {
         /* Most likely one of ours.  Is there a thread id? */
-        if( (PRThread *)NULL != tarena->marking_thread ) {
-          /* Yes.  Has this arena been marked by this thread? */
-          if( tarena->marking_thread == PR_GetCurrentThread() ) {
-            /* Yup.  Everything's okay. */
-            ;
-          } else {
-            /* Nope.  BZZT!  error */
-            releaseArenaLock();
-            PORT_SetError(SEC_ERROR_NO_MEMORY);
-            PORT_Assert(0);
-            return (void *)NULL;
-          }
-        } /* tid != null */
-      } /* tarena */
-    } /* scope */
+	if (pool->marking_thread  &&
+	    pool->marking_thread != PR_GetCurrentThread() ) {
+	    /* Another thread holds a mark in this arena */
+	    PZ_Unlock(pool->lock);
+	    PORT_SetError(SEC_ERROR_NO_MEMORY);
+	    PORT_Assert(0);
+	    return NULL;
+	} /* tid != null */
 #endif /* THREADMARK */
+	PL_ARENA_ALLOCATE(p, arena, size);
+	PZ_Unlock(pool->lock);
+    } else {
+	PL_ARENA_ALLOCATE(p, arena, size);
+    }
 
-    PL_ARENA_ALLOCATE(p, arena, size);
-    releaseArenaLock();
-    if (p == NULL) {
+    if (!p) {
 	++port_allocFailures;
 	PORT_SetError(SEC_ERROR_NO_MEMORY);
     }
 
     return(p);
 }
 
 void *
 PORT_ArenaZAlloc(PLArenaPool *arena, size_t size)
 {
-    void *p;
+    void *p = PORT_ArenaAlloc(arena, size);
 
-    getArenaLock();
-#ifdef THREADMARK
-    {
-      /* Is it one of ours?  Assume so and check the magic */
-      threadmark_arena *tarena = (threadmark_arena *)arena;
-      if( THREADMARK_MAGIC == tarena->magic ) {
-        /* Most likely one of ours.  Is there a thread id? */
-        if( (PRThread *)NULL != tarena->marking_thread ) {
-          /* Yes.  Has this arena been marked by this thread? */
-          if( tarena->marking_thread == PR_GetCurrentThread() ) {
-            /* Yup.  Everything's okay. */
-            ;
-          } else {
-            /* No, it was a different thread  BZZT!  error */
-            releaseArenaLock();
-            PORT_SetError(SEC_ERROR_NO_MEMORY);
-            PORT_Assert(0);
-            return (void *)NULL;
-          }
-        } /* tid != null */
-      } /* tarena */
-    } /* scope */
-#endif /* THREADMARK */
-
-    PL_ARENA_ALLOCATE(p, arena, size);
-    releaseArenaLock();
-    if (p == NULL) {
-	++port_allocFailures;
-	PORT_SetError(SEC_ERROR_NO_MEMORY);
-    } else {
+    if (p) {
 	PORT_Memset(p, 0, size);
     }
 
     return(p);
 }
 
 /* XXX - need to zeroize!! - jsw */
 void
 PORT_FreeArena(PLArenaPool *arena, PRBool zero)
 {
-    getArenaLock();
+    PORTArenaPool *pool = (PORTArenaPool *)arena;
+    PRLock *       lock = (PRLock *)0;
+    size_t         len  = sizeof *arena;
+    extern const PRVersionDescription * libVersionPoint(void);
+    static const PRVersionDescription * pvd;
+    static PRBool  doFreeArenaPool;
+
+    if (ARENAPOOL_MAGIC == pool->magic ) {
+	len  = sizeof *pool;
+	lock = pool->lock;
+	PZ_Lock(lock);
+    }
+    if (!pvd) {
+	/* no need for thread protection here */
+	pvd = libVersionPoint();
+	if ((pvd->vMajor > 4) || 
+	    (pvd->vMajor == 4 && pvd->vMinor > 1) ||
+	    (pvd->vMajor == 4 && pvd->vMinor == 1 && pvd->vPatch >= 1)) {
+	    doFreeArenaPool = PR_TRUE;
+	}
+    }
+    if (doFreeArenaPool)
+	PL_FreeArenaPool(arena);
     PL_FinishArenaPool(arena);
-    PORT_Free(arena);
-    releaseArenaLock();
+    PORT_ZFree(arena, len);
+    if (lock) {
+	PZ_Unlock(lock);
+	PZ_DestroyLock(lock);
+    }
 }
 
 void *
 PORT_ArenaGrow(PLArenaPool *arena, void *ptr, size_t oldsize, size_t newsize)
 {
+    PORTArenaPool *pool = (PORTArenaPool *)arena;
     PORT_Assert(newsize >= oldsize);
     
-    getArenaLock();
-    /* Do we do a THREADMARK check here? */
-    PL_ARENA_GROW(ptr, arena, oldsize, ( newsize - oldsize ) );
-    releaseArenaLock();
+    if (ARENAPOOL_MAGIC == pool->magic ) {
+	PZ_Lock(pool->lock);
+	/* Do we do a THREADMARK check here? */
+	PL_ARENA_GROW(ptr, arena, oldsize, ( newsize - oldsize ) );
+	PZ_Unlock(pool->lock);
+    } else {
+	PL_ARENA_GROW(ptr, arena, oldsize, ( newsize - oldsize ) );
+    }
     
     return(ptr);
 }
 
 void *
 PORT_ArenaMark(PLArenaPool *arena)
 {
     void * result;
 
-    getArenaLock();
+    PORTArenaPool *pool = (PORTArenaPool *)arena;
+    if (ARENAPOOL_MAGIC == pool->magic ) {
+	PZ_Lock(pool->lock);
 #ifdef THREADMARK
-    {
-      threadmark_mark *tm, **pw;
+	{
+	  threadmark_mark *tm, **pw;
+	  PRThread * currentThread = PR_GetCurrentThread();
 
-      threadmark_arena *tarena = (threadmark_arena *)arena;
-      if( THREADMARK_MAGIC == tarena->magic ) {
-        /* one of ours */
-        if( (PRThread *)NULL == tarena->marking_thread ) {
-          /* First mark */
-          tarena->marking_thread = PR_GetCurrentThread();
-        } else {
-          if( PR_GetCurrentThread() != tarena->marking_thread ) {
-            releaseArenaLock();
-            PORT_SetError(SEC_ERROR_NO_MEMORY);
-            PORT_Assert(0);
-            return (void *)NULL;
-          }
-        }
+	    if (! pool->marking_thread ) {
+		/* First mark */
+		pool->marking_thread = currentThread;
+	    } else if (currentThread != pool->marking_thread ) {
+		PZ_Unlock(pool->lock);
+		PORT_SetError(SEC_ERROR_NO_MEMORY);
+		PORT_Assert(0);
+		return NULL;
+	    }
 
-        result = PL_ARENA_MARK(arena);
-        PL_ARENA_ALLOCATE(tm, arena, sizeof(threadmark_mark));
-        if( (threadmark_mark *)NULL == tm ) {
-          releaseArenaLock();
-          PORT_SetError(SEC_ERROR_NO_MEMORY);
-          return (void *)NULL;
-        }
+	    result = PL_ARENA_MARK(arena);
+	    PL_ARENA_ALLOCATE(tm, arena, sizeof(threadmark_mark));
+	    if (!tm) {
+		PZ_Unlock(pool->lock);
+		PORT_SetError(SEC_ERROR_NO_MEMORY);
+		return NULL;
+	    }
 
-        tm->mark = result;
-        tm->next = (threadmark_mark *)NULL;
+	    tm->mark = result;
+	    tm->next = (threadmark_mark *)NULL;
 
-        pw = &tarena->first_mark;
-        while( (threadmark_mark *)NULL != *pw ) {
-             pw = &(*pw)->next;
-        }
+	    pw = &pool->first_mark;
+	    while( *pw ) {
+		 pw = &(*pw)->next;
+	    }
 
-        *pw = tm;
-      } else {
-        /* a "pure" NSPR arena */
-        result = PL_ARENA_MARK(arena);
-      }
+	    *pw = tm;
+	}
+#else /* THREADMARK */
+	result = PL_ARENA_MARK(arena);
+#endif /* THREADMARK */
+	PZ_Unlock(pool->lock);
+    } else {
+	/* a "pure" NSPR arena */
+	result = PL_ARENA_MARK(arena);
     }
-#else /* THREADMARK */
-    result = PL_ARENA_MARK(arena);
-#endif /* THREADMARK */
-    releaseArenaLock();
     return result;
 }
 
 void
 PORT_ArenaRelease(PLArenaPool *arena, void *mark)
 {
-    getArenaLock();
+    PORTArenaPool *pool = (PORTArenaPool *)arena;
+    if (ARENAPOOL_MAGIC == pool->magic ) {
+	PZ_Lock(pool->lock);
 #ifdef THREADMARK
-    {
-      threadmark_arena *tarena = (threadmark_arena *)arena;
-      if( THREADMARK_MAGIC == tarena->magic ) {
-        threadmark_mark **pw, *tm;
+	{
+	    threadmark_mark **pw, *tm;
 
-        if( PR_GetCurrentThread() != tarena->marking_thread ) {
-          releaseArenaLock();
-          PORT_SetError(SEC_ERROR_NO_MEMORY);
-          PORT_Assert(0);
-          return /* no error indication available */ ;
-        }
+	    if (PR_GetCurrentThread() != pool->marking_thread ) {
+		PZ_Unlock(pool->lock);
+		PORT_SetError(SEC_ERROR_NO_MEMORY);
+		PORT_Assert(0);
+		return /* no error indication available */ ;
+	    }
 
-        pw = &tarena->first_mark;
-        while( ((threadmark_mark *)NULL != *pw) && (mark != (*pw)->mark) ) {
-          pw = &(*pw)->next;
-        }
+	    pw = &pool->first_mark;
+	    while( *pw && (mark != (*pw)->mark) ) {
+		pw = &(*pw)->next;
+	    }
 
-        if( (threadmark_mark *)NULL == *pw ) {
-          /* bad mark */
-          releaseArenaLock();
-          PORT_SetError(SEC_ERROR_NO_MEMORY);
-          PORT_Assert(0);
-          return /* no error indication available */ ;
-        }
+	    if (! *pw ) {
+		/* bad mark */
+		PZ_Unlock(pool->lock);
+		PORT_SetError(SEC_ERROR_NO_MEMORY);
+		PORT_Assert(0);
+		return /* no error indication available */ ;
+	    }
 
-        tm = *pw;
-        *pw = (threadmark_mark *)NULL;
+	    tm = *pw;
+	    *pw = (threadmark_mark *)NULL;
 
-        PL_ARENA_RELEASE(arena, mark);
+	    PL_ARENA_RELEASE(arena, mark);
 
-        if( (threadmark_mark *)NULL == tarena->first_mark ) {
-          tarena->marking_thread = (PRThread *)NULL;
-        }
-      } else {
-        PL_ARENA_RELEASE(arena, mark);
-      }
+	    if (! pool->first_mark ) {
+		pool->marking_thread = (PRThread *)NULL;
+	    }
+	}
+#else /* THREADMARK */
+	PL_ARENA_RELEASE(arena, mark);
+#endif /* THREADMARK */
+	PZ_Unlock(pool->lock);
+    } else {
+	PL_ARENA_RELEASE(arena, mark);
     }
-#else /* THREADMARK */
-    PL_ARENA_RELEASE(arena, mark);
-#endif /* THREADMARK */
-    releaseArenaLock();
 }
 
 void
 PORT_ArenaUnmark(PLArenaPool *arena, void *mark)
 {
 #ifdef THREADMARK
-    getArenaLock();
-    {
-      threadmark_arena *tarena = (threadmark_arena *)arena;
-      if( THREADMARK_MAGIC == tarena->magic ) {
-        threadmark_mark **pw, *tm;
+    PORTArenaPool *pool = (PORTArenaPool *)arena;
+    if (ARENAPOOL_MAGIC == pool->magic ) {
+	threadmark_mark **pw, *tm;
+
+	PZ_Lock(pool->lock);
 
-        if( PR_GetCurrentThread() != tarena->marking_thread ) {
-          releaseArenaLock();
-          PORT_SetError(SEC_ERROR_NO_MEMORY);
-          PORT_Assert(0);
-          return /* no error indication available */ ;
-        }
+	if (PR_GetCurrentThread() != pool->marking_thread ) {
+	    PZ_Unlock(pool->lock);
+	    PORT_SetError(SEC_ERROR_NO_MEMORY);
+	    PORT_Assert(0);
+	    return /* no error indication available */ ;
+	}
 
-        pw = &tarena->first_mark;
-        while( ((threadmark_mark *)NULL != *pw) && (mark != (*pw)->mark) ) {
-          pw = &(*pw)->next;
-        }
+	pw = &pool->first_mark;
+	while( ((threadmark_mark *)NULL != *pw) && (mark != (*pw)->mark) ) {
+	    pw = &(*pw)->next;
+	}
 
-        if( (threadmark_mark *)NULL == *pw ) {
-          /* bad mark */
-          releaseArenaLock();
-          PORT_SetError(SEC_ERROR_NO_MEMORY);
-          PORT_Assert(0);
-          return /* no error indication available */ ;
-        }
+	if ((threadmark_mark *)NULL == *pw ) {
+	    /* bad mark */
+	    PZ_Unlock(pool->lock);
+	    PORT_SetError(SEC_ERROR_NO_MEMORY);
+	    PORT_Assert(0);
+	    return /* no error indication available */ ;
+	}
 
-        tm = *pw;
-        *pw = (threadmark_mark *)NULL;
+	tm = *pw;
+	*pw = (threadmark_mark *)NULL;
 
-        if( (threadmark_mark *)NULL == tarena->first_mark ) {
-          tarena->marking_thread = (PRThread *)NULL;
-        }
-      } else {
-        PL_ARENA_RELEASE(arena, mark);
-      }
+	if (! pool->first_mark ) {
+	    pool->marking_thread = (PRThread *)NULL;
+	}
+
+	PZ_Unlock(pool->lock);
     }
-    releaseArenaLock();
 #endif /* THREADMARK */
 }
 
 char *
 PORT_ArenaStrdup(PLArenaPool *arena, char *str) {
     int len = PORT_Strlen(str)+1;
     char *newstr;
 
-    getArenaLock();
     newstr = (char*)PORT_ArenaAlloc(arena,len);
-    releaseArenaLock();
     if (newstr) {
         PORT_Memcpy(newstr,str,len);
     }
     return newstr;
 }
 
 /********************** end of arena functions ***********************/
 
index 1d2a0c84a62c0a7a6d5ac40b75e253963ab9e660..3307eb25f4d417f3dde1ab45f8547ec8fd902468
GIT binary patch
literal 97893
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
Dbzr2K
--- a/security/nss/makefile.win
+++ b/security/nss/makefile.win
@@ -38,16 +38,17 @@
 #
 
 DEPTH = ..\..
 include <$(DEPTH)\config\config.mak>
 
 GMAKE = gmake.exe
 
 GMAKE_FLAGS = OBJDIR_NAME=$(OBJDIR) MOZILLA_CLIENT=1
+GMAKE_FLAGS = $(GMAKE_FLAGS) SOURCE_MDHEADERS_DIR=$(MOZ_SRC:\=/)/mozilla/dist/include/nspr
 
 #
 # The Client's debug build uses MSVC's debug runtime library (/MDd).
 #
 
 !ifndef MOZ_DEBUG
 GMAKE_FLAGS = $(GMAKE_FLAGS) BUILD_OPT=1
 !endif
--- a/security/nss/manifest.mn
+++ b/security/nss/manifest.mn
@@ -29,16 +29,16 @@
 # the GPL.  If you do not delete the provisions above, a recipient
 # may use your version of this file under either the MPL or the
 # GPL.
 #
 CORE_DEPTH = ..
 DEPTH      = ..
 
 IMPORTS =	nspr20/$(NSPR_IMPORT_VERSION) \
-		dbm/DBM_1_54 \
+		dbm/DBM_1_55_RTM \
 		$(NULL)
 
 RELEASE = security
 
 DIRS = lib cmd
 
 
--- a/security/nss/tests/cert/cert.sh
+++ b/security/nss/tests/cert/cert.sh
@@ -149,20 +149,17 @@ cert_init_cert()
 
     noise
 }
 
 ############################# cert_create_cert #########################
 # local shell function to create client certs 
 #     initialize DB, import
 #     root cert
-#     generate request
-#     sign request
-#     import Cert
-#
+#     add cert to DB
 ########################################################################
 cert_create_cert()
 {
     cert_init_cert "$1" "$2" "$3"
 
     CU_ACTION="Initializing ${CERTNAME}'s Cert DB"
     certu -N -d "${CERTDIR}" -f "${R_PWFILE}" 2>&1
     if [ "$RET" -ne 0 ]; then
@@ -170,16 +167,29 @@ cert_create_cert()
     fi
 
     CU_ACTION="Import Root CA for $CERTNAME"
     certu -A -n "TestCA" -t "TC,TC,TC" -f "${R_PWFILE}" -d "${CERTDIR}" \
           -i "${R_CADIR}/root.cert" 2>&1
     if [ "$RET" -ne 0 ]; then
         return $RET
     fi
+    cert_add_cert
+    return $?
+}
+
+############################# cert_add_cert ############################
+# local shell function to add client certs to an existing CERT DB
+#     generate request
+#     sign request
+#     import Cert
+#
+########################################################################
+cert_add_cert()
+{
 
     CU_ACTION="Generate Cert Request for $CERTNAME"
     CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
     certu -R -d "${CERTDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -o req 2>&1
     if [ "$RET" -ne 0 ]; then
         return $RET
     fi
 
@@ -318,46 +328,84 @@ cert_ssl()
 {
   ################# Creating Certs for SSL test ###########################
   #
   CERTFAILED=0
   echo "$SCRIPTNAME: Creating Client CA Issued Certificates ==============="
   cert_create_cert ${CLIENTDIR} "TestUser" 6
 
   echo "$SCRIPTNAME: Creating Server CA Issued Certificate for \\"
-  echo "             ${HOST}.${DOMSUF} ------------------------------------"
-  cert_init_cert ${SERVERDIR} "${HOST}.${DOMSUF}" 1
+  echo "             ${HOSTADDR} ------------------------------------"
+  cert_init_cert ${SERVERDIR} "${HOSTADDR}" 1
   cp ${CADIR}/*.db .
   CU_ACTION="Creating ${CERTNAME}'s Server Cert"
   CU_SUBJECT="CN=${CERTNAME}, O=BOGUS Netscape, L=Mountain View, ST=California, C=US"
   certu -S -n "${CERTNAME}" -c "TestCA" -t "Pu,Pu,Pu" -d . -f "${R_PWFILE}" \
         -z "${R_NOISE_FILE}" -v 60 2>&1
 
   #FIXME - certdir or serverdir????
   #certu -S -n "${CERTNAME}" -c "TestCA" -t "Pu,Pu,Pu" -m "$CERTSERIAL" \
   #      -d "${CERTDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -v 60 2>&1
 
   if [ "$CERTFAILED" != 0 ] ; then
       cert_log "ERROR: SSL failed $RET"
   else
       cert_log "SUCCESS: SSL passed"
   fi
 }
+############################## cert_stresscerts ################################
+# local shell function to create client certs for SSL stresstest
+########################################################################
+cert_stresscerts()
+{
+
+  ############### Creating Certs for SSL stress test #######################
+  #
+  CERTDIR="$CLIENTDIR"
+  cd "${CERTDIR}"
+
+  CERTFAILED=0
+  echo "$SCRIPTNAME: Creating Client CA Issued Certificates ==============="
+
+  CONTINUE=$GLOB_MAX_CERT
+  CERTSERIAL=10
+
+  while [ $CONTINUE -ge $GLOB_MIN_CERT ]
+  do
+      CERTNAME="TestUser$CONTINUE"
+      cert_add_cert ${CLIENTDIR} "TestUser$CONTINUE" $CERTSERIAL
+      CERTSERIAL=`expr $CERTSERIAL + 1 `
+      CONTINUE=`expr $CONTINUE - 1 `
+  done
+  if [ "$CERTFAILED" != 0 ] ; then
+      cert_log "ERROR: StressCert failed $RET"
+  else
+      cert_log "SUCCESS: StressCert passed"
+  fi
+}
+
 
 ############################## cert_cleanup ############################
 # local shell function to finish this script (no exit since it might be
 # sourced)
 ########################################################################
 cert_cleanup()
 {
   cert_log "$SCRIPTNAME: finished $SCRIPTNAME"
   html "</TABLE><BR>" 
   cd ${QADIR}
   . common/cleanup.sh
 }
 
 ################## main #################################################
 
-cert_init
-cert_CA
-cert_smime_client
-cert_ssl
+cert_init 
+cert_CA 
+cert_ssl 
+cert_smime_client        
+if [ -n "$DO_DIST_ST" -a "$DO_DIST_ST" = "TRUE" ] ; then
+    cert_stresscerts 
+    #following lines to be used when databases are to be reused
+    #cp -r /u/sonmi/tmp/stress/kentuckyderby.13/* $HOSTDIR
+    #cp -r $HOSTDIR/../clio.8/* $HOSTDIR
+
+fi
 cert_cleanup
--- a/security/nss/tests/common/init.sh
+++ b/security/nss/tests/common/init.sh
@@ -144,58 +144,80 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOU
 
     DIST=${DIST-${MOZILLA_ROOT}/dist}
     SECURITY_ROOT=${SECURITY_ROOT-${MOZILLA_ROOT}/security/nss}
     TESTDIR=${TESTDIR-${MOZILLA_ROOT}/tests_results/security}
     OBJDIR=`(cd $COMMON; gmake objdir_name)`
     OS_ARCH=`(cd $COMMON; gmake os_arch)`
     OS_NAME=`uname -s | sed -e "s/-[0-9]*\.[0-9]*//"`
 
-    if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME"  != "CYGWIN_NT" ]; then
-        PATH=${DIST}/${OBJDIR}/bin\;${DIST}/${OBJDIR}/lib\;$PATH
-        PATH=`perl ../path_uniq -d ';' "$PATH"`
-    else
-        PATH=${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:$PATH
-        PATH=`perl ../path_uniq -d ':' "$PATH"`
+    if [ -z "${DON_T_SET_PATHS}" -o "${DON_T_SET_PATHS}" != "TRUE" ] ; then
+        if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME"  != "CYGWIN_NT" ]; then
+            PATH=${DIST}/${OBJDIR}/bin\;${DIST}/${OBJDIR}/lib\;$PATH
+            PATH=`perl ../path_uniq -d ';' "$PATH"`
+        else
+            PATH=${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:$PATH
+            PATH=`perl ../path_uniq -d ':' "$PATH"`
+        fi
+
+        LD_LIBRARY_PATH=${DIST}/${OBJDIR}/lib
+        SHLIB_PATH=${DIST}/${OBJDIR}/lib
+        LIBPATH=${DIST}/${OBJDIR}/lib
     fi
 
-    LD_LIBRARY_PATH=${DIST}/${OBJDIR}/lib
-    SHLIB_PATH=${DIST}/${OBJDIR}/lib
-    LIBPATH=${DIST}/${OBJDIR}/lib
-
     if [ ! -d "${TESTDIR}" ]; then
         echo "$SCRIPTNAME init: Creating ${TESTDIR}"
         mkdir -p ${TESTDIR}
     fi
 
     case $HOST in
         *\.*)
             HOST=`echo $HOST | sed -e "s/\..*//"`
             ;;
         ?*)
             ;;
         *)
-            echo "$SCRIPTNAME: HOST environment variable is not defined."
+            echo "$SCRIPTNAME: Fatal HOST environment variable is not defined."
             exit 1 #does not need to be Exit, very early in script
             ;;
     esac
 
     if [ -z "${DOMSUF}" ]; then
         DOMSUF=`domainname`
         if  [ -z "${DOMSUF}" ]; then
-            echo "$SCRIPTNAME: DOMSUF environment variable is not defined."
+            echo "$SCRIPTNAME: Fatal DOMSUF env. variable is not defined."
+            exit 1 #does not need to be Exit, very early in script
+        fi
+    fi
+    if [ -z "$USE_IP" -o "$USE_IP" != "TRUE" ] ; then
+        HOSTADDR=${HOST}.${DOMSUF}
+    else
+        HOSTADDR=${IP_ADDRESS}
+    fi
+
+    #if running remote side of the distributed stress test we need to use the files that
+    #the server side gives us...
+    if [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then
+        for w in `ls -rtd ${TESTDIR}/${HOST}.[0-9]* 2>/dev/null |
+            sed -e "s/.*${HOST}.//"` ; do
+                version=$w
+        done
+        HOSTDIR=${TESTDIR}/${HOST}.$version
+        echo "$SCRIPTNAME init: HOSTDIR $HOSTDIR"
+        echo $HOSTDIR
+        if [ ! -d $HOSTDIR ] ; then
+            echo "$SCRIPTNAME: Fatal: Remote side of dist. stress test "
+            echo "       - server HOSTDIR $HOSTDIR does not exist"
             exit 1 #does not need to be Exit, very early in script
         fi
     fi
 
-#NOTE - this HOSTDIR migh not be set at the time of this test!!!
-# the original had a -s maybe meant -z???? - first replaced it with -d
-#which worked, but resulted in [ ! -d "" ] which doesn't make a lot of sense
-
-    if [ -z "${HOSTDIR}" ]; then
+    if [ -n "${HOSTDIR}" ]; then
+        version=`echo $HOSTDIR | sed  -e "s/.*${HOST}.//"` 
+    else
         if [ -f "${TESTDIR}/${HOST}" ]; then
             version=`cat ${TESTDIR}/${HOST}`
         else
             version=1
         fi
         if [ -z "${version}" ]; then    # for some strange reason this file
                                         # gets truncated at times... Windos
             for w in `ls -d ${TESTDIR}/${HOST}.[0-9]* 2>/dev/null |
@@ -208,47 +230,70 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOU
         fi
         expr $version + 1 > ${TESTDIR}/${HOST}
 
         HOSTDIR=${TESTDIR}/${HOST}'.'$version
 
         mkdir -p ${HOSTDIR}
     fi
 
+    if [ -z "${LOGFILE}" ]; then
+        LOGFILE=${HOSTDIR}/output.log
+    fi
+    if [ ! -f "${LOGFILE}" ]; then
+        touch ${LOGFILE}
+    fi
     if [ -z "${RESULTS}" ]; then
         RESULTS=${HOSTDIR}/results.html
     fi
     if [ ! -f "${RESULTS}" ]; then
         cp ${COMMON}/results_header.html ${RESULTS}
         html "<H4>Platform: ${OBJDIR}<BR>" 
         html "Test Run: ${HOST}.$version</H4>" 
+        html "${BC_ACTION}"
         html "<HR><BR>" 
         html "<HTML><BODY>" 
 
-        echo "********************************************"
-        echo "   Platform: ${OBJDIR}"
-        echo "   Results: ${HOST}.$version"
-        echo "********************************************"
+        echo "********************************************" | tee ${LOGFILE}
+        echo "   Platform: ${OBJDIR}" | tee ${LOGFILE}
+        echo "   Results: ${HOST}.$version" | tee ${LOGFILE}
+        echo "********************************************" | tee ${LOGFILE}
+	echo "$BC_ACTION" | tee ${LOGFILE}
+    #if running remote side of the distributed stress test let the user know who it is...
+    elif [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then
+        echo "********************************************" | tee ${LOGFILE}
+        echo "   Platform: ${OBJDIR}" | tee ${LOGFILE}
+        echo "   Results: ${HOST}.$version" | tee ${LOGFILE}
+        echo "   remote side of distributed stress test " | tee ${LOGFILE}
+        echo "   `uname -n -s`" | tee ${LOGFILE}
+        echo "********************************************" | tee ${LOGFILE}
     fi
-    if [ -z "${LOGFILE}" ]; then
-        LOGFILE=${HOSTDIR}/output.log
-    fi
-    if [ ! -f "${LOGFILE}" ]; then
-        touch ${LOGFILE}
-    fi
+
+    echo "$SCRIPTNAME init: Testing PATH $PATH against LIB $LD_LIBRARY_PATH" |
+        tee ${LOGFILE}
 
     KILL="kill"
     if  [ "${OS_ARCH}" = "Linux" ]; then
         SLEEP="sleep 30"
     fi
     if [ `uname -s` = "SunOS" ]; then
         PS="/usr/5bin/ps"
     else
         PS="ps"
     fi
+    #found 3 rsh's so far that do not work as expected - cygnus mks6 (restricted sh) and mks 7
+    if [ -z "$RSH" ]; then
+        if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME"  = "CYGWIN_NT" ]; then
+            RSH=/cygdrive/c/winnt/system32/rsh
+        elif [ "${OS_ARCH}" = "WINNT" ]; then
+            RSH=c:/winnt/system32/rsh
+        else
+            RSH=rsh
+        fi
+    fi
    
 
     CURDIR=`pwd`
 
     HTML_FAILED='</TD><TD bgcolor=red>Failed</TD><TR>'
     HTML_PASSED='</TD><TD bgcolor=lightGreen>Passed</TD><TR>'
 
     CU_ACTION='Unknown certutil action'
@@ -284,17 +329,29 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOU
     # a new log file, short - fast to search, mostly for tools to
     # see if their portion of the cert has succeeded, also for me -
     CERT_LOG_FILE=${HOSTDIR}/cert.log      #the output.log is so crowded...
 
     TEMPFILES="${PWFILE} ${NOISE_FILE}"
     trap "Exit $0 Signal_caught" 2 3
 
     export PATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH
-    export DOMSUF
+    export DOMSUF HOSTADDR
     export KILL SLEEP PS
     export MOZILLA_ROOT SECURITY_ROOT DIST TESTDIR OBJDIR HOSTDIR QADIR
     export LOGFILE SCRIPTNAME
 
+    if [ -z "$GLOB_MIN_CERT" ] ; then
+        GLOB_MIN_CERT=0
+    fi
+    if [ -z "$GLOBMAX_CERT" ] ; then
+        GLOB_MAX_CERT=200
+    fi
+    if [ -z "$MIN_CERT" ] ; then
+        MIN_CERT=$GLOB_MIN_CERT
+    fi
+    if [ -z "$MAX_CERT" ] ; then
+        MAX_CERT=$GLOB_MAX_CERT
+    fi
 
     SCRIPTNAME=$0
     INIT_SOURCED=TRUE   #whatever one does - NEVER export this one please
 fi
--- a/security/nss/tests/header
+++ b/security/nss/tests/header
@@ -10,17 +10,17 @@
 # included from (don't expect this to be up to date)
 # --------------------------------------------------
 #   qa_stat
 #   mksymlinks 
 #   nssqa 
 #
 # parameters
 # ----------
-#   nssversion (supported: 30b, 31, tip)
+#   nssversion (supported: 30b, 31, tip 32)
 #   builddate (default - today)
 #
 # options
 # -------
 #   -y answer all questions with y - use at your own risk... ignores warnings 
 #   -s silent (only usefull with -y)
 #   -h, -? - you guessed right - displays this text
 #   -d debug
@@ -151,16 +151,21 @@ fi
 O_LDIR=OFF          #local QA dir for NT, temporary
 
 if [ -z "$WIN_WAIT_FOREVER" ]    # header is global, some including scripts 
 then                # want the init to wait forever for directories to
                     # appear (windows only) if OFF exit, if ON wait forever
     WIN_WAIT_FOREVER=OFF
 fi
 
+if [ -z "$BC_MASTER" ]    # master directory for backwardscompatibility testing
+then
+    BC_MASTER="20010212.1.nss32_rtm"
+fi
+
 EARLY_EXIT=TRUE     #before the report file has been created, causes Exit to 
                     #create it
 
 ################################### glob_init ##########################
 # global shell function, main initialisation function
 ########################################################################
 glob_init()
 {
@@ -324,17 +329,16 @@ set_files()
 
 ################################### eval_opts ##########################
 # global shell function, for NT and cron operation, first a tmpfile 
 # needs to be created
 ########################################################################
 write_to_tmpfile()
 {
     O_CRONFILE=ON
-    Debug "Writing to the TMPFILE"
     O_FILE=ON
     FILENAME=${TMP}/nsstmp.$$    # for now write to the temporary file
                                  # since we don't know the hostname yet
                                  # will be inserted to the real file later
     TMPFILES="$TMPFILES nsstmp.$$"        
     touch $FILENAME || Exit "Error: can't touch $FILENAME"
     Debug "Writing output to $FILENAME"
 }
@@ -409,44 +413,42 @@ eval_opts()
             ;;
         -*)
             glob_usage "Error: Can't handle option $1"
             ;;
         ?*)
             NSSVER=$1
             if [ -z "$NSSVER" ]        
             then
-                NSSVER="tip"
-                Debug "NSS Version: Parameters missing - defaulting to tip!"
+                NSSVER="32"
+                Debug "NSS Version: Parameters missing - defaulting to 32!"
             else
                 BUILDDATE=$2
                 if [ -z "$BUILDDATE" ] 
                 then
                     BUILDDATE=`date +%m%d`
                     Debug "Builddate: Parameters missing - defaulting to today!"
                 else
                     shift
                 fi
             fi
             ;;
     esac
     shift
   done
 
-  Debug "Builddate $BUILDDATE NssVersion $NSSVER"
-
   if [ -z "$BUILDDATE" ]         
   then
       BUILDDATE=`date +%m%d`
       Debug "Builddate: Parameters missing - defaulting to today!"
   fi
   if [ -z "$NSSVER" ]            
   then
-      NSSVER="tip"
-      Debug "NSS Version: Parameters missing - defaulting to tip!"
+      NSSVER="32"
+      Debug "NSS Version: Parameters missing - defaulting to 32!"
   fi
   
   Debug "Builddate $BUILDDATE NssVersion $NSSVER"
   export BUILDDATE NSSVER
 }
 
 ######################### win_set_dirs ################################
 # global shell function, interactively finds the directories in case
@@ -575,30 +577,86 @@ set_host()
 set_objdir()
 {
     OBJDIR=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name`
     OS_ARCH=`cd ${TESTSCRIPTDIR}/common; gmake os_arch`
     
     #at this point $MASTEBUILD is be either NT or unix
 
     LOCALDIST=${D1}/builds/${QAYEAR}${BUILDDATE}.${BUILDNUMBER}/${MASTERBUILD}/mozilla/dist
+    BCDIST=${D1}/builds/${BC_MASTER}/${MASTERBUILD}/mozilla/dist
     LOCALDIST_BIN=${LOCALDIST}/${OBJDIR}/bin
 
     DIST=$LOCALDIST
 
-#FIXME - test so PATH won't contai it double
-    PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH
+    if [ -z "${TEST_LEVEL}" ] ; then 
+        TEST_LEVEL=0
+    fi
+    bc ${TEST_LEVEL}   #set the path for the backward compatibility test
+
     PATH_CONTAINS_BIN="TRUE"
     export PATH_CONTAINS_BIN
-    Debug "Path after set_objdir $PATH"
+
+    export OBJDIR OS_ARCH LOCALDIST LOCALDIST_BIN DIST PATH BCDIST
+}
 
-    Debug "PATH $PATH"
+########################### bc #########################################
+# global shell function , sets paths for the backward compatibility test
+########################################################################
+bc()
+{
+  DON_T_SET_PATHS="TRUE"
+  case $1 in
+    0)
+      if [ "$O_WIN" = "ON" -a "$O_CYGNUS" != ON ] ; then
+          PATH="$TESTSCRIPTDIR;$LOCALDIST_BIN;$BASEPATH"
+      else
+          PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH
+      fi
+      BC_ACTION=""
+      DON_T_SET_PATHS="FALSE" #let init.sh override - FIXME - check if necessary
+      ;;
+    1)
+      BC_ACTION="backward compatibility against shlibs in $BC_MASTER"
+      LD_LIBRARY_PATH=${BCDIST}/${OBJDIR}/lib
+      if [ "$O_WIN" = "ON" ] ; then
+          if [ "$O_CYGNUS" = ON ] ; then
+              PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH:$LD_LIBRARY_PATH
+          else
+              PATH="$TESTSCRIPTDIR;$LOCALDIST_BIN;$BASEPATH;$LD_LIBRARY_PATH"
+          fi
+      else
+          PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH
+      fi
+      Debug "1st stage of backward compatibility test"
+      ;;
+    *)
+      BC_ACTION="forward compatibility of binaries in $BC_MASTER"
+      BCDIST_BIN=${BCDIST}/${OBJDIR}/bin
+      LD_LIBRARY_PATH=${LOCALDIST}/${OBJDIR}/lib
+      if [ "$O_WIN" = "ON" ] ; then
+          if [ "$O_CYGNUS" = ON ] ; then
+              PATH=$TESTSCRIPTDIR:$BCDIST_BIN:$BASEPATH:$LD_LIBRARY_PATH
+          else
+              PATH="$TESTSCRIPTDIR;$BCDIST_BIN;$BASEPATH;$LD_LIBRARY_PATH"
+          fi
+      else
+          PATH=$TESTSCRIPTDIR:$BCDIST_BIN:$BASEPATH
+      fi
+      Debug "2nd stage of backward compatibility test"
+      ;;
+  esac
+  SHLIB_PATH=${LD_LIBRARY_PATH}
+  LIBPATH=${LD_LIBRARY_PATH}
+  Debug "PATH $PATH"
+  Debug "LD_LIBRARY_PATH $LD_LIBRARY_PATH"
+  export PATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH
+  export DON_T_SET_PATHS BC_ACTION
+}
 
-    export OBJDIR OS_ARCH LOCALDIST LOCALDIST_BIN DIST PATH
-}
 ########################### Ps #########################################
 # global shell function , attempts a platform specific ps
 ########################################################################
 Ps()
 {
 #AIX, OSF ps -ef, solaris /usr/5bin/ps -ef, win ps -ef but no user id
 #linux ps -ef, HP
 
@@ -705,17 +763,17 @@ Exit()
     then
         if [ $EARLY_EXIT = TRUE ]    #before the report file has been created
         then
             early_exit "$1"
         elif [ -n "$FILENAME" -a -f "$FILENAME" ]
         then
             cat $FILENAME | rmail $MAILINGLIST
         fi
-        rm $FILENAME 2>/dev/null
+        #rm $FILENAME 2>/dev/null
     elif  [ $O_MAIL = "ON" -a $EARLY_EXIT = TRUE ]
     then
         early_exit "$1"
         rm $FILENAME 2>/dev/null
     fi
     #chmod a+rw ${RESULTDIR} ${RESULTDIR}/* ${RESULTDIR}/*/* &
     exit
 }
--- a/security/nss/tests/nssqa
+++ b/security/nss/tests/nssqa
@@ -247,16 +247,26 @@ nssqa_main()
       BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT"
       run_all
   else
       Debug "This is a 32 bit platform"
   fi
   
 }
   
-if [ $O_FILE = ON ]
-then
-    nssqa_main 2>>$FILENAME
-else
-    nssqa_main
-fi
+#FIXME start TEST_LEVEL with 0
+
+TEST_LEVEL=0
+
+while [ $TEST_LEVEL -lt 3 ] ; do
+    unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT"
+    unset USE_64;export USE_64;Debug "USE_64 $USE_64"
+    bc $TEST_LEVEL
+    if [ $O_FILE = ON ]
+    then
+        nssqa_main 2>>$FILENAME
+    else
+        nssqa_main
+    fi
+    TEST_LEVEL=`expr $TEST_LEVEL + 1 `
+done
 
 Exit "Done."
--- a/security/nss/tests/qa_stat
+++ b/security/nss/tests/qa_stat
@@ -336,16 +336,28 @@ qa_errorlist()
         lline
     fi
 
     grep 'cache hits; .* cache misses, .* cache not reusable' */output.log | 
         grep -v selfserv |
         grep -v '0 cache hits; 1 cache misses, 0 cache not reusable' | 
         grep -v '0 cache hits; 0 cache misses, 0 cache not reusable' | 
         grep -v ' cache hits; 1 cache misses, 0 cache not reusable'
+    grep -i error */output.log |
+        grep -vi "write to SSL socket" |
+        grep -vi "HDX PR_Read returned error" |
+        grep -vi "no error" |
+        grep -vi "12285"
+    grep -i failed */output.log | 
+        grep -vi "write to SSL socket" | 
+        grep -vi "peer cannot verify" | 
+        grep -vi "error" |
+        grep -vi "fatal" |
+        grep -vi "TCP connection reset"
+    grep -i fatal */output.log
         #grep -v '999 cache hits; 1 cache misses, 0 cache not reusable'
     #if [ "$1" = "1" ]
     #then
         #lline
         #echo "    I n c o m p l e t e    Q A     L i s t"
         #lline
     #fi
     if [ "$1" = "1" ]
--- a/security/nss/tests/set_environment
+++ b/security/nss/tests/set_environment
@@ -15,20 +15,16 @@ if [ -z "$HOME" ]
 then
     HOME=/u/svbld
 fi
 if [ -z "$QASCRIPT_DIR" ]
 then
     QASCRIPT_DIR=`dirname $0`
 fi
 
-
-#FIXME - where do we need the OLDPATH
-
-OLDPATH="$PATH"
 PATH=.:$HOME/bin:/tools/ns/bin:/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/dist/local/exe:/usr/bin/X11:/usr/audio/bin:/u/sonmi/bin:$PATH
 
 CVSROOT=:pserver:svbld@cvsserver:/m/src
 
 os_name=`uname -s`
 os_version=`uname -r`
 os_full=""
 
@@ -114,55 +110,55 @@ if [ "$os_name" = "CYGWIN_NT-4.0" -o \
     "$os_name" = "CYGWIN_98-4.10" ]
 then
     #FIXME net use, mount the neccessary pnetwork drives and partitiones first
     #FIXME - take MKS out of the PATH
     os_full=$os_name
     os_name="Windows"
     O_CYGNUS=ON
     O_WIN=ON
-    OLDPATH=`echo "$OLDPATH" | sed -e 's/\\\/\//g'`
     PATH="`dirname $0`:.:/cygdrive/c/cygwin/bin:/cygdrive/z/nstools/bin:/cygdrive/z/nstools/perl5:/cygdrive/z/bin:/cygdrive/c/WINNT/System32:/cygdrive/c/WINNT"
-#:$OLDPATH:
     RM=/cygdrive/c/cygwin/bin/rm.exe    #FIXME - in case we cant cporrect 
                                         #these with the PATH alone
     PATH=`perl $QASCRIPT_DIR/path_uniq "$PATH"`
+    RSH=/cygdrive/c/winnt/system32/rsh
 elif [ "$os_name" = "Windows_95" -o \
     "$os_name" = "Windows_NT" -o \
     "$os_name" = "WINNT" -o \
+    "$os_name" = "Windows" -o \
     "$os_name" = "Windows_98" ]
 then
     #FIXME net use, mount the neccessary pnetwork drives and partitiones first
-    #OLDPATH=`echo "$OLDPATH" | sed -e 's/\\\/\//g'` FIXME - MKS shell 
-            # interprets \bin as <backspace>in...
     PATH=`echo $SHELL | sed -e "s/.ksh.exe//g"  -e "s/.sh.exe//g"`
     PATH="Z:/nstools/bin;Z:/nstools/perl5;z:/bin;$PATH"
 
     if [  "$os_name" = "Windows_NT" -o \
         "$os_name" = "WINNT" ]
     then
         PATH="${PATH};C:/WINNT/System32;C:/WINNT;.;"
     fi
     PATH="`dirname $0`;$PATH"
     
     PATH=`perl $QASCRIPT_DIR/path_uniq -d ';' "$PATH"`
     echo $PATH
     os_full=$os_name
     os_name="Windows"
     O_MKS=ON
     O_WIN=ON
+    RSH=c:/winnt/system32/rsh
     
 else
     EDITOR=vi
     EMACSLOADPATH=/u/svbld/emacs
     PYTHONPATH=.:/tools/ns/lib/python1.4
     PAGER=less
     XMCD_LIBDIR=/usr/local/lib/xmcd
     DISPLAY=:0.0
     PATH=`perl $QASCRIPT_DIR/path_uniq "$PATH"`
+    RSH=rsh
 fi
 
 BASEPATH=$PATH    # in  case we we set and reset DIST directories the PATH 
                 # needs to change accordingly
 export PATH EDITOR EMACSLOADPATH PYTHONPATH PAGER XMCD_LIBDIR DISPLAY MANPATH os_full os_name BASEPATH
 
 umask 022
 
--- a/security/nss/tests/ssl/ssl.sh
+++ b/security/nss/tests/ssl/ssl.sh
@@ -89,16 +89,17 @@ ssl_init()
   R_SERVERPID=../tests_pid.$$
 
   TEMPFILES="$TMPFILES ${SERVEROUTFILE}  ${SERVERPID}"
 
   fileout=0 #FIXME, looks like all.sh tried to turn this on but actually didn't
   #fileout=1
   #verbose="-v" #FIXME - see where this is usefull
   cd ${CLIENTDIR}
+
 }
 
 ########################### is_selfserv_alive ##########################
 # local shell function to exit with a fatal error if selfserver is not
 # running
 ########################################################################
 is_selfserv_alive()
 {
@@ -152,25 +153,25 @@ kill_selfserv()
 # also: wait until the server is up and running
 ########################################################################
 start_selfserv()
 {
   if [ -n "$testname" ] ; then
       echo "$SCRIPTNAME: $testname ----"
   fi
   sparam=`echo $sparam | sed -e 's;_; ;g'`
-  echo "selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOST}.${DOMSUF} \\"
+  echo "selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOSTADDR} \\"
   echo "         -w nss ${sparam} -i ${R_SERVERPID} $verbose &"
   echo "selfserv started at `date`"
   if [ ${fileout} -eq 1 ]; then
-      selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOST}.${DOMSUF} \
+      selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOSTADDR} \
                -w nss ${sparam} -i ${R_SERVERPID} $verbose \
                > ${SERVEROUTFILE} 2>&1 &
   else
-      selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOST}.${DOMSUF} \
+      selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOSTADDR} \
                -w nss ${sparam} -i ${R_SERVERPID} $verbose &
   fi
   wait_for_selfserv
 }
 
 ############################## ssl_cov #################################
 # local shell function to perform SSL Cipher Coverage tests
 ########################################################################
@@ -253,39 +254,44 @@ ssl_stress()
 
   cat ${SSLSTRESS} | while read value sparam cparam testname
   do
       if [ $value != "#" ]; then
           cparam=`echo $cparam | sed -e 's;_; ;g'`
           start_selfserv
 
           echo "strsclnt -p ${PORT} -d . -w nss $cparam $verbose \\"
-          echo "         ${HOST}.${DOMSUF}"
+          echo "         ${HOSTADDR}"
           echo "strsclnt started at `date`"
-          strsclnt -p ${PORT} -d . -w nss $cparam $verbose ${HOST}.${DOMSUF}
+          strsclnt -p ${PORT} -d . -w nss $cparam $verbose ${HOSTADDR}
           echo "strsclnt completed at `date`"
 
           html_msg $? $value "${testname}"
           kill_selfserv
       fi
   done
 
   html "</TABLE><BR>"
 }
 
+
 ############################## ssl_cleanup #############################
 # local shell function to finish this script (no exit since it might be
 # sourced)
 ########################################################################
 ssl_cleanup()
 {
   rm $SERVERPID 2>/dev/null
   cd ${QADIR}
   . common/cleanup.sh
 }
 
 ################## main #################################################
 
-ssl_init
-ssl_cov
-ssl_auth
-ssl_stress
-ssl_cleanup
+#this script may be sourced from the distributed stress test - in this case do nothing...
+
+if [ -z  "$DO_REM_ST" -a -z  "$DO_DIST_ST" ] ; then
+    ssl_init
+    ssl_cov
+    ssl_auth
+    ssl_stress
+    ssl_cleanup
+fi
new file mode 100755
--- /dev/null
+++ b/security/nss/tests/ssl/ssl_dist_stress.sh
@@ -0,0 +1,344 @@
+#! /bin/sh
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+# 
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+# 
+# The Original Code is the Netscape security libraries.
+# 
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation.  Portions created by Netscape are 
+# Copyright (C) 1994-2000 Netscape Communications Corporation.  All
+# Rights Reserved.
+# 
+# Contributor(s):
+# 
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable 
+# instead of those above.  If you wish to allow use of your 
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL.  If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+#
+########################################################################
+#
+# mozilla/security/nss/tests/ssl/ssl_dist_stress.sh
+#
+# Script to test NSS SSL - distributed stresstest - this script needs to 
+# source the regular ssl.sh (for shellfunctions, certs and variables 
+# initialisation)
+# create certs
+# start server
+# start itself via rsh on different systems to connect back to the server
+# 
+#
+# needs to work on all Unix and Windows platforms
+#
+# special strings
+# ---------------
+#   FIXME ... known problems, search for this string
+#   NOTE .... unexpected behavior
+#
+# FIXME _ don't know yet how long to wait until the server needs to be killed
+# especially on NT
+#
+########################################################################
+
+############################## ssl_ds_init #############################
+# local shell function to initialize this script
+########################################################################
+ssl_ds_init()
+{
+  if [ -z "$GLOB_MIN_CERT" ] ; then
+      GLOB_MIN_CERT=0
+  fi
+  if [ -z "$GLOBMAX_CERT" ] ; then
+      GLOB_MAX_CERT=200
+  fi
+  IP_PARAM=""
+  CD_QADIR_SSL=""
+
+
+  if [ -n "$1" ] ; then
+      ssl_ds_eval_opts $*
+  fi
+  SCRIPTNAME=ssl_dist_stress.sh      # sourced - $0 would point to all.sh
+
+  if [ -z "${CLEANUP}" ] ; then     # if nobody else is responsible for
+      CLEANUP="${SCRIPTNAME}"       # cleaning this script will do it
+  fi
+  
+  ssl_init  # let some other script do the hard work (initialize, generate certs, ...
+
+  SCRIPTNAME=ssl_dist_stress.sh
+  echo "$SCRIPTNAME: SSL distributed stress tests ==============================="
+
+}
+
+######################### ssl_ds_usage #################################
+# local shell function to explain the usage
+########################################################################
+ssl_ds_usage()
+{
+  echo "Usage: `basename $1`"
+  echo "        -host hostname "
+  echo "           ...host who runs the server, for distributed stress test"
+  echo "        -stress "
+  echo "           ...runs the server sider of the distributed stress test"
+  echo "        -dir unixdirectory "
+  echo "           ...lets the server side of the distributed stress test"
+  echo "              know where to find the scritp to start on the remote side"
+  echo "        -certnum start-end"
+  echo "           ... provides the range of certs for distributed stress test"
+  echo "               for example -certnum 10-20 will connect 10 times"
+  echo "               no blanks in the range string (not 10 - 20)"
+  echo "               valid range ${GLOB_MIN_CERT}-${GLOB_MAX_CERT}"
+  echo "        -? ...prints this text"
+  exit 1 #does not need to be Exit, very early in script
+}
+
+######################### ssl_ds_eval_opts #############################
+# local shell function to deal with options and parameters
+########################################################################
+ssl_ds_eval_opts()
+{
+    #use $0 not $SCRIPTNAM<E, too early, SCRIPTNAME not yet set
+
+  while [ -n "$1" ]
+  do
+    case $1 in
+        -host)
+            BUILD_OPT=1
+            export BUILD_OPT
+            DO_REM_ST="TRUE"
+            shift
+            SERVERHOST=$1
+            HOST=$1
+            if [ -z $SERVERHOST ] ; then
+                echo "$0 `uname -n`: -host requires hostname"
+                ssl_ds_usage
+            fi
+            echo "$0 `uname -n`: host $HOST ($1)"
+            ;;
+        -certn*)
+            shift
+            rangeOK=`echo $1  | sed -e 's/[0-9][0-9]*-[0-9][0-9]*/OK/'`
+            MIN_CERT=`echo $1 | sed -e 's/-[0-9][0-9]*//' -e 's/^00*//'`
+            MAX_CERT=`echo $1 | sed -e 's/[0-9][0-9]*-//' -e 's/^00*//'`
+            if [ -z "$rangeOK" -o "$rangeOK" != "OK" -o \
+                         -z "$MIN_CERT" -o -z "$MAX_CERT" -o \
+                        "$MIN_CERT" -gt "$MAX_CERT" -o \
+                        "$MIN_CERT" -lt "$GLOB_MIN_CERT" -o \
+                        "$MAX_CERT" -gt "$GLOB_MAX_CERT" ] ; then
+                echo "$0 `uname -n`: -certn range not valid"
+                ssl_ds_usage
+            fi
+            echo "$0 `uname -n`: will use certs from $MIN_CERT to $MAX_CERT"
+            ;;
+        -server|-stress|-dist*st*)
+            BUILD_OPT=1
+            export BUILD_OPT
+            DO_DIST_ST="TRUE"
+            ;;
+        -dir|-unixdir|-uxdir|-qadir)
+            shift
+            UX_DIR=$1
+	    #FIXME - we need a default unixdir
+            if [ -z "$UX_DIR" ] ; then # -o ! -d "$UX_DIR" ] ; then can't do, Win doesn't know...
+                echo "$0 `uname -n`: -dir requires directoryname "
+                ssl_ds_usage
+            fi
+            CD_QADIR_SSL="cd $UX_DIR"
+            ;;
+        -ip*)
+            shift
+            IP_ADDRESS=$1
+            if [ -z "$IP_ADDRESS" ] ; then
+                echo "$0 `uname -n`: -ip requires ip-address "
+                ssl_ds_usage
+            fi
+            USE_IP=TRUE
+            IP_PARAM="-ip $IP_ADDRESS"
+            ;;
+        -h|-help|"-?"|*)
+            ssl_ds_usage
+            ;;
+    esac
+    shift
+  done
+}
+
+############################## ssl_ds_rem_stress #######################
+# local shell function to perform the client part of the SSL stress test
+########################################################################
+
+ssl_ds_rem_stress()
+{
+  testname="SSL remote part of Stress test (`uname -n`)"
+  echo "$SCRIPTNAME `uname -n`: $testname"
+
+  #cp -r "${CLIENTDIR}" /tmp/ssl_ds.$$ #FIXME
+  #cd /tmp/ssl_ds.$$
+  #verbose="-v"
+
+  cd ${CLIENTDIR}
+
+  CONTINUE=$MAX_CERT
+  while [ $CONTINUE -ge $MIN_CERT ]
+  do
+      echo "strsclnt -D -p ${PORT} -d . -w nss -c 1 $verbose  "
+      echo "         -n TestUser$CONTINUE ${HOSTADDR} #`uname -n`"
+      strsclnt -D -p ${PORT} -d . -w nss -c 1 $verbose  \
+               -n "TestUser$CONTINUE" ${HOSTADDR} &
+               #${HOSTADDR} &
+      CONTINUE=`expr $CONTINUE - 1 `
+      #sleep 4 #give process time to start up
+  done
+
+  html_msg 0 0 "${testname}" #FIXME
+}
+
+######################### ssl_ds_dist_stress ###########################
+# local shell function to perform the server part of the new, distributed 
+# SSL stress test
+########################################################################
+
+ssl_ds_dist_stress()
+{
+  max_clientlist=" 
+               box-200
+               washer-200
+               dryer-200
+               hornet-50
+               shabadoo-50
+               y2sun2-10
+               galileo-10
+               shame-10
+               axilla-10
+               columbus-10
+               smarch-10
+               nugget-10
+               charm-10
+               hp64-10
+               biggayal-10
+               orville-10
+               kwyjibo-10
+               hbombaix-10
+               raven-10
+               jordan-10
+               phaedrus-10
+               louie-10
+               trex-10
+               compaqtor-10"
+
+  #clientlist="  box-200 washer-50 charm-10 jordan-10 louie-10 smarch-10 phaedrus-10 charm-10 hbombaix-20 box-200 washer-50 "
+  #clientlist=" box-200 washer-50 louie-10 hbombaix-10 charm-10 trex-20 jordan-10 box-200 compaqtor-10 "
+  #clientlist=" box-2 washer-5" #FIXME ADJUST
+  clientlist="  box-200 charm-10 jordan-10 louie-10 smarch-10 phaedrus-10 charm-10 "
+
+  html_head "SSL Distributed Stress Test"
+
+  testname="SSL distributed Stress test"
+
+  echo cd "${CLIENTDIR}"
+  cd "${CLIENTDIR}"
+  if [ -z "CD_QADIR_SSL" ] ; then
+      CD_QADIR_SSL="cd $QADIR/ssl"
+  else
+      cp -r $HOSTDIR $HOSTDIR/../../../../../y2sun2_Solaris8/mozilla/tests_results/security
+  fi
+
+  #sparam=" -t 128 -D -r "
+  sparam=" -t 16 -D -r -r "
+  start_selfserv
+
+  for c in $clientlist
+  do
+      client=`echo $c | sed -e "s/-.*//"`
+      number=`echo $c | sed -e "s/.*-//"`
+      CLIENT_OK="TRUE"
+      echo $client
+      ping $client >/dev/null || CLIENT_OK="FALSE"
+      if [ "$CLIENT_OK" = "FALSE" ] ; then
+          echo "$SCRIPTNAME `uname -n`: $client can't be reached - skipping"
+      else
+          get_certrange $number
+          echo "$SCRIPTNAME `uname -n`: $RSH $client -l svbld \\ "
+          echo "       \" $CD_QADIR_SSL ;ssl_dist_stress.sh \\"
+          echo "            -host $HOST -certnum $CERTRANGE $IP_PARAM \" "
+          $RSH $client -l svbld \
+               " $CD_QADIR_SSL;ssl_dist_stress.sh -host $HOST -certnum $CERTRANGE $IP_PARAM " &
+      fi
+  done
+
+  echo cd "${CLIENTDIR}"
+  cd "${CLIENTDIR}"
+
+  sleep 300 # give the clients time to finish #FIXME ADJUST
+ 
+  echo "GET /stop HTTP/1.0\n\n" > stdin.txt #check to make sure it has /r/n
+  echo "tstclnt -h clio.red.iplanet.com -p  8443 -d ${CLIENTDIR} -n TestUser0 "
+  echo "        -w nss -f < stdin.txt"
+  tstclnt -h clio.red.iplanet.com -p  8443 -d ${CLIENTDIR} -n TestUser0 \
+	  -w nss -f < stdin.txt
+  
+  html_msg 0 0 "${testname}"
+  html "</TABLE><BR>"
+}
+
+############################ get_certrange #############################
+# local shell function to find the range of certs that the next remote 
+# client is supposed to use (only for server side of the dist stress test
+########################################################################
+get_certrange()
+{
+  rangeOK=`echo $1  | sed -e 's/[0-9][0-9]*/OK/'`
+  if [ -z "$rangeOK" -o "$rangeOK" != "OK" -o $1 = "OK" ] ; then
+      range=10
+      echo "$SCRIPTNAME `uname -n`: $1 is not a valid number of certs "
+      echo "        defaulting to 10 for $client"
+  else
+      range=$1
+      if [ $range -gt $GLOB_MAX_CERT ] ; then
+          range=$GLOB_MAX_CERT
+      fi
+  fi
+  if [ -z "$FROM_CERT" ] ; then    # start new on top of the cert stack
+      FROM_CERT=$GLOB_MAX_CERT
+  elif [ `expr $FROM_CERT - $range + 1 ` -lt  0 ] ; then 
+          FROM_CERT=$GLOB_MAX_CERT # dont let it fall below 0 on the TO_CERT
+
+  fi
+  TO_CERT=`expr $FROM_CERT - $range + 1 `
+  if [ $TO_CERT -lt 0 ] ; then     # it's not that I'm bad in math, I just 
+      TO_CERT=0                    # don't trust expr...
+  fi
+  CERTRANGE="${TO_CERT}-${FROM_CERT}"
+  FROM_CERT=`expr ${TO_CERT} - 1 ` #start the next  client one below 
+}
+
+
+################## main #################################################
+
+DO_DIST_ST="TRUE"
+. ssl.sh
+ssl_ds_init $*
+if [ -n  "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then
+    ssl_ds_rem_stress
+    exit 0 #no cleanup on purpose
+elif [ -n  "$DO_DIST_ST" -a "$DO_DIST_ST" = "TRUE" ] ; then
+    ssl_ds_dist_stress
+fi
+ssl_cleanup
--- a/security/nss/tests/tools/tools.sh
+++ b/security/nss/tests/tools/tools.sh
@@ -153,13 +153,23 @@ tools_cleanup()
   html "</TABLE><BR>"
   cd ${QADIR}
   . common/cleanup.sh
 }
 
 ################## main #################################################
 
 tools_init
-tools_p12
+
+#FIXME - tmp workaround for tests that do not work in 3.2 RTM
+#echo $BC_ACTION | grep "forward compatibility"  && RUN_TOOLS_P12="FALSE"
+echo $BC_ACTION | grep "compatibility"  && RUN_TOOLS_P12="FALSE"
+if [ -n "${RUN_TOOLS_P12}" -a "${RUN_TOOLS_P12}" = "FALSE" ] ; then
+  html_msg 0 0 "Can't run pk12util tests  for NSS 3.2 (pk12util -i)"
+  html_msg 0 0 "Can't run pk12util tests  for NSS 3.2 (pk12util -o)"
+else
+    tools_p12
+fi
+
 tools_sign
 tools_cleanup