Function at 0x40398b
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create udp socket
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
push esi
push ebx
sub esp, 0x40
mov edx, dword [ebp + 0xc]
mov eax, dword [ebp + 0x14]
mov word [ebp - 0x1c], dx
mov word [ebp - 0x20], ax
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov dword [eax], 0
mov dword [esp], 0
mov eax, dword [sym.imp.WSOCK32.DLL_WSASetLastError]
call eax
sub esp, 4
movzx eax, word [0x40a084]
test ax, ax
je 0x4039f3
mov dword [esp + 8], 0x11
mov dword [esp + 4], 2
mov dword [esp], 2
mov eax, dword [sym.imp.WSOCK32.DLL_socket]
call eax
sub esp, 0xc
mov dword [0x40a544], eax
jmp 0x403a19
mov dword [esp + 8], 6
mov dword [esp + 4], 1
mov dword [esp], 2
mov eax, dword [sym.imp.WSOCK32.DLL_socket]
call eax
sub esp, 0xc
mov dword [0x40a544], eax
mov eax, dword [0x40a544]
test eax, eax
jns 0x403a2e
mov dword [esp], str.Cant_get_socket
call fcn.0040313a
mov eax, dword [0x40a544]
test eax, eax
jne 0x403a49
mov eax, dword [0x40a544]
mov dword [esp], eax
call sub.msvcrt.dll__dup
mov dword [0x40a544], eax
mov eax, dword [0x40a550]
mov edx, dword [0x40a544]
mov dword [esp + 0x10], 4
mov dword [esp + 0xc], eax
mov dword [esp + 8], 4
mov dword [esp + 4], 0xffff
mov dword [esp], edx
mov eax, dword [sym.imp.WSOCK32.DLL_setsockopt]
call eax
sub esp, 0x14
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x403a90
mov dword [esp], str.nnetfd_reuseaddr_failed
call fcn.0040307f
mov eax, dword [0x40a05c]
mov word [eax], 2
mov eax, dword [0x40a060]
mov word [eax], 2
cmp dword [ebp + 0x10], 0
je 0x403ac9
mov eax, dword [0x40a05c]
lea edx, [eax + 4]
mov dword [esp + 8], 4
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov dword [esp], edx
call sub.msvcrt.dll_memcpy
cmp word [ebp - 0x20], 0
je 0x403aeb
mov ebx, dword [0x40a05c]
movzx eax, word [ebp - 0x20]
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_htons]
call eax
sub esp, 4
mov word [ebx + 2], ax
mov ebx, 0
cmp dword [ebp + 0x10], 0
jne 0x403b01
cmp word [ebp - 0x20], 0
je 0x403ba8
movzx eax, word [ebp - 0x20]
mov dword [ebp - 0x10], eax
mov dword [ebp - 0xc], 4
jmp 0x403b9e
mov eax, dword [0x40a05c]
mov edx, dword [0x40a544]
mov dword [esp + 8], 0x10
mov dword [esp + 4], eax
mov dword [esp], edx
mov eax, dword [sym.imp.WSOCK32.DLL_bind]
call eax
sub esp, 0xc
mov ebx, eax
test ebx, ebx
jne 0x403b40
jmp 0x403ba8
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
cmp eax, 0x2740
je 0x403b52
jmp 0x403ba8
movzx esi, word [ebp - 0x20]
mov eax, dword [0x40a05c]
mov eax, dword [eax + 4]
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_inet_ntoa]
call eax
sub esp, 4
mov dword [esp + 8], esi
mov dword [esp + 4], eax
mov dword [esp], str.retrying_local__s:_d
call fcn.0040307f
mov dword [esp], 1
mov eax, dword [sym.imp.msvcrt.dll__sleep]
call eax
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov dword [eax], 0
sub dword [ebp - 0xc], 1
cmp dword [ebp - 0xc], 0
jg 0x403b14
test ebx, ebx
je 0x403bd9
movzx ebx, word [ebp - 0x20]
mov eax, dword [0x40a05c]
mov eax, dword [eax + 4]
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_inet_ntoa]
call eax
sub esp, 4
mov dword [esp + 8], ebx
mov dword [esp + 4], eax
mov dword [esp], str.Cant_grab__s:_d_with_bind
call fcn.0040313a
movzx eax, word [0x40a07c]
test ax, ax
je 0x403bef
mov eax, dword [0x40a544]
jmp 0x403d21
mov eax, dword [0x40a060]
lea edx, [eax + 4]
mov dword [esp + 8], 4
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov dword [esp], edx
call sub.msvcrt.dll_memcpy
mov ebx, dword [0x40a060]
movzx eax, word [ebp - 0x1c]
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_htons]
call eax
sub esp, 4
mov word [ebx + 2], ax
mov eax, dword [0x40a044]
test eax, eax
je 0x403c3e
mov dword [esp], str.Warning:_source_routing_unavailable_on_this_machine__ignoring
call fcn.0040307f
mov eax, dword [0x40a088]
mov dword [esp + 4], eax
mov dword [esp], 1
call fcn.00403241
mov dword [esp + 4], 0
mov dword [esp], 0x40a500
call sub.msvcrt.dll__setjmp3
test eax, eax
jne 0x403c93
mov eax, dword [0x40a060]
mov edx, dword [0x40a544]
mov dword [esp + 8], 0x10
mov dword [esp + 4], eax
mov dword [esp], edx
mov eax, dword [sym.imp.WSOCK32.DLL_connect]
call eax
sub esp, 0xc
mov ebx, eax
jmp 0x403ca9
mov ebx, 0xffffffff
mov dword [esp], 0x274c
mov eax, dword [sym.imp.WSOCK32.DLL_WSASetLastError]
call eax
sub esp, 4
mov dword [esp + 4], 0
mov dword [esp], 0
call fcn.00403241
test ebx, ebx
jne 0x403cc8
mov eax, dword [0x40a544]
jmp 0x403d21
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov ebx, eax
mov eax, dword [sym.imp.WSOCK32.DLL_WSAGetLastError]
call eax
mov dword [ebx], eax
mov eax, dword [0x40a544]
mov dword [esp + 4], 2
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_shutdown]
call eax
sub esp, 8
mov eax, dword [0x40a544]
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_closesocket]
call eax
sub esp, 4
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
mov eax, dword [sym.imp.WSOCK32.DLL_WSASetLastError]
call eax
sub esp, 4
mov eax, 0xffffffff
lea esp, [ebp - 8]
pop ebx
pop esi
pop ebp
ret