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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffdd4
push ebx
push esi
push edi
xor ebx, ebx
mov dword [ebp - 0x22c], ebx
mov dword [ebp - 0x128], ebx
mov dword [ebp - 0x124], ebx
mov ebx, ecx
mov edi, edx
mov dword [ebp - 4], eax
xor eax, eax
push ebp
push 0x514428
push dword fs:[eax]
mov dword fs:[eax], esp
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b14
xor edx, edx
push ebp
push 0x5143e7
push dword fs:[edx]
mov dword fs:[edx], esp
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x1ac]
mov dword [ebp - 8], eax
test eax, eax
je 0x514054
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
mov eax, dword [ebp - 4]
cmp byte [eax + 0x218], 0
jne 0x514087
mov eax, dword [ebp - 4]
cmp byte [eax + 0x1b4], 0
jne 0x514087
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
mov eax, dword [ebp - 4]
cmp byte [eax + 0x218], 0
jne 0x5140c7
mov eax, dword [ebp - 4]
add eax, 0x1b4
mov edx, 0x51443c
xor ecx, ecx
mov cl, byte [eax]
inc ecx
call fcn.004030c4
jne 0x5140c7
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
mov eax, dword [ebp - 4]
add eax, 0x218
mov edx, 0x51443c
xor ecx, ecx
mov cl, byte [eax]
inc ecx
call fcn.004030c4
jne 0x5140fb
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
mov eax, dword [ebp - 4]
cmp dword [eax + 0x1a8], 0
jne 0x514122
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
push 6
push 1
push 2
call sub.Ws2_32.dll_socket
mov esi, eax
mov eax, dword [ebp - 4]
mov dword [eax + 4], esi
inc esi
jne 0x514153
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
mov eax, dword [ebp - 4]
cmp byte [eax + 0x218], 0
je 0x51418c
lea eax, [ebp - 0x124]
mov edx, dword [ebp - 4]
add edx, 0x218
call fcn.00404bc4
mov eax, dword [ebp - 0x124]
call fcn.00404e18
push eax
call sub.Ws2_32.dll_inet_addr
mov edx, dword [ebp - 4]
mov dword [edx + 0xc], eax
jmp 0x5141b4
lea eax, [ebp - 0x128]
mov edx, dword [ebp - 4]
add edx, 0x1b4
call fcn.00404bc4
mov edx, dword [ebp - 0x128]
mov eax, dword [ebp - 4]
call fcn.0048af80
mov edx, dword [ebp - 4]
mov dword [edx + 0xc], eax
mov eax, dword [ebp - 4]
mov ax, word [eax + 0x1b0]
push eax
call sub.Ws2_32.dll_htons
mov edx, dword [ebp - 4]
mov word [edx + 0xa], ax
mov dword [ebp - 0xc], 1
lea eax, [ebp - 0xc]
push eax
push 0x8004667e
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_ioctlsocket
imul esi, ebx, 0x3e8
sar esi, 1
jns 0x5141f4
adc esi, 0
mov ebx, 2
push 0x10
mov eax, dword [ebp - 4]
add eax, 8
push eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_connect
inc eax
jne 0x5142e9
xor eax, eax
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x10], esi
lea eax, [ebp - 0x120]
push eax
call fcn.0048a788
lea eax, [ebp - 0x120]
push eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call fcn.0048a76c
mov dword [ebp - 0x1c], 4
lea eax, [ebp - 0x14]
push eax
push 0
lea eax, [ebp - 0x120]
push eax
push 0
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
inc eax
push eax
call sub.Ws2_32.dll_select
test eax, eax
jle 0x5142b8
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x18]
push eax
push 0x1007
push 0xffff
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_getsockopt
cmp dword [ebp - 0x18], 0
je 0x5142f7
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_closesocket
mov eax, dword [ebp - 4]
mov dword [eax + 4], 0xffffffff
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_closesocket
mov eax, dword [ebp - 4]
mov dword [eax + 4], 0xffffffff
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
push 0x19
call sub.kernel32.dll_Sleep_1
dec ebx
jne 0x5141f9
xor eax, eax
mov dword [ebp - 0xc], eax
lea eax, [ebp - 0xc]
push eax
push 0x8004667e
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_ioctlsocket
push 0x21
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x1a8]
push eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_WSAEventSelect
inc eax
jne 0x51435d
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
push eax
call sub.Ws2_32.dll_closesocket
mov eax, dword [ebp - 4]
mov dword [eax + 4], 0xffffffff
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143ff
test edi, edi
je 0x51437b
lea ecx, [ebp - 4]
mov dl, 1
mov eax, dword [0x513e68]
call fcn.00514640
mov edx, dword [ebp - 4]
mov dword [edx + 0x238], eax
jmp 0x514386
mov eax, dword [ebp - 4]
xor edx, edx
mov dword [eax + 0x238], edx
mov eax, dword [ebp - 4]
push dword [eax + 0xc]
call sub.Ws2_32.dll_inet_ntoa
mov edx, eax
lea eax, [ebp - 0x22c]
call fcn.00404b58
mov edx, dword [ebp - 0x22c]
lea eax, [ebp - 0x228]
mov ecx, 0xff
call fcn.00404bfc
lea edx, [ebp - 0x228]
mov eax, dword [ebp - 4]
add eax, 0x218
mov cl, 0x1f
call fcn.00403024
mov eax, dword [ebp - 4]
mov dword [eax + 0x1ac], 0xffffffff
mov dword [ebp - 8], 0xffffffff
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
jmp 0x5143f1
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x23c]
call fcn.00467b1c
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x51442f
lea eax, [ebp - 0x22c]
call fcn.00404968
lea eax, [ebp - 0x128]
mov edx, 2
call fcn.0040498c
ret