// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_split.cpp
// Function: BamTools::SplitTool::SplitToolPrivate::SplitTag()
bool SplitTool::SplitToolPrivate::SplitTag(void) {  
  
    // iterate through alignments, until we hit TAG
    BamAlignment al;
    while ( m_reader.GetNextAlignment(al) ) {
      
        // look for tag in this alignment and get tag type
        char tagType(0);
        if ( !al.GetTagType(m_settings->TagToSplit, tagType) )
            continue;
        
        // request split method based on tag type
        // pass it the current alignment found
        switch ( tagType ) {
          
            case (Constants::BAM_TAG_TYPE_INT8)   : return SplitTagImpl<int8_t>(al);
            case (Constants::BAM_TAG_TYPE_INT16)  : return SplitTagImpl<int16_t>(al);
            case (Constants::BAM_TAG_TYPE_INT32)  : return SplitTagImpl<int32_t>(al);
            case (Constants::BAM_TAG_TYPE_UINT8)  : return SplitTagImpl<uint8_t>(al);
            case (Constants::BAM_TAG_TYPE_UINT16) : return SplitTagImpl<uint16_t>(al);
            case (Constants::BAM_TAG_TYPE_UINT32) : return SplitTagImpl<uint32_t>(al);
            case (Constants::BAM_TAG_TYPE_FLOAT)  : return SplitTagImpl<float>(al);
            
            case (Constants::BAM_TAG_TYPE_ASCII)  :
            case (Constants::BAM_TAG_TYPE_STRING) :
            case (Constants::BAM_TAG_TYPE_HEX)    :
                return SplitTagImpl<string>(al);

            case (Constants::BAM_TAG_TYPE_ARRAY) : {

                char arrayTagType(0);
                if (!al.GetArrayTagType(m_settings->TagToSplit, arrayTagType))
                    continue;
                switch(arrayTagType) {
                    case (Constants::BAM_TAG_TYPE_INT8)   : return SplitListTagImpl<int8_t>(al);
                    case (Constants::BAM_TAG_TYPE_INT16)  : return SplitListTagImpl<int16_t>(al);
                    case (Constants::BAM_TAG_TYPE_INT32)  : return SplitListTagImpl<int32_t>(al);
                    case (Constants::BAM_TAG_TYPE_UINT8)  : return SplitListTagImpl<uint8_t>(al);
                    case (Constants::BAM_TAG_TYPE_UINT16) : return SplitListTagImpl<uint16_t>(al);
                    case (Constants::BAM_TAG_TYPE_UINT32) : return SplitListTagImpl<uint32_t>(al);
                    case (Constants::BAM_TAG_TYPE_FLOAT)  : return SplitListTagImpl<float>(al);
                    default:
                        cerr << "bamtools split ERROR: array tag has unsupported element type: " << arrayTagType << endl;
                        return false;
                }
            }
          
            default:
                cerr << "bamtools split ERROR: unknown tag type encountered: " << tagType << endl;
                return false;
        }
    }
    
    // tag not found, but that's not an error - return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x27220
leaq 0x28(%rbx), %r15
movl $0x90, %r12d
movq %r15, %rdi
movq %r14, %rsi
callq 0x27990
testb %al, %al
je 0x5450f
movb $0x0, 0xe(%rsp)
movq (%rbx), %rsi
addq %r12, %rsi
movq %r14, %rdi
leaq 0xe(%rsp), %rdx
callq 0x277f0
movb $0x1, %r13b
testb %al, %al
je 0x543b8
movzbl 0xe(%rsp), %eax
cmpl $0x52, %eax
jle 0x542bb
cmpl $0x65, %eax
jg 0x542e7
cmpl $0x53, %eax
je 0x5439b
cmpl $0x5a, %eax
je 0x542d7
cmpl $0x63, %eax
jne 0x543c6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x550e2
jmp 0x543b3
addl $-0x41, %eax
cmpl $0x8, %eax
ja 0x543c6
leaq 0x219a6(%rip), %rcx     # 0x75c74
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %r14, %rsi
callq 0x58828
jmp 0x543b3
cmpl $0x66, %eax
je 0x543a8
cmpl $0x69, %eax
je 0x5438e
cmpl $0x73, %eax
jne 0x543c6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x55896
jmp 0x543b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57854
jmp 0x543b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x568ee
jmp 0x543b3
movb $0x0, 0xd(%rsp)
movq (%rbx), %rsi
addq %r12, %rsi
movq %r14, %rdi
leaq 0xd(%rsp), %rdx
callq 0x27750
movl %eax, %r13d
testb %al, %al
je 0x54506
movzbl 0xd(%rsp), %eax
cmpl $0x62, %eax
jle 0x5442a
cmpl $0x68, %eax
jg 0x5444d
cmpl $0x63, %eax
je 0x544df
cmpl $0x66, %eax
jne 0x5447b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5c04a
jmp 0x54504
movq %rbx, %rdi
movq %r14, %rsi
callq 0x560ac
jmp 0x543b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5703e
jmp 0x543b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57f90
movl %eax, %ebp
xorl %r13d, %r13d
testb %r13b, %r13b
jne 0x5424f
jmp 0x54512
movl $0x34, %edx
movq 0x3bc0e(%rip), %rdi     # 0x8ffe0
leaq 0x21a84(%rip), %rsi     # 0x75e5d
callq 0x276c0
movb 0xe(%rsp), %al
movb %al, 0xf(%rsp)
movl $0x1, %edx
movq 0x3bbee(%rip), %rdi     # 0x8ffe0
leaq 0xf(%rsp), %rsi
callq 0x276c0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %r13, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
xorl %ebp, %ebp
jmp 0x543b5
cmpl $0x43, %eax
je 0x5446b
cmpl $0x49, %eax
je 0x544f9
cmpl $0x53, %eax
jne 0x5447b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5b0fe
jmp 0x54504
cmpl $0x69, %eax
je 0x544ec
cmpl $0x73, %eax
jne 0x5447b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x59a1a
jmp 0x54504
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5a966
jmp 0x54504
movl $0x3e, %edx
movq 0x3bb59(%rip), %rdi     # 0x8ffe0
leaq 0x21990(%rip), %rsi     # 0x75e1e
callq 0x276c0
movb 0xd(%rsp), %al
movb %al, 0xf(%rsp)
movl $0x1, %edx
movq 0x3bb39(%rip), %rdi     # 0x8ffe0
leaq 0xf(%rsp), %rsi
callq 0x276c0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbp, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
xorl %ebp, %ebp
jmp 0x54506
movq %rbx, %rdi
movq %r14, %rsi
callq 0x59282
jmp 0x54504
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5a1c0
jmp 0x54504
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5b8a4
movl %eax, %ebp
xorb $0x1, %r13b
jmp 0x543b8
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x27930
andb $0x1, %bpl
movl %ebp, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x54538
jmp 0x54538
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x27930
movq %rbx, %rdi
callq 0x27b20
movq %rax, %rdi
callq 0x2e1ed
nop