Function at 0x402c40
Capabilities:
Check for time delay via gettickcount
Get socket status

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x32c
mov eax, dword [0x51d56c]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x14]
push ebx
push esi
xor esi, esi
push edi
mov dword [ebp - 0x318], eax
mov dword [ebp - 0x324], esi
mov dword [ebp - 0x320], esi
mov dword [ebp - 0x31c], esi
cmp eax, 0x7fffffff
jl 0x402c8a
mov dword [ebp - 0x318], getsockopt
mov eax, dword [ebp - 0x318]
mov edi, dword [ebp + 8]
mov ebx, dword [ebp + 0xc]
cmp edi, 0xffffffff
jne 0x402cb8
cmp ebx, edi
jne 0x402cb8
cmp dword [ebp + 0x10], edi
jne 0x402cb8
push eax
call fcn.00402c10
add esp, 4
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ab15e
mov esp, ebp
pop ebp
ret
cmp eax, esi
jle 0x402cd3
mov dword [ebp - 0x31c], eax
call fcn.0040d0d0
mov dword [ebp - 0x324], eax
mov dword [ebp - 0x320], edx
xor edx, edx
mov dword [ebp - 0x108], edx
mov dword [ebp - 0x314], 0xffffffff
mov dword [ebp - 0x20c], esi
cmp edi, 0xffffffff
je 0x402d15
mov esi, 1
mov edx, esi
mov dword [ebp - 0x208], edi
mov dword [ebp - 0x20c], esi
mov dword [ebp - 0x104], edi
mov dword [ebp - 0x108], edx
mov dword [ebp - 0x314], edi
cmp ebx, 0xffffffff
je 0x402d8a
xor eax, eax
test esi, esi
je 0x402d2e
cmp dword [ebp + eax*4 - 0x208], ebx
je 0x402d2e
inc eax
cmp eax, esi
jb 0x402d20
cmp eax, esi
jne 0x402d4b
cmp esi, 0x40
jae 0x402d4b
mov dword [ebp + eax*4 - 0x208], ebx
mov esi, dword [ebp - 0x20c]
inc esi
mov dword [ebp - 0x20c], esi
xor eax, eax
test edx, edx
je 0x402d5f
cmp dword [ebp + eax*4 - 0x104], ebx
je 0x402d5f
inc eax
cmp eax, edx
jb 0x402d51
cmp eax, edx
jne 0x402d7c
cmp edx, 0x40
jae 0x402d7c
mov dword [ebp + eax*4 - 0x104], ebx
mov edx, dword [ebp - 0x108]
inc edx
mov dword [ebp - 0x108], edx
cmp ebx, dword [ebp - 0x314]
jbe 0x402d8a
mov dword [ebp - 0x314], ebx
mov edi, dword [ebp + 0x10]
xor ecx, ecx
mov dword [ebp - 0x310], ecx
cmp edi, 0xffffffff
je 0x402de4
mov ecx, 1
xor eax, eax
mov dword [ebp - 0x30c], edi
mov dword [ebp - 0x310], ecx
test edx, edx
je 0x402dc0
cmp dword [ebp + eax*4 - 0x104], edi
je 0x402dc0
add eax, ecx
cmp eax, edx
jb 0x402db1
cmp eax, edx
jne 0x402dd6
cmp edx, 0x40
jae 0x402dd6
mov dword [ebp + eax*4 - 0x104], edi
add dword [ebp - 0x108], ecx
cmp edi, dword [ebp - 0x314]
jbe 0x402de4
mov dword [ebp - 0x314], edi
mov ebx, dword [ebp - 0x314]
xor eax, eax
cmp dword [ebp - 0x318], eax
lea edx, [ebp - 0x32c]
setl al
lea edi, [eax - 1]
and edi, edx
inc ebx
jmp 0x402e10
mov ecx, dword [ebp - 0x310]
mov esi, dword [ebp - 0x20c]
nop
mov eax, dword [ebp - 0x318]
xor edx, edx
cmp eax, edx
jle 0x402e4d
mov eax, 0x10624dd3
imul dword [ebp - 0x31c]
sar edx, 6
mov eax, edx
shr eax, 0x1f
add eax, edx
mov edx, dword [ebp - 0x31c]
mov dword [ebp - 0x32c], eax
imul eax, eax, 0x3e8
sub edx, eax
imul edx, edx, 0x3e8
jmp 0x402e55
jne 0x402e5b
mov dword [ebp - 0x32c], edx
mov dword [ebp - 0x328], edx
neg ecx
sbb ecx, ecx
push edi
lea edx, [ebp - 0x310]
and ecx, edx
lea eax, [ebp - 0x108]
push eax
neg esi
sbb esi, esi
lea eax, [ebp - 0x20c]
push ecx
and esi, eax
push esi
push ebx
call dword [sym.imp.WS2_32.dll_select]
cmp eax, 0xffffffff
jne 0x402ee4
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
test eax, eax
je 0x402ea3
cmp dword [0x51eae8], 0
jne 0x402ee8
cmp eax, 0x2714
jne 0x402ee8
cmp dword [ebp - 0x318], 0
jle 0x402e03
mov ecx, dword [ebp - 0x320]
mov edx, dword [ebp - 0x324]
push ecx
push edx
call fcn.0040d0d0
push edx
push eax
call fcn.0040d100
mov ecx, dword [ebp - 0x318]
sub ecx, eax
add esp, 0x10
mov dword [ebp - 0x31c], ecx
test ecx, ecx
jle 0x402efe
jmp 0x402e03
test eax, eax
jns 0x402efc
pop edi
pop esi
or eax, 0xffffffff
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ab15e
mov esp, ebp
pop ebp
ret
jne 0x402f11
pop edi
pop esi
xor eax, eax
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004ab15e
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 8]
xor esi, esi
cmp edi, 0xffffffff
je 0x402f45
lea eax, [ebp - 0x20c]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402f31
mov esi, 1
lea ecx, [ebp - 0x108]
push ecx
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402f45
or esi, 4
mov edi, dword [ebp + 0xc]
cmp edi, 0xffffffff
je 0x402f75
lea edx, [ebp - 0x20c]
push edx
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402f61
or esi, 8
lea eax, [ebp - 0x108]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402f75
or esi, 4
mov edi, dword [ebp + 0x10]
cmp edi, 0xffffffff
je 0x402fa5
lea ecx, [ebp - 0x310]
push ecx
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402f91
or esi, 2
lea edx, [ebp - 0x108]
push edx
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x402fa5
or esi, 4
mov ecx, dword [ebp - 4]
pop edi
mov eax, esi
pop esi
xor ecx, ebp
pop ebx
call fcn.004ab15e
mov esp, ebp
pop ebp
ret