// File: zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_properties.h
// Function: bool BamTools::PropertyFilterValue::check<unsigned int>(unsigned int const&) const
bool PropertyFilterValue::check(const T& query) const {
  
    // ensure filter value & query are same type
    if ( !Value.is_type<T>() ) { 
        std::cerr << "Cannot compare different types!" << std::endl;
        return false;
    }
    
    // string matching
    if ( Value.is_type<std::string>() ) {
        std::cerr << "Cannot compare different types - query is a string!" << std::endl;
        return false;
    } 
    
    // numeric matching based on our filter type
    switch ( Type ) {
        case ( PropertyFilterValue::EXACT)              : return ( query == Value.get<T>() );
        case ( PropertyFilterValue::GREATER_THAN)       : return ( query >  Value.get<T>() ); 
        case ( PropertyFilterValue::GREATER_THAN_EQUAL) : return ( query >= Value.get<T>() ); 
        case ( PropertyFilterValue::LESS_THAN)          : return ( query <  Value.get<T>() );
        case ( PropertyFilterValue::LESS_THAN_EQUAL)    : return ( query <= Value.get<T>() );
        case ( PropertyFilterValue::NOT)                : return ( query != Value.get<T>() );
        default : BAMTOOLS_ASSERT_UNREACHABLE;
    }
    return false;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x38(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xbadb0
testb $0x1, %al
jne 0xb9acd
movq 0xab538(%rip), %rdi     # 0x164fe0
leaq 0x76338(%rip), %rsi     # 0x12fde7
callq 0x86700
movq %rax, %rdi
movq 0xab4b2(%rip), %rsi     # 0x164f70
callq 0x86770
movb $0x0, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rdi
callq 0xa9640
testb $0x1, %al
jne 0xb9add
jmp 0xb9b09
movq 0xab4fc(%rip), %rdi     # 0x164fe0
leaq 0x7631c(%rip), %rsi     # 0x12fe07
callq 0x86700
movq %rax, %rdi
movq 0xab476(%rip), %rsi     # 0x164f70
callq 0x86770
movb $0x0, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rax
movl 0x8(%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, 0x20(%rsp)
subl $0x5, %eax
ja 0xb9c38
movq 0x20(%rsp), %rax
leaq 0x7539c(%rip), %rcx     # 0x12eecc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
callq 0xbadf0
movq %rax, %rcx
movl 0x1c(%rsp), %eax
cmpl (%rcx), %eax
sete %al
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x18(%rsp)
callq 0xbadf0
movq %rax, %rcx
movl 0x18(%rsp), %eax
cmpl (%rcx), %eax
seta %al
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x14(%rsp)
callq 0xbadf0
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl (%rcx), %eax
setae %al
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xbadf0
movq %rax, %rcx
movl 0x10(%rsp), %eax
cmpl (%rcx), %eax
setb %al
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xc(%rsp)
callq 0xbadf0
movq %rax, %rcx
movl 0xc(%rsp), %eax
cmpl (%rcx), %eax
setbe %al
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0xb9c42
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x8(%rsp)
callq 0xbadf0
movq %rax, %rcx
movl 0x8(%rsp), %eax
cmpl (%rcx), %eax
setne %al
andb $0x1, %al
movb %al, 0x47(%rsp)
jmp 0xb9c42
callq 0xafa50
movb $0x0, 0x47(%rsp)
movb 0x47(%rsp), %al
andb $0x1, %al
addq $0x48, %rsp
retq
nopl (%rax)