// File: xdsopl[P]FEC/./reed_solomon.hh
// Function: ReedSolomon<4, 0, GF::Types<4, 19, unsigned char>>::decode(GF::Value<4, 19, unsigned char>*, GF::Index<4, 19, unsigned char>*, int)
int decode(ValueType *code, IndexType *erasures = 0, int erasures_count = 0)
	{
		assert(0 <= erasures_count && erasures_count <= NR);
#if 0
		for (int i = 0; i < erasures_count; ++i)
			code[(int)erasures[i]] = ValueType(0);
#endif
		ValueType syndromes[NR];
		if (!compute_syndromes(code, syndromes))
			return 0;
		IndexType locations[NR];
		ValueType magnitudes[NR];
		int count = Correction<NR, FCR, GF>::algorithm(syndromes, locations, magnitudes, erasures, erasures_count);
		if (count <= 0)
			return count;
		for (int i = 0; i < count; ++i)
			code[(int)locations[i]] += magnitudes[i];
		int corrections_count = 0;
		for (int i = 0; i < count; ++i)
			corrections_count += !!magnitudes[i];
		return corrections_count;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl -0x24(%rbp), %ecx
movb %al, -0x45(%rbp)
jg 0xef78
cmpl $0x4, -0x24(%rbp)
setle %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0xef81
jmp 0xef83
jmp 0xefa2
leaq 0xad15(%rip), %rdi      # 0x19c9f
leaq 0xb4ac(%rip), %rsi      # 0x1a43d
movl $0x5b, %edx
leaq 0xb4b2(%rip), %rcx      # 0x1a44f
callq 0x2100
leaq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0xbc20
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x58(%rbp)
jne 0xefb5
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0xf150
cmpl $0x0, %eax
jne 0xeff9
movl $0x0, -0x4(%rbp)
jmp 0xf143
leaq -0x2c(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x78(%rbp)
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0xcad0
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x70(%rbp)
jne 0xf00c
leaq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0xbc20
movq -0x98(%rbp), %rax
movq -0x90(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x88(%rbp)
jne 0xf047
leaq -0x28(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
callq 0xf290
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jg 0xf0a5
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xf143
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0xf0fd
movslq -0x38(%rbp), %rax
movb -0x30(%rbp,%rax), %al
movb %al, -0x39(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
movslq -0x38(%rbp), %rax
leaq -0x2c(%rbp), %rdi
addq %rax, %rdi
callq 0xd220
movq -0xa0(%rbp), %rdi
cltq
addq %rax, %rdi
movzbl -0x39(%rbp), %esi
callq 0xbd00
movb %al, -0x3a(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xf0ac
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0xf13d
movslq -0x44(%rbp), %rax
leaq -0x30(%rbp), %rdi
addq %rax, %rdi
callq 0xbce0
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xf10b
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nop