// File: /workspace/github_cpp_makefile_star2_O3/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, %ebp
leaq 0xe(%rsp), %r12
leaq 0xd(%rsp), %r13
movq %r15, %rdi
movq %r14, %rsi
callq 0x27980
testb %al, %al
je 0x541df
movb $0x0, 0xe(%rsp)
movq (%rbx), %rsi
addq %rbp, %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x277e0
testb %al, %al
je 0x540f2
movzbl 0xe(%rsp), %eax
cmpl $0x42, %eax
jne 0x5417e
movb $0x0, 0xd(%rsp)
movq (%rbx), %rsi
addq %rbp, %rsi
movq %r14, %rdi
movq %r13, %rdx
callq 0x27740
testb %al, %al
je 0x540f2
movzbl 0xd(%rsp), %eax
cmpl $0x62, %eax
jle 0x542d8
cmpl $0x68, %eax
jg 0x542fa
cmpl $0x63, %eax
je 0x54389
cmpl $0x66, %eax
jne 0x54326
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5bf1e
jmp 0x542b8
cmpl $0x59, %eax
jg 0x541b1
leal -0x41(%rax), %ecx
cmpl $0x8, %ecx
ja 0x54214
leaq 0x20af6(%rip), %rax     # 0x74c8c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5679e
jmp 0x542b8
cmpl $0x65, %eax
jle 0x541e6
cmpl $0x66, %eax
je 0x5429c
cmpl $0x69, %eax
je 0x542ab
cmpl $0x73, %eax
jne 0x5423a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x55720
jmp 0x542b8
movb $0x1, %bl
jmp 0x542ba
cmpl $0x5a, %eax
je 0x54202
cmpl $0x63, %eax
jne 0x5423a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x54f6c
jmp 0x542b8
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x58706
jmp 0x542b8
cmpl $0x53, %eax
jne 0x5423a
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x56f46
jmp 0x542b8
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5776c
jmp 0x542b8
movq 0x3ad9f(%rip), %rdi     # 0x8efe0
leaq 0x20c07(%rip), %rsi     # 0x74e4f
movl $0x34, %edx
callq 0x276b0
movb 0xe(%rsp), %al
leaq 0xf(%rsp), %rsi
movb %al, (%rsi)
movq 0x3ad7c(%rip), %rdi     # 0x8efe0
movl $0x1, %edx
callq 0x276b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
xorl %ebx, %ebx
jmp 0x542ba
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x57e98
jmp 0x542b8
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x55f46
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x27920
movl %ebx, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x43, %eax
je 0x54317
cmpl $0x49, %eax
je 0x543ad
cmpl $0x53, %eax
jne 0x54326
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5afdc
jmp 0x542b8
cmpl $0x69, %eax
je 0x5439b
cmpl $0x73, %eax
jne 0x54326
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x59900
jmp 0x542b8
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5a842
jmp 0x542b8
movq 0x3acb3(%rip), %rdi     # 0x8efe0
leaq 0x20adc(%rip), %rsi     # 0x74e10
movl $0x3e, %edx
callq 0x276b0
movb 0xd(%rsp), %al
leaq 0xf(%rsp), %rsi
movb %al, (%rsi)
movq 0x3ac90(%rip), %rdi     # 0x8efe0
movl $0x1, %edx
callq 0x276b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
jmp 0x54298
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x59166
jmp 0x542b8
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5a0a2
jmp 0x542b8
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5b77e
jmp 0x542b8
jmp 0x543c7
jmp 0x543c7
jmp 0x543c7
jmp 0x543c7
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x27920
movq %rbx, %rdi
callq 0x27b10
movq %rax, %rdi
callq 0x2e1cd