Function at 0x520970
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 rax, qword [rsp + 0xd0]
mov qword [rsp + 0xc0], r8
mov r14, rcx
mov rbx, r9
mov rcx, qword [rsp + 0xc0]
xor r8d, r8d
and ecx, 0xf
je 0x5209b8
mov r8d, 0x10
sub r8, rcx
mov rcx, r8
mov r8d, 1
test r14, r14
je 0x520d54
test rdx, rdx
je 0x520d61
test rax, rax
je 0x520d94
add rcx, qword [rsp + 0xc0]
mov r9, qword [rax]
mov qword [rsp + 0x30], rcx
add rcx, 0x20
mov qword [rax], rcx
test rbx, rbx
je 0x520d47
mov dword [rsp + 0x2c], 9
cmp rcx, r9
ja 0x520b5b
cmp qword [r14], 0
je 0x520d7b
movdqu xmm0, xmmword [str.OAES]
lea rdi, [rbx + 0x20]
mov rcx, rdi
mov qword [rsp + 0x38], rdi
movups xmmword [rbx], xmm0
movzx eax, word [r14 + 8]
mov byte [rbx + 8], r8b
mov r8, qword [rsp + 0xc0]
mov word [rbx + 6], ax
movdqu xmm1, xmmword [r14 + 0xa]
movups xmmword [rbx + 0x10], xmm1
call sym.memcpy
cmp qword [rsp + 0x30], 0
je 0x520d47
mov rax, 0xffffffffffffffe0
mov dword [rsp + 0x2c], 0
movzx r11d, word [r14 + 8]
mov r15, r14
sub rax, rbx
lea rsi, [rsp + 0x50]
mov qword [rsp + 0x40], rax
nop dword [rax]
mov rdx, qword [rsp + 0x38]
add rdx, qword [rsp + 0xc0]
mov eax, 0x10
mov rbx, rsi
sub rdx, rdi
cmp rdx, 0x10
cmova rdx, rax
mov rax, rdi
mov r9d, edx
cmp edx, 8
jae 0x520b70
xor ecx, ecx
test r9b, 4
je 0x520ac0
mov ecx, dword [rax]
mov dword [rbx], ecx
mov ecx, 4
test r9b, 2
je 0x520ad2
movzx ebp, word [rax + rcx]
mov word [rbx + rcx], bp
add rcx, 2
and r9d, 1
je 0x520adf
movzx eax, byte [rax + rcx]
mov byte [rbx + rcx], al
mov ecx, 0x11
mov ebx, 0x10
mov eax, 1
sub rcx, rdx
lea r9, [rsi + rdx]
cmp rbx, rdx
je 0x520b0e
nop word [rax + rax]
mov byte [r9 + rax - 1], al
add rax, 1
cmp rcx, rax
jne 0x520b00
and r11d, 2
jne 0x520d20
mov eax, dword [rsp + 0x2c]
test eax, eax
je 0x520b98
mov rax, qword [rsp + 0x50]
mov rdx, qword [rsp + 0x58]
mov qword [rdi], rax
mov qword [rdi + 8], rdx
movzx r11d, word [r15 + 8]
test r11b, 2
je 0x520b44
mov qword [r15 + 0xa], rax
mov qword [r15 + 0x12], rdx
mov rax, qword [rsp + 0x40]
add rdi, 0x10
add rax, rdi
cmp qword [rsp + 0x30], rax
ja 0x520a80
mov eax, dword [rsp + 0x2c]
add rsp, 0x68
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov ebp, edx
xor eax, eax
and ebp, 0xfffffff8
mov ecx, eax
add eax, 8
mov r8, qword [rdi + rcx]
mov qword [rsi + rcx], r8
cmp eax, ebp
jb 0x520b77
lea rbx, [rsi + rax]
add rax, rdi
jmp 0x520aaf
mov rcx, qword [r15]
test rcx, rcx
je 0x520d6e
mov rdx, qword [rcx + 0x18]
xor ebx, ebx
nop word [rax + rax]
movzx eax, byte [rdx + rbx]
xor byte [rsi + rbx], al
add rbx, 1
cmp rbx, 0x10
jne 0x520bb0
mov rax, qword [rcx + 0x20]
sub rax, 1
cmp rax, 1
jbe 0x520d88
sub rbx, rsi
mov r12d, 1
lea rax, [rsp + 0x58]
mov qword [rsp + 0x48], rdi
lea rcx, [rsp + 0x5c]
lea r14, [rsi + 0x10]
mov qword [rsp + 0xb0], r15
mov rdi, r12
mov r15, rsi
lea rbp, [0x008b6020]
mov rsi, rbx
mov r12, rcx
lea r13, [rsp + 0x54]
mov rbx, rax
nop word [rax + rax]
mov rcx, r15
nop dword [rax + rax]
movzx eax, byte [rcx]
add rcx, 1
mov rdx, rax
and eax, 0xf0
and edx, 0xf
add rax, rbp
movzx eax, byte [rax + rdx]
mov byte [rcx - 1], al
cmp r14, rcx
jne 0x520c20
mov rcx, r15
call sym.oaes_shift_rows
call sym.oaes_mix_cols
mov rcx, r13
call sym.oaes_mix_cols
mov rcx, rbx
call sym.oaes_mix_cols
mov rcx, r12
call sym.oaes_mix_cols
mov rax, qword [rsp + 0xb0]
mov r9, qword [rax]
mov rax, r15
nop dword [rax]
mov rdx, qword [r9 + 0x18]
add rdx, rsi
movzx edx, byte [rdx + rax]
xor byte [rax], dl
add rax, 1
cmp r14, rax
jne 0x520c78
mov rax, qword [r9 + 0x20]
add rdi, 1
add rsi, 0x10
sub rax, 1
cmp rdi, rax
jb 0x520c18
mov rsi, r15
mov rdi, qword [rsp + 0x48]
mov r15, qword [rsp + 0xb0]
mov rcx, rsi
lea r9, [rsp + 0x60]
nop
movzx eax, byte [rcx]
add rcx, 1
mov rdx, rax
and eax, 0xf0
and edx, 0xf
add rax, rbp
movzx eax, byte [rax + rdx]
mov byte [rcx - 1], al
cmp r9, rcx
jne 0x520cc0
mov rcx, rsi
call sym.oaes_shift_rows
mov rdx, qword [r15]
mov rax, qword [rdx + 0x20]
lea rcx, [rax - 1]
xor eax, eax
shl rcx, 4
add rcx, qword [rdx + 0x18]
nop
movzx edx, byte [rcx + rax]
xor byte [rsi + rax], dl
add rax, 1
cmp rax, 0x10
jne 0x520d00
jmp 0x520b20
mov rax, rsi
lea rdx, [r15 + 0xa]
lea r9, [rsp + 0x60]
nop dword [rax]
movzx ecx, byte [rdx]
xor byte [rax], cl
add rax, 1
add rdx, 1
cmp r9, rax
jne 0x520d30
jmp 0x520b18
mov dword [rsp + 0x2c], 0
jmp 0x520b5b
mov dword [rsp + 0x2c], 2
jmp 0x520b5b
mov dword [rsp + 0x2c], 3
jmp 0x520b5b
mov dword [rsp + 0x2c], 1
jmp 0x520b20
mov dword [rsp + 0x2c], 7
jmp 0x520b5b
lea rbp, [0x008b6020]
jmp 0x520cb7
mov dword [rsp + 0x2c], 6
jmp 0x520b5b