// File: /workspace/github_cpp_makefile_star2_O2/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 $0x60, %rsp
cmpb $0x0, 0x130(%rdi)
jne 0x4a56e
movq %rdi, %rbx
movq 0x90(%rdi), %rax
testq %rax, %rax
je 0x4a56e
movq %rdx, %r14
movq 0x88(%rbx), %rcx
leaq 0x50(%rsp), %rdx
movq %rcx, (%rdx)
leaq 0x5c(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x58(%rsp), %r8
andl $0x0, (%r8)
movq %rbx, %rdi
callq 0x35700
testb %al, %al
je 0x4a56e
movq 0x50(%rsp), %rsi
movzbl -0x1(%rsi), %r15d
leal -0x41(%r15), %ecx
rorb %cl
xorl %eax, %eax
cmpb $0x9, %cl
ja 0x4a570
movzbl %cl, %ecx
movl $0x213, %edx            # imm = 0x213
btl %ecx, %edx
jae 0x4a570
pushq $0x1
popq %rdx
leal -0x41(%r15), %eax
cmpl $0x8, %eax
jbe 0x4a485
cmpl $0x73, %r15d
je 0x4a481
cmpl $0x5a, %r15d
je 0x4a495
cmpl $0x63, %r15d
je 0x4a4ef
cmpl $0x66, %r15d
je 0x4a4ec
cmpl $0x69, %r15d
je 0x4a4ec
cmpl $0x53, %r15d
jne 0x4a4ff
pushq $0x2
jmp 0x4a4ee
leaq 0x2775c(%rip), %rcx     # 0x71be8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2816c(%rip), %rsi     # 0x72608
leaq 0x30(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x35280
leaq 0x2816b(%rip), %rsi     # 0x7261d
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x35280
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x35050
leaq 0x10(%rsp), %rdi
callq 0x35730
leaq 0x30(%rsp), %rdi
callq 0x35730
jmp 0x4a56e
pushq $0x4
popq %rdx
andl $0x0, (%r14)
movq %r14, %rdi
callq 0x354c0
movb $0x1, %al
jmp 0x4a570
leaq 0x28158(%rip), %rsi     # 0x7265e
leaq 0x10(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x35280
movsbl %r15b, %edx
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4acce
leaq 0x10(%rsp), %rdi
callq 0x35730
leaq 0x280cf(%rip), %rsi     # 0x72608
leaq 0x10(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x35280
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x35050
leaq 0x10(%rsp), %rdi
callq 0x35730
leaq 0x30(%rsp), %rdi
callq 0x35730
xorl %eax, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x35730
jmp 0x4a59b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x35730
jmp 0x4a5ca
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x35730
jmp 0x4a5ca
jmp 0x4a5b8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x35730
jmp 0x4a5c0
movq %rax, %rbx
jmp 0x4a5ca
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x35730
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198