LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::Chop(unsigned long)
void RollingBuffer::Chop(size_t n) {

    // update buffer size
    if ( n > m_totalBufferSize )
        m_totalBufferSize = 0;
    else
        m_totalBufferSize -= n;

    // loop until target case hit
    for ( ; ; ) {

        // if only one array, decrement tail
        if ( m_tailBufferIndex == 0 ) {
            m_tail -= n;

            // if all data chopped
            if ( m_tail <= m_head ) {
                m_head = 0;
                m_tail = 0;
            }
            return;
        }

        // if there's room in last byte array to 'chop', just decrement tail
        if ( n <= m_tail ) {
            m_tail -= n;
            return;
        }

        // otherwise we're going to overlap our internal byte arrays
        // reduce our chop amount by the amount of data in the last byte array
        n -= m_tail;

        // remove last byte array & set tail to it's end
        m_data.pop_back();
        --m_tailBufferIndex;
        m_tail = m_data.at(m_tailBufferIndex).Size();
    }

    // if buffer is now empty, reset state & clear up memory
    if ( IsEmpty() )
        Clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
xorl %ecx, %ecx
subq %rsi, %rax
cmovaeq %rax, %rcx
movq %rcx, 0x18(%rdi)
leaq 0x28(%rdi), %r15
cmpq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rax
je 0x54e43
movq %rax, %rcx
subq %r14, %rcx
jae 0x54e57
subq %rax, %r14
movq %r15, %rdi
callq 0x31df0
movq 0x10(%rbx), %rsi
decq %rsi
movq %rsi, 0x10(%rbx)
movq %r15, %rdi
callq 0x32790
movq %rax, %rdi
callq 0x32b70
movq %rax, 0x8(%rbx)
jmp 0x54e04
subq %r14, %rax
movq %rax, 0x8(%rbx)
cmpq (%rbx), %rax
ja 0x54e5b
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x54e5b
movq %rcx, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::Free(unsigned long)
void RollingBuffer::Free(size_t n) {

    // update buffer size
    if ( n > m_totalBufferSize )
        m_totalBufferSize = 0;
    else
        m_totalBufferSize -= n;

    // loop until target case hit
    for ( ; ; ) {

        const size_t blockSize = BlockSize();

        // if there's room in current array
        if ( n < blockSize ) {

            // shift 'head' over @n bytes
            m_head += n;

            // check for emptied, single byte array
            if ( m_head == m_tail && m_tailBufferIndex == 0 ) {
                m_head = 0;
                m_tail = 0;
            }

            break;
        }

        // otherwise we need to check next byte array
        // first update amount to remove
        n -= blockSize;

        // special case - there was only 1 array
        if ( m_data.size() == 1 ) {
            if ( m_data.at(0).Size() != m_bufferGrowth )
                m_data[0].Resize(m_bufferGrowth);
            m_head = 0;
            m_tail = 0;
            m_tailBufferIndex = 0;
            break;
        }

        // otherwise, remove first array and move to next iteration
        m_data.pop_front();
        --m_tailBufferIndex;
        m_head = 0;
    }

    // if buffer is now empty, reset state & clear up memory
    if ( IsEmpty() )
        Clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rax
xorl %ecx, %ecx
subq %rsi, %rax
cmovaeq %rax, %rcx
movq %rcx, 0x18(%rdi)
leaq 0x28(%rdi), %r14
movq %rsi, %r12
movq %rbx, %rdi
callq 0x320a0
subq %rax, %r12
jb 0x54eb8
movq %r14, %rdi
callq 0x31ea0
cmpq $0x1, %rax
je 0x54ed0
movq %r14, %rdi
callq 0x33370
decq 0x10(%rbx)
andq $0x0, (%rbx)
movq %r12, %r15
jmp 0x54e88
addq (%rbx), %r15
movq %r15, (%rbx)
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
xorq %rax, %r15
orq %rcx, %r15
je 0x54f04
jmp 0x54f0e
movq %r14, %rdi
xorl %esi, %esi
callq 0x32790
movq %rax, %rdi
callq 0x32b70
cmpq 0x20(%rbx), %rax
je 0x54eff
leaq 0x38(%rbx), %rdi
xorl %esi, %esi
callq 0x32b20
movq 0x20(%rbx), %rsi
movq %rax, %rdi
callq 0x323d0
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
xorl %eax, %eax
xorl %ecx, %ecx
orq %rcx, %rax
je 0x54f1f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x338f0
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::Read(char*, unsigned long)
size_t RollingBuffer::Read(char* dest, size_t max) {

    size_t bytesToRead    = std::min(Size(), max);
    size_t bytesReadSoFar = 0;

    while ( bytesReadSoFar < bytesToRead ) {
        const char* readPtr = ReadPointer();
        size_t blockBytes = std::min( (bytesToRead - bytesReadSoFar), BlockSize() );
        if ( dest )
            memcpy(dest+bytesReadSoFar, readPtr, blockBytes);
        bytesReadSoFar += blockBytes;
        Free(blockBytes);
    }

    return bytesReadSoFar;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rax
cmpq %rdx, %rax
cmovbq %rax, %rbx
xorl %r12d, %r12d
movq %rbx, %r13
subq %r12, %r13
jbe 0x54fa6
movq %r15, %rdi
callq 0x35430
movq %rax, %rbp
movq %r15, %rdi
callq 0x320a0
cmpq %r13, %rax
cmovbq %rax, %r13
testq %r14, %r14
je 0x54f96
leaq (%r14,%r12), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x32b40
addq %r13, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0x334d0
jmp 0x54f60
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::ReadPointer() const
const char* RollingBuffer::ReadPointer(void) const {

    // return null if empty buffer
    if ( m_data.empty() )
        return 0;

    // otherwise return pointer to current position
    const ByteArray& first = m_data.front();
    return first.ConstData() + m_head;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
cmpq %rdi, 0x58(%rbx)
je 0x54fd6
callq 0x31570
addq (%rbx), %rax
jmp 0x54fd8
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::ReadLine(char*, unsigned long)
size_t RollingBuffer::ReadLine(char* dest, size_t max) {

    // if we can't read line or if max is 0
    if ( !CanReadLine() || max == 0 )
        return 0;

    // otherwise, read until we hit newline
    size_t bytesReadSoFar = 0;
    bool finished = false;
    while ( !finished ) {

        const size_t index = IndexOf('\n');
        const char* readPtr = ReadPointer();
        size_t bytesToRead = std::min( (index+1)-bytesReadSoFar, BlockSize() );
        bytesToRead = std::min( bytesToRead, (max-1)-bytesReadSoFar );
        memcpy(dest+bytesReadSoFar, readPtr, bytesToRead);
        bytesReadSoFar += bytesToRead;
        Free(bytesToRead);

        if ( !((bytesReadSoFar < index+1) && (bytesReadSoFar < max-1)) )
            finished = true;
    }

    // null terminate 'dest' & return numBytesRead
    dest[bytesReadSoFar] = '\0';
    return bytesReadSoFar;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, (%rsp)
movq %rdi, 0x8(%rsp)
callq 0x34ca0
xorb $0x1, %al
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x5508d
decq %r15
xorl %eax, %eax
xorl %r12d, %r12d
movq 0x8(%rsp), %rbp
testb $0x1, %al
jne 0x55092
movq %rbp, %rdi
pushq $0xa
popq %rsi
callq 0x347e0
movq %rax, %rbx
movq %rbp, %rdi
callq 0x35430
movq %rax, 0x10(%rsp)
incq %rbx
movq %rbx, %r13
subq %r12, %r13
movq %rbp, %rdi
callq 0x320a0
cmpq %r13, %rax
cmovbq %rax, %r13
movq %r15, %r14
subq %r12, %r14
cmpq %r13, %r14
cmovaeq %r13, %r14
movq (%rsp), %rax
leaq (%rax,%r12), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x32b40
addq %r14, %r12
movq %rbp, %rdi
movq %r14, %rsi
callq 0x334d0
cmpq %rbx, %r12
setae %cl
cmpq %r15, %r12
setae %al
orb %cl, %al
jmp 0x55016
xorl %r12d, %r12d
jmp 0x5509b
movq (%rsp), %rax
movb $0x0, (%rax,%r12)
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::DisconnectFromHost()
void TcpSocket::DisconnectFromHost(void) {

    // close socket engine & delete
    if ( m_state == TcpSocket::ConnectedState )
        ResetSocketEngine();

    // reset connection state
//    m_localPort = 0;
    m_remotePort = 0;
//    m_localAddress.Clear();
    m_remoteAddress.Clear();
    m_hostName.clear();
    m_cachedSocketDescriptor = -1;

    // for future, make sure there's outgoing data that needs to be flushed
    m_readBuffer.Clear();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x1, 0xfc(%rdi)
jne 0x5653f
movq %rbx, %rdi
callq 0x33d20
andw $0x0, 0x28(%rbx)
leaq 0x30(%rbx), %rdi
callq 0x353e0
andq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rax
movb $0x0, (%rax)
orl $-0x1, 0x78(%rbx)
subq $-0x80, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x338f0
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::ConnectToHost(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, BamTools::IBamIODevice::OpenMode)
bool TcpSocket::ConnectToHost(const string& hostName,
                              const string& port,
                              IBamIODevice::OpenMode mode)
{
    // create new address object with requested host name
    HostAddress hostAddress;
    hostAddress.SetAddress(hostName);

    HostInfo info;
    // if host name was IP address ("x.x.x.x" or IPv6 format)
    // otherwise host name was 'plain-text' ("www.foo.bar")
    // we need to look up IP address(es)
    if ( hostAddress.HasIPAddress() )
        info.SetAddresses( vector<HostAddress>(1, hostAddress) );
    else
        info = HostInfo::Lookup(hostName, port);

    // attempt connection on requested port
    return ConnectImpl(info, port, mode);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
leaq 0x70(%rsp), %r13
movq %r13, %rdi
callq 0x34a80
movq %r13, %rdi
movq %r12, %rsi
callq 0x34c60
leaq 0xb0(%rsp), %rdi
callq 0x31e10
leaq 0x70(%rsp), %rdi
callq 0x31b80
testb %al, %al
je 0x56961
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
leaq 0x70(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x33b60
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x35700
leaq 0x10(%rsp), %rdi
callq 0x342e0
jmp 0x5698d
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x32580
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x31b70
leaq 0x10(%rsp), %rdi
callq 0x34d80
leaq 0xb0(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x330d0
movl %eax, %ebx
leaq 0xb0(%rsp), %rdi
callq 0x34d80
leaq 0x70(%rsp), %rdi
callq 0x31950
movl %ebx, %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x34d80
jmp 0x569fa
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x342e0
jmp 0x569fa
jmp 0x569f7
jmp 0x569f7
jmp 0x569f2
movq %rax, %rbx
jmp 0x56a07
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x34d80
leaq 0x70(%rsp), %rdi
callq 0x31950
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::ResetSocketEngine()
void TcpSocket::ResetSocketEngine(void) {

    // shut down socket engine
    if ( m_engine ) {
        m_engine->Close();
        delete m_engine;
        m_engine = 0;
    }

    // reset our state & cached socket handle
    m_state = TcpSocket::UnconnectedState;
    m_cachedSocketDescriptor = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x56a55
callq 0x332b0
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0x56a48
movq %r14, %rdi
callq 0x356f0
movq %r14, %rdi
callq 0x32fa0
andq $0x0, 0x70(%rbx)
andl $0x0, 0xfc(%rbx)
orl $-0x1, 0x78(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x32fa0
movq %rbx, %rdi
callq 0x34ed0
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::Read(char*, unsigned int)
int64_t TcpSocket::Read(char* data, const unsigned int numBytes) {

    // if we have data in buffer, just return it
    if ( !m_readBuffer.IsEmpty() ) {
        const size_t bytesRead = m_readBuffer.Read(data, numBytes);
        return static_cast<int64_t>(bytesRead);
    }

    // otherwise, we'll need to fetch data from socket
    // first make sure we have a valid socket engine
    if ( m_engine == 0 ) {
        // TODO: set error string/state?
        return -1;
    }

    // fetch data from socket, return 0 for success, -1 for failure
    // since this should be called in a loop,
    // we'll pull the actual bytes from the buffer on next iteration
    const int64_t socketBytesRead = ReadFromSocket();
    if ( socketBytesRead < 0 ) {
        // TODO: set error string/state ?
        return -1;
    }

    // we should have data now in buffer, try to fetch requested amount
    // if nothing in buffer, we will return 0 bytes read (signals EOF reached)
    const size_t numBytesRead = m_readBuffer.Read(data, numBytes);
    return static_cast<int64_t>(numBytesRead);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x80(%rdi), %r14
movq %r14, %rdi
callq 0x32760
testb %al, %al
je 0x56b28
cmpq $0x0, 0x70(%r15)
je 0x56b3f
movq %r15, %rdi
callq 0x33f50
testq %rax, %rax
js 0x56b3f
movl %ebp, %edx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31a90
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::ReadFromSocket()
int64_t TcpSocket::ReadFromSocket(void) {

    // check for any socket engine errors
    if ( !m_engine->IsValid() ) {
        m_errorString = "TcpSocket::ReadFromSocket - socket disconnected";
        ResetSocketEngine();
        return -1;
    }

    // wait for ready read
    bool timedOut;
    const bool isReadyRead = m_engine->WaitForRead(5000, &timedOut);

    // if not ready
    if ( !isReadyRead ) {

        // if we simply timed out
        if ( timedOut ) {
            // TODO: get add'l error info from engine ?
            m_errorString = "TcpSocket::ReadFromSocket - timed out waiting for ready read";
        }

        // otherwise, there was some other error
        else {
            // TODO: get add'l error info from engine ?
            m_errorString = "TcpSocket::ReadFromSocket - encountered error while waiting for ready read";
        }

        // return failure
        return -1;
    }

    // get number of bytes available from socket
    const int64_t bytesToRead = m_engine->NumBytesAvailable();
    if ( bytesToRead < 0 ) {
        // TODO: get add'l error info from engine ?
        m_errorString = "TcpSocket::ReadFromSocket - encountered error while determining numBytesAvailable";
        return -1;
    }

    // make space in buffer & read from socket
    char* buffer = m_readBuffer.Reserve(bytesToRead);
    const int64_t numBytesRead = m_engine->Read(buffer, bytesToRead);
    if ( numBytesRead == -1 ) {
        // TODO: get add'l error info from engine ?
        m_errorString = "TcpSocket::ReadFromSocket - encountered error while reading bytes";
    }

    // return number of bytes actually read
    return numBytesRead;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
callq 0x316d0
testb %al, %al
je 0x56bbe
movq 0x70(%rbx), %rdi
leaq 0x7(%rsp), %rdx
movl $0x1388, %esi           # imm = 0x1388
callq 0x35240
testb %al, %al
je 0x56bdb
movq 0x70(%rbx), %rdi
callq 0x34d50
testq %rax, %rax
js 0x56bfb
movq %rax, %r14
leaq 0x80(%rbx), %rdi
movq %rax, %rsi
callq 0x31e40
movq 0x70(%rbx), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x32440
cmpq $-0x1, %rax
jne 0x56c14
addq $0x100, %rbx            # imm = 0x100
leaq 0x6656(%rip), %rsi      # 0x5d212
jmp 0x56c09
leaq 0x100(%rbx), %rdi
leaq 0x653c(%rip), %rsi      # 0x5d108
callq 0x35550
movq %rbx, %rdi
callq 0x33d20
jmp 0x56c11
addq $0x100, %rbx            # imm = 0x100
cmpb $0x1, 0x7(%rsp)
jne 0x56bf2
leaq 0x6548(%rip), %rsi      # 0x5d138
jmp 0x56c09
leaq 0x657c(%rip), %rsi      # 0x5d175
jmp 0x56c09
addq $0x100, %rbx            # imm = 0x100
leaq 0x65b7(%rip), %rsi      # 0x5d1c0
movq %rbx, %rdi
callq 0x35550
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::ReadLine(char*, unsigned long)
int64_t TcpSocket::ReadLine(char* dest, size_t max) {

    // wait for buffer to contain line contents
    if ( !WaitForReadLine() ) {
        m_errorString = "TcpSocket::ReadLine - error waiting for read line";
        return -1;
    }

    // leave room for null term
    if ( max < 2 )
        return -1;
    --max;

    // read from buffer, handle newlines
    int64_t readSoFar = m_readBuffer.ReadLine(dest, max);
    if ( readSoFar && dest[readSoFar-1] == '\n' ) {

        // adjust for windows-style '\r\n'
        if ( readSoFar > 1 && dest[readSoFar-2] == '\r') {
            --readSoFar;
            dest[readSoFar-1] = '\n';
        }
    }

    // null terminate & return number of bytes read
    dest[readSoFar] = '\0';
    return readSoFar;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
callq 0x31740
testb %al, %al
je 0x56df7
cmpq $0x2, %r15
jb 0x56e0d
decq %r15
subq $-0x80, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x34740
testq %rax, %rax
je 0x56e12
cmpq $0x2, %rax
jl 0x56e14
cmpb $0xa, -0x1(%rbx,%rax)
jne 0x56e14
cmpb $0xd, -0x2(%rbx,%rax)
jne 0x56e14
movb $0xa, -0x2(%rbx,%rax)
decq %rax
jmp 0x56e14
addq $0x100, %r14            # imm = 0x100
leaq 0x644f(%rip), %rsi      # 0x5d254
movq %r14, %rdi
callq 0x35550
pushq $-0x1
popq %rax
jmp 0x56e18
xorl %eax, %eax
movb $0x0, (%rbx,%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::WaitForReadLine()
bool TcpSocket::WaitForReadLine(void) {

    // wait until we can read a line (will return immediately if already capable)
    while ( !CanReadLine() ) {
        if ( !ReadFromSocket() )
            return false;
    }

    // if we get here, success
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
movq %r14, %rdi
callq 0x34ca0
movl %eax, %ebp
testb %al, %al
jne 0x56e47
movq %rbx, %rdi
callq 0x33f50
testq %rax, %rax
jne 0x56e2c
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocket_p.cpp
// Function: BamTools::Internal::TcpSocket::Write(char const*, unsigned int)
int64_t TcpSocket::Write(const char* data, const unsigned int numBytes) {

    // single-shot attempt at write (not buffered, just try to shove the data through socket)
    // this method purely exists to send 'small' HTTP requests/FTP commands from client to server

    // wait for our socket to be write-able
    bool timedOut;
    const bool isReadyWrite = m_engine->WaitForWrite(3000, &timedOut);

    // if ready, return number of bytes written
    if ( isReadyWrite )
        return m_engine->Write(data, numBytes);

    // otherwise, socket not ready for writing
    // set error string depending on reason & return failure
    if ( !timedOut ) {
        // TODO: get add'l error info from engine ??
        m_errorString = "TcpSocket::Write - timed out waiting for ready-write";
    }
    else {
        // TODO: get add'l error info from engine ??
        m_errorString = "TcpSocket::Write - error encountered while waiting for ready-write";
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
leaq 0xf(%rsp), %rdx
movl $0xbb8, %esi            # imm = 0xBB8
callq 0x31ec0
testb %al, %al
je 0x56e85
movq 0x70(%rbx), %rdi
movl %ebp, %edx
movq %r14, %rsi
callq 0x34ac0
jmp 0x56eae
addq $0x100, %rbx            # imm = 0x100
cmpb $0x0, 0xf(%rsp)
je 0x56e9c
leaq 0x6421(%rip), %rsi      # 0x5d2bb
jmp 0x56ea3
leaq 0x63e3(%rip), %rsi      # 0x5d286
movq %rbx, %rdi
callq 0x35550
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::Connect(BamTools::Internal::HostAddress const&, unsigned short)
bool TcpSocketEngine::Connect(const HostAddress& address, const uint16_t port) {

    // return failure if invalid FD or already connected
    if ( !IsValid() || (m_socketState == TcpSocket::ConnectedState) ) {
        // TODO: set error string
        return false;
    }

    // attempt to connect to host address on requested port
    if ( !nativeConnect(address, port) ) {
        // TODO: set error string
        return false;
    }

    // if successful, store remote host address port & return success
    // TODO: (later) fetch proxied remote & local host/port  here
    m_remoteAddress = address;
    m_remotePort    = port;
    return true;
}

// Assembly:
xorl %eax, %eax
cmpl $-0x1, (%rdi)
je 0x5712b
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
cmpl $0x1, 0x50(%rdi)
je 0x57126
movl %edx, %ebx
movq %rsi, %r15
movzwl %bx, %edx
movq %r14, %rdi
callq 0x35480
testb %al, %al
je 0x57124
leaq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x34760
movw %bx, 0x48(%r14)
movb $0x1, %al
jmp 0x57126
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::Initialize(BamTools::Internal::HostAddress::NetworkProtocol)
bool TcpSocketEngine::Initialize(HostAddress::NetworkProtocol protocol) {

    // close current socket if we have one open
    if ( IsValid() )
        Close();

    // attempt to create new socket
    return nativeCreateSocket(protocol);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl $-0x1, (%rdi)
je 0x57180
movq %r14, %rdi
callq 0x332b0
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x34090
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::WaitForRead(int, bool*)
bool TcpSocketEngine::WaitForRead(int msec, bool* timedOut) {

    // reset timedOut flag
    *timedOut = false;

    // need to wait for our socket to be ready to read
    const int ret = nativeSelect(msec, true);

    // if timed out
    if ( ret == 0 ) {
        *timedOut = true;
        m_socketError = TcpSocket::SocketTimeoutError;
        m_errorString = "socket timed out";
    }

    // return if any sockets available for reading
    return ( ret > 0 );
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movb $0x0, (%rdx)
pushq $0x1
popq %rdx
callq 0x34bf0
movl %eax, %ebp
testl %eax, %eax
jne 0x571ed
movb $0x1, (%r14)
movl $0x5, 0x4c(%rbx)
addq $0x58, %rbx
leaq 0x6119(%rip), %rsi      # 0x5d2fe
movq %rbx, %rdi
callq 0x35550
testl %ebp, %ebp
setg %al
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::WaitForWrite(int, bool*)
bool TcpSocketEngine::WaitForWrite(int msec, bool* timedOut) {

    // reset timedOut flag
    *timedOut = false;

    // need to wait for our socket to be ready to write
    const int ret = nativeSelect(msec, false);

    // if timed out
    if ( ret == 0 ) {
        *timedOut = true;
        m_socketError = TcpSocket::SocketTimeoutError;
        m_errorString = "socket timed out";
    }

    // return if any sockets available for reading
    return ( ret > 0 );
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movb $0x0, (%rdx)
xorl %edx, %edx
callq 0x34bf0
movl %eax, %ebp
testl %eax, %eax
jne 0x57230
movb $0x1, (%r14)
movl $0x5, 0x4c(%rbx)
addq $0x58, %rbx
leaq 0x60d6(%rip), %rsi      # 0x5d2fe
movq %rbx, %rdi
callq 0x35550
testl %ebp, %ebp
setg %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_unix_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::nativeCreateSocket(BamTools::Internal::HostAddress::NetworkProtocol)
bool TcpSocketEngine::nativeCreateSocket(HostAddress::NetworkProtocol protocol) {

    // get protocol value for requested protocol type
    const int protocolNum = ( (protocol == HostAddress::IPv6Protocol) ? AF_INET6
                                                                      : AF_INET );

    // attempt to create socket
    int socketFd = socket(protocolNum, SOCK_STREAM, IPPROTO_TCP);

    // if we fetched an invalid socket descriptor
    if ( socketFd <= 0 ) {

        // see what error we got
        switch ( errno ) {
            case EPROTONOSUPPORT:
            case EAFNOSUPPORT:
            case EINVAL:
                m_socketError = TcpSocket::UnsupportedSocketOperationError;
                m_errorString = "protocol not supported";
                break;
            case ENFILE:
            case EMFILE:
            case ENOBUFS:
            case ENOMEM:
                m_socketError = TcpSocket::SocketResourceError;
                m_errorString = "out of resources";
                break;
            case EACCES:
                m_socketError = TcpSocket::SocketAccessError;
                m_errorString = "permission denied";
                break;
            default:
                break;
        }

        // return failure
        return false;
    }

    // otherwise, store our socket FD & return success
    m_socketDescriptor = socketFd;
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %eax, %eax
cmpl $0x1, %esi
sete %al
leal 0x2(,%rax,8), %edi
pushq $0x1
popq %rsi
pushq $0x6
popq %rdx
callq 0x31660
movl %eax, %ebx
testl %eax, %eax
jle 0x573cc
movl %ebx, (%r14)
jmp 0x57429
callq 0x31160
movl (%rax), %eax
leal -0x17(%rax), %ecx
cmpl $0x2, %ecx
jb 0x5740e
cmpl $0xc, %eax
je 0x5740e
cmpl $0xd, %eax
je 0x57436
cmpl $0x16, %eax
je 0x573f9
cmpl $0x5d, %eax
je 0x573f9
cmpl $0x69, %eax
je 0x5740e
cmpl $0x61, %eax
jne 0x57429
movl $0x7, 0x4c(%r14)
addq $0x58, %r14
leaq 0x5f9a(%rip), %rsi      # 0x5d3a6
jmp 0x57421
movl $0x4, 0x4c(%r14)
addq $0x58, %r14
leaq 0x5f9c(%rip), %rsi      # 0x5d3bd
movq %r14, %rdi
callq 0x35550
testl %ebx, %ebx
setg %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x3, 0x4c(%r14)
addq $0x58, %r14
leaq 0x5f4b(%rip), %rsi      # 0x5d394
jmp 0x57421
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_unix_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::nativeNumBytesAvailable() const
int64_t TcpSocketEngine::nativeNumBytesAvailable(void) const {

    // fetch number of bytes, return 0 on error
    int numBytes(0);
    if ( ioctl(m_socketDescriptor, FIONREAD, (char*)&numBytes) < 0 )
        return -1;
    return static_cast<int64_t>(numBytes);
}

// Assembly:
pushq %rax
leaq 0x4(%rsp), %rdx
andl $0x0, (%rdx)
movl (%rdi), %edi
movl $0x541b, %esi           # imm = 0x541B
xorl %eax, %eax
callq 0x34170
testl %eax, %eax
js 0x5746d
movl 0x4(%rsp), %eax
jmp 0x57470
pushq $-0x1
popq %rax
cltq
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_unix_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::nativeSelect(int, bool) const
int TcpSocketEngine::nativeSelect(int msecs, bool isRead) const {

    // set up FD set
    fd_set fds;
    FD_ZERO(&fds);
    FD_SET(m_socketDescriptor, &fds);

    // setup our timeout
    timeval tv;
    tv.tv_sec  = msecs / 1000;
    tv.tv_usec = (msecs % 1000) * 1000;

    // do 'select'
    if ( isRead )
        return select(m_socketDescriptor + 1, &fds, 0, 0, (msecs < 0 ? 0 : &tv));
    else
        return select(m_socketDescriptor + 1, 0, &fds, 0, (msecs < 0 ? 0 : &tv));
}

// Assembly:
subq $0x98, %rsp
movl %edx, %r9d
xorl %eax, %eax
cmpq $0x10, %rax
je 0x57499
andq $0x0, 0x18(%rsp,%rax,8)
incq %rax
jmp 0x57488
movl (%rdi), %edi
pushq $0x40
popq %rcx
movl %edi, %eax
cltd
idivl %ecx
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
orq %rax, 0x18(%rsp,%rdx,8)
movl $0x3e8, %ecx            # imm = 0x3E8
movl %esi, %eax
cltd
idivl %ecx
cltq
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
imull $0x3e8, %edx, %eax      # imm = 0x3E8
cltq
movq %rax, 0x8(%rcx)
incl %edi
xorl %r8d, %r8d
testl %esi, %esi
cmovnsq %rcx, %r8
testb %r9b, %r9b
je 0x574f1
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
jmp 0x574f8
leaq 0x18(%rsp), %rdx
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x32fc0
addq $0x98, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatParser_p.cpp
// Function: BamTools::Internal::SamFormatParser::Parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void SamFormatParser::Parse(const string& headerText) {

    // clear header's prior contents
    m_header.Clear();

    // empty header is OK, but skip processing
    if ( headerText.empty() )
        return;

    // other wise parse SAM lines
    istringstream headerStream(headerText);
    string headerLine("");
    while ( getline(headerStream, headerLine) )
         ParseSamLine(headerLine);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x35640
cmpq $0x0, 0x8(%r14)
je 0x575a1
leaq 0x30(%rsp), %rdi
pushq $0x8
popq %rdx
movq %r14, %rsi
callq 0x34b70
leaq 0x4916(%rip), %rsi      # 0x5be64
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x313c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5758d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x336f0
jmp 0x57567
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x30(%rsp), %rdi
callq 0x31d70
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %r15
retq
jmp 0x575b0
movq %rax, %rbx
jmp 0x575c2
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x30(%rsp), %rdi
callq 0x31d70
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatParser_p.cpp
// Function: BamTools::Internal::SamFormatParser::ParseSamLine(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void SamFormatParser::ParseSamLine(const string& line) {

    // skip if line is not long enough to contain true values
    if ( line.length() < 5 ) return;

    // determine token at beginning of line
    const string firstToken = line.substr(0,3);
    const string restOfLine = line.substr(4);
    if      ( firstToken == Constants::SAM_HD_BEGIN_TOKEN) ParseHDLine(restOfLine);
    else if ( firstToken == Constants::SAM_SQ_BEGIN_TOKEN) ParseSQLine(restOfLine);
    else if ( firstToken == Constants::SAM_RG_BEGIN_TOKEN) ParseRGLine(restOfLine);
    else if ( firstToken == Constants::SAM_PG_BEGIN_TOKEN) ParsePGLine(restOfLine);
    else if ( firstToken == Constants::SAM_CO_BEGIN_TOKEN) ParseCOLine(restOfLine);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
cmpq $0x5, 0x8(%rsi)
jb 0x576df
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
pushq $0x3
popq %rcx
xorl %edx, %edx
callq 0x332a0
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
movq %r14, %rsi
callq 0x332a0
leaq 0x20e53(%rip), %rsi     # 0x78470
leaq 0x28(%rsp), %rdi
callq 0x32220
testb %al, %al
je 0x5763d
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x322b0
jmp 0x576cb
leaq 0x20eac(%rip), %rsi     # 0x784f0
leaq 0x28(%rsp), %rdi
callq 0x32220
testb %al, %al
je 0x57661
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x350d0
jmp 0x576cb
leaq 0x20f68(%rip), %rsi     # 0x785d0
leaq 0x28(%rsp), %rdi
callq 0x32220
testb %al, %al
je 0x57685
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x31700
jmp 0x576cb
leaq 0x210e4(%rip), %rsi     # 0x78770
leaq 0x28(%rsp), %rdi
callq 0x32220
testb %al, %al
je 0x576a9
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x322c0
jmp 0x576cb
leaq 0x21180(%rip), %rsi     # 0x78830
leaq 0x28(%rsp), %rdi
callq 0x32220
testb %al, %al
je 0x576cb
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x31270
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x28(%rsp), %rdi
callq 0x33a00
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
jmp 0x576f9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x28(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatParser_p.cpp
// Function: BamTools::Internal::SamFormatParser::Split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char)
const vector<string> SamFormatParser::Split(const string& line, const char delim) {
    vector<string> tokens;
    stringstream lineStream(line);
    string token;
    while ( getline(lineStream, token, delim) )
        tokens.push_back(token);
    return tokens;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %ecx, %ebp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x20(%rsp), %rdi
pushq $0x18
popq %rax
movq %rdx, %rsi
movl %eax, %edx
callq 0x34880
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movsbl %bpl, %ebp
leaq 0x20(%rsp), %r14
movq %rsp, %r15
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x35260
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5840c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31f80
jmp 0x583e4
movq %rsp, %rdi
callq 0x33a00
leaq 0x20(%rsp), %rdi
callq 0x32870
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x58444
movq %rax, %r14
jmp 0x5844e
movq %rax, %r14
movq %rsp, %rdi
callq 0x33a00
leaq 0x20(%rsp), %rdi
callq 0x32870
movq %rbx, %rdi
callq 0x32810
movq %r14, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatPrinter_p.cpp
// Function: BamTools::Internal::SamFormatPrinter::ToString[abi:cxx11]() const
const string SamFormatPrinter::ToString(void) const {

    // clear out stream
    stringstream out("");

    // generate formatted header text
    PrintHD(out);
    PrintSQ(out);
    PrintRG(out);
    PrintPG(out);
    PrintCO(out);

    // return result
    return out.str();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x3857(%rip), %rsi      # 0x5be64
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x31b30
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0x34880
leaq 0x10(%rsp), %rdi
callq 0x33a00
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x35000
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x356d0
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x34f40
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x355f0
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x32050
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x34870
leaq 0x30(%rsp), %rdi
callq 0x32870
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x33a00
jmp 0x586bf
movq %rax, %rbx
jmp 0x586bf
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x32870
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatPrinter_p.cpp
// Function: BamTools::Internal::SamFormatPrinter::PrintHD(std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>>&) const
void SamFormatPrinter::PrintHD(std::stringstream& out) const {

    // if header has @HD data
    if ( m_header.HasVersion() ) {

        // @HD VN:<Version>
        out << Constants::SAM_HD_BEGIN_TOKEN
            << FormatTag(Constants::SAM_HD_VERSION_TAG, m_header.Version);

        // SO:<SortOrder>
        if ( m_header.HasSortOrder() )
            out << FormatTag(Constants::SAM_HD_SORTORDER_TAG, m_header.SortOrder);

        // GO:<GroupOrder>
        if ( m_header.HasGroupOrder() )
            out << FormatTag(Constants::SAM_HD_GROUPORDER_TAG, m_header.GroupOrder);

        // custom tags
        if ( !m_header.CustomTags.empty() ) {
            for (size_t i = 0; i < m_header.CustomTags.size(); ++i) {
                const CustomHeaderTag& customTag = m_header.CustomTags[i];
                out << FormatTag(customTag.TagName, customTag.TagValue);
            }
        }
        // newline
        out << endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x33a30
testb %al, %al
je 0x58808
addq $0x10, %rbx
leaq 0x2035a(%rip), %rsi     # 0x78a58
movq %rbx, %rdi
callq 0x32d80
movq %rax, %r15
movq (%r14), %rdx
leaq 0x20365(%rip), %rsi     # 0x78a78
movq %rsp, %r12
movq %r12, %rdi
callq 0x5918e
movq %r15, %rdi
movq %r12, %rsi
callq 0x32d80
movq %rsp, %rdi
callq 0x33a00
movq (%r14), %rdi
callq 0x34380
testb %al, %al
je 0x58769
movq (%r14), %rdx
addq $0x20, %rdx
leaq 0x2034d(%rip), %rsi     # 0x78a98
movq %rsp, %r15
movq %r15, %rdi
callq 0x5918e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32d80
movq %rsp, %rdi
callq 0x33a00
movq (%r14), %rdi
callq 0x32290
testb %al, %al
je 0x587a1
movq (%r14), %rdx
addq $0x40, %rdx
leaq 0x20335(%rip), %rsi     # 0x78ab8
movq %rsp, %r15
movq %r15, %rdi
callq 0x5918e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32d80
movq %rsp, %rdi
callq 0x33a00
movq (%r14), %rax
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rax
cmpq %rax, %rsi
je 0x58800
xorl %r12d, %r12d
movq %rsp, %r15
xorl %r13d, %r13d
subq %rsi, %rax
sarq $0x6, %rax
cmpq %rax, %r13
jae 0x58800
leaq (%rsi,%r12), %rdx
addq $0x20, %rdx
addq %r12, %rsi
movq %r15, %rdi
callq 0x5918e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32d80
movq %r15, %rdi
callq 0x33a00
incq %r13
movq (%r14), %rax
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rax
addq $0x40, %r12
jmp 0x587ba
movq %rbx, %rdi
callq 0x31e60
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x58848
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x58848
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x58848
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamFormatPrinter_p.cpp
// Function: BamTools::Internal::SamFormatPrinter::PrintCO(std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>>&) const
void SamFormatPrinter::PrintCO(std::stringstream& out) const {

    // iterate over comments
    vector<string>::const_iterator commentIter = m_header.Comments.begin();
    vector<string>::const_iterator commentEnd  = m_header.Comments.end();
    for ( ; commentIter != commentEnd; ++commentIter ) {

        // @CO <Comment>
        out << Constants::SAM_CO_BEGIN_TOKEN
            << Constants::SAM_TAB
            << (*commentIter)
            << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq (%rdi), %rax
movq 0x120(%rax), %r14
movq 0x128(%rax), %r12
addq $0x10, %rbx
leaq 0x1fcc9(%rip), %r15     # 0x78e18
pushq $0x9
popq %rbp
cmpq %r12, %r14
je 0x59185
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32d80
movq %rax, %rdi
movl %ebp, %esi
callq 0x337b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x32d80
movq %rax, %rdi
callq 0x31e60
addq $0x20, %r14
jmp 0x59152
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::Validate()
bool SamHeaderValidator::Validate(void) {
    bool isValid = true;
    isValid &= ValidateMetadata();
    isValid &= ValidateSequenceDictionary();
    isValid &= ValidateReadGroupDictionary();
    isValid &= ValidateProgramChain();
    return isValid;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x33940
movl %eax, %ebp
movq %rbx, %rdi
callq 0x324d0
movl %eax, %r14d
andb %bpl, %r14b
movq %rbx, %rdi
callq 0x310b0
movl %eax, %ebp
movq %rbx, %rdi
callq 0x32430
andb %bpl, %al
andb %r14b, %al
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ValidateMetadata()
bool SamHeaderValidator::ValidateMetadata(void) {
    bool isValid = true;
    isValid &= ValidateVersion();
    isValid &= ValidateSortOrder();
    isValid &= ValidateGroupOrder();
    return isValid;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x34c40
movl %eax, %ebp
movq %rbx, %rdi
callq 0x351f0
movl %eax, %r14d
andb %bpl, %r14b
movq %rbx, %rdi
callq 0x33a20
andb %r14b, %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ValidateSequenceDictionary()
bool SamHeaderValidator::ValidateSequenceDictionary(void) {

    bool isValid = true;

    // check for unique sequence names
    isValid &= ContainsUniqueSequenceNames();

    // iterate over sequences
    const SamSequenceDictionary& sequences = m_header.Sequences;
    SamSequenceConstIterator seqIter = sequences.ConstBegin();
    SamSequenceConstIterator seqEnd  = sequences.ConstEnd();
    for ( ; seqIter != seqEnd; ++seqIter ) {
        const SamSequence& seq = (*seqIter);
        isValid &= ValidateSequence(seq);
    }

    // return validation state
    return isValid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x32bf0
movl %eax, %ebp
movq (%rbx), %r15
addq $0x78, %r15
movq %r15, %rdi
callq 0x344e0
movq %rax, %r14
movq %r15, %rdi
callq 0x35350
movq %rax, %r15
cmpq %r15, %r14
je 0x595a8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32e80
andb %al, %bpl
addq $0xd8, %r14
jmp 0x5958c
andb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ValidateReadGroupDictionary()
bool SamHeaderValidator::ValidateReadGroupDictionary(void) {

    bool isValid = true;

    // check for unique read group IDs & platform units
    isValid &= ContainsUniqueIDsAndPlatformUnits();

    // iterate over read groups
    const SamReadGroupDictionary& readGroups = m_header.ReadGroups;
    SamReadGroupConstIterator rgIter = readGroups.ConstBegin();
    SamReadGroupConstIterator rgEnd  = readGroups.ConstEnd();
    for ( ; rgIter != rgEnd; ++rgIter ) {
        const SamReadGroup& rg = (*rgIter);
        isValid &= ValidateReadGroup(rg);
    }

    // return validation state
    return isValid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x31900
movl %eax, %ebp
movl $0xc0, %r15d
addq (%rbx), %r15
movq %r15, %rdi
callq 0x34a90
movq %rax, %r14
movq %r15, %rdi
callq 0x35040
movq %rax, %r15
cmpq %r15, %r14
je 0x59606
movq %rbx, %rdi
movq %r14, %rsi
callq 0x33f30
andb %al, %bpl
addq $0x198, %r14            # imm = 0x198
jmp 0x595ea
andb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ValidateProgramChain()
bool SamHeaderValidator::ValidateProgramChain(void) {
    bool isValid = true;
    isValid &= ContainsUniqueProgramIds();
    isValid &= ValidatePreviousProgramIds();
    return isValid;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x34e20
movl %eax, %ebp
movq %rbx, %rdi
callq 0x31ac0
andb %bpl, %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ValidateSortOrder()
bool SamHeaderValidator::ValidateSortOrder(void) {

    const string& sortOrder = m_header.SortOrder;

    // warn if sort order not present
    if ( sortOrder.empty() ) {
        AddWarning("Sort order (SO) missing. Not required, but strongly recommended");
        return true;
    }

    // if sort order is valid keyword
    if ( sortOrder == Constants::SAM_HD_SORTORDER_COORDINATE ||
         sortOrder == Constants::SAM_HD_SORTORDER_QUERYNAME  ||
         sortOrder == Constants::SAM_HD_SORTORDER_UNSORTED
       )
    {
        return true;
    }

    // otherwise
    AddError("Invalid sort order (SO): " + sortOrder);
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %r14
cmpq $0x0, 0x28(%r14)
je 0x5989b
addq $0x20, %r14
leaq 0x1fbee(%rip), %rsi     # 0x79420
movq %r14, %rdi
callq 0x32220
movb $0x1, %bpl
testb %al, %al
jne 0x598cb
leaq 0x1fbf4(%rip), %rsi     # 0x79440
movq %r14, %rdi
callq 0x32220
testb %al, %al
jne 0x598cb
leaq 0x1fc21(%rip), %rsi     # 0x79480
movq %r14, %rdi
callq 0x32220
testb %al, %al
jne 0x598cb
leaq 0x3d2a(%rip), %rsi      # 0x5d59c
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x32d90
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32f20
leaq 0x8(%rsp), %rdi
callq 0x33a00
xorl %ebp, %ebp
jmp 0x598cb
leaq 0x3cba(%rip), %rsi      # 0x5d55c
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x31dc0
leaq 0x8(%rsp), %rdi
callq 0x33a00
movb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59901
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x59901
movq %rax, %rdi
callq 0x39b2f
movq %rax, %rbx
movq %rbx, %rdi
callq 0x34ed0
nop