Function at 0x40b5c0
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create tcp socket
Create udp socket
Get socket status
Set socket configuration

Disassembly:
sub esp, 0x13c
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x154]
xor ebx, ebx
cmp edi, ebx
mov dword [esp + 0x1c], 1
mov dword [esp + 0x20], ebx
mov dword [esp + 0x14], ebx
jge 0x40b60f
mov eax, dword [0x47b1cc]
push 0x1e1
push eax
push 0x47b324
call fcn.004086d0
add esp, 0xc
mov eax, 0x1389
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
mov ebp, dword [esp + 0x150]
cmp ebp, ebx
jge 0x40b643
mov ecx, dword [0x47b1cc]
push 0x1e2
push ecx
push 0x47b318
call fcn.004086d0
add esp, 0xc
mov eax, 0x1389
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
mov esi, dword [esp + 0x158]
cmp esi, 0x3e8
ja 0x40b67b
mov edx, dword [0x47b1cc]
push 0x1e3
push edx
push 0x47b308
call fcn.004086d0
add esp, 0xc
mov eax, 0x1389
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
cmp dword [esp + 0x160], 0x3e8
ja 0x40b6b0
mov eax, dword [0x47b1cc]
push 0x1e4
push eax
push 0x47b2f8
call fcn.004086d0
add esp, 0xc
mov eax, 0x1389
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
push 0x47b2dc
call fcn.00451a5f
test eax, eax
push esi
sete byte [esp + 0x1b]
call fcn.0040b970
add esp, 8
test al, al
jne 0x40b713
push esi
call fcn.0040b9a0
add esp, 4
mov dword [esp + 0x24], eax
test eax, eax
jne 0x40b717
push esi
push 0x47b234
push 0x1394
call fcn.00408570
mov ecx, dword [0x47b1cc]
push 0x1ec
push ecx
call fcn.004087f0
add esp, 0x14
mov eax, 0x1394
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
mov dword [esp + 0x24], esi
test edi, edi
mov dword [esp + 0x18], 0
jle 0x40b876
mov eax, dword [esp + 0x15c]
xor ecx, ecx
mov edx, eax
mov cl, ah
shl edx, 8
add edx, ecx
mov dword [esp + 0x2c], edx
push 0
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov dx, word [esp + 0x2c]
mov esi, eax
mov eax, dword [esp + 0x24]
mov word [esp + 0x38], 2
push eax
mov word [esp + 0x3e], dx
call dword [sym.imp.WS2_32.dll_inet_addr]
xor ecx, ecx
mov dword [esp + 0x3c], eax
mov dword [esp + 0x40], ecx
test ebp, ebp
mov dword [esp + 0x44], ecx
jle 0x40b79a
mov al, byte [esp + 0x13]
test al, al
je 0x40b79a
lea edx, [esp + 0x1c]
push edx
push 0x8004667e
push esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
test eax, eax
jne 0x40b8ae
lea eax, [esp + 0x38]
push 0x10
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
test eax, eax
je 0x40b8e4
test ebp, ebp
jle 0x40b851
mov al, byte [esp + 0x13]
test al, al
je 0x40b851
lea ecx, [esp + 0x30]
lea edx, [esp + 0x48]
push ecx
push 0
push edx
lea eax, [esi + 1]
push 0
push eax
mov dword [esp + 0x60], esi
mov dword [esp + 0x5c], 1
mov dword [esp + 0x44], ebp
mov dword [esp + 0x48], 0
call dword [sym.imp.WS2_32.dll_select]
mov edi, eax
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov ebx, eax
push ebx
call fcn.00413b80
add esp, 4
mov dword [esp + 0x14], eax
test edi, edi
je 0x40b851
lea ecx, [esp + 0x28]
lea edx, [esp + 0x20]
push ecx
push edx
push 0x1007
push 0xffff
push esi
mov dword [esp + 0x3c], 4
call dword [sym.imp.WS2_32.dll_getsockopt]
test eax, eax
mov eax, dword [esp + 0x20]
jne 0x40b842
test eax, eax
je 0x40b8e4
push eax
mov ebx, eax
call fcn.00413b80
add esp, 4
mov dword [esp + 0x14], eax
push esi
call fcn.00413b00
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x158]
add esp, 4
inc eax
cmp eax, ecx
mov dword [esp + 0x18], eax
jl 0x40b73d
test ebx, ebx
jne 0x40b887
push 0x47b28c
call sym.cns_user.exe_gen__nls_nlst
add esp, 4
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x14]
push ecx
push 0x47b244
push 0x1391
call fcn.00408570
add esp, 0xc
mov eax, 0x1391
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
mov eax, dword [0x47b1cc]
push 0x200
push eax
push 0x479fd0
call fcn.004086d0
mov ecx, dword [0x47b1cc]
push 0x200
push ecx
call fcn.004087b0
add esp, 0x14
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
mov edx, dword [esp + 0x154]
mov eax, dword [esp + 0x18]
cmp eax, edx
jge 0x40b872
test ebp, ebp
jle 0x40b957
mov al, byte [esp + 0x13]
test al, al
je 0x40b957
lea eax, [esp + 0x1c]
mov dword [esp + 0x1c], 0
push eax
push 0x8004667e
push esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
test eax, eax
je 0x40b957
mov ecx, dword [0x47b1cc]
push 0x23b
push ecx
push 0x479fd0
call fcn.004086d0
mov edx, dword [0x47b1cc]
push 0x23b
push edx
call fcn.004087b0
add esp, 0x14
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x13c
ret
mov eax, dword [esp + 0x160]
pop edi
mov dword [eax], esi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x13c
ret