// File: /workspace/github_cpp_makefile_star2_O1/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 0x31d6a
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x6bf78
leaq 0x278(%rsp), %rdi
callq 0x670a8
leaq 0x278(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movl $0x1, %ecx
callq 0x672b6
testb %al, %al
je 0x33ff9
leaq 0x3ee42(%rip), %rsi     # 0x72db1
leaq 0x50(%rsp), %rdi
callq 0x6d17c
leaq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x6c1ae
leaq 0x68(%rsp), %rdi
callq 0x6ce52
testb %al, %al
je 0x34105
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3ee13(%rip), %rsi     # 0x72dbe
leaq 0x3ee10(%rip), %rdx     # 0x72dc2
leaq 0xf0(%rsp), %rdi
callq 0x2f1b2
leaq 0xf0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x33c34
movl %eax, %ebp
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x33fea
callq 0x27560
leaq 0x68(%rsp), %rdi
callq 0x6c31c
jmp 0x34087
movq 0x5bfe0(%rip), %rbx     # 0x8ffe0
leaq 0x3ed5f(%rip), %rsi     # 0x72d66
movl $0x4a, %edx
movq %rbx, %rdi
callq 0x276c0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq 0x5bfae(%rip), %rdi     # 0x8ffe0
callq 0x27040
movq %rax, %rdi
callq 0x27410
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x691ea
movq 0xf0(%rsp), %rsi
movq 0xf8(%rsp), %rdx
movq %rbx, %rdi
callq 0x276c0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34085
callq 0x27560
xorl %ebp, %ebp
leaq 0x370(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3409d
callq 0x27560
leaq 0x328(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x340b3
callq 0x27560
leaq 0x2c8(%rsp), %rdi
callq 0x3a64a
leaq 0x278(%rsp), %rdi
callq 0x3a7d6
leaq 0x50(%rsp), %rdi
callq 0x6c31c
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x340ed
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 0x6d814
movq %rax, 0x80(%rsp)
movb %dl, 0x88(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x6d860
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 0x6bb76
testb %al, %al
jne 0x342a4
movq %r14, %rdi
callq 0x6bb10
movq %r12, %rdi
movq %rax, %rsi
callq 0x6c1ae
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %r12, %rdi
leaq 0x3e0b2(%rip), %rsi     # 0x72253
callq 0x6d17c
movq %r15, %rdi
movq %rax, %rsi
callq 0x6c1ae
movq %r15, %rdi
callq 0x6ce52
testb %al, %al
je 0x3421f
leaq 0xf0(%rsp), %rdi
callq 0x27440
leaq 0x100(%rsp), %rdi
movl %r13d, %esi
callq 0x27ac0
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
leaq 0x108(%rsp), %rsi
callq 0x279a0
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x27350
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x34210
callq 0x27560
leaq 0xf0(%rsp), %rdi
callq 0x27490
jmp 0x34259
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6c650
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x27350
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x34259
callq 0x27560
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x33c34
movl %eax, %ebx
movq %r15, %rdi
callq 0x6c31c
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x34289
callq 0x27560
movq %r12, %rdi
callq 0x6c31c
movq %r14, %rdi
callq 0x6bb18
andb %bl, %bpl
incl %r13d
jmp 0x34154
leaq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
movq %rax, (%rdi)
leaq 0x4355d(%rip), %rdx     # 0x7781b
movq %rdx, %rsi
callq 0x2f1b2
leaq 0x3eaec(%rip), %rsi     # 0x72db9
leaq 0x50(%rsp), %rdi
callq 0x6d17c
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x6c1ae
leaq 0x30(%rsp), %rdi
callq 0x6d69a
testb %al, %al
je 0x34327
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6c650
leaq 0xf0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x27350
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x34327
callq 0x27560
movq 0x8(%rsp), %rax
leaq 0x68(%rax), %rbx
movq 0x70(%rax), %rdx
cmpq 0xf8(%rsp), %rdx
jne 0x34357
testq %rdx, %rdx
je 0x34375
movq 0xf0(%rsp), %rsi
movq (%rbx), %rdi
callq 0x275f0
testl %eax, %eax
je 0x34375
leaq 0xf0(%rsp), %rsi
movq %rbx, %rdi
callq 0x27350
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
callq 0x3c396
leaq 0x30(%rsp), %rdi
callq 0x6c31c
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
jne 0x33fe5
jmp 0x33fea
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3440d
callq 0x27560
jmp 0x3440d
jmp 0x3440a
jmp 0x344fd
jmp 0x344fd
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
jne 0x34435
jmp 0x34500
jmp 0x344fd
jmp 0x344fd
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3450a
callq 0x27560
jmp 0x3450a
jmp 0x3446b
jmp 0x344fd
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6c31c
jmp 0x3441c
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x34500
callq 0x27560
jmp 0x34500
movq %rax, %rbx
leaq 0x278(%rsp), %rdi
callq 0x3a7d6
jmp 0x34517
jmp 0x3453f
jmp 0x3446b
movq %rax, %rbx
jmp 0x34521
movq %rax, %rbx
jmp 0x34517
movq %rax, %rbx
jmp 0x3450a
jmp 0x344c3
jmp 0x344af
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x344b2
callq 0x27560
jmp 0x344b2
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x344c6
callq 0x27560
jmp 0x344c6
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x27490
jmp 0x344c6
jmp 0x344c3
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x6c31c
jmp 0x344da
jmp 0x344fd
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x344ee
callq 0x27560
leaq 0xd8(%rsp), %rdi
callq 0x6c31c
jmp 0x34500
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x6c31c
leaq 0x278(%rsp), %rdi
callq 0x39cbc
leaq 0x50(%rsp), %rdi
callq 0x6c31c
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34537
callq 0x27560
movq %rbx, %rdi
callq 0x27b20
movq %rax, %rdi
callq 0x2e1ed
nop