// File: /workspace/github_cpp_makefile_star2_O3/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 0x595a
leaq (%r14,%r15,4), %rax
movl $0x1, %ecx
movl %ecx, %edx
movl (%r14), %edi
leal -0x1(%rdi), %ecx
cmpl $0x1fffe, %ecx          # imm = 0x1FFFE
ja 0x58fd
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 0x5790
movl %edx, %ecx
subl %r8d, %ecx
cmpl $0xc1, %ecx
jg 0x591c
testl %edx, %edx
js 0x5811
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 0x5801
movw %r9w, (%rbx,%r11,2)
testl %r8d, %r8d
jle 0x5801
movl $0x1, %r12d
xorl %ebp, %ebp
btl %r12d, %edi
setb %bpl
xorw %bp, (%r10,%r12,2)
incq %r12
cmpq %r12, %r15
jne 0x57ea
leaq -0x1(%r11), %r12
addq $-0x2, %r10
testq %r11, %r11
movq %r12, %r11
jg 0x57d2
addq $0x4, %r14
cmpq %rax, %r14
jne 0x5766
subl %edx, %esi
cmpl $0xffffff3e, %esi       # imm = 0xFFFFFF3E
jne 0x595a
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 0xb4c2
addq $-0x2, %r15
jne 0x5846
testw %ax, %ax
jne 0x593b
movq %r14, %rdi
movl $0x1, %esi
callq 0xb540
incl %ebp
cmpl $0x18, %ebp
jne 0x5839
movq 0xcf756(%rip), %r14     # 0xd4fd8
leaq 0x8cca(%rip), %rsi      # 0xe553
movl $0xb, %edx
movq %r14, %rdi
callq 0x2190
xorl %r12d, %r12d
leaq 0x93d7(%rip), %r15      # 0xec77
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 0x58a0
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 0x8b17(%rip), %rdi      # 0xe41b
leaq 0x8b2a(%rip), %rsi      # 0xe435
leaq 0xa635(%rip), %rcx      # 0xff47
movl $0x20, %edx
callq 0x20c0
leaq 0x8bea(%rip), %rdi      # 0xe50d
leaq 0x8b0b(%rip), %rsi      # 0xe435
leaq 0xa616(%rip), %rcx      # 0xff47
movl $0x24, %edx
callq 0x20c0
leaq 0x8c0c(%rip), %rdi      # 0xe54e
leaq 0x8aec(%rip), %rsi      # 0xe435
leaq 0xa5f7(%rip), %rcx      # 0xff47
movl $0x35, %edx
callq 0x20c0
leaq 0x8bd2(%rip), %rdi      # 0xe533
leaq 0x8acd(%rip), %rsi      # 0xe435
leaq 0xa5d8(%rip), %rcx      # 0xff47
movl $0x2e, %edx
callq 0x20c0