Function at 0x10018c30
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
mov dword [ebp - 0x24], ecx
xor eax, eax
cmp dword [ebp + 0x10], 4
mov ecx, dword [ebp + 0xc]
push esi
mov esi, ecx
mov dword [ebp - 0x18], edx
mov dword [ebp - 8], esi
mov dword [ebp - 4], eax
mov dword [ebp - 0x20], eax
jb 0x10018ec1
mov edx, dword [ecx]
push edi
mov edi, edx
and edi, 0xf
add edi, 5
mov dword [ebp - 0xc], edi
cmp edi, 0xf
jbe 0x10018c75
pop edi
mov eax, 0xffffffd4
pop esi
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 8]
shr edx, 4
push ebx
mov ebx, 4
mov dword [eax], edi
mov edi, 1
mov eax, dword [ebp - 0xc]
mov ecx, eax
shl edi, cl
inc eax
mov dword [ebp - 0xc], eax
mov dword [ebp - 0x10], edi
lea ecx, [edi + 1]
mov eax, ecx
mov dword [ebp - 0x14], ecx
cmp eax, 1
jle 0x10018e98
mov edi, dword [ebp - 0x18]
mov ecx, dword [ebp - 4]
cmp ecx, dword [edi]
mov edi, dword [ebp - 0x10]
ja 0x10018e7d
cmp dword [ebp - 0x20], 0
je 0x10018d96
mov edi, ecx
cmp dx, 0xffff
jne 0x10018d00
mov eax, dword [ebp + 0x10]
add eax, 0xfffffffb
add eax, dword [ebp + 0xc]
mov dword [ebp - 0x20], eax
add edi, 0x18
cmp esi, eax
jae 0x10018cea
mov edx, dword [esi + 2]
add esi, 2
mov ecx, ebx
shr edx, cl
jmp 0x10018cf0
shr edx, 0x10
add ebx, 0x10
mov eax, dword [ebp - 0x20]
cmp dx, 0xffff
je 0x10018cd7
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], esi
mov eax, edx
and eax, 3
cmp al, 3
jne 0x10018d22
nop dword [eax]
shr edx, 2
add edi, 3
mov eax, edx
add ebx, 2
and eax, 3
cmp al, 3
je 0x10018d10
mov eax, edx
add ebx, 2
and eax, 3
add edi, eax
mov eax, dword [ebp - 0x18]
cmp edi, dword [eax]
ja 0x10018e8c
cmp ecx, edi
jae 0x10018d59
mov esi, ecx
xor eax, eax
mov ecx, edi
sub ecx, dword [ebp - 4]
mov dword [ebp - 4], edi
mov edi, dword [ebp - 0x24]
shr ecx, 1
lea edi, [edi + esi*2]
mov esi, dword [ebp - 8]
rep stosd dword es:[edi], eax
adc ecx, ecx
rep stosw word es:[edi], ax
mov eax, dword [ebp + 0x10]
mov edi, dword [ebp + 0xc]
add eax, 0xfffffff9
add eax, edi
cmp esi, eax
jbe 0x10018d80
mov eax, dword [ebp + 0x10]
mov ecx, ebx
sar ecx, 3
add eax, 0xfffffffc
add ecx, esi
add eax, edi
cmp ecx, eax
jbe 0x10018d80
shr edx, 2
jmp 0x10018d93
mov eax, ebx
and ebx, 7
sar eax, 3
mov ecx, ebx
add esi, eax
mov dword [ebp - 8], esi
mov edx, dword [esi]
shr edx, cl
mov edi, dword [ebp - 0x10]
add ebx, dword [ebp - 0xc]
lea ecx, [edi - 1]
movzx eax, di
and ecx, edx
mov dword [ebp - 0x28], eax
add eax, eax
mov dword [ebp - 0x2c], eax
sub eax, dword [ebp - 0x14]
dec eax
movzx eax, ax
mov dword [ebp - 0x20], eax
movzx eax, dx
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0x20]
cwde
cmp ecx, eax
jae 0x10018dce
mov eax, dword [ebp - 0x28]
dec eax
and eax, dword [ebp - 0x1c]
dec ebx
movzx ecx, ax
jmp 0x10018def
mov esi, dword [ebp - 0x2c]
dec esi
and esi, dword [ebp - 0x1c]
movzx eax, si
movsx edx, ax
sub eax, dword [ebp - 0x20]
cmp edx, edi
movzx ecx, ax
movzx eax, si
mov esi, dword [ebp - 8]
cmovl ecx, eax
movzx ecx, cx
mov edi, dword [ebp - 0x24]
dec ecx
movsx eax, cx
cdq
xor eax, edx
sub eax, edx
mov edx, dword [ebp - 0x14]
cwde
sub edx, eax
mov eax, dword [ebp - 4]
mov dword [ebp - 0x14], edx
mov word [edi + eax*2], cx
inc eax
mov edi, dword [ebp - 0x10]
mov dword [ebp - 4], eax
xor eax, eax
test cx, cx
sete al
mov dword [ebp - 0x20], eax
cmp edx, edi
jge 0x10018e31
mov eax, dword [ebp - 0xc]
sar edi, 1
dec eax
cmp edx, edi
jl 0x10018e24
mov dword [ebp - 0xc], eax
mov dword [ebp - 0x10], edi
mov edx, dword [ebp + 0xc]
add edx, dword [ebp + 0x10]
lea eax, [edx - 7]
cmp esi, eax
jbe 0x10018e58
mov eax, ebx
lea ecx, [edx - 4]
sar eax, 3
add eax, esi
cmp eax, ecx
jbe 0x10018e58
sub esi, edx
lea ebx, [ebx + esi*8]
mov esi, ecx
add ebx, 0x20
jmp 0x10018e62
mov eax, ebx
sar eax, 3
add esi, eax
and ebx, 7
mov edx, dword [esi]
mov ecx, ebx
mov eax, dword [ebp - 0x14]
and ecx, 0x1f
shr edx, cl
mov dword [ebp - 8], esi
cmp eax, 1
jg 0x10018ca7
mov ecx, dword [ebp - 4]
cmp eax, 1
je 0x10018e9c
pop ebx
pop edi
or eax, 0xffffffff
pop esi
mov esp, ebp
pop ebp
ret
pop ebx
pop edi
mov eax, 0xffffffd0
pop esi
mov esp, ebp
pop ebp
ret
xor ecx, ecx
jmp 0x10018e7d
lea eax, [ecx - 1]
mov ecx, dword [ebp - 0x18]
mov dword [ecx], eax
lea eax, [ebx + 7]
sar eax, 3
mov ecx, 0xffffffb8
sub eax, dword [ebp + 0xc]
add eax, esi
cmp eax, dword [ebp + 0x10]
pop ebx
pop edi
cmova eax, ecx
pop esi
mov esp, ebp
pop ebp
ret
mov eax, 0xffffffb8
pop esi
mov esp, ebp
pop ebp
ret