Function at 0x518590
Capabilities:
Encode data using xor
Encrypt data using aes
Reference aes constants

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x68
mov r13, qword [rsp + 0xd0]
mov rbx, rcx
mov rsi, rdx
mov r12, r9
test rcx, rcx
je 0x518920
test rdx, rdx
je 0x518930
mov eax, 4
test r8b, 0xf
jne 0x518615
test r13, r13
je 0x518940
sub r8, 0x20
mov rdx, qword [r13]
mov qword [r13], r8
test r9, r9
je 0x518918
mov eax, 9
cmp r8, rdx
ja 0x518615
cmp qword [rcx], 0
je 0x5189c0
mov eax, dword [str.OAES]
cmp dword [rsi], eax
jne 0x518610
cmp byte [rsi + 4], 1
je 0x518630
mov eax, 0xa
add rsp, 0x68
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
cmp byte [rsi + 5], 2
jne 0x518610
movzx edi, word [rsi + 6]
test edi, 0xfffc
jne 0x518610
mov eax, edi
and eax, 3
cmp ax, 3
je 0x518610
test di, di
je 0x518610
movzx eax, byte [rsi + 8]
mov byte [rsp + 0x37], al
test al, 0xfe
jne 0x518610
movdqu xmm2, xmmword [rsi + 0x10]
mov rcx, r9
lea rdx, [rsi + 0x20]
movups xmmword [rsp + 0x50], xmm2
call sym.memcpy
mov rcx, qword [r13]
test rcx, rcx
je 0x518893
and edi, 2
lea rbp, [r12 + 0x10]
lea rax, [r12 + 4]
mov qword [rsp + 0xd0], r13
mov word [rsp + 0x34], di
mov r13, rbp
xor edi, edi
lea r14, [0x0091a680]
mov dword [rsp + 0x30], 0
mov qword [rsp + 0x48], rax
mov qword [rsp + 0xb8], rsi
mov qword [rsp + 0xc8], r12
jmp 0x5186f8
cmp word [rsp + 0x34], 0
jne 0x518950
mov rax, qword [rsp + 0xd0]
add rdi, 0x10
mov rcx, qword [rax]
cmp rdi, rcx
jae 0x518888
add r13, 0x10
mov eax, dword [rsp + 0x30]
test eax, eax
jne 0x5186d0
sub rcx, rdi
cmp rcx, 0xf
jbe 0x5189d0
mov r10, qword [rbx]
test r10, r10
je 0x5189d0
mov rbp, qword [rsp + 0xc8]
xor ecx, ecx
add rbp, rdi
mov rsi, rbp
jmp 0x518733
mov r10, qword [rbx]
mov rax, qword [r10 + 0x20]
sub rax, 1
shl rax, 4
add rax, qword [r10 + 0x18]
movzx eax, byte [rax + rcx]
xor byte [rbp + rcx], al
add rcx, 1
cmp rcx, 0x10
jne 0x518730
mov rax, qword [rbx]
mov r12, qword [rax + 0x20]
sub r12, 2
je 0x518837
mov rcx, qword [rsp + 0xc8]
mov rax, qword [rsp + 0x48]
mov r10, r12
mov qword [rsp + 0x38], rsi
shl r10, 4
mov qword [rsp + 0x40], rdi
lea rcx, [rcx + rdi + 8]
add rax, rdi
sub r10, rbp
mov qword [rsp + 0x20], rcx
mov rcx, qword [rsp + 0xc8]
mov rsi, rax
lea rcx, [rcx + rdi + 0xc]
mov rdi, r10
mov r15, rcx
nop word [rax + rax]
mov rcx, rbp
call sym.oaes_inv_shift_rows
nop dword [rax + rax]
movzx eax, byte [rcx]
add rcx, 1
mov rdx, rax
and eax, 0xf0
and edx, 0xf
add rax, r14
movzx eax, byte [rax + rdx]
mov byte [rcx - 1], al
cmp r13, rcx
jne 0x5187c0
mov rax, rbp
nop dword [rax]
mov rdx, qword [rbx]
mov rcx, qword [rdx + 0x18]
add rcx, rdi
movzx edx, byte [rcx + rax]
xor byte [rax], dl
add rax, 1
cmp r13, rax
jne 0x5187e8
mov rcx, rbp
sub rdi, 0x10
call sym.oaes_inv_mix_cols
mov rcx, rsi
call sym.oaes_inv_mix_cols
mov rcx, qword [rsp + 0x20]
call sym.oaes_inv_mix_cols
mov rcx, r15
call sym.oaes_inv_mix_cols
sub r12, 1
jne 0x5187b0
mov rsi, qword [rsp + 0x38]
mov rdi, qword [rsp + 0x40]
mov rcx, rbp
call sym.oaes_inv_shift_rows
nop
movzx eax, byte [rbp]
add rbp, 1
mov rdx, rax
and eax, 0xf0
and edx, 0xf
add rax, r14
movzx eax, byte [rax + rdx]
mov byte [rbp - 1], al
cmp r13, rbp
jne 0x518840
xor eax, eax
nop dword [rax]
mov rdx, qword [rbx]
mov rdx, qword [rdx + 0x18]
movzx edx, byte [rdx + rax]
xor byte [rsi + rax], dl
add rax, 1
cmp rax, 0x10
jne 0x518868
jmp 0x5186d0
mov r12, qword [rsp + 0xc8]
mov r13, rax
test byte [rsp + 0x37], 1
je 0x518918
movzx ebx, byte [r12 + rcx - 1]
lea rax, [rbx - 1]
cmp rax, 0xe
ja 0x518610
mov r10, rcx
mov edx, 1
xor r11d, r11d
sub r10, rbx
add r10, r12
jmp 0x5188d9
movzx r8d, byte [r10 + rax - 1]
cmp r8, rax
cmovne edx, r11d
sub rax, 1
test rax, rax
jne 0x5188c8
test edx, edx
je 0x518610
sub rcx, rbx
lea r9, [r12 + rcx]
cmp ebx, 8
jae 0x5189dd
test bl, 4
jne 0x518a07
test ebx, ebx
je 0x518910
mov byte [r9], 0
test bl, 2
jne 0x518a1c
sub qword [r13], rbx
nop dword [rax]
xor eax, eax
jmp 0x518615
mov eax, 2
jmp 0x518615
mov eax, 3
jmp 0x518615
mov eax, 6
jmp 0x518615
mov rdx, qword [rsp + 0xc8]
lea rax, [rsp + 0x50]
lea r10, [rsp + 0x60]
add rdx, rdi
nop dword [rax]
movzx ecx, byte [rax]
add rax, 1
xor byte [rdx], cl
add rdx, 1
cmp r10, rax
jne 0x518968
mov rax, qword [rsp + 0xd0]
add rdi, 0x10
mov rcx, qword [rax]
cmp rcx, rdi
jbe 0x518888
test rdi, rdi
je 0x5186f4
mov rax, qword [rsp + 0xb8]
movdqu xmm0, xmmword [rax + rdi + 0x10]
movups xmmword [rsp + 0x20], xmm0
movups xmmword [rsp + 0x50], xmm0
jmp 0x5186f4
mov eax, 7
jmp 0x518615
mov dword [rsp + 0x30], 1
jmp 0x5186d0
lea rdi, [r9 + 8]
mov qword [r9], 0
mov qword [rbx + r9 - 8], 0
and rdi, 0xfffffffffffffff8
sub r9, rdi
lea ecx, [rbx + r9]
shr ecx, 3
rep stosq qword [rdi], rax
jmp 0x518910
mov dword [r9], 0
mov dword [rbx + r9 - 4], 0
jmp 0x518910
mov word [rbx + r9 - 2], 0
jmp 0x518910