Function at 0x4beb80
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub rsp, 0x58
mov qword [rsp + 0x60], rbx
mov qword [rsp + 0x48], r13
mov rbx, rcx
mov rcx, qword [rcx + 0x10]
movzx r13d, word [rcx + 4]
movzx eax, word [rcx + 2]
shl r13d, 0x10
or r13d, eax
cmp byte [rcx + 1], 0x1f
jae 0x4bec4b
mov rax, qword [rbx]
mov edx, dword [rax + 8]
test edx, edx
je 0x4bec4b
mov rax, qword [rbx + 0x40]
cmp word [rax + rdx], 1
lea r8, [rax + rdx]
jne 0x4bebdd
movzx eax, byte [r8 + 3]
cmp al, 0x20
jae 0x4bec4b
inc al
mov byte [r8 + 3], al
jmp 0x4bec4b
mov edx, dword [r8 + 4]
add rdx, rax
movzx eax, byte [rcx]
cmp byte [rdx], al
je 0x4bec38
nop
nop
add rdx, 6
cmp byte [rdx], al
jne 0x4bebf0
movzx eax, byte [rdx - 5]
cmp byte [rdx + 1], al
jb 0x4bec38
mov eax, dword [rdx]
lea rcx, [rdx - 6]
lea r9, [rsp + 0x20]
mov dword [r9], eax
movzx eax, word [rdx + 4]
mov word [r9 + 4], ax
mov eax, dword [rcx]
mov dword [rdx], eax
movzx eax, word [rcx + 4]
mov word [rdx + 4], ax
lea rdx, [rsp + 0x20]
mov eax, dword [rdx]
mov dword [rcx], eax
movzx eax, word [rdx + 4]
mov rdx, rcx
mov word [rcx + 4], ax
movzx eax, byte [rdx + 1]
cmp al, 0x73
jae 0x4bec4b
add al, 2
mov byte [rdx + 1], al
add word [r8 + 2], 2
cmp dword [rbx + 0x18], 0
jne 0x4beca1
mov edx, 1
mov rcx, rbx
call fcn.004be880
test rax, rax
mov qword [rbx + 8], rax
mov qword [rbx], rax
jne 0x4bec80
mov rcx, rbx
mov r13, qword [rsp + 0x48]
mov rbx, qword [rsp + 0x60]
add rsp, 0x58
jmp fcn.004be660
sub eax, dword [rbx + 0x40]
mov rcx, qword [rbx + 0x10]
mov word [rcx + 2], ax
shr eax, 0x10
mov word [rcx + 4], ax
mov r13, qword [rsp + 0x48]
mov rbx, qword [rsp + 0x60]
add rsp, 0x58
ret
mov rax, qword [rbx + 0x10]
mov rcx, qword [rbx + 0x58]
mov qword [rsp + 0x40], r14
movzx eax, byte [rax]
mov byte [rcx], al
inc qword [rbx + 0x58]
mov rax, qword [rbx + 0x58]
mov r14d, eax
sub r14d, dword [rbx + 0x40]
cmp rax, qword [rbx + 0x60]
jb 0x4bece4
mov rcx, rbx
call fcn.004be660
mov r14, qword [rsp + 0x40]
mov r13, qword [rsp + 0x48]
mov rbx, qword [rsp + 0x60]
add rsp, 0x58
ret
test r13d, r13d
je 0x4bed1f
cmp r13d, r14d
ja 0x4bed04
xor edx, edx
mov rcx, rbx
call fcn.004be880
test rax, rax
mov r13, rax
je 0x4becc8
sub r13d, dword [rbx + 0x40]
add dword [rbx + 0x18], 0xffffffff
jne 0x4bed39
mov rax, qword [rbx]
xor ecx, ecx
mov r14d, r13d
cmp qword [rbx + 8], rax
setne cl
sub qword [rbx + 0x58], rcx
jmp 0x4bed39
mov rcx, qword [rbx + 0x10]
mov eax, r14d
shr eax, 0x10
mov word [rcx + 2], r14w
mov word [rcx + 4], ax
mov r13d, dword [rbx]
sub r13d, dword [rbx + 0x40]
mov rdx, qword [rbx]
mov rax, qword [rbx + 0x10]
mov qword [rsp + 0x68], rbp
movzx r10d, word [rdx + 2]
movzx ecx, byte [rax + 1]
mov qword [rsp + 0x70], rsi
mov qword [rsp + 0x78], rdi
mov rdi, qword [rbx + 8]
sub r10d, ecx
mov qword [rsp + 0x50], r12
mov qword [rsp + 0x38], r15
movzx r15d, word [rdx]
sub r10d, r15d
inc r10d
cmp rdi, rdx
mov dword [rsp + 0x20], r10d
je 0x4bf01b
movzx ebp, word [rdi]
cmp ebp, 1
je 0x4beeb2
test bpl, 1
jne 0x4bee75
mov esi, ebp
shr esi, 1
movzx r12d, byte [rsi + rbx + 0x91]
movzx eax, byte [rsi + rbx + 0x92]
cmp r12d, eax
je 0x4bee75
lea edx, [r12 + 1]
mov ecx, edx
mov eax, dword [rbx + rdx*4 + 0x114]
test eax, eax
je 0x4bedd9
mov rdx, rax
add rdx, qword [rbx + 0x40]
mov eax, dword [rdx]
mov dword [rbx + rcx*4 + 0x114], eax
jmp 0x4bee08
movzx eax, byte [rdx + rbx + 0x6c]
lea ecx, [rax + rax*2]
mov eax, dword [rbx + 0x50]
sub eax, dword [rbx + 0x48]
shl ecx, 2
cmp ecx, eax
ja 0x4bedfd
mov rdx, qword [rbx + 0x48]
mov eax, ecx
add rax, rdx
mov qword [rbx + 0x48], rax
jmp 0x4bee08
mov rcx, rbx
call fcn.004be3c0
mov rdx, rax
test rdx, rdx
je 0x4bf056
mov r9d, dword [rdi + 4]
mov r10, rdx
mov r8, rdx
add r9, qword [rbx + 0x40]
sub r10, r9
lea rcx, [r9 + 8]
nop
nop
nop
mov eax, dword [rcx - 8]
add rcx, 0xc
add r8, 0xc
add esi, 0xffffffff
mov dword [r8 - 0xc], eax
mov eax, dword [rcx - 0x10]
mov dword [r8 - 8], eax
mov eax, dword [rcx - 0xc]
mov dword [r10 + rcx - 0xc], eax
jne 0x4bee30
mov eax, dword [rbx + r12*4 + 0x114]
mov r10d, dword [rsp + 0x20]
mov dword [r9], eax
sub r9d, dword [rbx + 0x40]
mov dword [rbx + r12*4 + 0x114], r9d
sub edx, dword [rbx + 0x40]
mov dword [rdi + 4], edx
movzx r8d, word [rdi + 2]
xor edx, edx
lea eax, [rbp*8]
cmp r8d, eax
lea eax, [rbp*4]
setbe dl
xor ecx, ecx
cmp eax, r15d
setbe cl
lea eax, [rbp + rbp]
and dx, cx
add dx, dx
cmp eax, r15d
adc dx, r8w
mov word [rdi + 2], dx
jmp 0x4bef4b
mov eax, dword [rbx + 0x114]
test eax, eax
je 0x4beecd
mov rdx, rax
add rdx, qword [rbx + 0x40]
mov eax, dword [rdx]
mov dword [rbx + 0x114], eax
jmp 0x4bef02
movzx eax, byte [rbx + 0x6c]
lea ecx, [rax + rax*2]
mov eax, dword [rbx + 0x50]
sub eax, dword [rbx + 0x48]
shl ecx, 2
cmp ecx, eax
ja 0x4beef0
mov rdx, qword [rbx + 0x48]
mov eax, ecx
add rax, rdx
mov qword [rbx + 0x48], rax
jmp 0x4bef02
xor edx, edx
mov rcx, rbx
call fcn.004be3c0
mov r10d, dword [rsp + 0x20]
mov rdx, rax
test rdx, rdx
je 0x4bf056
mov ecx, dword [rdi + 2]
mov dword [rdx], ecx
movzx ecx, word [rdi + 6]
mov word [rdx + 4], cx
mov ecx, edx
sub ecx, dword [rbx + 0x40]
mov dword [rdi + 4], ecx
movzx eax, byte [rdx + 1]
cmp al, 0x1e
jae 0x4bef2f
add al, al
mov byte [rdx + 1], al
jmp 0x4bef33
mov byte [rdx + 1], 0x78
movzx eax, byte [rdx + 1]
xor ecx, ecx
cmp r15d, 3
seta cl
add cx, word [rbx + 0x1c]
add cx, ax
mov word [rdi + 2], cx
mov rax, qword [rbx + 0x10]
movzx r9d, word [rdi + 2]
movzx r8d, byte [rax + 1]
lea eax, [r9 + 6]
add r10d, r9d
imul r8d, eax
lea eax, [r10 + r10*2]
add r8d, r8d
add eax, eax
cmp r8d, eax
jae 0x4bef9b
xor ecx, ecx
lea eax, [r10*4]
cmp r8d, eax
setae cl
xor eax, eax
cmp r8d, r10d
seta al
add r9w, 3
lea r8d, [rcx + rax + 1]
mov word [rdi + 2], r9w
jmp 0x4befd4
xor edx, edx
mov eax, r10d
imul eax, eax, 0xf
cmp r8d, eax
lea eax, [r10 + r10*2]
setae dl
xor ecx, ecx
shl eax, 2
cmp r8d, eax
lea eax, [r10 + r10*8]
setae cl
add edx, ecx
xor ecx, ecx
cmp r8d, eax
setae cl
lea r8d, [rdx + rcx + 4]
add r9w, r8w
mov word [rdi + 2], r9w
mov eax, dword [rdi + 4]
mov r10d, dword [rsp + 0x20]
lea rcx, [rbp + rbp*2]
lea rdx, [rax + rcx*2]
mov eax, r14d
inc bp
add rdx, qword [rbx + 0x40]
shr eax, 0x10
mov word [rdx + 2], r14w
mov word [rdx + 4], ax
mov rax, qword [rbx + 0x10]
movzx ecx, byte [rax]
mov byte [rdx + 1], r8b
mov byte [rdx], cl
mov word [rdi], bp
mov edi, dword [rdi + 8]
add rdi, qword [rbx + 0x40]
cmp rdi, qword [rbx]
jne 0x4bed81
mov edx, r13d
add rdx, qword [rbx + 0x40]
mov qword [rbx], rdx
mov qword [rbx + 8], rdx
mov rbp, qword [rsp + 0x68]
mov r12, qword [rsp + 0x50]
mov rdi, qword [rsp + 0x78]
mov rsi, qword [rsp + 0x70]
mov r15, qword [rsp + 0x38]
mov r14, qword [rsp + 0x40]
mov r13, qword [rsp + 0x48]
mov rbx, qword [rsp + 0x60]
add rsp, 0x58
ret
mov rcx, rbx
call fcn.004be660
jmp 0x4bf029