Function at 0x52150220
Capabilities:
Encode data using xor

Disassembly:
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x30
mov r13, qword [rcx + 0x38]
mov rbp, rdx
mov rdx, qword [rcx + 0x20]
mov rsi, rcx
mov rdi, r8
mov r12d, r9d
mov rax, qword [r13 + 0x78]
add rax, 7
and rax, 0xfffffffffffffff8
add rax, r8
cmp rax, rdx
jle 0x52150284
lea rbx, [rdx + r8 + 0x1000]
lea rcx, [r13 + 0x58]
and rbx, 0xfffffffffffff001
cmp qword [r13 + 0x58], 0
je 0x52150355
mov r8, rbx
call fcn.5216ef60
mov r13, qword [rsi + 0x38]
mov qword [rsi + 0x20], rbx
mov r8, qword [r13 + 0x60]
test r8, r8
je 0x521504b0
test rdi, rdi
jle 0x521504e0
lea r9, [rdi + rbp]
mov rdx, rbp
xor eax, eax
mov ecx, eax
add rdx, 1
and ecx, 1
shl rax, cl
movzx ecx, byte [rdx - 1]
xor rax, rcx
cmp r9, rdx
jne 0x521502a3
mov rbx, qword [r13 + 0x68]
lea rdx, [rbx - 1]
and rax, rdx
mov rbx, qword [r8 + rax*8]
lea r14, [rax*8]
test rbx, rbx
jne 0x521502e8
jmp 0x52150320
mov rbx, qword [rbx]
test rbx, rbx
je 0x52150320
cmp qword [rbx + 0x18], rdi
jne 0x521502e0
mov rcx, qword [rbx + 0x10]
add rcx, qword [r13 + 0x58]
mov r8, rdi
mov rdx, rbp
call fcn.52171f40
test eax, eax
jne 0x521502e0
mov rax, rbx
add rsp, 0x30
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
ret
xor edx, edx
mov rcx, rsi
call fcn.5214e2a0
test r12d, r12d
mov rbx, rax
mov rax, qword [rsi + 0x38]
cmove r12d, edi
cmp r12d, 4
mov rcx, qword [rax + 0x78]
ja case.default.0x52150353
lea r8, [0x521814b0]
mov r12d, r12d
movsxd rdx, dword [r8 + r12*4]
add rdx, r8
jmp rdx
mov rdx, rbx
call fcn.5216ef30
jmp 0x5215027c
add rcx, 7
and rcx, 0xfffffffffffffff8
mov qword [rax + 0x78], rcx
mov qword [rbx + 0x10], rcx
add rcx, qword [rax + 0x58]
mov r8, rdi
mov qword [rbx + 0x18], rdi
mov rdx, rbp
call fcn.5216ee90
mov rax, qword [rsi + 0x38]
add r14, qword [rax + 0x60]
add qword [rax + 0x78], rdi
mov rdi, qword [rax + 0x70]
mov rdx, qword [r14]
lea rcx, [rdi + 1]
mov qword [rbx], rdx
mov rdx, qword [rax + 0x68]
mov qword [r14], rbx
mov qword [rax + 0x70], rcx
mov r8, rdx
mov rax, rdx
sar rax, 1
sar r8, 2
add rax, r8
cmp rcx, rax
jle 0x52150305
lea rax, [rdx + rdx]
cmp rdx, rax
jge 0x52150305
lea rcx, [rsp + 0x28]
shl rdx, 4
call fcn.5216ef30
mov r12, qword [rsi + 0x38]
mov rax, qword [r12 + 0x68]
test rax, rax
jle 0x52150469
mov rbp, qword [r12 + 0x60]
mov r11, qword [rsp + 0x28]
lea rdi, [rax + rax - 1]
lea r13, [rbp + rax*8]
mov r8, qword [rbp]
test r8, r8
je 0x52150460
mov r10, qword [r12 + 0x58]
nop
mov r14, qword [r8 + 0x18]
mov r9, qword [r8]
mov rax, qword [r8 + 0x10]
test r14, r14
jle 0x521504f0
add r14, rax
lea rdx, [r10 + rax]
xor eax, eax
add r14, r10
mov ecx, eax
add rdx, 1
and ecx, 1
shl rax, cl
movzx ecx, byte [rdx - 1]
xor rax, rcx
cmp r14, rdx
jne 0x52150430
and rax, rdi
lea rax, [r11 + rax*8]
mov rdx, qword [rax]
test r9, r9
mov qword [r8], rdx
mov qword [rax], r8
mov r8, r9
jne 0x52150410
add rbp, 8
cmp r13, rbp
jne 0x52150400
lea rcx, [r12 + 0x60]
call fcn.5216efb0
mov rax, qword [rsi + 0x38]
mov rdx, qword [rsp + 0x28]
shl qword [rax + 0x68], 1
mov qword [rax + 0x60], rdx
jmp 0x52150305
add rcx, 1
and rcx, 0xfffffffffffffffe
mov qword [rax + 0x78], rcx
jmp case.0x52150353.0
add rcx, 3
and rcx, 0xfffffffffffffffc
mov qword [rax + 0x78], rcx
jmp case.0x52150353.0
lea rcx, [r13 + 0x60]
mov qword [r13 + 0x68], 0x10
mov edx, pe_nt_image_headers64
call fcn.5216ef30
mov r13, qword [rsi + 0x38]
test rdi, rdi
mov r8, qword [r13 + 0x60]
jg 0x5215029a
nop word [rax + rax]
xor eax, eax
jmp 0x521502bb
mov rax, r11
jmp 0x5215044f