Function at 0x140040950
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov qword [rsp + 0x10], rdx
mov qword [rsp + 8], rcx
push rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x58
mov r9, qword [rcx + 0x18]
mov rdi, qword [rdx]
mov ebx, r8d
mov eax, dword [r9 + 8]
mov ebp, dword [r9 + 4]
mov r14, rcx
cdq
lea r9d, [rbp*4]
mov qword [rsp + 0x48], rdi
sub eax, edx
mov dword [rsp], r9d
sar eax, 1
cmp r8d, eax
mov r8, qword [rcx]
cmovg ebx, eax
mov qword [rsp + 8], r8
test ebx, ebx
mov dword [rsp + 0xb0], ebx
jle 0x140040b69
movsxd r10, r9d
lea r11, [rdi + 2]
lea r9, [r8 + 2]
xor esi, esi
mov r12d, ebx
mov qword [rsp + 0x10], r9
mov qword [rsp + 0x38], r10
mov qword [rsp + 0x20], r11
mov dword [rsp + 0xb8], esi
mov qword [rsp + 0x18], r12
nop
mov eax, esi
mov ecx, 0xff
mov dword [rsp + 4], 0
cdq
idiv ebx
sub cl, al
test ebp, ebp
jle 0x140040b21
movzx eax, cl
mov r14, rdi
mov r12, r9
mov dword [rsp + 0x30], eax
mov r13, r9
sub r14, r8
mov edi, dword [rsp + 0x30]
sub r12, r8
sub r13, r8
mov ebp, 0xff
mov r15, r11
mov rsi, r8
sub ebp, eax
sub r15, r8
mov rax, r11
sub rax, r8
mov qword [rsp + 0x28], rax
mov rax, r9
mov r9, qword [rsp + 0xa0]
mov rbx, qword [rsp + 0x28]
sub rax, r8
mov r8d, dword [rsp + 4]
mov r10, rax
nop
movzx ecx, byte [r14 + rsi]
movzx eax, byte [rsi]
add r8d, 1
add rsi, 4
imul eax, ebp
imul ecx, edi
add ecx, eax
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
movzx eax, byte [r12 + rsi - 5]
mov byte [rsi - 4], dl
movzx ecx, byte [r15 + rsi - 5]
imul eax, ebp
imul ecx, edi
add ecx, eax
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
movzx eax, byte [r13 + rsi - 4]
mov byte [r12 + rsi - 5], dl
movzx ecx, byte [rbx + rsi - 4]
mov byte [r10 + rsi - 3], 0xff
imul eax, ebp
imul ecx, edi
add ecx, eax
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [r13 + rsi - 4], dl
mov rax, qword [r9 + 0x18]
mov r11d, dword [rax + 4]
cmp r8d, r11d
mov dword [rsp + 4], r11d
jl 0x140040a50
mov r8, qword [rsp + 8]
mov r9, qword [rsp + 0x10]
mov r10, qword [rsp + 0x38]
mov r11, qword [rsp + 0x20]
mov ebx, dword [rsp + 0xb0]
mov rdi, qword [rsp + 0x48]
mov esi, dword [rsp + 0xb8]
mov ebp, dword [rsp + 4]
mov r12, qword [rsp + 0x18]
add rdi, r10
add r11, r10
add r8, r10
add r9, r10
add esi, 0xff
sub r12, 1
mov qword [rsp + 0x48], rdi
mov qword [rsp + 0x20], r11
mov qword [rsp + 8], r8
mov qword [rsp + 0x18], r12
mov qword [rsp + 0x10], r9
mov dword [rsp + 0xb8], esi
jne 0x1400409e0
mov r14, qword [rsp + 0xa0]
mov r9d, dword [rsp]
mov rax, qword [r14 + 0x18]
mov ecx, dword [rax + 8]
mov rax, qword [rsp + 0xa8]
mov rax, qword [rax]
sub ecx, ebx
imul ecx, r9d
test ebx, ebx
movsxd rdx, ecx
lea r13, [rdx + rax]
mov rax, qword [r14]
lea r8, [rdx + rax]
mov qword [rsp + 0x18], r13
jle 0x140040d4d
mov rax, qword [r14 + 0x18]
movsxd r11, r9d
mov esi, 0xff
mov ecx, dword [rax + 4]
mov eax, ebx
lea r10, [r8 + 2]
imul eax, eax, 0xff
lea rdi, [r13 + 2]
mov r9d, ebx
sub esi, eax
mov qword [rsp + 0x28], r11
mov qword [rsp + 8], r10
mov qword [rsp + 0x10], rdi
mov qword [rsp + 0x20], r9
mov dword [rsp + 0xa8], esi
nop
nop
mov eax, esi
mov dword [rsp], 0
cdq
idiv ebx
sub al, 1
test ecx, ecx
jle 0x140040d16
movzx ecx, al
mov rax, rdi
mov r14, r13
sub rax, r8
mov r15, rdi
mov edi, dword [rsp]
mov qword [rsp + 0x38], rax
mov rbp, r10
mov r12, r10
mov r11, qword [rsp + 0x38]
mov rax, r10
mov r10, qword [rsp + 0xa0]
mov ebx, 0xff
sub r14, r8
sub r15, r8
sub rbp, r8
sub r12, r8
sub ebx, ecx
sub rax, r8
mov r9, r8
mov r13d, ecx
mov rsi, rax
nop
nop
nop
nop
movzx ecx, byte [r14 + r9]
movzx eax, byte [r9]
add edi, 1
add r9, 4
imul eax, ebx
imul ecx, r13d
add ecx, eax
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
movzx eax, byte [r9 + rbp - 5]
mov byte [r9 - 4], dl
movzx ecx, byte [r15 + r9 - 5]
imul eax, ebx
imul ecx, r13d
add ecx, eax
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
movzx eax, byte [r12 + r9 - 4]
mov byte [r9 + rbp - 5], dl
movzx ecx, byte [r11 + r9 - 4]
mov byte [rsi + r9 - 3], 0xff
imul eax, ebx
imul ecx, r13d
add ecx, eax
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [r12 + r9 - 4], dl
mov rax, qword [r10 + 0x18]
mov ecx, dword [rax + 4]
cmp edi, ecx
jl 0x140040c50
mov r10, qword [rsp + 8]
mov r11, qword [rsp + 0x28]
mov rdi, qword [rsp + 0x10]
mov esi, dword [rsp + 0xa8]
mov r13, qword [rsp + 0x18]
mov ebx, dword [rsp + 0xb0]
mov r9, qword [rsp + 0x20]
add r13, r11
add rdi, r11
add r10, r11
add esi, 0xff
add r8, r11
sub r9, 1
mov qword [rsp + 0x18], r13
mov qword [rsp + 0x10], rdi
mov qword [rsp + 8], r10
mov qword [rsp + 0x20], r9
mov dword [rsp + 0xa8], esi
jne 0x140040be0
add rsp, 0x58
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret