Function at 0x505560
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
mov eax, dword [ebp + 0x10]
mov dword [ebp - 4], edx
mov edx, dword [ebp + 8]
mov dword [ebp - 8], ecx
mov ecx, dword [ebp + 0xc]
push ebx
lea eax, [eax + edx*2]
mov dword [ebp - 0x1c], ecx
add eax, 2
mov dword [ebp - 0xc], eax
lea eax, [edx + 1]
mov dword [ebp - 0x14], eax
xor edx, edx
mov eax, 1
shl eax, cl
mov dword [ebp + 0xc], eax
push esi
xor esi, esi
lea ebx, [eax - 1]
mov eax, ecx
xor ecx, ecx
mov dword [ebp - 0x10], ebx
bts ecx, eax
cmp eax, 0x20
push edi
cmovae edx, ecx
mov edi, ebx
mov ebx, dword [ebp + 8]
xor ecx, edx
cmp eax, 0x40
cmovae edx, ecx
lea eax, [ebx*2 + 2]
mov ebx, edi
add eax, ecx
adc esi, edx
add eax, 8
adc esi, 0
test esi, esi
ja 0x50580e
jb 0x5055de
cmp eax, dword [ebp + 0x14]
ja 0x50580e
cmp dword [ebp + 8], 0xff
ja 0x50580e
mov ecx, dword [ebp - 0x1c]
cmp ecx, 0xc
jbe 0x5055ff
mov eax, 0xffffffd4
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [ebp - 0x14]
mov eax, 1
mov word [ebp + 8], cx
dec ecx
mov word [ebp + 0xa], ax
shl ax, cl
movzx eax, ax
mov dword [ebp + 0x14], eax
test esi, esi
je 0x50566c
mov esi, dword [ebp - 8]
mov ebx, dword [ebp - 4]
add esi, 6
mov ecx, dword [ebp + 0x10]
sub ebx, ecx
xor edx, edx
lea esi, [esi + edi*4]
movzx eax, word [ebx + ecx]
cmp ax, 0xffff
jne 0x505647
mov byte [esi], dl
dec edi
sub esi, 4
mov eax, 1
jmp 0x50565a
cmp ax, word [ebp + 0x14]
jl 0x505657
xor eax, eax
mov word [ebp + 0xa], ax
movzx eax, word [ebx + ecx]
movzx eax, ax
mov word [ecx], ax
inc edx
add ecx, 2
cmp edx, dword [ebp - 0x14]
jb 0x505630
mov ebx, dword [ebp - 0x10]
mov esi, dword [ebp - 0x14]
mov ecx, dword [ebp - 8]
mov eax, dword [ebp + 8]
mov edx, dword [ebp - 4]
mov dword [ecx], eax
mov eax, dword [ebp + 0xc]
mov ecx, eax
shr ecx, 3
shr eax, 1
cmp edi, ebx
jne 0x50575d
add eax, 3
xor edi, edi
add eax, ecx
mov dword [ebp + 8], edi
mov dword [ebp - 0x18], eax
xorps xmm0, xmm0
xor eax, eax
movlpd qword [ebp - 0x28], xmm0
test esi, esi
je 0x50570c
mov ecx, dword [ebp - 0x28]
mov ebx, dword [ebp - 0x24]
mov dword [ebp + 0x14], ecx
nop dword [eax]
movsx esi, word [edx + eax*2]
mov edx, dword [ebp - 0xc]
mov dword [ebp - 0x24], esi
mov dword [edi + edx], ecx
mov dword [edi + edx + 4], ebx
mov edx, dword [ebp - 4]
cmp esi, 8
jle 0x5056ef
add edi, dword [ebp - 0xc]
mov dword [edi + 8], ecx
lea ecx, [esi - 9]
shr ecx, 2
lea esi, [edi + 8]
mov dword [edi + 0xc], ebx
and ecx, 0x3ffffffe
add edi, 0x10
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [ebp + 0x14]
mov esi, dword [ebp - 0x24]
mov edi, dword [ebp + 8]
add edi, esi
inc eax
add ecx, 0x1010101
mov dword [ebp + 8], edi
mov dword [ebp + 0x14], ecx
adc ebx, 0x1010101
cmp eax, dword [ebp - 0x14]
jb 0x5056b0
mov ebx, dword [ebp - 0x10]
xor edx, edx
xor esi, esi
cmp dword [ebp + 0xc], edx
jbe 0x505805
mov edi, dword [ebp - 0xc]
nop dword [eax]
movzx eax, byte [esi + edi]
mov ecx, edx
mov edi, dword [ebp - 8]
and ecx, ebx
mov byte [edi + ecx*4 + 6], al
mov edi, dword [ebp - 0xc]
mov ecx, dword [ebp - 0x18]
add ecx, edx
and ecx, ebx
movzx eax, byte [esi + edi + 1]
add esi, 2
mov edi, dword [ebp - 8]
mov byte [edi + ecx*4 + 6], al
mov eax, dword [ebp - 0x18]
mov edi, dword [ebp - 0xc]
lea edx, [edx + eax*2]
and edx, ebx
cmp esi, dword [ebp + 0xc]
jb 0x505720
mov ebx, dword [ebp + 0xc]
jmp 0x5057ca
lea edx, [eax + 3]
xor eax, eax
add edx, ecx
xor ecx, ecx
mov dword [ebp + 8], ecx
test esi, esi
je 0x5057c3
nop dword [eax]
mov ecx, dword [ebp - 4]
xor ebx, ebx
xor esi, esi
cmp bx, word [ecx]
mov ecx, dword [ebp + 8]
jge 0x5057a8
nop
mov ebx, dword [ebp - 8]
mov byte [ebx + eax*4 + 6], cl
add eax, edx
mov ebx, dword [ebp - 0x10]
and eax, ebx
cmp eax, edi
jbe 0x50579a
add eax, edx
and eax, ebx
cmp eax, edi
ja 0x505792
mov ecx, dword [ebp - 4]
inc esi
movsx ecx, word [ecx]
cmp esi, ecx
mov ecx, dword [ebp + 8]
jl 0x505780
add dword [ebp - 4], 2
inc ecx
mov dword [ebp + 8], ecx
cmp ecx, dword [ebp - 0x14]
jb 0x505770
test eax, eax
je 0x5057c3
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp + 0xc]
test ebx, ebx
je 0x505805
mov esi, dword [ebp - 8]
mov edi, ebx
add esi, 7
movzx eax, byte [esi - 1]
lea esi, [esi + 4]
mov ecx, dword [ebp + 0x10]
movzx edx, word [ecx + eax*2]
lea ecx, [ecx + eax*2]
lea eax, [edx + 1]
mov word [ecx], ax
mov eax, edx
mov cl, byte [ebp - 0x1c]
bsr eax, eax
sub cl, al
shl dx, cl
sub dx, bx
mov byte [esi - 4], cl
mov word [esi - 7], dx
sub edi, 1
jne 0x5057d2
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov eax, 0xffffffd2
pop ebx
mov esp, ebp
pop ebp
ret