// File: /workspace/github_c_makefile_star2_O2/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 %rsi, (%rsp)
movq %rdi, %r12
cmpb $0x0, 0x168a4d(%rip)    # 0x43dff0
jne 0x2d5946
leaq 0x5d0(%rsp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x17380
leaq 0x3d0(%rsp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x17380
pushq $0x1
popq %rax
pushq $0x1b
popq %rcx
leaq 0xb1dc2(%rip), %rdx     # 0x3873a0
leaq 0xb1ddb(%rip), %rsi     # 0x3873c0
cmpq $-0x1, %rcx
je 0x2d560b
movzbl (%rcx,%rdx), %edi
movq %rax, 0x3c8(%rsp,%rdi,8)
movzbl (%rcx,%rsi), %edi
movq %rax, 0x5c8(%rsp,%rdi,8)
addq %rax, %rax
decq %rcx
jmp 0x2d55e5
xorl %esi, %esi
pushq $0x8
popq %rbp
leaq 0x1689e9(%rip), %rax    # 0x43e000
leaq 0x168fe2(%rip), %rdx    # 0x43e600
leaq 0x168ddb(%rip), %rdi    # 0x43e400
leaq 0x1693d4(%rip), %r8     # 0x43ea00
movq %r12, 0x8(%rsp)
cmpl $0x40, %esi
jge 0x2d56d4
movl %esi, %ecx
andl $0x3, %ecx
movl %ebp, %ebx
movl %ebp, %r9d
shrl %cl, %r9d
movslq %esi, %r10
movl %esi, %r11d
sarl $0x3, %r11d
movslq %r11d, %r11
leal 0x3(%rsi), %r15d
movslq %r15d, %r15
movq %r11, %r12
shlq $0x6, %r12
shlq $0x7, %r11
xorl %r13d, %r13d
cmpq $0x10, %r13
je 0x2d56b7
testl %r13d, %r9d
je 0x2d56b2
movq 0x5d0(%rsp,%r10,8), %rbp
leaq (%r11,%r13,8), %r14
orq %rbp, (%rax,%r14)
movq 0x3d0(%rsp,%r10,8), %rbp
orq %rbp, (%rdx,%r14)
cmpq $0x7, %r13
ja 0x2d56b2
movq 0x5d0(%rsp,%r15,8), %r14
leaq (%r12,%r13,8), %rbp
orq %r14, (%rdi,%rbp)
movq 0x3d0(%rsp,%r15,8), %r14
orq %r14, (%r8,%rbp)
incq %r13
jmp 0x2d5669
leal 0x4(%rsi), %r9d
cmpl $0x3, %ecx
cmovnel %esi, %r9d
incl %r9d
movl %r9d, %esi
movq 0x8(%rsp), %r12
movl %ebx, %ebp
jmp 0x2d5631
leaq 0xf0(%rsp), %rdi
movl $0xe0, %edx
xorl %esi, %esi
callq 0x17380
leaq 0x10(%rsp), %rdi
movl $0xe0, %edx
xorl %esi, %esi
callq 0x17380
pushq $0x1
popq %rdx
pushq $0x18
popq %rcx
leaq 0xb1d09(%rip), %rax     # 0x38740f
cmpq $0x6, %rcx
jb 0x2d5754
leaq -0x6(%rcx), %rsi
xorl %r8d, %r8d
movq %rdx, %rdi
movzbl (%rax,%r8), %edx
movq %rdi, -0xd8(%rsp,%rdx,8)
movzbl -0x18(%rax,%r8), %edx
movq %rdi, 0xe8(%rsp,%rdx,8)
leaq (%rdi,%rdi), %rdx
leaq (%rcx,%r8), %r9
decq %r9
decq %r8
cmpq %rsi, %r9
jg 0x2d5713
shlq $0x3, %rdi
addq $-0x6, %rax
movq %rsi, %rcx
movq %rdi, %rdx
jmp 0x2d5706
xorl %eax, %eax
leaq 0x1694a3(%rip), %rdx    # 0x43ec00
leaq 0x16981c(%rip), %rsi    # 0x43ef80
cmpq $0x1c, %rax
je 0x2d57b0
movq %rax, %rdi
shlq $0x5, %rdi
andq $-0x80, %rdi
movl %eax, %ecx
andb $0x3, %cl
movl %ebp, %r8d
shrl %cl, %r8d
xorl %ecx, %ecx
cmpq $0x10, %rcx
je 0x2d57ab
testl %ecx, %r8d
je 0x2d57a6
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
jmp 0x2d5782
incq %rax
jmp 0x2d5764
leaq 0x169b49(%rip), %rax    # 0x43f300
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
cmpq $0x56, %rsi
je 0x2d580b
xorl %edi, %edi
cmpq $0x40, %rsi
setae %dil
shll $0x18, %edi
movl %ecx, %r8d
andl $0x10000, %r8d          # imm = 0x10000
movl %edx, %r9d
andl $0x100, %r9d            # imm = 0x100
movl %esi, %r10d
andl $0x1, %r10d
orq %rdi, %r10
orq %r8, %r10
orq %r9, %r10
movq %r10, (%rax)
incq %rsi
addq $0x8, %rax
addq $0x40, %rdx
addq $0x1000, %rcx           # imm = 0x1000
jmp 0x2d57bd
leaq 0x16ad9e(%rip), %rax    # 0x4405b0
xorl %ecx, %ecx
movl $0x1000000, %edx        # imm = 0x1000000
xorl %esi, %esi
xorl %edi, %edi
xorl %r8d, %r8d
cmpq $0x10, %r8
je 0x2d586e
movq %rcx, %r9
andq %rdx, %r9
movl %esi, %r10d
andl $0x10000, %r10d         # imm = 0x10000
orq %r9, %r10
movl %edi, %r9d
andl $0x100, %r9d            # imm = 0x100
orq %r10, %r9
xorl %r10d, %r10d
cmpq $0x8, %r8
setae %r10b
orq %r9, %r10
movq %r10, (%rax)
incq %r8
addq $0x8, %rax
addq $0x40, %rdi
addq $0x8000, %rsi           # imm = 0x8000
addq %rdx, %rcx
jmp 0x2d5820
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x40, %rcx
je 0x2d589c
movl %ecx, %edx
andl $0x20, %edx
movl %eax, %esi
andl $0x10, %esi
orl %edx, %esi
movl %ecx, %edx
shrl %edx
andl $0xf, %edx
orl %esi, %edx
movl %edx, 0x2d0(%rsp,%rcx,4)
incq %rcx
addl $0x10, %eax
jmp 0x2d5872
pushq $0x1
popq %rax
pushq $0x20
popq %rsi
leaq 0xb1d67(%rip), %rcx     # 0x387610
movq %rsi, %rdx
subq $0x1, %rdx
jb 0x2d58c7
movzbl -0x1(%rsi,%rcx), %esi
movq %rax, 0x1c8(%rsp,%rsi,8)
addq %rax, %rax
movq %rdx, %rsi
jmp 0x2d58ac
leaq 0x1d0(%rsp), %rax
xorl %ecx, %ecx
leaq 0xb1b38(%rip), %rdx     # 0x387410
leaq 0x169cd1(%rip), %rsi    # 0x43f5b0
cmpq $0x8, %rcx
je 0x2d593f
movq %rcx, %rdi
shlq $0x6, %rdi
addq %rdx, %rdi
movq %rcx, %r8
shlq $0x9, %r8
addq %rsi, %r8
xorl %r9d, %r9d
cmpq $0x40, %r9
je 0x2d5936
movslq 0x2d0(%rsp,%r9,4), %r10
movzbl (%r10,%rdi), %r10d
leaq (%r8,%r9,8), %r11
xorl %r15d, %r15d
cmpq $0x4, %r15
je 0x2d5931
testb $0x8, %r10b
je 0x2d5929
movq (%rax,%r15,8), %r14
orq %r14, (%r11)
addl %r10d, %r10d
incq %r15
jmp 0x2d5916
incq %r9
jmp 0x2d58fc
incq %rcx
addq $0x20, %rax
jmp 0x2d58df
movb $0x1, 0x1686aa(%rip)    # 0x43dff0
xorl %ecx, %ecx
leaq 0x1686b1(%rip), %rdx    # 0x43e000
leaq 0x168aaa(%rip), %rsi    # 0x43e400
leaq 0x168ca3(%rip), %rdi    # 0x43e600
leaq 0x16909c(%rip), %r8     # 0x43ea00
xorl %r9d, %r9d
xorl %eax, %eax
xorl %r10d, %r10d
cmpq $0x200, %r9             # imm = 0x200
je 0x2d59b5
movb (%r12), %r11b
sarb %r11b
movzbl %r11b, %r11d
movl %r11d, %r14d
andl $0x78, %r14d
addq %rcx, %r14
movq (%rdx,%r14), %r15
andl $0x7, %r11d
leaq (%r9,%r11,8), %r11
orq (%rsi,%r11), %r15
orq %r15, %r10
movq (%rdi,%r14), %r14
orq (%r8,%r11), %r14
orq %r14, %rax
addq $0x40, %r9
incq %r12
subq $-0x80, %rcx
jmp 0x2d596c
movq (%rsp), %rbx
addq $0x8, %rbx
xorl %edx, %edx
leaq 0xb19ca(%rip), %rsi     # 0x387390
movl $0xfffffff, %edi        # imm = 0xFFFFFFF
leaq 0x16922e(%rip), %r8     # 0x43ec00
leaq 0x1695a7(%rip), %r9     # 0x43ef80
cmpq $0x10, %rdx
je 0x2d5b1d
movb (%rdx,%rsi), %cl
shlq %cl, %r10
movl %r10d, %r14d
shrl $0x1c, %r14d
andl $0x3, %r14d
movq %r10, %r11
andq %rdi, %r11
orq %r14, %r11
movl %r11d, %r15d
andl $0xf, %r15d
movl %r10d, %r14d
shrl %r14d
andl $0x78, %r14d
movq 0x280(%r8,%r14), %r14
orq 0x300(%r8,%r15,8), %r14
movl %r10d, %r15d
shrl $0x5, %r15d
andl $0x78, %r15d
orq 0x200(%r8,%r15), %r14
movl %r10d, %r15d
shrl $0x9, %r15d
andl $0x78, %r15d
orq 0x180(%r8,%r15), %r14
movl %r10d, %r15d
shrl $0xd, %r15d
andl $0x78, %r15d
orq 0x100(%r8,%r15), %r14
movl %r10d, %r15d
shrl $0x11, %r15d
andl $0x78, %r15d
orq 0x80(%r8,%r15), %r14
shrl $0x15, %r10d
andl $0x78, %r10d
orq (%r10,%r8), %r14
movq %r14, -0x8(%rbx)
shlq %cl, %rax
movl %eax, %r10d
shrl $0x1c, %r10d
andl $0x3, %r10d
movq %rax, %rcx
andq %rdi, %rcx
orq %r10, %rcx
movl %ecx, %r14d
andl $0xf, %r14d
movl %eax, %r10d
shrl %r10d
andl $0x78, %r10d
movq 0x280(%r9,%r10), %r10
orq 0x300(%r9,%r14,8), %r10
movl %eax, %r14d
shrl $0x5, %r14d
andl $0x78, %r14d
orq 0x200(%r9,%r14), %r10
movl %eax, %r14d
shrl $0x9, %r14d
andl $0x78, %r14d
orq 0x180(%r9,%r14), %r10
movl %eax, %r14d
shrl $0xd, %r14d
andl $0x78, %r14d
orq 0x100(%r9,%r14), %r10
movl %eax, %r14d
shrl $0x11, %r14d
andl $0x78, %r14d
orq 0x80(%r9,%r14), %r10
shrl $0x15, %eax
andl $0x78, %eax
orq (%rax,%r9), %r10
movq %r10, (%rbx)
incq %rdx
addq $0x10, %rbx
movq %rcx, %rax
movq %r11, %r10
jmp 0x2d59d9
addq $0x7d8, %rsp            # imm = 0x7D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq