Function at 0x1400407b0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rbx
push r12
push r13
sub rsp, 0x10
mov r13, rcx
xor r12d, r12d
mov rcx, qword [rcx]
mov rbx, rdx
cmp dword [r13 + 0x14], r12d
jle 0x140040aec
mov qword [rsp + 0x38], rbp
mov qword [rsp + 0x40], rsi
mov qword [rsp + 0x48], rdi
mov qword [rsp + 8], r14
mov qword [rsp], r15
nop dword [rax + rax]
movsxd rax, dword [r13 + 0x1c]
mov rdi, rcx
mov r15d, dword [rdi]
lea rcx, [rcx + rax*4]
dec r15d
mov qword [rsp + 0x30], rcx
test r15d, r15d
jle 0x140040ac7
mov rdx, qword [rbx]
add rdi, 4
mov r8d, dword [r13 + 0xc]
xor r11d, r11d
add r8d, r12d
mov eax, dword [rdx + 0xc]
mov r10d, dword [rdi]
imul eax, r8d
sub r8d, dword [rbx + 0x18]
movsxd rcx, eax
mov eax, r8d
add rcx, qword [rdx]
cdq
mov qword [rbx + 0x20], rcx
mov rcx, qword [rbx + 8]
idiv dword [rcx + 0x18]
imul edx, dword [rcx + 0xc]
movsxd rax, edx
add rax, qword [rcx]
sub r15d, 1
mov qword [rbx + 0x28], rax
js 0x140040a2a
nop dword [rax + rax]
mov esi, dword [rdi + 4]
lea rdi, [rdi + 8]
mov r14d, dword [rdi]
mov ecx, r10d
mov r9d, r14d
sar ecx, 8
sar r9d, 8
cmp r9d, ecx
jne 0x14004088d
mov eax, r14d
sub eax, r10d
imul eax, esi
add r11d, eax
jmp 0x140040a1d
movzx eax, r10b
mov r10d, 0x100
sub r10d, eax
imul r10d, esi
add r10d, r11d
sar r10d, 8
test r10d, r10d
jle 0x140040937
mov rax, qword [rbx]
mov r8, qword [rbx + 8]
mov edx, dword [rax + 0x10]
mov eax, ecx
sub eax, dword [rbx + 0x14]
imul edx, ecx
movsxd r11, edx
cdq
idiv dword [r8 + 0x14]
mov rax, qword [rbx + 0x28]
imul edx, dword [r8 + 0x10]
add r11, qword [rbx + 0x20]
movsxd r8, edx
movzx edx, byte [r8 + rax + 3]
movzx eax, dl
mov edx, 0x100
cmp r10d, 0xff
jl 0x140040910
mov r8d, dword [rbx + 0x10]
inc r8d
imul r8d, eax
movzx eax, byte [r11]
shr r8d, 8
sub edx, r8d
imul edx, eax
sar edx, 8
add dl, r8b
jmp 0x140040934
imul r10d, dword [rbx + 0x10]
sar r10d, 8
inc r10d
imul r10d, eax
movzx eax, byte [r11]
shr r10d, 8
sub edx, r10d
imul edx, eax
sar edx, 8
add dl, r10b
mov byte [r11], dl
test esi, esi
jle 0x140040a15
inc ecx
sub r9d, ecx
test r9d, r9d
jle 0x140040a15
mov rax, qword [rbx]
movsxd rdx, dword [rax + 0x10]
mov eax, edx
imul eax, ecx
sub ecx, dword [rbx + 0x14]
movsxd r10, eax
mov eax, dword [rbx + 0x10]
add r10, qword [rbx + 0x20]
imul eax, esi
sar eax, 8
cmp eax, 0xfe
jge 0x1400409ce
lea r11d, [rax + 1]
mov rbp, rdx
nop word [rax + rax]
mov r8, qword [rbx + 8]
mov eax, ecx
cdq
inc ecx
dec r9d
idiv dword [r8 + 0x14]
mov eax, dword [r8 + 0x10]
imul eax, edx
movsxd rdx, eax
mov rax, qword [rbx + 0x28]
movzx r8d, byte [rdx + rax + 3]
mov edx, 0x100
movzx eax, byte [r10]
imul r8d, r11d
shr r8d, 8
sub edx, r8d
imul edx, eax
sar edx, 8
add dl, r8b
mov byte [r10], dl
add r10, rbp
test r9d, r9d
jg 0x140040980
jmp 0x140040a15
mov r11, rdx
mov r8, qword [rbx + 8]
mov eax, ecx
cdq
inc ecx
dec r9d
idiv dword [r8 + 0x14]
mov eax, dword [r8 + 0x10]
imul eax, edx
movsxd rdx, eax
mov rax, qword [rbx + 0x28]
movzx r8d, byte [rdx + rax + 3]
mov edx, 0x100
movzx eax, byte [r10]
sub edx, r8d
imul edx, eax
sar edx, 8
add dl, r8b
mov byte [r10], dl
add r10, r11
test r9d, r9d
jg 0x1400409d1
movzx r11d, r14b
imul r11d, esi
sub r15d, 1
mov r10d, r14d
jns 0x140040860
sar r11d, 8
test r11d, r11d
jle 0x140040ac2
mov r8, qword [rbx + 8]
mov rcx, qword [rbx]
sar r10d, 8
mov edx, dword [rcx + 0x10]
imul edx, r10d
sub r10d, dword [rbx + 0x14]
mov eax, r10d
movsxd r9, edx
cdq
idiv dword [r8 + 0x14]
mov rax, qword [rbx + 0x28]
imul edx, dword [r8 + 0x10]
add r9, qword [rbx + 0x20]
movsxd rcx, edx
movzx r8d, byte [rcx + rax + 3]
mov ecx, 0x100
movzx eax, r8b
cmp r11d, 0xff
jl 0x140040a9b
mov edx, dword [rbx + 0x10]
inc edx
imul edx, eax
movzx eax, byte [r9]
shr edx, 8
sub ecx, edx
imul ecx, eax
sar ecx, 8
add cl, dl
jmp 0x140040abf
imul r11d, dword [rbx + 0x10]
sar r11d, 8
inc r11d
imul r11d, eax
movzx eax, byte [r9]
shr r11d, 8
sub ecx, r11d
imul ecx, eax
sar ecx, 8
add cl, r11b
mov byte [r9], cl
mov rcx, qword [rsp + 0x30]
inc r12d
cmp r12d, dword [r13 + 0x14]
jl 0x1400407f0
mov r15, qword [rsp]
mov r14, qword [rsp + 8]
mov rdi, qword [rsp + 0x48]
mov rsi, qword [rsp + 0x40]
mov rbp, qword [rsp + 0x38]
add rsp, 0x10
pop r13
pop r12
pop rbx
ret