// File: /workspace/github_cpp_makefile_star2_O1/xdsopl[P]FEC/./bose_chaudhuri_hocquenghem.hh
// Function: BoseChaudhuriHocquenghem<24, 1, 65343, GF::Types<16, 65581, unsigned short>>::BoseChaudhuriHocquenghem(std::initializer_list<int>)
BoseChaudhuriHocquenghem(std::initializer_list<int> minimal_polynomials)
	{
		// $generator(x) = \prod_i(minpoly_i(x))$
		int generator_degree = 1;
		generator[0] = ValueType(1);
		for (int i = 1; i <= NP; ++i)
			generator[i] = ValueType(0);
		for (auto m: minimal_polynomials) {
			assert(0 < m && m < 1<<(GF::M+1));
			int m_degree = GF::M;
			while (!(m>>m_degree))
				--m_degree;
			assert(generator_degree + m_degree <= NP + 1);
			for (int i = generator_degree; i >= 0; --i) {
				if (!generator[i])
					continue;
				generator[i] = ValueType(m&1);
				for (int j = 1; j <= m_degree; ++j)
					generator[i+j] += ValueType((m>>j)&1);
			}
			generator_degree += m_degree;
		}
		assert(generator_degree == NP + 1);
#ifndef NDEBUG
		IndexType root(FCR), pe(1);
		for (int i = 0; i < NR; ++i) {
			ValueType tmp(generator[NP]);
			for (int j = 1; j <= NP; ++j)
				tmp = fma(root, tmp, generator[NP-j]);
			assert(!tmp);
			root *= pe;
		}
		std::cout << "generator =";
		for (int i = 0; i <= NP; ++i)
			std::cout << " " << (int)generator[i];
		std::cout << std::endl;
#endif
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movw $0x1, (%rdi)
addq $0x2, %rdi
movl $0x180, %edx            # imm = 0x180
xorl %esi, %esi
callq 0x20b0
testq %r15, %r15
je 0x58f0
leaq (%r14,%r15,4), %rax
movl $0x1, %ecx
movl %ecx, %edx
movl (%r14), %edi
leal -0x1(%rdi), %ecx
cmpl $0x1fffe, %ecx          # imm = 0x1FFFE
ja 0x5893
movl $0x10, %ecx
movl $0xffffffee, %esi       # imm = 0xFFFFFFEE
movl $0xffffffef, %r8d       # imm = 0xFFFFFFEF
movl $0x11, %r9d
movl %r9d, %r15d
movl %edi, %r10d
shrl %cl, %r10d
decl %ecx
incl %esi
incl %r8d
leal -0x1(%r15), %r9d
testl %r10d, %r10d
je 0x5726
movl %edx, %ecx
subl %r8d, %ecx
cmpl $0xc1, %ecx
jg 0x58b2
testl %edx, %edx
js 0x57a7
negl %r8d
movl %edi, %r9d
andl $0x1, %r9d
movl %edx, %r11d
leaq (%rbx,%r11,2), %r10
movl %r15d, %r15d
cmpw $0x0, (%rbx,%r11,2)
je 0x5797
movw %r9w, (%rbx,%r11,2)
testl %r8d, %r8d
jle 0x5797
movl $0x1, %r12d
xorl %ebp, %ebp
btl %r12d, %edi
setb %bpl
xorw %bp, (%r10,%r12,2)
incq %r12
cmpq %r12, %r15
jne 0x5780
leaq -0x1(%r11), %r12
addq $-0x2, %r10
testq %r11, %r11
movq %r12, %r11
jg 0x5768
addq $0x4, %r14
cmpq %rax, %r14
jne 0x56fc
subl %edx, %esi
cmpl $0xffffff3e, %esi       # imm = 0xFFFFFF3E
jne 0x58f0
leaq 0xe(%rsp), %r14
movw $0x1, (%r14)
xorl %ebp, %ebp
movzwl 0x180(%rbx), %eax
movl $0x180, %r15d           # imm = 0x180
movzwl -0x2(%rbx,%r15), %edx
movzwl 0xe(%rsp), %edi
movl %eax, %esi
callq 0xb34c
addq $-0x2, %r15
jne 0x57dc
testw %ax, %ax
jne 0x58d1
movq %r14, %rdi
movl $0x1, %esi
callq 0xb3ca
incl %ebp
cmpl $0x18, %ebp
jne 0x57cf
movq 0xcf7c0(%rip), %r14     # 0xd4fd8
leaq 0x8c84(%rip), %rsi      # 0xe4a3
movl $0xb, %edx
movq %r14, %rdi
callq 0x2190
xorl %r12d, %r12d
leaq 0x9391(%rip), %r15      # 0xebc7
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
movzwl (%rbx,%r12,2), %esi
movq %r14, %rdi
callq 0x2200
incq %r12
cmpq $0xc1, %r12
jne 0x5836
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8ad1(%rip), %rdi      # 0xe36b
leaq 0x8ae4(%rip), %rsi      # 0xe385
leaq 0xa5ef(%rip), %rcx      # 0xfe97
movl $0x20, %edx
callq 0x20c0
leaq 0x8ba4(%rip), %rdi      # 0xe45d
leaq 0x8ac5(%rip), %rsi      # 0xe385
leaq 0xa5d0(%rip), %rcx      # 0xfe97
movl $0x24, %edx
callq 0x20c0
leaq 0x8bc6(%rip), %rdi      # 0xe49e
leaq 0x8aa6(%rip), %rsi      # 0xe385
leaq 0xa5b1(%rip), %rcx      # 0xfe97
movl $0x35, %edx
callq 0x20c0
leaq 0x8b8c(%rip), %rdi      # 0xe483
leaq 0x8a87(%rip), %rsi      # 0xe385
leaq 0xa592(%rip), %rcx      # 0xfe97
movl $0x2e, %edx
callq 0x20c0