Function at 0x140016c30
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rbx
push r13
sub rsp, 0x38
mov rbx, rcx
mov rcx, qword [rcx + 0x10]
movzx r13d, word [rcx + 4]
movzx eax, word [rcx + 2]
shl r13d, 0x10
or r13d, eax
cmp byte [rcx + 1], 0x1f
jae 0x140016cf0
mov rax, qword [rbx]
mov edx, dword [rax + 8]
test edx, edx
je 0x140016cf0
mov rax, qword [rbx + 0x40]
cmp word [rax + rdx], 1
lea r8, [rax + rdx]
jne 0x140016c87
movzx eax, byte [r8 + 3]
cmp al, 0x20
jae 0x140016cf0
add al, 1
mov byte [r8 + 3], al
jmp 0x140016cf0
mov edx, dword [r8 + 4]
add rdx, rax
movzx eax, byte [rcx]
cmp byte [rdx], al
je 0x140016cdd
add rdx, 6
cmp byte [rdx], al
jne 0x140016c95
movzx eax, byte [rdx - 5]
cmp byte [rdx + 1], al
jb 0x140016cdd
mov eax, dword [rdx]
lea rcx, [rdx - 6]
lea r9, [rsp + 0x50]
mov dword [r9], eax
movzx eax, word [rdx + 4]
mov word [r9 + 4], ax
mov eax, dword [rcx]
mov dword [rdx], eax
movzx eax, word [rcx + 4]
mov word [rdx + 4], ax
lea rdx, [rsp + 0x50]
mov eax, dword [rdx]
mov dword [rcx], eax
movzx eax, word [rdx + 4]
mov rdx, rcx
mov word [rcx + 4], ax
movzx eax, byte [rdx + 1]
cmp al, 0x73
jae 0x140016cf0
add al, 2
mov byte [rdx + 1], al
add word [r8 + 2], 2
cmp dword [rbx + 0x18], 0
jne 0x140016d3a
mov edx, 1
mov rcx, rbx
call fcn.140016930
test rax, rax
mov qword [rbx + 8], rax
mov qword [rbx], rax
jne 0x140016d1e
mov rcx, rbx
add rsp, 0x38
pop r13
pop rbx
jmp fcn.140016750
mov ecx, eax
mov rax, qword [rbx + 0x10]
sub ecx, dword [rbx + 0x40]
mov word [rax + 2], cx
shr ecx, 0x10
mov word [rax + 4], cx
add rsp, 0x38
pop r13
pop rbx
ret
mov rax, qword [rbx + 0x10]
mov rcx, qword [rbx + 0x58]
mov qword [rsp + 0x28], r14
movzx eax, byte [rax]
mov byte [rcx], al
add qword [rbx + 0x58], 1
mov rax, qword [rbx + 0x58]
mov r14d, eax
sub r14d, dword [rbx + 0x40]
cmp rax, qword [rbx + 0x60]
jae 0x140016d7e
test r13d, r13d
je 0x140016db1
cmp r13d, r14d
ja 0x140016d96
xor edx, edx
mov rcx, rbx
call fcn.140016930
test rax, rax
mov r13, rax
jne 0x140016d92
mov rcx, rbx
mov r14, qword [rsp + 0x28]
add rsp, 0x38
pop r13
pop rbx
jmp fcn.140016750
sub r13d, dword [rbx + 0x40]
add dword [rbx + 0x18], 0xffffffff
jne 0x140016dcb
mov rax, qword [rbx]
xor ecx, ecx
mov r14d, r13d
cmp qword [rbx + 8], rax
setne cl
sub qword [rbx + 0x58], rcx
jmp 0x140016dcb
mov rcx, qword [rbx + 0x10]
mov eax, r14d
shr eax, 0x10
mov word [rcx + 2], r14w
mov word [rcx + 4], ax
mov r13d, dword [rbx]
sub r13d, dword [rbx + 0x40]
mov rdx, qword [rbx]
mov rax, qword [rbx + 0x10]
mov qword [rsp + 0x58], rbp
movzx r10d, word [rdx + 2]
movzx ecx, byte [rax + 1]
mov qword [rsp + 0x60], rsi
mov rsi, qword [rbx + 8]
sub r10d, ecx
mov qword [rsp + 0x68], rdi
mov qword [rsp + 0x30], r12
mov qword [rsp + 0x20], r15
movzx r15d, word [rdx]
sub r10d, r15d
add r10d, 1
cmp rsi, rdx
mov dword [rsp + 0x50], r10d
je 0x1400170b7
movzx ebp, word [rsi]
cmp ebp, 1
je 0x140016f42
test bpl, 1
jne 0x140016f05
mov edi, ebp
shr edi, 1
movzx ecx, byte [rdi + rbx + 0x92]
lea eax, [rdi - 1]
movzx r12d, byte [rax + rbx + 0x92]
cmp r12d, ecx
je 0x140016f05
lea edx, [r12 + 1]
mov ecx, edx
mov eax, dword [rbx + rdx*4 + 0x114]
test eax, eax
je 0x140016e6f
mov rdx, rax
add rdx, qword [rbx + 0x40]
mov eax, dword [rdx]
mov dword [rbx + rcx*4 + 0x114], eax
jmp 0x140016e9e
movzx eax, byte [rdx + rbx + 0x6c]
lea ecx, [rax + rax*2]
mov eax, dword [rbx + 0x50]
sub eax, dword [rbx + 0x48]
shl ecx, 2
cmp ecx, eax
ja 0x140016e93
mov rdx, qword [rbx + 0x48]
mov eax, ecx
add rax, rdx
mov qword [rbx + 0x48], rax
jmp 0x140016e9e
mov rcx, rbx
call fcn.1400164e0
mov rdx, rax
test rdx, rdx
je 0x1400170ad
mov r9d, dword [rsi + 4]
mov r10, rdx
mov r8, rdx
add r9, qword [rbx + 0x40]
sub r10, r9
lea rcx, [r9 + 8]
nop
mov eax, dword [rcx - 8]
add rcx, 0xc
add r8, 0xc
add edi, 0xffffffff
mov dword [r8 - 0xc], eax
mov eax, dword [rcx - 0x10]
mov dword [r8 - 8], eax
mov eax, dword [rcx - 0xc]
mov dword [r10 + rcx - 0xc], eax
jne 0x140016ec0
mov eax, dword [rbx + r12*4 + 0x114]
mov r10d, dword [rsp + 0x50]
mov dword [r9], eax
sub r9d, dword [rbx + 0x40]
mov dword [rbx + r12*4 + 0x114], r9d
sub edx, dword [rbx + 0x40]
mov dword [rsi + 4], edx
movzx r8d, word [rsi + 2]
xor edx, edx
lea eax, [rbp*8]
cmp r8d, eax
lea eax, [rbp*4]
setbe dl
xor ecx, ecx
cmp eax, r15d
setbe cl
lea eax, [rbp + rbp]
and dx, cx
add dx, dx
cmp eax, r15d
adc dx, r8w
mov word [rsi + 2], dx
jmp 0x140016fdb
mov eax, dword [rbx + 0x114]
test eax, eax
je 0x140016f5d
mov rdx, rax
add rdx, qword [rbx + 0x40]
mov eax, dword [rdx]
mov dword [rbx + 0x114], eax
jmp 0x140016f92
movzx eax, byte [rbx + 0x6c]
lea ecx, [rax + rax*2]
mov eax, dword [rbx + 0x50]
sub eax, dword [rbx + 0x48]
shl ecx, 2
cmp ecx, eax
ja 0x140016f80
mov rdx, qword [rbx + 0x48]
mov eax, ecx
add rax, rdx
mov qword [rbx + 0x48], rax
jmp 0x140016f92
xor edx, edx
mov rcx, rbx
call fcn.1400164e0
mov r10d, dword [rsp + 0x50]
mov rdx, rax
test rdx, rdx
je 0x1400170ad
mov ecx, dword [rsi + 2]
mov dword [rdx], ecx
movzx ecx, word [rsi + 6]
mov word [rdx + 4], cx
mov ecx, edx
sub ecx, dword [rbx + 0x40]
mov dword [rsi + 4], ecx
movzx eax, byte [rdx + 1]
cmp al, 0x1e
jae 0x140016fbf
add al, al
mov byte [rdx + 1], al
jmp 0x140016fc3
mov byte [rdx + 1], 0x78
movzx eax, byte [rdx + 1]
xor ecx, ecx
cmp r15d, 3
seta cl
add cx, word [rbx + 0x1c]
add cx, ax
mov word [rsi + 2], cx
mov rax, qword [rbx + 0x10]
movzx r9d, word [rsi + 2]
movzx r8d, byte [rax + 1]
lea eax, [r9 + 6]
add r10d, r9d
imul r8d, eax
lea eax, [r10 + r10*2]
add r8d, r8d
add eax, eax
cmp r8d, eax
jae 0x14001702b
xor ecx, ecx
lea eax, [r10*4]
cmp r8d, eax
setae cl
xor eax, eax
cmp r8d, r10d
seta al
add r9w, 3
lea r8d, [rcx + rax + 1]
mov word [rsi + 2], r9w
jmp 0x140017064
xor edx, edx
mov eax, r10d
imul eax, eax, 0xf
cmp r8d, eax
lea eax, [r10 + r10*2]
setae dl
xor ecx, ecx
shl eax, 2
cmp r8d, eax
lea eax, [r10 + r10*8]
setae cl
add edx, ecx
xor ecx, ecx
cmp r8d, eax
setae cl
lea r8d, [rdx + rcx + 4]
add r9w, r8w
mov word [rsi + 2], r9w
mov eax, dword [rsi + 4]
lea rcx, [rbp + rbp*2]
add bp, 1
lea rdx, [rax + rcx*2]
mov eax, r14d
add rdx, qword [rbx + 0x40]
shr eax, 0x10
mov word [rdx + 2], r14w
mov word [rdx + 4], ax
mov rax, qword [rbx + 0x10]
movzx ecx, byte [rax]
mov byte [rdx + 1], r8b
mov byte [rdx], cl
mov word [rsi], bp
mov esi, dword [rsi + 8]
add rsi, qword [rbx + 0x40]
cmp rsi, qword [rbx]
je 0x1400170b7
mov r10d, dword [rsp + 0x50]
jmp 0x140016e14
mov rcx, rbx
call fcn.140016750
jmp 0x1400170c5
mov edx, r13d
add rdx, qword [rbx + 0x40]
mov qword [rbx], rdx
mov qword [rbx + 8], rdx
mov rbp, qword [rsp + 0x58]
mov r12, qword [rsp + 0x30]
mov rdi, qword [rsp + 0x68]
mov rsi, qword [rsp + 0x60]
mov r15, qword [rsp + 0x20]
mov r14, qword [rsp + 0x28]
add rsp, 0x38
pop r13
pop rbx
ret