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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x12c
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
xor edi, edi
mov dword [ebp - 0x128], edx
mov dword [ebp - 0x120], ecx
cmp dword [ebp + 0xc], edi
je 0x4021ce
mov eax, ebx
and eax, 0x8000000f
jns 0x4021aa
dec eax
or eax, 0xfffffff0
inc eax
je 0x4021c4
mov eax, ebx
cdq
and edx, 0xf
lea esi, [edx + eax]
sar esi, 4
inc esi
shl esi, 4
mov dword [ebp - 0x12c], esi
jmp 0x4021d6
mov esi, ebx
mov dword [ebp - 0x12c], esi
jmp 0x4021d6
mov esi, ebx
mov dword [ebp - 0x12c], ebx
push esi
call fcn.00404e1d
add esp, 4
mov dword [ebp - 0x11c], eax
mov dword [ebp - 0x124], edi
jmp 0x4021f0
mov eax, dword [ebp - 0x120]
push 0x4190e4
push 0
mov dword [ebp - 0x114], eax
lea eax, [ebp - 0x118]
push 0
push eax
push 0
mov dword [ebp - 0x118], 1
call dword [sym.imp.WS2_32.dll_select]
test eax, eax
jne 0x402293
mov eax, dword [ebp - 0x124]
inc eax
mov dword [ebp - 0x124], eax
cmp eax, 0xc
jbe 0x4021f0
push 0x41a170
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push 5
call fcn.00404e1d
add esp, 4
mov esi, eax
push 0
test esi, esi
je 0x4022cc
push 5
mov dword [esi], 0
push esi
push dword [ebp - 0x120]
mov byte [esi + 4], 0
mov byte [esi], 0xa0
mov dword [esi + 1], 0
call dword [sym.imp.WS2_32.dll_send]
push esi
call fcn.00404e93
add esp, 4
push 0x41a170
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov esi, dword [ebp - 0x12c]
jmp 0x4021f0
cmp eax, 0xffffffff
je 0x4022c2
push 0
mov eax, esi
sub eax, edi
push eax
mov eax, dword [ebp - 0x11c]
add eax, edi
push eax
push dword [ebp - 0x120]
call dword [sym.imp.WS2_32.dll_recv]
test eax, eax
jle 0x4022c2
add edi, eax
cmp edi, esi
jl 0x4021f0
cmp edi, esi
je 0x4022e8
push dword [ebp - 0x11c]
call fcn.00404e93
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00404cd7
mov esp, ebp
pop ebp
ret
cmp dword [ebp + 0xc], 0
je 0x402394
and edi, 0x8000000f
jns 0x4022ff
dec edi
or edi, 0xfffffff0
inc edi
jne 0x4022c6
xor edi, edi
cmp ebx, 0x10
jle 0x402360
mov edx, dword [ebp - 0x128]
mov ecx, 0x10
mov eax, dword [ebp - 0x11c]
mov esi, edx
sub eax, edx
sub ecx, edx
mov dword [ebp - 0x120], eax
mov dword [ebp - 0x124], ecx
jmp 0x402330
push ecx
lea ecx, [eax + esi]
lea edx, [ebp - 0x14]
call fcn.00401a50
movdqu xmm0, xmmword [ebp - 0x14]
mov eax, dword [ebp - 0x124]
add esp, 4
add edi, 0x10
movdqu xmmword [esi], xmm0
add esi, 0x10
add eax, esi
cmp eax, ebx
mov eax, dword [ebp - 0x120]
jl 0x402330
lea eax, [edi + 0x10]
cmp eax, ebx
jl 0x4023aa
push ecx
mov ecx, dword [ebp - 0x11c]
lea edx, [ebp - 0x14]
lea ecx, [edi + ecx]
call fcn.00401a50
add esp, 4
cmp edi, ebx
jge 0x4023aa
mov ecx, dword [ebp - 0x128]
mov eax, ebx
add ecx, edi
sub eax, edi
push eax
lea eax, [ebp - 0x14]
push eax
push ecx
jmp 0x4023a2
mov eax, dword [ebp - 0x128]
push ebx
push dword [ebp - 0x11c]
push eax
call fcn.00405fd0
add esp, 0xc
push dword [ebp - 0x11c]
call fcn.00404e93
mov ecx, dword [ebp - 4]
add esp, 4
mov eax, ebx
xor ecx, ebp
pop edi
pop esi
pop ebx
call fcn.00404cd7
mov esp, ebp
pop ebp
ret