Function at 0x40c240
Capabilities:
Encrypt data using aes
Reference aes constants

Disassembly:
sub esp, 0x14
push esi
push edi
mov edi, dword [esp + 0x34]
cmp edi, 0x10
je 0x40c258
cmp edi, 0x18
je 0x40c258
cmp edi, 0x20
jne 0x40c273
mov esi, dword [esp + 0x30]
cmp esi, 0x10
je 0x40c26b
cmp esi, 0x18
je 0x40c26b
cmp esi, 0x20
jne 0x40c273
mov eax, dword [esp + 0x28]
test eax, eax
je 0x40c27e
pop edi
mov eax, 0x80000003
pop esi
add esp, 0x14
ret
mov eax, edi
cdq
and edx, 3
add eax, edx
mov ecx, eax
mov eax, esi
cdq
and edx, 3
push ebx
add eax, edx
sar ecx, 2
mov ebx, eax
sar ebx, 2
cmp ecx, ebx
push ebp
mov dword [esp + 0x20], ecx
mov dword [esp + 0x14], ebx
mov ebp, ecx
jg 0x40c2aa
mov ebp, ebx
mov eax, dword [esp + 0x2c]
add ebp, 7
imul ebp, ecx
mov ecx, dword [esp + 0x28]
push 0x3d0
push 0x38
push eax
push ecx
mov dword [esp + 0x2c], ebp
call fcn.0040aca0
mov esi, eax
xor eax, eax
add esp, 0x10
cmp esi, eax
jne 0x40c2e2
pop ebp
pop ebx
pop edi
mov eax, 0x80000006
pop esi
add esp, 0x14
ret
mov dword [esi + 0x3c8], eax
mov dword [esi + 0x3cc], eax
mov dword [esi], edi
add esi, 4
mov dword [esi], ebp
add esi, 4
cmp ebx, eax
jle 0x40c329
mov edx, dword [esp + 0x34]
mov ecx, esi
sub edx, esi
mov edi, ebx
mov dword [esp + 0x18], ebx
lea ebx, [ebx]
mov eax, dword [edx + ecx]
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x3c]
bswap eax
mov dword [ecx], eax
add ecx, 4
dec edi
jne 0x40c310
mov eax, dword [esp + 0x18]
cmp ebx, ebp
mov ecx, dword [esi + eax*4 - 4]
mov dword [esp + 0x3c], ecx
mov edi, ebx
jge 0x40c423
mov dword [esp + 0x10], 0
mov dword [esp + 0x18], esi
mov eax, edi
cdq
idiv ebx
test edx, edx
jne 0x40c3ab
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x10]
shr edx, 0x10
movzx edx, dl
movzx ebx, byte [edx + str.cw]
cdq
idiv dword [esp + 0x14]
movzx edx, ch
movzx eax, byte [eax + 0x41a090]
xor ebx, eax
movzx eax, byte [edx + str.cw]
shl ebx, 8
mov edx, ecx
xor ebx, eax
and edx, 0xff
movzx eax, byte [edx + str.cw]
shl ebx, 8
shr ecx, 0x18
movzx ecx, byte [ecx + str.cw]
xor ebx, eax
shl ebx, 8
xor ecx, ebx
mov ebx, dword [esp + 0x14]
jmp 0x40c3fd
cmp ebx, 6
jle 0x40c3fd
cmp edx, 4
jne 0x40c3fd
movzx edx, byte [esp + 0x3e]
movzx eax, byte [edx + str.cw]
mov ebp, dword [esp + 0x1c]
mov edx, ecx
shr edx, 0x18
mov dword [esp + 0x3c], ebx
xor ebx, ebx
mov bh, byte [edx + str.cw]
movzx edx, ch
movzx edx, byte [edx + str.cw]
xor eax, ebx
mov ebx, dword [esp + 0x3c]
shl eax, 8
and ecx, 0xff
movzx ecx, byte [ecx + str.cw]
xor eax, edx
shl eax, 8
xor ecx, eax
mov eax, dword [esp + 0x18]
xor ecx, dword [eax]
mov edx, dword [esp + 0x10]
mov dword [esi + edi*4], ecx
inc edi
inc edx
add eax, 4
cmp edi, ebp
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x10], edx
mov dword [esp + 0x18], eax
jl 0x40c347
xor edx, edx
dec edi
js 0x40c49e
lea ebx, [esi + ebp*4]
jmp 0x40c430
mov eax, dword [esp + 0x20]
cmp edx, eax
mov ecx, dword [esi + edi*4]
mov dword [esp + 0x3c], ecx
jl 0x40c493
cmp edi, eax
jl 0x40c493
mov eax, ecx
shr eax, 0x10
movzx eax, al
movzx eax, byte [eax + str.cw]
mov eax, dword [eax*4 + 0x41b6b0]
movzx ebp, ch
movzx ebp, byte [ebp + str.cw]
xor eax, dword [ebp*4 + 0x41bab0]
mov ebp, ecx
shr ebp, 0x18
movzx ebp, byte [ebp + str.cw]
xor eax, dword [ebp*4 + 0x41b2b0]
and ecx, 0xff
movzx ecx, byte [ecx + str.cw]
xor eax, dword [ecx*4 + 0x41beb0]
jmp 0x40c495
mov eax, ecx
mov dword [ebx], eax
inc edx
add ebx, 4
dec edi
jns 0x40c430
pop ebp
pop ebx
pop edi
xor eax, eax
pop esi
add esp, 0x14
ret