// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/xcrypt.c
// Function: des_init
static void des_init()
{
	int	i, j, b, k, inbit, obit;
	unsigned int	*p, *il, *ir, *fl, *fr;

	old_rawkey0 = old_rawkey1 = 0;
	saltbits = 0;
	old_salt = 0;
	bits24 = (bits28 = bits32 + 4) + 4;

	/*
	 * Invert the S-boxes, reordering the input bits.
	 */
	for (i = 0; i < 8; i++)
		for (j = 0; j < 64; j++) {
			b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
			u_sbox[i][j] = sbox[i][b];
		}

	/*
	 * Convert the inverted S-boxes into 4 arrays of 8 bits.
	 * Each will handle 12 bits of the S-box input.
	 */
	for (b = 0; b < 4; b++)
		for (i = 0; i < 64; i++)
			for (j = 0; j < 64; j++)
				m_sbox[b][(i << 6) | j] =
					(u_sbox[(b << 1)][i] << 4) |
					u_sbox[(b << 1) + 1][j];

	/*
	 * Set up the initial & final permutations into a useful form, and
	 * initialise the inverted key permutation.
	 */
	for (i = 0; i < 64; i++) {
		init_perm[final_perm[i] = IP[i] - 1] = i;
		inv_key_perm[i] = 255;
	}

	/*
	 * Invert the key permutation and initialise the inverted key
	 * compression permutation.
	 */
	for (i = 0; i < 56; i++) {
		inv_key_perm[key_perm[i] - 1] = i;
		inv_comp_perm[i] = 255;
	}

	/*
	 * Invert the key compression permutation.
	 */
	for (i = 0; i < 48; i++) {
		inv_comp_perm[comp_perm[i] - 1] = i;
	}

	/*
	 * Set up the OR-mask arrays for the initial and final permutations,
	 * and for the key initial and compression permutations.
	 */
	for (k = 0; k < 8; k++) {
		for (i = 0; i < 256; i++) {
			*(il = &ip_maskl[k][i]) = 0;
			*(ir = &ip_maskr[k][i]) = 0;
			*(fl = &fp_maskl[k][i]) = 0;
			*(fr = &fp_maskr[k][i]) = 0;
			for (j = 0; j < 8; j++) {
				inbit = 8 * k + j;
				if (i & bits8[j]) {
					if ((obit = init_perm[inbit]) < 32)
						*il |= bits32[obit];
					else
						*ir |= bits32[obit-32];
					if ((obit = final_perm[inbit]) < 32)
						*fl |= bits32[obit];
					else
						*fr |= bits32[obit - 32];
				}
			}
		}
		for (i = 0; i < 128; i++) {
			*(il = &key_perm_maskl[k][i]) = 0;
			*(ir = &key_perm_maskr[k][i]) = 0;
			for (j = 0; j < 7; j++) {
				inbit = 8 * k + j;
				if (i & bits8[j + 1]) {
					if ((obit = inv_key_perm[inbit]) == 255)
						continue;
					if (obit < 28)
						*il |= bits28[obit];
					else
						*ir |= bits28[obit - 28];
				}
			}
			*(il = &comp_maskl[k][i]) = 0;
			*(ir = &comp_maskr[k][i]) = 0;
			for (j = 0; j < 7; j++) {
				inbit = 7 * k + j;
				if (i & bits8[j + 1]) {
					if ((obit=inv_comp_perm[inbit]) == 255)
						continue;
					if (obit < 24)
						*il |= bits24[obit];
					else
						*ir |= bits24[obit - 24];
				}
			}
		}
	}

	/*
	 * Invert the P-box permutation, and convert into OR-masks for
	 * handling the output of the S-box arrays setup above.
	 */
	for (i = 0; i < 32; i++)
		un_pbox[pbox[i] - 1] = i;

	for (b = 0; b < 4; b++)
		for (i = 0; i < 256; i++) {
			*(p = &psbox[b][i]) = 0;
			for (j = 0; j < 8; j++) {
				if (i & bits8[j])
					*p |= bits32[un_pbox[8 * b + j]];
			}
		}

	des_initialised = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x0, 0x148fe(%rip)     # 0x3c9cc
movl $0x0, 0x148f8(%rip)     # 0x3c9d0
movl $0x0, 0x148f2(%rip)     # 0x3c9d4
movl $0x0, 0x148ec(%rip)     # 0x3c9d8
leaq 0xe5fd(%rip), %rax      # 0x366f0
addq $0x10, %rax
movq %rax, 0x148e2(%rip)     # 0x3c9e0
leaq 0xe5eb(%rip), %rax      # 0x366f0
addq $0x10, %rax
addq $0x10, %rax
movq %rax, 0x148d4(%rip)     # 0x3c9e8
movl $0x0, -0x4(%rbp)
cmpl $0x8, -0x4(%rbp)
jge 0x28196
movl $0x0, -0x8(%rbp)
cmpl $0x40, -0x8(%rbp)
jge 0x28189
movl -0x8(%rbp), %eax
andl $0x20, %eax
movl -0x8(%rbp), %ecx
andl $0x1, %ecx
shll $0x4, %ecx
orl %ecx, %eax
movl -0x8(%rbp), %ecx
sarl %ecx
andl $0xf, %ecx
orl %ecx, %eax
movl %eax, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xe619(%rip), %rax      # 0x36770
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0xc(%rbp), %rcx
movb (%rax,%rcx), %dl
movslq -0x4(%rbp), %rcx
leaq 0x14880(%rip), %rax     # 0x3c9f0
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x28128
jmp 0x2818b
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x2811b
movl $0x0, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jge 0x28257
movl $0x0, -0x4(%rbp)
cmpl $0x40, -0x4(%rbp)
jge 0x28247
movl $0x0, -0x8(%rbp)
cmpl $0x40, -0x8(%rbp)
jge 0x28237
movl -0xc(%rbp), %eax
shll %eax
movslq %eax, %rcx
leaq 0x1481c(%rip), %rax     # 0x3c9f0
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movzbl (%rax,%rcx), %eax
shll $0x4, %eax
movl -0xc(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x147f8(%rip), %rcx     # 0x3c9f0
shlq $0x6, %rdx
addq %rdx, %rcx
movslq -0x8(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movb %al, %dl
movslq -0xc(%rbp), %rcx
leaq 0x149da(%rip), %rax     # 0x3cbf0
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x4(%rbp), %ecx
shll $0x6, %ecx
orl -0x8(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x281bf
jmp 0x28239
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x281ae
jmp 0x28249
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2819d
movl $0x0, -0x4(%rbp)
cmpl $0x40, -0x4(%rbp)
jge 0x282b2
movl -0x4(%rbp), %eax
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0xe6fc(%rip), %rax      # 0x36970
movzbl (%rax,%rcx), %eax
subl $0x1, %eax
movslq -0x4(%rbp), %rsi
leaq 0x189aa(%rip), %rcx     # 0x40c30
movb %al, (%rcx,%rsi)
movzbl %al, %eax
movl %eax, %ecx
leaq 0x1895b(%rip), %rax     # 0x40bf0
movb %dl, (%rax,%rcx)
movslq -0x4(%rbp), %rcx
leaq 0x189cd(%rip), %rax     # 0x40c70
movb $-0x1, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x2825e
movl $0x0, -0x4(%rbp)
cmpl $0x38, -0x4(%rbp)
jge 0x282fd
movl -0x4(%rbp), %eax
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0xe6e1(%rip), %rax      # 0x369b0
movzbl (%rax,%rcx), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x18990(%rip), %rax     # 0x40c70
movb %dl, (%rax,%rcx)
movslq -0x4(%rbp), %rcx
leaq 0x189c2(%rip), %rax     # 0x40cb0
movb $-0x1, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x282b9
movl $0x0, -0x4(%rbp)
cmpl $0x30, -0x4(%rbp)
jge 0x28339
movl -0x4(%rbp), %eax
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0xe6d6(%rip), %rax      # 0x369f0
movzbl (%rax,%rcx), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x18985(%rip), %rax     # 0x40cb0
movb %dl, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x28304
movl $0x0, -0x10(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0x28732
movl $0x0, -0x4(%rbp)
cmpl $0x100, -0x4(%rbp)      # imm = 0x100
jge 0x28506
movslq -0x10(%rbp), %rcx
leaq 0x18987(%rip), %rax     # 0x40cf0
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x28(%rbp)
movl $0x0, (%rax,%rcx,4)
movslq -0x10(%rbp), %rcx
leaq 0x1a959(%rip), %rax     # 0x42cf0
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x30(%rbp)
movl $0x0, (%rax,%rcx,4)
movslq -0x10(%rbp), %rcx
leaq 0x1c92b(%rip), %rax     # 0x44cf0
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x38(%rbp)
movl $0x0, (%rax,%rcx,4)
movslq -0x10(%rbp), %rcx
leaq 0x1e8fd(%rip), %rax     # 0x46cf0
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x40(%rbp)
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x8(%rbp)
cmpl $0x8, -0x8(%rbp)
jge 0x284f6
movl -0x10(%rbp), %eax
shll $0x3, %eax
addl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x4(%rbp), %eax
movslq -0x8(%rbp), %rdx
leaq 0xe5df(%rip), %rcx      # 0x36a20
movzbl (%rcx,%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x284e6
movslq -0x14(%rbp), %rcx
leaq 0x18795(%rip), %rax     # 0x40bf0
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
cmpl $0x20, %eax
jge 0x2847f
movslq -0x18(%rbp), %rcx
leaq 0xe27e(%rip), %rax      # 0x366f0
movl (%rax,%rcx,4), %ecx
movq -0x28(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x2849a
movl -0x18(%rbp), %eax
subl $0x20, %eax
movslq %eax, %rcx
leaq 0xe261(%rip), %rax      # 0x366f0
movl (%rax,%rcx,4), %ecx
movq -0x30(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movslq -0x14(%rbp), %rcx
leaq 0x1878b(%rip), %rax     # 0x40c30
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
cmpl $0x20, %eax
jge 0x284c9
movslq -0x18(%rbp), %rcx
leaq 0xe234(%rip), %rax      # 0x366f0
movl (%rax,%rcx,4), %ecx
movq -0x38(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x284e4
movl -0x18(%rbp), %eax
subl $0x20, %eax
movslq %eax, %rcx
leaq 0xe217(%rip), %rax      # 0x366f0
movl (%rax,%rcx,4), %ecx
movq -0x40(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x284e6
jmp 0x284e8
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2841d
jmp 0x284f8
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x28351
movl $0x0, -0x4(%rbp)
cmpl $0x80, -0x4(%rbp)
jge 0x28722
movslq -0x10(%rbp), %rcx
leaq 0x207cb(%rip), %rax     # 0x48cf0
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x28(%rbp)
movl $0x0, (%rax,%rcx,4)
movslq -0x10(%rbp), %rcx
leaq 0x2179d(%rip), %rax     # 0x49cf0
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x30(%rbp)
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x8(%rbp)
cmpl $0x7, -0x8(%rbp)
jge 0x28617
movl -0x10(%rbp), %eax
shll $0x3, %eax
addl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x4(%rbp), %eax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0xe47a(%rip), %rcx      # 0x36a20
movzbl (%rcx,%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x28607
movslq -0x14(%rbp), %rcx
leaq 0x186b4(%rip), %rax     # 0x40c70
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
cmpl $0xff, %eax
jne 0x285cc
jmp 0x28609
cmpl $0x1c, -0x18(%rbp)
jge 0x285ea
movq 0x14407(%rip), %rax     # 0x3c9e0
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x28(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x28605
movq 0x143ef(%rip), %rax     # 0x3c9e0
movl -0x18(%rbp), %ecx
subl $0x1c, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x30(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x28607
jmp 0x28609
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2857d
movslq -0x10(%rbp), %rcx
leaq 0x226ce(%rip), %rax     # 0x4acf0
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x28(%rbp)
movl $0x0, (%rax,%rcx,4)
movslq -0x10(%rbp), %rcx
leaq 0x236a0(%rip), %rax     # 0x4bcf0
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x30(%rbp)
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x8(%rbp)
cmpl $0x7, -0x8(%rbp)
jge 0x28712
imull $0x7, -0x10(%rbp), %eax
addl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x4(%rbp), %eax
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0xe37f(%rip), %rcx      # 0x36a20
movzbl (%rcx,%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x28702
movslq -0x14(%rbp), %rcx
leaq 0x185f9(%rip), %rax     # 0x40cb0
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
cmpl $0xff, %eax
jne 0x286c7
jmp 0x28704
cmpl $0x18, -0x18(%rbp)
jge 0x286e5
movq 0x14314(%rip), %rax     # 0x3c9e8
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x28(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x28700
movq 0x142fc(%rip), %rax     # 0x3c9e8
movl -0x18(%rbp), %ecx
subl $0x18, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x30(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x28702
jmp 0x28704
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2867a
jmp 0x28714
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x2850d
jmp 0x28724
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x28340
movl $0x0, -0x4(%rbp)
cmpl $0x20, -0x4(%rbp)
jge 0x2876e
movl -0x4(%rbp), %eax
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0xe2e1(%rip), %rax      # 0x36a30
movzbl (%rax,%rcx), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x24590(%rip), %rax     # 0x4ccf0
movb %dl, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x28739
movl $0x0, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jge 0x2883f
movl $0x0, -0x4(%rbp)
cmpl $0x100, -0x4(%rbp)      # imm = 0x100
jge 0x2882f
movslq -0xc(%rbp), %rcx
leaq 0x24572(%rip), %rax     # 0x4cd10
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x4(%rbp), %rcx
movq %rcx, %rsi
shlq $0x2, %rsi
movq %rax, %rdx
addq %rsi, %rdx
movq %rdx, -0x20(%rbp)
movl $0x0, (%rax,%rcx,4)
movl $0x0, -0x8(%rbp)
cmpl $0x8, -0x8(%rbp)
jge 0x2881f
movl -0x4(%rbp), %eax
movslq -0x8(%rbp), %rdx
leaq 0xe244(%rip), %rcx      # 0x36a20
movzbl (%rcx,%rdx), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x28812
movl -0xc(%rbp), %eax
shll $0x3, %eax
addl -0x8(%rbp), %eax
movslq %eax, %rcx
leaq 0x244f6(%rip), %rax     # 0x4ccf0
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0xdee9(%rip), %rax      # 0x366f0
movl (%rax,%rcx,4), %ecx
movq -0x20(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x28814
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x287c8
jmp 0x28821
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x28786
jmp 0x28831
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x28775
movl $0x1, 0x1417f(%rip)     # 0x3c9c8
popq %rbp
retq