// File: xdsopl[P]FEC/./reed_solomon.hh
// Function: ReedSolomon<4, 0, GF::Types<4, 19, unsigned char>>::encode(GF::Value<4, 19, unsigned char>*)
void encode(ValueType *code)
	{
		// $code = data * x^{NR} + (data * x^{NR}) \mod{generator}$
		for (int i = 0; i < NR; ++i)
			code[K+i] = ValueType(0);
		for (int i = 0; i < K; ++i) {
			ValueType feedback = code[i] + code[K];
			if (feedback) {
				IndexType fb = index(feedback);
				for (int j = 1; j < NR; ++j)
					code[K+j-1] = fma(fb, generator[NR-j], code[K+j]);
				code[N-1] = value(generator[0] * fb);
			} else {
				for (int j = 1; j < NR; ++j)
					code[K+j-1] = code[K+j];
				code[N-1] = ValueType(0);
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0xecce
leaq -0x15(%rbp), %rdi
xorl %esi, %esi
callq 0xbc30
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0xb, %ecx
movslq %ecx, %rcx
movb -0x15(%rbp), %dl
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xec9f
movl $0x0, -0x1c(%rbp)
cmpl $0xb, -0x1c(%rbp)
jge 0xee3a
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x1e(%rbp)
movq -0x10(%rbp), %rax
movb 0xb(%rax), %al
movb %al, -0x1f(%rbp)
movb -0x1e(%rbp), %al
movzbl %al, %edi
movzbl -0x1f(%rbp), %esi
callq 0xc000
movb %al, -0x1d(%rbp)
leaq -0x1d(%rbp), %rdi
callq 0xbce0
testb $0x1, %al
jne 0xed1b
jmp 0xedda
movb -0x1d(%rbp), %al
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %edi
callq 0xc200
movb %al, -0x20(%rbp)
movl $0x1, -0x28(%rbp)
cmpl $0x4, -0x28(%rbp)
jge 0xeda1
movq -0x40(%rbp), %rax
movb -0x20(%rbp), %cl
movb %cl, -0x2a(%rbp)
movl $0x4, %ecx
subl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x2b(%rbp)
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0xb, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x2c(%rbp)
movb -0x2a(%rbp), %cl
movb -0x2b(%rbp), %al
movzbl %cl, %edi
movzbl %al, %esi
movzbl -0x2c(%rbp), %edx
callq 0xee40
movb %al, -0x29(%rbp)
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0xb, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb -0x29(%rbp), %dl
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xed34
movq -0x40(%rbp), %rax
movb (%rax), %al
movb %al, -0x2f(%rbp)
movb -0x20(%rbp), %al
movb %al, -0x30(%rbp)
movb -0x2f(%rbp), %al
movzbl %al, %edi
movzbl -0x30(%rbp), %esi
callq 0xc110
movb %al, -0x2e(%rbp)
movzbl -0x2e(%rbp), %edi
callq 0xc0a0
movb %al, -0x2d(%rbp)
movq -0x10(%rbp), %rax
movb -0x2d(%rbp), %cl
movb %cl, 0xe(%rax)
jmp 0xee2a
movl $0x1, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jge 0xee15
movq -0x10(%rbp), %rdx
movl -0x34(%rbp), %eax
addl $0xb, %eax
movslq %eax, %rsi
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0xb, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb (%rdx,%rsi), %dl
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xede1
leaq -0x35(%rbp), %rdi
xorl %esi, %esi
callq 0xbc30
movq -0x10(%rbp), %rax
movb -0x35(%rbp), %cl
movb %cl, 0xe(%rax)
jmp 0xee2c
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xecd5
addq $0x40, %rsp
popq %rbp
retq