// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_filter.cpp
// Function: BamTools::FilterTool::FilterToolPrivate::ParseScript()
bool FilterTool::FilterToolPrivate::ParseScript(void) {
  
    // read in script contents from file
    const string document = GetScriptContents();
    
    // set up JsonCPP reader and attempt to parse script
    Json::Value root;
    Json::Reader reader;
    if ( !reader.parse(document, root) ) {
        // use built-in error reporting mechanism to alert user what was wrong with the script
        cerr  << "bamtools filter ERROR: failed to parse script - see error message(s) below" << endl
              << reader.getFormatedErrorMessages();
        return false;     
    }

    // initialize return status
    bool success = true;
    
    // see if root object contains multiple filters
    const Json::Value filters = root["filters"];
    if ( !filters.isNull() ) {
      
        // iterate over any filters found
        int filterIndex = 0;
        Json::Value::const_iterator filtersIter = filters.begin();
        Json::Value::const_iterator filtersEnd  = filters.end();
        for ( ; filtersIter != filtersEnd; ++filtersIter, ++filterIndex ) {
            Json::Value filter = (*filtersIter);
            
            // convert filter index to string
            string filterName;
            
            // if id tag supplied
            const Json::Value id = filter["id"];
            if ( !id.isNull() ) 
                filterName = id.asString();
            
            // use array index 
            else {
                stringstream convert;
                convert << filterIndex;
                filterName = convert.str();
            }
            
            // create & parse filter 
            success &= ParseFilterObject(filterName, filter);
        }
        
        // see if user defined a "rule" for these filters
        // otherwise, use filter engine's default rule behavior
        string ruleString("");
        const Json::Value rule = root["rule"];
        if ( rule.isString() )
            ruleString = rule.asString();
        m_filterEngine.setRule(ruleString);
          
        // return success/fail
        return success;
    } 
    
    // otherwise, root is the only filter (just contains properties)
    // create & parse filter named "ROOT"
    else success = ParseFilterObject("ROOT", root);
    
    // return success/failure
    return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movq %rdi, %rsi
leaq 0xa0(%rsp), %rdi
movq %rsi, 0x8(%rsp)
callq 0x31d44
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x6b93e
leaq 0x278(%rsp), %rdi
callq 0x66b04
leaq 0x278(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movl $0x1, %ecx
callq 0x66d12
testb %al, %al
je 0x33fbf
leaq 0x3de7c(%rip), %rsi     # 0x71db1
leaq 0x50(%rsp), %rdi
callq 0x6cb34
leaq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x6bb74
leaq 0x68(%rsp), %rdi
callq 0x6c780
testb %al, %al
je 0x340cb
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3de4d(%rip), %rsi     # 0x71dbe
leaq 0x3de4a(%rip), %rdx     # 0x71dc2
leaq 0xf0(%rsp), %rdi
callq 0x2f1a0
leaq 0xf0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x33bfa
movl %eax, %ebp
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x33fb0
callq 0x27560
leaq 0x68(%rsp), %rdi
callq 0x6bce2
jmp 0x3404d
movq 0x5b01a(%rip), %rbx     # 0x8efe0
leaq 0x3dd99(%rip), %rsi     # 0x71d66
movl $0x4a, %edx
movq %rbx, %rdi
callq 0x276b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq 0x5afe8(%rip), %rdi     # 0x8efe0
callq 0x27040
movq %rax, %rdi
callq 0x27410
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x68b42
movq 0xf0(%rsp), %rsi
movq 0xf8(%rsp), %rdx
movq %rbx, %rdi
callq 0x276b0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3404b
callq 0x27560
xorl %ebp, %ebp
leaq 0x370(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34063
callq 0x27560
leaq 0x328(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34079
callq 0x27560
leaq 0x2c8(%rsp), %rdi
callq 0x3a5d2
leaq 0x278(%rsp), %rdi
callq 0x3a76a
leaq 0x50(%rsp), %rdi
callq 0x6bce2
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x340b3
callq 0x27560
andb $0x1, %bpl
movl %ebp, %eax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x68(%rsp), %rdi
callq 0x6d264
movq %rax, 0x80(%rsp)
movb %dl, 0x88(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x6d2b0
leaq 0x90(%rsp), %rcx
movq %rax, (%rcx)
movb %dl, 0x8(%rcx)
xorl %r13d, %r13d
movb $0x1, %bpl
leaq 0x80(%rsp), %r14
leaq 0xd8(%rsp), %r12
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
leaq 0x90(%rsp), %rsi
callq 0x6b53a
testb %al, %al
jne 0x3426a
movq %r14, %rdi
callq 0x6b4d4
movq %r12, %rdi
movq %rax, %rsi
callq 0x6bb74
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %r12, %rdi
leaq 0x3d0ec(%rip), %rsi     # 0x71253
callq 0x6cb34
movq %r15, %rdi
movq %rax, %rsi
callq 0x6bb74
movq %r15, %rdi
callq 0x6c780
testb %al, %al
je 0x341e5
leaq 0xf0(%rsp), %rdi
callq 0x27440
leaq 0x100(%rsp), %rdi
movl %r13d, %esi
callq 0x27ab0
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
leaq 0x108(%rsp), %rsi
callq 0x27990
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x27350
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x341d6
callq 0x27560
leaq 0xf0(%rsp), %rdi
callq 0x27490
jmp 0x3421f
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6bfea
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x27350
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x3421f
callq 0x27560
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x33bfa
movl %eax, %ebx
movq %r15, %rdi
callq 0x6bce2
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3424f
callq 0x27560
movq %r12, %rdi
callq 0x6bce2
movq %r14, %rdi
callq 0x6b4dc
andb %bl, %bpl
incl %r13d
jmp 0x3411a
leaq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
movq %rax, (%rdi)
leaq 0x42593(%rip), %rdx     # 0x76817
movq %rdx, %rsi
callq 0x2f1a0
leaq 0x3db26(%rip), %rsi     # 0x71db9
leaq 0x50(%rsp), %rdi
callq 0x6cb34
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x6bb74
leaq 0x30(%rsp), %rdi
callq 0x6d0f2
testb %al, %al
je 0x342ed
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6bfea
leaq 0xf0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x27350
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x342ed
callq 0x27560
movq 0x8(%rsp), %rax
leaq 0x68(%rax), %rbx
movq 0x70(%rax), %rdx
cmpq 0xf8(%rsp), %rdx
jne 0x3431d
testq %rdx, %rdx
je 0x3433b
movq 0xf0(%rsp), %rsi
movq (%rbx), %rdi
callq 0x275f0
testl %eax, %eax
je 0x3433b
leaq 0xf0(%rsp), %rsi
movq %rbx, %rdi
callq 0x27350
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
callq 0x3c326
leaq 0x30(%rsp), %rdi
callq 0x6bce2
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
jne 0x33fab
jmp 0x33fb0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x343d3
callq 0x27560
jmp 0x343d3
jmp 0x343d0
jmp 0x344c3
jmp 0x344c3
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
jne 0x343fb
jmp 0x344c6
jmp 0x344c3
jmp 0x344c3
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x344d0
callq 0x27560
jmp 0x344d0
jmp 0x34431
jmp 0x344c3
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6bce2
jmp 0x343e2
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x344c6
callq 0x27560
jmp 0x344c6
movq %rax, %rbx
leaq 0x278(%rsp), %rdi
callq 0x3a76a
jmp 0x344dd
jmp 0x34505
jmp 0x34431
movq %rax, %rbx
jmp 0x344e7
movq %rax, %rbx
jmp 0x344dd
movq %rax, %rbx
jmp 0x344d0
jmp 0x34489
jmp 0x34475
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x34478
callq 0x27560
jmp 0x34478
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x3448c
callq 0x27560
jmp 0x3448c
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x27490
jmp 0x3448c
jmp 0x34489
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x6bce2
jmp 0x344a0
jmp 0x344c3
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x344b4
callq 0x27560
leaq 0xd8(%rsp), %rdi
callq 0x6bce2
jmp 0x344c6
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x6bce2
leaq 0x278(%rsp), %rdi
callq 0x39c44
leaq 0x50(%rsp), %rdi
callq 0x6bce2
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x344fd
callq 0x27560
movq %rbx, %rdi
callq 0x27b10
movq %rax, %rdi
callq 0x2e1cd
nop