// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/md5-1.2/src/des56.c
// Function: fsetkey
void fsetkey(char key[8], keysched *ks)
{
	register int i;
	register word32 C, D;
	static int built = 0;

	if(!built) {
		buildtables();
		built = 1;
	}

	C = D = 0;
	for(i = 0; i < 8; i++) {
		register int v;

		v = key[i] >> 1;	/* Discard "parity" bit */
		C |= wC_K4[i][(v>>3) & 15] | wC_K3[i][v & 7];
		D |= wD_K4[i][(v>>3) & 15] | wD_K3[i][v & 7];
	}

	/*
	 * C and D now hold the suitably right-justified
	 * 28 permuted key bits each.
	 */
	for(i = 0; i < 16; i++) {
#ifdef CRAY
#define choice2(x, v)  x[6][v&15] | x[5][(v>>4)&15] | x[4][(v>>8)&15] | \
		    x[3][(v>>12)&15] | x[2][(v>>16)&15] | x[1][(v>>20)&15] | \
		    x[0][(v>>24)&15]
#else
		register word32 *ap;

#  define choice2(x, v)  ( \
		    ap = &(x)[0][0], \
		    ap[16*6 + (v&15)] | \
		    ap[16*5 + ((v>>4)&15)]  | ap[16*4 + ((v>>8)&15)]  | \
		    ap[16*3 + ((v>>12)&15)] | ap[16*2 + ((v>>16)&15)] | \
		    ap[16*1 + ((v>>20)&15)] | ap[16*0 + ((v>>24)&15)] )
#endif 


		/* 28-bit left circular shift */
		C <<= preshift[i];
		C = ((C >> 28) & 3) | (C & (((word32)1<<28) - 1));
		ks->KS[i].h = choice2(hKS_C4, C);

		D <<= preshift[i];
		D = ((D >> 28) & 3) | (D & (((word32)1<<28) - 1));
		ks->KS[i].l = choice2(lKS_D4, D);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7d8, %rsp            # imm = 0x7D8
movq %rdi, %r14
cmpb $0x0, 0x18c0ad(%rip)    # 0x4bf040
jne 0x3333e8
movq %rsi, 0x8(%rsp)
leaq 0x5d0(%rsp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x173a0
leaq 0x3d0(%rsp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x173a0
movl $0x1, %eax
movl $0x1d, %ecx
leaq 0xb40d9(%rip), %rdx     # 0x3e70b0
leaq 0xb40f2(%rip), %rsi     # 0x3e70d0
movzbl -0x2(%rcx,%rdx), %edi
movq %rax, 0x3c8(%rsp,%rdi,8)
movzbl -0x2(%rcx,%rsi), %edi
movq %rax, 0x5c8(%rsp,%rdi,8)
addq %rax, %rax
decq %rcx
cmpq $0x1, %rcx
ja 0x332fde
xorl %edx, %edx
leaq 0x18c043(%rip), %rax    # 0x4bf050
leaq 0x18c63c(%rip), %rsi    # 0x4bf650
leaq 0x18c435(%rip), %rdi    # 0x4bf450
leaq 0x18ca2e(%rip), %r8     # 0x4bfa50
movl %edx, %ecx
andl $0x3, %ecx
movl $0x8, %r9d
shrl %cl, %r9d
movslq %edx, %r10
movl %r10d, %r11d
sarl $0x3, %r11d
movslq %r11d, %r11
leal 0x3(%r10), %ebp
movslq %ebp, %r15
movq %r11, %r12
shlq $0x6, %r12
shlq $0x7, %r11
xorl %r13d, %r13d
testl %r13d, %r9d
je 0x333095
movq 0x5d0(%rsp,%r10,8), %rbp
leaq (%r11,%r13,8), %rbx
orq %rbp, (%rax,%rbx)
movq 0x3d0(%rsp,%r10,8), %rbp
orq %rbp, (%rsi,%rbx)
cmpq $0x7, %r13
ja 0x333095
movq 0x5d0(%rsp,%r15,8), %rbx
leaq (%r12,%r13,8), %rbp
orq %rbx, (%rdi,%rbp)
movq 0x3d0(%rsp,%r15,8), %rbx
orq %rbx, (%r8,%rbp)
incq %r13
cmpq $0x10, %r13
jne 0x333052
leal 0x4(%rdx), %r9d
cmpl $0x3, %ecx
cmovnel %edx, %r9d
leal 0x1(%r9), %edx
cmpl $0x3f, %r9d
jl 0x333022
leaq 0xf0(%rsp), %rdi
movl $0xe0, %edx
xorl %esi, %esi
callq 0x173a0
leaq 0x10(%rsp), %rdi
movl $0xe0, %edx
xorl %esi, %esi
callq 0x173a0
movl $0x1, %esi
movl $0x18, %eax
movl $0x12, %edx
leaq 0xb402d(%rip), %rcx     # 0x3e711f
xorl %r8d, %r8d
movq %rsi, %rdi
movzbl (%rcx,%r8), %esi
movq %rdi, -0xd8(%rsp,%rsi,8)
movzbl -0x18(%rcx,%r8), %esi
movq %rdi, 0xe8(%rsp,%rsi,8)
leaq (%rdi,%rdi), %rsi
leaq (%rax,%r8), %r9
decq %r9
decq %r8
cmpq %rdx, %r9
ja 0x3330f5
shlq $0x3, %rdi
leaq -0x6(%rdx), %r8
addq $-0x6, %rax
addq $-0x6, %rcx
movq %rdi, %rsi
cmpq $0x5, %rdx
movq %r8, %rdx
ja 0x3330f2
xorl %eax, %eax
leaq 0x18cb05(%rip), %rdx    # 0x4bfc50
leaq 0x18ce7e(%rip), %rsi    # 0x4bffd0
movq %rax, %rdi
shlq $0x5, %rdi
andq $-0x80, %rdi
movl %eax, %ecx
andb $0x3, %cl
movl $0x8, %r8d
shrl %cl, %r8d
xorl %ecx, %ecx
testl %ecx, %r8d
je 0x33318b
movq 0xf0(%rsp,%rax,8), %r9
leaq (%rdi,%rcx,8), %r10
orq %r9, (%rdx,%r10)
movq 0x10(%rsp,%rax,8), %r9
orq %r9, (%rsi,%r10)
incq %rcx
cmpq $0x10, %rcx
jne 0x33316d
incq %rax
cmpq $0x1c, %rax
jne 0x333152
movdqa 0x2587b(%rip), %xmm0    # 0x358a20
xorl %eax, %eax
movdqa 0x25881(%rip), %xmm1    # 0x358a30
movdqa 0xb3dd9(%rip), %xmm2    # 0x3e6f90
pshufd $0xf5, %xmm2, %xmm3     # xmm3 = xmm2[1,1,3,3]
movdqa 0xb3ddc(%rip), %xmm4    # 0x3e6fa0
movdqa 0xb3de4(%rip), %xmm5    # 0x3e6fb0
movdqa 0xb3dec(%rip), %xmm6    # 0x3e6fc0
movdqa 0xa2574(%rip), %xmm7    # 0x3d5750
leaq 0x18d16d(%rip), %rcx    # 0x4c0350
movdqa 0x25854(%rip), %xmm8    # 0x358a40
movdqa %xmm0, %xmm9
pxor %xmm1, %xmm9
movdqa %xmm2, %xmm10
pcmpgtd %xmm9, %xmm10
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
pcmpeqd %xmm3, %xmm9
pand %xmm10, %xmm9
pandn %xmm4, %xmm9
movdqa %xmm0, %xmm10
psllq $0xc, %xmm10
pand %xmm5, %xmm10
movdqa %xmm0, %xmm11
psllq $0x6, %xmm11
pand %xmm6, %xmm11
movdqa %xmm0, %xmm12
pand %xmm7, %xmm12
por %xmm10, %xmm12
por %xmm11, %xmm12
por %xmm9, %xmm12
movdqa %xmm12, (%rax,%rcx)
paddq %xmm8, %xmm0
addq $0x10, %rax
cmpq $0x2b0, %rax            # imm = 0x2B0
jne 0x3331ec
movaps 0xb3d64(%rip), %xmm0    # 0x3e6fd0
movaps %xmm0, 0x18e38d(%rip)   # 0x4c1600
movaps 0xb3d66(%rip), %xmm0    # 0x3e6fe0
movaps %xmm0, 0x18e38f(%rip)   # 0x4c1610
movaps 0xb3d68(%rip), %xmm0    # 0x3e6ff0
movaps %xmm0, 0x18e391(%rip)   # 0x4c1620
movaps 0xb3d6a(%rip), %xmm0    # 0x3e7000
movaps %xmm0, 0x18e393(%rip)   # 0x4c1630
movaps 0xb3d6c(%rip), %xmm0    # 0x3e7010
movaps %xmm0, 0x18e395(%rip)   # 0x4c1640
movaps 0xb3d6e(%rip), %xmm0    # 0x3e7020
movaps %xmm0, 0x18e397(%rip)   # 0x4c1650
movaps 0xb3d70(%rip), %xmm0    # 0x3e7030
movaps %xmm0, 0x18e399(%rip)   # 0x4c1660
movaps 0xb3d72(%rip), %xmm0    # 0x3e7040
movaps %xmm0, 0x18e39b(%rip)   # 0x4c1670
movdqa 0xb3d73(%rip), %xmm0    # 0x3e7050
xorl %eax, %eax
movdqa 0xb3d79(%rip), %xmm1    # 0x3e7060
movdqa 0xb3d81(%rip), %xmm2    # 0x3e7070
movdqa 0xb3d89(%rip), %xmm3    # 0x3e7080
movdqa 0xb3d91(%rip), %xmm4    # 0x3e7090
movdqa %xmm0, %xmm5
pand %xmm1, %xmm5
movdqa %xmm0, %xmm6
pslld $0x4, %xmm6
pand %xmm2, %xmm6
por %xmm5, %xmm6
movdqa %xmm0, %xmm5
psrld $0x1, %xmm5
pand %xmm3, %xmm5
por %xmm6, %xmm5
movdqa %xmm5, 0x2d0(%rsp,%rax,4)
addq $0x4, %rax
paddd %xmm4, %xmm0
cmpq $0x40, %rax
jne 0x3332ff
movl $0x1, %eax
movl $0x21, %ecx
leaq 0xb3fcf(%rip), %rdx     # 0x3e7320
movzbl -0x2(%rcx,%rdx), %esi
movq %rax, 0x1c8(%rsp,%rsi,8)
addq %rax, %rax
decq %rcx
cmpq $0x1, %rcx
ja 0x333351
leaq 0x1d0(%rsp), %rax
xorl %ecx, %ecx
leaq 0xb3da5(%rip), %rdx     # 0x3e7120
leaq 0x18d27e(%rip), %rsi    # 0x4c0600
movq %rcx, %rdi
shlq $0x6, %rdi
addq %rdx, %rdi
movq %rcx, %r8
shlq $0x9, %r8
addq %rsi, %r8
xorl %r9d, %r9d
movslq 0x2d0(%rsp,%r9,4), %r10
movzbl (%r10,%rdi), %r10d
leaq (%r8,%r9,8), %r11
xorl %r15d, %r15d
testb $0x8, %r10b
je 0x3333ba
movq (%rax,%r15,8), %rbx
orq %rbx, (%r11)
addl %r10d, %r10d
incq %r15
cmpq $0x4, %r15
jne 0x3333ad
incq %r9
cmpq $0x40, %r9
jne 0x333399
incq %rcx
addq $0x20, %rax
cmpq $0x8, %rcx
jne 0x333382
movb $0x1, 0x18bc5d(%rip)    # 0x4bf040
movq 0x8(%rsp), %rsi
xorl %ecx, %ecx
leaq 0x18bc5f(%rip), %rdx    # 0x4bf050
leaq 0x18c058(%rip), %r15    # 0x4bf450
leaq 0x18c251(%rip), %rdi    # 0x4bf650
leaq 0x18c64a(%rip), %r8     # 0x4bfa50
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %eax, %eax
movb (%r14), %r11b
sarb %r11b
movzbl %r11b, %r11d
movl %r11d, %ebx
andl $0x78, %ebx
addq %r9, %rbx
andl $0x7, %r11d
leaq (%rcx,%r11,8), %r11
orq (%rdx,%rbx), %r10
orq (%r15,%r11), %r10
orq (%rdi,%rbx), %rax
orq (%r8,%r11), %rax
incq %r14
subq $-0x80, %r9
addq $0x40, %rcx
cmpq $0x200, %rcx            # imm = 0x200
jne 0x33340e
addq $0x8, %rsi
xorl %edx, %edx
leaq 0xb3c46(%rip), %r15     # 0x3e70a0
movl $0xfffffff, %edi        # imm = 0xFFFFFFF
leaq 0x18c7ea(%rip), %r8     # 0x4bfc50
leaq 0x18cb63(%rip), %r9     # 0x4bffd0
movb (%rdx,%r15), %cl
shlq %cl, %r10
movl %r10d, %ebx
shrl $0x1c, %ebx
andl $0x3, %ebx
movq %r10, %r11
andq %rdi, %r11
orq %rbx, %r11
movl %r11d, %ebx
andl $0xf, %ebx
movl %r10d, %r14d
shrl %r14d
andl $0x78, %r14d
movq 0x280(%r8,%r14), %r14
orq 0x300(%r8,%rbx,8), %r14
movl %r10d, %ebx
shrl $0x5, %ebx
andl $0x78, %ebx
orq 0x200(%r8,%rbx), %r14
movl %r10d, %ebx
shrl $0x9, %ebx
andl $0x78, %ebx
orq 0x180(%r8,%rbx), %r14
movl %r10d, %ebx
shrl $0xd, %ebx
andl $0x78, %ebx
orq 0x100(%r8,%rbx), %r14
movl %r10d, %ebx
shrl $0x11, %ebx
andl $0x78, %ebx
orq 0x80(%r8,%rbx), %r14
shrl $0x15, %r10d
andl $0x78, %r10d
orq (%r10,%r8), %r14
shlq %cl, %rax
movq %r14, -0x8(%rsi)
movl %eax, %r10d
shrl $0x1c, %r10d
andl $0x3, %r10d
movq %rax, %rcx
andq %rdi, %rcx
orq %r10, %rcx
movl %ecx, %ebx
andl $0xf, %ebx
movl %eax, %r10d
shrl %r10d
andl $0x78, %r10d
movq 0x280(%r9,%r10), %r10
orq 0x300(%r9,%rbx,8), %r10
movl %eax, %ebx
shrl $0x5, %ebx
andl $0x78, %ebx
orq 0x200(%r9,%rbx), %r10
movl %eax, %ebx
shrl $0x9, %ebx
andl $0x78, %ebx
orq 0x180(%r9,%rbx), %r10
movl %eax, %ebx
shrl $0xd, %ebx
andl $0x78, %ebx
orq 0x100(%r9,%rbx), %r10
movl %eax, %ebx
shrl $0x11, %ebx
andl $0x78, %ebx
orq 0x80(%r9,%rbx), %r10
shrl $0x15, %eax
andl $0x78, %eax
orq (%rax,%r9), %r10
movq %r10, (%rsi)
incq %rdx
addq $0x10, %rsi
movq %r11, %r10
movq %rcx, %rax
cmpq $0x10, %rdx
jne 0x33346d
addq $0x7d8, %rsp            # imm = 0x7D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq