Function at 0x40ae70
Capabilities:
Encode data using xor
Encrypt data using tea

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
push ebx
mov ebx, edx
mov dword [ebp - 0x14], ecx
mov eax, ebx
shr eax, 2
test bl, 3
push esi
push edi
lea ecx, [eax + 1]
cmove ecx, eax
mov dword [ebp - 0x18], ecx
lea edi, [ecx*4]
push edi
mov dword [ebp - 0x28], edi
call fcn.0054cf40
push edi
mov esi, eax
push 0
push esi
mov dword [ebp - 0x10], esi
call fcn.00547c40
add esp, 0x10
xor edi, edi
test ebx, ebx
je 0x40aed6
mov eax, edi
mov ecx, edi
shr eax, 2
and ecx, 3
lea edx, [esi + eax*4]
shl ecx, 3
mov eax, dword [ebp - 0x14]
movzx eax, byte [eax + edi]
inc edi
shl eax, cl
or dword [edx], eax
cmp edi, ebx
jb 0x40aeb6
push 0x10
call fcn.0054cf40
mov edi, eax
mov dword [ebp - 0xc], 2
mov eax, dword [ebp + 8]
xorps xmm0, xmm0
mov ecx, eax
mov dword [ebp - 4], edi
not ecx
mov dword [ebp - 8], 8
mov dword [ebp - 0x14], ecx
mov esi, 0xfffffffe
mov ecx, 0xfffffffc
lea ebx, [eax + 2]
sub ecx, eax
add esp, 4
mov dword [ebp - 0x1c], ecx
mov ecx, 0xfffffffd
sub ecx, eax
mov dword [ebp - 0x24], ecx
mov ecx, 1
sub ecx, eax
sub esi, eax
movups xmmword [edi], xmm0
mov dword [ebp - 0x20], ecx
nop dword [eax + eax]
lea ecx, [esi + ebx]
mov eax, ecx
and ecx, 3
shr eax, 2
lea edx, [edi + eax*4]
shl ecx, 3
movzx eax, byte [ebx - 2]
shl eax, cl
or dword [edx], eax
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 8]
add eax, ebx
shr eax, 2
and ecx, 0x18
lea edx, [edi + eax*4]
add dword [ebp - 8], 0x20
movzx eax, byte [ebx - 1]
shl eax, cl
or dword [edx], eax
mov eax, dword [ebp - 0xc]
mov ecx, dword [ebp - 0x1c]
shr eax, 2
lea edx, [edi + eax*4]
add dword [ebp - 0xc], 4
movzx eax, byte [ebx]
lea ecx, [ecx + ebx]
shl ecx, 3
and ecx, 0x18
shl eax, cl
or dword [edx], eax
mov eax, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x24]
add eax, ebx
shr eax, 2
lea edx, [edi + eax*4]
movzx eax, byte [ebx + 1]
lea ecx, [ecx + ebx]
add ebx, 4
shl ecx, 3
and ecx, 0x18
shl eax, cl
or dword [edx], eax
lea eax, [esi + ebx]
cmp eax, 0x10
jb 0x40af30
mov ecx, dword [ebp - 0x18]
xor edx, edx
mov esi, dword [ebp - 0x10]
lea eax, [ecx - 1]
mov dword [ebp - 0x14], eax
mov eax, 0x34
div ecx
mov edx, dword [ebp - 0x14]
mov ecx, 0xb54cda56
mov ebx, dword [esi]
imul eax, eax, 0x61c88647
sub ecx, eax
mov dword [ebp - 0xc], ecx
cmp edx, 1
jb 0x40b09b
test ecx, ecx
je 0x40b09b
lea eax, [esi + edx*4]
mov dword [ebp - 0x24], eax
mov eax, ecx
shr eax, 2
and eax, 3
mov dword [ebp - 8], eax
mov eax, edx
nop
mov esi, dword [esi + eax*4 - 4]
lea edi, [ebx*4]
mov ecx, esi
mov edx, ebx
shr ecx, 5
xor edi, ecx
shr edx, 3
mov ecx, esi
shl ecx, 4
xor edx, ecx
mov ecx, eax
add edi, edx
and ecx, 3
xor ecx, dword [ebp - 8]
mov edx, dword [ebp - 4]
mov edx, dword [edx + ecx*4]
mov ecx, dword [ebp - 0xc]
xor edx, esi
mov esi, dword [ebp - 0x10]
xor ecx, ebx
add edx, ecx
xor edi, edx
sub dword [esi + eax*4], edi
mov ebx, dword [esi + eax*4]
sub eax, 1
jne 0x40b000
mov ecx, dword [ebp - 0x24]
lea edi, [ebx*4]
mov edx, ebx
and eax, 3
xor eax, dword [ebp - 8]
shr edx, 3
mov esi, dword [ecx]
mov ecx, esi
shr ecx, 5
xor edi, ecx
mov ecx, esi
shl ecx, 4
xor edx, ecx
mov ecx, dword [ebp - 4]
add edi, edx
mov edx, dword [ebp - 0x14]
mov eax, dword [ecx + eax*4]
mov ecx, dword [ebp - 0xc]
xor eax, esi
mov esi, dword [ebp - 0x10]
xor ebx, ecx
add eax, ebx
xor edi, eax
sub dword [esi], edi
add ecx, 0x61c88647
mov ebx, dword [esi]
mov dword [ebp - 0xc], ecx
jne 0x40aff1
mov edi, dword [ebp - 4]
mov ecx, dword [ebp - 0x28]
mov ebx, dword [ebp - 0x18]
lea eax, [ecx - 7]
mov ebx, dword [esi + ebx*4 - 4]
cmp ebx, eax
jb 0x40b0ff
lea eax, [ecx - 4]
cmp ebx, eax
ja 0x40b0ff
mov eax, ebx
mov ecx, 0xffffffff
add eax, 1
cmovb eax, ecx
push eax
call fcn.0054cf40
add esp, 4
mov dword [ebp - 8], eax
xor edx, edx
test ebx, ebx
je 0x40b0f4
mov edi, eax
mov eax, edx
mov ecx, edx
shr eax, 2
and ecx, 3
shl ecx, 3
mov eax, dword [esi + eax*4]
shr eax, cl
mov byte [edi + edx], al
inc edx
cmp edx, ebx
jb 0x40b0d4
mov edi, dword [ebp - 4]
mov eax, dword [ebp - 8]
mov byte [eax + ebx], 0
mov eax, dword [ebp + 0xc]
mov dword [eax], ebx
jmp 0x40b106
mov dword [ebp - 8], 0
push esi
call fcn.0054c170
push edi
call fcn.0054c170
mov eax, dword [ebp - 8]
add esp, 8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret