Function at 0x1400409c0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rdi
push r12
push r13
sub rsp, 0x10
mov r13, rcx
xor r12d, r12d
mov rcx, qword [rcx]
mov rdi, rdx
cmp dword [r13 + 0x14], r12d
jle 0x140040c37
mov qword [rsp + 0x38], rbx
mov qword [rsp + 0x40], rbp
mov qword [rsp + 0x48], rsi
mov qword [rsp + 8], r14
mov qword [rsp], r15
nop dword [rax + rax]
movsxd rax, dword [r13 + 0x1c]
mov r14, rcx
mov r15d, dword [r14]
lea rcx, [rcx + rax*4]
dec r15d
mov qword [rsp + 0x30], rcx
test r15d, r15d
jle 0x140040c12
mov edx, dword [r13 + 0xc]
add r14, 4
mov r8, qword [rdi + 8]
add edx, r12d
mov r9, qword [rdi]
xor r10d, r10d
movsxd rax, edx
sub edx, dword [rdi + 0x18]
mov ebx, dword [r14]
movsxd rcx, dword [r9 + 0x14]
imul rcx, rax
mov eax, edx
add rcx, qword [r9]
cdq
mov qword [rdi + 0x20], rcx
idiv dword [r8 + 0x20]
movsxd rax, dword [r8 + 0x14]
movsxd rcx, edx
imul rcx, rax
add rcx, qword [r8]
sub r15d, 1
mov qword [rdi + 0x28], rcx
js 0x140040ba5
nop
mov esi, dword [r14 + 4]
lea r14, [r14 + 8]
mov ebp, dword [r14]
mov eax, ebp
cdq
movzx r9d, dl
add r9d, eax
mov eax, ebx
cdq
sar r9d, 8
movzx edx, dl
add eax, edx
sar eax, 8
mov r11d, eax
cmp r9d, eax
jne 0x140040aab
mov eax, ebp
sub eax, ebx
imul eax, esi
add r10d, eax
jmp 0x140040b96
movzx eax, bl
mov ecx, 0x100
sub ecx, eax
imul ecx, esi
lea eax, [r10 + rcx]
cdq
movzx edx, dl
add eax, edx
sar eax, 8
mov ecx, eax
test eax, eax
jle 0x140040b19
mov rax, qword [rdi]
mov edx, dword [rax + 0x18]
imul edx, r11d
movsxd r8, edx
add r8, qword [rdi + 0x20]
cmp ecx, 0xff
jl 0x140040af1
mov eax, dword [rdi + 0x10]
inc eax
imul edx, eax, 0xff
jmp 0x140040b00
imul ecx, dword [rdi + 0x10]
sar ecx, 8
inc ecx
imul edx, ecx, 0xff
movzx eax, byte [r8]
mov ecx, 0x100
shr edx, 8
sub ecx, edx
imul ecx, eax
sar ecx, 8
add cl, dl
mov byte [r8], cl
test esi, esi
jle 0x140040b8e
inc r11d
sub r9d, r11d
test r9d, r9d
jle 0x140040b8e
mov rax, qword [rdi]
mov ecx, esi
imul ecx, dword [rdi + 0x10]
movsxd r10, dword [rax + 0x18]
mov eax, r10d
imul eax, r11d
sar ecx, 8
cdqe
add rax, qword [rdi + 0x20]
cmp ecx, 0xfe
jge 0x140040b80
inc ecx
mov r8d, 0x100
imul edx, ecx, 0xff
shr edx, 8
sub r8d, edx
movzx ecx, byte [rax]
dec r9d
imul ecx, r8d
sar ecx, 8
add cl, dl
mov byte [rax], cl
add rax, r10
test r9d, r9d
jg 0x140040b61
jmp 0x140040b8e
mov byte [rax], 0xff
dec r9d
add rax, r10
test r9d, r9d
jg 0x140040b80
movzx r10d, bpl
imul r10d, esi
sub r15d, 1
mov ebx, ebp
jns 0x140040a70
mov r9, qword [rdi]
mov eax, r10d
cdq
movzx edx, dl
add eax, edx
sar eax, 8
mov ecx, eax
test eax, eax
jle 0x140040c0d
mov eax, ebx
cdq
movzx edx, dl
add eax, edx
mov edx, dword [r9 + 0x18]
sar eax, 8
imul edx, eax
movsxd r8, edx
add r8, qword [rdi + 0x20]
cmp ecx, 0xff
jl 0x140040be5
mov eax, dword [rdi + 0x10]
inc eax
imul edx, eax, 0xff
jmp 0x140040bf4
imul ecx, dword [rdi + 0x10]
sar ecx, 8
inc ecx
imul edx, ecx, 0xff
movzx eax, byte [r8]
mov ecx, 0x100
shr edx, 8
sub ecx, edx
imul ecx, eax
sar ecx, 8
add cl, dl
mov byte [r8], cl
mov rcx, qword [rsp + 0x30]
inc r12d
cmp r12d, dword [r13 + 0x14]
jl 0x140040a00
mov r15, qword [rsp]
mov r14, qword [rsp + 8]
mov rsi, qword [rsp + 0x48]
mov rbp, qword [rsp + 0x40]
mov rbx, qword [rsp + 0x38]
add rsp, 0x10
pop r13
pop r12
pop rdi
ret