// File: 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:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x170(%rsp)
movq %rsi, 0x168(%rsp)
movq %rdx, 0x160(%rsp)
movl %ecx, 0x15c(%rsp)
movq 0x170(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x118(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x7aae0
movq 0x20(%rsp), %rdi
movq 0x168(%rsp), %rsi
callq 0x7afd0
jmp 0xe02d9
leaq 0xa8(%rsp), %rdi
callq 0x73670
jmp 0xe02e8
leaq 0x118(%rsp), %rdi
callq 0x72f60
movb %al, 0x17(%rsp)
jmp 0xe02fb
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xe0308
jmp 0xe03f2
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7c6c0
movq 0x8(%rsp), %rcx
leaq 0x90(%rsp), %rdi
movl $0x1, %esi
leaq 0x118(%rsp), %rdx
callq 0x783b0
jmp 0xe033b
leaq 0xa8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x7ca00
jmp 0xe0352
leaq 0x90(%rsp), %rdi
callq 0x797f0
jmp 0xe0361
leaq 0x8f(%rsp), %rdi
callq 0x77470
jmp 0xe0452
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xe04b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xe04a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xe03e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x797f0
jmp 0xe03de
jmp 0xe03e0
leaq 0x8f(%rsp), %rdi
callq 0x77470
jmp 0xe04a3
movq 0x168(%rsp), %rsi
movq 0x160(%rsp), %rdx
leaq 0x28(%rsp), %rdi
callq 0x74880
jmp 0xe040e
leaq 0xa8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x72f50
jmp 0xe0422
leaq 0x28(%rsp), %rdi
callq 0x7b1e0
jmp 0xe042e
jmp 0xe0452
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x7b1e0
jmp 0xe0450
jmp 0xe04a3
movq 0x18(%rsp), %rdi
movq 0x160(%rsp), %rdx
movl 0x15c(%rsp), %ecx
leaq 0xa8(%rsp), %rsi
callq 0x768b0
movb %al, 0x7(%rsp)
jmp 0xe0479
leaq 0xa8(%rsp), %rdi
callq 0x7b1e0
jmp 0xe0488
leaq 0x118(%rsp), %rdi
callq 0x72a20
movb 0x7(%rsp), %al
andb $0x1, %al
addq $0x178, %rsp            # imm = 0x178
retq
leaq 0xa8(%rsp), %rdi
callq 0x7b1e0
jmp 0xe04b2
jmp 0xe04b4
leaq 0x118(%rsp), %rdi
callq 0x72a20
jmp 0xe04c3
jmp 0xe04c5
movq 0x110(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)