// File: auton1[P]viterbi/entry_filters.cpp
// Function: entry::filter_sites_by_INFO(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
void entry::filter_sites_by_INFO(const set<string> &flags_to_remove, const set<string> &flags_to_keep)
{
	// Filter sites by entries in the INFO field.
	if (passed_filters == false)
		return;

	if ((flags_to_remove.empty()) && (flags_to_keep.empty()))
		return;

	string value;
	unsigned int N_to_remove = flags_to_remove.size();
	unsigned int N_to_keep = flags_to_keep.size();

	parse_basic_entry(false, false, true);

	if (N_to_keep > 0)
	{
		bool keep = false;
		for (set<string>::iterator it=flags_to_keep.begin(); it != flags_to_keep.end(); ++it)
		{
			if (entry_header.INFO_map[ entry_header.INFO_reverse_map[*it] ].Type != Flag)
				LOG.error("Using INFO flag filtering on non flag type "+*it+" will not work correctly.");
			else
			{
				value = get_INFO_value(*it);
				if (value == "1")
					keep = true;
			}
		}
		passed_filters = keep;
	}

	if (passed_filters==false)
		return;

	if (N_to_remove > 0)
	{
		for (set<string>::iterator it=flags_to_remove.begin(); it != flags_to_remove.end(); ++it)
		{
			if (entry_header.INFO_map[ entry_header.INFO_reverse_map[*it] ].Type != Flag)
				LOG.error("Using INFO flag filtering on non flag type "+*it+" will not work correctly.");
			else
			{
				value = get_INFO_value(*it);
				if (value == "1")
				{
					passed_filters = false;
					continue;
				}
			}
		}
	}
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x1b0(%rsp)
movq %rsi, 0x1a8(%rsp)
movq %rdx, 0x1a0(%rsp)
movq 0x1b0(%rsp), %rax
movq %rax, 0x78(%rsp)
movb 0xc(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5cb0e
jmp 0x5d015
movq 0x1a8(%rsp), %rdi
callq 0x4d120
testb $0x1, %al
jne 0x5cb21
jmp 0x5cb39
movq 0x1a0(%rsp), %rdi
callq 0x4d120
testb $0x1, %al
jne 0x5cb34
jmp 0x5cb39
jmp 0x5d015
leaq 0x180(%rsp), %rdi
callq 0x67e0
movq 0x1a8(%rsp), %rdi
callq 0x10b30
movl %eax, 0x17c(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x10b30
movq 0x78(%rsp), %rdi
movl %eax, 0x178(%rsp)
movq (%rdi), %rax
movq 0x10(%rax), %rax
xorl %edx, %edx
movl $0x1, %ecx
movl %edx, %esi
callq *%rax
jmp 0x5cb87
cmpl $0x0, 0x178(%rsp)
jbe 0x5cdc8
movb $0x0, 0x16b(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x10ad0
movq %rax, 0x160(%rsp)
movq 0x1a0(%rsp), %rdi
callq 0x10ba0
movq %rax, 0x158(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x39760
testb $0x1, %al
jne 0x5cbe5
jmp 0x5cdb6
movq 0x78(%rsp), %rax
movq %rax, %rcx
addq $0x70, %rcx
movq %rcx, 0x60(%rsp)
addq $0x190, %rax            # imm = 0x190
movq %rax, 0x68(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x10b00
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x30fe0
movq %rax, 0x70(%rsp)
jmp 0x5cc22
movq 0x70(%rsp), %rsi
movq 0x60(%rsp), %rdi
callq 0x30ef0
movq %rax, 0x58(%rsp)
jmp 0x5cc38
movq 0x58(%rsp), %rax
cmpl $0x4, 0x88(%rax)
je 0x5cd2a
leaq 0x160(%rsp), %rdi
callq 0x10b00
movq %rax, %rdx
leaq 0x191c5(%rip), %rsi     # 0x75e26
leaq 0x118(%rsp), %rdi
callq 0xe8d0
jmp 0x5cc70
leaq 0x191db(%rip), %rdx     # 0x75e52
leaq 0x138(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0xf4a0
jmp 0x5cc8e
leaq 0x3696b(%rip), %rdi     # 0x93600
leaq 0x138(%rsp), %rsi
movl $0x1, %edx
callq 0x712f0
jmp 0x5cca9
leaq 0x138(%rsp), %rdi
callq 0x6b50
leaq 0x118(%rsp), %rdi
callq 0x6b50
jmp 0x5cda2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x5d01d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x5cd18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x6b50
leaq 0x118(%rsp), %rdi
callq 0x6b50
jmp 0x5d01d
leaq 0x160(%rsp), %rdi
callq 0x10b00
movq 0x78(%rsp), %rsi
movq %rax, %rdx
leaq 0xf8(%rsp), %rdi
callq 0x4b760
jmp 0x5cd4e
leaq 0x180(%rsp), %rdi
movq %rdi, 0x48(%rsp)
leaq 0xf8(%rsp), %rsi
movq %rsi, 0x40(%rsp)
callq 0x66c0
movq 0x40(%rsp), %rdi
callq 0x6b50
movq 0x48(%rsp), %rdi
leaq 0x172d0(%rip), %rsi     # 0x74053
callq 0xea20
movb %al, 0x57(%rsp)
jmp 0x5cd8e
movb 0x57(%rsp), %al
testb $0x1, %al
jne 0x5cd98
jmp 0x5cda0
movb $0x1, 0x16b(%rsp)
jmp 0x5cda2
jmp 0x5cda4
leaq 0x160(%rsp), %rdi
callq 0x5f300
jmp 0x5cbb2
movq 0x78(%rsp), %rax
movb 0x16b(%rsp), %cl
andb $0x1, %cl
movb %cl, 0xc(%rax)
movq 0x78(%rsp), %rax
movb 0xc(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5cdea
movl $0x1, 0xf4(%rsp)
jmp 0x5d008
cmpl $0x0, 0x17c(%rsp)
jbe 0x5cffd
movq 0x1a8(%rsp), %rdi
callq 0x10ad0
movq %rax, 0xe8(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x10ba0
movq %rax, 0xe0(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x39760
testb $0x1, %al
jne 0x5ce40
jmp 0x5cffb
movq 0x78(%rsp), %rax
movq %rax, %rcx
addq $0x70, %rcx
movq %rcx, 0x28(%rsp)
addq $0x190, %rax            # imm = 0x190
movq %rax, 0x30(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x10b00
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x30fe0
movq %rax, 0x38(%rsp)
jmp 0x5ce7d
movq 0x38(%rsp), %rsi
movq 0x28(%rsp), %rdi
callq 0x30ef0
movq %rax, 0x20(%rsp)
jmp 0x5ce93
movq 0x20(%rsp), %rax
cmpl $0x4, 0x88(%rax)
je 0x5cf6c
leaq 0xe8(%rsp), %rdi
callq 0x10b00
movq %rax, %rdx
leaq 0x18f6a(%rip), %rsi     # 0x75e26
leaq 0xa0(%rsp), %rdi
callq 0xe8d0
jmp 0x5cecb
leaq 0x18f80(%rip), %rdx     # 0x75e52
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xf4a0
jmp 0x5cee9
leaq 0x36710(%rip), %rdi     # 0x93600
leaq 0xc0(%rsp), %rsi
movl $0x1, %edx
callq 0x712f0
jmp 0x5cf04
leaq 0xc0(%rsp), %rdi
callq 0x6b50
leaq 0xa0(%rsp), %rdi
callq 0x6b50
jmp 0x5cfe7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x5cf5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x6b50
leaq 0xa0(%rsp), %rdi
callq 0x6b50
jmp 0x5d01d
leaq 0xe8(%rsp), %rdi
callq 0x10b00
movq 0x78(%rsp), %rsi
movq %rax, %rdx
leaq 0x80(%rsp), %rdi
callq 0x4b760
jmp 0x5cf90
leaq 0x180(%rsp), %rdi
movq %rdi, 0x10(%rsp)
leaq 0x80(%rsp), %rsi
movq %rsi, 0x8(%rsp)
callq 0x66c0
movq 0x8(%rsp), %rdi
callq 0x6b50
movq 0x10(%rsp), %rdi
leaq 0x1708e(%rip), %rsi     # 0x74053
callq 0xea20
movb %al, 0x1f(%rsp)
jmp 0x5cfd0
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x5cfda
jmp 0x5cfe5
movq 0x78(%rsp), %rax
movb $0x0, 0xc(%rax)
jmp 0x5cfe9
jmp 0x5cfe7
jmp 0x5cfe9
leaq 0xe8(%rsp), %rdi
callq 0x5f300
jmp 0x5ce0d
jmp 0x5cffd
movl $0x0, 0xf4(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x6b50
addq $0x1b8, %rsp            # imm = 0x1B8
retq
leaq 0x180(%rsp), %rdi
callq 0x6b50
movq 0x170(%rsp), %rdi
callq 0x69e0
nopw (%rax,%rax)