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

Disassembly:
sub esp, 0x1c
cmp dword [esp + 0x20], 0
push ebp
mov ebp, ecx
mov dword [esp + 4], ebp
je 0x40f82f
mov ecx, dword [esp + 0x2c]
cmp ecx, 0x10
je 0x40f4bc
cmp ecx, 0x18
je 0x40f4bc
cmp ecx, 0x20
jne 0x40f82f
mov eax, dword [esp + 0x30]
cmp eax, 0x10
je 0x40f4d3
cmp eax, 0x18
je 0x40f4d3
cmp eax, 0x20
jne 0x40f82f
push ebx
push esi
mov esi, dword [esp + 0x30]
push edi
push eax
mov dword [ebp + 0x3cc], eax
lea eax, [ebp + 0x3d4]
push esi
push eax
mov dword [ebp + 0x3c8], ecx
call sub.VCRUNTIME140.dll_memcpy
push dword [ebp + 0x3cc]
lea eax, [ebp + 0x3f4]
push esi
push eax
call sub.VCRUNTIME140.dll_memcpy
mov eax, dword [ebp + 0x3c8]
add esp, 0x18
cmp eax, 0x10
je 0x40f541
lea ecx, [ebp + 0x3d0]
mov dword [esp + 0x38], ecx
cmp eax, 0x18
je 0x40f52c
mov dword [ecx], 0xe
jmp 0x40f56c
xor eax, eax
cmp dword [ebp + 0x3cc], 0x20
sete al
lea eax, [eax*2 + 0xc]
jmp 0x40f56a
mov ecx, dword [ebp + 0x3cc]
cmp ecx, 0x10
jne 0x40f551
lea eax, [ecx - 6]
jmp 0x40f560
xor eax, eax
cmp ecx, 0x18
setne al
lea eax, [eax*2 + 0xc]
lea ecx, [ebp + 0x3d0]
mov dword [esp + 0x38], ecx
mov dword [ecx], eax
mov eax, dword [ebp + 0x3cc]
lea esi, [ebp + 8]
cdq
and edx, 3
lea ebx, [edx + eax]
sar ebx, 2
xor edx, edx
mov dword [esp + 0x3c], ebx
test ebx, ebx
jle 0x40f597
mov ecx, ebx
xor eax, eax
mov edi, esi
rep stosd dword es:[edi], eax
lea ecx, [ebp + 0x3d0]
mov eax, dword [ecx]
inc edx
add esi, 0x20
cmp edx, eax
jle 0x40f585
xor edx, edx
test eax, eax
js 0x40f5ce
lea esi, [ebp + 0x1e8]
nop dword [eax]
test ebx, ebx
jle 0x40f5c2
mov ecx, ebx
xor eax, eax
mov edi, esi
rep stosd dword es:[edi], eax
lea ecx, [ebp + 0x3d0]
mov eax, dword [ecx]
inc edx
add esi, 0x20
cmp edx, eax
jle 0x40f5b0
jmp 0x40f5d6
mov dword [esp + 0x38], ecx
mov dword [esp + 0x3c], ebx
lea edi, [eax + 1]
mov eax, dword [ebp + 0x3c8]
cdq
lea ecx, [ebp + 0x414]
and edx, 3
imul edi, ebx
add eax, edx
mov dword [esp + 0x20], ecx
sar eax, 2
mov dword [esp + 0x14], eax
mov dword [esp + 0x34], edi
test eax, eax
jle 0x40f6c7
mov esi, dword [esp + 0x30]
mov edi, eax
mov ebp, ecx
nop dword [eax]
movzx eax, byte [esi]
lea esi, [esi + 4]
shl eax, 0x18
lea ebp, [ebp + 4]
mov dword [ebp - 4], eax
movzx edx, byte [esi - 3]
shl edx, 0x10
or edx, eax
mov dword [ebp - 4], edx
movzx ecx, byte [esi - 2]
shl ecx, 8
or ecx, edx
mov dword [ebp - 4], ecx
movzx eax, byte [esi - 1]
or eax, ecx
mov dword [ebp - 4], eax
sub edi, 1
jne 0x40f610
mov eax, dword [esp + 0x38]
xor esi, esi
mov ecx, dword [esp + 0x20]
mov ebp, dword [esp + 0x10]
mov edi, dword [esp + 0x34]
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x14]
mov dword [esp + 0x30], esi
mov dword [esp + 0x18], ecx
mov dword [esp + 0x3c], ebx
nop dword [eax + eax]
cmp esi, edi
jge 0x40f79c
mov eax, esi
mov ecx, dword [ecx]
cdq
idiv ebx
mov edi, eax
mov eax, esi
cdq
idiv ebx
mov eax, dword [esp + 0x38]
lea esi, [edx + edi*8]
mov dword [ebp + esi*4 + 8], ecx
mov ecx, dword [eax]
mov eax, dword [esp + 0x18]
sub ecx, edi
mov esi, dword [esp + 0x30]
mov edi, dword [esp + 0x34]
inc esi
mov dword [esp + 0x30], esi
mov eax, dword [eax]
lea ecx, [edx + ecx*8]
mov dword [ebp + ecx*4 + 0x1e8], eax
mov ecx, dword [esp + 0x18]
mov eax, dword [esp + 0x14]
add ecx, 4
mov dword [esp + 0x18], ecx
cmp esi, eax
jl 0x40f670
jmp 0x40f6cd
xor esi, esi
mov dword [esp + 0x30], esi
cmp esi, edi
jge 0x40f79c
mov edi, dword [esp + 0x10]
lea ecx, [eax*4 + 0x410]
add ecx, ebp
mov eax, 0x460c38
mov dword [esp + 0x28], ecx
add ebp, 0x418
mov ebx, dword [ecx]
movzx ecx, byte [eax]
inc eax
mov dword [esp + 0x24], eax
mov eax, ebx
sar eax, 0x10
movzx eax, al
movsx edx, byte [eax + str.cw]
mov eax, ebx
sar eax, 8
xor edx, ecx
movzx eax, al
shl edx, 8
movzx eax, byte [eax + str.cw]
xor edx, eax
movzx eax, bl
shl edx, 8
sar ebx, 0x18
movzx eax, byte [eax + str.cw]
xor edx, eax
movzx eax, bl
shl edx, 8
movzx eax, byte [eax + str.cw]
xor edx, eax
xor dword [edi + 0x414], edx
mov edx, dword [esp + 0x14]
cmp edx, 8
je 0x40f836
cmp edx, 1
jle 0x40f76e
lea ecx, [edx - 1]
nop dword [eax]
mov eax, dword [ebp - 4]
lea ebp, [ebp + 4]
xor dword [ebp - 4], eax
sub ecx, 1
jne 0x40f760
xor eax, eax
lea ebp, [edi + 0x418]
mov dword [esp + 0x18], eax
test edx, edx
jg 0x40f8c4
mov ebx, dword [esp + 0x3c]
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x28]
cmp esi, dword [esp + 0x34]
jl 0x40f6f1
mov ebp, dword [esp + 0x10]
mov ecx, dword [esp + 0x38]
mov eax, 1
mov dword [esp + 0x30], eax
cmp dword [ecx], eax
jle 0x40f828
mov edx, dword [esp + 0x38]
lea ecx, [ebp + 0x208]
mov dword [esp + 0x3c], ecx
nop dword [eax + eax]
test ebx, ebx
jle 0x40f818
mov esi, ecx
mov edi, ebx
mov edx, dword [esi]
lea esi, [esi + 4]
mov eax, edx
sar eax, 0x18
movzx ecx, al
mov eax, edx
sar eax, 0x10
movzx eax, al
mov ecx, dword [ecx*4 + 0x45fc38]
xor ecx, dword [eax*4 + 0x460038]
mov eax, edx
sar eax, 8
movzx eax, al
xor ecx, dword [eax*4 + 0x460438]
movzx eax, dl
xor ecx, dword [eax*4 + 0x460838]
mov dword [esi - 4], ecx
sub edi, 1
jne 0x40f7c8
mov eax, dword [esp + 0x30]
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x38]
inc eax
add ecx, 0x20
mov dword [esp + 0x30], eax
mov dword [esp + 0x3c], ecx
cmp eax, dword [edx]
jl 0x40f7c0
pop edi
pop esi
mov byte [ebp + 4], 1
pop ebx
pop ebp
add esp, 0x1c
ret 0x10
mov eax, ebp
mov edx, 3
nop dword [eax]
mov ecx, dword [eax - 4]
lea eax, [eax + 4]
xor dword [eax - 4], ecx
sub edx, 1
jne 0x40f840
mov ebx, dword [esp + 0x10]
mov edx, dword [ebx + 0x420]
mov eax, edx
sar eax, 0x18
movzx eax, al
movsx ecx, byte [eax + str.cw]
mov eax, edx
sar eax, 0x10
movzx eax, al
shl ecx, 8
movzx eax, byte [eax + str.cw]
xor ecx, eax
mov eax, edx
sar eax, 8
movzx eax, al
shl ecx, 8
movzx eax, byte [eax + str.cw]
xor ecx, eax
movzx eax, dl
shl ecx, 8
mov edx, 3
movzx eax, byte [eax + str.cw]
xor ecx, eax
xor dword [ebx + 0x424], ecx
lea ecx, [ebx + 0x428]
nop
mov eax, dword [ecx - 4]
lea ecx, [ecx + 4]
xor dword [ecx - 4], eax
sub edx, 1
jne 0x40f8b0
xor eax, eax
mov dword [esp + 0x18], eax
mov ecx, dword [esp + 0x20]
mov ebx, dword [esp + 0x3c]
mov dword [esp + 0x1c], ecx
cmp esi, dword [esp + 0x34]
jge 0x40f798
mov eax, esi
mov ecx, dword [ecx]
cdq
idiv ebx
mov edi, eax
mov eax, esi
cdq
idiv ebx
mov eax, dword [esp + 0x10]
lea esi, [edx + edi*8]
mov dword [eax + esi*4 + 8], ecx
mov eax, dword [esp + 0x38]
mov esi, dword [esp + 0x30]
inc esi
mov dword [esp + 0x30], esi
mov ecx, dword [eax]
mov eax, dword [esp + 0x1c]
sub ecx, edi
mov edi, dword [esp + 0x10]
mov eax, dword [eax]
lea ecx, [edx + ecx*8]
mov dword [edi + ecx*4 + 0x1e8], eax
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x1c]
inc eax
add ecx, 4
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], ecx
cmp eax, dword [esp + 0x14]
jl 0x40f8d0
jmp 0x40f786