Function at 0x804870
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push r14
push r13
push rdi
push rsi
push rbx
sub rsp, 0x30
mov qword [rsp + 0x28], rcx
mov rcx, qword [rsp + 0x28]
movzx rax, byte [rcx + 0x80]
mov rax, qword [rcx + rax*8 + 0x70]
movzx rax, byte [rax]
sub al, 1
test al, al
je 0x8048c3
sub al, 1
test al, al
je 0x80494b
sub al, 1
test al, al
je 0x8049ce
sub al, 1
test al, al
jne 0x804ba1
jmp 0x804aa2
mov rax, qword [rsp + 0x28]
mov r13d, dword [rax + 0x3c]
add r13d, 1
mov rax, qword [rsp + 0x28]
mov eax, dword [rax + 0x38]
cmp r13d, eax
ja 0x804945
add eax, 1
mov rdx, qword [rsp + 0x28]
movzx rcx, byte [rdx + 0x80]
mov rcx, qword [rdx + rcx*8 + 0x70]
mov edx, r13d
mov r9, qword [rsp + 0x28]
movzx r8, byte [r9 + 0x80]
mov r8, qword [r9 + r8*8 + 0x70]
mov r9d, r13d
mov r11, qword [rsp + 0x28]
movzx r10, byte [r11 + 0x80]
mov r10, qword [r11 + r10*8 + 0x70]
mov r11d, r13d
mov rbx, qword [rsp + 0x28]
sub r11d, dword [rbx + 0x3c]
mov r11d, r11d
movzx r8, byte [r8 + r9]
add r8b, byte [r10 + r11]
and r8b, 0xff
mov byte [rcx + rdx], r8b
add r13d, 1
cmp r13d, eax
jne 0x8048e0
nop
jmp 0x804ba1
mov r13d, 1
mov rax, qword [rsp + 0x28]
mov eax, dword [rax + 0x38]
cmp r13d, eax
ja 0x8049c8
add eax, 1
mov rdx, qword [rsp + 0x28]
movzx rcx, byte [rdx + 0x80]
mov rcx, qword [rdx + rcx*8 + 0x70]
mov edx, r13d
mov r9, qword [rsp + 0x28]
movzx r8, byte [r9 + 0x80]
mov r8, qword [r9 + r8*8 + 0x70]
mov r9d, r13d
mov r10, qword [rsp + 0x28]
cmp byte [r10 + 0x80], 0
sete r10b
movzx r10, r10b
mov r11, qword [rsp + 0x28]
mov r10, qword [r11 + r10*8 + 0x70]
mov r11d, r13d
movzx r8, byte [r8 + r9]
add r8b, byte [r10 + r11]
and r8b, 0xff
mov byte [rcx + rdx], r8b
add r13d, 1
cmp r13d, eax
jne 0x804962
nop
jmp 0x804ba1
mov r13d, 1
mov rax, qword [rsp + 0x28]
mov ecx, dword [rax + 0x38]
cmp r13d, ecx
ja 0x804a9c
add ecx, 1
mov rax, qword [rsp + 0x28]
cmp byte [rax + 0x80], 0
sete al
movzx rax, al
mov rdx, qword [rsp + 0x28]
mov rax, qword [rdx + rax*8 + 0x70]
mov edx, r13d
movzx rax, byte [rax + rdx]
mov edx, r13d
sub edx, 1
mov r8, qword [rsp + 0x28]
cmp edx, dword [r8 + 0x3c]
jae 0x804a24
xor rsi, rsi
jmp 0x804a4a
mov r8, qword [rsp + 0x28]
movzx rdx, byte [r8 + 0x80]
mov rdx, qword [r8 + rdx*8 + 0x70]
mov r8d, r13d
mov r9, qword [rsp + 0x28]
sub r8d, dword [r9 + 0x3c]
mov r8d, r8d
movzx rsi, byte [rdx + r8]
mov r8, qword [rsp + 0x28]
movzx rdx, byte [r8 + 0x80]
mov r8, qword [r8 + rdx*8 + 0x70]
mov r9d, r13d
mov r10, qword [rsp + 0x28]
movzx rdx, byte [r10 + 0x80]
mov r10, qword [r10 + rdx*8 + 0x70]
mov r11d, r13d
add esi, eax
mov ebx, 2
mov eax, esi
cdq
idiv ebx
movzx rdx, byte [r10 + r11]
add dl, al
and dl, 0xff
mov byte [r8 + r9], dl
add r13d, 1
cmp r13d, ecx
jne 0x8049e9
nop
jmp 0x804ba1
xor rsi, rsi
xor rdi, rdi
mov r13d, 1
mov rax, qword [rsp + 0x28]
mov r14d, dword [rax + 0x38]
cmp r13d, r14d
ja 0x804ba0
add r14d, 1
mov rax, qword [rsp + 0x28]
cmp byte [rax + 0x80], 0
sete al
movzx rax, al
mov rcx, qword [rsp + 0x28]
mov rax, qword [rcx + rax*8 + 0x70]
mov ecx, r13d
movzx rax, byte [rax + rcx]
mov ecx, r13d
sub ecx, 1
mov rdx, qword [rsp + 0x28]
cmp ecx, dword [rdx + 0x3c]
jb 0x804b4f
mov rdx, qword [rsp + 0x28]
movzx rcx, byte [rdx + 0x80]
mov rcx, qword [rdx + rcx*8 + 0x70]
mov edx, r13d
mov r8, qword [rsp + 0x28]
sub edx, dword [r8 + 0x3c]
mov edx, edx
movzx rsi, byte [rcx + rdx]
mov rcx, qword [rsp + 0x28]
cmp byte [rcx + 0x80], 0
sete cl
movzx rcx, cl
mov rdx, qword [rsp + 0x28]
mov rcx, qword [rdx + rcx*8 + 0x70]
mov edx, r13d
mov r8, qword [rsp + 0x28]
sub edx, dword [r8 + 0x3c]
mov edx, edx
movzx rdi, byte [rcx + rdx]
mov rdx, qword [rsp + 0x28]
movzx rcx, byte [rdx + 0x80]
mov rcx, qword [rdx + rcx*8 + 0x70]
mov edx, r13d
movzx rbx, byte [rcx + rdx]
mov ecx, esi
mov edx, eax
mov r8d, edi
call fcn.00800300
mov rdx, qword [rsp + 0x28]
movzx rcx, byte [rdx + 0x80]
mov rcx, qword [rdx + rcx*8 + 0x70]
mov edx, r13d
add al, bl
and al, 0xff
mov byte [rcx + rdx], al
add r13d, 1
cmp r13d, r14d
jne 0x804ac5
nop
add rsp, 0x30
pop rbx
pop rsi
pop rdi
pop r13
pop r14
ret