Function at 0x140021cc4
Capabilities:
Encode data using xor

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rsi
push rdi
sub rsp, 0x20
mov rdx, qword [rsp + 0x50]
xor esi, esi
mov rbx, qword [rcx + 0x38]
test rdx, rdx
jne 0x140021d31
mov r8d, 0xc000000d
test rbx, rbx
je 0x140021fe5
cmp dword [rbx + 8], 8
jae 0x140021fe5
mov eax, dword [rbx + 8]
lea edi, [rsi + 1]
lea rcx, [rax + rax*2]
mov dword [rbx + rcx*4 + 0x10], 2
mov ecx, dword [rbx + 8]
lea rdx, [rcx + rcx*2]
mov dword [rbx + rdx*4 + 0x14], r8d
mov ecx, dword [rbx + 8]
add rcx, 2
lea rcx, [rcx + rcx*2]
mov dword [rbx + rcx*4], 0x40
jmp 0x140021fe2
mov r8, qword [rsp + 0x58]
mov dword [rcx], 0xbee0bee0
test r8, r8
je 0x140021d62
mov rax, qword [r8]
mov qword [rcx + 0x18], rax
mov rax, qword [r8 + 8]
mov qword [rcx + 0x20], rax
mov rax, qword [r8 + 0x18]
mov qword [rcx + 0x28], rax
mov rax, qword [r8 + 0x20]
mov qword [rcx + 0x30], rax
jmp 0x140021d72
mov qword [rcx + 0x18], rsi
mov qword [rcx + 0x20], rsi
mov qword [rcx + 0x28], rsi
mov qword [rcx + 0x30], rsi
mov qword [rcx + 0x90], rsi
lea rax, [rcx + 0x5c8]
mov dword [rcx + 0xbc], esi
mov edi, 1
mov dword [rcx + 0x78], edi
mov dword [rcx + 0xc0], 2
or dword [rcx + 0x380], 0xffffffff
mov dword [rcx + 0x368], esi
lea r9d, [rdi + 0x17]
mov qword [rcx + 0x370], rsi
mov r8d, r9d
mov qword [rcx + 0x378], rsi
mov dword [rcx + 0x5d8], esi
mov qword [rax + 8], rax
mov qword [rax], rax
lea rax, [rcx + 0x398]
mov dword [rax - 8], esi
mov qword [rax], rsi
mov dword [rax - 0x10], esi
add rax, r9
sub r8, rdi
jne 0x140021dce
or dword [rcx + 0x108], 0xffffffff
lea rax, [rcx + 0x350]
mov dword [rcx + 0xf0], esi
mov r8, r9
mov qword [rcx + 0xf8], rsi
mov qword [rcx + 0x100], rsi
mov dword [rcx + 0x360], esi
mov qword [rax + 8], rax
mov qword [rax], rax
lea rax, [rcx + 0x120]
mov dword [rax - 8], esi
mov qword [rax], rsi
mov dword [rax - 0x10], esi
add rax, r9
sub r8, rdi
jne 0x140021e18
and byte [rcx + 0x7c], 0xfc
lea rax, [0x140024ff0]
mov qword [rcx + 8], rax
lea rax, [0x1400250a0]
mov qword [rcx + 0x10], rax
mov dword [rcx + 0x48], esi
mov qword [rcx + 0x50], rsi
mov qword [rcx + 0x58], rsi
mov byte [rcx + 0x7d], sil
mov dword [rcx + 0x74], 0x1000
mov dword [rcx + 0x60], esi
mov qword [rcx + 0x68], rsi
mov qword [rcx + 0x80], rsi
mov qword [rcx + 0x88], rsi
mov dword [rcx + 0xa0], esi
mov dword [rcx + 0xac], 0x10000
mov qword [rcx + 0xb0], rsi
cmp dword [rdx], 0x66676572
jne 0x140021fa4
cmp dword [rdx + 0x1c], esi
jne 0x140021fa4
mov r10d, dword [rdx + 0x14]
cmp r10d, edi
ja 0x140021fa4
mov r11d, dword [rdx + 0x18]
lea eax, [r11 - 3]
cmp eax, 2
ja 0x140021fa4
cmp dword [rdx + 0x20], edi
jne 0x140021fa4
mov eax, dword [rdx + 0x28]
test eax, eax
je 0x140021fa4
test eax, 0xfff
jne 0x140021fa4
cmp eax, 0x7fffe000
ja 0x140021fa4
mov eax, esi
mov r8, rdx
mov r9d, 0x7f
xor eax, dword [r8]
lea r8, [r8 + 4]
sub r9, rdi
jne 0x140021eed
cmp eax, 0xffffffff
mov r8d, 0xfffffffe
cmove eax, r8d
test eax, eax
cmove eax, edi
cmp eax, dword [rdx + 0x1fc]
jne 0x140021fa4
and byte [rcx + 0x7c], 0xfd
lea eax, [r10 - 1]
mov qword [rcx + 0x40], rdx
shl eax, 0xc
add eax, r11d
mov dword [rcx + 0xc0], edi
mov dword [rcx + 0xc4], eax
mov dword [rdx + 0xff8], esi
mov eax, dword [rdx + 4]
add rdx, 0x1000
mov dword [rcx + 0x98], eax
mov dword [rcx + 0xa4], eax
mov dword [rcx + 0x9c], eax
call fcn.140025a20
test eax, eax
jns 0x140021fa0
mov r8d, 0xc000014c
test rbx, rbx
je 0x140021fe5
cmp dword [rbx + 8], 8
jae 0x140021fe5
mov ecx, dword [rbx + 8]
lea rdx, [rcx + rcx*2]
mov dword [rbx + rdx*4 + 0x10], 2
mov ecx, dword [rbx + 8]
lea rdx, [rcx + rcx*2]
mov dword [rbx + rdx*4 + 0x14], r8d
mov ecx, dword [rbx + 8]
add rcx, 2
lea rcx, [rcx + rcx*2]
mov dword [rbx + rcx*4], 0xa0
jmp 0x140021fe2
xor eax, eax
jmp 0x140021fe8
mov r8d, 0xc000014c
test rbx, rbx
je 0x140021fe5
cmp dword [rbx + 8], 8
jae 0x140021fe5
mov eax, dword [rbx + 8]
lea rcx, [rax + rax*2]
mov dword [rbx + rcx*4 + 0x10], 2
mov eax, dword [rbx + 8]
lea rcx, [rax + rax*2]
mov dword [rbx + rcx*4 + 0x14], r8d
mov eax, dword [rbx + 8]
add rax, 2
lea rax, [rax + rax*2]
mov dword [rbx + rax*4], 0x80
add dword [rbx + 8], edi
mov eax, r8d
mov rbx, qword [rsp + 0x30]
mov rsi, qword [rsp + 0x38]
add rsp, 0x20
pop rdi
ret