Function at 0x408499
Capabilities:
Connect socket
Get socket status
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x154
push esi
push edi
mov esi, ecx
xor edi, edi
cmp dword [esi + 0x2c], edi
jne 0x4084b2
cmp dword [esi + 0x34], edi
je 0x4084c8
cmp dword [esi + 0x28], 0xffffffff
jne 0x4084d0
push edi
push dword [esi]
mov ecx, esi
push edi
push edi
call fcn.00405c5c
test eax, eax
je 0x4084d0
push 3
pop eax
jmp 0x4086f5
cmp dword [ebp + 8], edi
mov ax, word [esi + 0x30]
push ebx
mov ebx, dword [esi + 0x2c]
mov word [ebp - 0xc], ax
je 0x40855f
push dword [ebp + 0xc]
mov ebx, dword [ebp + 8]
call dword [sym.imp.WS2_32.dll_htons]
mov dword [ebp - 0xc], eax
push 0x10
lea eax, [ebp - 0x24]
push edi
push eax
call fcn.00428760
mov ax, word [ebp - 0xc]
add esp, 0xc
mov dword [ebp - 0x20], ebx
mov word [ebp - 0x24], 2
mov word [ebp - 0x22], ax
call dword [sym.imp.WS2_32.dll_WSACreateEvent]
mov ecx, dword [esi + 0x24]
mov ebx, dword [sym.imp.WS2_32.dll_WSAEventSelect]
push 0x10
push eax
push dword [esi + 0x28]
mov dword [ebp - 8], eax
mov dword [ebp - 4], ecx
call ebx
push edi
push edi
push edi
push edi
push 0x10
lea eax, [ebp - 0x24]
push eax
push dword [esi + 0x28]
call dword [sym.imp.WS2_32.dll_WSAConnect]
cmp eax, 0xffffffff
jne 0x40864f
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x2733
je 0x408598
mov dword [ebp + 8], 3
jmp 0x4085c4
test byte [esi + 0x1c], 0x20
jne 0x408575
mov ax, word [esi + 0xc]
mov ebx, dword [esi + 0x10]
mov word [ebp - 0xc], ax
jmp 0x4084f0
cmp ebx, edi
jne 0x4084f0
push dword [esi + 0x34]
call fcn.00406905
mov ebx, eax
cmp ebx, edi
pop ecx
jne 0x4084f0
push 3
pop eax
jmp 0x4086f4
cmp dword [esi + 0x24], 0xffffffff
push edi
push dword [esi]
lea eax, [ebp - 8]
push edi
push eax
je 0x4085aa
push 2
jmp 0x4085ac
push 1
call dword [sym.imp.WS2_32.dll_WSAWaitForMultipleEvents]
cmp eax, edi
je 0x4085ee
cmp eax, 0x102
je 0x4085e5
mov dword [ebp + 8], 0x200
push edi
push dword [ebp - 8]
push dword [esi + 0x28]
call ebx
push dword [ebp - 8]
call dword [sym.imp.WS2_32.dll_WSACloseEvent]
mov ecx, esi
call fcn.00405d18
mov eax, dword [ebp + 8]
jmp 0x4086f4
mov dword [ebp + 8], 1
jmp 0x4085c4
mov eax, dword [esi + 0x28]
mov dword [ebp - 0x150], eax
lea eax, [ebp - 0x10]
push eax
push edi
lea eax, [ebp - 0x154]
push eax
push edi
push edi
mov dword [ebp - 0x154], 1
mov dword [ebp - 0x10], edi
mov dword [ebp - 0xc], 0xa
call dword [sym.imp.WS2_32.dll_select]
lea eax, [ebp - 0x154]
push eax
push dword [esi + 0x28]
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
je 0x408556
lea eax, [ebp - 0x50]
push eax
push dword [ebp - 8]
push dword [esi + 0x28]
call dword [sym.imp.WS2_32.dll_WSAEnumNetworkEvents]
cmp dword [ebp - 0x3c], edi
jne 0x408556
push edi
push dword [ebp - 8]
push dword [esi + 0x28]
call ebx
push dword [ebp - 8]
call dword [sym.imp.WS2_32.dll_WSACloseEvent]
lea eax, [ebp - 0x14]
push eax
push 0x8004667e
push dword [esi + 0x28]
mov dword [ebp - 0x14], edi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
xor eax, eax
cmp dword [ebp + 8], edi
mov dword [esi + 0x20], 1
je 0x4086b7
push dword [esi + 0x24]
mov ax, word [esi + 0x30]
push dword [esi]
push dword [ebp + 0x14]
push dword [ebp + 0x10]
push dword [ebp + 0x18]
push eax
push dword [esi + 0x2c]
push dword [esi + 0x34]
push dword [esi + 0x28]
call fcn.00407c2c
mov ebx, eax
add esp, 0x24
cmp ebx, edi
je 0x4086f2
mov ecx, esi
call fcn.00405d18
jmp 0x4086f2
test byte [esi + 0x1c], 0x20
jne 0x4086f4
mov ax, word [esi + 0x30]
push dword [esi + 0x34]
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
mov ecx, esi
push eax
push dword [esi + 0x2c]
call fcn.00408458
mov ebx, eax
cmp ebx, edi
je 0x4086e3
mov ecx, esi
call fcn.00405d18
mov eax, 0x10000001
cmp ebx, eax
jae 0x4086f2
cmp ebx, edi
je 0x4086f2
mov ebx, eax
mov eax, ebx
pop ebx
pop edi
pop esi
leave
ret 0x14