// File: /workspace/github_cpp_makefile_star2_O1/MyHush[P]hush-seeder/netbase.cpp
// Function: GLOBAL__sub_I_netbase.cpp
bool static Socks4(const CService &addrDest, SOCKET& hSocket)
{
    printf("SOCKS4 connecting %s\n", addrDest.ToString().c_str());
    if (!addrDest.IsIPv4())
    {
        closesocket(hSocket);
        return error("Proxy destination is not IPv4");
    }
    char pszSocks4IP[] = "\4\1\0\0\0\0\0\0user";
    struct sockaddr_in addr;
    socklen_t len = sizeof(addr);
    if (!addrDest.GetSockAddr((struct sockaddr*)&addr, &len) || addr.sin_family != AF_INET)
    {
        closesocket(hSocket);
        return error("Cannot get proxy destination address");
    }
    memcpy(pszSocks4IP + 2, &addr.sin_port, 2);
    memcpy(pszSocks4IP + 4, &addr.sin_addr, 4);
    char* pszSocks4 = pszSocks4IP;
    int nSize = sizeof(pszSocks4IP);

    int ret = send(hSocket, pszSocks4, nSize, MSG_NOSIGNAL);
    if (ret != nSize)
    {
        closesocket(hSocket);
        return error("Error sending to proxy");
    }
    char pchRet[8];
    if (recv(hSocket, pchRet, 8, 0) != 8)
    {
        closesocket(hSocket);
        return error("Error reading proxy response");
    }
    if (pchRet[1] != 0x5a)
    {
        closesocket(hSocket);
        if (pchRet[1] != 0x5b)
            printf("ERROR: Proxy returned error %d\n", pchRet[1]);
        return false;
    }
    printf("SOCKS4 connected %s\n", addrDest.ToString().c_str());
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x1a6bc(%rip), %rax     # 0x1e520
movq %rax, 0x1a6a5(%rip)     # 0x1e510
leaq 0x1a69e(%rip), %rbx     # 0x1e510
leaq 0x8(%rsp), %rsi
movq $0x13, (%rsi)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x1a681(%rip)     # 0x1e510
leaq 0x8(%rsp), %rsi
movq (%rsi), %rcx
movq %rcx, 0x1a682(%rip)     # 0x1e520
movups 0x1116f(%rip), %xmm0    # 0x15014
movups %xmm0, (%rax)
movl $0x67726f2e, 0xf(%rax)  # imm = 0x67726F2E
movq %rcx, 0x1a662(%rip)     # 0x1e518
movq 0x1a653(%rip), %rax     # 0x1e510
movb $0x0, (%rax,%rcx)
leaq 0x1a678(%rip), %rax     # 0x1e540
movq %rax, 0x1a661(%rip)     # 0x1e530
leaq 0x1a65a(%rip), %rbx     # 0x1e530
movq $0x12, (%rsi)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x1a642(%rip)     # 0x1e530
leaq 0x8(%rsp), %rsi
movq (%rsi), %rcx
movq %rcx, 0x1a643(%rip)     # 0x1e540
movups 0x11124(%rip), %xmm0    # 0x15028
movups %xmm0, (%rax)
movw $0x6772, 0x10(%rax)     # imm = 0x6772
movq %rcx, 0x1a624(%rip)     # 0x1e538
movq 0x1a615(%rip), %rax     # 0x1e530
movb $0x0, (%rax,%rcx)
leaq 0x1a63a(%rip), %rax     # 0x1e560
movq %rax, 0x1a623(%rip)     # 0x1e550
leaq 0x1a61c(%rip), %rbx     # 0x1e550
movq $0x14, (%rsi)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x1a604(%rip)     # 0x1e550
leaq 0x8(%rsp), %rbx
movq (%rbx), %rcx
movq %rcx, 0x1a605(%rip)     # 0x1e560
movups 0x110d9(%rip), %xmm0    # 0x1503b
movups %xmm0, (%rax)
movl $0x6d6f632e, 0x10(%rax) # imm = 0x6D6F632E
movq %rcx, 0x1a5e5(%rip)     # 0x1e558
movq 0x1a5d6(%rip), %rax     # 0x1e550
xorl %r15d, %r15d
movb %r15b, (%rax,%rcx)
leaq 0x1a5f8(%rip), %rax     # 0x1e580
movq %rax, 0x1a5e1(%rip)     # 0x1e570
movabsq $0x312e3032312e3436, %rax # imm = 0x312E3032312E3436
movq %rax, 0x1a5e0(%rip)     # 0x1e580
movabsq $0x3033312e3331312e, %rax # imm = 0x3033312E3331312E
movq %rax, 0x1a5d5(%rip)     # 0x1e586
movl $0xe, %eax
movq %rax, 0x1a5bb(%rip)     # 0x1e578
movb %r15b, 0x1a5ca(%rip)    # 0x1e58e
leaq 0x1a5d5(%rip), %rcx     # 0x1e5a0
movq %rcx, 0x1a5be(%rip)     # 0x1e590
movabsq $0x312e38352e393032, %rcx # imm = 0x312E38352E393032
movq %rcx, 0x1a5bd(%rip)     # 0x1e5a0
movabsq $0x3530322e3434312e, %rcx # imm = 0x3530322E3434312E
movq %rcx, 0x1a5b2(%rip)     # 0x1e5a6
movq %rax, 0x1a59d(%rip)     # 0x1e598
movb %r15b, 0x1a5ac(%rip)    # 0x1e5ae
leaq 0x1a5b7(%rip), %rax     # 0x1e5c0
movq %rax, 0x1a5a0(%rip)     # 0x1e5b0
movabsq $0x332e3033312e3439, %rax # imm = 0x332E3033312E3439
movq %rax, 0x1a59f(%rip)     # 0x1e5c0
movl $0x34392e35, 0x1a59d(%rip) # imm = 0x34392E35
movq $0xc, 0x1a582(%rip) # 0x1e5b8
movb %r15b, 0x1a58f(%rip)    # 0x1e5cc
leaq 0x1a59c(%rip), %rax     # 0x1e5e0
movq %rax, 0x1a585(%rip)     # 0x1e5d0
movabsq $0x3130312e3231322e, %rax # imm = 0x3130312E3231322E
movq %rax, 0x1a58b(%rip)     # 0x1e5e7
movabsq $0x2e3536312e383831, %rax # imm = 0x2E3536312E383831
movq %rax, 0x1a573(%rip)     # 0x1e5e0
movq $0xf, 0x1a560(%rip) # 0x1e5d8
movb %r15b, 0x1a570(%rip)    # 0x1e5ef
leaq 0x1a57a(%rip), %rax     # 0x1e600
movq %rax, 0x1a563(%rip)     # 0x1e5f0
movq $0x0, 0x1a560(%rip) # 0x1e5f8
movb %r15b, 0x1a561(%rip)    # 0x1e600
leaq -0x29c(%rip), %rdi      # 0x3e0a
leaq 0x1a2e3(%rip), %r14     # 0x1e390
xorl %esi, %esi
movq %r14, %rdx
callq 0x3380
leaq 0x1a562(%rip), %rax     # 0x1e620
movq %rax, 0x1a54b(%rip)     # 0x1e610
leaq 0x1a544(%rip), %rdi     # 0x1e610
movq $0x12, (%rbx)
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x1a52c(%rip)     # 0x1e610
movq (%rbx), %rcx
movq %rcx, 0x1a532(%rip)     # 0x1e620
movups 0x10f96(%rip), %xmm0    # 0x1508b
movups %xmm0, (%rax)
movw $0x6772, 0x10(%rax)     # imm = 0x6772
movq %rcx, 0x1a513(%rip)     # 0x1e618
movq 0x1a504(%rip), %rax     # 0x1e610
movb %r15b, (%rax,%rcx)
leaq -0x2db(%rip), %rdi      # 0x3e3c
xorl %esi, %esi
movq %r14, %rdx
callq 0x3380
leaq 0x1a508(%rip), %rax     # 0x1e630
xorps %xmm0, %xmm0
movups %xmm0, (%r15,%rax)
movw $0x0, 0x10(%r15,%rax)
movl $0x0, 0x14(%r15,%rax)
addq $0x18, %r15
cmpq $0x78, %r15
jne 0x412b
xorps %xmm0, %xmm0
movups %xmm0, 0x1a553(%rip)    # 0x1e6a8
movw $0x0, 0x1a55a(%rip)     # 0x1e6b8
movl $0x0, 0x1a554(%rip)     # 0x1e6bc
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x4174
movq %rax, %r14
xorl %eax, %eax
jmp 0x4180
movq %rax, %r14
movb $0x1, %al
testb %al, %al
jne 0x41ad
addq $-0x10, %rbx
leaq 0x1a381(%rip), %r15     # 0x1e510
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x419d
callq 0x33d0
leaq -0x20(%rbx), %rax
addq $-0x10, %rbx
cmpq %r15, %rbx
movq %rax, %rbx
jne 0x418f
movq %r14, %rdi
callq 0x3650