Function at 0x40652a
Capabilities:
Connect socket
Get socket status
Resolve dns
Set socket configuration

Disassembly:
sub esp, 0x26c
push ebx
push esi
mov esi, dword [esp + 0x278]
xor ebx, ebx
test esi, esi
je 0x4068c6
push edi
mov edi, dword [esp + 0x284]
push 2
pop ecx
push 0x17
pop eax
test edi, 0x10000000
je 0x40656c
and edi, 0xefffffff
mov dword [esp + 0x14], eax
mov dword [esp + 0x284], edi
jmp 0x406572
mov eax, ecx
mov dword [esp + 0x14], ecx
test edi, edi
jne 0x40657e
inc edi
mov dword [esp + 0x284], edi
push ebp
push 0
push edi
push eax
call dword [sym.imp.WSOCK32.DLL_socket]
mov ebp, eax
cmp ebp, 0xffffffff
je 0x4068c4
push 0x17
pop ecx
cmp dword [esp + 0x18], ecx
jne 0x406608
cmp dword [0x43e0b8], ebx
je 0x4068bd
lea eax, [esp + 0x64]
push eax
push esi
push ecx
call fcn.0040645f
add esp, 0xc
test eax, eax
jg 0x4065fe
lea eax, [esp + 0x1c]
push eax
push 0
push 0
push esi
call dword [0x43e0c4]
test eax, eax
jne 0x4068bd
mov eax, dword [esp + 0x1c]
lea edi, [esp + 0x64]
push eax
mov esi, dword [eax + 0x18]
add esi, 8
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
call dword [0x43e0c8]
mov eax, dword [esp + 0x1c]
mov edi, dword [esp + 0x288]
mov dword [esp + 0x10], eax
jmp 0x406646
mov eax, dword [esp + 0x1c]
mov dword [esp + 0x10], eax
jmp 0x406646
push esi
call dword [sym.imp.WSOCK32.DLL_inet_addr]
mov ecx, eax
mov dword [esp + 0x10], ecx
cmp ecx, 0xffffffff
jne 0x406636
push esi
call dword [sym.imp.WSOCK32.DLL_gethostbyname]
test eax, eax
je 0x406632
mov eax, dword [eax + 0xc]
mov eax, dword [eax]
mov ecx, dword [eax]
mov dword [esp + 0x10], ecx
jmp 0x406636
mov ecx, dword [esp + 0x10]
xor eax, eax
cmp ecx, 0xffffffff
setne al
test eax, eax
je 0x4068bd
mov esi, dword [esp + 0x290]
cmp dword [esp + 0x294], ebx
jne 0x40665e
test esi, esi
je 0x4066cf
cmp byte [esi], bl
je 0x4066cf
push 0x10
lea eax, [esp + 0x24]
push 0
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
push 2
pop eax
mov word [esp + 0x20], ax
cmp dword [esp + 0x294], ebx
je 0x406692
push dword [esp + 0x294]
call dword [sym.imp.WSOCK32.DLL_htons]
mov word [esp + 0x22], ax
test esi, esi
je 0x4066b5
cmp byte [esi], bl
je 0x4066b5
push esi
call fcn.004344f0
mov esi, eax
push esi
call dword [sym.imp.WSOCK32.DLL_inet_addr]
push esi
mov dword [esp + 0x28], eax
call fcn.004344e0
jmp 0x4066b9
and dword [esp + 0x24], ebx
push 0x10
lea eax, [esp + 0x24]
push eax
push ebp
call dword [sym.imp.WSOCK32.DLL_bind]
test eax, eax
jne 0x4068bd
xor eax, eax
inc eax
cmp edi, eax
jne 0x406870
mov esi, dword [esp + 0x18]
push 0x17
pop edi
cmp esi, edi
jne 0x40671f
push 0x1c
lea eax, [esp + 0x4c]
push 0
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
mov word [esp + 0x48], di
push dword [esp + 0x284]
call dword [sym.imp.WSOCK32.DLL_htons]
mov word [esp + 0x4a], ax
lea esi, [esp + 0x64]
lea edi, [esp + 0x50]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
mov esi, dword [esp + 0x18]
jmp 0x406752
push 0x10
lea eax, [esp + 0x34]
push 0
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
push 2
pop eax
push dword [esp + 0x284]
mov word [esp + 0x34], ax
call dword [sym.imp.WSOCK32.DLL_htons]
mov word [esp + 0x32], ax
mov eax, dword [esp + 0x10]
mov dword [esp + 0x34], eax
mov edi, dword [esp + 0x28c]
test edi, edi
jle 0x40682a
lea eax, [esp + 0x14]
mov dword [esp + 0x14], 1
push eax
push 0x8004667e
push ebp
call dword [sym.imp.WSOCK32.DLL_ioctlsocket]
test eax, eax
jne 0x4068bd
cmp esi, 0x17
jne 0x40678f
push 0x1c
lea eax, [esp + 0x4c]
jmp 0x406795
push 0x10
lea eax, [esp + 0x34]
push eax
push ebp
call dword [sym.imp.WSOCK32.DLL_connect]
cmp eax, 0xffffffff
jne 0x4068bd
mov eax, edi
mov dword [esp + 0x78], ebp
cdq
mov ecx, 0x3e8
idiv ecx
xor esi, esi
mov dword [esp + 0x17c], ebp
mov dword [esp + 0x40], eax
inc esi
imul eax, eax, 0x3e8
mov dword [esp + 0x74], esi
mov dword [esp + 0x178], esi
sub edi, eax
imul eax, edi, 0x3e8
mov dword [esp + 0x44], eax
lea eax, [esp + 0x40]
push eax
lea eax, [esp + 0x17c]
push eax
lea eax, [esp + 0x7c]
push eax
push 0
lea eax, [ebp + 1]
push eax
call dword [sym.imp.WSOCK32.DLL_select]
cmp eax, esi
jne 0x406812
lea eax, [esp + 0x74]
push eax
push ebp
call sub.WSOCK32.DLL___WSAFDIsSet
test eax, eax
je 0x406812
mov ebx, esi
and dword [esp + 0x14], 0
lea eax, [esp + 0x14]
push eax
push 0x8004667e
push ebp
call dword [sym.imp.WSOCK32.DLL_ioctlsocket]
jmp 0x40684f
cmp esi, 0x17
jne 0x406837
push 0x1c
lea eax, [esp + 0x4c]
jmp 0x40683d
push 0x10
lea eax, [esp + 0x34]
push eax
push ebp
call dword [sym.imp.WSOCK32.DLL_connect]
cmp eax, 0xffffffff
je 0x4068bd
xor esi, esi
inc esi
mov ebx, esi
test ebx, ebx
je 0x4068bd
push 0x10
push 0
push dword [0x43e01c]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
test ebx, ebx
je 0x4068bd
mov dword [ebx], esi
mov dword [ebx + 8], ebp
jmp 0x4068b7
mov dword [esp + 0x14], eax
lea eax, [esp + 0x14]
push eax
push 0x8004667e
push ebp
call dword [sym.imp.WSOCK32.DLL_ioctlsocket]
test eax, eax
jne 0x4068bd
push 0x20
push eax
push dword [0x43e01c]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
test ebx, ebx
je 0x4068bd
push 2
pop eax
mov dword [ebx], eax
mov eax, dword [esp + 0x10]
mov dword [ebx + 4], eax
mov eax, dword [esp + 0x284]
mov dword [ebx + 0x10], ebp
mov dword [ebx + 8], eax
and dword [ebx + 0xc], 0
jmp 0x4068c4
push ebp
call dword [sym.imp.WSOCK32.DLL_closesocket]
pop ebp
pop edi
pop esi
mov eax, ebx
pop ebx
add esp, 0x26c
ret 0x18