// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/api/BamAlignment.h
// Function: bool BamTools::BamAlignment::GetTag<unsigned int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int&) const
inline bool BamAlignment::GetTag(const std::string& tag, T& destination) const {

    // skip if alignment is core-only
    if ( SupportData.HasCoreOnly ) {
        // TODO: set error string?
        return false;
    }

    // skip if no tags present
    if ( TagData.empty() ) {
        // TODO: set error string?
        return false;
    }

    // localize the tag data
    char* pTagData = (char*)TagData.data();
    const unsigned int tagDataLength = TagData.size();
    unsigned int numBytesParsed = 0;

    // return failure if tag not found
    if ( !FindTag(tag, pTagData, tagDataLength, numBytesParsed) ) {
        // TODO: set error string?
        return false;
    }

    // fetch data type
    const char type = *(pTagData - 1);
    if ( !TagTypeHelper<T>::CanConvertFrom(type) ) {
        // TODO: set error string ?
        return false;
    }

    // determine data length
    int destinationLength = 0;
    switch ( type ) {

        // 1 byte data
        case (Constants::BAM_TAG_TYPE_ASCII) :
        case (Constants::BAM_TAG_TYPE_INT8)  :
        case (Constants::BAM_TAG_TYPE_UINT8) :
            destinationLength = 1;
            break;

        // 2 byte data
        case (Constants::BAM_TAG_TYPE_INT16)  :
        case (Constants::BAM_TAG_TYPE_UINT16) :
            destinationLength = 2;
            break;

        // 4 byte data
        case (Constants::BAM_TAG_TYPE_INT32)  :
        case (Constants::BAM_TAG_TYPE_UINT32) :
        case (Constants::BAM_TAG_TYPE_FLOAT)  :
            destinationLength = 4;
            break;

        // var-length types not supported for numeric destination
        case (Constants::BAM_TAG_TYPE_STRING) :
        case (Constants::BAM_TAG_TYPE_HEX)    :
        case (Constants::BAM_TAG_TYPE_ARRAY)  :
            SetErrorString("BamAlignment::GetTag",
                           "cannot store variable length tag data into a numeric destination");
            return false;

        // unrecognized tag type
        default:
            const std::string message = std::string("invalid tag type: ") + type;
            SetErrorString("BamAlignment::GetTag", message);
            return false;
    }

    // store data in destination
    destination = 0;
    memcpy(&destination, pTagData, destinationLength);

    // return success
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
cmpb $0x0, 0x130(%rdi)
jne 0x417ca
movq %rdi, %rbx
movq 0x90(%rdi), %rax
testq %rax, %rax
je 0x417ca
movq %rdx, %r14
movq 0x88(%rbx), %rcx
leaq 0x40(%rsp), %rdx
movq %rcx, (%rdx)
leaq 0x4c(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x48(%rsp), %r8
movl $0x0, (%r8)
movq %rbx, %rdi
callq 0x27700
testb %al, %al
je 0x417ca
movq 0x40(%rsp), %rsi
movzbl -0x1(%rsi), %r15d
leal -0x41(%r15), %ecx
rorb %cl
xorl %eax, %eax
cmpb $0x9, %cl
ja 0x417cc
movzbl %cl, %ecx
movl $0x213, %edx            # imm = 0x213
btl %ecx, %edx
jae 0x417cc
movl $0x1, %edx
cmpl $0x52, %r15d
jle 0x41740
cmpl $0x65, %r15d
jg 0x417d6
cmpl $0x53, %r15d
je 0x417e8
cmpl $0x5a, %r15d
je 0x4175d
cmpl $0x63, %r15d
je 0x417f4
jmp 0x41807
leal -0x41(%r15), %eax
cmpl $0x8, %eax
ja 0x41807
leaq 0x304f8(%rip), %rcx     # 0x71c4c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x30f0e(%rip), %rsi     # 0x7267b
leaq 0x30f1b(%rip), %rdx     # 0x7268f
leaq 0x20(%rsp), %rdi
callq 0x2f1a0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x30f02(%rip), %rsi     # 0x72690
leaq 0x30f3b(%rip), %rdx     # 0x726d0
movq %rsp, %rdi
callq 0x2f1a0
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x27060
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x417bb
callq 0x27560
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x417ca
callq 0x27560
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpl $0x66, %r15d
je 0x417ef
cmpl $0x69, %r15d
je 0x417ef
cmpl $0x73, %r15d
jne 0x41807
movl $0x2, %edx
jmp 0x417f4
movl $0x4, %edx
movl $0x0, (%r14)
movq %r14, %rdi
callq 0x274c0
movb $0x1, %al
jmp 0x417cc
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x30eba(%rip), %rsi     # 0x726d1
leaq 0x30ec5(%rip), %rdx     # 0x726e3
movq %rsp, %rdi
callq 0x2f1a0
movsbl %r15b, %edx
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x41f6e
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x41845
callq 0x27560
movq %rsp, %rdi
movq %r14, (%rdi)
leaq 0x30e29(%rip), %rsi     # 0x7267b
leaq 0x30e36(%rip), %rdx     # 0x7268f
callq 0x2f1a0
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x27060
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x4187c
callq 0x27560
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x417c5
jmp 0x417ca
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x418a9
callq 0x27560
jmp 0x418a9
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x418e4
jmp 0x418ee
movq %rax, %rbx
movq (%rsp), %rdi
jmp 0x418df
jmp 0x418eb
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x418da
callq 0x27560
jmp 0x418da
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x418ee
callq 0x27560
jmp 0x418ee
movq %rax, %rbx
movq %rbx, %rdi
callq 0x27b10