// File: /workspace/github_c_makefile_star2_O0/janmojzis[P]mcencrypt/encrypt.c
// Function: syndrome
void syndrome(unsigned char *s, const unsigned char *pk, unsigned char *e)
{
	unsigned char b, row[SYS_N/8];
	const unsigned char *pk_ptr = pk;

	int i, j;

	for (i = 0; i < SYND_BYTES; i++)
		s[i] = 0;

	for (i = 0; i < PK_NROWS; i++)	
	{
		for (j = 0; j < SYS_N/8; j++) 
			row[j] = 0;

		for (j = 0; j < PK_ROW_BYTES; j++) 
			row[ SYS_N/8 - PK_ROW_BYTES + j ] = pk_ptr[j];

		row[i/8] |= 1 << (i%8);
		
		b = 0;
		for (j = 0; j < SYS_N/8; j++)
			b ^= row[j] & e[j];

		b ^= b >> 4;
		b ^= b >> 2;
		b ^= b >> 1;
		b &= 1;

		s[ i/8 ] |= (b << (i%8));

		pk_ptr += PK_ROW_BYTES;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3c0, %rsp            # imm = 0x3C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x428(%rbp)
movl $0x0, -0x42c(%rbp)
cmpl $0xd0, -0x42c(%rbp)
jge 0xad28
movq -0x8(%rbp), %rax
movslq -0x42c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x42c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42c(%rbp)
jmp 0xacfc
movl $0x0, -0x42c(%rbp)
cmpl $0x680, -0x42c(%rbp)    # imm = 0x680
jge 0xaf01
movl $0x0, -0x430(%rbp)
cmpl $0x400, -0x430(%rbp)    # imm = 0x400
jge 0xad78
movslq -0x430(%rbp), %rax
movb $0x0, -0x420(%rbp,%rax)
movl -0x430(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x430(%rbp)
jmp 0xad4c
movl $0x0, -0x430(%rbp)
cmpl $0x330, -0x430(%rbp)    # imm = 0x330
jge 0xadc4
movq -0x428(%rbp), %rax
movslq -0x430(%rbp), %rcx
movb (%rax,%rcx), %cl
movl -0x430(%rbp), %eax
addl $0xd0, %eax
cltq
movb %cl, -0x420(%rbp,%rax)
movl -0x430(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x430(%rbp)
jmp 0xad82
movl -0x42c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %edx, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x434(%rbp)
movl -0x42c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl -0x434(%rbp), %edx
cltq
movzbl -0x420(%rbp,%rax), %ecx
orl %edx, %ecx
movb %cl, -0x420(%rbp,%rax)
movb $0x0, -0x19(%rbp)
movl $0x0, -0x430(%rbp)
cmpl $0x400, -0x430(%rbp)    # imm = 0x400
jge 0xae5c
movslq -0x430(%rbp), %rax
movzbl -0x420(%rbp,%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x430(%rbp), %rdx
movzbl (%rax,%rdx), %eax
andl %eax, %ecx
movzbl -0x19(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x19(%rbp)
movl -0x430(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x430(%rbp)
jmp 0xae16
movzbl -0x19(%rbp), %ecx
sarl $0x4, %ecx
movzbl -0x19(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %ecx
sarl $0x2, %ecx
movzbl -0x19(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %ecx
sarl %ecx
movzbl -0x19(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
andl $0x1, %eax
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %esi
movl -0x42c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %edx, %ecx
shll %cl, %esi
movq -0x8(%rbp), %rax
movq %rax, -0x440(%rbp)
movl -0x42c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x440(%rbp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
orl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x428(%rbp), %rax
addq $0x330, %rax            # imm = 0x330
movq %rax, -0x428(%rbp)
movl -0x42c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42c(%rbp)
jmp 0xad32
addq $0x3c0, %rsp            # imm = 0x3C0
popq %rbp
retq
nopw (%rax,%rax)