Function at 0x40be80
Capabilities:
Encode data using xor

Disassembly:
mov eax, dword [esp + 4]
sub esp, 0x10
push ebx
push esi
cmp eax, 5
jg 0x40bf31
cmp eax, 1
jne 0x40beb5
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x24]
mov ebx, dword [esp + 0x2c]
mov ecx, dword [eax]
mov edx, dword [edx]
call fcn.0040b490
pop esi
mov dword [ebx + 4], eax
pop ebx
add esp, 0x10
ret
cmp eax, 2
jne 0x40bed5
mov eax, dword [esp + 0x24]
mov esi, dword [esp + 0x2c]
push eax
mov eax, dword [esp + 0x2c]
call fcn.0040b840
add esp, 4
pop esi
pop ebx
add esp, 0x10
ret
cmp eax, 3
jne 0x40bef5
mov ecx, dword [esp + 0x2c]
mov eax, dword [esp + 0x28]
push ecx
mov ecx, dword [esp + 0x28]
call fcn.0040b8c0
add esp, 4
pop esi
pop ebx
add esp, 0x10
ret
cmp eax, 4
jne 0x40bf11
mov esi, dword [esp + 0x2c]
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x24]
call fcn.0040b9c0
pop esi
pop ebx
add esp, 0x10
ret
cmp eax, 5
jne 0x40bf31
mov edx, dword [esp + 0x2c]
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x24]
push edx
call fcn.0040bba0
add esp, 4
pop esi
pop ebx
add esp, 0x10
ret
mov ecx, eax
and ecx, 0x80000001
push ebp
push edi
jns 0x40bf42
dec ecx
or ecx, 0xfffffffe
inc ecx
jne 0x40bf57
mov ebp, eax
mov dword [esp + 0x1c], eax
cdq
sub eax, edx
mov edi, eax
sar edi, 1
mov dword [esp + 0x24], edi
jmp 0x40bf75
lea ebp, [eax + 1]
lea ecx, [eax - 1]
mov eax, ebp
cdq
sub eax, edx
mov edi, eax
mov eax, ecx
cdq
sub eax, edx
sar edi, 1
sar eax, 1
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x24], eax
mov esi, dword [esp + 0x34]
mov dword [esp + 0x18], ebp
test edi, edi
jle 0x40bfba
mov ebx, dword [esp + 0x2c]
mov edx, dword [esp + 0x30]
sub ebx, esi
sub edx, esi
mov eax, esi
lea ecx, [esi + edi*4]
mov dword [esp + 0x10], edx
mov dword [esp + 0x14], edi
lea ebx, [ebx]
mov edx, dword [ebx + eax]
mov dword [eax], edx
mov edx, dword [esp + 0x10]
mov edx, dword [edx + eax]
mov dword [ecx], edx
add eax, 4
add ecx, 4
dec dword [esp + 0x14]
jne 0x40bfa0
xor ecx, ecx
cmp dword [esp + 0x24], ecx
jle 0x40bff5
mov edx, dword [esp + 0x30]
mov ebx, dword [esp + 0x2c]
sub ebx, edx
sub edx, esi
lea eax, [esi + edi*4]
mov dword [esp + 0x10], edx
jmp 0x40bfdb
mov edx, dword [esp + 0x10]
add edx, eax
mov ebp, dword [edx + ebx]
xor dword [esi + ecx*4], ebp
mov edx, dword [edx]
xor dword [eax], edx
inc ecx
add eax, 4
cmp ecx, dword [esp + 0x24]
jl 0x40bfd7
mov ebp, dword [esp + 0x18]
mov ebx, dword [esp + 0x28]
push ebx
lea eax, [esi + edi*4]
push eax
lea ecx, [ebx + ebp*4]
push esi
push ecx
push edi
mov dword [esp + 0x28], eax
call fcn.0040be80
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x40]
push esi
push eax
push ecx
lea eax, [ebx + ebp*4]
push eax
push edi
call fcn.0040be80
add esp, 0x28
test ebp, ebp
jle 0x40c041
mov ecx, esi
mov eax, ebx
sub ecx, ebx
mov dword [esp + 0x18], ebp
mov edx, dword [ecx + eax]
xor dword [eax], edx
add eax, 4
dec dword [esp + 0x18]
jne 0x40c033
mov eax, dword [esp + 0x30]
mov edx, dword [esp + 0x2c]
lea ecx, [eax + edi*4]
lea esi, [esi + ebp*4]
push esi
push ecx
mov ecx, dword [esp + 0x2c]
lea eax, [edx + edi*4]
push eax
lea eax, [ebx + ebp*4]
push eax
push ecx
call fcn.0040be80
mov edx, dword [esp + 0x30]
add esp, 0x14
xor eax, eax
test edx, edx
jle 0x40c07f
mov ecx, esi
mov esi, dword [ecx]
xor dword [ebx + eax*4], esi
inc eax
add ecx, 4
cmp eax, edx
jl 0x40c072
xor eax, eax
test ebp, ebp
jle 0x40c09d
mov ecx, dword [esp + 0x14]
lea esp, [esp]
mov edx, dword [ebx + eax*4]
xor dword [ecx], edx
inc eax
add ecx, 4
cmp eax, ebp
jl 0x40c090
pop edi
pop ebp
pop esi
pop ebx
add esp, 0x10
ret