Function at 0x417610
Capabilities:
Encode data using xor
Encrypt data using aes
Encrypt data using rc4 ksa
Reference aes constants

Disassembly:
mov edx, dword [esp + 4]
sub esp, 0xc
cmp dword [0x5a2220], 0
je 0x417381
movzx eax, byte [ecx + 1]
push ebx
inc ecx
push ebp
push esi
inc ecx
push edi
movzx edi, byte [ecx - 2]
shl eax, 0x10
inc ecx
shl edi, 0x18
or edi, eax
movzx eax, byte [ecx - 1]
shl eax, 8
or edi, eax
movzx eax, byte [ecx]
inc ecx
movzx esi, byte [ecx + 1]
inc ecx
or edi, eax
movzx eax, byte [ecx - 1]
shl esi, 0x10
inc ecx
shl eax, 0x18
or eax, esi
movzx esi, byte [ecx]
inc ecx
shl esi, 8
or eax, esi
movzx esi, byte [ecx]
inc ecx
movzx ebx, byte [ecx + 1]
or eax, esi
movzx esi, byte [ecx]
inc ecx
shl ebx, 0x10
inc ecx
shl esi, 0x18
or esi, ebx
movzx ebx, byte [ecx]
shl ebx, 8
inc ecx
xor edi, dword [0x5a0898]
xor eax, dword [0x5a089c]
or esi, ebx
movzx ebx, byte [ecx]
inc ecx
movzx ebp, byte [ecx + 1]
or esi, ebx
movzx ebx, byte [ecx]
xor esi, dword [0x5a08a0]
inc ecx
shl ebp, 0x10
inc ecx
shl ebx, 0x18
or ebx, ebp
movzx ebp, byte [ecx]
movzx ecx, byte [ecx + 1]
shl ebp, 8
or ebp, ecx
mov ecx, dword [0x5a222c]
or ebp, ebx
xor ebp, dword [0x5a08a4]
cmp ecx, 1
jle 0x4171d0
mov ebx, 0x5a08c0
dec ecx
mov dword [esp + 0x10], ebx
mov dword [esp + 0x14], ecx
nop
mov edx, ebp
sar edx, 8
and edx, 0xff
mov ecx, eax
sar ecx, 0x18
and ecx, 0xff
mov dword [esp + 0x18], ecx
mov ecx, dword [edx*4 + 0x56dc88]
mov edx, dword [esp + 0x18]
xor ecx, dword [edx*4 + 0x56d488]
mov edx, edi
sar edx, 0x10
and edx, 0xff
xor ecx, dword [edx*4 + 0x56d888]
mov edx, esi
and edx, 0xff
xor ecx, dword [edx*4 + 0x56e088]
mov edx, esi
xor ecx, dword [ebx - 4]
sar edx, 0x18
and edx, 0xff
mov edx, dword [edx*4 + 0x56d488]
mov ebx, eax
sar ebx, 0x10
and ebx, 0xff
xor edx, dword [ebx*4 + 0x56d888]
mov ebx, edi
sar ebx, 8
and ebx, 0xff
xor edx, dword [ebx*4 + 0x56dc88]
mov ebx, ebp
and ebx, 0xff
xor edx, dword [ebx*4 + 0x56e088]
mov ebx, dword [esp + 0x10]
xor edx, dword [ebx]
mov ebx, esi
mov dword [esp + 0x18], edx
mov edx, ebp
sar edx, 0x18
sar ebx, 0x10
and ebx, 0xff
and edx, 0xff
mov edx, dword [edx*4 + 0x56d488]
xor edx, dword [ebx*4 + 0x56d888]
sar ebp, 0x10
mov ebx, eax
sar ebx, 8
and ebx, 0xff
xor edx, dword [ebx*4 + 0x56dc88]
and ebp, 0xff
mov ebp, dword [ebp*4 + 0x56d888]
sar esi, 8
mov ebx, edi
and esi, 0xff
xor ebp, dword [esi*4 + 0x56dc88]
mov esi, dword [esp + 0x18]
sar edi, 0x18
and edi, 0xff
xor ebp, dword [edi*4 + 0x56d488]
and ebx, 0xff
xor edx, dword [ebx*4 + 0x56e088]
mov ebx, dword [esp + 0x10]
xor edx, dword [ebx + 4]
and eax, 0xff
xor ebp, dword [eax*4 + 0x56e088]
add ebx, 0x20
xor ebp, dword [ebx - 0x28]
sub dword [esp + 0x14], 1
mov edi, ebp
mov eax, ecx
mov ebp, edx
mov dword [esp + 0x10], ebx
jne 0x417080
mov edx, dword [esp + 0x20]
mov ecx, dword [0x5a222c]
shl ecx, 5
add ecx, 0x5a0898
mov dword [esp + 0x14], ecx
mov ecx, dword [ecx]
mov dword [esp + 0x10], ecx
sar ecx, 0x18
mov ebx, edi
sar ebx, 0x18
and ebx, 0xff
xor cl, byte [ebx + 0x56c388]
mov ebx, dword [esp + 0x10]
mov byte [edx], cl
sar ebx, 0x10
mov ecx, ebp
sar ecx, 0x10
and ecx, 0xff
xor bl, byte [ecx + 0x56c388]
mov ecx, esi
sar ecx, 8
mov byte [edx + 1], bl
mov ebx, dword [esp + 0x10]
and ecx, 0xff
sar ebx, 8
xor bl, byte [ecx + 0x56c388]
mov ecx, eax
and ecx, 0xff
mov byte [edx + 2], bl
movzx ecx, byte [ecx + 0x56c388]
xor cl, byte [esp + 0x10]
mov ebx, eax
mov byte [edx + 3], cl
mov ecx, dword [esp + 0x14]
mov ecx, dword [ecx + 4]
mov dword [esp + 0x10], ecx
sar ecx, 0x18
sar ebx, 0x18
and ebx, 0xff
xor cl, byte [ebx + 0x56c388]
mov ebx, dword [esp + 0x10]
mov byte [edx + 4], cl
sar ebx, 0x10
mov ecx, edi
sar ecx, 0x10
and ecx, 0xff
xor bl, byte [ecx + 0x56c388]
mov ecx, ebp
mov byte [edx + 5], bl
mov ebx, dword [esp + 0x10]
sar ecx, 8
and ecx, 0xff
sar ebx, 8
xor bl, byte [ecx + 0x56c388]
mov ecx, esi
and ecx, 0xff
mov byte [edx + 6], bl
movzx ecx, byte [ecx + 0x56c388]
xor cl, byte [esp + 0x10]
mov ebx, esi
mov byte [edx + 7], cl
mov ecx, dword [esp + 0x14]
mov ecx, dword [ecx + 8]
mov dword [esp + 0x10], ecx
sar ebx, 0x18
sar ecx, 0x18
and ebx, 0xff
xor cl, byte [ebx + 0x56c388]
mov ebx, dword [esp + 0x10]
mov byte [edx + 8], cl
mov ecx, eax
sar ecx, 0x10
and ecx, 0xff
sar ebx, 0x10
xor bl, byte [ecx + 0x56c388]
mov ecx, edi
mov byte [edx + 9], bl
mov ebx, dword [esp + 0x10]
sar ecx, 8
and ecx, 0xff
sar ebx, 8
xor bl, byte [ecx + 0x56c388]
mov byte [edx + 0xa], bl
mov ecx, ebp
and ecx, 0xff
movzx ecx, byte [ecx + 0x56c388]
xor cl, byte [esp + 0x10]
sar ebp, 0x18
mov byte [edx + 0xb], cl
mov ecx, dword [esp + 0x14]
mov ecx, dword [ecx + 0xc]
and ebp, 0xff
mov ebx, ecx
sar ebx, 0x18
xor bl, byte [ebp + 0x56c388]
sar esi, 0x10
mov byte [edx + 0xc], bl
and esi, 0xff
mov ebx, ecx
sar ebx, 0x10
xor bl, byte [esi + 0x56c388]
sar eax, 8
mov byte [edx + 0xd], bl
and eax, 0xff
mov ebx, ecx
sar ebx, 8
xor bl, byte [eax + 0x56c388]
and edi, 0xff
mov byte [edx + 0xe], bl
mov al, byte [edi + 0x56c388]
pop edi
pop esi
xor al, cl
pop ebp
mov byte [edx + 0xf], al
pop ebx
add esp, 0xc
ret
sub esp, 0x20
cmp dword [0x5a2220], 0
je 0x41788a
mov eax, dword [0x5a2228]
cmp eax, 0x10
jne 0x417632
add esp, 0x20
jmp 0x416fb0
cdq
and edx, 3
add eax, edx
push esi
mov esi, eax
sar esi, 2
xor eax, eax
cmp esi, 4
je 0x41764c
cmp esi, 6
setne al
inc eax
push ebx
shl eax, 5
mov edx, dword [eax + 0x56f4b4]
push ebp
push edi
mov edi, dword [eax + 0x56f4bc]
mov eax, dword [eax + 0x56f4c4]
xor ebx, ebx
mov dword [esp + 0x20], eax
mov dword [esp + 0x1c], edx
mov dword [esp + 0x14], edi
mov eax, 0x5a0a78
test esi, esi
jle 0x4176bb
jmp 0x417680
movzx edi, byte [ecx]
shl edi, 0x18
mov dword [eax], edi
movzx edi, byte [ecx + 1]
inc ecx
shl edi, 0x10
or dword [eax], edi
movzx edi, byte [ecx + 1]
inc ecx
shl edi, 8
or dword [eax], edi
movzx ebp, byte [ecx + 1]
or dword [eax], ebp
mov ebp, dword [ebx*4 + 0x5a0898]
inc ecx
mov edi, eax
xor dword [edi], ebp
inc ebx
inc ecx
add eax, 4
cmp ebx, esi
jl 0x417680
mov edi, dword [esp + 0x14]
mov ebx, dword [0x5a222c]
cmp ebx, 1
jle 0x4177be
lea ecx, [ebx - 1]
mov dword [esp + 0x10], 0x5a08b8
mov dword [esp + 0x18], ecx
lea esp, [esp]
xor edi, edi
test esi, esi
jle 0x41778c
mov eax, dword [esp + 0x14]
mov ebp, dword [esp + 0x20]
mov ebx, dword [esp + 0x10]
sub eax, edx
sub ebp, edx
mov ecx, edx
mov dword [esp + 0x24], eax
mov dword [esp + 0x28], ebp
jmp 0x41770e
mov eax, dword [esp + 0x24]
mov ebp, dword [esp + 0x28]
add eax, ecx
cdq
idiv esi
inc edi
add ebx, 4
mov eax, dword [edx*4 + 0x5a0a78]
sar eax, 8
and eax, 0xff
mov dword [esp + 0x2c], eax
lea eax, [ecx + ebp]
cdq
idiv esi
mov eax, dword [esp + 0x2c]
mov ebp, dword [eax*4 + 0x56dc88]
mov eax, ecx
inc ecx
mov edx, dword [edx*4 + 0x5a0a78]
and edx, 0xff
xor ebp, dword [edx*4 + 0x56e088]
cdq
idiv esi
movsx eax, word [edx*4 + 0x5a0a7a]
movzx edx, byte [edi*4 + 0x5a0a77]
and eax, 0xff
xor ebp, dword [eax*4 + 0x56d888]
xor ebp, dword [edx*4 + 0x56d488]
xor ebp, dword [ebx - 4]
cmp edi, esi
mov dword [edi*4 + 0x5a0c94], ebp
jl 0x417706
mov ebx, dword [0x5a222c]
lea eax, [esi*4]
push eax
push 0x5a0c98
push 0x5a0a78
call fcn.004f8140
add dword [esp + 0x1c], 0x20
mov edx, dword [esp + 0x28]
add esp, 0xc
sub dword [esp + 0x18], 1
jne 0x4176e0
mov edi, dword [esp + 0x14]
xor ebp, ebp
test esi, esi
jle 0x417886
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x34]
shl ebx, 5
add ebx, 0x5a0898
sub edx, edi
sub eax, edi
mov dword [esp + 0x14], ebx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x28], eax
lea esp, [esp]
mov eax, dword [esp + 0x14]
mov ebx, dword [eax]
movzx edx, byte [ebp*4 + 0x5a0a7b]
mov eax, ebx
sar eax, 0x18
xor al, byte [edx + 0x56c388]
mov edx, dword [esp + 0x2c]
mov byte [ecx], al
lea eax, [edx + edi]
cdq
idiv esi
inc ecx
inc ecx
add dword [esp + 0x14], 4
inc ecx
inc ebp
inc ecx
movsx eax, word [edx*4 + 0x5a0a7a]
and eax, 0xff
mov edx, ebx
sar edx, 0x10
xor dl, byte [eax + 0x56c388]
mov eax, edi
mov byte [ecx - 3], dl
cdq
idiv esi
mov eax, dword [edx*4 + 0x5a0a78]
sar eax, 8
and eax, 0xff
mov edx, ebx
sar edx, 8
xor dl, byte [eax + 0x56c388]
mov eax, dword [esp + 0x28]
mov byte [ecx - 2], dl
add eax, edi
cdq
idiv esi
inc edi
mov edx, dword [edx*4 + 0x5a0a78]
and edx, 0xff
mov al, byte [edx + 0x56c388]
xor al, bl
cmp ebp, esi
mov byte [ecx - 1], al
jl 0x4177f0
pop edi
pop ebp
pop ebx
pop esi
add esp, 0x20
ret