Function at 0x682ba980
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x78
mov rbx, qword [rdx]
mov r11, qword [rdx + 8]
mov r10, qword [rdx + 0x10]
mov r13, rbx
mov r12, r11
movzx ebx, bx
movzx r11d, r11w
sar r13, 0x10
mov rbp, r10
sar r12, 0x10
movzx r10d, r10w
mov rsi, r8
sar rbp, 0x10
lea r9, [rsp + 0x40]
lea rdi, [rcx + 0x24]
movsxd rax, dword [rcx]
movsxd rdx, dword [rcx + 4]
add rcx, 0xc
add r9, 0x10
movsxd r14, dword [rcx - 4]
mov r8, rax
imul rax, rbx
mov r15, rdx
imul r15, r12
imul r8, r13
imul rdx, r11
add r8, r15
mov r15, r14
imul r15, rbp
add rdx, rax
imul r14, r10
add r8, r15
lea rax, [rdx + r14]
mov qword [r9 - 0x10], r8
mov qword [r9 - 8], rax
cmp rdi, rcx
jne 0x682ba9c7
mov r9, qword [rsp + 0x68]
mov rdx, qword [rsp + 0x48]
mov rax, qword [rsp + 0x40]
mov rbx, qword [rsp + 0x58]
mov r8, r9
mov r12, qword [rsp + 0x50]
sar r8, 0x10
add r8, qword [rsp + 0x60]
test r9w, r9w
sete cl
cmp r8, 0x10000
jne 0x682baa78
test cl, cl
je 0x682baa78
add rdx, 0x8000
add rbx, 0x8000
xor edi, edi
sar rdx, 0x10
sar rbx, 0x10
add rax, rdx
add r12, rbx
mov qword [rsi], rax
mov qword [rsi + 8], r12
jmp 0x682bacbd
test r8, r8
jne 0x682baaf9
test cl, cl
je 0x682baaf9
add rdx, 0x8000
add rbx, 0x8000
sar rdx, 0x10
sar rbx, 0x10
add rax, rdx
add r12, rbx
mov qword [rsi], rax
mov qword [rsi + 8], r12
test rax, rax
jle 0x682baab5
movabs rax, 0x7fffffffffffffff
jmp 0x682baac0
je 0x682baac3
mov eax, 1
shl rax, 0x3f
mov qword [rsi], rax
test r12, r12
jle 0x682baae0
movabs rax, 0x7fffffffffffffff
mov edi, 1
mov qword [rsi + 8], rax
jmp 0x682bacbd
mov edi, 1
je 0x682bacbd
mov eax, 1
shl rax, 0x3f
jmp 0x682bacb9
mov rcx, r8
sar rcx, 0x20
mov edi, ecx
jns 0x682bab06
not edi
mov rcx, rdx
movzx r10d, r9w
lea r9, [rsp + 0x38]
sar rcx, 0x10
add rax, rcx
test edi, edi
jne 0x682baba5
shl rdx, 0x10
mov rcx, rax
shl r8, 0x10
shl rcx, 0x20
sar rax, 0x20
mov edx, edx
add r8, r10
add rdx, rcx
mov rcx, rax
mov qword [rsp + 0x28], r8
call fcn.682de960
mov rdx, qword [rsp + 0x38]
mov r8, qword [rsp + 0x28]
mov rcx, rax
sar rcx, 0x3f
cmp rdx, rcx
je 0x682bab7f
test rdx, rdx
mov edi, 1
movabs rax, 0x7fffffffffffffff
movabs rdx, 0x8000000000000000
cmovs rax, rdx
mov rcx, rbx
shl rbx, 0x10
mov qword [rsi], rax
sar rcx, 0x10
mov edx, ebx
add rcx, r12
mov rbx, rcx
sar rcx, 0x20
shl rbx, 0x20
add rdx, rbx
jmp 0x682bac83
bsr ebp, edi
mov ecx, 0x10
xor ebp, 0x1f
lea r14d, [rbp - 0x10]
test r14d, r14d
jg 0x682babc0
sub ecx, ebp
sar r8, cl
jmp 0x682babcf
sub ecx, r14d
sar r10, cl
mov ecx, r14d
shl r8, cl
add r8, r10
mov r13d, 0x40
mov r10, rax
movzx edx, dx
sub r13d, ebp
mov ecx, r13d
sar r10, cl
mov ecx, ebp
shl rax, cl
cmp ebp, 0xf
jg 0x682babfa
mov ecx, 0x10
sub ecx, ebp
sar rdx, cl
jmp 0x682bac00
mov ecx, r14d
shl rdx, cl
add rdx, rax
mov rcx, r10
mov qword [rsp + 0x28], r8
xor edi, edi
call fcn.682de960
mov rdx, qword [rsp + 0x38]
mov r8, qword [rsp + 0x28]
mov rcx, rax
sar rcx, 0x3f
cmp rdx, rcx
je 0x682bac48
test rdx, rdx
mov edi, 1
movabs rax, 0x7fffffffffffffff
movabs rdx, 0x8000000000000000
cmovs rax, rdx
mov rdx, rbx
mov ecx, r13d
mov qword [rsi], rax
movzx ebx, bx
sar rdx, 0x10
add rdx, r12
mov r10, rdx
sar r10, cl
mov ecx, ebp
shl rdx, cl
cmp ebp, 0xf
jg 0x682bac77
mov ecx, 0x10
sub ecx, ebp
sar rbx, cl
jmp 0x682bac7d
mov ecx, r14d
shl rbx, cl
add rdx, rbx
mov rcx, r10
call fcn.682de960
mov rdx, qword [rsp + 0x38]
mov rcx, rax
sar rcx, 0x3f
cmp rdx, rcx
je 0x682bacb9
test rdx, rdx
mov edi, 1
movabs rax, 0x7fffffffffffffff
movabs rdx, 0x8000000000000000
cmovs rax, rdx
mov qword [rsi + 8], rax
mov eax, edi
mov qword [rsi + 0x10], 0x10000
xor eax, 1
add rsp, 0x78
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret