Function at 0x4be870
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov rax, rsp
sub rsp, 0x148
mov qword [rax + 8], rbx
mov qword [rax + 0x10], rbp
mov qword [rax + 0x18], rsi
mov qword [rax + 0x20], rdi
mov rdi, rcx
mov rcx, qword [rcx]
cmp word [rcx], 1
mov qword [rax - 0x10], r13
mov rbx, rdx
mov r13d, r8d
je 0x4beb2b
mov esi, dword [rcx + 4]
add rsi, qword [rdi + 0x40]
movzx eax, byte [rsi]
cmp eax, r8d
jne 0x4be94b
movzx ecx, word [rcx + 2]
mov eax, dword [rbx + 8]
movzx r8d, byte [rsi + 1]
xor edx, edx
div ecx
imul eax, r8d
cmp eax, 0x1000000
mov dword [rbx + 8], eax
jae 0x4be93a
nop
nop
nop
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4be8f7
mov rax, qword [rbx]
shr rax, 0x20
je 0x4be925
movzx ecx, byte [rbx + 0xc]
nop
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4be900
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4be8e0
mov rcx, rdi
mov qword [rdi + 0x10], rsi
call fcn.004be040
jmp 0x4bef79
mov dword [rdi + 0x20], 0
movzx r9d, byte [rsi + 1]
mov rdx, rcx
movzx ecx, word [rcx]
dec ecx
nop
movzx eax, byte [rsi + 6]
add rsi, 6
cmp eax, r8d
je 0x4bea8f
movzx eax, byte [rsi + 1]
add r9d, eax
add ecx, 0xffffffff
jne 0x4be960
mov rax, qword [rdi + 0x10]
movzx ecx, byte [rax]
movzx eax, byte [rcx + rdi + 0x3ac]
mov dword [rdi + 0x28], eax
xor eax, eax
mov qword [rsp + rax*8 + 0x30], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x38], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x40], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x48], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x50], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x58], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x60], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x68], 0xffffffffffffffff
add rax, 8
cmp rax, 0x20
jb 0x4be991
movzx eax, byte [rsi]
movzx ecx, word [rdx]
mov byte [rsp + rax + 0x30], 0
dec ecx
movzx eax, byte [rsi - 6]
sub rsi, 6
add ecx, 0xffffffff
mov byte [rsp + rax + 0x30], 0
jne 0x4be9f0
movzx ecx, word [rdx + 2]
mov eax, dword [rbx + 8]
xor edx, edx
div ecx
mov r8d, ecx
mov dword [rbx + 8], eax
sub r8d, r9d
imul eax, r9d
add qword [rbx], rax
mov eax, dword [rbx + 8]
imul eax, r8d
cmp eax, 0x1000000
mov dword [rbx + 8], eax
jae 0x4bed52
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4bea49
mov rax, qword [rbx]
shr rax, 0x20
je 0x4bea75
movzx ecx, byte [rbx + 0xc]
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4bea50
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4bea32
jmp 0x4bed52
movzx ecx, word [rdx + 2]
mov eax, dword [rbx + 8]
movzx r8d, byte [rsi + 1]
xor edx, edx
div ecx
mov dword [rbx + 8], eax
imul eax, r9d
add qword [rbx], rax
mov eax, dword [rbx + 8]
imul eax, r8d
cmp eax, 0x1000000
mov dword [rbx + 8], eax
jae 0x4beb1a
nop
nop
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4bead7
mov rax, qword [rbx]
shr rax, 0x20
je 0x4beb05
movzx ecx, byte [rbx + 0xc]
nop
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4beae0
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4beac0
mov rcx, rdi
mov qword [rdi + 0x10], rsi
call fcn.004bdf90
jmp 0x4bef79
mov r10, qword [rdi]
mov rax, qword [rdi + 0x10]
movzx ecx, byte [rax]
mov rax, qword [rdi + 0x40]
lea rbp, [r10 + 2]
movzx r9d, byte [rcx + rdi + 0x3ac]
mov dword [rdi + 0x28], r9d
mov ecx, dword [r10 + 8]
movzx ecx, word [rcx + rax]
movzx eax, byte [rbp]
movzx edx, byte [rcx + rdi + 0x2ab]
movzx ecx, byte [rax + rdi + 0x3ac]
mov eax, dword [rdi + 0x2c]
sar eax, 0x1a
lea esi, [rdx + rcx*2]
and eax, 0x20
add esi, eax
movzx eax, byte [r10 + 3]
add esi, dword [rdi + 0x20]
shl rax, 6
add esi, r9d
add rsi, rax
movzx eax, byte [rbp]
cmp eax, r8d
jne 0x4bec38
mov ecx, dword [rbx + 8]
movzx eax, word [rdi + rsi*2 + 0xa70]
shr ecx, 0xe
imul ecx, eax
cmp ecx, 0x1000000
mov dword [rbx + 8], ecx
jae 0x4bec0a
nop
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4bebc7
mov rax, qword [rbx]
shr rax, 0x20
je 0x4bebf5
movzx ecx, byte [rbx + 0xc]
nop
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4bebd0
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4bebb0
movzx ecx, word [rdi + rsi*2 + 0xa70]
lea eax, [rcx + 0x20]
sar eax, 7
sub cx, ax
sub cx, 0xff80
mov word [rdi + rsi*2 + 0xa70], cx
mov rcx, rdi
mov qword [rdi + 0x10], rbp
call fcn.004be0d0
jmp 0x4bef79
movzx eax, word [rdi + rsi*2 + 0xa70]
mov ecx, dword [rbx + 8]
shr ecx, 0xe
imul ecx, eax
sub dword [rbx + 8], ecx
mov eax, ecx
add qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jae 0x4becba
nop
nop
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4bec77
mov rax, qword [rbx]
shr rax, 0x20
je 0x4beca5
movzx ecx, byte [rbx + 0xc]
nop
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4bec80
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4bec60
movzx ecx, word [rdi + rsi*2 + 0xa70]
lea eax, [rcx + 0x20]
sar eax, 7
sub cx, ax
movzx eax, cx
lea rcx, [0x004ddce8]
mov word [rdi + rsi*2 + 0xa70], ax
shr rax, 0xa
movzx eax, byte [rax + rcx]
mov dword [rdi + 0x1c], eax
xor eax, eax
nop
nop
mov qword [rsp + rax*8 + 0x30], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x38], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x40], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x48], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x50], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x58], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x60], 0xffffffffffffffff
mov qword [rsp + rax*8 + 0x68], 0xffffffffffffffff
add rax, 8
cmp rax, 0x20
jb 0x4becf0
movzx eax, byte [rbp]
mov dword [rdi + 0x20], 0
mov byte [rsp + rax + 0x30], 0
mov qword [rsp + 0x140], r12
nop
nop
mov rax, qword [rdi]
movzx edx, word [rax]
nop
nop
nop
inc dword [rdi + 0x18]
mov rax, qword [rdi]
mov ecx, dword [rax + 8]
test ecx, ecx
je 0x4bef71
mov r8, rcx
add r8, qword [rdi + 0x40]
mov qword [rdi], r8
movzx eax, word [r8]
cmp eax, edx
je 0x4bed70
lea r8, [rsp + 0x20]
mov rcx, rdi
call fcn.004bdeb0
mov rcx, qword [rdi]
mov r8d, dword [rcx + 4]
movzx r9d, word [rcx]
mov r12, rax
add r8, qword [rdi + 0x40]
xor esi, esi
nop
nop
nop
movzx ecx, byte [r8]
cmp ecx, r13d
je 0x4bee8d
mov rdx, rcx
movzx ecx, byte [r8 + 1]
add r8, 6
movsx eax, byte [rsp + rdx + 0x30]
mov byte [rsp + rdx + 0x30], 0
and ecx, eax
add esi, ecx
add r9d, 0xffffffff
jne 0x4bedc0
mov eax, dword [rbx + 8]
mov r8d, dword [rsp + 0x20]
xor edx, edx
lea ecx, [rsi + r8]
div ecx
mov dword [rbx + 8], eax
imul eax, esi
add qword [rbx], rax
mov eax, dword [rbx + 8]
imul eax, r8d
cmp eax, 0x1000000
mov dword [rbx + 8], eax
jae 0x4bee7f
nop
nop
nop
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4bee37
mov rax, qword [rbx]
shr rax, 0x20
je 0x4bee65
movzx ecx, byte [rbx + 0xc]
nop
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4bee40
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4bee20
mov r8d, dword [rsp + 0x20]
add r8w, si
add word [r12], r8w
jmp 0x4bed60
mov r10d, esi
mov rbp, r8
movzx eax, byte [r8]
add r8, 6
movsx ecx, byte [rsp + rax + 0x30]
movzx eax, byte [r8 - 5]
and ecx, eax
add esi, ecx
add r9d, 0xffffffff
jne 0x4bee93
mov eax, dword [rsp + 0x20]
movzx r8d, byte [rbp + 1]
xor edx, edx
lea ecx, [rsi + rax]
mov eax, dword [rbx + 8]
div ecx
mov dword [rbx + 8], eax
imul eax, r10d
add qword [rbx], rax
mov eax, dword [rbx + 8]
imul eax, r8d
cmp eax, 0x1000000
mov dword [rbx + 8], eax
jae 0x4bef3a
nop
mov ecx, dword [rbx]
shl dword [rbx + 8], 8
cmp ecx, 0xff000000
jb 0x4beef7
mov rax, qword [rbx]
shr rax, 0x20
je 0x4bef25
movzx ecx, byte [rbx + 0xc]
nop
nop
mov rdx, qword [rbx]
mov r8, qword [rbx + 0x18]
shr rdx, 0x20
add dl, cl
mov rcx, r8
call qword [r8]
dec qword [rbx + 0x10]
mov cl, 0xff
jne 0x4bef00
mov ecx, dword [rbx]
mov eax, ecx
shr eax, 0x18
mov byte [rbx + 0xc], al
inc qword [rbx + 0x10]
shl ecx, 8
mov eax, ecx
mov qword [rbx], rax
cmp dword [rbx + 8], 0x1000000
jb 0x4beee0
movzx ecx, byte [r12 + 2]
cmp cl, 7
jae 0x4bef65
add byte [r12 + 3], 0xff
jne 0x4bef65
shl word [r12], 1
mov eax, 3
shl al, cl
inc cl
mov byte [r12 + 2], cl
mov byte [r12 + 3], al
mov rcx, rdi
mov qword [rdi + 0x10], rbp
call fcn.004be120
mov r12, qword [rsp + 0x140]
mov r13, qword [rsp + 0x138]
mov rdi, qword [rsp + 0x168]
mov rsi, qword [rsp + 0x160]
mov rbp, qword [rsp + 0x158]
mov rbx, qword [rsp + 0x150]
add rsp, 0x148
ret