// File: /workspace/github_cpp_makefile_star2_O1/xdsopl[P]FEC/testbench.cc
// Function: void test_bch<24, 1, 65343, 16, 65581, unsigned short>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, BoseChaudhuriHocquenghem<24, 1, 65343, GF::Types<16, 65581, unsigned short>>&, unsigned short*, unsigned short*, std::vector<unsigned char, std::allocator<unsigned char>>&)
void test_bch(std::string name, BoseChaudhuriHocquenghem<NR, FCR, K, GF::Types<M, P, TYPE>> &bch, TYPE *code, TYPE *target, std::vector<uint8_t> &data)
{
	std::cout << "testing: " << name << std::endl;

	{
		bch.encode(code);
		bool error = false;
		for (int i = 0; i < bch.N; ++i)
			error |= code[i] != target[i];
		if (error)
			std::cout << "encoder error!" << std::endl;
		assert(!error);
		//print_table(code + K, "parity", bch.NP);
		error = bch.decode(code);
		if (error)
			std::cout << "decoder error!" << std::endl;
		assert(!error);
		int pos = 0, cap = 0, corrupt = 0, erasures_count = 0;
		TYPE erasures[NR];
		// need one root per erasure
		for (int i = 0; pos < bch.N && cap+1 <= NR && i < NR/2; ++i, ++corrupt, ++pos, ++cap)
			code[erasures[erasures_count++] = pos] ^= 1;
		// need two roots per error
		for (int i = 0; pos < bch.N && cap+2 <= NR && i < NR/2; ++i, ++corrupt, ++pos, cap+=2)
			code[pos] ^= 1;
		int corrected = bch.decode(code, erasures, erasures_count);
		if (corrupt != corrected)
			std::cout << "decoder error: expected " << corrupt << " but got " << corrected << std::endl;
		assert(corrupt == corrected);
		TYPE syndromes[NR];
		if (corrected >= 0 && bch.compute_syndromes(code, syndromes)) {
			std::cout << "decoder error: result of correction is not a codeword!" << std::endl;
			assert(false);
		}
		error = false;
		for (int i = 0; i < bch.N; ++i)
			error |= code[i] != target[i];
		if (error)
			std::cout << "decoder error: code doesnt match target" << std::endl;
		assert(!error);
	}
	int blocks = (8 * data.size() + K - 1) / K;
	TYPE *coded = new TYPE[bch.N * blocks];
	{
		unsigned pos = 0;
		for (unsigned byte : data) {
			for (int bit = 0; bit < 8; ++bit) {
				coded[pos++] = (byte >> bit) & 1;
				if (pos % bch.N >= K)
					pos += bch.NP;
			}
		}
	}
	{
		auto start = std::chrono::system_clock::now();
		for (int i = 0; i < blocks; ++i)
			bch.encode(coded + i * bch.N);
		auto end = std::chrono::system_clock::now();
		auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
		int mbs = (data.size() + msec.count() / 2) / msec.count();
		int bytes = (bch.N * blocks) / 8;
		float redundancy = (100.0f*(bytes-data.size())) / data.size();
		std::cout << "encoding of " << data.size() << " random bytes into " << bytes << " codeword bytes (" << std::setprecision(1) << std::fixed << redundancy << "% redundancy) in " << blocks << " blocks took " << msec.count() << " milliseconds (" << mbs << "KB/s)." << std::endl;
	}
	std::random_device rd;
	std::default_random_engine generator(rd());
	std::uniform_int_distribution<int> pos_dist(0, bch.N-1);
	auto rnd_pos = std::bind(pos_dist, generator);
	std::vector<uint8_t> recovered(data.size());
	TYPE *tmp = new TYPE[bch.N * blocks];
	TYPE *erasures = new TYPE[NR * blocks];
	for (int places = 0; places <= NR; ++places) {
		for (int erasures_count = 0; erasures_count <= places; ++erasures_count) {
			for (int i = 0; i < bch.N * blocks; ++i)
				tmp[i] = coded[i];
			int corrupt = 0;
			for (int i = 0; i < blocks; ++i) {
				for (int j = 0; j < places; ++j) {
					erasures[i*NR + j] = rnd_pos();
					for (int k = 0; k < j;) {
						if (erasures[i*NR + k++] == erasures[i*NR + j]) {
							erasures[i*NR + j] = rnd_pos();
							k = 0;
						}
					}
					tmp[i * bch.N + erasures[i*NR + j]] ^= 1;
					++corrupt;
				}
			}
			int corrected = 0, wrong = 0;
			auto start = std::chrono::system_clock::now();
			for (int i = 0; i < blocks; ++i) {
				int result = bch.decode(tmp + i * bch.N, erasures + i * NR, erasures_count);
				if (places > NR/2 && places > erasures_count && result >= 0)
					for (int j = i * bch.N; j < (i + 1) * bch.N; ++j)
						wrong += coded[j] != tmp[j];
				corrected += result;
			}
			auto end = std::chrono::system_clock::now();
			auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
			int bytes = (bch.N * blocks) / 8;
			int mbs = (bytes + msec.count() / 2) / msec.count();
			std::cout << "decoding with " << places << " errors and " << erasures_count << " known erasures per block took " << msec.count() << " milliseconds (" << mbs << "KB/s).";
			if (corrupt != corrected || wrong)
				std::cout << " expected " << corrupt << " corrected errors but got " << corrected << " and " << wrong << " wrong corrections.";
			std::cout << std::endl;
			assert((places > NR/2 && places > erasures_count) || (corrupt == corrected && !wrong));
			int left = 0;
			for (int i = 0; i < bch.N * blocks; ++i)
				left += tmp[i] > 1;
			if (left)
				std::cout << "correction left GF(2) " << left << " times!" << std::endl;
			if (corrupt == corrected && !wrong) {
				unsigned acc = 0, bit = 0, pos = 0;
				for (uint8_t &byte: recovered) {
					while (bit < 8) {
						acc |= (unsigned)tmp[pos++] << bit++;
						if (pos % bch.N >= K)
							pos += bch.NP;
					}
					bit -= 8;
					byte = 255 & acc;
					acc >>= 8;
				}
				for (int i = 0; i < blocks; ++i) {
					TYPE syndromes[NR];
					if (bch.compute_syndromes(tmp + i * bch.N, syndromes)) {
						std::cout << "decoder error: result of correction is not a codeword!" << std::endl;
						assert(false);
					}
				}
				if (data != recovered) {
					std::cout << "decoder error: data could not be recovered from corruption!" << std::endl;
					assert(places > NR/2 && places > erasures_count);
				}
			}
		}
	}
	delete[] erasures;
	delete[] tmp;
	delete[] coded;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1468, %rsp           # imm = 0x1468
movq %r8, 0x50(%rsp)
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
movq 0xcf6a0(%rip), %r12     # 0xd4fd8
leaq 0x8fc0(%rip), %rsi      # 0xe8ff
movl $0x9, %edx
movq %r12, %rdi
callq 0x2190
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
callq 0x2190
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq %r13, %rdi
movq %r14, %rsi
callq 0xb4fe
xorl %eax, %eax
xorl %ecx, %ecx
movzwl (%r14,%rax,2), %edx
cmpw (%rbx,%rax,2), %dx
setne %dl
orb %dl, %cl
incq %rax
cmpq $0xffff, %rax           # imm = 0xFFFF
jne 0x5994
testb $0x1, %cl
jne 0x6501
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xb596
testl %eax, %eax
movq 0x50(%rsp), %r15
jne 0x653b
xorl %eax, %eax
movw %ax, 0xe0(%rsp,%rax,2)
xorb $0x1, (%r14,%rax,2)
leaq 0x1(%rax), %rcx
movq %rcx, %rax
cmpq $0xc, %rcx
jne 0x59d4
movl $0xc, %eax
xorb $0x1, (%r14,%rax,2)
incq %rax
cmpl $0x12, %eax
jne 0x59f3
leaq 0xe0(%rsp), %rdx
movq %r13, %rdi
movq %r14, %rsi
movl $0xc, %ecx
callq 0xb596
cmpl $0x12, %eax
jne 0x6575
leaq 0xb0(%rsp), %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0xb65c
testl %eax, %eax
jne 0x6609
xorl %eax, %eax
xorl %ecx, %ecx
movzwl (%r14,%rax,2), %edx
cmpw (%rbx,%rax,2), %dx
setne %dl
orb %dl, %cl
incq %rax
cmpq $0xffff, %rax           # imm = 0xFFFF
jne 0x5a40
testb $0x1, %cl
jne 0x6643
movq (%r15), %r14
movq 0x8(%r15), %r15
movq %r15, %rax
subq %r14, %rax
leaq 0xff3e(,%rax,8), %rax
movabsq $0x4030647bc14cbad9, %rcx # imm = 0x4030647BC14CBAD9
mulq %rcx
shrq $0xe, %rdx
movl %edx, %eax
shll $0x10, %eax
subl %edx, %eax
movq %rax, 0x30(%rsp)
cltq
addq %rax, %rax
movq %rdx, 0x8(%rsp)
testl %edx, %edx
movq $-0x1, %rbx
cmovnsq %rax, %rbx
movq %rbx, %rdi
callq 0x2030
cmpq %r14, %r15
je 0x5b18
xorl %ecx, %ecx
movl $0x80008001, %r10d      # imm = 0x80008001
movzbl (%r14), %edx
xorl %esi, %esi
xorl %r8d, %r8d
btl %esi, %edx
setb %r8b
leal 0x1(%rcx), %edi
movl %ecx, %r9d
movw %r8w, (%rax,%r9,2)
movq %rdi, %r8
imulq %r10, %r8
shrq $0x2f, %r8
movl %r8d, %r9d
shll $0x10, %r9d
subl %r9d, %r8d
addl %ecx, %r8d
incl %r8d
cmpl $0xff3f, %r8d           # imm = 0xFF3F
jae 0x5b03
movl %edi, %ecx
jmp 0x5b09
addl $0xc1, %ecx
incl %esi
cmpl $0x8, %esi
jne 0x5ac6
incq %r14
cmpq %r15, %r14
jne 0x5ac0
movq %rax, 0x48(%rsp)
callq 0x2050
movq %rax, %r14
cmpl $0x0, 0x8(%rsp)
jle 0x5b54
movq 0x8(%rsp), %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x48(%rsp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0xb4fe
addq $0x1fffe, %r15          # imm = 0x1FFFE
decq %r12
jne 0x5b3d
movq %r13, 0x68(%rsp)
callq 0x2050
subq %r14, %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %r14
sarq $0x12, %r14
movq %rdx, %rax
shrq $0x3f, %rax
movq 0x50(%rsp), %r13
movq 0x8(%r13), %rcx
subq (%r13), %rcx
addq %rax, %r14
sarq $0x13, %rdx
addq %rdx, %rax
addq %rcx, %rax
xorl %edx, %edx
divq %r14
movq %rax, %r15
movq 0x30(%rsp), %rax
leal 0x7(%rax), %ebp
testl %eax, %eax
cmovnsl %eax, %ebp
sarl $0x3, %ebp
movslq %ebp, %rax
movq %rax, 0x98(%rsp)
subq %rcx, %rax
js 0x5bc5
cvtsi2ss %rax, %xmm1
jmp 0x5bda
movq %rax, %rdx
shrq %rdx
andl $0x1, %eax
orq %rdx, %rax
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
mulss 0x8422(%rip), %xmm1     # 0xe004
testq %rcx, %rcx
js 0x5bee
cvtsi2ss %rcx, %xmm0
jmp 0x5c03
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
divss %xmm0, %xmm1
movss %xmm1, 0x10(%rsp)
movq 0xcf3c4(%rip), %r12     # 0xd4fd8
leaq 0x8e73(%rip), %rsi      # 0xea8e
movl $0xc, %edx
movq %r12, %rdi
callq 0x2190
movq 0x8(%r13), %rsi
subq (%r13), %rsi
movq %r12, %rdi
callq 0x20d0
movq %rax, %r12
leaq 0x8e59(%rip), %rsi      # 0xea9b
movl $0x13, %edx
movq %rax, %rdi
callq 0x2190
movq %r12, %rdi
movl %ebp, %esi
callq 0x2200
movq %rax, %r12
leaq 0x8e4c(%rip), %rsi      # 0xeaaf
movl $0x11, %edx
movq %rax, %rdi
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rcx
movq $0x1, 0x8(%r12,%rcx)
movq -0x18(%rax), %rax
movl $0xfffffefb, %ecx       # imm = 0xFFFFFEFB
andl 0x18(%r12,%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x18(%r12,%rax)
xorps %xmm0, %xmm0
cvtss2sd 0x10(%rsp), %xmm0
movq %r12, %rdi
callq 0x21d0
movq %rax, %r12
leaq 0x8e0f(%rip), %rsi      # 0xeac1
movl $0x11, %edx
movq %rax, %rdi
callq 0x2190
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x2200
movq %rax, %r12
leaq 0x8dfd(%rip), %rsi      # 0xead3
movl $0xd, %edx
movq %rax, %rdi
callq 0x2190
movq %r12, %rdi
movq %r14, %rsi
callq 0x2130
movq %rax, %r14
leaq 0x8de9(%rip), %rsi      # 0xeae1
movl $0xf, %edx
movq %rax, %rdi
callq 0x2190
movq %r14, %rdi
movl %r15d, %esi
callq 0x2200
movq %rax, %r14
leaq 0x8dd7(%rip), %rsi      # 0xeaf1
movl $0x6, %edx
movq %rax, %rdi
callq 0x2190
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 0xe0(%rsp), %r14
movq %r14, %rdi
callq 0x28f4
movq %r14, %rdi
callq 0x21b0
movl %eax, %ecx
leaq (%rcx,%rcx,2), %rcx
shrq $0x20, %rcx
movl %eax, %edx
subl %ecx, %edx
shrl %edx
addl %ecx, %edx
shrl $0x1e, %edx
movl %edx, %ecx
shll $0x1f, %ecx
orl %edx, %ecx
leal (%rax,%rcx), %edx
cmpl $0x1, %edx
adcl %eax, %ecx
movabsq $0xfffe00000000, %rax   # imm = 0xFFFE00000000
movq %rax, 0x88(%rsp)
movq %rcx, 0x90(%rsp)
movq 0x8(%r13), %rsi
subq (%r13), %rsi
leaq 0x70(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x296e
movq 0x30(%rsp), %r14
movq %rbx, %rdi
callq 0x2030
movq 0x8(%rsp), %rbx
movq %rax, %rbp
movq %rbx, %rax
shlq $0x23, %rax
leaq (%rax,%rax,2), %rax
movq %rax, %rcx
sarq $0x1f, %rcx
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x2030
movq %rax, %r15
cmpl $0x2, %r14d
movl $0x1, %eax
movl $0x1, 0x40(%rsp)
cmovll %eax, %r14d
addl %r14d, %r14d
movq %r14, 0x30(%rsp)
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq %rbx, 0x58(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x88(%rsp), %r12
movl $0x0, 0x2c(%rsp)
movq %rbp, 0x38(%rsp)
movl $0x0, 0x4(%rsp)
cmpl $0x0, 0x8(%rsp)
jle 0x5e62
movq %rbp, %rdi
movq 0x48(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x2100
movl $0x0, 0x1c(%rsp)
movl $0x0, %eax
cmpl $0x0, 0x8(%rsp)
jle 0x5f47
movq $0x0, 0x20(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x5f2b
movq 0x20(%rsp), %rbp
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %r14
leaq (%r15,%r14,2), %r13
leaq (,%rbp,2), %rax
shlq $0x11, %rbp
subq %rax, %rbp
addq 0x38(%rsp), %rbp
xorl %ebx, %ebx
movq %r12, %rdi
leaq 0x90(%rsp), %rsi
movq %r12, %rdx
callq 0x8e86
movw %ax, (%r13,%rbx,2)
testq %rbx, %rbx
je 0x5f15
xorl %eax, %eax
leal (%rax,%r14), %ecx
movslq %ecx, %rcx
movzwl (%r15,%rcx,2), %ecx
cmpw (%r13,%rbx,2), %cx
jne 0x5f0b
movq %r12, %rdi
leaq 0x90(%rsp), %rsi
movq %r12, %rdx
callq 0x8e86
movw %ax, (%r13,%rbx,2)
xorl %eax, %eax
jmp 0x5f0d
incl %eax
movslq %eax, %rcx
cmpq %rcx, %rbx
jg 0x5eda
movzwl (%r13,%rbx,2), %eax
xorw $0x1, (%rbp,%rax,2)
incq %rbx
cmpq 0x10(%rsp), %rbx
jne 0x5eba
movq 0x20(%rsp), %rcx
incq %rcx
movq %rcx, 0x20(%rsp)
cmpq 0x58(%rsp), %rcx
jne 0x5e83
movl 0x2c(%rsp), %eax
movl %eax, 0x44(%rsp)
callq 0x2050
movq %rax, 0xa0(%rsp)
movl 0x4(%rsp), %eax
movq %rax, 0x60(%rsp)
movl $0x0, %r14d
cmpl $0x0, 0x8(%rsp)
jle 0x604f
xorl %edi, %edi
movq 0x48(%rsp), %r8
movq 0x38(%rsp), %rbx
xorl %r13d, %r13d
xorl %r14d, %r14d
movl $0x0, 0x1c(%rsp)
movq %rdi, 0xa8(%rsp)
movq %r8, 0x20(%rsp)
movq %rdi, %rbp
shlq $0x10, %rbp
subq %rdi, %rbp
movq 0x38(%rsp), %rax
leaq (%rax,%rbp,2), %rsi
leaq (%rdi,%rdi,2), %rdx
shlq $0x4, %rdx
addq %r15, %rdx
movq 0x68(%rsp), %rdi
movl 0x4(%rsp), %ecx
callq 0xb596
movq 0x10(%rsp), %rdx
cmpq 0x60(%rsp), %rdx
setbe %cl
cmpq $0xd, %rdx
setb %dl
testl %eax, %eax
sets %sil
orb %cl, %dl
movq 0xa8(%rsp), %rdi
cmpq $0x8000, %rdi           # imm = 0x8000
setae %cl
orb %dl, %cl
orb %sil, %cl
jne 0x6026
addl $0xffff, %ebp           # imm = 0xFFFF
xorl %ecx, %ecx
movq 0x20(%rsp), %r8
movzwl (%r8,%rcx,2), %edx
xorl %esi, %esi
cmpw (%rbx,%rcx,2), %dx
setne %sil
addl %esi, %r14d
incq %rcx
leal (%rcx,%r13), %edx
cmpl %edx, %ebp
jg 0x6007
jmp 0x602b
movq 0x20(%rsp), %r8
addl %eax, 0x1c(%rsp)
incq %rdi
addq $0xffff, %r13           # imm = 0xFFFF
movl $0x1fffe, %eax          # imm = 0x1FFFE
addq %rax, %rbx
addq %rax, %r8
cmpq 0x58(%rsp), %rdi
jne 0x5f8c
callq 0x2050
subq 0xa0(%rsp), %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rcx
sarq $0x12, %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rax, %rcx
sarq $0x13, %rdx
addq %rdx, %rax
addq 0x98(%rsp), %rax
cqto
movq %rcx, %rbx
idivq %rcx
movq %rax, %rbp
movl $0xe, %edx
movq 0xcef38(%rip), %rdi     # 0xd4fd8
leaq 0x8a51(%rip), %rsi      # 0xeaf8
callq 0x2190
movq 0xcef25(%rip), %rdi     # 0xd4fd8
movq 0x10(%rsp), %rsi
callq 0x2200
movl $0xc, %edx
movq %rax, %rdi
leaq 0x8a3b(%rip), %rsi      # 0xeb07
movq %rax, %r13
callq 0x2190
movq %r13, %rdi
movl 0x4(%rsp), %esi
callq 0x2200
movq %rax, %r13
movl $0x1f, %edx
movq %rax, %rdi
leaq 0x8a22(%rip), %rsi      # 0xeb14
callq 0x2190
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2130
movq %rax, %rbx
movl $0xf, %edx
movq %rax, %rdi
leaq 0x89cd(%rip), %rsi      # 0xeae1
callq 0x2190
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2200
movl $0x6, %edx
movq %rax, %rdi
leaq 0x89bf(%rip), %rsi      # 0xeaf1
callq 0x2190
movl 0x44(%rsp), %eax
xorl 0x1c(%rsp), %eax
orl %r14d, %eax
setne %bpl
je 0x61cd
movl $0xa, %edx
movq 0xcee80(%rip), %rdi     # 0xd4fd8
leaq 0x88aa(%rip), %rsi      # 0xea09
callq 0x2190
movq 0xcee6d(%rip), %rdi     # 0xd4fd8
movl 0x44(%rsp), %esi
callq 0x2200
movq %rax, %rbx
movl $0x1a, %edx
movq %rax, %rdi
leaq 0x89ae(%rip), %rsi      # 0xeb34
callq 0x2190
movq %rbx, %rdi
movl 0x1c(%rsp), %esi
callq 0x2200
movq %rax, %rbx
movl $0x5, %edx
movq %rax, %rdi
leaq 0x8965(%rip), %rsi      # 0xeb0e
callq 0x2190
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2200
movl $0x13, %edx
movq %rax, %rdi
leaq 0x8987(%rip), %rsi      # 0xeb4f
callq 0x2190
movq 0xcee04(%rip), %rcx     # 0xd4fd8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0xcede6(%rip), %rdi     # 0xd4fd8
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq 0x10(%rsp), %rcx
cmpq $0xd, %rcx
setb %al
cmpq 0x60(%rsp), %rcx
setbe %cl
orb %al, %cl
testb %bpl, %cl
jne 0x64c3
movl %ebp, %ebx
movb %cl, 0x20(%rsp)
cmpl $0x0, 0x8(%rsp)
jle 0x6256
xorl %eax, %eax
xorl %r14d, %r14d
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rbp
movq 0xced97(%rip), %r13     # 0xd4fd8
cmpw $0x2, (%rbp,%rax)
sbbl $-0x1, %r14d
addq $0x2, %rax
cmpq %rax, %rcx
jne 0x6241
jmp 0x6265
xorl %r14d, %r14d
movq 0x38(%rsp), %rbp
movq 0xced73(%rip), %r13     # 0xd4fd8
testl %r14d, %r14d
je 0x62c7
movl $0x16, %edx
movq %r13, %rdi
leaq 0x8939(%rip), %rsi      # 0xebb2
callq 0x2190
movq %r13, %rdi
movl %r14d, %esi
callq 0x2200
movq %rax, %r14
movl $0x7, %edx
movq %rax, %rdi
leaq 0x892e(%rip), %rsi      # 0xebc9
callq 0x2190
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
testb %bl, %bl
jne 0x63f2
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rdx
cmpq %rdx, %rax
je 0x6341
xorl %esi, %esi
xorl %edi, %edi
xorl %ecx, %ecx
leal 0x1(%rsi), %r9d
movl %esi, %r8d
movzwl (%rbp,%r8,2), %r8d
shll %cl, %r8d
movq %r9, %r10
movl $0x80008001, %r11d      # imm = 0x80008001
imulq %r11, %r10
shrq $0x2f, %r10
movl %r10d, %r11d
shll $0x10, %r11d
subl %r11d, %r10d
addl %esi, %r10d
incl %r10d
cmpl $0xff3f, %r10d          # imm = 0xFF3F
jae 0x6323
movl %r9d, %esi
jmp 0x6329
addl $0xc1, %esi
incl %ecx
orl %r8d, %edi
cmpl $0x8, %ecx
jne 0x62e4
movb %dil, (%rax)
shrl $0x8, %edi
incq %rax
cmpq %rdx, %rax
jne 0x62e2
movq 0x58(%rsp), %rbx
movq %rbp, %r14
cmpl $0x0, 0x8(%rsp)
jle 0x6379
movq 0x68(%rsp), %rdi
movq %r14, %rsi
leaq 0xb0(%rsp), %rdx
callq 0xb65c
testl %eax, %eax
jne 0x6480
addq $0x1fffe, %r14          # imm = 0x1FFFE
decq %rbx
jne 0x6350
movq 0x50(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rax
movq %rax, %rdx
subq %rdi, %rdx
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rcx
subq %rsi, %rcx
cmpq %rcx, %rdx
jne 0x63ab
cmpq %rdi, %rax
je 0x63f2
callq 0x2180
testl %eax, %eax
je 0x63f2
movl $0x3b, %edx
movq %r13, %rdi
leaq 0x8817(%rip), %rsi      # 0xebd1
callq 0x2190
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
cmpb $0x0, 0x20(%rsp)
jne 0x64e2
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0x40(%rsp), %eax
jne 0x5e49
movq 0x10(%rsp), %rcx
incq %rcx
movl 0x2c(%rsp), %eax
addl 0x8(%rsp), %eax
movl %eax, 0x2c(%rsp)
incl 0x40(%rsp)
movq %rcx, 0x10(%rsp)
cmpq $0x19, %rcx
jne 0x5e41
movq %r15, %rdi
callq 0x21a0
movq %rbp, %rdi
callq 0x21a0
movq 0x48(%rsp), %rdi
callq 0x21a0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x6461
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0xe0(%rsp), %rdi
callq 0x2120
addq $0x1468, %rsp           # imm = 0x1468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xceb51(%rip), %rdi     # 0xd4fd8
leaq 0x859b(%rip), %rsi      # 0xea29
movl $0x36, %edx
callq 0x2190
movq 0xceb39(%rip), %rdi     # 0xd4fd8
callq 0x2090
leaq 0x85b5(%rip), %rdi      # 0xea60
leaq 0x846d(%rip), %rsi      # 0xe91f
leaq 0x9d64(%rip), %rcx      # 0x1021d
movl $0x133, %edx            # imm = 0x133
callq 0x20c0
leaq 0x8699(%rip), %rdi      # 0xeb63
leaq 0x844e(%rip), %rsi      # 0xe91f
leaq 0x9d45(%rip), %rcx      # 0x1021d
movl $0x11d, %edx            # imm = 0x11D
callq 0x20c0
leaq 0x8724(%rip), %rdi      # 0xec0d
leaq 0x842f(%rip), %rsi      # 0xe91f
leaq 0x9d26(%rip), %rcx      # 0x1021d
movl $0x138, %edx            # imm = 0x138
callq 0x20c0
movq 0xcead0(%rip), %rdi     # 0xd4fd8
leaq 0x83fa(%rip), %rsi      # 0xe909
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x83f5(%rip), %rdi      # 0xe918
leaq 0x83f5(%rip), %rsi      # 0xe91f
leaq 0x9cec(%rip), %rcx      # 0x1021d
movl $0xbe, %edx
callq 0x20c0
movq 0xcea96(%rip), %rdi     # 0xd4fd8
leaq 0x84a3(%rip), %rsi      # 0xe9ec
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x83bb(%rip), %rdi      # 0xe918
leaq 0x83bb(%rip), %rsi      # 0xe91f
leaq 0x9cb2(%rip), %rcx      # 0x1021d
movl $0xc3, %edx
callq 0x20c0
movl %eax, %ebp
movq 0xcea5a(%rip), %rbx     # 0xd4fd8
leaq 0x8476(%rip), %rsi      # 0xe9fb
movl $0x18, %edx
movq %rbx, %rdi
callq 0x2190
movq %rbx, %rdi
movl $0x12, %esi
callq 0x2200
movq %rax, %rbx
leaq 0x859c(%rip), %rsi      # 0xeb45
movl $0x9, %edx
movq %rax, %rdi
callq 0x2190
movq %rbx, %rdi
movl %ebp, %esi
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 0x8423(%rip), %rdi      # 0xea14
leaq 0x8327(%rip), %rsi      # 0xe91f
leaq 0x9c1e(%rip), %rcx      # 0x1021d
movl $0xcf, %edx
callq 0x20c0
movq 0xce9c8(%rip), %rdi     # 0xd4fd8
leaq 0x8412(%rip), %rsi      # 0xea29
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x8435(%rip), %rdi      # 0xea60
leaq 0x82ed(%rip), %rsi      # 0xe91f
leaq 0x9be4(%rip), %rcx      # 0x1021d
movl $0xd3, %edx
callq 0x20c0
movq 0xce98e(%rip), %rdi     # 0xd4fd8
leaq 0x8415(%rip), %rsi      # 0xea66
callq 0x2150
movq %rax, %rdi
callq 0x2090
leaq 0x82b3(%rip), %rdi      # 0xe918
leaq 0x82b3(%rip), %rsi      # 0xe91f
leaq 0x9baa(%rip), %rcx      # 0x1021d
movl $0xda, %edx
callq 0x20c0
jmp 0x66ca
jmp 0x6698
jmp 0x6698
jmp 0x6685
movq %rax, %rbx
jmp 0x66b5
jmp 0x6698
jmp 0x6698
jmp 0x6698
jmp 0x6698
jmp 0x6698
jmp 0x6698
jmp 0x6698
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x66b5
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0xe0(%rsp), %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2210
movq %rax, %rdi
callq 0x75d6