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

Disassembly:
sub esp, 0x30
push edi
mov edi, ecx
mov dword [esp + 4], edi
mov al, byte [edi + 4]
test al, al
jne 0x40210e
push 0x4370c0
lea ecx, [esp + 0x2c]
call fcn.00408322
lea eax, [esp + 0x28]
push 0x432670
push eax
call fcn.00408411
mov eax, dword [edi + 0x14]
cmp eax, 0x10
jne 0x40212e
mov ecx, dword [esp + 0x3c]
mov edx, dword [esp + 0x38]
push ecx
push edx
mov ecx, edi
call fcn.00401a30
pop edi
add esp, 0x30
ret 8
cdq
and edx, 3
push ebx
add eax, edx
push ebp
mov ebx, eax
push esi
sar ebx, 2
cmp ebx, 4
jne 0x402145
xor eax, eax
jmp 0x40214e
xor eax, eax
cmp ebx, 6
setne al
inc eax
shl eax, 5
lea esi, [ebx*4]
mov ecx, dword [eax + 0x42edbc]
mov edx, dword [eax + 0x42edc4]
mov eax, dword [eax + 0x42edcc]
push esi
mov dword [esp + 0x18], ecx
mov dword [esp + 0x24], edx
mov dword [esp + 0x28], eax
call fcn.00422c75
push esi
mov dword [esp + 0x20], eax
call fcn.00422c75
add esp, 8
xor esi, esi
test ebx, ebx
mov ebp, eax
jle 0x4021d9
mov edi, dword [esp + 0x44]
xor ecx, ecx
xor edx, edx
mov cl, byte [edi]
shl ecx, 0x18
inc edi
mov dword [eax], ecx
mov dl, byte [edi]
shl edx, 0x10
or ecx, edx
inc edi
mov dword [eax], ecx
mov edx, dword [eax]
xor ecx, ecx
mov ch, byte [edi]
or edx, ecx
inc edi
mov dword [eax], edx
xor edx, edx
mov dl, byte [edi]
mov ecx, eax
or dword [eax], edx
mov edx, dword [esp + 0x10]
inc edi
add eax, 4
mov edx, dword [edx + 0xc]
mov edx, dword [edx]
mov edx, dword [edx + esi*4]
xor dword [ecx], edx
inc esi
cmp esi, ebx
jl 0x402195
mov edi, dword [esp + 0x10]
mov ecx, dword [edi + 0x18]
mov eax, 1
cmp ecx, eax
mov dword [esp + 0x1c], eax
jle 0x4022e2
test ebx, ebx
mov dword [esp + 0x44], 0
jle 0x4022b1
mov edi, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
mov eax, ebp
mov esi, edi
sub eax, esi
mov edx, ecx
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x20]
sub eax, edx
mov edx, dword [esp + 0x24]
mov esi, ecx
mov dword [esp + 0x28], eax
sub edx, esi
mov dword [esp + 0x2c], edx
jmp 0x40222d
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x10]
mov esi, dword [esp + 0x1c]
add eax, ecx
add edi, 4
mov edx, dword [edx + 0xc]
mov esi, dword [edx + esi*4]
cdq
idiv ebx
xor eax, eax
mov al, byte [ebp + edx*4 + 1]
mov edx, dword [esp + 0x44]
mov esi, dword [esi + edx*4]
mov edx, dword [eax*4 + 0x42d590]
mov eax, dword [esp + 0x2c]
xor esi, edx
add eax, ecx
cdq
idiv ebx
mov edx, dword [ebp + edx*4]
and edx, 0xff
mov eax, dword [edx*4 + 0x42d990]
xor esi, eax
mov eax, ecx
cdq
idiv ebx
xor eax, eax
mov al, byte [ebp + edx*4 + 2]
mov edx, dword [eax*4 + 0x42d190]
mov eax, dword [esp + 0x30]
xor esi, edx
xor edx, edx
mov dl, byte [eax + edi - 1]
mov eax, dword [edx*4 + 0x42cd90]
xor esi, eax
mov eax, dword [esp + 0x44]
mov dword [edi - 4], esi
inc eax
inc ecx
cmp eax, ebx
mov dword [esp + 0x44], eax
jl 0x402229
mov esi, dword [esp + 0x18]
lea ecx, [ebx*4]
mov edx, ecx
mov edi, ebp
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov eax, dword [esp + 0x1c]
mov ecx, edx
and ecx, 3
inc eax
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x10]
mov dword [esp + 0x1c], eax
cmp eax, dword [ecx + 0x18]
jl 0x4021ed
xor eax, eax
test ebx, ebx
mov dword [esp + 0x44], eax
jle 0x4023a2
mov esi, dword [esp + 0x20]
mov ecx, dword [esp + 0x14]
mov edi, dword [esp + 0x48]
sub ecx, esi
mov dword [esp + 0x48], ecx
mov ecx, dword [esp + 0x24]
sub ecx, esi
mov dword [esp + 0x30], ecx
jmp 0x402312
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x10]
mov edx, dword [ecx + 0x18]
mov ecx, dword [ecx + 0xc]
mov edx, dword [ecx + edx*4]
mov ecx, dword [edx + eax*4]
xor edx, edx
mov dl, byte [ebp + eax*4 + 3]
mov eax, ecx
sar eax, 0x18
mov dl, byte [edx + 0x42bc90]
xor dl, al
mov eax, dword [esp + 0x48]
add eax, esi
mov byte [edi], dl
cdq
idiv ebx
xor eax, eax
inc edi
mov al, byte [ebp + edx*4 + 2]
mov edx, ecx
sar edx, 0x10
mov al, byte [eax + 0x42bc90]
xor al, dl
mov byte [edi], al
mov eax, esi
cdq
idiv ebx
xor eax, eax
inc edi
mov al, byte [ebp + edx*4 + 1]
mov edx, ecx
sar edx, 8
mov al, byte [eax + 0x42bc90]
xor al, dl
mov edx, dword [esp + 0x30]
mov byte [edi], al
inc edi
lea eax, [edx + esi]
cdq
idiv ebx
mov eax, dword [ebp + edx*4]
and eax, 0xff
mov dl, byte [eax + 0x42bc90]
mov eax, dword [esp + 0x44]
xor dl, cl
mov byte [edi], dl
inc edi
inc eax
inc esi
cmp eax, ebx
mov dword [esp + 0x44], eax
jl 0x40230e
mov eax, dword [esp + 0x18]
push eax
call fcn.00422c9e
push ebp
call fcn.00422c9e
add esp, 8
pop esi
pop ebp
pop ebx
pop edi
add esp, 0x30
ret 8