Function at 0x40a500
Capabilities:
Encode data using xor
Encrypt data using aes

Disassembly:
mov eax, dword [esp + 0x10]
cmp eax, 1
je 0x40a512
cmp eax, 2
jne 0x40aa3c
mov eax, dword [esp + 0xc]
test al, 0x3f
jne 0x40aa3c
cmp eax, 0x80
jb 0x40aa3c
cmp eax, 0x100
ja 0x40aa3c
push ebx
push ebp
mov ebp, dword [esp + 0xc]
xor ecx, ecx
push esi
mov esi, dword [esp + 0x14]
mov dword [ebp + 0x104], ecx
mov dword [ebp + 0x108], ecx
mov dword [ebp + 0x10c], ecx
mov dword [ebp + 0x110], ecx
mov ecx, eax
push edi
shr ecx, 5
add ecx, 6
mov edi, ebp
mov dword [ebp + 0x100], ecx
mov ecx, eax
shr ecx, 3
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
cmp eax, 0x80
rep movsb byte es:[edi], byte [esi]
jne 0x40a61f
lea ecx, [ebp + 4]
mov edi, 0x410cc8
mov esi, dword [ecx + 8]
xor eax, eax
mov edx, esi
xor ebx, ebx
mov dword [esp + 0x1c], edx
mov al, dh
mov bl, byte [esp + 0x1e]
add edi, 4
mov eax, dword [eax*4 + 0x40f4c8]
mov ebx, dword [ebx*4 + 0x40f4c8]
and eax, 0xff
and ebx, 0xff00
xor eax, ebx
mov ebx, edx
shr ebx, 0x18
and edx, 0xff
mov ebx, dword [ebx*4 + 0x40f4c8]
mov edx, dword [edx*4 + 0x40f4c8]
and ebx, 0xff0000
xor eax, ebx
mov ebx, dword [ecx - 4]
and edx, 0xff000000
xor eax, edx
mov edx, dword [edi - 4]
xor eax, ebx
mov ebx, dword [ecx]
xor eax, edx
mov edx, dword [ecx + 4]
mov dword [ecx + 0xc], eax
xor eax, ebx
mov dword [ecx + 0x10], eax
xor eax, edx
xor esi, eax
cmp edi, 0x410cf0
mov dword [ecx + 0x14], eax
mov dword [ecx + 0x18], esi
je 0x40a7e0
add ecx, 0x10
jmp 0x40a590
cmp eax, 0xc0
jne 0x40a6d2
lea ecx, [ebp + 4]
mov esi, 0x410cc8
mov edx, dword [ecx + 0x10]
xor eax, eax
mov dword [esp + 0x1c], edx
xor ebx, ebx
mov bl, byte [esp + 0x1e]
mov al, dh
add esi, 4
mov eax, dword [eax*4 + 0x40f4c8]
mov edi, dword [ebx*4 + 0x40f4c8]
and eax, 0xff
and edi, 0xff00
xor eax, edi
mov edi, edx
shr edi, 0x18
and edx, 0xff
mov ebx, dword [esi - 4]
mov edi, dword [edi*4 + 0x40f4c8]
mov edx, dword [edx*4 + 0x40f4c8]
and edi, 0xff0000
xor eax, edi
and edx, 0xff000000
mov edi, dword [ecx]
xor eax, edx
mov edx, dword [ecx - 4]
xor eax, edx
mov edx, dword [ecx + 4]
xor eax, ebx
mov ebx, dword [ecx + 8]
mov dword [ecx + 0x14], eax
xor eax, edi
mov dword [ecx + 0x18], eax
xor eax, edx
mov dword [ecx + 0x1c], eax
xor eax, ebx
cmp esi, 0x410ce8
mov dword [ecx + 0x20], eax
je 0x40a7e0
mov ebx, dword [ecx + 0xc]
mov edx, dword [ecx + 0x10]
xor eax, ebx
xor edx, eax
mov dword [ecx + 0x24], eax
mov dword [ecx + 0x28], edx
add ecx, 0x18
jmp 0x40a632
cmp eax, 0x100
jne 0x40a7e0
lea ecx, [ebp + 4]
mov edi, 0x410cc8
mov edx, dword [ecx + 0x18]
xor eax, eax
mov dword [esp + 0x1c], edx
xor ebx, ebx
mov bl, byte [esp + 0x1e]
mov al, dh
add edi, 4
mov eax, dword [eax*4 + 0x40f4c8]
mov esi, dword [ebx*4 + 0x40f4c8]
and eax, 0xff
and esi, 0xff00
xor eax, esi
mov esi, edx
shr esi, 0x18
and edx, 0xff
mov ebx, dword [edi - 4]
mov esi, dword [esi*4 + 0x40f4c8]
mov edx, dword [edx*4 + 0x40f4c8]
and esi, 0xff0000
xor eax, esi
and edx, 0xff000000
mov esi, dword [ecx]
xor eax, edx
mov edx, dword [ecx - 4]
xor eax, edx
mov edx, dword [ecx + 4]
xor eax, ebx
mov ebx, dword [ecx + 8]
mov dword [ecx + 0x1c], eax
xor eax, esi
mov dword [ecx + 0x20], eax
xor eax, edx
mov dword [ecx + 0x24], eax
xor eax, ebx
cmp edi, 0x410ce4
mov dword [esp + 0x1c], eax
mov dword [ecx + 0x28], eax
je 0x40a7e0
xor edx, edx
mov ebx, dword [ecx + 0x10]
mov dl, byte [esp + 0x1e]
mov esi, dword [edx*4 + 0x40f4c8]
xor edx, edx
mov dl, ah
and esi, 0xff0000
mov edx, dword [edx*4 + 0x40f4c8]
and edx, 0xff00
xor esi, edx
mov edx, eax
shr edx, 0x18
and eax, 0xff
mov edx, dword [edx*4 + 0x40f4c8]
mov eax, dword [eax*4 + 0x40f4c8]
and edx, 0xff000000
xor esi, edx
and eax, 0xff
mov edx, dword [ecx + 0x14]
xor esi, eax
xor esi, dword [ecx + 0xc]
mov dword [ecx + 0x2c], esi
xor esi, ebx
mov dword [ecx + 0x30], esi
xor esi, edx
mov edx, dword [ecx + 0x18]
mov dword [ecx + 0x34], esi
xor edx, esi
mov dword [ecx + 0x38], edx
add ecx, 0x20
jmp 0x40a6e5
cmp dword [esp + 0x20], 2
jne 0x40aa35
mov edx, dword [ebp + 0x100]
xor esi, esi
shl edx, 2
je 0x40a83b
lea ecx, [ebp + edx*4 + 8]
lea eax, [ebp + 8]
mov ebx, dword [ecx - 8]
mov edi, dword [eax - 8]
mov dword [eax - 8], ebx
mov dword [ecx - 8], edi
mov ebx, dword [ecx - 4]
mov edi, dword [eax - 4]
mov dword [eax - 4], ebx
mov dword [ecx - 4], edi
mov ebx, dword [ecx]
mov edi, dword [eax]
mov dword [eax], ebx
mov dword [ecx], edi
mov ebx, dword [ecx + 4]
mov edi, dword [eax + 4]
mov dword [eax + 4], ebx
mov dword [ecx + 4], edi
add esi, 4
sub edx, 4
add eax, 0x10
sub ecx, 0x10
cmp esi, edx
jb 0x40a7ff
mov eax, dword [ebp + 0x100]
mov esi, 1
cmp eax, esi
jbe 0x40aa35
lea eax, [ebp + 8]
mov ecx, dword [eax + 8]
add eax, 0x10
xor ebx, ebx
mov dword [esp + 0x20], ecx
mov bl, ch
xor edx, edx
mov dl, byte [esp + 0x22]
mov edi, dword [ebx*4 + 0x40f4c8]
mov edx, dword [edx*4 + 0x40f4c8]
and edi, 0xff
and edx, 0xff
mov ebx, dword [edi*4 + 0x40fcc8]
mov edi, ecx
mov edx, dword [edx*4 + 0x4100c8]
and ecx, 0xff
shr edi, 0x18
mov ecx, dword [ecx*4 + 0x40f4c8]
xor edx, ebx
mov edi, dword [edi*4 + 0x40f4c8]
and ecx, 0xff
and edi, 0xff
mov ebx, dword [edi*4 + 0x4104c8]
xor edx, ebx
mov ebx, dword [ecx*4 + 0x40f8c8]
mov ecx, dword [eax - 4]
xor edx, ebx
xor ebx, ebx
mov dword [eax - 8], edx
mov bl, ch
mov dword [esp + 0x20], ecx
xor edx, edx
mov edi, dword [ebx*4 + 0x40f4c8]
mov dl, byte [esp + 0x22]
and edi, 0xff
mov edx, dword [edx*4 + 0x40f4c8]
mov ebx, dword [edi*4 + 0x40fcc8]
mov edi, ecx
shr edi, 0x18
and edx, 0xff
and ecx, 0xff
mov edi, dword [edi*4 + 0x40f4c8]
mov edx, dword [edx*4 + 0x4100c8]
mov ecx, dword [ecx*4 + 0x40f4c8]
and edi, 0xff
xor edx, ebx
and ecx, 0xff
mov ebx, dword [edi*4 + 0x4104c8]
xor edx, ebx
mov ebx, dword [ecx*4 + 0x40f8c8]
mov ecx, dword [eax]
xor edx, ebx
xor ebx, ebx
mov dword [eax - 4], edx
mov bl, ch
mov dword [esp + 0x20], ecx
xor edx, edx
mov edi, dword [ebx*4 + 0x40f4c8]
mov dl, byte [esp + 0x22]
and edi, 0xff
mov edx, dword [edx*4 + 0x40f4c8]
mov ebx, dword [edi*4 + 0x40fcc8]
mov edi, ecx
shr edi, 0x18
and edx, 0xff
and ecx, 0xff
mov edi, dword [edi*4 + 0x40f4c8]
mov edx, dword [edx*4 + 0x4100c8]
mov ecx, dword [ecx*4 + 0x40f4c8]
and edi, 0xff
xor edx, ebx
and ecx, 0xff
mov ebx, dword [edi*4 + 0x4104c8]
xor edx, ebx
mov ebx, dword [ecx*4 + 0x40f8c8]
mov ecx, dword [eax + 4]
xor edx, ebx
mov dword [eax], edx
mov dword [esp + 0x20], ecx
xor edx, edx
mov dl, byte [esp + 0x22]
mov edx, dword [edx*4 + 0x40f4c8]
xor ebx, ebx
and edx, 0xff
mov bl, ch
mov edx, dword [edx*4 + 0x4100c8]
mov edi, dword [ebx*4 + 0x40f4c8]
and edi, 0xff
mov ebx, dword [edi*4 + 0x40fcc8]
mov edi, ecx
shr edi, 0x18
and ecx, 0xff
xor edx, ebx
mov edi, dword [edi*4 + 0x40f4c8]
mov ecx, dword [ecx*4 + 0x40f4c8]
and edi, 0xff
and ecx, 0xff
mov ebx, dword [edi*4 + 0x4104c8]
mov edi, dword [ecx*4 + 0x40f8c8]
xor edx, ebx
xor edx, edi
inc esi
mov dword [eax + 4], edx
mov ecx, dword [ebp + 0x100]
cmp esi, ecx
jb 0x40a851
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
or eax, 0xffffffff
ret