// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, 0x30(%rsp)
cmpl $0x7, %r8d
jae 0x70d6
movl %r8d, %ebx
movq %rcx, %r12
movb $0x1, 0xd(%rsp)
pushq $0x1
popq %rax
cmpq $0x7, %rax
je 0x6d11
movb $0x0, 0xd(%rsp,%rax)
incq %rax
jmp 0x6d01
movq %rdi, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
testl %ebx, %ebx
je 0x6d38
movzbl (%r12), %esi
pushq $0xe
popq %rdi
callq 0x713e
movzbl %al, %edi
callq 0x694b
movb %al, 0xe(%rsp)
movl %ebx, 0x14(%rsp)
movl %ebx, %r14d
pushq $0x1
popq %rbp
pushq $0xe
popq %rbx
cmpq %r14, %rbp
jae 0x6d90
movzbl (%r12,%rbp), %esi
movl %ebx, %edi
callq 0x713e
movzbl %al, %r13d
movl %ebp, %r15d
testl %r15d, %r15d
js 0x6d8b
movl %r15d, %eax
movzbl 0xd(%rsp,%rax), %esi
movl %r13d, %edi
callq 0x71b9
leal 0x1(%r15), %ecx
leaq (%rsp,%rcx), %rdi
addq $0xd, %rdi
movzbl %al, %esi
callq 0x6778
decl %r15d
jmp 0x6d5d
incq %rbp
jmp 0x6d45
leaq 0xd(%rsp), %rsi
movq 0x20(%rsp), %rdi
movl 0x14(%rsp), %edx
callq 0x722c
testl %eax, %eax
je 0x70ef
movl %eax, %ebx
cmpl $0x7, %eax
movq 0x30(%rsp), %r14
jge 0x7108
movzbl 0xd(%rsp), %edi
pushq $0x1
popq %rsi
callq 0x73d4
testb %al, %al
je 0x7121
movslq %ebx, %rax
incq %rax
pushq $-0x1
popq %rbp
cmpb $0x0, 0xc(%rsp,%rax)
jne 0x6dec
decl %ebx
decq %rax
jg 0x6dd9
jmp 0x70c5
leaq 0xd(%rsp), %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0x7420
cmpl %ebx, %eax
jl 0x70c5
movl %eax, %r15d
leaq 0xd(%rsp), %rsi
leaq 0x1a(%rsp), %r8
movq 0x20(%rsp), %r13
movq %r13, %rdi
movq %r14, %rdx
movl %eax, %ecx
movq 0x28(%rsp), %r9
callq 0x755a
cmpl $0x0, 0xcd2f6(%rip)     # 0xd4124
jne 0x70c2
movl %eax, 0x14(%rsp)
movl $0x1, 0xcd2e2(%rip)     # 0xd4124
movq 0xcd18f(%rip), %rbx     # 0xd3fd8
leaq 0x6030(%rip), %rsi      # 0xce80
movq %rbx, %rdi
callq 0x2160
xorl %r14d, %r14d
leaq 0x5d65(%rip), %r12      # 0xcbc7
cmpq $0x6, %r14
je 0x6e86
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2160
movzbl (%r13,%r14), %esi
movq %rax, %rdi
callq 0x21e0
incq %r14
jmp 0x6e62
movl %r15d, 0x20(%rsp)
movq 0xcd146(%rip), %r15     # 0xd3fd8
movq %r15, %rdi
callq 0x20a0
leaq 0x5feb(%rip), %rsi      # 0xce8c
movq %r15, %rdi
callq 0x2160
pushq $0x6
popq %rbx
pushq $0x1
popq %r14
leaq 0x5fe2(%rip), %r12      # 0xce99
leaq 0x5fdf(%rip), %r13      # 0xce9d
movq %rbx, %rbp
subq $0x1, %rbx
jb 0x6f31
movb 0xd(%rsp,%rbp), %al
testb %al, %al
je 0x6ebe
movzbl %al, %edi
movl %r14d, %esi
callq 0x6b32
testb %al, %al
je 0x6efa
movzbl 0xd(%rsp,%rbp), %esi
movq %r15, %rdi
callq 0x21e0
movq %rax, %rdi
leaq 0x5fa2(%rip), %rsi      # 0xce97
callq 0x2160
movq %r15, %rdi
movq %r12, %rsi
callq 0x2160
cmpq $0x1, %rbp
je 0x6f24
movq %r15, %rdi
leaq 0x5f86(%rip), %rsi      # 0xce9b
callq 0x2160
movq %rax, %rdi
movl %ebp, %esi
callq 0x21e0
movq %r15, %rdi
movq %r13, %rsi
callq 0x2160
jmp 0x6ebe
movzbl 0xd(%rsp), %esi
movq 0xcd09b(%rip), %rbx     # 0xd3fd8
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x20a0
leaq 0x5f4d(%rip), %rsi      # 0xcea1
movq %rbx, %rdi
callq 0x2160
xorl %r14d, %r14d
movl 0x20(%rsp), %eax
testl %eax, %eax
movl %eax, %r13d
cmovlel %r14d, %r13d
leaq 0x5c54(%rip), %r15      # 0xcbc7
movq 0x30(%rsp), %r12
cmpq %r14, %r13
je 0x6f9a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2160
movzbl (%r12,%r14), %esi
movq %rax, %rdi
callq 0x21e0
incq %r14
jmp 0x6f78
movq 0xcd037(%rip), %r14     # 0xd3fd8
movq %r14, %rdi
callq 0x20a0
leaq 0x5efd(%rip), %rsi      # 0xcead
movq %r14, %rdi
callq 0x2160
movl 0x14(%rsp), %r15d
pushq $0x1
popq %r12
leaq 0x5ed1(%rip), %rbp      # 0xce99
leaq 0x5ece(%rip), %rbx      # 0xce9d
testl %r15d, %r15d
jle 0x704d
movb 0x1a(%rsp,%r15), %al
testb %al, %al
je 0x7048
movzbl %al, %edi
movl %r12d, %esi
callq 0x6b32
testb %al, %al
je 0x7009
movzbl 0x1a(%rsp,%r15), %esi
movq %r14, %rdi
callq 0x21e0
movq %rax, %rdi
leaq 0x5e93(%rip), %rsi      # 0xce97
callq 0x2160
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2160
cmpq $0x1, %r15
jne 0x7023
cmpb $0x0, 0x1a(%rsp)
jne 0x703d
jmp 0x7048
movq %r14, %rdi
leaq 0x5e6e(%rip), %rsi      # 0xce9b
callq 0x2160
movq %rax, %rdi
movl %r15d, %esi
callq 0x21e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2160
decq %r15
jmp 0x6fcf
movzbl 0x1a(%rsp), %esi
testl %esi, %esi
je 0x7062
movq 0xccf7b(%rip), %rdi     # 0xd3fd8
callq 0x21e0
movq 0xccf6f(%rip), %rbx     # 0xd3fd8
movq %rbx, %rdi
callq 0x20a0
leaq 0x5e42(%rip), %rsi      # 0xceba
movq %rbx, %rdi
callq 0x2160
xorl %r15d, %r15d
leaq 0x5b3d(%rip), %r14      # 0xcbc7
movq 0x28(%rsp), %r12
cmpq %r15, %r13
je 0x70b1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movzbl (%r12,%r15), %esi
movq %rax, %rdi
callq 0x21e0
incq %r15
jmp 0x708f
movq 0xccf20(%rip), %rdi     # 0xd3fd8
callq 0x20a0
movl 0x20(%rsp), %r15d
movl %r15d, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5bc2(%rip), %rdi      # 0xcc9f
leaq 0x5c94(%rip), %rsi      # 0xcd78
leaq 0x5c9d(%rip), %rcx      # 0xcd88
pushq $0x19
jmp 0x7138
leaq 0x5d4b(%rip), %rdi      # 0xce41
leaq 0x5c7b(%rip), %rsi      # 0xcd78
leaq 0x5c84(%rip), %rcx      # 0xcd88
pushq $0x27
jmp 0x7138
leaq 0x5d41(%rip), %rdi      # 0xce50
leaq 0x5c62(%rip), %rsi      # 0xcd78
leaq 0x5c6b(%rip), %rcx      # 0xcd88
pushq $0x28
jmp 0x7138
leaq 0x5d3d(%rip), %rdi      # 0xce65
leaq 0x5c49(%rip), %rsi      # 0xcd78
leaq 0x5c52(%rip), %rcx      # 0xcd88
pushq $0x29
popq %rdx
callq 0x20d0