Function at 0x40e5e0
Capabilities:
Encode data using xor
Encrypt data using aes
Reference aes constants

Disassembly:
sub esp, 0x24
push ebp
mov ebp, ecx
cmp byte [ebp + 4], 0
je 0x40e8bf
mov eax, dword [ebp + 0x3cc]
cmp eax, 0x10
jne 0x40e60f
push dword [esp + 0x30]
push dword [esp + 0x30]
call fcn.0040e8d0
pop ebp
add esp, 0x24
ret 8
cdq
push ebx
and edx, 3
push esi
push edi
lea esi, [ebp + 0x454]
lea edi, [edx + eax]
mov dword [esp + 0x1c], esi
sar edi, 2
mov ebx, esi
mov dword [esp + 0x2c], edi
cmp edi, 4
jne 0x40e650
mov edx, dword [0x460c6c]
mov eax, dword [0x460c64]
mov dword [esp + 0x10], edx
mov edx, dword [0x460c74]
mov dword [esp + 0x14], eax
mov dword [esp + 0x18], edx
jmp 0x40e682
cmp edi, 6
mov ecx, 0x20
mov eax, 0x40
cmove eax, ecx
mov ecx, dword [eax + 0x460c64]
mov edx, dword [eax + 0x460c6c]
mov eax, dword [eax + 0x460c74]
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], edx
mov dword [esp + 0x18], eax
test edi, edi
jle 0x40e6d9
mov eax, dword [esp + 0x38]
mov dword [esp + 0x20], edi
lea edi, [ebp + 0x1e8]
movzx ecx, byte [eax]
lea eax, [eax + 4]
shl ecx, 0x18
lea edi, [edi + 4]
mov dword [ebx], ecx
movzx edx, byte [eax - 3]
shl edx, 0x10
or edx, ecx
mov ecx, ebx
mov dword [ebx], edx
movzx esi, byte [eax - 2]
shl esi, 8
or esi, edx
mov dword [ebx], esi
add ebx, 4
movzx edx, byte [eax - 1]
or esi, edx
xor esi, dword [edi - 4]
sub dword [esp + 0x20], 1
mov dword [ecx], esi
jne 0x40e690
mov edi, dword [esp + 0x2c]
lea esi, [ebp + 0x454]
mov ecx, dword [esp + 0x14]
cmp dword [ebp + 0x3d0], 1
mov dword [esp + 0x28], 1
jle 0x40e7e4
lea edx, [ebp + 0x208]
lea eax, [ebp + 0x434]
mov dword [esp + 0x2c], edx
nop
test edi, edi
jle 0x40e7a8
mov ebx, dword [esp + 0x10]
mov esi, ecx
mov dword [esp + 0x20], eax
sub ebx, ecx
mov eax, dword [esp + 0x18]
sub eax, ecx
mov dword [esp + 0x38], edx
mov dword [esp + 0x30], eax
mov dword [esp + 0x24], edi
lea eax, [ebx + esi]
cdq
idiv edi
mov eax, dword [ebp + edx*4 + 0x454]
sar eax, 8
movzx ecx, al
mov eax, dword [esp + 0x30]
add eax, esi
cdq
idiv edi
mov ecx, dword [ecx*4 + 0x45f438]
movzx eax, byte [ebp + edx*4 + 0x454]
xor ecx, dword [eax*4 + 0x45f838]
mov eax, esi
cdq
inc esi
idiv edi
movsx eax, word [ebp + edx*4 + 0x456]
mov edx, dword [esp + 0x20]
movzx eax, al
xor ecx, dword [eax*4 + 0x45f038]
movzx eax, byte [edx + 0x23]
xor ecx, dword [eax*4 + 0x45ec38]
mov eax, dword [esp + 0x38]
xor ecx, dword [eax]
add eax, 4
mov dword [edx], ecx
add edx, 4
sub dword [esp + 0x24], 1
mov dword [esp + 0x38], eax
mov dword [esp + 0x20], edx
jne 0x40e726
lea esi, [ebp + 0x454]
lea eax, [ebp + 0x434]
lea ecx, [edi*4]
push ecx
push eax
push esi
call sub.VCRUNTIME140.dll_memcpy
mov eax, dword [esp + 0x34]
add esp, 0xc
mov edx, dword [esp + 0x2c]
inc eax
mov ecx, dword [esp + 0x14]
add edx, 0x20
cmp eax, dword [ebp + 0x3d0]
mov dword [esp + 0x28], eax
lea eax, [ebp + 0x434]
mov dword [esp + 0x2c], edx
jl 0x40e700
xor ebx, ebx
mov dword [esp + 0x38], ebx
test edi, edi
jle 0x40e8bc
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x10]
sub edx, eax
mov esi, dword [esp + 0x3c]
sub dword [esp + 0x18], eax
mov dword [esp + 0x14], edx
nop dword [eax + eax]
mov eax, dword [ebp + 0x3d0]
lea esi, [esi + 4]
lea eax, [ebx + eax*8]
mov ebx, dword [ebp + eax*4 + 0x1e8]
mov ecx, ebx
mov eax, dword [esp + 0x1c]
sar ecx, 0x18
add dword [esp + 0x1c], 4
movzx eax, byte [eax + 3]
xor cl, byte [eax + 0x45db38]
mov eax, dword [esp + 0x10]
add eax, edx
mov byte [esi - 4], cl
cdq
mov ecx, ebx
idiv edi
sar ecx, 0x10
movsx eax, word [ebp + edx*4 + 0x456]
movzx eax, al
xor cl, byte [eax + 0x45db38]
mov eax, dword [esp + 0x10]
cdq
idiv edi
mov byte [esi - 3], cl
mov ecx, ebx
sar ecx, 8
mov eax, dword [ebp + edx*4 + 0x454]
sar eax, 8
movzx eax, al
xor cl, byte [eax + 0x45db38]
mov eax, dword [esp + 0x18]
mov byte [esi - 2], cl
mov ecx, dword [esp + 0x10]
add eax, ecx
cdq
inc ecx
idiv edi
mov dword [esp + 0x10], ecx
movzx eax, byte [ebp + edx*4 + 0x454]
mov edx, dword [esp + 0x14]
mov al, byte [eax + 0x45db38]
xor al, bl
mov ebx, dword [esp + 0x38]
inc ebx
mov byte [esi - 1], al
mov dword [esp + 0x38], ebx
cmp ebx, edi
jl 0x40e810
pop edi
pop esi
pop ebx
pop ebp
add esp, 0x24
ret 8