Function at 0x40f7a0
Capabilities:
Check for time delay via gettickcount

Disassembly:
sub esp, 0x54
mov eax, dword [0x5cc5b0]
xor eax, esp
mov dword [esp + 0x50], eax
mov eax, dword [esp + 0x60]
mov ecx, dword [esp + 0x5c]
push ebp
xor edx, edx
push edi
mov edi, dword [esp + 0x60]
mov ebp, dword [edi]
mov dword [eax], edx
mov dword [esp + 0x14], ecx
mov dword [esp + 0x24], eax
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], edx
cmp dword [edi + ecx*4 + 0x290], edx
je 0x40f7f4
pop edi
mov dword [eax], 1
xor eax, eax
pop ebp
mov ecx, dword [esp + 0x50]
xor ecx, esp
call fcn.00501f35
add esp, 0x54
ret
push ebx
push esi
call fcn.0040c120
mov esi, eax
mov eax, dword [ebp + 0x1e0]
mov ebx, edx
xor ecx, ecx
mov dword [esp + 0x24], esi
mov dword [esp + 0x28], ebx
mov dword [esp + 0x10], 0x493e0
test eax, eax
jle 0x40f820
mov ecx, 1
mov edx, dword [ebp + 0x1e4]
test edx, edx
jle 0x40f82d
or ecx, 2
dec ecx
je 0x40f840
dec ecx
je 0x40f83a
dec ecx
jne 0x40f844
cmp eax, edx
jl 0x40f840
mov dword [esp + 0x10], edx
jmp 0x40f844
mov dword [esp + 0x10], eax
mov eax, dword [ebp + 0x56c]
mov ecx, dword [ebp + 0x568]
push eax
push ecx
push ebx
push esi
call fcn.0040c150
add esp, 0x10
sub dword [esp + 0x10], eax
je 0x40f869
cmp dword [esp + 0x10], 0
jge 0x40f88f
push str.Connection_time_out
push ebp
call fcn.0040c610
add esp, 8
pop esi
pop ebx
pop edi
mov eax, 0x1c
pop ebp
mov ecx, dword [esp + 0x50]
xor ecx, esp
call fcn.00501f35
add esp, 0x54
ret
xor ebx, ebx
mov eax, ebx
xor eax, 1
mov dword [esp + 0x20], eax
mov eax, dword [edi + ebx*4 + 0x15c]
cmp eax, 0xffffffff
je 0x40fa22
push 0
push eax
push 0xffffffffffffffff
push 0xffffffffffffffff
call fcn.004015b0
add esp, 0x10
test eax, eax
jne 0x40f94b
mov edx, dword [edi + 0x2d4]
mov eax, dword [edi + 0x2d0]
mov ecx, dword [esp + 0x28]
mov esi, dword [edi + 0x2dc]
push edx
mov edx, dword [esp + 0x28]
push eax
push ecx
push edx
call fcn.0040c150
add esp, 0x10
cmp eax, esi
jl 0x40f902
push esi
push str.After__ldms_connect_time__move_on__n
push ebp
call fcn.0040c580
add esp, 0xc
mov dword [esp + 0x14], 0x274c
test ebx, ebx
jne 0x40f994
cmp dword [edi + 0x54], ebx
jne 0x40f994
mov eax, dword [edi + 0x2d4]
mov ecx, dword [edi + 0x2d0]
mov edx, dword [esp + 0x28]
push eax
mov eax, dword [esp + 0x28]
push ecx
push edx
push eax
call fcn.0040c150
add esp, 0x10
cmp eax, 0xc8
jl 0x40f994
mov ecx, dword [esp + 0x1c]
push 1
push ecx
call fcn.0040f6d0
add esp, 8
jmp 0x40f994
cmp eax, 2
jne 0x40f97c
mov edx, dword [edi + ebx*4 + 0x15c]
push edx
lea esi, [esp + 0x18]
call fcn.0040ebf0
add esp, 4
test eax, eax
jne 0x40fa70
push str.Connection_failed_n
push ebp
call fcn.0040c580
add esp, 8
jmp 0x40f994
test al, 4
je 0x40f994
mov eax, dword [edi + ebx*4 + 0x15c]
push eax
lea esi, [esp + 0x18]
call fcn.0040ebf0
add esp, 4
mov esi, dword [esp + 0x14]
test esi, esi
je 0x40fa22
push esi
mov dword [ebp + 0x8634], esi
call dword [sym.imp.WS2_32.dll_WSASetLastError]
mov eax, dword [edi + ebx*4 + 0x50]
test eax, eax
je 0x40fa22
push 0x2e
lea ecx, [esp + 0x34]
push ecx
push eax
call fcn.00402d50
push esi
push edi
call fcn.00411f40
mov edx, dword [edi + 0xb0]
push eax
push edx
lea eax, [esp + 0x4c]
push eax
push str.connect_to__s_port__ld_failed:__s_n
push ebp
call fcn.0040c580
mov ecx, dword [edi + ebx*4 + 0x50]
mov eax, dword [esp + 0x38]
add esp, 0x28
cmp dword [ecx + 0x1c], 0
je 0x40f9f7
cdq
sub eax, edx
sar eax, 1
mov edx, dword [esp + 0x1c]
push ebx
push edx
mov dword [edi + 0x2dc], eax
call fcn.0040f6d0
add esp, 8
cmp eax, 7
jne 0x40fa1e
mov ecx, dword [esp + 0x20]
cmp dword [edi + ecx*4 + 0x15c], 0xffffffff
jne 0x40fa22
mov dword [esp + 0x18], eax
inc ebx
cmp ebx, 2
jl 0x40f891
cmp dword [esp + 0x18], 0
je 0x40fb3f
cmp dword [edi + 0x54], 0
jne 0x40fa58
mov eax, dword [esp + 0x1c]
push 1
push eax
call fcn.0040f6d0
add esp, 8
mov dword [esp + 0x18], eax
test eax, eax
je 0x40fb02
cmp dword [edi + 0x274], 0
je 0x40fb17
mov esi, dword [edi + 0xa8]
jmp 0x40fb1d
mov edx, dword [edi + ebx*4 + 0x15c]
mov esi, dword [esp + 0x1c]
mov dword [edi + esi*4 + 0x154], edx
mov eax, dword [edi + ebx*4 + 0x50]
mov dword [edi + 0x4c], eax
mov dword [edi + ebx*4 + 0x15c], 0xffffffff
mov ebx, dword [esp + 0x20]
mov eax, dword [edi + ebx*4 + 0x15c]
cmp eax, 0xffffffff
je 0x40fab9
push eax
push edi
call fcn.0040f130
add esp, 8
mov dword [edi + ebx*4 + 0x15c], 0xffffffff
push esi
push edi
call fcn.00403e40
add esp, 8
test eax, eax
jne 0x40fb43
mov ecx, dword [esp + 0x2c]
mov dword [edi + esi*4 + 0x290], 1
mov dword [ecx], 1
test esi, esi
jne 0x40faeb
push 4
push ebp
call fcn.00414960
add esp, 8
mov edx, dword [edi + esi*4 + 0x154]
push edx
push edi
call fcn.0040ed30
push edi
call fcn.00403ed0
add esp, 0xc
pop esi
pop ebx
pop edi
xor eax, eax
pop ebp
mov ecx, dword [esp + 0x50]
xor ecx, esp
call fcn.00501f35
add esp, 0x54
ret
mov esi, dword [edi + 0x98]
mov ecx, dword [esp + 0x14]
push ecx
push edi
call fcn.00411f40
mov edx, dword [edi + 0xb0]
push eax
push edx
push esi
push str.Failed_to_connect_to__s_port__ld:__s
push ebp
call fcn.0040c610
add esp, 0x1c
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x60]
pop esi
pop ebx
pop edi
pop ebp
xor ecx, esp
call fcn.00501f35
add esp, 0x54
ret