// File: /workspace/github_cpp_makefile_star2_O3/xdsopl[P]FEC/./correction.hh
// Function: Correction<6, 1, GF::Types<4, 19, unsigned char>>::algorithm(GF::Value<4, 19, unsigned char>*, GF::Index<4, 19, unsigned char>*, GF::Value<4, 19, unsigned char>*, GF::Index<4, 19, unsigned char>*, int)
static int algorithm(ValueType *syndromes, IndexType *locations, ValueType *magnitudes, IndexType *erasures = 0, int erasures_count = 0)
	{
		assert(0 <= erasures_count && erasures_count <= NR);
		ValueType locator[NR+1];
		locator[0] = ValueType(1);
		for (int i = 1; i <= NR; ++i)
			locator[i] = ValueType(0);
		// $locator = \prod_{i=0}^{count}(1-x\,pe^{N-1-erasures_i})$
		if (erasures_count)
			locator[1] = value(IndexType(N-1) / erasures[0]);
		for (int i = 1; i < erasures_count; ++i) {
			IndexType tmp(IndexType(N-1) / erasures[i]);
			for (int j = i; j >= 0; --j)
				locator[j+1] += tmp * locator[j];
		}
		int locator_degree = BerlekampMassey<NR, GF>::algorithm(syndromes, locator, erasures_count);
		assert(locator_degree);
		assert(locator_degree <= NR);
		assert(locator[0] == ValueType(1));
		while (!locator[locator_degree])
			if (--locator_degree < 0)
				return -1;
		int count = FindLocations<NR, GF>::search(locator, locator_degree, locations);
		if (count < locator_degree)
			return -1;
		ValueType evaluator[NR];
		int evaluator_degree = Forney<NR, FCR, GF>::algorithm(syndromes, locator, locations, count, evaluator, magnitudes);
#ifdef NDEBUG
		(void)evaluator_degree;
#else
		static int init;
		if (!init) {
			init = 1;
			std::cout << "syndromes =";
			for (int i = 0; i < NR; ++i)
				std::cout << " " << (int)syndromes[i];
			std::cout << std::endl;
			std::cout << "locator = ";
			for (int i = NR; i > 0; --i) {
				if (!locator[i])
					continue;
				if (locator[i] != ValueType(1))
					std::cout << (int)locator[i] << "*";
				std::cout << "x";
				if (i != 1)
					std::cout << "^" << i;
				std::cout << " + ";
			}
			std::cout << (int)locator[0] << std::endl;
			std::cout << "locations =";
			for (int i = 0; i < count; ++i)
				std::cout << " " << (int)locations[i];
			std::cout << std::endl;
			std::cout << "evaluator = ";
			for (int i = evaluator_degree; i > 0; --i) {
				if (!evaluator[i])
					continue;
				if (evaluator[i] != ValueType(1))
					std::cout << (int)evaluator[i] << "*";
				std::cout << "x";
				if (i != 1)
					std::cout << "^" << i;
				if (i != 1 || evaluator[0])
					std::cout << " + ";
			}
			if (evaluator[0])
				std::cout << (int)evaluator[0];
			std::cout << std::endl;
			std::cout << "magnitudes =";
			for (int i = 0; i < count; ++i)
				std::cout << " " << (int)magnitudes[i];
			std::cout << std::endl;
		}
#endif
		return count;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x30(%rsp)
cmpl $0x7, %r8d
jae 0x8366
movb $0x1, 0x5(%rsp)
movl $0x0, 0x6(%rsp)
movw $0x0, 0xa(%rsp)
movl %r8d, 0xc(%rsp)
testl %r8d, %r8d
je 0x7ef4
movq 0x10(%rsp), %rax
movzbl (%rax), %esi
movl $0xe, %edi
callq 0x8401
cmpb $0xf, %al
jae 0x83e2
movzbl %al, %eax
leaq 0x91d8(%rip), %rcx      # 0x11060
movb (%rax,%rcx), %al
movb %al, 0x6(%rsp)
cmpl $0x1, 0xc(%rsp)
je 0x7ef4
movl 0xc(%rsp), %r14d
movl $0x1, %r15d
movl $0x2, %r12d
movq 0x10(%rsp), %rax
movzbl (%rax,%r15), %esi
movl $0xe, %edi
callq 0x8401
movzbl %al, %r13d
movq %r12, %rbp
leaq (%rsp,%rbp), %rbx
addq $0x5, %rbx
movzbl -0x1(%rbx), %esi
movl %r13d, %edi
callq 0x8485
movzbl %al, %esi
movq %rbx, %rdi
callq 0x78ce
decq %rbp
testq %rbp, %rbp
jg 0x7ec2
incq %r15
incq %r12
cmpq %r14, %r15
jne 0x7ea7
leaq 0x5(%rsp), %rsi
movq 0x30(%rsp), %rdi
movl 0xc(%rsp), %edx
callq 0x8520
testl %eax, %eax
je 0x8385
movl %eax, %ebp
cmpl $0x7, %eax
jge 0x83a4
movzbl 0x5(%rsp), %edi
movl $0x1, %esi
callq 0x86b9
testb %al, %al
movq 0x28(%rsp), %r15
je 0x83c3
movslq %ebp, %rax
incq %rax
cmpb $0x0, 0x4(%rsp,%rax)
jne 0x7f54
decl %ebp
decq %rax
jg 0x7f3c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x8357
leaq 0x5(%rsp), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x870c
movl %eax, %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ebp, %r13d
jl 0x8357
leaq 0x5(%rsp), %rbx
leaq 0x1a(%rsp), %r12
movq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %r13d, %edx
movq %r12, %rcx
callq 0x8cfc
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
movq %r12, %rcx
movl %eax, %r8d
movq 0x20(%rsp), %r9
callq 0x8dce
cmpl $0x0, 0xcd17e(%rip)     # 0xd5134
jne 0x8354
movl %r13d, 0x10(%rsp)
movl %ebp, 0xc(%rsp)
movl $0x1, 0xcd165(%rip)     # 0xd5134
movq 0xcd002(%rip), %r13     # 0xd4fd8
leaq 0x6f53(%rip), %rsi      # 0xef30
movl $0xb, %edx
movq %r13, %rdi
callq 0x2190
xorl %ebx, %ebx
leaq 0x6c84(%rip), %r12      # 0xec77
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2190
movzbl (%r14,%rbx), %esi
movq %r13, %rdi
callq 0x2200
incq %rbx
cmpq $0x6, %rbx
jne 0x7ff3
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0x6ef4(%rip), %rsi      # 0xef3c
movl $0xa, %edx
movq %r13, %rdi
callq 0x2190
movl $0x7, %ebx
leaq 0x6ee6(%rip), %r14      # 0xef47
leaq 0x6ee1(%rip), %r12      # 0xef49
leaq 0x6ede(%rip), %rbp      # 0xef4d
leaq 0x6ed5(%rip), %r15      # 0xef4b
movb 0x4(%rsp,%rbx), %al
testb %al, %al
je 0x80ed
movzbl %al, %edi
movl $0x1, %esi
callq 0x7c0f
testb %al, %al
je 0x80ac
movzbl 0x4(%rsp,%rbx), %esi
movq %r13, %rdi
callq 0x2200
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2190
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2190
cmpq $0x2, %rbx
je 0x80dd
movl $0x1, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2190
leal -0x1(%rbx), %esi
movq %r13, %rdi
callq 0x2200
movl $0x3, %edx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2190
decq %rbx
cmpq $0x1, %rbx
ja 0x8076
movzbl 0x5(%rsp), %esi
movq 0xcced6(%rip), %rbp     # 0xd4fd8
movq %rbp, %rdi
callq 0x2200
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0x6e16(%rip), %rsi      # 0xef51
movl $0xb, %edx
movq %rbp, %rdi
callq 0x2190
movl 0x10(%rsp), %eax
movl %eax, %ebx
testl %eax, %eax
movq 0x28(%rsp), %r13
jle 0x818e
xorl %r14d, %r14d
movq 0xcce77(%rip), %r15     # 0xd4fd8
leaq 0x6b0f(%rip), %r12      # 0xec77
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2190
movzbl (%r13,%r14), %esi
movq %r15, %rdi
callq 0x2200
incq %r14
cmpq %r14, %rbx
jne 0x8168
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0x6da0(%rip), %rsi      # 0xef5d
movl $0xc, %edx
movq %rbp, %rdi
callq 0x2190
movl 0xc(%rsp), %eax
testl %eax, %eax
jle 0x828c
movl %eax, %r14d
movq 0xccdf8(%rip), %r12     # 0xd4fd8
leaq 0x6d62(%rip), %r15      # 0xef49
leaq 0x6d5f(%rip), %r13      # 0xef4d
leaq 0x6d56(%rip), %rbp      # 0xef4b
movb 0x1a(%rsp,%r14), %al
testb %al, %al
je 0x827b
movzbl %al, %edi
movl $0x1, %esi
callq 0x7c0f
testb %al, %al
je 0x8231
movzbl 0x1a(%rsp,%r14), %esi
movq %r12, %rdi
callq 0x2200
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6d1b(%rip), %rsi      # 0xef47
callq 0x2190
movl $0x1, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2190
cmpq $0x1, %r14
jne 0x8250
cmpb $0x0, 0x1a(%rsp)
jne 0x826b
jmp 0x82a1
movl $0x1, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2190
movq %r12, %rdi
movl %r14d, %esi
callq 0x2200
movl $0x3, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2190
leaq -0x1(%r14), %rax
cmpq $0x1, %r14
movq %rax, %r14
jg 0x81f5
movzbl 0x1a(%rsp), %esi
testl %esi, %esi
je 0x82a1
movq 0xccd3c(%rip), %rdi     # 0xd4fd8
callq 0x2200
movq 0xccd30(%rip), %rbp     # 0xd4fd8
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0x6c93(%rip), %rsi      # 0xef6a
movl $0xc, %edx
movq %rbp, %rdi
callq 0x2190
cmpl $0x0, 0x10(%rsp)
movq 0x20(%rsp), %r13
jle 0x8327
xorl %r12d, %r12d
movq 0xcccde(%rip), %r14     # 0xd4fd8
leaq 0x6976(%rip), %r15      # 0xec77
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
movzbl (%r13,%r12), %esi
movq %r14, %rdi
callq 0x2200
incq %r12
cmpq %r12, %rbx
jne 0x8301
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movl 0x10(%rsp), %r13d
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x69e2(%rip), %rdi      # 0xed4f
leaq 0x6ab4(%rip), %rsi      # 0xee28
leaq 0x6abd(%rip), %rcx      # 0xee38
movl $0x19, %edx
callq 0x20c0
leaq 0x6b65(%rip), %rdi      # 0xeef1
leaq 0x6a95(%rip), %rsi      # 0xee28
leaq 0x6a9e(%rip), %rcx      # 0xee38
movl $0x27, %edx
callq 0x20c0
leaq 0x6b55(%rip), %rdi      # 0xef00
leaq 0x6a76(%rip), %rsi      # 0xee28
leaq 0x6a7f(%rip), %rcx      # 0xee38
movl $0x28, %edx
callq 0x20c0
leaq 0x6b4b(%rip), %rdi      # 0xef15
leaq 0x6a57(%rip), %rsi      # 0xee28
leaq 0x6a60(%rip), %rcx      # 0xee38
movl $0x29, %edx
callq 0x20c0
leaq 0x6357(%rip), %rdi      # 0xe740
leaq 0x6176(%rip), %rsi      # 0xe566
leaq 0x63ee(%rip), %rcx      # 0xe7e5
movl $0x67, %edx
callq 0x20c0