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

Disassembly:
sub esp, 0x14
push ebp
mov ebp, ecx
mov dword [esp + 0x10], ebp
cmp byte [ebp + 4], 0
je 0x40efef
push ebx
push esi
push edi
mov edi, dword [esp + 0x28]
movzx ebx, byte [edi]
movzx edx, byte [edi + 1]
movzx ecx, byte [edi + 2]
movzx eax, byte [edi + 3]
movzx esi, byte [edi + 5]
shl ebx, 8
or ebx, edx
movzx edx, byte [edi + 6]
shl ebx, 8
or ebx, ecx
movzx ecx, byte [edi + 7]
shl ebx, 8
or ebx, eax
movzx eax, byte [edi + 4]
xor ebx, dword [ebp + 8]
shl eax, 8
or eax, esi
mov dword [esp + 0x14], ebx
movzx esi, byte [edi + 9]
shl eax, 8
or eax, edx
movzx edx, byte [edi + 0xa]
shl eax, 8
or eax, ecx
movzx ecx, byte [edi + 8]
xor eax, dword [ebp + 0xc]
mov dword [esp + 0x28], ecx
mov ebp, dword [esp + 0x28]
movzx ecx, byte [edi + 0xb]
shl ebp, 8
or ebp, esi
shl ebp, 8
or ebp, edx
mov dword [esp + 0x28], ebp
mov edx, ebp
mov ebp, dword [esp + 0x1c]
shl edx, 8
or edx, ecx
movzx ecx, byte [edi + 0xd]
xor edx, dword [ebp + 0x10]
mov dword [esp + 0x28], edx
movzx edx, byte [edi + 0xc]
shl edx, 8
or edx, ecx
movzx ecx, byte [edi + 0xe]
shl edx, 8
or edx, ecx
movzx ecx, byte [edi + 0xf]
mov edi, dword [ebp + 0x3d0]
shl edx, 8
or edx, ecx
mov dword [esp + 0x20], edi
xor edx, dword [ebp + 0x14]
mov dword [esp + 0x10], edx
cmp edi, 1
jle 0x40ee77
lea esi, [ebp + 0x30]
lea ecx, [edi - 1]
mov dword [esp + 0x14], esi
mov dword [esp + 0x18], ecx
mov ecx, edx
mov ebp, dword [esp + 0x14]
sar ecx, 8
movzx edx, cl
mov ecx, dword [esp + 0x28]
sar ecx, 0x10
movzx ecx, cl
mov edi, dword [edx*4 + 0x45e438]
xor edi, dword [ecx*4 + 0x45e038]
mov ecx, eax
sar ecx, 0x18
movzx ecx, cl
xor edi, dword [ecx*4 + 0x45dc38]
movzx ecx, bl
xor edi, dword [ecx*4 + 0x45e838]
mov ecx, dword [esp + 0x10]
xor edi, dword [esi - 4]
sar ecx, 0x10
movzx edx, cl
mov ecx, dword [esp + 0x28]
sar ecx, 0x18
movzx ecx, cl
mov esi, dword [edx*4 + 0x45e038]
xor esi, dword [ecx*4 + 0x45dc38]
mov ecx, ebx
sar ecx, 8
movzx ecx, cl
xor esi, dword [ecx*4 + 0x45e438]
movzx ecx, al
xor esi, dword [ecx*4 + 0x45e838]
mov ecx, dword [esp + 0x10]
sar ecx, 0x18
movzx edx, cl
mov ecx, eax
sar ecx, 8
movzx ecx, cl
xor esi, dword [ebp]
mov edx, dword [edx*4 + 0x45dc38]
sar eax, 0x10
xor edx, dword [ecx*4 + 0x45e438]
mov ecx, ebx
sar ecx, 0x10
movzx ecx, cl
movzx eax, al
sar ebx, 0x18
xor edx, dword [ecx*4 + 0x45e038]
mov ecx, dword [esp + 0x28]
movzx ecx, cl
xor edx, dword [ecx*4 + 0x45e838]
mov ecx, dword [esp + 0x28]
xor edx, dword [ebp + 4]
sar ecx, 8
movzx ecx, cl
mov dword [esp + 0x28], esi
mov ecx, dword [ecx*4 + 0x45e438]
xor ecx, dword [eax*4 + 0x45e038]
movzx eax, bl
xor ecx, dword [eax*4 + 0x45dc38]
mov eax, dword [esp + 0x10]
movzx eax, al
mov dword [esp + 0x10], edx
xor ecx, dword [eax*4 + 0x45e838]
mov eax, edi
xor ecx, dword [ebp - 8]
add ebp, 0x20
sub dword [esp + 0x18], 1
mov ebx, ecx
mov dword [esp + 0x14], ebp
mov esi, ebp
jne 0x40ed51
mov ebp, dword [esp + 0x1c]
mov edi, dword [esp + 0x20]
mov dword [esp + 0x14], ebx
mov esi, dword [esp + 0x2c]
mov ecx, dword [esp + 0x14]
sar ecx, 0x18
movzx ecx, cl
shl edi, 5
mov ebx, dword [edi + ebp + 8]
mov edx, ebx
sar edx, 0x18
xor dl, byte [ecx + str.cw]
mov ecx, eax
sar ecx, 0x10
movzx ecx, cl
mov byte [esi], dl
mov edx, ebx
sar edx, 0x10
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x28]
sar ecx, 8
movzx ecx, cl
mov byte [esi + 1], dl
mov edx, ebx
sar edx, 8
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x10]
movzx ecx, cl
mov byte [esi + 2], dl
movzx ecx, byte [ecx + str.cw]
xor cl, bl
mov byte [esi + 3], cl
mov ecx, eax
mov ebx, dword [edi + ebp + 0xc]
mov edx, ebx
sar ecx, 0x18
movzx ecx, cl
sar edx, 0x18
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x28]
sar ecx, 0x10
movzx ecx, cl
mov byte [esi + 4], dl
mov edx, ebx
sar edx, 0x10
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x10]
sar ecx, 8
movzx ecx, cl
mov byte [esi + 5], dl
mov edx, ebx
sar edx, 8
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x14]
movzx ecx, cl
mov byte [esi + 6], dl
movzx ecx, byte [ecx + str.cw]
xor cl, bl
mov byte [esi + 7], cl
mov ebx, dword [edi + ebp + 0x10]
mov edx, ebx
mov ecx, dword [esp + 0x28]
sar ecx, 0x18
movzx ecx, cl
sar edx, 0x18
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x10]
sar ecx, 0x10
movzx ecx, cl
mov byte [esi + 8], dl
mov edx, ebx
sar edx, 0x10
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x14]
sar ecx, 8
movzx ecx, cl
mov byte [esi + 9], dl
mov edx, ebx
sar edx, 8
xor dl, byte [ecx + str.cw]
movzx ecx, al
mov byte [esi + 0xa], dl
movzx ecx, byte [ecx + str.cw]
xor cl, bl
mov byte [esi + 0xb], cl
mov ebx, dword [edi + ebp + 0x14]
mov edx, ebx
mov ecx, dword [esp + 0x10]
sar ecx, 0x18
movzx ecx, cl
sar edx, 0x18
sar eax, 8
movzx eax, al
xor dl, byte [ecx + str.cw]
mov ecx, dword [esp + 0x14]
sar ecx, 0x10
mov byte [esi + 0xc], dl
mov edx, ebx
movzx ecx, cl
sar edx, 0x10
pop edi
xor dl, byte [ecx + str.cw]
mov ecx, ebx
sar ecx, 8
xor cl, byte [eax + str.cw]
mov eax, dword [esp + 0x24]
movzx eax, al
mov byte [esi + 0xd], dl
mov byte [esi + 0xe], cl
mov al, byte [eax + str.cw]
xor al, bl
mov byte [esi + 0xf], al
pop esi
pop ebx
pop ebp
add esp, 0x14
ret 8