// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/io/BamHttp_p.cpp
// Function: BamTools::Internal::BamHttp::SendHeadRequest()
bool BamHttp::SendHeadRequest(void) {

    // ensure clean slate
    ClearResponse();
    if ( m_request )
        delete m_request;
    m_socket->ClearBuffer();

    // make sure we're connected
    if ( !EnsureSocketConnection() )
        return false;

    // create request
    m_request = new HttpRequestHeader(HEAD_METHOD, m_filename);
    m_request->SetField(HOST_HEADER, m_hostname);

    // send request
    const string requestHeader = m_request->ToString();
    const size_t headerSize    = requestHeader.size();
    if ( WriteToSocket(requestHeader.c_str(), headerSize) != headerSize ) {
        SetErrorString("BamHttp::SendHeadRequest", m_socket->GetErrorString());
        return false;
    }

    m_socket->ClearBuffer();

    // wait for response from server
    if ( !ReceiveResponse() ) {
        SetErrorString("BamHttp::SendHeadRequest", m_socket->GetErrorString());
        Close();
        return false;
    }
    BT_ASSERT_X(m_response, "BamHttp::SendHeadRequest : null HttpResponse");
    BT_ASSERT_X(m_response->IsValid(), "BamHttp::SendHeadRequest : invalid HttpResponse");

    // get content length if available
    if ( m_response->ContainsKey(CONTENT_LENGTH_HEADER) ) {
        const string contentLengthString = m_response->GetValue(CONTENT_LENGTH_HEADER);
        m_fileEndPosition = atoi( contentLengthString.c_str() ) - 1;
    }

    // return whether we found any errors
    return m_socket->GetError() == TcpSocket::NoError;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
callq 0x321a0
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x4f10f
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x30(%rbx), %rdi
callq 0x34f30
movq %rbx, %rdi
callq 0x33ae0
testb %al, %al
je 0x4f214
movl $0x88, %edi
callq 0x33130
movq %rax, %r14
leaq 0x78(%rbx), %rdx
leaq 0x291e0(%rip), %rsi     # 0x78320
pushq $0x1
popq %rcx
movq %rax, %rdi
movl %ecx, %r8d
callq 0x310f0
movq %r14, 0x98(%rbx)
leaq 0x38(%rbx), %rdx
leaq 0x291e0(%rip), %rsi     # 0x78340
movq %r14, %rdi
callq 0x33ca0
movq 0x98(%rbx), %rsi
movq (%rsi), %rax
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq *0x10(%rax)
movq (%r14), %rsi
movq 0x8(%r14), %r14
movq %rbx, %rdi
movl %r14d, %edx
callq 0x32700
cmpq %r14, %rax
jne 0x4f21b
movq 0x30(%rbx), %rdi
callq 0x34f30
movq %rbx, %rdi
callq 0x353b0
testb %al, %al
je 0x4f267
movq 0xa0(%rbx), %rdi
leaq 0x291e1(%rip), %rsi     # 0x783a0
callq 0x311d0
testb %al, %al
je 0x4f200
movq 0xa0(%rbx), %rsi
leaq 0x291ca(%rip), %rdx     # 0x783a0
leaq 0x8(%rsp), %rdi
callq 0x313b0
leaq 0x8(%rsp), %r14
movq (%r14), %rdi
callq 0x34710
decl %eax
cltq
movq %rax, 0xb8(%rbx)
movq %r14, %rdi
callq 0x33a00
movq 0x30(%rbx), %rdi
callq 0x33180
cmpl $-0x2, %eax
sete %bl
jmp 0x4f2bc
xorl %ebx, %ebx
jmp 0x4f2c6
leaq 0xda26(%rip), %rsi      # 0x5cc48
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
movq 0x30(%rbx), %rsi
leaq 0x28(%rsp), %rdi
callq 0x337f0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x34ab0
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x4f2ba
leaq 0xd9da(%rip), %rsi      # 0x5cc48
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
movq 0x30(%rbx), %rsi
leaq 0x28(%rsp), %rdi
callq 0x337f0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x34ab0
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x8(%rsp), %rdi
callq 0x33a00
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebx, %ebx
leaq 0x48(%rsp), %rdi
callq 0x33a00
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x4f2e6
jmp 0x4f31f
jmp 0x4f31f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x4f322
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x4f306
jmp 0x4f31f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x4f322
movq %rax, %rbx
movq %r14, %rdi
callq 0x32fa0
jmp 0x4f32c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f