Function at 0x40d500
Capabilities:
Connect socket
Set socket configuration

Disassembly:
sub esp, 0xe4
mov eax, dword [0x751f00]
xor eax, esp
mov dword [esp + 0xdc], eax
mov eax, dword [esp + 0xec]
push ebx
push ebp
mov ebp, dword [esp + 0xf0]
mov edx, dword [ebp]
push esi
push edi
mov dword [esp + 0x14], edx
push ebp
lea ebx, [esp + 0x20]
lea edx, [esp + 0x2c]
mov dword [esp + 0x28], eax
mov dword [esp + 0x24], 0
mov dword [eax], 0xffffffff
call fcn.0040da80
add esp, 4
mov dword [esp + 0x18], eax
test eax, eax
jne 0x40d7ce
movzx eax, word [esp + 0x38]
sub eax, 2
jne 0x40d5bb
lea eax, [esp + 0x3c]
push 0x2e
push eax
lea esi, [esp + 0xc4]
call fcn.00431340
add esp, 8
test eax, eax
je 0x40d5bb
mov ecx, dword [esp + 0x3a]
push ecx
call dword [sym.imp.WS2_32.dll_ntohs]
mov edx, esi
mov esi, dword [esp + 0x14]
push edx
push str.__Trying__s..._n
mov ecx, esi
call fcn.0040f940
mov ebx, dword [esp + 0x24]
add esp, 8
cmp dword [esp + 0x28], 2
jne 0x40d5b7
mov edi, 1
cmp dword [esp + 0x2c], edi
je 0x40d5f7
xor edi, edi
jmp 0x40d609
mov byte [esp + 0xbc], 0
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push ebp
call fcn.00431bd0
add esp, 4
push eax
mov eax, dword [esp + 0x18]
push edi
push str.sa_addr_inet_ntop___failed_with_errno__d:__s
call fcn.0040f9d0
mov eax, dword [esp + 0x28]
add esp, 0xc
mov esi, ebp
call fcn.0040da20
jmp 0x40d7ce
cmp dword [esi + 0x3ec], 0
je 0x40d609
mov ecx, ebx
mov eax, ebp
call fcn.0040d400
mov esi, ebx
call fcn.0040d460
mov esi, dword [esp + 0x14]
test edi, edi
je 0x40d628
cmp dword [esi + 0x528], 0
je 0x40d628
mov edi, ebx
call fcn.0040c630
mov eax, dword [esi + 0x1b0]
test eax, eax
je 0x40d668
mov ecx, dword [esi + 0x1b4]
push 0
push ebx
push ecx
call eax
add esp, 0xc
cmp eax, 2
jne 0x40d651
mov edi, 1
mov dword [esp + 0x20], edi
jmp 0x40d66d
test eax, eax
je 0x40d668
mov eax, ebx
mov esi, ebp
call fcn.0040da20
mov eax, 0x2a
jmp 0x40d7d0
mov edi, 1
cmp dword [esp + 0x28], 2
jne 0x40d6a8
push 2
push ebx
mov ecx, ebp
call fcn.0040c840
add esp, 8
mov dword [esp + 0x18], eax
test eax, eax
je 0x40d6a8
mov eax, ebx
mov esi, ebp
call fcn.0040da20
mov eax, dword [esp + 0x18]
cmp eax, edi
jne 0x40d7d0
mov eax, 7
jmp 0x40d7d0
lea edx, [esp + 0x1c]
push edx
push 0x8004667e
push ebx
mov dword [esp + 0x28], edi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov ecx, eax
mov eax, 0x10624dd3
mul ecx
shr edx, 6
mov eax, edx
imul eax, eax, 0x3e8
sub ecx, eax
imul ecx, ecx, 0x3e8
cmp dword [ebp + 0x330], edi
mov dword [ebp + 0x328], edx
mov dword [ebp + 0x32c], ecx
jle 0x40d70a
mov ecx, dword [ebp + 0x33c]
mov edx, dword [ebp + 0x338]
push ecx
push edx
push esi
call fcn.004049d0
add esp, 0xc
cmp dword [esp + 0x20], 0
jne 0x40d7c8
cmp dword [ebp + 0x8c], edi
jne 0x40d7c8
cmp dword [ebp + 0x310], 0
jne 0x40d740
mov eax, dword [esp + 0x34]
push eax
lea ecx, [esp + 0x3c]
push ecx
push ebx
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x40d7b5
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov esi, eax
cmp esi, 0xb
je 0x40d7a1
cmp esi, 0x2732
jle 0x40d75d
cmp esi, 0x2734
jle 0x40d7a1
push ebp
mov edi, esi
call fcn.00431bd0
mov edi, dword [esp + 0x18]
add esp, 4
push eax
lea edx, [esp + 0xc0]
push edx
push str.Immediate_connect_fail_for__s:__s_n
mov ecx, edi
call fcn.0040f940
mov dword [edi + 0x8700], esi
add esp, 0xc
mov eax, ebx
mov esi, ebp
call fcn.0040da20
mov dword [esp + 0x18], 7
mov eax, dword [esp + 0x18]
jmp 0x40d7d0
mov eax, dword [esp + 0x24]
mov dword [esp + 0x18], 0
mov dword [eax], ebx
mov eax, dword [esp + 0x18]
jmp 0x40d7d0
cmp dword [esp + 0x18], 0
jne 0x40d7c2
mov eax, dword [esp + 0x24]
mov dword [eax], ebx
mov eax, dword [esp + 0x18]
jmp 0x40d7d0
mov ecx, dword [esp + 0x24]
mov dword [ecx], ebx
xor eax, eax
mov ecx, dword [esp + 0xec]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0055e7fd
add esp, 0xe4
ret