// File: /workspace/github_cpp_makefile_star2_O2/auton1[P]viterbi/entry_filters.cpp
// Function: entry::apply_filters(parameters const&)
int entry::apply_filters(const parameters &params)
{
	if (line.empty())
	{
		passed_filters = false;
		return 0;
	}

// 	Apply all filters in turn.
	filter_sites_by_allele_type(params.keep_only_indels, params.remove_indels);
	filter_sites(params.snps_to_keep, params.snps_to_keep_file, params.snps_to_exclude_file);
	filter_sites_by_filter_status(params.site_filter_flags_to_exclude, params.site_filter_flags_to_keep, params.remove_all_filtered_sites);
	string chr_to_keep = "";
	if (params.chrs_to_keep.size() == 1)
		chr_to_keep = *(params.chrs_to_keep.begin()); // Get first chromosome in list (there should only be one).
	filter_sites_by_position(chr_to_keep, params.start_pos, params.end_pos);
	filter_sites_by_positions(params.positions_file, params.exclude_positions_file);
	filter_sites_by_overlap_positions(params.positions_overlap_file, params.exclude_positions_overlap_file);
	filter_sites_by_chromosome(params.chrs_to_keep, params.chrs_to_exclude);
	filter_sites_by_BED_file(params.BED_file, params.BED_exclude);
	filter_sites_by_number_of_alleles(params.min_alleles, params.max_alleles);
	filter_sites_by_INFO(params.site_INFO_flags_to_remove, params.site_INFO_flags_to_keep);
	filter_sites_by_quality(params.min_quality);
	filter_sites_by_mean_depth(params.min_mean_depth, params.max_mean_depth);
	filter_sites_by_mask(params.mask_file, params.invert_mask, params.min_kept_mask_value);
	if (params.phased_only == true)
		filter_sites_by_phase();
	filter_genotypes_by_quality_value(params.min_genotype_quality);
	filter_genotypes_by_depth_range(params.min_genotype_depth, params.max_genotype_depth);
	filter_genotypes_by_filter_flag(params.geno_filter_flags_to_exclude, params.remove_all_filtered_genotypes);
	filter_sites_by_frequency_and_call_rate(params.min_maf, params.max_maf, params.min_non_ref_af, params.max_non_ref_af, params.min_site_call_rate);
	filter_sites_by_allele_count(params.min_mac, params.max_mac, params.min_non_ref_ac, params.max_non_ref_ac, params.max_missing_call_count);
	filter_sites_by_HWE_pvalue(params.min_HWE_pvalue);
	filter_sites_by_thinning(params.min_interSNP_distance);

	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x3c0(%rdi), %rax
cmpq 0x3c8(%rdi), %rax
je 0x21882
movq %rsi, %r14
movzbl 0x1d9(%rsi), %esi
movzbl 0x2fa(%r14), %edx
movq %rbx, %rdi
callq 0x218a8
leaq 0x400(%r14), %rsi
leaq 0x3e0(%r14), %rdx
leaq 0x3c0(%r14), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0x219f0
leaq 0x300(%r14), %rsi
leaq 0x330(%r14), %rdx
movzbl 0x2f9(%r14), %ecx
movq %rbx, %rdi
callq 0x21a4c
leaq 0xd7a6(%rip), %rsi      # 0x2ee37
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5160
cmpq $0x1, 0x80(%r14)
jne 0x216bc
movq 0x70(%r14), %rsi
addq $0x20, %rsi
leaq 0x8(%rsp), %rdi
callq 0x5210
movl 0x430(%r14), %edx
movl 0xa8(%r14), %ecx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x21bbe
leaq 0x2b8(%r14), %rsi
leaq 0xb0(%r14), %rdx
movq %rbx, %rdi
callq 0x21c40
leaq 0x2d8(%r14), %rsi
leaq 0xd0(%r14), %rdx
movq %rbx, %rdi
callq 0x2226e
leaq 0x58(%r14), %rsi
leaq 0x28(%r14), %rdx
movq %rbx, %rdi
callq 0x2290e
leaq 0x8(%r14), %rsi
movzbl 0x1(%r14), %edx
movq %rbx, %rdi
callq 0x22974
movl 0x208(%r14), %edx
movl 0x23c(%r14), %esi
movq %rbx, %rdi
callq 0x2305a
leaq 0x390(%r14), %rsi
leaq 0x360(%r14), %rdx
movq %rbx, %rdi
callq 0x230ac
movsd 0x278(%r14), %xmm0
movq %rbx, %rdi
callq 0x2339a
movsd 0x220(%r14), %xmm1
movsd 0x260(%r14), %xmm0
movq %rbx, %rdi
callq 0x2342a
leaq 0x1e8(%r14), %rsi
movzbl 0x1d8(%r14), %edx
movl 0x25c(%r14), %ecx
movq %rbx, %rdi
callq 0x235aa
cmpb $0x1, 0x2b4(%r14)
jne 0x217ab
movq %rbx, %rdi
callq 0x23866
movsd 0x248(%r14), %xmm0
movq %rbx, %rdi
callq 0x238e2
movl 0x20c(%r14), %edx
movl 0x240(%r14), %esi
movq %rbx, %rdi
callq 0x2397c
leaq 0xf0(%r14), %rsi
movzbl 0x2f8(%r14), %edx
movq %rbx, %rdi
callq 0x23a20
movsd 0x1e0(%r14), %xmm0
movsd 0x218(%r14), %xmm1
movsd 0x270(%r14), %xmm2
movsd 0x230(%r14), %xmm3
movsd 0x288(%r14), %xmm4
movq %rbx, %rdi
callq 0x23ac4
cvtsi2sdl 0x1dc(%r14), %xmm0
cvtsi2sdl 0x210(%r14), %xmm1
cvtsi2sdl 0x268(%r14), %xmm2
cvtsi2sdl 0x22c(%r14), %xmm3
cvtsi2sdl 0x228(%r14), %xmm4
movq %rbx, %rdi
callq 0x23c9e
movsd 0x250(%r14), %xmm0
movq %rbx, %rdi
callq 0x23ea0
movl 0x258(%r14), %esi
movq %rbx, %rdi
callq 0x23fa0
leaq 0x8(%rsp), %rdi
callq 0x5908
pushq $0x1
popq %rax
jmp 0x21888
movb $0x0, 0xc(%rbx)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x21892
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5908
movq %rbx, %rdi
callq 0x5800
nop