Function at 0x409590
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
mov eax, dword [ebp + 0x14]
mov ecx, dword [ebp + 0x18]
push ebx
xor ebx, ebx
lea edx, [eax + ecx]
mov dword [ebp - 0x10], edx
mov dword [ebp - 4], eax
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x20], ebx
cmp ecx, 4
jae 0x4095bd
mov eax, 0xffffffb8
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, dword [eax]
mov ecx, edx
and ecx, 0xf
add ecx, 5
cmp ecx, 0xf
jle 0x4095d6
mov eax, 0xffffffd4
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x10]
push esi
push edi
mov edi, 1
shl edi, cl
mov dword [eax], ecx
inc ecx
shr edx, 4
lea eax, [edi + 1]
mov esi, 4
mov dword [ebp - 0x14], eax
mov dword [ebp - 8], edi
mov dword [ebp - 0xc], ecx
cmp eax, 1
jle 0x4097bc
mov ecx, dword [ebp + 0xc]
mov eax, dword [ecx]
mov dword [ebp - 0x18], eax
lea ebx, [ebx]
cmp ebx, dword [ebp - 0x18]
ja 0x4097bc
cmp dword [ebp - 0x20], 0
je 0x4096ed
mov edi, ebx
cmp dx, 0xffff
jne 0x409659
mov eax, dword [ebp - 0x10]
add eax, 0xfffffffb
add edi, 0x18
cmp dword [ebp - 4], eax
jae 0x40964c
mov ecx, dword [ebp - 4]
mov edx, dword [ecx + 2]
add ecx, 2
mov dword [ebp - 4], ecx
mov ecx, esi
shr edx, cl
jmp 0x409652
shr edx, 0x10
add esi, 0x10
cmp dx, 0xffff
je 0x409632
mov eax, edx
and eax, 3
cmp al, 3
jne 0x409675
shr edx, 2
mov ecx, edx
and ecx, 3
add edi, 3
add esi, 2
cmp cl, 3
je 0x409662
mov eax, edx
and eax, 3
add edi, eax
add esi, 2
cmp edi, dword [ebp - 0x18]
ja 0x4097cc
cmp ebx, edi
jae 0x4096ba
mov ecx, dword [ebp + 8]
lea eax, [ecx + ebx*2]
sub edi, ebx
mov dword [ebp - 0x20], eax
xor eax, eax
movzx ebx, ax
mov ecx, edi
mov edi, dword [ebp - 0x20]
mov eax, ebx
shl ebx, 0x10
mov dword [ebp - 0x24], ecx
or eax, ebx
mov ebx, dword [ebp - 0x1c]
shr ecx, 1
rep stosd dword es:[edi], eax
adc ecx, ecx
add ebx, dword [ebp - 0x24]
rep stosw word es:[edi], ax
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 4]
lea edi, [eax - 7]
cmp ecx, edi
jbe 0x4096da
mov edi, esi
sar edi, 3
add edi, ecx
add eax, 0xfffffffc
cmp edi, eax
jbe 0x4096da
shr edx, 2
jmp 0x4096ed
mov edx, esi
sar edx, 3
add ecx, edx
mov edx, dword [ecx]
and esi, 7
mov dword [ebp - 4], ecx
mov ecx, esi
shr edx, cl
mov ecx, dword [ebp - 8]
mov edi, dword [ebp - 8]
add ecx, ecx
mov eax, ecx
sub eax, dword [ebp - 0x14]
dec edi
dec eax
movzx eax, ax
mov dword [ebp - 0x24], eax
cwde
and edi, edx
cmp edi, eax
jae 0x40971b
mov ecx, dword [ebp - 8]
dec ecx
and ecx, edx
mov edx, dword [ebp - 0xc]
movzx ecx, cx
lea esi, [esi + edx - 1]
jmp 0x40972f
dec ecx
and ecx, edx
movzx ecx, cx
movsx eax, cx
cmp eax, dword [ebp - 8]
jl 0x40972c
sub ecx, dword [ebp - 0x24]
add esi, dword [ebp - 0xc]
mov edi, dword [ebp - 0x14]
dec ecx
movsx eax, cx
cdq
xor eax, edx
sub eax, edx
movsx edx, ax
mov eax, dword [ebp + 8]
sub edi, edx
mov word [eax + ebx*2], cx
xor eax, eax
mov edx, 1
add ebx, edx
test cx, cx
sete al
mov dword [ebp - 0x14], edi
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 8]
cmp edi, eax
jge 0x409772
sub dword [ebp - 0xc], edx
sar eax, 1
cmp edi, eax
jl 0x409766
mov dword [ebp - 8], eax
mov ecx, dword [ebp - 0x10]
mov eax, dword [ebp - 4]
lea edx, [ecx - 7]
cmp eax, edx
jbe 0x40979d
mov edx, esi
sar edx, 3
add edx, eax
add ecx, 0xfffffffc
cmp edx, ecx
jbe 0x40979d
mov ecx, eax
mov eax, dword [ebp - 0x10]
sub ecx, eax
lea esi, [esi + ecx*8 + 0x20]
add eax, 0xfffffffc
jmp 0x4097a7
mov edx, esi
sar edx, 3
add eax, edx
and esi, 7
mov edx, dword [eax]
mov ecx, esi
and ecx, 0x1f
shr edx, cl
mov dword [ebp - 4], eax
cmp edi, 1
jg 0x409610
cmp dword [ebp - 0x14], 1
je 0x4097d8
pop edi
pop esi
or eax, 0xffffffff
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov eax, 0xffffffd0
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0xc]
dec ebx
mov dword [eax], ebx
mov eax, dword [ebp - 4]
add esi, 7
sar esi, 3
add eax, esi
sub eax, dword [ebp + 0x14]
cmp eax, dword [ebp + 0x18]
jbe 0x4097f6
mov eax, 0xffffffb8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret