Function at 0x40e714
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffff6a4
push ebx
push esi
push edi
mov esi, dword [ebp + 0x14]
cmp dword [ebp + 0x1c], 4
mov dword [ebp - 4], 0x10000
lea eax, [esi + 0x40000]
mov dword [ebp - 0x54], eax
mov edx, dword [ebp - 0x54]
xor ecx, ecx
mov dword [edx], ecx
dec dword [ebp - 4]
add dword [ebp - 0x54], 0xfffffffc
cmp dword [ebp - 4], 0
jge 0x40e737
mov eax, dword [ebp + 0xc]
mov dx, word [eax]
mov dword [ebp - 4], 1
mov ecx, dword [ebp + 0xc]
lea eax, [ecx + 2]
mov ecx, dword [ebp + 0x10]
add ecx, 2
mov dword [ebp - 0x54], ecx
mov ecx, dword [ebp - 4]
cmp ecx, dword [ebp + 0x18]
jge 0x40e799
mov ecx, dword [ebp - 0x54]
shl edx, 8
mov word [ecx], 0
or dx, word [eax]
movzx ecx, dx
mov word [eax - 2], dx
add eax, 2
inc dword [esi + ecx*4]
inc dword [ebp - 4]
add dword [ebp - 0x54], 2
mov ecx, dword [ebp - 4]
cmp ecx, dword [ebp + 0x18]
jl 0x40e76f
mov eax, dword [ebp + 0x10]
shl edx, 8
mov word [eax], 0
mov eax, dword [ebp + 0xc]
movzx ecx, word [eax]
sar ecx, 8
mov eax, dword [ebp + 0xc]
or dx, cx
mov ecx, dword [ebp + 0x18]
mov word [eax + ecx*2 - 2], dx
movzx edx, dx
inc dword [esi + edx*4]
xor eax, eax
mov dword [ebp - 4], eax
mov edx, dword [ebp + 0xc]
mov eax, edx
mov edx, dword [ebp + 0x18]
add edx, dword [ebp - 4]
mov ecx, dword [ebp + 0xc]
mov bx, word [eax]
mov word [ecx + edx*2], bx
mov edx, dword [ebp + 0x18]
add edx, dword [ebp - 4]
mov ecx, dword [ebp + 0x10]
mov word [ecx + edx*2], 0
inc dword [ebp - 4]
add eax, 2
cmp dword [ebp - 4], 0x22
jl 0x40e7cb
cmp dword [ebp + 0x1c], 4
mov dword [ebp - 4], 1
mov eax, esi
mov edx, dword [eax]
add dword [eax + 4], edx
inc dword [ebp - 4]
add eax, 4
cmp dword [ebp - 4], 0x10000
jle 0x40e803
xor eax, eax
mov dword [ebp - 4], eax
mov ecx, dword [ebp + 0xc]
mov eax, ecx
mov edx, dword [ebp - 4]
cmp edx, dword [ebp + 0x18]
jge 0x40e850
mov dx, word [eax]
movzx ecx, dx
movzx edx, dx
mov ebx, dword [esi + ecx*4]
add eax, 2
dec ebx
mov dword [esi + edx*4], ebx
mov ecx, dword [ebp + 8]
mov edx, dword [ebp - 4]
mov dword [ecx + ebx*4], edx
inc dword [ebp - 4]
mov ecx, dword [ebp - 4]
cmp ecx, dword [ebp + 0x18]
jl 0x40e829
xor eax, eax
mov dword [ebp - 4], eax
lea eax, [ebp - 0x45c]
mov dword [ebp - 0x54], eax
lea eax, [ebp - 0x95c]
mov byte [eax], 0
inc eax
mov edx, dword [ebp - 0x54]
mov ecx, dword [ebp - 4]
mov dword [edx], ecx
inc dword [ebp - 4]
add dword [ebp - 0x54], 4
cmp dword [ebp - 4], 0xff
jle 0x40e864
mov ecx, 1
lea eax, [ecx + ecx*2]
inc eax
mov ecx, eax
cmp ecx, 0x100
jle 0x40e885
mov eax, ecx
mov ecx, 3
cdq
idiv ecx
mov ecx, eax
mov dword [ebp - 4], ecx
mov eax, dword [ebp - 4]
lea edx, [ebp + eax*4 - 0x45c]
mov dword [ebp - 0x54], edx
cmp dword [ebp - 4], 0xff
jg 0x40e944
mov eax, dword [ebp - 0x54]
mov edx, dword [eax]
mov dword [ebp - 0x1c], edx
mov ebx, dword [ebp - 4]
mov eax, dword [ebp - 0x1c]
shl eax, 7
lea edx, [esi + eax*8]
mov dword [ebp - 0x58], edx
jmp 0x40e8f0
mov eax, ebx
sub eax, ecx
mov edx, dword [ebp + eax*4 - 0x45c]
lea eax, [ecx - 1]
mov dword [ebp + ebx*4 - 0x45c], edx
sub ebx, ecx
cmp ebx, eax
jle 0x40e926
mov edx, ebx
mov edi, dword [ebp - 0x58]
sub edx, ecx
mov eax, dword [ebp + edx*4 - 0x45c]
inc eax
shl eax, 8
mov edx, dword [esi + eax*4]
mov eax, ebx
sub eax, ecx
mov eax, dword [ebp + eax*4 - 0x45c]
shl eax, 8
sub edx, dword [esi + eax*4]
mov eax, dword [ebp - 0x1c]
inc eax
shl eax, 8
mov eax, dword [esi + eax*4]
sub eax, dword [edi]
cmp edx, eax
ja 0x40e8d5
mov eax, dword [ebp - 0x1c]
mov dword [ebp + ebx*4 - 0x45c], eax
inc dword [ebp - 4]
add dword [ebp - 0x54], 4
cmp dword [ebp - 4], 0xff
jle 0x40e8bc
cmp ecx, 1
jne 0x40e893
xor edx, edx
xor eax, eax
mov dword [ebp - 0x14], edx
mov dword [ebp - 0x18], edx
mov dword [ebp - 4], eax
lea ecx, [ebp - 0x45c]
mov dword [ebp - 0x54], ecx
mov eax, dword [ebp - 0x54]
xor ebx, ebx
mov edx, dword [eax]
mov dword [ebp - 0x10], edx
cmp ebx, dword [ebp - 0x10]
je 0x40e9e9
mov edi, dword [ebp - 0x10]
shl edi, 8
add edi, ebx
mov eax, dword [esi + edi*4]
test eax, 0x200000
jne 0x40e9e2
and eax, 0xffdfffff
mov dword [ebp - 0x20], eax
mov edx, dword [esi + edi*4 + 4]
and edx, 0xffdfffff
dec edx
mov dword [ebp - 0x24], edx
mov ecx, dword [ebp - 0x24]
cmp ecx, dword [ebp - 0x20]
jle 0x40e9e2
cmp dword [ebp + 0x1c], 4
mov eax, dword [ebp + 0x20]
push eax
push 2
mov edx, dword [ebp - 0x24]
push edx
mov ecx, dword [ebp - 0x20]
push ecx
mov eax, dword [ebp + 0x18]
push eax
mov edx, dword [ebp + 0x10]
push edx
mov ecx, dword [ebp + 0xc]
push ecx
mov eax, dword [ebp + 8]
push eax
call fcn.0040e1f4
add esp, 0x20
mov edx, dword [ebp - 0x24]
sub edx, dword [ebp - 0x20]
inc edx
add dword [ebp - 0x14], edx
mov ecx, dword [ebp + 0x20]
cmp dword [ecx], 0
jl 0x40ec90
or dword [esi + edi*4], 0x200000
inc ebx
cmp ebx, 0xff
jle 0x40e96d
mov eax, dword [ebp - 0x10]
shl eax, 8
add eax, dword [ebp - 0x10]
mov dword [ebp - 0x38], eax
mov edx, dword [ebp - 0x38]
mov ecx, dword [esi + edx*4]
and ecx, 0xffdfffff
mov dword [ebp - 0x3c], ecx
mov eax, dword [ebp - 0x38]
mov edx, dword [esi + eax*4 + 4]
and edx, 0xffdfffff
dec edx
mov dword [ebp - 0x40], edx
mov cl, byte [ebp - 0x10]
mov byte [ebp - 0x41], cl
mov eax, dword [ebp - 0x3c]
mov dword [ebp - 0x28], eax
mov edx, dword [ebp - 0x10]
shl edx, 8
mov ecx, dword [esi + edx*4]
and ecx, 0xffdfffff
mov dword [ebp - 0x2c], ecx
mov eax, dword [ebp - 0x40]
mov dword [ebp - 0x30], eax
mov edx, dword [ebp - 0x10]
inc edx
shl edx, 8
mov ecx, dword [esi + edx*4]
and ecx, 0xffdfffff
dec ecx
mov dword [ebp - 0x34], ecx
mov eax, dword [ebp + 8]
mov edx, dword [ebp - 0x28]
lea ecx, [eax + edx*4]
mov dword [ebp - 0x5c], ecx
mov eax, dword [ebp + 8]
mov edx, dword [ebp - 0x2c]
lea eax, [eax + edx*4]
mov edx, dword [ebp - 0x2c]
cmp edx, dword [ebp - 0x28]
jge 0x40eaaa
mov ebx, dword [eax]
dec ebx
test ebx, ebx
jge 0x40ea81
add ebx, dword [ebp + 0x18]
mov edx, dword [ebp + 0xc]
movzx edx, word [edx + ebx*2]
sar edx, 8
cmp dl, byte [ebp - 0x41]
jne 0x40ea9c
mov ecx, dword [ebp - 0x5c]
mov dword [ecx], ebx
inc dword [ebp - 0x28]
add dword [ebp - 0x5c], 4
inc dword [ebp - 0x2c]
add eax, 4
mov edx, dword [ebp - 0x2c]
cmp edx, dword [ebp - 0x28]
jl 0x40ea77
mov eax, dword [ebp + 8]
mov ecx, dword [ebp - 0x30]
lea eax, [eax + ecx*4]
mov edx, dword [ebp + 8]
mov ecx, dword [ebp - 0x34]
lea edx, [edx + ecx*4]
mov dword [ebp - 0x5c], edx
mov ecx, dword [ebp - 0x34]
cmp ecx, dword [ebp - 0x30]
jle 0x40eafa
mov edx, dword [ebp - 0x5c]
mov ebx, dword [edx]
dec ebx
test ebx, ebx
jge 0x40ead4
add ebx, dword [ebp + 0x18]
mov edx, dword [ebp + 0xc]
movzx edx, word [edx + ebx*2]
sar edx, 8
cmp dl, byte [ebp - 0x41]
jne 0x40eaeb
mov dword [eax], ebx
dec dword [ebp - 0x30]
add eax, 0xfffffffc
dec dword [ebp - 0x34]
add dword [ebp - 0x5c], 0xfffffffc
mov ecx, dword [ebp - 0x34]
cmp ecx, dword [ebp - 0x30]
jg 0x40eac7
mov eax, dword [ebp - 0x38]
or dword [esi + eax*4], 0x200000
mov eax, dword [ebp - 0x10]
mov byte [ebp + eax - 0x95c], 1
cmp dword [ebp - 4], 0xff
jge 0x40ebb1
mov edx, dword [ebp - 0x10]
shl edx, 8
mov ecx, dword [esi + edx*4]
and ecx, 0xffdfffff
mov dword [ebp - 0x48], ecx
mov eax, dword [ebp - 0x10]
inc eax
shl eax, 8
mov edx, dword [esi + eax*4]
and edx, 0xffdfffff
sub edx, dword [ebp - 0x48]
mov dword [ebp - 0x4c], edx
xor edx, edx
jmp 0x40eb49
inc edx
mov ecx, edx
mov eax, dword [ebp - 0x4c]
sar eax, cl
cmp eax, 0xfffe
jg 0x40eb48
xor ebx, ebx
cmp ebx, dword [ebp - 0x4c]
jge 0x40eb97
mov eax, dword [ebp - 0x48]
mov ecx, dword [ebp + 8]
add eax, ebx
mov edi, ebx
mov eax, dword [ecx + eax*4]
mov ecx, edx
sar edi, cl
mov word [ebp - 0x4e], di
cmp eax, 0x22
mov di, word [ebp - 0x4e]
mov ecx, dword [ebp + 0x10]
mov word [ecx + eax*2], di
jge 0x40eb91
add eax, dword [ebp + 0x18]
mov ecx, dword [ebp + 0x10]
mov di, word [ebp - 0x4e]
mov word [ecx + eax*2], di
inc ebx
cmp ebx, dword [ebp - 0x4c]
jl 0x40eb5e
mov ecx, edx
mov eax, dword [ebp - 0x4c]
dec eax
sar eax, cl
cmp eax, 0xffff
jle 0x40ebb1
push 0x3ea
call fcn.0040d42c
pop ecx
xor ebx, ebx
lea eax, [ebp - 0x85c]
mov edx, ebx
inc ebx
shl edx, 8
add edx, dword [ebp - 0x10]
mov ecx, dword [esi + edx*4]
and ecx, 0xffdfffff
mov dword [eax], ecx
add eax, 4
cmp ebx, 0xff
jle 0x40ebb9
mov eax, dword [ebp - 0x10]
inc eax
shl eax, 8
mov edx, dword [esi + eax*4]
and edx, 0xffdfffff
mov dword [ebp - 0xc], edx
mov ecx, dword [ebp - 0x10]
shl ecx, 8
mov ebx, dword [esi + ecx*4]
and ebx, 0xffdfffff
mov eax, dword [ebp + 8]
lea eax, [eax + ebx*4]
cmp ebx, dword [ebp - 0xc]
jge 0x40ec5e
mov edx, dword [eax]
dec edx
mov dword [ebp - 8], edx
cmp dword [ebp - 8], 0
jge 0x40ec17
mov ecx, dword [ebp + 0x18]
add dword [ebp - 8], ecx
mov edx, dword [ebp + 0xc]
mov ecx, dword [ebp - 8]
movzx edx, word [edx + ecx*2]
sar edx, 8
xor ecx, ecx
mov cl, dl
cmp byte [ebp + ecx - 0x95c], 0
jne 0x40ec55
xor ecx, ecx
mov edi, dword [ebp + 8]
mov cl, dl
and edx, 0xff
mov ecx, dword [ebp + ecx*4 - 0x85c]
lea edi, [edi + ecx*4]
mov ecx, dword [ebp - 8]
mov dword [edi], ecx
inc dword [ebp + edx*4 - 0x85c]
inc ebx
add eax, 4
cmp ebx, dword [ebp - 0xc]
jl 0x40ec05
xor ebx, ebx
mov eax, ebx
shl eax, 8
add eax, dword [ebp - 0x10]
or dword [esi + eax*4], 0x200000
inc ebx
cmp ebx, 0xff
jle 0x40ec60
inc dword [ebp - 4]
add dword [ebp - 0x54], 4
cmp dword [ebp - 4], 0xff
jle 0x40e963
cmp dword [ebp + 0x1c], 4
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret