Function at 0x40aa20
Capabilities:
Encode data using xor
Encrypt data using xxtea

Disassembly:
sub esp, 0xc
push ebx
push ebp
push esi
mov esi, dword [esp + 0x1c]
push edi
mov edi, dword [esp + 0x24]
mov ecx, dword [esi]
xor ebx, ebx
cmp edi, 1
jle 0x40ab34
mov eax, 0x34
mov ecx, dword [esi + edi*4 - 4]
cdq
idiv edi
add eax, 6
mov edx, eax
dec eax
test edx, edx
jle 0x40ab2a
inc eax
mov dword [esp + 0x18], eax
sub ebx, 0x61c88647
lea edx, [edi - 1]
mov eax, ebx
mov dword [esp + 0x14], ebx
shr eax, 2
and eax, 3
mov dword [esp + 0x10], eax
xor eax, eax
test edx, edx
jle 0x40aad7
mov edx, esi
mov esi, dword [edx + 4]
mov ebx, ecx
mov edi, esi
add edx, 4
shr edi, 3
shl ebx, 4
xor edi, ebx
mov ebx, ecx
shr ebx, 5
lea ebp, [esi*4]
xor ebx, ebp
mov ebp, dword [esp + 0x10]
add edi, ebx
mov ebx, eax
and ebx, 3
xor ebx, ebp
mov ebp, dword [esp + 0x28]
mov ebx, dword [ebp + ebx*4]
xor ebx, ecx
mov ecx, dword [esp + 0x14]
xor ecx, esi
add ebx, ecx
xor edi, ebx
mov ebx, dword [edx - 4]
add ebx, edi
mov edi, dword [esp + 0x24]
mov dword [edx - 4], ebx
inc eax
lea esi, [edi - 1]
mov ecx, ebx
cmp eax, esi
jl 0x40aa7c
mov esi, dword [esp + 0x20]
mov edx, dword [esi]
mov ebx, ecx
mov ebp, edx
and eax, 3
shr ebp, 3
shl ebx, 4
xor ebp, ebx
mov ebx, ecx
shr ebx, 5
shl edx, 2
xor ebx, edx
mov edx, dword [esp + 0x10]
xor eax, edx
mov edx, dword [esp + 0x28]
add ebp, ebx
mov ebx, dword [esp + 0x14]
mov eax, dword [edx + eax*4]
mov edx, dword [esi]
xor eax, ecx
mov ecx, ebx
xor ecx, edx
add eax, ecx
mov ecx, dword [esi + edi*4 - 4]
xor ebp, eax
mov eax, dword [esp + 0x18]
add ecx, ebp
dec eax
mov dword [esi + edi*4 - 4], ecx
mov dword [esp + 0x18], eax
jne 0x40aa5b
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0xc
ret
cmp edi, 0xffffffff
jge 0x40ac30
mov eax, 0x34
mov ebx, 0xb54cda56
cdq
neg edi
idiv edi
mov dword [esp + 0x24], edi
imul eax, eax, 0x61c88647
sub ebx, eax
mov dword [esp + 0x14], ebx
je 0x40ac26
mov eax, ebx
shr eax, 2
and eax, 3
mov dword [esp + 0x10], eax
lea eax, [edi - 1]
test eax, eax
jle 0x40abd0
lea edx, [esi + eax*4]
mov esi, dword [edx - 4]
mov edi, ecx
mov ebx, esi
lea ebp, [ecx*4]
shr edi, 3
shl ebx, 4
xor edi, ebx
mov ebx, esi
shr ebx, 5
xor ebx, ebp
mov ebp, dword [esp + 0x10]
add edi, ebx
mov ebx, eax
and ebx, 3
sub edx, 4
xor ebx, ebp
mov ebp, dword [esp + 0x28]
mov ebp, dword [ebp + ebx*4]
mov ebx, dword [esp + 0x14]
xor ebp, esi
mov esi, ebx
xor esi, ecx
mov ecx, dword [edx + 4]
add ebp, esi
xor edi, ebp
sub ecx, edi
dec eax
mov dword [edx + 4], ecx
test eax, eax
jg 0x40ab78
mov edi, dword [esp + 0x24]
mov esi, dword [esp + 0x20]
mov edi, dword [esi + edi*4 - 4]
mov edx, ecx
mov ebp, edi
and eax, 3
shr edx, 3
shl ebp, 4
xor edx, ebp
lea ebp, [ecx*4]
shr edi, 5
xor edi, ebp
add edx, edi
mov edi, dword [esp + 0x10]
xor eax, edi
mov edi, dword [esp + 0x28]
mov eax, dword [edi + eax*4]
mov edi, dword [esp + 0x24]
mov ebp, dword [esi + edi*4 - 4]
xor eax, ebp
mov ebp, ebx
xor ebp, ecx
mov ecx, dword [esi]
add eax, ebp
xor edx, eax
sub ecx, edx
add ebx, 0x61c88647
mov dword [esi], ecx
mov dword [esp + 0x14], ebx
jne 0x40ab62
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0xc
ret
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0xc
ret