// File: /workspace/github_cpp_makefile_star2_O1/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 0x7257
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8ebe
callq 0x33d0
cmpl $0x0, 0x135a7(%rip)     # 0x1c46c
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
sete %al
andb 0x1359a(%rip), %al      # 0x1c470
movzbl %al, %edx
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x9322
movl 0xc(%rsp), %r15d
movups 0x30(%rsp), %xmm0
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movw %r15w, 0x10(%rdi)
callq 0x790e
testb %al, %al
je 0x8f32
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 0x7a9e
movl %eax, %ebx
jmp 0x9018
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 0xa489(%rip), %rdi      # 0x133dd
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7823
testb %al, %al
je 0x8f75
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, 0x134dd(%rip)     # 0x1c46c
je 0x9016
leaq 0x134bc(%rip), %rdi     # 0x1c458
leaq 0x8(%rsp), %rsi
movl %ebp, %edx
callq 0x7f8f
cmpl $0x5, 0x134bd(%rip)     # 0x1c46c
sete %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x9016
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x7106
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movl %r15d, %esi
callq 0x82e6
movl %eax, %ebp
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x9007
callq 0x33d0
testb %bpl, %bpl
je 0x9016
movl 0x8(%rsp), %eax
movl %eax, (%rbx)
movb $0x1, %bl
jmp 0x9018
xorl %ebx, %ebx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x9027
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 0x9065
jmp 0x906f
jmp 0x906c
jmp 0x906c
jmp 0x906c
movq %rax, %rbx
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x906f
callq 0x33d0
jmp 0x906f
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x907e
callq 0x33d0
movq %rbx, %rdi
callq 0x3650