// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/BamAlignment.h
// Function: bool BamTools::BamAlignment::GetTag<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned char&) 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 0x5d1ff
movq %rdi, %rbx
movq 0x90(%rdi), %rax
testq %rax, %rax
je 0x5d1ff
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 0x27710
testb %al, %al
je 0x5d1ff
movq 0x40(%rsp), %rsi
movzbl -0x1(%rsi), %r15d
movl %r15d, %eax
andb $-0x3, %al
cmpb $0x41, %al
jne 0x5d1ff
movl $0x1, %edx
cmpl $0x52, %r15d
jle 0x5d175
cmpl $0x65, %r15d
jg 0x5d20b
cmpl $0x53, %r15d
je 0x5d21d
cmpl $0x5a, %r15d
je 0x5d192
cmpl $0x63, %r15d
je 0x5d229
jmp 0x5d239
leal -0x41(%r15), %eax
cmpl $0x8, %eax
ja 0x5d239
leaq 0x18b27(%rip), %rcx     # 0x75cb0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x164d9(%rip), %rsi     # 0x7367b
leaq 0x164e6(%rip), %rdx     # 0x7368f
leaq 0x20(%rsp), %rdi
callq 0x2f1b2
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x164cd(%rip), %rsi     # 0x73690
leaq 0x16506(%rip), %rdx     # 0x736d0
movq %rsp, %rdi
callq 0x2f1b2
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x27060
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x5d1f0
callq 0x27560
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x5d1ff
callq 0x27560
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpl $0x66, %r15d
je 0x5d224
cmpl $0x69, %r15d
je 0x5d224
cmpl $0x73, %r15d
jne 0x5d239
movl $0x2, %edx
jmp 0x5d229
movl $0x4, %edx
movb $0x0, (%r14)
movq %r14, %rdi
callq 0x274c0
movb $0x1, %al
jmp 0x5d201
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x16488(%rip), %rsi     # 0x736d1
leaq 0x16493(%rip), %rdx     # 0x736e3
movq %rsp, %rdi
callq 0x2f1b2
movsbl %r15b, %edx
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x4203c
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x5d277
callq 0x27560
movq %rsp, %rdi
movq %r14, (%rdi)
leaq 0x163f7(%rip), %rsi     # 0x7367b
leaq 0x16404(%rip), %rdx     # 0x7368f
callq 0x2f1b2
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x27060
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x5d2ae
callq 0x27560
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x5d1fa
jmp 0x5d1ff
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x5d2db
callq 0x27560
jmp 0x5d2db
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x5d316
jmp 0x5d320
movq %rax, %rbx
movq (%rsp), %rdi
jmp 0x5d311
jmp 0x5d31d
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x5d30c
callq 0x27560
jmp 0x5d30c
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x5d320
callq 0x27560
jmp 0x5d320
movq %rax, %rbx
movq %rbx, %rdi
callq 0x27b20