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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x43c
cmp dword [ebp + 8], 0
push ebx
push esi
push edi
mov ebx, ecx
je 0x405d19
cmp byte [ebx + 0x435], 0
jne 0x405d19
xor ecx, ecx
mov word [ebx + 0x228], cx
mov ecx, ebx
call fcn.00403acf
mov esi, dword [ebx + 0x438]
mov edi, dword [ebx + 0x43c]
call dword [sym.imp.KERNEL32.dll_GetTickCount64]
add eax, esi
mov dword [ebx + 0x440], eax
adc edx, edi
cmp byte [ebp + 0x18], 0
mov dword [ebx + 0x444], edx
je 0x405cc4
lea eax, [esp + 0x30]
push eax
call fcn.00445a98
test al, al
je 0x405cbb
cmp dword [esp + 0x334], 0
ja 0x405bef
cmp dword [esp + 0x338], 2
jae 0x405cbb
mov eax, dword [esp + 0x30]
cmp eax, 3
jne 0x405c25
push dword [ebp + 0x10]
lea eax, [esp + 0x34]
mov ecx, ebx
push dword [ebp + 0xc]
push dword [ebp + 8]
push eax
call fcn.0040536e
test al, al
je 0x405c21
push 0
push 1
call fcn.00445a6c
mov al, 1
jmp 0x405d1b
mov eax, dword [esp + 0x30]
xor edi, edi
inc edi
cmp eax, edi
jne 0x405c49
push dword [ebp + 0x10]
lea eax, [esp + 0x34]
mov ecx, ebx
push dword [ebp + 0xc]
push dword [ebp + 8]
push eax
call fcn.00405594
test al, al
jne 0x405c11
mov eax, dword [esp + 0x30]
cmp eax, 2
jne 0x405c67
push dword [ebp + 0x10]
lea eax, [esp + 0x34]
mov ecx, ebx
push dword [ebp + 0xc]
push dword [ebp + 8]
push eax
call fcn.0040572e
test al, al
jne 0x405c11
push edi
push 0
call fcn.00445a6c
lea ecx, [ebx + 0x228]
push ecx
lea eax, [esp + 0x38]
push eax
push str._s_proxy_connect_failed___s___reconnect_directly
push str.Socket
push 0x4b9170
call fcn.004456e8
add esp, 0x14
mov ecx, ebx
call fcn.00403acf
mov esi, dword [ebx + 0x438]
mov edi, dword [ebx + 0x43c]
call dword [sym.imp.KERNEL32.dll_GetTickCount64]
add eax, esi
mov dword [ebx + 0x440], eax
adc edx, edi
mov dword [ebx + 0x444], edx
cmp byte [ebx + 0x435], 0
jne 0x405d19
push dword [ebp + 8]
xor eax, eax
lea edi, [ebx + 0x28]
lea esi, [ebx + 0x228]
mov edx, 0xff
mov ecx, edi
mov word [esi], ax
call fcn.00403dea
push 0x100
push edi
call fcn.0042aa53
pop ecx
pop ecx
push 2
lea eax, [ebx + 0xc]
push eax
lea eax, [ebx + 0x434]
push eax
push dword [ebp + 0xc]
push edi
call fcn.00445824
test al, al
jne 0x405d24
push str.address_resolve_failed
mov edx, 0xff
mov ecx, esi
call fcn.00403dea
xor al, al
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x14
movzx eax, word [ebx + 0xc]
push 1
push 0
push 0
push 6
push 1
push eax
call dword [sym.imp.WS2_32.dll_WSASocketW]
mov dword [ebx + 8], eax
cmp eax, 0xffffffff
jne 0x405d48
push str.socket_create_failed
jmp 0x405d0d
cmp dword [ebp + 0x14], 0
je 0x405d58
xor eax, eax
lea edi, [esp + 0x20]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
mov eax, dword [ebx]
xor edi, edi
inc edi
mov ecx, ebx
push edi
call dword [eax + 0x18]
lea eax, [esp + 0xc]
mov dword [esp + 0xc], edi
push eax
push 0x8004667e
push dword [ebx + 8]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov esi, dword [sym.imp.WS2_32.dll_setsockopt]
lea eax, [esp + 0x10]
push 4
push eax
push 0x1002
push 0xffff
push dword [ebx + 8]
mov dword [esp + 0x24], 0x100000
mov dword [esp + 0x28], 0x40000
call esi
push 4
lea eax, [esp + 0x18]
push eax
push 0x1001
push 0xffff
push dword [ebx + 8]
call esi
xor esi, esi
lea ecx, [ebx + 0xc]
cmp word [ecx], 0x17
push esi
push esi
push esi
push esi
push 0x10
pop eax
push 0x1c
pop edx
cmove eax, edx
push eax
push ecx
push dword [ebx + 8]
call dword [sym.imp.WS2_32.dll_WSAConnect]
cmp eax, 0xffffffff
jne 0x405e7b
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
jne 0x405e3f
mov ecx, dword [ebx + 8]
xor edx, edx
mov eax, dword [ebp + 0x10]
mov dword [esp + 0x344], ecx
mov ecx, 0x3e8
div ecx
xor edx, edx
mov dword [esp + 0x340], edi
mov dword [esp + 0x18], eax
mov eax, dword [ebp + 0x10]
div ecx
imul eax, edx, 0x3e8
mov dword [esp + 0x1c], eax
lea eax, [esp + 0x18]
push eax
push esi
lea eax, [esp + 0x348]
push eax
push esi
push esi
call dword [sym.imp.WS2_32.dll_select]
test eax, eax
jg 0x405e7b
mov ecx, ebx
call fcn.00403acf
push str.connect_failed
mov edx, 0xff
lea ecx, [ebx + 0x228]
call fcn.00403dea
lea eax, [ebx + 0x28]
push eax
push str._s_direct_connect_failed
push str.Socket
push 0x4b9170
call fcn.004456e8
add esp, 0x10
jmp 0x405d19
lea eax, [esp + 0xc]
mov dword [esp + 0xc], esi
push eax
push 0x8004667e
push dword [ebx + 8]
call dword [sym.imp.WS2_32.dll_ioctlsocket]
mov esi, dword [ebx + 0x438]
mov edi, dword [ebx + 0x43c]
call dword [sym.imp.KERNEL32.dll_GetTickCount64]
add eax, esi
mov dword [ebx + 0x440], eax
lea eax, [ebx + 0x28]
push eax
adc edx, edi
push 0
mov dword [ebx + 0x444], edx
mov eax, dword [ebx + 8]
push eax
push str._I64u__s_connected
push str.Socket
push 0x4b9170
call fcn.004456e8
add esp, 0x18
jmp 0x405c1a