// File: auton1[P]viterbi/entry_filters.cpp
// Function: entry::filter_sites_by_BED_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void entry::filter_sites_by_BED_file(const string &bed_file, bool BED_exclude)
{
	// Filter sites depending on positions in a BED file.
	if (passed_filters == false)
		return;

	if (bed_file == "")
		return;

	int pos1, pos2, idx;
	if (lims.empty())
	{
		ifstream BED(bed_file.c_str());
		if (!BED.is_open())
			LOG.error("Could not open BED file: " + bed_file);

		string chr;
		unsigned int N_chr=chr_to_idx.size();
		BED.ignore(numeric_limits<streamsize>::max(), '\n');	// Ignore header
		unsigned int N_BED_entries=0;
		while (!BED.eof())
		{
			BED >> chr >> pos1 >> pos2;
			BED.ignore(numeric_limits<streamsize>::max(), '\n');

			if (chr_to_idx.find(chr) == chr_to_idx.end())
			{
				N_chr++;
				chr_to_idx[chr] = (N_chr-1);
				lims.resize(N_chr);
			}

			idx = chr_to_idx[chr];
			lims[idx].push_back(make_pair(pos1,pos2));
			N_BED_entries++;
		}
		BED.close();

		LOG.printLOG("\tRead " + output_log::int2str(N_BED_entries) + " BED file entries.\n");

		for (unsigned int ui=0; ui<lims.size(); ui++)
			sort(lims[ui].begin(), lims[ui].end());
	}
	vector<unsigned int> min_ui(lims.size(), 0);
	parse_basic_entry(true);

	pos1 = POS;
	pos2 = pos1;
	unsigned int N_alleles = get_N_alleles();
	for (int i=0; i<(int)N_alleles; i++)
		pos2 = max(pos2, (int)(pos1 + get_allele(i).length() - 1));

	if (BED_exclude == false)
	{	// Exclude sites not in BED file
		if (chr_to_idx.find(CHROM) == chr_to_idx.end())
			passed_filters = false;
		else
		{
			idx = chr_to_idx[CHROM];
			bool found=false;
			unsigned int max_ui = lims[idx].size();
			for (unsigned int ui=min_ui[idx]; ui<max_ui; ui++)
			{	// No need to start this loop at zero every time...
				if (((pos1 > lims[idx][ui].first) && (pos1 <= lims[idx][ui].second)) ||	// Start pos inside bin
					((pos2 > lims[idx][ui].first) && (pos2 <= lims[idx][ui].second)) ||	// End pos inside bin
					((pos1 <= lims[idx][ui].first) && (pos2 >= lims[idx][ui].second)))	// Variant spans bin
				{
					found=true;
					break;
				}
				else if (pos1 > lims[idx][ui].second)
					min_ui[idx] = ui+1;
			}
			if (found == false)
				passed_filters = false;
		}
	}
	else
	{	// Exclude sites in BED file
		if (chr_to_idx.find(CHROM) != chr_to_idx.end())
		{
			idx = chr_to_idx[CHROM];
			bool found=false;
			unsigned int max_ui = lims[idx].size();
			for (unsigned int ui=min_ui[idx]; ui<max_ui; ui++)
			{	// No need to start this loop at zero every time...
				if (((pos1 > lims[idx][ui].first) && (pos1 <= lims[idx][ui].second)) ||	// Start pos inside bin
					((pos2 > lims[idx][ui].first) && (pos2 <= lims[idx][ui].second)) ||	// End pos inside bin
					((pos1 <= lims[idx][ui].first) && (pos2 >= lims[idx][ui].second)))	// Variant spans bin
				{
					found=true;
					break;
				}
				else if (pos1 > lims[idx][ui].second)
					min_ui[idx] = ui+1;
			}
			if (found == true)
				passed_filters = false;
		}
	}
}

// Assembly:
subq $0x4d8, %rsp            # imm = 0x4D8
movb %dl, %al
movq %rdi, 0x4d0(%rsp)
movq %rsi, 0x4c8(%rsp)
andb $0x1, %al
movb %al, 0x4c7(%rsp)
movq 0x4d0(%rsp), %rax
movq %rax, 0x100(%rsp)
movb 0xc(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5bc74
jmp 0x5ca10
movq 0x4c8(%rsp), %rdi
leaq 0x1a0a6(%rip), %rsi     # 0x75d29
callq 0xea20
testb $0x1, %al
jne 0x5bc8e
jmp 0x5bc93
jmp 0x5ca10
leaq 0x38846(%rip), %rdi     # 0x944e0
callq 0x5f000
testb $0x1, %al
jne 0x5bca8
jmp 0x5c202
movq 0x4c8(%rsp), %rdi
callq 0x61a0
movq %rax, %rsi
leaq 0x2b0(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
movl $0x8, %edx
callq 0x6a60
movq 0xf0(%rsp), %rdi
callq 0x68d0
movb %al, 0xff(%rsp)
jmp 0x5bce8
movb 0xff(%rsp), %al
testb $0x1, %al
jne 0x5bd80
jmp 0x5bcf9
movq 0x4c8(%rsp), %rdx
leaq 0x19fcf(%rip), %rsi     # 0x75cd7
leaq 0x280(%rsp), %rdi
callq 0xe8d0
jmp 0x5bd17
leaq 0x378e2(%rip), %rdi     # 0x93600
leaq 0x280(%rsp), %rsi
movl $0x1, %edx
callq 0x712f0
jmp 0x5bd32
leaq 0x280(%rsp), %rdi
callq 0x6b50
jmp 0x5bd80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
jmp 0x5c1f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
leaq 0x280(%rsp), %rdi
callq 0x6b50
jmp 0x5c1f0
leaq 0x260(%rsp), %rdi
callq 0x67e0
leaq 0x3871c(%rip), %rdi     # 0x944b0
callq 0x5ee40
movl %eax, 0x25c(%rsp)
callq 0x5ede0
movq %rax, %rsi
leaq 0x2b0(%rsp), %rdi
movl $0xa, %edx
callq 0x62e0
jmp 0x5bdbc
movl $0x0, 0x258(%rsp)
movq 0x2b0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x2b0(%rsp,%rax), %rdi
callq 0x6a70
movb %al, 0xef(%rsp)
jmp 0x5bde9
movb 0xef(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5bdfb
jmp 0x5bff4
leaq 0x2b0(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x6720
movq %rax, 0xe0(%rsp)
jmp 0x5be1a
movq 0xe0(%rsp), %rdi
leaq 0x4c0(%rsp), %rsi
callq 0x62b0
movq %rax, 0xd8(%rsp)
jmp 0x5be39
movq 0xd8(%rsp), %rdi
leaq 0x4bc(%rsp), %rsi
callq 0x62b0
jmp 0x5be50
callq 0x5ede0
movq %rax, %rsi
leaq 0x2b0(%rsp), %rdi
movl $0xa, %edx
callq 0x62e0
jmp 0x5be6c
leaq 0x3863d(%rip), %rdi     # 0x944b0
leaq 0x260(%rsp), %rsi
callq 0x310f0
movq %rax, 0xd0(%rsp)
jmp 0x5be8a
movq 0xd0(%rsp), %rax
movq %rax, 0x250(%rsp)
leaq 0x3860f(%rip), %rdi     # 0x944b0
callq 0x31120
movq %rax, 0x248(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x32ab0
testb $0x1, %al
jne 0x5becc
jmp 0x5bf4d
movl 0x25c(%rsp), %eax
incl %eax
movl %eax, 0x25c(%rsp)
movl 0x25c(%rsp), %eax
decl %eax
movl %eax, 0xc4(%rsp)
leaq 0x385bd(%rip), %rdi     # 0x944b0
leaq 0x260(%rsp), %rsi
callq 0x30fe0
movq %rax, 0xc8(%rsp)
jmp 0x5bf0a
movq 0xc8(%rsp), %rax
movl 0xc4(%rsp), %ecx
movl %ecx, (%rax)
movl 0x25c(%rsp), %eax
movl %eax, %esi
leaq 0x385b5(%rip), %rdi     # 0x944e0
callq 0x5f050
jmp 0x5bf32
jmp 0x5bf4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
jmp 0x5c1e3
leaq 0x3855c(%rip), %rdi     # 0x944b0
leaq 0x260(%rsp), %rsi
callq 0x30fe0
movq %rax, 0xb8(%rsp)
jmp 0x5bf6b
movq 0xb8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4b8(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x38555(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, 0xa8(%rsp)
leaq 0x4c0(%rsp), %rdi
leaq 0x4bc(%rsp), %rsi
callq 0x5f140
movq %rax, 0xb0(%rsp)
jmp 0x5bfb7
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rax
movq %rax, 0x240(%rsp)
leaq 0x240(%rsp), %rsi
callq 0x5f110
jmp 0x5bfde
movl 0x258(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x258(%rsp)
jmp 0x5bdc7
leaq 0x2b0(%rsp), %rdi
callq 0x60d0
jmp 0x5c003
movl 0x258(%rsp), %esi
leaq 0x1e0(%rsp), %rdi
callq 0x71730
jmp 0x5c019
leaq 0x19cd1(%rip), %rsi     # 0x75cf1
leaq 0x200(%rsp), %rdi
leaq 0x1e0(%rsp), %rdx
callq 0xf4f0
jmp 0x5c037
leaq 0x19cba(%rip), %rdx     # 0x75cf8
leaq 0x220(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0xf4a0
jmp 0x5c055
leaq 0x375a4(%rip), %rdi     # 0x93600
leaq 0x220(%rsp), %rsi
callq 0x71280
jmp 0x5c06b
leaq 0x220(%rsp), %rdi
callq 0x6b50
leaq 0x200(%rsp), %rdi
callq 0x6b50
leaq 0x1e0(%rsp), %rdi
callq 0x6b50
movl $0x0, 0x1dc(%rsp)
movl 0x1dc(%rsp), %eax
movq %rax, 0xa0(%rsp)
leaq 0x3842d(%rip), %rdi     # 0x944e0
callq 0x5f170
movq %rax, %rcx
movq 0xa0(%rsp), %rax
cmpq %rcx, %rax
jae 0x5c1c7
movl 0x1dc(%rsp), %eax
movl %eax, %esi
leaq 0x38404(%rip), %rdi     # 0x944e0
movq %rdi, 0x88(%rsp)
callq 0x5f0f0
movq %rax, %rsi
leaq 0x1b8(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x5f1e0
movq 0x88(%rsp), %rdi
movl 0x1dc(%rsp), %eax
movl %eax, %esi
callq 0x5f0f0
movq %rax, %rsi
leaq 0x198(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x5f210
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rsi
callq 0x5f190
jmp 0x5c146
jmp 0x5c148
movl 0x1dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1dc(%rsp)
jmp 0x5c09d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
jmp 0x5c1b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
jmp 0x5c1ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x6b50
leaq 0x200(%rsp), %rdi
callq 0x6b50
leaq 0x1e0(%rsp), %rdi
callq 0x6b50
jmp 0x5c1e3
leaq 0x260(%rsp), %rdi
callq 0x6b50
leaq 0x2b0(%rsp), %rdi
callq 0x6b38
jmp 0x5c202
leaq 0x260(%rsp), %rdi
callq 0x6b50
leaq 0x2b0(%rsp), %rdi
callq 0x6b38
jmp 0x5ca25
leaq 0x382d7(%rip), %rdi     # 0x944e0
callq 0x5f170
movq %rax, 0x78(%rsp)
movl $0x0, 0x17c(%rsp)
leaq 0x17b(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x11210
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
leaq 0x180(%rsp), %rdi
leaq 0x17c(%rsp), %rdx
callq 0x4f2b0
jmp 0x5c257
leaq 0x17b(%rsp), %rdi
callq 0x119d0
movq 0x100(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movl $0x1, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
jmp 0x5c280
movq 0x100(%rsp), %rdi
movl 0x400(%rdi), %eax
movl %eax, 0x4c0(%rsp)
movl 0x4c0(%rsp), %eax
movl %eax, 0x4bc(%rsp)
callq 0x4c290
movl %eax, 0x74(%rsp)
jmp 0x5c2ae
movl 0x74(%rsp), %eax
movl %eax, 0x174(%rsp)
movl $0x0, 0x170(%rsp)
movl 0x170(%rsp), %eax
cmpl 0x174(%rsp), %eax
jge 0x5c3dd
movq 0x100(%rsp), %rsi
movslq 0x4c0(%rsp), %rax
movq %rax, 0x68(%rsp)
movl 0x170(%rsp), %edx
leaq 0x148(%rsp), %rdi
callq 0x4aa20
jmp 0x5c303
leaq 0x148(%rsp), %rdi
callq 0x6850
movq %rax, %rcx
movq 0x68(%rsp), %rax
movl %ecx, %edx
movl %eax, %ecx
movl %ecx, %eax
movl %edx, %ecx
leal -0x1(%rax,%rcx), %eax
movl %eax, 0x16c(%rsp)
leaq 0x4bc(%rsp), %rdi
leaq 0x16c(%rsp), %rsi
callq 0x100a0
movq %rax, 0x60(%rsp)
jmp 0x5c347
movq 0x60(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4bc(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x6b50
movl 0x170(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x170(%rsp)
jmp 0x5c2c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
leaq 0x17b(%rsp), %rdi
callq 0x119d0
jmp 0x5ca25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
jmp 0x5ca18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2a8(%rsp)
movl %eax, 0x2a4(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x6b50
jmp 0x5ca18
movb 0x4c7(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5c704
movq 0x100(%rsp), %rsi
addq $0x3e0, %rsi            # imm = 0x3E0
leaq 0x380a8(%rip), %rdi     # 0x944b0
callq 0x310f0
movq %rax, 0x58(%rsp)
jmp 0x5c414
movq 0x58(%rsp), %rax
movq %rax, 0x140(%rsp)
leaq 0x38088(%rip), %rdi     # 0x944b0
callq 0x31120
movq %rax, 0x138(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x32ab0
testb $0x1, %al
jne 0x5c450
jmp 0x5c461
movq 0x100(%rsp), %rax
movb $0x0, 0xc(%rax)
jmp 0x5c6ff
movq 0x100(%rsp), %rsi
addq $0x3e0, %rsi            # imm = 0x3E0
leaq 0x38039(%rip), %rdi     # 0x944b0
callq 0x30fe0
movq %rax, 0x50(%rsp)
jmp 0x5c483
movq 0x50(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4b8(%rsp)
movb $0x0, 0x137(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x38038(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
callq 0x5f240
movl %eax, 0x130(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0xe8b0
movl (%rax), %eax
movl %eax, 0x12c(%rsp)
movl 0x12c(%rsp), %eax
cmpl 0x130(%rsp), %eax
jae 0x5c6e0
movl 0x4c0(%rsp), %eax
movl %eax, 0x4c(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37fd8(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x4c(%rsp), %eax
cmpl (%rcx), %eax
jle 0x5c569
movl 0x4c0(%rsp), %eax
movl %eax, 0x48(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37f9d(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x48(%rsp), %eax
cmpl 0x4(%rcx), %eax
jle 0x5c657
movl 0x4bc(%rsp), %eax
movl %eax, 0x44(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37f5d(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x44(%rsp), %eax
cmpl (%rcx), %eax
jle 0x5c5e0
movl 0x4bc(%rsp), %eax
movl %eax, 0x40(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37f22(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x40(%rsp), %eax
cmpl 0x4(%rcx), %eax
jle 0x5c657
movl 0x4c0(%rsp), %eax
movl %eax, 0x3c(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37ee6(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x3c(%rsp), %eax
cmpl (%rcx), %eax
jg 0x5c661
movl 0x4bc(%rsp), %eax
movl %eax, 0x38(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37eab(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x38(%rsp), %eax
cmpl 0x4(%rcx), %eax
jl 0x5c661
movb $0x1, 0x137(%rsp)
jmp 0x5c6e0
movl 0x4c0(%rsp), %eax
movl %eax, 0x34(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37e65(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x12c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x34(%rsp), %eax
cmpl 0x4(%rcx), %eax
jle 0x5c6c6
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0xe8b0
movl 0x30(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x5c6c8
jmp 0x5c6ca
movl 0x12c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x12c(%rsp)
jmp 0x5c4da
movb 0x137(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5c6fd
movq 0x100(%rsp), %rax
movb $0x0, 0xc(%rax)
jmp 0x5c6ff
jmp 0x5ca03
movq 0x100(%rsp), %rsi
addq $0x3e0, %rsi            # imm = 0x3E0
leaq 0x37d96(%rip), %rdi     # 0x944b0
callq 0x310f0
movq %rax, 0x28(%rsp)
jmp 0x5c726
movq 0x28(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x37d76(%rip), %rdi     # 0x944b0
callq 0x31120
movq %rax, 0x118(%rsp)
leaq 0x120(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x310d0
testb $0x1, %al
jne 0x5c765
jmp 0x5ca01
movq 0x100(%rsp), %rsi
addq $0x3e0, %rsi            # imm = 0x3E0
leaq 0x37d35(%rip), %rdi     # 0x944b0
callq 0x30fe0
movq %rax, 0x20(%rsp)
jmp 0x5c787
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4b8(%rsp)
movb $0x0, 0x117(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37d34(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
callq 0x5f240
movl %eax, 0x110(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0xe8b0
movl (%rax), %eax
movl %eax, 0x10c(%rsp)
movl 0x10c(%rsp), %eax
cmpl 0x110(%rsp), %eax
jae 0x5c9e2
movl 0x4c0(%rsp), %eax
movl %eax, 0x1c(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37cd4(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x1c(%rsp), %eax
cmpl (%rcx), %eax
jle 0x5c86d
movl 0x4c0(%rsp), %eax
movl %eax, 0x18(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37c99(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x18(%rsp), %eax
cmpl 0x4(%rcx), %eax
jle 0x5c95b
movl 0x4bc(%rsp), %eax
movl %eax, 0x14(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37c59(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl (%rcx), %eax
jle 0x5c8e4
movl 0x4bc(%rsp), %eax
movl %eax, 0x10(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37c1e(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x10(%rsp), %eax
cmpl 0x4(%rcx), %eax
jle 0x5c95b
movl 0x4c0(%rsp), %eax
movl %eax, 0xc(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37be2(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0xc(%rsp), %eax
cmpl (%rcx), %eax
jg 0x5c965
movl 0x4bc(%rsp), %eax
movl %eax, 0x8(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37ba7(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x8(%rsp), %eax
cmpl 0x4(%rcx), %eax
jl 0x5c965
movb $0x1, 0x117(%rsp)
jmp 0x5c9e2
movl 0x4c0(%rsp), %eax
movl %eax, 0x4(%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x37b61(%rip), %rdi     # 0x944e0
callq 0x5f0f0
movq %rax, %rdi
movl 0x10c(%rsp), %eax
movl %eax, %esi
callq 0x5f260
movq %rax, %rcx
movl 0x4(%rsp), %eax
cmpl 0x4(%rcx), %eax
jle 0x5c9c8
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
movslq 0x4b8(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0xe8b0
movl (%rsp), %ecx
movl %ecx, (%rax)
jmp 0x5c9ca
jmp 0x5c9cc
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x5c7de
movb 0x117(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x5c9ff
movq 0x100(%rsp), %rax
movb $0x0, 0xc(%rax)
jmp 0x5ca01
jmp 0x5ca03
leaq 0x180(%rsp), %rdi
callq 0x10c00
addq $0x4d8, %rsp            # imm = 0x4D8
retq
leaq 0x180(%rsp), %rdi
callq 0x10c00
movq 0x2a8(%rsp), %rdi
callq 0x69e0
nopw %cs:(%rax,%rax)