// File: xdsopl[P]FEC/./bose_chaudhuri_hocquenghem.hh
// Function: BoseChaudhuriHocquenghem<6, 1, 5, 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)
			if (1 < (int)magnitudes[i])
				return -1;
		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 $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl -0x24(%rbp), %ecx
movb %al, -0x51(%rbp)
jg 0xc768
cmpl $0x6, -0x24(%rbp)
setle %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xc771
jmp 0xc773
jmp 0xc792
leaq 0xd525(%rip), %rdi      # 0x19c9f
leaq 0xcc04(%rip), %rsi      # 0x19385
movl $0x62, %edx
leaq 0xd53e(%rip), %rcx      # 0x19ccb
callq 0x2100
leaq -0x2a(%rbp), %rax
movq %rax, %rcx
addq $0x6, %rcx
movq %rcx, -0x70(%rbp)
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0xbc20
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x68(%rbp)
jne 0xc7a5
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x2a(%rbp), %rdx
callq 0xc990
cmpl $0x0, %eax
jne 0xc7e9
movl $0x0, -0x4(%rbp)
jmp 0xc982
leaq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x6, %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0xcad0
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x80(%rbp)
jne 0xc7ff
leaq -0x36(%rbp), %rax
movq %rax, %rcx
addq $0x6, %rcx
movq %rcx, -0xa0(%rbp)
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xbc20
movq -0xa8(%rbp), %rax
movq -0xa0(%rbp), %rcx
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x98(%rbp)
jne 0xc843
leaq -0x2a(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x36(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
callq 0xcae0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jg 0xc8a1
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xc982
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xc8e4
movslq -0x40(%rbp), %rax
leaq -0x36(%rbp), %rdi
addq %rax, %rdi
callq 0xbfc0
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jge 0xc8d7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc982
jmp 0xc8d9
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xc8a8
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xc93c
movslq -0x44(%rbp), %rax
movb -0x36(%rbp,%rax), %al
movb %al, -0x45(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movslq -0x44(%rbp), %rax
leaq -0x30(%rbp), %rdi
addq %rax, %rdi
callq 0xd220
movq -0xb0(%rbp), %rdi
cltq
addq %rax, %rdi
movzbl -0x45(%rbp), %esi
callq 0xbd00
movb %al, -0x46(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xc8eb
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xc97c
movslq -0x50(%rbp), %rax
leaq -0x36(%rbp), %rdi
addq %rax, %rdi
callq 0xbce0
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xc94a
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nop