/* kwan_from_to.c v4.0 */

/*
 * $Log: kwan_from_to.c,v $
 * Revision 1.3  1998/06/16 06:27:39  remi
 * - Integrated some patches in the UltraSparc DES code.
 * - Cleaned-up C++ style comments in the UltraSparc DES code.
 * - Replaced "rm `find ..`" by "find . -name ..." in superclean.
 *
 * Revision 1.2  1998/06/14 15:18:46  remi
 * Avoid tons of warnings due to a brain-dead CVS.
 *
 * Revision 1.1.1.1  1998/06/14 14:23:49  remi
 * Initial integration.
 *
 */

#include "des.h"

static char *id="@(#)$Id: kwan_from_to.c,v 1.3 1998/06/16 06:27:39 remi Exp $";

/*
 * Generated S-box files.
 *
 * Produced by Matthew Kwan - May 1998
 */

/*
 * These are unmodified as retrieved from his web site.
 *
 * Well, almost unmodified.
 * An example Kwan modified routine looks like this:
 *
 * INLINE void
 * example_s1 (
 * 	KWAN_LOOP_SLICE	a1,	KWAN_LOOP_SLICE	a2,
 * 	KWAN_LOOP_SLICE	a3,	KWAN_LOOP_SLICE	a4,
 * 	KWAN_LOOP_SLICE	a5,	KWAN_LOOP_SLICE	a6,
 * 	KWAN_LOOP_SLICE	*merge1, KWAN_LOOP_SLICE *merge2,
 * 	KWAN_LOOP_SLICE	*merge3, KWAN_LOOP_SLICE *merge4,
 * 	KWAN_LOOP_SLICE	*out1,	KWAN_LOOP_SLICE	*out2,
 * 	KWAN_LOOP_SLICE	*out3,	KWAN_LOOP_SLICE	*out4
 * ) {
 * 	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
 * 	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
 * 	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
 * 	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
 * 	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
 * 	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
 * 	KWAN_LOOP_SLICE	x49, x50, x51, x52, x53, x54, x55, x56;
 * 	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

 * 	x1 = a3 & ~a5;
 * 	x2 = x1 ^ a4;
 *  ...
 * 	x21 = a1 & x20;
 * 	x22 = x12 ^ ~x21;
 * 	Preload_2 = *merge2;
 * 	Preload_2 = Preload_2 ^ x22;
 * 	*out2 = Preload_2;
 * 	x23 = x1 | x5;
 * 	x24 = x23 ^ x8;
 *  ...
 * 	x34 = a1 & x33;
 * 	x35 = x27 ^ x34;
 * 	Preload_4 = *merge4;
 * 	Preload_4 = Preload_4 ^ x35;
 * 	*out4 = Preload_4;
 * 	x36 = a3 & x28;
 * 	x37 = x18 & ~x36;
 *  ...
 * 	x45 = a1 & ~x44;
 * 	x46 = x39 ^ ~x45;
 * 	Preload_1 = *merge1;
 * 	Preload_1 = Preload_1 ^ x46;
 * 	*out1 = Preload_1;
 * 	x47 = x33 & ~x9;
 * 	x48 = x47 ^ x39;
 *  ... 
 * 	x55 = a1 | x54;
 * 	x56 = x48 ^ ~x55;
 * 	Preload_3 = *merge3;
 * 	Preload_3 = Preload_3 ^ x56;
 * 	*out3 = Preload_3;
 * }

INLINE void s1 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s2 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s3 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s4 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s5 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s6 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s7 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );
INLINE void s8 ( KWAN_LOOP_SLICE a1, KWAN_LOOP_SLICE a2,
		 KWAN_LOOP_SLICE a3, KWAN_LOOP_SLICE a4,
		 KWAN_LOOP_SLICE a5, KWAN_LOOP_SLICE a6,
		 KWAN_LOOP_SLICE *merge1, KWAN_LOOP_SLICE *merge2,
		 KWAN_LOOP_SLICE *merge3, KWAN_LOOP_SLICE *merge4,
		 KWAN_LOOP_SLICE *out1, KWAN_LOOP_SLICE *out2,
		 KWAN_LOOP_SLICE *out3, KWAN_LOOP_SLICE *out4 );

/* to improve correctness of this effort, I want to use the Kwan SBOXes
 * with as few modifications as possible.
 * I removed ~(blah) by passing the ~ around.
 * I also added the memory references that move data from merge to out.
 *
 * To increase efficiency, they have to do more work than originally.
 *
 * These cover functions do the extra work that Kwan needs, and then call
 * the original Kwan routine.
 *
 * The Kwan routine should be included inline, to remove calling overhead.
 * These cover functions should be included inline into do_simple.
 *
 * Whenever possible, pointer dependencies allowing, the head of each
 * routine should be stuffed up into the previous function.
 *
 */

INLINE void
s1 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50, x51, x52, x53, x54, x55, x56;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a3 & ~a5;
	x2 = x1 ^ a4;
	x3 = a3 & ~a4;
	x4 = x3 | a5;
	x5 = a6 & x4;
	x6 = x2 ^ x5;
	x7 = a4 & ~a5;
	x8 = a3 ^ a4;
	x9 = a6 & ~x8;
	x10 = x7 ^ x9;
	x11 = a2 | x10;
	x12 = x6 ^ x11;
	x13 = a5 ^ x5;
	x14 = x13 & x8;
	x15 = a5 & ~a4;
	x16 = x3 ^ x14;
	x17 = a6 | x16;
	x18 = x15 ^ x17;
	x19 = a2 | x18;
	x20 = x14 ^ x19;
	x21 = a1 & x20;
	x22 = x12 ^ ~x21;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x22;
	*out2 = Preload_2;
	x23 = x1 | x5;
	x24 = x23 ^ x8;
	x25 = x18 & ~x2;
	x26 = a2 & ~x25;
	x27 = x24 ^ x26;
	x28 = x6 | x7;
	x29 = x28 ^ x25;
	x30 = x9 ^ x24;
	x31 = x18 & ~x30;
	x32 = a2 & x31;
	x33 = x29 ^ x32;
	x34 = a1 & x33;
	x35 = x27 ^ x34;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x35;
	*out4 = Preload_4;
	x36 = a3 & x28;
	x37 = x18 & ~x36;
	x38 = a2 | x3;
	x39 = x37 ^ x38;
	x40 = a3 | x31;
	x41 = x24 & ~x37;
	x42 = x41 | x3;
	x43 = x42 & ~a2;
	x44 = x40 ^ x43;
	x45 = a1 & ~x44;
	x46 = x39 ^ ~x45;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x46;
	*out1 = Preload_1;
	x47 = x33 & ~x9;
	x48 = x47 ^ x39;
	x49 = x4 ^ x36;
	x50 = x49 & ~x5;
	x51 = x42 | x18;
	x52 = x51 ^ a5;
	x53 = a2 & ~x52;
	x54 = x50 ^ x53;
	x55 = a1 | x54;
	x56 = x48 ^ ~x55;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x56;
	*out3 = Preload_3;
}

INLINE void
s2 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a1 ^ a6;
	x2 = x1 ^ a5;
	x3 = a6 & a5;
	x4 = a1 & ~x3;
	x5 = a2 & ~x4;
	x6 = x2 ^ x5;
	x7 = x3 | x5;
	x8 = x7 & ~x1;
	x9 = a3 | x8;
	x10 = x6 ^ x9;
	x11 = a5 & ~x4;
	x12 = x11 | a2;
	x13 = a4 & x12;
	x14 = x10 ^ ~x13;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x14;
	*out1 = Preload_1;
	x15 = x4 ^ x14;
	x16 = x15 & ~a2;
	x17 = x2 ^ x16;
	x18 = a6 & ~x4;
	x19 = x6 ^ x11;
	x20 = a2 & x19;
	x21 = x18 ^ x20;
	x22 = a3 & x21;
	x23 = x17 ^ x22;
	x24 = a5 ^ a2;
	x25 = x24 & ~x8;
	x26 = x6 | a1;
	x27 = x26 ^ a2;
	x28 = a3 & ~x27;
	x29 = x25 ^ x28;
	x30 = a4 | x29;
	x31 = x23 ^ x30;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x31;
	*out3 = Preload_3;
	x32 = x18 | x25;
	x33 = x32 ^ x10;
	x34 = x27 | x20;
	x35 = a3 & x34;
	x36 = x33 ^ x35;
	x37 = x24 & x34;
	x38 = x12 & ~x37;
	x39 = a4 | x38;
	x40 = x36 ^ ~x39;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x40;
	*out4 = Preload_4;
	x41 = a2 ^ x2;
	x42 = x41 & ~x33;
	x43 = x42 ^ x29;
	x44 = a3 & ~x43;
	x45 = x41 ^ x44;
	x46 = x3 | x20;
	x47 = a3 & x3;
	x48 = x46 ^ x47;
	x49 = a4 & ~x48;
	x50 = x45 ^ ~x49;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x50;
	*out2 = Preload_2;
}

INLINE void
s3 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50, x51, x52, x53;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a2 ^ a3;
	x2 = x1 ^ a6;
	x3 = a2 & x2;
	x4 = a5 | x3;
	x5 = x2 ^ x4;
	x6 = a3 ^ x3;
	x7 = x6 & ~a5;
	x8 = a1 | x7;
	x9 = x5 ^ x8;
	x10 = a6 & ~x3;
	x11 = x10 ^ a5;
	x12 = a1 & x11;
	x13 = a5 ^ x12;
	x14 = a4 | x13;
	x15 = x9 ^ x14;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x15;
	*out4 = Preload_4;
	x16 = a3 & a6;
	x17 = x16 | x3;
	x18 = x17 ^ a5;
	x19 = x2 & ~x7;
	x20 = x19 ^ x16;
	x21 = a1 | x20;
	x22 = x18 ^ x21;
	x23 = a2 | x7;
	x24 = x23 ^ x4;
	x25 = x11 | x19;
	x26 = x25 ^ x17;
	x27 = a1 | x26;
	x28 = x24 ^ x27;
	x29 = a4 & ~x28;
	x30 = x22 ^ ~x29;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x30;
	*out3 = Preload_3;
	x31 = a3 & a5;
	x32 = x31 ^ x2;
	x33 = x7 & ~a3;
	x34 = a1 | x33;
	x35 = x32 ^ x34;
	x36 = x10 | x26;
	x37 = a6 ^ x17;
	x38 = x37 & ~x5;
	x39 = a1 & x38;
	x40 = x36 ^ x39;
	x41 = a4 & x40;
	x42 = x35 ^ x41;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x42;
	*out2 = Preload_2;
	x43 = a2 | x19;
	x44 = x43 ^ x18;
	x45 = a6 & x15;
	x46 = x45 ^ x6;
	x47 = x46 & ~a1;
	x48 = x44 ^ x47;
	x49 = x42 & ~x23;
	x50 = a1 | x49;
	x51 = x47 ^ x50;
	x52 = a4 & x51;
	x53 = x48 ^ ~x52;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x53;
	*out1 = Preload_1;
}

INLINE void
s4 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a1 | a3;
	x2 = a5 & x1;
	x3 = a1 ^ x2;
	x4 = a2 | a3;
	x5 = x3 ^ x4;
	x6 = a3 & ~a1;
	x7 = x6 | x3;
	x8 = a2 & x7;
	x9 = a5 ^ x8;
	x10 = a4 & x9;
	x11 = x5 ^ x10;
	x12 = a3 ^ x2;
	x13 = a2 & ~x12;
	x14 = x7 ^ x13;
	x15 = x12 | x3;
	x16 = a3 ^ a5;
	x17 = x16 & ~a2;
	x18 = x15 ^ x17;
	x19 = a4 | x18;
	x20 = x14 ^ x19;
	x21 = a6 | x20;
	x22 = x11 ^ x21;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x22;
	*out1 = Preload_1;
	x23 = a6 & x20;
	x24 = x23 ^ ~x11;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x24;
	*out2 = Preload_2;
	x25 = a2 & x9;
	x26 = x25 ^ x15;
	x27 = a3 ^ x8;
	x28 = x27 ^ x17;
	x29 = a4 & ~x28;
	x30 = x26 ^ x29;
	x31 = x11 ^ x30;
	x32 = a2 & ~x31;
	x33 = x22 ^ x32;
	x34 = x31 & ~a4;
	x35 = x33 ^ x34;
	x36 = a6 | x35;
	x37 = x30 ^ ~x36;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x37;
	*out3 = Preload_3;
	x38 = x23 ^ x35;
	x39 = x38 ^ x37;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x39;
	*out4 = Preload_4;
}

INLINE void
s5 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50, x51, x52, x53, x54, x55, x56;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a3 & ~a4;
	x2 = x1 ^ a1;
	x3 = a1 & ~a3;
	x4 = a6 | x3;
	x5 = x2 ^ x4;
	x6 = a4 ^ a1;
	x7 = x6 | x1;
	x8 = x7 & ~a6;
	x9 = a3 ^ x8;
	x10 = a5 | x9;
	x11 = x5 ^ x10;
	x12 = a3 & x7;
	x13 = x12 ^ a4;
	x14 = x13 & ~x3;
	x15 = a4 ^ x3;
	x16 = a6 | x15;
	x17 = x14 ^ x16;
	x18 = a5 | x17;
	x19 = x13 ^ x18;
	x20 = x19 & ~a2;
	x21 = x11 ^ x20;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x21;
	*out4 = Preload_4;
	x22 = a4 & x4;
	x23 = x22 ^ x17;
	x24 = a1 ^ x9;
	x25 = x2 & x24;
	x26 = a5 & ~x25;
	x27 = x23 ^ x26;
	x28 = a4 | x24;
	x29 = x28 & ~a2;
	x30 = x27 ^ x29;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x30;
	*out2 = Preload_2;
	x31 = x17 & x5;
	x32 = x7 & ~x31;
	x33 = x8 & ~a4;
	x34 = x33 ^ a3;
	x35 = a5 & x34;
	x36 = x32 ^ x35;
	x37 = x13 | x16;
	x38 = x9 ^ x31;
	x39 = a5 | x38;
	x40 = x37 ^ x39;
	x41 = a2 | x40;
	x42 = x36 ^ ~x41;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x42;
	*out3 = Preload_3;
	x43 = x19 & ~x32;
	x44 = x43 ^ x24;
	x45 = x27 | x43;
	x46 = x45 ^ x6;
	x47 = a5 & ~x46;
	x48 = x44 ^ x47;
	x49 = x6 & x38;
	x50 = x49 ^ x34;
	x51 = x21 ^ x38;
	x52 = x28 & ~x51;
	x53 = a5 & x52;
	x54 = x50 ^ x53;
	x55 = a2 | x54;
	x56 = x48 ^ x55;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x56;
	*out1 = Preload_1;
}

INLINE void
s6 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50, x51, x52, x53;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a5 ^ a1;
	x2 = x1 ^ a6;
	x3 = a1 & a6;
	x4 = x3 & ~a5;
	x5 = a4 & ~x4;
	x6 = x2 ^ x5;
	x7 = a6 ^ x3;
	x8 = x4 | x7;
	x9 = x8 & ~a4;
	x10 = x7 ^ x9;
	x11 = a2 & x10;
	x12 = x6 ^ x11;
	x13 = a6 | x6;
	x14 = x13 & ~a5;
	x15 = x4 | x10;
	x16 = a2 & ~x15;
	x17 = x14 ^ x16;
	x18 = x17 & ~a3;
	x19 = x12 ^ ~x18;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x19;
	*out1 = Preload_1;
	x20 = x19 & ~x1;
	x21 = x20 ^ x15;
	x22 = a6 & ~x21;
	x23 = x22 ^ x6;
	x24 = a2 & ~x23;
	x25 = x21 ^ x24;
	x26 = a5 | a6;
	x27 = x26 & ~x1;
	x28 = a2 & ~x24;
	x29 = x27 ^ x28;
	x30 = a3 & ~x29;
	x31 = x25 ^ ~x30;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x31;
	*out4 = Preload_4;
	x32 = x3 ^ x6;
	x33 = x32 & ~x10;
	x34 = a6 ^ x25;
	x35 = a5 & ~x34;
	x36 = a2 & ~x35;
	x37 = x33 ^ x36;
	x38 = x21 & ~a5;
	x39 = a3 | x38;
	x40 = x37 ^ ~x39;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x40;
	*out3 = Preload_3;
	x41 = x35 | x2;
	x42 = a5 & x7;
	x43 = a4 & ~x42;
	x44 = a2 | x43;
	x45 = x41 ^ x44;
	x46 = x23 | x35;
	x47 = x46 ^ x5;
	x48 = x26 & x33;
	x49 = x48 ^ x2;
	x50 = a2 & x49;
	x51 = x47 ^ x50;
	x52 = a3 & ~x51;
	x53 = x45 ^ ~x52;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x53;
	*out2 = Preload_2;
}

INLINE void
s7 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50, x51;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a2 & a4;
	x2 = x1 ^ a5;
	x3 = a4 & x2;
	x4 = x3 ^ a2;
	x5 = a3 & ~x4;
	x6 = x2 ^ x5;
	x7 = a3 ^ x5;
	x8 = a6 & ~x7;
	x9 = x6 ^ x8;
	x10 = a2 | a4;
	x11 = x10 | a5;
	x12 = a5 & ~a2;
	x13 = a3 | x12;
	x14 = x11 ^ x13;
	x15 = x3 ^ x6;
	x16 = a6 | x15;
	x17 = x14 ^ x16;
	x18 = a1 & x17;
	x19 = x9 ^ x18;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x19;
	*out1 = Preload_1;
	x20 = a4 & ~a3;
	x21 = a2 & ~x20;
	x22 = a6 & x21;
	x23 = x9 ^ x22;
	x24 = a4 ^ x4;
	x25 = a3 | x3;
	x26 = x24 ^ x25;
	x27 = a3 ^ x3;
	x28 = x27 & a2;
	x29 = a6 & ~x28;
	x30 = x26 ^ x29;
	x31 = a1 | x30;
	x32 = x23 ^ ~x31;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x32;
	*out2 = Preload_2;
	x33 = x7 ^ x30;
	x34 = a2 | x24;
	x35 = x34 ^ x19;
	x36 = x35 & ~a6;
	x37 = x33 ^ x36;
	x38 = x26 & ~a3;
	x39 = x38 | x30;
	x40 = x39 & ~a1;
	x41 = x37 ^ x40;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x41;
	*out3 = Preload_3;
	x42 = a5 | x20;
	x43 = x42 ^ x33;
	x44 = a2 ^ x15;
	x45 = x24 & ~x44;
	x46 = a6 & x45;
	x47 = x43 ^ x46;
	x48 = a3 & x22;
	x49 = x48 ^ x46;
	x50 = a1 | x49;
	x51 = x47 ^ x50;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x51;
	*out4 = Preload_4;
}

INLINE void
s8 (
	KWAN_LOOP_SLICE	a1,
	KWAN_LOOP_SLICE	a2,
	KWAN_LOOP_SLICE	a3,
	KWAN_LOOP_SLICE	a4,
	KWAN_LOOP_SLICE	a5,
	KWAN_LOOP_SLICE	a6,
	KWAN_LOOP_SLICE	*merge1,
	KWAN_LOOP_SLICE	*merge2,
	KWAN_LOOP_SLICE	*merge3,
	KWAN_LOOP_SLICE	*merge4,
	KWAN_LOOP_SLICE	*out1,
	KWAN_LOOP_SLICE	*out2,
	KWAN_LOOP_SLICE	*out3,
	KWAN_LOOP_SLICE	*out4
) {
	KWAN_LOOP_SLICE	x1, x2, x3, x4, x5, x6, x7, x8;
	KWAN_LOOP_SLICE	x9, x10, x11, x12, x13, x14, x15, x16;
	KWAN_LOOP_SLICE	x17, x18, x19, x20, x21, x22, x23, x24;
	KWAN_LOOP_SLICE	x25, x26, x27, x28, x29, x30, x31, x32;
	KWAN_LOOP_SLICE	x33, x34, x35, x36, x37, x38, x39, x40;
	KWAN_LOOP_SLICE	x41, x42, x43, x44, x45, x46, x47, x48;
	KWAN_LOOP_SLICE	x49, x50;
	KWAN_LOOP_SLICE	Preload_1, Preload_2, Preload_3, Preload_4;

	x1 = a3 ^ a1;
	x2 = a1 & ~a3;
	x3 = x2 ^ a4;
	x4 = a5 | x3;
	x5 = x1 ^ x4;
	x6 = x5 & ~a1;
	x7 = x6 ^ a3;
	x8 = x7 & ~a5;
	x9 = a4 ^ x8;
	x10 = a2 & ~x9;
	x11 = x5 ^ x10;
	x12 = x6 | a4;
	x13 = x12 ^ x1;
	x14 = x13 ^ a5;
	x15 = x3 & ~x14;
	x16 = x15 ^ x7;
	x17 = a2 & ~x16;
	x18 = x14 ^ x17;
	x19 = a6 | x18;
	x20 = x11 ^ ~x19;
	Preload_1 = *merge1;
	Preload_1 = Preload_1 ^ x20;
	*out1 = Preload_1;
	x21 = x5 | a5;
	x22 = x21 ^ x3;
	x23 = x11 & ~a4;
	x24 = a2 & ~x23;
	x25 = x22 ^ x24;
	x26 = a1 & x21;
	x27 = a5 & x2;
	x28 = x27 ^ x23;
	x29 = a2 & x28;
	x30 = x26 ^ x29;
	x31 = x30 & ~a6;
	x32 = x25 ^ x31;
	Preload_3 = *merge3;
	Preload_3 = Preload_3 ^ x32;
	*out3 = Preload_3;
	x33 = a3 & ~x16;
	x34 = x9 | x33;
	x35 = a2 | x6;
	x36 = x34 ^ x35;
	x37 = x2 & ~x14;
	x38 = x22 | x32;
	x39 = a2 & ~x38;
	x40 = x37 ^ x39;
	x41 = a6 | x40;
	x42 = x36 ^ ~x41;
	Preload_2 = *merge2;
	Preload_2 = Preload_2 ^ x42;
	*out2 = Preload_2;
	x43 = x1 & ~a5;
	x44 = x43 | a4;
	x45 = a3 ^ a5;
	x46 = x45 ^ x37;
	x47 = x46 & ~a2;
	x48 = x44 ^ x47;
	x49 = a6 & x48;
	x50 = x11 ^ ~x49;
	Preload_4 = *merge4;
	Preload_4 = Preload_4 ^ x50;
	*out4 = Preload_4;
}
/* end of kwan_from_to.c */
