// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x3c0(%rdi), %rax
cmpq 0x3c8(%rdi), %rax
je 0x28e06
movq %rsi, %r14
movzbl 0x1d9(%rsi), %esi
movzbl 0x2fa(%r14), %edx
movq %rbx, %rdi
callq 0x28e34
leaq 0x400(%r14), %r15
leaq 0x3e0(%r14), %r12
leaq 0x3c0(%r14), %rsi
movq %rbx, %rdi
callq 0x2c328
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2c12c
leaq 0x300(%r14), %rsi
leaq 0x330(%r14), %rdx
movzbl 0x2f9(%r14), %ecx
movq %rbx, %rdi
callq 0x29006
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x122fe(%rip), %rdx     # 0x3aeff
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0xc868
cmpq $0x1, 0x80(%r14)
jne 0x28c2a
movq 0x70(%r14), %rsi
addq $0x20, %rsi
leaq 0x8(%rsp), %rdi
callq 0x51f0
movl 0x430(%r14), %edx
movl 0xa8(%r14), %ecx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x29194
leaq 0x2b8(%r14), %rsi
leaq 0xb0(%r14), %rdx
movq %rbx, %rdi
callq 0x2922c
leaq 0x2d8(%r14), %rsi
leaq 0xd0(%r14), %rdx
movq %rbx, %rdi
callq 0x29a2a
leaq 0x58(%r14), %rsi
leaq 0x28(%r14), %rdx
movq %rbx, %rdi
callq 0x2a26e
leaq 0x8(%r14), %rsi
movzbl 0x1(%r14), %edx
movq %rbx, %rdi
callq 0x2a2d4
movl 0x208(%r14), %edx
movl 0x23c(%r14), %esi
movq %rbx, %rdi
callq 0x2ae0a
leaq 0x390(%r14), %rsi
leaq 0x360(%r14), %rdx
movq %rbx, %rdi
callq 0x2ae5e
movsd 0x278(%r14), %xmm0
movq %rbx, %rdi
callq 0x2b276
movsd 0x220(%r14), %xmm1
movsd 0x260(%r14), %xmm0
movq %rbx, %rdi
callq 0x2b312
leaq 0x1e8(%r14), %rsi
movzbl 0x1d8(%r14), %edx
movl 0x25c(%r14), %ecx
movq %rbx, %rdi
callq 0x2b4a8
cmpb $0x1, 0x2b4(%r14)
jne 0x28d19
movq %rbx, %rdi
callq 0x2b876
movsd 0x248(%r14), %xmm0
movq %rbx, %rdi
callq 0x2b8ec
movl 0x20c(%r14), %edx
movl 0x240(%r14), %esi
movq %rbx, %rdi
callq 0x2b9a8
leaq 0xf0(%r14), %rsi
movzbl 0x2f8(%r14), %edx
movq %rbx, %rdi
callq 0x2ba6a
movsd 0x1e0(%r14), %xmm0
movsd 0x218(%r14), %xmm1
movsd 0x270(%r14), %xmm2
movsd 0x230(%r14), %xmm3
movsd 0x288(%r14), %xmm4
movq %rbx, %rdi
callq 0x2bb2c
xorps %xmm0, %xmm0
cvtsi2sdl 0x1dc(%r14), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x210(%r14), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdl 0x268(%r14), %xmm2
xorps %xmm3, %xmm3
cvtsi2sdl 0x22c(%r14), %xmm3
xorps %xmm4, %xmm4
cvtsi2sdl 0x228(%r14), %xmm4
movq %rbx, %rdi
callq 0x2bd40
movsd 0x250(%r14), %xmm0
movq %rbx, %rdi
callq 0x2bf80
movl 0x258(%r14), %esi
movq %rbx, %rdi
callq 0x2c098
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x28dff
callq 0x5410
movl $0x1, %eax
jmp 0x28e0c
movb $0x0, 0xc(%rbx)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x28e1a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x28e2c
callq 0x5410
movq %rbx, %rdi
callq 0x57d0