Function at 0x10005519
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc
push ebx
push esi
push edi
mov edi, dword [ebp + 0x18]
xor ebx, ebx
mov dword [ebp - 4], ebx
test edi, edi
jne 0x10005551
mov esi, dword [ebp + 0x10]
imul esi, dword [ebp + 0x14]
add esi, 7
sar esi, 3
push esi
push dword [ebp + 0xc]
push dword [ebp + 8]
call 0x10021f76
add esp, 0xc
mov eax, esi
jmp 0x1000594f
mov esi, dword [ebp + 0x14]
push 8
pop eax
cmp esi, eax
jg 0x100057e7
je 0x100057ce
test esi, esi
jle 0x1000594d
push 2
pop ecx
cmp esi, ecx
jle 0x100056dc
cmp esi, 4
je 0x100056dc
cmp esi, 6
jne 0x1000594d
mov eax, dword [ebp + 0x10]
xor edx, edx
sar eax, 2
cmp edi, 1
movzx eax, ax
cmove edx, ecx
xor esi, esi
cmp si, ax
mov dword [ebp + 0x18], edx
mov esi, dword [ebp + 8]
jae 0x10005641
mov edi, dword [ebp + 0xc]
movzx ecx, dx
mov dword [ebp - 8], ecx
mov dword [ebp + 0x14], eax
movzx eax, byte [edi]
mov edx, 0xff
shl ax, cl
and ax, dx
movzx eax, ax
mov dword [ebp - 4], eax
movzx eax, byte [edi + 1]
shl ax, cl
and ax, dx
movzx ebx, ax
movzx eax, byte [edi + 2]
shl ax, cl
and ax, dx
movzx eax, ax
mov dword [ebp + 8], eax
movzx eax, byte [edi + 3]
add edi, 4
shl ax, cl
mov ecx, ebx
and ax, dx
shr ecx, 6
movzx edx, ax
and bl, 0xfc
mov al, byte [ebp - 4]
and al, 0xfc
shl bl, 2
or cl, al
shr edx, 2
mov byte [esi], cl
mov ecx, dword [ebp + 8]
mov eax, ecx
and cl, 0xfc
shr eax, 4
shl cl, 4
or bl, al
or cl, dl
mov byte [esi + 1], bl
mov byte [esi + 2], cl
add esi, 3
sub dword [ebp + 0x14], 1
mov ecx, dword [ebp - 8]
jne 0x100055b8
mov edx, dword [ebp + 0x18]
mov ebx, edi
push 2
mov dword [ebp + 8], edi
pop ecx
jmp 0x10005644
mov ebx, dword [ebp + 0xc]
mov edi, dword [ebp + 0x10]
and edi, ecx
mov ax, di
add edi, 0xffff
test ax, ax
je 0x10005672
movzx eax, byte [ebx]
mov cl, dl
shl ax, cl
mov ecx, 0xff
and ax, cx
inc ebx
movzx eax, ax
mov dword [ebp - 4], eax
and al, 0xfc
mov byte [esi], al
mov ax, di
add edi, 0xffff
test ax, ax
je 0x100056a4
movzx eax, byte [ebx]
mov cl, dl
shl ax, cl
mov ecx, 0xff
and ax, cx
inc ebx
movzx edx, ax
mov eax, edx
and dl, 0xfc
shr eax, 6
or byte [esi], al
inc esi
shl dl, 2
mov byte [esi], dl
test di, di
je 0x100056cd
movzx eax, byte [ebx]
mov cl, byte [ebp + 0x18]
shl ax, cl
mov ecx, 0xff
and ax, cx
movzx ecx, ax
mov eax, ecx
and cl, 0xfc
shr eax, 4
or byte [esi], al
shl cl, 4
mov byte [esi + 1], cl
imul eax, dword [ebp + 0x10], 6
add eax, 7
sar eax, 3
jmp 0x1000594f
cdq
idiv esi
push 8
dec eax
mov dword [ebp + 0x14], ebx
movzx eax, ax
mov dword [ebp - 4], eax
pop eax
sub eax, esi
movzx ecx, ax
mov eax, 0xff
sar eax, cl
movzx eax, ax
mov dword [ebp - 8], eax
xor eax, eax
mov dword [ebp - 0xc], ecx
mov ecx, ebx
mov dword [ebp + 0x18], ecx
cmp ax, word [ebp + 0x10]
jae 0x1000577c
mov edx, dword [ebp + 8]
mov eax, dword [ebp + 0xc]
mov dword [ebp + 8], edx
mov dx, bx
mov dword [ebp + 0xc], eax
cmp edi, 1
jne 0x1000572b
movzx eax, byte [eax]
and ax, word [ebp - 8]
jmp 0x10005738
mov al, byte [eax]
mov cl, byte [ebp - 0xc]
shr al, cl
mov ecx, dword [ebp + 0x18]
movzx eax, al
or dx, ax
inc dword [ebp + 0xc]
mov eax, ecx
mov word [ebp + 0x14], dx
and eax, dword [ebp - 4]
cmp ax, word [ebp - 4]
jne 0x10005760
mov al, dl
mov dword [ebp + 0x14], ebx
mov edx, dword [ebp + 8]
mov byte [edx], al
inc edx
mov dword [ebp + 8], edx
mov dx, bx
jmp 0x1000576d
mov cx, si
shl dx, cl
mov ecx, dword [ebp + 0x18]
mov word [ebp + 0x14], dx
mov eax, dword [ebp + 0xc]
inc ecx
mov dword [ebp + 0x18], ecx
cmp cx, word [ebp + 0x10]
jb 0x1000571d
jmp 0x10005786
mov eax, dword [ebp + 8]
mov dx, word [ebp + 0x14]
mov dword [ebp + 8], eax
mov ebx, dword [ebp - 4]
mov eax, ecx
and eax, ebx
test ax, ax
je 0x100057bd
inc ecx
mov eax, ecx
mov dword [ebp + 0x18], ecx
and eax, ebx
test ax, ax
je 0x100057b5
mov edi, ecx
mov cx, si
shl dx, cl
inc edi
mov eax, edi
and eax, ebx
test ax, ax
jne 0x100057a1
mov word [ebp + 0x14], dx
mov edx, dword [ebp + 8]
mov al, byte [ebp + 0x14]
mov byte [edx], al
mov eax, dword [ebp + 0x10]
movzx ecx, bx
add eax, ecx
inc ecx
cdq
idiv ecx
jmp 0x1000594f
push dword [ebp + 0x10]
push dword [ebp + 0xc]
push dword [ebp + 8]
call 0x10021f76
mov eax, dword [ebp + 0x10]
add esp, 0xc
jmp 0x1000594f
cmp esi, 0xc
je 0x1000581b
cmp esi, 0x10
je 0x10005814
cmp esi, 0x20
jne 0x1000594d
mov eax, dword [ebp + 0x10]
shl eax, 2
push eax
push dword [ebp + 0xc]
push dword [ebp + 8]
call 0x10021f76
add esp, 0xc
jmp 0x1000594d
mov eax, dword [ebp + 0x10]
add eax, eax
jmp 0x10005800
mov edx, dword [ebp + 0xc]
dec edi
mov esi, dword [ebp + 8]
neg edi
mov dword [ebp + 0xc], ebx
sbb edi, edi
and edi, 4
xor eax, eax
cmp ax, word [ebp + 0x10]
jae 0x1000593c
mov ax, word [edx]
mov cx, di
shr ax, cl
mov ebx, 0xfff
and ax, bx
movzx eax, ax
shl eax, 4
movzx ebx, ax
mov eax, dword [ebp + 0xc]
inc eax
mov dword [ebp - 4], ebx
mov dword [ebp + 0xc], eax
cmp ax, word [ebp + 0x10]
je 0x1000593c
mov ax, word [edx + 2]
mov ecx, edi
shl ax, cl
add edx, 4
mov ecx, 0xfff
mov dword [ebp + 8], edx
and ax, cx
movzx ecx, ax
mov ax, cx
mov dword [ebp + 0x14], ecx
shr ax, 8
or word [ebp - 4], ax
mov eax, dword [ebp - 4]
shr eax, 8
mov byte [esi], al
mov al, byte [ebp - 4]
mov byte [esi + 1], al
add esi, 2
mov eax, dword [ebp + 0xc]
shl ecx, 8
inc eax
movzx ebx, cx
mov dword [ebp - 4], ebx
mov dword [ebp + 0xc], eax
cmp ax, word [ebp + 0x10]
je 0x1000593c
mov ax, word [edx]
mov ecx, edi
add dword [ebp + 8], 2
mov ebx, 0xfff
shl ax, cl
and ax, bx
movzx edx, ax
mov ax, dx
mov dword [ebp + 0x14], edx
shr ax, 4
or word [ebp - 4], ax
mov eax, dword [ebp - 4]
shr eax, 8
mov byte [esi], al
mov al, byte [ebp - 4]
mov byte [esi + 1], al
add esi, 2
mov eax, dword [ebp + 0xc]
shl edx, 0xc
inc eax
movzx ebx, dx
mov dword [ebp - 4], ebx
mov dword [ebp + 0xc], eax
cmp ax, word [ebp + 0x10]
je 0x1000593c
mov edx, dword [ebp + 8]
mov ax, word [edx]
add edx, 2
shl ax, cl
mov ecx, 0xfff
and ax, cx
movzx eax, ax
or ebx, eax
mov eax, ebx
mov dword [ebp - 4], ebx
shr eax, 8
mov byte [esi], al
mov al, bl
mov byte [esi + 1], al
add esi, 2
mov eax, dword [ebp + 0xc]
inc eax
mov dword [ebp + 0xc], eax
jmp 0x1000582e
test byte [ebp + 0x10], 3
je 0x1000594d
mov al, byte [ebp - 4]
shr ebx, 8
mov byte [esi], bl
mov byte [esi + 1], al
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x14