Function at 0x180016920
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov rax, rsp
mov qword [rax + 0x20], r9
mov qword [rax + 0x18], r8
mov qword [rax + 0x10], rdx
mov qword [rax + 8], rcx
push rbp
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rax - 0x78]
sub rsp, 0x138
mov rax, qword [rcx]
xor r13d, r13d
mov rbx, rcx
mov dword [rax + 8], r13d
call fcn.180015f84
mov r9, qword [rbx]
mov ecx, dword [r9 + 8]
test eax, eax
jne 0x180016979
mov edx, ecx
xor r8d, r8d
mov rcx, rbx
call fcn.180015708
jmp 0x180016eec
mov r12d, 1
cmp ecx, 3
jne 0x1800169a7
cmp dword [rbx + 0x4850], ecx
je 0x18001699e
cmp dword [rbx + 0x484c], r13d
jne 0x1800169a7
cmp dword [rbx + 0x4848], r13d
jne 0x1800169a7
mov qword [rbp + 0x98], r12
jmp 0x1800169b2
mov qword [rbp + 0x98], r13
test ecx, ecx
jle 0x180016967
mov qword [rsp + 0x58], rcx
xorps xmm0, xmm0
xorps xmm1, xmm1
mov r15, rcx
movdqu xmmword [rsp + 0x38], xmm0
movdqu xmmword [rsp + 0x48], xmm1
test ecx, ecx
je 0x180016aa8
mov r14, r13
lea rdi, [rbp - 0x74]
lea rsi, [rbx + 0x46a4]
mov rax, qword [rbx]
mov ecx, dword [rax]
add ecx, 3
call qword [sym.imp.msvcrt.dll_malloc]
mov qword [rsi + 0x44], rax
test rax, rax
je 0x180016acb
mov eax, dword [rbx + 0x4688]
cdq
mov dword [rdi + 0xc], r13d
idiv dword [rsi]
mov r9d, eax
mov dword [rdi - 4], eax
mov eax, dword [rbx + 0x468c]
cdq
idiv dword [rsi + 4]
xor edx, edx
mov ecx, eax
mov dword [rdi], eax
sar ecx, 1
mov r8d, eax
mov dword [rdi + 8], ecx
mov rcx, qword [rbx]
mov eax, dword [rcx]
mov rcx, qword [rsi + 0x2c]
dec eax
add eax, r9d
mov qword [rdi - 0xc], rcx
div r9d
mov qword [rdi - 0x14], rcx
mov dword [rdi + 4], eax
cmp r9d, r12d
jne 0x180016a66
cmp r8d, r12d
jne 0x180016a57
lea rax, [0x1800161bc]
jmp 0x180016a90
cmp r8d, 2
jne 0x180016a89
lea rax, [0x1800161c0]
jmp 0x180016a90
cmp r9d, 2
jne 0x180016a89
cmp r8d, r12d
jne 0x180016a7a
lea rax, [0x180016208]
jmp 0x180016a90
cmp r8d, 2
jne 0x180016a89
mov rax, qword [rbx + 0x4880]
jmp 0x180016a90
lea rax, [0x180016558]
mov qword [rdi - 0x1c], rax
add r14, r12
add rdi, 0x30
add rsi, 0x60
cmp r14, r15
jl 0x1800169e2
mov rax, qword [rbx]
mov ecx, dword [rax]
mov r8d, dword [rax + 4]
test ecx, ecx
js 0x180016eb8
mov r10d, 0x7fffffff
jne 0x180016afb
lea r9d, [rcx*4]
jmp 0x180016b1b
mov rdx, qword [rbx]
xor r8d, r8d
mov rcx, rbx
mov edx, dword [rdx + 8]
call fcn.180015708
mov edx, dword [0x1801b53a4]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, [0x1800c00d8]
jmp 0x180016ee3
mov eax, r10d
cdq
idiv ecx
cmp eax, 4
jl 0x180016eb8
lea r9d, [rcx*4]
test r9d, r9d
js 0x180016eb8
test r8d, r8d
js 0x180016eb8
je 0x180016b36
mov eax, r10d
cdq
idiv r8d
cmp r9d, eax
jg 0x180016eb8
imul ecx, r8d
lea eax, [rcx*4 + 1]
movsxd rcx, eax
call qword [sym.imp.msvcrt.dll_malloc]
mov rdx, qword [rbx]
mov r15, rax
test rax, rax
je 0x180016ebb
mov eax, r13d
mov dword [rbp + 0xa0], eax
cmp dword [rdx + 4], r13d
jbe 0x180016e88
mov r14, qword [rsp + 0x48]
mov r12, qword [rsp + 0x40]
mov rdi, qword [rsp + 0x38]
mov qword [rsp + 0x30], r15
imul eax, dword [rdx]
shl eax, 2
mov esi, eax
add rsi, r15
cmp qword [rsp + 0x58], 0
mov qword [rsp + 0x60], rsi
jbe 0x180016c6f
mov rsi, qword [rsp + 0x58]
lea r14, [rbx + 0x46c0]
mov rbx, qword [rbp + 0x98]
lea rdi, [rbp - 0x6c]
mov eax, dword [rdi - 8]
lea r12, [rdi - 0x14]
sar eax, 1
lea rcx, [rdi - 0x1c]
mov qword [rsp + 0x30], rcx
mov qword [rbp + 0x98], r12
cmp dword [rdi], eax
jl 0x180016bd8
mov r8, qword [rcx]
mov rcx, r12
jmp 0x180016be1
mov r8, qword [r12]
mov qword [rsp + 0x30], rcx
mov rdx, qword [rcx]
mov eax, dword [rdi - 0xc]
mov rcx, qword [r14 + 0x28]
mov r9d, dword [rdi - 4]
mov dword [rsp + 0x20], eax
call qword [rdi - 0x24]
mov qword [rsp + r13*8 + 0x38], rax
mov eax, dword [rdi]
inc eax
mov dword [rdi], eax
cmp eax, dword [rdi - 8]
jl 0x180016c31
mov rax, qword [rsp + 0x30]
inc dword [rdi + 4]
mov rcx, qword [rbp + 0x98]
and dword [rdi], 0
mov rcx, qword [rcx]
mov qword [rax], rcx
mov eax, dword [rdi + 4]
cmp eax, dword [r14]
jge 0x180016c31
movsxd rax, dword [r14 + 4]
add rax, rcx
mov qword [r12], rax
inc r13
add rdi, 0x30
add r14, 0x60
cmp r13, rsi
jl 0x180016bb3
mov r14, qword [rsp + 0x48]
mov r12, qword [rsp + 0x40]
mov rdi, qword [rsp + 0x38]
mov rsi, qword [rsp + 0x60]
mov qword [rbp + 0x98], rbx
mov rbx, qword [rbp + 0x80]
mov qword [rsp + 0x30], r15
mov rdx, qword [rbx]
xor r13d, r13d
cmp dword [rdx + 8], 3
jne 0x180016cf0
cmp qword [rbp + 0x98], r13
je 0x180016ccb
mov r8d, r13d
cmp dword [rdx], r13d
jbe 0x180016e6e
add rsi, 3
mov r9d, r8d
mov rdx, r13
mov al, byte [r9 + rdi]
mov byte [rsi - 3], al
mov rax, qword [rsp + rdx*8 + 0x40]
mov cl, byte [r9 + rax]
mov byte [rdx + rsi - 2], cl
inc rdx
cmp rdx, 2
jl 0x180016c9e
mov byte [rsi], 0xff
inc r8d
mov rax, qword [rbx]
add rsi, 4
cmp r8d, dword [rax]
jb 0x180016c91
jmp 0x180016e6e
mov eax, dword [rdx]
mov r9, r14
mov rdx, rdi
mov dword [rsp + 0x28], 4
mov r8, r12
mov dword [rsp + 0x20], eax
mov rcx, rsi
call qword [rbx + 0x4878]
jmp 0x180016e6e
cmp dword [rdx + 8], 4
jne 0x180016e42
mov eax, dword [rbx + 0x484c]
test eax, eax
jne 0x180016d8b
mov r9d, r13d
cmp dword [rdx], r13d
jbe 0x180016e6e
mov r15, qword [rsp + 0x50]
add rsi, 2
mov edx, r9d
inc r9d
movzx r8d, byte [rdx + r15]
movzx ecx, byte [rdx + rdi]
imul ecx, r8d
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [rsi - 2], al
movzx ecx, byte [rdx + r12]
imul ecx, r8d
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [rsi - 1], al
movzx ecx, byte [rdx + r14]
mov byte [rsi + 1], 0xff
imul ecx, r8d
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [rsi], al
lea rsi, [rsi + 4]
mov rax, qword [rbx]
cmp r9d, dword [rax]
jb 0x180016d1d
mov r15, qword [rsp + 0x30]
jmp 0x180016e6e
mov ecx, dword [rdx]
mov r9, r14
mov r10, qword [rbx + 0x4878]
mov r8, r12
mov dword [rsp + 0x28], 4
mov rdx, rdi
mov dword [rsp + 0x20], ecx
mov rcx, rsi
cmp eax, 2
jne 0x180016e3d
call r10
mov rax, qword [rbx]
mov r8d, r13d
cmp dword [rax], r13d
jbe 0x180016e6e
mov r14, qword [rsp + 0x50]
add rsi, 2
mov eax, r8d
inc r8d
movzx edx, byte [rax + r14]
mov al, byte [rsi - 2]
not al
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [rsi - 2], al
mov al, byte [rsi - 1]
not al
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [rsi - 1], al
mov al, byte [rsi]
not al
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [rsi], al
lea rsi, [rsi + 4]
mov rax, qword [rbx]
cmp r8d, dword [rax]
jb 0x180016dd0
mov r14, qword [rsp + 0x48]
jmp 0x180016e6e
call r10
jmp 0x180016e6e
mov r8d, r13d
cmp dword [rdx], r13d
jbe 0x180016e6e
inc rsi
mov eax, r8d
inc r8d
mov cl, byte [rax + rdi]
mov byte [rsi + 1], cl
mov byte [rsi], cl
mov byte [rsi - 1], cl
mov byte [rsi + 2], 0xff
lea rsi, [rsi + 4]
mov rax, qword [rbx]
cmp r8d, dword [rax]
jb 0x180016e4d
mov eax, dword [rbp + 0xa0]
mov rdx, qword [rbx]
inc eax
mov dword [rbp + 0xa0], eax
cmp eax, dword [rdx + 4]
jb 0x180016b80
mov edx, dword [rdx + 8]
xor r8d, r8d
mov rcx, rbx
call fcn.180015708
mov rcx, qword [rbx]
mov rax, qword [rbp + 0x88]
mov edx, dword [rcx]
mov dword [rax], edx
mov rcx, qword [rbx]
mov rax, qword [rbp + 0x90]
mov edx, dword [rcx + 4]
mov dword [rax], edx
mov rax, r15
jmp 0x180016eee
mov rdx, qword [rbx]
mov edx, dword [rdx + 8]
xor r8d, r8d
mov rcx, rbx
call fcn.180015708
mov edx, dword [0x1801b53a4]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, [0x1800c00e8]
mov ecx, 0xa20
mov qword [rcx + rax], rdx
xor eax, eax
add rsp, 0x138
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret