Function at 0x404f40
Capabilities:
Connect socket
Get socket status
Set socket configuration

Disassembly:
sub esp, 0x230
xor eax, eax
push ebx
push ebp
mov dword [esp + 0x1a], eax
push esi
xor ebx, ebx
push edi
mov dword [esp + 0x26], eax
push ebx
mov dword [esp + 0x2e], eax
push 1
mov ebp, ecx
push 2
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x24], ebx
mov word [esp + 0x2c], bx
mov word [esp + 0x3a], ax
mov dword [esp + 0x20], ebx
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, ebx
jbe 0x40503e
mov eax, dword [esp + 0x244]
mov word [esp + 0x20], 2
cmp byte [eax], bl
je 0x404fac
push eax
mov ecx, ebp
call fcn.00404ec0
push eax
call dword [sym.imp.WS2_32.dll_htonl]
mov dword [esp + 0x24], eax
mov ecx, dword [esp + 0x248]
push ecx
call dword [sym.imp.MSVCRT.dll_atoi]
add esp, 4
push eax
call dword [sym.imp.WS2_32.dll_htons]
cmp ax, bx
mov word [esp + 0x22], ax
je 0x40503e
lea edx, [esp + 0x14]
mov dword [esp + 0x14], 1
push edx
push 0x8004667e
push esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp eax, 0xffffffff
mov dword [esp + 0x10], eax
je 0x40503e
mov eax, dword [ebp]
push 7
mov ecx, ebp
call dword [eax + 8]
lea ecx, [esp + 0x20]
push 0x10
push ecx
push esi
call dword [sym.imp.WS2_32.dll_connect]
mov ecx, eax
cmp ecx, ebx
mov dword [esp + 0x10], ecx
je 0x40517f
jge 0x405059
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov ecx, eax
cmp ecx, 0x2733
mov dword [esp + 0x10], ecx
je 0x405059
cmp ecx, 0x2734
je 0x405059
mov edx, dword [ebp]
push 8
mov ecx, ebp
call dword [edx + 8]
cmp esi, 0xffffffff
je 0x40504a
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x230
ret 0xc
mov edx, dword [esp + 0x24c]
cmp edx, ebx
jne 0x405069
mov edx, 0x1e
mov eax, 0xcccccccd
mov dword [esp + 0x30], 0xa
mul edx
mov edi, edx
mov dword [esp + 0x34], ebx
shr edi, 3
mov dword [esp + 0x1c], ebx
je 0x4050f8
mov eax, dword [ebp]
push 5
mov ecx, ebp
call dword [eax + 8]
test eax, eax
je 0x40503e
mov eax, 1
lea ecx, [esp + 0x30]
mov dword [esp + 0x13c], eax
mov dword [esp + 0x38], eax
push ecx
lea edx, [esp + 0x3c]
push ebx
lea eax, [esp + 0x144]
push edx
lea ecx, [esi + 1]
push eax
push ecx
mov dword [esp + 0x154], esi
mov dword [esp + 0x50], esi
call dword [sym.imp.WS2_32.dll_select]
mov ecx, eax
cmp ecx, 0xffffffff
mov dword [esp + 0x10], ecx
jne 0x4050e7
call dword [sym.imp.MSVCRT.dll__errno]
cmp dword [eax], 4
je 0x405087
mov ecx, dword [esp + 0x10]
cmp ecx, ebx
jg 0x405100
mov eax, dword [esp + 0x1c]
inc eax
cmp eax, edi
mov dword [esp + 0x1c], eax
jb 0x405087
cmp ecx, ebx
jle 0x40503e
lea edx, [esp + 0x38]
push edx
push esi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
jne 0x405125
lea eax, [esp + 0x13c]
push eax
push esi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x40503e
lea ecx, [esp + 0x18]
lea edx, [esp + 0x10]
push ecx
push edx
push 0x1007
push 0xffff
push esi
mov dword [esp + 0x2c], 4
call dword [sym.imp.WS2_32.dll_getsockopt]
test eax, eax
jl 0x40503e
cmp dword [esp + 0x10], ebx
jne 0x40503e
lea eax, [esp + 0x14]
mov dword [ebp + 4], esi
push eax
push 0x8004667e
push esi
mov dword [esp + 0x20], ebx
call dword [sym.imp.WS2_32.dll_ioctlsocket]
cmp eax, 0xffffffff
mov dword [esp + 0x10], eax
je 0x40503e
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x230
ret 0xc