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

Disassembly:
sub esp, 0x23c
push ebx
push ebp
push esi
push edi
mov ebp, ecx
call fcn.00405550
test eax, eax
jne 0x405c22
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x23c
ret 8
mov edi, dword [esp + 0x250]
or ecx, 0xffffffff
xor eax, eax
lea ebx, [ebp + 0x28]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
push ebx
mov eax, ecx
mov esi, edi
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x258]
mov dword [ebp + 0x128], ecx
call fcn.004056f0
add esp, 4
test eax, eax
jne 0x405c81
push ebx
push str.Couldnt_resolve___s_.
push ebp
call fcn.00406bd0
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x23c
ret 8
xor edi, edi
push edi
push ebp
call fcn.00406bd0
add esp, 8
mov ecx, ebp
call fcn.00405fb0
push edi
mov esi, 2
push 1
push esi
call sub.WSOCK32.dll_socket
cmp eax, 0xffffffff
mov dword [ebp], eax
jne 0x405ccf
mov ecx, ebp
call fcn.00406b60
push eax
push str.Couldnt_create_socket___d_.
push ebp
call fcn.00406bd0
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x23c
ret 8
lea edx, [esp + 0x24]
mov dword [esp + 0x24], 1
push edx
push 0x8004667e
push eax
call sub.WSOCK32.dll_ioctlsocket
cmp eax, 0xffffffff
je 0x405f01
mov edx, dword [ebp]
xor eax, eax
mov dword [esp + 0x2c], eax
lea ecx, [esp + 0x2c]
mov dword [esp + 0x30], eax
push 0x10
mov dword [esp + 0x38], eax
push ecx
push edx
mov dword [esp + 0x44], eax
mov word [esp + 0x38], si
mov dword [esp + 0x3c], edi
mov word [esp + 0x3a], di
call sub.WSOCK32.dll_bind
cmp eax, 0xffffffff
jne 0x405d37
mov ecx, ebp
call fcn.00406b60
push eax
push str.Couldnt_bind_socket___d_.
jmp 0x405f0e
xor eax, eax
push ebx
mov dword [esp + 0x18], eax
mov word [esp + 0x18], si
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], eax
call sub.WSOCK32.dll_inet_addr
mov cx, word [ebp + 0x128]
mov dword [esp + 0x18], eax
push ecx
call sub.WSOCK32.dll_htons
mov word [esp + 0x16], ax
mov eax, dword [ebp]
lea edx, [esp + 0x14]
push 0x10
push edx
push eax
call sub.WSOCK32.dll_connect
xor ebx, ebx
cmp eax, 0xffffffff
setne bl
cmp ebx, edi
jne 0x405f1e
mov ecx, ebp
call fcn.00406b60
cmp eax, 0x2733
jne 0x405ef2
mov ecx, dword [ebp + 0x1c]
mov eax, esi
cmp ecx, esi
jg 0x405da7
mov eax, ecx
mov esi, eax
mov dl, byte [0x437a1c]
test dl, dl
jne 0x405ede
cmp esi, ecx
jg 0x405ede
mov ecx, 1
mov dword [esp + 0x3c], eax
mov eax, dword [ebp]
mov dword [esp + 0x148], ecx
mov dword [esp + 0x44], ecx
lea ecx, [esp + 0x3c]
push ecx
lea edx, [esp + 0x48]
lea ecx, [esp + 0x14c]
mov dword [esp + 0x150], eax
mov dword [esp + 0x4c], eax
push edx
push ecx
inc eax
push edi
push eax
mov dword [esp + 0x54], edi
call sub.WSOCK32.dll_select
cmp eax, edi
jle 0x405e31
mov eax, dword [ebp]
lea edx, [esp + 0x44]
push edx
push eax
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
jne 0x405e68
mov edx, dword [ebp]
lea ecx, [esp + 0x148]
push ecx
push edx
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x405e37
mov ebx, 1
jmp 0x405e37
jl 0x405ec8
mov ecx, dword [ebp + 0x1c]
mov eax, ecx
sub eax, esi
cmp eax, 2
jg 0x405e4d
cmp eax, 1
jle 0x405e54
cmp eax, 2
jle 0x405e59
mov eax, 2
jmp 0x405e59
mov eax, 1
add esi, eax
cmp ebx, edi
je 0x405da9
jmp 0x405f1e
push edi
call dword [sym.imp.KERNEL32.dll_Sleep]
mov edx, dword [ebp]
lea eax, [esp + 0x28]
lea ecx, [esp + 0x10]
push eax
push ecx
push 0x1007
push 0xffff
push edx
mov dword [esp + 0x3c], 4
call sub.WSOCK32.dll_getsockopt
cmp eax, 0xffffffff
jne 0x405ea8
mov ecx, ebp
call fcn.00406b60
push eax
push str.CxSocket:_getsockopt_error___d_
jmp 0x405ed5
mov eax, dword [esp + 0x10]
cmp eax, edi
je 0x405eb8
push eax
push str.Connect_error___d_
jmp 0x405ed5
push str.Unknown_error
push ebp
call fcn.00406bd0
add esp, 8
jmp 0x405ede
mov ecx, ebp
call fcn.00406b60
push eax
push str.Select_error_connect____d_
push ebp
call fcn.00406bd0
add esp, 0xc
cmp ebx, edi
jne 0x405f1e
push str.Connect_timed_out.
push ebp
call fcn.00406bd0
add esp, 8
jmp 0x405f17
mov ecx, ebp
call fcn.00406b60
push eax
push str.Couldnt_connect_socket___d_.
jmp 0x405f0e
mov ecx, ebp
call fcn.00406b60
push eax
push str.Couldnt_change_to_non_blocking_socket___d_.
push ebp
call fcn.00406bd0
add esp, 0xc
mov ecx, ebp
call fcn.00405fb0
mov ecx, dword [ebp]
xor eax, eax
pop edi
cmp ecx, 0xffffffff
pop esi
pop ebp
setne al
pop ebx
add esp, 0x23c
ret 8