Function at 0x40c160
Capabilities:
Connect socket
Set socket configuration

Disassembly:
sub esp, 0x2e8
mov eax, dword [0x47602c]
xor eax, esp
mov dword [esp + 0x2e4], eax
mov eax, dword [esp + 0x2f8]
mov ecx, dword [esp + 0x2f4]
add eax, 0x54
push ebx
mov ebx, dword [esp + 0x2f0]
push ebp
push esi
mov esi, dword [esp + 0x2fc]
lea eax, [esi + eax*4]
mov dword [esp + 0x14], esi
mov dword [eax], 0xffffffff
mov dword [esp + 0x1c], eax
mov eax, dword [ecx + 4]
mov dword [esp + 0x30], eax
xor eax, eax
push edi
mov edi, dword [ebx + 0xc]
mov byte [esp + 0x13], 0
cmp dword [edi + 0x58], 3
setne al
inc eax
mov dword [esp + 0x38], eax
mov eax, 0x11
cmp dword [edi + 0x58], 3
jne 0x40c1d3
mov eax, dword [ecx + 0xc]
mov dword [esp + 0x3c], eax
mov eax, dword [ecx + 0x10]
mov dword [esp + 0x40], eax
cmp eax, 0x80
jbe 0x40c1f2
mov dword [esp + 0x40], 0x80
mov eax, 0x80
push eax
push dword [ecx + 0x18]
lea eax, [esp + 0x4c]
push eax
call fcn.00444700
add esp, 0xc
cmp dword [ebx + 0x1c0], 0
je 0x40c238
push 1
push ebx
call fcn.004016c0
lea eax, [esp + 0x3c]
push eax
mov eax, dword [ebx + 0x1c0]
push 0
push dword [ebx + 0x1c4]
call eax
push 0
push ebx
mov ebp, eax
call fcn.004016c0
add esp, 0x1c
jmp 0x40c24c
push dword [esp + 0x3c]
push dword [esp + 0x3c]
push dword [esp + 0x3c]
call dword [sym.imp.WS2_32.dll_socket]
mov ebp, eax
cmp ebp, 0xffffffff
je 0x40c664
cmp dword [edi + 0x58], 5
jne 0x40c266
push 1
push ebp
call fcn.004353f0
add esp, 8
mov ecx, dword [edi + 0x54]
test ecx, ecx
je 0x40c27d
mov eax, dword [esp + 0x5c]
cmp dword [esp + 0x34], 0x17
cmove eax, ecx
mov dword [esp + 0x5c], eax
lea eax, [esp + 0x14]
xor edi, edi
push eax
lea eax, [esp + 0xc8]
push eax
push dword [esp + 0x48]
lea eax, [esp + 0x50]
push eax
call fcn.0040aae0
add esp, 0x10
test al, al
jne 0x40c2e5
call fcn.0044c2c7
mov esi, dword [eax]
call fcn.0044c2c7
mov edi, eax
lea eax, [esp + 0xf4]
push 0x100
push eax
push esi
call fcn.0041bf40
push eax
push dword [edi]
push str.sa_addr_inet_ntop___failed_with_errno__d:__s
push ebx
call fcn.0040a120
push ebp
push dword [esp + 0x38]
push ebx
call fcn.0040ab70
add esp, 0x28
xor eax, eax
jmp 0x40c669
push dword [esp + 0x14]
lea eax, [esp + 0xc8]
push eax
push str.__Trying__s:_d..._n
push ebx
call fcn.0040a1e0
mov eax, dword [esp + 0x44]
add esp, 0x10
cmp eax, 2
je 0x40c30d
cmp eax, 0x17
jne 0x40c36a
cmp dword [esp + 0x38], 1
jne 0x40c36a
cmp byte [ebx + 0x717], 0
mov byte [esp + 0x12], 1
je 0x40c36f
push 4
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], 1
push eax
push 1
push 6
push ebp
call dword [sym.imp.WS2_32.dll_setsockopt]
test eax, eax
jns 0x40c36f
push 0x100
lea eax, [esp + 0x1f8]
push eax
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call fcn.0041bf40
push eax
push str.Could_not_set_TCP_NODELAY:__s_n
push ebx
call fcn.0040a1e0
add esp, 0x18
jmp 0x40c36f
mov byte [esp + 0x12], 0
mov eax, dword [0x476bb4]
mov dword [esp + 0x18], 0x4020
mov dword [esp + 0x14], edi
mov dword [esp + 0x1c], 4
test eax, eax
jne 0x40c3b7
push 3
push 2
push eax
push 6
call fcn.00435790
add esp, 0x10
test al, al
je 0x40c3ab
mov dword [0x476bb4], 2
jmp 0x40c3fd
mov dword [0x476bb4], 1
jmp 0x40c3bc
cmp eax, 2
je 0x40c3fd
lea eax, [esp + 0x1c]
push eax
lea eax, [esp + 0x18]
push eax
push 0x1001
push 0xffff
push ebp
call dword [sym.imp.WS2_32.dll_getsockopt]
test eax, eax
jne 0x40c3e5
mov eax, dword [esp + 0x14]
cmp eax, dword [esp + 0x18]
jg 0x40c3fd
push 4
lea eax, [esp + 0x1c]
push eax
push 0x1001
push 0xffff
push ebp
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp byte [esp + 0x12], 0
je 0x40c4be
cmp byte [ebx + 0x720], 0
je 0x40c4be
push 4
lea eax, [esp + 0x18]
mov dword [esp + 0x18], 1
push eax
push 8
push 0xffff
push ebp
call dword [sym.imp.WS2_32.dll_setsockopt]
test eax, eax
jns 0x40c447
push ebp
push str.Failed_to_set_SO_KEEPALIVE_on_fd__d_n
push ebx
call fcn.0040a1e0
add esp, 0xc
jmp 0x40c4be
push dword [ebx + 0x6b8]
mov dword [esp + 0x28], 1
call fcn.0040c740
push dword [ebx + 0x6bc]
imul eax, eax, 0x3e8
mov dword [esp + 0x1c], eax
mov dword [esp + 0x30], eax
call fcn.0040c740
add esp, 8
imul eax, eax, 0x3e8
push 0
push 0
mov dword [esp + 0x1c], eax
mov dword [esp + 0x34], eax
lea eax, [esp + 0x24]
push eax
push 0
push 0
push 0xc
lea eax, [esp + 0x3c]
push eax
push 0x98000004
push ebp
call dword [sym.imp.WS2_32.dll_WSAIoctl]
test eax, eax
je 0x40c4be
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push ebp
push str.Failed_to_set_SIO_KEEPALIVE_VALS_on_fd__d:__d_n
push ebx
call fcn.0040a1e0
add esp, 0x10
cmp dword [ebx + 0x1b8], edi
je 0x40c4fc
push 1
push ebx
call fcn.004016c0
mov eax, dword [ebx + 0x1b8]
push 0
push ebp
push dword [ebx + 0x1bc]
call eax
push 0
push ebx
mov dword [esp + 0x38], eax
call fcn.004016c0
mov eax, dword [esp + 0x38]
add esp, 0x1c
cmp eax, 2
jne 0x40c544
mov byte [esp + 0x13], 1
mov eax, dword [esp + 0x34]
cmp eax, 2
je 0x40c50a
cmp eax, 0x17
jne 0x40c55d
lea eax, [esp + 0x44]
push eax
call fcn.00435360
push eax
push dword [esp + 0x3c]
push ebp
push ebx
call fcn.0040bb00
mov edi, eax
add esp, 0x14
test edi, edi
je 0x40c55d
push ebp
push esi
push ebx
call fcn.0040ab70
add esp, 0xc
cmp edi, 1
je 0x40c664
mov eax, edi
jmp 0x40c669
test eax, eax
je 0x40c4fc
push ebp
push esi
push ebx
call fcn.0040ab70
add esp, 0xc
mov eax, 0x2a
jmp 0x40c669
push 1
push ebp
call fcn.004353f0
lea eax, [esp + 0x2c]
push eax
call fcn.004127d0
add esp, 0xc
cmp dword [esi + 0x26c], 1
movups xmm0, xmmword [eax]
movups xmmword [esi + 0x270], xmm0
jle 0x40c5b0
push 3
push dword [esi + 0x284]
push dword [esi + 0x280]
push ebx
call fcn.00401300
push 4
push dword [esi + 0x28c]
push dword [esi + 0x288]
push ebx
call fcn.00401300
add esp, 0x20
cmp byte [esp + 0x13], 0
jne 0x40c65a
cmp dword [esi + 0x58], 4
je 0x40c65a
cmp byte [esi + 0x262], 0
jne 0x40c5f1
push dword [esp + 0x40]
lea eax, [esp + 0x48]
push eax
push ebp
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
je 0x40c5f1
test edi, edi
jne 0x40c656
mov eax, dword [esp + 0x20]
mov dword [eax], ebp
mov eax, edi
jmp 0x40c669
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov edi, eax
mov ecx, edi
sub ecx, 0xb
je 0x40c64e
sub ecx, 0x2728
je 0x40c64e
sub ecx, 1
je 0x40c64e
push 0x100
lea eax, [esp + 0xf8]
push eax
push edi
call fcn.0041bf40
push eax
lea eax, [esp + 0xd4]
push eax
push str.Immediate_connect_fail_for__s:__s_n
push ebx
call fcn.0040a1e0
push ebp
push esi
push ebx
mov dword [ebx + 0x964], edi
call fcn.0040ab70
mov edi, 7
add esp, 0x28
mov eax, edi
jmp 0x40c669
mov eax, dword [esp + 0x20]
xor edi, edi
mov dword [eax], ebp
mov eax, edi
jmp 0x40c669
mov eax, dword [esp + 0x20]
mov dword [eax], ebp
xor eax, eax
jmp 0x40c669
mov eax, 7
mov ecx, dword [esp + 0x2f4]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.004435c6
add esp, 0x2e8
ret