Function at 0x40a740
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
push ebx
mov ebx, dword [ebp + 0x10]
cmp dword [ebx + 0x2000], 4
jge 0x40a75c
mov al, 1
pop ebx
mov esp, ebp
pop ebp
ret 0xc
xor ecx, ecx
push esi
mov dword [ebp - 8], ecx
push edi
mov al, byte [ecx + ebx]
cmp al, 0xc1
jne 0x40a774
movzx esi, byte [ecx + ebx + 1]
mov byte [ebp - 4], al
jmp 0x40a792
cmp al, 0xc2
jne 0x40a950
movzx edx, byte [ecx + ebx + 2]
mov byte [ebp - 4], al
movzx eax, byte [ecx + ebx + 1]
shl ax, 8
movzx esi, ax
or esi, edx
cmp esi, 4
jl 0x40a950
cmp esi, 0x2000
jg 0x40a950
cmp esi, dword [ebx + 0x2000]
jg 0x40a983
mov eax, dword [ebp + 0xc]
mov edi, dword [0x42f69c]
imul eax, eax, 0x64
add eax, 0x430818
inc dword [eax + 0x60]
mov edx, dword [eax + 0x60]
cmp edx, edi
jg 0x40a92b
cmp byte [ebp - 4], 0xc1
jne 0x40a805
mov al, byte [ecx + ebx + 2]
mov byte [ebp - 4], al
lea edx, [esi - 3]
xor eax, eax
lea edi, [ecx + ebx + 3]
test edx, edx
jle 0x40a836
mov dl, byte [ebp - 4]
nop
mov cl, byte [eax + edi]
add cl, dl
xor cl, 0xb8
mov byte [eax + edi], cl
inc eax
lea ecx, [esi - 3]
cmp eax, ecx
jl 0x40a7f0
jmp 0x40a833
mov dl, byte [ecx + ebx + 3]
mov byte [ebp - 4], dl
lea edx, [esi - 4]
xor eax, eax
lea edi, [ecx + ebx + 4]
test edx, edx
jle 0x40a836
mov dl, byte [ebp - 4]
lea esp, [esp]
mov cl, byte [eax + edi]
add cl, dl
xor cl, 0xb8
mov byte [eax + edi], cl
inc eax
lea ecx, [esi - 4]
cmp eax, ecx
jl 0x40a820
mov ecx, dword [ebp - 8]
mov al, byte [edi]
mov dx, word [ebp + 0xc]
push esi
add ecx, ebx
push ecx
push 0x4493bb
mov word [0x4493b8], dx
mov byte [0x4493ba], al
call fcn.0040f350
mov edi, dword [ebp + 8]
add esp, 0xc
lea eax, [edi + 0x40]
push eax
mov dword [0x44b3bc], esi
mov byte [ebp - 4], 0
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [edi + 0x68], 0x800
jae 0x40a8ef
mov eax, dword [edi + 0x68]
inc eax
cmp dword [edi + 0x60], eax
ja 0x40a88d
lea ebx, [edi + 0x58]
call fcn.004085e0
mov ebx, dword [ebp + 0x10]
mov eax, dword [edi + 0x64]
add eax, dword [edi + 0x68]
mov ecx, dword [edi + 0x60]
mov dword [ebp - 0xc], eax
cmp ecx, eax
ja 0x40a8a2
sub eax, ecx
mov dword [ebp - 0xc], eax
mov ecx, dword [edi + 0x5c]
cmp dword [ecx + eax*4], 0
jne 0x40a8cb
push 0x2008
call fcn.0040d884
add esp, 4
test eax, eax
je 0x40a95b
mov ecx, dword [ebp - 0xc]
mov edx, dword [edi + 0x5c]
mov dword [edx + ecx*4], eax
mov eax, ecx
mov edx, dword [edi + 0x5c]
mov eax, dword [edx + eax*4]
test eax, eax
je 0x40a8e8
push 0x2008
push 0x4493b8
push eax
call fcn.0040f350
add esp, 0xc
inc dword [edi + 0x68]
mov byte [ebp - 4], 1
lea eax, [edi + 0x40]
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp byte [ebp - 4], 0
je 0x40a90d
mov eax, dword [edi + 0x70]
push 0
push 1
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseSemaphore]
add dword [ebp - 8], esi
sub dword [ebx + 0x2000], esi
cmp dword [ebx + 0x2000], 0
jle 0x40a9a9
mov ecx, dword [ebp - 8]
jmp 0x40a763
push edi
push edx
add eax, 0xc
push eax
push str.__s__Client_disconnected__packets_exceeded.___d___d_
push 1
mov ecx, 0x42e050
call fcn.00406d40
mov eax, dword [ebp + 0xc]
mov ecx, dword [ebp + 8]
add esp, 0x14
call fcn.0040ac20
pop edi
pop esi
xor al, al
pop ebx
mov esp, ebp
pop ebp
ret 0xc
lea ecx, [ebp - 0x10]
push ecx
lea ecx, [ebp - 0x1c]
mov dword [ebp - 0x10], 0
call fcn.0040d745
push 0x42a8d0
lea edx, [ebp - 0x1c]
push edx
mov dword [ebp - 0x1c], vtable.std::bad_alloc.0
call fcn.0040f2fe
test ecx, ecx
jle 0x40a9a9
mov eax, dword [ebx + 0x2000]
test eax, eax
jle 0x40a9a9
mov edx, 0x2000
sub edx, ecx
cmp eax, edx
jg 0x40a9a9
push eax
add ecx, ebx
push ecx
push ebx
call fcn.0040d910
add esp, 0xc
pop edi
pop esi
mov al, 1
pop ebx
mov esp, ebp
pop ebp
ret 0xc