LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/HostAddress_p.cpp
// Function: BamTools::Internal::Split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char)
static inline
vector<string> Split(const string& source, char delim) {
    stringstream ss(source);
    string field;
    vector<string> fields;
    while ( getline(ss, field, delim) )
        fields.push_back(field);
    return fields;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movl %edx, %ebp
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movl $0x18, %edx
callq 0x28750
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movsbl %bpl, %ebp
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x28eb0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4b526
movq %rbx, %rdi
movq %r15, %rsi
callq 0x26ab0
jmp 0x4b4fe
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4b535
callq 0x27560
leaq 0x28(%rsp), %rdi
callq 0x270d0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x270a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4b56c
callq 0x27560
leaq 0x28(%rsp), %rdi
callq 0x270d0
movq %r14, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/HttpHeader_p.cpp
// Function: BamTools::Internal::Trim(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static string Trim(const string& source) {

    // skip if empty string
    if ( source.empty() )
        return source;

    // fetch string data
    const char*  s    = source.data(); // ignoring null-term on purpose
    const size_t size = source.size();
    size_t start = 0;
    size_t end   = size-1;

    // skip if no spaces at start or end
    if ( !IsSpace(s[start]) && !IsSpace( s[end] ) )
        return source;

    // remove leading whitespace
    while ( (start != end) && IsSpace(s[start]) )
        ++start;

    // remove trailing whitespace
    if ( start <= end ) {
        while ( end && IsSpace(s[end]) )
            --end;
    }

    // return result
    return string(s + start, (end-start) + 1);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %rdx
testq %rdx, %rdx
je 0x4c6e2
movq (%rsi), %rsi
leaq -0x1(%rdx), %rcx
movzbl (%rsi), %eax
leal -0x9(%rax), %edi
cmpl $0x5, %edi
jae 0x4c74a
xorl %eax, %eax
testq %rcx, %rcx
je 0x4c6fc
movzbl (%rsi,%rax), %edx
leal -0x9(%rdx), %edi
cmpl $0x5, %edi
jae 0x4c6dc
incq %rax
cmpq %rax, %rcx
jne 0x4c6c6
jmp 0x4c6f9
testl %edx, %edx
je 0x4c6d2
jmp 0x4c6fc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsi), %rsi
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x267c0
jmp 0x4c745
movq %rcx, %rax
cmpq %rcx, %rax
seta %dl
testq %rcx, %rcx
sete %dil
orb %dl, %dil
jne 0x4c729
movzbl (%rsi,%rcx), %edx
leal -0x9(%rdx), %edi
cmpl $0x5, %edi
jae 0x4c721
decq %rcx
jne 0x4c70e
jmp 0x4c727
testl %edx, %edx
je 0x4c71a
jmp 0x4c729
xorl %ecx, %ecx
addq %rsi, %rax
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
leaq (%rsi,%rcx), %rdx
incq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x26750
movq %rbx, %rax
popq %rbx
retq
testl %eax, %eax
je 0x4c6bf
movzbl (%rsi,%rcx), %eax
leal -0x9(%rax), %edi
cmpl $0x5, %edi
jb 0x4c6bf
testl %eax, %eax
je 0x4c6bf
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
jmp 0x4c6ec
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/HttpHeader_p.cpp
// Function: BamTools::Internal::HttpHeader::ParseLine(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
bool HttpHeader::ParseLine(const string& line, int) {

    // find colon position, return failure if not found
    const size_t colonFound = line.find(Constants::COLON_CHAR);
    if ( colonFound == string::npos )
        return false;

    // store key/value (without leading/trailing whitespace) & return success
    const string key   = Trim(line.substr(0, colonFound));
    const string value = Trim(line.substr(colonFound+1));
    m_fields[key] = value;
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
movl $0x3a, %esi
xorl %edx, %edx
callq 0x27f00
movq %rax, %rbx
cmpq $-0x1, %rax
je 0x4c853
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x277f0
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x4c69c
leaq 0x18(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x4c7d9
callq 0x27560
leaq 0x1(%rbx), %rdx
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x277f0
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x4c69c
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c813
callq 0x27560
addq $0x8, %r14
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x26130
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x26b80
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4c840
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c853
callq 0x27560
cmpq $-0x1, %rbx
setne %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4c895
jmp 0x4c89a
movq %rax, %rbx
jmp 0x4c89a
movq %rax, %rbx
leaq 0x18(%rsp), %rax
jmp 0x4c89f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4c89a
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c8ad
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/HttpHeader_p.cpp
// Function: BamTools::Internal::HttpHeader::ToString[abi:cxx11]() const
string HttpHeader::ToString(void) const {
    string result("");
    if ( m_isValid ) {
        map<string, string>::const_iterator fieldIter = m_fields.begin();
        map<string, string>::const_iterator fieldEnd  = m_fields.end();
        for ( ; fieldIter != fieldEnd; ++fieldIter ) {
            const string& key   = (*fieldIter).first;
            const string& value = (*fieldIter).second;
            const string& line  = key   + Constants::FIELD_SEPARATOR +
                                  value + Constants::FIELD_NEWLINE;
            result += line;
        }
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rsp)
movq %rax, (%rdi)
leaq 0x956f(%rip), %rdx      # 0x55e8f
movq %rdx, %rsi
callq 0x26750
cmpb $0x1, 0x38(%r14)
jne 0x4c9e9
movq 0x20(%r14), %r15
addq $0x10, %r14
cmpq %r14, %r15
je 0x4c9e9
leaq 0x28(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x8(%rsp), %r12
leaq 0x20(%r15), %rsi
movq %r13, %rdi
leaq 0x20fe7(%rip), %rdx     # 0x6d948
callq 0x29130
leaq 0x40(%r15), %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x29130
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x20fa6(%rip), %rdx     # 0x6d928
callq 0x29130
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x4c99b
callq 0x27560
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4c9af
callq 0x27560
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x265d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4c9d5
callq 0x27560
movq %r15, %rdi
callq 0x27ae0
movq %rax, %r15
cmpq %r14, %rax
jne 0x4c953
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x4ca3f
movq %rax, %r14
jmp 0x4ca1c
movq %rax, %r14
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x4ca1c
callq 0x27560
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x4ca35
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4ca3f
callq 0x27560
movq (%rbx), %rdi
cmpq (%rsp), %rdi
je 0x4ca4d
callq 0x27560
movq %r14, %rdi
callq 0x28c20
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/HttpHeader_p.cpp
// Function: BamTools::Internal::HttpRequestHeader::ToString[abi:cxx11]() const
string HttpRequestHeader::ToString(void) const {
    stringstream request("");
    request << m_method   << Constants::SPACE_CHAR
            << m_resource << Constants::SPACE_CHAR
            << Constants::HTTP_STRING << GetMajorVersion() << Constants::DOT_CHAR << GetMinorVersion()
            << Constants::FIELD_NEWLINE
            << HttpHeader::ToString()
            << Constants::FIELD_NEWLINE;
    return request.str();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x9076(%rip), %rdx      # 0x55e8f
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x26750
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
movl $0x18, %edx
callq 0x28750
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4ce44
callq 0x27560
leaq 0x30(%rsp), %rdi
movq 0x48(%r14), %rsi
movq 0x50(%r14), %rdx
callq 0x27a70
movq %rsp, %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x27a70
movq 0x68(%r14), %rsi
movq 0x70(%r14), %rdx
movq %rax, %rdi
callq 0x27a70
movq %rsp, %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x27a70
movq 0x20ad5(%rip), %rsi     # 0x6d968
movq 0x20ad6(%rip), %rdx     # 0x6d970
movq %rax, %rdi
callq 0x27a70
movl 0x3c(%r14), %esi
movq %rax, %rdi
callq 0x28aa0
movq %rsp, %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x27a70
movl 0x40(%r14), %esi
movq %rax, %rdi
callq 0x28aa0
movq 0x20a54(%rip), %rsi     # 0x6d928
movq 0x20a55(%rip), %rdx     # 0x6d930
movq %rax, %rdi
callq 0x27a70
movq %rax, %r15
movq %rsp, %rdi
movq %r14, %rsi
callq 0x28a20
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rdi
callq 0x27a70
movq 0x20a1f(%rip), %rsi     # 0x6d928
movq 0x20a20(%rip), %rdx     # 0x6d930
movq %rax, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4cf26
callq 0x27560
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x28740
leaq 0x20(%rsp), %rdi
callq 0x270d0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x4cf7c
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4cf89
callq 0x27560
jmp 0x4cf89
movq %rax, %rbx
jmp 0x4cf89
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4cf7f
callq 0x27560
jmp 0x4cf7f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x270d0
movq %rbx, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/HttpHeader_p.cpp
// Function: BamTools::Internal::HttpResponseHeader::ToString[abi:cxx11]() const
string HttpResponseHeader::ToString(void) const {
    stringstream response("");
    response << Constants::HTTP_STRING << GetMajorVersion() << Constants::DOT_CHAR << GetMinorVersion()
             << Constants::SPACE_CHAR  << m_statusCode
             << Constants::SPACE_CHAR  << m_reason
             << Constants::FIELD_NEWLINE
             << HttpHeader::ToString()
             << Constants::FIELD_NEWLINE;
    return response.str();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x8ac2(%rip), %rdx      # 0x55e8f
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x26750
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
movl $0x18, %edx
callq 0x28750
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4d3f8
callq 0x27560
leaq 0x30(%rsp), %rdi
movq 0x20564(%rip), %rsi     # 0x6d968
movq 0x20565(%rip), %rdx     # 0x6d970
callq 0x27a70
movl 0x3c(%r14), %esi
movq %rax, %rdi
callq 0x28aa0
movq %rsp, %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x27a70
movl 0x40(%r14), %esi
movq %rax, %rdi
callq 0x28aa0
movq %rsp, %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x27a70
movl 0x44(%r14), %esi
movq %rax, %rdi
callq 0x28aa0
movq %rsp, %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x27a70
movq 0x48(%r14), %rsi
movq 0x50(%r14), %rdx
movq %rax, %rdi
callq 0x27a70
movq 0x204a4(%rip), %rsi     # 0x6d928
movq 0x204a5(%rip), %rdx     # 0x6d930
movq %rax, %rdi
callq 0x27a70
movq %rax, %r15
movq %rsp, %rdi
movq %r14, %rsi
callq 0x28a20
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rdi
callq 0x27a70
movq 0x2046f(%rip), %rsi     # 0x6d928
movq 0x20470(%rip), %rdx     # 0x6d930
movq %rax, %rdi
callq 0x27a70
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4d4d6
callq 0x27560
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x28740
leaq 0x20(%rsp), %rdi
callq 0x270d0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x4d52c
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4d539
callq 0x27560
jmp 0x4d539
movq %rax, %rbx
jmp 0x4d539
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4d52f
callq 0x27560
jmp 0x4d52f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x270d0
movq %rbx, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/ILocalIODevice_p.cpp
// Function: BamTools::Internal::ILocalIODevice::Close()
void ILocalIODevice::Close(void) {

    // skip if not open
    if ( !IsOpen() )
        return;

    // flush & close FILE*
    fflush(m_stream);
    fclose(m_stream);
    m_stream = 0;

    // reset other device state
    m_mode = IBamIODevice::NotOpen;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x50(%rax)
testb %al, %al
je 0x4dce9
movq 0x30(%rbx), %rdi
callq 0x27b80
movq 0x30(%rbx), %rdi
callq 0x276a0
movq $0x0, 0x30(%rbx)
movl $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::RollingBuffer(unsigned long)
RollingBuffer::RollingBuffer(size_t growth)
    : m_bufferGrowth(growth)
{
    // buffer always contains at least 1 (maybe empty) byte array
    m_data.push_back( ByteArray() );

    // set cleared state
    Clear();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq %rsi, 0x20(%rdi)
leaq 0x28(%rdi), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
movups %xmm0, 0x68(%rdi)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x29020
movq %rsp, %rdi
callq 0x27de0
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x274f0
movq %rsp, %rdi
callq 0x27470
movq %r14, %rdi
callq 0x27bf0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
jmp 0x4dd91
movq %rax, %r14
movq %rsp, %rdi
callq 0x27470
jmp 0x4dd94
movq %rax, %r14
movq %rbx, %rdi
callq 0x27e90
movq %r14, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::Clear()
void RollingBuffer::Clear(void) {

    // remove all byte arrays (except first)
    m_data.erase( m_data.begin()+1, m_data.end() );

    // clear out first byte array
    m_data[0].Resize(0);
    m_data[0].Squeeze();

    // reset index & size markers
    m_head = 0;
    m_tail = 0;
    m_tailBufferIndex = 0;
    m_totalBufferSize = 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %rsi
movq 0x38(%rdi), %rax
movq 0x50(%rdi), %r8
movq %rax, %rdi
subq 0x40(%rbx), %rdi
movq %rdi, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r14, %rdx
leaq 0x1(%rdx), %rcx
cmpq $0x14, %rcx
ja 0x4ddee
addq $0x18, %rax
jmp 0x4de56
cmpq $-0x17, %rdi
jl 0x4de16
movabsq $-0x79e79e79e79e79e7, %rdx # imm = 0x8618618618618619
movq %rcx, %rax
mulq %rdx
movq %rcx, %rdi
subq %rdx, %rdi
shrq %rdi
addq %rdx, %rdi
shrq $0x4, %rdi
jmp 0x4de40
movq $-0x2, %rdi
subq %rdx, %rdi
movabsq $-0x79e79e79e79e79e7, %rdx # imm = 0x8618618618618619
movq %rdi, %rax
mulq %rdx
subq %rdx, %rdi
shrq %rdi
addq %rdx, %rdi
shrq $0x4, %rdi
notq %rdi
leaq (%r8,%rdi,8), %r8
imulq $-0x1f8, %rdi, %rax     # imm = 0xFE08
addq (%r8), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x58(%rbx), %rdi
movq 0x70(%rbx), %r9
leaq 0x48(%rsp), %rdx
movq %rax, (%rdx)
movq (%r8), %rax
movq %rax, 0x8(%rdx)
movl $0x1f8, %r10d           # imm = 0x1F8
addq %r10, %rax
movq %rax, 0x10(%rdx)
movq %r8, 0x18(%rdx)
leaq 0x28(%rsp), %rcx
movq %rdi, (%rcx)
movq (%r9), %rax
movq %rax, 0x8(%rcx)
addq %r10, %rax
movq %rax, 0x10(%rcx)
movq %r9, 0x18(%rcx)
leaq 0x8(%rsp), %rdi
callq 0x29160
movq 0x38(%rbx), %rdi
movq %rdi, %rsi
subq 0x40(%rbx), %rsi
movq %rsi, %rcx
sarq $0x3, %rcx
imulq %r14, %rcx
cmpq $0x15, %rcx
jb 0x4df17
movq 0x50(%rbx), %r8
testq %rsi, %rsi
jle 0x4dee6
movabsq $-0x79e79e79e79e79e7, %rdx # imm = 0x8618618618618619
movq %rcx, %rax
mulq %rdx
subq %rdx, %rcx
shrq %rcx
addq %rdx, %rcx
shrq $0x4, %rcx
jmp 0x4df09
notq %rcx
movabsq $-0x79e79e79e79e79e7, %rdx # imm = 0x8618618618618619
movq %rcx, %rax
mulq %rdx
subq %rdx, %rcx
shrq %rcx
addq %rdx, %rcx
shrq $0x4, %rcx
notq %rcx
imulq $-0x1f8, %rcx, %rdi     # imm = 0xFE08
addq (%r8,%rcx,8), %rdi
addq %rsi, %rdi
xorl %esi, %esi
callq 0x26d90
movq 0x38(%rbx), %rdi
movq %rdi, %rsi
subq 0x40(%rbx), %rsi
movq %rsi, %rcx
sarq $0x3, %rcx
imulq %r14, %rcx
cmpq $0x15, %rcx
jb 0x4df93
movq 0x50(%rbx), %r8
testq %rsi, %rsi
jle 0x4df62
movabsq $-0x79e79e79e79e79e7, %rdx # imm = 0x8618618618618619
movq %rcx, %rax
mulq %rdx
subq %rdx, %rcx
shrq %rcx
addq %rdx, %rcx
shrq $0x4, %rcx
jmp 0x4df85
notq %rcx
movabsq $-0x79e79e79e79e79e7, %rdx # imm = 0x8618618618618619
movq %rcx, %rax
mulq %rdx
subq %rdx, %rcx
shrq %rcx
addq %rdx, %rcx
shrq $0x4, %rcx
notq %rcx
imulq $-0x1f8, %rcx, %rdi     # imm = 0xFE08
addq (%r8,%rcx,8), %rdi
addq %rsi, %rdi
callq 0x28a60
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
addq $0x68, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/RollingBuffer_p.cpp
// Function: BamTools::Internal::RollingBuffer::BlockSize() const
size_t RollingBuffer::BlockSize(void) const {

    // if only one byte array in buffer <- needed?
    if ( m_tailBufferIndex == 0 )
        return m_tail - m_head;

    // otherwise return remaining num bytes in first array
    const ByteArray& first = m_data.front();
    return first.Size() - m_head;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x10(%rdi)
je 0x4dfca
movq 0x38(%rbx), %rdi
callq 0x27270
jmp 0x4dfce
movq 0x8(%rbx), %rax
subq (%rbx), %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rax
xorl %ecx, %ecx
subq %rsi, %rax
cmovaeq %rax, %rcx
movq %rcx, 0x18(%rdi)
cmpq $0x0, 0x10(%rdi)
je 0x4e1c5
leaq 0x28(%rbx), %r14
leaq 0x38(%rbx), %r15
movq %rsi, %r13
movq 0x8(%rbx), %rax
subq %rax, %r13
jbe 0x4e1e0
movq %r14, %rdi
callq 0x26950
movq 0x10(%rbx), %r12
decq %r12
movq %r12, 0x10(%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x262b0
movq %r15, %rdi
movq %r12, %rsi
callq 0x27250
movq %rax, %rdi
callq 0x27270
movq %rax, 0x8(%rbx)
cmpq $0x0, 0x10(%rbx)
movq %r13, %rsi
jne 0x4e17b
jmp 0x4e1c8
movq %rsi, %r13
movq 0x8(%rbx), %rax
subq %r13, %rax
movq %rax, 0x8(%rbx)
cmpq (%rbx), %rax
ja 0x4e1e7
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x4e1e7
subq %rsi, %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x18(%rdi), %rax
cmpq %rdx, %rax
cmovbq %rax, %rbx
testq %rbx, %rbx
je 0x4e49f
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movq 0x38(%r15), %rdi
cmpq %rdi, 0x58(%r15)
je 0x4e44a
callq 0x263c0
movq %rax, %r13
addq (%r15), %r13
jmp 0x4e44d
xorl %r13d, %r13d
cmpq $0x0, 0x10(%r15)
je 0x4e462
movq 0x38(%r15), %rdi
callq 0x27270
movq %rax, %rbp
jmp 0x4e466
movq 0x8(%r15), %rbp
movq %rbx, %rax
subq %r12, %rax
subq (%r15), %rbp
cmpq %rax, %rbp
cmovaeq %rax, %rbp
testq %r14, %r14
je 0x4e48a
leaq (%r14,%r12), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x27260
addq %rbp, %r12
movq %r15, %rdi
movq %rbp, %rsi
callq 0x27960
cmpq %rbx, %r12
jb 0x4e433
jmp 0x4e4a2
xorl %r12d, %r12d
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_O1/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 0x4e4d2
callq 0x263c0
addq (%rbx), %rax
jmp 0x4e4d4
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rsi, 0x10(%rsp)
movq %rdi, %r15
movl $0xa, %esi
callq 0x286e0
xorl %r12d, %r12d
movq %rbx, 0x8(%rsp)
testq %rbx, %rbx
je 0x4e5ce
cmpq $-0x1, %rax
je 0x4e5ce
decq 0x8(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x8(%rsp), %rbp
movq %r15, %rdi
movl $0xa, %esi
callq 0x286e0
movq %rax, %r13
movq 0x38(%r15), %rdi
cmpq %rdi, 0x58(%r15)
je 0x4e54a
callq 0x263c0
movq %rax, %rsi
addq (%r15), %rsi
jmp 0x4e54c
xorl %esi, %esi
cmpq $0x0, 0x10(%r15)
je 0x4e564
movq 0x38(%r15), %rdi
movq %rsi, %r14
callq 0x27270
movq %r14, %rsi
jmp 0x4e568
movq 0x8(%r15), %rax
incq %r13
movq %r13, %rcx
subq %r12, %rcx
subq (%r15), %rax
cmpq %rcx, %rax
cmovaeq %rcx, %rax
movq %rbp, %r14
subq %r12, %r14
cmpq %rax, %r14
cmovaeq %rax, %r14
movq 0x10(%rsp), %rax
leaq (%rax,%r12), %rdi
movq %r14, %rdx
callq 0x27260
addq %r14, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x27960
cmpq %rbp, %r12
movzbl %bl, %ebx
movl $0x1, %eax
cmovael %eax, %ebx
cmpq %r13, %r12
cmovael %eax, %ebx
testb $0x1, %bl
je 0x4e523
movq 0x10(%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
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4fc05
movq %rbx, %rdi
callq 0x27ef0
movw $0x0, 0x28(%rbx)
leaq 0x30(%rbx), %rdi
callq 0x28fd0
movq $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rax
movb $0x0, (%rax)
movl $0xffffffff, 0x78(%rbx) # imm = 0xFFFFFFFF
subq $-0x80, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x27bf0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xd0(%rsp), %r13
movq %r13, %rdi
callq 0x28890
movq %r13, %rdi
movq %r12, %rsi
callq 0x28a00
leaq 0x70(%rsp), %rdi
callq 0x26970
leaq 0xd0(%rsp), %rdi
callq 0x267b0
testb %al, %al
je 0x500ea
leaq 0x10(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movl $0x1, %esi
callq 0x27da0
leaq 0x70(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x29210
leaq 0x10(%rsp), %rdi
callq 0x28300
jmp 0x5013d
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x26eb0
leaq 0x70(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x26b80
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x261c0
leaq 0x50(%rsp), %rsi
movl -0x8(%rsi), %eax
leaq 0xb0(%rsp), %rdi
movl %eax, -0x8(%rdi)
callq 0x26b80
leaq 0x10(%rsp), %rdi
callq 0x28b10
leaq 0x70(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x27660
movl %eax, %ebx
leaq 0x70(%rsp), %rdi
callq 0x28b10
leaq 0xd0(%rsp), %rdi
callq 0x26640
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 0x28300
jmp 0x501a7
jmp 0x501a4
jmp 0x501a4
jmp 0x5019f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x28b10
jmp 0x501a7
movq %rax, %rbx
jmp 0x501b1
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x28b10
leaq 0xd0(%rsp), %rdi
callq 0x26640
movq %rbx, %rdi
callq 0x28c20
movq %rax, %rdi
callq 0x2f0bd
// File: /workspace/github_cpp_makefile_star2_O1/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 0x50204
callq 0x27800
movq 0x70(%rbx), %r14
testq %r14, %r14
je 0x501fc
movq %r14, %rdi
callq 0x29200
movq %r14, %rdi
callq 0x27560
movq $0x0, 0x70(%rbx)
movl $0x0, 0xfc(%rbx)
movl $0xffffffff, 0x78(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
// File: /workspace/github_cpp_makefile_star2_O1/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 0x27040
testb %al, %al
je 0x50302
cmpq $0x0, 0x70(%r15)
je 0x50319
movq %r15, %rdi
callq 0x28070
testq %rax, %rax
js 0x50319
movl %ebp, %edx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x26700
movq $-0x1, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x26490
testb %al, %al
je 0x503c9
movq 0x70(%rbx), %rdi
leaq 0x7(%rsp), %rdx
movl $0x1388, %esi           # imm = 0x1388
callq 0x28e90
testb %al, %al
je 0x503f5
movq 0x70(%rbx), %rdi
callq 0x28ad0
testq %rax, %rax
js 0x50428
movq %rax, %r14
leaq 0x80(%rbx), %rdi
movq %rax, %rsi
callq 0x269a0
movq 0x70(%rbx), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x26de0
movq %rax, %r14
cmpq $-0x1, %rax
jne 0x50454
movq 0x108(%rbx), %rdx
addq $0x100, %rbx            # imm = 0x100
leaq 0x6e2c(%rip), %rcx      # 0x571e0
movl $0x41, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x285b0
jmp 0x50454
leaq 0x100(%rbx), %rdi
movq 0x108(%rbx), %rdx
leaq 0x6cf8(%rip), %rcx      # 0x570d6
movl $0x2f, %r8d
xorl %esi, %esi
callq 0x285b0
movq %rbx, %rdi
callq 0x27ef0
jmp 0x5044d
movq 0x108(%rbx), %rdx
addq $0x100, %rbx            # imm = 0x100
cmpb $0x1, 0x7(%rsp)
jne 0x50419
leaq 0x6cf5(%rip), %rcx      # 0x57106
movl $0x3c, %r8d
jmp 0x50443
leaq 0x6d23(%rip), %rcx      # 0x57143
movl $0x4a, %r8d
jmp 0x50443
movq 0x108(%rbx), %rdx
addq $0x100, %rbx            # imm = 0x100
leaq 0x6d51(%rip), %rcx      # 0x5718e
movl $0x51, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x285b0
movq $-0x1, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x264d0
testb %al, %al
je 0x50644
movq $-0x1, %rax
cmpq $0x2, %r15
jb 0x50678
decq %r15
subq $-0x80, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x28670
testq %rax, %rax
je 0x50672
cmpq $0x2, %rax
jl 0x50674
cmpb $0xa, -0x1(%rbx,%rax)
jne 0x50674
cmpb $0xd, -0x2(%rbx,%rax)
jne 0x50674
movb $0xa, -0x2(%rbx,%rax)
decq %rax
jmp 0x50674
movq 0x108(%r14), %rdx
addq $0x100, %r14            # imm = 0x100
leaq 0x6bc9(%rip), %rcx      # 0x57222
movl $0x31, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x285b0
movq $-0x1, %rax
jmp 0x50678
xorl %eax, %eax
movb $0x0, (%rbx,%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x28a40
movl %eax, %ebp
testb %al, %al
jne 0x506a7
movq %rbx, %rdi
callq 0x28070
testq %rax, %rax
jne 0x5068c
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x26a00
testb %al, %al
je 0x506e5
movq 0x70(%rbx), %rdi
movl %ebp, %edx
movq %r14, %rsi
callq 0x288d0
jmp 0x50727
movq 0x108(%rbx), %rdx
addq $0x100, %rbx            # imm = 0x100
cmpb $0x0, 0xf(%rsp)
je 0x50709
leaq 0x6b88(%rip), %rcx      # 0x57289
movl $0x42, %r8d
jmp 0x50716
leaq 0x6b44(%rip), %rcx      # 0x57254
movl $0x34, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x285b0
movq $-0x1, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/TcpSocketEngine_p.cpp
// Function: BamTools::Internal::TcpSocketEngine::Close()
void TcpSocketEngine::Close(void) {

    // close socket if we have valid FD
    if ( m_socketDescriptor != -1 ) {
        nativeClose();
        m_socketDescriptor = -1;
    }

    // reset state
    m_socketState = TcpSocket::UnconnectedState;
//    m_localAddress.Clear();
    m_remoteAddress.Clear();
//    m_localPort = 0;
    m_remotePort = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $-0x1, (%rdi)
je 0x5095b
movq %rbx, %rdi
callq 0x286d0
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0x0, 0x50(%rbx)
leaq 0x8(%rbx), %rdi
callq 0x28fd0
movw $0x0, 0x48(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x509d3
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
cmpl $0x1, 0x50(%rdi)
je 0x509ce
movl %edx, %ebx
movq %rsi, %r15
movzwl %bx, %edx
movq %r14, %rdi
callq 0x29010
testb %al, %al
je 0x509cc
movq 0x10(%r15), %rax
movq %rax, 0x18(%r14)
movups (%r15), %xmm0
movups %xmm0, 0x8(%r14)
leaq 0x20(%r14), %rdi
leaq 0x18(%r15), %rsi
callq 0x26b80
movb 0x38(%r15), %al
movb %al, 0x40(%r14)
movw %bx, 0x48(%r14)
movb $0x1, %al
jmp 0x509ce
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x50a3a
movq %r14, %rdi
callq 0x27800
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x28140
nop
// File: /workspace/github_cpp_makefile_star2_O1/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)
movl $0x1, %edx
callq 0x289a0
movl %eax, %ebp
testl %eax, %eax
jne 0x50abd
movb $0x1, (%r14)
movl $0x5, 0x4c(%rbx)
movq 0x60(%rbx), %rdx
addq $0x58, %rbx
leaq 0x681f(%rip), %rcx      # 0x572cc
movl $0x10, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x285b0
testl %ebp, %ebp
setg %al
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x289a0
movl %eax, %ebp
testl %eax, %eax
jne 0x50b0c
movb $0x1, (%r14)
movl $0x5, 0x4c(%rbx)
movq 0x60(%rbx), %rdx
addq $0x58, %rbx
leaq 0x67d0(%rip), %rcx      # 0x572cc
movl $0x10, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x285b0
testl %ebp, %ebp
setg %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0x1, %esi
movl $0x6, %edx
callq 0x26450
movl %eax, %ebx
testl %eax, %eax
jle 0x50d43
movl %ebx, (%r14)
jmp 0x50dc4
callq 0x26110
movl (%rax), %eax
cmpl $0x16, %eax
jle 0x50d63
cmpl $0x60, %eax
jg 0x50d74
leal -0x17(%rax), %ecx
cmpl $0x2, %ecx
jb 0x50d9d
cmpl $0x5d, %eax
je 0x50d7e
jmp 0x50dc4
cmpl $0xc, %eax
je 0x50d9d
cmpl $0xd, %eax
je 0x50dd1
cmpl $0x16, %eax
je 0x50d7e
jmp 0x50dc4
cmpl $0x69, %eax
je 0x50d9d
cmpl $0x61, %eax
jne 0x50dc4
movl $0x7, 0x4c(%r14)
movq 0x60(%r14), %rdx
addq $0x58, %r14
leaq 0x65e1(%rip), %rcx      # 0x57376
movl $0x16, %r8d
jmp 0x50dba
movl $0x4, 0x4c(%r14)
movq 0x60(%r14), %rdx
addq $0x58, %r14
leaq 0x65d9(%rip), %rcx      # 0x5738d
movl $0x10, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x285b0
testl %ebx, %ebx
setg %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x3, 0x4c(%r14)
movq 0x60(%r14), %rdx
addq $0x58, %r14
leaq 0x657c(%rip), %rcx      # 0x57364
movl $0x11, %r8d
jmp 0x50dba
// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0x0, (%rdx)
movl (%rdi), %edi
movl $0x541b, %esi           # imm = 0x541B
xorl %eax, %eax
callq 0x281c0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x50e17
movl 0x4(%rsp), %ecx
movslq %ecx, %rax
popq %rcx
retq