Function at 0x180016660
Capabilities:
Encrypt data using rc4 prga

Disassembly:
mov dword [rsp + 0x20], r9d
mov qword [rsp + 0x10], rdx
push rbx
push rbp
push r13
sub rsp, 0x50
mov rax, qword [rcx + 0x10]
mov r13d, r9d
mov rbx, r8
mov r9, rdx
mov rbp, rcx
cmp dword [rax + 4], 0xfffffff5
jne 0x1800166f3
mov eax, dword [rax]
mov rdx, qword [rdx]
movzx r8d, word [rax + 6]
mov eax, r8d
add rax, rax
mov ecx, dword [rdx + rax*8]
mov eax, ecx
and eax, 0xf0000000
cmp eax, 0x80000000
jne 0x1800166c7
nop dword [rax]
movzx ecx, cx
add rcx, rcx
mov ecx, dword [rdx + rcx*8]
mov eax, ecx
and eax, 0xf0000000
cmp eax, 0x80000000
je 0x1800166b0
mov eax, ecx
movzx edx, cx
and eax, 0xf0000000
mov rcx, r9
cmp eax, 0x20000000
cmovne edx, r8d
mov r8d, r13d
call fcn.1800267d0
test rax, rax
jne 0x18001676a
mov r9, qword [rsp + 0x78]
mov rax, qword [rbp + 0x10]
lea rcx, [rax + 8]
cmp rcx, qword [rbp + 0x18]
jae 0x18001677d
cmp dword [rax + 0xc], 0xfffffff5
jne 0x18001677d
mov eax, dword [rcx]
mov rdx, qword [r9]
movzx r8d, word [rax + 6]
mov eax, r8d
add rax, rax
mov ecx, dword [rdx + rax*8]
mov eax, ecx
and eax, 0xf0000000
cmp eax, 0x80000000
jne 0x180016747
nop dword [rax]
movzx ecx, cx
add rcx, rcx
mov ecx, dword [rdx + rcx*8]
mov eax, ecx
and eax, 0xf0000000
cmp eax, 0x80000000
je 0x180016730
mov eax, ecx
movzx edx, cx
and eax, 0xf0000000
mov rcx, r9
cmp eax, 0x20000000
cmovne edx, r8d
mov r8d, r13d
call fcn.1800267d0
test rax, rax
je 0x18001677d
mov rdx, rax
mov rcx, rbp
add rsp, 0x50
pop r13
pop rbp
pop rbx
jmp fcn.180038870
mov qword [rsp + 0x48], rdi
xor edi, edi
mov qword [rsp + 0x40], r12
mov r12d, 0xffffffff
mov qword [rsp + 0x30], r15
mov r15d, r12d
cmp r13d, 4
jne 0x1800167d8
mov rax, qword [rbx + 8]
cmp qword [rbx], rax
mov rax, qword [rbp + 0x18]
mov r15, qword [rsp + 0x30]
setne dil
add edi, 0xfffffffd
mov dword [rax - 4], edi
mov eax, dword [rbp + 8]
mov dword [rax + 0x9c], edi
lea eax, [r12 + 2]
mov r12, qword [rsp + 0x40]
mov rdi, qword [rsp + 0x48]
add rsp, 0x50
pop r13
pop rbp
pop rbx
ret
mov qword [rsp + 0x70], rsi
lea rax, [rsp + 0x20]
sub rbx, rax
mov qword [rsp + 0x38], r14
mov rsi, rdi
lea rdx, [0x180068df0]
lea r13, [rbx + 0x10]
nop dword [rax + rax]
lea r14, [rsp + 0x20]
add r14, rsi
mov rcx, qword [r14 + r13]
test rcx, rcx
je 0x180016859
mov rax, qword [rbp + 0x10]
cmp dword [rsi + rax + 4], 0xfffffff5
jne 0x180016859
mov ebx, dword [rcx]
xor r8d, r8d
mov rax, qword [rsp + 0x78]
sub rcx, qword [rax]
sar rcx, 4
mov edx, ecx
mov rcx, rbp
call fcn.180026950
add rax, 0x10
lea rdx, [0x180068df0]
and ebx, 0xf0000000
mov ecx, edi
cmp ebx, 0x50000000
cmovne ecx, r12d
mov r12d, ecx
jmp 0x180016899
mov rax, qword [rbp + 0x10]
mov ecx, dword [rsi + rax + 4]
cmp ecx, 0xfffffffb
mov eax, edi
cmovne eax, r15d
mov r15d, eax
cmp ecx, 0xfffeffff
ja 0x18001687c
mov ecx, 0xd
jmp 0x180016893
mov eax, ecx
and eax, 0xffff8000
cmp eax, 0xffff0000
jne 0x180016891
mov ecx, 3
jmp 0x180016893
not ecx
mov eax, ecx
mov rax, qword [rdx + rax*8]
inc edi
mov qword [r14], rax
add rsi, 8
cmp edi, 2
jl 0x180016800
mov r14, qword [rsp + 0x38]
mov eax, r15d
mov rsi, qword [rsp + 0x70]
xor eax, r12d
mov r13d, dword [rsp + 0x88]
cmp eax, 1
je 0x180016906
cmp r13d, 5
jne 0x1800168d5
mov edx, 0xcf2
jmp 0x1800168f3
cmp r13d, 8
jne 0x1800168e2
mov edx, 0xd10
jmp 0x1800168f3
cmp r13d, 0xa
mov edx, 0xd35
mov eax, 0xd64
cmovl edx, eax
mov r9, qword [rsp + 0x28]
mov rcx, rbp
mov r8, qword [rsp + 0x20]
call fcn.180029d10
int3
movsxd r9, r12d
mov edx, 0xcd6
movsxd r8, r15d
mov rcx, rbp
mov r9, qword [rsp + r9*8 + 0x20]
mov r8, qword [rsp + r8*8 + 0x20]
call fcn.180029d10
int3