// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/md5-1.2/src/des56.c
// Function: fencrypt
void
fencrypt(char block[8], int decrypt, keysched *ks)
{
	int i;
	register word32 L, R;
	register struct keystage *ksp;
	register word32 *ap;

	/* Initial permutation */

	L = R = 0;
	i = 7;
	ap = wL_I8;
	do {
		register int v;

		v = block[i];	/* Could optimize according to ENDIAN */
		L = ap[v & 0x55] | (L << 1);
		R = ap[(v >> 1) & 0x55] | (R << 1);
	} while(--i >= 0);

	if(decrypt) {
		ksp = &ks->KS[15];
	} else {
		ksp = &ks->KS[0];
	}

#ifdef CRAY
#  define PS(i,j)	wPS[i][j]
#else 
#  define PS(i,j)	ap[64*(i) + (j)]
	ap = &wPS[0][0];
#endif 

	i = 16;
	do {
		register word32 k, tR;

		tR = (R >> 15) | (R << 17);

		k = ksp->h;
		L ^= PS(0, ((tR >> 12) ^ (k >> 24)) & 63)
		   | PS(1, ((tR >> 8) ^ (k >> 16)) & 63)
		   | PS(2, ((tR >> 4) ^ (k >> 8)) & 63)
		   | PS(3, (tR ^ k) & 63);

		k = ksp->l;
		L ^= PS(4, ((R >> 11) ^ (k >> 24)) & 63)
		   | PS(5, ((R >> 7) ^ (k >> 16)) & 63)
		   | PS(6, ((R >> 3) ^ (k >> 8)) & 63)
		   | PS(7, ((tR >> 16) ^ k) & 63);

		tR = L;
		L = R;
		R = tR;


		if(decrypt)
			ksp--;
		else
			ksp++;
	} while(--i > 0);
	{
		register word32 t;

#ifdef CRAY
# define FP(k)	(wO_L4[ (L >> (k)) & 15 ] << 1 | wO_L4[ (R >> (k)) & 15 ])
#else 
# define FP(k)	(ap[ (L >> (k)) & 15 ] << 1 | ap[ (R >> (k)) & 15 ])

		ap = wO_L4;
#endif 

		t = FP(0) | (FP(8) | (FP(16) | (FP(24) << 2)) << 2) << 2;
		R = FP(4) | (FP(12) | (FP(20) | (FP(28) << 2)) << 2) << 2;
		L = t;
	}
	{
		register word32 t;
		register char *bp;

		bp = &block[7];
		t = R;
		*bp = t & 255;
		*--bp = (t >>= 8) & 255;
		*--bp = (t >>= 8) & 255;
		*--bp = (t >> 8) & 255;
		t = L;
		*--bp = t & 255;
		*--bp = (t >>= 8) & 255;
		*--bp = (t >>= 8) & 255;
		*--bp = (t >> 8) & 255;
	}
}

// Assembly:
movl $0x8, %r8d
xorl %ecx, %ecx
leaq 0x18d015(%rip), %r9     # 0x4cb350
xorl %eax, %eax
movzbl -0x1(%rdi,%r8), %r10d
movl %r10d, %r11d
andl $0x55, %r11d
addq %rax, %rax
orq (%r9,%r11,8), %rax
andl $-0x56, %r10d
addq %rcx, %rcx
orq (%r9,%r10,4), %rcx
decq %r8
jne 0x33e33d
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xf0(%rdx), %r8
xorl %r9d, %r9d
testl %esi, %esi
sete %r9b
cmoveq %rdx, %r8
shll $0x5, %r9d
addq $-0x10, %r9
addq $0x8, %r8
movl $0x11, %edx
leaq 0x18d26b(%rip), %rsi    # 0x4cb600
movq %rax, %r11
movq %rcx, %rax
movq %rcx, %r14
shrq $0xf, %r14
movl %eax, %r10d
shll $0x11, %r10d
orl %r14d, %r10d
movl %r10d, %ecx
shrl $0xc, %ecx
movl -0x8(%r8), %ebp
movl %ebp, %r15d
shrl $0x18, %r15d
xorl %ecx, %r15d
andl $0x3f, %r15d
movl %eax, %ecx
shrl $0x17, %ecx
movl %ebp, %ebx
shrl $0x10, %ebx
xorl %ecx, %ebx
andl $0x3f, %ebx
movq 0x200(%rsi,%rbx,8), %rbx
orq (%rsi,%r15,8), %rbx
movl %eax, %ecx
shrl $0x13, %ecx
movl %ebp, %r15d
shrl $0x8, %r15d
xorl %ecx, %r15d
andl $0x3f, %r15d
orq 0x400(%rsi,%r15,8), %rbx
movl (%r8), %ecx
xorl %r14d, %ebp
orl $0xc0, %ebp
movzbl %bpl, %r14d
orq (%rsi,%r14,8), %rbx
movl %eax, %ebp
shrl $0xb, %ebp
movl %ecx, %r14d
movl %ecx, %r15d
shrl $0x10, %r10d
xorl %ecx, %r10d
movl %ecx, %r12d
shrl $0x18, %r12d
xorl %ebp, %r12d
andl $0x3f, %r12d
movl %eax, %ecx
shrl $0x7, %ecx
shrl $0x10, %r14d
xorl %ecx, %r14d
andl $0x3f, %r14d
movq 0xa00(%rsi,%r14,8), %rcx
orq 0x800(%rsi,%r12,8), %rcx
xorq %r11, %rbx
movl %eax, %r11d
shrl $0x3, %r11d
shrl $0x8, %r15d
xorl %r11d, %r15d
andl $0x3f, %r15d
orq 0xc00(%rsi,%r15,8), %rcx
orl $0x1c0, %r10d           # imm = 0x1C0
andl $0x1ff, %r10d           # imm = 0x1FF
orq (%rsi,%r10,8), %rcx
xorq %rbx, %rcx
addq %r9, %r8
decl %edx
cmpl $0x1, %edx
ja 0x33e395
movl %eax, %edx
andl $0xf, %edx
leaq 0x18e166(%rip), %rsi    # 0x4cc600
movq (%rsi,%rdx,8), %rdx
addq %rdx, %rdx
movl %ecx, %r8d
andl $0xf, %r8d
movl %eax, %r9d
shrl $0x5, %r9d
andl $0x78, %r9d
movq (%r9,%rsi), %r9
movl %ecx, %r10d
shrl $0x5, %r10d
andl $0x78, %r10d
movq (%r10,%rsi), %r10
movl %eax, %r11d
shrl $0xd, %r11d
andl $0x78, %r11d
movq (%r11,%rsi), %rbx
movl %ecx, %r11d
shrl $0xd, %r11d
andl $0x78, %r11d
movq (%r11,%rsi), %r11
movl %eax, %r14d
shrl $0x15, %r14d
andl $0x78, %r14d
movq (%r14,%rsi), %r14
movl %ecx, %r15d
shrl $0x15, %r15d
andl $0x78, %r15d
movq (%r15,%rsi), %r15
shlq $0x6, %r15
shlq $0x7, %r14
shlq $0x5, %rbx
orq %r14, %rbx
shlq $0x4, %r11
orq %rbx, %r11
orq %r15, %r11
shlq $0x3, %r9
shlq $0x2, %r10
orq (%rsi,%r8,8), %rdx
orq %r9, %rdx
orq %r10, %rdx
orq %r11, %rdx
movl %eax, %r8d
shrl %r8d
andl $0x78, %r8d
movl (%r8,%rsi), %r8d
addl %r8d, %r8d
movl %ecx, %r9d
shrl %r9d
andl $0x78, %r9d
movl %eax, %r10d
shrl $0x9, %r10d
andl $0x78, %r10d
movl (%r10,%rsi), %r10d
movl %ecx, %r11d
shrl $0x9, %r11d
andl $0x78, %r11d
movl (%r11,%rsi), %r11d
movl %eax, %ebx
shrl $0x11, %ebx
andl $0x78, %ebx
movl (%rbx,%rsi), %ebp
movl %ecx, %ebx
shrl $0x11, %ebx
andl $0x78, %ebx
movl (%rbx,%rsi), %ebx
shrl $0x1c, %eax
movl (%rsi,%rax,8), %eax
shrl $0x1c, %ecx
movl (%rsi,%rcx,8), %ecx
shll $0x6, %ecx
shll $0x7, %eax
shll $0x5, %ebp
orl %eax, %ebp
orl %ecx, %ebp
shll $0x4, %ebx
orl %ebp, %ebx
shll $0x3, %r10d
shll $0x2, %r11d
orl (%r9,%rsi), %r8d
orl %r10d, %r8d
orl %r11d, %r8d
orl %ebx, %r8d
bswapl %r8d
movl %r8d, 0x4(%rdi)
movb %dl, 0x3(%rdi)
movb %dh, 0x2(%rdi)
movl %edx, %eax
shrl $0x10, %eax
movb %al, 0x1(%rdi)
shrl $0x18, %edx
movb %dl, (%rdi)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)