 //
 // $Log: bdeslow.S,v $
 // Revision 1.9  1998/09/28 14:18:40  remi
 // Little patch to allow compilation with cygwin32 tools.
 //
 // Revision 1.8  1998/07/08 23:41:57  remi
 // Added support for CliIdentifyModules().
 //
 // Revision 1.7  1998/06/15 23:46:47  daa
 // add a .align 4 after the _Id: to ensure the rest of .data is long aligned
 //
 // Revision 1.6  1998/06/14 11:31:55  remi
 // Hmm, it's "$Id: bdeslow.S,v 1.9 1998/09/28 14:18:40 remi Exp $", not "$Id".
 // And removed the extra $Log entries... It seems we had a 'commit' war
 // this morning ! :-)
 //
 // Revision 1.5  1998/06/14 11:24:24  remi
 // Added "@(#)$Id".
 //
 // Revision 1.4  1998/06/14 10:40:48  friedbait
 // 'Log' keywords added
 //
 // Revision 1.3  1998/06/14 10:34:09  remi
 // #ifdef'ed bsdi changes. Is it ok, skand ?
 //
 //
 // BDESLOW.ASM
 // BDESLOW.S  - automatically converted to AT&T format
 //
 // Modified for automatic converting to AT&T assembler format.
 //
 // Large core version.
 // Marked Core 2d for large core library supplement d.
 //
 // Supplement to BrydDES Key Search Library version 1.01.
 // Date: February 4, 1998.
 // Copyright Svend Olaf Mikkelsen, 1995, 1997, 1998.
 //
 // Please read README.TXT.
 //
 // Written for Microsoft Macro Assembler, version 6.00B.
 // Modified, so it also seems to assemble correct with TASM 5.0.
 // MASM @@ labels are changed to the form _01:
 // TASM Parity? seems buggy, so Parity? not used.


//        .386 
 
//        .model flat 
 
//extern _bryd_continue:near 
//extern _bryd_key_found:near 
 
 .globl _bryd_des
 .globl _desencrypt
 .globl _desdecrypt
 .globl _desinit
 .globl _key_byte_to_hex
 .globl _c_key_byte_to_hex
 
         .data  
      
_id:	        .ascii "@(#)$Id: bdeslow.S,v 1.9 1998/09/28 14:18:40 remi Exp $"
		.byte 0
		.align 4

 //  BDESDAT.INC
 
 sboxdata:            .long 0x04041000,0x00000000,0x00040000,0x04041010
                      .long 0x04040010,0x00041010,0x00000010,0x00040000
                      .long 0x00001000,0x04041000,0x04041010,0x00001000
                      .long 0x04001010,0x04040010,0x04000000,0x00000010
                      .long 0x00001010,0x04001000,0x04001000,0x00041000
                      .long 0x00041000,0x04040000,0x04040000,0x04001010
                      .long 0x00040010,0x04000010,0x04000010,0x00040010
                      .long 0x00000000,0x00001010,0x00041010,0x04000000
                      .long 0x00040000,0x04041010,0x00000010,0x04040000
                      .long 0x04041000,0x04000000,0x04000000,0x00001000
                      .long 0x04040010,0x00040000,0x00041000,0x04000010
                      .long 0x00001000,0x00000010,0x04001010,0x00041010
                      .long 0x04041010,0x00040010,0x04040000,0x04001010
                      .long 0x04000010,0x00001010,0x00041010,0x04041000
                      .long 0x00001010,0x04001000,0x04001000,0x00000000
                      .long 0x00040010,0x00041000,0x00000000,0x04040010
                      .long 0x00420082,0x00020002,0x00020000,0x00420080
                      .long 0x00400000,0x00000080,0x00400082,0x00020082
                      .long 0x00000082,0x00420082,0x00420002,0x00000002
                      .long 0x00020002,0x00400000,0x00000080,0x00400082
                      .long 0x00420000,0x00400080,0x00020082,0x00000000
                      .long 0x00000002,0x00020000,0x00420080,0x00400002
                      .long 0x00400080,0x00000082,0x00000000,0x00420000
                      .long 0x00020080,0x00420002,0x00400002,0x00020080
                      .long 0x00000000,0x00420080,0x00400082,0x00400000
                      .long 0x00020082,0x00400002,0x00420002,0x00020000
                      .long 0x00400002,0x00020002,0x00000080,0x00420082
                      .long 0x00420080,0x00000080,0x00020000,0x00000002
                      .long 0x00020080,0x00420002,0x00400000,0x00000082
                      .long 0x00400080,0x00020082,0x00000082,0x00400080
                      .long 0x00420000,0x00000000,0x00020002,0x00020080
                      .long 0x00000002,0x00400082,0x00420082,0x00420000
                      .long 0x00000820,0x20080800,0x00000000,0x20080020
                      .long 0x20000800,0x00000000,0x00080820,0x20000800
                      .long 0x00080020,0x20000020,0x20000020,0x00080000
                      .long 0x20080820,0x00080020,0x20080000,0x00000820
                      .long 0x20000000,0x00000020,0x20080800,0x00000800
                      .long 0x00080800,0x20080000,0x20080020,0x00080820
                      .long 0x20000820,0x00080800,0x00080000,0x20000820
                      .long 0x00000020,0x20080820,0x00000800,0x20000000
                      .long 0x20080800,0x20000000,0x00080020,0x00000820
                      .long 0x00080000,0x20080800,0x20000800,0x00000000
                      .long 0x00000800,0x00080020,0x20080820,0x20000800
                      .long 0x20000020,0x00000800,0x00000000,0x20080020
                      .long 0x20000820,0x00080000,0x20000000,0x20080820
                      .long 0x00000020,0x00080820,0x00080800,0x20000020
                      .long 0x20080000,0x20000820,0x00000820,0x20080000
                      .long 0x00080820,0x00000020,0x20080020,0x00080800
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x02008200,0x02000204,0x02000004,0x00008004
                      .long 0x00000000,0x02008000,0x02008000,0x02008204
                      .long 0x00000204,0x00000000,0x02000200,0x02000004
                      .long 0x00000004,0x00008000,0x02000000,0x02008004
                      .long 0x00000200,0x02000000,0x00008004,0x00008200
                      .long 0x02000204,0x00000004,0x00008200,0x02000200
                      .long 0x00008000,0x02008200,0x02008204,0x00000204
                      .long 0x02000200,0x02000004,0x02008000,0x02008204
                      .long 0x00000204,0x00000000,0x00000000,0x02008000
                      .long 0x00008200,0x02000200,0x02000204,0x00000004
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x02008204,0x00000204,0x00000004,0x00008000
                      .long 0x02000004,0x00008004,0x02008200,0x02000204
                      .long 0x00008004,0x00008200,0x02000000,0x02008004
                      .long 0x00000200,0x02000000,0x00008000,0x02008200
                      .long 0x00000400,0x08200400,0x08200000,0x08000401
                      .long 0x00200000,0x00000400,0x00000001,0x08200000
                      .long 0x00200401,0x00200000,0x08000400,0x00200401
                      .long 0x08000401,0x08200001,0x00200400,0x00000001
                      .long 0x08000000,0x00200001,0x00200001,0x00000000
                      .long 0x00000401,0x08200401,0x08200401,0x08000400
                      .long 0x08200001,0x00000401,0x00000000,0x08000001
                      .long 0x08200400,0x08000000,0x08000001,0x00200400
                      .long 0x00200000,0x08000401,0x00000400,0x08000000
                      .long 0x00000001,0x08200000,0x08000401,0x00200401
                      .long 0x08000400,0x00000001,0x08200001,0x08200400
                      .long 0x00200401,0x00000400,0x08000000,0x08200001
                      .long 0x08200401,0x00200400,0x08000001,0x08200401
                      .long 0x08200000,0x00000000,0x00200001,0x08000001
                      .long 0x00200400,0x08000400,0x00000401,0x00200000
                      .long 0x00000000,0x00200001,0x08200400,0x00000401
                      .long 0x80000040,0x81000000,0x00010000,0x81010040
                      .long 0x81000000,0x00000040,0x81010040,0x01000000
                      .long 0x80010000,0x01010040,0x01000000,0x80000040
                      .long 0x01000040,0x80010000,0x80000000,0x00010040
                      .long 0x00000000,0x01000040,0x80010040,0x00010000
                      .long 0x01010000,0x80010040,0x00000040,0x81000040
                      .long 0x81000040,0x00000000,0x01010040,0x81010000
                      .long 0x00010040,0x01010000,0x81010000,0x80000000
                      .long 0x80010000,0x00000040,0x81000040,0x01010000
                      .long 0x81010040,0x01000000,0x00010040,0x80000040
                      .long 0x01000000,0x80010000,0x80000000,0x00010040
                      .long 0x80000040,0x81010040,0x01010000,0x81000000
                      .long 0x01010040,0x81010000,0x00000000,0x81000040
                      .long 0x00000040,0x00010000,0x81000000,0x01010040
                      .long 0x00010000,0x01000040,0x80010040,0x00000000
                      .long 0x81010000,0x80000000,0x01000040,0x80010040
                      .long 0x00800000,0x10800008,0x10002008,0x00000000
                      .long 0x00002000,0x10002008,0x00802008,0x10802000
                      .long 0x10802008,0x00800000,0x00000000,0x10000008
                      .long 0x00000008,0x10000000,0x10800008,0x00002008
                      .long 0x10002000,0x00802008,0x00800008,0x10002000
                      .long 0x10000008,0x10800000,0x10802000,0x00800008
                      .long 0x10800000,0x00002000,0x00002008,0x10802008
                      .long 0x00802000,0x00000008,0x10000000,0x00802000
                      .long 0x10000000,0x00802000,0x00800000,0x10002008
                      .long 0x10002008,0x10800008,0x10800008,0x00000008
                      .long 0x00800008,0x10000000,0x10002000,0x00800000
                      .long 0x10802000,0x00002008,0x00802008,0x10802000
                      .long 0x00002008,0x10000008,0x10802008,0x10800000
                      .long 0x00802000,0x00000000,0x00000008,0x10802008
                      .long 0x00000000,0x00802008,0x10800000,0x00002000
                      .long 0x10000008,0x10002000,0x00002000,0x00800008
                      .long 0x40004100,0x00004000,0x00100000,0x40104100
                      .long 0x40000000,0x40004100,0x00000100,0x40000000
                      .long 0x00100100,0x40100000,0x40104100,0x00104000
                      .long 0x40104000,0x00104100,0x00004000,0x00000100
                      .long 0x40100000,0x40000100,0x40004000,0x00004100
                      .long 0x00104000,0x00100100,0x40100100,0x40104000
                      .long 0x00004100,0x00000000,0x00000000,0x40100100
                      .long 0x40000100,0x40004000,0x00104100,0x00100000
                      .long 0x00104100,0x00100000,0x40104000,0x00004000
                      .long 0x00000100,0x40100100,0x00004000,0x00104100
                      .long 0x40004000,0x00000100,0x40000100,0x40100000
                      .long 0x40100100,0x40000000,0x00100000,0x40004100
                      .long 0x00000000,0x40104100,0x00100100,0x40000100
                      .long 0x40100000,0x40004000,0x40004100,0x00000000
                      .long 0x40104100,0x00104000,0x00104000,0x00004100
                      .long 0x00004100,0x00100100,0x40000000,0x40104000
                      .long 0x00001010,0x00041010,0x00040010,0x04001010
                      .long 0x00001010,0x00041010,0x00040010,0x04001010
                      .long 0x04000010,0x00001010,0x00041010,0x00001010
                      .long 0x04000010,0x00001010,0x00041010,0x00001010
                      .long 0x00040010,0x00041000,0x00041000,0x04040010
                      .long 0x00040010,0x00041000,0x00041000,0x04040010
                      .long 0x00040010,0x04001000,0x04041000,0x04040010
                      .long 0x00040010,0x04001000,0x04041000,0x04040010
                      .long 0x04001000,0x00041010,0x04000010,0x04041000
                      .long 0x04001000,0x00041010,0x04000010,0x04041000
                      .long 0x04041010,0x00040010,0x04040010,0x04041000
                      .long 0x04041010,0x00040010,0x04040010,0x04041000
                      .long 0x00041000,0x00041000,0x04001010,0x00040010
                      .long 0x00041000,0x00041000,0x04001010,0x00040010
                      .long 0x00041000,0x04040000,0x04001000,0x04040010
                      .long 0x00041000,0x04040000,0x04001000,0x04040010
                      .long 0x00200400,0x08200000,0x08200001,0x00200401
                      .long 0x00200400,0x08200000,0x08200001,0x00200401
                      .long 0x08200000,0x08000001,0x08200000,0x00200400
                      .long 0x08200000,0x08000001,0x08200000,0x00200400
                      .long 0x08000401,0x08000400,0x08000400,0x08000400
                      .long 0x08000401,0x08000400,0x08000400,0x08000400
                      .long 0x00000401,0x08000401,0x08000001,0x08200401
                      .long 0x00000401,0x08000401,0x08000001,0x08200401
                      .long 0x00200001,0x00200401,0x08000001,0x08200401
                      .long 0x00200001,0x00200401,0x08000001,0x08200401
                      .long 0x08200001,0x00000401,0x00200001,0x00000401
                      .long 0x08200001,0x00000401,0x00200001,0x00000401
                      .long 0x00000401,0x00200400,0x08200000,0x00200400
                      .long 0x00000401,0x00200400,0x08200000,0x00200400
                      .long 0x00200400,0x08200401,0x08200001,0x00200401
                      .long 0x00200400,0x08200401,0x08200001,0x00200401
                      .long 0x20080020,0x20080020,0x20080020,0x20080020
                      .long 0x20000800,0x20000800,0x20080020,0x20080020
                      .long 0x20080000,0x20080000,0x20080020,0x20080020
                      .long 0x20000800,0x20000800,0x20080820,0x20080820
                      .long 0x20000020,0x20000020,0x20080000,0x20080000
                      .long 0x20000800,0x20000800,0x20000800,0x20000800
                      .long 0x20080020,0x20080020,0x20080820,0x20080820
                      .long 0x20080800,0x20080800,0x20000800,0x20000800
                      .long 0x00080800,0x00080800,0x00080800,0x00080800
                      .long 0x20000800,0x20000800,0x20000800,0x20000800
                      .long 0x00080820,0x00080820,0x00080020,0x00080020
                      .long 0x20000820,0x20000820,0x20080020,0x20080020
                      .long 0x20080820,0x20080820,0x00080820,0x00080820
                      .long 0x00080800,0x00080800,0x20080820,0x20080820
                      .long 0x00080820,0x00080820,0x20080820,0x20080820
                      .long 0x00080800,0x00080800,0x20000820,0x20000820
                      .long 0x02008200,0x02000204,0x02000004,0x00008004
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x00000204,0x00000000,0x02000200,0x02000004
                      .long 0x00000000,0x02008000,0x02008000,0x02008204
                      .long 0x00000200,0x02000000,0x00008004,0x00008200
                      .long 0x00000004,0x00008000,0x02000000,0x02008004
                      .long 0x00008000,0x02008200,0x02008204,0x00000204
                      .long 0x02000204,0x00000004,0x00008200,0x02000200
                      .long 0x00000204,0x00000000,0x00000000,0x02008000
                      .long 0x02000200,0x02000004,0x02008000,0x02008204
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x00008200,0x02000200,0x02000204,0x00000004
                      .long 0x02000004,0x00008004,0x02008200,0x02000204
                      .long 0x02008204,0x00000204,0x00000004,0x00008000
                      .long 0x00000200,0x02000000,0x00008000,0x02008200
                      .long 0x00008004,0x00008200,0x02000000,0x02008004
                      .long 0x02000200,0x02000004,0x02008000,0x02008204
                      .long 0x00000204,0x00000000,0x00000000,0x02008000
                      .long 0x00008200,0x02000200,0x02000204,0x00000004
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x02008204,0x00000204,0x00000004,0x00008000
                      .long 0x02000004,0x00008004,0x02008200,0x02000204
                      .long 0x00008004,0x00008200,0x02000000,0x02008004
                      .long 0x00000200,0x02000000,0x00008000,0x02008200
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x02008200,0x02000204,0x02000004,0x00008004
                      .long 0x00000000,0x02008000,0x02008000,0x02008204
                      .long 0x00000204,0x00000000,0x02000200,0x02000004
                      .long 0x00000004,0x00008000,0x02000000,0x02008004
                      .long 0x00000200,0x02000000,0x00008004,0x00008200
                      .long 0x02000204,0x00000004,0x00008200,0x02000200
                      .long 0x00008000,0x02008200,0x02008204,0x00000204
                      .long 0x00040000,0x04041010,0x00000010,0x04040000
                      .long 0x04041000,0x04000000,0x04000000,0x00001000
                      .long 0x04040010,0x00040000,0x00041000,0x04000010
                      .long 0x00001000,0x00000010,0x04001010,0x00041010
                      .long 0x04041010,0x00040010,0x04040000,0x04001010
                      .long 0x04000010,0x00001010,0x00041010,0x04041000
                      .long 0x00001010,0x04001000,0x04001000,0x00000000
                      .long 0x00040010,0x00041000,0x00000000,0x04040010
                      .long 0x04041000,0x00000000,0x00040000,0x04041010
                      .long 0x04040010,0x00041010,0x00000010,0x00040000
                      .long 0x00001000,0x04041000,0x04041010,0x00001000
                      .long 0x04001010,0x04040010,0x04000000,0x00000010
                      .long 0x00001010,0x04001000,0x04001000,0x00041000
                      .long 0x00041000,0x04040000,0x04040000,0x04001010
                      .long 0x00040010,0x04000010,0x04000010,0x00040010
                      .long 0x00000000,0x00001010,0x00041010,0x04000000
                      .long 0x00080020,0x20000020,0x20000020,0x00080000
                      .long 0x20080820,0x00080020,0x20080000,0x00000820
                      .long 0x00000820,0x20080800,0x00000000,0x20080020
                      .long 0x20000800,0x00000000,0x00080820,0x20000800
                      .long 0x20000820,0x00080800,0x00080000,0x20000820
                      .long 0x00000020,0x20080820,0x00000800,0x20000000
                      .long 0x20000000,0x00000020,0x20080800,0x00000800
                      .long 0x00080800,0x20080000,0x20080020,0x00080820
                      .long 0x00000800,0x00080020,0x20080820,0x20000800
                      .long 0x20000020,0x00000800,0x00000000,0x20080020
                      .long 0x20080800,0x20000000,0x00080020,0x00000820
                      .long 0x00080000,0x20080800,0x20000800,0x00000000
                      .long 0x20080000,0x20000820,0x00000820,0x20080000
                      .long 0x00080820,0x00000020,0x20080020,0x00080800
                      .long 0x20000820,0x00080000,0x20000000,0x20080820
                      .long 0x00000020,0x00080820,0x00080800,0x20000020
                      .long 0x00001000,0x04041000,0x04041010,0x00001000
                      .long 0x04001010,0x04040010,0x04000000,0x00000010
                      .long 0x04041000,0x00000000,0x00040000,0x04041010
                      .long 0x04040010,0x00041010,0x00000010,0x00040000
                      .long 0x00040010,0x04000010,0x04000010,0x00040010
                      .long 0x00000000,0x00001010,0x00041010,0x04000000
                      .long 0x00001010,0x04001000,0x04001000,0x00041000
                      .long 0x00041000,0x04040000,0x04040000,0x04001010
                      .long 0x04040010,0x00040000,0x00041000,0x04000010
                      .long 0x00001000,0x00000010,0x04001010,0x00041010
                      .long 0x00040000,0x04041010,0x00000010,0x04040000
                      .long 0x04041000,0x04000000,0x04000000,0x00001000
                      .long 0x00001010,0x04001000,0x04001000,0x00000000
                      .long 0x00040010,0x00041000,0x00000000,0x04040010
                      .long 0x04041010,0x00040010,0x04040000,0x04001010
                      .long 0x04000010,0x00001010,0x00041010,0x04041000
                      .long 0x00000004,0x00008000,0x02000000,0x02008004
                      .long 0x00000200,0x02000000,0x00008004,0x00008200
                      .long 0x02000204,0x00000004,0x00008200,0x02000200
                      .long 0x00008000,0x02008200,0x02008204,0x00000204
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x02008200,0x02000204,0x02000004,0x00008004
                      .long 0x00000000,0x02008000,0x02008000,0x02008204
                      .long 0x00000204,0x00000000,0x02000200,0x02000004
                      .long 0x02008204,0x00000204,0x00000004,0x00008000
                      .long 0x02000004,0x00008004,0x02008200,0x02000204
                      .long 0x00008004,0x00008200,0x02000000,0x02008004
                      .long 0x00000200,0x02000000,0x00008000,0x02008200
                      .long 0x02000200,0x02000004,0x02008000,0x02008204
                      .long 0x00000204,0x00000000,0x00000000,0x02008000
                      .long 0x00008200,0x02000200,0x02000204,0x00000004
                      .long 0x02008004,0x00008204,0x00008204,0x00000200
                      .long 0x00000000,0x04041000,0x04041010,0x00040000
                      .long 0x00041010,0x04040010,0x00040000,0x00000010
                      .long 0x04041000,0x00001000,0x00001000,0x04041010
                      .long 0x04040010,0x04001010,0x00000010,0x04000000
                      .long 0x04001000,0x00001010,0x00041000,0x04001000
                      .long 0x04040000,0x00041000,0x04001010,0x04040000
                      .long 0x04000010,0x00040010,0x00040010,0x04000010
                      .long 0x00001010,0x00000000,0x04000000,0x00041010
                      .long 0x04041010,0x00040000,0x04040000,0x00000010
                      .long 0x04000000,0x04041000,0x00001000,0x04000000
                      .long 0x00040000,0x04040010,0x04000010,0x00041000
                      .long 0x00000010,0x00001000,0x00041010,0x04001010
                      .long 0x00040010,0x04041010,0x04001010,0x04040000
                      .long 0x00001010,0x04000010,0x04041000,0x00041010
                      .long 0x04001000,0x00001010,0x00000000,0x04001000
                      .long 0x00041000,0x00040010,0x04040010,0x00000000
 
 // Data for changing bits in key setup:
 
 changebit1:          .byte 14
                      .byte 1,10,3,4,6,8,7,14,9,2
                      .byte 12,9,14,32,17,5,20,6,22,30
                      .byte 23,3,25,13,28,31,32,10
 
 changebit2:          .byte 15
                      .byte 1,3,4,29,6,7,7,6,10,10
                      .byte 11,4,14,8,15,14,18,1,19,11
                      .byte 24,5,25,5,28,6,30,30,31,9
 
 changebit3:          .byte 12
                      .byte 2,5,5,12,9,9,12,29,14,7
                      .byte 15,6,19,10,22,2,23,1,26,1
                      .byte 27,11,32,32
 
 changebit4:          .byte 14
                      .byte 2,18,6,14,7,27,9,22,11,25
                      .byte 14,21,15,26,18,13,20,23,22,16
                      .byte 25,21,28,15,29,29,32,24
 
 changebit5:          .byte 14
                      .byte 1,19,3,27,5,22,7,25,10,21
                      .byte 11,26,13,18,18,16,21,21,24,15
                      .byte 25,29,28,18,30,26,32,14
 
 changebit6:          .byte 14
                      .byte 3,26,5,18,9,28,12,25,13,30
                      .byte 15,17,17,29,20,18,22,26,23,19
                      .byte 26,22,28,17,29,20,32,21
 
 changebit7:          .byte 13
                      .byte 4,25,5,30,7,17,10,24,14,14
                      .byte 15,27,18,22,20,17,21,20,26,13
                      .byte 28,23,30,16,31,28
 
 changebit9:          .byte 14
                      .byte 1,4,4,2,5,1,8,1,9,11
                      .byte 14,5,15,5,17,12,21,9,24,29
                      .byte 26,7,27,6,30,10,31,10
 
 changebit10:         .byte 13
                      .byte 2,29,3,13,6,31,9,10,12,2
                      .byte 13,1,16,1,17,2,20,9,22,32
                      .byte 25,12,29,9,31,3
 
 changebit11:         .byte 14
                      .byte 3,5,6,6,8,30,9,3,11,13
                      .byte 14,31,18,10,19,4,22,8,23,14
                      .byte 25,2,28,9,30,32,32,5
 
 changebit12:         .byte 13
                      .byte 4,26,5,19,8,22,10,17,11,20
                      .byte 16,13,17,18,21,28,24,25,25,30
                      .byte 27,17,30,24,32,18
 
 changebit13:         .byte 14
                      .byte 1,27,4,22,6,17,7,20,12,13
                      .byte 14,23,16,16,17,28,20,25,21,30
                      .byte 23,17,26,24,30,14,31,19
 
 changebit14:         .byte 13
                      .byte 1,26,4,13,6,23,8,16,11,21
                      .byte 14,15,15,29,18,24,22,14,23,27
                      .byte 25,22,27,25,30,21
 
 changebit15:         .byte 14
                      .byte 2,25,3,21,6,15,7,29,10,18
                      .byte 12,26,13,19,16,22,17,22,19,25
                      .byte 22,21,23,26,25,18,29,28
 
 changebit17:         .byte 14
                      .byte 2,2,4,8,5,14,7,2,10,9
                      .byte 12,32,15,12,18,6,20,30,21,3
                      .byte 23,13,26,31,29,10,31,4
 
 changebit18:         .byte 15
                      .byte 1,13,4,7,5,6,8,10,9,4
                      .byte 12,8,13,14,15,2,17,11,22,5
                      .byte 23,5,26,6,28,30,29,3,32,29
 
 changebit19:         .byte 13
                      .byte 1,5,3,12,7,9,10,29,12,7
                      .byte 13,6,16,10,17,10,20,2,21,1
                      .byte 24,1,25,11,30,5
 
 changebit20:         .byte 14
                      .byte 2,26,4,14,5,27,7,22,9,25
                      .byte 12,21,13,26,15,18,18,23,20,16
                      .byte 23,21,26,15,27,29,30,18
 
 changebit21:         .byte 14
                      .byte 2,22,3,22,5,25,8,21,9,26
                      .byte 11,18,15,28,19,21,22,15,23,29
                      .byte 26,18,28,26,29,19,31,27
 
 changebit22:         .byte 14
                      .byte 2,13,3,18,7,28,10,25,11,30
                      .byte 13,17,16,24,18,18,20,26,21,19
                      .byte 24,22,26,17,27,20,31,26
 
 changebit23:         .byte 13
                      .byte 1,21,3,30,5,17,8,24,12,14
                      .byte 13,27,15,22,18,17,19,20,24,13
                      .byte 26,23,28,16,32,25
 
 changebit25:         .byte 14
                      .byte 2,8,3,1,6,1,7,11,12,5
                      .byte 13,5,16,6,19,9,22,29,24,7
                      .byte 25,6,28,10,29,4,32,2
 
 changebit26:         .byte 13
                      .byte 2,7,4,31,7,10,10,2,11,1
                      .byte 14,1,15,11,18,9,20,32,23,12
                      .byte 27,9,30,29,31,13
 
 changebit27:         .byte 14
                      .byte 1,12,4,6,6,30,7,3,9,13
                      .byte 12,31,15,10,17,4,20,8,21,14
                      .byte 23,2,26,9,28,32,31,5
 
 changebit28:         .byte 13
                      .byte 2,14,3,19,6,22,8,17,9,20
                      .byte 14,13,16,23,19,28,22,25,23,30
                      .byte 25,17,28,24,32,26
 
 changebit29:         .byte 13
                      .byte 1,22,4,17,5,20,10,13,12,23
                      .byte 14,16,18,25,19,30,21,17,24,24
                      .byte 28,14,29,27,32,22
 
 changebit30:         .byte 14
                      .byte 1,18,4,23,6,16,9,21,12,15
                      .byte 13,29,16,18,20,14,21,27,23,22
                      .byte 25,25,28,21,29,26,32,13
 
 changebit31:         .byte 15
                      .byte 1,30,4,15,5,29,8,18,10,26
                      .byte 11,19,14,22,16,17,17,25,20,21
                      .byte 21,26,23,18,27,28,30,25,31,21
 
 changebit33:         .byte 13
                      .byte 1,1,3,14,5,2,8,9,10,32
                      .byte 13,12,18,30,19,3,21,13,24,31
                      .byte 27,10,30,2,32,8
 
 changebit34:         .byte 15
                      .byte 2,31,3,6,6,10,7,4,10,8
                      .byte 11,14,13,2,16,9,20,5,21,5
                      .byte 24,6,26,30,27,3,29,13,32,7
 
 changebit35:         .byte 14
                      .byte 2,6,5,9,8,29,10,7,11,6
                      .byte 14,10,15,4,18,2,19,1,22,1
                      .byte 23,11,28,5,29,5,31,12
 
 changebit36:         .byte 13
                      .byte 1,11,4,9,6,32,9,12,13,9
                      .byte 16,29,17,13,20,31,23,10,26,2
                      .byte 27,1,30,1,31,2
 
 changebit37:         .byte 15
                      .byte 2,17,3,25,6,21,7,26,9,18
                      .byte 13,28,16,25,17,21,20,15,21,29
                      .byte 24,18,26,26,27,19,30,22,31,22
 
 changebit38:         .byte 13
                      .byte 2,23,5,28,8,25,9,30,11,17
                      .byte 14,24,18,26,19,19,22,22,24,17
                      .byte 25,20,30,13,31,18
 
 changebit39:         .byte 13
                      .byte 2,15,3,17,6,24,10,14,11,27
                      .byte 13,22,15,25,17,20,22,13,24,23
                      .byte 26,16,29,21,31,30
 
 changebit41:         .byte 15
                      .byte 1,14,4,1,5,11,10,5,11,5
                      .byte 14,6,16,30,17,9,20,29,22,7
                      .byte 23,6,26,10,27,4,30,8,31,1
 
 changebit42:         .byte 12
                      .byte 1,6,5,10,8,2,9,1,12,1
                      .byte 13,11,18,32,21,12,25,9,28,29
                      .byte 30,7,32,31
 
 changebit43:         .byte 13
                      .byte 4,30,5,3,7,13,10,31,13,10
                      .byte 16,2,18,8,19,14,21,2,24,9
                      .byte 26,32,29,12,32,6
 
 changebit44:         .byte 15
                      .byte 2,9,6,5,7,5,10,6,12,30
                      .byte 13,3,15,13,18,7,19,6,22,10
                      .byte 23,4,26,8,27,14,29,2,31,11
 
 changebit45:         .byte 13
                      .byte 1,25,3,20,8,13,10,23,12,16
                      .byte 15,21,17,30,19,17,22,24,26,14
                      .byte 27,27,29,22,32,17
 
 changebit46:         .byte 14
                      .byte 4,16,7,21,10,15,11,29,14,18
                      .byte 16,26,18,14,19,27,21,22,23,25
                      .byte 26,21,27,26,29,18,32,23
 
 changebit47:         .byte 15
                      .byte 1,17,3,29,6,18,8,26,9,19
                      .byte 12,22,14,17,15,20,18,21,19,26
                      .byte 21,18,25,28,28,25,29,30,32,15
 
 changebit49:         .byte 13
                      .byte 2,1,3,2,6,9,8,32,11,12
                      .byte 15,9,17,3,19,13,22,31,25,10
                      .byte 28,2,29,1,31,14
 
 changebit50:         .byte 15
                      .byte 4,10,5,4,8,8,9,14,11,2
                      .byte 14,9,16,32,18,5,19,5,22,6
                      .byte 24,30,25,3,27,13,30,31,31,6
 
 changebit51:         .byte 14
                      .byte 2,30,3,9,6,29,8,7,9,6
                      .byte 12,10,13,4,16,8,17,1,20,1
                      .byte 21,11,26,5,27,5,30,6
 
 changebit52:         .byte 12
                      .byte 4,32,7,12,11,9,14,29,16,7
                      .byte 18,31,21,10,24,2,25,1,28,1
                      .byte 29,11,32,9
 
 changebit53:         .byte 15
                      .byte 1,20,4,21,5,26,7,18,11,28
                      .byte 14,25,15,30,18,15,19,29,22,18
                      .byte 24,26,25,19,28,22,30,17,31,25
 
 changebit54:         .byte 13
                      .byte 2,16,3,28,6,25,7,30,9,17
                      .byte 12,24,16,14,17,19,20,22,22,17
                      .byte 23,20,28,13,30,23
 
 changebit55:         .byte 13
                      .byte 1,29,4,24,8,14,9,27,11,22
                      .byte 13,25,16,21,20,13,22,23,24,16
                      .byte 27,21,30,15,31,17
 
 changebit57:         .byte 15
                      .byte 1,2,3,11,8,5,9,5,12,6
                      .byte 14,30,15,3,18,29,20,7,21,6
                      .byte 24,10,25,4,28,8,29,14,32,1
 
 changebit58:         .byte 12
                      .byte 2,10,3,10,6,2,7,1,10,1
                      .byte 11,11,16,5,19,12,23,9,26,29
                      .byte 28,7,29,6
 
 changebit59:         .byte 13
                      .byte 1,9,3,3,5,13,8,31,11,10
                      .byte 14,2,15,1,17,14,19,2,22,9
                      .byte 24,32,27,12,32,30
 
 changebit60:         .byte 15
                      .byte 2,32,4,5,5,5,8,6,10,30
                      .byte 11,3,13,13,16,31,17,6,20,10
                      .byte 21,4,24,8,25,14,27,2,30,9
 
 changebit61:         .byte 13
                      .byte 2,21,6,13,8,23,10,16,13,21
                      .byte 16,15,17,17,20,24,24,14,25,27
                      .byte 27,22,29,25,31,20
 
 changebit62:         .byte 14
                      .byte 1,28,5,21,8,15,9,29,12,18
                      .byte 14,26,15,19,17,27,19,22,21,25
                      .byte 24,21,25,26,27,18,32,16
 
 changebit63:         .byte 14
                      .byte 2,24,4,18,6,26,7,19,10,22
                      .byte 12,17,13,20,17,26,19,18,23,28
                      .byte 26,25,27,30,29,17,31,29
 
 changetable:         .long 0x80000000
                      .long 0x40000000
                      .long 0x20000000
                      .long 0x10000000
                      .long 0x08000000
                      .long 0x04000000
                      .long 0x02000000
                      .long 0x01000000
                      .long 0x00800000
                      .long 0x00400000
                      .long 0x00200000
                      .long 0x00100000
                      .long 0x00080000
                      .long 0x00040000
                      .long 0x00020000
                      .long 0x00010000
                      .long 0x00008000
                      .long 0x00004000
                      .long 0x00002000
                      .long 0x00001000
                      .long 0x00000800
                      .long 0x00000400
                      .long 0x00000200
                      .long 0x00000100
                      .long 0x00000080
                      .long 0x00000040
                      .long 0x00000020
                      .long 0x00000010
                      .long 0x00000008
                      .long 0x00000004
                      .long 0x00000002
                      .long 0x00000001
 
 keyfromsetupdata:    .long 1,6,0x01000000
                      .long 2,6,0x02000000
                      .long 3,9,0x00800000
                      .long 4,7,0x00000020
                      .long 5,5,0x00000400
                      .long 6,9,0x00000010
                      .long 7,7,0x00008000
                      .long 9,5,0x80000000
                      .long 10,6,0x00000002
                      .long 11,8,0x00000004
                      .long 12,8,0x00000400
                      .long 13,6,0x00008000
                      .long 14,6,0x00000200
                      .long 15,6,0x00020000
                      .long 17,5,0x00040000
                      .long 18,5,0x04000000
                      .long 19,7,0x00800000
                      .long 20,5,0x00000020
                      .long 21,5,0x00000080
                      .long 22,7,0x00000010
                      .long 23,5,0x00008000
                      .long 25,6,0x80000000
                      .long 26,7,0x00400000
                      .long 27,6,0x00000004
                      .long 28,6,0x00000400
                      .long 29,5,0x00001000
                      .long 30,6,0x00010000
                      .long 31,5,0x00000008
                      .long 33,5,0x40000000
                      .long 34,6,0x00400000
                      .long 35,8,0x00000008
                      .long 36,6,0x00000001
                      .long 37,6,0x00000800
                      .long 38,8,0x00000080
                      .long 39,6,0x00000100
                      .long 41,5,0x00200000
                      .long 42,8,0x40000000
                      .long 43,7,0x00080000
                      .long 44,7,0x08000000
                      .long 45,8,0x00080000
                      .long 46,10,0x00020000
                      .long 47,6,0x00004000
                      .long 49,6,0x00800000
                      .long 50,8,0x01000000
                      .long 51,6,0x00000008
                      .long 52,11,0x00800000
                      .long 53,5,0x00000040
                      .long 54,6,0x00000080
                      .long 55,8,0x00040000
                      .long 57,8,0x08000000
                      .long 58,6,0x40000000
                      .long 59,5,0x00080000
                      .long 60,5,0x08000000
                      .long 61,8,0x00000200
                      .long 62,8,0x00020000
                      .long 63,6,0x00000040
           
 .ascii  "BrydDES Key Search Library version 1.01.          "
 .ascii  "Core 2d                         "
 .ascii  "Copyright Svend Olaf Mikkelsen, 1995, 1997, 1998. "
 
 changeoffsets:       .long changebit1
                      .long changebit2
                      .long changebit3
                      .long changebit4
                      .long changebit5
                      .long changebit6
                      .long changebit7
                      .long 0
                      .long changebit9
                      .long changebit10
                      .long changebit11
                      .long changebit12
                      .long changebit13
                      .long changebit14
                      .long changebit15
                      .long 0
                      .long changebit17
                      .long changebit18
                      .long changebit19
                      .long changebit20
                      .long changebit21
                      .long changebit22
                      .long changebit23
                      .long 0
                      .long changebit25
                      .long changebit26
                      .long changebit27
                      .long changebit28
                      .long changebit29
                      .long changebit30
                      .long changebit31
                      .long 0
                      .long changebit33
                      .long changebit34
                      .long changebit35
                      .long changebit36
                      .long changebit37
                      .long changebit38
                      .long changebit39
                      .long 0
                      .long changebit41
                      .long changebit42
                      .long changebit43
                      .long changebit44
                      .long changebit45
                      .long changebit46
                      .long changebit47
                      .long 0
                      .long changebit49
                      .long changebit50
                      .long changebit51
                      .long changebit52
                      .long changebit53
                      .long changebit54
                      .long changebit55
                      .long 0
                      .long changebit57
                      .long changebit58
                      .long changebit59
                      .long changebit60
                      .long changebit61
                      .long changebit62
                      .long changebit63

#if defined(__bsdi__) || defined(__CYGWIN32__)
	.data
#else
	.bss
#endif
 .align 4
 
         .lcomm datastart,4
 
         .lcomm keysetup,1*128
         .lcomm plainaddr,4
         .lcomm plainpermu,1*8
         .lcomm plainpermucomp,1*8
         .lcomm cipheraddr,4
         .lcomm ivaddr,4
         .lcomm foundkeyaddr,4
         .lcomm maskaddr,4
 
         .lcomm sbox1,4*64
         .lcomm sbox2,4*64
         .lcomm sbox3,4*64
         .lcomm sbox4,4*64
         .lcomm sbox5,4*64
         .lcomm sbox6,4*64
         .lcomm sbox7,4*64
         .lcomm sbox8,4*64
 
         .lcomm tbox1,4*64
         .lcomm tbox5,4*64
         .lcomm tbox3,4*64
 
 // Used, since this version tests key bit 52 changed
 // without changing key setup.
         .lcomm round4box4,4*64
         .lcomm round6box4,4*64
         .lcomm round7box1,4*64
         .lcomm round8box3,4*64
         .lcomm round9box1,4*64
         .lcomm round11box4,4*64
         .lcomm round12box1,4*64
 
         .lcomm keyaddr,4
         .lcomm tempkey,1*8
         .lcomm foundkey,1*8
         .lcomm reserved1,4// saveesi not used
         .lcomm reserved2,4// saveesicomp not used
 
         .lcomm reserved3,4// not used
         .lcomm reserved4,4// not used
         .lcomm reserved5,4// not used
 
         .lcomm ediafter2comp,4
         .lcomm reserved6,4// not used
         .lcomm L1,4
 
 //theese 10 lines must be in this order
         .lcomm cipherpermu,1*8
         .lcomm cipherpermucheck,4 // prepared, but not used
         .lcomm round15box2check,4
         .lcomm round15box5check,4
         .lcomm reserved7,4// do not remove this line
         .lcomm cipherpermucomp,1*8
         .lcomm cipherpermucheckcomp,4 // prepared, but not used
         .lcomm round15box2checkcomp,4
         .lcomm round15box5checkcomp,4
         .lcomm reserved8,4
 
         .lcomm reserved9,4// not used
         .lcomm saveregister,4
 
         .lcomm undo2box1,4
         .lcomm undo2box1comp,4
         .lcomm redo2box3,4
         .lcomm redo2box1,4
         .lcomm ediafter2,4
         .lcomm redo2box5,4
         .lcomm redo2box5comp,4
         .lcomm saveeax,4
         .lcomm redo2box1comp,4
         .lcomm redo2box3comp,4
 
         .lcomm reserved10,4// not used
         .lcomm reserved11,4// not used
 
         .lcomm redo16box2,4
         .lcomm redo16box2comp,4
         .lcomm redo16box7,4
         .lcomm redo16box7comp,4
         .lcomm saveedx,4
 
 //theese 10 lines must be in this order
         .lcomm round13box3check00,4
         .lcomm round13box3check01,4
         .lcomm round13box3check10,4
         .lcomm round13box3check11,4
         .lcomm checkoffset,4
         .lcomm reserved12,4// do not remove this line
         .lcomm round13box3check00comp,4 // offset 24 from round13box3check00
         .lcomm round13box3check01comp,4
         .lcomm round13box3check10comp,4
         .lcomm round13box3check11comp,4
 
         .lcomm reserved13,4// not used
         .lcomm cipherpermucompbox3bits,4
         .lcomm cipherpermubox3bits,4
 
         .lcomm round2box1ptr,4
         .lcomm round2box1ptrcomp,4
         .lcomm saveesiround16,4
         .lcomm saveesiround16comp,4
 
         .lcomm esiafter1,4
         .lcomm esiafter1comp,4
 
         .lcomm redo1box1,4
         .lcomm redo1box3,4
         .lcomm redo1box5,4
         .lcomm redo1box1comp,4
         .lcomm redo1box3comp,4
         .lcomm redo1box5comp,4
         .lcomm saveesp,4
 
         .lcomm compcontrol_unused,4 // Not used, compcontrol moved.
         .lcomm is14b,4 // Tells if key bit 46 (14) and 50 (18) are
         .lcomm is18b,4 // set in key setup for the last rounds.
         .lcomm keyisfound,4
 
         .lcomm firstcall,4
 
         .lcomm table_of_changedata,4*28 //   numbered from 1
 
         .lcomm keysetupoffset,4
         .lcomm bit61_62_63_change,4
 
         .lcomm compcontrol,4
         .lcomm add_zero,4
 
 // New, January 1998:
         .lcomm change52control,4 // not used
         .lcomm is52b,4
 
         .lcomm dataend,4
 
         .text  
         nop  
         nop  
         nop  
         nop  
         nop  
 
 _bryd_des:               // procedure
 
 //bryd_des_frame equ 24
 
 // ptr plain    ptr ciphertext    ptr i_vector    ptr key   ptr  mask
 // 0    [in]    4        [out]    8       [in]    12 [in]   16   [in]
 
 // calls bryd_continue and eventually key_found_low
 
 // returns   eax 0  key found, interrupted or not
 //           eax 1  not interrupted
 //           eax 2  interrupted
 //           eax 3  mask error
 
         pushl %esi
         pushl %edi
         pushl %ebp
         pushl %ebx
         pushl %ecx
 
         //make uninitialized data the same at each call
         //to prevent errors
         movl $datastart,%edi
         movl $dataend,%ecx
         subl %edi,%ecx
         shrl $2,%ecx
         movl $0xCE6755BE,%eax // random number
 
         //rep stosd
 _01a:   stosl  
         loop _01a  
 
         // count the mask bits set to zero
         //mov eax,[esp][bryd_des_frame+16]  ; mask address
         movl 40(%esp),%eax // mask address
         movl (%eax),%edx
         movl 4(%eax),%eax
         //bswapmacro
         pushl %eax
         movl %eax,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %eax
         addl $4,%esp
         //bswapmacro
         pushl %eax
         movl %edx,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %edx
         addl $4,%esp
         movl $0x00247450,%ebx
         testl %eax,%ebx
         jz _if01   //.if !zero?
             movl $3,%eax
             jmp bryd_end  
         _if01: //.endif
         testl $0x0000000e,%eax
         jnz _if02   //  .if zero?
             movl $1,bit61_62_63_change
             jmp _if02a  
         _if02: // .else
             movl $0,bit61_62_63_change
         _if02a:    //.endif
         xorl %ebx,%eax // bit 43 46 50 51 52 54 58 60 set to zero
         orl $0x01010101,%eax
         orl $0x01010101,%edx
         movl $0,%ebx // count of bits to change
         movl $64,%ecx
 _01:    testl $0x80000000,%edx
         jnz _if03   //  .if zero?
             addl $1,%ebx
         _if03:    //.endif
         call shiftleft_edx_eax  
         loop _01  
         cmpl $27,%ebx //.if ebx > 27
         jna _if04  
             movl $3,%eax
             jmp bryd_end  
         _if04:     //.endif
         movl $28,%esi
         subl %ebx,%esi
         movl %esi,firstcall
 
         //set up table with the bit numbers to be changed
         //mov eax,[esp][bryd_des_frame+16]  ; mask address
         movl 40(%esp),%eax // mask address
         movl (%eax),%edx
         movl 4(%eax),%eax
         //bswapmacro
         pushl %eax
         movl %eax,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %eax
         addl $4,%esp
         //bswapmacro
         pushl %eax
         movl %edx,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %edx
         addl $4,%esp
         xorl $0x00247450,%eax
         orl $0x01010101,%eax // parity bits
         orl $0x01010101,%edx
         movl $64,%ecx
         movl $1,%ebx
 _02:    testl $0x80000000,%edx
         jnz _if05   //    .if zero?
                 //mov ebp,changeoffsets [ebx*4-4]
                 movl -4+changeoffsets(,%ebx,4),%ebp
                 //mov table_of_changedata [esi*4+0],ebp
                 movl %ebp,0+table_of_changedata(,%esi,4)
                 incl %esi
         _if05:    //    .endif
         call shiftleft_edx_eax  
         incl %ebx
         loop _02  
 
         movl $0,is14b
         movl $0,is18b
         movl $0,is52b
         movl $0,compcontrol
         movl $0,keyisfound
 
         movl $0,change52control
 
         movl %esp,saveesp
 
         //mov esi,[esp][bryd_des_frame+0]
         movl 24(%esp),%esi
         movl %esi,plainaddr
 
         //mov esi,[esp][bryd_des_frame+4]
         movl 28(%esp),%esi
         movl %esi,cipheraddr
 
         //mov esi,[esp][bryd_des_frame+8]
         movl 32(%esp),%esi
         movl %esi,ivaddr
 
         //mov esi,[esp][bryd_des_frame+12]
         movl 36(%esp),%esi
         movl %esi,keyaddr
 
         //mov esi,[esp][bryd_des_frame+16]
         movl 40(%esp),%esi
         movl %esi,maskaddr
 
         // setup initial key and set up S-boxes.
         movl keyaddr,%ebp
 
         movl (%ebp),%eax
         movl maskaddr,%ebx
         andl (%ebx),%eax
         movl %eax,(%ebp)
 
         movl 4(%ebp),%eax
         andl 4(%ebx),%eax
         movl %eax,4(%ebp)
 
         pushl %ebp
         call _desinit  
         addl $4,%esp
 
         movl cipheraddr,%ebx
         movl (%ebx),%esi
         //mov edi,dword ptr [ebx][4]
         movl 4(%ebx),%edi
 
         // The initial and final permutation code is inspired by
         // Eric Young, who again was inspired by others.
         // See the Libdes library.
 
         // initial permutation
         roll $4,%edi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0xF0F0F0F0,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $12,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x000FFFF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $14,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x33333333,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $6,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x0FF00FF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $7,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x55555555,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $1,%edi
         movl %ecx,%esi
 
         movl %esi,cipherpermu
         movl %edi,4+cipherpermu
 
         movl $0x40104100,%eax
         andl %edi,%eax
         movl %eax,cipherpermucheck // not used in this version
         xorl $0x40104100,%eax
         movl %eax,cipherpermucheckcomp // not used in this version
 
         movl $0x00420082,%eax
         andl %edi,%eax
         movl %eax,round15box2check // expected output from round 15, sbox 2
         xorl $0x00420082,%eax
         movl %eax,round15box2checkcomp // ..comp means used for testing
                                      // complement key
 
         xorl $0xFFFFFFFF,%esi
         xorl $0xFFFFFFFF,%edi
         movl %esi,cipherpermucomp
         movl %edi,4+cipherpermucomp
         andl $0x20080820,%edi
         movl %edi,cipherpermucompbox3bits
 
         movl 4+cipherpermu,%edi
         andl $0x20080820,%edi
         movl %edi,cipherpermubox3bits
 
         movl ivaddr,%ebx
         movl (%ebx),%esi
         //mov edi,dword ptr [ebx][4]
         movl 4(%ebx),%edi
 
         movl plainaddr,%ebx
         xorl (%ebx),%esi
         //xor edi,dword ptr [ebx][4]
         xorl 4(%ebx),%edi
 
         // The initial and final permutation code is inspired by
         // Eric Young, who again was inspired by others.
         // See the Libdes library.
 
         // initial permutation
         roll $4,%edi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0xF0F0F0F0,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $12,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x000FFFF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $14,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x33333333,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $6,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x0FF00FF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $7,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x55555555,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $1,%edi
         movl %ecx,%esi
 
         movl %esi,plainpermu
         movl %edi,4+plainpermu
         xorl $0xFFFFFFFF,%esi
         xorl $0xFFFFFFFF,%edi
         movl %esi,plainpermucomp
         movl %edi,4+plainpermucomp
 
         // Start key testing:
         xorl %ebx,%ebx
         xorl %ecx,%ecx
 
         // Rule for ebx and ecx:
         // Whenever other bits than the bl and cl bits are used
         // the registers must be zeroed afterwards.
         // Extra xor ebx,ebx and xor ecx,ecx are however inserted
         // to enhance Pentium Pro speed.
 
             cmpl $1,firstcall
             jnz callbit2  
             call bit1  
             jmp _if06  
 
 callbit2:   cmpl $2,firstcall
             jnz callbit3  
             call bit2  
             jmp _if06  
 
 callbit3:   cmpl $3,firstcall
             jnz callbit4  
             call bit3  
             jmp _if06  
 
 callbit4:   cmpl $4,firstcall
             jnz callbit5  
             call bit4  
             jmp _if06  
 
 callbit5:   cmpl $5,firstcall
             jnz callbit6  
             call bit5  
             jmp _if06  
 
 callbit6:   cmpl $6,firstcall
             jnz callbit7  
             call bit6  
             jmp _if06  
 
 callbit7:   cmpl $7,firstcall
             jnz callbit8  
             call bit7  
             jmp _if06  
 
 callbit8:   cmpl $8,firstcall
             jnz callbit9  
             call bit8  
             jmp _if06  
 
 callbit9:   cmpl $9,firstcall
             jnz callbit10  
             call bit9  
             jmp _if06  
 
 callbit10:  cmpl $10,firstcall
             jnz callbit11  
             call bit10  
             jmp _if06  
 
 callbit11:  cmpl $11,firstcall
             jnz callbit12  
             call bit11  
             jmp _if06  
 
 callbit12:  cmpl $12,firstcall
             jnz callbit13  
             call bit12  
             jmp _if06  
 
 callbit13:  cmpl $13,firstcall
             jnz callbit14  
             call bit13  
             jmp _if06  
 
 callbit14:  cmpl $14,firstcall
             jnz callbit15  
             call bit14  
             jmp _if06  
 
 callbit15:  cmpl $15,firstcall
             jnz callbit16  
             call bit15  
             jmp _if06  
 
 callbit16:  cmpl $16,firstcall
             jnz callbit17  
             call bit16  
             jmp _if06  
 
 callbit17:  cmpl $17,firstcall
             jnz callbit18  
             call bit17  
             jmp _if06  
 
 callbit18:  cmpl $18,firstcall
             jnz callbit19  
             call bit18  
             jmp _if06  
 
 callbit19:  cmpl $19,firstcall
             jnz callbit20  
             call bit19  
             jmp _if06  
 
 callbit20:  cmpl $20,firstcall
             jnz callbit21  
             call bit20  
             jmp _if06  
 
 callbit21:  cmpl $21,firstcall
             jnz callbit22  
             call bit21  
             jmp _if06  
 
 callbit22:  cmpl $22,firstcall
             jnz callbit23  
             call bit22  
             jmp _if06  
 
 callbit23:  cmpl $23,firstcall
             jnz callbit24  
             call bit23  
             jmp _if06  
 
 callbit24:  cmpl $24,firstcall
             jnz callbit25  
             call bit24  
             jmp _if06  
 
 callbit25:  cmpl $25,firstcall
             jnz callbit26  
             call bit25  
             jmp _if06  
 
 callbit26:  cmpl $26,firstcall
             jnz callbit27  
             call bit26  
             jmp _if06  
 
 callbit27:  cmpl $27,firstcall
             jnz callbit28  
             call bit27  
             jmp _if06  
 
 callbit28:  call bitno51  
 
         _if06:
 
         movl $0,%edx
         cmpl $1,keyisfound // .if keyisfound == 1
         jnz _if07  
             movl $0,%eax
             jmp _if07a  
         _if07:     //.else
             movl $1,%eax // eax 1, finished, not interrupted
         _if07a:    //.endif
         jmp bryd_end  
 
 bryd_not_continue:
 
         cmpl $1,keyisfound // .if keyisfound == 1
         jnz _if08  
             movl $0,%eax
             jmp _if08a  
         _if08:     //.else
             movl $2,%eax
         _if08a: //.endif
 
 bryd_end:
         movl $0,%edx
         popl %ecx
         popl %ebx
         popl %ebp
         popl %edi
         popl %esi
 
         ret  
 
 change:          // local procedure
 
         //mov ebp, table_of_changedata[ebp*4]
         movl 0+table_of_changedata(,%ebp,4),%ebp
 
         xorl %eax,%eax
         xorl %edx,%edx
         xorl %ecx,%ecx
         movb (%ebp),%cl
         movb 2(%ebp),%dl
         movb 1(%ebp),%al
         incl %ebp
 
 _13:    movl -4+changetable(,%edx,4),%edi
         movl -4+keysetup(,%eax,4),%esi
         addl $2,%ebp
         xorl %edi,%esi
         movb 1(%ebp),%dl
         movl %esi,-4+keysetup(,%eax,4)
         movb (%ebp),%al
         loop _13  
         xorl %ecx,%ecx
 
         ret  
 
 bit1:   call bit2  
         movl $1,%ebp
         call change  
 
 bit2:   call bit3  
         movl $2,%ebp
         call change  
 
 bit3:   call bit4  
         movl $3,%ebp
         call change  
 
 bit4:   call bit5  
         movl $4,%ebp
         call change  
 
 bit5:   call bit6  
         movl $5,%ebp
         call change  
 
 bit6:   call bit7  
         movl $6,%ebp
         call change  
 
 bit7:   call bit8  
         movl $7,%ebp
         call change  
 
 bit8:   call bit9  
         movl $8,%ebp
         call change  
 
 bit9:   call bit10  
         movl $9,%ebp
         call change  
 
 bit10:  call bit11  
         movl $10,%ebp
         call change  
 
 bit11:  call bit12  
         movl $11,%ebp
         call change  
 
 bit12:  call bit13  
         movl $12,%ebp
         call change  
 
 bit13:  call bit14  
         movl $13,%ebp
         call change  
 
 bit14:  call bit15  
         movl $14,%ebp
         call change  
 
 bit15:  call bit16  
         movl $15,%ebp
         call change  
 
 bit16:  call bit17  
         movl $16,%ebp
         call change  
 
 bit17:  call bit18  
         movl $17,%ebp
         call change  
 
 bit18:  call bit19  
         movl $18,%ebp
         call change  
 
 bit19:  call bit20  
         movl $19,%ebp
         call change  
 
 bit20:  call _bryd_continue  
         cmpl $0,%eax // .if eax == 0
         jnz _if09  
             movl saveesp,%esp
             jmp bryd_not_continue  
         _if09:  //.endif
         xorl %ebx,%ebx
         xorl %ecx,%ecx
 
         call bit21  
         movl $20,%ebp
         call change  
 
 bit21:  call bit22  
         movl $21,%ebp
         call change  
 
 bit22:  call bit23  
         movl $22,%ebp
         call change  
 
 bit23:  call bit24  
         movl $23,%ebp
         call change  
 
 bit24:  call bit25  
         movl $24,%ebp
         call change  
 
 bit25:  cmpl $1,bit61_62_63_change //     .if bit61_62_63_change == 1
         jnz _if10  
             jmp bit25a  
         _if10:    //.endif
         call bit26  
         movl $25,%ebp
         call change  
 
 bit26:  call bit27  
         movl $26,%ebp
         call change  
 
 bit27:  call bitno51  
         movl $27,%ebp
         call change  
         jmp bitno51  
 
 bit25a: call bit26a  
         // change key bit 61
         movl ((2-1)*4)+keysetup,%eax
         movl ((6-1)*4)+keysetup,%edx
         xorl $0x00000800,%eax
         xorl $0x00080000,%edx
         movl %eax,((2-1)*4)+keysetup
         movl %edx,((6-1)*4)+keysetup
         movl ((8-1)*4)+keysetup,%eax
         movl ((10-1)*4)+keysetup,%edx
         xorl $0x00000200,%eax
         xorl $0x00010000,%edx
         movl %eax,((8-1)*4)+keysetup
         movl %edx,((10-1)*4)+keysetup
         movl ((13-1)*4)+keysetup,%eax
         movl ((16-1)*4)+keysetup,%edx
         xorl $0x00000800,%eax
         xorl $0x00020000,%edx
         movl %eax,((13-1)*4)+keysetup
         movl %edx,((16-1)*4)+keysetup
         movl ((17-1)*4)+keysetup,%eax
         movl ((20-1)*4)+keysetup,%edx
         xorl $0x00008000,%eax
         xorl $0x00000100,%edx
         movl %eax,((17-1)*4)+keysetup
         movl %edx,((20-1)*4)+keysetup
         movl ((24-1)*4)+keysetup,%eax
         movl ((25-1)*4)+keysetup,%edx
         xorl $0x00040000,%eax
         xorl $0x00000020,%edx
         movl %eax,((24-1)*4)+keysetup
         movl %edx,((25-1)*4)+keysetup
         movl ((27-1)*4)+keysetup,%eax
         movl ((29-1)*4)+keysetup,%ebp
         xorl $0x00000400,%eax
         movl ((31-1)*4)+keysetup,%edx
         xorl $0x00000080,%ebp
         movl %eax,((27-1)*4)+keysetup
         xorl $0x00001000,%edx
         movl %ebp,((29-1)*4)+keysetup
         movl %edx,((31-1)*4)+keysetup
 
 bit26a: call bit27a  
         // change key bit 62
         movl ((1-1)*4)+keysetup,%eax
         movl ((5-1)*4)+keysetup,%edx
         xorl $0x00000010,%eax
         xorl $0x00000800,%edx
         movl %eax,((1-1)*4)+keysetup
         movl %edx,((5-1)*4)+keysetup
         movl ((8-1)*4)+keysetup,%eax
         movl ((9-1)*4)+keysetup,%edx
         xorl $0x00020000,%eax
         xorl $0x00000008,%edx
         movl %eax,((8-1)*4)+keysetup
         movl %edx,((9-1)*4)+keysetup
         movl ((12-1)*4)+keysetup,%eax
         movl ((14-1)*4)+keysetup,%edx
         xorl $0x00004000,%eax
         xorl $0x00000040,%edx
         movl %eax,((12-1)*4)+keysetup
         movl %edx,((14-1)*4)+keysetup
         movl ((15-1)*4)+keysetup,%eax
         movl ((17-1)*4)+keysetup,%edx
         xorl $0x00002000,%eax
         xorl $0x00000020,%edx
         movl %eax,((15-1)*4)+keysetup
         movl %edx,((17-1)*4)+keysetup
         movl ((19-1)*4)+keysetup,%eax
         movl ((21-1)*4)+keysetup,%edx
         xorl $0x00000400,%eax
         xorl $0x00000080,%edx
         movl %eax,((19-1)*4)+keysetup
         movl %edx,((21-1)*4)+keysetup
         movl ((24-1)*4)+keysetup,%eax
         movl ((25-1)*4)+keysetup,%edx
         xorl $0x00000800,%eax
         xorl $0x00000040,%edx
         movl %eax,((24-1)*4)+keysetup
         movl %edx,((25-1)*4)+keysetup
         movl ((27-1)*4)+keysetup,%eax
         movl ((32-1)*4)+keysetup,%edx
         xorl $0x00004000,%eax
         xorl $0x00010000,%edx
         movl %eax,((27-1)*4)+keysetup
         movl %edx,((32-1)*4)+keysetup
 
 bit27a: call bitno51  
         // change key bit 63
         movl ((2-1)*4)+keysetup,%eax
         movl ((4-1)*4)+keysetup,%edx
         xorl $0x00000100,%eax
         xorl $0x00004000,%edx
         movl %eax,((2-1)*4)+keysetup
         movl %edx,((4-1)*4)+keysetup
         movl ((6-1)*4)+keysetup,%eax
         movl ((7-1)*4)+keysetup,%edx
         xorl $0x00000040,%eax
         xorl $0x00002000,%edx
         movl %eax,((6-1)*4)+keysetup
         movl %edx,((7-1)*4)+keysetup
         movl ((10-1)*4)+keysetup,%eax
         movl ((12-1)*4)+keysetup,%edx
         xorl $0x00000400,%eax
         xorl $0x00008000,%edx
         movl %eax,((10-1)*4)+keysetup
         movl %edx,((12-1)*4)+keysetup
         movl ((13-1)*4)+keysetup,%eax
         movl ((17-1)*4)+keysetup,%edx
         xorl $0x00001000,%eax
         xorl $0x00000040,%edx
         movl %eax,((13-1)*4)+keysetup
         movl %edx,((17-1)*4)+keysetup
         movl ((19-1)*4)+keysetup,%eax
         movl ((23-1)*4)+keysetup,%edx
         xorl $0x00004000,%eax
         xorl $0x00000010,%edx
         movl %eax,((19-1)*4)+keysetup
         movl %edx,((23-1)*4)+keysetup
         movl ((26-1)*4)+keysetup,%eax
         movl ((27-1)*4)+keysetup,%edx
         xorl $0x00000080,%eax
         xorl $0x00000004,%edx
         movl %eax,((26-1)*4)+keysetup
         movl %edx,((27-1)*4)+keysetup
         movl ((29-1)*4)+keysetup,%eax
         movl ((31-1)*4)+keysetup,%edx
         xorl $0x00008000,%eax
         xorl $0x00000008,%edx
         movl %eax,((29-1)*4)+keysetup
         movl %edx,((31-1)*4)+keysetup
 
 // Key bit 51, 60, 54 and 58 are not used in round 16.
 
 bitno51:   // Compute expected output from round 13 sbox 3,
           // which equals to output from round 15 sbox 3 in decryption mode.
           // Part 1.
 
         // uddate key bit 46 round 13 to 16
         movl is14b,%eax
         movl 24+keysetup,%edx
         andl $0x00000800,%edx
         cmpl %edx,%eax //.if eax != edx
         je _if71  
             xorl $0x00000800,%eax
             movl %eax,is14b
             movl ((26-1)*4)+keysetup,%eax
             movl ((27-1)*4)+keysetup,%edx
             xorl $0x00000800,%eax
             xorl $0x00000040,%edx
             movl %eax,((26-1)*4)+keysetup
             movl %edx,((27-1)*4)+keysetup
             movl ((29-1)*4)+keysetup,%eax
             movl ((32-1)*4)+keysetup,%edx
             xorl $0x00004000,%eax
             xorl $0x00000200,%edx
             movl %eax,((29-1)*4)+keysetup
             movl %edx,((32-1)*4)+keysetup
         _if71: //.endif
         // update key bit 50 round 14 to 16
         movl is18b,%eax
         movl 16+keysetup,%edx
         andl $0x10000000,%edx
         cmpl %edx,%eax //.if eax != edx
         je _if72  
             xorl $0x10000000,%eax
             movl %eax,is18b
             movl ((27-1)*4)+keysetup,%eax
             movl ((30-1)*4)+keysetup,%ebp
             xorl $0x00080000,%eax
             movl ((31-1)*4)+keysetup,%edx
             xorl $0x00000002,%ebp
             movl %eax,((27-1)*4)+keysetup
             xorl $0x04000000,%edx
             movl %ebp,((30-1)*4)+keysetup
             movl %edx,((31-1)*4)+keysetup
         _if72:    //.endif
         // round 15 sbox 3 part 1
         movl cipherpermu,%esi
         movl 4+cipherpermu,%edi
         //mov eax,dword ptr keysetup [(16-1)*8]   ; round 16
         movl 120+keysetup,%eax // round 16
         xorl %edi,%eax
         movl 124+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         xorl $0x20,%ecx
         xorl %ebp,%esi
         movb %ah,%bl
         movl sbox7(%ecx),%edi
         andl $0xFF,%eax
         xorl %edi,%ebp
         movl %ebp,redo16box7
         movb %dh,%cl
         movl sbox3(%ecx),%edi
         xorl %edi,%esi
         andl $0xFF,%edx
         movl sbox2(%ebx),%edi
         xorl $0x4,%ebx
         xorl %edi,%esi
         movl sbox4(%eax),%ecx
         xorl %ecx,%esi
         movl sbox2(%ebx),%ebx
         movl sbox5(%edx),%ecx
         xorl %edi,%ebx
         xorl %ecx,%esi
         movl %ebx,redo16box2
         xorl %ebx,%ebx
         xorl %ecx,%ecx
         movl %esi,saveesiround16
 
         // Complement key part:
 
         movl cipherpermucomp,%esi
         movl 4+cipherpermucomp,%edi
 
         //mov eax,dword ptr keysetup [(16-1)*8]
         movl 120+keysetup,%eax
         xorl %edi,%eax
         //mov edx,dword ptr keysetup [(16-1)*8+4]
         movl 124+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         xorl $0x20,%ecx
         xorl %ebp,%esi
         movb %ah,%bl
         andl $0xFF,%eax
         movl sbox7(%ecx),%edi
         xorl %ecx,%ecx
         xorl %edi,%ebp
         movb %dh,%cl
         movl sbox3(%ecx),%edi
         xorl %edi,%esi
         andl $0xFF,%edx
         movl sbox2(%ebx),%edi
         xorl $0x4,%ebx
         xorl %edi,%esi
         movl sbox4(%eax),%ecx
         xorl %ecx,%esi
         movl sbox2(%ebx),%ebx
         movl sbox5(%edx),%ecx
         xorl %edi,%ebx
         xorl %ecx,%esi
         movl %ebx,redo16box2comp
         movl %ebp,redo16box7comp
         movl %esi,saveesiround16comp
         xorl %ebx,%ebx
         xorl %ecx,%ecx
 
         call bitno60  
         // change key bit 51
         movl ((2-1)*4)+keysetup,%eax
         movl ((3-1)*4)+keysetup,%edx
         xorl $0x00000004,%eax
         xorl $0x00800000,%edx
         movl %eax,((2-1)*4)+keysetup
         movl %edx,((3-1)*4)+keysetup
         movl ((6-1)*4)+keysetup,%eax
         movl ((8-1)*4)+keysetup,%edx
         xorl $0x00000008,%eax
         xorl $0x02000000,%edx
         movl %eax,((6-1)*4)+keysetup
         movl %edx,((8-1)*4)+keysetup
         movl ((9-1)*4)+keysetup,%eax
         movl ((12-1)*4)+keysetup,%edx
         xorl $0x04000000,%eax
         xorl $0x00400000,%edx
         movl %eax,((9-1)*4)+keysetup
         movl %edx,((12-1)*4)+keysetup
         movl ((13-1)*4)+keysetup,%eax
         movl ((16-1)*4)+keysetup,%edx
         xorl $0x10000000,%eax
         xorl $0x01000000,%edx
         movl %eax,((13-1)*4)+keysetup
         movl %edx,((16-1)*4)+keysetup
         movl ((17-1)*4)+keysetup,%eax
         movl ((20-1)*4)+keysetup,%edx
         xorl $0x80000000,%eax
         xorl $0x80000000,%edx
         movl %eax,((17-1)*4)+keysetup
         movl %edx,((20-1)*4)+keysetup
         movl ((21-1)*4)+keysetup,%eax
         movl ((26-1)*4)+keysetup,%edx
         xorl $0x00200000,%eax
         xorl $0x08000000,%edx
         movl %eax,((21-1)*4)+keysetup
         movl %edx,((26-1)*4)+keysetup
         movl ((27-1)*4)+keysetup,%eax
         movl ((30-1)*4)+keysetup,%edx
         xorl $0x08000000,%eax
         xorl $0x04000000,%edx
         movl %eax,((27-1)*4)+keysetup
         movl %edx,((30-1)*4)+keysetup
 
 bitno60:   // Compute round 1 for key and complement key, as well as values for
           // changing the output, since bit 60, 54 and 58 are used in round 1.
 
         // round 1 complement key
         movl plainpermucomp,%esi
         movl 4+plainpermucomp,%edi
 
         //mov eax,dword ptr keysetup [(1-1)*8]
         movl 0+keysetup,%eax
         xorl %edi,%eax
         movl 4+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
 
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
 
         xorl $0x10,%ebx
         xorl %ebp,%esi
 
         movl sbox7(%ecx),%edi
         movb %dh,%cl
 
         xorl %edi,%esi
         movl sbox1(%ebx),%edi
 
         xorl %ebp,%edi
         xorl %ebx,%ebx
 
         movl %edi,redo1box1comp
         movb %ah,%bl
 
         andl $0xFF,%eax
         movl sbox2(%ebx),%ebp
 
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
 
         xorl %ebp,%esi
         xorl $0x4,%ecx
 
         andl $0xFF,%edx
         movl sbox4(%eax),%edi
 
         xorl %edi,%esi
         movl sbox3(%ecx),%edi
 
         movl sbox5(%edx),%eax
         xorl $0x10,%edx
 
         xorl %ebp,%edi
         xorl %ecx,%ecx
 
         movl %edi,redo1box3comp
         movl sbox5(%edx),%edx
 
         xorl %eax,%esi
         xorl %eax,%edx
 
         movl %edx,redo1box5comp
 
         movl %esi,esiafter1comp
         // round 1
         movl plainpermu,%esi
         movl 4+plainpermu,%edi
 
         movl ((1-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((1-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
 
         xorl $0x10,%ebx
         xorl %ebp,%esi
 
         movl sbox7(%ecx),%edi
         movb %dh,%cl
 
         xorl %edi,%esi
         movl sbox1(%ebx),%edi
 
         xorl %ebp,%edi
         xorl %ebx,%ebx
 
         movl %edi,redo1box1
         movb %ah,%bl
 
         andl $0xFF,%eax
         movl sbox2(%ebx),%ebp
 
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
 
         xorl %ebp,%esi
         xorl $0x4,%ecx
 
         andl $0xFF,%edx
         movl sbox4(%eax),%edi
 
         xorl %edi,%esi
         movl sbox3(%ecx),%edi
 
         movl sbox5(%edx),%eax
         xorl $0x10,%edx
 
         xorl %ebp,%edi
         xorl %ecx,%ecx
 
         movl %edi,redo1box3
         movl sbox5(%edx),%edx
 
         xorl %eax,%esi
         xorl %eax,%edx
 
         movl %edx,redo1box5
 
         movl %esi,esiafter1
         call bitno54  
         // change key bit 60
         movl ((2-1)*4)+keysetup,%eax
         movl ((4-1)*4)+keysetup,%edx
         xorl $0x00000001,%eax
         xorl $0x08000000,%edx
         movl %eax,((2-1)*4)+keysetup
         movl %edx,((4-1)*4)+keysetup
         movl ((5-1)*4)+keysetup,%eax
         movl ((8-1)*4)+keysetup,%edx
         xorl $0x08000000,%eax
         xorl $0x04000000,%edx
         movl %eax,((5-1)*4)+keysetup
         movl %edx,((8-1)*4)+keysetup
         movl ((10-1)*4)+keysetup,%eax
         movl ((11-1)*4)+keysetup,%edx
         xorl $0x00000004,%eax
         xorl $0x20000000,%edx
         movl %eax,((10-1)*4)+keysetup
         movl %edx,((11-1)*4)+keysetup
         movl ((13-1)*4)+keysetup,%eax
         movl ((16-1)*4)+keysetup,%edx
         xorl $0x00080000,%eax
         xorl $0x00000002,%edx
         movl %eax,((13-1)*4)+keysetup
         movl %edx,((16-1)*4)+keysetup
         movl ((17-1)*4)+keysetup,%eax
         movl ((20-1)*4)+keysetup,%edx
         xorl $0x04000000,%eax
         xorl $0x00400000,%edx
         movl %eax,((17-1)*4)+keysetup
         movl %edx,((20-1)*4)+keysetup
         movl ((21-1)*4)+keysetup,%eax
         movl ((24-1)*4)+keysetup,%edx
         xorl $0x10000000,%eax
         xorl $0x01000000,%edx
         movl %eax,((21-1)*4)+keysetup
         movl %edx,((24-1)*4)+keysetup
         movl ((25-1)*4)+keysetup,%eax
         movl ((27-1)*4)+keysetup,%ebp
         xorl $0x00040000,%eax
         movl ((30-1)*4)+keysetup,%edx
         xorl $0x40000000,%ebp
         movl %eax,((25-1)*4)+keysetup
         xorl $0x00800000,%edx
         movl %ebp,((27-1)*4)+keysetup
         movl %edx,((30-1)*4)+keysetup
 
         // Redo round 1, sbox 1.
         movl esiafter1,%eax
         movl redo1box1,%ebp
         movl esiafter1comp,%edx
         xorl %ebp,%eax
         movl redo1box1comp,%ebp
         movl %eax,esiafter1
         xorl %ebp,%edx
         movl %edx,esiafter1comp
 
 bitno54:   // Compute expected output from round 13 box 3. Part 2.
         // round 15 sbox 3 part 2
         // lines marked ;2 belongs to the not complement key part
 
         movl redo16box2comp,%ebx
         movl redo16box7comp,%ebp
         movl saveesiround16comp,%esi
 
         // then we make four versions of box 3 in round 15
 
         andl $0x0FC00000,%ebx //  redo16box2comp
 
         shrl $20,%ebx
         andl $0x0FC00000,%ebp // redo16box7comp
 
         shrl $20,%ebp
         //mov edx,dword ptr keysetup [(15-1)*8+4]
         movl 116+keysetup,%edx
 
         xorl %esi,%edx
         andl $0x08200401,%esi
 
         andl $0x0FC00000,%edx
         movl %esi,round15box5checkcomp
 
         shrl $20,%edx
         movl redo16box2,%ecx // 2
 
         movl cipherpermucompbox3bits,%edi //  [4]
         andl $0x0FC00000,%ecx // 2
 
         movl sbox3(%edx),%eax
         xorl %ebx,%edx
 
         shrl $20,%ecx
         xorl %edi,%eax
 
         movl sbox3(%edx),%esi
         xorl %ebp,%edx
 
         xorl %edi,%esi
         movl %eax,round13box3check00comp
 
         movl sbox3(%edx),%eax
         xorl %ebx,%edx
 
         movl %esi,round13box3check01comp
         xorl %edi,%eax
 
         movl sbox3(%edx),%ebx
         //mov edx,dword ptr keysetup [(15-1)*8+4]
         movl 116+keysetup,%edx
 
         movl saveesiround16,%esi // 2
         xorl %edi,%ebx
 
         xorl %esi,%edx // 2
         movl %eax,round13box3check11comp
 
         andl $0x0FC00000,%edx //2
         movl %ebx,round13box3check10comp
 
         // not complement key:
 
         shrl $20,%edx
         movl %esi,%eax
 
         andl $0x08200401,%eax
         movl %edx,%ebp
 
         xorl %ecx,%ebp
         movl redo16box7,%edi
 
         movl %eax,round15box5check
         andl $0x0FC00000,%edi
 
         shrl $20,%edi
         movl cipherpermubox3bits,%eax
 
         movl sbox3(%ebp),%ebx //01
         xorl %edi,%ebp
 
         xorl %eax,%ebx
         movl sbox3(%edx),%esi //00
 
         movl %ebx,round13box3check01
         xorl %eax,%esi
 
         movl sbox3(%ebp),%ebx //11
         xorl %ecx,%ebp
 
         xorl %eax,%ebx
         xorl %ecx,%ecx
 
         movl %ebx,round13box3check11
         movl sbox3(%ebp),%edx //10
 
         movl %esi,round13box3check00
         xorl %eax,%edx
 
         movl %edx,round13box3check10
         xorl %ebx,%ebx
 
         call bitno58  
         // change key bit 54
         movl ((2-1)*4)+keysetup,%eax
         movl ((3-1)*4)+keysetup,%edx
         xorl $0x00010000,%eax
         xorl $0x00000010,%edx
         movl %eax,((2-1)*4)+keysetup
         movl %edx,((3-1)*4)+keysetup
         movl ((6-1)*4)+keysetup,%eax
         movl ((7-1)*4)+keysetup,%edx
         xorl $0x00000080,%eax
         xorl $0x00000004,%edx
         movl %eax,((6-1)*4)+keysetup
         movl %edx,((7-1)*4)+keysetup
         movl ((9-1)*4)+keysetup,%eax
         movl ((12-1)*4)+keysetup,%edx
         xorl $0x00008000,%eax
         xorl $0x00000100,%edx
         movl %eax,((9-1)*4)+keysetup
         movl %edx,((12-1)*4)+keysetup
         movl ((16-1)*4)+keysetup,%eax
         movl ((17-1)*4)+keysetup,%edx
         xorl $0x00040000,%eax
         xorl $0x00002000,%edx
         movl %eax,((16-1)*4)+keysetup
         movl %edx,((17-1)*4)+keysetup
         movl ((20-1)*4)+keysetup,%eax
         movl ((22-1)*4)+keysetup,%edx
         xorl $0x00000400,%eax
         xorl $0x00008000,%edx
         movl %eax,((20-1)*4)+keysetup
         movl %edx,((22-1)*4)+keysetup
         movl ((23-1)*4)+keysetup,%eax
         movl ((28-1)*4)+keysetup,%ebp
         xorl $0x00001000,%eax
         movl ((30-1)*4)+keysetup,%edx
         xorl $0x00080000,%ebp
         movl %eax,((23-1)*4)+keysetup
         xorl $0x00000200,%edx
         movl %ebp,((28-1)*4)+keysetup
         movl %edx,((30-1)*4)+keysetup
 
         // Redo round 1, sbox 5.
         movl esiafter1,%eax
         movl redo1box5,%ebp
         movl esiafter1comp,%edx
         xorl %ebp,%eax
         movl redo1box5comp,%ebp
         movl %eax,esiafter1
         xorl %ebp,%edx
         movl %edx,esiafter1comp
 
 bitno58:
         call bitno50  
         // change key bit 58
         movl ((2-1)*4)+keysetup,%eax
         movl ((3-1)*4)+keysetup,%edx
         xorl $0x00400000,%eax
         xorl $0x00400000,%edx
         movl %eax,((2-1)*4)+keysetup
         movl %edx,((3-1)*4)+keysetup
         movl ((6-1)*4)+keysetup,%eax
         movl ((7-1)*4)+keysetup,%edx
         xorl $0x40000000,%eax
         xorl $0x80000000,%edx
         movl %eax,((6-1)*4)+keysetup
         movl %edx,((7-1)*4)+keysetup
         movl ((10-1)*4)+keysetup,%eax
         movl ((11-1)*4)+keysetup,%edx
         xorl $0x80000000,%eax
         xorl $0x00200000,%edx
         movl %eax,((10-1)*4)+keysetup
         movl %edx,((11-1)*4)+keysetup
         movl ((16-1)*4)+keysetup,%eax
         movl ((19-1)*4)+keysetup,%edx
         xorl $0x08000000,%eax
         xorl $0x00100000,%edx
         movl %eax,((16-1)*4)+keysetup
         movl %edx,((19-1)*4)+keysetup
         movl ((23-1)*4)+keysetup,%eax
         movl ((26-1)*4)+keysetup,%edx
         xorl $0x00800000,%eax
         xorl $0x00000008,%edx
         movl %eax,((23-1)*4)+keysetup
         movl %edx,((26-1)*4)+keysetup
         movl ((28-1)*4)+keysetup,%eax
         movl ((29-1)*4)+keysetup,%edx
         xorl $0x02000000,%eax
         xorl $0x04000000,%edx
         movl %eax,((28-1)*4)+keysetup
         movl %edx,((29-1)*4)+keysetup
 
         // Redo round 1, sbox 3.
         movl esiafter1,%eax
         movl redo1box3,%ebp
         movl esiafter1comp,%edx
         xorl %ebp,%eax
         movl redo1box3comp,%ebp
         movl %eax,esiafter1
         xorl %ebp,%edx
         movl %edx,esiafter1comp
 
 // Key bit 50, 46, 43 and 52 are not used in round 1.
 
 bitno50:
         movl $round13box3check00,checkoffset
         // 00 means: bit46 0  bit50 0
         // We have 4 values for expected output of round 13 box 3
         // (8 including complement keys)
         // depending on the state of bit 46 and 50.
 
         // start key testing:
 
         xorl %ebx,%ebx
         xorl %ecx,%ecx
         movl esiafter1comp,%esi
         movl 4+plainpermucomp,%edi
         // compute round 2 and values for changing the output:
 
         //round 2 complement key
         //mov eax,dword ptr keysetup [(2-1)*8]
         movl 8+keysetup,%eax
         xorl %esi,%eax
         movl 12+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
 
         xorl %ebp,%edi
         movl %ebx,round2box1ptrcomp
 
         movl %ebp,undo2box1comp
         movl tbox1(%ebx),%ebp
 
         movl %ebp,redo2box1comp
         movl sbox7(%ecx),%ebp
 
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
 
         movl tbox3(%ecx),%ebp
         movl %ebp,redo2box3comp
 
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl tbox5(%edx),%ebp
         movl %ebp,redo2box5comp
 
         movl %edi,ediafter2comp
         movl esiafter1,%esi
         movl 4+plainpermu,%edi
 
         // round 2
         //mov eax,dword ptr keysetup [(2-1)*8]
         movl 8+keysetup,%eax
         xorl %esi,%eax
         movl 12+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
 
         movl %ebx,round2box1ptr
         movl %ebp,undo2box1
         movl tbox1(%ebx),%ebp
         movl %ebp,redo2box1
 
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
 
         movl tbox3(%ecx),%ebp
         movl %ebp,redo2box3
 
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl tbox5(%edx),%ebp
         movl %ebp,redo2box5
 
         movl %edi,ediafter2
         call testkeyfrom3  
 
         movl $round13box3check10,checkoffset
         // change bit 46 and test key from round 3
         call change46testkeyfrom3  
 
         //change key bit 50 round 3 to 13
 
         movl ((5-1)*4)+keysetup,%eax
         movl ((8-1)*4)+keysetup,%ebp
         xorl $0x10000000,%eax
         movl ((9-1)*4)+keysetup,%edx
         xorl $0x01000000,%ebp
         movl %eax,((5-1)*4)+keysetup
         xorl $0x00040000,%edx
         movl %ebp,((8-1)*4)+keysetup
         movl %edx,((9-1)*4)+keysetup
         movl ((11-1)*4)+keysetup,%eax
         movl ((14-1)*4)+keysetup,%edx
         xorl $0x40000000,%eax
         xorl $0x00800000,%edx
         movl %eax,((11-1)*4)+keysetup
         movl %edx,((14-1)*4)+keysetup
         movl ((16-1)*4)+keysetup,%eax
         movl ((18-1)*4)+keysetup,%edx
         xorl $0x00000001,%eax
         xorl $0x08000000,%edx
         movl %eax,((16-1)*4)+keysetup
         movl %edx,((18-1)*4)+keysetup
         movl ((19-1)*4)+keysetup,%eax
         movl ((22-1)*4)+keysetup,%edx
         xorl $0x08000000,%eax
         xorl $0x04000000,%edx
         movl %eax,((19-1)*4)+keysetup
         movl %edx,((22-1)*4)+keysetup
         movl ((24-1)*4)+keysetup,%eax
         movl ((25-1)*4)+keysetup,%edx
         xorl $0x00000004,%eax
         xorl $0x20000000,%edx
         movl %eax,((24-1)*4)+keysetup
         movl %edx,((25-1)*4)+keysetup
 
         movl $round13box3check11,checkoffset
         // redo round 2, sbox 3   load esi and edi:
         // redo round 2 sbox 3
         movl ediafter2comp,%esi
         movl redo2box3comp,%ebp
         movl ediafter2,%edi
         xorl %ebp,%esi
         movl redo2box3,%ebp
         movl %esi,ediafter2comp
         xorl %ebp,%edi
         movl esiafter1,%esi
         movl %edi,ediafter2
 
         call testkeyfrom3  
 
         movl $round13box3check01,checkoffset
         call change46testkeyfrom3  
 
         // change key bit 43
         movl ((4-1)*4)+keysetup,%eax
         movl ((5-1)*4)+keysetup,%edx
         xorl $0x00000004,%eax
         xorl $0x20000000,%edx
         movl %eax,((4-1)*4)+keysetup
         movl %edx,((5-1)*4)+keysetup
         movl ((7-1)*4)+keysetup,%eax
         movl ((10-1)*4)+keysetup,%edx
         xorl $0x00080000,%eax
         xorl $0x00000002,%edx
         movl %eax,((7-1)*4)+keysetup
         movl %edx,((10-1)*4)+keysetup
         movl ((13-1)*4)+keysetup,%eax
         movl ((16-1)*4)+keysetup,%edx
         xorl $0x00400000,%eax
         xorl $0x40000000,%edx
         movl %eax,((13-1)*4)+keysetup
         movl %edx,((16-1)*4)+keysetup
         movl ((18-1)*4)+keysetup,%eax
         movl ((19-1)*4)+keysetup,%edx
         xorl $0x01000000,%eax
         xorl $0x00040000,%edx
         movl %eax,((18-1)*4)+keysetup
         movl %edx,((19-1)*4)+keysetup
         movl ((21-1)*4)+keysetup,%eax
         movl ((24-1)*4)+keysetup,%edx
         xorl $0x40000000,%eax
         xorl $0x00800000,%edx
         movl %eax,((21-1)*4)+keysetup
         movl %edx,((24-1)*4)+keysetup
         movl ((26-1)*4)+keysetup,%eax
         movl ((29-1)*4)+keysetup,%ebp
         xorl $0x00000001,%eax
         movl ((32-1)*4)+keysetup,%edx
         xorl $0x00100000,%ebp
         movl %eax,((26-1)*4)+keysetup
         xorl $0x04000000,%edx
         movl %ebp,((29-1)*4)+keysetup
         movl %edx,((32-1)*4)+keysetup
   
         // redo round 2, sbox 1   load esi and edi
         // also calculate new values for redoing
         // box 1, when bit 52 changes
         // since box 1 depends on key bit 43 and key bit 52:
         // redo round 2 sbox 1
         movl round2box1ptrcomp,%ebx
         movl round2box1ptr,%edx
 
         xorl $0x40,%ebx
         movl undo2box1comp,%eax
 
         xorl $0x40,%edx
         movl ediafter2comp,%esi
 
         xorl %eax,%esi
         movl sbox1(%ebx),%ebp
 
         xorl %ebp,%esi
         movl tbox1(%ebx),%ebp
 
         movl ediafter2,%edi
         movl undo2box1,%eax
 
         movl %ebp,redo2box1comp
         xorl %eax,%edi
 
         xorl %ebx,%ebx
         movl sbox1(%edx),%ebp
 
         xorl %ebp,%edi
         movl tbox1(%edx),%ebp
 
         movl %ebp,redo2box1
         movl %esi,ediafter2comp
         movl %edi,ediafter2
         movl esiafter1,%esi
 
         call testkeyfrom3  
 
         movl $round13box3check11,checkoffset
         call change46testkeyfrom3  
 
         //change key bit 50 round 3 to 13
 
         movl ((5-1)*4)+keysetup,%eax
         movl ((8-1)*4)+keysetup,%ebp
         xorl $0x10000000,%eax
         movl ((9-1)*4)+keysetup,%edx
         xorl $0x01000000,%ebp
         movl %eax,((5-1)*4)+keysetup
         xorl $0x00040000,%edx
         movl %ebp,((8-1)*4)+keysetup
         movl %edx,((9-1)*4)+keysetup
         movl ((11-1)*4)+keysetup,%eax
         movl ((14-1)*4)+keysetup,%edx
         xorl $0x40000000,%eax
         xorl $0x00800000,%edx
         movl %eax,((11-1)*4)+keysetup
         movl %edx,((14-1)*4)+keysetup
         movl ((16-1)*4)+keysetup,%eax
         movl ((18-1)*4)+keysetup,%edx
         xorl $0x00000001,%eax
         xorl $0x08000000,%edx
         movl %eax,((16-1)*4)+keysetup
         movl %edx,((18-1)*4)+keysetup
         movl ((19-1)*4)+keysetup,%eax
         movl ((22-1)*4)+keysetup,%edx
         xorl $0x08000000,%eax
         xorl $0x04000000,%edx
         movl %eax,((19-1)*4)+keysetup
         movl %edx,((22-1)*4)+keysetup
         movl ((24-1)*4)+keysetup,%eax
         movl ((25-1)*4)+keysetup,%edx
         xorl $0x00000004,%eax
         xorl $0x20000000,%edx
         movl %eax,((24-1)*4)+keysetup
         movl %edx,((25-1)*4)+keysetup
 
         movl $round13box3check10,checkoffset
         // redo round 2 sbox 3
         movl ediafter2comp,%esi
         movl redo2box3comp,%ebp
         movl ediafter2,%edi
         xorl %ebp,%esi
         movl redo2box3,%ebp
         movl %esi,ediafter2comp
         xorl %ebp,%edi
         movl esiafter1,%esi
         movl %edi,ediafter2
 
         call testkeyfrom3  
 
         movl $round13box3check00,checkoffset
         //call change46testkeyfrom3
         //ret
         // The call and return is commented out, so the test procedure will
         // return directly to the key setup change of next bit.
 
 change46testkeyfrom3:
 
         movl ((7-1)*4)+keysetup,%eax
         movl ((10-1)*4)+keysetup,%ebp
         xorl $0x00000800,%eax
         movl ((11-1)*4)+keysetup,%edx
         xorl $0x00020000,%ebp
         movl %eax,((7-1)*4)+keysetup
         xorl $0x00000008,%edx
         movl %ebp,((10-1)*4)+keysetup
         movl %edx,((11-1)*4)+keysetup
         movl ((14-1)*4)+keysetup,%eax
         movl ((16-1)*4)+keysetup,%edx
         xorl $0x00004000,%eax
         xorl $0x00000040,%edx
         movl %eax,((14-1)*4)+keysetup
         movl %edx,((16-1)*4)+keysetup
         movl ((18-1)*4)+keysetup,%eax
         movl ((19-1)*4)+keysetup,%edx
         xorl $0x00040000,%eax
         xorl $0x00000020,%edx
         movl %eax,((18-1)*4)+keysetup
         movl %edx,((19-1)*4)+keysetup
         movl ((21-1)*4)+keysetup,%eax
         movl ((23-1)*4)+keysetup,%edx
         xorl $0x00000400,%eax
         xorl $0x00000080,%edx
         movl %eax,((21-1)*4)+keysetup
         movl %edx,((23-1)*4)+keysetup
 
         // redo round 2 sbox 5
         movl ediafter2comp,%esi
         movl redo2box5comp,%ebp
         movl ediafter2,%edi
         xorl %ebp,%esi
         movl redo2box5,%ebp
         movl %esi,ediafter2comp
         xorl %ebp,%edi
         movl esiafter1,%esi
         movl %edi,ediafter2
 
 testkeyfrom3:        // Test key from round 3, then change key bit 52
                     // and test again.
 ////        comment// 
 ////        // Following lines not used in large core version.
 ////        call round3to16  
 ////        
 ////
 ////        // Som redoing:
 ////        movl ediafter2comp,%eax
 ////        movl redo2box1comp,%ebp
 ////        movl esiafter1comp,%esi
 ////        xorl %ebp,%eax
 ////        movl redo2box1,%ebp
 ////        movl ediafter2,%edi
 ////        movl %eax,ediafter2comp
 ////        xorl %ebp,%edi
 ////        movl esiafter1,%esi
 ////
 ////        movl %edi,ediafter2
 ////
 ////        endcomment// 
 
 round3to16:
 
         xorl %ebx,%ebx // Might enhance Pentium Pro speed.
 
         movl ((3-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((3-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((4-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((4-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((5-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((5-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((6-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((6-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((7-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((7-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((8-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((8-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((9-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((9-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((10-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((10-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((11-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((11-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         // round 12 part 1
         //mov eax,dword ptr keysetup [(12-1)*8]
         movl 88+keysetup,%eax
 
         xorl %esi,%eax
         movl 92+keysetup,%edx
 
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
 
         andl $0xCFCFCFCF,%edx
         movb %ah,%cl
 
         roll $4,%edx
 
         movl %eax,saveeax
         movb %dl,%bl
 
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
 
         xorl %ebp,%edi
         movl sbox1(%ebx),%ebp
 
         xorl %ebp,%edi
         movb %dh,%cl
 
         movl %edx,saveedx
         movb %ah,%bl
 
         movl sbox7(%ecx),%ebp
         movb 2+saveedx,%cl
 
         xorl %ebp,%edi
         andl $0xFF,%eax
 
         movl sbox5(%ecx),%ebp
         //mov edx,dword ptr keysetup [(12-1+1)*8+4]
         movl 100+keysetup,%edx
 
         xorl %ebp,%edi
         movl sbox2(%ebx),%ebp
 
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
 
         xorl %ebp,%edi
         movl compcontrol,%ebp
 
         xorl %edi,%edx
         movl checkoffset,%eax
 
         andl $0x0FC00000,%edx
         movb 3+saveedx,%cl
 
         shrl $20,%edx
         movl (%ebp,%eax,1),%eax
 
         movl %esi,saveregister
         andl $0x20080820,%esi
 
         xorl %esi,%eax
         movl sbox3(%edx),%edx
 
         cmpl %eax,%edx
         je desround12rest  
         // ebp compcontrol
 
 test2:      // When jumped to here: Test complement key if not tested.
         //mov ebp,compcontrol    NB ebp must be set in the DES rounds
         movl ediafter2comp,%edi
         orl %ebp,%ebp //.if ebp != 0
         jz _if11  
 
         movl ediafter2comp,%edi
         movl redo2box1comp,%ebp
         movl esiafter1comp,%esi
         xorl %ebp,%edi
 
 test52keyfrom3:
         xorl %ecx,%ecx // Might enhance Pentium Pro speed.
         movl ((3-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((3-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((4-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((4-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl round4box4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((5-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((5-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((6-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((6-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl round6box4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((7-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((7-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl round7box1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((8-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((8-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl round8box3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((9-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((9-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl round9box1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((10-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((10-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
         movl ((11-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((11-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl round11box4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl ((12-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((12-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %ah,%cl
         roll $4,%edx
         movl %eax,saveeax
         movb %dl,%bl
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movl round12box1(%ebx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         movl %edx,saveedx
         movb %ah,%bl
         movl sbox7(%ecx),%ebp
         movb 2+saveedx,%cl
         xorl %ebp,%edi
         andl $0xFF,%eax
         movl sbox5(%ecx),%ebp
         //mov edx,dword ptr keysetup [(12-1+1)*8+4]
         movl 100+keysetup,%edx
         xorl %ebp,%edi
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl compcontrol,%ebp
         xorl %edi,%edx
         movl checkoffset,%eax
         andl $0x0FC00000,%edx
         movb 3+saveedx,%cl
         shrl $20,%edx
         movl (%ebp,%eax,1),%eax
         movl %esi,saveregister
         andl $0x20080820,%esi
         xorl %esi,%eax
         movl sbox3(%edx),%edx
         cmpl %eax,%edx
         je ch52round12rest  
         // ebp = compcontrol
 
 test52changed2:
         //mov ebp,compcontrol  ;   NB must be set already
         orl %ebp,%ebp //.if ebp == 0
         jnz _if76  
             ret  
         _if76:     //.endif
 
         movl ediafter2,%edi
         movl redo2box1,%ebp
         movl esiafter1,%esi
         xorl %ebp,%edi
 
         movl $0,compcontrol
         jmp test52keyfrom3  
 
         //rest of original key
 
 ch52round12rest:
 
         //mov bl,byte ptr saveeax
         movb 0+saveeax,%bl
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox8(%ebx),%ebp
         xorl %ebp,%edi
         movl saveregister,%esi
 
         movl ((13-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((13-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl %edx,saveedx
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox6(%ecx),%ebp
         movb %ah,%bl
         andl $0xFF,%eax
         xorl %ebp,%esi
         movb %dh,%cl
         movl sbox4(%eax),%ebp
         xorl $0x80,%ebx
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox2(%ebx),%ebp
         //mov edx,dword ptr keysetup [(13-1+1)*8+4]
         movl 108+keysetup,%edx
         xorl %ebx,%ebx
         xorl %ebp,%esi
         movl compcontrol,%ebp
         xorl %esi,%edx
         movl %edi,saveregister
         shrl $12,%edx
         andl $0x08200401,%edi
         movl round15box5check(%ebp),%ebp
         andl $0xFC,%edx
         xorl %edi,%ebp
         movl sbox5(%edx),%edx // agi
         cmpl %ebp,%edx
         je _53  
         movl compcontrol,%ebp
         jmp test52changed2  
 
 _53:    movb 2+saveedx,%bl
         movb 1+saveedx,%cl
 
         movl is14b,%eax
         movl 24+keysetup,%edx
         andl $0x00000800,%edx
         cmpl %edx,%eax //.if eax != edx     ; change bit 14 for round 13 to 16
         je _if75  
             xorl $0x00000800,%eax
             movl %eax,is14b
         movl ((26-1)*4)+keysetup,%eax
         movl ((27-1)*4)+keysetup,%edx
         xorl $0x00000800,%eax
         xorl $0x00000040,%edx
         movl %eax,((26-1)*4)+keysetup
         movl %edx,((27-1)*4)+keysetup
         movl ((29-1)*4)+keysetup,%eax
         movl ((32-1)*4)+keysetup,%edx
         xorl $0x00004000,%eax
         xorl $0x00000200,%edx
         movl %eax,((29-1)*4)+keysetup
         movl %edx,((32-1)*4)+keysetup
             xorl $0x80,%ecx
         _if75:     //.endif
 
         movl saveregister,%edi
         movl sbox5(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         xorl %ecx,%ecx
         xorl %ebp,%esi
 
         //change46rest moved to round 13
         // update key bit 50 round 14 to 16
         movl is18b,%eax
         movl 16+keysetup,%edx
         andl $0x10000000,%edx
         cmpl %edx,%eax //.if eax != edx
         je _if72_3  
             xorl $0x10000000,%eax
             movl %eax,is18b
         movl ((27-1)*4)+keysetup,%eax
         movl ((30-1)*4)+keysetup,%ebp
         xorl $0x00080000,%eax
         movl ((31-1)*4)+keysetup,%edx
         xorl $0x00000002,%ebp
         movl %eax,((27-1)*4)+keysetup
         xorl $0x04000000,%edx
         movl %ebp,((30-1)*4)+keysetup
         movl %edx,((31-1)*4)+keysetup
         _if72_3:    //.endif
         movl ((14-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((14-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         xorl $0x8,%ebx
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebx,%ebx
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %dh,%cl
         andl $0xFF,%edx
         xorl %ebp,%edi
         movl compcontrol,%ebp
         movl round15box2check(%ebp),%ebp
         movl %esi,saveregister
         movl sbox5(%edx),%edx
         xorl %edx,%edi
         movl sbox3(%ecx),%edx
         xorl %edx,%edi
         //mov edx,dword ptr keysetup [(14-1+1)*8]
         movl 112+keysetup,%edx
         xorl %edi,%edx
         andl $0x00420082,%esi
         shrl $26,%edx
         xorl %esi,%ebp
         //mov edx,dword ptr sbox2 [edx*4]
         movl 0+sbox2(,%edx,4),%edx
         cmpl %ebp,%edx
         je _54  
         movl compcontrol,%ebp
         jmp test52changed2  
 
 _54:    movb %ah,%bl
         andl $0xFF,%eax
         movl saveregister,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
 
         movl ((15-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((15-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         xorl %ebp,%esi
         movb %dl,%bl
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         xorl $0x20,%eax
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl compcontrol,%ebp
         //mov edx,dword ptr cipherpermu [4][ebp]
         movl 4+cipherpermu(%ebp),%edx
         cmpl %edx,%esi //.if esi == edx
         jne _if77  
         movl ((16-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((16-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl $0x8,%ecx
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ecx,%ecx
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
 
             movl compcontrol,%ebp
             movl cipherpermu(%ebp),%eax
             cmpl %eax,%edi//.if edi == eax
             jne _if79  
                 call key_from_permu   //resultat i esi edi
                 movl compcontrol,%ebp
                 orl %ebp,%ebp//.if ebp != 0
                 jz _if78  
                     xorl $0xFFFFFFFF,%esi
                     xorl $0xFFFFFFFF,%edi
                 _if78:   //.endif
                 xorl $0x00100000,%edi // this is bit 52 when stored to mem
                 call key_found_low  
             _if79:  // .endif
         _if77: //.endif
         xorl %ebx,%ebx
         xorl %ecx,%ecx
         movl compcontrol,%ebp
         jmp test52changed2  
 
             //This version tests key bit 52 changed without
             //change of key setup.
         _if11:  //.endif
         //mov edi,ediafter2comp
         movl $24,compcontrol
         movl esiafter1comp,%esi
 
         jmp round3to16  
 
         //rest of original key
 
 desround12rest:
         //mov cl,byte ptr saveedx [3]
         //mov bl,byte ptr saveeax
         movb 0+saveeax,%bl
 
         movl sbox3(%ecx),%ebp
 
         xorl %ebp,%edi
         movl sbox8(%ebx),%ebp
 
         xorl %ebp,%edi
         movl saveregister,%esi
 
         // round 13
         //mov eax,dword ptr keysetup [(13-1)*8]
         movl 96+keysetup,%eax
         xorl %edi,%eax
         movl 100+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl %edx,saveedx
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
 
         xorl %ebp,%esi
         movl sbox6(%ecx),%ebp
 
         movb %ah,%bl
         andl $0xFF,%eax
 
         xorl %ebp,%esi
         movb %dh,%cl
 
         movl sbox4(%eax),%ebp
         //mov edx,dword ptr keysetup [(13-1+1)*8+4]
         movl 108+keysetup,%edx
 
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
 
         xorl %ebp,%esi
         movl sbox2(%ebx),%ebp
 
         xorl %ebp,%esi
         movl compcontrol,%ebp
 
         xorl %esi,%edx
         movl %edi,saveregister
 
         shrl $12,%edx
         andl $0x08200401,%edi
 
         movl round15box5check(%ebp),%ebp
         andl $0xFC,%edx
 
         xorl %edi,%ebp
         movl sbox5(%edx),%edx // agi
 
         cmpl %ebp,%edx
         je _51  
 
         movl compcontrol,%ebp
         jmp test2  
 
 _51:    movb 2+saveedx,%bl
         movb 1+saveedx,%cl
 
         // update key setup bit 46
         movl is14b,%eax
         movl 24+keysetup,%edx
         andl $0x00000800,%edx
         cmpl %edx,%eax //.if eax != edx
         je _if74  
             xorl $0x00000800,%eax
             movl %eax,is14b
         movl ((26-1)*4)+keysetup,%eax
         movl ((27-1)*4)+keysetup,%edx
         xorl $0x00000800,%eax
         xorl $0x00000040,%edx
         movl %eax,((26-1)*4)+keysetup
         movl %edx,((27-1)*4)+keysetup
         movl ((29-1)*4)+keysetup,%eax
         movl ((32-1)*4)+keysetup,%edx
         xorl $0x00004000,%eax
         xorl $0x00000200,%edx
         movl %eax,((29-1)*4)+keysetup
         movl %edx,((32-1)*4)+keysetup
             xorl $0x80,%ecx
         _if74://      .endif
 
         movl saveregister,%edi
         movl sbox5(%ebx),%ebp // agi
 
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         xorl %ecx,%ecx
 
         xorl %ebp,%esi
 
         //change46rest   moved to round 13
         // update key bit 50 round 14 to 16
         movl is18b,%eax
         movl 16+keysetup,%edx
         andl $0x10000000,%edx
         cmpl %edx,%eax //.if eax != edx
         je _if72_2  
             xorl $0x10000000,%eax
             movl %eax,is18b
         movl ((27-1)*4)+keysetup,%eax
         movl ((30-1)*4)+keysetup,%ebp
         xorl $0x00080000,%eax
         movl ((31-1)*4)+keysetup,%edx
         xorl $0x00000002,%ebp
         movl %eax,((27-1)*4)+keysetup
         xorl $0x04000000,%edx
         movl %ebp,((30-1)*4)+keysetup
         movl %edx,((31-1)*4)+keysetup
         _if72_2:    //.endif
         //change52rest  ; new January 14, 1998. not used in large core
 
         // round 14
         //mov eax,dword ptr keysetup [(14-1)*8]
         movl 104+keysetup,%eax
         xorl %esi,%eax
         //mov edx,dword ptr keysetup [(14-1)*8+4]
         movl 108+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
 
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
 
         movb %dh,%cl
         andl $0xFF,%edx
 
         xorl %ebp,%edi
         movl compcontrol,%ebp
         //mov ebp,round15box2check [ebp]
         movl round15box2check(%ebp),%ebp
 
         movl %esi,saveregister
         movl sbox5(%edx),%edx
 
         xorl %edx,%edi
         movl sbox3(%ecx),%edx
 
         xorl %edx,%edi
         //mov edx,dword ptr keysetup [(14-1+1)*8]
         movl 112+keysetup,%edx
 
         xorl %edi,%edx
         andl $0x00420082,%esi
 
         shrl $26,%edx
         xorl %esi,%ebp
 
         movl 0+sbox2(,%edx,4),%edx
         movl $1,%esi // means nothing, will not delete it and change alignment now
 
         cmpl %ebp,%edx
         je _52  
         movl compcontrol,%ebp
         jmp test2  
 
 _52:    movb %ah,%bl
         andl $0xFF,%eax
         movl saveregister,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
 
         movl ((15-1)*8)+keysetup,%eax
         xorl %edi,%eax
         movl ((15-1)*8+4)+keysetup,%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
 
         movl compcontrol,%ebp
         movl 4+cipherpermu(%ebp),%edx
         cmpl %edx,%esi //.if esi == edx
         jnz _if12  
 
         movl ((16-1)*8)+keysetup,%eax
         xorl %esi,%eax
         movl ((16-1)*8+4)+keysetup,%edx
         xorl %esi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%edi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%edi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%edi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%edi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%edi
         movl sbox4(%eax),%ebp
         xorl %ebp,%edi
         movl sbox5(%edx),%ebp
         xorl %ebp,%edi
             movl compcontrol,%ebp
             movl cipherpermu(%ebp),%eax
             cmpl %eax,%edi //.if edi == eax
             jnz _if13  
                 call key_from_permu   //result in esi edi
                 movl compcontrol,%ebp
                 orl %ebp,%ebp//.if ebp != 0
                 jz _if14  
                     xorl $0xFFFFFFFF,%esi
                     xorl $0xFFFFFFFF,%edi
                 _if14:       //.endif
                 call key_found_low  
             _if13:   //.endif
         _if12:     //.endif
         xorl %ebx,%ebx
         xorl %ecx,%ecx
         movl compcontrol,%ebp
         jmp test2  
 
 key_from_permu:   // local procedure
 
 //keyfromsetupdata  dword 1,1,00400000h
 //                dword 2,1,20000000h
 //                dword 3,2,80000000h
 
         movl $28,%ecx
         movl $keyfromsetupdata,%edx
         movl $0,%esi
         movl $0,%edi
 
 _14:    movl (%edx),%eax // bit no
         movl 4(%edx),%ebx // key dword no
         movl 8(%edx),%ebp // check data
         andl -4+keysetup(,%ebx,4),%ebp
         jz _if31   //.if !zero?
             //or esi,changetable [eax*4-4]
             orl -4+changetable(,%eax,4),%esi
         _if31:    //.endif
         addl $12,%edx
         loop _14  
         //bswapmacro
         pushl %eax
         movl %esi,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %esi
         addl $4,%esp
 
         movl $28,%ecx
 _15:    movl (%edx),%eax // bit no
         subl $32,%eax
         movl 4(%edx),%ebx // key dword no
         movl 8(%edx),%ebp // check data
         andl -4+keysetup(,%ebx,4),%ebp
         jz _if32   // .if !zero?
             //or edi,changetable [eax*4-4]
             orl -4+changetable(,%eax,4),%edi
         _if32: //.endif
         addl $12,%edx
         loop _15  
         //bswapmacro
         pushl %eax
         movl %edi,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %edi
         addl $4,%esp
 
         ret  
 
 key_found_low:          // local procedure
 
         movl $1,keyisfound
 
         // key received in esi edi
         movl %esi,tempkey
         movl %edi,4+tempkey
 
         movl $tempkey,%esi
         movl $foundkey,%edi
         movl $8,%ecx
 _16:    movb (%esi),%al
         andb %al,%al
         jnp _16a  
         //.if parity?
             xorb $0x01,%al
         //.endif
 _16a:
         movb %al,(%edi)
         addl $1,%esi
         addl $1,%edi
         loop _16  
         pushl $foundkey
         call _bryd_key_found  
         addl $4,%esp
         xorl %ebx,%ebx
         xorl %ecx,%ecx
 
         ret  
 
 _desinit:                // procedure
 
 //desinit_frame equ 24
 
 // ptr key
 // 0    [in]
 
         pushl %esi
         pushl %edi
         pushl %ebp
         pushl %ebx
         pushl %ecx
 
         //ici!
         movl $keysetup,%edi
         movl $0,%eax
         movl $32,%ecx
         //rep stosd
 
 _desinit02:
         stosl  
         loop _desinit02  
 
         //mov esi, dword ptr [esp][desinit_frame]
         movl 24(%esp),%esi
         movl (%esi),%ebx
         //bswapmacro
         pushl %eax
         movl %ebx,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %ebx
         addl $4,%esp
         movl $1,%ebp
 
 _desinit01:
 
         shll $1,%ebx
         jnc _if_desinit01   //.if carry?
             //cannot change ebx,ebp
             pushl %ebp
             movl -4+changeoffsets(,%ebp,4),%ebp
 
             xorl %eax,%eax
             xorl %edx,%edx
             xorl %ecx,%ecx
             movb (%ebp),%cl
             movb 2(%ebp),%dl
             movb 1(%ebp),%al
             incl %ebp
 
     _13_a:  movl -4+changetable(,%edx,4),%edi
             movl -4+keysetup(,%eax,4),%esi
             addl $2,%ebp
             xorl %edi,%esi
             movb 1(%ebp),%dl
             movl %esi,-4+keysetup(,%eax,4)
             movb (%ebp),%al
             loop _13_a  
             popl %ebp
 
         _if_desinit01:    //.endif
 
         incl %ebp
         testl $0x7,%ebp
         jnz _if_desinit02   //.if zero?
             incl %ebp
             shll $1,%ebx
             cmpl $33,%ebp // .if ebp == 33
             jne _if_desinit03  
                 movl 24(%esp),%esi
                 movl 4(%esi),%ebx
         //bswapmacro
         pushl %eax
         movl %ebx,%eax
         rorw $8,%ax
         rorl $16,%eax
         rorw $8,%ax
         pushl %eax
         movl 4(%esp),%eax
         popl %ebx
         addl $4,%esp
             _if_desinit03:  //  .endif
         _if_desinit02:       //.endif
 
         cmpl $65,%ebp
         jne _desinit01  
 
         movl $sboxdata,%esi
         movl $sbox1,%edi
         movl $1152,%ecx
         //rep movsd
 
 _desinit03:
         movsl  
         loop _desinit03  
 
         popl %ecx
         popl %ebx
         popl %ebp
         popl %edi
         popl %esi
 
         ret  
 
 shiftleft_edx_eax:      // local procedure
         shll $1,%edx
         shll $1,%eax
         jnc _if55   //.if carry?
             orl $1,%edx
         _if55:       // .endif
         ret  
 
 _desencrypt:             // procedure
 
 //desencrypt_frame equ 24
 
 // ptr plain    ptr ciphertext
 // 0    [in]    4        [out]
 
         pushl %esi
         pushl %edi
         pushl %ebp
         pushl %ebx
         pushl %ecx
 
         //mov eax,dword ptr [esp][desencrypt_frame]
         movl 24(%esp),%eax
         movl (%eax),%esi
         movl 4(%eax),%edi
 
         movl $0,keysetupoffset
         movl $0,%ebp
 
         // The initial and final permutation code is inspired by
         // Eric Young, who again was inspired by others.
         // See the Libdes library.
 
         // initial permutation
         roll $4,%edi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0xF0F0F0F0,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $12,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x000FFFF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $14,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x33333333,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $6,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x0FF00FF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $7,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x55555555,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $1,%edi
         movl %ecx,%esi
 
         xorl %ebx,%ebx
         xorl %ecx,%ecx
 
 _18:    movl keysetup(%ebp),%eax
         xorl %edi,%eax
         movl 4+keysetup(%ebp),%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
         movl keysetupoffset,%ebp
         movl %esi,%eax
         addl $8,%ebp
         movl %ebp,keysetupoffset
         movl %edi,%esi
         movl %eax,%edi
         cmpl $128,%ebp
         jb _18  
 
         //final permutation
         roll $1,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0x55555555,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         rorl $7,%edi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x0FF00FF0,%esi
         xorl %esi,%edi
         xorl %ecx,%esi
         rorl $6,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0xCCCCCCCC,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         roll $14,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0x0FFFF000,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         rorl $12,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0x0F0F0F0F,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         roll $4,%edi
 
         //mov eax,dword ptr [esp][desencrypt_frame+4]
         movl 28(%esp),%eax
         movl %edi,(%eax)
         movl %esi,4(%eax)
 
         popl %ecx
         popl %ebx
         popl %ebp
         popl %edi
         popl %esi
 
         ret  
 
 _desdecrypt:             // procedure
 
 //desdecrypt_frame equ 24
 
 // ptr cipher   ptr plain
 // 0    [in]    4        [out]
 
         pushl %esi
         pushl %edi
         pushl %ebp
         pushl %ebx
         pushl %ecx
 
         //mov eax,dword ptr [esp][desdecrypt_frame]
         movl 24(%esp),%eax
         movl (%eax),%esi
         movl 4(%eax),%edi
 
         movl $120,keysetupoffset
         movl $120,%ebp
 
         // The initial and final permutation code is inspired by
         // Eric Young, who again was inspired by others.
         // See the Libdes library.
 
         // initial permutation
         roll $4,%edi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0xF0F0F0F0,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $12,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x000FFFF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $14,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x33333333,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $6,%ecx
         movl %ecx,%esi
         xorl %edi,%ecx
         andl $0x0FF00FF0,%ecx
         xorl %ecx,%esi
         xorl %ecx,%edi
         roll $7,%esi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x55555555,%esi
         xorl %esi,%ecx
         xorl %esi,%edi
         rorl $1,%edi
         movl %ecx,%esi
 
         xorl %ebx,%ebx
         xorl %ecx,%ecx
 
 _19:    movl keysetup(%ebp),%eax
         xorl %edi,%eax
         movl 4+keysetup(%ebp),%edx
         xorl %edi,%edx
         andl $0xFCFCFCFC,%eax
         andl $0xCFCFCFCF,%edx
         movb %al,%bl
         roll $4,%edx
         movb %ah,%cl
         movl sbox8(%ebx),%ebp
         movb %dl,%bl
         xorl %ebp,%esi
         shrl $16,%eax
         movl sbox6(%ecx),%ebp
         xorl %ebp,%esi
         movb %dh,%cl
         shrl $16,%edx
         movl sbox1(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox7(%ecx),%ebp
         movb %ah,%bl
         xorl %ebp,%esi
         movb %dh,%cl
         andl $0xFF,%eax
         andl $0xFF,%edx
         movl sbox2(%ebx),%ebp
         xorl %ebp,%esi
         movl sbox3(%ecx),%ebp
         xorl %ebp,%esi
         movl sbox4(%eax),%ebp
         xorl %ebp,%esi
         movl sbox5(%edx),%ebp
         xorl %ebp,%esi
         movl keysetupoffset,%ebp
         movl %esi,%eax
         subl $8,%ebp
         movl %ebp,keysetupoffset
         movl %edi,%esi
         movl %eax,%edi
         cmpl $0,%ebp
         jnl _19  
 
         //final permutation
         roll $1,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0x55555555,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         rorl $7,%edi
         movl %esi,%ecx
         xorl %edi,%esi
         andl $0x0FF00FF0,%esi
         xorl %esi,%edi
         xorl %ecx,%esi
         rorl $6,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0xCCCCCCCC,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         roll $14,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0x0FFFF000,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         rorl $12,%esi
         movl %edi,%ecx
         xorl %esi,%edi
         andl $0x0F0F0F0F,%edi
         xorl %edi,%esi
         xorl %ecx,%edi
         roll $4,%edi
 
         //mov eax,dword ptr [esp][desdecrypt_frame+4]
         movl 28(%esp),%eax
         movl %edi,(%eax)
         movl %esi,4(%eax)
 
         popl %ecx
         popl %ebx
         popl %ebp
         popl %edi
         popl %esi
 
         ret  
 
 _key_byte_to_hex:        // procedure
         movl $0,add_zero
         jmp key_byte_to_hex_1  
 _c_key_byte_to_hex:
         movl $1,add_zero
 key_byte_to_hex_1:
 
 // ptr key    ptr hexkey    dword no_of_bytes
 // 0  [in]    4    [out]    8              in
 
 // returns  eax  0: parity ok    1: parity adjusted
 
         pushl %esi
         pushl %edi
         pushl %ebp
         pushl %ebx
         pushl %ecx // pushes adds 20 to frame
 
         //mov esi,[esp][24+0]
         movl 24(%esp),%esi
         //mov edi,[esp][24+4]
         movl 28(%esp),%edi
         //mov ecx,[esp][24+8]
         movl 32(%esp),%ecx
 
         movl $0,%edx
 _20:    movb (%esi),%al
         andb %al,%al
         jnp _20a  
         //.if parity?
             movl $1,%edx
             xorb $0x01,%al
         //.endif
 _20a:
         movb %al,%ah
         andb $0x0f,%ah
         andb $0xf0,%al
         shrb $4,%al
         //.if ah > 9
         cmpb $9,%ah
         jna _if61  
             addb $55,%ah
             jmp _if61a  
         _if61: //.else
             addb $48,%ah
         _if61a: //.endif
         cmpb $9,%al //.if al > 9
         jna _if63  
             addb $55,%al
             jmp _if63a  
         _if63:    //.else
             addb $48,%al
         _if63a:   //.endif
         movw %ax,(%edi)
         addl $1,%esi
         addl $2,%edi
         loop _20  
 
         cmpl $1,add_zero //.if add_zero == 1
         jnz _if62  
             movb $0,(%edi)
         _if62: //.endif
 
         movl %edx,%eax
 
         popl %ecx
         popl %ebx
         popl %ebp
         popl %edi
         popl %esi
         ret  
 
//end 

.globl _bdeslow_S
.globl bdeslow_S
_bdeslow_S:
bdeslow_S:
	movl	$_id, %eax
	ret
