Function at 0x5166c0
Capabilities:
Encode data using xor

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbp
push rbx
sub rsp, 0x78
mov rdi, r8
mov r8d, edx
mov rsi, rcx
mov rcx, qword [rcx + 0x10]
mov rdx, rdi
mov dword [rsp + 0x34], r8d
call fcn.004d5160
mov eax, dword [rdi + 0x30]
mov ecx, eax
xor ecx, 0xffffffbf
test ecx, eax
mov qword [rsp + 0x38], rsi
mov qword [rsp + 0x28], rdi
je 0x5167c4
mov rcx, qword [rsi + 0x10]
mov rax, qword [rcx]
cmp byte [rax + 0x67], 0
je 0x516798
lea rax, [0x0213b3e8]
mov cl, byte [rax]
cmp cl, 0x5f
je 0x5167bd
cmp cl, 0x60
jne 0x5167c4
mov rbx, qword [rax + 0x10]
cmp byte [rbx], 0
je 0x5167c4
xor ecx, ecx
mov edx, 0x12
mov rax, rbx
xor r8d, r8d
jmp 0x516773
add r8d, 1
mov rsi, qword [rsp + 0x38]
add rcx, 1
movsxd rbp, r8d
lea rax, [rbx + rbp]
add rdx, 0x18
cmp byte [rbx + rbp], 0
mov rdi, qword [rsp + 0x28]
je 0x5167c4
mov rdi, qword [rdi + 8]
movzx ebp, word [rdi + rdx]
mov edi, ebp
xor edi, 0xffdf
test edi, ebp
jne 0x516759
mov esi, ebp
xor esi, 0xffbf
test esi, ebp
je 0x516750
mov byte [rax], 0x40
jmp 0x516750
mov eax, dword [rcx + 0x90]
add eax, 0xffffffff
cdqe
lea rax, [rax + rax*2]
shl rax, 3
add rax, qword [rcx + 0x88]
mov cl, byte [rax]
cmp cl, 0x5f
jne 0x516727
mov dword [rax + 0xc], 1
movzx eax, word [rdi + 0x36]
test ax, ax
jle 0x516845
movzx ecx, ax
cmp ecx, 1
mov edx, 1
cmova edx, ecx
mov rcx, qword [rsp + 0x28]
mov r10, qword [rcx + 8]
mov r8d, edx
and r8d, 1
cmp ax, 1
jne 0x516b5b
xor ecx, ecx
test r8, r8
mov rsi, qword [rsp + 0x38]
je 0x516845
lea rdx, [rcx + rcx*2]
movzx ebp, word [r10 + rdx*8 + 0x12]
mov ecx, ebp
xor ecx, 0xff9f
test cx, bp
je 0x516845
lea rcx, [r10 + rdx*8]
add rcx, 0x12
mov ebx, ebp
not ebx
and ebx, 0xffff8d44
mov edx, ebp
and edx, 0x72bb
or edx, ebx
xor edx, 0xffff8dc4
and ebp, 0x80
or ebp, edx
mov word [rcx], bp
movabs r12, 0x3a3881c999ee65b7
mov rbp, qword [rsp + 0x28]
mov qword [rsp + 0x70], rbp
lea rcx, [0x0051aeb0]
mov qword [rsp + 0x50], rcx
mov ecx, dword [rsp + 0x34]
neg ecx
xorps xmm0, xmm0
movups xmmword [rsp + 0x58], xmm0
mov dword [rsi + 0x40], ecx
nop word cs:[rax + rax]
test ax, ax
jle 0x516b43
xor r14d, r14d
xor eax, eax
mov qword [rsp + 0x40], rax
xor edi, edi
jmp 0x5168e2
movsx r9d, cx
add r9d, dword [rsp + 0x34]
mov rcx, rsi
mov rdx, rbp
mov r8, r15
call fcn.004ca9d0
movzx eax, word [r15 + 0x12]
mov ecx, eax
xor ecx, 0x80
and ecx, eax
mov word [r15 + 0x12], cx
mov edi, 1
add r14, 1
movsx rax, word [rbp + 0x36]
cmp r14, rax
jge 0x516b10
cmp r14, 1
mov r13d, 1
cmova r13, r14
mov rcx, qword [rbp + 8]
lea rdx, [r14 + r14*2]
movzx ebx, word [rcx + rdx*8 + 0x12]
test bl, bl
jns 0x5168d0
lea r15, [rcx + rdx*8]
mov eax, ebx
and eax, 0x100
mov ebp, ebx
xor ebp, 0x100
or ebp, eax
mov word [r15 + 0x12], bp
mov rbp, qword [rsp + 0x28]
mov word [rsp + 0x6c], 0
movzx ecx, word [rcx + rdx*8 + 0x10]
test ecx, ecx
je 0x51693a
cmp byte [rbp + 0x3f], 0
je 0x5169ba
mov eax, ebx
xor eax, 0x100
and eax, ebx
mov word [r15 + 0x12], ax
mov ecx, r14d
mov eax, dword [rbp + 0x30]
mov edx, eax
xor edx, 0xffffffdf
test edx, eax
je 0x5168a0
test cx, cx
js 0x5168a0
mov r10, qword [rbp + 8]
movzx edi, word [r10 + 0x12]
and edi, 0x20
test cx, cx
je 0x516a0e
mov r8, r14
shl r8, 0x10
sar r8, 0x10
cmp r8, 1
mov eax, 1
cmovbe r8, rax
movabs rax, 0x3bbd9c76367c0483
mov r9d, eax
not r9d
or r9d, eax
and r9d, r13d
and r9d, 1
cmp r14, 2
jae 0x516a21
xor edx, edx
xor ecx, ecx
jmp 0x516abe
mov rdx, qword [rbp + 0x50]
test rdx, rdx
je 0x51693a
cmp dword [rdx], ecx
jl 0x51693a
add ecx, 0xffffffff
movsxd rax, ecx
shl rax, 5
mov rdx, qword [rdx + rax + 8]
test rdx, rdx
je 0x51693a
lea rcx, [rsp + 0x48]
call fcn.004cea30
mov al, byte [rsp + 0x6c]
and word [r15 + 0x12], 0xfeff
test al, al
jns 0x516948
mov qword [rsp + 0x40], r15
jmp 0x5168d0
xor r8d, r8d
xor ecx, ecx
test di, di
jne 0x516af2
jmp 0x5168a0
movabs r11, 0x7ffffffffffffffe
xor r11, r13
not r11
and r11, r13
xor edx, edx
xor ecx, ecx
nop dword [rax + rax]
movzx ebp, di
shr ebp, 5
mov edi, ebp
not edi
and edi, 1
and ebp, 0xfffffffe
or ebp, edi
add ecx, ebp
mov rax, rdx
not rax
mov rbp, r12
not rbp
mov rdi, rax
and rdi, r12
mov rsi, rdx
and rsi, rbp
or rsi, rdi
mov rdi, r12
and rdi, 0xfffffffffffffffe
mov ebx, ebp
and ebx, 1
or rbx, rdi
xor rbx, rsi
not eax
or ebp, r12d
and ebp, eax
and ebp, 1
or rbp, rbx
lea rax, [rbp*2]
add rax, rbp
movzx eax, byte [r10 + rax*8 + 0x12]
and al, 0x20
cmp al, 1
adc cx, 0
add rdx, 2
lea rax, [rdx + rdx*2]
movzx edi, word [r10 + rax*8 + 0x12]
and edi, 0x20
add r11, 0xfffffffffffffffe
jne 0x516a40
test r9, r9
je 0x516adf
lea rax, [rdx + rdx*2]
movzx eax, word [r10 + rax*8 + 0x2a]
movzx edx, di
mov edi, eax
xor edi, 0xffffffdf
and edi, eax
shr edx, 5
xor edx, 1
add ecx, edx
mov rsi, qword [rsp + 0x38]
mov rbp, qword [rsp + 0x28]
test di, di
je 0x5168a0
sub r8d, ecx
add r8w, word [rbp + 0x38]
mov ecx, r8d
jmp 0x5168a0
mov rbx, qword [rsp + 0x40]
test rbx, rbx
sete cl
test edi, edi
setne dl
cmp dl, cl
je 0x516b2c
test edi, edi
jne 0x516880
test rbx, rbx
je 0x516b43
mov r8, qword [rbx]
lea rdx, [0x00602e08]
mov rcx, rsi
call fcn.00419aa0
mov dword [rsi + 0x40], 0
add rsp, 0x78
pop rbx
pop rbp
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret
mov r9d, edx
xor r9d, 1
and r9d, edx
lea rdi, [r10 + 0x12]
xor ecx, ecx
mov rbx, r9
jmp 0x516b85
add rcx, 2
add rbx, 0xfffffffffffffffe
add rdi, 0x30
cmp r9, rcx
je 0x5167f7
movzx esi, word [rdi]
mov edx, esi
xor edx, 0xff9f
test dx, si
je 0x516ba8
mov edx, esi
and edx, 0x80
xor esi, 0x80
or esi, edx
mov word [rdi], si
mov edx, ecx
and edx, 1
mov rbp, rcx
xor rbp, 1
or rbp, rdx
lea rbp, [rbp + rbp*2]
movzx esi, word [r10 + rbp*8 + 0x12]
mov edx, esi
xor edx, 0xff9f
test dx, si
je 0x516b70
lea r11, [r10 + rbp*8]
add r11, 0x12
mov edx, esi
not edx
and edx, 0x6b9d
mov ebp, esi
and ebp, 0xffff9462
or ebp, edx
xor ebp, 0x6b1d
and esi, 0x80
or esi, ebp
mov word [r11], si
jmp 0x516b70