// File: xdsopl[P]FEC/./bose_chaudhuri_hocquenghem.hh
// Function: BoseChaudhuriHocquenghem<6, 1, 5, GF::Types<4, 19, unsigned char>>::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
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rax, %rcx
addq $0xb, %rcx
movq %rcx, -0x80(%rbp)
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0xbc20
movq -0x90(%rbp), %rax
movq -0x80(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x78(%rbp)
jne 0x3021
movl $0x1, -0x1c(%rbp)
leaq -0x1d(%rbp), %rdi
movl $0x1, %esi
callq 0xbc30
movq -0x88(%rbp), %rax
movb -0x1d(%rbp), %cl
movb %cl, (%rax)
movl $0x1, -0x24(%rbp)
cmpl $0xa, -0x24(%rbp)
jg 0x309e
leaq -0x25(%rbp), %rdi
xorl %esi, %esi
callq 0xbc30
movq -0x88(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb -0x25(%rbp), %dl
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3071
leaq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xbc80
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0xbca0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x3239
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl -0x44(%rbp), %ecx
movb %al, -0x91(%rbp)
jge 0x30f3
cmpl $0x20, -0x44(%rbp)
setl %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x30ff
jmp 0x3101
jmp 0x3120
leaq 0x16263(%rip), %rdi     # 0x1936b
leaq 0x16276(%rip), %rsi     # 0x19385
movl $0x20, %edx
leaq 0x1628a(%rip), %rcx     # 0x193a5
callq 0x2100
movl $0x4, -0x48(%rbp)
movl -0x44(%rbp), %eax
movl -0x48(%rbp), %ecx
sarl %cl, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x313d
jmp 0x3148
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3127
movl -0x1c(%rbp), %eax
addl -0x48(%rbp), %eax
cmpl $0xb, %eax
jg 0x3155
jmp 0x3174
leaq 0x16301(%rip), %rdi     # 0x1945d
leaq 0x16222(%rip), %rsi     # 0x19385
movl $0x24, %edx
leaq 0x16236(%rip), %rcx     # 0x193a5
callq 0x2100
movl -0x1c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x321f
movq -0x88(%rbp), %rdi
movslq -0x4c(%rbp), %rax
addq %rax, %rdi
callq 0xbce0
testb $0x1, %al
jne 0x319d
jmp 0x3211
movl -0x44(%rbp), %eax
andl $0x1, %eax
leaq -0x4d(%rbp), %rdi
movzbl %al, %esi
callq 0xbc30
movq -0x88(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movb -0x4d(%rbp), %dl
movb %dl, (%rax,%rcx)
movl $0x1, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x48(%rbp), %eax
jg 0x320f
movl -0x44(%rbp), %eax
movl -0x54(%rbp), %ecx
sarl %cl, %eax
andl $0x1, %eax
leaq -0x55(%rbp), %rdi
movzbl %al, %esi
callq 0xbc30
movq -0x88(%rbp), %rdi
movl -0x4c(%rbp), %eax
addl -0x54(%rbp), %eax
cltq
addq %rax, %rdi
movzbl -0x55(%rbp), %esi
callq 0xbd00
movb %al, -0x56(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x31c7
jmp 0x3211
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x317a
movl -0x48(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
jmp 0x30c0
cmpl $0xb, -0x1c(%rbp)
jne 0x3241
jmp 0x3260
leaq 0x1623b(%rip), %rdi     # 0x19483
leaq 0x16136(%rip), %rsi     # 0x19385
movl $0x2e, %edx
leaq 0x1614a(%rip), %rcx     # 0x193a5
callq 0x2100
leaq -0x57(%rbp), %rdi
movl $0x1, %esi
callq 0xbd80
leaq -0x58(%rbp), %rdi
movl $0x1, %esi
callq 0xbd80
movl $0x0, -0x5c(%rbp)
cmpl $0x6, -0x5c(%rbp)
jge 0x334a
movq -0x88(%rbp), %rax
movb 0xa(%rax), %al
movb %al, -0x5d(%rbp)
movl $0x1, -0x64(%rbp)
cmpl $0xa, -0x64(%rbp)
jg 0x32f4
movq -0x88(%rbp), %rax
movb -0x57(%rbp), %cl
movb %cl, -0x66(%rbp)
movb -0x5d(%rbp), %cl
movb %cl, -0x67(%rbp)
movl $0xa, %ecx
subl -0x64(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x68(%rbp)
movb -0x66(%rbp), %cl
movb -0x67(%rbp), %al
movzbl %cl, %edi
movzbl %al, %esi
movzbl -0x68(%rbp), %edx
callq 0xbde0
movb %al, -0x65(%rbp)
movb -0x65(%rbp), %al
movb %al, -0x5d(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x32a1
leaq -0x5d(%rbp), %rdi
callq 0xbce0
xorb $-0x1, %al
testb $0x1, %al
jne 0x3305
jmp 0x3307
jmp 0x3326
leaq 0x16190(%rip), %rdi     # 0x1949e
leaq 0x16070(%rip), %rsi     # 0x19385
movl $0x35, %edx
leaq 0x16084(%rip), %rcx     # 0x193a5
callq 0x2100
movb -0x58(%rbp), %al
movb %al, -0x69(%rbp)
leaq -0x57(%rbp), %rdi
movzbl -0x69(%rbp), %esi
callq 0xbef0
movb %al, -0x6a(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x3283
movq 0xdec87(%rip), %rdi     # 0xe1fd8
leaq 0x1614b(%rip), %rsi     # 0x194a3
callq 0x21b0
movl $0x0, -0x70(%rbp)
cmpl $0xa, -0x70(%rbp)
jg 0x33b0
movq 0xdec67(%rip), %rdi     # 0xe1fd8
leaq 0x1684f(%rip), %rsi     # 0x19bc7
callq 0x21b0
movq -0x88(%rbp), %rdi
movq %rax, -0xa0(%rbp)
movslq -0x70(%rbp), %rax
addq %rax, %rdi
callq 0xbfc0
movq -0xa0(%rbp), %rdi
movl %eax, %esi
callq 0x22b0
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x3364
movq 0xdec21(%rip), %rdi     # 0xe1fd8
movq 0xdec0a(%rip), %rsi     # 0xe1fc8
callq 0x21e0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)