Function at 0x4a6c40
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub rsp, 0x18
mov qword [rsp + 0x20], rbx
mov qword [rsp + 0x28], rbp
mov ebp, dword [rdx + 4]
mov qword [rsp + 0x30], rsi
mov esi, dword [rdx + 8]
mov qword [rsp + 0x38], rdi
mov r9, rdx
xor edx, edx
lea rbx, [rcx + 8]
mov qword [rsp + 0x10], r12
mov qword [rsp + 8], r13
movzx r13d, word [rbx]
lea eax, [rsi + 1]
mov r11, rcx
mov r12d, 1
mov edi, r12d
imul eax, r13d
dec eax
div ebp
lea rdx, [rcx + 0xa]
movzx ecx, word [rcx + 0xa]
cmp ecx, eax
jbe 0x4a6cae
nop
nop
movzx ecx, word [rdx + 2]
add rdx, 2
inc edi
cmp ecx, eax
ja 0x4a6ca0
mov r8d, dword [r9]
xor edx, edx
mov ecx, edi
movzx eax, word [r11 + rcx*2 + 6]
imul eax, ebp
div r13d
xor edx, edx
lea r10d, [rax + r8 - 1]
movzx eax, word [r11 + rcx*2 + 8]
imul eax, ebp
div r13d
sub esi, eax
add eax, r8d
mov dword [r9], eax
mov dword [r9 + 8], esi
mov ecx, dword [r9]
mov eax, ecx
xor eax, r10d
bt eax, 0xf
jae 0x4a6d0d
bt ecx, 0xe
jae 0x4a6d7b
bt r10d, 0xe
jb 0x4a6d7b
and ecx, 0x3fff
bts r10d, 0xe
mov dword [r9], ecx
mov eax, dword [r9]
and r10d, 0x7fff
and eax, 0x7fff
add r10d, r10d
add eax, eax
or r10d, r12d
mov dword [r9], eax
cmp dword [r9 + 0x10], 0x10000
jb 0x4a6d58
mov rax, qword [r9 + 0x18]
cmp rax, qword [r9 + 0x20]
jb 0x4a6d43
mov cl, 0xff
mov byte [r9 + 0x14], r12b
jmp 0x4a6d4d
movzx ecx, byte [rax]
inc rax
mov qword [r9 + 0x18], rax
movzx eax, cl
bts eax, 8
mov dword [r9 + 0x10], eax
mov eax, dword [r9 + 0x10]
mov ecx, eax
add eax, eax
mov dword [r9 + 0x10], eax
mov eax, dword [r9 + 8]
shr ecx, 7
add eax, eax
and ecx, r12d
or eax, ecx
mov dword [r9 + 8], eax
jmp 0x4a6ce0
sub r10d, ecx
mov qword [rsp], r14
inc r10d
add edi, 0xffffffff
movsxd rax, edi
mov dword [r9 + 4], r10d
movzx r14d, byte [rdi + r11 + 0x8a]
lea rcx, [r11 + rax*2 + 8]
nop
add word [rcx], 8
mov eax, edi
sub rcx, 2
add edi, 0xffffffff
test eax, eax
jne 0x4a6da0
cmp word [rbx], 0xed8
jbe 0x4a6ed3
add dword [r11 + 4], 0xffffffff
jne 0x4a6ea7
xor esi, esi
mov dword [r11 + 4], 0x32
cmp dword [r11], esi
mov r9d, esi
jbe 0x4a6e00
mov r8, rbx
nop
movzx ecx, word [r8]
movzx eax, word [r8 + 2]
inc r9d
sub ecx, eax
add r8, 2
inc ecx
sar ecx, 1
mov word [r8 - 2], cx
cmp r9d, dword [r11]
jb 0x4a6de0
mov eax, dword [r11]
dec eax
je 0x4a6e7e
mov r13, 0xffffffffffffff77
lea rdi, [r11 + 0x8a]
sub r13, r11
nop
nop
cmp r12d, dword [r11]
mov r9d, r12d
lea r8, [rdi + r13]
jae 0x4a6e69
lea rdx, [rbx + 2]
movzx r10d, word [rbx]
movzx eax, word [rdx]
cmp r10w, ax
jae 0x4a6e5a
movzx ecx, byte [rdi]
mov word [rbx], ax
movzx eax, byte [r8 + r11 + 0x8a]
mov byte [rdi], al
mov word [rdx], r10w
mov byte [r8 + r11 + 0x8a], cl
inc r9d
inc r8
add rdx, 2
cmp r9d, dword [r11]
jb 0x4a6e30
mov eax, dword [r11]
inc esi
inc r12d
dec eax
add rbx, 2
inc rdi
cmp esi, eax
jb 0x4a6e20
movsxd rcx, esi
lea rdx, [r11 + rcx*2 + 8]
nop
nop
nop
movzx ecx, word [rdx + 2]
sub rdx, 2
add word [rdx + 2], cx
mov ecx, esi
add esi, 0xffffffff
test ecx, ecx
jne 0x4a6e90
jmp 0x4a6ed3
mov edx, dword [r11]
dec edx
movsxd rax, edx
lea rcx, [r11 + rax*2 + 8]
movzx eax, word [rcx + 2]
shr word [rcx], 1
cmp word [rcx], ax
ja 0x4a6ec6
inc ax
mov word [rcx], ax
mov eax, edx
sub rcx, 2
add edx, 0xffffffff
test eax, eax
jne 0x4a6eb4
mov r13, qword [rsp + 8]
mov r12, qword [rsp + 0x10]
mov rdi, qword [rsp + 0x38]
mov rsi, qword [rsp + 0x30]
mov rbp, qword [rsp + 0x28]
mov rbx, qword [rsp + 0x20]
mov eax, r14d
mov r14, qword [rsp]
add rsp, 0x18
ret