// File: /workspace/github_c_makefile_star2_O0/janmojzis[P]mcencrypt/encrypt.c
// Function: gen_e
static void gen_e(unsigned char *e)
{
	int i, j, eq;

	uint16_t ind[ SYS_T ];
	uint64_t e_int[ SYS_N/64 ];	
	uint64_t one = 1;	
	uint64_t mask;	
	uint64_t val[ SYS_T ];	

	while (1)
	{
		randombytes((unsigned char *) ind, sizeof(ind));

		for (i = 0; i < SYS_T; i++)
			ind[i] &= GFMASK;

		eq = 0;

		for (i = 1; i < SYS_T; i++) for (j = 0; j < i; j++)
			if (ind[i] == ind[j]) 
				eq = 1;

		if (eq == 0)
			break;
	}

	for (j = 0; j < SYS_T; j++)
		val[j] = one << (ind[j] & 63);

	for (i = 0; i < SYS_N/64; i++) 
	{
		e_int[i] = 0;

		for (j = 0; j < SYS_T; j++)
		{
			mask = i ^ (ind[j] >> 6);
			mask -= 1;
			mask >>= 63;
			mask = -mask;

			e_int[i] |= val[j] & mask;
		}
	}

	for (i = 0; i < SYS_N/64; i++)
		store8(e + i*8, e_int[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x930, %rsp            # imm = 0x930
movq %rdi, -0x8(%rbp)
movq $0x1, -0x528(%rbp)
leaq -0x120(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xd3b0
movl $0x0, -0xc(%rbp)
cmpl $0x80, -0xc(%rbp)
jge 0xafb0
movslq -0xc(%rbp), %rax
movzwl -0x120(%rbp,%rax,2), %ecx
andl $0x1fff, %ecx           # imm = 0x1FFF
movw %cx, -0x120(%rbp,%rax,2)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xaf82
movl $0x0, -0x14(%rbp)
movl $0x1, -0xc(%rbp)
cmpl $0x80, -0xc(%rbp)
jge 0xb013
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xb006
movslq -0xc(%rbp), %rax
movzwl -0x120(%rbp,%rax,2), %eax
movslq -0x10(%rbp), %rcx
movzwl -0x120(%rbp,%rcx,2), %ecx
cmpl %ecx, %eax
jne 0xaff9
movl $0x1, -0x14(%rbp)
jmp 0xaffb
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xafce
jmp 0xb008
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xafbe
cmpl $0x0, -0x14(%rbp)
jne 0xb01b
jmp 0xb020
jmp 0xaf6a
movl $0x0, -0x10(%rbp)
cmpl $0x80, -0x10(%rbp)
jge 0xb065
movq -0x528(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzwl -0x120(%rbp,%rcx,2), %ecx
andl $0x3f, %ecx
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, %rcx
movslq -0x10(%rbp), %rax
movq %rcx, -0x930(%rbp,%rax,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb027
movl $0x0, -0xc(%rbp)
cmpl $0x80, -0xc(%rbp)
jge 0xb133
movslq -0xc(%rbp), %rax
movq $0x0, -0x520(%rbp,%rax,8)
movl $0x0, -0x10(%rbp)
cmpl $0x80, -0x10(%rbp)
jge 0xb123
movl -0xc(%rbp), %eax
movslq -0x10(%rbp), %rcx
movzwl -0x120(%rbp,%rcx,2), %ecx
sarl $0x6, %ecx
xorl %ecx, %eax
cltq
movq %rax, -0x530(%rbp)
movq -0x530(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x530(%rbp)
movq -0x530(%rbp), %rax
shrq $0x3f, %rax
movq %rax, -0x530(%rbp)
xorl %eax, %eax
subq -0x530(%rbp), %rax
movq %rax, -0x530(%rbp)
movslq -0x10(%rbp), %rax
movq -0x930(%rbp,%rax,8), %rcx
andq -0x530(%rbp), %rcx
movslq -0xc(%rbp), %rax
orq -0x520(%rbp,%rax,8), %rcx
movq %rcx, -0x520(%rbp,%rax,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb090
jmp 0xb125
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb06c
movl $0x0, -0xc(%rbp)
cmpl $0x80, -0xc(%rbp)
jge 0xb16e
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
shll $0x3, %eax
cltq
addq %rax, %rdi
movslq -0xc(%rbp), %rax
movq -0x520(%rbp,%rax,8), %rsi
callq 0xde30
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb13a
addq $0x930, %rsp            # imm = 0x930
popq %rbp
retq
nopw (%rax,%rax)