// File: /workspace/github_cpp_makefile_star2_O3/tenup-coin[P]seeder/netbase.cpp
// Function: ConnectSocketByName(CService&, unsigned int&, char const*, int, int)
bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault, int nTimeout)
{
    string strDest;
    int port = portDefault;
    SplitHostPort(string(pszDest), port, strDest);

    SOCKET hSocket = INVALID_SOCKET;
    CService addrResolved(CNetAddr(strDest, fNameLookup && !nameproxyInfo.second), port);
    if (addrResolved.IsValid()) {
        addr = addrResolved;
        return ConnectSocket(addr, hSocketRet, nTimeout);
    }
    addr = CService("0.0.0.0:0");
    if (!nameproxyInfo.second)
        return false;
    if (!ConnectSocketDirectly(nameproxyInfo.first, hSocket, nTimeout))
        return false;

    switch(nameproxyInfo.second)
    {
        default:
        case 4: return false;
        case 5:
            if (!Socks5(strDest, port, hSocket))
                return false;
            break;
    }

    hSocketRet = hSocket;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movl %r8d, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
movl %ecx, 0xc(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x30(%rsp), %rax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x3190
leaq 0xb0(%rsp), %rdi
leaq 0xc(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x71c3
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8dc0
callq 0x33d0
cmpl $0x0, 0x136a5(%rip)     # 0x1c46c
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
sete %al
andb 0x13698(%rip), %al      # 0x1c470
movzbl %al, %edx
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x91e4
movl 0xc(%rsp), %r15d
movups 0x30(%rsp), %xmm0
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movw %r15w, 0x10(%rdi)
callq 0x7850
testb %al, %al
je 0x8e34
movzwl 0x80(%rsp), %eax
movw %ax, 0x10(%r14)
movaps 0x70(%rsp), %xmm0
movups %xmm0, (%r14)
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x79d2
movl %eax, %ebx
jmp 0x8f1a
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movw %ax, 0x20(%rsp)
leaq 0x30(%rsp), %rsi
movw %ax, 0x10(%rsi)
movaps %xmm0, (%rsi)
leaq 0xa587(%rip), %rdi      # 0x133dd
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7767
testb %al, %al
je 0x8e77
movzwl 0x40(%rsp), %eax
movw %ax, 0x20(%rsp)
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movzwl 0x20(%rsp), %eax
movw %ax, 0x10(%r14)
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%r14)
cmpl $0x0, 0x135db(%rip)     # 0x1c46c
je 0x8f18
leaq 0x135ba(%rip), %rdi     # 0x1c458
leaq 0x8(%rsp), %rsi
movl %ebp, %edx
callq 0x7e87
cmpl $0x5, 0x135bb(%rip)     # 0x1c46c
sete %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x8f18
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x706e
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl %r15d, %esi
callq 0x81de
movl %eax, %ebp
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x8f09
callq 0x33d0
testb %bpl, %bpl
je 0x8f18
movl 0x8(%rsp), %eax
movl %eax, (%rbx)
movb $0x1, %bl
jmp 0x8f1a
xorl %ebx, %ebx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x8f29
callq 0x33d0
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
jne 0x8f67
jmp 0x8f71
jmp 0x8f6e
jmp 0x8f6e
jmp 0x8f6e
movq %rax, %rbx
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f71
callq 0x33d0
jmp 0x8f71
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x8f80
callq 0x33d0
movq %rbx, %rdi
callq 0x3650