Function at 0x520520
Capabilities:
Get socket status

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x328
mov eax, dword [0x657114]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 0x31c], 0
mov dword [ebp - 0x318], 0
push esi
mov esi, dword [ebp + 0x10]
push edi
mov edi, dword [ebp + 0xc]
cmp eax, 0xffffffff
jne 0x520575
cmp edi, 0xffffffff
jne 0x520575
push esi
call fcn.005207a0
add esp, 4
pop edi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004682d0
mov esp, ebp
pop ebp
ret
test esi, esi
jle 0x52058d
call fcn.00518010
mov dword [ebp - 0x31c], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 0x318], edx
xor ecx, ecx
test esi, esi
push ebx
mov ebx, esi
mov dword [ebp - 0x108], ecx
cmovle ebx, ecx
mov dword [ebp - 0x20c], ecx
or edx, 0xffffffff
cmp eax, 0xffffffff
je 0x5205ce
mov ecx, 1
mov dword [ebp - 0x208], eax
mov dword [ebp - 0x20c], 1
mov edx, eax
mov dword [ebp - 0x104], eax
mov dword [ebp - 0x108], ecx
mov dword [ebp - 0x310], 0
cmp edi, 0xffffffff
je 0x52061c
xor eax, eax
mov dword [ebp - 0x30c], edi
mov dword [ebp - 0x310], 1
test ecx, ecx
je 0x520601
cmp dword [ebp + eax*4 - 0x104], edi
je 0x520601
inc eax
cmp eax, ecx
jb 0x5205f3
cmp eax, ecx
jne 0x520617
cmp ecx, 0x40
jae 0x520617
mov dword [ebp + eax*4 - 0x104], edi
inc dword [ebp - 0x108]
cmp edi, edx
cmova edx, edi
xor ecx, ecx
lea eax, [ebp - 0x324]
test esi, esi
cmovs eax, ecx
lea ecx, [edx + 1]
mov dword [ebp - 0x314], eax
mov dword [ebp - 0x328], ecx
test esi, esi
jle 0x520671
mov eax, 0x10624dd3
mov ecx, ebx
imul ebx
sar edx, 6
mov eax, edx
shr eax, 0x1f
add eax, edx
mov dword [ebp - 0x324], eax
imul eax, eax, 0x3e8
sub ecx, eax
imul eax, ecx, 0x3e8
mov dword [ebp - 0x320], eax
mov eax, dword [ebp - 0x314]
jmp 0x520687
jne 0x520687
mov dword [ebp - 0x324], 0
mov dword [ebp - 0x320], 0
push eax
lea eax, [ebp - 0x108]
push eax
lea eax, [ebp - 0x310]
push eax
lea eax, [ebp - 0x20c]
push eax
push dword [ebp - 0x328]
call dword [sym.imp.WS2_32.dll_select]
cmp eax, 0xffffffff
jne 0x5206f7
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
test eax, eax
je 0x5206bf
cmp eax, 0x2714
jne 0x5206fb
mov eax, dword [ebp - 0x314]
test esi, esi
jle 0x520671
push dword [ebp - 0x318]
push dword [ebp - 0x31c]
call fcn.00518010
push edx
push eax
call fcn.00517fa0
mov ebx, esi
add esp, 0x10
sub ebx, eax
test ebx, ebx
jle 0x5206fb
mov eax, dword [ebp - 0x314]
jmp 0x520638
test eax, eax
jns 0x52070f
pop ebx
pop edi
or eax, 0xffffffff
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004682d0
mov esp, ebp
pop ebp
ret
jne 0x520724
pop ebx
pop edi
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004682d0
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp + 8]
xor esi, esi
cmp ebx, 0xffffffff
je 0x520759
lea eax, [ebp - 0x20c]
push eax
push ebx
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
mov ecx, 1
lea eax, [ebp - 0x108]
push eax
push ebx
cmovne esi, ecx
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x520759
or esi, 4
cmp edi, 0xffffffff
je 0x520786
lea eax, [ebp - 0x310]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x520772
or esi, 2
lea eax, [ebp - 0x108]
push eax
push edi
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x520786
or esi, 4
mov ecx, dword [ebp - 4]
mov eax, esi
pop ebx
pop edi
xor ecx, ebp
pop esi
call fcn.004682d0
mov esp, ebp
pop ebp
ret