// File: /workspace/github_cpp_makefile_star2_O1/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)
cmpl $0x7, %r8d
jae 0x825d
movl %r8d, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, 0x30(%rsp)
movb $0x1, 0x5(%rsp)
movl $0x0, 0x6(%rsp)
movw $0x0, 0xa(%rsp)
testl %r8d, %r8d
je 0x7d71
movq 0x10(%rsp), %rax
movzbl (%rax), %esi
movl $0xe, %edi
callq 0x82f8
cmpb $0xf, %al
jae 0x82d9
movzbl %al, %eax
leaq 0x9256(%rip), %rcx      # 0x10fc0
movb (%rax,%rcx), %al
movb %al, 0x6(%rsp)
movq %r14, 0x28(%rsp)
movq %rbx, 0x20(%rsp)
movl %ebp, 0xc(%rsp)
cmpl $0x2, %ebp
jl 0x7ddf
movl 0xc(%rsp), %r14d
movl $0x1, %r15d
movl $0x2, %r12d
movq 0x10(%rsp), %rax
movzbl (%rax,%r15), %esi
movl $0xe, %edi
callq 0x82f8
movzbl %al, %r13d
movq %r12, %rbp
leaq (%rsp,%rbp), %rbx
addq $0x5, %rbx
movzbl -0x1(%rbx), %esi
movl %r13d, %edi
callq 0x837c
movzbl %al, %esi
movq %rbx, %rdi
callq 0x77e4
decq %rbp
jg 0x7db0
incq %r15
incq %r12
cmpq %r14, %r15
jne 0x7d95
leaq 0x5(%rsp), %rsi
movq 0x30(%rsp), %rdi
movl 0xc(%rsp), %edx
callq 0x8418
testl %eax, %eax
je 0x827c
movl %eax, %ebp
cmpl $0x7, %eax
jge 0x829b
movzbl 0x5(%rsp), %edi
movl $0x1, %esi
callq 0x85b9
testb %al, %al
movq 0x28(%rsp), %r15
je 0x82ba
movslq %ebp, %rax
incq %rax
cmpb $0x0, 0x4(%rsp,%rax)
jne 0x7e3f
decl %ebp
decq %rax
jg 0x7e27
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x824e
leaq 0x5(%rsp), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x860c
movl %eax, %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ebp, %r13d
jl 0x824e
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 0x8bfa
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
movq %r12, %rcx
movl %eax, %r8d
movq 0x20(%rsp), %r9
callq 0x8cbe
cmpl $0x0, 0xcd293(%rip)     # 0xd5134
jne 0x824b
movl %r13d, 0x10(%rsp)
movl %ebp, 0xc(%rsp)
movl $0x1, 0xcd27a(%rip)     # 0xd5134
movq 0xcd117(%rip), %r13     # 0xd4fd8
leaq 0x6fb8(%rip), %rsi      # 0xee80
movl $0xb, %edx
movq %r13, %rdi
callq 0x2190
xorl %ebx, %ebx
leaq 0x6ce9(%rip), %r12      # 0xebc7
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 0x7ede
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 0x6f59(%rip), %rsi      # 0xee8c
movl $0xa, %edx
movq %r13, %rdi
callq 0x2190
movl $0x7, %ebx
leaq 0x6f4b(%rip), %r14      # 0xee97
leaq 0x6f46(%rip), %r12      # 0xee99
leaq 0x6f43(%rip), %rbp      # 0xee9d
leaq 0x6f3a(%rip), %r15      # 0xee9b
movb 0x4(%rsp,%rbx), %al
testb %al, %al
je 0x7fd8
movzbl %al, %edi
movl $0x1, %esi
callq 0x7b4b
testb %al, %al
je 0x7f97
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 0x7fc8
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 0x7f61
movzbl 0x5(%rsp), %esi
movq 0xccfeb(%rip), %r15     # 0xd4fd8
movq %r15, %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 0x6e7b(%rip), %rsi      # 0xeea1
movl $0xb, %edx
movq %r15, %rdi
callq 0x2190
movl 0x10(%rsp), %eax
movl %eax, %ebx
testl %eax, %eax
movq 0x28(%rsp), %r13
jle 0x8079
xorl %r14d, %r14d
movq 0xccf8c(%rip), %r15     # 0xd4fd8
leaq 0x6b74(%rip), %r12      # 0xebc7
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 0x8053
movq 0xccf58(%rip), %r14     # 0xd4fd8
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
leaq 0x6dff(%rip), %rsi      # 0xeead
movl $0xc, %edx
movq %r14, %rdi
callq 0x2190
movl 0xc(%rsp), %eax
testl %eax, %eax
jle 0x817d
movl %eax, %r14d
movq 0xccf07(%rip), %r12     # 0xd4fd8
leaq 0x6dc1(%rip), %r15      # 0xee99
leaq 0x6dbe(%rip), %r13      # 0xee9d
leaq 0x6db5(%rip), %rbp      # 0xee9b
movb 0x1a(%rsp,%r14), %al
testb %al, %al
je 0x816c
movzbl %al, %edi
movl $0x1, %esi
callq 0x7b4b
testb %al, %al
je 0x8122
movzbl 0x1a(%rsp,%r14), %esi
movq %r12, %rdi
callq 0x2200
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6d7a(%rip), %rsi      # 0xee97
callq 0x2190
movl $0x1, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2190
cmpq $0x1, %r14
jne 0x8141
cmpb $0x0, 0x1a(%rsp)
jne 0x815c
jmp 0x816c
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 0x80e6
movzbl 0x1a(%rsp), %esi
testl %esi, %esi
movl 0x10(%rsp), %ebp
je 0x8196
movq 0xcce47(%rip), %rdi     # 0xd4fd8
callq 0x2200
movq 0xcce3b(%rip), %r14     # 0xd4fd8
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
leaq 0x6cef(%rip), %rsi      # 0xeeba
movl $0xc, %edx
movq %r14, %rdi
callq 0x2190
testl %ebp, %ebp
movq 0x20(%rsp), %r13
jle 0x8218
xorl %r12d, %r12d
movq 0xccded(%rip), %r14     # 0xd4fd8
leaq 0x69d5(%rip), %r15      # 0xebc7
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 0x81f2
movq 0xccdb9(%rip), %rbx     # 0xd4fd8
movq (%rbx), %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
movl 0x10(%rsp), %r13d
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6a3b(%rip), %rdi      # 0xec9f
leaq 0x6b0d(%rip), %rsi      # 0xed78
leaq 0x6b16(%rip), %rcx      # 0xed88
movl $0x19, %edx
callq 0x20c0
leaq 0x6bbe(%rip), %rdi      # 0xee41
leaq 0x6aee(%rip), %rsi      # 0xed78
leaq 0x6af7(%rip), %rcx      # 0xed88
movl $0x27, %edx
callq 0x20c0
leaq 0x6bae(%rip), %rdi      # 0xee50
leaq 0x6acf(%rip), %rsi      # 0xed78
leaq 0x6ad8(%rip), %rcx      # 0xed88
movl $0x28, %edx
callq 0x20c0
leaq 0x6ba4(%rip), %rdi      # 0xee65
leaq 0x6ab0(%rip), %rsi      # 0xed78
leaq 0x6ab9(%rip), %rcx      # 0xed88
movl $0x29, %edx
callq 0x20c0
leaq 0x63b0(%rip), %rdi      # 0xe690
leaq 0x61cf(%rip), %rsi      # 0xe4b6
leaq 0x6447(%rip), %rcx      # 0xe735
movl $0x67, %edx
callq 0x20c0