// File: /workspace/github_cpp_makefile_star2_O3/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 0x196cd(%rip), %rax     # 0x1d520
movq %rax, 0x196b6(%rip)     # 0x1d510
leaq 0x196af(%rip), %rbx     # 0x1d510
leaq 0x8(%rsp), %r15
movq $0x13, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x1968f(%rip)     # 0x1d510
movq (%r15), %rcx
movq %rcx, 0x19695(%rip)     # 0x1d520
movups 0x10182(%rip), %xmm0    # 0x14014
movups %xmm0, (%rax)
movl $0x67726f2e, 0xf(%rax)  # imm = 0x67726F2E
movq %rcx, 0x19675(%rip)     # 0x1d518
movq 0x19666(%rip), %rax     # 0x1d510
movb $0x0, (%rax,%rcx)
leaq 0x1968b(%rip), %rax     # 0x1d540
movq %rax, 0x19674(%rip)     # 0x1d530
leaq 0x1966d(%rip), %r14     # 0x1d530
movq $0x12, (%r15)
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x19650(%rip)     # 0x1d530
leaq 0x8(%rsp), %rsi
movq (%rsi), %rcx
movq %rcx, 0x19651(%rip)     # 0x1d540
movups 0x10132(%rip), %xmm0    # 0x14028
movups %xmm0, (%rax)
movw $0x6772, 0x10(%rax)     # imm = 0x6772
movq %rcx, 0x19632(%rip)     # 0x1d538
movq 0x19623(%rip), %rax     # 0x1d530
movb $0x0, (%rax,%rcx)
leaq 0x19648(%rip), %rax     # 0x1d560
movq %rax, 0x19631(%rip)     # 0x1d550
leaq 0x1962a(%rip), %r14     # 0x1d550
movq $0x14, (%rsi)
movq %r14, %rdi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x19612(%rip)     # 0x1d550
leaq 0x8(%rsp), %rbx
movq (%rbx), %rcx
movq %rcx, 0x19613(%rip)     # 0x1d560
movups 0x100e7(%rip), %xmm0    # 0x1403b
movups %xmm0, (%rax)
movl $0x6d6f632e, 0x10(%rax) # imm = 0x6D6F632E
movq %rcx, 0x195f3(%rip)     # 0x1d558
movq 0x195e4(%rip), %rax     # 0x1d550
xorl %r15d, %r15d
movb %r15b, (%rax,%rcx)
leaq 0x19606(%rip), %rax     # 0x1d580
movq %rax, 0x195ef(%rip)     # 0x1d570
movabsq $0x312e3032312e3436, %rax # imm = 0x312E3032312E3436
movq %rax, 0x195ee(%rip)     # 0x1d580
movabsq $0x3033312e3331312e, %rax # imm = 0x3033312E3331312E
movq %rax, 0x195e3(%rip)     # 0x1d586
movl $0xe, %eax
movq %rax, 0x195c9(%rip)     # 0x1d578
movb %r15b, 0x195d8(%rip)    # 0x1d58e
leaq 0x195e3(%rip), %rcx     # 0x1d5a0
movq %rcx, 0x195cc(%rip)     # 0x1d590
movabsq $0x312e38352e393032, %rcx # imm = 0x312E38352E393032
movq %rcx, 0x195cb(%rip)     # 0x1d5a0
movabsq $0x3530322e3434312e, %rcx # imm = 0x3530322E3434312E
movq %rcx, 0x195c0(%rip)     # 0x1d5a6
movq %rax, 0x195ab(%rip)     # 0x1d598
movb %r15b, 0x195ba(%rip)    # 0x1d5ae
leaq 0x195c5(%rip), %rax     # 0x1d5c0
movq %rax, 0x195ae(%rip)     # 0x1d5b0
movabsq $0x332e3033312e3439, %rax # imm = 0x332E3033312E3439
movq %rax, 0x195ad(%rip)     # 0x1d5c0
movl $0x34392e35, 0x195ab(%rip) # imm = 0x34392E35
movq $0xc, 0x19590(%rip) # 0x1d5b8
movb %r15b, 0x1959d(%rip)    # 0x1d5cc
leaq 0x195aa(%rip), %rax     # 0x1d5e0
movq %rax, 0x19593(%rip)     # 0x1d5d0
movabsq $0x3130312e3231322e, %rax # imm = 0x3130312E3231322E
movq %rax, 0x19599(%rip)     # 0x1d5e7
movabsq $0x2e3536312e383831, %rax # imm = 0x2E3536312E383831
movq %rax, 0x19581(%rip)     # 0x1d5e0
movq $0xf, 0x1956e(%rip) # 0x1d5d8
movb %r15b, 0x1957e(%rip)    # 0x1d5ef
leaq 0x19588(%rip), %rax     # 0x1d600
movq %rax, 0x19571(%rip)     # 0x1d5f0
movq $0x0, 0x1956e(%rip) # 0x1d5f8
movb %r15b, 0x1956f(%rip)    # 0x1d600
leaq -0x29f(%rip), %rdi      # 0x3df9
leaq 0x192f1(%rip), %r14     # 0x1d390
xorl %esi, %esi
movq %r14, %rdx
callq 0x3380
leaq 0x19570(%rip), %rax     # 0x1d620
movq %rax, 0x19559(%rip)     # 0x1d610
leaq 0x19552(%rip), %rdi     # 0x1d610
movq $0x12, (%rbx)
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3680
movq %rax, 0x1953a(%rip)     # 0x1d610
movq (%rbx), %rcx
movq %rcx, 0x19540(%rip)     # 0x1d620
movups 0xffa4(%rip), %xmm0     # 0x1408b
movups %xmm0, (%rax)
movw $0x6772, 0x10(%rax)     # imm = 0x6772
movq %rcx, 0x19521(%rip)     # 0x1d618
movq 0x19512(%rip), %rax     # 0x1d610
movb %r15b, (%rax,%rcx)
leaq -0x2de(%rip), %rdi      # 0x3e2b
xorl %esi, %esi
movq %r14, %rdx
callq 0x3380
leaq 0x19516(%rip), %rax     # 0x1d630
xorps %xmm0, %xmm0
movups %xmm0, (%r15,%rax)
movw $0x0, 0x10(%r15,%rax)
movl $0x0, 0x14(%r15,%rax)
addq $0x18, %r15
cmpq $0x78, %r15
jne 0x411d
xorps %xmm0, %xmm0
movups %xmm0, 0x19561(%rip)    # 0x1d6a8
movw $0x0, 0x19568(%rip)     # 0x1d6b8
movl $0x0, 0x19562(%rip)     # 0x1d6bc
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x4166
movq %rax, %r15
addq $-0x10, %r14
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x417b
callq 0x33d0
leaq -0x20(%r14), %rax
addq $-0x10, %r14
cmpq %rbx, %r14
movq %rax, %r14
jne 0x416d
movq %r15, %rdi
callq 0x3650