Function at 0x59af10
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, 0x38
mov rax, qword [rcx + 0x38]
mov rdi, qword [rsp + 0xa0]
lea rbp, [r9 + 2]
mov r13, r8
mov r14, rcx
mov r15, rdx
mov qword [rsp + 0x98], r9
mov r12, qword [rdx + 0x48]
cmp rax, r9
cmove rbp, rax
add rdi, 2
cmp rax, qword [rsp + 0xa0]
cmove rdi, qword [rsp + 0xa0]
call fcn.0059a6e0
cmp qword [rsp + 0xb0], 0
mov r8, rax
je 0x59af82
mov rax, qword [rsp + 0xb0]
mov dword [rax], 0
cmp r13, qword [r14 + 0x30]
je 0x59b220
movzx edx, word [r13 - 2]
movzx ecx, dh
movzx edx, dl
add rcx, 0x2e
mov rax, qword [r12 + rcx*8]
movsx r9d, word [rax + rdx*2]
mov qword [rsp + 0x28], r13
mov qword [rsp + 0x20], r13
mov rdx, r15
mov rcx, r14
call fcn.0059ab00
test rax, rax
je 0x59b060
test byte [r14 + 0x10], 8
mov qword [rax + 0x20], r13
lea rbx, [r13 + 2]
je 0x59b070
cmp rdi, r13
mov r8, rax
ja 0x59b00e
jmp 0x59b249
mov r8, rax
mov ecx, dword [r8 + 0xc]
mov qword [r8 + 0x20], rbx
and ecx, 2
setne al
cmp rbp, rbx
setbe dl
and dl, al
jne 0x59b0f5
add rbx, 2
cmp rdi, rsi
jbe 0x59b210
movzx eax, word [rbx - 2]
mov rsi, rbx
movzx edx, ah
movzx r9d, al
mov rax, qword [r8 + 0x28]
add rdx, 0x2e
mov rdx, qword [r12 + rdx*8]
movsx rdx, word [rdx + r9*2]
mov rax, qword [rax + rdx*8]
mov r9, rdx
test rax, rax
jne 0x59afe2
mov qword [rsp + 0x28], r13
mov qword [rsp + 0x20], rbx
mov rdx, r15
mov rcx, r14
call fcn.0059ab00
test rax, rax
mov r8, rax
jne 0x59afe5
nop word cs:[rax + rax]
xor eax, eax
jmp 0x59b183
cmp rdi, r13
mov r8, rax
ja 0x59b0a8
jmp 0x59b249
mov r8, rax
mov ecx, dword [r8 + 0xc]
mov qword [r8 + 0x20], rbx
and ecx, 2
setne al
cmp rbp, rbx
setbe dl
and dl, al
jne 0x59b0f5
add rbx, 2
cmp rdi, rsi
jbe 0x59b210
movzx eax, word [rbx - 2]
mov rsi, rbx
movzx edx, ah
movzx r9d, al
mov rax, qword [r8 + 0x28]
add rdx, 0x2e
mov rdx, qword [r12 + rdx*8]
movsx rdx, word [rdx + r9*2]
mov rax, qword [rax + rdx*8]
mov r9, rdx
test rax, rax
jne 0x59b080
mov qword [rsp + 0x28], r13
mov qword [rsp + 0x20], rbx
mov rdx, r15
mov rcx, r14
call fcn.0059ab00
test rax, rax
mov r8, rax
jne 0x59b083
jmp 0x59b060
mov rax, r8
cmp qword [rsp + 0xa8], 0
je 0x59b166
mov rbx, qword [r15 + 0x58]
test rbx, rbx
je 0x59b240
mov r9d, dword [r15 + 4]
mov r8, qword [r15 + 0x18]
test r9d, r9d
jle 0x59b15b
sub r9d, 1
add r9, 1
lea rdi, [r9*8]
shl r9, 6
sub r9, rdi
add r9, r8
nop word [rax + rax]
test byte [r8 + 0xc], 8
je 0x59b152
mov r10, qword [r8 + 0x20]
cmp rbx, r10
cmovb rbx, r10
add r8, 0x38
cmp r8, r9
jne 0x59b140
mov rdi, qword [rsp + 0xa8]
mov qword [rdi], rbx
cmp qword [rsp + 0x98], rsi
jae 0x59b194
test dl, dl
je 0x59b194
sub rsi, 2
test ecx, ecx
je 0x59b060
mov rax, rsi
add rsp, 0x38
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov rdx, qword [r14 + 0x38]
cmp rdx, rsi
jne 0x59b178
cmp qword [rsp + 0xa0], rdx
jne 0x59b178
xor edx, edx
test byte [r14 + 0x10], 2
mov rcx, qword [r15 + 0x40]
mov r8, rax
sete dl
add rdx, 8
movsx r9d, word [rcx + rdx*2 + 8]
mov qword [rsp + 0x28], r13
mov rdx, r15
mov qword [rsp + 0x20], rsi
mov rcx, r14
call fcn.0059ab00
test rax, rax
je 0x59b25a
test byte [rax + 0xc], 2
jne 0x59b180
cmp qword [rsp + 0xb0], 0
je 0x59b060
mov rdi, qword [rsp + 0xb0]
mov dword [rdi], 1
mov ecx, dword [rax + 0xc]
and ecx, 2
jmp 0x59b178
mov edi, eax
mov rax, r8
mov edx, edi
jmp 0x59b0f8
mov eax, dword [r14 + 0x10]
mov rdx, qword [r15 + 0x40]
and eax, 1
xor eax, 1
cdqe
add rax, 8
movsx r9d, word [rdx + rax*2 + 4]
jmp 0x59afa4
mov rbx, qword [r14 + 0x30]
jmp 0x59b110
mov ecx, dword [rax + 0xc]
mov rsi, r13
and ecx, 2
setne dl
jmp 0x59b0f8
cmp qword [rsp + 0xb0], 0
je 0x59b060
mov rax, qword [rsp + 0xb0]
mov dword [rax], 1
xor eax, eax
jmp 0x59b183