Function at 0x40c660
Capabilities:
Get socket status
Receive data
Receive data on socket
Send data
Send data on socket

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x164
mov eax, dword [0x44a00c]
xor eax, esp
mov dword [esp + 0x160], eax
push ebx
push esi
push edi
mov edi, ecx
xor ebx, ebx
cmp byte [edi + 0x60], bl
jne 0x40c995
nop word [eax + eax]
test ebx, ebx
jne 0x40c6b8
push 0x20
push 0x10070
call fcn.004247b8
mov ebx, eax
add esp, 8
lea ecx, [ebx + 0xc]
mov dword [ebx + 4], 0x10064
mov dword [ebx + 8], ecx
mov dword [ebx], 1
mov dword [esp + 0x1c], 0x10
lea ecx, [esp + 0x28]
mov eax, dword [ebx + 8]
push ecx
push 0
mov dword [esp + 0x2c], eax
lea ecx, [esp + 0x68]
lea esi, [eax + 0xa]
mov dword [esp + 0x30], 1
mov eax, dword [edi + 0x58]
push 0
mov dword [esp + 0x70], eax
inc eax
push ecx
push eax
mov dword [esp + 0x28], esi
mov dword [esp + 0x40], 0
mov dword [esp + 0x74], 1
call dword [sym.imp.WS2_32.dll_select]
test eax, eax
jg 0x40c71d
jns 0x40c98b
push 0x3e8
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x40c98b
lea eax, [esp + 0x1c]
push eax
lea eax, [esp + 0x54]
push eax
push 0
push 0x10000
push esi
push dword [edi + 0x58]
call dword [sym.imp.WS2_32.dll_recvfrom]
mov dword [esp + 0x18], eax
test eax, eax
jns 0x40c764
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push str.___recvfrom_error.err_d_n
call fcn.00401410
add esp, 8
push 0x3e8
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x40c98b
cmp eax, 0xa
jb 0x40c98b
cmp dword [esi], 0x4e414c56
jne 0x40c98b
push dword [esi + 6]
call dword [sym.imp.WS2_32.dll_ntohl]
mov edx, dword [esp + 0x14]
mov esi, eax
mov eax, dword [esp + 0x18]
add eax, 0xfffffff6
mov dword [esp + 0x20], eax
mov cl, byte [edx + 4]
cmp cl, 1
jne 0x40c8a2
test eax, eax
jle 0x40c8a2
cmp byte [edi + 0x34], 0
je 0x40c7b8
lea eax, [edi + 0x18]
push eax
mov eax, dword [edi + 0x20]
call eax
jmp 0x40c7bf
push edi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [edi + 0x70]
mov ecx, eax
mov edx, dword [eax + 4]
cmp byte [edx + 0xd], 0
jne 0x40c7e4
nop dword [eax]
cmp dword [edx + 0x10], esi
jae 0x40c7da
mov edx, dword [edx + 8]
jmp 0x40c7de
mov ecx, edx
mov edx, dword [edx]
cmp byte [edx + 0xd], 0
je 0x40c7d0
mov dword [esp + 0x30], eax
cmp ecx, eax
je 0x40c7f7
cmp esi, dword [ecx + 0x10]
jb 0x40c7f7
mov dword [esp + 0x34], ecx
jmp 0x40c7fd
mov dword [esp + 0x38], eax
mov ecx, eax
mov dword [esp + 0x3c], eax
cmp ecx, eax
je 0x40c882
mov esi, dword [ecx + 0x14]
xorps xmm0, xmm0
mov ecx, dword [esp + 0x20]
mov eax, dword [esp + 0x14]
add eax, 2
mov dword [ebx + 8], eax
lea eax, [ecx + 8]
mov dword [ebx + 4], eax
mov eax, dword [ebx + 8]
mov dword [ebx], 1
push ebx
push ecx
movq qword [eax], xmm0
mov dword [eax + 4], ecx
mov ecx, edi
push esi
mov word [eax], 0x103
call fcn.0040a870
cmp dword [ebx], 1
jle 0x40c85b
push ebx
call dword [sym.imp.KERNEL32.dll_InterlockedDecrement]
test eax, eax
jne 0x40c857
push ebx
call fcn.00424799
add esp, 4
xor ebx, ebx
jmp 0x40c862
mov eax, dword [esp + 0x24]
mov dword [ebx + 8], eax
push 0
call fcn.004230b2
mov dword [esi + 0x70], eax
add esp, 4
mov dword [esi + 0x74], edx
mov eax, dword [esp + 0x54]
mov dword [esi + 0x68], eax
mov ax, word [esp + 0x52]
mov word [esi + 0x6c], ax
cmp byte [edi + 0x34], 0
je 0x40c896
lea eax, [edi + 0x18]
push eax
mov eax, dword [edi + 0x28]
call eax
jmp 0x40c98b
push edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x40c98b
test cl, cl
jne 0x40c970
mov byte [esp + 0x13], cl
cmp byte [edi + 0x34], cl
je 0x40c8be
lea eax, [edi + 0x18]
push eax
mov eax, dword [edi + 0x20]
call eax
jmp 0x40c8c5
push edi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [edi + 0x70]
mov ecx, eax
mov edx, dword [eax + 4]
cmp byte [edx + 0xd], 0
jne 0x40c8e7
cmp dword [edx + 0x10], esi
jae 0x40c8dd
mov edx, dword [edx + 8]
jmp 0x40c8e1
mov ecx, edx
mov edx, dword [edx]
cmp byte [edx + 0xd], 0
je 0x40c8d3
mov dword [esp + 0x40], eax
cmp ecx, eax
je 0x40c8fa
cmp esi, dword [ecx + 0x10]
jb 0x40c8fa
mov dword [esp + 0x44], ecx
jmp 0x40c900
mov dword [esp + 0x48], eax
mov ecx, eax
mov dword [esp + 0x4c], eax
cmp ecx, eax
je 0x40c930
mov esi, dword [ecx + 0x14]
push 0
call fcn.004230b2
mov dword [esi + 0x70], eax
add esp, 4
mov dword [esi + 0x74], edx
mov eax, dword [esp + 0x54]
mov dword [esi + 0x68], eax
mov ax, word [esp + 0x52]
mov word [esi + 0x6c], ax
mov byte [esp + 0x13], 1
cmp byte [edi + 0x34], 0
je 0x40c941
lea eax, [edi + 0x18]
push eax
mov eax, dword [edi + 0x28]
call eax
jmp 0x40c948
push edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp byte [esp + 0x13], 0
je 0x40c98b
mov eax, dword [esp + 0x14]
lea ecx, [esp + 0x50]
push 0x10
push ecx
push 0
push dword [esp + 0x24]
mov byte [eax + 5], 1
push eax
push dword [edi + 0x58]
call dword [sym.imp.WS2_32.dll_sendto]
jmp 0x40c98b
cmp cl, 2
jne 0x40c98b
cmp eax, 0x12
jb 0x40c98b
lea eax, [esp + 0x50]
mov ecx, edi
push eax
lea eax, [edx + 0xa]
push eax
push esi
call fcn.0040c9b0
cmp byte [edi + 0x60], 0
je 0x40c690
mov ecx, dword [esp + 0x16c]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.0041be62
mov esp, ebp
pop ebp
ret