Function at 0x140016f00
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push rbx
push rsi
push rdi
push r14
mov r10, qword [rsp + 0x48]
mov rbx, rcx
movsxd rsi, r9d
mov r9d, edx
test r10, r10
je 0x1400170b0
movzx ecx, word [rcx + 2]
mov r11d, ecx
imul r11d, r9d
lea eax, [r8 + r11*2]
add eax, eax
movsxd r14, eax
movzx eax, byte [rbx + 0xb]
cmp al, 1
jne 0x140016f94
movzx ecx, byte [rbx + 0xa]
mov eax, 1
mov edx, dword [rsp + 0x50]
dec ecx
shl eax, cl
mov r9d, eax
dec eax
neg r9d
test edx, edx
jle 0x14001727e
lea rbx, [rbx + rsi*8]
mov r11d, edx
lea r8, [r14 + r14]
mov edx, dword [r10]
cmp edx, r9d
jge 0x140016f72
mov edx, r9d
jmp 0x140016f77
cmp edx, eax
cmovg edx, eax
mov rcx, qword [rbx + 0x28]
add r10, 4
mov word [r8 + rcx], dx
add r8, 4
sub r11, 1
jne 0x140016f65
pop r14
pop rdi
pop rsi
pop rbx
ret
cmp al, 3
jne 0x140016fe0
movzx eax, word [rbx + 4]
imul eax, esi
add eax, r9d
imul eax, ecx
add eax, r8d
movsxd r8, dword [rsp + 0x50]
movsxd rdx, eax
test r8, r8
jle 0x14001727e
xor r11d, r11d
add rdx, rdx
nop
movzx eax, word [r10 + r11*4]
lea rdx, [rdx + 2]
mov rcx, qword [rbx + 0x48]
inc r11
mov word [rdx + rcx - 2], ax
cmp r11, r8
jl 0x140016fc0
pop r14
pop rdi
pop rsi
pop rbx
ret
movzx eax, byte [rbx]
cmp al, 4
jne 0x140017045
movzx edx, byte [rbx + 0xa]
mov eax, 1
mov edi, eax
lea ecx, [rdx - 1]
shl edi, cl
mov ecx, edx
mov edx, dword [rsp + 0x50]
shl eax, cl
dec eax
test edx, edx
jle 0x14001727e
lea rbx, [rbx + rsi*8]
mov r9d, edx
lea r8, [r14 + r14]
xor r11d, r11d
mov edx, dword [r10]
add edx, edi
jns 0x140017023
mov edx, r11d
jmp 0x140017028
cmp edx, eax
cmovg edx, eax
mov rcx, qword [rbx + 0x28]
add r10, 4
mov word [r8 + rcx], dx
add r8, 4
sub r9, 1
jne 0x140017017
pop r14
pop rdi
pop rsi
pop rbx
ret
cmp al, 1
jne 0x14001727e
movzx ecx, byte [rbx + 0xa]
mov eax, 1
mov r9d, eax
shl r9d, cl
dec r9d
dec ecx
shl eax, cl
lea ecx, [r11 + r8]
movsxd r8, ecx
mov ecx, dword [rsp + 0x50]
test ecx, ecx
jle 0x14001727e
add r8, r8
mov edi, ecx
xor r11d, r11d
nop
mov edx, dword [r10]
add edx, eax
jns 0x14001708c
mov edx, r11d
jmp 0x140017093
cmp edx, r9d
cmovg edx, r9d
mov rcx, qword [rbx + 0x28]
add r10, 4
mov word [r8 + rcx], dx
add r8, 2
sub rdi, 1
jne 0x140017080
pop r14
pop rdi
pop rsi
pop rbx
ret
cmp byte [rcx + 0xb], 3
jne 0x14001727e
mov rcx, qword [rcx + 0x48]
test rcx, rcx
je 0x14001727e
movzx r8d, word [rbx + 2]
xor r11d, r11d
mov qword [rsp + 0x28], rbp
mov edx, r8d
imul edx, r9d
mov r14d, 0x400
mov qword [rsp + 0x30], r12
mov ebp, r11d
mov qword [rsp + 0x38], r13
mov qword [rsp + 0x40], r15
movsxd rax, edx
lea r13d, [rdx*4]
lea r15, [rcx + rax*2]
movzx eax, word [rbx + 4]
imul eax, r8d
cdqe
lea r12, [r15 + rax*2]
lea rsi, [r12 + rax*2]
lea r9, [rsi + rax*2]
movzx eax, byte [rbx + 7]
lea ecx, [rax - 1]
shl r14d, cl
mov ecx, eax
mov eax, 1
shl eax, cl
dec eax
test r8d, r8d
je 0x14001726a
sub r9, rsi
sub r12, rsi
mov qword [rsp + 0x48], r9
sub r15, rsi
nop dword [rax]
nop dword [rax + rax]
movsx r9d, word [r9 + rsi]
movsx ecx, word [r12 + rsi]
movsx r10d, word [r15 + rsi]
imul edx, ecx, 0xa8
shl r10d, 0xa
imul r8d, r9d, 0xfffffdb7
sub r8d, edx
add r8d, r10d
add r8d, r14d
mov ecx, r8d
sar ecx, 0x1f
mov edx, ecx
xor edx, r8d
sub edx, ecx
add edx, 0x200
sar edx, 9
and edx, 0xfffffffe
mov edi, edx
neg edi
test r8d, r8d
lea r8d, [r14 + 0x200]
cmovns edi, edx
imul ecx, r9d, 0x5e6
add ecx, r10d
add r8d, ecx
sar r8d, 0xa
test r8d, r8d
jns 0x1400171be
mov r8d, r11d
jmp 0x1400171c5
cmp r8d, eax
cmovg r8d, eax
lea ecx, [rbp*2]
add ecx, r13d
lea edx, [rdi + 1]
lea r9, [rcx + rcx]
mov rcx, qword [rbx + 0x28]
mov word [r9 + rcx], r8w
movsx ecx, word [rsi]
add edx, ecx
sar edx, 1
jns 0x1400171ed
mov edx, r11d
jmp 0x1400171f2
cmp edx, eax
cmovg edx, eax
mov rcx, qword [rbx + 0x30]
mov word [r9 + rcx], dx
movsx ecx, word [rsi]
sub edi, ecx
inc edi
sar edi, 1
jns 0x14001720b
mov edi, r11d
jmp 0x140017210
cmp edi, eax
cmovg edi, eax
mov rcx, qword [rbx + 0x38]
mov word [r9 + rcx], di
movsx ecx, word [r12 + rsi]
movsx r8d, word [r15 + rsi]
imul edx, ecx, 0x787
shl r8d, 0xa
add edx, 0x200
add edx, r14d
add edx, r8d
sar edx, 0xa
test edx, edx
jns 0x140017245
mov edx, r11d
jmp 0x14001724a
cmp edx, eax
cmovg edx, eax
mov rcx, qword [rbx + 0x40]
inc ebp
add rsi, 2
mov word [r9 + rcx], dx
movzx ecx, word [rbx + 2]
mov r9, qword [rsp + 0x48]
cmp ebp, ecx
jl 0x140017150
mov r13, qword [rsp + 0x38]
mov r12, qword [rsp + 0x30]
mov rbp, qword [rsp + 0x28]
mov r15, qword [rsp + 0x40]
pop r14
pop rdi
pop rsi
pop rbx
ret