// File: /workspace/github_cpp_makefile_star2_O2/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 0x35200
leaq 0x28(%rbx), %r15
movl $0x90, %ebp
leaq 0xf(%rsp), %r12
leaq 0x1c3f6(%rip), %r13     # 0x74c5c
movq %r15, %rdi
movq %r14, %rsi
callq 0x359b0
testb %al, %al
je 0x5896e
movb $0x0, 0xf(%rsp)
movq (%rbx), %rsi
addq %rbp, %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x35800
testb %al, %al
je 0x58866
movzbl 0xf(%rsp), %eax
leal -0x41(%rax), %ecx
cmpl $0x8, %ecx
ja 0x5891c
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
movb $0x0, 0xe(%rsp)
movq (%rbx), %rsi
addq %rbp, %rsi
movq %r14, %rdi
leaq 0xe(%rsp), %rdx
callq 0x35760
testb %al, %al
je 0x58866
movzbl 0xe(%rsp), %eax
cmpl $0x43, %eax
je 0x58a46
cmpl $0x49, %eax
je 0x58a94
cmpl $0x53, %eax
je 0x58a82
cmpl $0x73, %eax
je 0x58a19
cmpl $0x66, %eax
je 0x58a37
cmpl $0x69, %eax
je 0x58a28
cmpl $0x63, %eax
jne 0x58a55
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5c67c
jmp 0x589f9
cmpl $0x53, %eax
je 0x589ec
cmpl $0x5a, %eax
je 0x5895c
cmpl $0x73, %eax
je 0x589bf
cmpl $0x66, %eax
je 0x589dd
cmpl $0x69, %eax
je 0x589ce
cmpl $0x63, %eax
jne 0x58975
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x595ea
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5bf7a
jmp 0x589f9
movb $0x1, %bl
jmp 0x589fb
movq 0x3c664(%rip), %rdi     # 0x94fe0
leaq 0x1c49c(%rip), %rsi     # 0x74e1f
callq 0x355b0
movsbl 0xf(%rsp), %esi
movq %rax, %rdi
callq 0x356e0
movq %rax, %rdi
callq 0x35300
xorl %ebx, %ebx
jmp 0x589fb
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5a7b6
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5b396
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x59bd8
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5a1ca
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5b982
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5ada4
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x35940
movl %ebx, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5cc70
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5d264
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5ea34
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5d858
jmp 0x589f9
movq 0x3c584(%rip), %rdi     # 0x94fe0
leaq 0x1c37d(%rip), %rsi     # 0x74de0
callq 0x355b0
movsbl 0xe(%rsp), %esi
movq %rax, %rdi
callq 0x356e0
movq %rax, %rdi
callq 0x35300
jmp 0x5899d
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5de4c
jmp 0x589f9
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x5e440
jmp 0x589f9
jmp 0x58aae
jmp 0x58aae
jmp 0x58aae
jmp 0x58aae
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x35940
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
nop