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

Disassembly:
sub esp, 0x134
mov eax, dword [0x45b9b0]
xor eax, esp
mov dword [esp + 0x130], eax
push ebx
mov ebx, dword [esp + 0x13c]
push ebp
push esi
mov esi, ecx
push edi
lea edi, [esi + 0x20dc]
test edi, edi
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x28], edi
je 0x40786d
lea eax, [edi + 4]
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ebp, 1
cmp dword [esi + 0x10], ebp
mov dword [esp + 0x20], ebp
mov dword [esp + 0x10], 0
je 0x4078ad
mov ecx, dword [esp + 0x14c]
mov edx, dword [esi + 0xc]
push ecx
push ebx
push edx
call dword [sym.imp.WS2_32.dll_connect]
test edi, edi
mov esi, eax
je 0x4078a6
add edi, 4
push edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, esi
jmp 0x407a60
mov ecx, dword [esi + 0xc]
push 4
lea eax, [esp + 0x24]
push eax
push 0x3002
push 0xffff
push ecx
call dword [sym.imp.WS2_32.dll_setsockopt]
cmp byte [esi + 0x1020], 0
lea edi, [esi + 0x1020]
jne 0x407930
mov edx, dword [ebx + 4]
push edx
call dword [sym.imp.WS2_32.dll_inet_ntoa]
mov edx, edi
mov cl, byte [eax]
mov byte [edx], cl
add eax, ebp
add edx, ebp
test cl, cl
jne 0x4078e3
movzx eax, word [ebx + 2]
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
cmp eax, 0x50
mov dword [esi + 0x2020], eax
jne 0x40791d
lea edx, [esi + 0x20]
mov eax, edi
sub edx, edi
nop
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, ebp
test cl, cl
jne 0x407910
jmp 0x407930
push eax
push edi
lea ecx, [esi + 0x20]
push str._s:_u
push ecx
call fcn.0042fa06
add esp, 0x10
lea edx, [esp + 0x130]
push edx
call fcn.004060b0
mov ebp, dword [sym.imp.WS2_32.dll_connect]
mov ebx, dword [sym.imp.WS2_32.dll_select]
add esp, 4
test eax, eax
je 0x4079bd
mov ecx, dword [esi + 0xc]
push 0x10
lea eax, [esp + 0x134]
push eax
push ecx
call ebp
mov edi, eax
test edi, edi
je 0x4079b1
cmp edi, 0xffffffff
jne 0x4079bd
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
jne 0x4079bd
mov eax, dword [esi + 0xc]
lea edx, [esp + 0x14]
push edx
push 0
lea ecx, [esp + 0x34]
push ecx
mov dword [esp + 0x3c], eax
push 0
add eax, 1
push eax
mov dword [esp + 0x40], 1
mov dword [esp + 0x28], 0x5a
mov dword [esp + 0x2c], 0
call ebx
test eax, eax
jle 0x4079bd
xor edi, edi
mov dword [esi + 0x2024], 1
jmp 0x407a2a
mov edx, dword [esp + 0x14c]
mov eax, dword [esp + 0x1c]
mov ecx, dword [esi + 0xc]
push edx
push eax
push ecx
call ebp
mov edi, eax
test edi, edi
je 0x407a2a
cmp edi, 0xffffffff
jne 0x407a32
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
jne 0x407a32
cmp dword [esi + 0x2030], 0
jne 0x407a32
mov eax, dword [esi + 0xc]
lea edx, [esp + 0x14]
push edx
push 0
lea ecx, [esp + 0x34]
push ecx
mov dword [esp + 0x3c], eax
push 0
add eax, 1
push eax
mov dword [esp + 0x40], 1
mov dword [esp + 0x28], 0x5a
mov dword [esp + 0x2c], 0
call ebx
test eax, eax
jle 0x407a32
xor edi, edi
mov dword [esp + 0x10], 1
cmp dword [esp + 0x10], 0
mov dword [esi + 0x2028], 1
je 0x407a4c
push 2
mov ecx, esi
call fcn.00407700
mov eax, dword [esp + 0x28]
test eax, eax
je 0x407a5e
add eax, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, edi
mov ecx, dword [esp + 0x140]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0042ec03
add esp, 0x134
ret 8