Function at 0x4a1b91
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Create tcp socket
Get socket status
Resolve dns
Set socket configuration

Disassembly:
push ebp
mov ecx, 4
mov ebp, esp
push edi
cld
push esi
push ebx
xor ebx, ebx
mov esi, eax
lea edi, [ebp - 0x1c]
mov eax, ebx
sub esp, 0x250
mov dword [ebp - 0x258], edx
rep stosd dword es:[edi], eax
push esi
call sub.WSOCK32.DLL_gethostbyname
mov esi, eax
test eax, eax
jne 0x4a1be1
push str.Failed_to_resolve_host
jmp 0x4a1bcc
push str.address_size_mismatch_n
push 0
push 0xa
call fcn.004472ec
jmp 0x4a1dec
mov eax, edi
jmp 0x4a1def
mov eax, dword [eax + 0xc]
mov dword [ebp - 0x25c], 0
cmp dword [eax], 0
je 0x4a1dec
cmp word [esi + 8], 2
jne 0x4a1dec
mov ax, word [esi + 0xa]
cmp ax, 4
ja 0x4a1bc7
cwde
mov edx, dword [esi + 0xc]
push eax
mov eax, dword [ebp - 0x25c]
lea ebx, [ebp - 0x1c]
push dword [edx + eax*4]
lea eax, [ebp - 0x240]
push eax
call fcn.004bdd50
mov ax, word [esi + 8]
mov word [ebp - 0x1c], ax
mov eax, dword [ebp - 0x240]
mov dword [ebp - 0x18], eax
movzx eax, word [ebp - 0x258]
push eax
call sub.WSOCK32.DLL_htons
add esp, 0xc
mov word [ebp - 0x1a], ax
push 6
push 1
push 2
call sub.WSOCK32.DLL_socket
mov edi, eax
cmp eax, 0xffffffff
jne 0x4a1c6a
push str.socket_failed_n
jmp 0x4a1d84
lea eax, [ebp - 0x244]
mov dword [ebp - 0x244], 1
push eax
push 0x8004667e
push edi
call sub.WSOCK32.DLL_ioctlsocket
inc eax
setne al
movzx eax, al
dec eax
push 0x10
mov dword [ebp - 0x254], eax
push ebx
push edi
call sub.WSOCK32.DLL_connect
inc eax
jne 0x4a1cb6
call fcn.004a1573
sub eax, 0x2733
cmp eax, 1
jbe 0x4a1cb6
push str.error_connecting_to_HTTP_server
jmp 0x4a1d19
mov eax, dword [0x4fab00]
mov dword [ebp - 0x248], 0
mov dword [ebp - 0x24c], eax
mov dword [ebp - 0x128], edi
mov dword [ebp - 0x12c], 1
mov dword [ebp - 0x238], edi
lea eax, [ebp - 0x24c]
lea edx, [ebp - 0x23c]
push eax
lea ebx, [ebp - 0x12c]
lea eax, [edi + 1]
push edx
mov dword [ebp - 0x23c], 1
push ebx
push 0
push eax
call sub.WSOCK32.DLL_select
cmp eax, 0xffffffff
je 0x4a1d30
test eax, eax
jne 0x4a1d37
push str.Connect_attempt_timed_out
push 0
push 0xa
call fcn.004472ec
add esp, 0xc
push edi
call sub.WSOCK32.DLL_closesocket
jmp 0x4a1dd4
push str.Connect_failed
jmp 0x4a1d19
push ebx
push edi
call sub.WSOCK32.DLL___WSAFDIsSet
test eax, eax
jne 0x4a1d53
lea eax, [ebp - 0x23c]
push eax
push edi
call sub.WSOCK32.DLL___WSAFDIsSet
test eax, eax
je 0x4a1dc1
lea eax, [ebp - 0x250]
mov dword [ebp - 0x250], 4
push eax
lea eax, [ebp - 0x254]
push eax
push 0x1007
push 0xffff
push edi
call sub.WSOCK32.DLL_getsockopt
test eax, eax
jns 0x4a1d92
push str.getsockopt_failed_n
push 0
push 0xa
call fcn.004472ec
add esp, 0xc
jmp 0x4a1dd4
cmp dword [ebp - 0x254], 0
je 0x4a1dcb
push str.Error_connecting_to_remote_host
push 0
push 0xa
call fcn.004472ec
add esp, 0xc
push edi
call sub.WSOCK32.DLL_closesocket
call sub.msvcrt.dll__errno
mov edx, dword [ebp - 0x254]
mov dword [eax], edx
jmp 0x4a1dd4
push str.select_failed_n
jmp 0x4a1d19
cmp edi, 0xffffffff
jne 0x4a1bda
inc dword [ebp - 0x25c]
mov eax, dword [esi + 0xc]
mov edx, dword [ebp - 0x25c]
cmp dword [eax + edx*4], 0
jmp 0x4a1bf1
or eax, 0xffffffff
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret